package o2;

import j2.b1;
import j2.g0;
import j2.s1;
import j2.x0;
import l1.i;

/* loaded from: classes.dex */
public abstract class n {
    public static final m a(g0 g0Var, boolean z10) {
        int i10;
        x0 k02 = g0Var.k0();
        int a10 = b1.a(8);
        i10 = k02.i();
        Object obj = null;
        if ((i10 & a10) != 0) {
            i.c k10 = k02.k();
            loop0: while (true) {
                if (k10 == null) {
                    break;
                }
                if ((k10.J1() & a10) != 0) {
                    i.c cVar = k10;
                    a1.b bVar = null;
                    while (cVar != null) {
                        if (cVar instanceof s1) {
                            obj = cVar;
                            break loop0;
                        }
                        if (((cVar.J1() & a10) != 0) && (cVar instanceof j2.m)) {
                            int i11 = 0;
                            for (i.c i22 = ((j2.m) cVar).i2(); i22 != null; i22 = i22.F1()) {
                                if ((i22.J1() & a10) != 0) {
                                    i11++;
                                    if (i11 == 1) {
                                        cVar = i22;
                                    } else {
                                        if (bVar == null) {
                                            bVar = new a1.b(new i.c[16], 0);
                                        }
                                        if (cVar != null) {
                                            bVar.c(cVar);
                                            cVar = null;
                                        }
                                        bVar.c(i22);
                                    }
                                }
                            }
                            if (i11 == 1) {
                            }
                        }
                        cVar = j2.k.g(bVar);
                    }
                }
                if ((k10.E1() & a10) == 0) {
                    break;
                }
                k10 = k10.F1();
            }
        }
        kotlin.jvm.internal.t.d(obj);
        i.c P0 = ((s1) obj).P0();
        i I = g0Var.I();
        kotlin.jvm.internal.t.d(I);
        return new m(P0, z10, g0Var, I);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final int e(m mVar) {
        return mVar.o() + 2000000000;
    }

    public static final g0 f(g0 g0Var, dn.l lVar) {
        for (g0 o02 = g0Var.o0(); o02 != null; o02 = o02.o0()) {
            if (((Boolean) lVar.invoke(o02)).booleanValue()) {
                return o02;
            }
        }
        return null;
    }

    public static final s1 g(g0 g0Var) {
        int i10;
        x0 k02 = g0Var.k0();
        int a10 = b1.a(8);
        i10 = k02.i();
        Object obj = null;
        if ((i10 & a10) != 0) {
            i.c k10 = k02.k();
            loop0: while (true) {
                if (k10 == null) {
                    break;
                }
                if ((k10.J1() & a10) != 0) {
                    i.c cVar = k10;
                    a1.b bVar = null;
                    while (cVar != null) {
                        if (cVar instanceof s1) {
                            if (((s1) cVar).v1()) {
                                obj = cVar;
                                break loop0;
                            }
                        } else if (((cVar.J1() & a10) != 0) && (cVar instanceof j2.m)) {
                            int i11 = 0;
                            for (i.c i22 = ((j2.m) cVar).i2(); i22 != null; i22 = i22.F1()) {
                                if ((i22.J1() & a10) != 0) {
                                    i11++;
                                    if (i11 == 1) {
                                        cVar = i22;
                                    } else {
                                        if (bVar == null) {
                                            bVar = new a1.b(new i.c[16], 0);
                                        }
                                        if (cVar != null) {
                                            bVar.c(cVar);
                                            cVar = null;
                                        }
                                        bVar.c(i22);
                                    }
                                }
                            }
                            if (i11 == 1) {
                            }
                        }
                        cVar = j2.k.g(bVar);
                    }
                }
                if ((k10.E1() & a10) == 0) {
                    break;
                }
                k10 = k10.F1();
            }
        }
        return (s1) obj;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final f h(m mVar) {
        return (f) j.a(mVar.w(), p.f30605a.y());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final int i(m mVar) {
        return mVar.o() + 1000000000;
    }
}
