package defpackage;

import com.google.android.material.card.MaterialCardViewHelper;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "io.ktor.utils.io.ByteReadChannelOperationsKt$reader$job$1", f = "ByteReadChannelOperations.kt", i = {0, 0, 1, 3, 5}, l = {290, MaterialCardViewHelper.DEFAULT_FADE_ANIM_DURATION, 301, MaterialCardViewHelper.DEFAULT_FADE_ANIM_DURATION, 301, MaterialCardViewHelper.DEFAULT_FADE_ANIM_DURATION, 301}, m = "invokeSuspend", n = {"$this$launch", "nested", "$this$launch", "$this$launch", "$this$launch"}, s = {"L$0", "L$1", "L$0", "L$0", "L$0"})
@vx8
final class do0 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public Object a;
    public int b;
    public /* synthetic */ Object c;
    public final /* synthetic */ gr3 d;
    public final /* synthetic */ xl0 e;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public do0(gr3 gr3Var, xl0 xl0Var, Continuation continuation) {
        super(2, continuation);
        this.d = gr3Var;
        this.e = xl0Var;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        do0 do0Var = new do0(this.d, this.e, continuation);
        do0Var.c = obj;
        return do0Var;
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        return ((do0) create((ak1) obj, (Continuation) obj2)).invokeSuspend(e6a.a);
    }

    /* JADX WARN: Code restructure failed: missing block: B:29:0x008a, code lost:
    
        if (r3.d(r8) != r0) goto L61;
     */
    /* JADX WARN: Code restructure failed: missing block: B:40:0x00e4, code lost:
    
        if (r3.d(r8) != r0) goto L61;
     */
    /* JADX WARN: Not initialized variable reg: 4, insn: 0x00cd: IPUT (r4 I:java.lang.Object), (r8 I:do0) do0.c java.lang.Object, block:B:36:0x00cd */
    /* JADX WARN: Not initialized variable reg: 4, insn: 0x00eb: IPUT (r4 I:java.lang.Object), (r8 I:do0) do0.c java.lang.Object, block:B:45:0x00eb */
    /* JADX WARN: Removed duplicated region for block: B:51:0x0107  */
    /* JADX WARN: Type inference failed for: r1v0, types: [fx4, int] */
    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    jadx.core.utils.exceptions.JadxRuntimeException: Not class type: int
    	at jadx.core.dex.info.ClassInfo.checkClassType(ClassInfo.java:59)
    	at jadx.core.dex.info.ClassInfo.fromType(ClassInfo.java:32)
    	at jadx.core.dex.nodes.RootNode.resolveClass(RootNode.java:508)
    	at jadx.core.dex.nodes.utils.TypeUtils.getClassTypeVars(TypeUtils.java:53)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:175)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        Object obj2;
        Object obj3;
        Throwable th;
        Throwable th2;
        ck1 ck1Var = ck1.a;
        ?? r1 = this.b;
        xl0 xl0Var = this.e;
        try {
            try {
            } catch (Throwable th3) {
                try {
                    r1.h(er2.a("Exception thrown while reading from channel", th3));
                    kp0.a(xl0Var, th3);
                    this.c = obj3;
                    this.a = null;
                    this.b = 4;
                    if (r1.u(this) != ck1Var) {
                        this.c = null;
                        this.b = 5;
                    }
                } catch (Throwable th4) {
                    th = th4;
                    this.c = obj2;
                    this.a = th;
                    this.b = 6;
                    if (r1.u(this) != ck1Var) {
                        try {
                            this.c = th;
                            this.a = null;
                            this.b = 7;
                            if (xl0Var.d(this) != ck1Var) {
                            }
                        } catch (Throwable th5) {
                            th = th;
                            th2 = th5;
                            s38.a(th2);
                            throw th;
                        }
                    }
                }
                return ck1Var;
            }
        } catch (Throwable th6) {
            s38.a(th6);
        }
        switch (r1) {
            case 0:
                s38.b(obj);
                ak1 ak1Var = (ak1) this.c;
                hx4 hx4Var = new hx4(kx4.d(ak1Var.getB()));
                gr3 gr3Var = this.d;
                eu7 eu7Var = new eu7(xl0Var, ak1Var.getB().bx(hx4Var));
                this.c = ak1Var;
                this.a = hx4Var;
                this.b = 1;
                gr3Var.invoke(eu7Var, this);
                throw null;
            case 1:
                u81 u81Var = (u81) this.a;
                ak1 ak1Var2 = (ak1) this.c;
                s38.b(obj);
                u81Var.bw();
                if (kx4.d(ak1Var2.getB()).isCancelled()) {
                    xl0Var.c(kx4.d(ak1Var2.getB()).w());
                }
                this.c = ak1Var2;
                this.a = null;
                this.b = 2;
                if (u81Var.u(this) != ck1Var) {
                    this.c = null;
                    this.b = 3;
                    break;
                }
                return ck1Var;
            case 2:
                s38.b(obj);
                this.c = null;
                this.b = 3;
                break;
            case 3:
            case 5:
                s38.b(obj);
                return e6a.a;
            case 4:
                s38.b(obj);
                this.c = null;
                this.b = 5;
                break;
            case 6:
                Throwable th7 = (Throwable) this.a;
                s38.b(obj);
                th = th7;
                this.c = th;
                this.a = null;
                this.b = 7;
                if (xl0Var.d(this) != ck1Var) {
                    throw th;
                }
                return ck1Var;
            case 7:
                th = (Throwable) this.c;
                try {
                    s38.b(obj);
                    throw th;
                } catch (Throwable th8) {
                    th2 = th8;
                    s38.a(th2);
                    throw th;
                }
            default:
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }
}
