package F;

import i0.InterfaceC2255s;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import x4.AbstractC3251q;
import x4.AbstractC3256v;

/* JADX INFO: renamed from: F.v, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0167v {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final n.N f1339a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public f0 f1340b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final n.O f1341c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final ArrayList f1342d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final ArrayList f1343e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final ArrayList f1344f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final ArrayList f1345g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final ArrayList f1346h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final InterfaceC2255s f1347i;

    public C0167v() {
        long[] jArr = n.Y.f21386a;
        this.f1339a = new n.N();
        n.O o6 = n.a0.f21397a;
        this.f1341c = new n.O();
        this.f1342d = new ArrayList();
        this.f1343e = new ArrayList();
        this.f1344f = new ArrayList();
        this.f1345g = new ArrayList();
        this.f1346h = new ArrayList();
        this.f1347i = new C0164s(this);
    }

    public static int e(int[] iArr, H h5) {
        int i6 = h5.i();
        int iC = h5.c() + i6;
        int iMax = 0;
        while (i6 < iC) {
            int iB = h5.b() + iArr[i6];
            iArr[i6] = iB;
            iMax = Math.max(iMax, iB);
            i6++;
        }
        return iMax;
    }

    public final void a(int i6, Object obj) {
        A0.a.v(this.f1339a.d(obj));
    }

    public final long b() {
        ArrayList arrayList = this.f1346h;
        if (arrayList.size() <= 0) {
            return 0L;
        }
        A0.a.v(arrayList.get(0));
        throw null;
    }

    /* JADX WARN: Removed duplicated region for block: B:30:0x008b  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void c(int i6, int i7, ArrayList arrayList, f0 f0Var, I i8, boolean z6, int i9, boolean z7, int i10, int i11) throws Throwable {
        Throwable th;
        f0 f0Var2 = this.f1340b;
        this.f1340b = f0Var;
        int size = arrayList.size();
        for (int i12 = 0; i12 < size; i12++) {
            H h5 = (H) arrayList.get(i12);
            int iA = h5.a();
            for (int i13 = 0; i13 < iA; i13++) {
                h5.d(i13);
            }
        }
        n.N n6 = this.f1339a;
        if (n6.e()) {
            d();
            return;
        }
        boolean z8 = z6 || !z7;
        Object[] objArr = n6.f21382b;
        long[] jArr = n6.f21381a;
        int length = jArr.length - 2;
        n.O o6 = this.f1341c;
        if (length >= 0) {
            int i14 = 0;
            while (true) {
                long j4 = jArr[i14];
                int i15 = i14;
                if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i16 = 8 - ((~(i15 - length)) >>> 31);
                    long j6 = j4;
                    for (int i17 = 0; i17 < i16; i17++) {
                        if ((j6 & 255) < 128) {
                            o6.d(objArr[(i15 << 3) + i17]);
                        }
                        j6 >>= 8;
                    }
                    if (i16 != 8) {
                        break;
                    } else if (i15 == length) {
                        break;
                    } else {
                        i14 = i15 + 1;
                    }
                }
            }
        }
        int size2 = arrayList.size();
        for (int i18 = 0; i18 < size2; i18++) {
            H h6 = (H) arrayList.get(i18);
            o6.l(h6.getKey());
            int iA2 = h6.a();
            for (int i19 = 0; i19 < iA2; i19++) {
                h6.d(i19);
            }
            A0.a.v(this.f1339a.j(h6.getKey()));
        }
        int[] iArr = new int[i9];
        ArrayList arrayList2 = this.f1343e;
        ArrayList arrayList3 = this.f1342d;
        if (z8 && f0Var2 != null) {
            if (!arrayList3.isEmpty()) {
                if (arrayList3.size() > 1) {
                    AbstractC3256v.J(arrayList3, new C0166u(f0Var2, 2));
                }
                if (arrayList3.size() > 0) {
                    H h7 = (H) arrayList3.get(0);
                    e(iArr, h7);
                    Object objD = n6.d(h7.getKey());
                    kotlin.jvm.internal.o.e(objD);
                    A0.a.v(objD);
                    h7.h(0);
                    throw null;
                }
                Arrays.fill(iArr, 0, i9, 0);
            }
            if (!arrayList2.isEmpty()) {
                if (arrayList2.size() > 1) {
                    AbstractC3256v.J(arrayList2, new C0166u(f0Var2, 0));
                }
                if (arrayList2.size() > 0) {
                    H h8 = (H) arrayList2.get(0);
                    e(iArr, h8);
                    Object objD2 = n6.d(h8.getKey());
                    kotlin.jvm.internal.o.e(objD2);
                    A0.a.v(objD2);
                    h8.h(0);
                    throw null;
                }
                Arrays.fill(iArr, 0, i9, 0);
            }
        }
        Object[] objArr2 = o6.f21389b;
        long[] jArr2 = o6.f21388a;
        int length2 = jArr2.length - 2;
        ArrayList arrayList4 = this.f1345g;
        ArrayList arrayList5 = this.f1344f;
        if (length2 >= 0) {
            th = null;
            int i20 = 0;
            while (true) {
                long j7 = jArr2[i20];
                if ((((~j7) << 7) & j7 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i21 = 8 - ((~(i20 - length2)) >>> 31);
                    for (int i22 = 0; i22 < i21; i22++) {
                        if ((j7 & 255) < 128) {
                            A0.a.v(n6.d(objArr2[(i20 << 3) + i22]));
                        }
                        j7 >>= 8;
                    }
                    if (i21 != 8) {
                        break;
                    }
                }
                if (i20 == length2) {
                    break;
                } else {
                    i20++;
                }
            }
        } else {
            th = null;
        }
        if (!arrayList5.isEmpty()) {
            if (arrayList5.size() > 1) {
                AbstractC3256v.J(arrayList5, new C0166u(f0Var, 3));
            }
            if (arrayList5.size() > 0) {
                H h9 = (H) arrayList5.get(0);
                Object objD3 = n6.d(h9.getKey());
                kotlin.jvm.internal.o.e(objD3);
                A0.a.v(objD3);
                e(iArr, h9);
                if (!z6) {
                    throw th;
                }
                ((H) AbstractC3251q.e0(arrayList)).h(0);
                throw th;
            }
            Arrays.fill(iArr, 0, i9, 0);
        }
        if (!arrayList4.isEmpty()) {
            if (arrayList4.size() > 1) {
                AbstractC3256v.J(arrayList4, new C0166u(f0Var, 1));
            }
            if (arrayList4.size() > 0) {
                H h10 = (H) arrayList4.get(0);
                Object objD4 = n6.d(h10.getKey());
                kotlin.jvm.internal.o.e(objD4);
                A0.a.v(objD4);
                e(iArr, h10);
                throw th;
            }
        }
        Collections.reverse(arrayList5);
        arrayList.addAll(0, arrayList5);
        arrayList.addAll(arrayList4);
        arrayList3.clear();
        arrayList2.clear();
        arrayList5.clear();
        arrayList4.clear();
        o6.e();
    }

    /* JADX WARN: Removed duplicated region for block: B:17:0x0046  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void d() {
        n.N n6 = this.f1339a;
        if (n6.f21385e != 0) {
            Object[] objArr = n6.f21383c;
            long[] jArr = n6.f21381a;
            int length = jArr.length - 2;
            if (length >= 0) {
                int i6 = 0;
                while (true) {
                    long j4 = jArr[i6];
                    if ((((~j4) << 7) & j4 & (-9187201950435737472L)) != -9187201950435737472L) {
                        int i7 = 8 - ((~(i6 - length)) >>> 31);
                        for (int i8 = 0; i8 < i7; i8++) {
                            if ((255 & j4) < 128) {
                                A0.a.v(objArr[(i6 << 3) + i8]);
                                throw null;
                            }
                            j4 >>= 8;
                        }
                        if (i7 != 8) {
                            break;
                        } else if (i6 == length) {
                            break;
                        } else {
                            i6++;
                        }
                    }
                }
            }
            n6.f();
        }
    }
}
