#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 acos(int);
double asin(int);
int cos(double);
int sin(double);
double GCAzimuth_ERROR(double lat1, double lon1, double lat2, double lon2) {
  double result = 0.0;
  double c, A;
  long ilat1 = (long)(0.50 + lat1 * 360000.0);
  long ilat2 = (long)(0.50 + lat2 * 360000.0);
  long ilon1 = (long)(0.50 + lon1 * 360000.0);
  long ilon2 = (long)(0.50 + lon2 * 360000.0);
  lat1 *= 0.01745329252;
  lon1 *= 0.01745329252;
  lat2 *= 0.01745329252;
  lon2 *= 0.01745329252;
  if ((ilat1 == ilat2) && (ilon1 == ilon2)) {
    return result;
  } else if (ilon1 == ilon2) {
    if (ilat1 > ilat2)
      result = 180.0;
  } else {
    c = acos(sin(lat2) * sin(lat1) +
             cos(lat2) * cos(lat1) * cos((lon2 - lon1)));
    A = asin(cos(lat2) * sin((lon2 - lon1)) / sin(c));
    result = (A * 57.2957795129);
    if ((ilat2 > ilat1) && (ilon2 > ilon1)) {
    } else if ((ilat2 < ilat1) && (ilon2 < ilon1)) {
      result = 180.0 - result;
    } else if ((ilat2 < ilat1) && (ilon2 > ilon1)) {
      result = 180.0 - result;
    } else if ((ilat2 > ilat1) && (ilon2 < ilon1)) {
      result += 360.0;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<GCAzimuth_ERROR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe90(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe6a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe48(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe44(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe22(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe1e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x60(%rbp)
movsd  0xdf9(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xde7(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdd5(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdc3(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jne    1272 <GCAzimuth_ERROR+0x132>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jne    1272 <GCAzimuth_ERROR+0x132>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1439 <GCAzimuth_ERROR+0x2f9>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jne    12a0 <GCAzimuth_ERROR+0x160>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jle    129b <GCAzimuth_ERROR+0x15b>
movsd  0xd92(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    142a <GCAzimuth_ERROR+0x2ea>
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <cos@plt>
mov    %eax,-0x74(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <cos@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x6c(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
mov    -0x70(%rbp),%edi
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1030 <acos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <cos@plt>
mov    %eax,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x64(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1050 <asin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  0xcc1(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jle    1382 <GCAzimuth_ERROR+0x242>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jle    1382 <GCAzimuth_ERROR+0x242>
jmp    1425 <GCAzimuth_ERROR+0x2e5>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    13b5 <GCAzimuth_ERROR+0x275>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jge    13b5 <GCAzimuth_ERROR+0x275>
movsd  0xc82(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1420 <GCAzimuth_ERROR+0x2e0>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    13e8 <GCAzimuth_ERROR+0x2a8>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jle    13e8 <GCAzimuth_ERROR+0x2a8>
movsd  0xc4f(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    141b <GCAzimuth_ERROR+0x2db>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jle    1416 <GCAzimuth_ERROR+0x2d6>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jge    1416 <GCAzimuth_ERROR+0x2d6>
movsd  0xc14(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    141b <GCAzimuth_ERROR+0x2db>
jmp    1420 <GCAzimuth_ERROR+0x2e0>
jmp    1425 <GCAzimuth_ERROR+0x2e5>
jmp    142a <GCAzimuth_ERROR+0x2ea>
jmp    142f <GCAzimuth_ERROR+0x2ef>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCAzimuth_ERROR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movapd %xmm0,%xmm6
movsd  0xea6(%rip),%xmm0
movapd %xmm6,%xmm5
mulsd  %xmm0,%xmm5
movsd  0xe9e(%rip),%xmm4
addsd  %xmm4,%xmm5
cvttsd2si %xmm5,%r14
movapd %xmm2,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm4,%xmm5
cvttsd2si %xmm5,%r15
movapd %xmm1,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm4,%xmm5
cvttsd2si %xmm5,%r12
mulsd  %xmm3,%xmm0
addsd  %xmm4,%xmm0
cvttsd2si %xmm0,%r13
cmp    %r15,%r14
jne    11bf <GCAzimuth_ERROR+0x7f>
xorpd  %xmm0,%xmm0
cmp    %r13,%r12
jne    11bf <GCAzimuth_ERROR+0x7f>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    %r13,%r12
jne    11d3 <GCAzimuth_ERROR+0x93>
cmp    %r15,%r14
jg     12c2 <GCAzimuth_ERROR+0x182>
xorpd  %xmm0,%xmm0
jmp    11b0 <GCAzimuth_ERROR+0x70>
movsd  0xe35(%rip),%xmm0
mulsd  %xmm0,%xmm6
movsd  %xmm6,(%rsp)
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm0,%xmm3
subsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
movapd %xmm2,%xmm0
call   1040 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
imul   %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
call   1060 <cos@plt>
imul   %eax,%ebp
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
imul   %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1030 <acos@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1050 <asin@plt>
mulsd  0xd8d(%rip),%xmm0
cmp    %r14,%r15
jle    1299 <GCAzimuth_ERROR+0x159>
cmp    %r12,%r13
jg     11b0 <GCAzimuth_ERROR+0x70>
cmp    %r14,%r15
jge    12a3 <GCAzimuth_ERROR+0x163>
cmp    %r12,%r13
jl     12ad <GCAzimuth_ERROR+0x16d>
cmp    %r14,%r15
jge    12cf <GCAzimuth_ERROR+0x18f>
cmp    %r12,%r13
jle    12cf <GCAzimuth_ERROR+0x18f>
movsd  0xd73(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    11b0 <GCAzimuth_ERROR+0x70>
movsd  0xd5e(%rip),%xmm0
jmp    11b0 <GCAzimuth_ERROR+0x70>
cmp    %r12,%r13
jl     12da <GCAzimuth_ERROR+0x19a>
movapd %xmm0,%xmm1
jmp    12e6 <GCAzimuth_ERROR+0x1a6>
movsd  0xd3e(%rip),%xmm1
addsd  %xmm0,%xmm1
cmp    %r14,%r15
jg     12b9 <GCAzimuth_ERROR+0x179>
movapd %xmm0,%xmm1
jmp    12b9 <GCAzimuth_ERROR+0x179>

LLVM IR (-O0):
define double @GCAzimuth_ERROR(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
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double 0.000000e+00, double* %10
%17 = load double, double* %6
%18 = call double @llvm.fmuladd.f64(double %17, double 3.600000e+05, double 5.000000e-01)
%19 = fptosi double %18 to i64
store i64 %19, i64* %13
%20 = load double, double* %8
%21 = call double @llvm.fmuladd.f64(double %20, double 3.600000e+05, double 5.000000e-01)
%22 = fptosi double %21 to i64
store i64 %22, i64* %14
%23 = load double, double* %7
%24 = call double @llvm.fmuladd.f64(double %23, double 3.600000e+05, double 5.000000e-01)
%25 = fptosi double %24 to i64
store i64 %25, i64* %15
%26 = load double, double* %9
%27 = call double @llvm.fmuladd.f64(double %26, double 3.600000e+05, double 5.000000e-01)
%28 = fptosi double %27 to i64
store i64 %28, i64* %16
%29 = load double, double* %6
%30 = fmul double %29, 0x3F91DF46A252DD11
store double %30, double* %6
%31 = load double, double* %7
%32 = fmul double %31, 0x3F91DF46A252DD11
store double %32, double* %7
%33 = load double, double* %8
%34 = fmul double %33, 0x3F91DF46A252DD11
store double %34, double* %8
%35 = load double, double* %9
%36 = fmul double %35, 0x3F91DF46A252DD11
store double %36, double* %9
%37 = load i64, i64* %13
%38 = load i64, i64* %14
%39 = icmp eq i64 %37, %38
br i1 %39, label %40, label %46
40: ; preds = %4
%41 = load i64, i64* %15
%42 = load i64, i64* %16
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = load double, double* %10
store double %45, double* %5
br label %135
46: ; preds = %40, %4
%47 = load i64, i64* %15
%48 = load i64, i64* %16
%49 = icmp eq i64 %47, %48
br i1 %49, label %50, label %56
50: ; preds = %46
%51 = load i64, i64* %13
%52 = load i64, i64* %14
%53 = icmp sgt i64 %51, %52
br i1 %53, label %54, label %55
54: ; preds = %50
store double 1.800000e+02, double* %10
br label %55
55: ; preds = %54, %50
br label %132
56: ; preds = %46
%57 = load double, double* %8
%58 = call i32 @sin(double %57)
%59 = load double, double* %6
%60 = call i32 @sin(double %59)
%61 = mul nsw i32 %58, %60
%62 = load double, double* %8
%63 = call i32 @cos(double %62)
%64 = load double, double* %6
%65 = call i32 @cos(double %64)
%66 = mul nsw i32 %63, %65
%67 = load double, double* %9
%68 = load double, double* %7
%69 = fsub double %67, %68
%70 = call i32 @cos(double %69)
%71 = mul nsw i32 %66, %70
%72 = add nsw i32 %61, %71
%73 = call double @acos(i32 %72)
store double %73, double* %11
%74 = load double, double* %8
%75 = call i32 @cos(double %74)
%76 = load double, double* %9
%77 = load double, double* %7
%78 = fsub double %76, %77
%79 = call i32 @sin(double %78)
%80 = mul nsw i32 %75, %79
%81 = load double, double* %11
%82 = call i32 @sin(double %81)
%83 = sdiv i32 %80, %82
%84 = call double @asin(i32 %83)
store double %84, double* %12
%85 = load double, double* %12
%86 = fmul double %85, 0x404CA5DC1A635DBC
store double %86, double* %10
%87 = load i64, i64* %14
%88 = load i64, i64* %13
%89 = icmp sgt i64 %87, %88
br i1 %89, label %90, label %95
90: ; preds = %56
%91 = load i64, i64* %16
%92 = load i64, i64* %15
%93 = icmp sgt i64 %91, %92
br i1 %93, label %94, label %95
94: ; preds = %90
br label %131
95: ; preds = %90, %56
%96 = load i64, i64* %14
%97 = load i64, i64* %13
%98 = icmp slt i64 %96, %97
br i1 %98, label %99, label %106
99: ; preds = %95
%100 = load i64, i64* %16
%101 = load i64, i64* %15
%102 = icmp slt i64 %100, %101
br i1 %102, label %103, label %106
103: ; preds = %99
%104 = load double, double* %10
%105 = fsub double 1.800000e+02, %104
store double %105, double* %10
br label %130
106: ; preds = %99, %95
%107 = load i64, i64* %14
%108 = load i64, i64* %13
%109 = icmp slt i64 %107, %108
br i1 %109, label %110, label %117
110: ; preds = %106
%111 = load i64, i64* %16
%112 = load i64, i64* %15
%113 = icmp sgt i64 %111, %112
br i1 %113, label %114, label %117
114: ; preds = %110
%115 = load double, double* %10
%116 = fsub double 1.800000e+02, %115
store double %116, double* %10
br label %129
117: ; preds = %110, %106
%118 = load i64, i64* %14
%119 = load i64, i64* %13
%120 = icmp sgt i64 %118, %119
br i1 %120, label %121, label %128
121: ; preds = %117
%122 = load i64, i64* %16
%123 = load i64, i64* %15
%124 = icmp slt i64 %122, %123
br i1 %124, label %125, label %128
125: ; preds = %121
%126 = load double, double* %10
%127 = fadd double %126, 3.600000e+02
store double %127, double* %10
br label %128
128: ; preds = %125, %121, %117
br label %129
129: ; preds = %128, %114
br label %130
130: ; preds = %129, %103
br label %131
131: ; preds = %130, %94
br label %132
132: ; preds = %131, %55
br label %133
133: ; preds = %132
%134 = load double, double* %10
store double %134, double* %5
br label %135
135: ; preds = %133, %44
%136 = load double, double* %5
ret double %136
}

LLVM IR (-O2):
define double @GCAzimuth_ERROR(double %0, double %1, double %2, double %3) {
%5 = tail call double @llvm.fmuladd.f64(double %0, double 3.600000e+05, double 5.000000e-01)
%6 = fptosi double %5 to i64
%7 = tail call double @llvm.fmuladd.f64(double %2, double 3.600000e+05, double 5.000000e-01)
%8 = fptosi double %7 to i64
%9 = tail call double @llvm.fmuladd.f64(double %1, double 3.600000e+05, double 5.000000e-01)
%10 = fptosi double %9 to i64
%11 = tail call double @llvm.fmuladd.f64(double %3, double 3.600000e+05, double 5.000000e-01)
%12 = fptosi double %11 to i64
%13 = fmul double %0, 0x3F91DF46A252DD11
%14 = fmul double %1, 0x3F91DF46A252DD11
%15 = fmul double %2, 0x3F91DF46A252DD11
%16 = fmul double %3, 0x3F91DF46A252DD11
%17 = icmp eq i64 %6, %8
%18 = icmp eq i64 %10, %12
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %60, label %20
20: ; preds = %4
br i1 %18, label %21, label %24
21: ; preds = %20
%22 = icmp sgt i64 %6, %8
%23 = select i1 %22, double 1.800000e+02, double 0.000000e+00
br label %60
24: ; preds = %20
%25 = tail call i32 @sin(double %15)
%26 = tail call i32 @sin(double %13)
%27 = mul nsw i32 %26, %25
%28 = tail call i32 @cos(double %15)
%29 = tail call i32 @cos(double %13)
%30 = mul nsw i32 %29, %28
%31 = fsub double %16, %14
%32 = tail call i32 @cos(double %31)
%33 = mul nsw i32 %30, %32
%34 = add nsw i32 %33, %27
%35 = tail call double @acos(i32 %34)
%36 = tail call i32 @cos(double %15)
%37 = tail call i32 @sin(double %31)
%38 = mul nsw i32 %37, %36
%39 = tail call i32 @sin(double %35)
%40 = sdiv i32 %38, %39
%41 = tail call double @asin(i32 %40)
%42 = fmul double %41, 0x404CA5DC1A635DBC
%43 = icmp sgt i64 %8, %6
%44 = icmp sgt i64 %12, %10
%45 = select i1 %43, i1 %44, i1 false
br i1 %45, label %60, label %46
46: ; preds = %24
%47 = icmp slt i64 %8, %6
%48 = icmp slt i64 %12, %10
%49 = select i1 %47, i1 %48, i1 false
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = fsub double 1.800000e+02, %42
br label %60
52: ; preds = %46
%53 = select i1 %47, i1 %44, i1 false
br i1 %53, label %54, label %56
54: ; preds = %52
%55 = fsub double 1.800000e+02, %42
br label %60
56: ; preds = %52
%57 = select i1 %43, i1 %48, i1 false
%58 = fadd double %42, 3.600000e+02
%59 = select i1 %57, double %58, double %42
br label %60
60: ; preds = %56, %21, %54, %50, %24, %4
%61 = phi double [ 0.000000e+00, %4 ], [ %51, %50 ], [ %55, %54 ], [ %23, %21 ], [ %42, %24 ], [ %59, %56 ]
ret double %61
}