package o;

import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Ba0 extends AbstractC1536j0 implements InterfaceC1287gR, InterfaceC2104oz, InterfaceC0795bD {
    public static final /* synthetic */ AtomicReferenceFieldUpdater q = AtomicReferenceFieldUpdater.newUpdater(Ba0.class, Object.class, "_state$volatile");
    private volatile /* synthetic */ Object _state$volatile;
    public int p;

    public Ba0(Object obj) {
        this._state$volatile = obj;
    }

    /*  JADX ERROR: JadxOverflowException in pass: RegionMakerVisitor
        jadx.core.utils.exceptions.JadxOverflowException: Regions count limit reached
        	at jadx.core.utils.ErrorsCounter.addError(ErrorsCounter.java:59)
        	at jadx.core.utils.ErrorsCounter.error(ErrorsCounter.java:31)
        	at jadx.core.dex.attributes.nodes.NotificationAttrNode.addError(NotificationAttrNode.java:19)
        */
    /* JADX WARN: Path cross not found for [B:58:0x00f1, B:59:0x00f2], limit reached: 66 */
    /* JADX WARN: Removed duplicated region for block: B:30:0x0083 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007b, B:30:0x0083, B:33:0x008a, B:34:0x008e, B:36:0x0091, B:46:0x00b2, B:49:0x00bf, B:50:0x00db, B:56:0x00eb, B:53:0x00e2, B:55:0x00e8, B:38:0x0097, B:42:0x009e, B:21:0x0053, B:24:0x005d, B:27:0x006e), top: B:63:0x0027 }] */
    /* JADX WARN: Removed duplicated region for block: B:36:0x0091 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007b, B:30:0x0083, B:33:0x008a, B:34:0x008e, B:36:0x0091, B:46:0x00b2, B:49:0x00bf, B:50:0x00db, B:56:0x00eb, B:53:0x00e2, B:55:0x00e8, B:38:0x0097, B:42:0x009e, B:21:0x0053, B:24:0x005d, B:27:0x006e), top: B:63:0x0027 }] */
    /* JADX WARN: Removed duplicated region for block: B:40:0x009b  */
    /* JADX WARN: Removed duplicated region for block: B:41:0x009d  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x00b0  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00be  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00bf A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007b, B:30:0x0083, B:33:0x008a, B:34:0x008e, B:36:0x0091, B:46:0x00b2, B:49:0x00bf, B:50:0x00db, B:56:0x00eb, B:53:0x00e2, B:55:0x00e8, B:38:0x0097, B:42:0x009e, B:21:0x0053, B:24:0x005d, B:27:0x006e), top: B:63:0x0027 }] */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0017  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:48:0x00be -> B:28:0x007b). Please report as a decompilation issue!!! */
    @Override // o.InterfaceC2104oz
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final java.lang.Object a(o.InterfaceC2294qz r18, o.InterfaceC0220Im r19) {
        /*
            Method dump skipped, instructions count: 249
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.Ba0.a(o.qz, o.Im):java.lang.Object");
    }

    @Override // o.InterfaceC0795bD
    public final InterfaceC2104oz b(InterfaceC2747vn interfaceC2747vn, int i, int i2) {
        return ((((i < 0 || i >= 2) && i != -2) || i2 != 2) && !((i == 0 || i == -3) && i2 == 1)) ? new C1118eh(this, interfaceC2747vn, i, i2) : this;
    }

    @Override // o.InterfaceC2294qz
    public final Object c(Object obj, InterfaceC0220Im interfaceC0220Im) {
        if (obj == null) {
            obj = F3.f;
        }
        i(null, obj);
        return Oh0.a;
    }

    @Override // o.AbstractC1536j0
    public final AbstractC1631k0 e() {
        return new Ca0();
    }

    @Override // o.AbstractC1536j0
    public final AbstractC1631k0[] f() {
        return new Ca0[2];
    }

    @Override // o.InterfaceC3102za0
    public final Object getValue() {
        C2943xq c2943xq = F3.f;
        Object obj = q.get(this);
        if (obj == c2943xq) {
            return null;
        }
        return obj;
    }

    public final boolean i(Object obj, Object obj2) {
        int i;
        AbstractC1631k0[] abstractC1631k0Arr;
        C2943xq c2943xq;
        synchronized (this) {
            AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = q;
            Object obj3 = atomicReferenceFieldUpdater.get(this);
            if (obj != null && !F3.c(obj3, obj)) {
                return false;
            }
            if (F3.c(obj3, obj2)) {
                return true;
            }
            atomicReferenceFieldUpdater.set(this, obj2);
            int i2 = this.p;
            if ((i2 & 1) != 0) {
                this.p = i2 + 2;
                return true;
            }
            int i3 = i2 + 1;
            this.p = i3;
            AbstractC1631k0[] abstractC1631k0Arr2 = this.l;
            while (true) {
                Ca0[] ca0Arr = (Ca0[]) abstractC1631k0Arr2;
                if (ca0Arr != null) {
                    for (Ca0 ca0 : ca0Arr) {
                        if (ca0 != null) {
                            AtomicReference atomicReference = ca0.a;
                            while (true) {
                                Object obj4 = atomicReference.get();
                                if (obj4 != null && obj4 != (c2943xq = AbstractC0752ap.h)) {
                                    C2943xq c2943xq2 = AbstractC0752ap.g;
                                    if (obj4 != c2943xq2) {
                                        while (!atomicReference.compareAndSet(obj4, c2943xq2)) {
                                            if (atomicReference.get() != obj4) {
                                                break;
                                            }
                                        }
                                        ((C2448sg) obj4).resumeWith(Oh0.a);
                                        break;
                                    }
                                    while (!atomicReference.compareAndSet(obj4, c2943xq)) {
                                        if (atomicReference.get() != obj4) {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                synchronized (this) {
                    i = this.p;
                    if (i == i3) {
                        this.p = i3 + 1;
                        return true;
                    }
                    abstractC1631k0Arr = this.l;
                }
                abstractC1631k0Arr2 = abstractC1631k0Arr;
                i3 = i;
            }
        }
    }
}
