package defpackage;

import java.nio.ByteBuffer;
import kotlin.Metadata;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(k = 3, mv = {2, 0, 0}, xi = 176)
@DebugMetadata(c = "io.ktor.util.cio.ReadersJvmKt", f = "ReadersJvm.kt", i = {0, 0, 0}, l = {17}, m = "pass", n = {"$this$pass", "buffer", "block"}, s = {"L$0", "L$1", "L$2"})
final class fu7 extends ContinuationImpl {
    public bn0 a;
    public ByteBuffer b;
    public sq3 c;
    public /* synthetic */ Object d;
    public int e;

    /* JADX WARN: Removed duplicated region for block: B:11:0x0032  */
    /* JADX WARN: Removed duplicated region for block: B:15:0x004b  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:12:0x0041 -> B:14:0x0044). Please report as a decompilation issue!!! */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        sq3 sq3Var;
        ByteBuffer byteBuffer;
        bn0 bn0Var;
        fu7 fu7Var;
        this.d = obj;
        int i = (this.e | Integer.MIN_VALUE) - Integer.MIN_VALUE;
        this.e = i;
        ck1 ck1Var = ck1.a;
        if (i == 0) {
            s38.b(obj);
            sq3Var = null;
            byteBuffer = null;
            bn0Var = null;
            fu7Var = this;
            if (!bn0Var.i()) {
            }
        } else {
            if (i != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            sq3Var = this.c;
            byteBuffer = this.b;
            bn0Var = this.a;
            s38.b(obj);
            fu7Var = this;
            byteBuffer.flip();
            sq3Var.invoke(byteBuffer);
            if (!bn0Var.i()) {
                byteBuffer.clear();
                fu7Var.a = bn0Var;
                fu7Var.b = byteBuffer;
                fu7Var.c = sq3Var;
                fu7Var.e = 1;
                if (mo0.a(bn0Var, byteBuffer, fu7Var) == ck1Var) {
                    return ck1Var;
                }
                byteBuffer.flip();
                sq3Var.invoke(byteBuffer);
                if (!bn0Var.i()) {
                    Throwable thA = bn0Var.a();
                    if (thA == null) {
                        return e6a.a;
                    }
                    throw thA;
                }
            }
        }
    }
}
