package com.google.android.gms.internal.firebase_ml; import com.google.android.gms.internal.firebase_ml.zzue; import java.io.IOException; import java.util.Arrays; /* loaded from: classes2.dex */ public final class zzwx { private static final zzwx zzbsm = new zzwx(0, new int[0], new Object[0], false); private int count; private boolean zzbkd; private int zzboi; private Object[] zzbqy; private int[] zzbsn; /* JADX INFO: Access modifiers changed from: package-private */ public static zzwx zzth() { return new zzwx(); } /* JADX INFO: Access modifiers changed from: package-private */ public static zzwx zza(zzwx zzwxVar, zzwx zzwxVar2) { int i = zzwxVar.count + zzwxVar2.count; int[] copyOf = Arrays.copyOf(zzwxVar.zzbsn, i); System.arraycopy(zzwxVar2.zzbsn, 0, copyOf, zzwxVar.count, zzwxVar2.count); Object[] copyOf2 = Arrays.copyOf(zzwxVar.zzbqy, i); System.arraycopy(zzwxVar2.zzbqy, 0, copyOf2, zzwxVar.count, zzwxVar2.count); return new zzwx(i, copyOf, copyOf2, true); } private zzwx() { this(0, new int[8], new Object[8], true); } private zzwx(int i, int[] iArr, Object[] objArr, boolean z) { this.zzboi = -1; this.count = i; this.zzbsn = iArr; this.zzbqy = objArr; this.zzbkd = z; } /* JADX INFO: Access modifiers changed from: package-private */ public final void zza(zzxr zzxrVar) throws IOException { if (zzxrVar.zzqh() == zzue.zzf.zzbpa) { for (int i = this.count - 1; i >= 0; i--) { zzxrVar.zza(this.zzbsn[i] >>> 3, this.zzbqy[i]); } return; } for (int i2 = 0; i2 < this.count; i2++) { zzxrVar.zza(this.zzbsn[i2] >>> 3, this.zzbqy[i2]); } } public final void zzb(zzxr zzxrVar) throws IOException { if (this.count == 0) { return; } if (zzxrVar.zzqh() == zzue.zzf.zzboz) { for (int i = 0; i < this.count; i++) { zzb(this.zzbsn[i], this.zzbqy[i], zzxrVar); } return; } for (int i2 = this.count - 1; i2 >= 0; i2--) { zzb(this.zzbsn[i2], this.zzbqy[i2], zzxrVar); } } private static void zzb(int i, Object obj, zzxr zzxrVar) throws IOException { int i2 = i >>> 3; int i3 = i & 7; if (i3 == 0) { zzxrVar.zzi(i2, ((Long) obj).longValue()); return; } if (i3 == 1) { zzxrVar.zzc(i2, ((Long) obj).longValue()); return; } if (i3 == 2) { zzxrVar.zza(i2, (zzsw) obj); return; } if (i3 != 3) { if (i3 == 5) { zzxrVar.zzk(i2, ((Integer) obj).intValue()); return; } throw new RuntimeException(zzuo.zzrp()); } if (zzxrVar.zzqh() == zzue.zzf.zzboz) { zzxrVar.zzde(i2); ((zzwx) obj).zzb(zzxrVar); zzxrVar.zzdf(i2); } else { zzxrVar.zzdf(i2); ((zzwx) obj).zzb(zzxrVar); zzxrVar.zzde(i2); } } public final int zzti() { int i = this.zzboi; if (i != -1) { return i; } int i2 = 0; for (int i3 = 0; i3 < this.count; i3++) { i2 += zztl.zzd(this.zzbsn[i3] >>> 3, (zzsw) this.zzbqy[i3]); } this.zzboi = i2; return i2; } public final int zzqy() { int zze; int i = this.zzboi; if (i != -1) { return i; } int i2 = 0; for (int i3 = 0; i3 < this.count; i3++) { int i4 = this.zzbsn[i3]; int i5 = i4 >>> 3; int i6 = i4 & 7; if (i6 == 0) { zze = zztl.zze(i5, ((Long) this.zzbqy[i3]).longValue()); } else if (i6 == 1) { zze = zztl.zzg(i5, ((Long) this.zzbqy[i3]).longValue()); } else if (i6 == 2) { zze = zztl.zzc(i5, (zzsw) this.zzbqy[i3]); } else if (i6 == 3) { zze = (zztl.zzcu(i5) << 1) + ((zzwx) this.zzbqy[i3]).zzqy(); } else if (i6 == 5) { zze = zztl.zzo(i5, ((Integer) this.zzbqy[i3]).intValue()); } else { throw new IllegalStateException(zzuo.zzrp()); } i2 += zze; } this.zzboi = i2; return i2; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof zzwx)) { return false; } zzwx zzwxVar = (zzwx) obj; int i = this.count; if (i == zzwxVar.count) { int[] iArr = this.zzbsn; int[] iArr2 = zzwxVar.zzbsn; int i2 = 0; while (true) { if (i2 < i) { if (iArr[i2] != iArr2[i2]) { break; } i2++; } else { Object[] objArr = this.zzbqy; Object[] objArr2 = zzwxVar.zzbqy; 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.zzbsn; int i2 = 17; int i3 = 17; for (int i4 = 0; i4 < i; i4++) { i3 = (i3 * 31) + iArr[i4]; } Object[] objArr = this.zzbqy; 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 zzb(StringBuilder sb, int i) { for (int i2 = 0; i2 < this.count; i2++) { zzvr.zza(sb, i, String.valueOf(this.zzbsn[i2] >>> 3), this.zzbqy[i2]); } } /* JADX INFO: Access modifiers changed from: package-private */ public final void zzb(int i, Object obj) { if (!this.zzbkd) { throw new UnsupportedOperationException(); } int i2 = this.count; int[] iArr = this.zzbsn; if (i2 == iArr.length) { int i3 = i2 + (i2 < 4 ? 8 : i2 >> 1); this.zzbsn = Arrays.copyOf(iArr, i3); this.zzbqy = Arrays.copyOf(this.zzbqy, i3); } int[] iArr2 = this.zzbsn; int i4 = this.count; iArr2[i4] = i; this.zzbqy[i4] = obj; this.count = i4 + 1; } public final void zzpt() { this.zzbkd = false; } public static zzwx zztg() { return zzbsm; } }