what-the-bank/sources/com/facetec/sdk/ms.java

1063 lines
31 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import com.google.common.primitives.UnsignedBytes;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ByteChannel;
import java.nio.charset.Charset;
import net.sf.scuba.smartcards.ISO7816;
import net.sf.scuba.smartcards.ISOFileInfo;
import okhttp3.internal.connection.RealConnection;
import org.jmrtd.PassportService;
/* loaded from: classes.dex */
public final class ms implements mr, mv, Cloneable, ByteChannel {
private static final byte[] c = {ISO7816.INS_DECREASE, 49, ISO7816.INS_INCREASE, 51, ISO7816.INS_DECREASE_STAMPED, 53, 54, 55, 56, 57, 97, ISOFileInfo.FCP_BYTE, 99, ISOFileInfo.FMD_BYTE, 101, 102};
nc b;
long e;
@Override // com.facetec.sdk.nk, java.io.Closeable, java.lang.AutoCloseable
public final void close() {
}
@Override // com.facetec.sdk.mr, com.facetec.sdk.mv
public final ms d() {
return this;
}
@Override // com.facetec.sdk.mv, com.facetec.sdk.nj, java.io.Flushable
public final void flush() {
}
@Override // java.nio.channels.Channel
public final boolean isOpen() {
return true;
}
@Override // com.facetec.sdk.mv
public final /* bridge */ /* synthetic */ mv r() throws IOException {
return this;
}
@Override // com.facetec.sdk.mr
public final void e(long j) throws EOFException {
if (this.e < j) {
throw new EOFException();
}
}
public final ms c(ms msVar, long j, long j2) {
if (msVar == null) {
throw new IllegalArgumentException("out == null");
}
ng.d(this.e, j, j2);
if (j2 == 0) {
return this;
}
msVar.e += j2;
nc ncVar = this.b;
while (j >= ncVar.a - ncVar.e) {
j -= ncVar.a - ncVar.e;
ncVar = ncVar.i;
}
while (j2 > 0) {
nc c2 = ncVar.c();
c2.e = (int) (c2.e + j);
c2.a = Math.min(c2.e + ((int) j2), c2.a);
nc ncVar2 = msVar.b;
if (ncVar2 == null) {
c2.f = c2;
c2.i = c2;
msVar.b = c2;
} else {
ncVar2.f.c(c2);
}
j2 -= c2.a - c2.e;
ncVar = ncVar.i;
j = 0;
}
return this;
}
public final long e() {
long j = this.e;
if (j == 0) {
return 0L;
}
nc ncVar = this.b.f;
return (ncVar.a >= 8192 || !ncVar.d) ? j : j - (ncVar.a - ncVar.e);
}
@Override // com.facetec.sdk.mr
public final byte g() {
if (this.e == 0) {
throw new IllegalStateException("size == 0");
}
nc ncVar = this.b;
int i = ncVar.e;
int i2 = ncVar.a;
int i3 = i + 1;
byte b = ncVar.b[i];
this.e--;
if (i3 == i2) {
this.b = ncVar.b();
nf.a(ncVar);
} else {
ncVar.e = i3;
}
return b;
}
public final byte c(long j) {
ng.d(this.e, j, 1L);
long j2 = this.e;
if (j2 - j <= j) {
long j3 = j - j2;
nc ncVar = this.b;
do {
ncVar = ncVar.f;
j3 += ncVar.a - ncVar.e;
} while (j3 < 0);
return ncVar.b[ncVar.e + ((int) j3)];
}
nc ncVar2 = this.b;
while (true) {
long j4 = ncVar2.a - ncVar2.e;
if (j >= j4) {
j -= j4;
ncVar2 = ncVar2.i;
} else {
return ncVar2.b[ncVar2.e + ((int) j)];
}
}
}
@Override // com.facetec.sdk.mr
public final short i() {
int i;
int i2;
if (this.e < 2) {
StringBuilder sb = new StringBuilder("size < 2: ");
sb.append(this.e);
throw new IllegalStateException(sb.toString());
}
nc ncVar = this.b;
int i3 = ncVar.e;
int i4 = ncVar.a;
if (i4 - i3 < 2) {
i = (g() & UnsignedBytes.MAX_VALUE) << 8;
i2 = g() & UnsignedBytes.MAX_VALUE;
} else {
byte[] bArr = ncVar.b;
byte b = bArr[i3];
int i5 = i3 + 2;
byte b2 = bArr[i3 + 1];
this.e -= 2;
if (i5 == i4) {
this.b = ncVar.b();
nf.a(ncVar);
} else {
ncVar.e = i5;
}
i = b2 & UnsignedBytes.MAX_VALUE;
i2 = (b & UnsignedBytes.MAX_VALUE) << 8;
}
return (short) (i | i2);
}
@Override // com.facetec.sdk.mr
public final int h() {
int i;
int i2;
if (this.e < 4) {
StringBuilder sb = new StringBuilder("size < 4: ");
sb.append(this.e);
throw new IllegalStateException(sb.toString());
}
nc ncVar = this.b;
int i3 = ncVar.e;
int i4 = ncVar.a;
if (i4 - i3 < 4) {
i = ((g() & UnsignedBytes.MAX_VALUE) << 24) | ((g() & UnsignedBytes.MAX_VALUE) << 16) | ((g() & UnsignedBytes.MAX_VALUE) << 8);
i2 = g() & UnsignedBytes.MAX_VALUE;
} else {
byte[] bArr = ncVar.b;
byte b = bArr[i3];
byte b2 = bArr[i3 + 1];
byte b3 = bArr[i3 + 2];
int i5 = i3 + 4;
byte b4 = bArr[i3 + 3];
this.e -= 4;
if (i5 == i4) {
this.b = ncVar.b();
nf.a(ncVar);
} else {
ncVar.e = i5;
}
i = b4 & UnsignedBytes.MAX_VALUE;
i2 = ((b2 & UnsignedBytes.MAX_VALUE) << 16) | ((b & UnsignedBytes.MAX_VALUE) << 24) | ((b3 & UnsignedBytes.MAX_VALUE) << 8);
}
return i | i2;
}
@Override // com.facetec.sdk.mr
public final short j() {
return ng.c(i());
}
@Override // com.facetec.sdk.mr
public final int f() {
return ng.a(h());
}
/* JADX WARN: Removed duplicated region for block: B:32:0x008a */
/* JADX WARN: Removed duplicated region for block: B:34:0x0098 */
/* JADX WARN: Removed duplicated region for block: B:40:0x009c A[EDGE_INSN: B:40:0x009c->B:37:0x009c BREAK A[LOOP:0: B:4:0x000b->B:39:?], SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:41:0x0094 */
@Override // com.facetec.sdk.mr
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final long m() {
/*
r14 = this;
long r0 = r14.e
r2 = 0
int r0 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1))
if (r0 == 0) goto La3
r0 = 0
r1 = r0
r4 = r2
Lb:
com.facetec.sdk.nc r6 = r14.b
byte[] r7 = r6.b
int r8 = r6.e
int r9 = r6.a
L13:
if (r8 >= r9) goto L88
r10 = r7[r8]
r11 = 48
if (r10 < r11) goto L22
r11 = 57
if (r10 > r11) goto L22
int r11 = r10 + (-48)
goto L37
L22:
r11 = 97
if (r10 < r11) goto L2d
r11 = 102(0x66, float:1.43E-43)
if (r10 > r11) goto L2d
int r11 = r10 + (-87)
goto L37
L2d:
r11 = 65
if (r10 < r11) goto L6c
r11 = 70
if (r10 > r11) goto L6c
int r11 = r10 + (-55)
L37:
r12 = -1152921504606846976(0xf000000000000000, double:-3.105036184601418E231)
long r12 = r12 & r4
int r12 = (r12 > r2 ? 1 : (r12 == r2 ? 0 : -1))
if (r12 != 0) goto L47
r10 = 4
long r4 = r4 << r10
long r10 = (long) r11
long r4 = r4 | r10
int r8 = r8 + 1
int r0 = r0 + 1
goto L13
L47:
com.facetec.sdk.ms r0 = new com.facetec.sdk.ms
r0.<init>()
com.facetec.sdk.ms r0 = r0.h(r4)
com.facetec.sdk.ms r0 = r0.h(r10)
java.lang.NumberFormatException r1 = new java.lang.NumberFormatException
java.lang.StringBuilder r2 = new java.lang.StringBuilder
java.lang.String r3 = "Number too large: "
r2.<init>(r3)
java.lang.String r0 = r0.k()
r2.append(r0)
java.lang.String r0 = r2.toString()
r1.<init>(r0)
throw r1
L6c:
if (r0 == 0) goto L70
r1 = 1
goto L88
L70:
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = "Expected leading [0-9a-fA-F] character but was 0x"
r0.<init>(r1)
java.lang.NumberFormatException r1 = new java.lang.NumberFormatException
java.lang.String r2 = java.lang.Integer.toHexString(r10)
r0.append(r2)
java.lang.String r0 = r0.toString()
r1.<init>(r0)
throw r1
L88:
if (r8 != r9) goto L94
com.facetec.sdk.nc r7 = r6.b()
r14.b = r7
com.facetec.sdk.nf.a(r6)
goto L96
L94:
r6.e = r8
L96:
if (r1 != 0) goto L9c
com.facetec.sdk.nc r6 = r14.b
if (r6 != 0) goto Lb
L9c:
long r1 = r14.e
long r6 = (long) r0
long r1 = r1 - r6
r14.e = r1
return r4
La3:
java.lang.IllegalStateException r0 = new java.lang.IllegalStateException
java.lang.String r1 = "size == 0"
r0.<init>(r1)
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.facetec.sdk.ms.m():long");
}
public final mt n() {
return new mt(l());
}
@Override // com.facetec.sdk.mr
public final mt b(long j) throws EOFException {
return new mt(j(j));
}
public final String k() {
try {
return d(this.e, ng.e);
} catch (EOFException e) {
throw new AssertionError(e);
}
}
private String o(long j) throws EOFException {
return d(j, ng.e);
}
@Override // com.facetec.sdk.mr
public final String d(Charset charset) {
try {
return d(this.e, charset);
} catch (EOFException e) {
throw new AssertionError(e);
}
}
private String d(long j, Charset charset) throws EOFException {
ng.d(this.e, 0L, j);
if (charset == null) {
throw new IllegalArgumentException("charset == null");
}
if (j > 2147483647L) {
throw new IllegalArgumentException("byteCount > Integer.MAX_VALUE: ".concat(String.valueOf(j)));
}
if (j == 0) {
return "";
}
nc ncVar = this.b;
if (ncVar.e + j > ncVar.a) {
return new String(j(j), charset);
}
String str = new String(ncVar.b, ncVar.e, (int) j, charset);
ncVar.e = (int) (ncVar.e + j);
this.e -= j;
if (ncVar.e == ncVar.a) {
this.b = ncVar.b();
nf.a(ncVar);
}
return str;
}
@Override // com.facetec.sdk.mr
public final String o() throws EOFException {
return a(Long.MAX_VALUE);
}
@Override // com.facetec.sdk.mr
public final String a(long j) throws EOFException {
if (j < 0) {
throw new IllegalArgumentException("limit < 0: ".concat(String.valueOf(j)));
}
long j2 = j != Long.MAX_VALUE ? j + 1 : Long.MAX_VALUE;
long b = b((byte) 10, 0L, j2);
if (b != -1) {
return d(b);
}
if (j2 < c() && c(j2 - 1) == 13 && c(j2) == 10) {
return d(j2);
}
ms msVar = new ms();
c(msVar, 0L, Math.min(32L, c()));
StringBuilder sb = new StringBuilder("\\n not found: limit=");
sb.append(Math.min(c(), j));
sb.append(" content=");
sb.append(msVar.n().c());
sb.append((char) 8230);
throw new EOFException(sb.toString());
}
/* JADX INFO: Access modifiers changed from: package-private */
public final String d(long j) throws EOFException {
if (j > 0) {
long j2 = j - 1;
if (c(j2) == 13) {
String o2 = o(j2);
f(2L);
return o2;
}
}
String o3 = o(j);
f(1L);
return o3;
}
public final byte[] l() {
try {
return j(this.e);
} catch (EOFException e) {
throw new AssertionError(e);
}
}
@Override // com.facetec.sdk.mr
public final byte[] j(long j) throws EOFException {
ng.d(this.e, 0L, j);
if (j > 2147483647L) {
throw new IllegalArgumentException("byteCount > Integer.MAX_VALUE: ".concat(String.valueOf(j)));
}
byte[] bArr = new byte[(int) j];
d(bArr);
return bArr;
}
@Override // com.facetec.sdk.mr
public final void d(byte[] bArr) throws EOFException {
int i = 0;
while (i < bArr.length) {
int a = a(bArr, i, bArr.length - i);
if (a == -1) {
throw new EOFException();
}
i += a;
}
}
public final int a(byte[] bArr, int i, int i2) {
ng.d(bArr.length, i, i2);
nc ncVar = this.b;
if (ncVar == null) {
return -1;
}
int min = Math.min(i2, ncVar.a - ncVar.e);
System.arraycopy(ncVar.b, ncVar.e, bArr, i, min);
ncVar.e += min;
this.e -= min;
if (ncVar.e == ncVar.a) {
this.b = ncVar.b();
nf.a(ncVar);
}
return min;
}
@Override // java.nio.channels.ReadableByteChannel
public final int read(ByteBuffer byteBuffer) throws IOException {
nc ncVar = this.b;
if (ncVar == null) {
return -1;
}
int min = Math.min(byteBuffer.remaining(), ncVar.a - ncVar.e);
byteBuffer.put(ncVar.b, ncVar.e, min);
ncVar.e += min;
this.e -= min;
if (ncVar.e == ncVar.a) {
this.b = ncVar.b();
nf.a(ncVar);
}
return min;
}
public final void t() {
try {
f(this.e);
} catch (EOFException e) {
throw new AssertionError(e);
}
}
@Override // com.facetec.sdk.mr
public final void f(long j) throws EOFException {
while (j > 0) {
if (this.b == null) {
throw new EOFException();
}
int min = (int) Math.min(j, r0.a - this.b.e);
long j2 = min;
this.e -= j2;
j -= j2;
this.b.e += min;
if (this.b.e == this.b.a) {
nc ncVar = this.b;
this.b = ncVar.b();
nf.a(ncVar);
}
}
}
public final ms c(mt mtVar) {
if (mtVar == null) {
throw new IllegalArgumentException("byteString == null");
}
mtVar.c(this);
return this;
}
@Override // com.facetec.sdk.mv
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public final ms e(String str) {
return c(str, 0, str.length());
}
public final ms c(String str, int i, int i2) {
char charAt;
if (str == null) {
throw new IllegalArgumentException("string == null");
}
if (i < 0) {
throw new IllegalArgumentException("beginIndex < 0: ".concat(String.valueOf(i)));
}
if (i2 < i) {
StringBuilder sb = new StringBuilder("endIndex < beginIndex: ");
sb.append(i2);
sb.append(" < ");
sb.append(i);
throw new IllegalArgumentException(sb.toString());
}
if (i2 > str.length()) {
StringBuilder sb2 = new StringBuilder("endIndex > string.length: ");
sb2.append(i2);
sb2.append(" > ");
sb2.append(str.length());
throw new IllegalArgumentException(sb2.toString());
}
while (i < i2) {
char charAt2 = str.charAt(i);
if (charAt2 < 128) {
nc a = a(1);
byte[] bArr = a.b;
int i3 = a.a - i;
int min = Math.min(i2, 8192 - i3);
int i4 = i + 1;
bArr[i + i3] = (byte) charAt2;
while (true) {
i = i4;
if (i >= min || (charAt = str.charAt(i)) >= 128) {
break;
}
i4 = i + 1;
bArr[i + i3] = (byte) charAt;
}
int i5 = (i3 + i) - a.a;
a.a += i5;
this.e += i5;
} else {
if (charAt2 < 2048) {
h((charAt2 >> 6) | 192);
h((charAt2 & '?') | 128);
} else if (charAt2 < 55296 || charAt2 > 57343) {
h((charAt2 >> '\f') | PassportService.DEFAULT_MAX_BLOCKSIZE);
h(((charAt2 >> 6) & 63) | 128);
h((charAt2 & '?') | 128);
} else {
int i6 = i + 1;
char charAt3 = i6 < i2 ? str.charAt(i6) : (char) 0;
if (charAt2 > 56319 || charAt3 < 56320 || charAt3 > 57343) {
h(63);
i = i6;
} else {
int i7 = (((charAt2 & 10239) << 10) | (9215 & charAt3)) + 65536;
h((i7 >> 18) | 240);
h(((i7 >> 12) & 63) | 128);
h(((i7 >> 6) & 63) | 128);
h((i7 & 63) | 128);
i += 2;
}
}
i++;
}
}
return this;
}
public final ms c(int i) {
if (i < 128) {
h(i);
} else if (i < 2048) {
h((i >> 6) | 192);
h((i & 63) | 128);
} else if (i < 65536) {
if (i >= 55296 && i <= 57343) {
h(63);
} else {
h((i >> 12) | PassportService.DEFAULT_MAX_BLOCKSIZE);
h(((i >> 6) & 63) | 128);
h((i & 63) | 128);
}
} else if (i <= 1114111) {
h((i >> 18) | 240);
h(((i >> 12) & 63) | 128);
h(((i >> 6) & 63) | 128);
h((i & 63) | 128);
} else {
StringBuilder sb = new StringBuilder("Unexpected code point: ");
sb.append(Integer.toHexString(i));
throw new IllegalArgumentException(sb.toString());
}
return this;
}
@Override // com.facetec.sdk.mv
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public final ms e(byte[] bArr) {
if (bArr == null) {
throw new IllegalArgumentException("source == null");
}
return d(bArr, 0, bArr.length);
}
@Override // com.facetec.sdk.mv
/* renamed from: c, reason: merged with bridge method [inline-methods] */
public final ms d(byte[] bArr, int i, int i2) {
if (bArr == null) {
throw new IllegalArgumentException("source == null");
}
long j = i2;
ng.d(bArr.length, i, j);
int i3 = i2 + i;
while (i < i3) {
nc a = a(1);
int min = Math.min(i3 - i, 8192 - a.a);
System.arraycopy(bArr, i, a.b, a.a, min);
i += min;
a.a += min;
}
this.e += j;
return this;
}
@Override // java.nio.channels.WritableByteChannel
public final int write(ByteBuffer byteBuffer) throws IOException {
if (byteBuffer == null) {
throw new IllegalArgumentException("source == null");
}
int remaining = byteBuffer.remaining();
int i = remaining;
while (i > 0) {
nc a = a(1);
int min = Math.min(i, 8192 - a.a);
byteBuffer.get(a.b, a.a, min);
i -= min;
a.a += min;
}
this.e += remaining;
return remaining;
}
public final long d(nk nkVar) throws IOException {
if (nkVar == null) {
throw new IllegalArgumentException("source == null");
}
long j = 0;
while (true) {
long b = nkVar.b(this, 8192L);
if (b == -1) {
return j;
}
j += b;
}
}
@Override // com.facetec.sdk.mv
/* renamed from: b, reason: merged with bridge method [inline-methods] */
public final ms h(int i) {
nc a = a(1);
byte[] bArr = a.b;
int i2 = a.a;
a.a = i2 + 1;
bArr[i2] = (byte) i;
this.e++;
return this;
}
@Override // com.facetec.sdk.mv
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public final ms g(int i) {
nc a = a(2);
byte[] bArr = a.b;
int i2 = a.a;
bArr[i2] = (byte) (i >>> 8);
bArr[i2 + 1] = (byte) i;
a.a = i2 + 2;
this.e += 2;
return this;
}
@Override // com.facetec.sdk.mv
/* renamed from: e, reason: merged with bridge method [inline-methods] */
public final ms f(int i) {
nc a = a(4);
byte[] bArr = a.b;
int i2 = a.a;
bArr[i2] = (byte) (i >>> 24);
bArr[i2 + 1] = (byte) (i >>> 16);
bArr[i2 + 2] = (byte) (i >>> 8);
bArr[i2 + 3] = (byte) i;
a.a = i2 + 4;
this.e += 4;
return this;
}
@Override // com.facetec.sdk.mv
/* renamed from: i, reason: merged with bridge method [inline-methods] */
public final ms n(long j) {
boolean z;
if (j == 0) {
return h(48);
}
if (j < 0) {
j = -j;
if (j < 0) {
return e("-9223372036854775808");
}
z = true;
} else {
z = false;
}
int i = j < 100000000 ? j < 10000 ? j < 100 ? j >= 10 ? 2 : 1 : j < 1000 ? 3 : 4 : j < 1000000 ? j < 100000 ? 5 : 6 : j < 10000000 ? 7 : 8 : j < 1000000000000L ? j < RealConnection.IDLE_CONNECTION_HEALTHY_NS ? j < 1000000000 ? 9 : 10 : j < 100000000000L ? 11 : 12 : j < 1000000000000000L ? j < 10000000000000L ? 13 : j < 100000000000000L ? 14 : 15 : j < 100000000000000000L ? j < 10000000000000000L ? 16 : 17 : j < 1000000000000000000L ? 18 : 19;
if (z) {
i++;
}
nc a = a(i);
byte[] bArr = a.b;
int i2 = a.a + i;
while (j != 0) {
i2--;
bArr[i2] = c[(int) (j % 10)];
j /= 10;
}
if (z) {
bArr[i2 - 1] = 45;
}
a.a += i;
this.e += i;
return this;
}
@Override // com.facetec.sdk.mv
/* renamed from: g, reason: merged with bridge method [inline-methods] */
public final ms h(long j) {
if (j == 0) {
return h(48);
}
int numberOfTrailingZeros = (Long.numberOfTrailingZeros(Long.highestOneBit(j)) / 4) + 1;
nc a = a(numberOfTrailingZeros);
byte[] bArr = a.b;
int i = a.a;
for (int i2 = (a.a + numberOfTrailingZeros) - 1; i2 >= i; i2--) {
bArr[i2] = c[(int) (15 & j)];
j >>>= 4;
}
a.a += numberOfTrailingZeros;
this.e += numberOfTrailingZeros;
return this;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final nc a(int i) {
if (i <= 0 || i > 8192) {
throw new IllegalArgumentException();
}
nc ncVar = this.b;
if (ncVar == null) {
nc d = nf.d();
this.b = d;
d.f = d;
d.i = d;
return d;
}
nc ncVar2 = ncVar.f;
return (ncVar2.a + i > 8192 || !ncVar2.d) ? ncVar2.c(nf.d()) : ncVar2;
}
@Override // com.facetec.sdk.nj
public final void c(ms msVar, long j) {
nc d;
if (msVar == null) {
throw new IllegalArgumentException("source == null");
}
if (msVar == this) {
throw new IllegalArgumentException("source == this");
}
ng.d(msVar.e, 0L, j);
while (j > 0) {
if (j < msVar.b.a - msVar.b.e) {
nc ncVar = this.b;
nc ncVar2 = ncVar != null ? ncVar.f : null;
if (ncVar2 != null && ncVar2.d) {
if ((ncVar2.a + j) - (ncVar2.c ? 0 : ncVar2.e) <= 8192) {
msVar.b.a(ncVar2, (int) j);
msVar.e -= j;
this.e += j;
return;
}
}
nc ncVar3 = msVar.b;
int i = (int) j;
if (i <= 0 || i > ncVar3.a - ncVar3.e) {
throw new IllegalArgumentException();
}
if (i >= 1024) {
d = ncVar3.c();
} else {
d = nf.d();
System.arraycopy(ncVar3.b, ncVar3.e, d.b, 0, i);
}
d.a = d.e + i;
ncVar3.e += i;
ncVar3.f.c(d);
msVar.b = d;
}
nc ncVar4 = msVar.b;
long j2 = ncVar4.a - ncVar4.e;
msVar.b = ncVar4.b();
nc ncVar5 = this.b;
if (ncVar5 == null) {
this.b = ncVar4;
ncVar4.f = ncVar4;
ncVar4.i = ncVar4;
} else {
nc c2 = ncVar5.f.c(ncVar4);
if (c2.f == c2) {
throw new IllegalStateException();
}
if (c2.f.d) {
int i2 = c2.a - c2.e;
if (i2 <= (8192 - c2.f.a) + (c2.f.c ? 0 : c2.f.e)) {
c2.a(c2.f, i2);
c2.b();
nf.a(c2);
}
}
}
msVar.e -= j2;
this.e += j2;
j -= j2;
}
}
@Override // com.facetec.sdk.nk
public final long b(ms msVar, long j) {
if (msVar == null) {
throw new IllegalArgumentException("sink == null");
}
if (j < 0) {
throw new IllegalArgumentException("byteCount < 0: ".concat(String.valueOf(j)));
}
long j2 = this.e;
if (j2 == 0) {
return -1L;
}
if (j > j2) {
j = j2;
}
msVar.c(this, j);
return j;
}
@Override // com.facetec.sdk.mr
public final long s() {
return b((byte) 0, 0L, Long.MAX_VALUE);
}
public final long b(byte b, long j, long j2) {
nc ncVar;
long j3 = 0;
if (j < 0 || j2 < j) {
throw new IllegalArgumentException(String.format("size=%s fromIndex=%s toIndex=%s", Long.valueOf(this.e), Long.valueOf(j), Long.valueOf(j2)));
}
long j4 = this.e;
long j5 = j2 > j4 ? j4 : j2;
if (j == j5 || (ncVar = this.b) == null) {
return -1L;
}
if (j4 - j < j) {
while (j4 > j) {
ncVar = ncVar.f;
j4 -= ncVar.a - ncVar.e;
}
} else {
while (true) {
long j6 = (ncVar.a - ncVar.e) + j3;
if (j6 >= j) {
break;
}
ncVar = ncVar.i;
j3 = j6;
}
j4 = j3;
}
long j7 = j;
while (j4 < j5) {
byte[] bArr = ncVar.b;
int min = (int) Math.min(ncVar.a, (ncVar.e + j5) - j4);
for (int i = (int) ((ncVar.e + j7) - j4); i < min; i++) {
if (bArr[i] == b) {
return (i - ncVar.e) + j4;
}
}
j4 += ncVar.a - ncVar.e;
ncVar = ncVar.i;
j7 = j4;
}
return -1L;
}
@Override // com.facetec.sdk.mr
public final boolean e(mt mtVar) {
return a(mtVar, mtVar.i());
}
private boolean a(mt mtVar, int i) {
if (i < 0 || this.e < i || mtVar.i() < i) {
return false;
}
for (int i2 = 0; i2 < i; i2++) {
if (c(i2) != mtVar.d(i2)) {
return false;
}
}
return true;
}
@Override // com.facetec.sdk.nk
public final nh b() {
return nh.c;
}
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ms)) {
return false;
}
ms msVar = (ms) obj;
long j = this.e;
if (j != msVar.e) {
return false;
}
long j2 = 0;
if (j == 0) {
return true;
}
nc ncVar = this.b;
nc ncVar2 = msVar.b;
int i = ncVar.e;
int i2 = ncVar2.e;
while (j2 < this.e) {
long min = Math.min(ncVar.a - i, ncVar2.a - i2);
int i3 = 0;
while (i3 < min) {
if (ncVar.b[i] != ncVar2.b[i2]) {
return false;
}
i3++;
i++;
i2++;
}
if (i == ncVar.a) {
ncVar = ncVar.i;
i = ncVar.e;
}
if (i2 == ncVar2.a) {
ncVar2 = ncVar2.i;
i2 = ncVar2.e;
}
j2 += min;
}
return true;
}
public final int hashCode() {
nc ncVar = this.b;
if (ncVar == null) {
return 0;
}
int i = 1;
do {
int i2 = ncVar.a;
for (int i3 = ncVar.e; i3 < i2; i3++) {
i = (i * 31) + ncVar.b[i3];
}
ncVar = ncVar.i;
} while (ncVar != this.b);
return i;
}
public final String toString() {
mt niVar;
long j = this.e;
if (j <= 2147483647L) {
int i = (int) j;
if (i == 0) {
niVar = mt.a;
} else {
niVar = new ni(this, i);
}
return niVar.toString();
}
StringBuilder sb = new StringBuilder("size > Integer.MAX_VALUE: ");
sb.append(this.e);
throw new IllegalArgumentException(sb.toString());
}
public final /* synthetic */ Object clone() throws CloneNotSupportedException {
ms msVar = new ms();
if (this.e == 0) {
return msVar;
}
nc c2 = this.b.c();
msVar.b = c2;
c2.f = c2;
c2.i = c2;
nc ncVar = this.b;
while (true) {
ncVar = ncVar.i;
if (ncVar == this.b) {
msVar.e = this.e;
return msVar;
}
msVar.b.f.c(ncVar.c());
}
}
public final long c() {
return this.e;
}
@Override // com.facetec.sdk.mr
public final boolean a() {
return this.e == 0;
}
}