package nn;

import java.lang.ref.WeakReference;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/* loaded from: classes3.dex */
public abstract class i0 {

    /* renamed from: a, reason: collision with root package name */
    private static final ConcurrentMap f30187a = new ConcurrentHashMap();

    public static final xn.k a(Class cls) {
        kotlin.jvm.internal.t.g(cls, "<this>");
        ClassLoader f10 = yn.d.f(cls);
        q0 q0Var = new q0(f10);
        ConcurrentMap concurrentMap = f30187a;
        WeakReference weakReference = (WeakReference) concurrentMap.get(q0Var);
        if (weakReference != null) {
            xn.k kVar = (xn.k) weakReference.get();
            if (kVar != null) {
                return kVar;
            }
            concurrentMap.remove(q0Var, weakReference);
        }
        xn.k a10 = xn.k.f50940c.a(f10);
        while (true) {
            try {
                ConcurrentMap concurrentMap2 = f30187a;
                WeakReference weakReference2 = (WeakReference) concurrentMap2.putIfAbsent(q0Var, new WeakReference(a10));
                if (weakReference2 == null) {
                    return a10;
                }
                xn.k kVar2 = (xn.k) weakReference2.get();
                if (kVar2 != null) {
                    return kVar2;
                }
                concurrentMap2.remove(q0Var, weakReference2);
            } finally {
                q0Var.a(null);
            }
        }
    }
}
