package o; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; /* renamed from: o.fXe, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C13331fXe extends fUX { private InterfaceC13169fSq b; private boolean e; public C13331fXe(InterfaceC13169fSq interfaceC13169fSq, InterfaceC13169fSq interfaceC13169fSq2, boolean z) { super(interfaceC13169fSq); this.b = interfaceC13169fSq2; this.e = z; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { C13406fZi c13406fZi = new C13406fZi(interfaceC13174fSv); if (this.e) { this.c.subscribe(new RVV(c13406fZi, this.b)); } else { this.c.subscribe(new Sts(c13406fZi, this.b)); } } /* renamed from: o.fXe$HBt */ /* loaded from: classes6.dex */ static abstract class HBt extends AtomicReference implements InterfaceC13174fSv, fSJ { private InterfaceC13169fSq b; fSJ c; final InterfaceC13174fSv d; final AtomicReference e = new AtomicReference<>(); abstract void a(); abstract void b(); HBt(InterfaceC13174fSv interfaceC13174fSv, InterfaceC13169fSq interfaceC13169fSq) { this.d = interfaceC13174fSv; this.b = interfaceC13169fSq; } @Override // o.InterfaceC13174fSv public void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.c, fsj)) { this.c = fsj; this.d.onSubscribe(this); if (this.e.get() == null) { this.b.subscribe(new IeS(this)); } } } @Override // o.InterfaceC13174fSv public void onNext(T t) { lazySet(t); } @Override // o.InterfaceC13174fSv public void onError(Throwable th) { EnumC13192fTf.e(this.e); this.d.onError(th); } @Override // o.InterfaceC13174fSv public void onComplete() { EnumC13192fTf.e(this.e); b(); } @Override // o.fSJ public void dispose() { EnumC13192fTf.e(this.e); this.c.dispose(); } @Override // o.fSJ public boolean isDisposed() { return this.e.get() == EnumC13192fTf.DISPOSED; } } /* renamed from: o.fXe$IeS */ /* loaded from: classes6.dex */ static final class IeS implements InterfaceC13174fSv { private HBt c; IeS(HBt hBt) { this.c = hBt; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { EnumC13192fTf.a(this.c.e, fsj); } @Override // o.InterfaceC13174fSv public final void onNext(Object obj) { this.c.a(); } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { HBt hBt = this.c; hBt.c.dispose(); hBt.d.onError(th); } @Override // o.InterfaceC13174fSv public final void onComplete() { HBt hBt = this.c; hBt.c.dispose(); hBt.b(); } } /* renamed from: o.fXe$Sts */ /* loaded from: classes6.dex */ static final class Sts extends HBt { Sts(InterfaceC13174fSv interfaceC13174fSv, InterfaceC13169fSq interfaceC13169fSq) { super(interfaceC13174fSv, interfaceC13169fSq); } @Override // o.C13331fXe.HBt final void b() { this.d.onComplete(); } @Override // o.C13331fXe.HBt final void a() { T andSet = getAndSet(null); if (andSet != null) { this.d.onNext(andSet); } } } /* renamed from: o.fXe$RVV */ /* loaded from: classes6.dex */ static final class RVV extends HBt { private volatile boolean a; private AtomicInteger b; RVV(InterfaceC13174fSv interfaceC13174fSv, InterfaceC13169fSq interfaceC13169fSq) { super(interfaceC13174fSv, interfaceC13169fSq); this.b = new AtomicInteger(); } @Override // o.C13331fXe.HBt final void b() { this.a = true; if (this.b.getAndIncrement() == 0) { T andSet = getAndSet(null); if (andSet != null) { this.d.onNext(andSet); } this.d.onComplete(); } } @Override // o.C13331fXe.HBt final void a() { if (this.b.getAndIncrement() != 0) { return; } do { boolean z = this.a; T andSet = getAndSet(null); if (andSet != null) { this.d.onNext(andSet); } if (z) { this.d.onComplete(); return; } } while (this.b.decrementAndGet() != 0); } } }