package c7;

import Z6.C0369i;
import b7.EnumC0551a;
import d7.AbstractC0851b;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

/* JADX INFO: loaded from: classes.dex */
public final class K extends AbstractC0851b implements InterfaceC0591B, InterfaceC0596d, d7.t {

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

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

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

    @Override // d7.AbstractC0851b
    public final d7.d b() {
        return new L();
    }

    @Override // d7.AbstractC0851b
    public final d7.d[] c() {
        return new L[2];
    }

    public final Object e() {
        B3.f fVar = d7.c.f12346b;
        Object obj = f9402u.get(this);
        if (obj == fVar) {
            return null;
        }
        return obj;
    }

    public final void f(Object obj) {
        if (obj == null) {
            obj = d7.c.f12346b;
        }
        g(null, obj);
    }

    public final boolean g(Object obj, Object obj2) throws IllegalAccessException, Z6.F, InvocationTargetException {
        int i;
        d7.d[] dVarArr;
        B3.f fVar;
        synchronized (this) {
            AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = f9402u;
            Object obj3 = atomicReferenceFieldUpdater.get(this);
            if (obj != null && !P6.g.a(obj3, obj)) {
                return false;
            }
            if (P6.g.a(obj3, obj2)) {
                return true;
            }
            atomicReferenceFieldUpdater.set(this, obj2);
            int i5 = this.f9403t;
            if ((i5 & 1) != 0) {
                this.f9403t = i5 + 2;
                return true;
            }
            int i8 = i5 + 1;
            this.f9403t = i8;
            d7.d[] dVarArr2 = this.f12342q;
            while (true) {
                L[] lArr = (L[]) dVarArr2;
                if (lArr != null) {
                    for (L l8 : lArr) {
                        if (l8 != null) {
                            AtomicReference atomicReference = l8.f9404a;
                            while (true) {
                                Object obj4 = atomicReference.get();
                                if (obj4 != null && obj4 != (fVar = H.f9391c)) {
                                    B3.f fVar2 = H.f9390b;
                                    if (obj4 != fVar2) {
                                        while (!atomicReference.compareAndSet(obj4, fVar2)) {
                                            if (atomicReference.get() != obj4) {
                                                break;
                                            }
                                        }
                                        ((C0369i) obj4).i(A6.n.f457a);
                                        break;
                                    }
                                    while (!atomicReference.compareAndSet(obj4, fVar)) {
                                        if (atomicReference.get() != obj4) {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                synchronized (this) {
                    i = this.f9403t;
                    if (i == i8) {
                        this.f9403t = i8 + 1;
                        return true;
                    }
                    dVarArr = this.f12342q;
                }
                dVarArr2 = dVarArr;
                i8 = i;
            }
        }
    }

    @Override // d7.t
    public final InterfaceC0596d i(E6.i iVar, int i, EnumC0551a enumC0551a) {
        return (((i < 0 || i >= 2) && i != -2) || enumC0551a != EnumC0551a.f9222r) ? H.j(this, iVar, i, enumC0551a) : this;
    }

    @Override // c7.InterfaceC0597e
    public final Object l(Object obj, E6.d dVar) {
        f(obj);
        return A6.n.f457a;
    }

    /* JADX WARN: Path cross not found for [B:58:0x00f7, B:59:0x00f8], limit reached: 66 */
    /* JADX WARN: Removed duplicated region for block: B:30:0x0086 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007e, B:30:0x0086, B:33:0x008d, B:34:0x0091, B:36:0x0094, B:46:0x00b5, B:49:0x00c5, B:50:0x00df, B:56:0x00f1, B:53:0x00e8, B:55:0x00ee, B:38:0x009a, B:42:0x00a1, B:21:0x0053, B:24:0x005d, B:27:0x006e), top: B:63:0x0027 }] */
    /* JADX WARN: Removed duplicated region for block: B:36:0x0094 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007e, B:30:0x0086, B:33:0x008d, B:34:0x0091, B:36:0x0094, B:46:0x00b5, B:49:0x00c5, B:50:0x00df, B:56:0x00f1, B:53:0x00e8, B:55:0x00ee, B:38:0x009a, B:42:0x00a1, B:21:0x0053, B:24:0x005d, B:27:0x006e), top: B:63:0x0027 }] */
    /* JADX WARN: Removed duplicated region for block: B:40:0x009e  */
    /* JADX WARN: Removed duplicated region for block: B:41:0x00a0  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x00b3  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00c4  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00c5 A[Catch: all -> 0x003e, TryCatch #0 {all -> 0x003e, blocks: (B:14:0x0039, B:28:0x007e, B:30:0x0086, B:33:0x008d, B:34:0x0091, B:36:0x0094, B:46:0x00b5, B:49:0x00c5, B:50:0x00df, B:56:0x00f1, B:53:0x00e8, B:55:0x00ee, B:38:0x009a, B:42:0x00a1, 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:0x00c4 -> B:28:0x007e). 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 // c7.InterfaceC0596d
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final java.lang.Object o(c7.InterfaceC0597e r17, E6.d r18) throws java.lang.Throwable {
        /*
            Method dump skipped, instruction units count: 255
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: c7.K.o(c7.e, E6.d):java.lang.Object");
    }
}
