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

395 lines
14 KiB
Java

package o;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: o.fVm, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13269fVm<T, R> extends AbstractC13163fSk<R> {
private Iterable<? extends InterfaceC13169fSq<? extends T>> a;
private boolean b;
private int c;
private fSS<? super Object[], ? extends R> d;
private InterfaceC13169fSq<? extends T>[] e;
public C13269fVm(InterfaceC13169fSq<? extends T>[] interfaceC13169fSqArr, Iterable<? extends InterfaceC13169fSq<? extends T>> iterable, fSS<? super Object[], ? extends R> fss, int i, boolean z) {
this.e = interfaceC13169fSqArr;
this.a = iterable;
this.d = fss;
this.c = i;
this.b = z;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super R> interfaceC13174fSv) {
int length;
InterfaceC13169fSq<? extends T>[] interfaceC13169fSqArr = this.e;
if (interfaceC13169fSqArr == null) {
interfaceC13169fSqArr = new InterfaceC13169fSq[8];
try {
length = 0;
for (InterfaceC13169fSq<? extends T> interfaceC13169fSq : this.a) {
if (length == interfaceC13169fSqArr.length) {
InterfaceC13169fSq<? extends T>[] interfaceC13169fSqArr2 = new InterfaceC13169fSq[(length >> 2) + length];
System.arraycopy(interfaceC13169fSqArr, 0, interfaceC13169fSqArr2, 0, length);
interfaceC13169fSqArr = interfaceC13169fSqArr2;
}
interfaceC13169fSqArr[length] = (InterfaceC13169fSq) Objects.requireNonNull(interfaceC13169fSq, "The Iterator returned a null ObservableSource");
length++;
}
} catch (Throwable th) {
C13147fSI.c(th);
EnumC13195fTi.a(th, interfaceC13174fSv);
return;
}
} else {
length = interfaceC13169fSqArr.length;
}
int i = length;
if (i == 0) {
EnumC13195fTi.e(interfaceC13174fSv);
return;
}
HBt hBt = new HBt(interfaceC13174fSv, this.d, i, this.c, this.b);
IeS<T, R>[] ieSArr = hBt.h;
int length2 = ieSArr.length;
hBt.c.onSubscribe(hBt);
for (int i2 = 0; i2 < length2 && !hBt.d && !hBt.a; i2++) {
interfaceC13169fSqArr[i2].subscribe(ieSArr[i2]);
}
}
/* renamed from: o.fVm$HBt */
/* loaded from: classes6.dex */
static final class HBt<T, R> extends AtomicInteger implements fSJ {
volatile boolean a;
final boolean b;
final InterfaceC13174fSv<? super R> c;
volatile boolean d;
int e;
final C13355fYI f = new C13355fYI();
private fSS<? super Object[], ? extends R> g;
final IeS<T, R>[] h;
Object[] i;
private int j;
/* renamed from: o, reason: collision with root package name */
private C13416fZs<Object[]> f9114o;
HBt(InterfaceC13174fSv<? super R> interfaceC13174fSv, fSS<? super Object[], ? extends R> fss, int i, int i2, boolean z) {
this.c = interfaceC13174fSv;
this.g = fss;
this.b = z;
this.i = new Object[i];
IeS<T, R>[] ieSArr = new IeS[i];
for (int i3 = 0; i3 < i; i3++) {
ieSArr[i3] = new IeS<>(this, i3);
}
this.h = ieSArr;
this.f9114o = new C13416fZs<>(i2);
}
@Override // o.fSJ
public final void dispose() {
if (this.a) {
return;
}
this.a = true;
for (IeS<T, R> ieS : this.h) {
EnumC13192fTf.e(ieS);
}
e();
}
final void e() {
if (getAndIncrement() != 0) {
return;
}
C13416fZs<Object[]> c13416fZs = this.f9114o;
InterfaceC13174fSv<? super R> interfaceC13174fSv = this.c;
boolean z = this.b;
int i = 1;
while (!this.a) {
int i2 = 0;
if (!z && this.f.get() != null) {
IeS<T, R>[] ieSArr = this.h;
int length = ieSArr.length;
while (i2 < length) {
EnumC13192fTf.e(ieSArr[i2]);
i2++;
}
synchronized (this) {
this.i = null;
}
c13416fZs.e();
Throwable b = fYR.b(this.f);
if (b == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b != fYR.b) {
interfaceC13174fSv.onError(b);
return;
}
return;
}
}
boolean z2 = this.d;
Object[] b2 = c13416fZs.b();
boolean z3 = b2 == null;
if (z2 && z3) {
synchronized (this) {
this.i = null;
}
c13416fZs.e();
Throwable b3 = fYR.b(this.f);
if (b3 == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b3 != fYR.b) {
interfaceC13174fSv.onError(b3);
return;
}
return;
}
}
if (!z3) {
try {
interfaceC13174fSv.onNext((Object) Objects.requireNonNull(this.g.a(b2), "The combiner returned a null value"));
} catch (Throwable th) {
C13147fSI.c(th);
if (!fYR.c(this.f, th)) {
C13418fZu.c(th);
}
IeS<T, R>[] ieSArr2 = this.h;
int length2 = ieSArr2.length;
while (i2 < length2) {
EnumC13192fTf.e(ieSArr2[i2]);
i2++;
}
synchronized (this) {
this.i = null;
c13416fZs.e();
Throwable b4 = fYR.b(this.f);
if (b4 == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b4 != fYR.b) {
interfaceC13174fSv.onError(b4);
return;
}
return;
}
}
}
} else {
i = addAndGet(-i);
if (i == 0) {
return;
}
}
}
synchronized (this) {
this.i = null;
}
c13416fZs.e();
Throwable b5 = fYR.b(this.f);
if (b5 == null || b5 == fYR.b) {
return;
}
C13418fZu.c(b5);
}
/* JADX WARN: Multi-variable type inference failed */
final void b(int i, T t) {
boolean z;
synchronized (this) {
Object[] objArr = this.i;
if (objArr == null) {
return;
}
Object obj = objArr[i];
int i2 = this.j;
if (obj == null) {
i2++;
this.j = i2;
}
objArr[i] = t;
if (i2 == objArr.length) {
this.f9114o.b(objArr.clone());
z = true;
} else {
z = false;
}
if (z) {
e();
}
}
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.a;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fVm$IeS */
/* loaded from: classes6.dex */
public static final class IeS<T, R> extends AtomicReference<fSJ> implements InterfaceC13174fSv<T> {
private HBt<T, R> a;
private int d;
IeS(HBt<T, R> hBt, int i) {
this.a = hBt;
this.d = i;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this, fsj);
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
this.a.b(this.d, t);
}
/* JADX WARN: Code restructure failed: missing block: B:17:0x0028, code lost:
if (r4 == r6.length) goto L18;
*/
/* JADX WARN: Code restructure failed: missing block: B:19:0x002d, code lost:
if (r1 != false) goto L25;
*/
@Override // o.InterfaceC13174fSv
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void onError(java.lang.Throwable r6) {
/*
r5 = this;
o.fVm$HBt<T, R> r0 = r5.a
int r1 = r5.d
o.fYI r2 = r0.f
boolean r2 = o.fYR.c(r2, r6)
if (r2 == 0) goto L44
boolean r6 = r0.b
r2 = 0
if (r6 == 0) goto L33
monitor-enter(r0)
java.lang.Object[] r6 = r0.i // Catch: java.lang.Throwable -> L30
if (r6 != 0) goto L18
monitor-exit(r0)
return
L18:
r1 = r6[r1] // Catch: java.lang.Throwable -> L30
r3 = 1
if (r1 != 0) goto L1f
r1 = r3
goto L20
L1f:
r1 = r2
L20:
if (r1 != 0) goto L2a
int r4 = r0.e // Catch: java.lang.Throwable -> L30
int r4 = r4 + r3
r0.e = r4 // Catch: java.lang.Throwable -> L30
int r6 = r6.length // Catch: java.lang.Throwable -> L30
if (r4 != r6) goto L2c
L2a:
r0.d = r3 // Catch: java.lang.Throwable -> L30
L2c:
monitor-exit(r0)
if (r1 == 0) goto L40
goto L33
L30:
r6 = move-exception
monitor-exit(r0)
throw r6
L33:
o.fVm$IeS<T, R>[] r6 = r0.h
int r1 = r6.length
L36:
if (r2 >= r1) goto L40
r3 = r6[r2]
o.EnumC13192fTf.e(r3)
int r2 = r2 + 1
goto L36
L40:
r0.e()
goto L47
L44:
o.C13418fZu.c(r6)
L47:
return
*/
throw new UnsupportedOperationException("Method not decompiled: o.C13269fVm.IeS.onError(java.lang.Throwable):void");
}
/* JADX WARN: Code restructure failed: missing block: B:14:0x001c, code lost:
if (r5 == r2.length) goto L15;
*/
@Override // o.InterfaceC13174fSv
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void onComplete() {
/*
r6 = this;
o.fVm$HBt<T, R> r0 = r6.a
int r1 = r6.d
monitor-enter(r0)
java.lang.Object[] r2 = r0.i // Catch: java.lang.Throwable -> L34
if (r2 != 0) goto Lb
monitor-exit(r0)
return
Lb:
r1 = r2[r1] // Catch: java.lang.Throwable -> L34
r3 = 0
r4 = 1
if (r1 != 0) goto L13
r1 = r4
goto L14
L13:
r1 = r3
L14:
if (r1 != 0) goto L1e
int r5 = r0.e // Catch: java.lang.Throwable -> L34
int r5 = r5 + r4
r0.e = r5 // Catch: java.lang.Throwable -> L34
int r2 = r2.length // Catch: java.lang.Throwable -> L34
if (r5 != r2) goto L20
L1e:
r0.d = r4 // Catch: java.lang.Throwable -> L34
L20:
monitor-exit(r0)
if (r1 == 0) goto L30
o.fVm$IeS<T, R>[] r1 = r0.h
int r2 = r1.length
L26:
if (r3 >= r2) goto L30
r4 = r1[r3]
o.EnumC13192fTf.e(r4)
int r3 = r3 + 1
goto L26
L30:
r0.e()
return
L34:
r1 = move-exception
monitor-exit(r0)
throw r1
*/
throw new UnsupportedOperationException("Method not decompiled: o.C13269fVm.IeS.onComplete():void");
}
}
}