double interp2_k_lagrange5(double x) {
  double result = 0.0;
  if ((x >= 0.0) & (x < 0.5)) {
    result = ((1.0 / 4.0) * x * x * x * x) + ((-5.0 / 4.0) * x * x) + 1.0;
  } else if ((x >= 0.5) & (x < 1.5)) {
    result = ((-1.0 / 6.0) * x * x * x * x) + ((5.0 / 6.0) * x * x * x) +
             ((-5.0 / 6.0) * x * x) + ((-5.0 / 6.0) * x) + 1.0;
  } else if ((x >= 1.5) & (x < 2.5)) {
    result = ((1.0 / 24.0) * x * x * x * x) + ((-5.0 / 12.0) * x * x * x) +
             ((35.0 / 24.0) * x * x) + ((-25.0 / 12.0) * x) + 1.0;
  }
  return result;
}


x86 assembly (clang, -O0):
<interp2_k_lagrange5>:
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
setae  %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xed3(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1192 <interp2_k_lagrange5+0x92>
movsd  0xf12(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xeee(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe94(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    130b <interp2_k_lagrange5+0x20b>
movsd  -0x8(%rbp),%xmm0
movsd  0xe61(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xe55(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     124c <interp2_k_lagrange5+0x14c>
movsd  0xe7c(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xe58(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe31(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xe12(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdda(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1306 <interp2_k_lagrange5+0x206>
movsd  -0x8(%rbp),%xmm0
movsd  0xdaf(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xda3(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1301 <interp2_k_lagrange5+0x201>
movsd  0xdaa(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xd86(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd5f(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xd38(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd20(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1306 <interp2_k_lagrange5+0x206>
jmp    130b <interp2_k_lagrange5+0x20b>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<interp2_k_lagrange5>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1151 <interp2_k_lagrange5+0x51>
movsd  0xeee(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1151 <interp2_k_lagrange5+0x51>
movsd  0xf38(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xf2c(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
addsd  0xeec(%rip),%xmm1
movapd %xmm1,%xmm0
ret
ucomisd 0xea7(%rip),%xmm0
jb     11af <interp2_k_lagrange5+0xaf>
movsd  0xea5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11af <interp2_k_lagrange5+0xaf>
movsd  0xecf(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xec3(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0xeaf(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
jmp    1217 <interp2_k_lagrange5+0x117>
ucomisd 0xe51(%rip),%xmm0
xorpd  %xmm1,%xmm1
jb     1227 <interp2_k_lagrange5+0x127>
movsd  0xe4b(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    1227 <interp2_k_lagrange5+0x127>
movsd  0xe45(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe39(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0xe25(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  0xe1d(%rip),%xmm0
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
addsd  0xe15(%rip),%xmm0
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @interp2_k_lagrange5(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
%6 = zext i1 %5 to i32
%7 = load double, double* %2
%8 = fcmp olt double %7, 5.000000e-01
%9 = zext i1 %8 to i32
%10 = and i32 %6, %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %26
12: ; preds = %1
%13 = load double, double* %2
%14 = fmul double 2.500000e-01, %13
%15 = load double, double* %2
%16 = fmul double %14, %15
%17 = load double, double* %2
%18 = fmul double %16, %17
%19 = load double, double* %2
%20 = load double, double* %2
%21 = fmul double -1.250000e+00, %20
%22 = load double, double* %2
%23 = fmul double %21, %22
%24 = call double @llvm.fmuladd.f64(double %18, double %19, double %23)
%25 = fadd double %24, 1.000000e+00
store double %25, double* %3
br label %90
26: ; preds = %1
%27 = load double, double* %2
%28 = fcmp oge double %27, 5.000000e-01
%29 = zext i1 %28 to i32
%30 = load double, double* %2
%31 = fcmp olt double %30, 1.500000e+00
%32 = zext i1 %31 to i32
%33 = and i32 %29, %32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %57
35: ; preds = %26
%36 = load double, double* %2
%37 = fmul double 0xBFC5555555555555, %36
%38 = load double, double* %2
%39 = fmul double %37, %38
%40 = load double, double* %2
%41 = fmul double %39, %40
%42 = load double, double* %2
%43 = load double, double* %2
%44 = fmul double 0x3FEAAAAAAAAAAAAB, %43
%45 = load double, double* %2
%46 = fmul double %44, %45
%47 = load double, double* %2
%48 = fmul double %46, %47
%49 = call double @llvm.fmuladd.f64(double %41, double %42, double %48)
%50 = load double, double* %2
%51 = fmul double 0xBFEAAAAAAAAAAAAB, %50
%52 = load double, double* %2
%53 = call double @llvm.fmuladd.f64(double %51, double %52, double %49)
%54 = load double, double* %2
%55 = call double @llvm.fmuladd.f64(double 0xBFEAAAAAAAAAAAAB, double %54, double %53)
%56 = fadd double %55, 1.000000e+00
store double %56, double* %3
br label %89
57: ; preds = %26
%58 = load double, double* %2
%59 = fcmp oge double %58, 1.500000e+00
%60 = zext i1 %59 to i32
%61 = load double, double* %2
%62 = fcmp olt double %61, 2.500000e+00
%63 = zext i1 %62 to i32
%64 = and i32 %60, %63
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %88
66: ; preds = %57
%67 = load double, double* %2
%68 = fmul double 0x3FA5555555555555, %67
%69 = load double, double* %2
%70 = fmul double %68, %69
%71 = load double, double* %2
%72 = fmul double %70, %71
%73 = load double, double* %2
%74 = load double, double* %2
%75 = fmul double 0xBFDAAAAAAAAAAAAB, %74
%76 = load double, double* %2
%77 = fmul double %75, %76
%78 = load double, double* %2
%79 = fmul double %77, %78
%80 = call double @llvm.fmuladd.f64(double %72, double %73, double %79)
%81 = load double, double* %2
%82 = fmul double 0x3FF7555555555555, %81
%83 = load double, double* %2
%84 = call double @llvm.fmuladd.f64(double %82, double %83, double %80)
%85 = load double, double* %2
%86 = call double @llvm.fmuladd.f64(double 0xC000AAAAAAAAAAAB, double %85, double %84)
%87 = fadd double %86, 1.000000e+00
store double %87, double* %3
br label %88
88: ; preds = %66, %57
br label %89
89: ; preds = %88, %35
br label %90
90: ; preds = %89, %12
%91 = load double, double* %3
ret double %91
}

LLVM IR (-O2):
define double @interp2_k_lagrange5(double %0) {
%2 = fcmp oge double %0, 0.000000e+00
%3 = fcmp olt double %0, 5.000000e-01
%4 = and i1 %2, %3
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = fmul double %0, 2.500000e-01
%7 = fmul double %6, %0
%8 = fmul double %7, %0
%9 = fmul double %0, -1.250000e+00
%10 = fmul double %9, %0
%11 = tail call double @llvm.fmuladd.f64(double %8, double %0, double %10)
%12 = fadd double %11, 1.000000e+00
br label %45
13: ; preds = %1
%14 = fcmp oge double %0, 5.000000e-01
%15 = fcmp olt double %0, 1.500000e+00
%16 = and i1 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = fmul double %0, 0xBFC5555555555555
%19 = fmul double %18, %0
%20 = fmul double %19, %0
%21 = fmul double %0, 0x3FEAAAAAAAAAAAAB
%22 = fmul double %21, %0
%23 = fmul double %22, %0
%24 = tail call double @llvm.fmuladd.f64(double %20, double %0, double %23)
%25 = fmul double %0, 0xBFEAAAAAAAAAAAAB
%26 = tail call double @llvm.fmuladd.f64(double %25, double %0, double %24)
%27 = tail call double @llvm.fmuladd.f64(double %0, double 0xBFEAAAAAAAAAAAAB, double %26)
%28 = fadd double %27, 1.000000e+00
br label %45
29: ; preds = %13
%30 = fcmp oge double %0, 1.500000e+00
%31 = fcmp olt double %0, 2.500000e+00
%32 = and i1 %30, %31
br i1 %32, label %33, label %45
33: ; preds = %29
%34 = fmul double %0, 0x3FA5555555555555
%35 = fmul double %34, %0
%36 = fmul double %35, %0
%37 = fmul double %0, 0xBFDAAAAAAAAAAAAB
%38 = fmul double %37, %0
%39 = fmul double %38, %0
%40 = tail call double @llvm.fmuladd.f64(double %36, double %0, double %39)
%41 = fmul double %0, 0x3FF7555555555555
%42 = tail call double @llvm.fmuladd.f64(double %41, double %0, double %40)
%43 = tail call double @llvm.fmuladd.f64(double %0, double 0xC000AAAAAAAAAAAB, double %42)
%44 = fadd double %43, 1.000000e+00
br label %45
45: ; preds = %17, %33, %29, %5
%46 = phi double [ %12, %5 ], [ %28, %17 ], [ %44, %33 ], [ 0.000000e+00, %29 ]
ret double %46
}