#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 distance(float x1, float y1, float z1, float x2, float y2, float z2) {
  float x = x1 - x2;
  float y = y1 - y2;
  float z = z1 - z2;
  return sqrt(x * x + y * y + z * z);
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
subss  %xmm3,%xmm0
subss  %xmm4,%xmm1
subss  %xmm5,%xmm2
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
mulss  %xmm2,%xmm2
addss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jb     1140 <distance+0x30>
xorps  %xmm0,%xmm0
sqrtss %xmm2,%xmm0
ret
movaps %xmm2,%xmm0
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @distance(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%16 = load float, float* %7
%17 = load float, float* %10
%18 = fsub float %16, %17
store float %18, float* %13
%19 = load float, float* %8
%20 = load float, float* %11
%21 = fsub float %19, %20
store float %21, float* %14
%22 = load float, float* %9
%23 = load float, float* %12
%24 = fsub float %22, %23
store float %24, float* %15
%25 = load float, float* %13
%26 = load float, float* %13
%27 = load float, float* %14
%28 = load float, float* %14
%29 = fmul float %27, %28
%30 = call float @llvm.fmuladd.f32(float %25, float %26, float %29)
%31 = load float, float* %15
%32 = load float, float* %15
%33 = call float @llvm.fmuladd.f32(float %31, float %32, float %30)
%34 = call float @sqrt(float %33)
ret float %34
}

LLVM IR (-O2):
define float @distance(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fsub float %0, %3
%8 = fsub float %1, %4
%9 = fsub float %2, %5
%10 = fmul float %8, %8
%11 = tail call float @llvm.fmuladd.f32(float %7, float %7, float %10)
%12 = tail call float @llvm.fmuladd.f32(float %9, float %9, float %11)
%13 = tail call float @sqrt(float %12)
ret float %13
}