package d.a.w;

import d.a.l;
import d.a.s.h.e;

/* JADX INFO: loaded from: classes.dex */
public final class b<T> extends c<T> {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final c<T> f5925b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f5926c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public d.a.s.h.a<Object> f5927d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public volatile boolean f5928e;

    public b(c<T> cVar) {
        this.f5925b = cVar;
    }

    @Override // d.a.l
    public void a(Throwable th) {
        if (this.f5928e) {
            d.a.u.a.v(th);
            return;
        }
        synchronized (this) {
            boolean z = false;
            if (this.f5928e) {
                z = true;
            } else {
                this.f5928e = true;
                if (this.f5926c) {
                    d.a.s.h.a<Object> aVar = this.f5927d;
                    if (aVar == null) {
                        aVar = new d.a.s.h.a<>(4);
                        this.f5927d = aVar;
                    }
                    aVar.f5894a[0] = e.error(th);
                    return;
                }
                this.f5926c = true;
            }
            if (z) {
                d.a.u.a.v(th);
            } else {
                this.f5925b.a(th);
            }
        }
    }

    @Override // d.a.l
    public void b() {
        if (this.f5928e) {
            return;
        }
        synchronized (this) {
            if (this.f5928e) {
                return;
            }
            this.f5928e = true;
            if (!this.f5926c) {
                this.f5926c = true;
                this.f5925b.b();
                return;
            }
            d.a.s.h.a<Object> aVar = this.f5927d;
            if (aVar == null) {
                aVar = new d.a.s.h.a<>(4);
                this.f5927d = aVar;
            }
            aVar.a(e.complete());
        }
    }

    @Override // d.a.l
    public void c(d.a.p.b bVar) {
        boolean z = true;
        if (!this.f5928e) {
            synchronized (this) {
                if (!this.f5928e) {
                    if (this.f5926c) {
                        d.a.s.h.a<Object> aVar = this.f5927d;
                        if (aVar == null) {
                            aVar = new d.a.s.h.a<>(4);
                            this.f5927d = aVar;
                        }
                        aVar.a(e.disposable(bVar));
                        return;
                    }
                    this.f5926c = true;
                    z = false;
                }
            }
        }
        if (z) {
            bVar.dispose();
        } else {
            this.f5925b.c(bVar);
            s();
        }
    }

    @Override // d.a.l
    public void d(T t) {
        if (this.f5928e) {
            return;
        }
        synchronized (this) {
            if (this.f5928e) {
                return;
            }
            if (!this.f5926c) {
                this.f5926c = true;
                this.f5925b.d(t);
                s();
            } else {
                d.a.s.h.a<Object> aVar = this.f5927d;
                if (aVar == null) {
                    aVar = new d.a.s.h.a<>(4);
                    this.f5927d = aVar;
                }
                aVar.a(e.next(t));
            }
        }
    }

    @Override // d.a.h
    public void o(l<? super T> lVar) {
        this.f5925b.e(lVar);
    }

    /* JADX WARN: Code restructure failed: missing block: B:32:0x0027, code lost:
    
        continue;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void s() {
        /*
            r6 = this;
        L0:
            monitor-enter(r6)
            d.a.s.h.a<java.lang.Object> r0 = r6.f5927d     // Catch: java.lang.Throwable -> L2c
            r1 = 0
            if (r0 != 0) goto La
            r6.f5926c = r1     // Catch: java.lang.Throwable -> L2c
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L2c
            return
        La:
            r2 = 0
            r6.f5927d = r2     // Catch: java.lang.Throwable -> L2c
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L2c
            java.lang.Object[] r0 = r0.f5894a
            r2 = 4
        L11:
            if (r0 == 0) goto L0
            r3 = r1
        L14:
            if (r3 >= r2) goto L27
            r4 = r0[r3]
            if (r4 != 0) goto L1b
            goto L27
        L1b:
            d.a.w.c<T> r5 = r6.f5925b
            boolean r4 = d.a.s.h.e.acceptFull(r4, r5)
            if (r4 == 0) goto L24
            goto L0
        L24:
            int r3 = r3 + 1
            goto L14
        L27:
            r0 = r0[r2]
            java.lang.Object[] r0 = (java.lang.Object[]) r0
            goto L11
        L2c:
            r0 = move-exception
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L2c
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: d.a.w.b.s():void");
    }
}
