package defpackage;

import java.util.Arrays;

/* JADX INFO: renamed from: ᵠᵢᵞ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3162 implements Cloneable {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public /* synthetic */ boolean f12032;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public /* synthetic */ Object[] f12033;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public /* synthetic */ long[] f12034;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public /* synthetic */ int f12035;

    public C3162() {
        int i;
        int i2 = 4;
        while (true) {
            i = 80;
            if (i2 >= 32) {
                break;
            }
            int i3 = (1 << i2) - 12;
            if (80 <= i3) {
                i = i3;
                break;
            }
            i2++;
        }
        int i4 = i / 8;
        this.f12034 = new long[i4];
        this.f12033 = new Object[i4];
    }

    public final String toString() {
        if (m7268() <= 0) {
            return "{}";
        }
        StringBuilder sb = new StringBuilder(this.f12035 * 28);
        sb.append('{');
        int i = this.f12035;
        for (int i2 = 0; i2 < i; i2++) {
            if (i2 > 0) {
                sb.append(", ");
            }
            sb.append(m7266(i2));
            sb.append('=');
            Object objM7270 = m7270(i2);
            if (objM7270 != sb) {
                sb.append(objM7270);
            } else {
                sb.append("(this Map)");
            }
        }
        sb.append('}');
        return sb.toString();
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final void m7265(long j, Long l) {
        int i = this.f12035;
        if (i != 0 && j <= this.f12034[i - 1]) {
            m7272(j, l);
            return;
        }
        if (this.f12032) {
            long[] jArr = this.f12034;
            if (i >= jArr.length) {
                Object[] objArr = this.f12033;
                int i2 = 0;
                for (int i3 = 0; i3 < i; i3++) {
                    Object obj = objArr[i3];
                    if (obj != ˀᵳˎᵹ.ˌᴵ) {
                        if (i3 != i2) {
                            jArr[i2] = jArr[i3];
                            objArr[i2] = obj;
                            objArr[i3] = null;
                        }
                        i2++;
                    }
                }
                this.f12032 = false;
                this.f12035 = i2;
            }
        }
        int i4 = this.f12035;
        if (i4 >= this.f12034.length) {
            int i5 = (i4 + 1) * 8;
            int i6 = 4;
            while (true) {
                if (i6 >= 32) {
                    break;
                }
                int i7 = (1 << i6) - 12;
                if (i5 <= i7) {
                    i5 = i7;
                    break;
                }
                i6++;
            }
            int i8 = i5 / 8;
            this.f12034 = Arrays.copyOf(this.f12034, i8);
            this.f12033 = Arrays.copyOf(this.f12033, i8);
        }
        this.f12034[i4] = j;
        this.f12033[i4] = l;
        this.f12035 = i4 + 1;
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final long m7266(int i) {
        int i2;
        if (i < 0 || i >= (i2 = this.f12035)) {
            AbstractC3481.m7945("Expected index to be within 0..size()-1, but was " + i);
            throw null;
        }
        if (this.f12032) {
            long[] jArr = this.f12034;
            Object[] objArr = this.f12033;
            int i3 = 0;
            for (int i4 = 0; i4 < i2; i4++) {
                Object obj = objArr[i4];
                if (obj != ˀᵳˎᵹ.ˌᴵ) {
                    if (i4 != i3) {
                        jArr[i3] = jArr[i4];
                        objArr[i3] = obj;
                        objArr[i4] = null;
                    }
                    i3++;
                }
            }
            this.f12032 = false;
            this.f12035 = i3;
        }
        return this.f12034[i];
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters and merged with bridge method [inline-methods] */
    public final C3162 clone() {
        C3162 c3162 = (C3162) super.clone();
        c3162.f12034 = (long[]) this.f12034.clone();
        c3162.f12033 = (Object[]) this.f12033.clone();
        return c3162;
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final int m7268() {
        if (this.f12032) {
            int i = this.f12035;
            long[] jArr = this.f12034;
            Object[] objArr = this.f12033;
            int i2 = 0;
            for (int i3 = 0; i3 < i; i3++) {
                Object obj = objArr[i3];
                if (obj != ˀᵳˎᵹ.ˌᴵ) {
                    if (i3 != i2) {
                        jArr[i2] = jArr[i3];
                        objArr[i2] = obj;
                        objArr[i3] = null;
                    }
                    i2++;
                }
            }
            this.f12032 = false;
            this.f12035 = i2;
        }
        return this.f12035;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final Object m7269(long j) {
        Object obj;
        int i = ᵣˉ.ᵻˈᵦʼ(this.f12034, this.f12035, j);
        if (i < 0 || (obj = this.f12033[i]) == ˀᵳˎᵹ.ˌᴵ) {
            return -1L;
        }
        return obj;
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final Object m7270(int i) {
        int i2;
        if (i < 0 || i >= (i2 = this.f12035)) {
            AbstractC3481.m7945("Expected index to be within 0..size()-1, but was " + i);
            throw null;
        }
        if (this.f12032) {
            long[] jArr = this.f12034;
            Object[] objArr = this.f12033;
            int i3 = 0;
            for (int i4 = 0; i4 < i2; i4++) {
                Object obj = objArr[i4];
                if (obj != ˀᵳˎᵹ.ˌᴵ) {
                    if (i4 != i3) {
                        jArr[i3] = jArr[i4];
                        objArr[i3] = obj;
                        objArr[i4] = null;
                    }
                    i3++;
                }
            }
            this.f12032 = false;
            this.f12035 = i3;
        }
        return this.f12033[i];
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final void m7271() {
        int i = this.f12035;
        Object[] objArr = this.f12033;
        for (int i2 = 0; i2 < i; i2++) {
            objArr[i2] = null;
        }
        this.f12035 = 0;
        this.f12032 = false;
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final void m7272(long j, Object obj) {
        Object obj2 = ˀᵳˎᵹ.ˌᴵ;
        int i = ᵣˉ.ᵻˈᵦʼ(this.f12034, this.f12035, j);
        if (i >= 0) {
            this.f12033[i] = obj;
            return;
        }
        int i2 = ~i;
        int i3 = this.f12035;
        if (i2 < i3) {
            Object[] objArr = this.f12033;
            if (objArr[i2] == obj2) {
                this.f12034[i2] = j;
                objArr[i2] = obj;
                return;
            }
        }
        if (this.f12032) {
            long[] jArr = this.f12034;
            if (i3 >= jArr.length) {
                Object[] objArr2 = this.f12033;
                int i4 = 0;
                for (int i5 = 0; i5 < i3; i5++) {
                    Object obj3 = objArr2[i5];
                    if (obj3 != obj2) {
                        if (i5 != i4) {
                            jArr[i4] = jArr[i5];
                            objArr2[i4] = obj3;
                            objArr2[i5] = null;
                        }
                        i4++;
                    }
                }
                this.f12032 = false;
                this.f12035 = i4;
                i2 = ~ᵣˉ.ᵻˈᵦʼ(this.f12034, i4, j);
            }
        }
        int i6 = this.f12035;
        if (i6 >= this.f12034.length) {
            int i7 = (i6 + 1) * 8;
            int i8 = 4;
            while (true) {
                if (i8 >= 32) {
                    break;
                }
                int i9 = (1 << i8) - 12;
                if (i7 <= i9) {
                    i7 = i9;
                    break;
                }
                i8++;
            }
            int i10 = i7 / 8;
            this.f12034 = Arrays.copyOf(this.f12034, i10);
            this.f12033 = Arrays.copyOf(this.f12033, i10);
        }
        int i11 = this.f12035 - i2;
        if (i11 != 0) {
            long[] jArr2 = this.f12034;
            int i12 = i2 + 1;
            System.arraycopy(jArr2, i2, jArr2, i12, i11);
            Object[] objArr3 = this.f12033;
            AbstractC3761.m8436(i12, i2, this.f12035, objArr3, objArr3);
        }
        this.f12034[i2] = j;
        this.f12033[i2] = obj;
        this.f12035++;
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final Object m7273(long j) {
        Object obj;
        int i = ᵣˉ.ᵻˈᵦʼ(this.f12034, this.f12035, j);
        if (i < 0 || (obj = this.f12033[i]) == ˀᵳˎᵹ.ˌᴵ) {
            return null;
        }
        return obj;
    }
}
