#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 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 *= 0.01745329252;
  latA *= 0.01745329252;
  lonB *= 0.01745329252;
  latB *= 0.01745329252;
  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 * 57.2957795129);
  }
  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) * 57.2957795129;
  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 * 57.2957795129);
}


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)
movsd  0xe85(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe73(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe61(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe4f(%rip),%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    0x2d98(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1280 <GCDistanceAzimuth__+0x130>
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  0xd97(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    145d <GCDistanceAzimuth__+0x30d>
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)
ff
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
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  0xc5d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1060 <isnan@plt>
cmp    $0x0,%rax
je     141e <GCDistanceAzimuth__+0x2ce>
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movaps 0xc57(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc2b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    141e <GCDistanceAzimuth__+0x2ce>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1411 <GCDistanceAzimuth__+0x2c1>
movsd  0xc11(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1419 <GCDistanceAzimuth__+0x2c9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    141e <GCDistanceAzimuth__+0x2ce>
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    143e <GCDistanceAzimuth__+0x2ee>
movsd  0xbec(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xbb5(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCDistanceAzimuth__>:
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%rbx
movsd  0xea0(%rip),%xmm4
mulsd  %xmm4,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm4,%xmm0
movsd  %xmm0,0x38(%rsp)
mulsd  %xmm4,%xmm3
movapd %xmm3,0x50(%rsp)
mulsd  %xmm4,%xmm2
movapd %xmm2,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    0x2de6(%rip),%rax
movsd  (%rax),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm1
ja     138c <GCDistanceAzimuth__+0x23c>
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,0x68(%rsp)
movaps 0x40(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x60(%rsp)
movapd 0x50(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movapd %xmm0,0x50(%rsp)
call   1070 <cos@plt>
movsd  0x60(%rsp),%xmm1
mulsd  0x68(%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>
mulsd  0xd01(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
call   1060 <isnan@plt>
test   %rax,%rax
jne    131f <GCDistanceAzimuth__+0x1cf>
movapd 0x20(%rsp),%xmm3
jmp    1361 <GCDistanceAzimuth__+0x211>
movapd 0x50(%rsp),%xmm1
andpd  0xd03(%rip),%xmm1
movapd 0x40(%rsp),%xmm2
cmpltsd 0x38(%rsp),%xmm2
movsd  0xcce(%rip),%xmm0
cmpltsd 0xccd(%rip),%xmm1
andpd  %xmm2,%xmm0
andpd  %xmm1,%xmm0
andnpd 0x20(%rsp),%xmm1
orpd   %xmm0,%xmm1
movapd %xmm1,%xmm3
movsd  0xcb7(%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)
mulsd  0xc70(%rip),%xmm2
movapd %xmm2,%xmm0
add    $0x70,%rsp
pop    %rbx
ret

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

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