package defpackage;

import java.util.ArrayList;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlinx.coroutines.CompletionHandlerException;
import kotlinx.coroutines.JobCancellationException;
import kotlinx.coroutines.TimeoutCancellationException;
import sun.misc.Unsafe;

/* JADX INFO: renamed from: ᵕᵾᵩˆ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public class C2374 implements InterfaceC4645 {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public static final /* synthetic */ AtomicReferenceFieldUpdater f9293 = AtomicReferenceFieldUpdater.newUpdater(C2374.class, Object.class, "_state$volatile");

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public static final /* synthetic */ long f9294;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public static final /* synthetic */ AtomicReferenceFieldUpdater f9295;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public static final /* synthetic */ long f9296;
    private volatile /* synthetic */ Object _parentHandle$volatile;
    private volatile /* synthetic */ Object _state$volatile;

    static {
        Unsafe unsafe = AbstractC1929.f7689;
        f9296 = unsafe.objectFieldOffset(C2374.class.getDeclaredField("_state$volatile"));
        f9295 = AtomicReferenceFieldUpdater.newUpdater(C2374.class, Object.class, "_parentHandle$volatile");
        f9294 = unsafe.objectFieldOffset(C2374.class.getDeclaredField("_parentHandle$volatile"));
    }

    public C2374(boolean z) {
        this._state$volatile = z ? AbstractC2487.f9668 : AbstractC2487.f9670;
    }

    /* JADX INFO: renamed from: ᵡᵶ, reason: contains not printable characters */
    public static C4872 m6058(C1466 c1466) {
        while (c1466.mo4199()) {
            c1466 = c1466.m4200();
        }
        while (true) {
            c1466 = c1466.m4204();
            if (!c1466.mo4199()) {
                if (c1466 instanceof C4872) {
                    return (C4872) c1466;
                }
                if (c1466 instanceof C2404) {
                    return null;
                }
            }
        }
    }

    /* JADX INFO: renamed from: ᵵᵸᵕᵸ, reason: contains not printable characters */
    public static String m6059(Object obj) {
        if (!(obj instanceof C1731)) {
            return obj instanceof InterfaceC3004 ? ((InterfaceC3004) obj).mo3716() ? "Active" : "New" : obj instanceof C5507 ? "Cancelled" : "Completed";
        }
        C1731 c1731 = (C1731) obj;
        return c1731.m4778() ? "Cancelling" : C1731.f6929.get(c1731) == 1 ? "Completing" : "Active";
    }

    @Override // defpackage.InterfaceC5263
    public final InterfaceC1313 getKey() {
        return C3664.f13909;
    }

    @Override // defpackage.InterfaceC4645
    public final boolean isCancelled() {
        Object objM6071 = m6071();
        if (objM6071 instanceof C5507) {
            return true;
        }
        return (objM6071 instanceof C1731) && ((C1731) objM6071).m4778();
    }

    @Override // defpackage.InterfaceC4645
    public final boolean start() {
        int iM6092;
        do {
            iM6092 = m6092(m6071());
            if (iM6092 == 0) {
                return false;
            }
        } while (iM6092 != 1);
        return true;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(mo6062() + '{' + m6059(m6071()) + '}');
        sb.append('@');
        sb.append(ᵹˊᵫˋ.ᵶᵥᵝ(this));
        return sb.toString();
    }

    /* JADX WARN: Code restructure failed: missing block: B:45:0x008d, code lost:
    
        return r8;
     */
    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final InterfaceC0083 m6060(boolean z, AbstractC1389 abstractC1389) {
        C2374 c2374;
        AbstractC1389 abstractC13892;
        boolean zM4202;
        abstractC1389.f5746 = this;
        loop0: while (true) {
            Object objM6071 = this.m6071();
            if (objM6071 instanceof C2100) {
                C2100 c2100 = (C2100) objM6071;
                if (c2100.f8336) {
                    while (true) {
                        f9293.getClass();
                        Unsafe unsafe = AbstractC1929.f7689;
                        long j = f9296;
                        c2374 = this;
                        abstractC13892 = abstractC1389;
                        if (unsafe.compareAndSwapObject(c2374, j, objM6071, abstractC13892)) {
                            break loop0;
                        }
                        if (unsafe.getObjectVolatile(c2374, j) != objM6071) {
                            break;
                        }
                        this = c2374;
                        abstractC1389 = abstractC13892;
                    }
                } else {
                    c2374 = this;
                    abstractC13892 = abstractC1389;
                    c2374.m6074(c2100);
                }
                this = c2374;
                abstractC1389 = abstractC13892;
            } else {
                c2374 = this;
                abstractC13892 = abstractC1389;
                boolean z2 = objM6071 instanceof InterfaceC3004;
                C2751 c2751 = C2751.f10576;
                if (z2) {
                    InterfaceC3004 interfaceC3004 = (InterfaceC3004) objM6071;
                    C2404 c2404Mo3715 = interfaceC3004.mo3715();
                    if (c2404Mo3715 == null) {
                        c2374.m6087((AbstractC1389) objM6071);
                    } else {
                        if (abstractC13892.mo3967()) {
                            C1731 c1731 = interfaceC3004 instanceof C1731 ? (C1731) interfaceC3004 : null;
                            Throwable thM4773 = c1731 != null ? c1731.m4773() : null;
                            if (thM4773 == null) {
                                zM4202 = c2404Mo3715.m4202(abstractC13892, 5);
                            } else if (z) {
                                abstractC13892.mo3966(thM4773);
                                return c2751;
                            }
                        } else {
                            zM4202 = c2404Mo3715.m4202(abstractC13892, 1);
                        }
                        if (zM4202) {
                            break;
                        }
                    }
                    this = c2374;
                    abstractC1389 = abstractC13892;
                } else if (z) {
                    Object objM60712 = c2374.m6071();
                    C5507 c5507 = objM60712 instanceof C5507 ? (C5507) objM60712 : null;
                    abstractC13892.mo3966(c5507 != null ? c5507.f20800 : null);
                }
            }
        }
        return abstractC13892;
    }

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public final Object m6061() throws Throwable {
        Object objM6071 = m6071();
        if (objM6071 instanceof InterfaceC3004) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("This job has not completed yet");
            return null;
        }
        if (objM6071 instanceof C5507) {
            throw ((C5507) objM6071).f20800;
        }
        return AbstractC2487.m6226(objM6071);
    }

    /* JADX INFO: renamed from: ʿᵿʽᵞ, reason: contains not printable characters */
    public String mo6062() {
        return getClass().getSimpleName();
    }

    @Override // defpackage.InterfaceC4645
    /* JADX INFO: renamed from: ˀᵗ, reason: contains not printable characters */
    public final InterfaceC0083 mo6063(boolean z, boolean z2, ˀᵭ r3) {
        return m6060(z2, z ? new C4123(r3) : new C1798(r3));
    }

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public final C2404 m6064(InterfaceC3004 interfaceC3004) {
        C2404 c2404Mo3715 = interfaceC3004.mo3715();
        if (c2404Mo3715 != null) {
            return c2404Mo3715;
        }
        if (interfaceC3004 instanceof C2100) {
            return new C2404();
        }
        if (interfaceC3004 instanceof AbstractC1389) {
            m6087((AbstractC1389) interfaceC3004);
            return null;
        }
        C3226.m7364(interfaceC3004, "State should have list: ");
        return null;
    }

    /* JADX INFO: renamed from: ˁʢᵛ, reason: contains not printable characters */
    public final boolean m6065(Object obj) {
        Object objM6085;
        do {
            objM6085 = m6085(m6071(), obj);
            if (objM6085 == AbstractC2487.f9667) {
                return false;
            }
            if (objM6085 == AbstractC2487.f9664) {
                return true;
            }
        } while (objM6085 == AbstractC2487.f9665);
        mo5025(objM6085);
        return true;
    }

    /* JADX INFO: renamed from: ˁˌᵩ */
    public boolean mo3696() {
        return this instanceof C0207;
    }

    /* JADX INFO: renamed from: ˁᵺˈ */
    public void mo5789() {
    }

    /* JADX INFO: renamed from: ˆʤᵳ, reason: contains not printable characters */
    public final boolean m6066(C1731 c1731, C4872 c4872, Object obj) {
        while (AbstractC3481.m7957(c4872.f18569, false, new C4824(this, c1731, c4872, obj)) == C2751.f10576) {
            c4872 = m6058(c4872);
            if (c4872 == null) {
                return false;
            }
        }
        return true;
    }

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final boolean m6067() {
        return !(m6071() instanceof InterfaceC3004);
    }

    @Override // defpackage.InterfaceC4645
    /* JADX INFO: renamed from: ˉˆᵗ, reason: contains not printable characters */
    public final Object mo6068(AbstractC3500 abstractC3500) {
        Object objM6071;
        C5063 c5063;
        do {
            objM6071 = m6071();
            boolean z = objM6071 instanceof InterfaceC3004;
            c5063 = C5063.f19112;
            if (!z) {
                AbstractC3481.m7932(abstractC3500.mo1376());
                return c5063;
            }
        } while (m6092(objM6071) < 0);
        C3453 c3453 = new C3453(1, ˌᵨʽʙ.ᵔᵖᵹᵫ(abstractC3500));
        c3453.m7878();
        c3453.m7886(new C1780(2, AbstractC3481.m7957(this, true, new C4873(c3453))));
        Object objM7875 = c3453.m7875();
        EnumC0111 enumC0111 = EnumC0111.f1384;
        if (objM7875 != enumC0111) {
            objM7875 = c5063;
        }
        return objM7875 == enumC0111 ? objM7875 : c5063;
    }

    /* JADX WARN: Code restructure failed: missing block: B:28:0x0059, code lost:
    
        r0 = r8;
     */
    /* JADX WARN: Removed duplicated region for block: B:18:0x003c A[PHI: r0
      0x003c: PHI (r0v1 java.lang.Object) = (r0v0 java.lang.Object), (r0v9 java.lang.Object) binds: [B:3:0x0008, B:16:0x0038] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean m6069(Object obj) {
        C1735 c1735;
        Object objM6085 = AbstractC2487.f9667;
        if (mo3696()) {
            do {
                Object objM6071 = m6071();
                if (objM6071 instanceof InterfaceC3004) {
                    if (objM6071 instanceof C1731) {
                        if (C1731.f6929.get((C1731) objM6071) == 1) {
                        }
                    }
                    objM6085 = m6085(objM6071, new C5507(m6097(obj), false));
                }
                objM6085 = AbstractC2487.f9667;
                break;
            } while (objM6085 == AbstractC2487.f9665);
            if (objM6085 != AbstractC2487.f9664) {
                if (objM6085 == AbstractC2487.f9667) {
                    Throwable thM6097 = null;
                    while (true) {
                        Object objM60712 = m6071();
                        if (!(objM60712 instanceof C1731)) {
                            if (!(objM60712 instanceof InterfaceC3004)) {
                                c1735 = AbstractC2487.f9669;
                                break;
                            }
                            if (thM6097 == null) {
                                thM6097 = m6097(obj);
                            }
                            InterfaceC3004 interfaceC3004 = (InterfaceC3004) objM60712;
                            if (!interfaceC3004.mo3716()) {
                                Object objM60852 = m6085(objM60712, new C5507(thM6097, false));
                                if (objM60852 == AbstractC2487.f9667) {
                                    C3226.m7364(objM60712, "Cannot happen in ");
                                    return false;
                                }
                                if (objM60852 != AbstractC2487.f9665) {
                                    objM6085 = objM60852;
                                    break;
                                }
                            } else if (m6077(interfaceC3004, thM6097)) {
                                c1735 = AbstractC2487.f9667;
                                break;
                            }
                        } else {
                            synchronized (objM60712) {
                                if (((C1731) objM60712).m4776() == AbstractC2487.f9666) {
                                    c1735 = AbstractC2487.f9669;
                                } else {
                                    boolean zM4778 = ((C1731) objM60712).m4778();
                                    if (obj != null || !zM4778) {
                                        if (thM6097 == null) {
                                            thM6097 = m6097(obj);
                                        }
                                        ((C1731) objM60712).m4774(thM6097);
                                    }
                                    Throwable thM4773 = zM4778 ? null : ((C1731) objM60712).m4773();
                                    if (thM4773 != null) {
                                        m6090(((C1731) objM60712).f6933, thM4773);
                                    }
                                    c1735 = AbstractC2487.f9667;
                                }
                            }
                        }
                    }
                }
                if (objM6085 != AbstractC2487.f9667 && objM6085 != AbstractC2487.f9664) {
                    if (objM6085 == AbstractC2487.f9669) {
                        return false;
                    }
                    mo5025(objM6085);
                    return true;
                }
            }
        }
        return true;
    }

    /* JADX INFO: renamed from: ˉᵵᵜ */
    public boolean mo3697() {
        return true;
    }

    @Override // defpackage.InterfaceC3822
    /* JADX INFO: renamed from: ˊˌˊ */
    public final InterfaceC5263 mo2664(InterfaceC1313 interfaceC1313) {
        return ᵸᵺᵜ.ˋˈ(this, interfaceC1313);
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public final Object m6070(InterfaceC2643 interfaceC2643) throws Throwable {
        Object objM6071;
        do {
            objM6071 = m6071();
            if (!(objM6071 instanceof InterfaceC3004)) {
                if (objM6071 instanceof C5507) {
                    throw ((C5507) objM6071).f20800;
                }
                return AbstractC2487.m6226(objM6071);
            }
        } while (m6092(objM6071) < 0);
        C5039 c5039 = new C5039(ˌᵨʽʙ.ᵔᵖᵹᵫ(interfaceC2643), this);
        c5039.m7878();
        c5039.m7886(new C1780(2, AbstractC3481.m7957(this, true, new C5174(c5039))));
        return c5039.m7875();
    }

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public final Object m6071() {
        f9293.getClass();
        return AbstractC1929.f7689.getObjectVolatile(this, f9296);
    }

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public void mo6072(CancellationException cancellationException) {
        m6069(cancellationException);
    }

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public final InterfaceC2121 m6073() {
        f9295.getClass();
        return (InterfaceC2121) AbstractC1929.f7689.getObjectVolatile(this, f9294);
    }

    /* JADX INFO: renamed from: ˋʿᐧ */
    public void mo4356(Object obj) {
    }

    /* JADX INFO: renamed from: ˋᵯᵩ, reason: contains not printable characters */
    public final void m6074(C2100 c2100) {
        C2404 c2404 = new C2404();
        Object c1232 = c2100.f8336 ? c2404 : new C1232(c2404);
        while (true) {
            f9293.getClass();
            Unsafe unsafe = AbstractC1929.f7689;
            long j = f9296;
            C2374 c2374 = this;
            C2100 c21002 = c2100;
            if (unsafe.compareAndSwapObject(c2374, j, c21002, c1232) || unsafe.getObjectVolatile(c2374, j) != c21002) {
                return;
            }
            this = c2374;
            c2100 = c21002;
        }
    }

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final boolean m6075(Throwable th) {
        if (mo5024()) {
            return true;
        }
        boolean z = th instanceof CancellationException;
        InterfaceC2121 interfaceC2121M6073 = m6073();
        return (interfaceC2121M6073 == null || interfaceC2121M6073 == C2751.f10576) ? z : interfaceC2121M6073.mo5622(th) || z;
    }

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public final Object m6076(C1731 c1731, Object obj) throws Throwable {
        C1731 c17312;
        Throwable th;
        Throwable thM6089;
        C2374 c2374;
        C1731 c17313;
        C5507 c5507 = obj instanceof C5507 ? (C5507) obj : null;
        Throwable th2 = c5507 != null ? c5507.f20800 : null;
        synchronized (c1731) {
            try {
                c1731.m4778();
                ArrayList arrayListM4775 = c1731.m4775(th2);
                thM6089 = m6089(c1731, arrayListM4775);
                if (thM6089 != null) {
                    try {
                        if (arrayListM4775.size() > 1) {
                            Set setNewSetFromMap = Collections.newSetFromMap(new IdentityHashMap(arrayListM4775.size()));
                            int size = arrayListM4775.size();
                            int i = 0;
                            while (i < size) {
                                Object obj2 = arrayListM4775.get(i);
                                i++;
                                Throwable th3 = (Throwable) obj2;
                                if (th3 != thM6089 && th3 != thM6089 && !(th3 instanceof CancellationException) && setNewSetFromMap.add(th3)) {
                                    ᵷˆᵣ.ʽˈˋ(thM6089, th3);
                                }
                            }
                        }
                    } catch (Throwable th4) {
                        th = th4;
                        c17312 = c1731;
                        throw th;
                    }
                }
            } catch (Throwable th5) {
                c17312 = c1731;
                th = th5;
            }
        }
        if (thM6089 != null && thM6089 != th2) {
            obj = new C5507(thM6089, false);
        }
        if (thM6089 != null && (m6075(thM6089) || mo1017(thM6089))) {
            C5507 c55072 = (C5507) obj;
            c55072.getClass();
            C5507.f20799.compareAndSet(c55072, 0, 1);
        }
        mo4356(obj);
        AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = f9293;
        Object c5173 = obj instanceof InterfaceC3004 ? new C5173((InterfaceC3004) obj) : obj;
        while (true) {
            atomicReferenceFieldUpdater.getClass();
            Unsafe unsafe = AbstractC1929.f7689;
            long j = f9296;
            c2374 = this;
            c17313 = c1731;
            if (unsafe.compareAndSwapObject(c2374, j, c17313, c5173) || unsafe.getObjectVolatile(c2374, j) != c17313) {
                break;
            }
            this = c2374;
            c1731 = c17313;
        }
        c2374.m6094(c17313, obj);
        return obj;
    }

    /* JADX INFO: renamed from: ˏʜᵪ, reason: contains not printable characters */
    public final boolean m6077(InterfaceC3004 interfaceC3004, Throwable th) {
        C2404 c2404M6064 = m6064(interfaceC3004);
        if (c2404M6064 == null) {
            return false;
        }
        C1731 c1731 = new C1731(c2404M6064, th);
        while (true) {
            f9293.getClass();
            Unsafe unsafe = AbstractC1929.f7689;
            long j = f9296;
            C2374 c2374 = this;
            InterfaceC3004 interfaceC30042 = interfaceC3004;
            if (unsafe.compareAndSwapObject(c2374, j, interfaceC30042, c1731)) {
                c2374.m6090(c2404M6064, th);
                return true;
            }
            if (unsafe.getObjectVolatile(c2374, j) != interfaceC30042) {
                return false;
            }
            this = c2374;
            interfaceC3004 = interfaceC30042;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:35:0x007a, code lost:
    
        return r5;
     */
    @Override // defpackage.InterfaceC4645
    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final InterfaceC2121 mo6078(C2374 c2374) {
        C2374 c23742;
        C4872 c4872 = new C4872(c2374);
        c4872.f5746 = this;
        loop0: while (true) {
            Object objM6071 = this.m6071();
            if (objM6071 instanceof C2100) {
                C2100 c2100 = (C2100) objM6071;
                if (c2100.f8336) {
                    while (true) {
                        f9293.getClass();
                        Unsafe unsafe = AbstractC1929.f7689;
                        long j = f9296;
                        c23742 = this;
                        if (unsafe.compareAndSwapObject(c23742, j, objM6071, c4872)) {
                            break loop0;
                        }
                        if (unsafe.getObjectVolatile(c23742, j) != objM6071) {
                            break;
                        }
                        this = c23742;
                    }
                } else {
                    c23742 = this;
                    c23742.m6074(c2100);
                }
                this = c23742;
            } else {
                c23742 = this;
                boolean z = objM6071 instanceof InterfaceC3004;
                C2751 c2751 = C2751.f10576;
                if (!z) {
                    Object objM60712 = c23742.m6071();
                    C5507 c5507 = objM60712 instanceof C5507 ? (C5507) objM60712 : null;
                    c4872.mo3966(c5507 != null ? c5507.f20800 : null);
                    return c2751;
                }
                C2404 c2404Mo3715 = ((InterfaceC3004) objM6071).mo3715();
                if (c2404Mo3715 == null) {
                    c23742.m6087((AbstractC1389) objM6071);
                    this = c23742;
                } else if (!c2404Mo3715.m4202(c4872, 7)) {
                    boolean zM4202 = c2404Mo3715.m4202(c4872, 3);
                    Object objM60713 = c23742.m6071();
                    if (objM60713 instanceof C1731) {
                        thM4773 = ((C1731) objM60713).m4773();
                    } else {
                        C5507 c55072 = objM60713 instanceof C5507 ? (C5507) objM60713 : null;
                        if (c55072 != null) {
                            thM4773 = c55072.f20800;
                        }
                    }
                    c4872.mo3966(thM4773);
                    if (zM4202) {
                        break loop0;
                    }
                    return c2751;
                }
            }
        }
    }

    /* JADX INFO: renamed from: ˏᵩʨ, reason: contains not printable characters */
    public final Object m6079(Object obj) {
        Object objM6085;
        do {
            objM6085 = m6085(m6071(), obj);
            if (objM6085 == AbstractC2487.f9667) {
                String str = "Job " + this + " is already complete or completing, but is being completed with " + obj;
                C5507 c5507 = obj instanceof C5507 ? (C5507) obj : null;
                throw new IllegalStateException(str, c5507 != null ? c5507.f20800 : null);
            }
        } while (objM6085 == AbstractC2487.f9665);
        return objM6085;
    }

    @Override // defpackage.InterfaceC4645
    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public boolean mo6080() {
        Object objM6071 = m6071();
        return (objM6071 instanceof InterfaceC3004) && ((InterfaceC3004) objM6071).mo3716();
    }

    /* JADX INFO: renamed from: ːᵝٴᵶ, reason: contains not printable characters */
    public final void m6081(AbstractC1389 abstractC1389) {
        C2374 c2374;
        while (true) {
            Object objM6071 = this.m6071();
            if (!(objM6071 instanceof AbstractC1389)) {
                if (!(objM6071 instanceof InterfaceC3004) || ((InterfaceC3004) objM6071).mo3715() == null) {
                    return;
                }
                abstractC1389.m4203();
                return;
            }
            if (objM6071 != abstractC1389) {
                return;
            }
            while (true) {
                f9293.getClass();
                Unsafe unsafe = AbstractC1929.f7689;
                long j = f9296;
                c2374 = this;
                if (unsafe.compareAndSwapObject(c2374, j, objM6071, AbstractC2487.f9668)) {
                    return;
                }
                if (unsafe.getObjectVolatile(c2374, j) != objM6071) {
                    break;
                } else {
                    this = c2374;
                }
            }
            this = c2374;
        }
    }

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public final void m6082(InterfaceC4645 interfaceC4645) {
        C2751 c2751 = C2751.f10576;
        if (interfaceC4645 == null) {
            m6084(c2751);
            return;
        }
        interfaceC4645.start();
        InterfaceC2121 interfaceC2121Mo6078 = interfaceC4645.mo6078(this);
        m6084(interfaceC2121Mo6078);
        if (m6067()) {
            interfaceC2121Mo6078.mo1023();
            m6084(c2751);
        }
    }

    @Override // defpackage.InterfaceC3822
    /* JADX INFO: renamed from: ˑˊᵲ */
    public final InterfaceC3822 mo2665(InterfaceC1313 interfaceC1313) {
        return ᵸᵺᵜ.ˈᵲᵢ(this, interfaceC1313);
    }

    @Override // defpackage.InterfaceC4645
    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final CancellationException mo6083() {
        CancellationException cancellationException;
        Object objM6071 = m6071();
        if (objM6071 instanceof C1731) {
            Throwable thM4773 = ((C1731) objM6071).m4773();
            if (thM4773 == null) {
                C3226.m7364(this, "Job is still new or active: ");
                return null;
            }
            String strConcat = getClass().getSimpleName().concat(" is cancelling");
            cancellationException = thM4773 instanceof CancellationException ? (CancellationException) thM4773 : null;
            return cancellationException == null ? new JobCancellationException(strConcat, thM4773, this) : cancellationException;
        }
        if (objM6071 instanceof InterfaceC3004) {
            C3226.m7364(this, "Job is still new or active: ");
            return null;
        }
        if (!(objM6071 instanceof C5507)) {
            return new JobCancellationException(getClass().getSimpleName().concat(" has completed normally"), null, this);
        }
        Throwable th = ((C5507) objM6071).f20800;
        cancellationException = th instanceof CancellationException ? (CancellationException) th : null;
        return cancellationException == null ? new JobCancellationException(mo4358(), th, this) : cancellationException;
    }

    /* JADX INFO: renamed from: ᵗᵭ, reason: contains not printable characters */
    public final void m6084(InterfaceC2121 interfaceC2121) {
        f9295.getClass();
        AbstractC1929.f7689.putObjectVolatile(this, f9294, interfaceC2121);
    }

    /* JADX INFO: renamed from: ᵘᵝ, reason: contains not printable characters */
    public final Object m6085(Object obj, Object obj2) {
        if (!(obj instanceof InterfaceC3004)) {
            return AbstractC2487.f9667;
        }
        if (((obj instanceof C2100) || (obj instanceof AbstractC1389)) && !(obj instanceof C4872) && !(obj2 instanceof C5507)) {
            return m6093((InterfaceC3004) obj, obj2) ? obj2 : AbstractC2487.f9665;
        }
        InterfaceC3004 interfaceC3004 = (InterfaceC3004) obj;
        C2404 c2404M6064 = m6064(interfaceC3004);
        if (c2404M6064 == null) {
            return AbstractC2487.f9665;
        }
        C1731 c1731 = interfaceC3004 instanceof C1731 ? (C1731) interfaceC3004 : null;
        if (c1731 == null) {
            c1731 = new C1731(c2404M6064, null);
        }
        synchronized (c1731) {
            AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = C1731.f6929;
            if (atomicIntegerFieldUpdater.get(c1731) == 1) {
                return AbstractC2487.f9667;
            }
            atomicIntegerFieldUpdater.set(c1731, 1);
            if (c1731 != interfaceC3004) {
                AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = f9293;
                while (!atomicReferenceFieldUpdater.compareAndSet(this, interfaceC3004, c1731)) {
                    if (atomicReferenceFieldUpdater.get(this) != interfaceC3004) {
                        return AbstractC2487.f9665;
                    }
                }
            }
            boolean zM4778 = c1731.m4778();
            C5507 c5507 = obj2 instanceof C5507 ? (C5507) obj2 : null;
            if (c5507 != null) {
                c1731.m4774(c5507.f20800);
            }
            Throwable thM4773 = zM4778 ? null : c1731.m4773();
            if (thM4773 != null) {
                m6090(c2404M6064, thM4773);
            }
            C4872 c4872M6058 = m6058(c2404M6064);
            if (c4872M6058 != null && m6066(c1731, c4872M6058, obj2)) {
                return AbstractC2487.f9664;
            }
            c2404M6064.m4202(new C1878(2), 2);
            C4872 c4872M60582 = m6058(c2404M6064);
            return (c4872M60582 == null || !m6066(c1731, c4872M60582, obj2)) ? m6076(c1731, obj2) : AbstractC2487.f9664;
        }
    }

    @Override // defpackage.InterfaceC4645
    /* JADX INFO: renamed from: ᵛˀˊ, reason: contains not printable characters */
    public final InterfaceC0083 mo6086(InterfaceC0778 interfaceC0778) {
        return m6060(true, new C1798(interfaceC0778));
    }

    /* JADX INFO: renamed from: ᵛˑﹳ */
    public boolean mo1017(Throwable th) {
        return false;
    }

    /* JADX INFO: renamed from: ᵜᵤ, reason: contains not printable characters */
    public final void m6087(AbstractC1389 abstractC1389) {
        abstractC1389.m4206(new C2404());
        C1466 c1466M4204 = abstractC1389.m4204();
        while (true) {
            f9293.getClass();
            Unsafe unsafe = AbstractC1929.f7689;
            long j = f9296;
            C2374 c2374 = this;
            AbstractC1389 abstractC13892 = abstractC1389;
            if (unsafe.compareAndSwapObject(c2374, j, abstractC13892, c1466M4204) || unsafe.getObjectVolatile(c2374, j) != abstractC13892) {
                return;
            }
            this = c2374;
            abstractC1389 = abstractC13892;
        }
    }

    /* JADX INFO: renamed from: ᵜᵪʾ */
    public String mo4358() {
        return "Job was cancelled";
    }

    /* JADX INFO: renamed from: ᵝᵶ */
    public void mo4189(Object obj) {
        mo5025(obj);
    }

    /* JADX INFO: renamed from: ᵞᵛᵘ */
    public boolean mo5024() {
        return this instanceof C2541;
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public Object m6088(AbstractC3500 abstractC3500) {
        return m6070(abstractC3500);
    }

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public final Throwable m6089(C1731 c1731, ArrayList arrayList) {
        Object obj;
        Object obj2 = null;
        if (arrayList.isEmpty()) {
            if (c1731.m4778()) {
                return new JobCancellationException(mo4358(), null, this);
            }
            return null;
        }
        int size = arrayList.size();
        int i = 0;
        int i2 = 0;
        while (true) {
            if (i2 >= size) {
                obj = null;
                break;
            }
            obj = arrayList.get(i2);
            i2++;
            if (!(((Throwable) obj) instanceof CancellationException)) {
                break;
            }
        }
        Throwable th = (Throwable) obj;
        if (th != null) {
            return th;
        }
        Throwable th2 = (Throwable) arrayList.get(0);
        if (th2 instanceof TimeoutCancellationException) {
            int size2 = arrayList.size();
            while (true) {
                if (i >= size2) {
                    break;
                }
                Object obj3 = arrayList.get(i);
                i++;
                Throwable th3 = (Throwable) obj3;
                if (th3 != th2 && (th3 instanceof TimeoutCancellationException)) {
                    obj2 = obj3;
                    break;
                }
            }
            Throwable th4 = (Throwable) obj2;
            if (th4 != null) {
                return th4;
            }
        }
        return th2;
    }

    /* JADX INFO: renamed from: ᵡᵶᵬʤ, reason: contains not printable characters */
    public final void m6090(C2404 c2404, Throwable th) {
        c2404.m4202(new C1878(4), 4);
        CompletionHandlerException completionHandlerException = null;
        for (C1466 c1466M4204 = (C1466) c2404.m4207(); !ᵥˈᵛ.ˊᵫᵗ(c1466M4204, c2404); c1466M4204 = c1466M4204.m4204()) {
            if ((c1466M4204 instanceof AbstractC1389) && ((AbstractC1389) c1466M4204).mo3967()) {
                try {
                    ((AbstractC1389) c1466M4204).mo3966(th);
                } catch (Throwable th2) {
                    if (completionHandlerException != null) {
                        ᵷˆᵣ.ʽˈˋ(completionHandlerException, th2);
                    } else {
                        completionHandlerException = new CompletionHandlerException("Exception in completion handler " + c1466M4204 + " for " + this, th2);
                    }
                }
            }
        }
        if (completionHandlerException != null) {
            mo4360(completionHandlerException);
        }
        m6075(th);
    }

    @Override // defpackage.InterfaceC3822
    /* JADX INFO: renamed from: ᵨˈʼﹶ */
    public final InterfaceC3822 mo2666(InterfaceC3822 interfaceC3822) {
        return ᵝˉː.ˈᵲᵢ(this, interfaceC3822);
    }

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public boolean mo6091(Throwable th) {
        if (th instanceof CancellationException) {
            return true;
        }
        return m6069(th) && mo3697();
    }

    /* JADX INFO: renamed from: ᵫˈᵹ, reason: contains not printable characters */
    public final int m6092(Object obj) {
        Unsafe unsafe;
        boolean z = obj instanceof C2100;
        long j = f9296;
        AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = f9293;
        if (!z) {
            C2374 c2374 = this;
            Object obj2 = obj;
            if (!(obj2 instanceof C1232)) {
                return 0;
            }
            C2404 c2404 = ((C1232) obj2).f5199;
            do {
                atomicReferenceFieldUpdater.getClass();
                C2374 c23742 = c2374;
                unsafe = AbstractC1929.f7689;
                Object obj3 = obj2;
                boolean zCompareAndSwapObject = unsafe.compareAndSwapObject(c23742, f9296, obj3, c2404);
                c2374 = c23742;
                obj2 = obj3;
                if (zCompareAndSwapObject) {
                    c2374.mo5789();
                    return 1;
                }
            } while (unsafe.getObjectVolatile(c2374, j) == obj2);
            return -1;
        }
        if (((C2100) obj).f8336) {
            return 0;
        }
        while (true) {
            atomicReferenceFieldUpdater.getClass();
            Unsafe unsafe2 = AbstractC1929.f7689;
            C2374 c23743 = this;
            Object obj4 = obj;
            if (unsafe2.compareAndSwapObject(c23743, f9296, obj4, AbstractC2487.f9668)) {
                c23743.mo5789();
                return 1;
            }
            if (unsafe2.getObjectVolatile(c23743, j) != obj4) {
                return -1;
            }
            this = c23743;
            obj = obj4;
        }
    }

    /* JADX INFO: renamed from: ᵬᵦˋ, reason: contains not printable characters */
    public final boolean m6093(InterfaceC3004 interfaceC3004, Object obj) {
        Object c5173 = obj instanceof InterfaceC3004 ? new C5173((InterfaceC3004) obj) : obj;
        while (true) {
            f9293.getClass();
            Unsafe unsafe = AbstractC1929.f7689;
            long j = f9296;
            C2374 c2374 = this;
            InterfaceC3004 interfaceC30042 = interfaceC3004;
            if (unsafe.compareAndSwapObject(c2374, j, interfaceC30042, c5173)) {
                c2374.mo4356(obj);
                c2374.m6094(interfaceC30042, obj);
                return true;
            }
            if (unsafe.getObjectVolatile(c2374, j) != interfaceC30042) {
                return false;
            }
            this = c2374;
            interfaceC3004 = interfaceC30042;
        }
    }

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final void m6094(InterfaceC3004 interfaceC3004, Object obj) {
        InterfaceC2121 interfaceC2121M6073 = m6073();
        if (interfaceC2121M6073 != null) {
            interfaceC2121M6073.mo1023();
            m6084(C2751.f10576);
        }
        CompletionHandlerException completionHandlerException = null;
        C5507 c5507 = obj instanceof C5507 ? (C5507) obj : null;
        Throwable th = c5507 != null ? c5507.f20800 : null;
        if (interfaceC3004 instanceof AbstractC1389) {
            try {
                ((AbstractC1389) interfaceC3004).mo3966(th);
                return;
            } catch (Throwable th2) {
                mo4360(new CompletionHandlerException("Exception in completion handler " + interfaceC3004 + " for " + this, th2));
                return;
            }
        }
        C2404 c2404Mo3715 = interfaceC3004.mo3715();
        if (c2404Mo3715 != null) {
            c2404Mo3715.m4202(new C1878(1), 1);
            for (C1466 c1466M4204 = (C1466) c2404Mo3715.m4207(); !ᵥˈᵛ.ˊᵫᵗ(c1466M4204, c2404Mo3715); c1466M4204 = c1466M4204.m4204()) {
                if (c1466M4204 instanceof AbstractC1389) {
                    try {
                        ((AbstractC1389) c1466M4204).mo3966(th);
                    } catch (Throwable th3) {
                        if (completionHandlerException != null) {
                            ᵷˆᵣ.ʽˈˋ(completionHandlerException, th3);
                        } else {
                            completionHandlerException = new CompletionHandlerException("Exception in completion handler " + c1466M4204 + " for " + this, th3);
                        }
                    }
                }
            }
            if (completionHandlerException != null) {
                mo4360(completionHandlerException);
            }
        }
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public Object m6095() {
        return m6061();
    }

    @Override // defpackage.InterfaceC4645
    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public void mo6096(CancellationException cancellationException) {
        if (cancellationException == null) {
            cancellationException = new JobCancellationException(mo4358(), null, this);
        }
        mo6072(cancellationException);
    }

    /* JADX INFO: renamed from: ᵵᵬᵽ */
    public void mo4360(CompletionHandlerException completionHandlerException) {
        throw completionHandlerException;
    }

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public final Throwable m6097(Object obj) {
        Throwable thM4773;
        if (obj == null ? true : obj instanceof Throwable) {
            Throwable th = (Throwable) obj;
            return th == null ? new JobCancellationException(mo4358(), null, this) : th;
        }
        C2374 c2374 = (C2374) obj;
        Object objM6071 = c2374.m6071();
        if (objM6071 instanceof C1731) {
            thM4773 = ((C1731) objM6071).m4773();
        } else if (objM6071 instanceof C5507) {
            thM4773 = ((C5507) objM6071).f20800;
        } else {
            if (objM6071 instanceof InterfaceC3004) {
                C3226.m7364(objM6071, "Cannot be cancelling child in this state: ");
                return null;
            }
            thM4773 = null;
        }
        CancellationException cancellationException = thM4773 instanceof CancellationException ? (CancellationException) thM4773 : null;
        return cancellationException == null ? new JobCancellationException("Parent job is ".concat(m6059(objM6071)), thM4773, c2374) : cancellationException;
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ */
    public void mo5025(Object obj) {
    }

    @Override // defpackage.InterfaceC3822
    /* JADX INFO: renamed from: ᵸˆˁ */
    public final Object mo2667(Object obj, InterfaceC0321 interfaceC0321) {
        return interfaceC0321.mo1564(obj, this);
    }
}
