package y0;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import y0.i0;

/* loaded from: classes.dex */
public final class t implements f0, u2, m2 {
    private final z0.a A;
    private final a1.f B;
    private a1.f C;
    private boolean D;
    private t E;
    private int F;
    private final a0 G;
    private final n H;
    private final vm.g I;
    private final boolean J;
    private boolean K;
    private dn.p L;

    /* renamed from: p, reason: collision with root package name */
    private final r f51799p;

    /* renamed from: q, reason: collision with root package name */
    private final f f51800q;

    /* renamed from: r, reason: collision with root package name */
    private final AtomicReference f51801r;

    /* renamed from: s, reason: collision with root package name */
    private final Object f51802s;

    /* renamed from: t, reason: collision with root package name */
    private final Set f51803t;

    /* renamed from: u, reason: collision with root package name */
    private final a3 f51804u;

    /* renamed from: v, reason: collision with root package name */
    private final a1.f f51805v;

    /* renamed from: w, reason: collision with root package name */
    private final androidx.collection.h0 f51806w;

    /* renamed from: x, reason: collision with root package name */
    private final androidx.collection.h0 f51807x;

    /* renamed from: y, reason: collision with root package name */
    private final a1.f f51808y;

    /* renamed from: z, reason: collision with root package name */
    private final z0.a f51809z;

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes.dex */
    public static final class a implements r2 {

        /* renamed from: a, reason: collision with root package name */
        private final Set f51810a;

        /* renamed from: e, reason: collision with root package name */
        private androidx.collection.h0 f51814e;

        /* renamed from: b, reason: collision with root package name */
        private final List f51811b = new ArrayList();

        /* renamed from: c, reason: collision with root package name */
        private final List f51812c = new ArrayList();

        /* renamed from: d, reason: collision with root package name */
        private final List f51813d = new ArrayList();

        /* renamed from: f, reason: collision with root package name */
        private final List f51815f = new ArrayList();

        /* renamed from: g, reason: collision with root package name */
        private final androidx.collection.x f51816g = new androidx.collection.x(0, 1, null);

        /* renamed from: h, reason: collision with root package name */
        private final androidx.collection.x f51817h = new androidx.collection.x(0, 1, null);

        public a(Set set) {
            this.f51810a = set;
        }

        private final void i(int i10) {
            if (!this.f51815f.isEmpty()) {
                int i11 = 0;
                int i12 = 0;
                List list = null;
                androidx.collection.x xVar = null;
                androidx.collection.x xVar2 = null;
                while (i12 < this.f51817h.b()) {
                    if (i10 <= this.f51817h.a(i12)) {
                        Object remove = this.f51815f.remove(i12);
                        int j10 = this.f51817h.j(i12);
                        int j11 = this.f51816g.j(i12);
                        if (list == null) {
                            list = sm.u.q(remove);
                            xVar2 = new androidx.collection.x(0, 1, null);
                            xVar2.f(j10);
                            xVar = new androidx.collection.x(0, 1, null);
                            xVar.f(j11);
                        } else {
                            kotlin.jvm.internal.t.e(xVar, "null cannot be cast to non-null type androidx.collection.MutableIntList");
                            kotlin.jvm.internal.t.e(xVar2, "null cannot be cast to non-null type androidx.collection.MutableIntList");
                            list.add(remove);
                            xVar2.f(j10);
                            xVar.f(j11);
                        }
                    } else {
                        i12++;
                    }
                }
                if (list != null) {
                    kotlin.jvm.internal.t.e(xVar, "null cannot be cast to non-null type androidx.collection.MutableIntList");
                    kotlin.jvm.internal.t.e(xVar2, "null cannot be cast to non-null type androidx.collection.MutableIntList");
                    int size = list.size() - 1;
                    while (i11 < size) {
                        int i13 = i11 + 1;
                        int size2 = list.size();
                        for (int i14 = i13; i14 < size2; i14++) {
                            int a10 = xVar2.a(i11);
                            int a11 = xVar2.a(i14);
                            if (a10 < a11 || (a11 == a10 && xVar.a(i11) < xVar.a(i14))) {
                                u.e(list, i11, i14);
                                u.d(xVar, i11, i14);
                                u.d(xVar2, i11, i14);
                            }
                        }
                        i11 = i13;
                    }
                    this.f51812c.addAll(list);
                }
            }
        }

        private final void j(Object obj, int i10, int i11, int i12) {
            i(i10);
            boolean z10 = false;
            if (i12 >= 0 && i12 < i10) {
                z10 = true;
            }
            if (!z10) {
                this.f51812c.add(obj);
                return;
            }
            this.f51815f.add(obj);
            this.f51816g.f(i11);
            this.f51817h.f(i12);
        }

        @Override // y0.r2
        public void a(s2 s2Var) {
            this.f51811b.add(s2Var);
        }

        @Override // y0.r2
        public void b(k kVar, int i10, int i11, int i12) {
            androidx.collection.h0 h0Var = this.f51814e;
            if (h0Var == null) {
                h0Var = androidx.collection.s0.a();
                this.f51814e = h0Var;
            }
            h0Var.w(kVar);
            j(kVar, i10, i11, i12);
        }

        @Override // y0.r2
        public void c(k kVar, int i10, int i11, int i12) {
            j(kVar, i10, i11, i12);
        }

        @Override // y0.r2
        public void d(dn.a aVar) {
            this.f51813d.add(aVar);
        }

        @Override // y0.r2
        public void e(s2 s2Var, int i10, int i11, int i12) {
            j(s2Var, i10, i11, i12);
        }

        public final void f() {
            if (!this.f51810a.isEmpty()) {
                Object a10 = c4.f51502a.a("Compose:abandons");
                try {
                    Iterator it = this.f51810a.iterator();
                    while (it.hasNext()) {
                        s2 s2Var = (s2) it.next();
                        it.remove();
                        s2Var.b();
                    }
                    rm.n0 n0Var = rm.n0.f34904a;
                } finally {
                    c4.f51502a.b(a10);
                }
            }
        }

        public final void g() {
            Object a10;
            i(Integer.MIN_VALUE);
            if (!this.f51812c.isEmpty()) {
                a10 = c4.f51502a.a("Compose:onForgotten");
                try {
                    androidx.collection.h0 h0Var = this.f51814e;
                    for (int size = this.f51812c.size() - 1; -1 < size; size--) {
                        Object obj = this.f51812c.get(size);
                        if (obj instanceof s2) {
                            this.f51810a.remove(obj);
                            ((s2) obj).c();
                        }
                        if (obj instanceof k) {
                            if (h0Var == null || !h0Var.a(obj)) {
                                ((k) obj).g();
                            } else {
                                ((k) obj).f();
                            }
                        }
                    }
                    rm.n0 n0Var = rm.n0.f34904a;
                } finally {
                }
            }
            if (!this.f51811b.isEmpty()) {
                a10 = c4.f51502a.a("Compose:onRemembered");
                try {
                    List list = this.f51811b;
                    int size2 = list.size();
                    for (int i10 = 0; i10 < size2; i10++) {
                        s2 s2Var = (s2) list.get(i10);
                        this.f51810a.remove(s2Var);
                        s2Var.d();
                    }
                    rm.n0 n0Var2 = rm.n0.f34904a;
                } finally {
                }
            }
        }

