#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 TimeYMDHMSToYrsec(int, int, int, int, int, double);
double TimeYMDHMSToJulian(int yr, int mo, int dy, int hr, int mt, double sc) {
  int A, B, i;
  double jdoy;
  double dfrac;
  yr = yr - 1;
  i = yr / 100;
  A = i;
  i = A / 4;
  B = 2 - A + i;
  i = 365.25 * yr;
  i += 30.6001 * 14;
  jdoy = i + 1720994.5 + B;
  dfrac = 1 + TimeYMDHMSToYrsec(yr + 1, mo, dy, hr, mt, sc) / 86400;
  return jdoy + dfrac;
}


x86 assembly (clang, -O0):
<TimeYMDHMSToJulian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
mov    $0x2,%eax
sub    -0x24(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe9d(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  -0x20(%rbp),%xmm0
call   1030 <TimeYMDHMSToYrsec@plt>
mov    $0x15180,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimeYMDHMSToJulian>:
push   %rax
lea    -0x1(%rdi),%eax
movslq %eax,%r9
imul   $0xffffffffae147ae1,%r9,%r11
mov    %r11,%r10
shr    $0x3f,%r10
shr    $0x20,%r11
sar    $0x5,%r11d
add    %r10d,%r11d
imul   $0x51eb851f,%r9,%rax
mov    %rax,%r10
shr    $0x3f,%r10
shr    $0x20,%rax
sar    $0x7,%eax
add    %r10d,%eax
cvtsi2sd %r9d,%xmm1
mulsd  0xeab(%rip),%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
addsd  0xea3(%rip),%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
addsd  0xe9b(%rip),%xmm1
lea    0x2(%r11,%rax,1),%eax
cvtsi2sd %eax,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
call   1030 <TimeYMDHMSToYrsec@plt>
cltq
imul   $0xffffffffc22e4507,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
sar    $0x10,%ecx
shr    $0x1f,%eax
add    %ecx,%eax
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @TimeYMDHMSToJulian(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 i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = 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
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = sdiv i32 %20, 100
store i32 %21, i32* %15
%22 = load i32, i32* %15
store i32 %22, i32* %13
%23 = load i32, i32* %13
%24 = sdiv i32 %23, 4
store i32 %24, i32* %15
%25 = load i32, i32* %13
%26 = sub nsw i32 2, %25
%27 = load i32, i32* %15
%28 = add nsw i32 %26, %27
store i32 %28, i32* %14
%29 = load i32, i32* %7
%30 = sitofp i32 %29 to double
%31 = fmul double 3.652500e+02, %30
%32 = fptosi double %31 to i32
store i32 %32, i32* %15
%33 = load i32, i32* %15
%34 = sitofp i32 %33 to double
%35 = fadd double %34, 0x407AC66C226809D5
%36 = fptosi double %35 to i32
store i32 %36, i32* %15
%37 = load i32, i32* %15
%38 = sitofp i32 %37 to double
%39 = fadd double %38, 0x413A42A280000000
%40 = load i32, i32* %14
%41 = sitofp i32 %40 to double
%42 = fadd double %39, %41
store double %42, double* %16
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
%45 = load i32, i32* %8
%46 = load i32, i32* %9
%47 = load i32, i32* %10
%48 = load i32, i32* %11
%49 = load double, double* %12
%50 = call i32 @TimeYMDHMSToYrsec(i32 %44, i32 %45, i32 %46, i32 %47, i32 %48, double %49)
%51 = sdiv i32 %50, 86400
%52 = add nsw i32 1, %51
%53 = sitofp i32 %52 to double
store double %53, double* %17
%54 = load double, double* %16
%55 = load double, double* %17
%56 = fadd double %54, %55
ret double %56
}

LLVM IR (-O2):
define double @TimeYMDHMSToJulian(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5) {
%7 = add nsw i32 %0, -1
%8 = sdiv i32 %7, -100
%9 = sdiv i32 %7, 400
%10 = add nsw i32 %8, 2
%11 = add nsw i32 %10, %9
%12 = sitofp i32 %7 to double
%13 = fmul double %12, 3.652500e+02
%14 = fptosi double %13 to i32
%15 = sitofp i32 %14 to double
%16 = fadd double %15, 0x407AC66C226809D5
%17 = fptosi double %16 to i32
%18 = sitofp i32 %17 to double
%19 = fadd double %18, 0x413A42A280000000
%20 = sitofp i32 %11 to double
%21 = fadd double %19, %20
%22 = tail call i32 @TimeYMDHMSToYrsec(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5)
%23 = sdiv i32 %22, 86400
%24 = add nsw i32 %23, 1
%25 = sitofp i32 %24 to double
%26 = fadd double %21, %25
ret double %26
}