#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 */
scalar_t__ powf(float, float);
float sqrtf(scalar_t__);
float distance(float *cartesian1, float *cartesian2) {
  return sqrtf(powf(cartesian1[0] - cartesian2[0], 2.f) +
               powf(cartesian1[1] - cartesian2[1], 2.f) +
               powf(cartesian1[2] - cartesian2[2], 2.f));
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
movss  0xeb8(%rip),%xmm1
call   1030 <powf@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  0xe95(%rip),%xmm1
call   1030 <powf@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  0xe68(%rip),%xmm1
call   1030 <powf@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
movss  0xec5(%rip),%xmm1
call   1030 <powf@plt>
mov    %rax,%rbx
movss  0x4(%r15),%xmm0
subss  0x4(%r14),%xmm0
movss  0xea9(%rip),%xmm1
call   1030 <powf@plt>
add    %rax,%rbx
movss  0x8(%r15),%xmm0
subss  0x8(%r14),%xmm0
movss  0xe8d(%rip),%xmm1
call   1030 <powf@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <sqrtf@plt>

LLVM IR (-O0):
define float @distance(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = fsub float %7, %10
%12 = call i64 @powf(float %11, float 2.000000e+00)
%13 = load float*, float** %3
%14 = getelementptr inbounds float, float* %13, i64 1
%15 = load float, float* %14
%16 = load float*, float** %4
%17 = getelementptr inbounds float, float* %16, i64 1
%18 = load float, float* %17
%19 = fsub float %15, %18
%20 = call i64 @powf(float %19, float 2.000000e+00)
%21 = add nsw i64 %12, %20
%22 = load float*, float** %3
%23 = getelementptr inbounds float, float* %22, i64 2
%24 = load float, float* %23
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = fsub float %24, %27
%29 = call i64 @powf(float %28, float 2.000000e+00)
%30 = add nsw i64 %21, %29
%31 = call float @sqrtf(i64 %30)
ret float %31
}

LLVM IR (-O2):
define float @distance(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fsub float %3, %4
%6 = tail call i64 @powf(float %5, float 2.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 i64 @powf(float %11, float 2.000000e+00)
%13 = add nsw i64 %12, %6
%14 = getelementptr inbounds float, float* %0, i64 2
%15 = load float, float* %14
%16 = getelementptr inbounds float, float* %1, i64 2
%17 = load float, float* %16
%18 = fsub float %15, %17
%19 = tail call i64 @powf(float %18, float 2.000000e+00)
%20 = add nsw i64 %13, %19
%21 = tail call float @sqrtf(i64 %20)
ret float %21
}