package com.google.android.gms.internal.ads; import androidx.work.WorkInfo; import com.applovin.exoplayer2.common.base.Ascii; import java.io.IOException; import java.nio.ByteBuffer; import kotlin.jvm.internal.ByteCompanionObject; /* loaded from: classes3.dex */ final class zzgwn extends zzgwp { private final ByteBuffer zze; private final long zzf; private long zzg; private long zzh; private final long zzi; private int zzj; private int zzk; private int zzl; public /* synthetic */ zzgwn(ByteBuffer byteBuffer, boolean z, zzgwo zzgwoVar) { super(null); this.zzl = Integer.MAX_VALUE; this.zze = byteBuffer; long zze = zzhao.zze(byteBuffer); this.zzf = zze; this.zzg = byteBuffer.limit() + zze; long position = zze + byteBuffer.position(); this.zzh = position; this.zzi = position; } private final int zzC() { return (int) (this.zzg - this.zzh); } private final void zzI() { long j = this.zzg + this.zzj; this.zzg = j; int i = (int) (j - this.zzi); int i2 = this.zzl; if (i <= i2) { this.zzj = 0; return; } int i3 = i - i2; this.zzj = i3; this.zzg = j - i3; } @Override // com.google.android.gms.internal.ads.zzgwp public final boolean zzA() throws IOException { return this.zzh == this.zzg; } @Override // com.google.android.gms.internal.ads.zzgwp public final boolean zzB() throws IOException { return zzq() != 0; } @Override // com.google.android.gms.internal.ads.zzgwp public final double zza() throws IOException { return Double.longBitsToDouble(zzp()); } @Override // com.google.android.gms.internal.ads.zzgwp public final float zzb() throws IOException { return Float.intBitsToFloat(zzh()); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzc() { return (int) (this.zzh - this.zzi); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zze() throws IOException { return zzi(); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzf() throws IOException { return zzh(); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzg() throws IOException { return zzi(); } /* JADX WARN: Code restructure failed: missing block: B:33:0x0089, code lost: if (com.google.android.gms.internal.ads.zzhao.zza(r3) >= 0) goto L33; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final int zzi() throws java.io.IOException { /* r9 = this; long r0 = r9.zzh long r2 = r9.zzg int r2 = (r2 > r0 ? 1 : (r2 == r0 ? 0 : -1)) if (r2 != 0) goto La goto L92 La: r2 = 1 long r2 = r2 + r0 byte r4 = com.google.android.gms.internal.ads.zzhao.zza(r0) if (r4 < 0) goto L16 r9.zzh = r2 return r4 L16: long r5 = r9.zzg long r5 = r5 - r2 r7 = 9 int r5 = (r5 > r7 ? 1 : (r5 == r7 ? 0 : -1)) if (r5 < 0) goto L92 r5 = 2 long r5 = r5 + r0 byte r2 = com.google.android.gms.internal.ads.zzhao.zza(r2) int r2 = r2 << 7 r2 = r2 ^ r4 if (r2 >= 0) goto L2e r0 = r2 ^ (-128(0xffffffffffffff80, float:NaN)) goto L8f L2e: r3 = 3 long r3 = r3 + r0 byte r5 = com.google.android.gms.internal.ads.zzhao.zza(r5) int r5 = r5 << 14 r2 = r2 ^ r5 if (r2 < 0) goto L3e r0 = r2 ^ 16256(0x3f80, float:2.278E-41) L3c: r5 = r3 goto L8f L3e: r5 = 4 long r5 = r5 + r0 byte r3 = com.google.android.gms.internal.ads.zzhao.zza(r3) int r3 = r3 << 21 r2 = r2 ^ r3 if (r2 >= 0) goto L4f r0 = -2080896(0xffffffffffe03f80, float:NaN) r0 = r0 ^ r2 goto L8f L4f: r3 = 5 long r3 = r3 + r0 byte r5 = com.google.android.gms.internal.ads.zzhao.zza(r5) int r6 = r5 << 28 r2 = r2 ^ r6 r6 = 266354560(0xfe03f80, float:2.2112565E-29) r2 = r2 ^ r6 if (r5 >= 0) goto L8d r5 = 6 long r5 = r5 + r0 byte r3 = com.google.android.gms.internal.ads.zzhao.zza(r3) if (r3 >= 0) goto L8b r3 = 7 long r3 = r3 + r0 byte r5 = com.google.android.gms.internal.ads.zzhao.zza(r5) if (r5 >= 0) goto L8d r5 = 8 long r5 = r5 + r0 byte r3 = com.google.android.gms.internal.ads.zzhao.zza(r3) if (r3 >= 0) goto L8b long r3 = r0 + r7 byte r5 = com.google.android.gms.internal.ads.zzhao.zza(r5) if (r5 >= 0) goto L8d r5 = 10 long r5 = r5 + r0 byte r0 = com.google.android.gms.internal.ads.zzhao.zza(r3) if (r0 < 0) goto L92 L8b: r0 = r2 goto L8f L8d: r0 = r2 goto L3c L8f: r9.zzh = r5 return r0 L92: long r0 = r9.zzr() int r0 = (int) r0 return r0 */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.ads.zzgwn.zzi():int"); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzj() throws IOException { return zzh(); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzk() throws IOException { return zzgwp.zzD(zzi()); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzl() throws IOException { if (zzA()) { this.zzk = 0; return 0; } int zzi = zzi(); this.zzk = zzi; if ((zzi >>> 3) != 0) { return zzi; } throw new zzgyg("Protocol message contained an invalid tag (zero)."); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzm() throws IOException { return zzi(); } @Override // com.google.android.gms.internal.ads.zzgwp public final long zzn() throws IOException { return zzp(); } @Override // com.google.android.gms.internal.ads.zzgwp public final long zzo() throws IOException { return zzq(); } public final long zzq() throws IOException { long j; long j2; int i; long j3 = this.zzh; if (this.zzg != j3) { long j4 = 1 + j3; byte zza = zzhao.zza(j3); if (zza >= 0) { this.zzh = j4; return zza; } if (this.zzg - j4 >= 9) { long j5 = 2 + j3; int zza2 = (zzhao.zza(j4) << 7) ^ zza; if (zza2 >= 0) { long j6 = 3 + j3; int zza3 = zza2 ^ (zzhao.zza(j5) << Ascii.SO); if (zza3 >= 0) { j = zza3 ^ 16256; } else { j5 = 4 + j3; int zza4 = zza3 ^ (zzhao.zza(j6) << Ascii.NAK); if (zza4 < 0) { i = (-2080896) ^ zza4; } else { j6 = 5 + j3; long zza5 = (zzhao.zza(j5) << 28) ^ zza4; if (zza5 < 0) { long j7 = 6 + j3; long zza6 = (zzhao.zza(j6) << 35) ^ zza5; if (zza6 >= 0) { j5 = j3 + 7; long zza7 = zza6 ^ (zzhao.zza(j7) << 42); if (zza7 >= 0) { j = 4363953127296L ^ zza7; } else { j7 = 8 + j3; zza6 = zza7 ^ (zzhao.zza(j5) << 49); if (zza6 < 0) { j2 = -558586000294016L; } else { j5 = j3 + 9; long zza8 = (zza6 ^ (zzhao.zza(j7) << 56)) ^ 71499008037633920L; if (zza8 < 0) { long j8 = j3 + 10; if (zzhao.zza(j5) >= 0) { j5 = j8; } } j = zza8; } } this.zzh = j5; return j; } j2 = -34093383808L; j = j2 ^ zza6; j5 = j7; this.zzh = j5; return j; } j = 266354560 ^ zza5; } } j5 = j6; this.zzh = j5; return j; } i = zza2 ^ WorkInfo.STOP_REASON_FOREGROUND_SERVICE_TIMEOUT; j = i; this.zzh = j5; return j; } } return zzr(); } public final long zzr() throws IOException { long j = 0; for (int i = 0; i < 64; i += 7) { long j2 = this.zzh; if (j2 == this.zzg) { throw new zzgyg("While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."); } this.zzh = 1 + j2; j |= (r3 & Byte.MAX_VALUE) << i; if ((zzhao.zza(j2) & ByteCompanionObject.MIN_VALUE) == 0) { return j; } } throw new zzgyg("CodedInputStream encountered a malformed varint."); } @Override // com.google.android.gms.internal.ads.zzgwp public final long zzs() throws IOException { return zzp(); } @Override // com.google.android.gms.internal.ads.zzgwp public final long zzt() throws IOException { return zzgwp.zzF(zzq()); } @Override // com.google.android.gms.internal.ads.zzgwp public final long zzu() throws IOException { return zzq(); } @Override // com.google.android.gms.internal.ads.zzgwp public final zzgwj zzv() throws IOException { int zzi = zzi(); if (zzi <= 0 || zzi > zzC()) { if (zzi == 0) { return zzgwj.zzb; } if (zzi < 0) { throw new zzgyg("CodedInputStream encountered an embedded string or message which claimed to have negative size."); } throw new zzgyg("While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."); } byte[] bArr = new byte[zzi]; long j = zzi; zzhao.zzo(this.zzh, bArr, 0L, j); this.zzh += j; return new zzgwg(bArr); } @Override // com.google.android.gms.internal.ads.zzgwp public final String zzw() throws IOException { int zzi = zzi(); if (zzi <= 0 || zzi > zzC()) { if (zzi == 0) { return ""; } if (zzi < 0) { throw new zzgyg("CodedInputStream encountered an embedded string or message which claimed to have negative size."); } throw new zzgyg("While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."); } byte[] bArr = new byte[zzi]; long j = zzi; zzhao.zzo(this.zzh, bArr, 0L, j); String str = new String(bArr, zzgye.zza); this.zzh += j; return str; } @Override // com.google.android.gms.internal.ads.zzgwp public final String zzx() throws IOException { int zzi = zzi(); if (zzi > 0 && zzi <= zzC()) { String zzg = zzhat.zzg(this.zze, (int) (this.zzh - this.zzf), zzi); this.zzh += zzi; return zzg; } if (zzi == 0) { return ""; } if (zzi <= 0) { throw new zzgyg("CodedInputStream encountered an embedded string or message which claimed to have negative size."); } throw new zzgyg("While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."); } @Override // com.google.android.gms.internal.ads.zzgwp public final void zzy(int i) throws zzgyg { if (this.zzk != i) { throw new zzgyg("Protocol message end-group tag did not match expected tag."); } } @Override // com.google.android.gms.internal.ads.zzgwp public final void zzz(int i) { this.zzl = i; zzI(); } @Override // com.google.android.gms.internal.ads.zzgwp public final int zzd(int i) throws zzgyg { if (i < 0) { throw new zzgyg("CodedInputStream encountered an embedded string or message which claimed to have negative size."); } int zzc = i + zzc(); int i2 = this.zzl; if (zzc > i2) { throw new zzgyg("While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."); } this.zzl = zzc; zzI(); return i2; } public final int zzh() throws IOException { long j = this.zzh; if (this.zzg - j < 4) { throw new zzgyg("While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."); } this.zzh = 4 + j; int zza = zzhao.zza(j) & 255; int zza2 = zzhao.zza(1 + j) & 255; int zza3 = zzhao.zza(2 + j) & 255; return ((zzhao.zza(j + 3) & 255) << 24) | (zza2 << 8) | zza | (zza3 << 16); } public final long zzp() throws IOException { long j = this.zzh; if (this.zzg - j < 8) { throw new zzgyg("While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."); } this.zzh = 8 + j; long zza = zzhao.zza(j); long zza2 = zzhao.zza(1 + j); long zza3 = zzhao.zza(2 + j); long zza4 = zzhao.zza(3 + j); long zza5 = zzhao.zza(4 + j); return ((zzhao.zza(j + 7) & 255) << 56) | (zza & 255) | ((zza2 & 255) << 8) | ((zza3 & 255) << 16) | ((zza4 & 255) << 24) | ((zza5 & 255) << 32) | ((zzhao.zza(5 + j) & 255) << 40) | ((zzhao.zza(6 + j) & 255) << 48); } }