package o;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class NR extends LP implements Xg0, GR {
    public JR A;
    public NR B;
    public final String C = "androidx.compose.ui.input.nestedscroll.NestedScrollNode";
    public GR z;

    public NR(GR gr, JR jr) {
        this.z = gr;
        this.A = jr;
    }

    @Override // o.LP
    public final void A0() {
        B10 b10 = new B10();
        YT.V(this, new C1448i3(b10, 2));
        NR nr = (NR) ((Xg0) b10.l);
        this.B = nr;
        JR jr = this.A;
        jr.b = nr;
        if (jr.a == this) {
            jr.a = null;
        }
    }

    public final InterfaceC0065Cn H0() {
        NR nr = this.y ? (NR) YT.v(this) : null;
        InterfaceC0065Cn interfaceC0065CnH0 = nr != null ? nr.H0() : null;
        if (interfaceC0065CnH0 != null && C80.D(interfaceC0065CnH0)) {
            return interfaceC0065CnH0;
        }
        InterfaceC0065Cn interfaceC0065Cn = this.A.d;
        if (interfaceC0065Cn != null) {
            return interfaceC0065Cn;
        }
        throw new IllegalStateException("in order to access nested coroutine scope you need to attach dispatcher to the `Modifier.nestedScroll` first.");
    }

    @Override // o.GR
    public final long L(int i, long j, long j2) {
        long jL = this.z.L(i, j, j2);
        boolean z = this.y;
        NR nr = null;
        if (z && z) {
            nr = (NR) YT.v(this);
        }
        NR nr2 = nr;
        return C1765lT.e(jL, nr2 != null ? nr2.L(i, C1765lT.e(j, jL), C1765lT.d(j2, jL)) : 0L);
    }

    /* JADX WARN: Code restructure failed: missing block: B:22:0x0057, code lost:
    
        if (r12 == r4) goto L29;
     */
    /* JADX WARN: Code restructure failed: missing block: B:28:0x0073, code lost:
    
        if (r12 != r4) goto L30;
     */
    /* JADX WARN: Code restructure failed: missing block: B:29:0x0075, code lost:
    
        return r4;
     */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    @Override // o.GR
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final java.lang.Object V(long r10, o.InterfaceC0220Im r12) {
        /*
            r9 = this;
            boolean r0 = r12 instanceof o.MR
            if (r0 == 0) goto L13
            r0 = r12
            o.MR r0 = (o.MR) r0
            int r1 = r0.r
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.r = r1
            goto L1a
        L13:
            o.MR r0 = new o.MR
            o.Lm r12 = (o.AbstractC0298Lm) r12
            r0.<init>(r9, r12)
        L1a:
            java.lang.Object r12 = r0.p
            int r1 = r0.r
            r2 = 2
            r3 = 1
            o.Dn r4 = o.EnumC0091Dn.l
            if (r1 == 0) goto L3c
            if (r1 == r3) goto L36
            if (r1 != r2) goto L2e
            long r10 = r0.f233o
            o.IJ.H(r12)
            goto L76
        L2e:
            java.lang.IllegalStateException r10 = new java.lang.IllegalStateException
            java.lang.String r11 = "call to 'resume' before 'invoke' with coroutine"
            r10.<init>(r11)
            throw r10
        L36:
            long r10 = r0.f233o
            o.IJ.H(r12)
            goto L5a
        L3c:
            o.IJ.H(r12)
            boolean r12 = r9.y
            r1 = 0
            if (r12 == 0) goto L4d
            if (r12 == 0) goto L4d
            o.Xg0 r12 = o.YT.v(r9)
            r1 = r12
            o.NR r1 = (o.NR) r1
        L4d:
            if (r1 == 0) goto L62
            r0.f233o = r10
            r0.r = r3
            java.lang.Object r12 = r1.V(r10, r0)
            if (r12 != r4) goto L5a
            goto L75
        L5a:
            o.lj0 r12 = (o.C1791lj0) r12
            long r5 = r12.a
        L5e:
            r7 = r5
            r5 = r10
            r10 = r7
            goto L65
        L62:
            r5 = 0
            goto L5e
        L65:
            o.GR r12 = r9.z
            long r5 = o.C1791lj0.d(r5, r10)
            r0.f233o = r10
            r0.r = r2
            java.lang.Object r12 = r12.V(r5, r0)
            if (r12 != r4) goto L76
        L75:
            return r4
        L76:
            o.lj0 r12 = (o.C1791lj0) r12
            long r0 = r12.a
            long r10 = o.C1791lj0.e(r10, r0)
            o.lj0 r12 = new o.lj0
            r12.<init>(r10)
            return r12
        */
        throw new UnsupportedOperationException("Method not decompiled: o.NR.V(long, o.Im):java.lang.Object");
    }

    @Override // o.GR
    public final long f0(int i, long j) {
        boolean z = this.y;
        NR nr = null;
        if (z && z) {
            nr = (NR) YT.v(this);
        }
        long jF0 = nr != null ? nr.f0(i, j) : 0L;
        return C1765lT.e(jF0, this.z.f0(i, C1765lT.d(j, jF0)));
    }

    /* JADX WARN: Removed duplicated region for block: B:8:0x0016  */
    @Override // o.GR
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final java.lang.Object j(long r13, long r15, o.InterfaceC0220Im r17) {
        /*
            r12 = this;
            r0 = r17
            boolean r1 = r0 instanceof o.KR
            if (r1 == 0) goto L16
            r1 = r0
            o.KR r1 = (o.KR) r1
            int r2 = r1.s
            r3 = -2147483648(0xffffffff80000000, float:-0.0)
            r4 = r2 & r3
            if (r4 == 0) goto L16
            int r2 = r2 - r3
            r1.s = r2
        L14:
            r7 = r1
            goto L1e
        L16:
            o.KR r1 = new o.KR
            o.Lm r0 = (o.AbstractC0298Lm) r0
            r1.<init>(r12, r0)
            goto L14
        L1e:
            java.lang.Object r0 = r7.q
            int r1 = r7.s
            r8 = 2
            r2 = 1
            o.Dn r9 = o.EnumC0091Dn.l
            if (r1 == 0) goto L42
            if (r1 == r2) goto L3a
            if (r1 != r8) goto L32
            long r1 = r7.f191o
            o.IJ.H(r0)
            goto L88
        L32:
            java.lang.IllegalStateException r0 = new java.lang.IllegalStateException
            java.lang.String r1 = "call to 'resume' before 'invoke' with coroutine"
            r0.<init>(r1)
            throw r0
        L3a:
            long r1 = r7.p
            long r3 = r7.f191o
            o.IJ.H(r0)
            goto L59
        L42:
            o.IJ.H(r0)
            o.GR r0 = r12.z
            r7.f191o = r13
            r5 = r15
            r7.p = r5
            r7.s = r2
            r3 = r13
            r2 = r0
            java.lang.Object r0 = r2.j(r3, r5, r7)
            if (r0 != r9) goto L57
            goto L86
        L57:
            r3 = r13
            r1 = r15
        L59:
            o.lj0 r0 = (o.C1791lj0) r0
            long r10 = r0.a
            boolean r0 = r12.y
            if (r0 == 0) goto L6e
            r5 = 0
            if (r0 == 0) goto L70
            if (r0 == 0) goto L70
            o.Xg0 r0 = o.YT.v(r12)
            r5 = r0
            o.NR r5 = (o.NR) r5
            goto L70
        L6e:
            o.NR r5 = r12.B
        L70:
            if (r5 == 0) goto L8e
            long r3 = o.C1791lj0.e(r3, r10)
            long r0 = o.C1791lj0.d(r1, r10)
            r7.f191o = r10
            r7.s = r8
            r2 = r5
            r5 = r0
            java.lang.Object r0 = r2.j(r3, r5, r7)
            if (r0 != r9) goto L87
        L86:
            return r9
        L87:
            r1 = r10
        L88:
            o.lj0 r0 = (o.C1791lj0) r0
            long r3 = r0.a
            r10 = r1
            goto L90
        L8e:
            r3 = 0
        L90:
            long r0 = o.C1791lj0.e(r10, r3)
            o.lj0 r2 = new o.lj0
            r2.<init>(r0)
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: o.NR.j(long, long, o.Im):java.lang.Object");
    }

    @Override // o.Xg0
    public final Object s() {
        return this.C;
    }

    @Override // o.LP
    public final void z0() {
        JR jr = this.A;
        jr.a = this;
        jr.b = null;
        this.B = null;
        jr.c = new U4(17, this);
        jr.d = v0();
    }
}
