#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 floor(double);
double julian(int Year, int Month, int Day) {
  if ((Month == 1) || (Month == 2)) {
    Year--;
    Month = Month + 12;
  }
  double B = 2.0 - floor(Year / 100.0) + floor(Year / 400.0);
  return (B + floor(365.25 * Year) + floor(30.6001 * (Month + 1.0)) + Day +
          1720994.5);
}


x86 assembly (clang, -O0):
<julian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     1135 <julian+0x25>
cmpl   $0x2,-0x8(%rbp)
jne    1147 <julian+0x37>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xedc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  0xec0(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe69(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe3a(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe26(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdf8(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<julian>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebx
lea    -0x1(%rsi),%eax
lea    0xc(%rsi),%ebp
cmp    $0x2,%eax
cmovae %esi,%ebp
sbb    $0x0,%edi
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x8(%rsp)
divsd  0xec7(%rip),%xmm0
call   1030 <floor@plt>
movsd  0xec2(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0xeb2(%rip),%xmm0
call   1030 <floor@plt>
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe9b(%rip),%xmm0
call   1030 <floor@plt>
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
addsd  0xe83(%rip),%xmm0
mulsd  0xe83(%rip),%xmm0
call   1030 <floor@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
addsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
addsd  0xe6d(%rip),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @julian(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 1
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %10, %3
%14 = load i32, i32* %4
%15 = add nsw i32 %14, -1
store i32 %15, i32* %4
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 12
store i32 %17, i32* %5
br label %18
18: ; preds = %13, %10
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, 1.000000e+02
%22 = call double @llvm.floor.f64(double %21)
%23 = fsub double 2.000000e+00, %22
%24 = load i32, i32* %4
%25 = sitofp i32 %24 to double
%26 = fdiv double %25, 4.000000e+02
%27 = call double @llvm.floor.f64(double %26)
%28 = fadd double %23, %27
store double %28, double* %7
%29 = load double, double* %7
%30 = load i32, i32* %4
%31 = sitofp i32 %30 to double
%32 = fmul double 3.652500e+02, %31
%33 = call double @llvm.floor.f64(double %32)
%34 = fadd double %29, %33
%35 = load i32, i32* %5
%36 = sitofp i32 %35 to double
%37 = fadd double %36, 1.000000e+00
%38 = fmul double 3.060010e+01, %37
%39 = call double @llvm.floor.f64(double %38)
%40 = fadd double %34, %39
%41 = load i32, i32* %6
%42 = sitofp i32 %41 to double
%43 = fadd double %40, %42
%44 = fadd double %43, 0x413A42A280000000
ret double %44
}

LLVM IR (-O2):
define double @julian(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %1, -1
%5 = icmp ult i32 %4, 2
%6 = add nsw i32 %1, 12
%7 = select i1 %5, i32 %6, i32 %1
%8 = sext i1 %5 to i32
%9 = add nsw i32 %8, %0
%10 = sitofp i32 %9 to double
%11 = fdiv double %10, 1.000000e+02
%12 = tail call double @llvm.floor.f64(double %11)
%13 = fsub double 2.000000e+00, %12
%14 = fdiv double %10, 4.000000e+02
%15 = tail call double @llvm.floor.f64(double %14)
%16 = fadd double %15, %13
%17 = fmul double %10, 3.652500e+02
%18 = tail call double @llvm.floor.f64(double %17)
%19 = fadd double %18, %16
%20 = sitofp i32 %7 to double
%21 = fadd double %20, 1.000000e+00
%22 = fmul double %21, 3.060010e+01
%23 = tail call double @llvm.floor.f64(double %22)
%24 = fadd double %23, %19
%25 = sitofp i32 %2 to double
%26 = fadd double %24, %25
%27 = fadd double %26, 0x413A42A280000000
ret double %27
}