package com.google.android.gms.internal.vision; 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 zzeh { /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(byte[] bArr, int i, zzei zzeiVar) { int i2 = i + 1; byte b = bArr[i]; if (b >= 0) { zzeiVar.zzro = b; return i2; } return zza(b, bArr, i2, zzeiVar); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, zzei zzeiVar) { int i3 = i & 127; int i4 = i2 + 1; byte b = bArr[i2]; if (b >= 0) { zzeiVar.zzro = i3 | (b << 7); return i4; } int i5 = i3 | ((b & Ascii.DEL) << 7); int i6 = i2 + 2; byte b2 = bArr[i4]; if (b2 >= 0) { zzeiVar.zzro = i5 | (b2 << 14); return i6; } int i7 = i5 | ((b2 & Ascii.DEL) << 14); int i8 = i2 + 3; byte b3 = bArr[i6]; if (b3 >= 0) { zzeiVar.zzro = i7 | (b3 << Ascii.NAK); return i8; } int i9 = i7 | ((b3 & Ascii.DEL) << 21); int i10 = i2 + 4; byte b4 = bArr[i8]; if (b4 >= 0) { zzeiVar.zzro = i9 | (b4 << 28); return i10; } while (true) { int i11 = i10 + 1; if (bArr[i10] >= 0) { zzeiVar.zzro = 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, zzei zzeiVar) { int i2 = i + 1; long j = bArr[i]; if (j >= 0) { zzeiVar.zzrp = 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++; } zzeiVar.zzrp = 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, zzei zzeiVar) throws zzgf { int zza = zza(bArr, i, zzeiVar); int i2 = zzeiVar.zzro; if (i2 < 0) { throw zzgf.zzfi(); } if (i2 == 0) { zzeiVar.zzrq = ""; return zza; } zzeiVar.zzrq = new String(bArr, zza, i2, zzga.UTF_8); return zza + i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzd(byte[] bArr, int i, zzei zzeiVar) throws zzgf { int zza = zza(bArr, i, zzeiVar); int i2 = zzeiVar.zzro; if (i2 < 0) { throw zzgf.zzfi(); } if (i2 == 0) { zzeiVar.zzrq = ""; return zza; } zzeiVar.zzrq = zziw.zzi(bArr, zza, i2); return zza + i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zze(byte[] bArr, int i, zzei zzeiVar) throws zzgf { int zza = zza(bArr, i, zzeiVar); int i2 = zzeiVar.zzro; if (i2 < 0) { throw zzgf.zzfi(); } if (i2 > bArr.length - zza) { throw zzgf.zzfh(); } if (i2 == 0) { zzeiVar.zzrq = zzeo.zzrx; return zza; } zzeiVar.zzrq = zzeo.zzb(bArr, zza, i2); return zza + i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, int i3, zzge zzgeVar, zzei zzeiVar) { zzfz zzfzVar = (zzfz) zzgeVar; int zza = zza(bArr, i2, zzeiVar); zzfzVar.zzbg(zzeiVar.zzro); while (zza < i3) { int zza2 = zza(bArr, zza, zzeiVar); if (i != zzeiVar.zzro) { break; } zza = zza(bArr, zza2, zzeiVar); zzfzVar.zzbg(zzeiVar.zzro); } return zza; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(byte[] bArr, int i, zzge zzgeVar, zzei zzeiVar) throws IOException { zzfz zzfzVar = (zzfz) zzgeVar; int zza = zza(bArr, i, zzeiVar); int i2 = zzeiVar.zzro + zza; while (zza < i2) { zza = zza(bArr, zza, zzeiVar); zzfzVar.zzbg(zzeiVar.zzro); } if (zza == i2) { return zza; } throw zzgf.zzfh(); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, int i3, zzip zzipVar, zzei zzeiVar) throws zzgf { if ((i >>> 3) == 0) { throw zzgf.zzfk(); } int i4 = i & 7; if (i4 == 0) { int zzb = zzb(bArr, i2, zzeiVar); zzipVar.zzb(i, Long.valueOf(zzeiVar.zzrp)); return zzb; } if (i4 == 1) { zzipVar.zzb(i, Long.valueOf(zzb(bArr, i2))); return i2 + 8; } if (i4 == 2) { int zza = zza(bArr, i2, zzeiVar); int i5 = zzeiVar.zzro; if (i5 < 0) { throw zzgf.zzfi(); } if (i5 > bArr.length - zza) { throw zzgf.zzfh(); } if (i5 == 0) { zzipVar.zzb(i, zzeo.zzrx); } else { zzipVar.zzb(i, zzeo.zzb(bArr, zza, i5)); } return zza + i5; } if (i4 != 3) { if (i4 == 5) { zzipVar.zzb(i, Integer.valueOf(zza(bArr, i2))); return i2 + 4; } throw zzgf.zzfk(); } zzip zzhf = zzip.zzhf(); int i6 = (i & (-8)) | 4; int i7 = 0; while (true) { if (i2 >= i3) { break; } int zza2 = zza(bArr, i2, zzeiVar); int i8 = zzeiVar.zzro; if (i8 == i6) { i7 = i8; i2 = zza2; break; } i7 = i8; i2 = zza(i8, bArr, zza2, i3, zzhf, zzeiVar); } if (i2 > i3 || i7 != i6) { throw zzgf.zzfo(); } zzipVar.zzb(i, zzhf); return i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(int i, byte[] bArr, int i2, int i3, zzei zzeiVar) throws zzgf { if ((i >>> 3) == 0) { throw zzgf.zzfk(); } int i4 = i & 7; if (i4 == 0) { return zzb(bArr, i2, zzeiVar); } if (i4 == 1) { return i2 + 8; } if (i4 == 2) { return zza(bArr, i2, zzeiVar) + zzeiVar.zzro; } if (i4 != 3) { if (i4 == 5) { return i2 + 4; } throw zzgf.zzfk(); } int i5 = (i & (-8)) | 4; int i6 = 0; while (i2 < i3) { i2 = zza(bArr, i2, zzeiVar); i6 = zzeiVar.zzro; if (i6 == i5) { break; } i2 = zza(i6, bArr, i2, i3, zzeiVar); } if (i2 > i3 || i6 != i5) { throw zzgf.zzfo(); } return i2; } }