package com.google.crypto.tink.shaded.protobuf;

import java.util.Arrays;

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

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

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

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

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

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

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

    public f1(int i10, int[] iArr, Object[] objArr, boolean z10) {
        this.f23898a = i10;
        this.f23899b = iArr;
        this.f23900c = objArr;
        this.f23902e = z10;
    }

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

    public final void a(int i10) {
        int[] iArr = this.f23899b;
        if (i10 > iArr.length) {
            int i11 = this.f23898a;
            int i12 = (i11 / 2) + i11;
            if (i12 >= i10) {
                i10 = i12;
            }
            if (i10 < 8) {
                i10 = 8;
            }
            this.f23899b = Arrays.copyOf(iArr, i10);
            this.f23900c = Arrays.copyOf(this.f23900c, i10);
        }
    }

    public final int b() {
        int iR0;
        int i10 = this.f23901d;
        if (i10 != -1) {
            return i10;
        }
        int iB = 0;
        for (int i11 = 0; i11 < this.f23898a; i11++) {
            int i12 = this.f23899b[i11];
            int i13 = i12 >>> 3;
            int i14 = i12 & 7;
            if (i14 == 0) {
                iR0 = n.r0(i13, ((Long) this.f23900c[i11]).longValue());
            } else if (i14 == 1) {
                ((Long) this.f23900c[i11]).longValue();
                iR0 = n.b0(i13);
            } else if (i14 == 2) {
                iR0 = n.X(i13, (ByteString) this.f23900c[i11]);
            } else if (i14 == 3) {
                iB = ((f1) this.f23900c[i11]).b() + (n.o0(i13) * 2) + iB;
            } else {
                if (i14 != 5) {
                    throw new IllegalStateException(InvalidProtocolBufferException.d());
                }
                ((Integer) this.f23900c[i11]).intValue();
                iR0 = n.a0(i13);
            }
            iB = iR0 + iB;
        }
        this.f23901d = iB;
        return iB;
    }

    public final void d(int i10, Object obj) {
        if (!this.f23902e) {
            throw new UnsupportedOperationException();
        }
        a(this.f23898a + 1);
        int[] iArr = this.f23899b;
        int i11 = this.f23898a;
        iArr[i11] = i10;
        this.f23900c[i11] = obj;
        this.f23898a = i11 + 1;
    }

    public final void e(xyz.stream.utils.j0 j0Var) {
        if (this.f23898a == 0) {
            return;
        }
        j0Var.getClass();
        for (int i10 = 0; i10 < this.f23898a; i10++) {
            int i11 = this.f23899b[i10];
            Object obj = this.f23900c[i10];
            int i12 = i11 >>> 3;
            int i13 = i11 & 7;
            if (i13 == 0) {
                j0Var.Q(i12, ((Long) obj).longValue());
            } else if (i13 == 1) {
                j0Var.F(i12, ((Long) obj).longValue());
            } else if (i13 == 2) {
                j0Var.u(i12, (ByteString) obj);
            } else if (i13 == 3) {
                int i14 = j0Var.f36153a;
                switch (i14) {
                    case 6:
                        ((androidx.datastore.preferences.protobuf.n) j0Var.f36154b).T(i12, 3);
                        break;
                    default:
                        ((n) j0Var.f36154b).D0(i12, 3);
                        break;
                }
                ((f1) obj).e(j0Var);
                switch (i14) {
                    case 6:
                        ((androidx.datastore.preferences.protobuf.n) j0Var.f36154b).T(i12, 4);
                        break;
                    default:
                        ((n) j0Var.f36154b).D0(i12, 4);
                        break;
                }
            } else {
                if (i13 != 5) {
                    throw new RuntimeException(InvalidProtocolBufferException.d());
                }
                j0Var.C(i12, ((Integer) obj).intValue());
            }
        }
    }

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