#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 abs(int);
double pow(double, double);
double sqrt(double);
double calc_dis(int x, int y, int x2, int y2) {
  double linea, lineb;
  double linec = 4.0;
  linea = abs(x - x2);
  lineb = abs(y - y2);
  linec = pow(linea, 2.0) + pow(lineb, 2.0);
  linec = sqrt(linec);
  return linec;
}


x86 assembly (clang, -O0):
<calc_dis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1030 <abs@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1030 <abs@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe6b(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_dis>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %esi,%ebp
sub    %edx,%edi
call   1030 <abs@plt>
movsd  %xmm0,(%rsp)
sub    %ebx,%ebp
mov    %ebp,%edi
call   1030 <abs@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1162 <calc_dis+0x42>
sqrtsd %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @calc_dis(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store double 4.000000e+00, double* %11
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = sub nsw i32 %12, %13
%15 = call double @abs(i32 %14)
store double %15, double* %9
%16 = load i32, i32* %6
%17 = load i32, i32* %8
%18 = sub nsw i32 %16, %17
%19 = call double @abs(i32 %18)
store double %19, double* %10
%20 = load double, double* %9
%21 = call double @pow(double %20, double 2.000000e+00)
%22 = load double, double* %10
%23 = call double @pow(double %22, double 2.000000e+00)
%24 = fadd double %21, %23
store double %24, double* %11
%25 = load double, double* %11
%26 = call double @sqrt(double %25)
store double %26, double* %11
%27 = load double, double* %11
ret double %27
}

LLVM IR (-O2):
define double @calc_dis(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %2
%6 = tail call double @abs(i32 %5)
%7 = sub nsw i32 %1, %3
%8 = tail call double @abs(i32 %7)
%9 = fmul double %6, %6
%10 = fmul double %8, %8
%11 = fadd double %9, %10
%12 = tail call double @sqrt(double %11)
ret double %12
}