package androidx.compose.runtime;

import androidx.compose.runtime.DerivedState;
import androidx.compose.runtime.changelist.ChangeList;
import androidx.compose.runtime.collection.ScatterSetWrapper;
import androidx.compose.runtime.collection.ScopeMap;
import androidx.compose.runtime.internal.RememberEventDispatcher;
import androidx.compose.runtime.internal.StabilityInferred;
import androidx.compose.runtime.internal.Trace;
import androidx.compose.runtime.snapshots.ReaderKind;
import androidx.compose.runtime.snapshots.StateObject;
import androidx.compose.runtime.snapshots.StateObjectImpl;
import androidx.compose.runtime.tooling.CompositionObserver;
import androidx.compose.runtime.tooling.CompositionObserverHandle;
import androidx.compose.runtime.tooling.ObservableComposition;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import n.C2596x;
import n.N;
import n.O;
import n.Q;
import n.S;
import n.Z;
import n.c0;
import x4.AbstractC3250p;
import x4.AbstractC3251q;
import x4.C3224A;
import x4.y;

/* JADX INFO: loaded from: classes.dex */
@StabilityInferred(parameters = 0)
public final class CompositionImpl implements ControlledComposition, ReusableComposition, RecomposeScopeOwner, CompositionServices, PausableComposition, ObservableComposition {
    public static final int $stable = 8;
    private final A4.j _recomposeContext;
    private final Set<RememberObserver> abandonSet;
    private final Applier<?> applier;
    private final ChangeList changes;
    private J4.e composable;
    private final ComposerImpl composer;
    private final O conditionallyInvalidatedScopes;
    private final N derivedStates;
    private final O invalidatedScopes;
    private CompositionImpl invalidationDelegate;
    private int invalidationDelegateGroup;
    private N invalidations;
    private final boolean isRoot;
    private final ChangeList lateChanges;
    private final Object lock;
    private final N observations;
    private final N observationsProcessed;
    private final CompositionObserverHolder observerHolder;
    private final CompositionContext parent;
    private boolean pendingInvalidScopes;
    private final AtomicReference<Object> pendingModifications;
    private PausedCompositionImpl pendingPausedComposition;
    private final RememberEventDispatcher rememberManager;
    private ShouldPauseCallback shouldPause;
    private final SlotTable slotTable;
    private int state;

    public CompositionImpl(CompositionContext compositionContext, Applier<?> applier, A4.j jVar) {
        this.parent = compositionContext;
        this.applier = applier;
        this.pendingModifications = new AtomicReference<>(null);
        this.lock = new Object();
        Q q6 = new Q(new O());
        this.abandonSet = q6;
        SlotTable slotTable = new SlotTable();
        if (compositionContext.getCollectingCallByInformation$runtime()) {
            slotTable.collectCalledByInformation();
        }
        if (compositionContext.getCollectingSourceInformation$runtime()) {
            slotTable.collectSourceInformation();
        }
        this.slotTable = slotTable;
        this.observations = ScopeMap.m183constructorimpl$default(null, 1, null);
        this.invalidatedScopes = new O();
        this.conditionallyInvalidatedScopes = new O();
        this.derivedStates = ScopeMap.m183constructorimpl$default(null, 1, null);
        ChangeList changeList = new ChangeList();
        this.changes = changeList;
        ChangeList changeList2 = new ChangeList();
        this.lateChanges = changeList2;
        this.observationsProcessed = ScopeMap.m183constructorimpl$default(null, 1, null);
        this.invalidations = ScopeMap.m183constructorimpl$default(null, 1, null);
        CompositionObserverHolder compositionObserverHolder = new CompositionObserverHolder(null, false, compositionContext, 3, null);
        this.observerHolder = compositionObserverHolder;
        this.rememberManager = new RememberEventDispatcher();
        ComposerImpl composerImpl = new ComposerImpl(applier, compositionContext, slotTable, q6, changeList, changeList2, compositionObserverHolder, this);
        compositionContext.registerComposer$runtime(composerImpl);
        this.composer = composerImpl;
        this._recomposeContext = jVar;
        this.isRoot = compositionContext instanceof Recomposer;
        this.composable = ComposableSingletons$CompositionKt.INSTANCE.getLambda$954879418$runtime();
    }

