package o;

import android.graphics.LinearGradient;
import android.graphics.Shader;
import android.os.Build;
import java.util.List;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.qL, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2232qL extends G70 {
    public final List c;
    public final long d;
    public final long e;

    public C2232qL(List list, long j, long j2) {
        this.c = list;
        this.d = j;
        this.e = j2;
    }

    @Override // o.G70
    public final Shader b(long j) {
        int i;
        int[] iArr;
        int i2;
        float[] fArr;
        long j2 = this.d;
        char c = ' ';
        int i3 = (int) (j2 >> 32);
        if (Float.intBitsToFloat(i3) == Float.POSITIVE_INFINITY) {
            i3 = (int) (j >> 32);
        }
        float fIntBitsToFloat = Float.intBitsToFloat(i3);
        long j3 = 4294967295L;
        int i4 = (int) (j2 & 4294967295L);
        if (Float.intBitsToFloat(i4) == Float.POSITIVE_INFINITY) {
            i4 = (int) (j & 4294967295L);
        }
        float fIntBitsToFloat2 = Float.intBitsToFloat(i4);
        long j4 = this.e;
        int i5 = (int) (j4 >> 32);
        if (Float.intBitsToFloat(i5) == Float.POSITIVE_INFINITY) {
            i5 = (int) (j >> 32);
        }
        float fIntBitsToFloat3 = Float.intBitsToFloat(i5);
        int i6 = (int) (j4 & 4294967295L);
        if (Float.intBitsToFloat(i6) == Float.POSITIVE_INFINITY) {
            i6 = (int) (j & 4294967295L);
        }
        float fIntBitsToFloat4 = Float.intBitsToFloat(i6);
        long jFloatToRawIntBits = (Float.floatToRawIntBits(fIntBitsToFloat) << 32) | (Float.floatToRawIntBits(fIntBitsToFloat2) & 4294967295L);
        long jFloatToRawIntBits2 = (Float.floatToRawIntBits(fIntBitsToFloat3) << 32) | (Float.floatToRawIntBits(fIntBitsToFloat4) & 4294967295L);
        List list = this.c;
        if (list.size() < 2) {
            throw new IllegalArgumentException("colors must have length of at least 2 if colorStops is omitted.");
        }
        if (Build.VERSION.SDK_INT >= 26) {
            i = 0;
        } else {
            int iR = AbstractC0008Ai.R(list);
            i = 0;
            int i7 = 1;
            while (i7 < iR) {
                char c2 = c;
                long j5 = j3;
                if (C0190Hi.d(((C0190Hi) list.get(i7)).a) == 0.0f) {
                    i++;
                }
                i7++;
                c = c2;
                j3 = j5;
            }
        }
        char c3 = c;
        long j6 = j3;
        float fIntBitsToFloat5 = Float.intBitsToFloat((int) (jFloatToRawIntBits >> c3));
        float fIntBitsToFloat6 = Float.intBitsToFloat((int) (jFloatToRawIntBits & j6));
        float fIntBitsToFloat7 = Float.intBitsToFloat((int) (jFloatToRawIntBits2 >> c3));
        float fIntBitsToFloat8 = Float.intBitsToFloat((int) (jFloatToRawIntBits2 & j6));
        if (Build.VERSION.SDK_INT >= 26) {
            int size = list.size();
            iArr = new int[size];
            for (int i8 = 0; i8 < size; i8++) {
                iArr[i8] = AbstractC0752ap.g0(((C0190Hi) list.get(i8)).a);
            }
        } else {
            iArr = new int[list.size() + i];
            int iR2 = AbstractC0008Ai.R(list);
            int size2 = list.size();
            int i9 = 0;
            for (int i10 = 0; i10 < size2; i10++) {
                long j7 = ((C0190Hi) list.get(i10)).a;
                if (C0190Hi.d(j7) == 0.0f) {
                    if (i10 == 0) {
                        i2 = i9 + 1;
                        iArr[i9] = AbstractC0752ap.g0(C0190Hi.b(0.0f, ((C0190Hi) list.get(1)).a));
                    } else if (i10 == iR2) {
                        i2 = i9 + 1;
                        iArr[i9] = AbstractC0752ap.g0(C0190Hi.b(0.0f, ((C0190Hi) list.get(i10 - 1)).a));
                    } else {
                        int i11 = i9 + 1;
                        iArr[i9] = AbstractC0752ap.g0(C0190Hi.b(0.0f, ((C0190Hi) list.get(i10 - 1)).a));
                        i9 += 2;
                        iArr[i11] = AbstractC0752ap.g0(C0190Hi.b(0.0f, ((C0190Hi) list.get(i10 + 1)).a));
                    }
                    i9 = i2;
                } else {
                    iArr[i9] = AbstractC0752ap.g0(j7);
                    i9++;
                }
            }
        }
        int[] iArr2 = iArr;
        if (i == 0) {
            fArr = null;
        } else {
            fArr = new float[list.size() + i];
            fArr[0] = 0.0f;
            int iR3 = AbstractC0008Ai.R(list);
            int i12 = 1;
            for (int i13 = 1; i13 < iR3; i13++) {
                long j8 = ((C0190Hi) list.get(i13)).a;
                float fR = i13 / AbstractC0008Ai.R(list);
                int i14 = i12 + 1;
                fArr[i12] = fR;
                if (C0190Hi.d(j8) == 0.0f) {
                    i12 += 2;
                    fArr[i14] = fR;
                } else {
                    i12 = i14;
                }
            }
            fArr[i12] = 1.0f;
        }
        return new LinearGradient(fIntBitsToFloat5, fIntBitsToFloat6, fIntBitsToFloat7, fIntBitsToFloat8, iArr2, fArr, Shader.TileMode.CLAMP);
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof C2232qL)) {
            return false;
        }
        C2232qL c2232qL = (C2232qL) obj;
        return this.c.equals(c2232qL.c) && C1765lT.b(this.d, c2232qL.d) && C1765lT.b(this.e, c2232qL.e);
    }

    public final int hashCode() {
        return Integer.hashCode(0) + AbstractC0126Ew.f(AbstractC0126Ew.f(this.c.hashCode() * 961, 31, this.d), 31, this.e);
    }

    public final String toString() {
        String str;
        long j = this.d;
        String str2 = "";
        if (((((j & 9187343241974906880L) ^ 9187343241974906880L) - 4294967297L) & (-9223372034707292160L)) == 0) {
            str = "start=" + ((Object) C1765lT.g(j)) + ", ";
        } else {
            str = "";
        }
        long j2 = this.e;
        if (((((j2 & 9187343241974906880L) ^ 9187343241974906880L) - 4294967297L) & (-9223372034707292160L)) == 0) {
            str2 = "end=" + ((Object) C1765lT.g(j2)) + ", ";
        }
        return "LinearGradient(colors=" + this.c + ", stops=null, " + str + str2 + "tileMode=" + ((Object) "Clamp") + ')';
    }
}
