package ᨨ;

/* renamed from: ᨨ.ݜ  reason: contains not printable characters */
/* compiled from: Segment */
public final class C1475 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f5494;

    /* renamed from: ඓ  reason: contains not printable characters */
    public boolean f5495;

    /* renamed from: ῲ  reason: contains not printable characters */
    public int f5496;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public C1475 f5497;

    /* renamed from: K  reason: contains not printable characters */
    public final byte[] f5498;

    /* renamed from: 㴹  reason: contains not printable characters */
    public C1475 f5499;

    /* renamed from: 㸾  reason: contains not printable characters */
    public boolean f5500;

    public C1475() {
        this.f5498 = new byte[8192];
        this.f5495 = true;
        this.f5500 = false;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public C1475 m3695() {
        this.f5500 = true;
        return new C1475(this.f5498, this.f5496, this.f5494, true, false);
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1475 m3696() {
        C1475 r0 = this.f5499;
        if (r0 == this) {
            r0 = null;
        }
        C1475 r2 = this.f5497;
        r2.f5499 = this.f5499;
        this.f5499.f5497 = r2;
        this.f5499 = null;
        this.f5497 = null;
        return r0;
    }

    public C1475(byte[] bArr, int i, int i2, boolean z, boolean z2) {
        this.f5498 = bArr;
        this.f5496 = i;
        this.f5494 = i2;
        this.f5500 = z;
        this.f5495 = z2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1475 m3698(C1475 r2) {
        r2.f5497 = this;
        r2.f5499 = this.f5499;
        this.f5499.f5497 = r2;
        this.f5499 = r2;
        return r2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1475 m3697(int i) {
        C1475 r0;
        if (i <= 0 || i > this.f5494 - this.f5496) {
            throw new IllegalArgumentException();
        }
        if (i >= 1024) {
            r0 = m3695();
        } else {
            r0 = C1497.m3826();
            System.arraycopy(this.f5498, this.f5496, r0.f5498, 0, i);
        }
        r0.f5494 = r0.f5496 + i;
        this.f5496 += i;
        this.f5497.m3698(r0);
        return r0;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3699(C1475 r5, int i) {
        if (r5.f5495) {
            int i2 = r5.f5494;
            if (i2 + i > 8192) {
                if (!r5.f5500) {
                    int i3 = r5.f5496;
                    if ((i2 + i) - i3 <= 8192) {
                        byte[] bArr = r5.f5498;
                        System.arraycopy(bArr, i3, bArr, 0, i2 - i3);
                        r5.f5494 -= r5.f5496;
                        r5.f5496 = 0;
                    } else {
                        throw new IllegalArgumentException();
                    }
                } else {
                    throw new IllegalArgumentException();
                }
            }
            System.arraycopy(this.f5498, this.f5496, r5.f5498, r5.f5494, i);
            r5.f5494 += i;
            this.f5496 += i;
            return;
        }
        throw new IllegalArgumentException();
    }
}
