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

import java.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public final class e0 {

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

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

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

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

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

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

    public e0(int i, int[] iArr, Object[] objArr, boolean z8) {
        this.f10487a = i;
        this.f10488b = iArr;
        this.f10489c = objArr;
        this.f10491e = z8;
    }

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

    public final void a(int i) {
        int[] iArr = this.f10488b;
        if (i > iArr.length) {
            int i5 = this.f10487a;
            int i8 = (i5 / 2) + i5;
            if (i8 >= i) {
                i = i8;
            }
            if (i < 8) {
                i = 8;
            }
            this.f10488b = Arrays.copyOf(iArr, i);
            this.f10489c = Arrays.copyOf(this.f10489c, i);
        }
    }

    public final int b() {
        int iV;
        int iX;
        int iR;
        int i = this.f10490d;
        if (i != -1) {
            return i;
        }
        int i5 = 0;
        for (int i8 = 0; i8 < this.f10487a; i8++) {
            int i9 = this.f10488b[i8];
            int i10 = i9 >>> 3;
            int i11 = i9 & 7;
            if (i11 != 0) {
                if (i11 == 1) {
                    ((Long) this.f10489c[i8]).getClass();
                    iR = C0745k.R(i10);
                } else if (i11 == 2) {
                    iR = C0745k.O(i10, (AbstractC0742h) this.f10489c[i8]);
                } else if (i11 == 3) {
                    iV = C0745k.V(i10) * 2;
                    iX = ((e0) this.f10489c[i8]).b();
                } else {
                    if (i11 != 5) {
                        throw new IllegalStateException(B.c());
                    }
                    ((Integer) this.f10489c[i8]).getClass();
                    iR = C0745k.Q(i10);
                }
                i5 = iR + i5;
            } else {
                long jLongValue = ((Long) this.f10489c[i8]).longValue();
                iV = C0745k.V(i10);
                iX = C0745k.X(jLongValue);
            }
            i5 = iX + iV + i5;
        }
        this.f10490d = i5;
        return i5;
    }

    public final void d(int i, Object obj) {
        if (!this.f10491e) {
            throw new UnsupportedOperationException();
        }
        a(this.f10487a + 1);
        int[] iArr = this.f10488b;
        int i5 = this.f10487a;
        iArr[i5] = i;
        this.f10489c[i5] = obj;
        this.f10487a = i5 + 1;
    }

    public final void e(K k8) throws F0.t {
        if (this.f10487a == 0) {
            return;
        }
        k8.getClass();
        for (int i = 0; i < this.f10487a; i++) {
            int i5 = this.f10488b[i];
            Object obj = this.f10489c[i];
            int i8 = i5 >>> 3;
            int i9 = i5 & 7;
            C0745k c0745k = (C0745k) k8.f10442a;
            if (i9 == 0) {
                c0745k.h0(((Long) obj).longValue(), i8);
            } else if (i9 == 1) {
                c0745k.c0(((Long) obj).longValue(), i8);
            } else if (i9 == 2) {
                k8.a(i8, (AbstractC0742h) obj);
            } else if (i9 == 3) {
                c0745k.f0(i8, 3);
                ((e0) obj).e(k8);
                c0745k.f0(i8, 4);
            } else {
                if (i9 != 5) {
                    throw new RuntimeException(B.c());
                }
                c0745k.a0(i8, ((Integer) obj).intValue());
            }
        }
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof e0)) {
            return false;
        }
        e0 e0Var = (e0) obj;
        int i = this.f10487a;
        if (i == e0Var.f10487a) {
            int[] iArr = this.f10488b;
            int[] iArr2 = e0Var.f10488b;
            int i5 = 0;
            while (true) {
                if (i5 >= i) {
                    Object[] objArr = this.f10489c;
                    Object[] objArr2 = e0Var.f10489c;
                    int i8 = this.f10487a;
                    for (int i9 = 0; i9 < i8; i9++) {
                        if (objArr[i9].equals(objArr2[i9])) {
                        }
                    }
                    return true;
                }
                if (iArr[i5] != iArr2[i5]) {
                    break;
                }
                i5++;
            }
        }
        return false;
    }

    public final int hashCode() {
        int i = this.f10487a;
        int i5 = (527 + i) * 31;
        int[] iArr = this.f10488b;
        int iHashCode = 17;
        int i8 = 17;
        for (int i9 = 0; i9 < i; i9++) {
            i8 = (i8 * 31) + iArr[i9];
        }
        int i10 = (i5 + i8) * 31;
        Object[] objArr = this.f10489c;
        int i11 = this.f10487a;
        for (int i12 = 0; i12 < i11; i12++) {
            iHashCode = (iHashCode * 31) + objArr[i12].hashCode();
        }
        return i10 + iHashCode;
    }
}
