package o;

import java.util.Map;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public abstract class YM extends VW implements InterfaceC2424sO, InterfaceC0712aQ {
    public VM q;
    public OC r;
    public XW s;
    public boolean t;
    public boolean u;
    public boolean v;
    public final ZM w = new ZM(0, this);
    public C2689v7 x;
    public ZQ y;

    public static void B0(AbstractC2239qS abstractC2239qS) {
        C2515tK c2515tK;
        AbstractC2239qS abstractC2239qS2 = abstractC2239qS.A;
        C2420sK c2420sK = abstractC2239qS.z;
        if (!F3.c(abstractC2239qS2 != null ? abstractC2239qS2.z : null, c2420sK)) {
            c2420sK.O.f773o.G.f();
            return;
        }
        InterfaceC3059z2 interfaceC3059z2R = c2420sK.O.f773o.r();
        if (interfaceC3059z2R == null || (c2515tK = ((C2140pO) interfaceC3059z2R).G) == null) {
            return;
        }
        c2515tK.f();
    }

    public final VM A0() {
        VM vm = this.q;
        if (vm != null) {
            return vm;
        }
        VM vm2 = new VM(this);
        this.q = vm2;
        return vm2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void C0(C0713aR c0713aR) {
        C2420sK c2420sK;
        Object[] objArr = c0713aR.b;
        long[] jArr = c0713aR.a;
        int length = jArr.length - 2;
        if (length < 0) {
            return;
        }
        int i = 0;
        while (true) {
            long j = jArr[i];
            if ((((~j) << 7) & j & (-9187201950435737472L)) != -9187201950435737472L) {
                int i2 = 8 - ((~(i - length)) >>> 31);
                for (int i3 = 0; i3 < i2; i3++) {
                    if ((255 & j) < 128 && (c2420sK = (C2420sK) ((Ok0) objArr[(i << 3) + i3]).get()) != null) {
                        if (w()) {
                            c2420sK.N(false);
                        } else {
                            c2420sK.P(false);
                        }
                    }
                    j >>= 8;
                }
                if (i2 != 8) {
                    return;
                }
            }
            if (i == length) {
                return;
            } else {
                i++;
            }
        }
    }

    public abstract void D0();

    @Override // o.InterfaceC2424sO
    public final InterfaceC2329rO G(int i, int i2, Map map, K3 k3, OC oc) {
        if ((i & (-16777216)) != 0 || ((-16777216) & i2) != 0) {
            AbstractC2133pH.b("Size(" + i + " x " + i2 + ") is out of range. Each dimension must be between 0 and 16777215.");
        }
        return new XM(i, i2, map, k3, oc, this);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:47:0x0108  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void d0(o.C2420sK r32, o.C1751lF r33) {
        /*
            Method dump skipped, instructions count: 394
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.YM.d0(o.sK, o.lF):void");
    }

    public abstract int f0(AbstractC2679v2 abstractC2679v2);

    /* JADX WARN: Multi-variable type inference failed */
    public final void g0(XW xw, long j, long j2) {
        boolean z;
        char c;
        long j3;
        long j4;
        long j5;
        C2420sK c2420sK;
        boolean z2;
        int i;
        char c2;
        long j6;
        C0713aR c0713aR;
        C1767lV snapshotObserver;
        ZQ zq = this.y;
        C2689v7 c2689v7 = this.x;
        if (c2689v7 == null) {
            c2689v7 = new C2689v7();
            this.x = c2689v7;
        }
        C2689v7 c2689v72 = c2689v7;
        InterfaceC1577jV interfaceC1577jV = w0().x;
        if (interfaceC1577jV != null && (snapshotObserver = ((C2207q3) interfaceC1577jV).getSnapshotObserver()) != null) {
            snapshotObserver.a(xw, C2291qw.v, new WM(this, j, j2, xw));
        }
        boolean zW = w();
        C0713aR c0713aR2 = (C0713aR) c2689v72.e;
        C0713aR c0713aR3 = (C0713aR) c2689v72.f;
        int i2 = c2689v72.a;
        for (int i3 = 0; i3 < i2; i3++) {
            byte b = ((byte[]) c2689v72.d)[i3];
            if (b == 3) {
                c0713aR3.i(((C1751lF[]) c2689v72.b)[i3]);
            } else if (b != 0 && zq != null && (c0713aR = (C0713aR) zq.k(((C1751lF[]) c2689v72.b)[i3])) != null) {
                c0713aR2.j(c0713aR);
            }
        }
        int i4 = c2689v72.a;
        int i5 = 0;
        for (int i6 = 0; i6 < i4; i6++) {
            byte[] bArr = (byte[]) c2689v72.d;
            if (bArr[i6] == 2) {
                i5++;
            } else if (i5 > 0) {
                C1751lF[] c1751lFArr = (C1751lF[]) c2689v72.b;
                c1751lFArr[i6 - i5] = c1751lFArr[i6];
            }
            bArr[i6] = 2;
        }
        int i7 = c2689v72.a;
        for (int i8 = i7 - i5; i8 < i7; i8++) {
            ((C1751lF[]) c2689v72.b)[i8] = null;
        }
        c2689v72.a -= i5;
        YM ymY0 = y0();
        Object[] objArr = c0713aR3.b;
        long[] jArr = c0713aR3.a;
        int length = jArr.length - 2;
        char c3 = 7;
        long j7 = -9187201950435737472L;
        int i9 = 8;
        if (length >= 0) {
            j4 = 128;
            int i10 = 0;
            while (true) {
                long j8 = jArr[i10];
                j5 = 255;
                if ((((~j8) << c3) & j8 & j7) != j7) {
                    int i11 = 8 - ((~(i10 - length)) >>> 31);
                    int i12 = 0;
                    while (i12 < i11) {
                        if ((j8 & 255) < 128) {
                            c2 = c3;
                            C1751lF c1751lF = (C1751lF) objArr[(i10 << 3) + i12];
                            j6 = j7;
                            YM ym = ymY0 == null ? this : ymY0;
                            i = i9;
                            YM ym2 = ym;
                            while (true) {
                                C2689v7 c2689v73 = ym2.x;
                                if (c2689v73 != null) {
                                    z2 = zW;
                                    if (!AbstractC2219q9.H((C1751lF[]) c2689v73.b, c1751lF)) {
                                        break;
                                        break;
                                    }
                                    break;
                                }
                                z2 = zW;
                                YM ymY02 = ym2.y0();
                                if (ymY02 == null) {
                                    break;
                                }
                                ym2 = ymY02;
                                zW = z2;
                            }
                            ZQ zq2 = ym2.y;
                            C0713aR c0713aR4 = zq2 != null ? (C0713aR) zq2.k(c1751lF) : null;
                            if (c0713aR4 != null) {
                                ym.C0(c0713aR4);
                            }
                        } else {
                            z2 = zW;
                            i = i9;
                            c2 = c3;
                            j6 = j7;
                        }
                        j8 >>= i;
                        i12++;
                        c3 = c2;
                        j7 = j6;
                        i9 = i;
                        zW = z2;
                    }
                    z = zW;
                    c = c3;
                    j3 = j7;
                    if (i11 != i9) {
                        break;
                    }
                } else {
                    z = zW;
                    c = c3;
                    j3 = j7;
                }
                if (i10 == length) {
                    break;
                }
                i10++;
                c3 = c;
                j7 = j3;
                zW = z;
                i9 = 8;
            }
        } else {
            z = zW;
            c = 7;
            j3 = -9187201950435737472L;
            j4 = 128;
            j5 = 255;
        }
        c0713aR3.b();
        Object[] objArr2 = c0713aR2.b;
        long[] jArr2 = c0713aR2.a;
        int length2 = jArr2.length - 2;
        if (length2 >= 0) {
            int i13 = 0;
            while (true) {
                long j9 = jArr2[i13];
                if ((((~j9) << c) & j9 & j3) != j3) {
                    int i14 = 8 - ((~(i13 - length2)) >>> 31);
                    for (int i15 = 0; i15 < i14; i15++) {
                        if ((j9 & j5) < j4 && (c2420sK = (C2420sK) ((Ok0) objArr2[(i13 << 3) + i15]).get()) != null) {
                            if (z) {
                                c2420sK.N(false);
                            } else {
                                c2420sK.P(false);
                            }
                        }
                        j9 >>= 8;
                    }
                    if (i14 != 8) {
                        break;
                    }
                }
                if (i13 == length2) {
                    break;
                } else {
                    i13++;
                }
            }
        }
        c0713aR2.b();
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x0051  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void h0(o.InterfaceC2329rO r15) {
        /*
            r14 = this;
            o.ZQ r0 = r14.y
            boolean r1 = r14.v
            if (r1 == 0) goto L9
        L6:
            r1 = r14
            goto Lbe
        L9:
            o.OC r1 = r15.d()
            r2 = 0
            if (r1 != 0) goto L5a
            if (r0 == 0) goto L6
            java.lang.Object[] r15 = r0.c
            long[] r1 = r0.a
            int r3 = r1.length
            int r3 = r3 + (-2)
            if (r3 < 0) goto L56
            r4 = r2
        L1c:
            r5 = r1[r4]
            long r7 = ~r5
            r9 = 7
            long r7 = r7 << r9
            long r7 = r7 & r5
            r9 = -9187201950435737472(0x8080808080808080, double:-2.937446524422997E-306)
            long r7 = r7 & r9
            int r7 = (r7 > r9 ? 1 : (r7 == r9 ? 0 : -1))
            if (r7 == 0) goto L51
            int r7 = r4 - r3
            int r7 = ~r7
            int r7 = r7 >>> 31
            r8 = 8
            int r7 = 8 - r7
            r9 = r2
        L36:
            if (r9 >= r7) goto L4f
            r10 = 255(0xff, double:1.26E-321)
            long r10 = r10 & r5
            r12 = 128(0x80, double:6.3E-322)
            int r10 = (r10 > r12 ? 1 : (r10 == r12 ? 0 : -1))
            if (r10 >= 0) goto L4b
            int r10 = r4 << 3
            int r10 = r10 + r9
            r10 = r15[r10]
            o.aR r10 = (o.C0713aR) r10
            r14.C0(r10)
        L4b:
            long r5 = r5 >> r8
            int r9 = r9 + 1
            goto L36
        L4f:
            if (r7 != r8) goto L56
        L51:
            if (r4 == r3) goto L56
            int r4 = r4 + 1
            goto L1c
        L56:
            r0.a()
            return
        L5a:
            o.OC r0 = r14.r
            r3 = 1
            if (r0 == r1) goto L61
            r0 = r3
            goto L62
        L61:
            r0 = r2
        L62:
            r4 = 0
            if (r0 != 0) goto L9b
            o.VM r1 = r14.A0()
            boolean r1 = r1.l
            if (r1 == 0) goto L9b
            o.fK r0 = r14.p0()
            long r4 = r0.b(r4)
            long r4 = o.As0.P(r4)
            long r0 = r0.K()
            o.VM r6 = r14.A0()
            long r6 = r6.m
            boolean r6 = o.C0704aI.a(r4, r6)
            if (r6 == 0) goto L96
            o.VM r6 = r14.A0()
            long r6 = r6.n
            boolean r6 = o.C1470iI.a(r0, r6)
            if (r6 != 0) goto L97
        L96:
            r2 = r3
        L97:
            r3 = r4
            r5 = r0
            r0 = r2
            goto La2
        L9b:
            r1 = 9223372034707292159(0x7fffffff7fffffff, double:NaN)
            r5 = r4
            r3 = r1
        La2:
            if (r0 == 0) goto L6
            o.XW r0 = r14.s
            if (r0 == 0) goto Lad
            r0.l = r15
        Laa:
            r1 = r14
            r2 = r0
            goto Lb5
        Lad:
            o.XW r0 = new o.XW
            r0.<init>(r15, r14)
            r14.s = r0
            goto Laa
        Lb5:
            r1.g0(r2, r3, r5)
            o.OC r15 = r15.d()
            r1.r = r15
        Lbe:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.YM.h0(o.rO):void");
    }

    public final int l0(AbstractC2679v2 abstractC2679v2) {
        int iF0;
        if (v0() && (iF0 = f0(abstractC2679v2)) != Integer.MIN_VALUE) {
            return iF0 + ((int) (abstractC2679v2 instanceof C2740vj0 ? this.p >> 32 : this.p & 4294967295L));
        }
        return Integer.MIN_VALUE;
    }

    @Override // o.InterfaceC0712aQ
    public final void m(boolean z) {
        YM ymY0 = y0();
        C2420sK c2420sKW0 = ymY0 != null ? ymY0.w0() : null;
        if (F3.c(c2420sKW0, w0())) {
            this.t = z;
            return;
        }
        if ((c2420sKW0 != null ? c2420sKW0.O.c : 0) != 3) {
            if ((c2420sKW0 != null ? c2420sKW0.O.c : 0) != 4) {
                return;
            }
        }
        this.t = z;
    }

    public abstract YM o0();

    public abstract InterfaceC1184fK p0();

    public abstract boolean v0();

    @Override // o.InterfaceC2608uI
    public boolean w() {
        return false;
    }

    public abstract C2420sK w0();

    public abstract InterfaceC2329rO x0();

    public abstract YM y0();

    public abstract long z0();
}