        public final void h() {
            if (!this.f51813d.isEmpty()) {
                Object a10 = c4.f51502a.a("Compose:sideeffects");
                try {
                    List list = this.f51813d;
                    int size = list.size();
                    for (int i10 = 0; i10 < size; i10++) {
                        ((dn.a) list.get(i10)).invoke();
                    }
                    this.f51813d.clear();
                    rm.n0 n0Var = rm.n0.f34904a;
                } finally {
                    c4.f51502a.b(a10);
                }
            }
        }
    }

    public t(r rVar, f fVar, vm.g gVar) {
        this.f51799p = rVar;
        this.f51800q = fVar;
        this.f51801r = new AtomicReference(null);
        this.f51802s = new Object();
        Set l10 = new androidx.collection.h0(0, 1, null).l();
        this.f51803t = l10;
        a3 a3Var = new a3();
        if (rVar.c()) {
            a3Var.r();
        }
        if (rVar.e()) {
            a3Var.x();
        }
        this.f51804u = a3Var;
        this.f51805v = new a1.f();
        this.f51806w = new androidx.collection.h0(0, 1, null);
        this.f51807x = new androidx.collection.h0(0, 1, null);
        this.f51808y = new a1.f();
        z0.a aVar = new z0.a();
        this.f51809z = aVar;
        z0.a aVar2 = new z0.a();
        this.A = aVar2;
        this.B = new a1.f();
        this.C = new a1.f();
        this.G = new a0(null, false, 3, null);
        n nVar = new n(fVar, rVar, a3Var, l10, aVar, aVar2, this);
        rVar.n(nVar);
        this.H = nVar;
        this.I = gVar;
        this.J = rVar instanceof n2;
        this.L = i.f51572a.a();
    }

