package d.a.t;

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

/* JADX INFO: loaded from: classes.dex */
public final class a<T> implements l<T>, b {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final l<? super T> f5921b;

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

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

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

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

    public a(l<? super T> lVar) {
        this.f5921b = lVar;
    }

    @Override // d.a.l
    public void a(Throwable th) {
        if (this.f5925f) {
            d.a.u.a.w(th);
            return;
        }
        synchronized (this) {
            boolean z = false;
            if (this.f5925f) {
                z = true;
            } else {
                if (this.f5923d) {
                    this.f5925f = true;
                    d.a.s.h.a<Object> aVar = this.f5924e;
                    if (aVar == null) {
                        aVar = new d.a.s.h.a<>(4);
                        this.f5924e = aVar;
                    }
                    aVar.f5909a[0] = e.error(th);
                    return;
                }
                this.f5925f = true;
                this.f5923d = true;
            }
            if (z) {
                d.a.u.a.w(th);
            } else {
                this.f5921b.a(th);
            }
        }
    }

    @Override // d.a.l
    public void b() {
        if (this.f5925f) {
            return;
        }
        synchronized (this) {
            if (this.f5925f) {
                return;
            }
            if (!this.f5923d) {
                this.f5925f = true;
                this.f5923d = true;
                this.f5921b.b();
            } else {
                d.a.s.h.a<Object> aVar = this.f5924e;
                if (aVar == null) {
                    aVar = new d.a.s.h.a<>(4);
                    this.f5924e = aVar;
                }
                aVar.a(e.complete());
            }
        }
    }

    @Override // d.a.l
    public void c(b bVar) {
        if (d.a.s.a.b.validate(this.f5922c, bVar)) {
            this.f5922c = bVar;
            this.f5921b.c(this);
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:62:0x0067, code lost:
    
        continue;
     */
    @Override // d.a.l
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void d(T r7) {
        /*
            r6 = this;
            boolean r0 = r6.f5925f
            if (r0 == 0) goto L5
            return
        L5:
            if (r7 != 0) goto L17
            d.a.p.b r7 = r6.f5922c
            r7.dispose()
            java.lang.NullPointerException r7 = new java.lang.NullPointerException
            java.lang.String r0 = "onNext called with null. Null values are generally not allowed in 2.x operators and sources."
            r7.<init>(r0)
            r6.a(r7)
            return
        L17:
            monitor-enter(r6)
            boolean r0 = r6.f5925f     // Catch: java.lang.Throwable -> L72
            if (r0 == 0) goto L1e
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L72
            return
        L1e:
            boolean r0 = r6.f5923d     // Catch: java.lang.Throwable -> L72
            r1 = 4
            if (r0 == 0) goto L37
            d.a.s.h.a<java.lang.Object> r0 = r6.f5924e     // Catch: java.lang.Throwable -> L72
            if (r0 != 0) goto L2e
            d.a.s.h.a r0 = new d.a.s.h.a     // Catch: java.lang.Throwable -> L72
            r0.<init>(r1)     // Catch: java.lang.Throwable -> L72
            r6.f5924e = r0     // Catch: java.lang.Throwable -> L72
        L2e:
            java.lang.Object r7 = d.a.s.h.e.next(r7)     // Catch: java.lang.Throwable -> L72
            r0.a(r7)     // Catch: java.lang.Throwable -> L72
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L72
            return
        L37:
            r0 = 1
            r6.f5923d = r0     // Catch: java.lang.Throwable -> L72
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L72
            d.a.l<? super T> r2 = r6.f5921b
            r2.d(r7)
        L40:
            monitor-enter(r6)
            d.a.s.h.a<java.lang.Object> r7 = r6.f5924e     // Catch: java.lang.Throwable -> L6f
            r2 = 0
            if (r7 != 0) goto L4a
            r6.f5923d = r2     // Catch: java.lang.Throwable -> L6f
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L6f
            goto L6e
        L4a:
            r3 = 0
            r6.f5924e = r3     // Catch: java.lang.Throwable -> L6f
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L6f
            d.a.l<? super T> r3 = r6.f5921b
            java.lang.Object[] r7 = r7.f5909a
        L52:
            if (r7 == 0) goto L6c
            r4 = r2
        L55:
            if (r4 >= r1) goto L67
            r5 = r7[r4]
            if (r5 != 0) goto L5c
            goto L67
        L5c:
            boolean r5 = d.a.s.h.e.acceptFull(r5, r3)
            if (r5 == 0) goto L64
            r2 = r0
            goto L6c
        L64:
            int r4 = r4 + 1
            goto L55
        L67:
            r7 = r7[r1]
            java.lang.Object[] r7 = (java.lang.Object[]) r7
            goto L52
        L6c:
            if (r2 == 0) goto L40
        L6e:
            return
        L6f:
            r7 = move-exception
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L6f
            throw r7
        L72:
            r7 = move-exception
            monitor-exit(r6)     // Catch: java.lang.Throwable -> L72
            throw r7
        */
        throw new UnsupportedOperationException("Method not decompiled: d.a.t.a.d(java.lang.Object):void");
    }

    @Override // d.a.p.b
    public void dispose() {
        this.f5922c.dispose();
    }

    @Override // d.a.p.b
    public boolean isDisposed() {
        return this.f5922c.isDisposed();
    }
}
