package o;

import java.util.Arrays;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.wu0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2857wu0 {
    public static final C2857wu0 f = new C2857wu0(0, new int[0], new Object[0], false);
    public int a;
    public int[] b;
    public Object[] c;
    public int d = -1;
    public boolean e;

    public C2857wu0(int i, int[] iArr, Object[] objArr, boolean z) {
        this.a = i;
        this.b = iArr;
        this.c = objArr;
        this.e = z;
    }

    public static C2857wu0 a() {
        return new C2857wu0(0, new int[8], new Object[8], true);
    }

    public final void b(C1696kj0 c1696kj0) {
        if (this.a != 0) {
            for (int i = 0; i < this.a; i++) {
                int i2 = this.b[i];
                Object obj = this.c[i];
                int i3 = i2 & 7;
                int i4 = i2 >>> 3;
                if (i3 == 0) {
                    ((Zs0) c1696kj0.m).d0(i4, ((Long) obj).longValue());
                } else if (i3 == 1) {
                    ((Zs0) c1696kj0.m).e0(i4, ((Long) obj).longValue());
                } else if (i3 == 2) {
                    Zs0 zs0 = (Zs0) c1696kj0.m;
                    zs0.i0((i4 << 3) | 2);
                    zs0.f0((Ws0) obj);
                } else if (i3 == 3) {
                    ((Zs0) c1696kj0.m).Z(i4, 3);
                    ((C2857wu0) obj).b(c1696kj0);
                    ((Zs0) c1696kj0.m).Z(i4, 4);
                } else {
                    if (i3 != 5) {
                        throw new RuntimeException(new Ft0());
                    }
                    ((Zs0) c1696kj0.m).c0(i4, ((Integer) obj).intValue());
                }
            }
        }
    }

    public final int c() {
        int iO0;
        int iX;
        int iO02;
        int i = this.d;
        if (i != -1) {
            return i;
        }
        int iC = 0;
        for (int i2 = 0; i2 < this.a; i2++) {
            int i3 = this.b[i2];
            int i4 = i3 >>> 3;
            int i5 = i3 & 7;
            if (i5 != 0) {
                if (i5 == 1) {
                    ((Long) this.c[i2]).getClass();
                    iO02 = Zs0.o0(i4 << 3) + 8;
                } else if (i5 == 2) {
                    int i6 = i4 << 3;
                    Ws0 ws0 = (Ws0) this.c[i2];
                    int iO03 = Zs0.o0(i6);
                    int iC2 = ws0.c();
                    iC = Ag0.c(iC2, iC2, iO03, iC);
                } else if (i5 == 3) {
                    int iO04 = Zs0.o0(i4 << 3);
                    iO0 = iO04 + iO04;
                    iX = ((C2857wu0) this.c[i2]).c();
                } else {
                    if (i5 != 5) {
                        throw new IllegalStateException(new Ft0());
                    }
                    ((Integer) this.c[i2]).getClass();
                    iO02 = Zs0.o0(i4 << 3) + 4;
                }
                iC = iO02 + iC;
            } else {
                int i7 = i4 << 3;
                long jLongValue = ((Long) this.c[i2]).longValue();
                iO0 = Zs0.o0(i7);
                iX = Zs0.X(jLongValue);
            }
            iC = iX + iO0 + iC;
        }
        this.d = iC;
        return iC;
    }

    public final void d(int i, Object obj) {
        if (!this.e) {
            throw new UnsupportedOperationException();
        }
        e(this.a + 1);
        int[] iArr = this.b;
        int i2 = this.a;
        iArr[i2] = i;
        this.c[i2] = obj;
        this.a = i2 + 1;
    }

    public final void e(int i) {
        int[] iArr = this.b;
        if (i > iArr.length) {
            int i2 = this.a;
            int i3 = (i2 / 2) + i2;
            if (i3 >= i) {
                i = i3;
            }
            if (i < 8) {
                i = 8;
            }
            this.b = Arrays.copyOf(iArr, i);
            this.c = Arrays.copyOf(this.c, i);
        }
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof C2857wu0)) {
            return false;
        }
        C2857wu0 c2857wu0 = (C2857wu0) obj;
        int i = this.a;
        if (i == c2857wu0.a) {
            int[] iArr = this.b;
            int[] iArr2 = c2857wu0.b;
            int i2 = 0;
            while (true) {
                if (i2 >= i) {
                    Object[] objArr = this.c;
                    Object[] objArr2 = c2857wu0.c;
                    int i3 = this.a;
                    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.a;
        int i2 = i + 527;
        int[] iArr = this.b;
        int iHashCode = 17;
        int i3 = 17;
        for (int i4 = 0; i4 < i; i4++) {
            i3 = (i3 * 31) + iArr[i4];
        }
        int i5 = ((i2 * 31) + i3) * 31;
        Object[] objArr = this.c;
        int i6 = this.a;
        for (int i7 = 0; i7 < i6; i7++) {
            iHashCode = (iHashCode * 31) + objArr[i7].hashCode();
        }
        return i5 + iHashCode;
    }
}
