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

import java.util.Arrays;

/* JADX INFO: loaded from: classes3.dex */
public final class f0 {

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

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

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

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

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

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

    public f0(int i6, int[] iArr, Object[] objArr, boolean z6) {
        this.f13781a = i6;
        this.f13782b = iArr;
        this.f13783c = objArr;
        this.f13785e = z6;
    }

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

    public final void a(int i6) {
        int[] iArr = this.f13782b;
        if (i6 > iArr.length) {
            int i7 = this.f13781a;
            int i8 = (i7 / 2) + i7;
            if (i8 >= i6) {
                i6 = i8;
            }
            if (i6 < 8) {
                i6 = 8;
            }
            this.f13782b = Arrays.copyOf(iArr, i6);
            this.f13783c = Arrays.copyOf(this.f13783c, i6);
        }
    }

    public final int b() {
        int iP;
        int iR;
        int iL;
        int i6 = this.f13784d;
        if (i6 != -1) {
            return i6;
        }
        int i7 = 0;
        for (int i8 = 0; i8 < this.f13781a; i8++) {
            int i9 = this.f13782b[i8];
            int i10 = i9 >>> 3;
            int i11 = i9 & 7;
            if (i11 != 0) {
                if (i11 == 1) {
                    ((Long) this.f13783c[i8]).getClass();
                    iL = C1264l.L(i10);
                } else if (i11 == 2) {
                    iL = C1264l.I(i10, (AbstractC1261i) this.f13783c[i8]);
                } else if (i11 == 3) {
                    iP = C1264l.P(i10) * 2;
                    iR = ((f0) this.f13783c[i8]).b();
                } else {
                    if (i11 != 5) {
                        throw new IllegalStateException(C.c());
                    }
                    ((Integer) this.f13783c[i8]).getClass();
                    iL = C1264l.K(i10);
                }
                i7 = iL + i7;
            } else {
                long jLongValue = ((Long) this.f13783c[i8]).longValue();
                iP = C1264l.P(i10);
                iR = C1264l.R(jLongValue);
            }
            i7 = iR + iP + i7;
        }
        this.f13784d = i7;
        return i7;
    }

    public final void d(int i6, Object obj) {
        if (!this.f13785e) {
            throw new UnsupportedOperationException();
        }
        a(this.f13781a + 1);
        int[] iArr = this.f13782b;
        int i7 = this.f13781a;
        iArr[i7] = i6;
        this.f13783c[i7] = obj;
        this.f13781a = i7 + 1;
    }

    public final void e(L l) throws H4.c {
        if (this.f13781a == 0) {
            return;
        }
        l.getClass();
        for (int i6 = 0; i6 < this.f13781a; i6++) {
            int i7 = this.f13782b[i6];
            Object obj = this.f13783c[i6];
            int i8 = i7 >>> 3;
            int i9 = i7 & 7;
            C1264l c1264l = (C1264l) l.f13733a;
            if (i9 == 0) {
                c1264l.b0(i8, ((Long) obj).longValue());
            } else if (i9 == 1) {
                c1264l.W(i8, ((Long) obj).longValue());
            } else if (i9 == 2) {
                l.a(i8, (AbstractC1261i) obj);
            } else if (i9 == 3) {
                c1264l.Z(i8, 3);
                ((f0) obj).e(l);
                c1264l.Z(i8, 4);
            } else {
                if (i9 != 5) {
                    throw new RuntimeException(C.c());
                }
                c1264l.U(i8, ((Integer) obj).intValue());
            }
        }
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof f0)) {
            return false;
        }
        f0 f0Var = (f0) obj;
        int i6 = this.f13781a;
        if (i6 == f0Var.f13781a) {
            int[] iArr = this.f13782b;
            int[] iArr2 = f0Var.f13782b;
            int i7 = 0;
            while (true) {
                if (i7 >= i6) {
                    Object[] objArr = this.f13783c;
                    Object[] objArr2 = f0Var.f13783c;
                    int i8 = this.f13781a;
                    for (int i9 = 0; i9 < i8; i9++) {
                        if (objArr[i9].equals(objArr2[i9])) {
                        }
                    }
                    return true;
                }
                if (iArr[i7] != iArr2[i7]) {
                    break;
                }
                i7++;
            }
        }
        return false;
    }

    public final int hashCode() {
        int i6 = this.f13781a;
        int i7 = (527 + i6) * 31;
        int[] iArr = this.f13782b;
        int iHashCode = 17;
        int i8 = 17;
        for (int i9 = 0; i9 < i6; i9++) {
            i8 = (i8 * 31) + iArr[i9];
        }
        int i10 = (i7 + i8) * 31;
        Object[] objArr = this.f13783c;
        int i11 = this.f13781a;
        for (int i12 = 0; i12 < i11; i12++) {
            iHashCode = (iHashCode * 31) + objArr[i12].hashCode();
        }
        return i10 + iHashCode;
    }
}
