package androidx.collection;

import com.google.android.gms.dynamite.descriptors.com.google.android.gms.measurement.dynamite.ModuleDescriptor;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

/* loaded from: classes.dex */
public abstract class r0 {

    /* renamed from: a, reason: collision with root package name */
    public long[] f1379a;

    /* renamed from: b, reason: collision with root package name */
    public Object[] f1380b;

    /* renamed from: c, reason: collision with root package name */
    public int f1381c;

    /* renamed from: d, reason: collision with root package name */
    public int f1382d;

    /* loaded from: classes.dex */
    public class a implements Set, en.a {
        public a() {
        }

        @Override // java.util.Set, java.util.Collection
        public boolean contains(Object obj) {
            return r0.this.a(obj);
        }

        @Override // java.util.Set, java.util.Collection
        public boolean containsAll(Collection elements) {
            kotlin.jvm.internal.t.g(elements, "elements");
            r0 r0Var = r0.this;
            Iterator it = elements.iterator();
            while (it.hasNext()) {
                if (!r0Var.a(it.next())) {
                    return false;
                }
            }
            return true;
        }

        public int e() {
            return r0.this.f1382d;
        }

        @Override // java.util.Set, java.util.Collection
        public boolean isEmpty() {
            return r0.this.d();
        }

        @Override // java.util.Set, java.util.Collection
        public final /* bridge */ int size() {
            return e();
        }

        @Override // java.util.Set, java.util.Collection
        public Object[] toArray() {
            return kotlin.jvm.internal.j.a(this);
        }

        @Override // java.util.Set, java.util.Collection
        public Object[] toArray(Object[] array) {
            kotlin.jvm.internal.t.g(array, "array");
            return kotlin.jvm.internal.j.b(this, array);
        }
    }

    /* loaded from: classes.dex */
    static final class b extends kotlin.jvm.internal.v implements dn.l {
        b() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final CharSequence invoke(Object obj) {
            return obj == r0.this ? "(this)" : String.valueOf(obj);
        }
    }

    public /* synthetic */ r0(kotlin.jvm.internal.k kVar) {
        this();
    }

