double math_pchip_interpolate(double t, double p0, double p1, double m0,
                              double m1) {
  const double c2 = -3 * (p0 - p1) - 2 * m0 - m1;
  const double c3 = 2 * (p0 - p1) + m0 + m1;
  return p0 + t * (m0 + t * (c2 + t * c3));
}


x86 assembly (clang, -O0):
<math_pchip_interpolate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xed9(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xead(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm3
movsd  -0x8(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm5
movsd  -0x8(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm6
mulsd  %xmm6,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_pchip_interpolate>:
movapd %xmm1,%xmm5
subsd  %xmm2,%xmm5
movsd  0xef0(%rip),%xmm2
mulsd  %xmm5,%xmm2
movapd %xmm3,%xmm6
addsd  %xmm3,%xmm6
subsd  %xmm6,%xmm2
subsd  %xmm4,%xmm2
addsd  %xmm5,%xmm5
addsd  %xmm3,%xmm5
addsd  %xmm4,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm2,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm3,%xmm5
mulsd  %xmm5,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @math_pchip_interpolate(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%13 = load double, double* %7
%14 = load double, double* %8
%15 = fsub double %13, %14
%16 = load double, double* %9
%17 = fmul double 2.000000e+00, %16
%18 = fneg double %17
%19 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %15, double %18)
%20 = load double, double* %10
%21 = fsub double %19, %20
store double %21, double* %11
%22 = load double, double* %7
%23 = load double, double* %8
%24 = fsub double %22, %23
%25 = load double, double* %9
%26 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %24, double %25)
%27 = load double, double* %10
%28 = fadd double %26, %27
store double %28, double* %12
%29 = load double, double* %7
%30 = load double, double* %6
%31 = load double, double* %9
%32 = load double, double* %6
%33 = load double, double* %11
%34 = load double, double* %6
%35 = load double, double* %12
%36 = call double @llvm.fmuladd.f64(double %34, double %35, double %33)
%37 = call double @llvm.fmuladd.f64(double %32, double %36, double %31)
%38 = call double @llvm.fmuladd.f64(double %30, double %37, double %29)
ret double %38
}

LLVM IR (-O2):
define double @math_pchip_interpolate(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %1, %2
%7 = fmul double %3, -2.000000e+00
%8 = tail call double @llvm.fmuladd.f64(double %6, double -3.000000e+00, double %7)
%9 = fsub double %8, %4
%10 = tail call double @llvm.fmuladd.f64(double %6, double 2.000000e+00, double %3)
%11 = fadd double %10, %4
%12 = tail call double @llvm.fmuladd.f64(double %0, double %11, double %9)
%13 = tail call double @llvm.fmuladd.f64(double %0, double %12, double %3)
%14 = tail call double @llvm.fmuladd.f64(double %0, double %13, double %1)
ret double %14
}