package p025.p026.p027;

import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.TypeCastException;
import p402.InterfaceC6540;

/* JADX INFO: renamed from: އ.֏.֏.ކ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@InterfaceC6540
public class C1284 {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public static final AtomicReferenceFieldUpdater f4413 = AtomicReferenceFieldUpdater.newUpdater(C1284.class, Object.class, "_next");

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public static final AtomicReferenceFieldUpdater f4414 = AtomicReferenceFieldUpdater.newUpdater(C1284.class, Object.class, "_prev");

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public static final AtomicReferenceFieldUpdater f4415 = AtomicReferenceFieldUpdater.newUpdater(C1284.class, Object.class, "_removedRef");
    public volatile Object _next = this;
    public volatile Object _prev = this;
    public volatile Object _removedRef = null;

    /* JADX INFO: renamed from: އ.֏.֏.ކ$֏, reason: contains not printable characters */
    public static abstract class AbstractC1285 extends AbstractC1279<C1284> {

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public C1284 f4416;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final C1284 f4417;

        public AbstractC1285(C1284 c1284) {
            this.f4417 = c1284;
        }
    }

    /* JADX INFO: renamed from: އ.֏.֏.ކ$ؠ, reason: contains not printable characters */
    public static final class C1286 extends AbstractC1292 {
    }

    public String toString() {
        return getClass().getSimpleName() + '@' + Integer.toHexString(System.identityHashCode(this));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final int m2571(C1284 c1284, C1284 c12842, AbstractC1285 abstractC1285) {
        f4414.lazySet(c1284, this);
        f4413.lazySet(c1284, c12842);
        abstractC1285.f4416 = c12842;
        if (f4413.compareAndSet(this, c12842, abstractC1285)) {
            return abstractC1285.mo2564(this) == null ? 1 : 2;
        }
        return 0;
    }

    /* JADX WARN: Code restructure failed: missing block: B:28:0x004a, code lost:
    
        if (p025.p026.p027.C1284.f4413.compareAndSet(r3, r2, ((p025.p026.p027.C1293) r4).f4429) != false) goto L30;
     */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final C1284 m2572(AbstractC1292 abstractC1292) {
        while (true) {
            C1284 c1284 = (C1284) this._prev;
            C1284 c12842 = c1284;
            while (true) {
                C1284 c12843 = null;
                while (true) {
                    Object obj = c12842._next;
                    if (obj == this) {
                        if (c1284 == c12842 || f4414.compareAndSet(this, c1284, c12842)) {
                            return c12842;
                        }
                    } else {
                        if (mo2568()) {
                            return null;
                        }
                        if (obj == abstractC1292) {
                            return c12842;
                        }
                        if (obj instanceof AbstractC1292) {
                            if (abstractC1292 != null) {
                                AbstractC1292 abstractC12922 = (AbstractC1292) obj;
                                if (abstractC1292.mo2565() != null) {
                                    abstractC12922.mo2565();
                                }
                            }
                            ((AbstractC1292) obj).mo2564(c12842);
                        } else if (obj instanceof C1293) {
                            if (c12843 != null) {
                                break;
                            }
                            c12842 = (C1284) c12842._prev;
                        } else {
                            if (obj == null) {
                                throw new TypeCastException("null cannot be cast to non-null type kotlinx.coroutines.internal.Node /* = kotlinx.coroutines.internal.LockFreeLinkedListNode */");
                            }
                            c12843 = c12842;
                            c12842 = (C1284) obj;
                        }
                    }
                }
                c12842 = c12843;
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m2573(C1284 c1284) {
        C1284 c12842;
        do {
            c12842 = (C1284) c1284._prev;
            if (m2575() != c1284) {
                return;
            }
        } while (!f4414.compareAndSet(c1284, c12842, this));
        if (mo2568()) {
            c1284.m2572((AbstractC1292) null);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final boolean m2574(C1284 c1284, C1284 c12842) {
        f4414.lazySet(c1284, this);
        f4413.lazySet(c1284, c12842);
        if (!f4413.compareAndSet(this, c12842, c1284)) {
            return false;
        }
        c1284.m2573(c12842);
        return true;
    }

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final Object m2575() {
        while (true) {
            Object obj = this._next;
            if (!(obj instanceof AbstractC1292)) {
                return obj;
            }
            ((AbstractC1292) obj).mo2564(this);
        }
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final C1284 m2576() {
        return C1283.m2570(m2575());
    }

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final C1284 m2577() {
        C1284 c1284M2572 = m2572((AbstractC1292) null);
        if (c1284M2572 == null) {
            Object obj = this._prev;
            while (true) {
                c1284M2572 = (C1284) obj;
                if (!c1284M2572.mo2568()) {
                    break;
                }
                obj = c1284M2572._prev;
            }
        }
        return c1284M2572;
    }

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final void m2578() {
        Object objM2575 = m2575();
        if (objM2575 == null) {
            throw new TypeCastException("null cannot be cast to non-null type kotlinx.coroutines.internal.Removed");
        }
        ((C1293) objM2575).f4429.m2572((AbstractC1292) null);
    }

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final void m2579() {
        C1284 c1284 = this;
        while (true) {
            Object objM2575 = c1284.m2575();
            if (!(objM2575 instanceof C1293)) {
                c1284.m2572((AbstractC1292) null);
                return;
            }
            c1284 = ((C1293) objM2575).f4429;
        }
    }

    /* JADX INFO: renamed from: ފ */
    public boolean mo2568() {
        return m2575() instanceof C1293;
    }

    /* JADX INFO: renamed from: ދ */
    public boolean mo2569() {
        return m2580() == null;
    }

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final C1284 m2580() {
        Object objM2575;
        C1284 c1284;
        C1293 c1293;
        do {
            objM2575 = m2575();
            if (objM2575 instanceof C1293) {
                return ((C1293) objM2575).f4429;
            }
            if (objM2575 == this) {
                return (C1284) objM2575;
            }
            if (objM2575 == null) {
                throw new TypeCastException("null cannot be cast to non-null type kotlinx.coroutines.internal.Node /* = kotlinx.coroutines.internal.LockFreeLinkedListNode */");
            }
            c1284 = (C1284) objM2575;
            c1293 = (C1293) c1284._removedRef;
            if (c1293 == null) {
                c1293 = new C1293(c1284);
                f4415.lazySet(c1284, c1293);
            }
        } while (!f4413.compareAndSet(this, objM2575, c1293));
        c1284.m2572((AbstractC1292) null);
        return null;
    }
}
