double extruder_integrate(double base, double start_v, double half_accel,
                          double start, double end) {
  double half_v = .5 * start_v, sixth_a = (1. / 3.) * half_accel;
  double si = start * (base + start * (half_v + start * sixth_a));
  double ei = end * (base + end * (half_v + end * sixth_a));
  return ei - si;
}


x86 assembly (clang, -O0):
<extruder_integrate>:
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  0xee3(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec9(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<extruder_integrate>:
mulsd  0xef8(%rip),%xmm1
mulsd  0xef8(%rip),%xmm2
unpcklpd %xmm3,%xmm4
unpcklpd %xmm2,%xmm2
unpcklpd %xmm1,%xmm1
mulpd  %xmm4,%xmm2
addpd  %xmm1,%xmm2
unpcklpd %xmm0,%xmm0
mulpd  %xmm4,%xmm2
addpd  %xmm2,%xmm0
mulpd  %xmm4,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @extruder_integrate(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
%13 = alloca double
%14 = 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
%15 = load double, double* %7
%16 = fmul double 5.000000e-01, %15
store double %16, double* %11
%17 = load double, double* %8
%18 = fmul double 0x3FD5555555555555, %17
store double %18, double* %12
%19 = load double, double* %9
%20 = load double, double* %6
%21 = load double, double* %9
%22 = load double, double* %11
%23 = load double, double* %9
%24 = load double, double* %12
%25 = call double @llvm.fmuladd.f64(double %23, double %24, double %22)
%26 = call double @llvm.fmuladd.f64(double %21, double %25, double %20)
%27 = fmul double %19, %26
store double %27, double* %13
%28 = load double, double* %10
%29 = load double, double* %6
%30 = load double, double* %10
%31 = load double, double* %11
%32 = load double, double* %10
%33 = load double, double* %12
%34 = call double @llvm.fmuladd.f64(double %32, double %33, double %31)
%35 = call double @llvm.fmuladd.f64(double %30, double %34, double %29)
%36 = fmul double %28, %35
store double %36, double* %14
%37 = load double, double* %14
%38 = load double, double* %13
%39 = fsub double %37, %38
ret double %39
}

LLVM IR (-O2):
define double @extruder_integrate(double %0, double %1, double %2, double %3, double %4) {
%6 = fmul double %1, 5.000000e-01
%7 = fmul double %2, 0x3FD5555555555555
%8 = insertelement <2 x double> poison, double %4, i64 0
%9 = insertelement <2 x double> %8, double %3, i64 1
%10 = insertelement <2 x double> poison, double %7, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = insertelement <2 x double> poison, double %6, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %9, <2 x double> %11, <2 x double> %13)
%15 = insertelement <2 x double> poison, double %0, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %9, <2 x double> %14, <2 x double> %16)
%18 = fmul <2 x double> %17, %9
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%20 = fsub <2 x double> %18, %19
%21 = extractelement <2 x double> %20, i64 0
ret double %21
}