package defpackage;

import java.util.Arrays;
import org.tukaani.xz.CorruptedInputException;

/* JADX INFO: renamed from: ᵠⁱᵢ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3180 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public byte[] f12075;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public int f12076;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public int f12077;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final /* synthetic */ int f12078;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public int f12079;

    public C3180(int i) {
        this.f12078 = i;
        switch (i) {
            case 3:
                break;
            default:
                this.f12075 = AbstractC0956.f4216;
                break;
        }
    }

    public C3180(int i, int i2) {
        this.f12078 = 0;
        this.f12076 = i;
        this.f12079 = i2;
        this.f12075 = new byte[(i2 * 2) - 1];
        this.f12077 = 0;
    }

    public C3180(int i, byte[] bArr) {
        this.f12078 = 1;
        this.f12075 = bArr;
        this.f12077 = i;
    }

    public C3180(C2470 c2470) {
        this.f12078 = 2;
        this.f12076 = 0;
        this.f12079 = 0;
        byte[] bArrMo4894 = c2470.mo4894(65531);
        this.f12075 = bArrMo4894;
        this.f12077 = bArrMo4894.length;
    }

    public C3180(byte[] bArr) {
        this.f12078 = 4;
        this.f12075 = bArr;
        this.f12076 = bArr.length;
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public static final void m7285(short[] sArr) {
        Arrays.fill(sArr, (short) 1024);
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public int m7286() {
        return ((this.f12077 - this.f12076) * 8) - this.f12079;
    }

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public void m7287(int i) {
        int i2;
        switch (this.f12078) {
            case 1:
                int i3 = i / 8;
                int i4 = this.f12076 + i3;
                this.f12076 = i4;
                int i5 = (i - (i3 * 8)) + this.f12079;
                this.f12079 = i5;
                if (i5 > 7) {
                    this.f12076 = i4 + 1;
                    this.f12079 = i5 - 8;
                }
                m7300();
                break;
            default:
                int i6 = i / 8;
                int i7 = this.f12079 + i6;
                this.f12079 = i7;
                int i8 = (i - (i6 * 8)) + this.f12077;
                this.f12077 = i8;
                boolean z = true;
                if (i8 > 7) {
                    this.f12079 = i7 + 1;
                    this.f12077 = i8 - 8;
                }
                int i9 = this.f12079;
                if (i9 < 0 || (i9 >= (i2 = this.f12076) && (i9 != i2 || this.f12077 != 0))) {
                    z = false;
                }
                ᵻᵪ.ˌᴵ(z);
                break;
        }
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public void m7288() {
        int i = this.f12079 + 1;
        this.f12079 = i;
        if (i == 8) {
            this.f12079 = 0;
            this.f12076++;
        }
        m7300();
    }

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public void m7289(byte[] bArr, int i, int i2) {
        byte[] bArr2 = this.f12075;
        if (bArr.length - i < i2) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("Bytes to write do not exist in source");
            return;
        }
        if (i2 > bArr2.length - this.f12077) {
            C1390.m3982("Size of bytes to be written is greater than available buffer space");
            return;
        }
        int i3 = this.f12076;
        if (i3 + i2 <= bArr2.length) {
            System.arraycopy(bArr, i, bArr2, i3, i2);
        } else {
            int length = bArr2.length - i3;
            System.arraycopy(bArr, i, bArr2, i3, length);
            System.arraycopy(bArr, i + length, bArr2, 0, i2 - length);
        }
        this.f12076 = (this.f12076 + i2) % bArr2.length;
        this.f12077 += i2;
    }

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public void m7290(int i, byte[] bArr) {
        ᵻᵪ.ˌᴵ(this.f12079 == 0);
        System.arraycopy(this.f12075, this.f12076, bArr, 0, i);
        this.f12076 += i;
        m7300();
    }

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public void m7291(int i) {
        ᵻᵪ.ˌᴵ(this.f12079 == 0);
        this.f12076 += i;
        m7300();
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public void m7292() {
        if (this.f12079 == 0) {
            return;
        }
        this.f12079 = 0;
        this.f12076++;
        m7300();
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public long m7293(int i) {
        if (i <= 32) {
            int iM7302 = m7302(i);
            String str = AbstractC0956.f4222;
            return ((long) iM7302) & 4294967295L;
        }
        int iM73022 = m7302(i - 32);
        int iM73023 = m7302(32);
        String str2 = AbstractC0956.f4222;
        return (((long) iM73023) & 4294967295L) | ((((long) iM73022) & 4294967295L) << 32);
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public void m7294(C4545 c4545) {
        m7296(c4545.f17283, c4545.f17284);
        m7298(c4545.f17282 * 8);
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public int m7295(short[] sArr) {
        int iM7303 = 1;
        do {
            iM7303 = m7303(sArr, iM7303) | (iM7303 << 1);
        } while (iM7303 < sArr.length);
        return iM7303 - sArr.length;
    }

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public void m7296(int i, byte[] bArr) {
        this.f12075 = bArr;
        this.f12076 = 0;
        this.f12079 = 0;
        this.f12077 = i;
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public void m7297(int i, byte[] bArr) {
        int i2 = i >> 3;
        for (int i3 = 0; i3 < i2; i3++) {
            byte[] bArr2 = this.f12075;
            int i4 = this.f12076;
            int i5 = i4 + 1;
            this.f12076 = i5;
            byte b = bArr2[i4];
            int i6 = this.f12079;
            byte b2 = (byte) (b << i6);
            bArr[i3] = b2;
            bArr[i3] = (byte) (((255 & bArr2[i5]) >> (8 - i6)) | b2);
        }
        int i7 = i & 7;
        if (i7 == 0) {
            return;
        }
        byte b3 = (byte) (bArr[i2] & (255 >> i7));
        bArr[i2] = b3;
        int i8 = this.f12079;
        if (i8 + i7 > 8) {
            byte[] bArr3 = this.f12075;
            int i9 = this.f12076;
            this.f12076 = i9 + 1;
            bArr[i2] = (byte) (b3 | ((bArr3[i9] & 255) << i8));
            this.f12079 = i8 - 8;
        }
        int i10 = this.f12079 + i7;
        this.f12079 = i10;
        byte[] bArr4 = this.f12075;
        int i11 = this.f12076;
        bArr[i2] = (byte) (((byte) (((255 & bArr4[i11]) >> (8 - i10)) << (8 - i7))) | bArr[i2]);
        if (i10 == 8) {
            this.f12079 = 0;
            this.f12076 = i11 + 1;
        }
        m7300();
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public void m7298(int i) {
        int i2 = i / 8;
        this.f12076 = i2;
        this.f12079 = i - (i2 * 8);
        m7300();
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public boolean m7299() {
        switch (this.f12078) {
            case 1:
                boolean z = (this.f12075[this.f12076] & (128 >> this.f12079)) != 0;
                m7288();
                return z;
            default:
                boolean z2 = (((this.f12075[this.f12079] & 255) >> this.f12077) & 1) == 1;
                m7287(1);
                return z2;
        }
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public void m7300() {
        int i;
        int i2 = this.f12076;
        ᵻᵪ.ˌᴵ(i2 >= 0 && (i2 < (i = this.f12077) || (i2 == i && this.f12079 == 0)));
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public int m7301() {
        return (this.f12076 * 8) + this.f12079;
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public int m7302(int i) {
        switch (this.f12078) {
            case 1:
                if (i == 0) {
                    return 0;
                }
                this.f12079 += i;
                int i2 = 0;
                while (true) {
                    int i3 = this.f12079;
                    if (i3 <= 8) {
                        byte[] bArr = this.f12075;
                        int i4 = this.f12076;
                        int i5 = ((-1) >>> (32 - i)) & (((255 & bArr[i4]) >> (8 - i3)) | i2);
                        if (i3 == 8) {
                            this.f12079 = 0;
                            this.f12076 = i4 + 1;
                        }
                        m7300();
                        return i5;
                    }
                    int i6 = i3 - 8;
                    this.f12079 = i6;
                    byte[] bArr2 = this.f12075;
                    int i7 = this.f12076;
                    this.f12076 = i7 + 1;
                    i2 |= (bArr2[i7] & 255) << i6;
                }
                break;
            default:
                int i8 = this.f12079;
                int iMin = Math.min(i, 8 - this.f12077);
                byte[] bArr3 = this.f12075;
                int i9 = i8 + 1;
                int i10 = ((bArr3[i8] & 255) >> this.f12077) & (255 >> (8 - iMin));
                while (iMin < i) {
                    i10 |= (bArr3[i9] & 255) << iMin;
                    iMin += 8;
                    i9++;
                }
                int i11 = i10 & ((-1) >>> (32 - i));
                m7287(i);
                return i11;
        }
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public int m7303(short[] sArr, int i) throws CorruptedInputException {
        m7304();
        short s = sArr[i];
        int i2 = (this.f12076 >>> 11) * s;
        if (Integer.compare(this.f12079 ^ Integer.MIN_VALUE, Integer.MIN_VALUE ^ i2) < 0) {
            this.f12076 = i2;
            sArr[i] = (short) (s + ((2048 - s) >>> 5));
            return 0;
        }
        this.f12076 -= i2;
        this.f12079 -= i2;
        sArr[i] = (short) (s - (s >>> 5));
        return 1;
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public void m7304() throws CorruptedInputException {
        int i = this.f12076;
        if (((-16777216) & i) == 0) {
            try {
                int i2 = this.f12079 << 8;
                byte[] bArr = this.f12075;
                int i3 = this.f12077;
                this.f12077 = i3 + 1;
                this.f12079 = i2 | (bArr[i3] & 255);
                this.f12076 = i << 8;
            } catch (ArrayIndexOutOfBoundsException unused) {
                throw new CorruptedInputException();
            }
        }
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public int m7305() {
        ᵻᵪ.ˌᴵ(this.f12079 == 0);
        return this.f12076;
    }
}
