package o;

import java.util.concurrent.atomic.AtomicReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.nR, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1953nR extends Sb0 implements SC {
    public InterfaceC2238qR p;
    public Object q;
    public C2753vq r;
    public C2048oR s;
    public int t;
    public /* synthetic */ Object u;
    public final /* synthetic */ int v;
    public final /* synthetic */ C2048oR w;
    public final /* synthetic */ C2484t x;
    public final /* synthetic */ C2753vq y;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C1953nR(int i, C2048oR c2048oR, C2484t c2484t, C2753vq c2753vq, InterfaceC0220Im interfaceC0220Im) {
        super(2, interfaceC0220Im);
        this.v = i;
        this.w = c2048oR;
        this.x = c2484t;
        this.y = c2753vq;
    }

    @Override // o.SC
    public final Object f(Object obj, Object obj2) {
        return ((C1953nR) l((InterfaceC0065Cn) obj, (InterfaceC0220Im) obj2)).n(Oh0.a);
    }

    @Override // o.AbstractC0728ad
    public final InterfaceC0220Im l(Object obj, InterfaceC0220Im interfaceC0220Im) {
        C1953nR c1953nR = new C1953nR(this.v, this.w, this.x, this.y, interfaceC0220Im);
        c1953nR.u = obj;
        return c1953nR;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r5v5, types: [o.SC] */
    /* JADX WARN: Type inference failed for: r6v2, types: [o.qR] */
    @Override // o.AbstractC0728ad
    public final Object n(Object obj) {
        C2427sR c2427sR;
        C2484t c2484t;
        C2753vq c2753vq;
        C1763lR c1763lR;
        C2048oR c2048oR;
        C1763lR c1763lR2;
        InterfaceC2238qR interfaceC2238qR;
        AtomicReference atomicReference;
        AtomicReference atomicReference2;
        int i = this.t;
        EnumC0091Dn enumC0091Dn = EnumC0091Dn.l;
        try {
            try {
                if (i == 0) {
                    IJ.H(obj);
                    C1763lR c1763lR3 = new C1763lR(this.v, (TI) ((InterfaceC0065Cn) this.u).i().m(C0669Zu.K));
                    C2048oR c2048oR2 = this.w;
                    C2048oR.a(c2048oR2, c1763lR3);
                    c2427sR = c2048oR2.b;
                    this.u = c1763lR3;
                    this.p = c2427sR;
                    c2484t = this.x;
                    this.q = c2484t;
                    C2753vq c2753vq2 = this.y;
                    this.r = c2753vq2;
                    this.s = c2048oR2;
                    this.t = 1;
                    if (c2427sR.d(this) != enumC0091Dn) {
                        c2753vq = c2753vq2;
                        c1763lR = c1763lR3;
                        c2048oR = c2048oR2;
                    }
                    return enumC0091Dn;
                }
                if (i != 1) {
                    if (i != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    c2048oR = (C2048oR) this.q;
                    interfaceC2238qR = this.p;
                    c1763lR2 = (C1763lR) this.u;
                    try {
                        IJ.H(obj);
                        atomicReference2 = c2048oR.a;
                        while (!atomicReference2.compareAndSet(c1763lR2, null) && atomicReference2.get() == c1763lR2) {
                        }
                        ((C2427sR) interfaceC2238qR).f(null);
                        return obj;
                    } catch (Throwable th) {
                        th = th;
                        atomicReference = c2048oR.a;
                        while (!atomicReference.compareAndSet(c1763lR2, null)) {
                        }
                        throw th;
                    }
                }
                c2048oR = this.s;
                c2753vq = this.r;
                ?? r5 = (SC) this.q;
                ?? r6 = this.p;
                c1763lR = (C1763lR) this.u;
                IJ.H(obj);
                c2484t = r5;
                c2427sR = r6;
                this.u = c1763lR;
                this.p = c2427sR;
                this.q = c2048oR;
                this.r = null;
                this.s = null;
                this.t = 2;
                obj = c2484t.f(c2753vq, this);
                if (obj != enumC0091Dn) {
                    interfaceC2238qR = c2427sR;
                    c1763lR2 = c1763lR;
                    atomicReference2 = c2048oR.a;
                    while (!atomicReference2.compareAndSet(c1763lR2, null)) {
                    }
                    ((C2427sR) interfaceC2238qR).f(null);
                    return obj;
                }
                return enumC0091Dn;
            } catch (Throwable th2) {
                th = th2;
                c1763lR2 = c1763lR;
                atomicReference = c2048oR.a;
                while (!atomicReference.compareAndSet(c1763lR2, null) && atomicReference.get() == c1763lR2) {
                }
                throw th;
            }
        } catch (Throwable th3) {
            ((C2427sR) 2).f(null);
            throw th3;
        }
    }
}
