package O1;

import java.util.concurrent.atomic.AtomicInteger;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class U extends C4.j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public L f5376a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ C0.J f5378c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public U(C0.J j4, A4.d dVar) {
        super(2, dVar);
        this.f5378c = j4;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new U(this.f5378c, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:16:0x0059, code lost:
    
        if (r1.invoke(r7, r6) != r0) goto L18;
     */
    /* JADX WARN: Removed duplicated region for block: B:15:0x0050 A[PHI: r1 r7
      0x0050: PHI (r1v1 O1.L) = (r1v3 O1.L), (r1v4 O1.L) binds: [B:13:0x004d, B:9:0x001a] A[DONT_GENERATE, DONT_INLINE]
      0x0050: PHI (r7v7 java.lang.Object) = (r7v15 java.lang.Object), (r7v0 java.lang.Object) binds: [B:13:0x004d, B:9:0x001a] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:16:0x0059 -> B:18:0x005c). Please report as a decompilation issue!!! */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        L l;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f5377b;
        C0.J j4 = this.f5378c;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            if (((AtomicInteger) ((C0.B) j4.f536e).f506b).get() <= 0) {
                throw new IllegalStateException("Check failed.");
            }
            V4.E.m(((V4.C) j4.f533b).getCoroutineContext());
            l = (L) j4.f534c;
            X4.e eVar = (X4.e) j4.f535d;
            this.f5376a = l;
            this.f5377b = 1;
            obj = eVar.e(this);
            if (obj != aVar) {
            }
            return aVar;
        }
        if (i6 != 1) {
            if (i6 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            AbstractC2467b.l(obj);
            if (((AtomicInteger) ((C0.B) j4.f536e).f506b).decrementAndGet() == 0) {
                return C3137A.f25453a;
            }
            V4.E.m(((V4.C) j4.f533b).getCoroutineContext());
            l = (L) j4.f534c;
            X4.e eVar2 = (X4.e) j4.f535d;
            this.f5376a = l;
            this.f5377b = 1;
            obj = eVar2.e(this);
            if (obj != aVar) {
                this.f5376a = null;
                this.f5377b = 2;
            }
            return aVar;
        }
        l = this.f5376a;
        AbstractC2467b.l(obj);
        this.f5376a = null;
        this.f5377b = 2;
    }
}
