package p138.p176.p177.p190.p238;

import java.util.Arrays;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྌ.މ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4099 implements InterfaceC4089 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final boolean f13085;

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

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final byte[] f13087;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final C4088[] f13088;

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

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

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

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public C4088[] f13092;

    public C4099(boolean z, int i) {
        C0567.m1896(i > 0);
        C0567.m1896(true);
        this.f13085 = z;
        this.f13086 = i;
        this.f13091 = 0;
        this.f13092 = new C4088[100];
        this.f13087 = null;
        this.f13088 = new C4088[1];
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized C4088 m6586() {
        C4088 c4088;
        this.f13090++;
        if (this.f13091 > 0) {
            C4088[] c4088Arr = this.f13092;
            int i = this.f13091 - 1;
            this.f13091 = i;
            c4088 = c4088Arr[i];
            this.f13092[i] = null;
        } else {
            c4088 = new C4088(new byte[this.f13086], 0);
        }
        return c4088;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized void m6587(int i) {
        boolean z = i < this.f13089;
        this.f13089 = i;
        if (z) {
            m6592();
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized void m6588(C4088 c4088) {
        this.f13088[0] = c4088;
        m6589(this.f13088);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized void m6589(C4088[] c4088Arr) {
        if (this.f13091 + c4088Arr.length >= this.f13092.length) {
            this.f13092 = (C4088[]) Arrays.copyOf(this.f13092, Math.max(this.f13092.length * 2, this.f13091 + c4088Arr.length));
        }
        for (C4088 c4088 : c4088Arr) {
            C4088[] c4088Arr2 = this.f13092;
            int i = this.f13091;
            this.f13091 = i + 1;
            c4088Arr2[i] = c4088;
        }
        this.f13090 -= c4088Arr.length;
        notifyAll();
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public synchronized int m6590() {
        return this.f13090 * this.f13086;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public synchronized void m6591() {
        if (this.f13085) {
            m6587(0);
        }
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public synchronized void m6592() {
        int i = 0;
        int iMax = Math.max(0, C4150.m6742(this.f13089, this.f13086) - this.f13090);
        if (iMax >= this.f13091) {
            return;
        }
        if (this.f13087 != null) {
            int i2 = this.f13091 - 1;
            while (i <= i2) {
                C4088 c4088 = this.f13092[i];
                if (c4088.f13060 == this.f13087) {
                    i++;
                } else {
                    C4088 c40882 = this.f13092[i2];
                    if (c40882.f13060 != this.f13087) {
                        i2--;
                    } else {
                        this.f13092[i] = c40882;
                        this.f13092[i2] = c4088;
                        i2--;
                        i++;
                    }
                }
            }
            iMax = Math.max(iMax, i);
            if (iMax >= this.f13091) {
                return;
            }
        }
        Arrays.fill(this.f13092, iMax, this.f13091, (Object) null);
        this.f13091 = iMax;
    }
}
