package v;

/* JADX INFO: loaded from: classes.dex */
public final class p implements o {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public float f33607a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public float f33608b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public float f33609c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public float f33610d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public float f33611e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public float f33612f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public float f33613g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public float f33614h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public float f33615i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int f33616j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public boolean f33617k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public float f33618l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public float f33619m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public float f33620n;

    @Override // v.o
    public final boolean a() {
        return b() < 1.0E-5f && Math.abs(this.f33615i - this.f33619m) < 1.0E-5f;
    }

    @Override // v.o
    public final float b() {
        return this.f33617k ? -c(this.f33620n) : c(this.f33620n);
    }

    public final float c(float f10) {
        float f11;
        float f12;
        float f13 = this.f33610d;
        if (f10 <= f13) {
            f11 = this.f33607a;
            f12 = this.f33608b;
        } else {
            int i10 = this.f33616j;
            if (i10 == 1) {
                return 0.0f;
            }
            f10 -= f13;
            f13 = this.f33611e;
            if (f10 >= f13) {
                if (i10 == 2) {
                    return 0.0f;
                }
                float f14 = f10 - f13;
                float f15 = this.f33612f;
                if (f14 >= f15) {
                    return 0.0f;
                }
                float f16 = this.f33609c;
                return f16 - ((f14 * f16) / f15);
            }
            f11 = this.f33608b;
            f12 = this.f33609c;
        }
        return (((f12 - f11) * f10) / f13) + f11;
    }

    public final void d(float f10, float f11, float f12, float f13, float f14) {
        this.f33615i = f11;
        if (f10 == 0.0f) {
            f10 = 1.0E-4f;
        }
        float f15 = f10 / f12;
        float f16 = (f15 * f10) / 2.0f;
        if (f10 < 0.0f) {
            float fSqrt = (float) Math.sqrt((f11 - ((((-f10) / f12) * f10) / 2.0f)) * f12);
            if (fSqrt < f13) {
                this.f33616j = 2;
                this.f33607a = f10;
                this.f33608b = fSqrt;
                this.f33609c = 0.0f;
                float f17 = (fSqrt - f10) / f12;
                this.f33610d = f17;
                this.f33611e = fSqrt / f12;
                this.f33613g = ((f10 + fSqrt) * f17) / 2.0f;
                this.f33614h = f11;
                this.f33615i = f11;
                return;
            }
            this.f33616j = 3;
            this.f33607a = f10;
            this.f33608b = f13;
            this.f33609c = f13;
            float f18 = (f13 - f10) / f12;
            this.f33610d = f18;
            float f19 = f13 / f12;
            this.f33612f = f19;
            float f20 = ((f10 + f13) * f18) / 2.0f;
            float f21 = (f19 * f13) / 2.0f;
            this.f33611e = ((f11 - f20) - f21) / f13;
            this.f33613g = f20;
            this.f33614h = f11 - f21;
            this.f33615i = f11;
            return;
        }
        if (f16 >= f11) {
            this.f33616j = 1;
            this.f33607a = f10;
            this.f33608b = 0.0f;
            this.f33613g = f11;
            this.f33610d = (2.0f * f11) / f10;
            return;
        }
        float f22 = f11 - f16;
        float f23 = f22 / f10;
        if (f23 + f15 < f14) {
            this.f33616j = 2;
            this.f33607a = f10;
            this.f33608b = f10;
            this.f33609c = 0.0f;
            this.f33613g = f22;
            this.f33614h = f11;
            this.f33610d = f23;
            this.f33611e = f15;
            return;
        }
        float fSqrt2 = (float) Math.sqrt(((f10 * f10) / 2.0f) + (f12 * f11));
        float f24 = (fSqrt2 - f10) / f12;
        this.f33610d = f24;
        float f25 = fSqrt2 / f12;
        this.f33611e = f25;
        if (fSqrt2 < f13) {
            this.f33616j = 2;
            this.f33607a = f10;
            this.f33608b = fSqrt2;
            this.f33609c = 0.0f;
            this.f33610d = f24;
            this.f33611e = f25;
            this.f33613g = ((f10 + fSqrt2) * f24) / 2.0f;
            this.f33614h = f11;
            return;
        }
        this.f33616j = 3;
        this.f33607a = f10;
        this.f33608b = f13;
        this.f33609c = f13;
        float f26 = (f13 - f10) / f12;
        this.f33610d = f26;
        float f27 = f13 / f12;
        this.f33612f = f27;
        float f28 = ((f10 + f13) * f26) / 2.0f;
        float f29 = (f27 * f13) / 2.0f;
        this.f33611e = ((f11 - f28) - f29) / f13;
        this.f33613g = f28;
        this.f33614h = f11 - f29;
        this.f33615i = f11;
    }

    @Override // v.o
    public final float getInterpolation(float f10) {
        float f11;
        float f12 = this.f33610d;
        if (f10 <= f12) {
            float f13 = this.f33607a;
            f11 = ((((this.f33608b - f13) * f10) * f10) / (f12 * 2.0f)) + (f13 * f10);
        } else {
            int i10 = this.f33616j;
            if (i10 == 1) {
                f11 = this.f33613g;
            } else {
                float f14 = f10 - f12;
                float f15 = this.f33611e;
                if (f14 < f15) {
                    float f16 = this.f33613g;
                    float f17 = this.f33608b;
                    f11 = ((((this.f33609c - f17) * f14) * f14) / (f15 * 2.0f)) + (f17 * f14) + f16;
                } else if (i10 == 2) {
                    f11 = this.f33614h;
                } else {
                    float f18 = f14 - f15;
                    float f19 = this.f33612f;
                    if (f18 <= f19) {
                        float f20 = this.f33614h;
                        float f21 = this.f33609c * f18;
                        f11 = (f20 + f21) - ((f21 * f18) / (f19 * 2.0f));
                    } else {
                        f11 = this.f33615i;
                    }
                }
            }
        }
        this.f33619m = f11;
        this.f33620n = f10;
        return this.f33617k ? this.f33618l - f11 : this.f33618l + f11;
    }
}
