package defpackage;

import defpackage.dw7;
import defpackage.em0;
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 = {"Lhwa;", "Le6a;", "<anonymous>", "(Lhwa;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "io.ktor.client.plugins.internal.ByteChannelReplay$replay$1", f = "ByteChannelReplay.kt", i = {0}, l = {33, 34}, m = "invokeSuspend", n = {"$this$writer"}, s = {"L$0"})
final class fm0 extends SuspendLambda implements gr3<hwa, Continuation<? super e6a>, Object> {
    public int a;
    public /* synthetic */ Object b;
    public final /* synthetic */ dw7.h c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public fm0(dw7.h hVar, Continuation continuation) {
        super(2, continuation);
        this.c = hVar;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        fm0 fm0Var = new fm0(this.c, continuation);
        fm0Var.b = obj;
        return fm0Var;
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:23:0x0072, code lost:
    
        if (defpackage.kp0.c(r1, r8, 0, r8.length, r7) == r0) goto L24;
     */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        hwa hwaVar;
        ck1 ck1Var = ck1.a;
        int i = this.a;
        if (i == 0) {
            s38.b(obj);
            hwaVar = (hwa) this.b;
            Object obj2 = this.c.a;
            cr4.d(obj2);
            em0.a aVar = (em0.a) obj2;
            this.b = hwaVar;
            this.a = 1;
            gwa gwaVar = aVar.b;
            if (gwaVar == null) {
                cr4.n("writerJob");
                throw null;
            }
            if (!((rx4) gwaVar.b).bi()) {
                gwa gwaVar2 = aVar.b;
                if (gwaVar2 == null) {
                    cr4.n("writerJob");
                    throw null;
                }
                gwaVar2.a.c(new la8("Save body abandoned"));
            }
            obj = aVar.a.ab(this);
            if (obj != ck1Var) {
            }
            return ck1Var;
        }
        if (i != 1) {
            if (i != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            s38.b(obj);
            return e6a.a;
        }
        hwaVar = (hwa) this.b;
        s38.b(obj);
        byte[] bArr = (byte[]) obj;
        gp0 gp0Var = hwaVar.a;
        this.b = null;
        this.a = 2;
    }
}
