double mpdist(double *a, double *b) {
  double out;
  out = (0.5 * (*a - *b));
  a++;
  b++;
  out += (0.5 * (*a - *b));
  a++;
  b++;
  out += (0.5 * (*a - *b));
  return out;
}


x86 assembly (clang, -O0):
<mpdist>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
movsd  0xedc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe9e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe5c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpdist>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
movsd  0x8(%rdi),%xmm1
movsd  0xeeb(%rip),%xmm2
subsd  0x8(%rsi),%xmm1
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
subsd  0x10(%rsi),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @mpdist(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = fmul double %5, 5.000000e-01
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %7
%10 = load double, double* %8
%11 = fsub double %9, %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double 5.000000e-01, double %6)
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = getelementptr inbounds double, double* %1, i64 2
%15 = load double, double* %13
%16 = load double, double* %14
%17 = fsub double %15, %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double 5.000000e-01, double %12)
ret double %18
}