package W;

import a.AbstractC0212a;
import com.google.android.gms.internal.measurement.AbstractC0366e2;
import d4.C0550i;
import i4.EnumC0643a;
import j4.AbstractC0806h;

/* JADX INFO: loaded from: classes.dex */
public final class r extends AbstractC0806h implements q4.p {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ int f3190k = 1;

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

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

    public /* synthetic */ r(int i, h4.c cVar) {
        super(i, cVar);
    }

    @Override // q4.p
    public final Object a(Object obj, Object obj2, Object obj3) {
        switch (this.f3190k) {
            case 0:
                return new r((O) this.f3192m, (h4.c) obj3).invokeSuspend(C0550i.f6143a);
            default:
                ((Boolean) obj2).getClass();
                r rVar = new r(3, (h4.c) obj3);
                rVar.f3192m = (S) obj;
                return rVar.invokeSuspend(C0550i.f6143a);
        }
    }

    @Override // j4.AbstractC0799a
    public final Object invokeSuspend(Object obj) throws Throwable {
        switch (this.f3190k) {
            case 0:
                EnumC0643a enumC0643a = EnumC0643a.f6670k;
                int i = this.f3191l;
                if (i == 0) {
                    AbstractC0212a.H(obj);
                    this.f3191l = 1;
                    if (O.b((O) this.f3192m, this) == enumC0643a) {
                        return enumC0643a;
                    }
                } else {
                    if (i != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    AbstractC0212a.H(obj);
                }
                return C0550i.f6143a;
            default:
                EnumC0643a enumC0643a2 = EnumC0643a.f6670k;
                int i5 = this.f3191l;
                if (i5 != 0) {
                    if (i5 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    AbstractC0212a.H(obj);
                    return obj;
                }
                AbstractC0212a.H(obj);
                S s5 = (S) this.f3192m;
                this.f3191l = 1;
                if (s5.f3082b.get()) {
                    throw new IllegalStateException("This scope has already been closed.");
                }
                Object objA = AbstractC0366e2.a(s5.f3081a, new Q(s5, null), this);
                return objA == enumC0643a2 ? enumC0643a2 : objA;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public r(O o5, h4.c cVar) {
        super(3, cVar);
        this.f3192m = o5;
    }
}
