package com.google.android.gms.internal.vision; import com.google.android.gms.internal.vision.zzfy; import java.io.IOException; import java.util.Arrays; /* loaded from: classes2.dex */ public final class zzip { private static final zzip zzaas = new zzip(0, new int[0], new Object[0], false); private int count; private int[] zzaat; private boolean zzrl; private int zzwk; private Object[] zzze; /* JADX INFO: Access modifiers changed from: package-private */ public static zzip zzhf() { return new zzip(); } /* JADX INFO: Access modifiers changed from: package-private */ public static zzip zza(zzip zzipVar, zzip zzipVar2) { int i = zzipVar.count + zzipVar2.count; int[] copyOf = Arrays.copyOf(zzipVar.zzaat, i); System.arraycopy(zzipVar2.zzaat, 0, copyOf, zzipVar.count, zzipVar2.count); Object[] copyOf2 = Arrays.copyOf(zzipVar.zzze, i); System.arraycopy(zzipVar2.zzze, 0, copyOf2, zzipVar.count, zzipVar2.count); return new zzip(i, copyOf, copyOf2, true); } private zzip() { this(0, new int[8], new Object[8], true); } private zzip(int i, int[] iArr, Object[] objArr, boolean z) { this.zzwk = -1; this.count = i; this.zzaat = iArr; this.zzze = objArr; this.zzrl = z; } /* JADX INFO: Access modifiers changed from: package-private */ public final void zza(zzjj zzjjVar) throws IOException { if (zzjjVar.zzed() == zzfy.zzg.zzxj) { for (int i = this.count - 1; i >= 0; i--) { zzjjVar.zza(this.zzaat[i] >>> 3, this.zzze[i]); } return; } for (int i2 = 0; i2 < this.count; i2++) { zzjjVar.zza(this.zzaat[i2] >>> 3, this.zzze[i2]); } } public final void zzb(zzjj zzjjVar) throws IOException { if (this.count == 0) { return; } if (zzjjVar.zzed() == zzfy.zzg.zzxi) { for (int i = 0; i < this.count; i++) { zzb(this.zzaat[i], this.zzze[i], zzjjVar); } return; } for (int i2 = this.count - 1; i2 >= 0; i2--) { zzb(this.zzaat[i2], this.zzze[i2], zzjjVar); } } private static void zzb(int i, Object obj, zzjj zzjjVar) throws IOException { int i2 = i >>> 3; int i3 = i & 7; if (i3 == 0) { zzjjVar.zzi(i2, ((Long) obj).longValue()); return; } if (i3 == 1) { zzjjVar.zzc(i2, ((Long) obj).longValue()); return; } if (i3 == 2) { zzjjVar.zza(i2, (zzeo) obj); return; } if (i3 != 3) { if (i3 == 5) { zzjjVar.zzh(i2, ((Integer) obj).intValue()); return; } throw new RuntimeException(zzgf.zzfm()); } if (zzjjVar.zzed() == zzfy.zzg.zzxi) { zzjjVar.zzbe(i2); ((zzip) obj).zzb(zzjjVar); zzjjVar.zzbf(i2); } else { zzjjVar.zzbf(i2); ((zzip) obj).zzb(zzjjVar); zzjjVar.zzbe(i2); } } public final int zzhg() { int i = this.zzwk; if (i != -1) { return i; } int i2 = 0; for (int i3 = 0; i3 < this.count; i3++) { i2 += zzfe.zzd(this.zzaat[i3] >>> 3, (zzeo) this.zzze[i3]); } this.zzwk = i2; return i2; } public final int zzeq() { int zze; int i = this.zzwk; if (i != -1) { return i; } int i2 = 0; for (int i3 = 0; i3 < this.count; i3++) { int i4 = this.zzaat[i3]; int i5 = i4 >>> 3; int i6 = i4 & 7; if (i6 == 0) { zze = zzfe.zze(i5, ((Long) this.zzze[i3]).longValue()); } else if (i6 == 1) { zze = zzfe.zzg(i5, ((Long) this.zzze[i3]).longValue()); } else if (i6 == 2) { zze = zzfe.zzc(i5, (zzeo) this.zzze[i3]); } else if (i6 == 3) { zze = (zzfe.zzav(i5) << 1) + ((zzip) this.zzze[i3]).zzeq(); } else if (i6 == 5) { zze = zzfe.zzl(i5, ((Integer) this.zzze[i3]).intValue()); } else { throw new IllegalStateException(zzgf.zzfm()); } i2 += zze; } this.zzwk = i2; return i2; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof zzip)) { return false; } zzip zzipVar = (zzip) obj; int i = this.count; if (i == zzipVar.count) { int[] iArr = this.zzaat; int[] iArr2 = zzipVar.zzaat; int i2 = 0; while (true) { if (i2 < i) { if (iArr[i2] != iArr2[i2]) { break; } i2++; } else { Object[] objArr = this.zzze; Object[] objArr2 = zzipVar.zzze; int i3 = this.count; for (int i4 = 0; i4 < i3; i4++) { if (objArr[i4].equals(objArr2[i4])) { } } return true; } } } return false; } public final int hashCode() { int i = this.count; int[] iArr = this.zzaat; int i2 = 17; int i3 = 17; for (int i4 = 0; i4 < i; i4++) { i3 = (i3 * 31) + iArr[i4]; } Object[] objArr = this.zzze; int i5 = this.count; for (int i6 = 0; i6 < i5; i6++) { i2 = (i2 * 31) + objArr[i6].hashCode(); } return ((((i + 527) * 31) + i3) * 31) + i2; } /* JADX INFO: Access modifiers changed from: package-private */ public final void zza(StringBuilder sb, int i) { for (int i2 = 0; i2 < this.count; i2++) { zzhi.zza(sb, i, String.valueOf(this.zzaat[i2] >>> 3), this.zzze[i2]); } } /* JADX INFO: Access modifiers changed from: package-private */ public final void zzb(int i, Object obj) { if (!this.zzrl) { throw new UnsupportedOperationException(); } int i2 = this.count; int[] iArr = this.zzaat; if (i2 == iArr.length) { int i3 = i2 + (i2 < 4 ? 8 : i2 >> 1); this.zzaat = Arrays.copyOf(iArr, i3); this.zzze = Arrays.copyOf(this.zzze, i3); } int[] iArr2 = this.zzaat; int i4 = this.count; iArr2[i4] = i; this.zzze[i4] = obj; this.count = i4 + 1; } public final void zzci() { this.zzrl = false; } public static zzip zzhe() { return zzaas; } }