#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 cos(double);
double fabs(double);
double compute_distance_between_points(double longitude1, double latitude1,
                                       double longitude2, double latitude2) {
  double diff_longitude, diff_latitude;
  double return_value;
  if ((longitude1 == 0) || (latitude1 == 0) || (longitude2 == 0) ||
      (latitude2 == 0))
    return -1.0;
  diff_longitude = fabs(longitude1 - longitude2);
  diff_latitude = fabs(latitude1 - latitude2);
  return_value =
      (diff_longitude + diff_latitude) * 69.1 * cos(latitude1 / 57.3);
  return return_value;
}


x86 assembly (clang, -O0):
<compute_distance_between_points>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1149 <compute_distance_between_points+0x39>
jp     1149 <compute_distance_between_points+0x39>
jmp    119b <compute_distance_between_points+0x8b>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1166 <compute_distance_between_points+0x56>
jp     1166 <compute_distance_between_points+0x56>
jmp    119b <compute_distance_between_points+0x8b>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1183 <compute_distance_between_points+0x73>
jp     1183 <compute_distance_between_points+0x73>
jmp    119b <compute_distance_between_points+0x8b>
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ad <compute_distance_between_points+0x9d>
jp     11ad <compute_distance_between_points+0x9d>
movsd  0xe6d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    122d <compute_distance_between_points+0x11d>
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movaps 0xe62(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movaps 0xe48(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xe15(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xdf7(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_distance_between_points>:
sub    $0x18,%rsp
movapd %xmm0,%xmm4
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm0
movsd  0xed8(%rip),%xmm0
jne    112c <compute_distance_between_points+0x1c>
jnp    1188 <compute_distance_between_points+0x78>
ucomisd %xmm5,%xmm1
jne    1134 <compute_distance_between_points+0x24>
jnp    1188 <compute_distance_between_points+0x78>
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm2
jne    1140 <compute_distance_between_points+0x30>
jnp    1188 <compute_distance_between_points+0x78>
ucomisd %xmm5,%xmm3
jne    1148 <compute_distance_between_points+0x38>
jnp    1188 <compute_distance_between_points+0x78>
unpcklpd %xmm1,%xmm4
unpcklpd %xmm3,%xmm2
subpd  %xmm2,%xmm4
andpd  0xec4(%rip),%xmm4
pshufd $0xee,%xmm4,%xmm0
addsd  %xmm4,%xmm0
mulsd  0xe9b(%rip),%xmm0
movapd %xmm0,(%rsp)
divsd  0xe96(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  (%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @compute_distance_between_points(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%13 = load double, double* %6
%14 = fcmp oeq double %13, 0.000000e+00
br i1 %14, label %24, label %15
15: ; preds = %4
%16 = load double, double* %7
%17 = fcmp oeq double %16, 0.000000e+00
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load double, double* %8
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load double, double* %9
%23 = fcmp oeq double %22, 0.000000e+00
br i1 %23, label %24, label %25
24: ; preds = %21, %18, %15, %4
store double -1.000000e+00, double* %5
br label %43
25: ; preds = %21
%26 = load double, double* %6
%27 = load double, double* %8
%28 = fsub double %26, %27
%29 = call double @llvm.fabs.f64(double %28)
store double %29, double* %10
%30 = load double, double* %7
%31 = load double, double* %9
%32 = fsub double %30, %31
%33 = call double @llvm.fabs.f64(double %32)
store double %33, double* %11
%34 = load double, double* %10
%35 = load double, double* %11
%36 = fadd double %34, %35
%37 = fmul double %36, 6.910000e+01
%38 = load double, double* %7
%39 = fdiv double %38, 5.730000e+01
%40 = call double @cos(double %39)
%41 = fmul double %37, %40
store double %41, double* %12
%42 = load double, double* %12
store double %42, double* %5
br label %43
43: ; preds = %25, %24
%44 = load double, double* %5
ret double %44
}

LLVM IR (-O2):
define double @compute_distance_between_points(double %0, double %1, double %2, double %3) {
%5 = fcmp oeq double %0, 0.000000e+00
%6 = fcmp oeq double %1, 0.000000e+00
%7 = or i1 %5, %6
%8 = fcmp oeq double %2, 0.000000e+00
%9 = or i1 %7, %8
%10 = fcmp oeq double %3, 0.000000e+00
%11 = or i1 %9, %10
br i1 %11, label %26, label %12
12: ; preds = %4
%13 = insertelement <2 x double> poison, double %0, i64 0
%14 = insertelement <2 x double> %13, double %1, i64 1
%15 = insertelement <2 x double> poison, double %2, i64 0
%16 = insertelement <2 x double> %15, double %3, i64 1
%17 = fsub <2 x double> %14, %16
%18 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %17)
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%20 = fadd <2 x double> %18, %19
%21 = extractelement <2 x double> %20, i64 0
%22 = fmul double %21, 6.910000e+01
%23 = fdiv double %1, 5.730000e+01
%24 = tail call double @cos(double %23)
%25 = fmul double %22, %24
br label %26
26: ; preds = %4, %12
%27 = phi double [ %25, %12 ], [ -1.000000e+00, %4 ]
ret double %27
}