double interp2_k_cubic6(double x) {
  double result = 0.0;
  if ((x >= 0.0) && (x < 1.0)) {
    result = ((6.0 / 5.0) * x * x * x) - ((11.0 / 5.0) * x * x) + 1.0;
  } else if ((x >= 1.0) && (x < 2.0)) {
    result = ((-3.0 / 5.0) * x * x * x) + ((16.0 / 5.0) * x * x) -
             ((27.0 / 5.0) * x) + (14.0 / 5.0);
  } else if ((x >= 2.0) && (x < 3.0)) {
    result = ((1.0 / 5.0) * x * x * x) - ((8.0 / 5.0) * x * x) +
             ((21.0 / 5.0) * x) - (18.0 / 5.0);
  }
  return result;
}


x86 assembly (clang, -O0):
<interp2_k_cubic6>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1194 <interp2_k_cubic6+0x94>
movsd  0xed5(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1194 <interp2_k_cubic6+0x94>
movsd  0xf22(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xf03(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe7a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12bc <interp2_k_cubic6+0x1bc>
movsd  -0x8(%rbp),%xmm0
movsd  0xe5f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     121a <interp2_k_cubic6+0x11a>
movsd  0xe55(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    121a <interp2_k_cubic6+0x11a>
movsd  0xe8a(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xe6b(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xe44(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe2c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12b7 <interp2_k_cubic6+0x1b7>
movsd  -0x8(%rbp),%xmm0
movsd  0xde1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12b2 <interp2_k_cubic6+0x1b2>
movsd  0xdd7(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    12b2 <interp2_k_cubic6+0x1b2>
movsd  0xde4(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xdc5(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xd87(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd6f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12b7 <interp2_k_cubic6+0x1b7>
jmp    12bc <interp2_k_cubic6+0x1bc>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<interp2_k_cubic6>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     114d <interp2_k_cubic6+0x4d>
movsd  0xeee(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    114d <interp2_k_cubic6+0x4d>
movsd  0xf38(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xf30(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
addsd  0xeb8(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xeab(%rip),%xmm0
jb     11a3 <interp2_k_cubic6+0xa3>
movsd  0xea9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a3 <interp2_k_cubic6+0xa3>
movsd  0xecb(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xec3(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
mulsd  0xeb7(%rip),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
addsd  0xeaf(%rip),%xmm0
jmp    11fb <interp2_k_cubic6+0xfb>
ucomisd 0xe5d(%rip),%xmm0
xorpd  %xmm1,%xmm1
jb     11ff <interp2_k_cubic6+0xff>
movsd  0xe57(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    11ff <interp2_k_cubic6+0xff>
movsd  0xe51(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe49(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
mulsd  0xe3d(%rip),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
addsd  0xe35(%rip),%xmm0
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @interp2_k_cubic6(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %3
%4 = load double, double* %2
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %22
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp olt double %7, 1.000000e+00
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load double, double* %2
%11 = fmul double 1.200000e+00, %10
%12 = load double, double* %2
%13 = fmul double %11, %12
%14 = load double, double* %2
%15 = load double, double* %2
%16 = fmul double 2.200000e+00, %15
%17 = load double, double* %2
%18 = fmul double %16, %17
%19 = fneg double %18
%20 = call double @llvm.fmuladd.f64(double %13, double %14, double %19)
%21 = fadd double %20, 1.000000e+00
store double %21, double* %3
br label %65
22: ; preds = %6, %1
%23 = load double, double* %2
%24 = fcmp oge double %23, 1.000000e+00
br i1 %24, label %25, label %42
25: ; preds = %22
%26 = load double, double* %2
%27 = fcmp olt double %26, 2.000000e+00
br i1 %27, label %28, label %42
28: ; preds = %25
%29 = load double, double* %2
%30 = fmul double -6.000000e-01, %29
%31 = load double, double* %2
%32 = fmul double %30, %31
%33 = load double, double* %2
%34 = load double, double* %2
%35 = fmul double 3.200000e+00, %34
%36 = load double, double* %2
%37 = fmul double %35, %36
%38 = call double @llvm.fmuladd.f64(double %32, double %33, double %37)
%39 = load double, double* %2
%40 = call double @llvm.fmuladd.f64(double -5.400000e+00, double %39, double %38)
%41 = fadd double %40, 2.800000e+00
store double %41, double* %3
br label %64
42: ; preds = %25, %22
%43 = load double, double* %2
%44 = fcmp oge double %43, 2.000000e+00
br i1 %44, label %45, label %63
45: ; preds = %42
%46 = load double, double* %2
%47 = fcmp olt double %46, 3.000000e+00
br i1 %47, label %48, label %63
48: ; preds = %45
%49 = load double, double* %2
%50 = fmul double 2.000000e-01, %49
%51 = load double, double* %2
%52 = fmul double %50, %51
%53 = load double, double* %2
%54 = load double, double* %2
%55 = fmul double 1.600000e+00, %54
%56 = load double, double* %2
%57 = fmul double %55, %56
%58 = fneg double %57
%59 = call double @llvm.fmuladd.f64(double %52, double %53, double %58)
%60 = load double, double* %2
%61 = call double @llvm.fmuladd.f64(double 4.200000e+00, double %60, double %59)
%62 = fsub double %61, 3.600000e+00
store double %62, double* %3
br label %63
63: ; preds = %48, %45, %42
br label %64
64: ; preds = %63, %28
br label %65
65: ; preds = %64, %9
%66 = load double, double* %3
ret double %66
}

LLVM IR (-O2):
define double @interp2_k_cubic6(double %0) {
%2 = fcmp oge double %0, 0.000000e+00
%3 = fcmp olt double %0, 1.000000e+00
%4 = and i1 %2, %3
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = fmul double %0, 1.200000e+00
%7 = fmul double %6, %0
%8 = fmul double %0, -2.200000e+00
%9 = fmul double %8, %0
%10 = tail call double @llvm.fmuladd.f64(double %7, double %0, double %9)
%11 = fadd double %10, 1.000000e+00
br label %36
12: ; preds = %1
%13 = fcmp oge double %0, 1.000000e+00
%14 = fcmp olt double %0, 2.000000e+00
%15 = and i1 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = fmul double %0, -6.000000e-01
%18 = fmul double %17, %0
%19 = fmul double %0, 3.200000e+00
%20 = fmul double %19, %0
%21 = tail call double @llvm.fmuladd.f64(double %18, double %0, double %20)
%22 = tail call double @llvm.fmuladd.f64(double %0, double -5.400000e+00, double %21)
%23 = fadd double %22, 2.800000e+00
br label %36
24: ; preds = %12
%25 = fcmp oge double %0, 2.000000e+00
%26 = fcmp olt double %0, 3.000000e+00
%27 = and i1 %25, %26
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = fmul double %0, 2.000000e-01
%30 = fmul double %29, %0
%31 = fmul double %0, -1.600000e+00
%32 = fmul double %31, %0
%33 = tail call double @llvm.fmuladd.f64(double %30, double %0, double %32)
%34 = tail call double @llvm.fmuladd.f64(double %0, double 4.200000e+00, double %33)
%35 = fadd double %34, -3.600000e+00
br label %36
36: ; preds = %16, %28, %24, %5
%37 = phi double [ %11, %5 ], [ %23, %16 ], [ %35, %28 ], [ 0.000000e+00, %24 ]
ret double %37
}