package com.google.android.gms.internal.firebase_ml; import com.google.common.base.Ascii; import com.google.common.primitives.UnsignedBytes; import java.io.IOException; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class zzss { /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(byte[] bArr, int i, zzst zzstVar) { int i2 = i + 1; byte b = bArr[i]; if (b >= 0) { zzstVar.zzbkg = b; return i2; } return zza(b, bArr, i2, zzstVar); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, zzst zzstVar) { int i3 = i & 127; int i4 = i2 + 1; byte b = bArr[i2]; if (b >= 0) { zzstVar.zzbkg = i3 | (b << 7); return i4; } int i5 = i3 | ((b & Ascii.DEL) << 7); int i6 = i2 + 2; byte b2 = bArr[i4]; if (b2 >= 0) { zzstVar.zzbkg = i5 | (b2 << 14); return i6; } int i7 = i5 | ((b2 & Ascii.DEL) << 14); int i8 = i2 + 3; byte b3 = bArr[i6]; if (b3 >= 0) { zzstVar.zzbkg = i7 | (b3 << Ascii.NAK); return i8; } int i9 = i7 | ((b3 & Ascii.DEL) << 21); int i10 = i2 + 4; byte b4 = bArr[i8]; if (b4 >= 0) { zzstVar.zzbkg = i9 | (b4 << 28); return i10; } while (true) { int i11 = i10 + 1; if (bArr[i10] >= 0) { zzstVar.zzbkg = i9 | ((b4 & Ascii.DEL) << 28); return i11; } i10 = i11; } } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzb(byte[] bArr, int i, zzst zzstVar) { int i2 = i + 1; long j = bArr[i]; if (j >= 0) { zzstVar.zzbkh = j; return i2; } int i3 = i + 2; byte b = bArr[i2]; long j2 = (j & 127) | ((b & Ascii.DEL) << 7); int i4 = 7; while (b < 0) { b = bArr[i3]; i4 += 7; j2 |= (b & Ascii.DEL) << i4; i3++; } zzstVar.zzbkh = j2; return i3; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(byte[] bArr, int i) { return ((bArr[i + 3] & UnsignedBytes.MAX_VALUE) << 24) | (bArr[i] & UnsignedBytes.MAX_VALUE) | ((bArr[i + 1] & UnsignedBytes.MAX_VALUE) << 8) | ((bArr[i + 2] & UnsignedBytes.MAX_VALUE) << 16); } /* JADX INFO: Access modifiers changed from: package-private */ public static long zzb(byte[] bArr, int i) { return (bArr[i] & 255) | ((bArr[i + 1] & 255) << 8) | ((bArr[i + 2] & 255) << 16) | ((bArr[i + 3] & 255) << 24) | ((bArr[i + 4] & 255) << 32) | ((bArr[i + 5] & 255) << 40) | ((bArr[i + 6] & 255) << 48) | ((bArr[i + 7] & 255) << 56); } /* JADX INFO: Access modifiers changed from: package-private */ public static double zzc(byte[] bArr, int i) { return Double.longBitsToDouble(zzb(bArr, i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static float zzd(byte[] bArr, int i) { return Float.intBitsToFloat(zza(bArr, i)); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzc(byte[] bArr, int i, zzst zzstVar) throws zzuo { int zza = zza(bArr, i, zzstVar); int i2 = zzstVar.zzbkg; if (i2 < 0) { throw zzuo.zzrn(); } if (i2 == 0) { zzstVar.zzbki = ""; return zza; } zzstVar.zzbki = new String(bArr, zza, i2, zzug.UTF_8); return zza + i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzd(byte[] bArr, int i, zzst zzstVar) throws zzuo { int zza = zza(bArr, i, zzstVar); int i2 = zzstVar.zzbkg; if (i2 < 0) { throw zzuo.zzrn(); } if (i2 == 0) { zzstVar.zzbki = ""; return zza; } zzstVar.zzbki = zzxe.zzh(bArr, zza, i2); return zza + i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zze(byte[] bArr, int i, zzst zzstVar) throws zzuo { int zza = zza(bArr, i, zzstVar); int i2 = zzstVar.zzbkg; if (i2 < 0) { throw zzuo.zzrn(); } if (i2 > bArr.length - zza) { throw zzuo.zzrm(); } if (i2 == 0) { zzstVar.zzbki = zzsw.zzbkl; return zza; } zzstVar.zzbki = zzsw.zzc(bArr, zza, i2); return zza + i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(zzwe zzweVar, byte[] bArr, int i, int i2, zzst zzstVar) throws IOException { int i3 = i + 1; int i4 = bArr[i]; if (i4 < 0) { i3 = zza(i4, bArr, i3, zzstVar); i4 = zzstVar.zzbkg; } int i5 = i3; if (i4 < 0 || i4 > i2 - i5) { throw zzuo.zzrm(); } Object newInstance = zzweVar.newInstance(); int i6 = i4 + i5; zzweVar.zza(newInstance, bArr, i5, i6, zzstVar); zzweVar.zzq(newInstance); zzstVar.zzbki = newInstance; return i6; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(zzwe zzweVar, byte[] bArr, int i, int i2, int i3, zzst zzstVar) throws IOException { zzvs zzvsVar = (zzvs) zzweVar; Object newInstance = zzvsVar.newInstance(); int zza = zzvsVar.zza((zzvs) newInstance, bArr, i, i2, i3, zzstVar); zzvsVar.zzq(newInstance); zzstVar.zzbki = newInstance; return zza; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, int i3, zzun zzunVar, zzst zzstVar) { zzuf zzufVar = (zzuf) zzunVar; int zza = zza(bArr, i2, zzstVar); zzufVar.zzdh(zzstVar.zzbkg); while (zza < i3) { int zza2 = zza(bArr, zza, zzstVar); if (i != zzstVar.zzbkg) { break; } zza = zza(bArr, zza2, zzstVar); zzufVar.zzdh(zzstVar.zzbkg); } return zza; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(byte[] bArr, int i, zzun zzunVar, zzst zzstVar) throws IOException { zzuf zzufVar = (zzuf) zzunVar; int zza = zza(bArr, i, zzstVar); int i2 = zzstVar.zzbkg + zza; while (zza < i2) { zza = zza(bArr, zza, zzstVar); zzufVar.zzdh(zzstVar.zzbkg); } if (zza == i2) { return zza; } throw zzuo.zzrm(); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(zzwe zzweVar, int i, byte[] bArr, int i2, int i3, zzun zzunVar, zzst zzstVar) throws IOException { int zza = zza(zzweVar, bArr, i2, i3, zzstVar); zzunVar.add(zzstVar.zzbki); while (zza < i3) { int zza2 = zza(bArr, zza, zzstVar); if (i != zzstVar.zzbkg) { break; } zza = zza(zzweVar, bArr, zza2, i3, zzstVar); zzunVar.add(zzstVar.zzbki); } return zza; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, int i3, zzwx zzwxVar, zzst zzstVar) throws zzuo { if ((i >>> 3) == 0) { throw zzuo.zzro(); } int i4 = i & 7; if (i4 == 0) { int zzb = zzb(bArr, i2, zzstVar); zzwxVar.zzb(i, Long.valueOf(zzstVar.zzbkh)); return zzb; } if (i4 == 1) { zzwxVar.zzb(i, Long.valueOf(zzb(bArr, i2))); return i2 + 8; } if (i4 == 2) { int zza = zza(bArr, i2, zzstVar); int i5 = zzstVar.zzbkg; if (i5 < 0) { throw zzuo.zzrn(); } if (i5 > bArr.length - zza) { throw zzuo.zzrm(); } if (i5 == 0) { zzwxVar.zzb(i, zzsw.zzbkl); } else { zzwxVar.zzb(i, zzsw.zzc(bArr, zza, i5)); } return zza + i5; } if (i4 != 3) { if (i4 == 5) { zzwxVar.zzb(i, Integer.valueOf(zza(bArr, i2))); return i2 + 4; } throw zzuo.zzro(); } zzwx zzth = zzwx.zzth(); int i6 = (i & (-8)) | 4; int i7 = 0; while (true) { if (i2 >= i3) { break; } int zza2 = zza(bArr, i2, zzstVar); int i8 = zzstVar.zzbkg; if (i8 == i6) { i7 = i8; i2 = zza2; break; } i7 = i8; i2 = zza(i8, bArr, zza2, i3, zzth, zzstVar); } if (i2 > i3 || i7 != i6) { throw zzuo.zzrq(); } zzwxVar.zzb(i, zzth); return i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, int i3, zzst zzstVar) throws zzuo { if ((i >>> 3) == 0) { throw zzuo.zzro(); } int i4 = i & 7; if (i4 == 0) { return zzb(bArr, i2, zzstVar); } if (i4 == 1) { return i2 + 8; } if (i4 == 2) { return zza(bArr, i2, zzstVar) + zzstVar.zzbkg; } if (i4 != 3) { if (i4 == 5) { return i2 + 4; } throw zzuo.zzro(); } int i5 = (i & (-8)) | 4; int i6 = 0; while (i2 < i3) { i2 = zza(bArr, i2, zzstVar); i6 = zzstVar.zzbkg; if (i6 == i5) { break; } i2 = zza(i6, bArr, i2, i3, zzstVar); } if (i2 > i3 || i6 != i5) { throw zzuo.zzrq(); } return i2; } }