#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 floor(int);
double date2MJD(int yr, int mo, int day, int hr, int min, double sec) {
  double part1, part2;
  double JD, MJD;
  part1 = 367 * ((double)yr) -
          floor(7 * ((double)yr + floor(((double)mo + 9) / 12.0)) / 4.0) +
          floor(275 * (double)mo / 9.0) + (double)day;
  part2 = 1721013.5 + ((sec / 60.0 + (double)min) / 60.0 + (double)hr) / 24.0;
  JD = part1 + part2;
  MJD = JD - 2400000.5;
  return MJD;
}


x86 assembly (clang, -O0):
<date2MJD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xeee(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
movsd  -0x58(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm1
movsd  0xec4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeb0(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe73(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe51(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe3d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
movsd  -0x48(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xe00(%rip),%xmm0
divsd  %xmm0,%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xdeb(%rip),%xmm0
divsd  %xmm0,%xmm1
cvtsi2sdl -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xdce(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdba(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xd8d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date2MJD>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x18(%rsp)
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
movsd  %xmm0,0x10(%rsp)
addsd  0xeb8(%rip),%xmm0
divsd  0xeb8(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  0xea2(%rip),%xmm0
mulsd  0xea2(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xe8c(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  0xe86(%rip),%xmm2
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
divsd  0xe4c(%rip),%xmm2
cvttsd2si %xmm2,%edi
call   1030 <floor@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0xe5e(%rip),%xmm0
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
movsd  0x18(%rsp),%xmm3
divsd  %xmm0,%xmm3
addsd  %xmm3,%xmm2
xorps  %xmm3,%xmm3
cvtsi2sd %ebp,%xmm3
divsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
addsd  %xmm2,%xmm0
divsd  0xe32(%rip),%xmm0
addsd  0xe32(%rip),%xmm0
addsd  %xmm1,%xmm3
addsd  %xmm3,%xmm0
addsd  0xe2a(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @date2MJD(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store double %5, double* %12
%17 = load i32, i32* %7
%18 = sitofp i32 %17 to double
%19 = load i32, i32* %7
%20 = sitofp i32 %19 to double
%21 = load i32, i32* %8
%22 = sitofp i32 %21 to double
%23 = fadd double %22, 9.000000e+00
%24 = fdiv double %23, 1.200000e+01
%25 = fptosi double %24 to i32
%26 = call i32 @floor(i32 %25)
%27 = sitofp i32 %26 to double
%28 = fadd double %20, %27
%29 = fmul double 7.000000e+00, %28
%30 = fdiv double %29, 4.000000e+00
%31 = fptosi double %30 to i32
%32 = call i32 @floor(i32 %31)
%33 = sitofp i32 %32 to double
%34 = fneg double %33
%35 = call double @llvm.fmuladd.f64(double 3.670000e+02, double %18, double %34)
%36 = load i32, i32* %8
%37 = sitofp i32 %36 to double
%38 = fmul double 2.750000e+02, %37
%39 = fdiv double %38, 9.000000e+00
%40 = fptosi double %39 to i32
%41 = call i32 @floor(i32 %40)
%42 = sitofp i32 %41 to double
%43 = fadd double %35, %42
%44 = load i32, i32* %9
%45 = sitofp i32 %44 to double
%46 = fadd double %43, %45
store double %46, double* %13
%47 = load double, double* %12
%48 = fdiv double %47, 6.000000e+01
%49 = load i32, i32* %11
%50 = sitofp i32 %49 to double
%51 = fadd double %48, %50
%52 = fdiv double %51, 6.000000e+01
%53 = load i32, i32* %10
%54 = sitofp i32 %53 to double
%55 = fadd double %52, %54
%56 = fdiv double %55, 2.400000e+01
%57 = fadd double 0x413A42B580000000, %56
store double %57, double* %14
%58 = load double, double* %13
%59 = load double, double* %14
%60 = fadd double %58, %59
store double %60, double* %15
%61 = load double, double* %15
%62 = fsub double %61, 0x41424F8040000000
store double %62, double* %16
%63 = load double, double* %16
ret double %63
}

LLVM IR (-O2):
define double @date2MJD(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5) {
%7 = sitofp i32 %0 to double
%8 = sitofp i32 %1 to double
%9 = fadd double %8, 9.000000e+00
%10 = fdiv double %9, 1.200000e+01
%11 = fptosi double %10 to i32
%12 = tail call i32 @floor(i32 %11)
%13 = sitofp i32 %12 to double
%14 = fadd double %7, %13
%15 = fmul double %14, 7.000000e+00
%16 = fmul double %15, 2.500000e-01
%17 = fptosi double %16 to i32
%18 = tail call i32 @floor(i32 %17)
%19 = sitofp i32 %18 to double
%20 = fneg double %19
%21 = tail call double @llvm.fmuladd.f64(double %7, double 3.670000e+02, double %20)
%22 = fmul double %8, 2.750000e+02
%23 = fdiv double %22, 9.000000e+00
%24 = fptosi double %23 to i32
%25 = tail call i32 @floor(i32 %24)
%26 = sitofp i32 %25 to double
%27 = fadd double %21, %26
%28 = sitofp i32 %2 to double
%29 = fadd double %27, %28
%30 = fdiv double %5, 6.000000e+01
%31 = sitofp i32 %4 to double
%32 = fadd double %30, %31
%33 = fdiv double %32, 6.000000e+01
%34 = sitofp i32 %3 to double
%35 = fadd double %33, %34
%36 = fdiv double %35, 2.400000e+01
%37 = fadd double %36, 0x413A42B580000000
%38 = fadd double %37, %29
%39 = fadd double %38, 0xC1424F8040000000
ret double %39
}