package o;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.NoSuchElementException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.h90, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1365h90 {
    public final C1077e90 a;
    public int[] b;
    public Object[] c;
    public ArrayList d;
    public HashMap e;
    public IQ f;
    public int g;
    public int h;
    public int i;
    public int j;
    public int k;
    public int l;
    public int m;
    public int n;

    /* renamed from: o, reason: collision with root package name */
    public int f555o;
    public final C1564jI p;
    public final C1564jI q;
    public final C1564jI r;
    public IQ s;
    public int t;
    public int u;
    public int v;
    public boolean w;
    public HQ x;

    public C1365h90(C1077e90 c1077e90) {
        this.a = c1077e90;
        int[] iArr = c1077e90.l;
        this.b = iArr;
        Object[] objArr = c1077e90.n;
        this.c = objArr;
        this.d = c1077e90.t;
        this.e = c1077e90.u;
        this.f = c1077e90.v;
        int i = c1077e90.m;
        this.g = i;
        this.h = (iArr.length / 5) - i;
        int i2 = c1077e90.f504o;
        this.k = i2;
        this.l = objArr.length - i2;
        this.m = i;
        this.p = new C1564jI();
        this.q = new C1564jI();
        this.r = new C1564jI();
        this.u = i;
        this.v = -1;
    }

    public static int i(int i, int i2, int i3, int i4) {
        return i > i2 ? -(((i4 - i3) - i) + 1) : i;
    }

    public static void x(C1365h90 c1365h90) {
        int i = c1365h90.v;
        int iQ = c1365h90.q(i);
        int[] iArr = c1365h90.b;
        int i2 = (iQ * 5) + 1;
        int i3 = iArr[i2];
        if ((i3 & 134217728) != 0) {
            return;
        }
        int i4 = (i3 & (-134217729)) | 134217728;
        iArr[i2] = i4;
        if ((67108864 & i4) != 0) {
            return;
        }
        c1365h90.R(c1365h90.C(iArr, i));
    }

    public final void A(int i, int i2) {
        int i3 = this.l;
        int i4 = this.k;
        int i5 = this.m;
        if (i4 != i) {
            Object[] objArr = this.c;
            if (i < i4) {
                System.arraycopy(objArr, i, objArr, i + i3, i4 - i);
            } else {
                int i6 = i4 + i3;
                System.arraycopy(objArr, i6, objArr, i4, (i + i3) - i6);
            }
        }
        int iMin = Math.min(i2 + 1, o());
        if (i5 != iMin) {
            int length = this.c.length - i3;
            if (iMin < i5) {
                int iQ = q(iMin);
                int iQ2 = q(i5);
                int i7 = this.g;
                while (iQ < iQ2) {
                    int i8 = (iQ * 5) + 4;
                    int i9 = this.b[i8];
                    if (!(i9 >= 0)) {
                        AbstractC0373Ok.c("Unexpected anchor value, expected a positive anchor");
                    }
                    this.b[i8] = -((length - i9) + 1);
                    iQ++;
                    if (iQ == i7) {
                        iQ += this.h;
                    }
                }
            } else {
                int iQ3 = q(i5);
                int iQ4 = q(iMin);
                while (iQ3 < iQ4) {
                    int i10 = (iQ3 * 5) + 4;
                    int i11 = this.b[i10];
                    if (!(i11 < 0)) {
                        AbstractC0373Ok.c("Unexpected anchor value, expected a negative anchor");
                    }
                    this.b[i10] = i11 + length + 1;
                    iQ3++;
                    if (iQ3 == this.g) {
                        iQ3 += this.h;
                    }
                }
            }
            this.m = iMin;
        }
        this.k = i;
    }

    public final Object B(int i) {
        int iQ = q(i);
        int[] iArr = this.b;
        if ((iArr[(iQ * 5) + 1] & 1073741824) != 0) {
            return this.c[h(g(iArr, iQ))];
        }
        return null;
    }

    public final int C(int[] iArr, int i) {
        int i2 = iArr[(q(i) * 5) + 2];
        return i2 > -2 ? i2 : (o() + i2) - (-2);
    }

    public final Object D(Object obj) {
        if (this.n > 0) {
            v(1, this.v);
        }
        Object[] objArr = this.c;
        int i = this.i;
        this.i = i + 1;
        Object obj2 = objArr[h(i)];
        if (this.i > this.j) {
            AbstractC0373Ok.c("Writing to an invalid slot");
        }
        this.c[h(this.i - 1)] = obj;
        return obj2;
    }

    public final void E() {
        int i;
        HQ hq = this.x;
        if (hq != null) {
            while (hq.b != 0) {
                int iY = AbstractC2798wI.y(hq);
                int iQ = q(iY);
                int iS = iY + 1;
                int iS2 = s(iY) + iY;
                while (true) {
                    if (iS >= iS2) {
                        i = 0;
                        break;
                    } else {
                        if ((this.b[(q(iS) * 5) + 1] & 201326592) != 0) {
                            i = 1;
                            break;
                        }
                        iS += s(iS);
                    }
                }
                int[] iArr = this.b;
                int i2 = (iQ * 5) + 1;
                int i3 = iArr[i2];
                if (((67108864 & i3) != 0 ? 1 : 0) != i) {
                    iArr[i2] = (i << 26) | ((-67108865) & i3);
                    int iC = C(iArr, iY);
                    if (iC >= 0) {
                        AbstractC2798wI.d(hq, iC);
                    }
                }
            }
        }
    }

    public final boolean F() {
        if (this.n != 0) {
            AbstractC0373Ok.c("Cannot remove group while inserting");
        }
        int i = this.t;
        int i2 = this.i;
        int iG = g(this.b, q(i));
        int iJ = J();
        M(this.v);
        HQ hq = this.x;
        if (hq != null) {
            while (true) {
                int i3 = hq.b;
                if (i3 == 0) {
                    break;
                }
                if (i3 == 0) {
                    throw new NoSuchElementException("IntList is empty.");
                }
                if (hq.a[0] < i) {
                    break;
                }
                AbstractC2798wI.y(hq);
            }
        }
        boolean zG = G(i, this.t - i);
        H(iG, this.i - iG, i - 1);
        this.t = i;
        this.i = i2;
        this.f555o -= iJ;
        return zG;
    }

    public final boolean G(int i, int i2) {
        if (i2 > 0) {
            ArrayList arrayList = this.d;
            z(i);
            if (!arrayList.isEmpty()) {
                HashMap map = this.e;
                int i3 = i + i2;
                int iB = AbstractC1269g90.b(this.d, i3, n() - this.h);
                if (iB >= this.d.size()) {
                    iB--;
                }
                int i4 = iB + 1;
                int i5 = 0;
                while (iB >= 0) {
                    G2 g2 = (G2) this.d.get(iB);
                    int iC = c(g2);
                    if (iC < i) {
                        break;
                    }
                    if (iC < i3) {
                        g2.a = Integer.MIN_VALUE;
                        if (map != null) {
                        }
                        if (i5 == 0) {
                            i5 = iB + 1;
                        }
                        i4 = iB;
                    }
                    iB--;
                }
                z = i4 < i5;
                if (z) {
                    this.d.subList(i4, i5).clear();
                }
            }
            this.g = i;
            this.h += i2;
            int i6 = this.m;
            if (i6 > i) {
                this.m = Math.max(i, i6 - i2);
            }
            int i7 = this.u;
            if (i7 >= this.g) {
                this.u = i7 - i2;
            }
            int i8 = this.v;
            if (i8 >= 0 && (this.b[(q(i8) * 5) + 1] & 67108864) != 0) {
                R(i8);
            }
        }
        return z;
    }

    public final void H(int i, int i2, int i3) {
        if (i2 > 0) {
            int i4 = this.l;
            int i5 = i + i2;
            A(i5, i3);
            this.k = i;
            this.l = i4 + i2;
            Arrays.fill(this.c, i, i5, (Object) null);
            int i6 = this.j;
            if (i6 >= i) {
                this.j = i6 - i2;
            }
        }
    }

    public final Object I(int i, int i2, Object obj) {
        int iL = L(this.b, q(i));
        int iG = g(this.b, q(i + 1));
        int i3 = iL + i2;
        if (i3 < iL || i3 >= iG) {
            AbstractC0373Ok.c("Write to an invalid slot index " + i2 + " for group " + i);
        }
        int iH = h(i3);
        Object[] objArr = this.c;
        Object obj2 = objArr[iH];
        objArr[iH] = obj;
        return obj2;
    }

    public final int J() {
        int iQ = q(this.t);
        int iA = AbstractC1269g90.a(this.b, iQ) + this.t;
        this.t = iA;
        this.i = g(this.b, q(iA));
        int i = this.b[(iQ * 5) + 1];
        if ((1073741824 & i) != 0) {
            return 1;
        }
        return i & 67108863;
    }

    public final void K() {
        int i = this.u;
        this.t = i;
        this.i = g(this.b, q(i));
    }

    public final int L(int[] iArr, int i) {
        if (i >= n()) {
            return this.c.length - this.l;
        }
        int iC = AbstractC1269g90.c(iArr, i);
        return iC < 0 ? (this.c.length - this.l) + iC + 1 : iC;
    }

    public final AbstractC2414sE M(int i) {
        G2 g2P;
        HashMap map = this.e;
        if (map == null || (g2P = P(i)) == null) {
            return null;
        }
        return (AbstractC2414sE) map.get(g2P);
    }

    public final void N() {
        if (this.n != 0) {
            AbstractC0373Ok.c("Key must be supplied when inserting");
        }
        J7 j7 = C0140Fk.a;
        O(0, j7, j7, false);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void O(int i, Object obj, Object obj2, boolean z) {
        int i2;
        int i3 = this.v;
        Object[] objArr = this.n > 0;
        this.r.c(this.f555o);
        J7 j7 = C0140Fk.a;
        if (objArr == true) {
            int i4 = this.t;
            int iG = g(this.b, q(i4));
            u(1);
            this.i = iG;
            this.j = iG;
            int iQ = q(i4);
            int i5 = obj != j7 ? 1 : 0;
            int i6 = (z || obj2 == j7) ? 0 : 1;
            int i7 = i(iG, this.k, this.l, this.c.length);
            if (i7 >= 0 && this.m < i4) {
                i7 = -(((this.c.length - this.l) - i7) + 1);
            }
            int[] iArr = this.b;
            int i8 = this.v;
            int i9 = iQ * 5;
            iArr[i9] = i;
            iArr[i9 + 1] = ((z ? 1 : 0) << 30) | (i5 << 29) | (i6 << 28);
            iArr[i9 + 2] = i8;
            iArr[i9 + 3] = 0;
            iArr[i9 + 4] = i7;
            int i10 = (z ? 1 : 0) + i5 + i6;
            if (i10 > 0) {
                v(i10, i4);
                Object[] objArr2 = this.c;
                int i11 = this.i;
                if (z) {
                    objArr2[i11] = obj2;
                    i11++;
                }
                if (i5 != 0) {
                    objArr2[i11] = obj;
                    i11++;
                }
                if (i6 != 0) {
                    objArr2[i11] = obj2;
                    i11++;
                }
                this.i = i11;
            }
            this.f555o = 0;
            i2 = i4 + 1;
            this.v = i4;
            this.t = i2;
            if (i3 >= 0) {
                M(i3);
            }
        } else {
            this.p.c(i3);
            this.q.c((n() - this.h) - this.u);
            int i12 = this.t;
            int iQ2 = q(i12);
            if (!F3.c(obj2, j7)) {
                if (z) {
                    S(this.t, obj2);
                } else {
                    Q(obj2);
                }
            }
            this.i = L(this.b, iQ2);
            this.j = g(this.b, q(this.t + 1));
            int[] iArr2 = this.b;
            int i13 = iQ2 * 5;
            this.f555o = iArr2[i13 + 1] & 67108863;
            this.v = i12;
            this.t = i12 + 1;
            i2 = i12 + iArr2[i13 + 3];
        }
        this.u = i2;
    }

    public final G2 P(int i) {
        ArrayList arrayList;
        int iE;
        if (i < 0 || i >= o() || (iE = AbstractC1269g90.e((arrayList = this.d), i, o())) < 0) {
            return null;
        }
        return (G2) arrayList.get(iE);
    }

    public final void Q(Object obj) {
        int iQ = q(this.t);
        int i = (iQ * 5) + 1;
        if ((this.b[i] & 268435456) == 0) {
            AbstractC0373Ok.c("Updating the data of a group that was not created with a data slot");
        }
        Object[] objArr = this.c;
        int[] iArr = this.b;
        objArr[h(Integer.bitCount(iArr[i] >> 29) + g(iArr, iQ))] = obj;
    }

    public final void R(int i) {
        if (i >= 0) {
            HQ hq = this.x;
            if (hq == null) {
                hq = new HQ();
                this.x = hq;
            }
            AbstractC2798wI.d(hq, i);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0015  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void S(int r5, java.lang.Object r6) {
        /*
            r4 = this;
            int r0 = r4.q(r5)
            int[] r1 = r4.b
            int r2 = r1.length
            if (r0 >= r2) goto L15
            int r2 = r0 * 5
            r3 = 1
            int r2 = r2 + r3
            r1 = r1[r2]
            r2 = 1073741824(0x40000000, float:2.0)
            r1 = r1 & r2
            if (r1 == 0) goto L15
            goto L16
        L15:
            r3 = 0
        L16:
            if (r3 != 0) goto L2e
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r2 = "Updating the node of a group at "
            r1.<init>(r2)
            r1.append(r5)
            java.lang.String r5 = " that was not created with as a node group"
            r1.append(r5)
            java.lang.String r5 = r1.toString()
            o.AbstractC0373Ok.c(r5)
        L2e:
            java.lang.Object[] r5 = r4.c
            int[] r1 = r4.b
            int r0 = r4.g(r1, r0)
            int r0 = r4.h(r0)
            r5[r0] = r6
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C1365h90.S(int, java.lang.Object):void");
    }

    public final void a(int i) {
        boolean z = false;
        if (!(i >= 0)) {
            AbstractC0373Ok.c("Cannot seek backwards");
        }
        if (!(this.n <= 0)) {
            AbstractC1102eY.b("Cannot call seek() while inserting");
        }
        if (i == 0) {
            return;
        }
        int i2 = this.t + i;
        if (i2 >= this.v && i2 <= this.u) {
            z = true;
        }
        if (!z) {
            AbstractC0373Ok.c("Cannot seek outside the current group (" + this.v + '-' + this.u + ')');
        }
        this.t = i2;
        int iG = g(this.b, q(i2));
        this.i = iG;
        this.j = iG;
    }

    public final G2 b(int i) {
        ArrayList arrayList = this.d;
        int iE = AbstractC1269g90.e(arrayList, i, o());
        if (iE >= 0) {
            return (G2) arrayList.get(iE);
        }
        if (i > this.g) {
            i = -(o() - i);
        }
        G2 g2 = new G2(i);
        arrayList.add(-(iE + 1), g2);
        return g2;
    }

    public final int c(G2 g2) {
        int i = g2.a;
        return i < 0 ? o() + i : i;
    }

    public final void d() {
        int i = this.n;
        this.n = i + 1;
        if (i == 0) {
            this.q.c((n() - this.h) - this.u);
        }
    }

    public final void e(boolean z) {
        this.w = true;
        if (z && this.p.b == 0) {
            z(o());
            A(this.c.length - this.l, this.g);
            int i = this.k;
            Arrays.fill(this.c, i, this.l + i, (Object) null);
            E();
        }
        int[] iArr = this.b;
        int i2 = this.g;
        Object[] objArr = this.c;
        int i3 = this.k;
        ArrayList arrayList = this.d;
        HashMap map = this.e;
        IQ iq = this.f;
        C1077e90 c1077e90 = this.a;
        if (!c1077e90.r) {
            AbstractC1102eY.a("Unexpected writer close()");
        }
        c1077e90.r = false;
        c1077e90.l = iArr;
        c1077e90.m = i2;
        c1077e90.n = objArr;
        c1077e90.f504o = i3;
        c1077e90.t = arrayList;
        c1077e90.u = map;
        c1077e90.v = iq;
    }

    public final int f(int i) {
        return g(this.b, q(i));
    }

    public final int g(int[] iArr, int i) {
        if (i >= n()) {
            return this.c.length - this.l;
        }
        int i2 = iArr[(i * 5) + 4];
        return i2 < 0 ? (this.c.length - this.l) + i2 + 1 : i2;
    }

    public final int h(int i) {
        return (this.l * (i < this.k ? 0 : 1)) + i;
    }

    public final void j() {
        UQ uq;
        boolean z = this.n > 0;
        int i = this.t;
        int i2 = this.u;
        int i3 = this.v;
        int iQ = q(i3);
        int i4 = this.f555o;
        int i5 = i - i3;
        int i6 = iQ * 5;
        int i7 = i6 + 1;
        boolean z2 = (this.b[i7] & 1073741824) != 0;
        C1564jI c1564jI = this.r;
        if (z) {
            IQ iq = this.s;
            if (iq != null && (uq = (UQ) iq.b(i3)) != null) {
                Object[] objArr = uq.a;
                int i8 = uq.b;
                for (int i9 = 0; i9 < i8; i9++) {
                    D(objArr[i9]);
                }
            }
            int[] iArr = this.b;
            iArr[i6 + 3] = i5;
            AbstractC1269g90.d(iQ, i4, iArr);
            int iB = c1564jI.b();
            if (z2) {
                i4 = 1;
            }
            this.f555o = iB + i4;
            int iC = C(this.b, i3);
            this.v = iC;
            int iO = iC < 0 ? o() : q(iC + 1);
            int iG = iO >= 0 ? g(this.b, iO) : 0;
            this.i = iG;
            this.j = iG;
            return;
        }
        if (i != i2) {
            AbstractC0373Ok.c("Expected to be at the end of a group");
        }
        int[] iArr2 = this.b;
        int i10 = i6 + 3;
        int i11 = iArr2[i10];
        int i12 = iArr2[i7] & 67108863;
        iArr2[i10] = i5;
        AbstractC1269g90.d(iQ, i4, iArr2);
        int iB2 = this.p.b();
        this.u = (n() - this.h) - this.q.b();
        this.v = iB2;
        int iC2 = C(this.b, i3);
        int iB3 = c1564jI.b();
        this.f555o = iB3;
        if (iC2 == iB2) {
            this.f555o = iB3 + (z2 ? 0 : i4 - i12);
            return;
        }
        int i13 = i5 - i11;
        int i14 = z2 ? 0 : i4 - i12;
        if (i13 != 0 || i14 != 0) {
            while (iC2 != 0 && iC2 != iB2 && (i14 != 0 || i13 != 0)) {
                int iQ2 = q(iC2);
                if (i13 != 0) {
                    int[] iArr3 = this.b;
                    int i15 = (iQ2 * 5) + 3;
                    iArr3[i15] = iArr3[i15] + i13;
                }
                if (i14 != 0) {
                    int[] iArr4 = this.b;
                    AbstractC1269g90.d(iQ2, (iArr4[(iQ2 * 5) + 1] & 67108863) + i14, iArr4);
                }
                int[] iArr5 = this.b;
                if ((iArr5[(iQ2 * 5) + 1] & 1073741824) != 0) {
                    i14 = 0;
                }
                iC2 = C(iArr5, iC2);
            }
        }
        this.f555o += i14;
    }

    public final void k() {
        if (this.n <= 0) {
            AbstractC1102eY.b("Unbalanced begin/end insert");
        }
        int i = this.n - 1;
        this.n = i;
        if (i == 0) {
            if (this.r.b != this.p.b) {
                AbstractC0373Ok.c("startGroup/endGroup mismatch while inserting");
            }
            this.u = (n() - this.h) - this.q.b();
        }
    }

    public final void l(int i) {
        boolean z = false;
        if (!(this.n <= 0)) {
            AbstractC0373Ok.c("Cannot call ensureStarted() while inserting");
        }
        int i2 = this.v;
        if (i2 != i) {
            if (i >= i2 && i < this.u) {
                z = true;
            }
            if (!z) {
                AbstractC0373Ok.c("Started group at " + i + " must be a subgroup of the group at " + i2);
            }
            int i3 = this.t;
            int i4 = this.i;
            int i5 = this.j;
            this.t = i;
            N();
            this.t = i3;
            this.i = i4;
            this.j = i5;
        }
    }

    public final void m(int i, int i2, int i3) {
        if (i >= this.g) {
            i = -((o() - i) + 2);
        }
        while (i3 < i2) {
            this.b[(q(i3) * 5) + 2] = i;
            int i4 = this.b[(q(i3) * 5) + 3] + i3;
            m(i3, i4, i3 + 1);
            i3 = i4;
        }
    }

    public final int n() {
        return this.b.length / 5;
    }

    public final int o() {
        return n() - this.h;
    }

    public final Object p(int i) {
        int iQ = q(i);
        int[] iArr = this.b;
        int i2 = (iQ * 5) + 1;
        if ((iArr[i2] & 268435456) == 0) {
            return C0140Fk.a;
        }
        return this.c[Integer.bitCount(iArr[i2] >> 29) + g(iArr, iQ)];
    }

    public final int q(int i) {
        return (this.h * (i < this.g ? 0 : 1)) + i;
    }

    public final Object r(int i) {
        int iQ = q(i);
        int[] iArr = this.b;
        int i2 = iQ * 5;
        int i3 = iArr[i2 + 1];
        if ((536870912 & i3) == 0) {
            return null;
        }
        return this.c[Integer.bitCount(i3 >> 30) + iArr[i2 + 4]];
    }

    public final int s(int i) {
        return AbstractC1269g90.a(this.b, q(i));
    }

    public final boolean t(int i, int i2) {
        int iN;
        int iS;
        if (i2 == this.v) {
            iN = this.u;
        } else {
            C1564jI c1564jI = this.p;
            if (i2 > c1564jI.a(0)) {
                iS = s(i2);
            } else {
                int[] iArr = c1564jI.a;
                int iMin = Math.min(iArr.length, c1564jI.b);
                int i3 = 0;
                while (true) {
                    if (i3 >= iMin) {
                        i3 = -1;
                        break;
                    }
                    if (iArr[i3] == i2) {
                        break;
                    }
                    i3++;
                }
                if (i3 < 0) {
                    iS = s(i2);
                } else {
                    iN = (n() - this.h) - this.q.a[i3];
                }
            }
            iN = iS + i2;
        }
        return i > i2 && i < iN;
    }

    public final String toString() {
        return "SlotWriter(current = " + this.t + " end=" + this.u + " size = " + o() + " gap=" + this.g + '-' + (this.g + this.h) + ')';
    }

    public final void u(int i) {
        if (i > 0) {
            int i2 = this.t;
            z(i2);
            int i3 = this.g;
            int i4 = this.h;
            int[] iArr = this.b;
            int length = iArr.length / 5;
            int i5 = length - i4;
            if (i4 < i) {
                int iMax = Math.max(Math.max(length * 2, i5 + i), 32);
                int[] iArr2 = new int[iMax * 5];
                int i6 = iMax - i5;
                AbstractC2219q9.I(0, 0, i3 * 5, iArr, iArr2);
                AbstractC2219q9.I((i3 + i6) * 5, (i4 + i3) * 5, length * 5, iArr, iArr2);
                this.b = iArr2;
                i4 = i6;
            }
            int i7 = this.u;
            if (i7 >= i3) {
                this.u = i7 + i;
            }
            int i8 = i3 + i;
            this.g = i8;
            this.h = i4 - i;
            int i9 = i(i5 > 0 ? f(i2 + i) : 0, this.m >= i3 ? this.k : 0, this.l, this.c.length);
            for (int i10 = i3; i10 < i8; i10++) {
                this.b[(i10 * 5) + 4] = i9;
            }
            int i11 = this.m;
            if (i11 >= i3) {
                this.m = i11 + i;
            }
        }
    }

    public final void v(int i, int i2) {
        if (i > 0) {
            A(this.i, i2);
            int i3 = this.k;
            int i4 = this.l;
            if (i4 < i) {
                Object[] objArr = this.c;
                int length = objArr.length;
                int i5 = length - i4;
                int iMax = Math.max(Math.max(length * 2, i5 + i), 32);
                Object[] objArr2 = new Object[iMax];
                for (int i6 = 0; i6 < iMax; i6++) {
                    objArr2[i6] = null;
                }
                int i7 = iMax - i5;
                int i8 = i4 + i3;
                System.arraycopy(objArr, 0, objArr2, 0, i3);
                System.arraycopy(objArr, i8, objArr2, i3 + i7, length - i8);
                this.c = objArr2;
                i4 = i7;
            }
            int i9 = this.j;
            if (i9 >= i3) {
                this.j = i9 + i;
            }
            this.k = i3 + i;
            this.l = i4 - i;
        }
    }

    public final boolean w(int i) {
        return (this.b[(q(i) * 5) + 1] & 1073741824) != 0;
    }

    public final void y(C1077e90 c1077e90, int i) {
        if (this.n <= 0) {
            AbstractC0373Ok.c("Check failed");
        }
        if (i == 0 && this.t == 0 && this.a.m == 0) {
            int[] iArr = c1077e90.l;
            int i2 = iArr[(i * 5) + 3];
            int i3 = c1077e90.m;
            if (i2 == i3) {
                int[] iArr2 = this.b;
                Object[] objArr = this.c;
                ArrayList arrayList = this.d;
                HashMap map = this.e;
                IQ iq = this.f;
                Object[] objArr2 = c1077e90.n;
                int i4 = c1077e90.f504o;
                HashMap map2 = c1077e90.u;
                IQ iq2 = c1077e90.v;
                this.b = iArr;
                this.c = objArr2;
                this.d = c1077e90.t;
                this.g = i3;
                this.h = (iArr.length / 5) - i3;
                this.k = i4;
                this.l = objArr2.length - i4;
                this.m = i3;
                this.e = map2;
                this.f = iq2;
                c1077e90.l = iArr2;
                c1077e90.m = 0;
                c1077e90.n = objArr;
                c1077e90.f504o = 0;
                c1077e90.t = arrayList;
                c1077e90.u = map;
                c1077e90.v = iq;
                return;
            }
        }
        C1365h90 c1365h90D = c1077e90.d();
        try {
            F3.E(c1365h90D, i, this, true, true, false);
            c1365h90D.e(true);
        } catch (Throwable th) {
            c1365h90D.e(false);
            throw th;
        }
    }

    public final void z(int i) {
        G2 g2;
        int i2;
        G2 g22;
        int i3;
        int i4;
        int i5 = this.h;
        int i6 = this.g;
        if (i6 != i) {
            if (!this.d.isEmpty()) {
                int iN = n() - this.h;
                if (i6 < i) {
                    for (int iB = AbstractC1269g90.b(this.d, i6, iN); iB < this.d.size() && (i3 = (g22 = (G2) this.d.get(iB)).a) < 0 && (i4 = i3 + iN) < i; iB++) {
                        g22.a = i4;
                    }
                } else {
                    for (int iB2 = AbstractC1269g90.b(this.d, i, iN); iB2 < this.d.size() && (i2 = (g2 = (G2) this.d.get(iB2)).a) >= 0; iB2++) {
                        g2.a = -(iN - i2);
                    }
                }
            }
            if (i5 > 0) {
                int[] iArr = this.b;
                int i7 = i * 5;
                int i8 = i5 * 5;
                int i9 = i6 * 5;
                if (i < i6) {
                    AbstractC2219q9.I(i8 + i7, i7, i9, iArr, iArr);
                } else {
                    AbstractC2219q9.I(i9, i9 + i8, i7 + i8, iArr, iArr);
                }
            }
            if (i < i6) {
                i6 = i + i5;
            }
            int iN2 = n();
            if (i6 >= iN2) {
                AbstractC0373Ok.c("Check failed");
            }
            while (i6 < iN2) {
                int i10 = (i6 * 5) + 2;
                int i11 = this.b[i10];
                int iO = i11 > -2 ? i11 : (o() + i11) - (-2);
                if (iO >= i) {
                    iO = -((o() - iO) - (-2));
                }
                if (iO != i11) {
                    this.b[i10] = iO;
                }
                i6++;
                if (i6 == i) {
                    i6 += i5;
                }
            }
        }
        this.g = i;
    }
}