    /* JADX WARN: Removed duplicated region for block: B:113:0x01fa  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private final void A(z0.a aVar) {
        a aVar2;
        a aVar3;
        boolean z10;
        long[] jArr;
        int i10;
        boolean z11;
        a aVar4;
        long[] jArr2;
        int i11;
        int i12;
        char c10;
        long j10;
        int i13;
        boolean z12;
        long[] jArr3;
        long[] jArr4;
        t tVar = this;
        a aVar5 = new a(tVar.f51803t);
        try {
            if (aVar.c()) {
                if (tVar.A.c()) {
                    aVar5.f();
                    return;
                }
                return;
            }
            c4 c4Var = c4.f51502a;
            Object a10 = c4Var.a("Compose:applyChanges");
            try {
                tVar.f51800q.e();
                d3 O = tVar.f51804u.O();
                int i14 = 0;
                try {
                    aVar.b(tVar.f51800q, O, aVar5);
                    rm.n0 n0Var = rm.n0.f34904a;
                    boolean z13 = true;
                    O.L(true);
                    tVar.f51800q.i();
                    c4Var.b(a10);
                    aVar5.g();
                    aVar5.h();
                    if (tVar.D) {
                        try {
                            try {
                                Object a11 = c4Var.a("Compose:unobserve");
                                try {
                                    tVar.D = false;
                                    androidx.collection.g0 d10 = tVar.f51805v.d();
                                    long[] jArr5 = d10.f1366a;
                                    int length = jArr5.length - 2;
                                    if (length >= 0) {
                                        int i15 = 0;
                                        while (true) {
                                            long j11 = jArr5[i15];
                                            char c11 = 7;
                                            long j12 = -9187201950435737472L;
                                            if ((((~j11) << 7) & j11 & (-9187201950435737472L)) != -9187201950435737472L) {
                                                int i16 = 8;
                                                int i17 = 8 - ((~(i15 - length)) >>> 31);
                                                while (i14 < i17) {
                                                    if ((j11 & 255) < 128 ? z13 : false) {
                                                        int i18 = (i15 << 3) + i14;
                                                        Object obj = d10.f1367b[i18];
                                                        Object obj2 = d10.f1368c[i18];
                                                        if (obj2 instanceof androidx.collection.h0) {
                                                            kotlin.jvm.internal.t.e(obj2, "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2>");
                                                            androidx.collection.h0 h0Var = (androidx.collection.h0) obj2;
                                                            Object[] objArr = h0Var.f1380b;
                                                            long[] jArr6 = h0Var.f1379a;
                                                            int length2 = jArr6.length - 2;
                                                            aVar4 = aVar5;
                                                            jArr2 = jArr5;
                                                            if (length2 >= 0) {
                                                                int i19 = 0;
                                                                while (true) {
                                                                    try {
                                                                        long j13 = jArr6[i19];
                                                                        i11 = length;
                                                                        i12 = i15;
                                                                        c10 = 7;
                                                                        j10 = -9187201950435737472L;
                                                                        if ((((~j13) << 7) & j13 & (-9187201950435737472L)) != -9187201950435737472L) {
                                                                            int i20 = 8 - ((~(i19 - length2)) >>> 31);
                                                                            int i21 = 0;
                                                                            while (i21 < i20) {
                                                                                if ((j13 & 255) < 128) {
                                                                                    jArr4 = jArr6;
                                                                                    int i22 = (i19 << 3) + i21;
                                                                                    if (!((k2) objArr[i22]).r()) {
                                                                                        h0Var.y(i22);
                                                                                    }
                                                                                } else {
                                                                                    jArr4 = jArr6;
                                                                                }
                                                                                j13 >>= 8;
                                                                                i21++;
                                                                                jArr6 = jArr4;
                                                                            }
                                                                            jArr3 = jArr6;
                                                                            z11 = true;
                                                                            if (i20 != 8) {
                                                                                break;
                                                                            }
                                                                        } else {
                                                                            jArr3 = jArr6;
                                                                            z11 = true;
                                                                        }
                                                                        if (i19 == length2) {
                                                                            break;
                                                                        }
                                                                        i19++;
                                                                        length = i11;
                                                                        i15 = i12;
                                                                        jArr6 = jArr3;
                                                                    } catch (Throwable th2) {
                                                                        th = th2;
                                                                        c4.f51502a.b(a11);
                                                                        throw th;
                                                                    }
                                                                }
                                                            } else {
                                                                i11 = length;
                                                                i12 = i15;
                                                                c10 = 7;
                                                                j10 = -9187201950435737472L;
                                                                z11 = true;
                                                            }
                                                            z12 = h0Var.d();
                                                        } else {
                                                            aVar4 = aVar5;
                                                            jArr2 = jArr5;
                                                            i11 = length;
                                                            i12 = i15;
                                                            c10 = c11;
                                                            j10 = -9187201950435737472L;
                                                            z11 = true;
                                                            kotlin.jvm.internal.t.e(obj2, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2");
                                                            z12 = !((k2) obj2).r();
                                                        }
                                                        if (z12) {
                                                            d10.p(i18);
                                                        }
                                                        i13 = 8;
                                                    } else {
                                                        z11 = z13;
                                                        aVar4 = aVar5;
                                                        jArr2 = jArr5;
                                                        i11 = length;
                                                        i12 = i15;
                                                        c10 = c11;
                                                        j10 = j12;
                                                        i13 = i16;
                                                    }
                                                    j11 >>= i13;
                                                    i14++;
                                                    i16 = i13;
                                                    c11 = c10;
                                                    j12 = j10;
                                                    jArr5 = jArr2;
                                                    aVar5 = aVar4;
                                                    length = i11;
                                                    i15 = i12;
                                                    z13 = z11;
                                                }
                                                z10 = z13;
                                                aVar3 = aVar5;
                                                jArr = jArr5;
                                                int i23 = length;
                                                int i24 = i15;
                                                if (i17 != i16) {
                                                    break;
                                                }
                                                length = i23;
                                                i10 = i24;
                                            } else {
                                                z10 = z13;
                                                aVar3 = aVar5;
                                                jArr = jArr5;
                                                i10 = i15;
                                            }
                                            if (i10 == length) {
                                                break;
                                            }
                                            i15 = i10 + 1;
                                            jArr5 = jArr;
                                            aVar5 = aVar3;
                                            z13 = z10;
                                            i14 = 0;
                                        }
                                    } else {
                                        aVar3 = aVar5;
                                    }
                                    B();
                                    rm.n0 n0Var2 = rm.n0.f34904a;
                                    c4.f51502a.b(a11);
                                } catch (Throwable th3) {
                                    th = th3;
                                }
                            } catch (Throwable th4) {
                                th = th4;
                                tVar = this;
                                if (tVar.A.c()) {
                                    aVar2.f();
                                }
                                throw th;
                            }
                        } catch (Throwable th5) {
                            th = th5;
                            aVar2 = aVar5;
                            tVar = this;
                            if (tVar.A.c()) {
                            }
                            throw th;
                        }
                    } else {
                        aVar3 = aVar5;
                    }
                    if (this.A.c()) {
                        aVar3.f();
                    }
                } catch (Throwable th6) {
                    aVar2 = aVar5;
                    try {
                        O.L(false);
                        throw th6;
                    } catch (Throwable th7) {
                        th = th7;
                        try {
                            c4.f51502a.b(a10);
                            throw th;
                        } catch (Throwable th8) {
                            th = th8;
                            if (tVar.A.c()) {
                            }
                            throw th;
                        }
                    }
                }
            } catch (Throwable th9) {
                th = th9;
                aVar2 = aVar5;
            }
        } catch (Throwable th10) {
            th = th10;
            aVar2 = aVar5;
        }
    }

    private final void B() {
        long[] jArr;
        long[] jArr2;
        int i10;
        int i11;
        int i12;
        boolean z10;
        Object[] objArr;
        long[] jArr3;
        Object[] objArr2;
        long[] jArr4;
        androidx.collection.g0 d10 = this.f51808y.d();
        long[] jArr5 = d10.f1366a;
        int length = jArr5.length - 2;
        long j10 = 255;
        char c10 = 7;
        long j11 = -9187201950435737472L;
        int i13 = 8;
        if (length >= 0) {
            int i14 = 0;
            while (true) {
                long j12 = jArr5[i14];
                if ((((~j12) << c10) & j12 & j11) != j11) {
                    int i15 = 8 - ((~(i14 - length)) >>> 31);
                    int i16 = 0;
                    while (i16 < i15) {
                        if ((j12 & j10) < 128) {
                            int i17 = (i14 << 3) + i16;
                            Object obj = d10.f1367b[i17];
                            Object obj2 = d10.f1368c[i17];
                            if (obj2 instanceof androidx.collection.h0) {
                                kotlin.jvm.internal.t.e(obj2, "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2>");
                                androidx.collection.h0 h0Var = (androidx.collection.h0) obj2;
                                Object[] objArr3 = h0Var.f1380b;
                                long[] jArr6 = h0Var.f1379a;
                                int length2 = jArr6.length - 2;
                                jArr2 = jArr5;
                                i10 = length;
                                if (length2 >= 0) {
                                    int i18 = 0;
                                    while (true) {
                                        long j13 = jArr6[i18];
                                        i11 = i15;
                                        i12 = i16;
                                        if ((((~j13) << c10) & j13 & (-9187201950435737472L)) != -9187201950435737472L) {
                                            int i19 = 8 - ((~(i18 - length2)) >>> 31);
                                            int i20 = 0;
                                            while (i20 < i19) {
                                                if ((j13 & 255) < 128) {
                                                    int i21 = (i18 << 3) + i20;
                                                    objArr2 = objArr3;
                                                    jArr4 = jArr6;
                                                    if (!this.f51805v.c((i0) objArr3[i21])) {
                                                        h0Var.y(i21);
                                                    }
                                                } else {
                                                    objArr2 = objArr3;
                                                    jArr4 = jArr6;
                                                }
                                                j13 >>= 8;
                                                i20++;
                                                jArr6 = jArr4;
                                                objArr3 = objArr2;
                                            }
                                            objArr = objArr3;
                                            jArr3 = jArr6;
                                            if (i19 != 8) {
                                                break;
                                            }
                                        } else {
                                            objArr = objArr3;
                                            jArr3 = jArr6;
                                        }
                                        if (i18 == length2) {
                                            break;
                                        }
                                        i18++;
                                        i15 = i11;
                                        i16 = i12;
                                        jArr6 = jArr3;
                                        objArr3 = objArr;
                                        c10 = 7;
                                    }
                                } else {
                                    i11 = i15;
                                    i12 = i16;
                                }
                                z10 = h0Var.d();
                            } else {
                                jArr2 = jArr5;
                                i10 = length;
                                i11 = i15;
                                i12 = i16;
                                kotlin.jvm.internal.t.e(obj2, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2");
                                z10 = !this.f51805v.c((i0) obj2);
                            }
                            if (z10) {
                                d10.p(i17);
                            }
                        } else {
                            jArr2 = jArr5;
                            i10 = length;
                            i11 = i15;
                            i12 = i16;
                        }
                        j12 >>= 8;
                        i16 = i12 + 1;
                        i13 = 8;
                        jArr5 = jArr2;
                        length = i10;
                        i15 = i11;
                        j10 = 255;
                        c10 = 7;
                    }
                    jArr = jArr5;
                    int i22 = length;
                    if (i15 != i13) {
                        break;
                    } else {
                        length = i22;
                    }
                } else {
                    jArr = jArr5;
                }
                if (i14 == length) {
                    break;
                }
                i14++;
                jArr5 = jArr;
                j10 = 255;
                c10 = 7;
                j11 = -9187201950435737472L;
                i13 = 8;
            }
        }
        if (!this.f51807x.e()) {
            return;
        }
        androidx.collection.h0 h0Var2 = this.f51807x;
        Object[] objArr4 = h0Var2.f1380b;
        long[] jArr7 = h0Var2.f1379a;
        int length3 = jArr7.length - 2;
        if (length3 < 0) {
            return;
        }
        int i23 = 0;
        while (true) {
            long j14 = jArr7[i23];
            if ((((~j14) << 7) & j14 & (-9187201950435737472L)) != -9187201950435737472L) {
                int i24 = 8 - ((~(i23 - length3)) >>> 31);
                for (int i25 = 0; i25 < i24; i25++) {
                    if ((j14 & 255) < 128) {
                        int i26 = (i23 << 3) + i25;
                        if (!((k2) objArr4[i26]).t()) {
                            h0Var2.y(i26);
                        }
                    }
                    j14 >>= 8;
                }
                if (i24 != 8) {
                    return;
                }
            }
            if (i23 == length3) {
                return;
            } else {
                i23++;
            }
        }
    }

    private final void C(dn.p pVar) {
        if (!(!this.K)) {
            b2.b("The composition is disposed");
        }
        this.L = pVar;
        this.f51799p.a(this, pVar);
    }

    private final void D() {
        Object andSet = this.f51801r.getAndSet(u.c());
        if (andSet != null) {
            if (kotlin.jvm.internal.t.b(andSet, u.c())) {
                p.s("pending composition has not been applied");
                throw new rm.k();
            }
            if (andSet instanceof Set) {
                z((Set) andSet, true);
                return;
            }
            if (!(andSet instanceof Object[])) {
                p.s("corrupt pendingModifications drain: " + this.f51801r);
                throw new rm.k();
            }
            for (Set set : (Set[]) andSet) {
                z(set, true);
            }
        }
    }

    private final void E() {
        Object andSet = this.f51801r.getAndSet(null);
        if (kotlin.jvm.internal.t.b(andSet, u.c())) {
            return;
        }
        if (andSet instanceof Set) {
            z((Set) andSet, false);
            return;
        }
        if (andSet instanceof Object[]) {
            for (Set set : (Set[]) andSet) {
                z(set, false);
            }
            return;
        }
        if (andSet == null) {
            p.s("calling recordModificationsOf and applyChanges concurrently is not supported");
            throw new rm.k();
        }
        p.s("corrupt pendingModifications drain: " + this.f51801r);
        throw new rm.k();
    }

    private final boolean F() {
        return this.H.B0();
    }

    /* JADX WARN: Code restructure failed: missing block: B:65:0x00b8, code lost:
    
        if ((r5 == y0.w2.f51842a) != false) goto L57;
     */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00bf A[Catch: all -> 0x00dd, TRY_LEAVE, TryCatch #0 {, blocks: (B:4:0x000b, B:6:0x0010, B:12:0x001f, B:14:0x0025, B:18:0x0029, B:20:0x002e, B:21:0x0037, B:23:0x003b, B:24:0x0044, B:26:0x0050, B:28:0x0054, B:31:0x0060, B:33:0x0073, B:35:0x007f, B:39:0x0090, B:50:0x00bf, B:45:0x00a4, B:60:0x00ae, B:62:0x00b1), top: B:3:0x000b }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private final y0 H(k2 k2Var, d dVar, Object obj) {
        boolean z10;
        int i10;
        synchronized (this.f51802s) {
            t tVar = this.E;
            t tVar2 = null;
            if (tVar != null) {
                if (!this.f51804u.L(this.F, dVar)) {
                    tVar = null;
                }
                tVar2 = tVar;
            }
            if (tVar2 == null) {
                if (N(k2Var, obj)) {
                    return y0.IMMINENT;
                }
                J();
                if (obj == null) {
                    this.C.h(k2Var, w2.f51842a);
                } else if (obj instanceof i0) {
                    Object b10 = this.C.d().b(k2Var);
                    if (b10 != null) {
                        if (b10 instanceof androidx.collection.h0) {
                            androidx.collection.h0 h0Var = (androidx.collection.h0) b10;
                            Object[] objArr = h0Var.f1380b;
                            long[] jArr = h0Var.f1379a;
                            int length = jArr.length - 2;
                            if (length >= 0) {
                                int i11 = 0;
                                loop0: while (true) {
                                    long j10 = jArr[i11];
                                    if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                                        int i12 = 8;
                                        int i13 = 8 - ((~(i11 - length)) >>> 31);
                                        int i14 = 0;
                                        while (i14 < i13) {
                                            if ((j10 & 255) < 128) {
                                                if (objArr[(i11 << 3) + i14] == w2.f51842a) {
                                                    break loop0;
                                                }
                                                i10 = 8;
                                            } else {
                                                i10 = i12;
                                            }
                                            j10 >>= i10;
                                            i14++;
                                            i12 = i10;
                                        }
                                        if (i13 != i12) {
                                            break;
                                        }
                                    }
                                    if (i11 == length) {
                                        break;
                                    }
                                    i11++;
                                }
                                z10 = true;
                            }
                        }
                        if (!z10) {
                            this.C.a(k2Var, obj);
                        }
                    }
                    z10 = false;
                    if (!z10) {
                    }
                } else {
                    this.C.h(k2Var, w2.f51842a);
                }
            }
            if (tVar2 != null) {
                return tVar2.H(k2Var, dVar, obj);
            }
            this.f51799p.k(this);
            return r() ? y0.DEFERRED : y0.SCHEDULED;
        }
    }

    private final void I(Object obj) {
        Object b10 = this.f51805v.d().b(obj);
        if (b10 == null) {
            return;
        }
        if (!(b10 instanceof androidx.collection.h0)) {
            k2 k2Var = (k2) b10;
            if (k2Var.s(obj) == y0.IMMINENT) {
                this.B.a(obj, k2Var);
                return;
            }
            return;
        }
        androidx.collection.h0 h0Var = (androidx.collection.h0) b10;
        Object[] objArr = h0Var.f1380b;
        long[] jArr = h0Var.f1379a;
        int length = jArr.length - 2;
        if (length < 0) {
            return;
        }
        int i10 = 0;
        while (true) {
            long j10 = jArr[i10];
            if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                int i11 = 8 - ((~(i10 - length)) >>> 31);
                for (int i12 = 0; i12 < i11; i12++) {
                    if ((255 & j10) < 128) {
                        k2 k2Var2 = (k2) objArr[(i10 << 3) + i12];
                        if (k2Var2.s(obj) == y0.IMMINENT) {
                            this.B.a(obj, k2Var2);
                        }
                    }
                    j10 >>= 8;
                }
                if (i11 != 8) {
                    return;
                }
            }
            if (i10 == length) {
                return;
            } else {
                i10++;
            }
        }
    }

    private final k1.c J() {
        a0 a0Var = this.G;
        if (a0Var.b()) {
            a0Var.a();
        } else {
            a0 i10 = this.f51799p.i();
            if (i10 != null) {
                i10.a();
            }
            a0Var.a();
            if (!kotlin.jvm.internal.t.b(null, null)) {
                a0Var.c(null);
            }
        }
        return null;
    }

    private final a1.f M() {
        a1.f fVar = this.C;
        this.C = new a1.f();
        return fVar;
    }

    private final boolean N(k2 k2Var, Object obj) {
        return r() && this.H.p1(k2Var, obj);
    }

    private final void g(Object obj, boolean z10) {
        Object b10 = this.f51805v.d().b(obj);
        if (b10 == null) {
            return;
        }
        if (!(b10 instanceof androidx.collection.h0)) {
            k2 k2Var = (k2) b10;
            if (this.B.f(obj, k2Var) || k2Var.s(obj) == y0.IGNORED) {
                return;
            }
            if (!k2Var.t() || z10) {
                this.f51806w.h(k2Var);
                return;
            } else {
                this.f51807x.h(k2Var);
                return;
            }
        }
        androidx.collection.h0 h0Var = (androidx.collection.h0) b10;
        Object[] objArr = h0Var.f1380b;
        long[] jArr = h0Var.f1379a;
        int length = jArr.length - 2;
        if (length < 0) {
            return;
        }
        int i10 = 0;
        while (true) {
            long j10 = jArr[i10];
            if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                int i11 = 8 - ((~(i10 - length)) >>> 31);
                for (int i12 = 0; i12 < i11; i12++) {
                    if ((255 & j10) < 128) {
                        k2 k2Var2 = (k2) objArr[(i10 << 3) + i12];
                        if (!this.B.f(obj, k2Var2) && k2Var2.s(obj) != y0.IGNORED) {
                            if (!k2Var2.t() || z10) {
                                this.f51806w.h(k2Var2);
                            } else {
                                this.f51807x.h(k2Var2);
                            }
                        }
                    }
                    j10 >>= 8;
                }
                if (i11 != 8) {
                    return;
                }
            }
            if (i10 == length) {
                return;
            } else {
                i10++;
            }
        }
    }

    private final void z(Set set, boolean z10) {
        int i10;
        String str;
        long[] jArr;
        int i11;
        String str2;
        long[] jArr2;
        int i12;
        long j10;
        int i13;
        boolean a10;
        Object[] objArr;
        Object[] objArr2;
        String str3;
        long[] jArr3;
        int i14;
        String str4;
        long[] jArr4;
        int i15;
        int i16;
        int i17;
        int i18;
        boolean z11;
        long[] jArr5;
        Object[] objArr3;
        long[] jArr6;
        Object[] objArr4;
        Object[] objArr5;
        Object[] objArr6;
        long j11;
        int i19;
        int i20;
        int i21;
        char c10 = 7;
        long j12 = -9187201950435737472L;
        int i22 = 8;
        if (set instanceof a1.d) {
            androidx.collection.r0 e10 = ((a1.d) set).e();
            Object[] objArr7 = e10.f1380b;
            long[] jArr7 = e10.f1379a;
            int length = jArr7.length - 2;
            if (length >= 0) {
                int i23 = 0;
                while (true) {
                    long j13 = jArr7[i23];
                    if ((((~j13) << 7) & j13 & j12) != j12) {
                        int i24 = 8 - ((~(i23 - length)) >>> 31);
                        int i25 = 0;
                        while (i25 < i24) {
                            if ((j13 & 255) < 128) {
                                Object obj = objArr7[(i23 << 3) + i25];
                                if (obj instanceof k2) {
                                    ((k2) obj).s(null);
                                } else {
                                    g(obj, z10);
                                    Object b10 = this.f51808y.d().b(obj);
                                    if (b10 != null) {
                                        if (b10 instanceof androidx.collection.h0) {
                                            androidx.collection.h0 h0Var = (androidx.collection.h0) b10;
                                            Object[] objArr8 = h0Var.f1380b;
                                            long[] jArr8 = h0Var.f1379a;
                                            int length2 = jArr8.length - 2;
                                            if (length2 >= 0) {
                                                i19 = i24;
                                                i20 = i25;
                                                int i26 = 0;
                                                while (true) {
                                                    long j14 = jArr8[i26];
                                                    objArr6 = objArr7;
                                                    j11 = j13;
                                                    if ((((~j14) << 7) & j14 & (-9187201950435737472L)) != -9187201950435737472L) {
                                                        int i27 = 8 - ((~(i26 - length2)) >>> 31);
                                                        for (int i28 = 0; i28 < i27; i28++) {
                                                            if ((j14 & 255) < 128) {
                                                                g((i0) objArr8[(i26 << 3) + i28], z10);
                                                            }
                                                            j14 >>= 8;
                                                        }
                                                        if (i27 != 8) {
                                                            break;
                                                        }
                                                    }
                                                    if (i26 == length2) {
                                                        break;
                                                    }
                                                    i26++;
                                                    objArr7 = objArr6;
                                                    j13 = j11;
                                                }
                                            }
                                        } else {
                                            objArr6 = objArr7;
                                            j11 = j13;
                                            i19 = i24;
                                            i20 = i25;
                                            g((i0) b10, z10);
                                        }
                                        i21 = 8;
                                    }
                                }
                                objArr6 = objArr7;
                                j11 = j13;
                                i19 = i24;
                                i20 = i25;
                                i21 = 8;
                            } else {
                                objArr6 = objArr7;
                                j11 = j13;
                                i19 = i24;
                                i20 = i25;
                                i21 = i22;
                            }
                            j13 = j11 >> i21;
                            i25 = i20 + 1;
                            i24 = i19;
                            i22 = i21;
                            objArr7 = objArr6;
                        }
                        objArr5 = objArr7;
                        if (i24 != i22) {
                            break;
                        }
                    } else {
                        objArr5 = objArr7;
                    }
                    if (i23 == length) {
                        break;
                    }
                    i23++;
                    objArr7 = objArr5;
                    j12 = -9187201950435737472L;
                    i22 = 8;
                }
            }
        } else {
            for (Object obj2 : set) {
                if (obj2 instanceof k2) {
                    ((k2) obj2).s(null);
                } else {
                    g(obj2, z10);
                    Object b11 = this.f51808y.d().b(obj2);
                    if (b11 != null) {
                        if (b11 instanceof androidx.collection.h0) {
                            androidx.collection.h0 h0Var2 = (androidx.collection.h0) b11;
                            Object[] objArr9 = h0Var2.f1380b;
                            long[] jArr9 = h0Var2.f1379a;
                            int length3 = jArr9.length - 2;
                            if (length3 >= 0) {
                                while (true) {
                                    long j15 = jArr9[i10];
                                    if ((((~j15) << 7) & j15 & (-9187201950435737472L)) != -9187201950435737472L) {
                                        int i29 = 8 - ((~(i10 - length3)) >>> 31);
                                        for (int i30 = 0; i30 < i29; i30++) {
                                            if ((j15 & 255) < 128) {
                                                g((i0) objArr9[(i10 << 3) + i30], z10);
                                            }
                                            j15 >>= 8;
                                        }
                                        if (i29 != 8) {
                                            break;
                                        }
                                    }
                                    i10 = i10 != length3 ? i10 + 1 : 0;
                                }
                            }
                        } else {
                            g((i0) b11, z10);
                        }
                    }
                }
            }
        }
        androidx.collection.h0 h0Var3 = this.f51807x;
        androidx.collection.h0 h0Var4 = this.f51806w;
        String str5 = "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2>";
        if (!z10 || !h0Var3.e()) {
            String str6 = "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2>";
            if (h0Var4.e()) {
                androidx.collection.g0 d10 = this.f51805v.d();
                long[] jArr10 = d10.f1366a;
                int length4 = jArr10.length - 2;
                if (length4 >= 0) {
                    int i31 = 0;
                    while (true) {
                        long j16 = jArr10[i31];
                        if ((((~j16) << 7) & j16 & (-9187201950435737472L)) != -9187201950435737472L) {
                            int i32 = 8 - ((~(i31 - length4)) >>> 31);
                            int i33 = 0;
                            while (i33 < i32) {
                                if ((j16 & 255) < 128) {
                                    int i34 = (i31 << 3) + i33;
                                    Object obj3 = d10.f1367b[i34];
                                    Object obj4 = d10.f1368c[i34];
                                    if (obj4 instanceof androidx.collection.h0) {
                                        String str7 = str6;
                                        kotlin.jvm.internal.t.e(obj4, str7);
                                        androidx.collection.h0 h0Var5 = (androidx.collection.h0) obj4;
                                        Object[] objArr10 = h0Var5.f1380b;
                                        long[] jArr11 = h0Var5.f1379a;
                                        int length5 = jArr11.length - 2;
                                        jArr2 = jArr10;
                                        if (length5 >= 0) {
                                            i13 = i32;
                                            str2 = str7;
                                            int i35 = 0;
                                            while (true) {
                                                long j17 = jArr11[i35];
                                                i12 = i31;
                                                j10 = j16;
                                                if ((((~j17) << 7) & j17 & (-9187201950435737472L)) != -9187201950435737472L) {
                                                    int i36 = 8 - ((~(i35 - length5)) >>> 31);
                                                    int i37 = 0;
                                                    while (i37 < i36) {
                                                        if ((j17 & 255) < 128) {
                                                            int i38 = (i35 << 3) + i37;
                                                            objArr2 = objArr10;
                                                            if (h0Var4.a((k2) objArr10[i38])) {
                                                                h0Var5.y(i38);
                                                            }
                                                        } else {
                                                            objArr2 = objArr10;
                                                        }
                                                        j17 >>= 8;
                                                        i37++;
                                                        objArr10 = objArr2;
                                                    }
                                                    objArr = objArr10;
                                                    if (i36 != 8) {
                                                        break;
                                                    }
                                                } else {
                                                    objArr = objArr10;
                                                }
                                                if (i35 == length5) {
                                                    break;
                                                }
                                                i35++;
                                                i31 = i12;
                                                j16 = j10;
                                                objArr10 = objArr;
                                            }
                                        } else {
                                            i12 = i31;
                                            j10 = j16;
                                            i13 = i32;
                                            str2 = str7;
                                        }
                                        a10 = h0Var5.d();
                                    } else {
                                        str2 = str6;
                                        jArr2 = jArr10;
                                        i12 = i31;
                                        j10 = j16;
                                        i13 = i32;
                                        kotlin.jvm.internal.t.e(obj4, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2");
                                        a10 = h0Var4.a((k2) obj4);
                                    }
                                    if (a10) {
                                        d10.p(i34);
                                    }
                                } else {
                                    str2 = str6;
                                    jArr2 = jArr10;
                                    i12 = i31;
                                    j10 = j16;
                                    i13 = i32;
                                }
                                j16 = j10 >> 8;
                                i33++;
                                i32 = i13;
                                i31 = i12;
                                jArr10 = jArr2;
                                str6 = str2;
                            }
                            str = str6;
                            jArr = jArr10;
                            int i39 = i31;
                            if (i32 != 8) {
                                break;
                            } else {
                                i11 = i39;
                            }
                        } else {
                            str = str6;
                            jArr = jArr10;
                            i11 = i31;
                        }
                        if (i11 == length4) {
                            break;
                        }
                        i31 = i11 + 1;
                        jArr10 = jArr;
                        str6 = str;
                    }
                }
                B();
                h0Var4.m();
                return;
            }
            return;
        }
        androidx.collection.g0 d11 = this.f51805v.d();
        long[] jArr12 = d11.f1366a;
        int length6 = jArr12.length - 2;
        if (length6 >= 0) {
            int i40 = 0;
            while (true) {
                long j18 = jArr12[i40];
                if ((((~j18) << c10) & j18 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i41 = 8 - ((~(i40 - length6)) >>> 31);
                    int i42 = 0;
                    while (i42 < i41) {
                        if ((j18 & 255) < 128) {
                            int i43 = (i40 << 3) + i42;
                            Object obj5 = d11.f1367b[i43];
                            Object obj6 = d11.f1368c[i43];
                            if (obj6 instanceof androidx.collection.h0) {
                                kotlin.jvm.internal.t.e(obj6, str5);
                                androidx.collection.h0 h0Var6 = (androidx.collection.h0) obj6;
                                Object[] objArr11 = h0Var6.f1380b;
                                jArr4 = jArr12;
                                long[] jArr13 = h0Var6.f1379a;
                                str4 = str5;
                                int length7 = jArr13.length - 2;
                                i15 = length6;
                                i16 = i40;
                                if (length7 >= 0) {
                                    int i44 = 0;
                                    while (true) {
                                        long j19 = jArr13[i44];
                                        i17 = i41;
                                        i18 = i42;
                                        if ((((~j19) << 7) & j19 & (-9187201950435737472L)) != -9187201950435737472L) {
                                            int i45 = 8 - ((~(i44 - length7)) >>> 31);
                                            int i46 = 0;
                                            while (i46 < i45) {
                                                if ((j19 & 255) < 128) {
                                                    jArr6 = jArr13;
                                                    int i47 = (i44 << 3) + i46;
                                                    objArr4 = objArr11;
                                                    k2 k2Var = (k2) objArr11[i47];
                                                    if (h0Var3.a(k2Var) || h0Var4.a(k2Var)) {
                                                        h0Var6.y(i47);
                                                    }
                                                } else {
                                                    jArr6 = jArr13;
                                                    objArr4 = objArr11;
                                                }
                                                j19 >>= 8;
                                                i46++;
                                                jArr13 = jArr6;
                                                objArr11 = objArr4;
                                            }
                                            jArr5 = jArr13;
                                            objArr3 = objArr11;
                                            if (i45 != 8) {
                                                break;
                                            }
                                        } else {
                                            jArr5 = jArr13;
                                            objArr3 = objArr11;
                                        }
                                        if (i44 == length7) {
                                            break;
                                        }
                                        i44++;
                                        i41 = i17;
                                        i42 = i18;
                                        jArr13 = jArr5;
                                        objArr11 = objArr3;
                                    }
                                } else {
                                    i17 = i41;
                                    i18 = i42;
                                }
                                z11 = h0Var6.d();
                            } else {
                                str4 = str5;
                                jArr4 = jArr12;
                                i15 = length6;
                                i16 = i40;
                                i17 = i41;
                                i18 = i42;
                                kotlin.jvm.internal.t.e(obj6, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap.removeScopeIf$lambda$2");
                                k2 k2Var2 = (k2) obj6;
                                z11 = h0Var3.a(k2Var2) || h0Var4.a(k2Var2);
                            }
                            if (z11) {
                                d11.p(i43);
                            }
                        } else {
                            str4 = str5;
                            jArr4 = jArr12;
                            i15 = length6;
                            i16 = i40;
                            i17 = i41;
                            i18 = i42;
                        }
                        j18 >>= 8;
                        i42 = i18 + 1;
                        str5 = str4;
                        length6 = i15;
                        jArr12 = jArr4;
                        i40 = i16;
                        i41 = i17;
                    }
                    str3 = str5;
                    jArr3 = jArr12;
                    int i48 = length6;
                    int i49 = i40;
                    if (i41 != 8) {
                        break;
                    }
                    length6 = i48;
                    i14 = i49;
                } else {
                    str3 = str5;
                    jArr3 = jArr12;
                    i14 = i40;
                }
                if (i14 == length6) {
                    break;
                }
                i40 = i14 + 1;
                c10 = 7;
                str5 = str3;
                jArr12 = jArr3;
            }
        }
        h0Var3.m();
        B();
    }

    public final a0 G() {
        return this.G;
    }

    public final void K(i0 i0Var) {
        if (this.f51805v.c(i0Var)) {
            return;
        }
        this.f51808y.g(i0Var);
    }

    public final void L(Object obj, k2 k2Var) {
        this.f51805v.f(obj, k2Var);
    }

    @Override // y0.q
    public void a() {
        synchronized (this.f51802s) {
            if (!(!this.H.M0())) {
                b2.b("Composition is disposed while composing. If dispose is triggered by a call in @Composable function, consider wrapping it with SideEffect block.");
            }
            if (!this.K) {
                this.K = true;
                this.L = i.f51572a.b();
                z0.a E0 = this.H.E0();
                if (E0 != null) {
                    A(E0);
                }
                boolean z10 = this.f51804u.E() > 0;
                if (z10 || (!this.f51803t.isEmpty())) {
                    a aVar = new a(this.f51803t);
                    if (z10) {
                        this.f51800q.e();
                        d3 O = this.f51804u.O();
                        try {
                            p.K(O, aVar);
                            rm.n0 n0Var = rm.n0.f34904a;
                            O.L(true);
                            this.f51800q.clear();
                            this.f51800q.i();
                            aVar.g();
                        } catch (Throwable th2) {
                            O.L(false);
                            throw th2;
                        }
                    }
                    aVar.f();
                }
                this.H.p0();
            }
            rm.n0 n0Var2 = rm.n0.f34904a;
        }
        this.f51799p.r(this);
    }

    @Override // y0.f0, y0.m2
    public void b(Object obj) {
        k2 D0;
        long[] jArr;
        long[] jArr2;
        int i10;
        if (F() || (D0 = this.H.D0()) == null) {
            return;
        }
        D0.H(true);
        if (D0.w(obj)) {
            return;
        }
        if (obj instanceof j1.y) {
            ((j1.y) obj).t(j1.g.a(1));
        }
        this.f51805v.a(obj, D0);
        if (obj instanceof i0) {
            i0 i0Var = (i0) obj;
            i0.a p10 = i0Var.p();
            this.f51808y.g(obj);
            androidx.collection.j0 b10 = p10.b();
            Object[] objArr = b10.f1332b;
            long[] jArr3 = b10.f1331a;
            int length = jArr3.length - 2;
            if (length >= 0) {
                int i11 = 0;
                while (true) {
                    long j10 = jArr3[i11];
                    if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                        int i12 = 8;
                        int i13 = 8 - ((~(i11 - length)) >>> 31);
                        int i14 = 0;
                        while (i14 < i13) {
                            if ((j10 & 255) < 128) {
                                j1.x xVar = (j1.x) objArr[(i11 << 3) + i14];
                                if (xVar instanceof j1.y) {
                                    jArr2 = jArr3;
                                    ((j1.y) xVar).t(j1.g.a(1));
                                } else {
                                    jArr2 = jArr3;
                                }
                                this.f51808y.a(xVar, obj);
                                i10 = 8;
                            } else {
                                jArr2 = jArr3;
                                i10 = i12;
                            }
                            j10 >>= i10;
                            i14++;
                            i12 = i10;
                            jArr3 = jArr2;
                        }
                        jArr = jArr3;
                        if (i13 != i12) {
                            break;
                        }
                    } else {
                        jArr = jArr3;
                    }
                    if (i11 == length) {
                        break;
                    }
                    i11++;
                    jArr3 = jArr;
                }
            }
            D0.v(i0Var, p10.a());
        }
    }

    @Override // y0.m2
    public y0 c(k2 k2Var, Object obj) {
        t tVar;
        if (k2Var.k()) {
            k2Var.C(true);
        }
        d i10 = k2Var.i();
        if (i10 == null || !i10.b()) {
            return y0.IGNORED;
        }
        if (this.f51804u.P(i10)) {
            return !k2Var.j() ? y0.IGNORED : H(k2Var, i10, obj);
        }
        synchronized (this.f51802s) {
            tVar = this.E;
        }
        return tVar != null && tVar.N(k2Var, obj) ? y0.IMMINENT : y0.IGNORED;
    }

    @Override // y0.m2
    public void d(k2 k2Var) {
        this.D = true;
    }

    @Override // y0.u2
    public void deactivate() {
        synchronized (this.f51802s) {
            boolean z10 = this.f51804u.E() > 0;
            if (z10 || (!this.f51803t.isEmpty())) {
                c4 c4Var = c4.f51502a;
                Object a10 = c4Var.a("Compose:deactivate");
                try {
                    a aVar = new a(this.f51803t);
                    if (z10) {
                        this.f51800q.e();
                        d3 O = this.f51804u.O();
                        try {
                            p.t(O, aVar);
                            rm.n0 n0Var = rm.n0.f34904a;
                            O.L(true);
                            this.f51800q.i();
                            aVar.g();
                        } catch (Throwable th2) {
                            O.L(false);
                            throw th2;
                        }
                    }
                    aVar.f();
                    rm.n0 n0Var2 = rm.n0.f34904a;
                    c4Var.b(a10);
                } catch (Throwable th3) {
                    c4.f51502a.b(a10);
                    throw th3;
                }
            }
            this.f51805v.b();
            this.f51808y.b();
            this.C.b();
            this.f51809z.a();
            this.A.a();
            this.H.o0();
            rm.n0 n0Var3 = rm.n0.f34904a;
        }
    }

    @Override // y0.f0
    public void e(k1 k1Var) {
        a aVar = new a(this.f51803t);
        d3 O = k1Var.a().O();
        try {
            p.K(O, aVar);
            rm.n0 n0Var = rm.n0.f34904a;
            O.L(true);
            aVar.g();
        } catch (Throwable th2) {
            O.L(false);
            throw th2;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:19:0x0055, code lost:
    
        return true;
     */
    @Override // y0.f0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean h(Set set) {
        if (set instanceof a1.d) {
            androidx.collection.r0 e10 = ((a1.d) set).e();
            Object[] objArr = e10.f1380b;
            long[] jArr = e10.f1379a;
            int length = jArr.length - 2;
            if (length >= 0) {
                int i10 = 0;
                loop0: while (true) {
                    long j10 = jArr[i10];
                    if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                        int i11 = 8 - ((~(i10 - length)) >>> 31);
                        for (int i12 = 0; i12 < i11; i12++) {
                            if ((255 & j10) < 128) {
                                Object obj = objArr[(i10 << 3) + i12];
                                if (this.f51805v.c(obj) || this.f51808y.c(obj)) {
                                    break loop0;
                                }
                            }
                            j10 >>= 8;
                        }
                        if (i11 != 8) {
                            break;
                        }
                    }
                    if (i10 == length) {
                        break;
                    }
                    i10++;
                }
            }
        } else {
            for (Object obj2 : set) {
                if (this.f51805v.c(obj2) || this.f51808y.c(obj2)) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override // y0.q
    public void i(dn.p pVar) {
        C(pVar);
    }

    @Override // y0.u2
    public void j(dn.p pVar) {
        this.H.n1();
        C(pVar);
        this.H.u0();
    }

    @Override // y0.f0
    public void k(dn.a aVar) {
        this.H.R0(aVar);
    }

    @Override // y0.f0
    public void l() {
        synchronized (this.f51802s) {
            try {
                if (this.A.d()) {
                    A(this.A);
                }
                rm.n0 n0Var = rm.n0.f34904a;
            } catch (Throwable th2) {
                try {
                    if (!this.f51803t.isEmpty()) {
                        new a(this.f51803t).f();
                    }
                    throw th2;
                } catch (Exception e10) {
                    this.v();
                    throw e10;
                }
            }
        }
    }

    @Override // y0.f0
    public Object m(f0 f0Var, int i10, dn.a aVar) {
        if (f0Var == null || kotlin.jvm.internal.t.b(f0Var, this) || i10 < 0) {
            return aVar.invoke();
        }
        this.E = (t) f0Var;
        this.F = i10;
        try {
            return aVar.invoke();
        } finally {
            this.E = null;
            this.F = 0;
        }
    }

    @Override // y0.q
    public boolean n() {
        return this.K;
    }

    @Override // y0.f0
    public void o(dn.p pVar) {
        try {
            synchronized (this.f51802s) {
                D();
                a1.f M = M();
                try {
                    J();
                    this.H.j0(M, pVar);
                } catch (Exception e10) {
                    this.C = M;
                    throw e10;
                }
            }
        } finally {
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r2v4, types: [java.lang.Object[]] */
    /* JADX WARN: Type inference failed for: r2v6, types: [java.util.Set[]] */
    @Override // y0.f0
    public void p(Set set) {
        Object obj;
        ?? B;
        Set set2;
        do {
            obj = this.f51801r.get();
            if (obj == null ? true : kotlin.jvm.internal.t.b(obj, u.c())) {
                set2 = set;
            } else if (obj instanceof Set) {
                set2 = new Set[]{obj, set};
            } else {
                if (!(obj instanceof Object[])) {
                    throw new IllegalStateException(("corrupt pendingModifications: " + this.f51801r).toString());
                }
                kotlin.jvm.internal.t.e(obj, "null cannot be cast to non-null type kotlin.Array<kotlin.collections.Set<kotlin.Any>>");
                B = sm.o.B((Set[]) obj, set);
                set2 = B;
            }
        } while (!y.x0.a(this.f51801r, obj, set2));
        if (obj == null) {
            synchronized (this.f51802s) {
                E();
                rm.n0 n0Var = rm.n0.f34904a;
            }
        }
    }

    @Override // y0.f0
    public void q() {
        synchronized (this.f51802s) {
            try {
                A(this.f51809z);
                E();
                rm.n0 n0Var = rm.n0.f34904a;
            } catch (Throwable th2) {
                try {
                    if (!this.f51803t.isEmpty()) {
                        new a(this.f51803t).f();
                    }
                    throw th2;
                } catch (Exception e10) {
                    this.v();
                    throw e10;
                }
            }
        }
    }

    @Override // y0.f0
    public boolean r() {
        return this.H.M0();
    }

    @Override // y0.f0
    public void s(List list) {
        int size = list.size();
        boolean z10 = false;
        int i10 = 0;
        while (true) {
            if (i10 >= size) {
                z10 = true;
                break;
            } else if (!kotlin.jvm.internal.t.b(((l1) ((rm.v) list.get(i10)).c()).b(), this)) {
                break;
            } else {
                i10++;
            }
        }
        p.O(z10);
        try {
            this.H.J0(list);
            rm.n0 n0Var = rm.n0.f34904a;
        } finally {
        }
    }

    @Override // y0.f0
    public void t(Object obj) {
        synchronized (this.f51802s) {
            I(obj);
            Object b10 = this.f51808y.d().b(obj);
            if (b10 != null) {
                if (b10 instanceof androidx.collection.h0) {
                    androidx.collection.h0 h0Var = (androidx.collection.h0) b10;
                    Object[] objArr = h0Var.f1380b;
                    long[] jArr = h0Var.f1379a;
                    int length = jArr.length - 2;
                    if (length >= 0) {
                        int i10 = 0;
                        while (true) {
                            long j10 = jArr[i10];
                            if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                                int i11 = 8 - ((~(i10 - length)) >>> 31);
                                for (int i12 = 0; i12 < i11; i12++) {
                                    if ((255 & j10) < 128) {
                                        I((i0) objArr[(i10 << 3) + i12]);
                                    }
                                    j10 >>= 8;
                                }
                                if (i11 != 8) {
                                    break;
                                }
                            }
                            if (i10 == length) {
                                break;
                            } else {
                                i10++;
                            }
                        }
                    }
                } else {
                    I((i0) b10);
                }
            }
            rm.n0 n0Var = rm.n0.f34904a;
        }
    }

    @Override // y0.q
    public boolean u() {
        boolean z10;
        synchronized (this.f51802s) {
            z10 = this.C.e() > 0;
        }
        return z10;
    }

    @Override // y0.f0
    public void v() {
        this.f51801r.set(null);
        this.f51809z.a();
        this.A.a();
        if (!this.f51803t.isEmpty()) {
            new a(this.f51803t).f();
        }
    }

    @Override // y0.f0
    public void w() {
        synchronized (this.f51802s) {
            try {
                this.H.g0();
                if (!this.f51803t.isEmpty()) {
                    new a(this.f51803t).f();
                }
                rm.n0 n0Var = rm.n0.f34904a;
            } catch (Throwable th2) {
                try {
                    if (!this.f51803t.isEmpty()) {
                        new a(this.f51803t).f();
                    }
                    throw th2;
                } catch (Exception e10) {
                    this.v();
                    throw e10;
                }
            }
        }
    }

    @Override // y0.f0
    public boolean x() {
        boolean T0;
        synchronized (this.f51802s) {
            D();
            try {
                a1.f M = M();
                try {
                    J();
                    T0 = this.H.T0(M);
                    if (!T0) {
                        E();
                    }
                } catch (Exception e10) {
                    this.C = M;
                    throw e10;
                }
            } catch (Throwable th2) {
                try {
                    if (!this.f51803t.isEmpty()) {
                        new a(this.f51803t).f();
                    }
                    throw th2;
                } catch (Exception e11) {
                    v();
                    throw e11;
                }
            }
        }
        return T0;
    }

    @Override // y0.f0
    public void y() {
        synchronized (this.f51802s) {
            for (Object obj : this.f51804u.F()) {
                k2 k2Var = obj instanceof k2 ? (k2) obj : null;
                if (k2Var != null) {
                    k2Var.invalidate();
                }
            }
            rm.n0 n0Var = rm.n0.f34904a;
        }
    }

    public /* synthetic */ t(r rVar, f fVar, vm.g gVar, int i10, kotlin.jvm.internal.k kVar) {
        this(rVar, fVar, (i10 & 4) != 0 ? null : gVar);
    }
}
