package a5;

import V4.AbstractC0786y;
import V4.C0784w;
import V4.E;
import V4.F0;
import V4.M;
import V4.Y;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

/* JADX INFO: loaded from: classes3.dex */
public final class f extends M implements C4.d, A4.d {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public static final /* synthetic */ AtomicReferenceFieldUpdater f10821k = AtomicReferenceFieldUpdater.newUpdater(f.class, Object.class, "_reusableCancellableContinuation$volatile");
    private volatile /* synthetic */ Object _reusableCancellableContinuation$volatile;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final AbstractC0786y f10822d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final C4.c f10823e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public Object f10824f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final Object f10825j;

    public f(AbstractC0786y abstractC0786y, C4.c cVar) {
        super(-1);
        this.f10822d = abstractC0786y;
        this.f10823e = cVar;
        this.f10824f = AbstractC0988a.f10810b;
        this.f10825j = AbstractC0988a.k(cVar.getContext());
    }

    @Override // C4.d
    public final C4.d getCallerFrame() {
        return this.f10823e;
    }

    @Override // A4.d
    public final A4.j getContext() {
        return this.f10823e.getContext();
    }

    @Override // V4.M
    public final Object h() {
        Object obj = this.f10824f;
        this.f10824f = AbstractC0988a.f10810b;
        return obj;
    }

    @Override // A4.d
    public final void resumeWith(Object obj) {
        Throwable thA = w4.n.a(obj);
        Object c0784w = thA == null ? obj : new C0784w(thA, false);
        C4.c cVar = this.f10823e;
        A4.j context = cVar.getContext();
        AbstractC0786y abstractC0786y = this.f10822d;
        if (abstractC0786y.g(context)) {
            this.f10824f = c0784w;
            this.f8257c = 0;
            abstractC0786y.c(cVar.getContext(), this);
            return;
        }
        Y yA = F0.a();
        if (yA.f8276b >= 4294967296L) {
            this.f10824f = c0784w;
            this.f8257c = 0;
            yA.y(this);
            return;
        }
        yA.A(true);
        try {
            A4.j context2 = cVar.getContext();
            Object objL = AbstractC0988a.l(context2, this.f10825j);
            try {
                cVar.resumeWith(obj);
                while (yA.C()) {
                }
            } finally {
                AbstractC0988a.g(context2, objL);
            }
        } finally {
            try {
            } finally {
            }
        }
    }

    public final String toString() {
        return "DispatchedContinuation[" + this.f10822d + ", " + E.E(this.f10823e) + ']';
    }

    @Override // V4.M
    public final A4.d d() {
        return this;
    }
}
