#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 acos(int);
int cos(double);
int sin(double);
double MoonPhase(double AltM, double AziM, double AltS, double AziS) {
  double AltMi = AltM * (3.14159265358979323846 / 180.0);
  double AltSi = AltS * (3.14159265358979323846 / 180.0);
  double AziMi = AziM * (3.14159265358979323846 / 180.0);
  double AziSi = AziS * (3.14159265358979323846 / 180.0);
  double MoonAvgPar = 0.95;
  return 180 -
         acos(cos(AziSi - AziMi -
                  MoonAvgPar * (3.14159265358979323846 / 180.0)) *
                  cos(AltMi + MoonAvgPar * (3.14159265358979323846 / 180.0)) *
                  cos(AltSi) +
              sin(AltSi) *
                  sin(AltMi + MoonAvgPar * (3.14159265358979323846 / 180.0))) /
             (3.14159265358979323846 / 180.0);
}


x86 assembly (clang, -O0):
<MoonPhase>:
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  0xeb4(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xea2(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe90(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe7e(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe74(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe39(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <cos@plt>
mov    %eax,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xe17(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x54(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x4c(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xdcb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sin@plt>
mov    -0x50(%rbp),%edi
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1030 <acos@plt>
movaps %xmm0,%xmm1
movsd  0xda1(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd8d(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MoonPhase>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  0xec2(%rip),%xmm4
mulsd  %xmm4,%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x10(%rsp)
mulsd  %xmm4,%xmm1
mulsd  %xmm4,%xmm3
subsd  %xmm1,%xmm3
addsd  0xea2(%rip),%xmm3
movapd %xmm3,%xmm0
call   1050 <cos@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
addsd  0xe91(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1050 <cos@plt>
mov    %eax,%ebp
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
imul   %eax,%ebp
imul   %ebx,%ebp
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
imul   %eax,%ebx
add    %ebp,%ebx
mov    %ebx,%edi
call   1030 <acos@plt>
divsd  0xe37(%rip),%xmm0
movsd  0xe47(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @MoonPhase(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
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%14 = load double, double* %5
%15 = fmul double %14, 0x3F91DF46A2529D39
store double %15, double* %9
%16 = load double, double* %7
%17 = fmul double %16, 0x3F91DF46A2529D39
store double %17, double* %10
%18 = load double, double* %6
%19 = fmul double %18, 0x3F91DF46A2529D39
store double %19, double* %11
%20 = load double, double* %8
%21 = fmul double %20, 0x3F91DF46A2529D39
store double %21, double* %12
store double 0x3FEE666666666666, double* %13
%22 = load double, double* %12
%23 = load double, double* %11
%24 = fsub double %22, %23
%25 = load double, double* %13
%26 = fneg double %25
%27 = call double @llvm.fmuladd.f64(double %26, double 0x3F91DF46A2529D39, double %24)
%28 = call i32 @cos(double %27)
%29 = load double, double* %9
%30 = load double, double* %13
%31 = call double @llvm.fmuladd.f64(double %30, double 0x3F91DF46A2529D39, double %29)
%32 = call i32 @cos(double %31)
%33 = mul nsw i32 %28, %32
%34 = load double, double* %10
%35 = call i32 @cos(double %34)
%36 = mul nsw i32 %33, %35
%37 = load double, double* %10
%38 = call i32 @sin(double %37)
%39 = load double, double* %9
%40 = load double, double* %13
%41 = call double @llvm.fmuladd.f64(double %40, double 0x3F91DF46A2529D39, double %39)
%42 = call i32 @sin(double %41)
%43 = mul nsw i32 %38, %42
%44 = add nsw i32 %36, %43
%45 = call double @acos(i32 %44)
%46 = fdiv double %45, 0x3F91DF46A2529D39
%47 = fsub double 1.800000e+02, %46
ret double %47
}

LLVM IR (-O2):
define double @MoonPhase(double %0, double %1, double %2, double %3) {
%5 = fmul double %0, 0x3F91DF46A2529D39
%6 = fmul double %2, 0x3F91DF46A2529D39
%7 = fmul double %1, 0x3F91DF46A2529D39
%8 = fmul double %3, 0x3F91DF46A2529D39
%9 = fsub double %8, %7
%10 = fadd double %9, 0xBF90FA831A34E229
%11 = tail call i32 @cos(double %10)
%12 = fadd double %5, 0x3F90FA831A34E229
%13 = tail call i32 @cos(double %12)
%14 = mul nsw i32 %13, %11
%15 = tail call i32 @cos(double %6)
%16 = mul nsw i32 %14, %15
%17 = tail call i32 @sin(double %6)
%18 = tail call i32 @sin(double %12)
%19 = mul nsw i32 %18, %17
%20 = add nsw i32 %19, %16
%21 = tail call double @acos(i32 %20)
%22 = fdiv double %21, 0x3F91DF46A2529D39
%23 = fsub double 1.800000e+02, %22
ret double %23
}