package O1;

import Z6.InterfaceC0382w;
import com.google.android.gms.internal.measurement.C1;

/* JADX INFO: loaded from: classes.dex */
public final class D extends G6.i implements O6.p {

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public int f4933u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public /* synthetic */ Object f4934v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final /* synthetic */ T1.c f4935w;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public D(E6.d dVar, T1.c cVar) {
        super(2, dVar);
        this.f4935w = cVar;
    }

    @Override // O6.p
    public final Object k(Object obj, Object obj2) {
        return ((D) m((E6.d) obj2, (InterfaceC0382w) obj)).p(A6.n.f457a);
    }

    @Override // G6.a
    public final E6.d m(E6.d dVar, Object obj) {
        D d8 = new D(dVar, this.f4935w);
        d8.f4934v = obj;
        return d8;
    }

    /* JADX WARN: Removed duplicated region for block: B:19:0x004f A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0050  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x0062  */
    /* JADX WARN: Removed duplicated region for block: B:27:0x0063  */
    @Override // G6.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object p(Object obj) throws Throwable {
        E e8;
        Throwable th;
        F6.a aVar = F6.a.f2580q;
        int i = this.f4933u;
        if (i != 0) {
            if (i != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            e8 = (E) this.f4934v;
            try {
                C1.N(obj);
                if (e8.f4938r.decrementAndGet() < 0) {
                    return obj;
                }
                throw new IllegalStateException("Transaction was never started or was already released.");
            } catch (Throwable th2) {
                th = th2;
                if (e8.f4938r.decrementAndGet() < 0) {
                    throw th;
                }
                throw new IllegalStateException("Transaction was never started or was already released.");
            }
        }
        C1.N(obj);
        E6.g gVarK = ((InterfaceC0382w) this.f4934v).u().K(E.f4936s);
        P6.g.b(gVarK);
        E e9 = (E) gVarK;
        e9.f4938r.incrementAndGet();
        try {
            T1.c cVar = this.f4935w;
            this.f4934v = e9;
            this.f4933u = 1;
            Object objB = cVar.b(this);
            if (objB == aVar) {
                return aVar;
            }
            e8 = e9;
            obj = objB;
            if (e8.f4938r.decrementAndGet() < 0) {
            }
        } catch (Throwable th3) {
            e8 = e9;
            th = th3;
            if (e8.f4938r.decrementAndGet() < 0) {
            }
        }
    }
}
