package p138.p176.p177.p190.p239;

import p000.p001.p002.p003.p004.C0567;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ဢ.ޑ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4141 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public byte[] f13230;

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

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

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public int f13233 = 0;

    public C4141(byte[] bArr, int i, int i2) {
        this.f13230 = bArr;
        this.f13232 = i;
        this.f13231 = i2;
        m6710();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6710() {
        int i;
        int i2 = this.f13232;
        C0567.m1932(i2 >= 0 && (i2 < (i = this.f13231) || (i2 == i && this.f13233 == 0)));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean m6711(int i) {
        int i2 = this.f13232;
        int i3 = i / 8;
        int i4 = i2 + i3;
        int i5 = (this.f13233 + i) - (i3 * 8);
        if (i5 > 7) {
            i4++;
            i5 -= 8;
        }
        while (true) {
            i2++;
            if (i2 > i4 || i4 >= this.f13231) {
                break;
            }
            if (m6715(i2)) {
                i4++;
                i2 += 2;
            }
        }
        int i6 = this.f13231;
        if (i4 >= i6) {
            return i4 == i6 && i5 == 0;
        }
        return true;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int m6712(int i) {
        int i2;
        this.f13233 += i;
        int i3 = 0;
        while (true) {
            i2 = this.f13233;
            if (i2 <= 8) {
                break;
            }
            int i4 = i2 - 8;
            this.f13233 = i4;
            byte[] bArr = this.f13230;
            int i5 = this.f13232;
            i3 |= (bArr[i5] & 255) << i4;
            if (!m6715(i5 + 1)) {
                i = 1;
            }
            this.f13232 = i5 + i;
        }
        byte[] bArr2 = this.f13230;
        int i6 = this.f13232;
        int i7 = ((-1) >>> (32 - i)) & (i3 | ((bArr2[i6] & 255) >> (8 - i2)));
        if (i2 == 8) {
            this.f13233 = 0;
            this.f13232 = i6 + (m6715(i6 + 1) ? 2 : 1);
        }
        m6710();
        return i7;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public boolean m6713() {
        int i = this.f13232;
        int i2 = this.f13233;
        int i3 = 0;
        while (this.f13232 < this.f13231 && !m6714()) {
            i3++;
        }
        boolean z = this.f13232 == this.f13231;
        this.f13232 = i;
        this.f13233 = i2;
        return !z && m6711((i3 * 2) + 1);
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public boolean m6714() {
        boolean z = (this.f13230[this.f13232] & (128 >> this.f13233)) != 0;
        m6719();
        return z;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final boolean m6715(int i) {
        if (2 <= i && i < this.f13231) {
            byte[] bArr = this.f13230;
            if (bArr[i] == 3 && bArr[i - 2] == 0 && bArr[i - 1] == 0) {
                return true;
            }
        }
        return false;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final int m6716() {
        int i = 0;
        while (!m6714()) {
            i++;
        }
        return ((1 << i) - 1) + (i > 0 ? m6712(i) : 0);
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public void m6717(int i) {
        int i2 = this.f13232;
        int i3 = i / 8;
        int i4 = i2 + i3;
        this.f13232 = i4;
        int i5 = (i - (i3 * 8)) + this.f13233;
        this.f13233 = i5;
        if (i5 > 7) {
            this.f13232 = i4 + 1;
            this.f13233 = i5 - 8;
        }
        while (true) {
            i2++;
            if (i2 > this.f13232) {
                m6710();
                return;
            } else if (m6715(i2)) {
                this.f13232++;
                i2 += 2;
            }
        }
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public int m6718() {
        int iM6716 = m6716();
        return ((iM6716 + 1) / 2) * (iM6716 % 2 == 0 ? -1 : 1);
    }

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public void m6719() {
        int i = this.f13233 + 1;
        this.f13233 = i;
        if (i == 8) {
            this.f13233 = 0;
            int i2 = this.f13232;
            this.f13232 = i2 + (m6715(i2 + 1) ? 2 : 1);
        }
        m6710();
    }
}
