package p071y;

import p073z.C1865a;

/* renamed from: y.a */
/* loaded from: classes.dex */
public class C1807a {

    /* renamed from: a */
    public final float f4523a;

    /* renamed from: b */
    public final float f4524b;

    /* renamed from: c */
    public final float f4525c;

    /* renamed from: d */
    public final float f4526d;

    /* renamed from: e */
    public final float f4527e;

    /* renamed from: f */
    public final float f4528f;

    /* renamed from: g */
    public final float f4529g;

    /* renamed from: h */
    public final float f4530h;

    /* renamed from: i */
    public final float f4531i;

    public C1807a(float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) {
        this.f4523a = f;
        this.f4524b = f2;
        this.f4525c = f3;
        this.f4526d = f4;
        this.f4527e = f5;
        this.f4528f = f6;
        this.f4529g = f7;
        this.f4530h = f8;
        this.f4531i = f9;
    }

    /* renamed from: b */
    public static C1807a m362b(float f, float f2, float f3) {
        float f4 = 100.0f;
        float f5 = 1000.0f;
        C1807a c1807a = null;
        float f6 = 1000.0f;
        float f7 = 0.0f;
        while (Math.abs(f7 - f4) > 0.01f) {
            float f8 = ((f4 - f7) / 2.0f) + f7;
            int m348p = m359e(f8, f2, f).m348p();
            float m346b = C1808b.m346b(m348p);
            float abs = Math.abs(f3 - m346b);
            if (abs < 0.2f) {
                C1807a m361c = m361c(m348p);
                float m363a = m361c.m363a(m359e(m361c.m353k(), m361c.m355i(), f));
                if (m363a <= 1.0f) {
                    c1807a = m361c;
                    f5 = abs;
                    f6 = m363a;
                }
            }
            if (f5 == 0.0f && f6 == 0.0f) {
                break;
            } else if (m346b < f3) {
                f7 = f8;
            } else {
                f4 = f8;
            }
        }
        return c1807a;
    }

    /* renamed from: c */
    public static C1807a m361c(int i) {
        return m360d(i, C1839r.f4568k);
    }

    /* renamed from: d */
    public static C1807a m360d(int i, C1839r c1839r) {
        double d;
        float[] m342f = C1808b.m342f(i);
        float[][] fArr = C1808b.f4532a;
        float f = m342f[0];
        float[] fArr2 = fArr[0];
        float f2 = m342f[1];
        float f3 = m342f[2];
        float f4 = (fArr2[0] * f) + (fArr2[1] * f2) + (fArr2[2] * f3);
        float[] fArr3 = fArr[1];
        float f5 = (fArr3[0] * f) + (fArr3[1] * f2) + (fArr3[2] * f3);
        float[] fArr4 = fArr[2];
        float f6 = (f * fArr4[0]) + (f2 * fArr4[1]) + (f3 * fArr4[2]);
        float f7 = c1839r.m238i()[0] * f4;
        float f8 = c1839r.m238i()[1] * f5;
        float f9 = c1839r.m238i()[2] * f6;
        double m244c = c1839r.m244c() * Math.abs(f7);
        Double.isNaN(m244c);
        float pow = (float) Math.pow(m244c / 100.0d, 0.42d);
        double m244c2 = c1839r.m244c() * Math.abs(f8);
        Double.isNaN(m244c2);
        float pow2 = (float) Math.pow(m244c2 / 100.0d, 0.42d);
        double m244c3 = c1839r.m244c() * Math.abs(f9);
        Double.isNaN(m244c3);
        float pow3 = (float) Math.pow(m244c3 / 100.0d, 0.42d);
        float signum = ((Math.signum(f7) * 400.0f) * pow) / (pow + 27.13f);
        float signum2 = ((Math.signum(f8) * 400.0f) * pow2) / (pow2 + 27.13f);
        float signum3 = ((Math.signum(f9) * 400.0f) * pow3) / (pow3 + 27.13f);
        double d2 = signum;
        Double.isNaN(d2);
        double d3 = signum2;
        Double.isNaN(d3);
        double d4 = signum3;
        Double.isNaN(d4);
        float f10 = ((float) (((d2 * 11.0d) + (d3 * (-12.0d))) + d4)) / 11.0f;
        double d5 = signum + signum2;
        Double.isNaN(d4);
        Double.isNaN(d5);
        float f11 = ((float) (d5 - (d4 * 2.0d))) / 9.0f;
        float f12 = signum2 * 20.0f;
        float f13 = (((signum * 20.0f) + f12) + (21.0f * signum3)) / 20.0f;
        float f14 = (((signum * 40.0f) + f12) + signum3) / 20.0f;
        float atan2 = (((float) Math.atan2(f11, f10)) * 180.0f) / 3.1415927f;
        if (atan2 < 0.0f) {
            atan2 += 360.0f;
        } else if (atan2 >= 360.0f) {
            atan2 -= 360.0f;
        }
        float f15 = atan2;
        float f16 = (3.1415927f * f15) / 180.0f;
        float pow4 = ((float) Math.pow((f14 * c1839r.m241f()) / c1839r.m246a(), c1839r.m245b() * c1839r.m237j())) * 100.0f;
        float m243d = c1839r.m243d() * (4.0f / c1839r.m245b()) * ((float) Math.sqrt(pow4 / 100.0f)) * (c1839r.m246a() + 4.0f);
        Double.isNaN(((double) f15) < 20.14d ? 360.0f + f15 : f15);
        float pow5 = ((float) Math.pow(1.64d - Math.pow(0.29d, c1839r.m242e()), 0.73d)) * ((float) Math.pow((((((((float) (Math.cos(((d * 3.141592653589793d) / 180.0d) + 2.0d) + 3.8d)) * 0.25f) * 3846.1538f) * c1839r.m240g()) * c1839r.m239h()) * ((float) Math.sqrt((f10 * f10) + (f11 * f11)))) / (f13 + 0.305f), 0.9d));
        double d6 = pow4;
        Double.isNaN(d6);
        float sqrt = pow5 * ((float) Math.sqrt(d6 / 100.0d));
        float m243d2 = sqrt * c1839r.m243d();
        float sqrt2 = ((float) Math.sqrt((pow5 * c1839r.m245b()) / (c1839r.m246a() + 4.0f))) * 50.0f;
        float f17 = (1.7f * pow4) / ((0.007f * pow4) + 1.0f);
        float log = ((float) Math.log((0.0228f * m243d2) + 1.0f)) * 43.85965f;
        double d7 = f16;
        return new C1807a(f15, sqrt, pow4, m243d, m243d2, sqrt2, f17, log * ((float) Math.cos(d7)), log * ((float) Math.sin(d7)));
    }

