package defpackage;

import androidx.media3.container.NalUnitUtil;
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 = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@DebugMetadata(c = "io.ktor.utils.io.ByteReadChannelOperations_jvmKt", f = "ByteReadChannelOperations.jvm.kt", i = {0, 0}, l = {118}, m = "readFully", n = {"$this$readFully", "buffer"}, s = {"L$0", "L$1"})
final class ko0 extends ContinuationImpl {
    public bn0 a;
    public ByteBuffer b;
    public /* synthetic */ Object c;
    public int d;

    /* JADX WARN: Removed duplicated region for block: B:11:0x002f  */
    /* JADX WARN: Removed duplicated region for block: B:17:0x004a  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:12:0x0033 -> B:16:0x0042). Please report as a decompilation issue!!! */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:14:0x003f -> B:16:0x0042). 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) {
        ByteBuffer byteBuffer;
        bn0 bn0Var;
        ko0 ko0Var;
        this.c = obj;
        int i = (this.d | Integer.MIN_VALUE) - Integer.MIN_VALUE;
        this.d = i;
        ck1 ck1Var = ck1.a;
        if (i == 0) {
            s38.b(obj);
            byteBuffer = null;
            bn0Var = null;
            ko0Var = this;
            if (!byteBuffer.hasRemaining()) {
            }
        } else {
            if (i != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            byteBuffer = this.b;
            bn0Var = this.a;
            s38.b(obj);
            ko0Var = this;
            py8.a(bn0Var.g(), byteBuffer);
            if (!byteBuffer.hasRemaining()) {
                return e6a.a;
            }
            if (go0.d(bn0Var) == 0) {
                ko0Var.a = bn0Var;
                ko0Var.b = byteBuffer;
                ko0Var.d = 1;
                if (bn0Var.h(1, ko0Var) == ck1Var) {
                    return ck1Var;
                }
            }
            py8.a(bn0Var.g(), byteBuffer);
            if (!byteBuffer.hasRemaining()) {
            }
        }
    }
}
