#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 */
int /*<<< orphan*/ cal_mjd(int, int, int, double *);
double floor(double);
int /*<<< orphan*/ m(double, double, double *);
int /*<<< orphan*/ mjd_cal(double, int *, double *, int *);
void moonnf(double mj, double *mjn, double *mjf) {
  int mo, yr;
  double dy;
  double mj0;
  double k, tn, tf, t;
  mjd_cal(mj, &mo, &dy, &yr);
  cal_mjd(1, 0., yr, &mj0);
  k = (yr - 1900 + ((mj - mj0) / 365)) * 12.3685;
  k = floor(k + 0.5);
  tn = k / 1236.85;
  tf = (k + 0.5) / 1236.85;
  t = tn;
  m(t, k, mjn);
  t = tf;
  k += 0.5;
  m(t, k, mjf);
}


x86 assembly (clang, -O0):
<moonnf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x1c(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <mjd_cal@plt>
mov    -0x20(%rbp),%edx
mov    $0x1,%edi
xor    %esi,%esi
lea    -0x30(%rbp),%rcx
call   1050 <cal_mjd@plt>
mov    -0x20(%rbp),%eax
sub    $0x76c,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xe7c(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xe64(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe43(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
call   1060 <floor@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xe2f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe16(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xe11(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    -0x10(%rbp),%rdi
call   1030 <m@plt>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xdd1(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
call   1030 <m@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moonnf>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x10(%rsp)
lea    0x2c(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <mjd_cal@plt>
mov    0xc(%rsp),%edx
lea    0x20(%rsp),%rcx
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <cal_mjd@plt>
mov    $0xfffff894,%eax
add    0xc(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  0x20(%rsp),%xmm1
divsd  0xe60(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe5c(%rip),%xmm1
addsd  0xe5c(%rip),%xmm1
movapd %xmm1,%xmm0
call   1060 <floor@plt>
movapd %xmm0,%xmm1
movsd  0xe4f(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  0xe3b(%rip),%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
divsd  %xmm2,%xmm3
movsd  %xmm3,0x18(%rsp)
mov    %rbx,%rdi
call   1030 <m@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %r14,%rdi
call   1030 <m@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @moonnf(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%15 = load double, double* %4
%16 = call i32 @mjd_cal(double %15, i32* %7, double* %9, i32* %8)
%17 = load i32, i32* %8
%18 = call i32 @cal_mjd(i32 1, i32 0, i32 %17, double* %10)
%19 = load i32, i32* %8
%20 = sub nsw i32 %19, 1900
%21 = sitofp i32 %20 to double
%22 = load double, double* %4
%23 = load double, double* %10
%24 = fsub double %22, %23
%25 = fdiv double %24, 3.650000e+02
%26 = fadd double %21, %25
%27 = fmul double %26, 1.236850e+01
store double %27, double* %11
%28 = load double, double* %11
%29 = fadd double %28, 5.000000e-01
%30 = call double @llvm.floor.f64(double %29)
store double %30, double* %11
%31 = load double, double* %11
%32 = fdiv double %31, 1.236850e+03
store double %32, double* %12
%33 = load double, double* %11
%34 = fadd double %33, 5.000000e-01
%35 = fdiv double %34, 1.236850e+03
store double %35, double* %13
%36 = load double, double* %12
store double %36, double* %14
%37 = load double, double* %14
%38 = load double, double* %11
%39 = load double*, double** %5
%40 = call i32 @m(double %37, double %38, double* %39)
%41 = load double, double* %13
store double %41, double* %14
%42 = load double, double* %11
%43 = fadd double %42, 5.000000e-01
store double %43, double* %11
%44 = load double, double* %14
%45 = load double, double* %11
%46 = load double*, double** %6
%47 = call i32 @m(double %44, double %45, double* %46)
ret void
}

LLVM IR (-O2):
define void @moonnf(double %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast double* %6 to i8*
%11 = bitcast double* %7 to i8*
%12 = call i32 @mjd_cal(double %0, i32* %4, double* %6, i32* %5)
%13 = load i32, i32* %5
%14 = call i32 @cal_mjd(i32 1, i32 0, i32 %13, double* %7)
%15 = load i32, i32* %5
%16 = add nsw i32 %15, -1900
%17 = sitofp i32 %16 to double
%18 = load double, double* %7
%19 = fsub double %0, %18
%20 = fdiv double %19, 3.650000e+02
%21 = fadd double %20, %17
%22 = fmul double %21, 1.236850e+01
%23 = fadd double %22, 5.000000e-01
%24 = call double @llvm.floor.f64(double %23)
%25 = fdiv double %24, 1.236850e+03
%26 = fadd double %24, 5.000000e-01
%27 = fdiv double %26, 1.236850e+03
%28 = call i32 @m(double %25, double %24, double* %1)
%29 = call i32 @m(double %27, double %26, double* %2)
ret void
}