package o; import com.google.crypto.tink.shaded.protobuf.CodedOutputStream; import com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException; import java.io.IOException; import java.util.Arrays; import o.MLB; /* loaded from: classes2.dex */ public final class pTc { private static final pTc i = new pTc(0, new int[0], new Object[0], false); boolean a; Object[] b; int c; int[] d; int e; /* JADX INFO: Access modifiers changed from: package-private */ public static pTc b() { return new pTc(); } /* JADX INFO: Access modifiers changed from: package-private */ public static pTc a(pTc ptc, pTc ptc2) { int i2 = ptc.c + ptc2.c; int[] copyOf = Arrays.copyOf(ptc.d, i2); System.arraycopy(ptc2.d, 0, copyOf, ptc.c, ptc2.c); Object[] copyOf2 = Arrays.copyOf(ptc.b, i2); System.arraycopy(ptc2.b, 0, copyOf2, ptc.c, ptc2.c); return new pTc(i2, copyOf, copyOf2, true); } private pTc() { this(0, new int[8], new Object[8], true); } private pTc(int i2, int[] iArr, Object[] objArr, boolean z) { this.e = -1; this.c = i2; this.d = iArr; this.b = objArr; this.a = z; } public final void a(MLB mlb) throws IOException { if (this.c == 0) { return; } if (mlb.d() == MLB.Sts.ASCENDING) { for (int i2 = 0; i2 < this.c; i2++) { c(this.d[i2], this.b[i2], mlb); } return; } for (int i3 = this.c - 1; i3 >= 0; i3--) { c(this.d[i3], this.b[i3], mlb); } } private static void c(int i2, Object obj, MLB mlb) throws IOException { int d = C15775iXO.d(i2); int e = C15775iXO.e(i2); if (e == 0) { mlb.d(d, ((Long) obj).longValue()); return; } if (e == 1) { mlb.a(d, ((Long) obj).longValue()); return; } if (e == 2) { mlb.d(d, (jra) obj); return; } if (e != 3) { if (e == 5) { mlb.e(d, ((Integer) obj).intValue()); return; } throw new RuntimeException(InvalidProtocolBufferException.d()); } if (mlb.d() == MLB.Sts.ASCENDING) { mlb.d(d); ((pTc) obj).a(mlb); mlb.c(d); } else { mlb.c(d); ((pTc) obj).a(mlb); mlb.d(d); } } public final int c() { int e; int i2 = this.e; if (i2 != -1) { return i2; } int i3 = 0; for (int i4 = 0; i4 < this.c; i4++) { int i5 = this.d[i4]; int d = C15775iXO.d(i5); int e2 = C15775iXO.e(i5); if (e2 == 0) { e = CodedOutputStream.e(d, ((Long) this.b[i4]).longValue()); } else if (e2 == 1) { e = CodedOutputStream.b(d); } else if (e2 == 2) { e = CodedOutputStream.d(d, (jra) this.b[i4]); } else if (e2 == 3) { e = (CodedOutputStream.m(d) << 1) + ((pTc) this.b[i4]).c(); } else if (e2 == 5) { e = CodedOutputStream.a(d); } else { throw new IllegalStateException(InvalidProtocolBufferException.d()); } i3 += e; } this.e = i3; return i3; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof pTc)) { return false; } pTc ptc = (pTc) obj; int i2 = this.c; if (i2 == ptc.c) { int[] iArr = this.d; int[] iArr2 = ptc.d; int i3 = 0; while (true) { if (i3 >= i2) { Object[] objArr = this.b; Object[] objArr2 = ptc.b; int i4 = this.c; for (int i5 = 0; i5 < i4; i5++) { if (objArr[i5].equals(objArr2[i5])) { } } return true; } if (iArr[i3] != iArr2[i3]) { break; } i3++; } } return false; } /* JADX INFO: Access modifiers changed from: package-private */ public final void e(StringBuilder sb, int i2) { for (int i3 = 0; i3 < this.c; i3++) { C7474cox.c(sb, i2, String.valueOf(C15775iXO.d(this.d[i3])), this.b[i3]); } } /* JADX INFO: Access modifiers changed from: package-private */ public final void c(int i2, Object obj) { if (this.a) { a(); int[] iArr = this.d; int i3 = this.c; iArr[i3] = i2; this.b[i3] = obj; this.c = i3 + 1; return; } throw new UnsupportedOperationException(); } private void a() { int i2 = this.c; int[] iArr = this.d; if (i2 == iArr.length) { int i3 = i2 + (i2 < 4 ? 8 : i2 >> 1); this.d = Arrays.copyOf(iArr, i3); this.b = Arrays.copyOf(this.b, i3); } } public final int hashCode() { int i2 = this.c; int[] iArr = this.d; int i3 = 17; int i4 = 17; for (int i5 = 0; i5 < i2; i5++) { i4 = (i4 * 31) + iArr[i5]; } Object[] objArr = this.b; int i6 = this.c; int i7 = (((i2 + 527) * 31) + i4) * 31; for (int i8 = 0; i8 < i6; i8++) { i3 = (i3 * 31) + objArr[i8].hashCode(); } return i7 + i3; } public static pTc e() { return i; } }