#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 FLT_MIN;
double M_PI;
double acos(double);
double atan2(double, double);
double cos(double);
double fabs(double);
scalar_t__ isnan(double);
double sin(double);
double GCDistanceAzimuth__(double latA, double lonA, double latB, double lonB,
                           double *pazimuth) {
  lonA *= (M_PI / 180.0);
  latA *= (M_PI / 180.0);
  lonB *= (M_PI / 180.0);
  latB *= (M_PI / 180.0);
  double dist =
      sin(latA) * sin(latB) + cos(latA) * cos(latB) * cos(lonA - lonB);
  dist = acos(dist);
  if (dist < FLT_MIN) {
    *pazimuth = 0.0;
    return (dist * (180.0 / M_PI));
  }
  double cosAzimuth =
      (cos(latA) * sin(latB) - sin(latA) * cos(latB) * cos((lonB - lonA))) /
      sin(dist);
  double sinAzimuth = cos(latB) * sin((lonB - lonA)) / sin(dist);
  double az = atan2(sinAzimuth, cosAzimuth) * (180.0 / M_PI);
  if (isnan(az) && fabs(lonB - lonA) < 0.000001) {
    if (latA > latB) {
      az = 180.0;
    } else {
      az = 0.0;
    }
  }
  if (az < 0.0) {
    az += 360.0;
  }
  *pazimuth = az;
  return (dist * (180.0 / M_PI));
}


