double CINTsquare_dist(const double *r1, const double *r2) {
  double r12[3];
  r12[0] = r1[0] - r2[0];
  r12[1] = r1[1] - r2[1];
  r12[2] = r1[2] - r2[2];
  return r12[0] * r12[0] + r12[1] * r12[1] + r12[2] * r12[2];
}


x86 assembly (clang, -O0):
<CINTsquare_dist>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @CINTsquare_dist(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca [3 x double]
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = fsub double %8, %11
%13 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
store double %12, double* %13
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fsub double %16, %19
%21 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
store double %20, double* %21
%22 = load double*, double** %3
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = fsub double %24, %27
%29 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
store double %28, double* %29
%30 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%31 = load double, double* %30
%32 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%33 = load double, double* %32
%34 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%35 = load double, double* %34
%36 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%37 = load double, double* %36
%38 = fmul double %35, %37
%39 = call double @llvm.fmuladd.f64(double %31, double %33, double %38)
%40 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%41 = load double, double* %40
%42 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%43 = load double, double* %42
%44 = call double @llvm.fmuladd.f64(double %41, double %43, double %39)
ret double %44
}

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