package o; import com.google.common.base.Ascii; import com.google.common.primitives.UnsignedBytes; import com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException; import java.io.IOException; import java.util.Arrays; /* loaded from: classes2.dex */ public abstract class SXg { private static volatile int e = 100; int a; JpZ b; private boolean c; int d; private int j; public abstract void a() throws InvalidProtocolBufferException; public abstract boolean a(int i) throws IOException; public abstract boolean b() throws IOException; public abstract boolean c() throws IOException; public abstract int d(); public abstract void d(int i); public abstract int e(int i) throws InvalidProtocolBufferException; public abstract jra e() throws IOException; public abstract float f() throws IOException; public abstract int g() throws IOException; public abstract long h() throws IOException; public abstract double i() throws IOException; public abstract int j() throws IOException; public abstract int k() throws IOException; public abstract int l() throws IOException; public abstract long m() throws IOException; public abstract long n() throws IOException; abstract long o() throws IOException; public abstract String p() throws IOException; public abstract long q() throws IOException; public abstract int r() throws IOException; public abstract int s() throws IOException; public abstract String t() throws IOException; public abstract long v() throws IOException; public abstract int y() throws IOException; /* synthetic */ SXg(byte b) { this(); } /* JADX INFO: Access modifiers changed from: package-private */ public static SXg e(byte[] bArr, int i, int i2, boolean z) { RVV rvv = new RVV(bArr, i, i2, z, (byte) 0); try { rvv.e(i2); return rvv; } catch (InvalidProtocolBufferException e2) { throw new IllegalArgumentException(e2); } } private SXg() { this.d = e; this.j = Integer.MAX_VALUE; this.c = false; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class RVV extends SXg { private final byte[] c; private int e; private final boolean f; private int g; private int h; private boolean i; private int j; private int m; /* renamed from: o, reason: collision with root package name */ private int f8364o; /* synthetic */ RVV(byte[] bArr, int i, int i2, boolean z, byte b) { this(bArr, i, i2, z); } private RVV(byte[] bArr, int i, int i2, boolean z) { super((byte) 0); this.j = Integer.MAX_VALUE; this.c = bArr; this.h = i2 + i; this.f8364o = i; this.m = i; this.f = z; } @Override // o.SXg public final void a() throws InvalidProtocolBufferException { if (this.g != 0) { throw InvalidProtocolBufferException.e(); } } @Override // o.SXg public final boolean a(int i) throws IOException { int r; int e = C15775iXO.e(i); int i2 = 0; if (e == 0) { if (this.h - this.f8364o >= 10) { while (i2 < 10) { byte[] bArr = this.c; int i3 = this.f8364o; this.f8364o = i3 + 1; if (bArr[i3] < 0) { i2++; } } throw InvalidProtocolBufferException.a(); } while (i2 < 10) { if (x() < 0) { i2++; } } throw InvalidProtocolBufferException.a(); return true; } if (e == 1) { b(8); return true; } if (e == 2) { b(z()); return true; } if (e != 3) { if (e == 4) { return false; } if (e == 5) { b(4); return true; } throw InvalidProtocolBufferException.d(); } do { r = r(); if (r == 0) { break; } } while (a(r)); if (this.g == C15775iXO.b(C15775iXO.d(i), 4)) { return true; } throw InvalidProtocolBufferException.e(); } @Override // o.SXg public final double i() throws IOException { return Double.longBitsToDouble(D()); } @Override // o.SXg public final float f() throws IOException { return Float.intBitsToFloat(u()); } @Override // o.SXg public final long v() throws IOException { return A(); } @Override // o.SXg public final long n() throws IOException { return A(); } @Override // o.SXg public final int l() throws IOException { return z(); } @Override // o.SXg public final long h() throws IOException { return D(); } @Override // o.SXg public final int g() throws IOException { return u(); } @Override // o.SXg public final boolean c() throws IOException { return A() != 0; } @Override // o.SXg public final String t() throws IOException { int z = z(); if (z > 0) { int i = this.h; int i2 = this.f8364o; if (z <= i - i2) { String str = new String(this.c, i2, z, oZe.b); this.f8364o += z; return str; } } if (z == 0) { return ""; } if (z < 0) { throw InvalidProtocolBufferException.i(); } throw InvalidProtocolBufferException.h(); } @Override // o.SXg public final String p() throws IOException { int z = z(); if (z > 0) { int i = this.h; int i2 = this.f8364o; if (z <= i - i2) { String c = iEH.c(this.c, i2, z); this.f8364o += z; return c; } } if (z == 0) { return ""; } if (z <= 0) { throw InvalidProtocolBufferException.i(); } throw InvalidProtocolBufferException.h(); } @Override // o.SXg public final jra e() throws IOException { byte[] bArr; int z = z(); if (z > 0) { int i = this.h; int i2 = this.f8364o; if (z <= i - i2) { jra d = jra.d(this.c, i2, z); this.f8364o += z; return d; } } if (z == 0) { return jra.d; } if (z > 0) { int i3 = this.h; int i4 = this.f8364o; if (z <= i3 - i4) { int i5 = z + i4; this.f8364o = i5; bArr = Arrays.copyOfRange(this.c, i4, i5); return jra.b(bArr); } } if (z > 0) { throw InvalidProtocolBufferException.h(); } if (z == 0) { bArr = oZe.d; return jra.b(bArr); } throw InvalidProtocolBufferException.i(); } @Override // o.SXg public final int y() throws IOException { return z(); } @Override // o.SXg public final int j() throws IOException { return z(); } @Override // o.SXg public final int k() throws IOException { return u(); } @Override // o.SXg public final long m() throws IOException { return D(); } @Override // o.SXg public final int s() throws IOException { int z = z(); return (z >>> 1) ^ (-(z & 1)); } @Override // o.SXg public final long q() throws IOException { long A = A(); return (A >>> 1) ^ (-(1 & A)); } private int z() throws IOException { int i; int i2 = this.f8364o; int i3 = this.h; if (i3 != i2) { byte[] bArr = this.c; int i4 = i2 + 1; byte b = bArr[i2]; if (b >= 0) { this.f8364o = i4; return b; } if (i3 - i4 >= 9) { int i5 = i2 + 2; int i6 = (bArr[i4] << 7) ^ b; if (i6 < 0) { i = i6 ^ (-128); } else { int i7 = i2 + 3; int i8 = (bArr[i5] << 14) ^ i6; if (i8 >= 0) { i = i8 ^ 16256; } else { int i9 = i2 + 4; int i10 = i8 ^ (bArr[i7] << Ascii.NAK); if (i10 < 0) { i = (-2080896) ^ i10; } else { i7 = i2 + 5; byte b2 = bArr[i9]; int i11 = (i10 ^ (b2 << 28)) ^ 266354560; if (b2 < 0) { i9 = i2 + 6; if (bArr[i7] < 0) { i7 = i2 + 7; if (bArr[i9] < 0) { i9 = i2 + 8; if (bArr[i7] < 0) { i7 = i2 + 9; if (bArr[i9] < 0) { if (bArr[i7] >= 0) { i5 = i2 + 10; i = i11; } } } } } i = i11; } i = i11; } i5 = i9; } i5 = i7; } this.f8364o = i5; return i; } } return (int) o(); } private long A() throws IOException { long j; long j2; long j3; int i = this.f8364o; int i2 = this.h; if (i2 != i) { byte[] bArr = this.c; int i3 = i + 1; byte b = bArr[i]; if (b >= 0) { this.f8364o = i3; return b; } if (i2 - i3 >= 9) { int i4 = i + 2; int i5 = (bArr[i3] << 7) ^ b; if (i5 < 0) { j = i5 ^ (-128); } else { int i6 = i + 3; int i7 = (bArr[i4] << 14) ^ i5; if (i7 >= 0) { j = i7 ^ 16256; i4 = i6; } else { int i8 = i + 4; int i9 = i7 ^ (bArr[i6] << Ascii.NAK); if (i9 < 0) { long j4 = (-2080896) ^ i9; i4 = i8; j = j4; } else { long j5 = i9; i4 = i + 5; long j6 = j5 ^ (bArr[i8] << 28); if (j6 >= 0) { j3 = 266354560; } else { int i10 = i + 6; long j7 = j6 ^ (bArr[i4] << 35); if (j7 < 0) { j2 = -34093383808L; } else { i4 = i + 7; j6 = j7 ^ (bArr[i10] << 42); if (j6 >= 0) { j3 = 4363953127296L; } else { i10 = i + 8; j7 = j6 ^ (bArr[i4] << 49); if (j7 < 0) { j2 = -558586000294016L; } else { i4 = i + 9; long j8 = (j7 ^ (bArr[i10] << 56)) ^ 71499008037633920L; if (j8 < 0) { if (bArr[i4] >= 0) { i4 = i + 10; } } j = j8; } } } j = j7 ^ j2; i4 = i10; } j = j6 ^ j3; } } } this.f8364o = i4; return j; } } return o(); } @Override // o.SXg final long o() throws IOException { long j = 0; for (int i = 0; i < 64; i += 7) { j |= (r3 & Ascii.DEL) << i; if ((x() & 128) == 0) { return j; } } throw InvalidProtocolBufferException.a(); } private int u() throws IOException { int i = this.f8364o; if (this.h - i < 4) { throw InvalidProtocolBufferException.h(); } byte[] bArr = this.c; this.f8364o = i + 4; 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); } private long D() throws IOException { int i = this.f8364o; if (this.h - i < 8) { throw InvalidProtocolBufferException.h(); } byte[] bArr = this.c; this.f8364o = i + 8; return ((bArr[i + 7] & 255) << 56) | (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); } @Override // o.SXg public final void d(int i) { this.j = i; w(); } private byte x() throws IOException { int i = this.f8364o; if (i == this.h) { throw InvalidProtocolBufferException.h(); } byte[] bArr = this.c; this.f8364o = i + 1; return bArr[i]; } private void b(int i) throws IOException { if (i >= 0) { int i2 = this.h; int i3 = this.f8364o; if (i <= i2 - i3) { this.f8364o = i3 + i; return; } } if (i < 0) { throw InvalidProtocolBufferException.i(); } throw InvalidProtocolBufferException.h(); } @Override // o.SXg public final int e(int i) throws InvalidProtocolBufferException { if (i < 0) { throw InvalidProtocolBufferException.i(); } int i2 = i + (this.f8364o - this.m); if (i2 >= 0) { int i3 = this.j; if (i2 > i3) { throw InvalidProtocolBufferException.h(); } this.j = i2; w(); return i3; } throw InvalidProtocolBufferException.f(); } @Override // o.SXg public final int r() throws IOException { if (this.f8364o == this.h) { this.g = 0; return 0; } int z = z(); this.g = z; if (C15775iXO.d(z) != 0) { return this.g; } throw InvalidProtocolBufferException.c(); } @Override // o.SXg public final boolean b() throws IOException { return this.f8364o == this.h; } @Override // o.SXg public final int d() { return this.f8364o - this.m; } private void w() { int i = this.h + this.e; this.h = i; int i2 = i - this.m; int i3 = this.j; if (i2 <= i3) { this.e = 0; return; } int i4 = i2 - i3; this.e = i4; this.h = i - i4; } } }