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

import java.util.Arrays;

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

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

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

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

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

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

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

    public nc2(int i10, int[] iArr, Object[] objArr, boolean z10) {
        this.f14530a = i10;
        this.f14531b = iArr;
        this.f14532c = objArr;
        this.f14534e = z10;
    }

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

    public final void b(ra2 ra2Var) {
        if (this.f14530a != 0) {
            for (int i10 = 0; i10 < this.f14530a; i10++) {
                int i11 = this.f14531b[i10];
                Object obj = this.f14532c[i10];
                int i12 = i11 & 7;
                int i13 = i11 >>> 3;
                if (i12 == 0) {
                    ra2Var.c(i13, ((Long) obj).longValue());
                } else if (i12 == 1) {
                    ra2Var.j(i13, ((Long) obj).longValue());
                } else if (i12 == 2) {
                    ra2Var.m(i13, (zzian) obj);
                } else if (i12 == 3) {
                    ra2Var.f16089a.C(i13, 3);
                    ((nc2) obj).b(ra2Var);
                    ra2Var.f16089a.C(i13, 4);
                } else {
                    if (i12 != 5) {
                        throw new RuntimeException(new zzicf());
                    }
                    ra2Var.k(i13, ((Integer) obj).intValue());
                }
            }
        }
    }

    public final int c() {
        int iZ;
        int iA;
        int iZ2;
        int i10 = this.f14533d;
        if (i10 != -1) {
            return i10;
        }
        int iB = 0;
        for (int i11 = 0; i11 < this.f14530a; i11++) {
            int i12 = this.f14531b[i11];
            int i13 = i12 >>> 3;
            int i14 = i12 & 7;
            if (i14 != 0) {
                if (i14 == 1) {
                    ((Long) this.f14532c[i11]).longValue();
                    iZ2 = qa2.z(i13 << 3) + 8;
                } else if (i14 == 2) {
                    int i15 = i13 << 3;
                    zzian zzianVar = (zzian) this.f14532c[i11];
                    int iZ3 = qa2.z(i15);
                    int iJ = zzianVar.j();
                    iB = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.b(iJ, iJ, iZ3, iB);
                } else if (i14 == 3) {
                    int iZ4 = qa2.z(i13 << 3);
                    iZ = iZ4 + iZ4;
                    iA = ((nc2) this.f14532c[i11]).c();
                } else {
                    if (i14 != 5) {
                        throw new IllegalStateException(new zzicf());
                    }
                    ((Integer) this.f14532c[i11]).intValue();
                    iZ2 = qa2.z(i13 << 3) + 4;
                }
                iB = iZ2 + iB;
            } else {
                int i16 = i13 << 3;
                long jLongValue = ((Long) this.f14532c[i11]).longValue();
                iZ = qa2.z(i16);
                iA = qa2.A(jLongValue);
            }
            iB = iA + iZ + iB;
        }
        this.f14533d = iB;
        return iB;
    }

    public final void d(int i10, Object obj) {
        if (!this.f14534e) {
            throw new UnsupportedOperationException();
        }
        e(this.f14530a + 1);
        int[] iArr = this.f14531b;
        int i11 = this.f14530a;
        iArr[i11] = i10;
        this.f14532c[i11] = obj;
        this.f14530a = i11 + 1;
    }

    public final void e(int i10) {
        int[] iArr = this.f14531b;
        if (i10 > iArr.length) {
            int i11 = this.f14530a;
            int i12 = (i11 / 2) + i11;
            if (i12 >= i10) {
                i10 = i12;
            }
            if (i10 < 8) {
                i10 = 8;
            }
            this.f14531b = Arrays.copyOf(iArr, i10);
            this.f14532c = Arrays.copyOf(this.f14532c, i10);
        }
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof nc2)) {
            return false;
        }
        nc2 nc2Var = (nc2) obj;
        int i10 = this.f14530a;
        if (i10 == nc2Var.f14530a) {
            int[] iArr = this.f14531b;
            int[] iArr2 = nc2Var.f14531b;
            int i11 = 0;
            while (true) {
                if (i11 >= i10) {
                    Object[] objArr = this.f14532c;
                    Object[] objArr2 = nc2Var.f14532c;
                    int i12 = this.f14530a;
                    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.f14530a;
        int i11 = i10 + 527;
        int[] iArr = this.f14531b;
        int iHashCode = 17;
        int i12 = 17;
        for (int i13 = 0; i13 < i10; i13++) {
            i12 = (i12 * 31) + iArr[i13];
        }
        int i14 = ((i11 * 31) + i12) * 31;
        Object[] objArr = this.f14532c;
        int i15 = this.f14530a;
        for (int i16 = 0; i16 < i15; i16++) {
            iHashCode = (iHashCode * 31) + objArr[i16].hashCode();
        }
        return i14 + iHashCode;
    }
}
