#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 M_PI;
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 *= (M_PI / 180.0);
  lon1 *= (M_PI / 180.0);
  lat2 *= (M_PI / 180.0);
  lon2 *= (M_PI / 180.0);
  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 * (180.0 / M_PI));
    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)
mov    0x2de2(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xdee(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2dc1(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xdcd(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2da0(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xdac(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2d7f(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xd8b(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jne    12ae <GCAzimuth_ERROR+0x16e>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jne    12ae <GCAzimuth_ERROR+0x16e>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1484 <GCAzimuth_ERROR+0x344>
mov    -0x58(%rbp),%rax
cmp    -0x60(%rbp),%rax
jne    12dc <GCAzimuth_ERROR+0x19c>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jle    12d7 <GCAzimuth_ERROR+0x197>
movsd  0xd2e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1475 <GCAzimuth_ERROR+0x335>
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  -0x40(%rbp),%xmm0
movsd  0xc68(%rip),%xmm1
mov    0x2c49(%rip),%rax
divsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jle    13cd <GCAzimuth_ERROR+0x28d>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jle    13cd <GCAzimuth_ERROR+0x28d>
jmp    1470 <GCAzimuth_ERROR+0x330>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    1400 <GCAzimuth_ERROR+0x2c0>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jge    1400 <GCAzimuth_ERROR+0x2c0>
movsd  0xc0f(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    146b <GCAzimuth_ERROR+0x32b>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    1433 <GCAzimuth_ERROR+0x2f3>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jle    1433 <GCAzimuth_ERROR+0x2f3>
movsd  0xbdc(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1466 <GCAzimuth_ERROR+0x326>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jle    1461 <GCAzimuth_ERROR+0x321>
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jge    1461 <GCAzimuth_ERROR+0x321>
movsd  0xbc1(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1466 <GCAzimuth_ERROR+0x326>
jmp    146b <GCAzimuth_ERROR+0x32b>
jmp    1470 <GCAzimuth_ERROR+0x330>
jmp    1475 <GCAzimuth_ERROR+0x335>
jmp    147a <GCAzimuth_ERROR+0x33a>
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
mov    0x2e3f(%rip),%rax
movsd  (%rax),%xmm4
cmp    %r15,%r14
jne    11ca <GCAzimuth_ERROR+0x8a>
xorpd  %xmm0,%xmm0
cmp    %r13,%r12
jne    11ca <GCAzimuth_ERROR+0x8a>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    %r13,%r12
jne    11de <GCAzimuth_ERROR+0x9e>
cmp    %r15,%r14
jg     12dc <GCAzimuth_ERROR+0x19c>
xorpd  %xmm0,%xmm0
jmp    11bb <GCAzimuth_ERROR+0x7b>
divsd  0xe2a(%rip),%xmm4
mulsd  %xmm4,%xmm6
movsd  %xmm6,(%rsp)
mulsd  %xmm4,%xmm1
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm3,%xmm4
subsd  %xmm1,%xmm4
movsd  %xmm4,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>
movapd %xmm0,%xmm1
movsd  0xd76(%rip),%xmm2
movapd %xmm2,%xmm0
mov    0x2d43(%rip),%rax
divsd  (%rax),%xmm0
mulsd  %xmm1,%xmm0
cmp    %r14,%r15
jle    12bb <GCAzimuth_ERROR+0x17b>
cmp    %r12,%r13
jg     11bb <GCAzimuth_ERROR+0x7b>
cmp    %r14,%r15
jge    12c5 <GCAzimuth_ERROR+0x185>
cmp    %r12,%r13
jl     12cf <GCAzimuth_ERROR+0x18f>
cmp    %r14,%r15
jge    12e9 <GCAzimuth_ERROR+0x1a9>
cmp    %r12,%r13
jle    12e9 <GCAzimuth_ERROR+0x1a9>
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
jmp    11bb <GCAzimuth_ERROR+0x7b>
movsd  0xd2c(%rip),%xmm0
jmp    11bb <GCAzimuth_ERROR+0x7b>
cmp    %r12,%r13
jl     12f4 <GCAzimuth_ERROR+0x1b4>
movapd %xmm0,%xmm1
jmp    1300 <GCAzimuth_ERROR+0x1c0>
movsd  0xd1c(%rip),%xmm1
addsd  %xmm0,%xmm1
cmp    %r14,%r15
jg     1309 <GCAzimuth_ERROR+0x1c9>
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    11bb <GCAzimuth_ERROR+0x7b>

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
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 = load double, double* @M_PI
%14 = fdiv double %13, 1.800000e+02
%15 = fmul double %14, %0
%16 = fmul double %14, %1
%17 = fmul double %14, %2
%18 = fmul double %14, %3
%19 = icmp eq i64 %6, %8
%20 = icmp eq i64 %10, %12
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %64, label %22
22: ; preds = %4
br i1 %20, label %23, label %26
23: ; preds = %22
%24 = icmp sgt i64 %6, %8
%25 = select i1 %24, double 1.800000e+02, double 0.000000e+00
br label %64
26: ; preds = %22
%27 = tail call i32 @sin(double %17)
%28 = tail call i32 @sin(double %15)
%29 = mul nsw i32 %28, %27
%30 = tail call i32 @cos(double %17)
%31 = tail call i32 @cos(double %15)
%32 = mul nsw i32 %31, %30
%33 = fsub double %18, %16
%34 = tail call i32 @cos(double %33)
%35 = mul nsw i32 %32, %34
%36 = add nsw i32 %35, %29
%37 = tail call double @acos(i32 %36)
%38 = tail call i32 @cos(double %17)
%39 = tail call i32 @sin(double %33)
%40 = mul nsw i32 %39, %38
%41 = tail call i32 @sin(double %37)
%42 = sdiv i32 %40, %41
%43 = tail call double @asin(i32 %42)
%44 = load double, double* @M_PI
%45 = fdiv double 1.800000e+02, %44
%46 = fmul double %43, %45
%47 = icmp sgt i64 %8, %6
%48 = icmp sgt i64 %12, %10
%49 = select i1 %47, i1 %48, i1 false
br i1 %49, label %64, label %50
50: ; preds = %26
%51 = icmp slt i64 %8, %6
%52 = icmp slt i64 %12, %10
%53 = select i1 %51, i1 %52, i1 false
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = fsub double 1.800000e+02, %46
br label %64
56: ; preds = %50
%57 = select i1 %51, i1 %48, i1 false
br i1 %57, label %58, label %60
58: ; preds = %56
%59 = fsub double 1.800000e+02, %46
br label %64
60: ; preds = %56
%61 = select i1 %47, i1 %52, i1 false
%62 = fadd double %46, 3.600000e+02
%63 = select i1 %61, double %62, double %46
br label %64
64: ; preds = %60, %23, %58, %54, %26, %4
%65 = phi double [ 0.000000e+00, %4 ], [ %55, %54 ], [ %59, %58 ], [ %25, %23 ], [ %46, %26 ], [ %63, %60 ]
ret double %65
}