package defpackage;

import androidx.media3.container.NalUnitUtil;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u0000*\u0006\b\u0000\u0010\u0001 \u00002\b\u0012\u0004\u0012\u00028\u00000\u00022\u00060\u0003j\u0002`\u00042\b\u0012\u0004\u0012\u00028\u00000\u0005R\u0013\u0010\b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00070\u00068\u0002X\u0082\u0004R\u000b\u0010\n\u001a\u00020\t8\u0016X\u0096\u0005¨\u0006\u000b"}, d2 = {"Llc2;", "T", "Loc2;", "Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "Lkotlinx/coroutines/internal/CoroutineStackFrame;", "Lkotlin/coroutines/Continuation;", "Lww;", "", "_reusableCancellableContinuation", "Lgj1;", "context", "kotlinx-coroutines-core"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class lc2<T> extends oc2<T> implements CoroutineStackFrame, Continuation<T> {
    public static final /* synthetic */ AtomicReferenceFieldUpdater j = AtomicReferenceFieldUpdater.newUpdater(lc2.class, Object.class, "_reusableCancellableContinuation$volatile");
    private volatile /* synthetic */ Object _reusableCancellableContinuation$volatile;
    public final lj1 d;
    public final ContinuationImpl e;
    public Object f;
    public final Object i;

    public lc2(lj1 lj1Var, ContinuationImpl continuationImpl) {
        super(-1);
        this.d = lj1Var;
        this.e = continuationImpl;
        this.f = mc2.a;
        this.i = wl9.b(continuationImpl.getB());
    }

    @Override // defpackage.oc2
    /* JADX INFO: renamed from: c */
    public final Continuation getD() {
        return this;
    }

    @Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
    public final CoroutineStackFrame getCallerFrame() {
        return this.e;
    }

    @Override // kotlin.coroutines.Continuation
    /* JADX INFO: renamed from: getContext */
    public final gj1 getB() {
        return this.e.getB();
    }

    @Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
    public final StackTraceElement getStackTraceElement() {
        return null;
    }

    @Override // defpackage.oc2
    public final Object h() {
        Object obj = this.f;
        this.f = mc2.a;
        return obj;
    }

    @Override // kotlin.coroutines.Continuation
    public final void resumeWith(Object obj) {
        Throwable thA = q38.a(obj);
        Object w81Var = thA == null ? obj : new w81(thA, false);
        ContinuationImpl continuationImpl = this.e;
        gj1 c = continuationImpl.getB();
        lj1 lj1Var = this.d;
        if (lj1Var.bo(c)) {
            this.f = w81Var;
            this.c = 0;
            lj1Var.as(continuationImpl.getB(), this);
            return;
        }
        bq2 bq2VarA = am9.a();
        if (bq2VarA.c >= 4294967296L) {
            this.f = w81Var;
            this.c = 0;
            bq2VarA.cc(this);
            return;
        }
        bq2VarA.ch(true);
        try {
            gj1 c2 = continuationImpl.getB();
            Object objC = wl9.c(c2, this.i);
            try {
                continuationImpl.resumeWith(obj);
                while (bq2VarA.cj()) {
                }
            } finally {
                wl9.a(c2, objC);
            }
        } finally {
            try {
            } finally {
            }
        }
    }

    public final String toString() {
        return "DispatchedContinuation[" + this.d + ", " + uw1.b(this.e) + ']';
    }
}
