what-the-bank/sources/o/cKE.java

1927 lines
60 KiB
Java

package o;
import com.google.common.base.Ascii;
import com.google.common.primitives.UnsignedBytes;
import com.google.protobuf.InvalidProtocolBufferException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes2.dex */
public abstract class cKE {
private static volatile int a = 100;
int b;
int c;
public int d;
uCO e;
private boolean i;
public static long b(long j) {
return (j >>> 1) ^ (-(1 & j));
}
public static int c(int i) {
return (i >>> 1) ^ (-(i & 1));
}
public abstract boolean a() throws IOException;
public abstract boolean b() throws IOException;
public abstract boolean b(int i) throws IOException;
public abstract QwV c() throws IOException;
public abstract int d();
public abstract int d(int i) throws InvalidProtocolBufferException;
public abstract void e() throws InvalidProtocolBufferException;
public abstract void e(int i);
public abstract double f() throws IOException;
public abstract long g() throws IOException;
public abstract int h() throws IOException;
public abstract float i() throws IOException;
public abstract int j() throws IOException;
public abstract long k() throws IOException;
public abstract int l() throws IOException;
public abstract int m() throws IOException;
abstract long n() throws IOException;
public abstract long o() throws IOException;
public abstract long p() throws IOException;
public abstract int q() throws IOException;
public abstract String 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 */ cKE(byte b) {
this();
}
/* JADX INFO: Access modifiers changed from: package-private */
public static cKE a(Iterable<ByteBuffer> iterable) {
int i = 0;
int i2 = 0;
for (ByteBuffer byteBuffer : iterable) {
i2 += byteBuffer.remaining();
if (byteBuffer.hasArray()) {
i |= 1;
} else {
i = byteBuffer.isDirect() ? i | 2 : i | 4;
}
}
if (i == 2) {
return new RVV(iterable, i2);
}
return new LWm(new MZr(iterable));
}
public static cKE a(byte[] bArr) {
int length = bArr.length;
return c(bArr, 0, 0, false);
}
public static cKE a(byte[] bArr, int i, int i2) {
return c(bArr, 0, i2, false);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static cKE c(byte[] bArr, int i, int i2, boolean z) {
HBt hBt = new HBt(bArr, i, i2, z, (byte) 0);
try {
hBt.d(i2);
return hBt;
} catch (InvalidProtocolBufferException e) {
throw new IllegalArgumentException(e);
}
}
private cKE() {
this.c = a;
this.d = Integer.MAX_VALUE;
this.i = false;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public static final class HBt extends cKE {
private final byte[] a;
private int f;
private int g;
private int h;
private final boolean i;
private boolean j;
private int l;
private int n;
/* renamed from: o, reason: collision with root package name */
private int f8607o;
/* synthetic */ HBt(byte[] bArr, int i, int i2, boolean z, byte b) {
this(bArr, i, i2, z);
}
private HBt(byte[] bArr, int i, int i2, boolean z) {
super((byte) 0);
this.f = Integer.MAX_VALUE;
this.a = bArr;
this.n = i2 + i;
this.l = i;
this.f8607o = i;
this.i = z;
}
@Override // o.cKE
public final void e() throws InvalidProtocolBufferException {
if (this.g != 0) {
throw InvalidProtocolBufferException.c();
}
}
@Override // o.cKE
public final boolean b(int i) throws IOException {
int s;
int c = Nvr.c(i);
int i2 = 0;
if (c == 0) {
if (this.n - this.l >= 10) {
while (i2 < 10) {
byte[] bArr = this.a;
int i3 = this.l;
this.l = i3 + 1;
if (bArr[i3] < 0) {
i2++;
}
}
throw InvalidProtocolBufferException.b();
}
while (i2 < 10) {
if (x() < 0) {
i2++;
}
}
throw InvalidProtocolBufferException.b();
return true;
}
if (c == 1) {
a(8);
return true;
}
if (c == 2) {
a(A());
return true;
}
if (c != 3) {
if (c == 4) {
return false;
}
if (c == 5) {
a(4);
return true;
}
throw InvalidProtocolBufferException.e();
}
do {
s = s();
if (s == 0) {
break;
}
} while (b(s));
if (this.g == Nvr.c(Nvr.b(i), 4)) {
return true;
}
throw InvalidProtocolBufferException.c();
}
@Override // o.cKE
public final double f() throws IOException {
return Double.longBitsToDouble(C());
}
@Override // o.cKE
public final float i() throws IOException {
return Float.intBitsToFloat(w());
}
@Override // o.cKE
public final long v() throws IOException {
return z();
}
@Override // o.cKE
public final long k() throws IOException {
return z();
}
@Override // o.cKE
public final int l() throws IOException {
return A();
}
@Override // o.cKE
public final long g() throws IOException {
return C();
}
@Override // o.cKE
public final int j() throws IOException {
return w();
}
@Override // o.cKE
public final boolean b() throws IOException {
return z() != 0;
}
@Override // o.cKE
public final String t() throws IOException {
int A = A();
if (A > 0) {
int i = this.n;
int i2 = this.l;
if (A <= i - i2) {
String str = new String(this.a, i2, A, MTP.b);
this.l += A;
return str;
}
}
if (A == 0) {
return "";
}
if (A < 0) {
throw InvalidProtocolBufferException.i();
}
throw InvalidProtocolBufferException.g();
}
@Override // o.cKE
public final String r() throws IOException {
int A = A();
if (A > 0) {
int i = this.n;
int i2 = this.l;
if (A <= i - i2) {
String d = C16752qto.d(this.a, i2, A);
this.l += A;
return d;
}
}
if (A == 0) {
return "";
}
if (A <= 0) {
throw InvalidProtocolBufferException.i();
}
throw InvalidProtocolBufferException.g();
}
@Override // o.cKE
public final QwV c() throws IOException {
byte[] bArr;
int A = A();
if (A > 0) {
int i = this.n;
int i2 = this.l;
if (A <= i - i2) {
QwV c = QwV.c(this.a, i2, A);
this.l += A;
return c;
}
}
if (A == 0) {
return QwV.a;
}
if (A > 0) {
int i3 = this.n;
int i4 = this.l;
if (A <= i3 - i4) {
int i5 = A + i4;
this.l = i5;
bArr = Arrays.copyOfRange(this.a, i4, i5);
return QwV.d(bArr);
}
}
if (A > 0) {
throw InvalidProtocolBufferException.g();
}
if (A == 0) {
bArr = MTP.e;
return QwV.d(bArr);
}
throw InvalidProtocolBufferException.i();
}
@Override // o.cKE
public final int y() throws IOException {
return A();
}
@Override // o.cKE
public final int h() throws IOException {
return A();
}
@Override // o.cKE
public final int m() throws IOException {
return w();
}
@Override // o.cKE
public final long o() throws IOException {
return C();
}
@Override // o.cKE
public final int q() throws IOException {
int A = A();
return (A >>> 1) ^ (-(A & 1));
}
@Override // o.cKE
public final long p() throws IOException {
long z = z();
return (z >>> 1) ^ (-(1 & z));
}
private int A() throws IOException {
int i;
int i2 = this.l;
int i3 = this.n;
if (i3 != i2) {
byte[] bArr = this.a;
int i4 = i2 + 1;
byte b = bArr[i2];
if (b >= 0) {
this.l = 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.l = i5;
return i;
}
}
return (int) n();
}
private long z() throws IOException {
long j;
long j2;
long j3;
int i = this.l;
int i2 = this.n;
if (i2 != i) {
byte[] bArr = this.a;
int i3 = i + 1;
byte b = bArr[i];
if (b >= 0) {
this.l = 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.l = i4;
return j;
}
}
return n();
}
@Override // o.cKE
final long n() 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.b();
}
private int w() throws IOException {
int i = this.l;
if (this.n - i < 4) {
throw InvalidProtocolBufferException.g();
}
byte[] bArr = this.a;
this.l = 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 C() throws IOException {
int i = this.l;
if (this.n - i < 8) {
throw InvalidProtocolBufferException.g();
}
byte[] bArr = this.a;
this.l = 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.cKE
public final void e(int i) {
this.f = i;
u();
}
private byte x() throws IOException {
int i = this.l;
if (i == this.n) {
throw InvalidProtocolBufferException.g();
}
byte[] bArr = this.a;
this.l = i + 1;
return bArr[i];
}
private void a(int i) throws IOException {
if (i >= 0) {
int i2 = this.n;
int i3 = this.l;
if (i <= i2 - i3) {
this.l = i3 + i;
return;
}
}
if (i < 0) {
throw InvalidProtocolBufferException.i();
}
throw InvalidProtocolBufferException.g();
}
@Override // o.cKE
public final int d(int i) throws InvalidProtocolBufferException {
if (i < 0) {
throw InvalidProtocolBufferException.i();
}
int i2 = i + (this.l - this.f8607o);
if (i2 >= 0) {
int i3 = this.f;
if (i2 > i3) {
throw InvalidProtocolBufferException.g();
}
this.f = i2;
u();
return i3;
}
throw InvalidProtocolBufferException.f();
}
@Override // o.cKE
public final int s() throws IOException {
if (this.l == this.n) {
this.g = 0;
return 0;
}
int A = A();
this.g = A;
if (Nvr.b(A) != 0) {
return this.g;
}
throw InvalidProtocolBufferException.d();
}
@Override // o.cKE
public final boolean a() throws IOException {
return this.l == this.n;
}
@Override // o.cKE
public final int d() {
return this.l - this.f8607o;
}
private void u() {
int i = this.n + this.h;
this.n = i;
int i2 = i - this.f8607o;
int i3 = this.f;
if (i2 <= i3) {
this.h = 0;
return;
}
int i4 = i2 - i3;
this.h = i4;
this.n = i - i4;
}
}
public static cKE e(InputStream inputStream) {
if (inputStream == null) {
byte[] bArr = MTP.e;
return c(bArr, 0, bArr.length, false);
}
return new LWm(inputStream);
}
/* loaded from: classes2.dex */
static final class LWm extends cKE {
private final byte[] a;
private final InputStream f;
private int g;
private int h;
private int i;
private int j;
private int k;
private int m;
private HBt n;
/* loaded from: classes2.dex */
interface HBt {
}
/* synthetic */ LWm(InputStream inputStream) {
this(inputStream, 4096);
}
private LWm(InputStream inputStream, int i) {
super((byte) 0);
this.i = Integer.MAX_VALUE;
this.n = null;
MTP.c(inputStream, "input");
this.f = inputStream;
this.a = new byte[4096];
this.j = 0;
this.k = 0;
this.m = 0;
}
private static int b(InputStream inputStream, byte[] bArr, int i, int i2) throws IOException {
try {
return inputStream.read(bArr, i, i2);
} catch (InvalidProtocolBufferException e) {
e.e = true;
throw e;
}
}
private static long d(InputStream inputStream, long j) throws IOException {
try {
return inputStream.skip(j);
} catch (InvalidProtocolBufferException e) {
e.e = true;
throw e;
}
}
private static int d(InputStream inputStream) throws IOException {
try {
return inputStream.available();
} catch (InvalidProtocolBufferException e) {
e.e = true;
throw e;
}
}
@Override // o.cKE
public final int s() throws IOException {
if (this.k == this.j && !h(1)) {
this.g = 0;
return 0;
}
int D = D();
this.g = D;
if (Nvr.b(D) != 0) {
return this.g;
}
throw InvalidProtocolBufferException.d();
}
@Override // o.cKE
public final void e() throws InvalidProtocolBufferException {
if (this.g != 0) {
throw InvalidProtocolBufferException.c();
}
}
@Override // o.cKE
public final boolean b(int i) throws IOException {
int s;
int c = Nvr.c(i);
int i2 = 0;
if (c == 0) {
if (this.j - this.k >= 10) {
while (i2 < 10) {
byte[] bArr = this.a;
int i3 = this.k;
this.k = i3 + 1;
if (bArr[i3] < 0) {
i2++;
}
}
throw InvalidProtocolBufferException.b();
}
while (i2 < 10) {
if (u() < 0) {
i2++;
}
}
throw InvalidProtocolBufferException.b();
return true;
}
if (c == 1) {
o(8);
return true;
}
if (c == 2) {
o(D());
return true;
}
if (c != 3) {
if (c == 4) {
return false;
}
if (c == 5) {
o(4);
return true;
}
throw InvalidProtocolBufferException.e();
}
do {
s = s();
if (s == 0) {
break;
}
} while (b(s));
if (this.g == Nvr.c(Nvr.b(i), 4)) {
return true;
}
throw InvalidProtocolBufferException.c();
}
@Override // o.cKE
public final double f() throws IOException {
return Double.longBitsToDouble(z());
}
@Override // o.cKE
public final float i() throws IOException {
return Float.intBitsToFloat(x());
}
@Override // o.cKE
public final long v() throws IOException {
return B();
}
@Override // o.cKE
public final long k() throws IOException {
return B();
}
@Override // o.cKE
public final int l() throws IOException {
return D();
}
@Override // o.cKE
public final long g() throws IOException {
return z();
}
@Override // o.cKE
public final int j() throws IOException {
return x();
}
@Override // o.cKE
public final boolean b() throws IOException {
return B() != 0;
}
@Override // o.cKE
public final String t() throws IOException {
int D = D();
if (D > 0) {
int i = this.j;
int i2 = this.k;
if (D <= i - i2) {
String str = new String(this.a, i2, D, MTP.b);
this.k += D;
return str;
}
}
if (D == 0) {
return "";
}
if (D <= this.j) {
i(D);
String str2 = new String(this.a, this.k, D, MTP.b);
this.k += D;
return str2;
}
return new String(a(D), MTP.b);
}
@Override // o.cKE
public final String r() throws IOException {
byte[] a;
int D = D();
int i = this.k;
int i2 = this.j;
if (D <= i2 - i && D > 0) {
a = this.a;
this.k = i + D;
} else {
if (D == 0) {
return "";
}
i = 0;
if (D <= i2) {
i(D);
a = this.a;
this.k = D;
} else {
a = a(D);
}
}
return C16752qto.d(a, i, D);
}
@Override // o.cKE
public final QwV c() throws IOException {
int D = D();
int i = this.j;
int i2 = this.k;
if (D <= i - i2 && D > 0) {
QwV c = QwV.c(this.a, i2, D);
this.k += D;
return c;
}
if (D == 0) {
return QwV.a;
}
byte[] j = j(D);
if (j != null) {
return QwV.b(j);
}
int i3 = this.k;
int i4 = this.j;
int i5 = i4 - i3;
this.m += i4;
this.k = 0;
this.j = 0;
List<byte[]> f = f(D - i5);
byte[] bArr = new byte[D];
System.arraycopy(this.a, i3, bArr, 0, i5);
for (byte[] bArr2 : f) {
System.arraycopy(bArr2, 0, bArr, i5, bArr2.length);
i5 += bArr2.length;
}
return QwV.d(bArr);
}
@Override // o.cKE
public final int y() throws IOException {
return D();
}
@Override // o.cKE
public final int h() throws IOException {
return D();
}
@Override // o.cKE
public final int m() throws IOException {
return x();
}
@Override // o.cKE
public final long o() throws IOException {
return z();
}
@Override // o.cKE
public final int q() throws IOException {
int D = D();
return (D >>> 1) ^ (-(D & 1));
}
@Override // o.cKE
public final long p() throws IOException {
long B = B();
return (B >>> 1) ^ (-(1 & B));
}
private int D() throws IOException {
int i;
int i2 = this.k;
int i3 = this.j;
if (i3 != i2) {
byte[] bArr = this.a;
int i4 = i2 + 1;
byte b = bArr[i2];
if (b >= 0) {
this.k = 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.k = i5;
return i;
}
}
return (int) n();
}
private long B() throws IOException {
long j;
long j2;
long j3;
int i = this.k;
int i2 = this.j;
if (i2 != i) {
byte[] bArr = this.a;
int i3 = i + 1;
byte b = bArr[i];
if (b >= 0) {
this.k = 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.k = i4;
return j;
}
}
return n();
}
@Override // o.cKE
final long n() throws IOException {
long j = 0;
for (int i = 0; i < 64; i += 7) {
j |= (r3 & Ascii.DEL) << i;
if ((u() & 128) == 0) {
return j;
}
}
throw InvalidProtocolBufferException.b();
}
private int x() throws IOException {
int i = this.k;
if (this.j - i < 4) {
i(4);
i = this.k;
}
byte[] bArr = this.a;
this.k = 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 z() throws IOException {
int i = this.k;
if (this.j - i < 8) {
i(8);
i = this.k;
}
byte[] bArr = this.a;
this.k = 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.cKE
public final int d(int i) throws InvalidProtocolBufferException {
if (i < 0) {
throw InvalidProtocolBufferException.i();
}
int i2 = i + this.m + this.k;
int i3 = this.i;
if (i2 > i3) {
throw InvalidProtocolBufferException.g();
}
this.i = i2;
w();
return i3;
}
@Override // o.cKE
public final void e(int i) {
this.i = i;
w();
}
@Override // o.cKE
public final boolean a() throws IOException {
return this.k == this.j && !h(1);
}
private void i(int i) throws IOException {
if (h(i)) {
return;
}
if (i > (this.d - this.m) - this.k) {
throw InvalidProtocolBufferException.j();
}
throw InvalidProtocolBufferException.g();
}
private boolean h(int i) throws IOException {
if (this.k + i <= this.j) {
StringBuilder sb = new StringBuilder("refillBuffer() called when ");
sb.append(i);
sb.append(" bytes were already available in buffer");
throw new IllegalStateException(sb.toString());
}
int i2 = this.d;
int i3 = this.m;
int i4 = this.k;
if (i > (i2 - i3) - i4 || i3 + i4 + i > this.i) {
return false;
}
if (i4 > 0) {
int i5 = this.j;
if (i5 > i4) {
byte[] bArr = this.a;
System.arraycopy(bArr, i4, bArr, 0, i5 - i4);
}
this.m += i4;
this.j -= i4;
this.k = 0;
}
InputStream inputStream = this.f;
byte[] bArr2 = this.a;
int i6 = this.j;
int b = b(inputStream, bArr2, i6, Math.min(bArr2.length - i6, (this.d - this.m) - this.j));
if (b == 0 || b < -1 || b > this.a.length) {
StringBuilder sb2 = new StringBuilder();
sb2.append(this.f.getClass());
sb2.append("#read(byte[]) returned invalid result: ");
sb2.append(b);
sb2.append("\nThe InputStream implementation is buggy.");
throw new IllegalStateException(sb2.toString());
}
if (b <= 0) {
return false;
}
this.j += b;
w();
if (this.j >= i) {
return true;
}
return h(i);
}
private byte u() throws IOException {
if (this.k == this.j) {
i(1);
}
byte[] bArr = this.a;
int i = this.k;
this.k = i + 1;
return bArr[i];
}
private byte[] a(int i) throws IOException {
byte[] j = j(i);
if (j != null) {
return j;
}
int i2 = this.k;
int i3 = this.j;
int i4 = i3 - i2;
this.m += i3;
this.k = 0;
this.j = 0;
List<byte[]> f = f(i - i4);
byte[] bArr = new byte[i];
System.arraycopy(this.a, i2, bArr, 0, i4);
for (byte[] bArr2 : f) {
System.arraycopy(bArr2, 0, bArr, i4, bArr2.length);
i4 += bArr2.length;
}
return bArr;
}
private byte[] j(int i) throws IOException {
if (i == 0) {
return MTP.e;
}
if (i < 0) {
throw InvalidProtocolBufferException.i();
}
int i2 = this.m + this.k + i;
if (i2 - this.d > 0) {
throw InvalidProtocolBufferException.j();
}
int i3 = this.i;
if (i2 > i3) {
o((i3 - this.m) - this.k);
throw InvalidProtocolBufferException.g();
}
int i4 = this.j - this.k;
int i5 = i - i4;
if (i5 >= 4096 && i5 > d(this.f)) {
return null;
}
byte[] bArr = new byte[i];
System.arraycopy(this.a, this.k, bArr, 0, i4);
this.m += this.j;
this.k = 0;
this.j = 0;
while (i4 < i) {
int b = b(this.f, bArr, i4, i - i4);
if (b == -1) {
throw InvalidProtocolBufferException.g();
}
this.m += b;
i4 += b;
}
return bArr;
}
private List<byte[]> f(int i) throws IOException {
ArrayList arrayList = new ArrayList();
while (i > 0) {
int min = Math.min(i, 4096);
byte[] bArr = new byte[min];
int i2 = 0;
while (i2 < min) {
int read = this.f.read(bArr, i2, min - i2);
if (read == -1) {
throw InvalidProtocolBufferException.g();
}
this.m += read;
i2 += read;
}
i -= min;
arrayList.add(bArr);
}
return arrayList;
}
private void o(int i) throws IOException {
int i2 = this.j;
int i3 = this.k;
if (i > i2 - i3 || i < 0) {
g(i);
} else {
this.k = i3 + i;
}
}
private void g(int i) throws IOException {
if (i < 0) {
throw InvalidProtocolBufferException.i();
}
int i2 = this.m;
int i3 = this.k;
int i4 = this.i;
int i5 = i2 + i3;
if (i5 + i > i4) {
o((i4 - i2) - i3);
throw InvalidProtocolBufferException.g();
}
this.m = i5;
int i6 = this.j;
this.j = 0;
this.k = 0;
int i7 = i6 - i3;
while (i7 < i) {
try {
long j = i - i7;
long d = d(this.f, j);
if (d >= 0 && d <= j) {
if (d == 0) {
break;
} else {
i7 += (int) d;
}
} else {
StringBuilder sb = new StringBuilder();
sb.append(this.f.getClass());
sb.append("#skip returned invalid result: ");
sb.append(d);
sb.append("\nThe InputStream implementation is buggy.");
throw new IllegalStateException(sb.toString());
}
} finally {
this.m += i7;
w();
}
}
if (i7 >= i) {
return;
}
int i8 = this.j;
int i9 = i8 - this.k;
this.k = i8;
i(1);
while (true) {
int i10 = i - i9;
int i11 = this.j;
if (i10 <= i11) {
this.k = i10;
return;
} else {
i9 += i11;
this.k = i11;
i(1);
}
}
}
@Override // o.cKE
public final int d() {
return this.m + this.k;
}
private void w() {
int i = this.j + this.h;
this.j = i;
int i2 = this.m + i;
int i3 = this.i;
if (i2 <= i3) {
this.h = 0;
return;
}
int i4 = i2 - i3;
this.h = i4;
this.j = i - i4;
}
}
/* loaded from: classes2.dex */
static final class RVV extends cKE {
private int a;
private ByteBuffer f;
private long g;
private long h;
private long i;
private long j;
private final boolean k;
private int l;
private boolean m;
private final Iterator<ByteBuffer> n;
/* renamed from: o, reason: collision with root package name */
private final Iterable<ByteBuffer> f8608o;
private int p;
private int r;
private int s;
private int t;
/* synthetic */ RVV(Iterable iterable, int i) {
this(iterable, i, true);
}
private RVV(Iterable<ByteBuffer> iterable, int i, boolean z) {
super((byte) 0);
this.l = Integer.MAX_VALUE;
this.t = i;
this.f8608o = iterable;
this.n = iterable.iterator();
this.k = true;
this.r = 0;
this.s = 0;
if (i == 0) {
this.f = MTP.d;
this.h = 0L;
this.j = 0L;
this.g = 0L;
this.i = 0L;
return;
}
x();
}
private void x() {
ByteBuffer next = this.n.next();
this.f = next;
this.r += (int) (this.h - this.j);
long position = next.position();
this.h = position;
this.j = position;
this.g = this.f.limit();
long d = vqr.d(this.f);
this.i = d;
this.h += d;
this.j += d;
this.g += d;
}
@Override // o.cKE
public final int s() throws IOException {
if (a()) {
this.p = 0;
return 0;
}
int A = A();
this.p = A;
if (Nvr.b(A) != 0) {
return this.p;
}
throw InvalidProtocolBufferException.d();
}
@Override // o.cKE
public final void e() throws InvalidProtocolBufferException {
if (this.p != 0) {
throw InvalidProtocolBufferException.c();
}
}
@Override // o.cKE
public final boolean b(int i) throws IOException {
int s;
int c = Nvr.c(i);
if (c == 0) {
for (int i2 = 0; i2 < 10; i2++) {
if (w() >= 0) {
return true;
}
}
throw InvalidProtocolBufferException.b();
}
if (c == 1) {
a(8);
return true;
}
if (c == 2) {
a(A());
return true;
}
if (c != 3) {
if (c == 4) {
return false;
}
if (c == 5) {
a(4);
return true;
}
throw InvalidProtocolBufferException.e();
}
do {
s = s();
if (s == 0) {
break;
}
} while (b(s));
if (this.p == Nvr.c(Nvr.b(i), 4)) {
return true;
}
throw InvalidProtocolBufferException.c();
}
@Override // o.cKE
public final double f() throws IOException {
return Double.longBitsToDouble(B());
}
@Override // o.cKE
public final float i() throws IOException {
return Float.intBitsToFloat(z());
}
@Override // o.cKE
public final long v() throws IOException {
return C();
}
@Override // o.cKE
public final long k() throws IOException {
return C();
}
@Override // o.cKE
public final int l() throws IOException {
return A();
}
@Override // o.cKE
public final long g() throws IOException {
return B();
}
@Override // o.cKE
public final int j() throws IOException {
return z();
}
@Override // o.cKE
public final boolean b() throws IOException {
return C() != 0;
}
@Override // o.cKE
public final String t() throws IOException {
int A = A();
if (A > 0) {
long j = A;
long j2 = this.g;
long j3 = this.h;
if (j <= j2 - j3) {
byte[] bArr = new byte[A];
vqr.e(j3, bArr, 0L, j);
String str = new String(bArr, MTP.b);
this.h += j;
return str;
}
}
if (A > 0 && A <= ((int) (((this.t - this.r) - this.h) + this.j))) {
byte[] bArr2 = new byte[A];
e(bArr2, A);
return new String(bArr2, MTP.b);
}
if (A == 0) {
return "";
}
if (A < 0) {
throw InvalidProtocolBufferException.i();
}
throw InvalidProtocolBufferException.g();
}
@Override // o.cKE
public final String r() throws IOException {
int A = A();
if (A > 0) {
long j = A;
long j2 = this.g;
long j3 = this.h;
if (j <= j2 - j3) {
String c = C16752qto.c(this.f, (int) (j3 - this.j), A);
this.h += j;
return c;
}
}
if (A >= 0 && A <= ((int) (((this.t - this.r) - this.h) + this.j))) {
byte[] bArr = new byte[A];
e(bArr, A);
return C16752qto.d(bArr, 0, A);
}
if (A == 0) {
return "";
}
if (A <= 0) {
throw InvalidProtocolBufferException.i();
}
throw InvalidProtocolBufferException.g();
}
@Override // o.cKE
public final QwV c() throws IOException {
int A = A();
if (A > 0) {
long j = A;
long j2 = this.g;
long j3 = this.h;
if (j <= j2 - j3) {
byte[] bArr = new byte[A];
vqr.e(j3, bArr, 0L, j);
this.h += j;
return QwV.d(bArr);
}
}
if (A > 0 && A <= ((int) (((this.t - this.r) - this.h) + this.j))) {
byte[] bArr2 = new byte[A];
e(bArr2, A);
return QwV.d(bArr2);
}
if (A == 0) {
return QwV.a;
}
if (A < 0) {
throw InvalidProtocolBufferException.i();
}
throw InvalidProtocolBufferException.g();
}
@Override // o.cKE
public final int y() throws IOException {
return A();
}
@Override // o.cKE
public final int h() throws IOException {
return A();
}
@Override // o.cKE
public final int m() throws IOException {
return z();
}
@Override // o.cKE
public final long o() throws IOException {
return B();
}
@Override // o.cKE
public final int q() throws IOException {
int A = A();
return (A >>> 1) ^ (-(A & 1));
}
@Override // o.cKE
public final long p() throws IOException {
long C = C();
return (C >>> 1) ^ (-(1 & C));
}
private int A() throws IOException {
int i;
long j = this.h;
if (this.g != j) {
byte d = vqr.d(j);
if (d >= 0) {
this.h++;
return d;
}
if (this.g - this.h >= 10) {
long j2 = 2 + j;
int d2 = d ^ (vqr.d(1 + j) << 7);
if (d2 < 0) {
i = d2 ^ (-128);
} else {
long j3 = 3 + j;
int d3 = d2 ^ (vqr.d(j2) << 14);
if (d3 >= 0) {
i = d3 ^ 16256;
} else {
j2 = 4 + j;
int d4 = d3 ^ (vqr.d(j3) << Ascii.NAK);
if (d4 < 0) {
i = (-2080896) ^ d4;
} else {
j3 = 5 + j;
byte d5 = vqr.d(j2);
int i2 = (d4 ^ (d5 << 28)) ^ 266354560;
if (d5 < 0) {
j2 = 6 + j;
if (vqr.d(j3) < 0) {
j3 = 7 + j;
if (vqr.d(j2) < 0) {
j2 = 8 + j;
if (vqr.d(j3) < 0) {
j3 = 9 + j;
if (vqr.d(j2) < 0) {
if (vqr.d(j3) >= 0) {
j2 = j + 10;
}
}
}
}
}
i = i2;
}
i = i2;
}
}
j2 = j3;
}
this.h = j2;
return i;
}
}
return (int) n();
}
private long C() throws IOException {
long j;
long j2;
int i;
long j3 = this.h;
if (this.g != j3) {
byte d = vqr.d(j3);
if (d >= 0) {
this.h++;
return d;
}
if (this.g - this.h >= 10) {
long j4 = 2 + j3;
int d2 = d ^ (vqr.d(1 + j3) << 7);
if (d2 >= 0) {
long j5 = 3 + j3;
int d3 = d2 ^ (vqr.d(j4) << 14);
if (d3 >= 0) {
j = d3 ^ 16256;
j4 = j5;
} else {
j4 = 4 + j3;
int d4 = d3 ^ (vqr.d(j5) << Ascii.NAK);
if (d4 < 0) {
i = (-2080896) ^ d4;
} else {
long j6 = 5 + j3;
long d5 = d4 ^ (vqr.d(j4) << 28);
if (d5 >= 0) {
j2 = 266354560;
} else {
long j7 = 6 + j3;
d5 ^= vqr.d(j6) << 35;
if (d5 < 0) {
j2 = -34093383808L;
} else {
j6 = 7 + j3;
d5 ^= vqr.d(j7) << 42;
if (d5 >= 0) {
j2 = 4363953127296L;
} else {
j7 = 8 + j3;
d5 ^= vqr.d(j6) << 49;
if (d5 < 0) {
j2 = -558586000294016L;
} else {
long j8 = 9 + j3;
long d6 = (d5 ^ (vqr.d(j7) << 56)) ^ 71499008037633920L;
if (d6 >= 0) {
j = d6;
j4 = j8;
} else if (vqr.d(j8) >= 0) {
j4 = j3 + 10;
j = d6;
}
}
}
}
j4 = j7;
j = j2 ^ d5;
}
j4 = j6;
j = j2 ^ d5;
}
}
this.h = j4;
return j;
}
i = d2 ^ (-128);
j = i;
this.h = j4;
return j;
}
}
return n();
}
@Override // o.cKE
final long n() throws IOException {
long j = 0;
for (int i = 0; i < 64; i += 7) {
j |= (r3 & Ascii.DEL) << i;
if ((w() & 128) == 0) {
return j;
}
}
throw InvalidProtocolBufferException.b();
}
@Override // o.cKE
public final void e(int i) {
this.l = i;
u();
}
private void e(byte[] bArr, int i) throws IOException {
if (i < 0 || i > ((int) (((this.t - this.r) - this.h) + this.j))) {
if (i > 0) {
throw InvalidProtocolBufferException.g();
}
if (i != 0) {
throw InvalidProtocolBufferException.i();
}
return;
}
int i2 = i;
while (i2 > 0) {
if (this.g - this.h == 0) {
if (!this.n.hasNext()) {
throw InvalidProtocolBufferException.g();
}
x();
}
int min = Math.min(i2, (int) (this.g - this.h));
long j = min;
vqr.e(this.h, bArr, i - i2, j);
i2 -= min;
this.h += j;
}
}
@Override // o.cKE
public final int d(int i) throws InvalidProtocolBufferException {
if (i < 0) {
throw InvalidProtocolBufferException.i();
}
int i2 = i + ((int) (((this.r - this.s) + this.h) - this.j));
int i3 = this.l;
if (i2 > i3) {
throw InvalidProtocolBufferException.g();
}
this.l = i2;
u();
return i3;
}
private byte w() throws IOException {
if (this.g - this.h == 0) {
if (!this.n.hasNext()) {
throw InvalidProtocolBufferException.g();
}
x();
}
long j = this.h;
this.h = 1 + j;
return vqr.d(j);
}
private int z() throws IOException {
long j = this.g;
long j2 = this.h;
if (j - j2 >= 4) {
this.h = 4 + j2;
byte d = vqr.d(j2);
byte d2 = vqr.d(1 + j2);
byte d3 = vqr.d(2 + j2);
return (d & UnsignedBytes.MAX_VALUE) | ((d2 & UnsignedBytes.MAX_VALUE) << 8) | ((d3 & UnsignedBytes.MAX_VALUE) << 16) | ((vqr.d(j2 + 3) & UnsignedBytes.MAX_VALUE) << 24);
}
return (w() & UnsignedBytes.MAX_VALUE) | ((w() & UnsignedBytes.MAX_VALUE) << 8) | ((w() & UnsignedBytes.MAX_VALUE) << 16) | ((w() & UnsignedBytes.MAX_VALUE) << 24);
}
private long B() throws IOException {
long j;
long w;
byte w2;
long j2 = this.g;
long j3 = this.h;
if (j2 - j3 >= 8) {
this.h = 8 + j3;
w = ((vqr.d(j3 + 5) & 255) << 40) | (vqr.d(j3) & 255) | ((vqr.d(1 + j3) & 255) << 8) | ((vqr.d(j3 + 2) & 255) << 16) | ((vqr.d(j3 + 3) & 255) << 24) | ((vqr.d(j3 + 4) & 255) << 32) | ((vqr.d(j3 + 6) & 255) << 48);
w2 = vqr.d(j3 + 7);
j = 255;
} else {
j = 255;
w = (w() & 255) | ((w() & 255) << 8) | ((w() & 255) << 16) | ((w() & 255) << 24) | ((w() & 255) << 32) | ((w() & 255) << 40) | ((w() & 255) << 48);
w2 = w();
}
return w | ((w2 & j) << 56);
}
private void a(int i) throws IOException {
if (i < 0 || i > ((this.t - this.r) - this.h) + this.j) {
if (i < 0) {
throw InvalidProtocolBufferException.i();
}
throw InvalidProtocolBufferException.g();
}
while (i > 0) {
if (this.g - this.h == 0) {
if (!this.n.hasNext()) {
throw InvalidProtocolBufferException.g();
}
x();
}
int min = Math.min(i, (int) (this.g - this.h));
i -= min;
this.h += min;
}
}
@Override // o.cKE
public final boolean a() throws IOException {
return (((long) this.r) + this.h) - this.j == ((long) this.t);
}
@Override // o.cKE
public final int d() {
return (int) (((this.r - this.s) + this.h) - this.j);
}
private void u() {
int i = this.t + this.a;
this.t = i;
int i2 = i - this.s;
int i3 = this.l;
if (i2 <= i3) {
this.a = 0;
return;
}
int i4 = i2 - i3;
this.a = i4;
this.t = i - i4;
}
}
}