package tp;

/* loaded from: classes3.dex */
public abstract class e1 extends i0 {

    /* renamed from: r, reason: collision with root package name */
    private long f36533r;

    /* renamed from: s, reason: collision with root package name */
    private boolean f36534s;

    /* renamed from: t, reason: collision with root package name */
    private sm.k f36535t;

    public static /* synthetic */ void Y(e1 e1Var, boolean z10, int i10, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: decrementUseCount");
        }
        if ((i10 & 1) != 0) {
            z10 = false;
        }
        e1Var.X(z10);
    }

    private final long a0(boolean z10) {
        return z10 ? 4294967296L : 1L;
    }

    public static /* synthetic */ void k0(e1 e1Var, boolean z10, int i10, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: incrementUseCount");
        }
        if ((i10 & 1) != 0) {
            z10 = false;
        }
        e1Var.j0(z10);
    }

    public final void X(boolean z10) {
        long a02 = this.f36533r - a0(z10);
        this.f36533r = a02;
        if (a02 <= 0 && this.f36534s) {
            shutdown();
        }
    }

    public final void e0(y0 y0Var) {
        sm.k kVar = this.f36535t;
        if (kVar == null) {
            kVar = new sm.k();
            this.f36535t = kVar;
        }
        kVar.addLast(y0Var);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public long g0() {
        sm.k kVar = this.f36535t;
        return (kVar == null || kVar.isEmpty()) ? Long.MAX_VALUE : 0L;
    }

    public final void j0(boolean z10) {
        this.f36533r += a0(z10);
        if (z10) {
            return;
        }
        this.f36534s = true;
    }

    public final boolean n0() {
        return this.f36533r >= a0(true);
    }

    public final boolean o0() {
        sm.k kVar = this.f36535t;
        if (kVar != null) {
            return kVar.isEmpty();
        }
        return true;
    }

    public abstract long p0();

    public final boolean q0() {
        y0 y0Var;
        sm.k kVar = this.f36535t;
        if (kVar == null || (y0Var = (y0) kVar.F()) == null) {
            return false;
        }
        y0Var.run();
        return true;
    }

    public boolean s0() {
        return false;
    }

    public abstract void shutdown();
}
