double s6eucldistsq(double v1[6], double v2[6]) {
  double vtemp;
  int ii;
  double distsq;
  distsq = 0.;
  for (ii = 0; ii < 6; ii++) {
    vtemp = v1[ii] - v2[ii];
    distsq += vtemp * vtemp;
  }
  return distsq;
}


x86 assembly (clang, -O0):
<s6eucldistsq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jge    116e <s6eucldistsq+0x6e>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111b <s6eucldistsq+0x1b>
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<s6eucldistsq>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
subsd  0x8(%rsi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  0x10(%rdi),%xmm0
subsd  0x10(%rsi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x18(%rdi),%xmm1
subsd  0x18(%rsi),%xmm1
mulsd  %xmm1,%xmm1
movsd  0x20(%rdi),%xmm2
subsd  0x20(%rsi),%xmm2
addsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
movsd  0x28(%rdi),%xmm0
subsd  0x28(%rsi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @s6eucldistsq(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca i32
%7 = alloca double
store double* %0, double** %3
store double* %1, double** %4
store double 0.000000e+00, double* %7
store i32 0, i32* %6
br label %8
8: ; preds = %27, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load double*, double** %3
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double*, double** %4
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fsub double %16, %21
store double %22, double* %5
%23 = load double, double* %5
%24 = load double, double* %5
%25 = load double, double* %7
%26 = call double @llvm.fmuladd.f64(double %23, double %24, double %25)
store double %26, double* %7
br label %27
27: ; preds = %11
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %8
30: ; preds = %8
%31 = load double, double* %7
ret double %31
}

LLVM IR (-O2):
define double @s6eucldistsq(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double %5, double 0.000000e+00)
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fsub double %8, %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %6)
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = fsub double %14, %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %12)
%19 = getelementptr inbounds double, double* %0, i64 3
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %1, i64 3
%22 = load double, double* %21
%23 = fsub double %20, %22
%24 = tail call double @llvm.fmuladd.f64(double %23, double %23, double %18)
%25 = getelementptr inbounds double, double* %0, i64 4
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %1, i64 4
%28 = load double, double* %27
%29 = fsub double %26, %28
%30 = tail call double @llvm.fmuladd.f64(double %29, double %29, double %24)
%31 = getelementptr inbounds double, double* %0, i64 5
%32 = load double, double* %31
%33 = getelementptr inbounds double, double* %1, i64 5
%34 = load double, double* %33
%35 = fsub double %32, %34
%36 = tail call double @llvm.fmuladd.f64(double %35, double %35, double %30)
ret double %36
}