#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 atan2(double, double);
double cos(double const);
double sin(double const);
double GeogAz(const double o1, const double a1, const double o2,
              const double a2) {
  double sin_da, sin_sa, y, x;
  sin_da = sin(a1 - a2);
  sin_sa = sin(a2 + a1);
  y = cos(a2) * sin(o2 - o1);
  x = 0.5 * (sin_sa - sin_da - (sin_sa + sin_da) * cos(o2 - o1));
  return atan2(y, x);
}


x86 assembly (clang, -O0):
<GeogAz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdfc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
call   1030 <atan2@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GeogAz>:
sub    $0x28,%rsp
movsd  %xmm3,(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
subsd  %xmm3,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x20(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm2
movsd  0x18(%rsp),%xmm0
subsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe15(%rip),%xmm1
movsd  (%rsp),%xmm0
add    $0x28,%rsp
jmp    1030 <atan2@plt>

LLVM IR (-O0):
define double @GeogAz(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* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%13 = load double, double* %6
%14 = load double, double* %8
%15 = fsub double %13, %14
%16 = call double @sin(double %15)
store double %16, double* %9
%17 = load double, double* %8
%18 = load double, double* %6
%19 = fadd double %17, %18
%20 = call double @sin(double %19)
store double %20, double* %10
%21 = load double, double* %8
%22 = call double @cos(double %21)
%23 = load double, double* %7
%24 = load double, double* %5
%25 = fsub double %23, %24
%26 = call double @sin(double %25)
%27 = fmul double %22, %26
store double %27, double* %11
%28 = load double, double* %10
%29 = load double, double* %9
%30 = fsub double %28, %29
%31 = load double, double* %10
%32 = load double, double* %9
%33 = fadd double %31, %32
%34 = load double, double* %7
%35 = load double, double* %5
%36 = fsub double %34, %35
%37 = call double @cos(double %36)
%38 = fneg double %33
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %30)
%40 = fmul double 5.000000e-01, %39
store double %40, double* %12
%41 = load double, double* %11
%42 = load double, double* %12
%43 = call double @atan2(double %41, double %42)
ret double %43
}

LLVM IR (-O2):
define double @GeogAz(double %0, double %1, double %2, double %3) {
%5 = fsub double %1, %3
%6 = tail call double @sin(double %5)
%7 = fadd double %1, %3
%8 = tail call double @sin(double %7)
%9 = tail call double @cos(double %3)
%10 = fsub double %2, %0
%11 = tail call double @sin(double %10)
%12 = fmul double %9, %11
%13 = fsub double %8, %6
%14 = fadd double %6, %8
%15 = tail call double @cos(double %10)
%16 = fneg double %14
%17 = tail call double @llvm.fmuladd.f64(double %16, double %15, double %13)
%18 = fmul double %17, 5.000000e-01
%19 = tail call double @atan2(double %12, double %18)
ret double %19
}