package androidx.datastore.preferences.protobuf;

import defpackage.C1260;
import defpackage.C2347;
import defpackage.C2585;
import defpackage.C2707;
import defpackage.C3718;
import defpackage.C5050;
import java.io.IOException;
import java.util.Arrays;

/* renamed from: androidx.datastore.preferences.protobuf.ᵸˑ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0010 {

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public static final C0010 f364 = new C0010(0, new int[0], new Object[0], false);

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public boolean f365;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public Object[] f366;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public int f367;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public int[] f368;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public int f369 = -1;

    public C0010(int i, int[] iArr, Object[] objArr, boolean z) {
        this.f367 = i;
        this.f368 = iArr;
        this.f366 = objArr;
        this.f365 = z;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof C0010)) {
            return false;
        }
        C0010 c0010 = (C0010) obj;
        int i = this.f367;
        if (i == c0010.f367) {
            int[] iArr = this.f368;
            int[] iArr2 = c0010.f368;
            int i2 = 0;
            while (true) {
                if (i2 >= i) {
                    Object[] objArr = this.f366;
                    Object[] objArr2 = c0010.f366;
                    int i3 = this.f367;
                    for (int i4 = 0; i4 < i3; i4++) {
                        if (objArr[i4].equals(objArr2[i4])) {
                        }
                    }
                    return true;
                }
                if (iArr[i2] != iArr2[i2]) {
                    break;
                }
                i2++;
            }
        }
        return false;
    }

    public final int hashCode() {
        int i = this.f367;
        int i2 = (527 + i) * 31;
        int[] iArr = this.f368;
        int iHashCode = 17;
        int i3 = 17;
        for (int i4 = 0; i4 < i; i4++) {
            i3 = (i3 * 31) + iArr[i4];
        }
        int i5 = (i2 + i3) * 31;
        Object[] objArr = this.f366;
        int i6 = this.f367;
        for (int i7 = 0; i7 < i6; i7++) {
            iHashCode = (iHashCode * 31) + objArr[i7].hashCode();
        }
        return i5 + iHashCode;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m223(int i, Object obj) {
        if (!this.f365) {
            C2585.m6504();
            return;
        }
        m224(this.f367 + 1);
        int[] iArr = this.f368;
        int i2 = this.f367;
        iArr[i2] = i;
        this.f366[i2] = obj;
        this.f367 = i2 + 1;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m224(int i) {
        int[] iArr = this.f368;
        if (i > iArr.length) {
            int i2 = this.f367;
            int i3 = (i2 / 2) + i2;
            if (i3 >= i) {
                i = i3;
            }
            if (i < 8) {
                i = 8;
            }
            this.f368 = Arrays.copyOf(iArr, i);
            this.f366 = Arrays.copyOf(this.f366, i);
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int m225() {
        int iM6067;
        int iM6066;
        int iM60672;
        int i = this.f369;
        if (i != -1) {
            return i;
        }
        int i2 = 0;
        for (int i3 = 0; i3 < this.f367; i3++) {
            int i4 = this.f368[i3];
            int i5 = i4 >>> 3;
            int i6 = i4 & 7;
            if (i6 != 0) {
                if (i6 == 1) {
                    ((Long) this.f366[i3]).getClass();
                    iM60672 = C2347.m6067(i5) + 8;
                } else if (i6 == 2) {
                    iM60672 = C2347.m6064(i5, (C5050) this.f366[i3]);
                } else if (i6 == 3) {
                    iM6067 = C2347.m6067(i5) * 2;
                    iM6066 = ((C0010) this.f366[i3]).m225();
                } else {
                    if (i6 != 5) {
                        C2707.m6713(InvalidProtocolBufferException.m97());
                        return 0;
                    }
                    ((Integer) this.f366[i3]).getClass();
                    iM60672 = C2347.m6067(i5) + 4;
                }
                i2 = iM60672 + i2;
            } else {
                long jLongValue = ((Long) this.f366[i3]).longValue();
                iM6067 = C2347.m6067(i5);
                iM6066 = C2347.m6066(jLongValue);
            }
            i2 = iM6066 + iM6067 + i2;
        }
        this.f369 = i2;
        return i2;
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void m226(C3718 c3718) throws IOException {
        if (this.f367 == 0) {
            return;
        }
        c3718.getClass();
        C2347 c2347 = (C2347) c3718.f13883;
        for (int i = 0; i < this.f367; i++) {
            int i2 = this.f368[i];
            Object obj = this.f366[i];
            int i3 = i2 >>> 3;
            int i4 = i2 & 7;
            if (i4 == 0) {
                c2347.m6072(((Long) obj).longValue(), i3);
            } else if (i4 == 1) {
                c2347.m6084(((Long) obj).longValue(), i3);
            } else if (i4 == 2) {
                c2347.m6070(i3, (C5050) obj);
            } else if (i4 == 3) {
                c2347.m6068(i3, 3);
                ((C0010) obj).m226(c3718);
                c2347.m6068(i3, 4);
            } else {
                if (i4 != 5) {
                    C1260.m3814(InvalidProtocolBufferException.m97());
                    return;
                }
                c2347.m6090(i3, ((Integer) obj).intValue());
            }
        }
    }
}