    private final void addPendingInvalidationsLocked(Object obj, boolean z6) {
        Object objD = this.observations.d(obj);
        if (objD == null) {
            return;
        }
        if (!(objD instanceof O)) {
            RecomposeScopeImpl recomposeScopeImpl = (RecomposeScopeImpl) objD;
            if (ScopeMap.m190removeimpl(this.observationsProcessed, obj, recomposeScopeImpl) || recomposeScopeImpl.invalidateForResult(obj) == InvalidationResult.IGNORED) {
                return;
            }
            if (!recomposeScopeImpl.isConditional() || z6) {
                this.invalidatedScopes.d(recomposeScopeImpl);
                return;
            } else {
                this.conditionallyInvalidatedScopes.d(recomposeScopeImpl);
                return;
            }
        }
        O o6 = (O) objD;
        Object[] objArr = o6.f21389b;
        long[] jArr = o6.f21388a;
        int length = jArr.length - 2;
        if (length < 0) {
            return;
        }
        int i6 = 0;
        while (true) {
            long j4 = jArr[i6];
            if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                int i7 = 8 - ((~(i6 - length)) >>> 31);
                for (int i8 = 0; i8 < i7; i8++) {
                    if ((255 & j4) < 128) {
                        RecomposeScopeImpl recomposeScopeImpl2 = (RecomposeScopeImpl) objArr[(i6 << 3) + i8];
                        if (!ScopeMap.m190removeimpl(this.observationsProcessed, obj, recomposeScopeImpl2) && recomposeScopeImpl2.invalidateForResult(obj) != InvalidationResult.IGNORED) {
                            if (!recomposeScopeImpl2.isConditional() || z6) {
                                this.invalidatedScopes.d(recomposeScopeImpl2);
                            } else {
                                this.conditionallyInvalidatedScopes.d(recomposeScopeImpl2);
                            }
                        }
                    }
                    j4 >>= 8;
                }
                if (i7 != 8) {
                    return;
                }
            }
            if (i6 == length) {
                return;
            } else {
                i6++;
            }
        }
    }

    /* JADX WARN: Finally extract failed */
    private final void applyChangesInLocked(ChangeList changeList) {
        Applier<?> pausableApplier$runtime;
        RememberEventDispatcher rememberManager$runtime;
        long[] jArr;
        long[] jArr2;
        long j4;
        char c6;
        long j6;
        int i6;
        boolean zB;
        long[] jArr3;
        this.rememberManager.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
        try {
            if (changeList.isEmpty()) {
                try {
                    if (this.lateChanges.isEmpty() && this.pendingPausedComposition == null) {
                        this.rememberManager.dispatchAbandons();
                    }
                } finally {
                }
            } else {
                PausedCompositionImpl pausedCompositionImpl = this.pendingPausedComposition;
                if (pausedCompositionImpl == null || (pausableApplier$runtime = pausedCompositionImpl.getPausableApplier$runtime()) == null) {
                    pausableApplier$runtime = this.applier;
                }
                PausedCompositionImpl pausedCompositionImpl2 = this.pendingPausedComposition;
                String str = kotlin.jvm.internal.o.c(pausableApplier$runtime, pausedCompositionImpl2 != null ? pausedCompositionImpl2.getPausableApplier$runtime() : null) ? "Compose:recordChanges" : "Compose:applyChanges";
                Trace trace = Trace.INSTANCE;
                Object objBeginSection = trace.beginSection(str);
                try {
                    PausedCompositionImpl pausedCompositionImpl3 = this.pendingPausedComposition;
                    if (pausedCompositionImpl3 == null || (rememberManager$runtime = pausedCompositionImpl3.getRememberManager$runtime()) == null) {
                        rememberManager$runtime = this.rememberManager;
                    }
                    pausableApplier$runtime.onBeginChanges();
                    SlotWriter slotWriterOpenWriter = this.slotTable.openWriter();
                    int i7 = 0;
                    try {
                        changeList.executeAndFlushAllPendingChanges(pausableApplier$runtime, slotWriterOpenWriter, rememberManager$runtime, this.composer.getErrorContext$runtime());
                        slotWriterOpenWriter.close(true);
                        pausableApplier$runtime.onEndChanges();
                        trace.endSection(objBeginSection);
                        this.rememberManager.dispatchRememberObservers();
                        this.rememberManager.dispatchSideEffects();
                        if (this.pendingInvalidScopes) {
                            objBeginSection = trace.beginSection("Compose:unobserve");
                            try {
                                this.pendingInvalidScopes = false;
                                N n6 = this.observations;
                                long[] jArr4 = n6.f21381a;
                                int length = jArr4.length - 2;
                                if (length >= 0) {
                                    int i8 = 0;
                                    while (true) {
                                        long j7 = jArr4[i8];
                                        char c7 = 7;
                                        long j8 = -9187201950435737472L;
                                        if ((((~j7) << 7) & j7 & (-9187201950435737472L)) != -9187201950435737472L) {
                                            int i9 = 8;
                                            int i10 = 8 - ((~(i8 - length)) >>> 31);
                                            int i11 = i7;
                                            while (i11 < i10) {
                                                if ((j7 & 255) < 128) {
                                                    int i12 = (i8 << 3) + i11;
                                                    c6 = c7;
                                                    Object obj = n6.f21382b[i12];
                                                    Object obj2 = n6.f21383c[i12];
                                                    j6 = j8;
                                                    if (obj2 instanceof O) {
                                                        kotlin.jvm.internal.o.f(obj2, "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap>");
                                                        O o6 = (O) obj2;
                                                        Object[] objArr = o6.f21389b;
                                                        long[] jArr5 = o6.f21388a;
                                                        int length2 = jArr5.length - 2;
                                                        if (length2 >= 0) {
                                                            j4 = j7;
                                                            int i13 = i9;
                                                            int i14 = 0;
                                                            while (true) {
                                                                long j9 = jArr5[i14];
                                                                Object[] objArr2 = objArr;
                                                                long[] jArr6 = jArr5;
                                                                if ((((~j9) << c6) & j9 & j6) != j6) {
                                                                    int i15 = 8 - ((~(i14 - length2)) >>> 31);
                                                                    int i16 = 0;
                                                                    while (i16 < i15) {
                                                                        if ((j9 & 255) < 128) {
                                                                            jArr3 = jArr4;
                                                                            int i17 = (i14 << 3) + i16;
                                                                            if (!((RecomposeScopeImpl) objArr2[i17]).getValid()) {
                                                                                o6.m(i17);
                                                                            }
                                                                        } else {
                                                                            jArr3 = jArr4;
                                                                        }
                                                                        j9 >>= i13;
                                                                        i16++;
                                                                        jArr4 = jArr3;
                                                                    }
                                                                    jArr2 = jArr4;
                                                                    if (i15 != i13) {
                                                                        break;
                                                                    }
                                                                } else {
                                                                    jArr2 = jArr4;
                                                                }
                                                                if (i14 == length2) {
                                                                    break;
                                                                }
                                                                i14++;
                                                                objArr = objArr2;
                                                                jArr5 = jArr6;
                                                                jArr4 = jArr2;
                                                                i13 = 8;
                                                            }
                                                        } else {
                                                            jArr2 = jArr4;
                                                            j4 = j7;
                                                        }
                                                        zB = o6.b();
                                                    } else {
                                                        jArr2 = jArr4;
                                                        j4 = j7;
                                                        kotlin.jvm.internal.o.f(obj2, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap");
                                                        zB = !((RecomposeScopeImpl) obj2).getValid();
                                                    }
                                                    if (zB) {
                                                        n6.k(i12);
                                                    }
                                                    i6 = 8;
                                                } else {
                                                    jArr2 = jArr4;
                                                    j4 = j7;
                                                    c6 = c7;
                                                    j6 = j8;
                                                    i6 = i9;
                                                }
                                                j7 = j4 >> i6;
                                                i11++;
                                                i9 = i6;
                                                c7 = c6;
                                                j8 = j6;
                                                jArr4 = jArr2;
                                            }
                                            jArr = jArr4;
                                            if (i10 != i9) {
                                                break;
                                            }
                                        } else {
                                            jArr = jArr4;
                                        }
                                        if (i8 == length) {
                                            break;
                                        }
                                        i8++;
                                        jArr4 = jArr;
                                        i7 = 0;
                                    }
                                }
                                cleanUpDerivedStateObservations();
                                Trace.INSTANCE.endSection(objBeginSection);
                            } finally {
                                Trace.INSTANCE.endSection(objBeginSection);
                            }
                        }
                        try {
                            if (this.lateChanges.isEmpty() && this.pendingPausedComposition == null) {
                                this.rememberManager.dispatchAbandons();
                            }
                        } finally {
                        }
                    } catch (Throwable th) {
                        slotWriterOpenWriter.close(false);
                        throw th;
                    }
                } catch (Throwable th2) {
                    throw th2;
                }
            }
        } catch (Throwable th3) {
            try {
                if (this.lateChanges.isEmpty() && this.pendingPausedComposition == null) {
                    this.rememberManager.dispatchAbandons();
                }
                throw th3;
            } finally {
            }
        }
    }

    private final void cleanUpDerivedStateObservations() {
        char c6;
        long j4;
        long j6;
        long j7;
        long[] jArr;
        long[] jArr2;
        long j8;
        int i6;
        char c7;
        long j9;
        long j10;
        int i7;
        boolean zB;
        long[] jArr3;
        int i8;
        int i9;
        N n6 = this.derivedStates;
        long[] jArr4 = n6.f21381a;
        int length = jArr4.length - 2;
        char c8 = 7;
        long j11 = -9187201950435737472L;
        int i10 = 8;
        if (length >= 0) {
            int i11 = 0;
            long j12 = 128;
            while (true) {
                long j13 = jArr4[i11];
                j6 = 255;
                if ((((~j13) << c8) & j13 & j11) != j11) {
                    int i12 = 8 - ((~(i11 - length)) >>> 31);
                    int i13 = 0;
                    while (i13 < i12) {
                        if ((j13 & 255) < j12) {
                            c7 = c8;
                            int i14 = (i11 << 3) + i13;
                            j9 = j11;
                            Object obj = n6.f21382b[i14];
                            Object obj2 = n6.f21383c[i14];
                            if (obj2 instanceof O) {
                                kotlin.jvm.internal.o.f(obj2, "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap>");
                                O o6 = (O) obj2;
                                Object[] objArr = o6.f21389b;
                                long[] jArr5 = o6.f21388a;
                                int length2 = jArr5.length - 2;
                                if (length2 >= 0) {
                                    j10 = j12;
                                    int i15 = 0;
                                    int i16 = i10;
                                    while (true) {
                                        int i17 = length2;
                                        long j14 = jArr5[i15];
                                        j8 = j13;
                                        if ((((~j14) << c7) & j14 & j9) != j9) {
                                            int i18 = 8 - ((~(i15 - i17)) >>> 31);
                                            int i19 = 0;
                                            while (i19 < i18) {
                                                if ((j14 & 255) < j10) {
                                                    jArr3 = jArr4;
                                                    int i20 = (i15 << 3) + i19;
                                                    i8 = i19;
                                                    i9 = i13;
                                                    if (!ScopeMap.m184containsimpl(this.observations, (DerivedState) objArr[i20])) {
                                                        o6.m(i20);
                                                    }
                                                } else {
                                                    jArr3 = jArr4;
                                                    i8 = i19;
                                                    i9 = i13;
                                                }
                                                j14 >>= i16;
                                                i19 = i8 + 1;
                                                i13 = i9;
                                                jArr4 = jArr3;
                                            }
                                            jArr2 = jArr4;
                                            i6 = i13;
                                            if (i18 != i16) {
                                                break;
                                            }
                                        } else {
                                            jArr2 = jArr4;
                                            i6 = i13;
                                        }
                                        length2 = i17;
                                        if (i15 == length2) {
                                            break;
                                        }
                                        i15++;
                                        j13 = j8;
                                        i13 = i6;
                                        jArr4 = jArr2;
                                        i16 = 8;
                                    }
                                } else {
                                    jArr2 = jArr4;
                                    j8 = j13;
                                    i6 = i13;
                                    j10 = j12;
                                }
                                zB = o6.b();
                            } else {
                                jArr2 = jArr4;
                                j8 = j13;
                                i6 = i13;
                                j10 = j12;
                                kotlin.jvm.internal.o.f(obj2, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap");
                                zB = !ScopeMap.m184containsimpl(this.observations, (DerivedState) obj2);
                            }
                            if (zB) {
                                n6.k(i14);
                            }
                            i7 = 8;
                        } else {
                            jArr2 = jArr4;
                            j8 = j13;
                            i6 = i13;
                            c7 = c8;
                            j9 = j11;
                            j10 = j12;
                            i7 = i10;
                        }
                        j13 = j8 >> i7;
                        i13 = i6 + 1;
                        i10 = i7;
                        c8 = c7;
                        j11 = j9;
                        j12 = j10;
                        jArr4 = jArr2;
                    }
                    jArr = jArr4;
                    c6 = c8;
                    j4 = j11;
                    j7 = j12;
                    if (i12 != i10) {
                        break;
                    }
                } else {
                    jArr = jArr4;
                    c6 = c8;
                    j4 = j11;
                    j7 = j12;
                }
                if (i11 == length) {
                    break;
                }
                i11++;
                c8 = c6;
                j11 = j4;
                j12 = j7;
                jArr4 = jArr;
                i10 = 8;
            }
        } else {
            c6 = 7;
            j4 = -9187201950435737472L;
            j6 = 255;
            j7 = 128;
        }
        if (!this.conditionallyInvalidatedScopes.c()) {
            return;
        }
        O o7 = this.conditionallyInvalidatedScopes;
        Object[] objArr2 = o7.f21389b;
        long[] jArr6 = o7.f21388a;
        int length3 = jArr6.length - 2;
        if (length3 < 0) {
            return;
        }
        int i21 = 0;
        while (true) {
            long j15 = jArr6[i21];
            if ((((~j15) << c6) & j15 & j4) != j4) {
                int i22 = 8 - ((~(i21 - length3)) >>> 31);
                for (int i23 = 0; i23 < i22; i23++) {
                    if ((j15 & j6) < j7) {
                        int i24 = (i21 << 3) + i23;
                        if (!((RecomposeScopeImpl) objArr2[i24]).isConditional()) {
                            o7.m(i24);
                        }
                    }
                    j15 >>= 8;
                }
                if (i22 != 8) {
                    return;
                }
            }
            if (i21 == length3) {
                return;
            } else {
                i21++;
            }
        }
    }

    private final boolean clearDeactivated() {
        boolean z6;
        synchronized (this.lock) {
            z6 = true;
            if (this.state != 1) {
                z6 = false;
            }
            if (z6) {
                this.state = 0;
            }
        }
        return z6;
    }

    private final void composeInitial(J4.e eVar) {
        this.composable = eVar;
        this.parent.composeInitial$runtime(this, eVar);
    }

    private final PausedComposition composeInitialPaused(boolean z6, J4.e eVar) {
        if (this.pendingPausedComposition != null) {
            PreconditionsKt.throwIllegalStateException("A pausable composition is in progress");
        }
        PausedCompositionImpl pausedCompositionImpl = new PausedCompositionImpl(this, this.parent, this.composer, this.abandonSet, eVar, z6, this.applier, this.lock);
        this.pendingPausedComposition = pausedCompositionImpl;
        return pausedCompositionImpl;
    }

    private final void composeInitialWithReuse(J4.e eVar) {
        this.composer.startReuseFromRoot();
        composeInitial(eVar);
        this.composer.endReuseFromRoot();
    }

    private final void drainPendingModificationsForCompositionLocked() {
        Object andSet = this.pendingModifications.getAndSet(CompositionKt.PendingApplyNoModifications);
        if (andSet != null) {
            if (andSet.equals(CompositionKt.PendingApplyNoModifications)) {
                ComposerKt.composeRuntimeError("pending composition has not been applied");
                throw new E3.v();
            }
            if (andSet instanceof Set) {
                addPendingInvalidationsLocked((Set<? extends Object>) andSet, true);
                return;
            }
            if (!(andSet instanceof Object[])) {
                ComposerKt.composeRuntimeError("corrupt pendingModifications drain: " + this.pendingModifications);
                throw new E3.v();
            }
            for (Set<? extends Object> set : (Set[]) andSet) {
                addPendingInvalidationsLocked(set, true);
            }
        }
    }

    private final void drainPendingModificationsLocked() {
        Object andSet = this.pendingModifications.getAndSet(null);
        if (kotlin.jvm.internal.o.c(andSet, CompositionKt.PendingApplyNoModifications)) {
            return;
        }
        if (andSet instanceof Set) {
            addPendingInvalidationsLocked((Set<? extends Object>) andSet, false);
            return;
        }
        if (andSet instanceof Object[]) {
            for (Set<? extends Object> set : (Set[]) andSet) {
                addPendingInvalidationsLocked(set, false);
            }
            return;
        }
        if (andSet != null) {
            ComposerKt.composeRuntimeError("corrupt pendingModifications drain: " + this.pendingModifications);
            throw new E3.v();
        }
        if (this.pendingPausedComposition == null) {
            ComposerKt.composeImmediateRuntimeError("calling recordModificationsOf and applyChanges concurrently is not supported");
        }
    }

    private final void drainPendingModificationsOutOfBandLocked() {
        Object andSet = this.pendingModifications.getAndSet(C3224A.f26032a);
        if (kotlin.jvm.internal.o.c(andSet, CompositionKt.PendingApplyNoModifications) || andSet == null) {
            return;
        }
        if (andSet instanceof Set) {
            addPendingInvalidationsLocked((Set<? extends Object>) andSet, false);
            return;
        }
        if (!(andSet instanceof Object[])) {
            ComposerKt.composeRuntimeError("corrupt pendingModifications drain: " + this.pendingModifications);
            throw new E3.v();
        }
        for (Set<? extends Object> set : (Set[]) andSet) {
            addPendingInvalidationsLocked(set, false);
        }
    }

    private final void ensureRunning() {
        int i6 = this.state;
        if (!(i6 == 0)) {
            PreconditionsKt.throwIllegalStateException(i6 != 1 ? i6 != 2 ? i6 != 3 ? "" : "The composition is disposed" : "A previous pausable composition for this composition was cancelled. This composition must be disposed." : "The composition should be activated before setting content.");
        }
        if (this.pendingPausedComposition == null) {
            return;
        }
        PreconditionsKt.throwIllegalStateException("A pausable composition is in progress");
    }

    private static /* synthetic */ void getAbandonSet$annotations() {
    }

    private final boolean getAreChildrenComposing() {
        return this.composer.getAreChildrenComposing$runtime();
    }

    public static /* synthetic */ void getPendingInvalidScopes$runtime$annotations() {
    }

    public static /* synthetic */ void getSlotTable$runtime$annotations() {
    }

    private final <T> T guardChanges(J4.a aVar) {
        try {
            return (T) aVar.invoke();
        } catch (Throwable th) {
            try {
                if (!this.abandonSet.isEmpty()) {
                    RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                    try {
                        rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                        rememberEventDispatcher.dispatchAbandons();
                        rememberEventDispatcher.clear();
                    } catch (Throwable th2) {
                        rememberEventDispatcher.clear();
                        throw th2;
                    }
                }
                throw th;
            } catch (Throwable th3) {
                abandonChanges();
                throw th3;
            }
        }
    }

    private final <T> T guardInvalidationsLocked(J4.c cVar) {
        N nM25takeInvalidationsafanTW4 = m25takeInvalidationsafanTW4();
        try {
            return (T) cVar.invoke(ScopeMap.m180boximpl(nM25takeInvalidationsafanTW4));
        } catch (Throwable th) {
            this.invalidations = nM25takeInvalidationsafanTW4;
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:44:0x009c  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00a6 A[Catch: all -> 0x001e, EDGE_INSN: B:64:0x00a6->B:49:0x00a6 BREAK  A[LOOP:0: B:31:0x005d->B:45:0x009e], EDGE_INSN: B:65:0x00a6->B:49:0x00a6 BREAK  A[LOOP:0: B:31:0x005d->B:45:0x009e], TRY_LEAVE, TryCatch #0 {all -> 0x001e, blocks: (B:4:0x000b, B:6:0x0010, B:14:0x0023, B:16:0x0029, B:20:0x002f, B:21:0x0038, B:23:0x003c, B:24:0x0045, B:26:0x004d, B:28:0x0051, B:31:0x005d, B:33:0x006d, B:35:0x0079, B:37:0x0083, B:41:0x0092, B:45:0x009e, B:46:0x00a1, B:49:0x00a6), top: B:62:0x000b }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private final InvalidationResult invalidateChecked(RecomposeScopeImpl recomposeScopeImpl, Anchor anchor, Object obj) {
        int i6;
        synchronized (this.lock) {
            try {
                CompositionImpl compositionImpl = this.invalidationDelegate;
                CompositionImpl compositionImpl2 = null;
                if (compositionImpl != null) {
                    if (!this.slotTable.groupContainsAnchor(this.invalidationDelegateGroup, anchor)) {
                        compositionImpl = null;
                    }
                    compositionImpl2 = compositionImpl;
                }
                if (compositionImpl2 == null) {
                    if (tryImminentInvalidation(recomposeScopeImpl, obj)) {
                        return InvalidationResult.IMMINENT;
                    }
                    if (obj != null && (obj instanceof DerivedState)) {
                        Object objD = this.invalidations.d(recomposeScopeImpl);
                        if (objD == null) {
                            ScopeMap.m177addimpl(this.invalidations, recomposeScopeImpl, obj);
                        } else if (objD instanceof O) {
                            O o6 = (O) objD;
                            Object[] objArr = o6.f21389b;
                            long[] jArr = o6.f21388a;
                            int length = jArr.length - 2;
                            if (length >= 0) {
                                int i7 = 0;
                                loop0: while (true) {
                                    long j4 = jArr[i7];
                                    if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                                        int i8 = 8;
                                        int i9 = 8 - ((~(i7 - length)) >>> 31);
                                        int i10 = 0;
                                        while (i10 < i9) {
                                            if ((j4 & 255) < 128) {
                                                i6 = i8;
                                                if (objArr[(i7 << 3) + i10] == ScopeInvalidated.INSTANCE) {
                                                    break loop0;
                                                }
                                            } else {
                                                i6 = i8;
                                            }
                                            j4 >>= i6;
                                            i10++;
                                            i8 = i6;
                                        }
                                        if (i9 != i8) {
                                            break;
                                        }
                                        if (i7 == length) {
                                            break;
                                        }
                                        i7++;
                                    }
                                }
                                ScopeMap.m177addimpl(this.invalidations, recomposeScopeImpl, obj);
                            }
                        } else if (objD == ScopeInvalidated.INSTANCE) {
                        }
                    } else {
                        ScopeMap.m194setimpl(this.invalidations, recomposeScopeImpl, ScopeInvalidated.INSTANCE);
                    }
                }
                if (compositionImpl2 != null) {
                    return compositionImpl2.invalidateChecked(recomposeScopeImpl, anchor, obj);
                }
                this.parent.invalidate$runtime(this);
                return isComposing() ? InvalidationResult.DEFERRED : InvalidationResult.SCHEDULED;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    private final void invalidateScopeOfLocked(Object obj) {
        Object objD = this.observations.d(obj);
        if (objD == null) {
            return;
        }
        if (!(objD instanceof O)) {
            RecomposeScopeImpl recomposeScopeImpl = (RecomposeScopeImpl) objD;
            if (recomposeScopeImpl.invalidateForResult(obj) == InvalidationResult.IMMINENT) {
                ScopeMap.m177addimpl(this.observationsProcessed, obj, recomposeScopeImpl);
                return;
            }
            return;
        }
        O o6 = (O) objD;
        Object[] objArr = o6.f21389b;
        long[] jArr = o6.f21388a;
        int length = jArr.length - 2;
        if (length < 0) {
            return;
        }
        int i6 = 0;
        while (true) {
            long j4 = jArr[i6];
            if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                int i7 = 8 - ((~(i6 - length)) >>> 31);
                for (int i8 = 0; i8 < i7; i8++) {
                    if ((255 & j4) < 128) {
                        RecomposeScopeImpl recomposeScopeImpl2 = (RecomposeScopeImpl) objArr[(i6 << 3) + i8];
                        if (recomposeScopeImpl2.invalidateForResult(obj) == InvalidationResult.IMMINENT) {
                            ScopeMap.m177addimpl(this.observationsProcessed, obj, recomposeScopeImpl2);
                        }
                    }
                    j4 >>= 8;
                }
                if (i7 != 8) {
                    return;
                }
            }
            if (i6 == length) {
                return;
            } else {
                i6++;
            }
        }
    }

    private final CompositionObserver observer() {
        return this.observerHolder.current();
    }

    /* JADX INFO: renamed from: takeInvalidations-afanTW4, reason: not valid java name */
    private final N m25takeInvalidationsafanTW4() {
        N n6 = this.invalidations;
        this.invalidations = ScopeMap.m183constructorimpl$default(null, 1, null);
        return n6;
    }

    private final <T> T trackAbandonedValues(J4.a aVar) {
        try {
            return (T) aVar.invoke();
        } catch (Throwable th) {
            if (!this.abandonSet.isEmpty()) {
                RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                try {
                    rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                    rememberEventDispatcher.dispatchAbandons();
                } finally {
                    rememberEventDispatcher.clear();
                }
            }
            throw th;
        }
    }

    private final boolean tryImminentInvalidation(RecomposeScopeImpl recomposeScopeImpl, Object obj) {
        return isComposing() && this.composer.tryImminentInvalidation$runtime(recomposeScopeImpl, obj);
    }

    private final void validateRecomposeScopeAnchors(SlotTable slotTable) {
        Object[] slots = slotTable.getSlots();
        ArrayList arrayList = new ArrayList();
        for (Object obj : slots) {
            RecomposeScopeImpl recomposeScopeImpl = obj instanceof RecomposeScopeImpl ? (RecomposeScopeImpl) obj : null;
            if (recomposeScopeImpl != null) {
                arrayList.add(recomposeScopeImpl);
            }
        }
        int size = arrayList.size();
        for (int i6 = 0; i6 < size; i6++) {
            RecomposeScopeImpl recomposeScopeImpl2 = (RecomposeScopeImpl) arrayList.get(i6);
            Anchor anchor = recomposeScopeImpl2.getAnchor();
            if (anchor != null && !slotTable.slotsOf$runtime(anchor.toIndexFor(slotTable)).contains(recomposeScopeImpl2)) {
                PreconditionsKt.throwIllegalStateException("Misaligned anchor " + anchor + " in scope " + recomposeScopeImpl2 + " encountered, scope found at " + AbstractC3250p.P(slotTable.getSlots(), recomposeScopeImpl2));
            }
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void abandonChanges() {
        this.pendingModifications.set(null);
        this.changes.clear();
        this.lateChanges.clear();
        if (this.abandonSet.isEmpty()) {
            return;
        }
        RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
        try {
            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
            rememberEventDispatcher.dispatchAbandons();
        } finally {
            rememberEventDispatcher.clear();
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void applyChanges() {
        synchronized (this.lock) {
            try {
                applyChangesInLocked(this.changes);
                drainPendingModificationsLocked();
            } catch (Throwable th) {
                try {
                    if (!this.abandonSet.isEmpty()) {
                        RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                        try {
                            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                            rememberEventDispatcher.dispatchAbandons();
                            rememberEventDispatcher.clear();
                        } catch (Throwable th2) {
                            rememberEventDispatcher.clear();
                            throw th2;
                        }
                    }
                    throw th;
                } catch (Throwable th3) {
                    abandonChanges();
                    throw th3;
                }
            }
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void applyLateChanges() {
        synchronized (this.lock) {
            try {
                if (this.lateChanges.isNotEmpty()) {
                    applyChangesInLocked(this.lateChanges);
                }
            } catch (Throwable th) {
                try {
                    if (!this.abandonSet.isEmpty()) {
                        RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                        try {
                            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                            rememberEventDispatcher.dispatchAbandons();
                            rememberEventDispatcher.clear();
                        } catch (Throwable th2) {
                            rememberEventDispatcher.clear();
                            throw th2;
                        }
                    }
                    throw th;
                } finally {
                }
            }
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void changesApplied() {
        RememberEventDispatcher rememberEventDispatcher;
        synchronized (this.lock) {
            try {
                this.composer.changesApplied$runtime();
                if (!this.abandonSet.isEmpty()) {
                    rememberEventDispatcher = this.rememberManager;
                    try {
                        rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                        rememberEventDispatcher.dispatchAbandons();
                        rememberEventDispatcher.clear();
                    } finally {
                    }
                }
            } catch (Throwable th) {
                try {
                    if (!this.abandonSet.isEmpty()) {
                        rememberEventDispatcher = this.rememberManager;
                        try {
                            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                            rememberEventDispatcher.dispatchAbandons();
                            rememberEventDispatcher.clear();
                        } finally {
                        }
                    }
                    throw th;
                } catch (Throwable th2) {
                    abandonChanges();
                    throw th2;
                }
            }
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void composeContent(J4.e eVar) {
        try {
            synchronized (this.lock) {
                drainPendingModificationsForCompositionLocked();
                try {
                    this.composer.m21composeContentZbOJvo$runtime(m25takeInvalidationsafanTW4(), eVar, this.shouldPause);
                } finally {
                }
            }
        } catch (Throwable th) {
            try {
                if (!this.abandonSet.isEmpty()) {
                    RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                    try {
                        rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                        rememberEventDispatcher.dispatchAbandons();
                        rememberEventDispatcher.clear();
                    } catch (Throwable th2) {
                        rememberEventDispatcher.clear();
                        throw th2;
                    }
                }
                throw th;
            } catch (Throwable th3) {
                abandonChanges();
                throw th3;
            }
        }
    }

    public final int composerStacksSizes$runtime() {
        return this.composer.stacksSize$runtime();
    }

    @Override // androidx.compose.runtime.ReusableComposition
    public void deactivate() {
        synchronized (this.lock) {
            try {
                if (!(this.pendingPausedComposition == null)) {
                    PreconditionsKt.throwIllegalStateException("Deactivate is not supported while pausable composition is in progress");
                }
                boolean z6 = this.slotTable.getGroupsSize() > 0;
                if (z6 || !this.abandonSet.isEmpty()) {
                    Trace trace = Trace.INSTANCE;
                    Object objBeginSection = trace.beginSection("Compose:deactivate");
                    try {
                        RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                        try {
                            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                            if (z6) {
                                this.applier.onBeginChanges();
                                SlotWriter slotWriterOpenWriter = this.slotTable.openWriter();
                                try {
                                    ComposerImplKt.deactivateCurrentGroup(slotWriterOpenWriter, this.rememberManager);
                                    slotWriterOpenWriter.close(true);
                                    this.applier.onEndChanges();
                                    rememberEventDispatcher.dispatchRememberObservers();
                                } catch (Throwable th) {
                                    slotWriterOpenWriter.close(false);
                                    throw th;
                                }
                            }
                            rememberEventDispatcher.dispatchAbandons();
                            rememberEventDispatcher.clear();
                            trace.endSection(objBeginSection);
                        } catch (Throwable th2) {
                            rememberEventDispatcher.clear();
                            throw th2;
                        }
                    } catch (Throwable th3) {
                        Trace.INSTANCE.endSection(objBeginSection);
                        throw th3;
                    }
                }
                ScopeMap.m181clearimpl(this.observations);
                ScopeMap.m181clearimpl(this.derivedStates);
                ScopeMap.m181clearimpl(this.invalidations);
                this.changes.clear();
                this.lateChanges.clear();
                this.composer.deactivate$runtime();
                this.state = 1;
            } catch (Throwable th4) {
                throw th4;
            }
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public <R> R delegateInvalidations(ControlledComposition controlledComposition, int i6, J4.a aVar) {
        if (controlledComposition == null || controlledComposition.equals(this) || i6 < 0) {
            return (R) aVar.invoke();
        }
        this.invalidationDelegate = (CompositionImpl) controlledComposition;
        this.invalidationDelegateGroup = i6;
        try {
            return (R) aVar.invoke();
        } finally {
            this.invalidationDelegate = null;
            this.invalidationDelegateGroup = 0;
        }
    }

    @Override // androidx.compose.runtime.Composition
    public void dispose() {
        synchronized (this.lock) {
            try {
                if (this.composer.isComposing$runtime()) {
                    PreconditionsKt.throwIllegalStateException("Composition is disposed while composing. If dispose is triggered by a call in @Composable function, consider wrapping it with SideEffect block.");
                }
                if (this.state != 3) {
                    this.state = 3;
                    this.composable = ComposableSingletons$CompositionKt.INSTANCE.getLambda$1918065384$runtime();
                    ChangeList deferredChanges$runtime = this.composer.getDeferredChanges$runtime();
                    if (deferredChanges$runtime != null) {
                        applyChangesInLocked(deferredChanges$runtime);
                    }
                    boolean z6 = this.slotTable.getGroupsSize() > 0;
                    if (z6 || !this.abandonSet.isEmpty()) {
                        RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                        try {
                            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                            if (z6) {
                                this.applier.onBeginChanges();
                                SlotWriter slotWriterOpenWriter = this.slotTable.openWriter();
                                try {
                                    ComposerKt.removeCurrentGroup(slotWriterOpenWriter, this.rememberManager);
                                    slotWriterOpenWriter.close(true);
                                    this.applier.clear();
                                    this.applier.onEndChanges();
                                    rememberEventDispatcher.dispatchRememberObservers();
                                } catch (Throwable th) {
                                    slotWriterOpenWriter.close(false);
                                    throw th;
                                }
                            }
                            rememberEventDispatcher.dispatchAbandons();
                            rememberEventDispatcher.clear();
                        } catch (Throwable th2) {
                            rememberEventDispatcher.clear();
                            throw th2;
                        }
                    }
                    this.composer.dispose$runtime();
                }
            } catch (Throwable th3) {
                throw th3;
            }
        }
        this.parent.unregisterComposition$runtime(this);
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void disposeUnusedMovableContent(MovableContentState movableContentState) {
        RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
        try {
            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
            SlotWriter slotWriterOpenWriter = movableContentState.getSlotTable$runtime().openWriter();
            try {
                ComposerKt.removeCurrentGroup(slotWriterOpenWriter, this.rememberManager);
                slotWriterOpenWriter.close(true);
                rememberEventDispatcher.dispatchRememberObservers();
            } catch (Throwable th) {
                slotWriterOpenWriter.close(false);
                throw th;
            }
        } finally {
            rememberEventDispatcher.clear();
        }
    }

    public final List<w4.k> extractInvalidationsOfGroup$runtime(J4.c cVar) {
        long[] jArr;
        long[] jArr2;
        long j4;
        char c6;
        long j6;
        int i6;
        int i7;
        boolean zB;
        Object obj;
        long j7;
        Object obj2;
        int i8;
        if (ScopeMap.m188getSizeimpl(this.invalidations) <= 0) {
            return y.f26065a;
        }
        ArrayList arrayList = new ArrayList();
        N n6 = this.invalidations;
        long[] jArr3 = n6.f21381a;
        int length = jArr3.length - 2;
        if (length >= 0) {
            int i9 = 0;
            while (true) {
                long j8 = jArr3[i9];
                char c7 = 7;
                long j9 = -9187201950435737472L;
                if ((((~j8) << 7) & j8 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i10 = 8;
                    int i11 = 8 - ((~(i9 - length)) >>> 31);
                    int i12 = 0;
                    while (i12 < i11) {
                        if ((j8 & 255) < 128) {
                            int i13 = (i9 << 3) + i12;
                            c6 = c7;
                            Object obj3 = n6.f21382b[i13];
                            j6 = j9;
                            Object obj4 = n6.f21383c[i13];
                            kotlin.jvm.internal.o.f(obj3, "null cannot be cast to non-null type Key of androidx.compose.runtime.collection.ScopeMap");
                            if (obj4 instanceof O) {
                                kotlin.jvm.internal.o.f(obj4, "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap>");
                                O o6 = (O) obj4;
                                Object[] objArr = o6.f21389b;
                                long[] jArr4 = o6.f21388a;
                                int i14 = i10;
                                int length2 = jArr4.length - 2;
                                jArr2 = jArr3;
                                j4 = j8;
                                if (length2 >= 0) {
                                    int i15 = 0;
                                    while (true) {
                                        long j10 = jArr4[i15];
                                        Object[] objArr2 = objArr;
                                        i6 = i12;
                                        if ((((~j10) << c6) & j10 & j6) != j6) {
                                            int i16 = 8 - ((~(i15 - length2)) >>> 31);
                                            int i17 = 0;
                                            while (i17 < i16) {
                                                if ((j10 & 255) < 128) {
                                                    j7 = j10;
                                                    int i18 = (i15 << 3) + i17;
                                                    Object obj5 = objArr2[i18];
                                                    obj2 = obj3;
                                                    RecomposeScopeImpl recomposeScopeImpl = (RecomposeScopeImpl) obj2;
                                                    i8 = i17;
                                                    Anchor anchor = recomposeScopeImpl.getAnchor();
                                                    if (anchor != null && ((Boolean) cVar.invoke(anchor)).booleanValue()) {
                                                        arrayList.add(new w4.k(recomposeScopeImpl, obj5));
                                                        o6.m(i18);
                                                    }
                                                } else {
                                                    j7 = j10;
                                                    obj2 = obj3;
                                                    i8 = i17;
                                                }
                                                j10 = j7 >> i14;
                                                i17 = i8 + 1;
                                                obj3 = obj2;
                                            }
                                            obj = obj3;
                                            if (i16 != i14) {
                                                break;
                                            }
                                        } else {
                                            obj = obj3;
                                        }
                                        if (i15 == length2) {
                                            break;
                                        }
                                        i15++;
                                        i12 = i6;
                                        objArr = objArr2;
                                        obj3 = obj;
                                        i14 = 8;
                                    }
                                } else {
                                    i6 = i12;
                                }
                                zB = o6.b();
                            } else {
                                jArr2 = jArr3;
                                j4 = j8;
                                i6 = i12;
                                kotlin.jvm.internal.o.f(obj4, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap");
                                RecomposeScopeImpl recomposeScopeImpl2 = (RecomposeScopeImpl) obj3;
                                Anchor anchor2 = recomposeScopeImpl2.getAnchor();
                                if (anchor2 == null || !((Boolean) cVar.invoke(anchor2)).booleanValue()) {
                                    zB = false;
                                } else {
                                    arrayList.add(new w4.k(recomposeScopeImpl2, obj4));
                                    zB = true;
                                }
                            }
                            if (zB) {
                                n6.k(i13);
                            }
                            i7 = 8;
                        } else {
                            jArr2 = jArr3;
                            j4 = j8;
                            c6 = c7;
                            j6 = j9;
                            i6 = i12;
                            i7 = i10;
                        }
                        i12 = i6 + 1;
                        i10 = i7;
                        j8 = j4 >> i7;
                        c7 = c6;
                        j9 = j6;
                        jArr3 = jArr2;
                    }
                    jArr = jArr3;
                    if (i11 != i10) {
                        break;
                    }
                } else {
                    jArr = jArr3;
                }
                if (i9 == length) {
                    break;
                }
                i9++;
                jArr3 = jArr;
            }
        }
        return arrayList;
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public ShouldPauseCallback getAndSetShouldPauseCallback(ShouldPauseCallback shouldPauseCallback) {
        ShouldPauseCallback shouldPauseCallback2 = this.shouldPause;
        this.shouldPause = shouldPauseCallback;
        return shouldPauseCallback2;
    }

    public final J4.e getComposable() {
        return this.composable;
    }

    public final ComposerImpl getComposer$runtime() {
        return this.composer;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // androidx.compose.runtime.CompositionServices
    public <T> T getCompositionService(CompositionServiceKey<T> compositionServiceKey) {
        if (kotlin.jvm.internal.o.c(compositionServiceKey, CompositionKt.getObservableCompositionServiceKey())) {
            return this;
        }
        return null;
    }

    public final List<RecomposeScopeImpl> getConditionalScopes$runtime() {
        O o6 = this.conditionallyInvalidatedScopes;
        o6.getClass();
        return AbstractC3251q.C0(new c0(o6));
    }

    public final Set<Object> getDerivedStateDependencies$runtime() {
        N n6 = this.derivedStates;
        n6.getClass();
        return new C2596x(n6).keySet();
    }

    @Override // androidx.compose.runtime.Composition
    public boolean getHasInvalidations() {
        boolean z6;
        synchronized (this.lock) {
            z6 = ScopeMap.m188getSizeimpl(this.invalidations) > 0;
        }
        return z6;
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public boolean getHasPendingChanges() {
        boolean hasPendingChanges$runtime;
        synchronized (this.lock) {
            hasPendingChanges$runtime = this.composer.getHasPendingChanges$runtime();
        }
        return hasPendingChanges$runtime;
    }

    public final Set<Object> getObservedObjects$runtime() {
        N n6 = this.observations;
        n6.getClass();
        return new C2596x(n6).keySet();
    }

    public final CompositionObserverHolder getObserverHolder$runtime() {
        return this.observerHolder;
    }

    public final CompositionContext getParent() {
        return this.parent;
    }

    public final boolean getPendingInvalidScopes$runtime() {
        return this.pendingInvalidScopes;
    }

    public final A4.j getRecomposeContext() {
        A4.j jVar = this._recomposeContext;
        return jVar == null ? this.parent.getRecomposeCoroutineContext$runtime() : jVar;
    }

    public final SlotTable getSlotTable$runtime() {
        return this.slotTable;
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void insertMovableContent(List<w4.k> list) {
        int size = list.size();
        boolean z6 = false;
        int i6 = 0;
        while (true) {
            if (i6 >= size) {
                z6 = true;
                break;
            } else if (!kotlin.jvm.internal.o.c(((MovableContentStateReference) list.get(i6).f25469a).getComposition$runtime(), this)) {
                break;
            } else {
                i6++;
            }
        }
        if (!z6) {
            ComposerKt.composeImmediateRuntimeError("Check failed");
        }
        try {
            this.composer.insertMovableContentReferences(list);
        } catch (Throwable th) {
            try {
                if (!this.abandonSet.isEmpty()) {
                    RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                    try {
                        rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                        rememberEventDispatcher.dispatchAbandons();
                        rememberEventDispatcher.clear();
                    } catch (Throwable th2) {
                        rememberEventDispatcher.clear();
                        throw th2;
                    }
                }
                throw th;
            } catch (Throwable th3) {
                abandonChanges();
                throw th3;
            }
        }
    }

    @Override // androidx.compose.runtime.RecomposeScopeOwner
    public InvalidationResult invalidate(RecomposeScopeImpl recomposeScopeImpl, Object obj) {
        CompositionObserver compositionObserverObserver;
        CompositionImpl compositionImpl;
        if (recomposeScopeImpl.getDefaultsInScope()) {
            recomposeScopeImpl.setDefaultsInvalid(true);
        }
        Anchor anchor = recomposeScopeImpl.getAnchor();
        if (anchor == null || !anchor.getValid()) {
            return InvalidationResult.IGNORED;
        }
        if (!this.slotTable.ownsAnchor(anchor)) {
            synchronized (this.lock) {
                compositionImpl = this.invalidationDelegate;
            }
            return (compositionImpl == null || !compositionImpl.tryImminentInvalidation(recomposeScopeImpl, obj)) ? InvalidationResult.IGNORED : InvalidationResult.IMMINENT;
        }
        if (!recomposeScopeImpl.getCanRecompose()) {
            return InvalidationResult.IGNORED;
        }
        InvalidationResult invalidationResultInvalidateChecked = invalidateChecked(recomposeScopeImpl, anchor, obj);
        if (invalidationResultInvalidateChecked != InvalidationResult.IGNORED && (compositionObserverObserver = observer()) != null) {
            compositionObserverObserver.onScopeInvalidated(recomposeScopeImpl, obj);
        }
        return invalidationResultInvalidateChecked;
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void invalidateAll() {
        synchronized (this.lock) {
            try {
                for (Object obj : this.slotTable.getSlots()) {
                    RecomposeScopeImpl recomposeScopeImpl = obj instanceof RecomposeScopeImpl ? (RecomposeScopeImpl) obj : null;
                    if (recomposeScopeImpl != null) {
                        recomposeScopeImpl.invalidate();
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void invalidateGroupsWithKey(int i6) {
        List<RecomposeScopeImpl> listInvalidateGroupsWithKey$runtime;
        synchronized (this.lock) {
            listInvalidateGroupsWithKey$runtime = this.slotTable.invalidateGroupsWithKey$runtime(i6);
        }
        if (listInvalidateGroupsWithKey$runtime != null) {
            int size = listInvalidateGroupsWithKey$runtime.size();
            for (int i7 = 0; i7 < size; i7++) {
                if (listInvalidateGroupsWithKey$runtime.get(i7).invalidateForResult(null) != InvalidationResult.IGNORED) {
                }
            }
            return;
        }
        if (this.composer.forceRecomposeScopes$runtime()) {
            this.parent.invalidate$runtime(this);
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public boolean isComposing() {
        return this.composer.isComposing$runtime();
    }

    @Override // androidx.compose.runtime.Composition
    public boolean isDisposed() {
        return this.state == 3;
    }

    public final boolean isRoot() {
        return this.isRoot;
    }

    /* JADX WARN: Code restructure failed: missing block: B:17:0x0050, code lost:
    
        return true;
     */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0057  */
    @Override // androidx.compose.runtime.ControlledComposition
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean observesAnyOf(Set<? extends Object> set) {
        if (set instanceof ScatterSetWrapper) {
            Z set$runtime = ((ScatterSetWrapper) set).getSet$runtime();
            Object[] objArr = set$runtime.f21389b;
            long[] jArr = set$runtime.f21388a;
            int length = jArr.length - 2;
            if (length >= 0) {
                int i6 = 0;
                loop0: while (true) {
                    long j4 = jArr[i6];
                    if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                        int i7 = 8 - ((~(i6 - length)) >>> 31);
                        for (int i8 = 0; i8 < i7; i8++) {
                            if ((255 & j4) < 128) {
                                Object obj = objArr[(i6 << 3) + i8];
                                if (ScopeMap.m184containsimpl(this.observations, obj) || ScopeMap.m184containsimpl(this.derivedStates, obj)) {
                                    break loop0;
                                }
                            }
                            j4 >>= 8;
                        }
                        if (i7 != 8) {
                            break;
                        }
                        if (i6 == length) {
                            break;
                        }
                        i6++;
                    }
                }
            }
        } else {
            for (Object obj2 : set) {
                if (ScopeMap.m184containsimpl(this.observations, obj2) || ScopeMap.m184containsimpl(this.derivedStates, obj2)) {
                    return true;
                }
            }
        }
        return false;
    }

    public final void pausedCompositionFinished$runtime(Z z6) {
        this.pendingPausedComposition = null;
        if (z6 != null) {
            this.rememberManager.ignoreForgotten(z6);
            this.state = 2;
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void prepareCompose(J4.a aVar) {
        this.composer.prepareCompose$runtime(aVar);
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public boolean recompose() {
        synchronized (this.lock) {
            PausedCompositionImpl pausedCompositionImpl = this.pendingPausedComposition;
            if (pausedCompositionImpl != null && !pausedCompositionImpl.isRecomposing$runtime()) {
                pausedCompositionImpl.markIncomplete$runtime();
                pausedCompositionImpl.getPausableApplier$runtime().markRecomposePending();
                return false;
            }
            drainPendingModificationsForCompositionLocked();
            try {
                try {
                    boolean zM22recomposeaFTiNEg$runtime = this.composer.m22recomposeaFTiNEg$runtime(m25takeInvalidationsafanTW4(), this.shouldPause);
                    if (!zM22recomposeaFTiNEg$runtime) {
                        drainPendingModificationsLocked();
                    }
                    return zM22recomposeaFTiNEg$runtime;
                } finally {
                }
            } catch (Throwable th) {
                try {
                    if (!this.abandonSet.isEmpty()) {
                        RememberEventDispatcher rememberEventDispatcher = this.rememberManager;
                        try {
                            rememberEventDispatcher.prepare(this.abandonSet, this.composer.getErrorContext$runtime());
                            rememberEventDispatcher.dispatchAbandons();
                            rememberEventDispatcher.clear();
                        } catch (Throwable th2) {
                            rememberEventDispatcher.clear();
                            throw th2;
                        }
                    }
                    throw th;
                } catch (Throwable th3) {
                    abandonChanges();
                    throw th3;
                }
            }
        }
    }

    @Override // androidx.compose.runtime.RecomposeScopeOwner
    public void recomposeScopeReleased(RecomposeScopeImpl recomposeScopeImpl) {
        this.pendingInvalidScopes = true;
        CompositionObserver compositionObserverObserver = observer();
        if (compositionObserverObserver != null) {
            compositionObserverObserver.onScopeDisposed(recomposeScopeImpl);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // androidx.compose.runtime.ControlledComposition
    public void recordModificationsOf(Set<? extends Object> set) {
        Object obj;
        while (true) {
            Object obj2 = this.pendingModifications.get();
            if (obj2 == null || obj2.equals(CompositionKt.PendingApplyNoModifications)) {
                obj = set;
            } else if (obj2 instanceof Set) {
                obj = new Set[]{obj2, set};
            } else {
                if (!(obj2 instanceof Object[])) {
                    throw new IllegalStateException(("corrupt pendingModifications: " + this.pendingModifications).toString());
                }
                Set[] setArr = (Set[]) obj2;
                int length = setArr.length;
                Object[] objArrCopyOf = Arrays.copyOf(setArr, length + 1);
                objArrCopyOf[length] = set;
                obj = objArrCopyOf;
            }
            AtomicReference<Object> atomicReference = this.pendingModifications;
            while (!atomicReference.compareAndSet(obj2, obj)) {
                if (atomicReference.get() != obj2) {
                    break;
                }
            }
            if (obj2 == null) {
                synchronized (this.lock) {
                    drainPendingModificationsLocked();
                }
                return;
            }
            return;
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition, androidx.compose.runtime.RecomposeScopeOwner
    public void recordReadOf(Object obj) {
        RecomposeScopeImpl currentRecomposeScope$runtime;
        int i6;
        int i7;
        int i8;
        if (getAreChildrenComposing() || (currentRecomposeScope$runtime = this.composer.getCurrentRecomposeScope$runtime()) == null) {
            return;
        }
        int i9 = 1;
        currentRecomposeScope$runtime.setUsed(true);
        boolean zRecordRead = currentRecomposeScope$runtime.recordRead(obj);
        CompositionObserver compositionObserverObserver = observer();
        if (compositionObserverObserver != null) {
            compositionObserverObserver.onReadInScope(currentRecomposeScope$runtime, obj);
        }
        if (zRecordRead) {
            return;
        }
        if (obj instanceof StateObjectImpl) {
            ((StateObjectImpl) obj).m270recordReadInh_f27i8$runtime(ReaderKind.m257constructorimpl(1));
        }
        ScopeMap.m177addimpl(this.observations, obj, currentRecomposeScope$runtime);
        if (obj instanceof DerivedState) {
            DerivedState<?> derivedState = (DerivedState) obj;
            DerivedState.Record<?> currentRecord = derivedState.getCurrentRecord();
            ScopeMap.m192removeScopeimpl(this.derivedStates, obj);
            S dependencies = currentRecord.getDependencies();
            Object[] objArr = dependencies.f21371b;
            long[] jArr = dependencies.f21370a;
            int length = jArr.length - 2;
            if (length >= 0) {
                int i10 = 0;
                while (true) {
                    long j4 = jArr[i10];
                    if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                        int i11 = 8;
                        int i12 = 8 - ((~(i10 - length)) >>> 31);
                        int i13 = 0;
                        while (i13 < i12) {
                            if ((j4 & 255) < 128) {
                                i7 = i9;
                                StateObject stateObject = (StateObject) objArr[(i10 << 3) + i13];
                                if (stateObject instanceof StateObjectImpl) {
                                    i8 = i11;
                                    ((StateObjectImpl) stateObject).m270recordReadInh_f27i8$runtime(ReaderKind.m257constructorimpl(i7));
                                } else {
                                    i8 = i11;
                                }
                                ScopeMap.m177addimpl(this.derivedStates, stateObject, obj);
                            } else {
                                i7 = i9;
                                i8 = i11;
                            }
                            j4 >>= i8;
                            i13++;
                            i9 = i7;
                            i11 = i8;
                        }
                        i6 = i9;
                        if (i12 != i11) {
                            break;
                        }
                    } else {
                        i6 = i9;
                    }
                    if (i10 == length) {
                        break;
                    }
                    i10++;
                    i9 = i6;
                }
            }
            currentRecomposeScope$runtime.recordDerivedStateValue(derivedState, currentRecord.getCurrentValue());
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0057  */
    @Override // androidx.compose.runtime.ControlledComposition
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void recordWriteOf(Object obj) {
        synchronized (this.lock) {
            try {
                invalidateScopeOfLocked(obj);
                Object objD = this.derivedStates.d(obj);
                if (objD != null) {
                    if (objD instanceof O) {
                        O o6 = (O) objD;
                        Object[] objArr = o6.f21389b;
                        long[] jArr = o6.f21388a;
                        int length = jArr.length - 2;
                        if (length >= 0) {
                            int i6 = 0;
                            while (true) {
                                long j4 = jArr[i6];
                                if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                                    int i7 = 8 - ((~(i6 - length)) >>> 31);
                                    for (int i8 = 0; i8 < i7; i8++) {
                                        if ((255 & j4) < 128) {
                                            invalidateScopeOfLocked((DerivedState) objArr[(i6 << 3) + i8]);
                                        }
                                        j4 >>= 8;
                                    }
                                    if (i7 != 8) {
                                        break;
                                    } else if (i6 == length) {
                                        break;
                                    } else {
                                        i6++;
                                    }
                                }
                            }
                        }
                    } else {
                        invalidateScopeOfLocked((DerivedState) objD);
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void removeDerivedStateObservation$runtime(DerivedState<?> derivedState) {
        if (ScopeMap.m184containsimpl(this.observations, derivedState)) {
            return;
        }
        ScopeMap.m192removeScopeimpl(this.derivedStates, derivedState);
    }

    public final void removeObservation$runtime(Object obj, RecomposeScopeImpl recomposeScopeImpl) {
        ScopeMap.m190removeimpl(this.observations, obj, recomposeScopeImpl);
    }

    public final void setComposable(J4.e eVar) {
        this.composable = eVar;
    }

    @Override // androidx.compose.runtime.Composition
    public void setContent(J4.e eVar) {
        boolean zClearDeactivated = clearDeactivated();
        ensureRunning();
        if (zClearDeactivated) {
            composeInitialWithReuse(eVar);
        } else {
            composeInitial(eVar);
        }
    }

    @Override // androidx.compose.runtime.ReusableComposition
    public void setContentWithReuse(J4.e eVar) {
        clearDeactivated();
        ensureRunning();
        composeInitialWithReuse(eVar);
    }

    @Override // androidx.compose.runtime.tooling.ObservableComposition
    public CompositionObserverHandle setObserver(final CompositionObserver compositionObserver) {
        synchronized (this.lock) {
            this.observerHolder.setObserver(compositionObserver);
            this.observerHolder.setRoot(true);
        }
        return new CompositionObserverHandle() { // from class: androidx.compose.runtime.CompositionImpl.setObserver.2
            @Override // androidx.compose.runtime.tooling.CompositionObserverHandle
            public void dispose() {
                Object obj = CompositionImpl.this.lock;
                CompositionImpl compositionImpl = CompositionImpl.this;
                CompositionObserver compositionObserver2 = compositionObserver;
                synchronized (obj) {
                    if (kotlin.jvm.internal.o.c(compositionImpl.getObserverHolder$runtime().getObserver(), compositionObserver2)) {
                        compositionImpl.getObserverHolder$runtime().setObserver(null);
                        compositionImpl.getObserverHolder$runtime().setRoot(false);
                    }
                }
            }
        };
    }

    @Override // androidx.compose.runtime.PausableComposition
    public PausedComposition setPausableContent(J4.e eVar) {
        return composeInitialPaused(clearDeactivated(), eVar);
    }

    @Override // androidx.compose.runtime.PausableComposition
    public PausedComposition setPausableContentWithReuse(J4.e eVar) {
        clearDeactivated();
        ensureRunning();
        return composeInitialPaused(true, eVar);
    }

    public final void setPendingInvalidScopes$runtime(boolean z6) {
        this.pendingInvalidScopes = z6;
    }

    public final void updateMovingInvalidations$runtime() {
        synchronized (this.lock) {
            drainPendingModificationsOutOfBandLocked();
            try {
                this.composer.m23updateComposerInvalidationsRY85e9Y(m25takeInvalidationsafanTW4());
            } finally {
            }
        }
    }

    @Override // androidx.compose.runtime.ControlledComposition
    public void verifyConsistent() {
        synchronized (this.lock) {
            if (!isComposing()) {
                this.composer.verifyConsistent$runtime();
                this.slotTable.verifyWellFormed();
                validateRecomposeScopeAnchors(this.slotTable);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:107:0x0232  */
    /* JADX WARN: Removed duplicated region for block: B:167:0x0343  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x00b1  */
    /* JADX WARN: Removed duplicated region for block: B:70:0x0176 A[EDGE_INSN: B:70:0x0176->B:219:0x0113 BREAK  A[LOOP:13: B:60:0x0144->B:71:0x0178]] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private final void addPendingInvalidationsLocked(Set<? extends Object> set, boolean z6) {
        char c6;
        long j4;
        long j6;
        long j7;
        int i6;
        long[] jArr;
        String str;
        long[] jArr2;
        String str2;
        long j8;
        boolean zA;
        long j9;
        long[] jArr3;
        int i7;
        long[] jArr4;
        int i8;
        int i9;
        long j10;
        boolean zB;
        int i10;
        long j11;
        long j12;
        char c7;
        long j13;
        int i11;
        int i12;
        int i13;
        Object obj = null;
        char c8 = 7;
        long j14 = -9187201950435737472L;
        int i14 = 8;
        if (set instanceof ScatterSetWrapper) {
            Z set$runtime = ((ScatterSetWrapper) set).getSet$runtime();
            Object[] objArr = set$runtime.f21389b;
            long[] jArr5 = set$runtime.f21388a;
            int length = jArr5.length - 2;
            if (length >= 0) {
                int i15 = 0;
                j6 = 128;
                while (true) {
                    long j15 = jArr5[i15];
                    j7 = 255;
                    if ((((~j15) << c8) & j15 & j14) != j14) {
                        int i16 = 8 - ((~(i15 - length)) >>> 31);
                        int i17 = 0;
                        while (i17 < i16) {
                            if ((j15 & 255) < 128) {
                                c7 = c8;
                                Object obj2 = objArr[(i15 << 3) + i17];
                                j13 = j14;
                                if (obj2 instanceof RecomposeScopeImpl) {
                                    ((RecomposeScopeImpl) obj2).invalidateForResult(obj);
                                } else {
                                    addPendingInvalidationsLocked(obj2, z6);
                                    Object objD = this.derivedStates.d(obj2);
                                    if (objD != null) {
                                        if (objD instanceof O) {
                                            O o6 = (O) objD;
                                            Object[] objArr2 = o6.f21389b;
                                            long[] jArr6 = o6.f21388a;
                                            int length2 = jArr6.length - 2;
                                            if (length2 >= 0) {
                                                j12 = j15;
                                                int i18 = 0;
                                                while (true) {
                                                    long j16 = jArr6[i18];
                                                    int i19 = i14;
                                                    i11 = length;
                                                    if ((((~j16) << c7) & j16 & j13) != j13) {
                                                        int i20 = 8 - ((~(i18 - length2)) >>> 31);
                                                        int i21 = 0;
                                                        while (i21 < i20) {
                                                            if ((j16 & 255) < 128) {
                                                                i13 = i19;
                                                                addPendingInvalidationsLocked((DerivedState) objArr2[(i18 << 3) + i21], z6);
                                                            } else {
                                                                i13 = i19;
                                                            }
                                                            j16 >>= i13;
                                                            i21++;
                                                            i19 = i13;
                                                        }
                                                        if (i20 != i19) {
                                                            break;
                                                        }
                                                        if (i18 == length2) {
                                                            break;
                                                        }
                                                        i18++;
                                                        length = i11;
                                                        i14 = 8;
                                                    }
                                                }
                                            }
                                        } else {
                                            j12 = j15;
                                            i11 = length;
                                            addPendingInvalidationsLocked((DerivedState) objD, z6);
                                        }
                                        i12 = 8;
                                    }
                                }
                                j12 = j15;
                                i11 = length;
                                i12 = 8;
                            } else {
                                j12 = j15;
                                c7 = c8;
                                j13 = j14;
                                i11 = length;
                                i12 = i14;
                            }
                            i17++;
                            length = i11;
                            i14 = i12;
                            c8 = c7;
                            j14 = j13;
                            j15 = j12 >> i12;
                            obj = null;
                        }
                        c6 = c8;
                        j4 = j14;
                        int i22 = length;
                        if (i16 != i14) {
                            break;
                        } else {
                            length = i22;
                        }
                    } else {
                        c6 = c8;
                        j4 = j14;
                    }
                    if (i15 == length) {
                        break;
                    }
                    i15++;
                    c8 = c6;
                    j14 = j4;
                    obj = null;
                    i14 = 8;
                }
            } else {
                c6 = 7;
                j4 = -9187201950435737472L;
                j6 = 128;
                j7 = 255;
            }
        } else {
            c6 = 7;
            j4 = -9187201950435737472L;
            j6 = 128;
            j7 = 255;
            for (Object obj3 : set) {
                if (obj3 instanceof RecomposeScopeImpl) {
                    ((RecomposeScopeImpl) obj3).invalidateForResult(null);
                } else {
                    addPendingInvalidationsLocked(obj3, z6);
                    Object objD2 = this.derivedStates.d(obj3);
                    if (objD2 != null) {
                        if (objD2 instanceof O) {
                            O o7 = (O) objD2;
                            Object[] objArr3 = o7.f21389b;
                            long[] jArr7 = o7.f21388a;
                            int length3 = jArr7.length - 2;
                            if (length3 >= 0) {
                                while (true) {
                                    long j17 = jArr7[i6];
                                    if ((((~j17) << 7) & j17 & (-9187201950435737472L)) != -9187201950435737472L) {
                                        int i23 = 8 - ((~(i6 - length3)) >>> 31);
                                        for (int i24 = 0; i24 < i23; i24++) {
                                            if ((j17 & 255) < 128) {
                                                addPendingInvalidationsLocked((DerivedState) objArr3[(i6 << 3) + i24], z6);
                                            }
                                            j17 >>= 8;
                                        }
                                        if (i23 == 8) {
                                            i6 = i6 != length3 ? i6 + 1 : 0;
                                        }
                                    }
                                }
                            }
                        } else {
                            addPendingInvalidationsLocked((DerivedState) objD2, z6);
                        }
                    }
                }
            }
        }
        O o8 = this.conditionallyInvalidatedScopes;
        O o9 = this.invalidatedScopes;
        String str3 = "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap>";
        if (z6 && o8.c()) {
            N n6 = this.observations;
            long[] jArr8 = n6.f21381a;
            int length4 = jArr8.length - 2;
            if (length4 >= 0) {
                int i25 = 0;
                while (true) {
                    long j18 = jArr8[i25];
                    if ((((~j18) << c6) & j18 & j4) != j4) {
                        int i26 = 8 - ((~(i25 - length4)) >>> 31);
                        int i27 = 0;
                        while (i27 < i26) {
                            if ((j18 & j7) < j6) {
                                int i28 = (i25 << 3) + i27;
                                Object obj4 = n6.f21382b[i28];
                                Object obj5 = n6.f21383c[i28];
                                if (obj5 instanceof O) {
                                    kotlin.jvm.internal.o.f(obj5, "null cannot be cast to non-null type androidx.collection.MutableScatterSet<Scope of androidx.compose.runtime.collection.ScopeMap>");
                                    O o10 = (O) obj5;
                                    Object[] objArr4 = o10.f21389b;
                                    long[] jArr9 = o10.f21388a;
                                    jArr4 = jArr8;
                                    int length5 = jArr9.length - 2;
                                    if (length5 >= 0) {
                                        j10 = j18;
                                        int i29 = 0;
                                        while (true) {
                                            long j19 = jArr9[i29];
                                            i8 = length4;
                                            i9 = i25;
                                            if ((((~j19) << c6) & j19 & j4) != j4) {
                                                int i30 = 8 - ((~(i29 - length5)) >>> 31);
                                                for (int i31 = 0; i31 < i30; i31 = i10 + 1) {
                                                    if ((j19 & j7) < j6) {
                                                        i10 = i31;
                                                        int i32 = (i29 << 3) + i10;
                                                        j11 = j19;
                                                        RecomposeScopeImpl recomposeScopeImpl = (RecomposeScopeImpl) objArr4[i32];
                                                        if (o8.a(recomposeScopeImpl) || o9.a(recomposeScopeImpl)) {
                                                            o10.m(i32);
                                                        }
                                                    } else {
                                                        i10 = i31;
                                                        j11 = j19;
                                                    }
                                                    j19 = j11 >> 8;
                                                }
                                                if (i30 != 8) {
                                                    break;
                                                }
                                                if (i29 == length5) {
                                                    break;
                                                }
                                                i29++;
                                                length4 = i8;
                                                i25 = i9;
                                            }
                                        }
                                    } else {
                                        i8 = length4;
                                        i9 = i25;
                                        j10 = j18;
                                    }
                                    zB = o10.b();
                                } else {
                                    jArr4 = jArr8;
                                    i8 = length4;
                                    i9 = i25;
                                    j10 = j18;
                                    kotlin.jvm.internal.o.f(obj5, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap");
                                    RecomposeScopeImpl recomposeScopeImpl2 = (RecomposeScopeImpl) obj5;
                                    zB = o8.a(recomposeScopeImpl2) || o9.a(recomposeScopeImpl2);
                                }
                                if (zB) {
                                    n6.k(i28);
                                }
                            } else {
                                jArr4 = jArr8;
                                i8 = length4;
                                i9 = i25;
                                j10 = j18;
                            }
                            j18 = j10 >> 8;
                            i27++;
                            length4 = i8;
                            jArr8 = jArr4;
                            i25 = i9;
                        }
                        jArr3 = jArr8;
                        int i33 = length4;
                        int i34 = i25;
                        if (i26 != 8) {
                            break;
                        }
                        length4 = i33;
                        i7 = i34;
                    } else {
                        jArr3 = jArr8;
                        i7 = i25;
                    }
                    if (i7 == length4) {
                        break;
                    }
                    i25 = i7 + 1;
                    jArr8 = jArr3;
                }
            }
            o8.e();
            cleanUpDerivedStateObservations();
            return;
        }
        if (o9.c()) {
            N n7 = this.observations;
            long[] jArr10 = n7.f21381a;
            int length6 = jArr10.length - 2;
            if (length6 >= 0) {
                int i35 = 0;
                while (true) {
                    long j20 = jArr10[i35];
                    if ((((~j20) << c6) & j20 & j4) != j4) {
                        int i36 = 8 - ((~(i35 - length6)) >>> 31);
                        int i37 = 0;
                        while (i37 < i36) {
                            if ((j20 & j7) < j6) {
                                int i38 = (i35 << 3) + i37;
                                Object obj6 = n7.f21382b[i38];
                                Object obj7 = n7.f21383c[i38];
                                if (obj7 instanceof O) {
                                    kotlin.jvm.internal.o.f(obj7, str3);
                                    O o11 = (O) obj7;
                                    Object[] objArr5 = o11.f21389b;
                                    long[] jArr11 = o11.f21388a;
                                    int length7 = jArr11.length - 2;
                                    jArr2 = jArr10;
                                    str2 = str3;
                                    if (length7 >= 0) {
                                        int i39 = 0;
                                        while (true) {
                                            long j21 = jArr11[i39];
                                            j8 = j20;
                                            if ((((~j21) << c6) & j21 & j4) != j4) {
                                                int i40 = 8 - ((~(i39 - length7)) >>> 31);
                                                int i41 = 0;
                                                while (i41 < i40) {
                                                    if ((j21 & j7) < j6) {
                                                        j9 = j21;
                                                        int i42 = (i39 << 3) + i41;
                                                        if (o9.a((RecomposeScopeImpl) objArr5[i42])) {
                                                            o11.m(i42);
                                                        }
                                                    } else {
                                                        j9 = j21;
                                                    }
                                                    i41++;
                                                    j21 = j9 >> 8;
                                                }
                                                if (i40 != 8) {
                                                    break;
                                                }
                                                if (i39 == length7) {
                                                    break;
                                                }
                                                i39++;
                                                j20 = j8;
                                            }
                                        }
                                    } else {
                                        j8 = j20;
                                    }
                                    zA = o11.b();
                                } else {
                                    jArr2 = jArr10;
                                    str2 = str3;
                                    j8 = j20;
                                    kotlin.jvm.internal.o.f(obj7, "null cannot be cast to non-null type Scope of androidx.compose.runtime.collection.ScopeMap");
                                    zA = o9.a((RecomposeScopeImpl) obj7);
                                }
                                if (zA) {
                                    n7.k(i38);
                                }
                            } else {
                                jArr2 = jArr10;
                                str2 = str3;
                                j8 = j20;
                            }
                            j20 = j8 >> 8;
                            i37++;
                            jArr10 = jArr2;
                            str3 = str2;
                        }
                        jArr = jArr10;
                        str = str3;
                        if (i36 != 8) {
                            break;
                        }
                    } else {
                        jArr = jArr10;
                        str = str3;
                    }
                    if (i35 == length6) {
                        break;
                    }
                    i35++;
                    jArr10 = jArr;
                    str3 = str;
                }
            }
            cleanUpDerivedStateObservations();
            o9.e();
        }
    }

    public /* synthetic */ CompositionImpl(CompositionContext compositionContext, Applier applier, A4.j jVar, int i6, kotlin.jvm.internal.h hVar) {
        this(compositionContext, applier, (i6 & 4) != 0 ? null : jVar);
    }
}
