package com.google.android.gms.internal.measurement; import com.google.android.gms.internal.measurement.zzuo; import java.io.IOException; import java.util.Arrays; /* loaded from: classes.dex */ public final class zzxe { private static final zzxe f = new zzxe(0, new int[0], new Object[0], false); private int a; private int[] b; private Object[] c; private int d; private boolean e; private zzxe() { this(0, new int[8], new Object[8], true); } static zzxe a(zzxe zzxeVar, zzxe zzxeVar2) { int i = zzxeVar.a + zzxeVar2.a; int[] copyOf = Arrays.copyOf(zzxeVar.b, i); System.arraycopy(zzxeVar2.b, 0, copyOf, zzxeVar.a, zzxeVar2.a); Object[] copyOf2 = Arrays.copyOf(zzxeVar.c, i); System.arraycopy(zzxeVar2.c, 0, copyOf2, zzxeVar.a, zzxeVar2.a); return new zzxe(i, copyOf, copyOf2, true); } public static zzxe d() { return f; } static zzxe e() { return new zzxe(); } public final void b(zzxy zzxyVar) throws IOException { if (this.a == 0) { return; } if (zzxyVar.a() == zzuo.zze.k) { for (int i = 0; i < this.a; i++) { a(this.b[i], this.c[i], zzxyVar); } return; } for (int i2 = this.a - 1; i2 >= 0; i2--) { a(this.b[i2], this.c[i2], zzxyVar); } } public final int c() { int i = this.d; if (i != -1) { return i; } int i2 = 0; for (int i3 = 0; i3 < this.a; i3++) { i2 += zztv.d(this.b[i3] >>> 3, (zzte) this.c[i3]); } this.d = i2; return i2; } public final boolean equals(Object obj) { boolean z; boolean z2; if (this == obj) { return true; } if (obj == null || !(obj instanceof zzxe)) { return false; } zzxe zzxeVar = (zzxe) obj; int i = this.a; if (i == zzxeVar.a) { int[] iArr = this.b; int[] iArr2 = zzxeVar.b; int i2 = 0; while (true) { if (i2 >= i) { z = true; break; } if (iArr[i2] != iArr2[i2]) { z = false; break; } i2++; } if (z) { Object[] objArr = this.c; Object[] objArr2 = zzxeVar.c; int i3 = this.a; int i4 = 0; while (true) { if (i4 >= i3) { z2 = true; break; } if (!objArr[i4].equals(objArr2[i4])) { z2 = false; break; } i4++; } if (z2) { return true; } } } return false; } public final int hashCode() { int i = this.a; int i2 = (i + 527) * 31; int[] iArr = this.b; int i3 = 17; int i4 = 17; for (int i5 = 0; i5 < i; i5++) { i4 = (i4 * 31) + iArr[i5]; } int i6 = (i2 + i4) * 31; Object[] objArr = this.c; int i7 = this.a; for (int i8 = 0; i8 < i7; i8++) { i3 = (i3 * 31) + objArr[i8].hashCode(); } return i6 + i3; } private zzxe(int i, int[] iArr, Object[] objArr, boolean z) { this.d = -1; this.a = i; this.b = iArr; this.c = objArr; this.e = z; } public final void a() { this.e = false; } public final int b() { int e; int i = this.d; if (i != -1) { return i; } int i2 = 0; for (int i3 = 0; i3 < this.a; i3++) { int i4 = this.b[i3]; int i5 = i4 >>> 3; int i6 = i4 & 7; if (i6 == 0) { e = zztv.e(i5, ((Long) this.c[i3]).longValue()); } else if (i6 == 1) { e = zztv.g(i5, ((Long) this.c[i3]).longValue()); } else if (i6 == 2) { e = zztv.c(i5, (zzte) this.c[i3]); } else if (i6 == 3) { e = (zztv.e(i5) << 1) + ((zzxe) this.c[i3]).b(); } else if (i6 == 5) { e = zztv.i(i5, ((Integer) this.c[i3]).intValue()); } else { throw new IllegalStateException(zzuv.zzwu()); } i2 += e; } this.d = i2; return i2; } final void a(zzxy zzxyVar) throws IOException { if (zzxyVar.a() == zzuo.zze.l) { for (int i = this.a - 1; i >= 0; i--) { zzxyVar.a(this.b[i] >>> 3, this.c[i]); } return; } for (int i2 = 0; i2 < this.a; i2++) { zzxyVar.a(this.b[i2] >>> 3, this.c[i2]); } } private static void a(int i, Object obj, zzxy zzxyVar) throws IOException { int i2 = i >>> 3; int i3 = i & 7; if (i3 == 0) { zzxyVar.d(i2, ((Long) obj).longValue()); return; } if (i3 == 1) { zzxyVar.c(i2, ((Long) obj).longValue()); return; } if (i3 == 2) { zzxyVar.a(i2, (zzte) obj); return; } if (i3 != 3) { if (i3 == 5) { zzxyVar.d(i2, ((Integer) obj).intValue()); return; } throw new RuntimeException(zzuv.zzwu()); } if (zzxyVar.a() == zzuo.zze.k) { zzxyVar.b(i2); ((zzxe) obj).b(zzxyVar); zzxyVar.a(i2); } else { zzxyVar.a(i2); ((zzxe) obj).b(zzxyVar); zzxyVar.b(i2); } } final void a(StringBuilder sb, int i) { for (int i2 = 0; i2 < this.a; i2++) { zzvy.a(sb, i, String.valueOf(this.b[i2] >>> 3), this.c[i2]); } } final void a(int i, Object obj) { if (this.e) { int i2 = this.a; if (i2 == this.b.length) { int i3 = this.a + (i2 < 4 ? 8 : i2 >> 1); this.b = Arrays.copyOf(this.b, i3); this.c = Arrays.copyOf(this.c, i3); } int[] iArr = this.b; int i4 = this.a; iArr[i4] = i; this.c[i4] = obj; this.a = i4 + 1; return; } throw new UnsupportedOperationException(); } }