double amsp_integrate_quadratic(const double *qCoeff, double x, double dx) {
  return 2 * dx *
         (qCoeff[0] + qCoeff[1] * x + qCoeff[2] * ((x) * (x)) +
          (1 / 3.) * qCoeff[2] * ((dx) * (dx)));
}


x86 assembly (clang, -O0):
<amsp_integrate_quadratic>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xeee(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
movsd  -0x10(%rbp),%xmm3
mulsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x8(%rbp),%rax
movsd  0xe9c(%rip),%xmm1
mulsd  0x10(%rax),%xmm1
movsd  -0x18(%rbp),%xmm3
mulsd  -0x18(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<amsp_integrate_quadratic>:
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
movsd  0x8(%rdi),%xmm3
mulsd  %xmm0,%xmm3
addsd  (%rdi),%xmm3
movsd  0x10(%rdi),%xmm4
mulsd  %xmm0,%xmm0
mulsd  %xmm4,%xmm0
addsd  %xmm3,%xmm0
mulsd  0xed2(%rip),%xmm4
mulsd  %xmm1,%xmm1
mulsd  %xmm1,%xmm4
addsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @amsp_integrate_quadratic(double* %0, double %1, double %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double
store double* %0, double** %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = fmul double 2.000000e+00, %7
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = load double, double* %5
%16 = call double @llvm.fmuladd.f64(double %14, double %15, double %11)
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = load double, double* %5
%21 = load double, double* %5
%22 = fmul double %20, %21
%23 = call double @llvm.fmuladd.f64(double %19, double %22, double %16)
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 2
%26 = load double, double* %25
%27 = fmul double 0x3FD5555555555555, %26
%28 = load double, double* %6
%29 = load double, double* %6
%30 = fmul double %28, %29
%31 = call double @llvm.fmuladd.f64(double %27, double %30, double %23)
%32 = fmul double %8, %31
ret double %32
}

LLVM IR (-O2):
define double @amsp_integrate_quadratic(double* nocapture %0, double %1, double %2) {
%4 = fmul double %2, 2.000000e+00
%5 = load double, double* %0
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double %1, double %5)
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = fmul double %1, %1
%12 = tail call double @llvm.fmuladd.f64(double %10, double %11, double %8)
%13 = fmul double %10, 0x3FD5555555555555
%14 = fmul double %2, %2
%15 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %12)
%16 = fmul double %4, %15
ret double %16
}