#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 sin(int);
double MoonPosition(double j, double ls) {
  double ms, l, mm, n, ev, sms, ae, ec;
  int i;
  ms = 0.985647332099 * j - 3.762863;
  if (ms < 0) {
    ms = ms + 360.0;
  }
  l = 13.176396 * j + 64.975464;
  i = (int)(l / 360.0);
  l = l - i * 360.0;
  if (l < 0) {
    l = l + 360.0;
  }
  mm = l - 0.1114041 * j - 349.383063;
  i = (int)(mm / 360.0);
  mm = mm - i * 360.0;
  n = 151.950429 - 0.0529539 * j;
  i = (int)(n / 360.0);
  n = n - i * 360.0;
  ev = 1.2739 *
       sin((2 * (l - ls) - mm) * (3.1415926535897932384626433832795 / 180.0));
  sms = sin(ms * (3.1415926535897932384626433832795 / 180.0));
  ae = 0.1858 * sms;
  mm = mm + ev - ae - 0.37 * sms;
  ec = 6.2886 * sin(mm * (3.1415926535897932384626433832795 / 180.0));
  l = l + ev + ec - ae +
      0.214 * sin(2 * mm * (3.1415926535897932384626433832795 / 180.0));
  l = 0.6583 * sin(2 * (l - ls) * (3.1415926535897932384626433832795 / 180.0)) +
      l;
  return l;
}


