package o; import o.AbstractC13173fSu; /* loaded from: classes6.dex */ public final class fWH extends fUX { private boolean a; private AbstractC13173fSu d; private int e; public fWH(InterfaceC13169fSq interfaceC13169fSq, AbstractC13173fSu abstractC13173fSu, boolean z, int i) { super(interfaceC13169fSq); this.d = abstractC13173fSu; this.a = z; this.e = i; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { AbstractC13173fSu abstractC13173fSu = this.d; if (abstractC13173fSu instanceof fYE) { this.c.subscribe(interfaceC13174fSv); } else { this.c.subscribe(new IeS(interfaceC13174fSv, abstractC13173fSu.c(), this.a, this.e)); } } /* loaded from: classes6.dex */ static final class IeS extends AbstractC13183fTH implements InterfaceC13174fSv, Runnable { private InterfaceC13174fSv a; private boolean b; private volatile boolean c; private volatile boolean d; private int e; private boolean f; private fSJ g; private int h; private InterfaceC13414fZq i; private Throwable j; /* renamed from: o, reason: collision with root package name */ private AbstractC13173fSu.Sts f9119o; IeS(InterfaceC13174fSv interfaceC13174fSv, AbstractC13173fSu.Sts sts, boolean z, int i) { this.a = interfaceC13174fSv; this.f9119o = sts; this.b = z; this.e = i; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.g, fsj)) { this.g = fsj; if (fsj instanceof InterfaceC13412fZo) { InterfaceC13412fZo interfaceC13412fZo = (InterfaceC13412fZo) fsj; int b = interfaceC13412fZo.b(7); if (b == 1) { this.h = b; this.i = interfaceC13412fZo; this.d = true; this.a.onSubscribe(this); if (getAndIncrement() == 0) { this.f9119o.c(this); return; } return; } if (b == 2) { this.h = b; this.i = interfaceC13412fZo; this.a.onSubscribe(this); return; } } this.i = new C13416fZs(this.e); this.a.onSubscribe(this); } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (this.d) { return; } if (this.h != 2) { this.i.b(t); } if (getAndIncrement() == 0) { this.f9119o.c(this); } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.d) { C13418fZu.c(th); return; } this.j = th; this.d = true; if (getAndIncrement() == 0) { this.f9119o.c(this); } } @Override // o.fSJ public final void dispose() { if (this.c) { return; } this.c = true; this.g.dispose(); this.f9119o.dispose(); if (this.f || getAndIncrement() != 0) { return; } this.i.e(); } /* JADX WARN: Code restructure failed: missing block: B:43:0x0070, code lost: r3 = addAndGet(-r3); */ /* JADX WARN: Code restructure failed: missing block: B:44:0x0075, code lost: if (r3 != 0) goto L52; */ /* JADX WARN: Code restructure failed: missing block: B:46:0x0077, code lost: return; */ @Override // java.lang.Runnable /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void run() { /* r7 = this; boolean r0 = r7.f r1 = 1 if (r0 == 0) goto L4c r0 = r1 L6: boolean r2 = r7.c if (r2 != 0) goto L4b boolean r2 = r7.d java.lang.Throwable r3 = r7.j boolean r4 = r7.b if (r4 != 0) goto L25 if (r2 == 0) goto L25 if (r3 == 0) goto L25 r7.c = r1 o.fSv r0 = r7.a java.lang.Throwable r1 = r7.j r0.onError(r1) o.fSu$Sts r0 = r7.f9119o r0.dispose() return L25: o.fSv r3 = r7.a r4 = 0 r3.onNext(r4) if (r2 == 0) goto L44 r7.c = r1 java.lang.Throwable r0 = r7.j if (r0 == 0) goto L39 o.fSv r1 = r7.a r1.onError(r0) goto L3e L39: o.fSv r0 = r7.a r0.onComplete() L3e: o.fSu$Sts r0 = r7.f9119o r0.dispose() return L44: int r0 = -r0 int r0 = r7.addAndGet(r0) if (r0 != 0) goto L6 L4b: return L4c: o.fZq r0 = r7.i o.fSv r2 = r7.a r3 = r1 L51: boolean r4 = r7.d boolean r5 = r0.c() boolean r4 = r7.e(r4, r5, r2) if (r4 != 0) goto L92 L5d: boolean r4 = r7.d java.lang.Object r5 = r0.b() // Catch: java.lang.Throwable -> L7c if (r5 != 0) goto L67 r6 = r1 goto L68 L67: r6 = 0 L68: boolean r4 = r7.e(r4, r6, r2) if (r4 != 0) goto L92 if (r6 == 0) goto L78 int r3 = -r3 int r3 = r7.addAndGet(r3) if (r3 != 0) goto L51 return L78: r2.onNext(r5) goto L5d L7c: r3 = move-exception o.C13147fSI.c(r3) r7.c = r1 o.fSJ r1 = r7.g r1.dispose() r0.e() r2.onError(r3) o.fSu$Sts r0 = r7.f9119o r0.dispose() L92: return */ throw new UnsupportedOperationException("Method not decompiled: o.fWH.IeS.run():void"); } private boolean e(boolean z, boolean z2, InterfaceC13174fSv interfaceC13174fSv) { if (this.c) { this.i.e(); return true; } if (!z) { return false; } Throwable th = this.j; if (this.b) { if (!z2) { return false; } this.c = true; if (th != null) { interfaceC13174fSv.onError(th); } else { interfaceC13174fSv.onComplete(); } this.f9119o.dispose(); return true; } if (th != null) { this.c = true; this.i.e(); interfaceC13174fSv.onError(th); this.f9119o.dispose(); return true; } if (!z2) { return false; } this.c = true; interfaceC13174fSv.onComplete(); this.f9119o.dispose(); return true; } @Override // o.InterfaceC13414fZq public final T b() throws Throwable { return this.i.b(); } @Override // o.InterfaceC13414fZq public final void e() { this.i.e(); } @Override // o.InterfaceC13414fZq public final boolean c() { return this.i.c(); } @Override // o.InterfaceC13174fSv public final void onComplete() { if (this.d) { return; } this.d = true; if (getAndIncrement() == 0) { this.f9119o.c(this); } } @Override // o.InterfaceC13413fZp public final int b(int i) { if ((i & 2) == 0) { return 0; } this.f = true; return 2; } @Override // o.fSJ public final boolean isDisposed() { return this.c; } } }