package j2;

import l1.i;

/* loaded from: classes.dex */
public abstract class y1 {
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r3v10, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r3v11, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r3v12 */
    /* JADX WARN: Type inference failed for: r3v13 */
    /* JADX WARN: Type inference failed for: r3v14 */
    /* JADX WARN: Type inference failed for: r3v15 */
    /* JADX WARN: Type inference failed for: r3v16 */
    /* JADX WARN: Type inference failed for: r3v17 */
    /* JADX WARN: Type inference failed for: r3v6 */
    /* JADX WARN: Type inference failed for: r3v7, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r3v9 */
    /* JADX WARN: Type inference failed for: r4v0 */
    /* JADX WARN: Type inference failed for: r4v1 */
    /* JADX WARN: Type inference failed for: r4v10 */
    /* JADX WARN: Type inference failed for: r4v11 */
    /* JADX WARN: Type inference failed for: r4v2 */
    /* JADX WARN: Type inference failed for: r4v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r4v4 */
    /* JADX WARN: Type inference failed for: r4v5 */
    /* JADX WARN: Type inference failed for: r4v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r4v8 */
    /* JADX WARN: Type inference failed for: r4v9 */
    public static final x1 a(j jVar, Object obj) {
        x0 k02;
        int a10 = b1.a(262144);
        if (!jVar.P0().O1()) {
            throw new IllegalStateException("visitAncestors called on an unattached node".toString());
        }
        i.c L1 = jVar.P0().L1();
        g0 m10 = k.m(jVar);
        while (m10 != null) {
            if ((m10.k0().k().E1() & a10) != 0) {
                while (L1 != null) {
                    if ((L1.J1() & a10) != 0) {
                        m mVar = L1;
                        ?? r42 = 0;
                        while (mVar != 0) {
                            if (mVar instanceof x1) {
                                x1 x1Var = (x1) mVar;
                                if (kotlin.jvm.internal.t.b(obj, x1Var.N())) {
                                    return x1Var;
                                }
                            } else {
                                if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                    i.c i22 = mVar.i2();
                                    int i10 = 0;
                                    mVar = mVar;
                                    r42 = r42;
                                    while (i22 != null) {
                                        if ((i22.J1() & a10) != 0) {
                                            i10++;
                                            r42 = r42;
                                            if (i10 == 1) {
                                                mVar = i22;
                                            } else {
                                                if (r42 == 0) {
                                                    r42 = new a1.b(new i.c[16], 0);
                                                }
                                                if (mVar != 0) {
                                                    r42.c(mVar);
                                                    mVar = 0;
                                                }
                                                r42.c(i22);
                                            }
                                        }
                                        i22 = i22.F1();
                                        mVar = mVar;
                                        r42 = r42;
                                    }
                                    if (i10 == 1) {
                                    }
                                }
                            }
                            mVar = k.g(r42);
                        }
                    }
                    L1 = L1.L1();
                }
            }
            m10 = m10.o0();
            L1 = (m10 == null || (k02 = m10.k0()) == null) ? null : k02.o();
        }
        return null;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r4v10, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r4v11, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r4v12 */
    /* JADX WARN: Type inference failed for: r4v13 */
    /* JADX WARN: Type inference failed for: r4v14 */
    /* JADX WARN: Type inference failed for: r4v15 */
    /* JADX WARN: Type inference failed for: r4v16 */
    /* JADX WARN: Type inference failed for: r4v17 */
    /* JADX WARN: Type inference failed for: r4v6 */
    /* JADX WARN: Type inference failed for: r4v7, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r4v9 */
    /* JADX WARN: Type inference failed for: r5v0 */
    /* JADX WARN: Type inference failed for: r5v1 */
    /* JADX WARN: Type inference failed for: r5v10 */
    /* JADX WARN: Type inference failed for: r5v11 */
    /* JADX WARN: Type inference failed for: r5v2 */
    /* JADX WARN: Type inference failed for: r5v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v4 */
    /* JADX WARN: Type inference failed for: r5v5 */
    /* JADX WARN: Type inference failed for: r5v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v8 */
    /* JADX WARN: Type inference failed for: r5v9 */
    public static final x1 b(x1 x1Var) {
        x0 k02;
        int a10 = b1.a(262144);
        if (!x1Var.P0().O1()) {
            throw new IllegalStateException("visitAncestors called on an unattached node".toString());
        }
        i.c L1 = x1Var.P0().L1();
        g0 m10 = k.m(x1Var);
        while (m10 != null) {
            if ((m10.k0().k().E1() & a10) != 0) {
                while (L1 != null) {
                    if ((L1.J1() & a10) != 0) {
                        m mVar = L1;
                        ?? r52 = 0;
                        while (mVar != 0) {
                            if (mVar instanceof x1) {
                                x1 x1Var2 = (x1) mVar;
                                if (kotlin.jvm.internal.t.b(x1Var.N(), x1Var2.N()) && l1.b.a(x1Var, x1Var2)) {
                                    return x1Var2;
                                }
                            } else {
                                if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                    i.c i22 = mVar.i2();
                                    int i10 = 0;
                                    mVar = mVar;
                                    r52 = r52;
                                    while (i22 != null) {
                                        if ((i22.J1() & a10) != 0) {
                                            i10++;
                                            r52 = r52;
                                            if (i10 == 1) {
                                                mVar = i22;
                                            } else {
                                                if (r52 == 0) {
                                                    r52 = new a1.b(new i.c[16], 0);
                                                }
                                                if (mVar != 0) {
                                                    r52.c(mVar);
                                                    mVar = 0;
                                                }
                                                r52.c(i22);
                                            }
                                        }
                                        i22 = i22.F1();
                                        mVar = mVar;
                                        r52 = r52;
                                    }
                                    if (i10 == 1) {
                                    }
                                }
                            }
                            mVar = k.g(r52);
                        }
                    }
                    L1 = L1.L1();
                }
            }
            m10 = m10.o0();
            L1 = (m10 == null || (k02 = m10.k0()) == null) ? null : k02.o();
        }
        return null;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r12v0, types: [dn.l] */
    /* JADX WARN: Type inference failed for: r2v11 */
    /* JADX WARN: Type inference failed for: r2v12, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r2v13, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r2v14 */
    /* JADX WARN: Type inference failed for: r2v15 */
    /* JADX WARN: Type inference failed for: r2v16 */
    /* JADX WARN: Type inference failed for: r2v17 */
    /* JADX WARN: Type inference failed for: r2v18 */
    /* JADX WARN: Type inference failed for: r2v19 */
    /* JADX WARN: Type inference failed for: r2v6 */
    /* JADX WARN: Type inference failed for: r2v7, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r4v0 */
    /* JADX WARN: Type inference failed for: r4v1 */
    /* JADX WARN: Type inference failed for: r4v10 */
    /* JADX WARN: Type inference failed for: r4v11 */
    /* JADX WARN: Type inference failed for: r4v2 */
    /* JADX WARN: Type inference failed for: r4v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r4v4 */
    /* JADX WARN: Type inference failed for: r4v5 */
    /* JADX WARN: Type inference failed for: r4v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r4v8 */
    /* JADX WARN: Type inference failed for: r4v9 */
    public static final void c(j jVar, Object obj, dn.l lVar) {
        x0 k02;
        int a10 = b1.a(262144);
        if (!jVar.P0().O1()) {
            throw new IllegalStateException("visitAncestors called on an unattached node".toString());
        }
        i.c L1 = jVar.P0().L1();
        g0 m10 = k.m(jVar);
        while (m10 != null) {
            if ((m10.k0().k().E1() & a10) != 0) {
                while (L1 != null) {
                    if ((L1.J1() & a10) != 0) {
                        m mVar = L1;
                        ?? r42 = 0;
                        while (mVar != 0) {
                            if (mVar instanceof x1) {
                                x1 x1Var = (x1) mVar;
                                if (!(kotlin.jvm.internal.t.b(obj, x1Var.N()) ? ((Boolean) lVar.invoke(x1Var)).booleanValue() : true)) {
                                    return;
                                }
                            } else {
                                if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                    i.c i22 = mVar.i2();
                                    int i10 = 0;
                                    mVar = mVar;
                                    r42 = r42;
                                    while (i22 != null) {
                                        if ((i22.J1() & a10) != 0) {
                                            i10++;
                                            r42 = r42;
                                            if (i10 == 1) {
                                                mVar = i22;
                                            } else {
                                                if (r42 == 0) {
                                                    r42 = new a1.b(new i.c[16], 0);
                                                }
                                                if (mVar != 0) {
                                                    r42.c(mVar);
                                                    mVar = 0;
                                                }
                                                r42.c(i22);
                                            }
                                        }
                                        i22 = i22.F1();
                                        mVar = mVar;
                                        r42 = r42;
                                    }
                                    if (i10 == 1) {
                                    }
                                }
                            }
                            mVar = k.g(r42);
                        }
                    }
                    L1 = L1.L1();
                }
            }
            m10 = m10.o0();
            L1 = (m10 == null || (k02 = m10.k0()) == null) ? null : k02.o();
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r12v0, types: [dn.l] */
    /* JADX WARN: Type inference failed for: r3v11 */
    /* JADX WARN: Type inference failed for: r3v12, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r3v13, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r3v14 */
    /* JADX WARN: Type inference failed for: r3v15 */
    /* JADX WARN: Type inference failed for: r3v16 */
    /* JADX WARN: Type inference failed for: r3v17 */
    /* JADX WARN: Type inference failed for: r3v18 */
    /* JADX WARN: Type inference failed for: r3v19 */
    /* JADX WARN: Type inference failed for: r3v6 */
    /* JADX WARN: Type inference failed for: r3v7, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r5v0 */
    /* JADX WARN: Type inference failed for: r5v1 */
    /* JADX WARN: Type inference failed for: r5v10 */
    /* JADX WARN: Type inference failed for: r5v11 */
    /* JADX WARN: Type inference failed for: r5v2 */
    /* JADX WARN: Type inference failed for: r5v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v4 */
    /* JADX WARN: Type inference failed for: r5v5 */
    /* JADX WARN: Type inference failed for: r5v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v8 */
    /* JADX WARN: Type inference failed for: r5v9 */
    public static final void d(x1 x1Var, dn.l lVar) {
        x0 k02;
        int a10 = b1.a(262144);
        if (!x1Var.P0().O1()) {
            throw new IllegalStateException("visitAncestors called on an unattached node".toString());
        }
        i.c L1 = x1Var.P0().L1();
        g0 m10 = k.m(x1Var);
        while (m10 != null) {
            if ((m10.k0().k().E1() & a10) != 0) {
                while (L1 != null) {
                    if ((L1.J1() & a10) != 0) {
                        m mVar = L1;
                        ?? r52 = 0;
                        while (mVar != 0) {
                            boolean z10 = true;
                            if (mVar instanceof x1) {
                                x1 x1Var2 = (x1) mVar;
                                if (kotlin.jvm.internal.t.b(x1Var.N(), x1Var2.N()) && l1.b.a(x1Var, x1Var2)) {
                                    z10 = ((Boolean) lVar.invoke(x1Var2)).booleanValue();
                                }
                                if (!z10) {
                                    return;
                                }
                            } else {
                                if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                    i.c i22 = mVar.i2();
                                    int i10 = 0;
                                    mVar = mVar;
                                    r52 = r52;
                                    while (i22 != null) {
                                        if ((i22.J1() & a10) != 0) {
                                            i10++;
                                            r52 = r52;
                                            if (i10 == 1) {
                                                mVar = i22;
                                            } else {
                                                if (r52 == 0) {
                                                    r52 = new a1.b(new i.c[16], 0);
                                                }
                                                if (mVar != 0) {
                                                    r52.c(mVar);
                                                    mVar = 0;
                                                }
                                                r52.c(i22);
                                            }
                                        }
                                        i22 = i22.F1();
                                        mVar = mVar;
                                        r52 = r52;
                                    }
                                    if (i10 == 1) {
                                    }
                                }
                            }
                            mVar = k.g(r52);
                        }
                    }
                    L1 = L1.L1();
                }
            }
            m10 = m10.o0();
            L1 = (m10 == null || (k02 = m10.k0()) == null) ? null : k02.o();
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:67:0x00d1, code lost:
    
        if (r6 == false) goto L70;
     */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r14v0, types: [dn.l] */
    /* JADX WARN: Type inference failed for: r7v0 */
    /* JADX WARN: Type inference failed for: r7v1, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r7v10 */
    /* JADX WARN: Type inference failed for: r7v11, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r7v12, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r7v13 */
    /* JADX WARN: Type inference failed for: r7v14 */
    /* JADX WARN: Type inference failed for: r7v15 */
    /* JADX WARN: Type inference failed for: r7v16 */
    /* JADX WARN: Type inference failed for: r7v17 */
    /* JADX WARN: Type inference failed for: r7v18 */
    /* JADX WARN: Type inference failed for: r8v0 */
    /* JADX WARN: Type inference failed for: r8v1 */
    /* JADX WARN: Type inference failed for: r8v10 */
    /* JADX WARN: Type inference failed for: r8v11 */
    /* JADX WARN: Type inference failed for: r8v2 */
    /* JADX WARN: Type inference failed for: r8v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r8v4 */
    /* JADX WARN: Type inference failed for: r8v5 */
    /* JADX WARN: Type inference failed for: r8v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r8v8 */
    /* JADX WARN: Type inference failed for: r8v9 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final void e(j jVar, Object obj, dn.l lVar) {
        boolean z10;
        int a10 = b1.a(262144);
        if (!jVar.P0().O1()) {
            g2.a.b("visitSubtreeIf called on an unattached node");
        }
        a1.b bVar = new a1.b(new i.c[16], 0);
        i.c F1 = jVar.P0().F1();
        if (F1 == null) {
            k.c(bVar, jVar.P0());
        } else {
            bVar.c(F1);
        }
        while (bVar.t()) {
            i.c cVar = (i.c) bVar.z(bVar.q() - 1);
            if ((cVar.E1() & a10) != 0) {
                for (i.c cVar2 = cVar; cVar2 != null; cVar2 = cVar2.F1()) {
                    if ((cVar2.J1() & a10) != 0) {
                        m mVar = cVar2;
                        ?? r82 = 0;
                        while (true) {
                            if (mVar == 0) {
                                z10 = true;
                                break;
                            }
                            if (mVar instanceof x1) {
                                x1 x1Var = (x1) mVar;
                                w1 w1Var = kotlin.jvm.internal.t.b(obj, x1Var.N()) ? (w1) lVar.invoke(x1Var) : w1.ContinueTraversal;
                                if (w1Var == w1.CancelTraversal) {
                                    return;
                                }
                                if (!(w1Var != w1.SkipSubtreeAndContinueTraversal)) {
                                    z10 = false;
                                    break;
                                }
                            } else if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                i.c i22 = mVar.i2();
                                int i10 = 0;
                                mVar = mVar;
                                r82 = r82;
                                while (i22 != null) {
                                    if ((i22.J1() & a10) != 0) {
                                        i10++;
                                        r82 = r82;
                                        if (i10 == 1) {
                                            mVar = i22;
                                        } else {
                                            if (r82 == 0) {
                                                r82 = new a1.b(new i.c[16], 0);
                                            }
                                            if (mVar != 0) {
                                                r82.c(mVar);
                                                mVar = 0;
                                            }
                                            r82.c(i22);
                                        }
                                    }
                                    i22 = i22.F1();
                                    mVar = mVar;
                                    r82 = r82;
                                }
                                if (i10 == 1) {
                                }
                            }
                            mVar = k.g(r82);
                        }
                    }
                }
            }
            k.c(bVar, cVar);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r14v0, types: [dn.l] */
    /* JADX WARN: Type inference failed for: r8v0 */
    /* JADX WARN: Type inference failed for: r8v1, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r8v10 */
    /* JADX WARN: Type inference failed for: r8v11, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r8v12, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r8v13 */
    /* JADX WARN: Type inference failed for: r8v14 */
    /* JADX WARN: Type inference failed for: r8v15 */
    /* JADX WARN: Type inference failed for: r8v16 */
    /* JADX WARN: Type inference failed for: r8v17 */
    /* JADX WARN: Type inference failed for: r8v18 */
    /* JADX WARN: Type inference failed for: r9v0 */
    /* JADX WARN: Type inference failed for: r9v1 */
    /* JADX WARN: Type inference failed for: r9v10 */
    /* JADX WARN: Type inference failed for: r9v11 */
    /* JADX WARN: Type inference failed for: r9v2 */
    /* JADX WARN: Type inference failed for: r9v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r9v4 */
    /* JADX WARN: Type inference failed for: r9v5 */
    /* JADX WARN: Type inference failed for: r9v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r9v8 */
    /* JADX WARN: Type inference failed for: r9v9 */
    public static final void f(x1 x1Var, dn.l lVar) {
        boolean z10;
        int a10 = b1.a(262144);
        if (!x1Var.P0().O1()) {
            g2.a.b("visitSubtreeIf called on an unattached node");
        }
        a1.b bVar = new a1.b(new i.c[16], 0);
        i.c F1 = x1Var.P0().F1();
        if (F1 == null) {
            k.c(bVar, x1Var.P0());
        } else {
            bVar.c(F1);
        }
        while (bVar.t()) {
            i.c cVar = (i.c) bVar.z(bVar.q() - 1);
            if ((cVar.E1() & a10) != 0) {
                for (i.c cVar2 = cVar; cVar2 != null; cVar2 = cVar2.F1()) {
                    if ((cVar2.J1() & a10) != 0) {
                        m mVar = cVar2;
                        ?? r92 = 0;
                        while (true) {
                            if (mVar == 0) {
                                z10 = true;
                                break;
                            }
                            if (mVar instanceof x1) {
                                x1 x1Var2 = (x1) mVar;
                                w1 w1Var = (kotlin.jvm.internal.t.b(x1Var.N(), x1Var2.N()) && l1.b.a(x1Var, x1Var2)) ? (w1) lVar.invoke(x1Var2) : w1.ContinueTraversal;
                                if (w1Var == w1.CancelTraversal) {
                                    return;
                                }
                                if (!(w1Var != w1.SkipSubtreeAndContinueTraversal)) {
                                    z10 = false;
                                    break;
                                }
                            } else if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                i.c i22 = mVar.i2();
                                int i10 = 0;
                                mVar = mVar;
                                r92 = r92;
                                while (i22 != null) {
                                    if ((i22.J1() & a10) != 0) {
                                        i10++;
                                        r92 = r92;
                                        if (i10 == 1) {
                                            mVar = i22;
                                        } else {
                                            if (r92 == 0) {
                                                r92 = new a1.b(new i.c[16], 0);
                                            }
                                            if (mVar != 0) {
                                                r92.c(mVar);
                                                mVar = 0;
                                            }
                                            r92.c(i22);
                                        }
                                    }
                                    i22 = i22.F1();
                                    mVar = mVar;
                                    r92 = r92;
                                }
                                if (i10 == 1) {
                                }
                            }
                            mVar = k.g(r92);
                        }
                        if (z10) {
                        }
                    }
                }
            }
            k.c(bVar, cVar);
        }
    }
}
