#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 */
int asin(float);
int cos(float);
int pow(float, int);
float sin(float);
float sqrt(int);
float dist_calc(float lat1, float lon1, float depth1, float lat2, float lon2,
                float depth2) {
  double central_angle;
  float dlat, dlong, ddepth, distance;
  dlat = lat1 - lat2;
  dlong = lon1 - lon2;
  ddepth = depth1 - depth2;
  central_angle =
      2 * asin(sqrt(pow(sin(dlat / 2), 2) +
                    cos(lat1) * cos(lat2) * pow(sin(dlong / 2), 2)));
  distance = 6371.009 * central_angle;
  distance = sqrt(pow(distance, 2) + pow(ddepth, 2));
  return distance;
}


x86 assembly (clang, -O0):
<dist_calc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
movss  0xe58(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <sin@plt>
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,-0x3c(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,-0x40(%rbp)
movss  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x38(%rbp)
movss  -0x28(%rbp),%xmm0
movss  0xe13(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <sin@plt>
mov    $0x2,%edi
call   1060 <pow@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1070 <sqrt@plt>
call   1040 <asin@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdcd(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,-0x34(%rbp)
movss  -0x2c(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    -0x34(%rbp),%edi
add    %eax,%edi
call   1070 <sqrt@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_calc>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movss  %xmm3,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
subss  %xmm3,%xmm0
subss  %xmm4,%xmm1
movss  %xmm1,0x10(%rsp)
subss  %xmm5,%xmm2
movss  %xmm2,0x14(%rsp)
mulss  0xe7e(%rip),%xmm0
call   1030 <sin@plt>
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,%ebx
movss  0x8(%rsp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ebp
movss  0xc(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
movss  0x10(%rsp),%xmm0
mulss  0xe44(%rip),%xmm0
call   1030 <sin@plt>
mov    $0x2,%edi
call   1060 <pow@plt>
imul   %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1070 <sqrt@plt>
call   1040 <asin@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe1b(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,%ebx
movss  0x14(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
add    %eax,%ebx
mov    %ebx,%edi
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <sqrt@plt>

LLVM IR (-O0):
define float @dist_calc(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 double
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = 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
%18 = load float, float* %7
%19 = load float, float* %10
%20 = fsub float %18, %19
store float %20, float* %14
%21 = load float, float* %8
%22 = load float, float* %11
%23 = fsub float %21, %22
store float %23, float* %15
%24 = load float, float* %9
%25 = load float, float* %12
%26 = fsub float %24, %25
store float %26, float* %16
%27 = load float, float* %14
%28 = fdiv float %27, 2.000000e+00
%29 = call float @sin(float %28)
%30 = call i32 @pow(float %29, i32 2)
%31 = load float, float* %7
%32 = call i32 @cos(float %31)
%33 = load float, float* %10
%34 = call i32 @cos(float %33)
%35 = mul nsw i32 %32, %34
%36 = load float, float* %15
%37 = fdiv float %36, 2.000000e+00
%38 = call float @sin(float %37)
%39 = call i32 @pow(float %38, i32 2)
%40 = mul nsw i32 %35, %39
%41 = add nsw i32 %30, %40
%42 = call float @sqrt(i32 %41)
%43 = call i32 @asin(float %42)
%44 = mul nsw i32 2, %43
%45 = sitofp i32 %44 to double
store double %45, double* %13
%46 = load double, double* %13
%47 = fmul double 0x40B8E3024DD2F1AA, %46
%48 = fptrunc double %47 to float
store float %48, float* %17
%49 = load float, float* %17
%50 = call i32 @pow(float %49, i32 2)
%51 = load float, float* %16
%52 = call i32 @pow(float %51, i32 2)
%53 = add nsw i32 %50, %52
%54 = call float @sqrt(i32 %53)
store float %54, float* %17
%55 = load float, float* %17
ret float %55
}

LLVM IR (-O2):
define float @dist_calc(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 %7, 5.000000e-01
%11 = tail call float @sin(float %10)
%12 = tail call i32 @pow(float %11, i32 2)
%13 = tail call i32 @cos(float %0)
%14 = tail call i32 @cos(float %3)
%15 = mul nsw i32 %14, %13
%16 = fmul float %8, 5.000000e-01
%17 = tail call float @sin(float %16)
%18 = tail call i32 @pow(float %17, i32 2)
%19 = mul nsw i32 %15, %18
%20 = add nsw i32 %19, %12
%21 = tail call float @sqrt(i32 %20)
%22 = tail call i32 @asin(float %21)
%23 = shl nsw i32 %22, 1
%24 = sitofp i32 %23 to double
%25 = fmul double %24, 0x40B8E3024DD2F1AA
%26 = fptrunc double %25 to float
%27 = tail call i32 @pow(float %26, i32 2)
%28 = tail call i32 @pow(float %9, i32 2)
%29 = add nsw i32 %28, %27
%30 = tail call float @sqrt(i32 %29)
ret float %30
}