package com.google.android.gms.internal.firebase_ml; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /* loaded from: classes2.dex */ public abstract class zztl extends zzsv { private static final Logger logger = Logger.getLogger(zztl.class.getName()); private static final boolean zzbkz = zzxc.zztj(); zztn zzbla; public static int zzai(boolean z) { return 1; } public static int zzcw(int i) { if ((i & (-128)) == 0) { return 1; } if ((i & (-16384)) == 0) { return 2; } if (((-2097152) & i) == 0) { return 3; } return (i & (-268435456)) == 0 ? 4 : 5; } public static int zzcy(int i) { return 4; } public static int zzcz(int i) { return 4; } public static int zzd(double d) { return 8; } private static int zzdc(int i) { return (i << 1) ^ (i >> 31); } public static zztl zzg(byte[] bArr) { return new zza(bArr, 0, bArr.length); } public static int zzu(float f) { return 4; } public static int zzu(long j) { int i; if (((-128) & j) == 0) { return 1; } if (j < 0) { return 10; } if (((-34359738368L) & j) != 0) { j >>>= 28; i = 6; } else { i = 2; } if (((-2097152) & j) != 0) { i += 2; j >>>= 14; } return (j & (-16384)) != 0 ? i + 1 : i; } public static int zzw(long j) { return 8; } public static int zzx(long j) { return 8; } private static long zzy(long j) { return (j << 1) ^ (j >> 63); } public abstract void zza(int i, long j) throws IOException; public abstract void zza(int i, zzsw zzswVar) throws IOException; public abstract void zza(int i, zzvo zzvoVar) throws IOException; /* JADX INFO: Access modifiers changed from: package-private */ public abstract void zza(int i, zzvo zzvoVar, zzwe zzweVar) throws IOException; public abstract void zza(zzsw zzswVar) throws IOException; public abstract void zzb(int i, zzsw zzswVar) throws IOException; public abstract void zzb(int i, String str) throws IOException; public abstract void zzb(int i, boolean z) throws IOException; public abstract void zzb(zzvo zzvoVar) throws IOException; public abstract void zzc(int i, long j) throws IOException; public abstract void zzco(String str) throws IOException; public abstract void zzcq(int i) throws IOException; public abstract void zzcr(int i) throws IOException; public abstract void zzct(int i) throws IOException; public abstract void zzd(byte b) throws IOException; /* JADX INFO: Access modifiers changed from: package-private */ public abstract void zze(byte[] bArr, int i, int i2) throws IOException; public abstract void zzg(int i, int i2) throws IOException; public abstract void zzh(int i, int i2) throws IOException; public abstract void zzi(int i, int i2) throws IOException; public abstract void zzk(int i, int i2) throws IOException; public abstract void zzq(long j) throws IOException; public abstract int zzqe(); public abstract void zzs(long j) throws IOException; /* loaded from: classes2.dex */ public static final class zzb extends IOException { zzb() { super("CodedOutputStream was writing to a flat byte array and ran out of space."); } zzb(Throwable th) { super("CodedOutputStream was writing to a flat byte array and ran out of space.", th); } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public zzb(java.lang.String r3, java.lang.Throwable r4) { /* r2 = this; java.lang.String r3 = java.lang.String.valueOf(r3) int r0 = r3.length() java.lang.String r1 = "CodedOutputStream was writing to a flat byte array and ran out of space.: " if (r0 == 0) goto L11 java.lang.String r3 = r1.concat(r3) goto L16 L11: java.lang.String r3 = new java.lang.String r3.(r1) L16: r2.(r3, r4) return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.firebase_ml.zztl.zzb.(java.lang.String, java.lang.Throwable):void"); } } private zztl() { } public final void zzj(int i, int i2) throws IOException { zzi(i, zzdc(i2)); } public final void zzb(int i, long j) throws IOException { zza(i, zzy(j)); } public final void zza(int i, float f) throws IOException { zzk(i, Float.floatToRawIntBits(f)); } public final void zza(int i, double d) throws IOException { zzc(i, Double.doubleToRawLongBits(d)); } public final void zzcs(int i) throws IOException { zzcr(zzdc(i)); } /* loaded from: classes2.dex */ static final class zza extends zztl { private final byte[] buffer; private final int limit; private final int offset; private int position; zza(byte[] bArr, int i, int i2) { super(); if (bArr == null) { throw new NullPointerException("buffer"); } if (((bArr.length - i2) | i2) < 0) { throw new IllegalArgumentException(String.format("Array range is invalid. Buffer.length=%d, offset=%d, length=%d", Integer.valueOf(bArr.length), 0, Integer.valueOf(i2))); } this.buffer = bArr; this.offset = 0; this.position = 0; this.limit = i2; } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzg(int i, int i2) throws IOException { zzcr((i << 3) | i2); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzh(int i, int i2) throws IOException { zzg(i, 0); zzcq(i2); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzi(int i, int i2) throws IOException { zzg(i, 0); zzcr(i2); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzk(int i, int i2) throws IOException { zzg(i, 5); zzct(i2); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zza(int i, long j) throws IOException { zzg(i, 0); zzq(j); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzc(int i, long j) throws IOException { zzg(i, 1); zzs(j); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzb(int i, boolean z) throws IOException { zzg(i, 0); zzd(z ? (byte) 1 : (byte) 0); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzb(int i, String str) throws IOException { zzg(i, 2); zzco(str); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zza(int i, zzsw zzswVar) throws IOException { zzg(i, 2); zza(zzswVar); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zza(zzsw zzswVar) throws IOException { zzcr(zzswVar.size()); zzswVar.zza(this); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zze(byte[] bArr, int i, int i2) throws IOException { zzcr(i2); write(bArr, 0, i2); } @Override // com.google.android.gms.internal.firebase_ml.zztl final void zza(int i, zzvo zzvoVar, zzwe zzweVar) throws IOException { zzg(i, 2); zzsn zzsnVar = (zzsn) zzvoVar; int zzpq = zzsnVar.zzpq(); if (zzpq == -1) { zzpq = zzweVar.zzaa(zzsnVar); zzsnVar.zzch(zzpq); } zzcr(zzpq); zzweVar.zza(zzvoVar, this.zzbla); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zza(int i, zzvo zzvoVar) throws IOException { zzg(1, 3); zzi(2, i); zzg(3, 2); zzb(zzvoVar); zzg(1, 4); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzb(int i, zzsw zzswVar) throws IOException { zzg(1, 3); zzi(2, i); zza(3, zzswVar); zzg(1, 4); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzb(zzvo zzvoVar) throws IOException { zzcr(zzvoVar.zzqy()); zzvoVar.zzb(this); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzd(byte b) throws IOException { try { byte[] bArr = this.buffer; int i = this.position; this.position = i + 1; bArr[i] = b; } catch (IndexOutOfBoundsException e) { throw new zzb(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.position), Integer.valueOf(this.limit), 1), e); } } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzcq(int i) throws IOException { if (i >= 0) { zzcr(i); } else { zzq(i); } } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzcr(int i) throws IOException { if (zztl.zzbkz && zzqe() >= 10) { while ((i & (-128)) != 0) { byte[] bArr = this.buffer; int i2 = this.position; this.position = i2 + 1; zzxc.zza(bArr, i2, (byte) ((i & 127) | 128)); i >>>= 7; } byte[] bArr2 = this.buffer; int i3 = this.position; this.position = i3 + 1; zzxc.zza(bArr2, i3, (byte) i); return; } while ((i & (-128)) != 0) { try { byte[] bArr3 = this.buffer; int i4 = this.position; this.position = i4 + 1; bArr3[i4] = (byte) ((i & 127) | 128); i >>>= 7; } catch (IndexOutOfBoundsException e) { throw new zzb(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.position), Integer.valueOf(this.limit), 1), e); } } byte[] bArr4 = this.buffer; int i5 = this.position; this.position = i5 + 1; bArr4[i5] = (byte) i; } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzct(int i) throws IOException { try { byte[] bArr = this.buffer; int i2 = this.position; bArr[i2] = (byte) i; bArr[i2 + 1] = (byte) (i >> 8); bArr[i2 + 2] = (byte) (i >> 16); this.position = i2 + 4; bArr[i2 + 3] = (byte) (i >>> 24); } catch (IndexOutOfBoundsException e) { throw new zzb(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.position), Integer.valueOf(this.limit), 1), e); } } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzq(long j) throws IOException { if (zztl.zzbkz && zzqe() >= 10) { while ((j & (-128)) != 0) { byte[] bArr = this.buffer; int i = this.position; this.position = i + 1; zzxc.zza(bArr, i, (byte) ((((int) j) & 127) | 128)); j >>>= 7; } byte[] bArr2 = this.buffer; int i2 = this.position; this.position = i2 + 1; zzxc.zza(bArr2, i2, (byte) j); return; } while ((j & (-128)) != 0) { try { byte[] bArr3 = this.buffer; int i3 = this.position; this.position = i3 + 1; bArr3[i3] = (byte) ((((int) j) & 127) | 128); j >>>= 7; } catch (IndexOutOfBoundsException e) { throw new zzb(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.position), Integer.valueOf(this.limit), 1), e); } } byte[] bArr4 = this.buffer; int i4 = this.position; this.position = i4 + 1; bArr4[i4] = (byte) j; } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzs(long j) throws IOException { try { byte[] bArr = this.buffer; int i = this.position; bArr[i] = (byte) j; bArr[i + 1] = (byte) (j >> 8); bArr[i + 2] = (byte) (j >> 16); bArr[i + 3] = (byte) (j >> 24); bArr[i + 4] = (byte) (j >> 32); bArr[i + 5] = (byte) (j >> 40); bArr[i + 6] = (byte) (j >> 48); this.position = i + 8; bArr[i + 7] = (byte) (j >> 56); } catch (IndexOutOfBoundsException e) { throw new zzb(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.position), Integer.valueOf(this.limit), 1), e); } } private final void write(byte[] bArr, int i, int i2) throws IOException { try { System.arraycopy(bArr, i, this.buffer, this.position, i2); this.position += i2; } catch (IndexOutOfBoundsException e) { throw new zzb(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.position), Integer.valueOf(this.limit), Integer.valueOf(i2)), e); } } @Override // com.google.android.gms.internal.firebase_ml.zzsv public final void zzb(byte[] bArr, int i, int i2) throws IOException { write(bArr, i, i2); } @Override // com.google.android.gms.internal.firebase_ml.zztl public final void zzco(String str) throws IOException { int i = this.position; try { int zzcw = zzcw(str.length() * 3); int zzcw2 = zzcw(str.length()); if (zzcw2 == zzcw) { int i2 = i + zzcw2; this.position = i2; int zza = zzxe.zza(str, this.buffer, i2, zzqe()); this.position = i; zzcr((zza - i) - zzcw2); this.position = zza; return; } zzcr(zzxe.zzb(str)); this.position = zzxe.zza(str, this.buffer, this.position, zzqe()); } catch (zzxi e) { this.position = i; zza(str, e); } catch (IndexOutOfBoundsException e2) { throw new zzb(e2); } } @Override // com.google.android.gms.internal.firebase_ml.zztl public final int zzqe() { return this.limit - this.position; } } public final void zzr(long j) throws IOException { zzq(zzy(j)); } public final void zzt(float f) throws IOException { zzct(Float.floatToRawIntBits(f)); } public final void zzc(double d) throws IOException { zzs(Double.doubleToRawLongBits(d)); } public final void zzah(boolean z) throws IOException { zzd(z ? (byte) 1 : (byte) 0); } public static int zzl(int i, int i2) { return zzcu(i) + zzcv(i2); } public static int zzm(int i, int i2) { return zzcu(i) + zzcw(i2); } public static int zzn(int i, int i2) { return zzcu(i) + zzcw(zzdc(i2)); } public static int zzo(int i, int i2) { return zzcu(i) + 4; } public static int zzp(int i, int i2) { return zzcu(i) + 4; } public static int zzd(int i, long j) { return zzcu(i) + zzu(j); } public static int zze(int i, long j) { return zzcu(i) + zzu(j); } public static int zzf(int i, long j) { return zzcu(i) + zzu(zzy(j)); } public static int zzg(int i, long j) { return zzcu(i) + 8; } public static int zzh(int i, long j) { return zzcu(i) + 8; } public static int zzb(int i, float f) { return zzcu(i) + 4; } public static int zzb(int i, double d) { return zzcu(i) + 8; } public static int zzc(int i, boolean z) { return zzcu(i) + 1; } public static int zzq(int i, int i2) { return zzcu(i) + zzcv(i2); } public static int zzc(int i, String str) { return zzcu(i) + zzcp(str); } public static int zzc(int i, zzsw zzswVar) { int zzcu = zzcu(i); int size = zzswVar.size(); return zzcu + zzcw(size) + size; } public static int zza(int i, zzuv zzuvVar) { int zzcu = zzcu(i); int zzqy = zzuvVar.zzqy(); return zzcu + zzcw(zzqy) + zzqy; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzb(int i, zzvo zzvoVar, zzwe zzweVar) { return zzcu(i) + zza(zzvoVar, zzweVar); } public static int zzb(int i, zzvo zzvoVar) { return (zzcu(1) << 1) + zzm(2, i) + zzcu(3) + zzc(zzvoVar); } public static int zzd(int i, zzsw zzswVar) { return (zzcu(1) << 1) + zzm(2, i) + zzc(3, zzswVar); } public static int zzb(int i, zzuv zzuvVar) { return (zzcu(1) << 1) + zzm(2, i) + zza(3, zzuvVar); } public static int zzcu(int i) { return zzcw(i << 3); } public static int zzcv(int i) { if (i >= 0) { return zzcw(i); } return 10; } public static int zzcx(int i) { return zzcw(zzdc(i)); } public static int zzt(long j) { return zzu(j); } public static int zzv(long j) { return zzu(zzy(j)); } public static int zzda(int i) { return zzcv(i); } public static int zzcp(String str) { int length; try { length = zzxe.zzb(str); } catch (zzxi unused) { length = str.getBytes(zzug.UTF_8).length; } return zzcw(length) + length; } public static int zza(zzuv zzuvVar) { int zzqy = zzuvVar.zzqy(); return zzcw(zzqy) + zzqy; } public static int zzb(zzsw zzswVar) { int size = zzswVar.size(); return zzcw(size) + size; } public static int zzh(byte[] bArr) { int length = bArr.length; return zzcw(length) + length; } public static int zzc(zzvo zzvoVar) { int zzqy = zzvoVar.zzqy(); return zzcw(zzqy) + zzqy; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(zzvo zzvoVar, zzwe zzweVar) { zzsn zzsnVar = (zzsn) zzvoVar; int zzpq = zzsnVar.zzpq(); if (zzpq == -1) { zzpq = zzweVar.zzaa(zzsnVar); zzsnVar.zzch(zzpq); } return zzcw(zzpq) + zzpq; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzdb(int i) { return zzcw(i) + i; } public final void zzqf() { if (zzqe() != 0) { throw new IllegalStateException("Did not write as much data as expected."); } } final void zza(String str, zzxi zzxiVar) throws IOException { logger.logp(Level.WARNING, "com.google.protobuf.CodedOutputStream", "inefficientWriteStringNoTag", "Converting ill-formed UTF-16. Your Protocol Buffer will not round trip correctly!", (Throwable) zzxiVar); byte[] bytes = str.getBytes(zzug.UTF_8); try { zzcr(bytes.length); zzb(bytes, 0, bytes.length); } catch (zzb e) { throw e; } catch (IndexOutOfBoundsException e2) { throw new zzb(e2); } } /* JADX INFO: Access modifiers changed from: package-private */ @Deprecated public static int zzc(int i, zzvo zzvoVar, zzwe zzweVar) { int zzcu = zzcu(i); zzsn zzsnVar = (zzsn) zzvoVar; int zzpq = zzsnVar.zzpq(); if (zzpq == -1) { zzpq = zzweVar.zzaa(zzsnVar); zzsnVar.zzch(zzpq); } return (zzcu << 1) + zzpq; } @Deprecated public static int zzd(zzvo zzvoVar) { return zzvoVar.zzqy(); } @Deprecated public static int zzdd(int i) { return zzcw(i); } }