package Y4;

import I2.C0317a;
import V4.C0772m;
import Z4.AbstractC0869b;
import Z4.AbstractC0870c;
import Z4.AbstractC0871d;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import w4.C3137A;

/* JADX INFO: loaded from: classes3.dex */
public final class c0 extends AbstractC0869b implements H, InterfaceC0843i, Z4.u {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final /* synthetic */ AtomicReferenceFieldUpdater f8932f = AtomicReferenceFieldUpdater.newUpdater(c0.class, Object.class, "_state$volatile");
    private volatile /* synthetic */ Object _state$volatile;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f8933e;

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

    @Override // Y4.G
    public final void a() {
        throw new UnsupportedOperationException("MutableStateFlow.resetReplayCache is not supported");
    }

    @Override // Z4.u
    public final InterfaceC0843i b(A4.j jVar, int i6, X4.a aVar) {
        return (((i6 < 0 || i6 >= 2) && i6 != -2) || aVar != X4.a.f8641b) ? O.n(this, jVar, i6, aVar) : this;
    }

    @Override // Y4.G
    public final boolean c(Object obj) {
        j(obj);
        return true;
    }

    /* JADX WARN: Path cross not found for [B:58:0x00f8, B:59:0x00f9], limit reached: 66 */
    /* JADX WARN: Removed duplicated region for block: B:30:0x0085 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007d, B:30:0x0085, B:33:0x008c, B:34:0x0090, B:36:0x0093, B:46:0x00b4, B:49:0x00c4, B:50:0x00de, B:56:0x00f0, B:53:0x00e7, B:55:0x00ed, B:38:0x0099, B:42:0x00a0, B:21:0x0053, B:24:0x005d, B:27:0x006e), top: B:63:0x0027 }] */
    /* JADX WARN: Removed duplicated region for block: B:36:0x0093 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007d, B:30:0x0085, B:33:0x008c, B:34:0x0090, B:36:0x0093, B:46:0x00b4, B:49:0x00c4, B:50:0x00de, B:56:0x00f0, B:53:0x00e7, B:55:0x00ed, B:38:0x0099, B:42:0x00a0, B:21:0x0053, B:24:0x005d, B:27:0x006e), top: B:63:0x0027 }] */
    /* JADX WARN: Removed duplicated region for block: B:40:0x009d  */
    /* JADX WARN: Removed duplicated region for block: B:41:0x009f  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x00b2  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00c3  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00c4 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007d, B:30:0x0085, B:33:0x008c, B:34:0x0090, B:36:0x0093, B:46:0x00b4, B:49:0x00c4, B:50:0x00de, B:56:0x00f0, B:53:0x00e7, B:55:0x00ed, B:38:0x0099, B:42:0x00a0, 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:0x00c3 -> B:28:0x007d). Please report as a decompilation issue!!! */
    /*  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)
        */
    @Override // Y4.InterfaceC0843i
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final java.lang.Object collect(Y4.InterfaceC0844j r17, A4.d r18) {
        /*
            Method dump skipped, instruction units count: 256
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: Y4.c0.collect(Y4.j, A4.d):java.lang.Object");
    }

    @Override // Z4.AbstractC0869b
    public final AbstractC0871d e() {
        return new d0();
    }

    @Override // Y4.InterfaceC0844j
    public final Object emit(Object obj, A4.d dVar) {
        j(obj);
        return C3137A.f25453a;
    }

    @Override // Z4.AbstractC0869b
    public final AbstractC0871d[] f() {
        return new d0[2];
    }

    @Override // Y4.a0
    public final Object getValue() {
        C0317a c0317a = AbstractC0870c.f9163b;
        Object obj = f8932f.get(this);
        if (obj == c0317a) {
            return null;
        }
        return obj;
    }

    public final boolean i(Object obj, Object obj2) {
        C0317a c0317a = AbstractC0870c.f9163b;
        if (obj == null) {
            obj = c0317a;
        }
        if (obj2 == null) {
            obj2 = c0317a;
        }
        return k(obj, obj2);
    }

    public final void j(Object obj) {
        if (obj == null) {
            obj = AbstractC0870c.f9163b;
        }
        k(null, obj);
    }

    public final boolean k(Object obj, Object obj2) {
        int i6;
        AbstractC0871d[] abstractC0871dArr;
        C0317a c0317a;
        synchronized (this) {
            AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = f8932f;
            Object obj3 = atomicReferenceFieldUpdater.get(this);
            if (obj != null && !kotlin.jvm.internal.o.c(obj3, obj)) {
                return false;
            }
            if (kotlin.jvm.internal.o.c(obj3, obj2)) {
                return true;
            }
            atomicReferenceFieldUpdater.set(this, obj2);
            int i7 = this.f8933e;
            if ((i7 & 1) != 0) {
                this.f8933e = i7 + 2;
                return true;
            }
            int i8 = i7 + 1;
            this.f8933e = i8;
            AbstractC0871d[] abstractC0871dArr2 = this.f9158a;
            while (true) {
                d0[] d0VarArr = (d0[]) abstractC0871dArr2;
                if (d0VarArr != null) {
                    for (d0 d0Var : d0VarArr) {
                        if (d0Var != null) {
                            AtomicReference atomicReference = d0Var.f8937a;
                            while (true) {
                                Object obj4 = atomicReference.get();
                                if (obj4 != null && obj4 != (c0317a = O.f8892c)) {
                                    C0317a c0317a2 = O.f8891b;
                                    if (obj4 != c0317a2) {
                                        while (!atomicReference.compareAndSet(obj4, c0317a2)) {
                                            if (atomicReference.get() != obj4) {
                                                break;
                                            }
                                        }
                                        ((C0772m) obj4).resumeWith(C3137A.f25453a);
                                        break;
                                    }
                                    while (!atomicReference.compareAndSet(obj4, c0317a)) {
                                        if (atomicReference.get() != obj4) {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                synchronized (this) {
                    i6 = this.f8933e;
                    if (i6 == i8) {
                        this.f8933e = i8 + 1;
                        return true;
                    }
                    abstractC0871dArr = this.f9158a;
                }
                abstractC0871dArr2 = abstractC0871dArr;
                i8 = i6;
            }
        }
    }
}
