#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 */
float sqrt(float);
float Dist(float *Coord1, float *Coord2) {
  register int i;
  float Dist = 0;
  for (i = 0; i < 3; i++)
    Dist += (Coord1[i] - Coord2[i]) * (Coord1[i] - Coord2[i]);
  return (sqrt(Dist));
}


x86 assembly (clang, -O0):
<Dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    118d <Dist+0x7d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm2
movss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <Dist+0x1f>
movss  -0x18(%rbp),%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dist>:
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
subss  (%rsi),%xmm0
mulss  %xmm0,%xmm0
xorps  %xmm2,%xmm2
addss  %xmm2,%xmm0
subss  0x4(%rsi),%xmm1
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
subss  0x8(%rsi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
ucomiss %xmm2,%xmm0
jb     1151 <Dist+0x41>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define float @Dist(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fsub float %3, %4
%6 = tail call float @llvm.fmuladd.f32(float %5, float %5, float 0.000000e+00)
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
%11 = fsub float %8, %10
%12 = tail call float @llvm.fmuladd.f32(float %11, float %11, float %6)
%13 = getelementptr inbounds float, float* %0, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %1, i64 2
%16 = load float, float* %15
%17 = fsub float %14, %16
%18 = tail call float @llvm.fmuladd.f32(float %17, float %17, float %12)
%19 = tail call float @sqrt(float %18)
ret float %19
}