    /* renamed from: e */
    public static C1807a m359e(float f, float f2, float f3) {
        return m358f(f, f2, f3, C1839r.f4568k);
    }

    /* renamed from: f */
    public static C1807a m358f(float f, float f2, float f3, C1839r c1839r) {
        double d;
        double d2 = f;
        Double.isNaN(d2);
        float m245b = (4.0f / c1839r.m245b()) * ((float) Math.sqrt(d2 / 100.0d)) * (c1839r.m246a() + 4.0f) * c1839r.m243d();
        float m243d = f2 * c1839r.m243d();
        float sqrt = ((float) Math.sqrt(((f2 / ((float) Math.sqrt(d))) * c1839r.m245b()) / (c1839r.m246a() + 4.0f))) * 50.0f;
        float f4 = (1.7f * f) / ((0.007f * f) + 1.0f);
        double d3 = m243d;
        Double.isNaN(d3);
        float log = ((float) Math.log((d3 * 0.0228d) + 1.0d)) * 43.85965f;
        double d4 = (3.1415927f * f3) / 180.0f;
        return new C1807a(f3, f2, f, m245b, m243d, sqrt, f4, log * ((float) Math.cos(d4)), log * ((float) Math.sin(d4)));
    }

    /* renamed from: m */
    public static int m351m(float f, float f2, float f3) {
        return m350n(f, f2, f3, C1839r.f4568k);
    }

    /* renamed from: n */
    public static int m350n(float f, float f2, float f3, C1839r c1839r) {
        if (f2 < 1.0d || Math.round(f3) <= 0.0d || Math.round(f3) >= 100.0d) {
            return C1808b.m347a(f3);
        }
        float min = f < 0.0f ? 0.0f : Math.min(360.0f, f);
        float f4 = f2;
        C1807a c1807a = null;
        float f5 = 0.0f;
        boolean z = true;
        while (Math.abs(f5 - f2) >= 0.4f) {
            C1807a m362b = m362b(min, f4, f3);
            if (!z) {
                if (m362b == null) {
                    f2 = f4;
                } else {
                    f5 = f4;
                    c1807a = m362b;
                }
                f4 = ((f2 - f5) / 2.0f) + f5;
            } else if (m362b != null) {
                return m362b.m349o(c1839r);
            } else {
                f4 = ((f2 - f5) / 2.0f) + f5;
                z = false;
            }
        }
        return c1807a == null ? C1808b.m347a(f3) : c1807a.m349o(c1839r);
    }

