package com.google.android.gms.internal.pal;

import java.util.Arrays;

/* JADX INFO: loaded from: classes2.dex */
public final class m1 {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final m1 f21068f = new m1(0, new int[0], new Object[0], false);

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f21069a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int[] f21070b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Object[] f21071c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public int f21072d = -1;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f21073e;

    public m1(int i10, int[] iArr, Object[] objArr, boolean z10) {
        this.f21069a = i10;
        this.f21070b = iArr;
        this.f21071c = objArr;
        this.f21073e = z10;
    }

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

    public final int a() {
        int iI0;
        int iJ0;
        int i10 = this.f21072d;
        if (i10 != -1) {
            return i10;
        }
        int iW = 0;
        for (int i11 = 0; i11 < this.f21069a; i11++) {
            int i12 = this.f21070b[i11];
            int i13 = i12 >>> 3;
            int i14 = i12 & 7;
            if (i14 != 0) {
                if (i14 == 1) {
                    ((Long) this.f21071c[i11]).longValue();
                    iW = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.w(i13 << 3, 8, iW);
                } else if (i14 == 2) {
                    zzaby zzabyVar = (zzaby) this.f21071c[i11];
                    int iI02 = s.I0(i13 << 3);
                    int iG = zzabyVar.g();
                    iW = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.v(iG, iG, iI02, iW);
                } else if (i14 == 3) {
                    int iZ0 = s.Z0(i13);
                    iI0 = iZ0 + iZ0;
                    iJ0 = ((m1) this.f21071c[i11]).a();
                } else {
                    if (i14 != 5) {
                        throw new IllegalStateException(zzadi.a());
                    }
                    ((Integer) this.f21071c[i11]).intValue();
                    iW = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.w(i13 << 3, 4, iW);
                }
            } else {
                long jLongValue = ((Long) this.f21071c[i11]).longValue();
                iI0 = s.I0(i13 << 3);
                iJ0 = s.J0(jLongValue);
            }
            iW = iJ0 + iI0 + iW;
        }
        this.f21072d = iW;
        return iW;
    }

    public final void c(int i10, Object obj) {
        if (!this.f21073e) {
            throw new UnsupportedOperationException();
        }
        int i11 = this.f21069a;
        int[] iArr = this.f21070b;
        if (i11 == iArr.length) {
            int i12 = i11 + (i11 < 4 ? 8 : i11 >> 1);
            this.f21070b = Arrays.copyOf(iArr, i12);
            this.f21071c = Arrays.copyOf(this.f21071c, i12);
        }
        int[] iArr2 = this.f21070b;
        int i13 = this.f21069a;
        iArr2[i13] = i10;
        this.f21071c[i13] = obj;
        this.f21069a = i13 + 1;
    }

    public final void d(t tVar) {
        if (this.f21069a != 0) {
            for (int i10 = 0; i10 < this.f21069a; i10++) {
                int i11 = this.f21070b[i10];
                Object obj = this.f21071c[i10];
                int i12 = i11 >>> 3;
                int i13 = i11 & 7;
                if (i13 == 0) {
                    tVar.n(i12, ((Long) obj).longValue());
                } else if (i13 == 1) {
                    tVar.j(i12, ((Long) obj).longValue());
                } else if (i13 == 2) {
                    tVar.f(i12, (zzaby) obj);
                } else if (i13 == 3) {
                    tVar.f21214a.S0(i12, 3);
                    ((m1) obj).d(tVar);
                    tVar.f21214a.S0(i12, 4);
                } else {
                    if (i13 != 5) {
                        throw new RuntimeException(zzadi.a());
                    }
                    tVar.i(i12, ((Integer) obj).intValue());
                }
            }
        }
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof m1)) {
            return false;
        }
        m1 m1Var = (m1) obj;
        int i10 = this.f21069a;
        if (i10 == m1Var.f21069a) {
            int[] iArr = this.f21070b;
            int[] iArr2 = m1Var.f21070b;
            int i11 = 0;
            while (true) {
                if (i11 >= i10) {
                    Object[] objArr = this.f21071c;
                    Object[] objArr2 = m1Var.f21071c;
                    int i12 = this.f21069a;
                    for (int i13 = 0; i13 < i12; i13++) {
                        if (objArr[i13].equals(objArr2[i13])) {
                        }
                    }
                    return true;
                }
                if (iArr[i11] != iArr2[i11]) {
                    break;
                }
                i11++;
            }
        }
        return false;
    }

    public final int hashCode() {
        int i10 = this.f21069a;
        int i11 = (i10 + 527) * 31;
        int[] iArr = this.f21070b;
        int iHashCode = 17;
        int i12 = 17;
        for (int i13 = 0; i13 < i10; i13++) {
            i12 = (i12 * 31) + iArr[i13];
        }
        int i14 = (i11 + i12) * 31;
        Object[] objArr = this.f21071c;
        int i15 = this.f21069a;
        for (int i16 = 0; i16 < i15; i16++) {
            iHashCode = (iHashCode * 31) + objArr[i16].hashCode();
        }
        return i14 + iHashCode;
    }
}
