package kotlin.reflect.w.internal.y0.n;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import kotlin.collections.EmptyList;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.markers.KMappedMarker;
import kotlin.jvm.internal.o;
import kotlin.reflect.KAnnotatedElement;
import kotlin.reflect.KClass;
import kotlin.reflect.w.internal.y0.o.d;
import kotlin.reflect.w.internal.y0.o.e;
import kotlin.reflect.w.internal.y0.o.r;
import kotlin.reflect.w.internal.y0.o.v;

/* JADX INFO: loaded from: classes2.dex */
public final class c1 extends e<a1<?>, a1<?>> implements Iterable<a1<?>>, KMappedMarker {

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final a f8889m = new a(null);

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static final c1 f8890n = new c1(EmptyList.f9307f);

    public static final class a extends v<a1<?>, a1<?>> {
        public a(DefaultConstructorMarker defaultConstructorMarker) {
        }

        /* JADX WARN: Multi-variable type inference failed */
        @Override // kotlin.reflect.w.internal.y0.o.v
        public <T extends a1<?>> int a(ConcurrentHashMap<KClass<? extends a1<?>>, Integer> concurrentHashMap, KClass<T> kClass, Function1<? super KClass<? extends a1<?>>, Integer> function1) {
            int iIntValue;
            o.f(concurrentHashMap, "<this>");
            o.f(kClass, "kClass");
            o.f(function1, "compute");
            Integer num = concurrentHashMap.get(kClass);
            if (num != null) {
                return num.intValue();
            }
            synchronized (concurrentHashMap) {
                Integer num2 = concurrentHashMap.get(kClass);
                if (num2 == null) {
                    Object objInvoke = ((v.a) function1).invoke(kClass);
                    concurrentHashMap.putIfAbsent(kClass, Integer.valueOf(((Number) objInvoke).intValue()));
                    num2 = (Integer) objInvoke;
                }
                o.e(num2, "this[kClass] ?: compute(…putIfAbsent(kClass, it) }");
                iIntValue = num2.intValue();
            }
            return iIntValue;
        }

        public final c1 c(List<? extends a1<?>> list) {
            o.f(list, "attributes");
            return list.isEmpty() ? c1.f8890n : new c1(list);
        }
    }

    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$PrimitiveArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    public c1(List<? extends a1<?>> list) {
        r rVar;
        for (a1<?> a1Var : list) {
            KAnnotatedElement kAnnotatedElementB = a1Var.b();
            o.f(kAnnotatedElementB, "tClass");
            o.f(a1Var, "value");
            int iB = f8889m.b(kAnnotatedElementB);
            int iA = this.f9045f.a();
            if (iA != 0) {
                if (iA == 1) {
                    KMappedMarker kMappedMarker = this.f9045f;
                    o.d(kMappedMarker, "null cannot be cast to non-null type org.jetbrains.kotlin.util.OneElementArrayMap<T of org.jetbrains.kotlin.util.AttributeArrayOwner>");
                    r rVar2 = (r) kMappedMarker;
                    int i2 = rVar2.f9059m;
                    if (i2 == iB) {
                        rVar = new r(a1Var, iB);
                    } else {
                        d dVar = new d();
                        this.f9045f = dVar;
                        dVar.c(i2, rVar2.f9058f);
                    }
                }
                this.f9045f.c(iB, a1Var);
            } else {
                rVar = new r(a1Var, iB);
            }
            this.f9045f = rVar;
        }
    }
}
