package o;

import java.util.ArrayList;
import java.util.HashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.eR, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public class C1095eR extends AbstractC2220q90 {
    public static final int[] n = new int[0];
    public final OC e;
    public final OC f;
    public int g;
    public C0713aR h;
    public ArrayList i;
    public C2599u90 j;
    public int[] k;
    public int l;
    public boolean m;

    public C1095eR(long j, C2599u90 c2599u90, OC oc, OC oc2) {
        super(j, c2599u90);
        this.e = oc;
        this.f = oc2;
        this.j = C2599u90.p;
        this.k = n;
        this.l = 1;
    }

    public final void A(long j) {
        synchronized (AbstractC2884x90.c) {
            this.j = this.j.e(j);
        }
    }

    public void B(C0713aR c0713aR) {
        this.h = c0713aR;
    }

    public C1095eR C(OC oc, OC oc2) throws Throwable {
        if (this.c) {
            AbstractC1102eY.a("Cannot use a disposed snapshot");
        }
        if (this.m && this.d < 0) {
            AbstractC1102eY.b("Unsupported operation on a disposed or applied snapshot");
        }
        A(g());
        Object obj = AbstractC2884x90.c;
        synchronized (obj) {
            try {
                long j = AbstractC2884x90.e;
                long j2 = 1;
                AbstractC2884x90.e = j + j2;
                AbstractC2884x90.d = AbstractC2884x90.d.e(j);
                C2599u90 c2599u90D = d();
                r(c2599u90D.e(j));
                try {
                    ER er = new ER(j, AbstractC2884x90.e(c2599u90D, g() + j2, j), AbstractC2884x90.l(oc, e(), true), AbstractC2884x90.b(oc2, i()), this);
                    if (this.m || this.c) {
                        return er;
                    }
                    long jG = g();
                    synchronized (obj) {
                        long j3 = AbstractC2884x90.e;
                        AbstractC2884x90.e = j3 + j2;
                        s(j3);
                        AbstractC2884x90.d = AbstractC2884x90.d.e(g());
                    }
                    r(AbstractC2884x90.e(d(), jG + j2, g()));
                    return er;
                } catch (Throwable th) {
                    th = th;
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        }
    }

    @Override // o.AbstractC2220q90
    public final void b() {
        AbstractC2884x90.d = AbstractC2884x90.d.b(g()).a(this.j);
    }

    @Override // o.AbstractC2220q90
    public void c() {
        if (this.c) {
            return;
        }
        this.c = true;
        synchronized (AbstractC2884x90.c) {
            o();
        }
        l();
    }

    @Override // o.AbstractC2220q90
    public boolean f() {
        return false;
    }

    @Override // o.AbstractC2220q90
    public int h() {
        return this.g;
    }

    @Override // o.AbstractC2220q90
    public OC i() {
        return this.f;
    }

    @Override // o.AbstractC2220q90
    public void k() {
        this.l++;
    }

    /* JADX WARN: Removed duplicated region for block: B:34:0x008c  */
    @Override // o.AbstractC2220q90
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void l() {
        /*
            r17 = this;
            r0 = r17
            int r1 = r0.l
            if (r1 <= 0) goto L7
            goto Lc
        L7:
            java.lang.String r1 = "no pending nested snapshots"
            o.AbstractC1102eY.a(r1)
        Lc:
            int r1 = r0.l
            int r1 = r1 + (-1)
            r0.l = r1
            if (r1 != 0) goto L94
            boolean r1 = r0.m
            if (r1 != 0) goto L94
            o.aR r1 = r0.x()
            if (r1 == 0) goto L91
            boolean r2 = r0.m
            if (r2 == 0) goto L27
            java.lang.String r2 = "Unsupported operation on a snapshot that has been applied"
            o.AbstractC1102eY.b(r2)
        L27:
            r2 = 0
            r0.B(r2)
            long r2 = r0.g()
            java.lang.Object[] r4 = r1.b
            long[] r1 = r1.a
            int r5 = r1.length
            int r5 = r5 + (-2)
            if (r5 < 0) goto L91
            r7 = 0
        L39:
            r8 = r1[r7]
            long r10 = ~r8
            r12 = 7
            long r10 = r10 << r12
            long r10 = r10 & r8
            r12 = -9187201950435737472(0x8080808080808080, double:-2.937446524422997E-306)
            long r10 = r10 & r12
            int r10 = (r10 > r12 ? 1 : (r10 == r12 ? 0 : -1))
            if (r10 == 0) goto L8c
            int r10 = r7 - r5
            int r10 = ~r10
            int r10 = r10 >>> 31
            r11 = 8
            int r10 = 8 - r10
            r12 = 0
        L53:
            if (r12 >= r10) goto L8a
            r13 = 255(0xff, double:1.26E-321)
            long r13 = r13 & r8
            r15 = 128(0x80, double:6.3E-322)
            int r13 = (r13 > r15 ? 1 : (r13 == r15 ? 0 : -1))
            if (r13 >= 0) goto L86
            int r13 = r7 << 3
            int r13 = r13 + r12
            r13 = r4[r13]
            o.Ga0 r13 = (o.Ga0) r13
            o.Ia0 r13 = r13.a()
        L69:
            if (r13 == 0) goto L86
            long r14 = r13.a
            int r16 = (r14 > r2 ? 1 : (r14 == r2 ? 0 : -1))
            if (r16 == 0) goto L7d
            o.u90 r6 = r0.j
            java.lang.Long r14 = java.lang.Long.valueOf(r14)
            boolean r6 = o.AbstractC3117zi.b0(r6, r14)
            if (r6 == 0) goto L83
        L7d:
            o.v90 r6 = o.AbstractC2884x90.a
            r14 = 0
            r13.a = r14
        L83:
            o.Ia0 r13 = r13.b
            goto L69
        L86:
            long r8 = r8 >> r11
            int r12 = r12 + 1
            goto L53
        L8a:
            if (r10 != r11) goto L91
        L8c:
            if (r7 == r5) goto L91
            int r7 = r7 + 1
            goto L39
        L91:
            r0.a()
        L94:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C1095eR.l():void");
    }

    @Override // o.AbstractC2220q90
    public void m() {
        if (this.m || this.c) {
            return;
        }
        v();
    }

    @Override // o.AbstractC2220q90
    public void n(Ga0 ga0) {
        C0713aR c0713aRX = x();
        if (c0713aRX == null) {
            int i = A40.a;
            c0713aRX = new C0713aR();
            B(c0713aRX);
        }
        c0713aRX.a(ga0);
    }

    @Override // o.AbstractC2220q90
    public final void p() {
        int length = this.k.length;
        for (int i = 0; i < length; i++) {
            AbstractC2884x90.u(this.k[i]);
        }
        o();
    }

    @Override // o.AbstractC2220q90
    public void t(int i) {
        this.g = i;
    }

    @Override // o.AbstractC2220q90
    public AbstractC2220q90 u(OC oc) throws Throwable {
        if (this.c) {
            AbstractC1102eY.a("Cannot use a disposed snapshot");
        }
        if (this.m && this.d < 0) {
            AbstractC1102eY.b("Unsupported operation on a disposed or applied snapshot");
        }
        long jG = g();
        A(g());
        Object obj = AbstractC2884x90.c;
        synchronized (obj) {
            try {
                long j = AbstractC2884x90.e;
                long j2 = 1;
                AbstractC2884x90.e = j + j2;
                AbstractC2884x90.d = AbstractC2884x90.d.e(j);
                try {
                    FR fr = new FR(j, AbstractC2884x90.e(d(), jG + j2, j), AbstractC2884x90.l(oc, e(), true), this);
                    if (this.m || this.c) {
                        return fr;
                    }
                    long jG2 = g();
                    synchronized (obj) {
                        long j3 = AbstractC2884x90.e;
                        AbstractC2884x90.e = j3 + j2;
                        s(j3);
                        AbstractC2884x90.d = AbstractC2884x90.d.e(g());
                    }
                    r(AbstractC2884x90.e(d(), jG2 + j2, g()));
                    return fr;
                } catch (Throwable th) {
                    th = th;
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        }
    }

    public final void v() {
        long j;
        A(g());
        if (this.m || this.c) {
            return;
        }
        long jG = g();
        synchronized (AbstractC2884x90.c) {
            long j2 = AbstractC2884x90.e;
            j = 1;
            AbstractC2884x90.e = j2 + j;
            s(j2);
            AbstractC2884x90.d = AbstractC2884x90.d.e(g());
        }
        r(AbstractC2884x90.e(d(), jG + j, g()));
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:59:0x0106  */
    /* JADX WARN: Removed duplicated region for block: B:61:0x010b  */
    /* JADX WARN: Removed duplicated region for block: B:75:0x0145  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public o.AbstractC2539te w() {
        /*
            Method dump skipped, instructions count: 363
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C1095eR.w():o.te");
    }

    public C0713aR x() {
        return this.h;
    }

    @Override // o.AbstractC2220q90
    /* renamed from: y, reason: merged with bridge method [inline-methods] */
    public OC e() {
        return this.e;
    }

    public final AbstractC2539te z(long j, C0713aR c0713aR, HashMap map, C2599u90 c2599u90) {
        ArrayList arrayList;
        ArrayList arrayListL0;
        ArrayList arrayList2;
        C2599u90 c2599u902;
        Object[] objArr;
        long[] jArr;
        C2599u90 c2599u903;
        Object[] objArr2;
        long[] jArr2;
        int i;
        long j2;
        ArrayList arrayList3;
        Ia0 ia0B;
        C2599u90 c2599u90D = d().e(g()).d(this.j);
        Object[] objArr3 = c0713aR.b;
        long[] jArr3 = c0713aR.a;
        int length = jArr3.length - 2;
        if (length >= 0) {
            int i2 = 0;
            arrayList2 = null;
            arrayListL0 = null;
            while (true) {
                long j3 = jArr3[i2];
                if ((((~j3) << 7) & j3 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i3 = 8 - ((~(i2 - length)) >>> 31);
                    int i4 = 0;
                    while (i4 < i3) {
                        if ((j3 & 255) < 128) {
                            objArr2 = objArr3;
                            Ga0 ga0 = (Ga0) objArr3[(i2 << 3) + i4];
                            jArr2 = jArr3;
                            Ia0 ia0A = ga0.a();
                            i = i4;
                            ArrayList arrayList4 = arrayList2;
                            Ia0 ia0S = AbstractC2884x90.s(ia0A, j, c2599u90);
                            if (ia0S == null) {
                                c2599u903 = c2599u90D;
                                arrayList3 = arrayListL0;
                                j2 = j3;
                            } else {
                                arrayList3 = arrayListL0;
                                j2 = j3;
                                Ia0 ia0S2 = AbstractC2884x90.s(ia0A, g(), c2599u90D);
                                if (ia0S2 == null) {
                                    c2599u903 = c2599u90D;
                                } else {
                                    c2599u903 = c2599u90D;
                                    if (ia0S2.a != 1 && !ia0S.equals(ia0S2)) {
                                        Ia0 ia0S3 = AbstractC2884x90.s(ia0A, g(), d());
                                        if (ia0S3 == null) {
                                            AbstractC2884x90.r();
                                            throw null;
                                        }
                                        if (map == null || (ia0B = (Ia0) map.get(ia0S)) == null) {
                                            ia0B = ga0.b(ia0S2, ia0S, ia0S3);
                                        }
                                        if (ia0B == null) {
                                            return new C2314r90(this);
                                        }
                                        if (!ia0B.equals(ia0S3)) {
                                            if (ia0B.equals(ia0S)) {
                                                ArrayList arrayList5 = arrayList4 == null ? new ArrayList() : arrayList4;
                                                arrayList5.add(new C3001yV(ga0, ia0S.b(g())));
                                                arrayListL0 = arrayList3 == null ? new ArrayList() : arrayList3;
                                                arrayListL0.add(ga0);
                                                arrayList2 = arrayList5;
                                            } else {
                                                arrayList2 = arrayList4 == null ? new ArrayList() : arrayList4;
                                                arrayList2.add(!ia0B.equals(ia0S2) ? new C3001yV(ga0, ia0B) : new C3001yV(ga0, ia0S2.b(g())));
                                            }
                                        }
                                        arrayListL0 = arrayList3;
                                    }
                                }
                            }
                            arrayList2 = arrayList4;
                            arrayListL0 = arrayList3;
                        } else {
                            c2599u903 = c2599u90D;
                            objArr2 = objArr3;
                            jArr2 = jArr3;
                            i = i4;
                            j2 = j3;
                        }
                        j3 = j2 >> 8;
                        i4 = i + 1;
                        jArr3 = jArr2;
                        objArr3 = objArr2;
                        c2599u90D = c2599u903;
                    }
                    c2599u902 = c2599u90D;
                    objArr = objArr3;
                    jArr = jArr3;
                    if (i3 != 8) {
                        break;
                    }
                } else {
                    c2599u902 = c2599u90D;
                    objArr = objArr3;
                    jArr = jArr3;
                }
                if (i2 == length) {
                    arrayList = arrayList2;
                    break;
                }
                i2++;
                jArr3 = jArr;
                objArr3 = objArr;
                c2599u90D = c2599u902;
            }
        } else {
            arrayList = null;
            arrayListL0 = null;
        }
        arrayList2 = arrayList;
        if (arrayList2 != null) {
            v();
            int size = arrayList2.size();
            for (int i5 = 0; i5 < size; i5++) {
                C3001yV c3001yV = (C3001yV) arrayList2.get(i5);
                Ga0 ga02 = (Ga0) c3001yV.l;
                Ia0 ia0 = (Ia0) c3001yV.m;
                ia0.a = j;
                synchronized (AbstractC2884x90.c) {
                    ia0.b = ga02.a();
                    ga02.c(ia0);
                }
            }
        }
        if (arrayListL0 != null) {
            int size2 = arrayListL0.size();
            for (int i6 = 0; i6 < size2; i6++) {
                c0713aR.k((Ga0) arrayListL0.get(i6));
            }
            ArrayList arrayList6 = this.i;
            if (arrayList6 != null) {
                arrayListL0 = AbstractC3117zi.l0(arrayList6, arrayListL0);
            }
            this.i = arrayListL0;
        }
        return C2409s90.f;
    }
}
