package kotlinx.coroutines.internal;

import androidx.media3.common.C;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlinx.coroutines.l1;

/* JADX INFO: loaded from: classes.dex */
public abstract class s extends d implements l1 {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final /* synthetic */ AtomicIntegerFieldUpdater f29486d = AtomicIntegerFieldUpdater.newUpdater(s.class, "cleanedAndPointers$volatile");

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final long f29487c;
    private volatile /* synthetic */ int cleanedAndPointers$volatile;

    public s(long j10, s sVar, int i10) {
        super(sVar);
        this.f29487c = j10;
        this.cleanedAndPointers$volatile = i10 << 16;
    }

    @Override // kotlinx.coroutines.internal.d
    public final boolean c() {
        return f29486d.get(this) == f() && b() != null;
    }

    public final boolean e() {
        return f29486d.addAndGet(this, -65536) == f() && b() != null;
    }

    public abstract int f();

    public abstract void g(int i10, kotlin.coroutines.h hVar);

    public final void h() {
        if (f29486d.incrementAndGet(this) == f()) {
            d();
        }
    }

    public final boolean i() {
        AtomicIntegerFieldUpdater atomicIntegerFieldUpdater;
        int i10;
        do {
            atomicIntegerFieldUpdater = f29486d;
            i10 = atomicIntegerFieldUpdater.get(this);
            if (i10 == f() && b() != null) {
                return false;
            }
        } while (!atomicIntegerFieldUpdater.compareAndSet(this, i10, C.DEFAULT_BUFFER_SEGMENT_SIZE + i10));
        return true;
    }
}
