package com.google.protobuf;

import java.util.Arrays;

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

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

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

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

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

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

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

    public T0() {
        this(0, new int[8], new Object[8], true);
    }

    public static T0 e(T0 t02, T0 t03) {
        int i6 = t02.f14226a + t03.f14226a;
        int[] iArrCopyOf = Arrays.copyOf(t02.f14227b, i6);
        System.arraycopy(t03.f14227b, 0, iArrCopyOf, t02.f14226a, t03.f14226a);
        Object[] objArrCopyOf = Arrays.copyOf(t02.f14228c, i6);
        System.arraycopy(t03.f14228c, 0, objArrCopyOf, t02.f14226a, t03.f14226a);
        return new T0(i6, iArrCopyOf, objArrCopyOf, true);
    }

    public final void a() {
        if (!this.f14230e) {
            throw new UnsupportedOperationException();
        }
    }

    public final void b(int i6) {
        int[] iArr = this.f14227b;
        if (i6 > iArr.length) {
            int i7 = this.f14226a;
            int i8 = (i7 / 2) + i7;
            if (i8 >= i6) {
                i6 = i8;
            }
            if (i6 < 8) {
                i6 = 8;
            }
            this.f14227b = Arrays.copyOf(iArr, i6);
            this.f14228c = Arrays.copyOf(this.f14228c, i6);
        }
    }

    public final int c() {
        int iD;
        int iF;
        int iD2;
        int i6 = this.f14229d;
        if (i6 != -1) {
            return i6;
        }
        int i7 = 0;
        for (int i8 = 0; i8 < this.f14226a; i8++) {
            int i9 = this.f14227b[i8];
            int i10 = i9 >>> 3;
            int i11 = i9 & 7;
            if (i11 != 0) {
                if (i11 == 1) {
                    ((Long) this.f14228c[i8]).getClass();
                    iD2 = AbstractC1335v.D(i10) + 8;
                } else if (i11 == 2) {
                    iD2 = AbstractC1335v.z(i10, (AbstractC1320n) this.f14228c[i8]);
                } else if (i11 == 3) {
                    iD = AbstractC1335v.D(i10) * 2;
                    iF = ((T0) this.f14228c[i8]).c();
                } else {
                    if (i11 != 5) {
                        throw new IllegalStateException(C1297b0.d());
                    }
                    ((Integer) this.f14228c[i8]).getClass();
                    iD2 = AbstractC1335v.D(i10) + 4;
                }
                i7 = iD2 + i7;
            } else {
                long jLongValue = ((Long) this.f14228c[i8]).longValue();
                iD = AbstractC1335v.D(i10);
                iF = AbstractC1335v.F(jLongValue);
            }
            i7 = iF + iD + i7;
        }
        this.f14229d = i7;
        return i7;
    }

    public final boolean d(int i6, AbstractC1329s abstractC1329s) throws C1295a0 {
        int iZ;
        a();
        int i7 = i6 >>> 3;
        int i8 = i6 & 7;
        if (i8 == 0) {
            f(i6, Long.valueOf(abstractC1329s.r()));
            return true;
        }
        if (i8 == 1) {
            f(i6, Long.valueOf(abstractC1329s.o()));
            return true;
        }
        if (i8 == 2) {
            f(i6, abstractC1329s.k());
            return true;
        }
        if (i8 != 3) {
            if (i8 == 4) {
                return false;
            }
            if (i8 != 5) {
                throw C1297b0.d();
            }
            f(i6, Integer.valueOf(abstractC1329s.n()));
            return true;
        }
        T0 t02 = new T0();
        do {
            iZ = abstractC1329s.z();
            if (iZ == 0) {
                break;
            }
        } while (t02.d(iZ, abstractC1329s));
        abstractC1329s.a((i7 << 3) | 4);
        f(i6, t02);
        return true;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof T0)) {
            return false;
        }
        T0 t02 = (T0) obj;
        int i6 = this.f14226a;
        if (i6 == t02.f14226a) {
            int[] iArr = this.f14227b;
            int[] iArr2 = t02.f14227b;
            int i7 = 0;
            while (true) {
                if (i7 >= i6) {
                    Object[] objArr = this.f14228c;
                    Object[] objArr2 = t02.f14228c;
                    int i8 = this.f14226a;
                    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 void f(int i6, Object obj) {
        a();
        b(this.f14226a + 1);
        int[] iArr = this.f14227b;
        int i7 = this.f14226a;
        iArr[i7] = i6;
        this.f14228c[i7] = obj;
        this.f14226a = i7 + 1;
    }

    public final void g(C1317l0 c1317l0) {
        if (this.f14226a == 0) {
            return;
        }
        c1317l0.getClass();
        for (int i6 = 0; i6 < this.f14226a; i6++) {
            int i7 = this.f14227b[i6];
            Object obj = this.f14228c[i6];
            int i8 = i7 >>> 3;
            int i9 = i7 & 7;
            AbstractC1335v abstractC1335v = (AbstractC1335v) c1317l0.f14296a;
            if (i9 == 0) {
                abstractC1335v.Z(i8, ((Long) obj).longValue());
            } else if (i9 == 1) {
                abstractC1335v.O(i8, ((Long) obj).longValue());
            } else if (i9 == 2) {
                abstractC1335v.K(i8, (AbstractC1320n) obj);
            } else if (i9 == 3) {
                abstractC1335v.W(i8, 3);
                ((T0) obj).g(c1317l0);
                abstractC1335v.W(i8, 4);
            } else {
                if (i9 != 5) {
                    throw new RuntimeException(C1297b0.d());
                }
                abstractC1335v.M(i8, ((Integer) obj).intValue());
            }
        }
    }

    public final int hashCode() {
        int i6 = this.f14226a;
        int i7 = (527 + i6) * 31;
        int[] iArr = this.f14227b;
        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.f14228c;
        int i11 = this.f14226a;
        for (int i12 = 0; i12 < i11; i12++) {
            iHashCode = (iHashCode * 31) + objArr[i12].hashCode();
        }
        return i10 + iHashCode;
    }

    public T0(int i6, int[] iArr, Object[] objArr, boolean z6) {
        this.f14229d = -1;
        this.f14226a = i6;
        this.f14227b = iArr;
        this.f14228c = objArr;
        this.f14230e = z6;
    }
}
