#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double sqrt(double);
double absdiff(double in1[3], double in2[3]) {
  double tt, rv = 0.0;
  tt = in1[0] - in2[0];
  rv += tt * tt;
  tt = in1[1] - in2[1];
  rv += tt * tt;
  tt = in1[2] - in2[2];
  rv += tt * tt;
  return sqrt(rv);
}


x86 assembly (clang, -O0):
<absdiff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<absdiff>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
subsd  (%rsi),%xmm0
mulsd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
addsd  %xmm2,%xmm0
subsd  0x8(%rsi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
subsd  0x10(%rsi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
jb     1153 <absdiff+0x43>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @absdiff(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
store double* %0, double** %3
store double* %1, double** %4
store double 0.000000e+00, double* %6
%7 = load double*, double** %3
%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
store double %13, double* %5
%14 = load double, double* %5
%15 = load double, double* %5
%16 = load double, double* %6
%17 = call double @llvm.fmuladd.f64(double %14, double %15, double %16)
store double %17, double* %6
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = fsub double %20, %23
store double %24, double* %5
%25 = load double, double* %5
%26 = load double, double* %5
%27 = load double, double* %6
%28 = call double @llvm.fmuladd.f64(double %25, double %26, double %27)
store double %28, double* %6
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = load double*, double** %4
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = fsub double %31, %34
store double %35, double* %5
%36 = load double, double* %5
%37 = load double, double* %5
%38 = load double, double* %6
%39 = call double @llvm.fmuladd.f64(double %36, double %37, double %38)
store double %39, double* %6
%40 = load double, double* %6
%41 = call double @sqrt(double %40)
ret double %41
}

LLVM IR (-O2):
define double @absdiff(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 = tail call double @sqrt(double %18)
ret double %19
}