    public static /* synthetic */ String g(r0 r0Var, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i10, CharSequence charSequence4, dn.l lVar, int i11, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: joinToString");
        }
        if ((i11 & 1) != 0) {
            charSequence = ", ";
        }
        CharSequence charSequence5 = (i11 & 2) != 0 ? "" : charSequence2;
        CharSequence charSequence6 = (i11 & 4) == 0 ? charSequence3 : "";
        if ((i11 & 8) != 0) {
            i10 = -1;
        }
        int i12 = i10;
        if ((i11 & 16) != 0) {
            charSequence4 = "...";
        }
        CharSequence charSequence7 = charSequence4;
        if ((i11 & 32) != 0) {
            lVar = null;
        }
        return r0Var.f(charSequence, charSequence5, charSequence6, i12, charSequence7, lVar);
    }

    /* JADX WARN: Code restructure failed: missing block: B:21:0x0072, code lost:
    
        if (((r7 & ((~r7) << 6)) & (-9187201950435737472L)) == 0) goto L23;
     */
    /* JADX WARN: Code restructure failed: missing block: B:24:0x0074, code lost:
    
        r11 = -1;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean a(Object obj) {
        int i10;
        int hashCode = (obj != null ? obj.hashCode() : 0) * (-862048943);
        int i11 = hashCode ^ (hashCode << 16);
        int i12 = i11 & ModuleDescriptor.MODULE_VERSION;
        int i13 = this.f1381c;
        int i14 = (i11 >>> 7) & i13;
        int i15 = 0;
        loop0: while (true) {
            long[] jArr = this.f1379a;
            int i16 = i14 >> 3;
            int i17 = (i14 & 7) << 3;
            long j10 = ((jArr[i16 + 1] << (64 - i17)) & ((-i17) >> 63)) | (jArr[i16] >>> i17);
            long j11 = (i12 * 72340172838076673L) ^ j10;
            long j12 = (~j11) & (j11 - 72340172838076673L) & (-9187201950435737472L);
            while (true) {
                if (!(j12 != 0)) {
                    break;
                }
                i10 = ((Long.numberOfTrailingZeros(j12) >> 3) + i14) & i13;
                if (kotlin.jvm.internal.t.b(this.f1380b[i10], obj)) {
                    break loop0;
                }
                j12 &= j12 - 1;
            }
            i15 += 8;
            i14 = (i14 + i15) & i13;
        }
        return i10 >= 0;
    }

    public final int b() {
        return this.f1381c;
    }

    public final int c() {
        return this.f1382d;
    }

    public final boolean d() {
        return this.f1382d == 0;
    }

    public final boolean e() {
        return this.f1382d != 0;
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof r0)) {
            return false;
        }
        r0 r0Var = (r0) obj;
        if (r0Var.c() != c()) {
            return false;
        }
        Object[] objArr = this.f1380b;
        long[] jArr = this.f1379a;
        int length = jArr.length - 2;
        if (length >= 0) {
            int i10 = 0;
            while (true) {
                long j10 = jArr[i10];
                if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i11 = 8 - ((~(i10 - length)) >>> 31);
                    for (int i12 = 0; i12 < i11; i12++) {
                        if (((255 & j10) < 128) && !r0Var.a(objArr[(i10 << 3) + i12])) {
                            return false;
                        }
                        j10 >>= 8;
                    }
                    if (i11 != 8) {
                        break;
                    }
                }
                if (i10 == length) {
                    break;
                }
                i10++;
            }
        }
        return true;
    }

    public final String f(CharSequence separator, CharSequence prefix, CharSequence postfix, int i10, CharSequence truncated, dn.l lVar) {
        kotlin.jvm.internal.t.g(separator, "separator");
        kotlin.jvm.internal.t.g(prefix, "prefix");
        kotlin.jvm.internal.t.g(postfix, "postfix");
        kotlin.jvm.internal.t.g(truncated, "truncated");
        StringBuilder sb2 = new StringBuilder();
        sb2.append(prefix);
        Object[] objArr = this.f1380b;
        long[] jArr = this.f1379a;
        int length = jArr.length - 2;
        if (length >= 0) {
            int i11 = 0;
            int i12 = 0;
            loop0: while (true) {
                long j10 = jArr[i11];
                if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i13 = 8;
                    int i14 = 8 - ((~(i11 - length)) >>> 31);
                    int i15 = 0;
                    while (i15 < i14) {
                        if ((j10 & 255) < 128) {
                            Object obj = objArr[(i11 << 3) + i15];
                            if (i12 == i10) {
                                sb2.append(truncated);
                                break loop0;
                            }
                            if (i12 != 0) {
                                sb2.append(separator);
                            }
                            if (lVar == null) {
                                sb2.append(obj);
                            } else {
                                sb2.append((CharSequence) lVar.invoke(obj));
                            }
                            i12++;
                        }
                        j10 >>= 8;
                        i15++;
                        i13 = 8;
                    }
                    if (i14 != i13) {
                        break;
                    }
                }
                if (i11 == length) {
                    break;
                }
                i11++;
            }
            String sb3 = sb2.toString();
            kotlin.jvm.internal.t.f(sb3, "StringBuilder().apply(builderAction).toString()");
            return sb3;
        }
        sb2.append(postfix);
        String sb32 = sb2.toString();
        kotlin.jvm.internal.t.f(sb32, "StringBuilder().apply(builderAction).toString()");
        return sb32;
    }

    public int hashCode() {
        Object[] objArr = this.f1380b;
        long[] jArr = this.f1379a;
        int length = jArr.length - 2;
        int i10 = 0;
        if (length >= 0) {
            int i11 = 0;
            int i12 = 0;
            while (true) {
                long j10 = jArr[i11];
                if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i13 = 8 - ((~(i11 - length)) >>> 31);
                    for (int i14 = 0; i14 < i13; i14++) {
                        if ((255 & j10) < 128) {
                            Object obj = objArr[(i11 << 3) + i14];
                            i12 += obj != null ? obj.hashCode() : 0;
                        }
                        j10 >>= 8;
                    }
                    if (i13 != 8) {
                        return i12;
                    }
                }
                if (i11 == length) {
                    i10 = i12;
                    break;
                }
                i11++;
            }
        }
        return i10;
    }

    public String toString() {
        return g(this, null, "[", "]", 0, null, new b(), 25, null);
    }

    private r0() {
        this.f1379a = q0.f1375a;
        this.f1380b = w.a.f40530c;
    }
}
