double interp2_k_lagrange6(double x) {
  double result = 0.0;
  if ((x >= 0.0) & (x < 1.0)) {
    result = ((-1.0 / 12.0) * x * x * x * x * x) +
             ((3.0 / 12.0) * x * x * x * x) + ((5.0 / 12.0) * x * x * x) +
             ((-15.0 / 12.0) * x * x) + ((-4.0 / 12.0) * x) + 1.0;
  } else if ((x >= 1.0) & (x < 2.0)) {
    result = ((1.0 / 24.0) * x * x * x * x * x) +
             ((-9.0 / 24.0) * x * x * x * x) + ((25.0 / 24.0) * x * x * x) +
             ((-15.0 / 24.0) * x * x) + ((-26.0 / 24.0) * x) + 1.0;
  } else if ((x >= 2.0) & (x < 3.0)) {
    result = ((-1.0 / 120.0) * x * x * x * x * x) +
             ((15.0 / 120.0) * x * x * x * x) + ((-85.0 / 120.0) * x * x * x) +
             ((225.0 / 120.0) * x * x) + ((-274.0 / 120.0) * x) + 1.0;
  }
  return result;
}


x86 assembly (clang, -O0):
<interp2_k_lagrange6>:
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     11ef <interp2_k_lagrange6+0xef>
movsd  0xf3a(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xf11(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xee5(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xebe(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xe97(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13ba <interp2_k_lagrange6+0x2ba>
movsd  -0x8(%rbp),%xmm0
movsd  0xe04(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xdf8(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     12d2 <interp2_k_lagrange6+0x1d2>
movsd  0xe2f(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xe06(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdda(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdb3(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xd8c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd3c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13b5 <interp2_k_lagrange6+0x2b5>
movsd  -0x8(%rbp),%xmm0
movsd  0xd29(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xd1d(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     13b0 <interp2_k_lagrange6+0x2b0>
movsd  0xd24(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xcfb(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xccf(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xca8(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xc81(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc59(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    13b5 <interp2_k_lagrange6+0x2b5>
jmp    13ba <interp2_k_lagrange6+0x2ba>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<interp2_k_lagrange6>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1185 <interp2_k_lagrange6+0x85>
movsd  0xeee(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1185 <interp2_k_lagrange6+0x85>
movsd  0xf48(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xf38(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0xf20(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0xf10(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xf08(%rip),%xmm0
jmp    1292 <interp2_k_lagrange6+0x192>
ucomisd 0xe73(%rip),%xmm0
jb     120a <interp2_k_lagrange6+0x10a>
movsd  0xe71(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    120a <interp2_k_lagrange6+0x10a>
movsd  0xe9b(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe8b(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0xe73(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0xe63(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xe5b(%rip),%xmm0
jmp    1292 <interp2_k_lagrange6+0x192>
ucomisd 0xdf6(%rip),%xmm0
xorpd  %xmm1,%xmm1
jb     12a6 <interp2_k_lagrange6+0x1a6>
movsd  0xdec(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    12a6 <interp2_k_lagrange6+0x1a6>
movsd  0xde6(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xdd6(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0xdbe(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0xdae(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xda6(%rip),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
addsd  0xd5e(%rip),%xmm0
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @interp2_k_lagrange6(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, 1.000000e+00
%9 = zext i1 %8 to i32
%10 = and i32 %6, %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %44
12: ; preds = %1
%13 = load double, double* %2
%14 = fmul double 0xBFB5555555555555, %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 = fmul double %18, %19
%21 = load double, double* %2
%22 = load double, double* %2
%23 = fmul double 2.500000e-01, %22
%24 = load double, double* %2
%25 = fmul double %23, %24
%26 = load double, double* %2
%27 = fmul double %25, %26
%28 = load double, double* %2
%29 = fmul double %27, %28
%30 = call double @llvm.fmuladd.f64(double %20, double %21, double %29)
%31 = load double, double* %2
%32 = fmul double 0x3FDAAAAAAAAAAAAB, %31
%33 = load double, double* %2
%34 = fmul double %32, %33
%35 = load double, double* %2
%36 = call double @llvm.fmuladd.f64(double %34, double %35, double %30)
%37 = load double, double* %2
%38 = fmul double -1.250000e+00, %37
%39 = load double, double* %2
%40 = call double @llvm.fmuladd.f64(double %38, double %39, double %36)
%41 = load double, double* %2
%42 = call double @llvm.fmuladd.f64(double 0xBFD5555555555555, double %41, double %40)
%43 = fadd double %42, 1.000000e+00
store double %43, double* %3
br label %128
44: ; preds = %1
%45 = load double, double* %2
%46 = fcmp oge double %45, 1.000000e+00
%47 = zext i1 %46 to i32
%48 = load double, double* %2
%49 = fcmp olt double %48, 2.000000e+00
%50 = zext i1 %49 to i32
%51 = and i32 %47, %50
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %85
53: ; preds = %44
%54 = load double, double* %2
%55 = fmul double 0x3FA5555555555555, %54
%56 = load double, double* %2
%57 = fmul double %55, %56
%58 = load double, double* %2
%59 = fmul double %57, %58
%60 = load double, double* %2
%61 = fmul double %59, %60
%62 = load double, double* %2
%63 = load double, double* %2
%64 = fmul double -3.750000e-01, %63
%65 = load double, double* %2
%66 = fmul double %64, %65
%67 = load double, double* %2
%68 = fmul double %66, %67
%69 = load double, double* %2
%70 = fmul double %68, %69
%71 = call double @llvm.fmuladd.f64(double %61, double %62, double %70)
%72 = load double, double* %2
%73 = fmul double 0x3FF0AAAAAAAAAAAB, %72
%74 = load double, double* %2
%75 = fmul double %73, %74
%76 = load double, double* %2
%77 = call double @llvm.fmuladd.f64(double %75, double %76, double %71)
%78 = load double, double* %2
%79 = fmul double -6.250000e-01, %78
%80 = load double, double* %2
%81 = call double @llvm.fmuladd.f64(double %79, double %80, double %77)
%82 = load double, double* %2
%83 = call double @llvm.fmuladd.f64(double 0xBFF1555555555555, double %82, double %81)
%84 = fadd double %83, 1.000000e+00
store double %84, double* %3
br label %127
85: ; preds = %44
%86 = load double, double* %2
%87 = fcmp oge double %86, 2.000000e+00
%88 = zext i1 %87 to i32
%89 = load double, double* %2
%90 = fcmp olt double %89, 3.000000e+00
%91 = zext i1 %90 to i32
%92 = and i32 %88, %91
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %126
94: ; preds = %85
%95 = load double, double* %2
%96 = fmul double 0xBF81111111111111, %95
%97 = load double, double* %2
%98 = fmul double %96, %97
%99 = load double, double* %2
%100 = fmul double %98, %99
%101 = load double, double* %2
%102 = fmul double %100, %101
%103 = load double, double* %2
%104 = load double, double* %2
%105 = fmul double 1.250000e-01, %104
%106 = load double, double* %2
%107 = fmul double %105, %106
%108 = load double, double* %2
%109 = fmul double %107, %108
%110 = load double, double* %2
%111 = fmul double %109, %110
%112 = call double @llvm.fmuladd.f64(double %102, double %103, double %111)
%113 = load double, double* %2
%114 = fmul double 0xBFE6AAAAAAAAAAAB, %113
%115 = load double, double* %2
%116 = fmul double %114, %115
%117 = load double, double* %2
%118 = call double @llvm.fmuladd.f64(double %116, double %117, double %112)
%119 = load double, double* %2
%120 = fmul double 1.875000e+00, %119
%121 = load double, double* %2
%122 = call double @llvm.fmuladd.f64(double %120, double %121, double %118)
%123 = load double, double* %2
%124 = call double @llvm.fmuladd.f64(double 0xC002444444444444, double %123, double %122)
%125 = fadd double %124, 1.000000e+00
store double %125, double* %3
br label %126
126: ; preds = %94, %85
br label %127
127: ; preds = %126, %53
br label %128
128: ; preds = %127, %12
%129 = load double, double* %3
ret double %129
}

LLVM IR (-O2):
define double @interp2_k_lagrange6(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 %22
5: ; preds = %1
%6 = fmul double %0, 0xBFB5555555555555
%7 = fmul double %6, %0
%8 = fmul double %7, %0
%9 = fmul double %8, %0
%10 = fmul double %0, 2.500000e-01
%11 = fmul double %10, %0
%12 = fmul double %11, %0
%13 = fmul double %12, %0
%14 = tail call double @llvm.fmuladd.f64(double %9, double %0, double %13)
%15 = fmul double %0, 0x3FDAAAAAAAAAAAAB
%16 = fmul double %15, %0
%17 = tail call double @llvm.fmuladd.f64(double %16, double %0, double %14)
%18 = fmul double %0, -1.250000e+00
%19 = tail call double @llvm.fmuladd.f64(double %18, double %0, double %17)
%20 = tail call double @llvm.fmuladd.f64(double %0, double 0xBFD5555555555555, double %19)
%21 = fadd double %20, 1.000000e+00
br label %64
22: ; preds = %1
%23 = fcmp oge double %0, 1.000000e+00
%24 = fcmp olt double %0, 2.000000e+00
%25 = and i1 %23, %24
br i1 %25, label %26, label %43
26: ; preds = %22
%27 = fmul double %0, 0x3FA5555555555555
%28 = fmul double %27, %0
%29 = fmul double %28, %0
%30 = fmul double %29, %0
%31 = fmul double %0, -3.750000e-01
%32 = fmul double %31, %0
%33 = fmul double %32, %0
%34 = fmul double %33, %0
%35 = tail call double @llvm.fmuladd.f64(double %30, double %0, double %34)
%36 = fmul double %0, 0x3FF0AAAAAAAAAAAB
%37 = fmul double %36, %0
%38 = tail call double @llvm.fmuladd.f64(double %37, double %0, double %35)
%39 = fmul double %0, -6.250000e-01
%40 = tail call double @llvm.fmuladd.f64(double %39, double %0, double %38)
%41 = tail call double @llvm.fmuladd.f64(double %0, double 0xBFF1555555555555, double %40)
%42 = fadd double %41, 1.000000e+00
br label %64
43: ; preds = %22
%44 = fcmp oge double %0, 2.000000e+00
%45 = fcmp olt double %0, 3.000000e+00
%46 = and i1 %44, %45
br i1 %46, label %47, label %64
47: ; preds = %43
%48 = fmul double %0, 0xBF81111111111111
%49 = fmul double %48, %0
%50 = fmul double %49, %0
%51 = fmul double %50, %0
%52 = fmul double %0, 1.250000e-01
%53 = fmul double %52, %0
%54 = fmul double %53, %0
%55 = fmul double %54, %0
%56 = tail call double @llvm.fmuladd.f64(double %51, double %0, double %55)
%57 = fmul double %0, 0xBFE6AAAAAAAAAAAB
%58 = fmul double %57, %0
%59 = tail call double @llvm.fmuladd.f64(double %58, double %0, double %56)
%60 = fmul double %0, 1.875000e+00
%61 = tail call double @llvm.fmuladd.f64(double %60, double %0, double %59)
%62 = tail call double @llvm.fmuladd.f64(double %0, double 0xC002444444444444, double %61)
%63 = fadd double %62, 1.000000e+00
br label %64
64: ; preds = %26, %47, %43, %5
%65 = phi double [ %21, %5 ], [ %42, %26 ], [ %63, %47 ], [ 0.000000e+00, %43 ]
ret double %65
}