x86 assembly (clang, -O0):
<MoonPosition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecd(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1164 <MoonPosition+0x54>
movsd  0xeb6(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xea7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x54(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe49(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11f4 <MoonPosition+0xe4>
movsd  0xe26(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xe7a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xde4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
movsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x54(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdb0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xdee(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdea(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xd74(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
movsd  -0x30(%rbp),%xmm1
cvtsi2sdl -0x54(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd40(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd1d(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xd35(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xcf4(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  0xd01(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
subsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  0xcd3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xc9e(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xc9d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xc63(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xc4e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  -0x60(%rbp),%xmm1
movsd  0xc44(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xc1d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xc09(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  -0x20(%rbp),%xmm1
movsd  0xbe7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MoonPosition>:
sub    $0x48,%rsp
movsd  %xmm1,0x28(%rsp)
movsd  0xede(%rip),%xmm5
mulsd  %xmm0,%xmm5
addsd  0xeda(%rip),%xmm5
movsd  0xeda(%rip),%xmm6
xorpd  %xmm2,%xmm2
movapd %xmm5,%xmm7
movsd  0xed2(%rip),%xmm3
mulsd  %xmm0,%xmm3
addsd  0xece(%rip),%xmm3
cmpltsd %xmm2,%xmm7
movapd %xmm3,%xmm4
divsd  %xmm6,%xmm4
cvttpd2dq %xmm4,%xmm4
cvtdq2pd %xmm4,%xmm4
mulsd  %xmm6,%xmm4
subsd  %xmm4,%xmm3
movapd %xmm3,%xmm4
cmpltsd %xmm2,%xmm4
movapd %xmm3,%xmm2
addsd  %xmm6,%xmm2
andpd  %xmm4,%xmm2
andnpd %xmm3,%xmm4
movapd %xmm5,%xmm3
addsd  %xmm6,%xmm3
andpd  %xmm7,%xmm3
mulsd  0xe8c(%rip),%xmm0
orpd   %xmm2,%xmm4
addsd  %xmm4,%xmm0
movapd %xmm4,0x30(%rsp)
addsd  0xe7e(%rip),%xmm0
andnpd %xmm5,%xmm7
movapd %xmm0,%xmm2
divsd  %xmm6,%xmm2
cvttpd2dq %xmm2,%xmm2
orpd   %xmm3,%xmm7
movapd %xmm7,0x10(%rsp)
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm6,%xmm2
movapd %xmm0,%xmm3
subsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
movapd %xmm4,%xmm0
subsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
subsd  %xmm3,%xmm0
mulsd  0xe3e(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mulsd  0xe35(%rip),%xmm0
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
mulsd  0xe1a(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movapd %xmm0,%xmm1
movsd  0xe15(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
subsd  %xmm2,%xmm0
mulsd  0xdfc(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  0xdd2(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
mulsd  0xde1(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  0x30(%rsp),%xmm1
addsd  %xmm1,%xmm0
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
mulsd  0xd95(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mulsd  0xdac(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm0,%xmm1
subsd  0x28(%rsp),%xmm1
addsd  %xmm1,%xmm1
mulsd  0xd64(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
mulsd  0xd83(%rip),%xmm0
addsd  (%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @MoonPosition(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%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 i32
store double %0, double* %3
store double %1, double* %4
%14 = load double, double* %3
%15 = call double @llvm.fmuladd.f64(double 0x3FEF8A6C461827C8, double %14, double 0xC00E1A57EAA2A0A9)
store double %15, double* %5
%16 = load double, double* %5
%17 = fcmp olt double %16, 0.000000e+00
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load double, double* %5
%20 = fadd double %19, 3.600000e+02
store double %20, double* %5
br label %21
21: ; preds = %18, %2
%22 = load double, double* %3
%23 = call double @llvm.fmuladd.f64(double 0x402A5A5093964A5A, double %22, double 0x40503E6E008E9B39)
store double %23, double* %6
%24 = load double, double* %6
%25 = fdiv double %24, 3.600000e+02
%26 = fptosi double %25 to i32
store i32 %26, i32* %13
%27 = load double, double* %6
%28 = load i32, i32* %13
%29 = sitofp i32 %28 to double
%30 = fneg double %29
%31 = call double @llvm.fmuladd.f64(double %30, double 3.600000e+02, double %27)
store double %31, double* %6
%32 = load double, double* %6
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %37
34: ; preds = %21
%35 = load double, double* %6
%36 = fadd double %35, 3.600000e+02
store double %36, double* %6
br label %37
37: ; preds = %34, %21
%38 = load double, double* %6
%39 = load double, double* %3
%40 = call double @llvm.fmuladd.f64(double 0xBFBC84FAA623EB98, double %39, double %38)
%41 = fsub double %40, 0x4075D62106AB14EC
store double %41, double* %7
%42 = load double, double* %7
%43 = fdiv double %42, 3.600000e+02
%44 = fptosi double %43 to i32
store i32 %44, i32* %13
%45 = load double, double* %7
%46 = load i32, i32* %13
%47 = sitofp i32 %46 to double
%48 = fneg double %47
%49 = call double @llvm.fmuladd.f64(double %48, double 3.600000e+02, double %45)
store double %49, double* %7
%50 = load double, double* %3
%51 = call double @llvm.fmuladd.f64(double -5.295390e-02, double %50, double 0x4062FE69EA140571)
store double %51, double* %8
%52 = load double, double* %8
%53 = fdiv double %52, 3.600000e+02
%54 = fptosi double %53 to i32
store i32 %54, i32* %13
%55 = load double, double* %8
%56 = load i32, i32* %13
%57 = sitofp i32 %56 to double
%58 = fneg double %57
%59 = call double @llvm.fmuladd.f64(double %58, double 3.600000e+02, double %55)
store double %59, double* %8
%60 = load double, double* %6
%61 = load double, double* %4
%62 = fsub double %60, %61
%63 = load double, double* %7
%64 = fneg double %63
%65 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %62, double %64)
%66 = fmul double %65, 0x3F91DF46A2529D39
%67 = fptosi double %66 to i32
%68 = call double @sin(i32 %67)
%69 = fmul double 1.273900e+00, %68
store double %69, double* %9
%70 = load double, double* %5
%71 = fmul double %70, 0x3F91DF46A2529D39
%72 = fptosi double %71 to i32
%73 = call double @sin(i32 %72)
store double %73, double* %10
%74 = load double, double* %10
%75 = fmul double 1.858000e-01, %74
store double %75, double* %11
%76 = load double, double* %7
%77 = load double, double* %9
%78 = fadd double %76, %77
%79 = load double, double* %11
%80 = fsub double %78, %79
%81 = load double, double* %10
%82 = call double @llvm.fmuladd.f64(double -3.700000e-01, double %81, double %80)
store double %82, double* %7
%83 = load double, double* %7
%84 = fmul double %83, 0x3F91DF46A2529D39
%85 = fptosi double %84 to i32
%86 = call double @sin(i32 %85)
%87 = fmul double 6.288600e+00, %86
store double %87, double* %12
%88 = load double, double* %6
%89 = load double, double* %9
%90 = fadd double %88, %89
%91 = load double, double* %12
%92 = fadd double %90, %91
%93 = load double, double* %11
%94 = fsub double %92, %93
%95 = load double, double* %7
%96 = fmul double 2.000000e+00, %95
%97 = fmul double %96, 0x3F91DF46A2529D39
%98 = fptosi double %97 to i32
%99 = call double @sin(i32 %98)
%100 = call double @llvm.fmuladd.f64(double 2.140000e-01, double %99, double %94)
store double %100, double* %6
%101 = load double, double* %6
%102 = load double, double* %4
%103 = fsub double %101, %102
%104 = fmul double 2.000000e+00, %103
%105 = fmul double %104, 0x3F91DF46A2529D39
%106 = fptosi double %105 to i32
%107 = call double @sin(i32 %106)
%108 = load double, double* %6
%109 = call double @llvm.fmuladd.f64(double 6.583000e-01, double %107, double %108)
store double %109, double* %6
%110 = load double, double* %6
ret double %110
}

LLVM IR (-O2):
define double @MoonPosition(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %0, double 0x3FEF8A6C461827C8, double 0xC00E1A57EAA2A0A9)
%4 = fcmp olt double %3, 0.000000e+00
%5 = fadd double %3, 3.600000e+02
%6 = select i1 %4, double %5, double %3
%7 = tail call double @llvm.fmuladd.f64(double %0, double 0x402A5A5093964A5A, double 0x40503E6E008E9B39)
%8 = fdiv double %7, 3.600000e+02
%9 = fptosi double %8 to i32
%10 = sitofp i32 %9 to double
%11 = fneg double %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double 3.600000e+02, double %7)
%13 = fcmp olt double %12, 0.000000e+00
%14 = fadd double %12, 3.600000e+02
%15 = select i1 %13, double %14, double %12
%16 = tail call double @llvm.fmuladd.f64(double %0, double 0xBFBC84FAA623EB98, double %15)
%17 = fadd double %16, 0xC075D62106AB14EC
%18 = fdiv double %17, 3.600000e+02
%19 = fptosi double %18 to i32
%20 = sitofp i32 %19 to double
%21 = fneg double %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double 3.600000e+02, double %17)
%23 = fsub double %15, %1
%24 = fneg double %22
%25 = tail call double @llvm.fmuladd.f64(double %23, double 2.000000e+00, double %24)
%26 = fmul double %25, 0x3F91DF46A2529D39
%27 = fptosi double %26 to i32
%28 = tail call double @sin(i32 %27)
%29 = fmul double %28, 1.273900e+00
%30 = fmul double %6, 0x3F91DF46A2529D39
%31 = fptosi double %30 to i32
%32 = tail call double @sin(i32 %31)
%33 = fmul double %32, 1.858000e-01
%34 = fadd double %22, %29
%35 = fsub double %34, %33
%36 = tail call double @llvm.fmuladd.f64(double %32, double -3.700000e-01, double %35)
%37 = fmul double %36, 0x3F91DF46A2529D39
%38 = fptosi double %37 to i32
%39 = tail call double @sin(i32 %38)
%40 = fmul double %39, 6.288600e+00
%41 = fadd double %15, %29
%42 = fadd double %41, %40
%43 = fsub double %42, %33
%44 = fmul double %36, 2.000000e+00
%45 = fmul double %44, 0x3F91DF46A2529D39
%46 = fptosi double %45 to i32
%47 = tail call double @sin(i32 %46)
%48 = tail call double @llvm.fmuladd.f64(double %47, double 2.140000e-01, double %43)
%49 = fsub double %48, %1
%50 = fmul double %49, 2.000000e+00
%51 = fmul double %50, 0x3F91DF46A2529D39
%52 = fptosi double %51 to i32
%53 = tail call double @sin(i32 %52)
%54 = tail call double @llvm.fmuladd.f64(double %53, double 6.583000e-01, double %48)
ret double %54
}