package com.google.common.collect;

import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.J2ktIncompatible;
import java.util.AbstractMap;
import java.util.Map;
import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
@GwtCompatible(emulated = true, serializable = true)
@ElementTypesAreNonnullByDefault
final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> {

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final ImmutableMap f23618g = new RegularImmutableMap(null, new Object[0], 0);

    @J2ktIncompatible
    private static final long serialVersionUID = 0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final transient Object f23619d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final transient Object[] f23620e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final transient int f23621f;

    public static class EntrySet<K, V> extends ImmutableSet<Map.Entry<K, V>> {

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public final transient ImmutableMap f23622d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public final transient Object[] f23623e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final transient int f23624f = 0;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        public final transient int f23625g;

        public EntrySet(ImmutableMap immutableMap, Object[] objArr, int i10) {
            this.f23622d = immutableMap;
            this.f23623e = objArr;
            this.f23625g = i10;
        }

        @Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection
        public final boolean contains(Object obj) {
            if (!(obj instanceof Map.Entry)) {
                return false;
            }
            Map.Entry entry = (Map.Entry) obj;
            Object key = entry.getKey();
            Object value = entry.getValue();
            return value != null && value.equals(this.f23622d.get(key));
        }

        @Override // com.google.common.collect.ImmutableCollection
        public final int f(int i10, Object[] objArr) {
            return c().f(i10, objArr);
        }

        @Override // com.google.common.collect.ImmutableCollection
        public final boolean j() {
            return true;
        }

        @Override // com.google.common.collect.ImmutableCollection
        /* JADX INFO: renamed from: k */
        public final v1 iterator() {
            return c().listIterator(0);
        }

        @Override // com.google.common.collect.ImmutableSet
        public final ImmutableList q() {
            return new ImmutableList<Map.Entry<Object, Object>>() { // from class: com.google.common.collect.RegularImmutableMap.EntrySet.1
                @Override // java.util.List
                public final Object get(int i10) {
                    com.google.common.base.h.e(i10, EntrySet.this.f23625g);
                    EntrySet entrySet = EntrySet.this;
                    int i11 = i10 * 2;
                    Object obj = entrySet.f23623e[entrySet.f23624f + i11];
                    Objects.requireNonNull(obj);
                    EntrySet entrySet2 = EntrySet.this;
                    Object obj2 = entrySet2.f23623e[i11 + (entrySet2.f23624f ^ 1)];
                    Objects.requireNonNull(obj2);
                    return new AbstractMap.SimpleImmutableEntry(obj, obj2);
                }

                @Override // com.google.common.collect.ImmutableCollection
                public final boolean j() {
                    return true;
                }

                @Override // java.util.AbstractCollection, java.util.Collection, java.util.List
                public final int size() {
                    return EntrySet.this.f23625g;
                }

                @Override // com.google.common.collect.ImmutableList, com.google.common.collect.ImmutableCollection
                @J2ktIncompatible
                public Object writeReplace() {
                    return super.writeReplace();
                }
            };
        }

        @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
        public final int size() {
            return this.f23625g;
        }

        @Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
        @J2ktIncompatible
        @GwtIncompatible
        public Object writeReplace() {
            return super.writeReplace();
        }
    }

    public static final class KeySet<K> extends ImmutableSet<K> {

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public final transient ImmutableMap f23626d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public final transient ImmutableList f23627e;

        public KeySet(ImmutableMap immutableMap, ImmutableList immutableList) {
            this.f23626d = immutableMap;
            this.f23627e = immutableList;
        }

        @Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
        public final ImmutableList c() {
            return this.f23627e;
        }

        @Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection
        public final boolean contains(Object obj) {
            return this.f23626d.get(obj) != null;
        }

        @Override // com.google.common.collect.ImmutableCollection
        public final int f(int i10, Object[] objArr) {
            return this.f23627e.f(i10, objArr);
        }

        @Override // com.google.common.collect.ImmutableCollection
        public final boolean j() {
            return true;
        }

        @Override // com.google.common.collect.ImmutableCollection
        /* JADX INFO: renamed from: k */
        public final v1 iterator() {
            return this.f23627e.listIterator(0);
        }

        @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
        public final int size() {
            return this.f23626d.size();
        }

        @Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
        @J2ktIncompatible
        @GwtIncompatible
        public Object writeReplace() {
            return super.writeReplace();
        }
    }

    public static final class KeysOrValuesAsList extends ImmutableList<Object> {

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final transient Object[] f23628c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public final transient int f23629d;

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

        public KeysOrValuesAsList(Object[] objArr, int i10, int i11) {
            this.f23628c = objArr;
            this.f23629d = i10;
            this.f23630e = i11;
        }

        @Override // java.util.List
        public final Object get(int i10) {
            com.google.common.base.h.e(i10, this.f23630e);
            Object obj = this.f23628c[(i10 * 2) + this.f23629d];
            Objects.requireNonNull(obj);
            return obj;
        }

        @Override // com.google.common.collect.ImmutableCollection
        public final boolean j() {
            return true;
        }

        @Override // java.util.AbstractCollection, java.util.Collection, java.util.List
        public final int size() {
            return this.f23630e;
        }

        @Override // com.google.common.collect.ImmutableList, com.google.common.collect.ImmutableCollection
        public Object writeReplace() {
            return super.writeReplace();
        }
    }

    public RegularImmutableMap(Object obj, Object[] objArr, int i10) {
        this.f23619d = obj;
        this.f23620e = objArr;
        this.f23621f = i10;
    }

    /*  JADX ERROR: Types fix failed
        jadx.core.utils.exceptions.JadxRuntimeException: Several immutable types in one variable: [short[], byte[]], vars: [r6v3 ??, r6v5 ??, r6v4 ??, r6v6 ??]
        	at jadx.core.dex.visitors.InitCodeVariables.setCodeVarType(InitCodeVariables.java:107)
        	at jadx.core.dex.visitors.InitCodeVariables.setCodeVar(InitCodeVariables.java:83)
        	at jadx.core.dex.visitors.InitCodeVariables.initCodeVar(InitCodeVariables.java:74)
        	at jadx.core.dex.visitors.InitCodeVariables.initCodeVars(InitCodeVariables.java:48)
        	at jadx.core.dex.visitors.InitCodeVariables.rerun(InitCodeVariables.java:36)
        	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.trySplitConstInsns(FixTypesVisitor.java:580)
        	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
        */
    public static com.google.common.collect.RegularImmutableMap k(int r16, java.lang.Object[] r17, com.google.common.collect.q0 r18) {
        /*
            Method dump skipped, instruction units count: 398
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.common.collect.RegularImmutableMap.k(int, java.lang.Object[], com.google.common.collect.q0):com.google.common.collect.RegularImmutableMap");
    }

    /* JADX WARN: Removed duplicated region for block: B:4:0x0003  */
    /* JADX WARN: Removed duplicated region for block: B:4:0x0003 A[EDGE_INSN: B:44:0x0003->B:4:0x0003 BREAK  A[LOOP:0: B:16:0x0037->B:22:0x004d], EDGE_INSN: B:46:0x0003->B:4:0x0003 BREAK  A[LOOP:1: B:26:0x0062->B:32:0x0079], EDGE_INSN: B:48:0x0003->B:4:0x0003 BREAK  A[LOOP:2: B:34:0x0088->B:43:0x00a0]] */
    @Override // com.google.common.collect.ImmutableMap, java.util.Map
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object get(Object obj) {
        Object obj2;
        if (obj == null) {
            obj2 = null;
        } else {
            Object[] objArr = this.f23620e;
            if (this.f23621f == 1) {
                Object obj3 = objArr[0];
                Objects.requireNonNull(obj3);
                if (obj3.equals(obj)) {
                    obj2 = objArr[1];
                    Objects.requireNonNull(obj2);
                }
            } else {
                Object obj4 = this.f23619d;
                if (obj4 != null) {
                    if (obj4 instanceof byte[]) {
                        byte[] bArr = (byte[]) obj4;
                        int length = bArr.length - 1;
                        int iW = z0.w(obj.hashCode());
                        while (true) {
                            int i10 = iW & length;
                            int i11 = bArr[i10] & 255;
                            if (i11 == 255) {
                                break;
                            }
                            if (obj.equals(objArr[i11])) {
                                obj2 = objArr[i11 ^ 1];
                                break;
                            }
                            iW = i10 + 1;
                        }
                    } else if (obj4 instanceof short[]) {
                        short[] sArr = (short[]) obj4;
                        int length2 = sArr.length - 1;
                        int iW2 = z0.w(obj.hashCode());
                        while (true) {
                            int i12 = iW2 & length2;
                            int i13 = sArr[i12] & 65535;
                            if (i13 == 65535) {
                                break;
                            }
                            if (obj.equals(objArr[i13])) {
                                obj2 = objArr[i13 ^ 1];
                                break;
                            }
                            iW2 = i12 + 1;
                        }
                    } else {
                        int[] iArr = (int[]) obj4;
                        int length3 = iArr.length - 1;
                        int iW3 = z0.w(obj.hashCode());
                        while (true) {
                            int i14 = iW3 & length3;
                            int i15 = iArr[i14];
                            if (i15 == -1) {
                                break;
                            }
                            if (obj.equals(objArr[i15])) {
                                obj2 = objArr[i15 ^ 1];
                                break;
                            }
                            iW3 = i14 + 1;
                        }
                    }
                }
            }
        }
        if (obj2 == null) {
            return null;
        }
        return obj2;
    }

    @Override // java.util.Map
    public final int size() {
        return this.f23621f;
    }

    @Override // com.google.common.collect.ImmutableMap
    @J2ktIncompatible
    @GwtIncompatible
    public Object writeReplace() {
        return super.writeReplace();
    }
}