x86 assembly (clang, -O0):
<GCDistanceAzimuth__>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    0x2e6e(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe7a(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e4d(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe59(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e2c(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe38(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e0b(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe17(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
call   1070 <cos@plt>
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    0x2d54(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    12cb <GCDistanceAzimuth__+0x17b>
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  0xd4e(%rip),%xmm1
mov    0x2d2f(%rip),%rax
divsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14c2 <GCDistanceAzimuth__+0x372>
movsd  -0x10(%rbp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0xa8(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1070 <cos@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x98(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  0xc0a(%rip),%xmm1
mov    0x2beb(%rip),%rax
divsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1060 <isnan@plt>
cmp    $0x0,%rax
je     1474 <GCDistanceAzimuth__+0x324>
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movaps 0xbf1(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xbcd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1474 <GCDistanceAzimuth__+0x324>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1467 <GCDistanceAzimuth__+0x317>
movsd  0xba3(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    146f <GCDistanceAzimuth__+0x31f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1474 <GCDistanceAzimuth__+0x324>
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1494 <GCDistanceAzimuth__+0x344>
movsd  0xb86(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  0xb52(%rip),%xmm1
mov    0x2b33(%rip),%rax
divsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCDistanceAzimuth__>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rdi,%rbx
mov    0x2e87(%rip),%r14
movsd  (%r14),%xmm4
divsd  0xe92(%rip),%xmm4
mulsd  %xmm4,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm4,%xmm0
movsd  %xmm0,0x38(%rsp)
mulsd  %xmm4,%xmm3
movapd %xmm3,0x50(%rsp)
mulsd  %xmm2,%xmm4
movapd %xmm4,0x40(%rsp)
call   1050 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movaps 0x40(%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x38(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x40(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x50(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  %xmm1,%xmm0
call   1040 <acos@plt>
movapd %xmm0,%xmm2
mov    0x2dd0(%rip),%rax
movsd  (%rax),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm1
ja     13a7 <GCDistanceAzimuth__+0x257>
movsd  0x38(%rsp),%xmm0
movsd  %xmm2,0x18(%rsp)
call   1070 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movaps 0x40(%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x38(%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x70(%rsp)
movaps 0x40(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x68(%rsp)
movapd 0x50(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movapd %xmm0,0x50(%rsp)
call   1070 <cos@plt>
movsd  0x68(%rsp),%xmm1
mulsd  0x70(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <sin@plt>
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movaps 0x40(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x50(%rsp),%xmm0
call   1050 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <sin@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x20(%rsp),%xmm1
call   1030 <atan2@plt>
movsd  0xceb(%rip),%xmm1
divsd  (%r14),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm1,%xmm0
call   1060 <isnan@plt>
test   %rax,%rax
jne    133a <GCDistanceAzimuth__+0x1ea>
movapd 0x20(%rsp),%xmm3
jmp    137c <GCDistanceAzimuth__+0x22c>
movapd 0x50(%rsp),%xmm0
andpd  0xcd8(%rip),%xmm0
movapd 0x40(%rsp),%xmm1
cmpltsd 0x38(%rsp),%xmm1
cmpltsd 0xcaa(%rip),%xmm0
movsd  0xc9a(%rip),%xmm2
andpd  %xmm2,%xmm1
andpd  %xmm0,%xmm1
andnpd 0x20(%rsp),%xmm0
orpd   %xmm1,%xmm0
movapd %xmm0,%xmm3
movsd  0xc8c(%rip),%xmm1
addsd  %xmm3,%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm3,%xmm0
cmpltsd %xmm2,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm3,%xmm0
orpd   %xmm1,%xmm0
movsd  0x18(%rsp),%xmm2
movsd  %xmm0,(%rbx)
movsd  0xc4d(%rip),%xmm0
divsd  (%r14),%xmm0
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
@FLT_MIN = global double 0.000000e+00
define double @GCDistanceAzimuth__(double %0, double %1, double %2, double %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
%16 = load double, double* @M_PI
%17 = fdiv double %16, 1.800000e+02
%18 = load double, double* %8
%19 = fmul double %18, %17
store double %19, double* %8
%20 = load double, double* @M_PI
%21 = fdiv double %20, 1.800000e+02
%22 = load double, double* %7
%23 = fmul double %22, %21
store double %23, double* %7
%24 = load double, double* @M_PI
%25 = fdiv double %24, 1.800000e+02
%26 = load double, double* %10
%27 = fmul double %26, %25
store double %27, double* %10
%28 = load double, double* @M_PI
%29 = fdiv double %28, 1.800000e+02
%30 = load double, double* %9
%31 = fmul double %30, %29
store double %31, double* %9
%32 = load double, double* %7
%33 = call double @sin(double %32)
%34 = load double, double* %9
%35 = call double @sin(double %34)
%36 = load double, double* %7
%37 = call double @cos(double %36)
%38 = load double, double* %9
%39 = call double @cos(double %38)
%40 = fmul double %37, %39
%41 = load double, double* %8
%42 = load double, double* %10
%43 = fsub double %41, %42
%44 = call double @cos(double %43)
%45 = fmul double %40, %44
%46 = call double @llvm.fmuladd.f64(double %33, double %35, double %45)
store double %46, double* %12
%47 = load double, double* %12
%48 = call double @acos(double %47)
store double %48, double* %12
%49 = load double, double* %12
%50 = load double, double* @FLT_MIN
%51 = fcmp olt double %49, %50
br i1 %51, label %52, label %58
52: ; preds = %5
%53 = load double*, double** %11
store double 0.000000e+00, double* %53
%54 = load double, double* %12
%55 = load double, double* @M_PI
%56 = fdiv double 1.800000e+02, %55
%57 = fmul double %54, %56
store double %57, double* %6
br label %123
58: ; preds = %5
%59 = load double, double* %7
%60 = call double @cos(double %59)
%61 = load double, double* %9
%62 = call double @sin(double %61)
%63 = load double, double* %7
%64 = call double @sin(double %63)
%65 = load double, double* %9
%66 = call double @cos(double %65)
%67 = fmul double %64, %66
%68 = load double, double* %10
%69 = load double, double* %8
%70 = fsub double %68, %69
%71 = call double @cos(double %70)
%72 = fmul double %67, %71
%73 = fneg double %72
%74 = call double @llvm.fmuladd.f64(double %60, double %62, double %73)
%75 = load double, double* %12
%76 = call double @sin(double %75)
%77 = fdiv double %74, %76
store double %77, double* %13
%78 = load double, double* %9
%79 = call double @cos(double %78)
%80 = load double, double* %10
%81 = load double, double* %8
%82 = fsub double %80, %81
%83 = call double @sin(double %82)
%84 = fmul double %79, %83
%85 = load double, double* %12
%86 = call double @sin(double %85)
%87 = fdiv double %84, %86
store double %87, double* %14
%88 = load double, double* %14
%89 = load double, double* %13
%90 = call double @atan2(double %88, double %89)
%91 = load double, double* @M_PI
%92 = fdiv double 1.800000e+02, %91
%93 = fmul double %90, %92
store double %93, double* %15
%94 = load double, double* %15
%95 = call i64 @isnan(double %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %110
97: ; preds = %58
%98 = load double, double* %10
%99 = load double, double* %8
%100 = fsub double %98, %99
%101 = call double @llvm.fabs.f64(double %100)
%102 = fcmp olt double %101, 0x3EB0C6F7A0B5ED8D
br i1 %102, label %103, label %110
103: ; preds = %97
%104 = load double, double* %7
%105 = load double, double* %9
%106 = fcmp ogt double %104, %105
br i1 %106, label %107, label %108
107: ; preds = %103
store double 1.800000e+02, double* %15
br label %109
108: ; preds = %103
store double 0.000000e+00, double* %15
br label %109
109: ; preds = %108, %107
br label %110
110: ; preds = %109, %97, %58
%111 = load double, double* %15
%112 = fcmp olt double %111, 0.000000e+00
br i1 %112, label %113, label %116
113: ; preds = %110
%114 = load double, double* %15
%115 = fadd double %114, 3.600000e+02
store double %115, double* %15
br label %116
116: ; preds = %113, %110
%117 = load double, double* %15
%118 = load double*, double** %11
store double %117, double* %118
%119 = load double, double* %12
%120 = load double, double* @M_PI
%121 = fdiv double 1.800000e+02, %120
%122 = fmul double %119, %121
store double %122, double* %6
br label %123
123: ; preds = %116, %52
%124 = load double, double* %6
ret double %124
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@FLT_MIN = global double 0.000000e+00
define double @GCDistanceAzimuth__(double %0, double %1, double %2, double %3, double* nocapture writeonly %4) {
%6 = load double, double* @M_PI
%7 = fdiv double %6, 1.800000e+02
%8 = fmul double %7, %1
%9 = fmul double %7, %0
%10 = fmul double %7, %3
%11 = fmul double %7, %2
%12 = tail call double @sin(double %9)
%13 = tail call double @sin(double %11)
%14 = tail call double @cos(double %9)
%15 = tail call double @cos(double %11)
%16 = fmul double %14, %15
%17 = fsub double %8, %10
%18 = tail call double @cos(double %17)
%19 = fmul double %16, %18
%20 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %19)
%21 = tail call double @acos(double %20)
%22 = load double, double* @FLT_MIN
%23 = fcmp olt double %21, %22
br i1 %23, label %57, label %24
24: ; preds = %5
%25 = tail call double @cos(double %9)
%26 = tail call double @sin(double %11)
%27 = tail call double @sin(double %9)
%28 = tail call double @cos(double %11)
%29 = fsub double %10, %8
%30 = tail call double @cos(double %29)
%31 = fneg double %27
%32 = fmul double %28, %31
%33 = fmul double %32, %30
%34 = tail call double @llvm.fmuladd.f64(double %25, double %26, double %33)
%35 = tail call double @sin(double %21)
%36 = fdiv double %34, %35
%37 = tail call double @cos(double %11)
%38 = tail call double @sin(double %29)
%39 = fmul double %37, %38
%40 = tail call double @sin(double %21)
%41 = fdiv double %39, %40
%42 = tail call double @atan2(double %41, double %36)
%43 = load double, double* @M_PI
%44 = fdiv double 1.800000e+02, %43
%45 = fmul double %42, %44
%46 = tail call i64 @isnan(double %45)
%47 = icmp ne i64 %46, 0
%48 = tail call double @llvm.fabs.f64(double %29)
%49 = fcmp olt double %48, 0x3EB0C6F7A0B5ED8D
%50 = select i1 %47, i1 %49, i1 false
%51 = fcmp ogt double %9, %11
%52 = select i1 %51, double 1.800000e+02, double 0.000000e+00
%53 = select i1 %50, double %52, double %45
%54 = fcmp olt double %53, 0.000000e+00
%55 = fadd double %53, 3.600000e+02
%56 = select i1 %54, double %55, double %53
br label %57
57: ; preds = %5, %24
%58 = phi double [ %56, %24 ], [ 0.000000e+00, %5 ]
store double %58, double* %4
%59 = load double, double* @M_PI
%60 = fdiv double 1.800000e+02, %59
%61 = fmul double %21, %60
ret double %61
}