#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 DegToRad(double);
double RadToDeg(int);
int /*<<< orphan*/ asin(int /*<<< orphan*/);
double cos(double);
int fabs(int /*<<< orphan*/);
double sin(double);
int /*<<< orphan*/ sqrt(double);
double angularDistance(double fromRA, double fromDEC, double toRA,
                       double toDEC) {
  double dalpha = DegToRad(fromRA) - DegToRad(toRA);
  double ddelta = DegToRad(fromDEC) - DegToRad(toDEC);
  double sa = sin(dalpha / 2.);
  double sd = sin(ddelta / 2.);
  double hava = sa * sa;
  double havd = sd * sd;
  double aux = havd + cos(DegToRad(fromDEC)) * cos(DegToRad(toDEC)) * hava;
  return (RadToDeg(2 * fabs(asin(sqrt(aux)))));
}


x86 assembly (clang, -O0):
<angularDistance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <DegToRad@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <DegToRad@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <DegToRad@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <DegToRad@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe10(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <DegToRad@plt>
call   1080 <cos@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <DegToRad@plt>
call   1080 <cos@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1090 <sqrt@plt>
mov    %eax,%edi
call   1070 <asin@plt>
mov    %eax,%edi
call   1050 <fabs@plt>
mov    %eax,%edi
shl    $0x1,%edi
call   1030 <RadToDeg@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<angularDistance>:
sub    $0x28,%rsp
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1040 <DegToRad@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <DegToRad@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <DegToRad@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <DegToRad@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe1a(%rip),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe01(%rip),%xmm0
call   1060 <sin@plt>
movapd %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <DegToRad@plt>
call   1080 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <DegToRad@plt>
call   1080 <cos@plt>
mulsd  0x18(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
call   1090 <sqrt@plt>
mov    %eax,%edi
call   1070 <asin@plt>
mov    %eax,%edi
call   1050 <fabs@plt>
lea    (%rax,%rax,1),%edi
add    $0x28,%rsp
jmp    1030 <RadToDeg@plt>

LLVM IR (-O0):
define double @angularDistance(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 double
%14 = alloca double
%15 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%16 = load double, double* %5
%17 = call double @DegToRad(double %16)
%18 = load double, double* %7
%19 = call double @DegToRad(double %18)
%20 = fsub double %17, %19
store double %20, double* %9
%21 = load double, double* %6
%22 = call double @DegToRad(double %21)
%23 = load double, double* %8
%24 = call double @DegToRad(double %23)
%25 = fsub double %22, %24
store double %25, double* %10
%26 = load double, double* %9
%27 = fdiv double %26, 2.000000e+00
%28 = call double @sin(double %27)
store double %28, double* %11
%29 = load double, double* %10
%30 = fdiv double %29, 2.000000e+00
%31 = call double @sin(double %30)
store double %31, double* %12
%32 = load double, double* %11
%33 = load double, double* %11
%34 = fmul double %32, %33
store double %34, double* %13
%35 = load double, double* %12
%36 = load double, double* %12
%37 = fmul double %35, %36
store double %37, double* %14
%38 = load double, double* %14
%39 = load double, double* %6
%40 = call double @DegToRad(double %39)
%41 = call double @cos(double %40)
%42 = load double, double* %8
%43 = call double @DegToRad(double %42)
%44 = call double @cos(double %43)
%45 = fmul double %41, %44
%46 = load double, double* %13
%47 = call double @llvm.fmuladd.f64(double %45, double %46, double %38)
store double %47, double* %15
%48 = load double, double* %15
%49 = call i32 @sqrt(double %48)
%50 = call i32 @asin(i32 %49)
%51 = call i32 @fabs(i32 %50)
%52 = mul nsw i32 2, %51
%53 = call double @RadToDeg(i32 %52)
ret double %53
}

LLVM IR (-O2):
define double @angularDistance(double %0, double %1, double %2, double %3) {
%5 = tail call double @DegToRad(double %0)
%6 = tail call double @DegToRad(double %2)
%7 = fsub double %5, %6
%8 = tail call double @DegToRad(double %1)
%9 = tail call double @DegToRad(double %3)
%10 = fsub double %8, %9
%11 = fmul double %7, 5.000000e-01
%12 = tail call double @sin(double %11)
%13 = fmul double %10, 5.000000e-01
%14 = tail call double @sin(double %13)
%15 = fmul double %12, %12
%16 = fmul double %14, %14
%17 = tail call double @DegToRad(double %1)
%18 = tail call double @cos(double %17)
%19 = tail call double @DegToRad(double %3)
%20 = tail call double @cos(double %19)
%21 = fmul double %18, %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double %15, double %16)
%23 = tail call i32 @sqrt(double %22)
%24 = tail call i32 @asin(i32 %23)
%25 = tail call i32 @fabs(i32 %24)
%26 = shl nsw i32 %25, 1
%27 = tail call double @RadToDeg(i32 %26)
ret double %27
}