package defpackage;

import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlinx.coroutines.DispatchException;
import sun.misc.Unsafe;

/* renamed from: ᵝʤﹶ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2869 extends AbstractC4927 implements InterfaceC0571, InterfaceC4943 {
    private volatile /* synthetic */ Object _reusableCancellableContinuation$volatile;

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final Object f11118;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public Object f11119;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final AbstractC1989 f11120;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final AbstractC2687 f11121;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public static final /* synthetic */ AtomicReferenceFieldUpdater f11117 = AtomicReferenceFieldUpdater.newUpdater(C2869.class, Object.class, "_reusableCancellableContinuation$volatile");

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public static final /* synthetic */ long f11116 = AbstractC3747.f13986.objectFieldOffset(C2869.class.getDeclaredField("_reusableCancellableContinuation$volatile"));

    public C2869(AbstractC2687 abstractC2687, AbstractC1989 abstractC1989) {
        super(-1);
        this.f11121 = abstractC2687;
        this.f11120 = abstractC1989;
        this.f11119 = AbstractC1243.f5204;
        this.f11118 = abstractC1989.mo2135().mo1765(0, AbstractC2338.f9166);
    }

    public final String toString() {
        return "DispatchedContinuation[" + this.f11121 + ", " + ˁـᵛ.ᐧﾞ(this.f11120) + ']';
    }

    @Override // defpackage.InterfaceC4943
    /* renamed from: ˇʼʤˎ */
    public final void mo2134(Object obj) throws DispatchException {
        Throwable thM8872 = AbstractC4019.m8872(obj);
        Object c1411 = thM8872 == null ? obj : new C1411(thM8872, false);
        AbstractC1989 abstractC1989 = this.f11120;
        InterfaceC2262 interfaceC2262Mo2135 = abstractC1989.mo2135();
        AbstractC2687 abstractC2687 = this.f11121;
        if (AbstractC1243.m3783(abstractC2687, interfaceC2262Mo2135)) {
            this.f11119 = c1411;
            this.f18326 = 0;
            AbstractC1243.m3785(abstractC2687, abstractC1989.mo2135(), this);
            return;
        }
        AbstractC0685 abstractC0685M4289 = AbstractC1407.m4289();
        if (abstractC0685M4289.f3352 >= 4294967296L) {
            this.f11119 = c1411;
            this.f18326 = 0;
            abstractC0685M4289.m2662(this);
            return;
        }
        abstractC0685M4289.m2663(true);
        try {
            InterfaceC2262 interfaceC2262Mo21352 = abstractC1989.mo2135();
            Object objM6058 = AbstractC2338.m6058(interfaceC2262Mo21352, this.f11118);
            try {
                abstractC1989.mo2134(obj);
                while (abstractC0685M4289.m2664()) {
                }
            } finally {
                AbstractC2338.m6057(interfaceC2262Mo21352, objM6058);
            }
        } finally {
            try {
            } finally {
            }
        }
    }

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final C4385 m7009() {
        f11117.getClass();
        Object objectVolatile = AbstractC3747.f13986.getObjectVolatile(this, f11116);
        if (objectVolatile instanceof C4385) {
            return (C4385) objectVolatile;
        }
        return null;
    }

    @Override // defpackage.InterfaceC4943
    /* renamed from: ˌᵜᵹᵩ */
    public final InterfaceC2262 mo2135() {
        return this.f11120.mo2135();
    }

    @Override // defpackage.AbstractC4927
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final InterfaceC4943 mo7010() {
        return this;
    }

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public final Throwable m7011(C4385 c4385) {
        Unsafe unsafe;
        C2869 c2869;
        C4385 c43852;
        while (true) {
            f11117.getClass();
            Unsafe unsafe2 = AbstractC3747.f13986;
            long j = f11116;
            Object objectVolatile = unsafe2.getObjectVolatile(this, j);
            C0434 c0434 = AbstractC1243.f5205;
            if (objectVolatile != c0434) {
                C2869 c28692 = this;
                if (!(objectVolatile instanceof Throwable)) {
                    C4069.m8939(objectVolatile, "Inconsistent state ");
                    return null;
                }
                do {
                    unsafe = AbstractC3747.f13986;
                    if (unsafe.compareAndSwapObject(c28692, f11116, objectVolatile, (Object) null)) {
                        return (Throwable) objectVolatile;
                    }
                } while (unsafe.getObjectVolatile(c28692, j) == objectVolatile);
                ᵹˉᵞ.ˌᵜᵹᵩ("Failed requirement.");
                return null;
            }
            while (true) {
                Unsafe unsafe3 = AbstractC3747.f13986;
                c2869 = this;
                c43852 = c4385;
                if (unsafe3.compareAndSwapObject(c2869, f11116, c0434, c43852)) {
                    return null;
                }
                if (unsafe3.getObjectVolatile(c2869, j) != c0434) {
                    break;
                }
                this = c2869;
                c4385 = c43852;
            }
            this = c2869;
            c4385 = c43852;
        }
    }

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final boolean m7012() {
        f11117.getClass();
        return AbstractC3747.f13986.getObjectVolatile(this, f11116) != null;
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final C4385 m7013() {
        C2869 c2869;
        while (true) {
            f11117.getClass();
            Unsafe unsafe = AbstractC3747.f13986;
            long j = f11116;
            Object objectVolatile = unsafe.getObjectVolatile(this, j);
            C0434 c0434 = AbstractC1243.f5205;
            if (objectVolatile == null) {
                unsafe.putObjectVolatile(this, j, c0434);
                return null;
            }
            if (objectVolatile instanceof C4385) {
                while (true) {
                    Unsafe unsafe2 = AbstractC3747.f13986;
                    c2869 = this;
                    if (unsafe2.compareAndSwapObject(c2869, f11116, objectVolatile, c0434)) {
                        return (C4385) objectVolatile;
                    }
                    if (unsafe2.getObjectVolatile(c2869, j) != objectVolatile) {
                        break;
                    }
                    this = c2869;
                }
            } else {
                c2869 = this;
                if (objectVolatile != c0434 && !(objectVolatile instanceof Throwable)) {
                    C4069.m8939(objectVolatile, "Inconsistent state ");
                    return null;
                }
            }
            this = c2869;
        }
    }

    @Override // defpackage.AbstractC4927
    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final Object mo7014() {
        Object obj = this.f11119;
        this.f11119 = AbstractC1243.f5204;
        return obj;
    }

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public final boolean m7015(Throwable th) {
        C2869 c2869;
        Throwable th2;
        Unsafe unsafe;
        while (true) {
            f11117.getClass();
            Unsafe unsafe2 = AbstractC3747.f13986;
            long j = f11116;
            Object objectVolatile = unsafe2.getObjectVolatile(this, j);
            C0434 c0434 = AbstractC1243.f5205;
            if (ᵲᵝᵪ.ᵹᵝᵶ(objectVolatile, c0434)) {
                while (true) {
                    Unsafe unsafe3 = AbstractC3747.f13986;
                    C2869 c28692 = this;
                    th2 = th;
                    c2869 = c28692;
                    if (unsafe3.compareAndSwapObject(c28692, f11116, c0434, th2)) {
                        return true;
                    }
                    if (unsafe3.getObjectVolatile(c2869, j) != c0434) {
                        break;
                    }
                    this = c2869;
                    th = th2;
                }
            } else {
                c2869 = this;
                th2 = th;
                if (objectVolatile instanceof Throwable) {
                    return true;
                }
                do {
                    unsafe = AbstractC3747.f13986;
                    if (unsafe.compareAndSwapObject(c2869, f11116, objectVolatile, (Object) null)) {
                        return false;
                    }
                } while (unsafe.getObjectVolatile(c2869, j) == objectVolatile);
            }
            this = c2869;
            th = th2;
        }
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final void m7016() {
        do {
            f11117.getClass();
        } while (AbstractC3747.f13986.getObjectVolatile(this, f11116) == AbstractC1243.f5205);
    }

    @Override // defpackage.InterfaceC0571
    /* renamed from: ᵻᵢﹳᵰ */
    public final InterfaceC0571 mo2414() {
        return this.f11120;
    }
}
