package F1;

import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import r1.AbstractC0707b;

/* JADX INFO: loaded from: classes.dex */
public final class T extends kotlinx.coroutines.internal.q {

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    private static final /* synthetic */ AtomicIntegerFieldUpdater f590x = AtomicIntegerFieldUpdater.newUpdater(T.class, "_decision");
    private volatile /* synthetic */ int _decision;

    public T(q1.g gVar, q1.d dVar) {
        super(gVar, dVar);
        this._decision = 0;
    }

    private final boolean x0() {
        do {
            int i2 = this._decision;
            if (i2 != 0) {
                if (i2 == 1) {
                    return false;
                }
                throw new IllegalStateException("Already resumed");
            }
        } while (!f590x.compareAndSet(this, 0, 2));
        return true;
    }

    private final boolean y0() {
        do {
            int i2 = this._decision;
            if (i2 != 0) {
                if (i2 == 2) {
                    return false;
                }
                throw new IllegalStateException("Already suspended");
            }
        } while (!f590x.compareAndSet(this, 0, 1));
        return true;
    }

    @Override // kotlinx.coroutines.internal.q, F1.u0
    protected void p(Object obj) {
        s0(obj);
    }

    @Override // kotlinx.coroutines.internal.q, F1.AbstractC0109a
    protected void s0(Object obj) {
        if (x0()) {
            return;
        }
        kotlinx.coroutines.internal.f.c(AbstractC0707b.c(this.f5173r), C.a(obj, this.f5173r), null, 2, null);
    }

    public final Object w0() throws Throwable {
        if (y0()) {
            return AbstractC0707b.d();
        }
        Object objH = v0.h(N());
        if (objH instanceof C0143y) {
            throw ((C0143y) objH).f667a;
        }
        return objH;
    }
}
