double extruder_integrate_time(double base, double start_v, double half_accel,
                               double start, double end) {
  double half_b = .5 * base, third_v = (1. / 3.) * start_v;
  double eighth_a = .25 * half_accel;
  double si = start * start * (half_b + start * (third_v + start * eighth_a));
  double ei = end * end * (half_b + end * (third_v + end * eighth_a));
  return ei - si;
}


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

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

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

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