double BiCubicR(double x) {
  double xp2, xp1, xm1;
  double r = 0;
  xp2 = x + 2;
  xp1 = x + 1;
  xm1 = x - 1;
  if (xp2 > 0)
    r += xp2 * xp2 * xp2;
  if (xp1 > 0)
    r -= 4 * xp1 * xp1 * xp1;
  if (x > 0)
    r += 6 * x * x * x;
  if (xm1 > 0)
    r -= 4 * xm1 * xm1 * xm1;
  return (r / 6.0);
}


x86 assembly (clang, -O0):
<BiCubicR>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed5(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    117e <BiCubicR+0x7e>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11d0 <BiCubicR+0xd0>
movsd  0xe78(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    120b <BiCubicR+0x10b>
movsd  0xe2e(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    125d <BiCubicR+0x15d>
movsd  0xdeb(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdae(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<BiCubicR>:
movapd %xmm0,%xmm1
movsd  0xef4(%rip),%xmm3
addsd  %xmm0,%xmm3
movsd  0xef0(%rip),%xmm4
addsd  %xmm0,%xmm4
movsd  0xeec(%rip),%xmm2
addsd  %xmm0,%xmm2
movapd %xmm3,%xmm5
mulsd  %xmm3,%xmm5
mulsd  %xmm3,%xmm5
xorpd  %xmm0,%xmm0
addsd  %xmm0,%xmm5
xorpd  %xmm6,%xmm6
cmpltsd %xmm3,%xmm6
andpd  %xmm5,%xmm6
movsd  0xec7(%rip),%xmm3
movapd %xmm4,%xmm5
mulsd  %xmm3,%xmm5
mulsd  %xmm4,%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm6,%xmm5
xorpd  %xmm7,%xmm7
cmpltsd %xmm4,%xmm7
movapd %xmm7,%xmm4
andnpd %xmm6,%xmm4
andpd  %xmm5,%xmm7
orpd   %xmm4,%xmm7
movsd  0xe9a(%rip),%xmm4
movapd %xmm1,%xmm5
mulsd  %xmm4,%xmm5
mulsd  %xmm1,%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm7,%xmm5
xorpd  %xmm6,%xmm6
cmpltsd %xmm1,%xmm6
movapd %xmm6,%xmm1
andnpd %xmm7,%xmm1
andpd  %xmm5,%xmm6
orpd   %xmm1,%xmm6
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm6,%xmm3
cmpltsd %xmm2,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm6,%xmm1
andpd  %xmm3,%xmm0
orpd   %xmm1,%xmm0
divsd  %xmm4,%xmm0
ret

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

LLVM IR (-O2):
define double @BiCubicR(double %0) {
%2 = fadd double %0, 2.000000e+00
%3 = fadd double %0, 1.000000e+00
%4 = fadd double %0, -1.000000e+00
%5 = fcmp ogt double %2, 0.000000e+00
%6 = fmul double %2, %2
%7 = tail call double @llvm.fmuladd.f64(double %6, double %2, double 0.000000e+00)
%8 = select i1 %5, double %7, double 0.000000e+00
%9 = fcmp ogt double %3, 0.000000e+00
%10 = fmul double %3, -4.000000e+00
%11 = fmul double %3, %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double %3, double %8)
%13 = select i1 %9, double %12, double %8
%14 = fcmp ogt double %0, 0.000000e+00
%15 = fmul double %0, 6.000000e+00
%16 = fmul double %15, %0
%17 = tail call double @llvm.fmuladd.f64(double %16, double %0, double %13)
%18 = select i1 %14, double %17, double %13
%19 = fcmp ogt double %4, 0.000000e+00
%20 = fmul double %4, -4.000000e+00
%21 = fmul double %4, %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double %4, double %18)
%23 = select i1 %19, double %22, double %18
%24 = fdiv double %23, 6.000000e+00
ret double %24
}