package v;

import V4.C0763h0;
import V4.InterfaceC0765i0;
import java.util.concurrent.atomic.AtomicReference;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: renamed from: v.D0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2973D0 extends C4.j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public e5.a f24703a;

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public C2975E0 f24706d;

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

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

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ z0 f24709j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ C2975E0 f24710k;
    public final /* synthetic */ C4.j l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final /* synthetic */ Object f24711m;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    /* JADX WARN: Multi-variable type inference failed */
    public C2973D0(z0 z0Var, C2975E0 c2975e0, J4.e eVar, Object obj, A4.d dVar) {
        super(2, dVar);
        this.f24709j = z0Var;
        this.f24710k = c2975e0;
        this.l = (C4.j) eVar;
        this.f24711m = obj;
    }

    /* JADX WARN: Type inference failed for: r3v0, types: [C4.j, J4.e] */
    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        C2973D0 c2973d0 = new C2973D0(this.f24709j, this.f24710k, this.l, this.f24711m, dVar);
        c2973d0.f24708f = obj;
        return c2973d0;
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((C2973D0) create((V4.C) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r1v0, types: [int] */
    /* JADX WARN: Type inference failed for: r5v3 */
    /* JADX WARN: Type inference failed for: r5v4, types: [J4.e] */
    /* JADX WARN: Type inference failed for: r5v7 */
    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        C2975E0 c2975e0;
        Object obj2;
        C2969B0 c2969b0;
        e5.a aVar;
        ?? r5;
        C2975E0 c2975e02;
        Throwable th;
        C2969B0 c2969b02;
        AtomicReference atomicReference;
        AtomicReference atomicReference2;
        B4.a aVar2 = B4.a.f492a;
        ?? r12 = this.f24707e;
        try {
            try {
                if (r12 == 0) {
                    AbstractC2467b.l(obj);
                    A4.h hVar = ((V4.C) this.f24708f).getCoroutineContext().get(C0763h0.f8306a);
                    kotlin.jvm.internal.o.e(hVar);
                    C2969B0 c2969b03 = new C2969B0(this.f24709j, (InterfaceC0765i0) hVar);
                    c2975e0 = this.f24710k;
                    C2975E0.a(c2975e0, c2969b03);
                    this.f24708f = c2969b03;
                    e5.c cVar = c2975e0.f24718b;
                    this.f24703a = cVar;
                    C4.j jVar = this.l;
                    this.f24704b = jVar;
                    Object obj3 = this.f24711m;
                    this.f24705c = obj3;
                    this.f24706d = c2975e0;
                    this.f24707e = 1;
                    if (cVar.e(this) != aVar2) {
                        obj2 = obj3;
                        c2969b0 = c2969b03;
                        aVar = cVar;
                        r5 = jVar;
                    }
                    return aVar2;
                }
                if (r12 != 1) {
                    if (r12 != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    c2975e02 = (C2975E0) this.f24704b;
                    aVar = this.f24703a;
                    c2969b02 = (C2969B0) this.f24708f;
                    try {
                        AbstractC2467b.l(obj);
                        atomicReference2 = c2975e02.f24717a;
                        while (!atomicReference2.compareAndSet(c2969b02, null) && atomicReference2.get() == c2969b02) {
                        }
                        ((e5.c) aVar).g(null);
                        return obj;
                    } catch (Throwable th2) {
                        th = th2;
                        atomicReference = c2975e02.f24717a;
                        while (!atomicReference.compareAndSet(c2969b02, null)) {
                        }
                        throw th;
                    }
                }
                C2975E0 c2975e03 = this.f24706d;
                obj2 = this.f24705c;
                J4.e eVar = (J4.e) this.f24704b;
                e5.a aVar3 = this.f24703a;
                c2969b0 = (C2969B0) this.f24708f;
                AbstractC2467b.l(obj);
                c2975e0 = c2975e03;
                aVar = aVar3;
                r5 = eVar;
                this.f24708f = c2969b0;
                this.f24703a = aVar;
                this.f24704b = c2975e0;
                this.f24705c = null;
                this.f24706d = null;
                this.f24707e = 2;
                Object objInvoke = r5.invoke(obj2, this);
                if (objInvoke != aVar2) {
                    c2975e02 = c2975e0;
                    obj = objInvoke;
                    c2969b02 = c2969b0;
                    atomicReference2 = c2975e02.f24717a;
                    while (!atomicReference2.compareAndSet(c2969b02, null)) {
                    }
                    ((e5.c) aVar).g(null);
                    return obj;
                }
                return aVar2;
            } catch (Throwable th3) {
                c2975e02 = c2975e0;
                th = th3;
                c2969b02 = c2969b0;
                atomicReference = c2975e02.f24717a;
                while (!atomicReference.compareAndSet(c2969b02, null) && atomicReference.get() == c2969b02) {
                }
                throw th;
            }
        } catch (Throwable th4) {
            ((e5.c) r12).g(null);
            throw th4;
        }
    }
}
