package o; import java.util.concurrent.atomic.AtomicInteger; /* loaded from: classes6.dex */ public final class fWU extends fUX { private InterfaceC13148fSM e; public fWU(AbstractC13163fSk abstractC13163fSk, InterfaceC13148fSM interfaceC13148fSM) { super(abstractC13163fSk); this.e = interfaceC13148fSM; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { C13197fTk c13197fTk = new C13197fTk(); interfaceC13174fSv.onSubscribe(c13197fTk); new LWm(interfaceC13174fSv, this.e, c13197fTk, this.c).a(); } /* loaded from: classes6.dex */ static final class LWm extends AtomicInteger implements InterfaceC13174fSv { private C13197fTk a; private InterfaceC13148fSM b; private InterfaceC13174fSv c; private InterfaceC13169fSq d; LWm(InterfaceC13174fSv interfaceC13174fSv, InterfaceC13148fSM interfaceC13148fSM, C13197fTk c13197fTk, InterfaceC13169fSq interfaceC13169fSq) { this.c = interfaceC13174fSv; this.a = c13197fTk; this.d = interfaceC13169fSq; this.b = interfaceC13148fSM; } @Override // o.InterfaceC13174fSv public final void onNext(T t) { this.c.onNext(t); } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { this.c.onError(th); } @Override // o.InterfaceC13174fSv public final void onComplete() { try { if (this.b.c()) { this.c.onComplete(); } else { a(); } } catch (Throwable th) { C13147fSI.c(th); this.c.onError(th); } } final void a() { if (getAndIncrement() == 0) { int i = 1; do { this.d.subscribe(this); i = addAndGet(-i); } while (i != 0); } } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { EnumC13192fTf.c(this.a, fsj); } } }