package zp;

import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

/* loaded from: classes3.dex */
public abstract class e {

    /* renamed from: p, reason: collision with root package name */
    private static final AtomicReferenceFieldUpdater f53541p = AtomicReferenceFieldUpdater.newUpdater(e.class, Object.class, "_next");

    /* renamed from: q, reason: collision with root package name */
    private static final AtomicReferenceFieldUpdater f53542q = AtomicReferenceFieldUpdater.newUpdater(e.class, Object.class, "_prev");
    private volatile Object _next;
    private volatile Object _prev;

    public e(e eVar) {
        this._prev = eVar;
    }

    private final e c() {
        e g10 = g();
        while (g10 != null && g10.h()) {
            g10 = (e) f53542q.get(g10);
        }
        return g10;
    }

    private final e d() {
        e e10;
        e e11 = e();
        kotlin.jvm.internal.t.d(e11);
        while (e11.h() && (e10 = e11.e()) != null) {
            e11 = e10;
        }
        return e11;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final Object f() {
        return f53541p.get(this);
    }

    public final void b() {
        f53542q.lazySet(this, null);
    }

    public final e e() {
        Object f10 = f();
        if (f10 == d.a()) {
            return null;
        }
        return (e) f10;
    }

    public final e g() {
        return (e) f53542q.get(this);
    }

    public abstract boolean h();

    public final boolean i() {
        return e() == null;
    }

    public final boolean j() {
        return androidx.concurrent.futures.b.a(f53541p, this, null, d.a());
    }

    public final void k() {
        Object obj;
        if (i()) {
            return;
        }
        while (true) {
            e c10 = c();
            e d10 = d();
            AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = f53542q;
            do {
                obj = atomicReferenceFieldUpdater.get(d10);
            } while (!androidx.concurrent.futures.b.a(atomicReferenceFieldUpdater, d10, obj, ((e) obj) == null ? null : c10));
            if (c10 != null) {
                f53541p.set(c10, d10);
            }
            if (!d10.h() || d10.i()) {
                if (c10 == null || !c10.h()) {
                    return;
                }
            }
        }
    }

    public final boolean l(e eVar) {
        return androidx.concurrent.futures.b.a(f53541p, this, null, eVar);
    }
}
