float JellyOnceAnimation(float p) {
  if (p < 0.5) {
    float t = (p - 0.25);
    return (-1 / (0.25 * 0.25)) * t * t + 1.0;
  } else if (p < 1.0) {
    float t = (p - 0.75);
    return (0.5 / (0.25 * 0.25)) * t * t - 0.5;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<JellyOnceAnimation>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xee6(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    117e <JellyOnceAnimation+0x7e>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xefb(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11fb <JellyOnceAnimation+0xfb>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe79(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f3 <JellyOnceAnimation+0xf3>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe76(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe50(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11fb <JellyOnceAnimation+0xfb>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<JellyOnceAnimation>:
movss  0xef8(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1133 <JellyOnceAnimation+0x33>
addss  0xef7(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeff(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef7(%rip),%xmm1
jmp    1167 <JellyOnceAnimation+0x67>
xorps  %xmm1,%xmm1
movss  0xec6(%rip),%xmm2
ucomiss %xmm0,%xmm2
jbe    116b <JellyOnceAnimation+0x6b>
addss  0xebd(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb9(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeb1(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @JellyOnceAnimation(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = fcmp olt double %7, 5.000000e-01
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = fsub double %11, 2.500000e-01
%13 = fptrunc double %12 to float
store float %13, float* %4
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = fmul double -1.600000e+01, %15
%17 = load float, float* %4
%18 = fpext float %17 to double
%19 = call double @llvm.fmuladd.f64(double %16, double %18, double 1.000000e+00)
%20 = fptrunc double %19 to float
store float %20, float* %2
br label %38
21: ; preds = %1
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = fcmp olt double %23, 1.000000e+00
br i1 %24, label %25, label %37
25: ; preds = %21
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = fsub double %27, 7.500000e-01
%29 = fptrunc double %28 to float
store float %29, float* %5
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = fmul double 8.000000e+00, %31
%33 = load float, float* %5
%34 = fpext float %33 to double
%35 = call double @llvm.fmuladd.f64(double %32, double %34, double -5.000000e-01)
%36 = fptrunc double %35 to float
store float %36, float* %2
br label %38
37: ; preds = %21
store float 0.000000e+00, float* %2
br label %38
38: ; preds = %37, %25, %9
%39 = load float, float* %2
ret float %39
}

LLVM IR (-O2):
define float @JellyOnceAnimation(float %0) {
%2 = fcmp olt float %0, 5.000000e-01
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = fadd float %0, -2.500000e-01
%5 = fpext float %4 to double
%6 = fmul double %5, -1.600000e+01
%7 = tail call double @llvm.fmuladd.f64(double %6, double %5, double 1.000000e+00)
%8 = fptrunc double %7 to float
br label %17
9: ; preds = %1
%10 = fcmp olt float %0, 1.000000e+00
br i1 %10, label %11, label %17
11: ; preds = %9
%12 = fadd float %0, -7.500000e-01
%13 = fpext float %12 to double
%14 = fmul double %13, 8.000000e+00
%15 = tail call double @llvm.fmuladd.f64(double %14, double %13, double -5.000000e-01)
%16 = fptrunc double %15 to float
br label %17
17: ; preds = %9, %11, %3
%18 = phi float [ %8, %3 ], [ %16, %11 ], [ 0.000000e+00, %9 ]
ret float %18
}