    /* renamed from: a */
    public float m363a(C1807a c1807a) {
        float m352l = m352l() - c1807a.m352l();
        float m357g = m357g() - c1807a.m357g();
        float m356h = m356h() - c1807a.m356h();
        return (float) (Math.pow(Math.sqrt((m352l * m352l) + (m357g * m357g) + (m356h * m356h)), 0.63d) * 1.41d);
    }

    /* renamed from: g */
    public float m357g() {
        return this.f4530h;
    }

    /* renamed from: h */
    public float m356h() {
        return this.f4531i;
    }

    /* renamed from: i */
    public float m355i() {
        return this.f4524b;
    }

    /* renamed from: j */
    public float m354j() {
        return this.f4523a;
    }

    /* renamed from: k */
    public float m353k() {
        return this.f4525c;
    }

    /* renamed from: l */
    public float m352l() {
        return this.f4529g;
    }

    /* renamed from: o */
    public int m349o(C1839r c1839r) {
        float f;
        double d;
        double d2;
        double d3;
        double d4;
        double d5;
        double d6;
        if (m355i() == 0.0d || m353k() == 0.0d) {
            f = 0.0f;
        } else {
            float m355i = m355i();
            double m353k = m353k();
            Double.isNaN(m353k);
            f = m355i / ((float) Math.sqrt(m353k / 100.0d));
        }
        double d7 = f;
        double pow = Math.pow(1.64d - Math.pow(0.29d, c1839r.m242e()), 0.73d);
        Double.isNaN(d7);
        float pow2 = (float) Math.pow(d7 / pow, 1.1111111111111112d);
        double m354j = (m354j() * 3.1415927f) / 180.0f;
        Double.isNaN(m354j);
        float m246a = c1839r.m246a();
        double m353k2 = m353k();
        Double.isNaN(m353k2);
        double m245b = c1839r.m245b();
        Double.isNaN(m245b);
        double d8 = 1.0d / m245b;
        double m237j = c1839r.m237j();
        Double.isNaN(m237j);
        float pow3 = m246a * ((float) Math.pow(m353k2 / 100.0d, d8 / m237j));
        float cos = ((float) (Math.cos(2.0d + m354j) + 3.8d)) * 0.25f * 3846.1538f * c1839r.m240g() * c1839r.m239h();
        float m241f = pow3 / c1839r.m241f();
        float sin = (float) Math.sin(m354j);
        float cos2 = (float) Math.cos(m354j);
        float f2 = (((0.305f + m241f) * 23.0f) * pow2) / (((cos * 23.0f) + ((11.0f * pow2) * cos2)) + ((pow2 * 108.0f) * sin));
        float f3 = cos2 * f2;
        float f4 = f2 * sin;
        float f5 = m241f * 460.0f;
        float f6 = (((451.0f * f3) + f5) + (288.0f * f4)) / 1403.0f;
        float f7 = ((f5 - (891.0f * f3)) - (261.0f * f4)) / 1403.0f;
        float f8 = ((f5 - (f3 * 220.0f)) - (f4 * 6300.0f)) / 1403.0f;
        Double.isNaN(Math.abs(f6));
        Double.isNaN(Math.abs(f6));
        float signum = Math.signum(f6) * (100.0f / c1839r.m244c()) * ((float) Math.pow((float) Math.max(0.0d, (d * 27.13d) / (400.0d - d2)), 2.380952380952381d));
        Double.isNaN(Math.abs(f7));
        Double.isNaN(Math.abs(f7));
        float signum2 = Math.signum(f7) * (100.0f / c1839r.m244c()) * ((float) Math.pow((float) Math.max(0.0d, (d3 * 27.13d) / (400.0d - d4)), 2.380952380952381d));
        Double.isNaN(Math.abs(f8));
        Double.isNaN(Math.abs(f8));
        float signum3 = Math.signum(f8) * (100.0f / c1839r.m244c()) * ((float) Math.pow((float) Math.max(0.0d, (d5 * 27.13d) / (400.0d - d6)), 2.380952380952381d));
        float f9 = signum / c1839r.m238i()[0];
        float f10 = signum2 / c1839r.m238i()[1];
        float f11 = signum3 / c1839r.m238i()[2];
        float[][] fArr = C1808b.f4533b;
        float[] fArr2 = fArr[0];
        float f12 = (fArr2[0] * f9) + (fArr2[1] * f10) + (fArr2[2] * f11);
        float[] fArr3 = fArr[1];
        float[] fArr4 = fArr[2];
        return C1865a.m160a(f12, (fArr3[0] * f9) + (fArr3[1] * f10) + (fArr3[2] * f11), (f9 * fArr4[0]) + (f10 * fArr4[1]) + (f11 * fArr4[2]));
    }

    /* renamed from: p */
    public int m348p() {
        return m349o(C1839r.f4568k);
    }
}