#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__ pow(float, int);
float sqrt(scalar_t__);
float getDistance(float goal[3], float curr[3]) {
  return sqrt(pow((goal[0] - curr[0]), 2) + pow((goal[1] - curr[1]), 2) +
              pow((goal[2] - curr[2]), 2));
}


x86 assembly (clang, -O0):
<getDistance>:
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
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
mov    $0x2,%edi
call   1030 <pow@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
mov    $0x2,%edi
call   1030 <pow@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDistance>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,%rbx
movss  0x4(%r15),%xmm0
subss  0x4(%r14),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
add    %rax,%rbx
movss  0x8(%r15),%xmm0
subss  0x8(%r14),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define float @getDistance(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 @pow(float %11, i32 2)
%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 @pow(float %19, i32 2)
%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 @pow(float %28, i32 2)
%30 = add nsw i64 %21, %29
%31 = call float @sqrt(i64 %30)
ret float %31
}

LLVM IR (-O2):
define float @getDistance(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 @pow(float %5, i32 2)
%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 @pow(float %11, i32 2)
%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 @pow(float %18, i32 2)
%20 = add nsw i64 %13, %19
%21 = tail call float @sqrt(i64 %20)
ret float %21
}