package p037.p091.p095;

import p037.p057.C1718;
import p037.p057.C1719;
import p037.p091.p095.AbstractC2124;
import p037.p091.p095.C2127;

/* JADX INFO: renamed from: މ.މ.ލ.ޞ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC2183 extends AbstractC2124 {

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public C1718<C2184> f7092 = new C1718<>(64);

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public int f7093 = -1;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public Object f7094;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public int f7095;

    /* JADX INFO: renamed from: މ.މ.ލ.ޞ$֏, reason: contains not printable characters */
    public static class C2184 extends AbstractC2124.C2125 {

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int f7096;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public int f7097;

        public C2184(int i, int i2, int i3) {
            super(i);
            this.f7096 = i2;
            this.f7097 = i3;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final int m4239(int i, int i2, int i3) {
        int iM4160;
        boolean z;
        int i4 = this.f6893;
        if (i4 >= 0 && (i4 != m4241() || this.f6893 != i - 1)) {
            throw new IllegalStateException();
        }
        int i5 = this.f6893;
        if (i5 >= 0) {
            iM4160 = i3 - ((C2127.C2129) this.f6888).m4160(i5);
        } else if (this.f7092.m3350() <= 0 || i != m4241() + 1) {
            iM4160 = 0;
        } else {
            int iM4241 = m4241();
            while (true) {
                if (iM4241 < this.f7093) {
                    z = false;
                    break;
                }
                if (mo4101(iM4241).f6896 == i2) {
                    z = true;
                    break;
                }
                iM4241--;
            }
            if (!z) {
                iM4241 = m4241();
            }
            iM4160 = this.f6889 ? (-mo4101(iM4241).f7097) - this.f6890 : mo4101(iM4241).f7097 + this.f6890;
            for (int i6 = iM4241 + 1; i6 <= m4241(); i6++) {
                iM4160 -= mo4101(i6).f7096;
            }
        }
        C2184 c2184 = new C2184(i2, iM4160, 0);
        C1718<C2184> c1718 = this.f7092;
        C2184[] c2184Arr = c1718.f5576;
        int i7 = c1718.f5578;
        c2184Arr[i7] = c2184;
        int i8 = c1718.f5579 & (i7 + 1);
        c1718.f5578 = i8;
        if (i8 == c1718.f5577) {
            c1718.m3348();
        }
        Object obj = this.f7094;
        if (obj != null) {
            c2184.f7097 = this.f7095;
            this.f7094 = null;
        } else {
            c2184.f7097 = ((C2127.C2129) this.f6888).m4161(i, true, this.f6887, false);
            obj = this.f6887[0];
        }
        Object obj2 = obj;
        if (this.f7092.m3350() == 1) {
            this.f6893 = i;
            this.f6892 = i;
            this.f7093 = i;
        } else {
            int i9 = this.f6893;
            if (i9 < 0) {
                this.f6893 = i;
                this.f6892 = i;
            } else {
                this.f6893 = i9 + 1;
            }
        }
        ((C2127.C2129) this.f6888).m4162(obj2, i, c2184.f7097, i2, i3);
        return c2184.f7097;
    }

    @Override // p037.p091.p095.AbstractC2124
    /* JADX INFO: renamed from: ֏ */
    public final boolean mo4094(int i, boolean z) {
        boolean zMo4243;
        if (((C2127.C2129) this.f6888).m4159() == 0) {
            return false;
        }
        if (!z && m4093(i)) {
            return false;
        }
        try {
            if (m4242(i, z)) {
                zMo4243 = true;
                this.f6887[0] = null;
            } else {
                zMo4243 = mo4243(i, z);
                this.f6887[0] = null;
            }
            this.f7094 = null;
            return zMo4243;
        } catch (Throwable th) {
            this.f6887[0] = null;
            this.f7094 = null;
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x004d  */
    @Override // p037.p091.p095.AbstractC2124
    /* JADX INFO: renamed from: ֏ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final C1719[] mo4095(int i, int i2) {
        for (int i3 = 0; i3 < this.f6891; i3++) {
            C1719 c1719 = this.f6894[i3];
            c1719.f5582 = c1719.f5581;
        }
        if (i >= 0) {
            while (i <= i2) {
                C1719 c17192 = this.f6894[mo4101(i).f6896];
                if (c17192.m3352() <= 0) {
                    c17192.m3353(i);
                    c17192.m3353(i);
                } else {
                    int i4 = c17192.f5581;
                    int i5 = c17192.f5582;
                    if (i4 == i5) {
                        throw new ArrayIndexOutOfBoundsException();
                    }
                    int[] iArr = c17192.f5580;
                    int i6 = (i5 - 1) & c17192.f5583;
                    if (iArr[i6] == i - 1) {
                        if (i4 == i5) {
                            throw new ArrayIndexOutOfBoundsException();
                        }
                        int i7 = iArr[i6];
                        c17192.f5582 = i6;
                        c17192.m3353(i);
                    }
                }
                i++;
            }
        }
        return this.f6894;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final int m4240(int i, int i2, int i3) {
        int i4 = this.f6892;
        if (i4 >= 0 && (i4 != this.f7093 || i4 != i + 1)) {
            throw new IllegalStateException();
        }
        int i5 = this.f7093;
        C2184 c2184Mo4101 = i5 >= 0 ? mo4101(i5) : null;
        int iM4160 = ((C2127.C2129) this.f6888).m4160(this.f7093);
        C2184 c2184 = new C2184(i2, 0, 0);
        C1718<C2184> c1718 = this.f7092;
        int i6 = (c1718.f5577 - 1) & c1718.f5579;
        c1718.f5577 = i6;
        c1718.f5576[i6] = c2184;
        if (i6 == c1718.f5578) {
            c1718.m3348();
        }
        Object obj = this.f7094;
        if (obj != null) {
            c2184.f7097 = this.f7095;
            this.f7094 = null;
        } else {
            c2184.f7097 = ((C2127.C2129) this.f6888).m4161(i, false, this.f6887, false);
            obj = this.f6887[0];
        }
        Object obj2 = obj;
        this.f6892 = i;
        this.f7093 = i;
        if (this.f6893 < 0) {
            this.f6893 = i;
        }
        int i7 = !this.f6889 ? i3 - c2184.f7097 : i3 + c2184.f7097;
        if (c2184Mo4101 != null) {
            c2184Mo4101.f7096 = iM4160 - i7;
        }
        ((C2127.C2129) this.f6888).m4162(obj2, i, c2184.f7097, i2, i7);
        return c2184.f7097;
    }

    @Override // p037.p091.p095.AbstractC2124
    /* JADX INFO: renamed from: ؠ */
    public final boolean mo4100(int i, boolean z) {
        boolean zMo4245;
        if (((C2127.C2129) this.f6888).m4159() == 0) {
            return false;
        }
        if (!z && m4099(i)) {
            return false;
        }
        try {
            if (m4244(i, z)) {
                zMo4245 = true;
                this.f6887[0] = null;
            } else {
                zMo4245 = mo4245(i, z);
                this.f6887[0] = null;
            }
            this.f7094 = null;
            return zMo4245;
        } catch (Throwable th) {
            this.f6887[0] = null;
            this.f7094 = null;
            throw th;
        }
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final int m4241() {
        return (this.f7092.m3350() + this.f7093) - 1;
    }

    @Override // p037.p091.p095.AbstractC2124
    /* JADX INFO: renamed from: ހ */
    public final C2184 mo4101(int i) {
        int i2 = i - this.f7093;
        if (i2 < 0 || i2 >= this.f7092.m3350()) {
            return null;
        }
        C1718<C2184> c1718 = this.f7092;
        if (c1718 == null) {
            throw null;
        }
        if (i2 < 0 || i2 >= c1718.m3350()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        return c1718.f5576[c1718.f5579 & (c1718.f5577 + i2)];
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final boolean m4242(int i, boolean z) {
        int i2;
        int iM4160;
        int i3;
        if (this.f7092.m3350() == 0) {
            return false;
        }
        int iM4159 = ((C2127.C2129) this.f6888).m4159();
        int i4 = this.f6893;
        if (i4 >= 0) {
            i2 = i4 + 1;
            iM4160 = ((C2127.C2129) this.f6888).m4160(i4);
        } else {
            int i5 = this.f6895;
            i2 = i5 != -1 ? i5 : 0;
            if (i2 > m4241() + 1 || i2 < this.f7093) {
                C1718<C2184> c1718 = this.f7092;
                c1718.m3351(c1718.m3350());
                return false;
            }
            if (i2 > m4241()) {
                return false;
            }
            iM4160 = Integer.MAX_VALUE;
        }
        int iM4241 = m4241();
        int i6 = i2;
        while (i6 < iM4159 && i6 <= iM4241) {
            C2184 c2184Mo4101 = mo4101(i6);
            if (iM4160 != Integer.MAX_VALUE) {
                iM4160 += c2184Mo4101.f7096;
            }
            int i7 = c2184Mo4101.f6896;
            int iM4161 = ((C2127.C2129) this.f6888).m4161(i6, true, this.f6887, false);
            if (iM4161 != c2184Mo4101.f7097) {
                c2184Mo4101.f7097 = iM4161;
                this.f7092.m3349(iM4241 - i6);
                i3 = i6;
            } else {
                i3 = iM4241;
            }
            this.f6893 = i6;
            if (this.f6892 < 0) {
                this.f6892 = i6;
            }
            ((C2127.C2129) this.f6888).m4162(this.f6887[0], i6, iM4161, i7, iM4160);
            if (!z && m4093(i)) {
                return true;
            }
            if (iM4160 == Integer.MAX_VALUE) {
                iM4160 = ((C2127.C2129) this.f6888).m4160(i6);
            }
            if (i7 == this.f6891 - 1 && z) {
                return true;
            }
            i6++;
            iM4241 = i3;
        }
        return false;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public abstract boolean mo4243(int i, boolean z);

    @Override // p037.p091.p095.AbstractC2124
    /* JADX INFO: renamed from: ނ */
    public void mo4103(int i) {
        super.mo4103(i);
        this.f7092.m3349((m4241() - i) + 1);
        if (this.f7092.m3350() == 0) {
            this.f7093 = -1;
        }
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final boolean m4244(int i, boolean z) {
        int iM4160;
        int i2;
        int i3;
        if (this.f7092.m3350() == 0) {
            return false;
        }
        int i4 = this.f6892;
        if (i4 < 0) {
            iM4160 = Integer.MAX_VALUE;
            int i5 = this.f6895;
            i2 = i5 != -1 ? i5 : 0;
            if (i2 <= m4241()) {
                int i6 = this.f7093;
                if (i2 >= i6 - 1) {
                    if (i2 < i6) {
                        return false;
                    }
                    i3 = 0;
                }
            }
            C1718<C2184> c1718 = this.f7092;
            c1718.m3351(c1718.m3350());
            return false;
        }
        iM4160 = ((C2127.C2129) this.f6888).m4160(i4);
        i3 = mo4101(this.f6892).f7096;
        i2 = this.f6892 - 1;
        int iMax = Math.max(C2127.this.f6905, this.f7093);
        while (i2 >= iMax) {
            C2184 c2184Mo4101 = mo4101(i2);
            int i7 = c2184Mo4101.f6896;
            int iM4161 = ((C2127.C2129) this.f6888).m4161(i2, false, this.f6887, false);
            if (iM4161 != c2184Mo4101.f7097) {
                this.f7092.m3351((i2 + 1) - this.f7093);
                this.f7093 = this.f6892;
                this.f7094 = this.f6887[0];
                this.f7095 = iM4161;
                return false;
            }
            this.f6892 = i2;
            if (this.f6893 < 0) {
                this.f6893 = i2;
            }
            ((C2127.C2129) this.f6888).m4162(this.f6887[0], i2, iM4161, i7, iM4160 - i3);
            if (!z && m4099(i)) {
                return true;
            }
            iM4160 = ((C2127.C2129) this.f6888).m4160(i2);
            i3 = c2184Mo4101.f7096;
            if (i7 == 0 && z) {
                return true;
            }
            i2--;
        }
        return false;
    }

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public abstract boolean mo4245(int i, boolean z);
}
