double dotabac(double a[3], double b[3], double c[3]) {
  return (b[0] - a[0]) * (c[0] - a[0]) + (b[1] - a[1]) * (c[1] - a[1]) +
         (b[2] - a[2]) * (c[2] - a[2]);
}


x86 assembly (clang, -O0):
<dotabac>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm3
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotabac>:
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
movsd  (%rdi),%xmm2
movsd  0x8(%rdi),%xmm3
subsd  %xmm2,%xmm0
movsd  (%rdx),%xmm4
movsd  0x8(%rdx),%xmm5
subsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm4
subsd  %xmm3,%xmm1
subsd  %xmm3,%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm4,%xmm5
movsd  0x10(%rsi),%xmm1
movsd  0x10(%rdi),%xmm2
subsd  %xmm2,%xmm1
movsd  0x10(%rdx),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm5,%xmm0
ret

LLVM IR (-O0):
define double @dotabac(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** %5
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fsub double %9, %12
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double, double* %15
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = fsub double %16, %19
%21 = load double*, double** %5
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fsub double %23, %26
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 1
%30 = load double, double* %29
%31 = load double*, double** %4
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = fsub double %30, %33
%35 = fmul double %27, %34
%36 = call double @llvm.fmuladd.f64(double %13, double %20, double %35)
%37 = load double*, double** %5
%38 = getelementptr inbounds double, double* %37, i64 2
%39 = load double, double* %38
%40 = load double*, double** %4
%41 = getelementptr inbounds double, double* %40, i64 2
%42 = load double, double* %41
%43 = fsub double %39, %42
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 2
%46 = load double, double* %45
%47 = load double*, double** %4
%48 = getelementptr inbounds double, double* %47, i64 2
%49 = load double, double* %48
%50 = fsub double %46, %49
%51 = call double @llvm.fmuladd.f64(double %43, double %50, double %36)
ret double %51
}

LLVM IR (-O2):
define double @dotabac(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = load double, double* %0
%6 = fsub double %4, %5
%7 = load double, double* %2
%8 = fsub double %7, %5
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %0, i64 1
%12 = load double, double* %11
%13 = fsub double %10, %12
%14 = getelementptr inbounds double, double* %2, i64 1
%15 = load double, double* %14
%16 = fsub double %15, %12
%17 = fmul double %13, %16
%18 = tail call double @llvm.fmuladd.f64(double %6, double %8, double %17)
%19 = getelementptr inbounds double, double* %1, i64 2
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %0, i64 2
%22 = load double, double* %21
%23 = fsub double %20, %22
%24 = getelementptr inbounds double, double* %2, i64 2
%25 = load double, double* %24
%26 = fsub double %25, %22
%27 = tail call double @llvm.fmuladd.f64(double %23, double %26, double %18)
ret double %27
}