#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(int /*<<< orphan*/);
int /*<<< orphan*/ square_euclidean_distance(double *, double *, int);
double euclidean_distance2(double ax, double ay, double bx, double by) {
  double a[2];
  double b[2];
  a[0] = ax;
  a[1] = ay;
  b[0] = bx;
  b[1] = by;
  return sqrt(square_euclidean_distance(a, b, 2));
}


x86 assembly (clang, -O0):
<euclidean_distance2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x2,%edx
call   1040 <square_euclidean_distance@plt>
mov    %eax,%edi
call   1030 <sqrt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<euclidean_distance2>:
sub    $0x28,%rsp
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm3,0x8(%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x2,%edx
call   1040 <square_euclidean_distance@plt>
mov    %eax,%edi
call   1030 <sqrt@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @euclidean_distance2(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca [2 x double]
%10 = alloca [2 x double]
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %5
%12 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
store double %11, double* %12
%13 = load double, double* %6
%14 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 1
store double %13, double* %14
%15 = load double, double* %7
%16 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
store double %15, double* %16
%17 = load double, double* %8
%18 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 1
store double %17, double* %18
%19 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
%20 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%21 = call i32 @square_euclidean_distance(double* %19, double* %20, i32 2)
%22 = call double @sqrt(i32 %21)
ret double %22
}

LLVM IR (-O2):
define double @euclidean_distance2(double %0, double %1, double %2, double %3) {
%5 = alloca [2 x double]
%6 = alloca [2 x double]
%7 = bitcast [2 x double]* %5 to i8*
%8 = bitcast [2 x double]* %6 to i8*
%9 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
store double %0, double* %9
%10 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
store double %1, double* %10
%11 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
store double %2, double* %11
%12 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 1
store double %3, double* %12
%13 = call i32 @square_euclidean_distance(double* %9, double* %11, i32 2)
%14 = call double @sqrt(i32 %13)
ret double %14
}