package androidx.datastore.core;

import kotlin.Metadata;
import kotlin.Pair;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.CoroutineSingletons;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u0010\u0005\u001a\u0014\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u0004\u0012\u0004\u0012\u00020\u00010\u0003\"\u0004\b\u0000\u0010\u00002\u0006\u0010\u0002\u001a\u00020\u0001H\u008a@"}, d2 = {"T", "", "locked", "Lkotlin/Pair;", "Landroidx/datastore/core/c0;", "<anonymous>"}, k = 3, mv = {1, 8, 0})
@DebugMetadata(c = "androidx.datastore.core.DataStoreImpl$readDataAndUpdateCache$4", f = "DataStoreImpl.kt", i = {0, 1}, l = {306, 309}, m = "invokeSuspend", n = {"locked", "locked"}, s = {"Z$0", "Z$0"})
final class DataStoreImpl$readDataAndUpdateCache$4 extends SuspendLambda implements Function2 {
    final /* synthetic */ int $cachedVersion;
    Object L$0;
    /* synthetic */ boolean Z$0;
    int label;
    final /* synthetic */ n this$0;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public DataStoreImpl$readDataAndUpdateCache$4(n nVar, int i10, Continuation continuation) {
        super(2, continuation);
        this.this$0 = nVar;
        this.$cachedVersion = i10;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        DataStoreImpl$readDataAndUpdateCache$4 dataStoreImpl$readDataAndUpdateCache$4 = new DataStoreImpl$readDataAndUpdateCache$4(this.this$0, this.$cachedVersion, continuation);
        dataStoreImpl$readDataAndUpdateCache$4.Z$0 = ((Boolean) obj).booleanValue();
        return dataStoreImpl$readDataAndUpdateCache$4;
    }

    @Override // kotlin.jvm.functions.Function2
    public final Object invoke(Object obj, Object obj2) {
        return ((DataStoreImpl$readDataAndUpdateCache$4) create(Boolean.valueOf(((Boolean) obj).booleanValue()), (Continuation) obj2)).invokeSuspend(kd.e.f29109a);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v10 */
    /* JADX WARN: Type inference failed for: r0v2 */
    /* JADX WARN: Type inference failed for: r0v3 */
    /* JADX WARN: Type inference failed for: r0v5 */
    /* JADX WARN: Type inference failed for: r0v6 */
    /* JADX WARN: Type inference failed for: r0v9 */
    /* JADX WARN: Type inference failed for: r1v0, types: [int] */
    /* JADX WARN: Type inference failed for: r1v1, types: [boolean] */
    /* JADX WARN: Type inference failed for: r1v10 */
    /* JADX WARN: Type inference failed for: r1v14 */
    /* JADX WARN: Type inference failed for: r1v15 */
    /* JADX WARN: Type inference failed for: r1v16 */
    /* JADX WARN: Type inference failed for: r1v4, types: [boolean] */
    /* JADX WARN: Type inference failed for: r1v7 */
    /* JADX WARN: Type inference failed for: r4v0 */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        Throwable th;
        int iIntValue;
        ?? r02;
        ?? r03;
        c0 c0Var;
        ?? r12;
        CoroutineSingletons coroutineSingletons = CoroutineSingletons.f29226a;
        ?? r13 = this.label;
        try {
        } catch (Throwable th2) {
            if (r13 == 0) {
                ?? r42 = r13;
                th = th2;
                iIntValue = this.$cachedVersion;
                r02 = r42 == true ? 1 : 0;
                w wVar = new w(th, iIntValue);
                r12 = r02;
                c0Var = wVar;
                return new Pair(c0Var, Boolean.valueOf((boolean) r12));
            }
            u uVarG = this.this$0.g();
            this.L$0 = th2;
            this.Z$0 = r13;
            this.label = 2;
            Integer numA = ((b0) uVarG).a();
            if (numA == coroutineSingletons) {
                return coroutineSingletons;
            }
            r03 = r13;
            th = th2;
            obj = numA;
        }
        if (r13 == 0) {
            kotlin.a.d(obj);
            boolean z10 = this.Z$0;
            n nVar = this.this$0;
            this.Z$0 = z10;
            this.label = 1;
            obj = n.f(nVar, z10, this);
            r13 = z10;
            if (obj == coroutineSingletons) {
                return coroutineSingletons;
            }
        } else {
            if (r13 != 1) {
                if (r13 != 2) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                boolean z11 = this.Z$0;
                th = (Throwable) this.L$0;
                kotlin.a.d(obj);
                r03 = z11;
                iIntValue = ((Number) obj).intValue();
                r02 = r03;
                w wVar2 = new w(th, iIntValue);
                r12 = r02;
                c0Var = wVar2;
                return new Pair(c0Var, Boolean.valueOf((boolean) r12));
            }
            boolean z12 = this.Z$0;
            kotlin.a.d(obj);
            r13 = z12;
        }
        c0Var = (c0) obj;
        r12 = r13;
        return new Pair(c0Var, Boolean.valueOf((boolean) r12));
    }
}
