#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(double);
double days(int y, int m, int d, double h) {
  int a, b;
  double day;
  if (m == 1 || m == 2) {
    m += 12;
    y -= 1;
  }
  a = y / 100;
  b = 2 - a + a / 4;
  day = floor(365.25 * (y + 4716)) + floor(30.6001 * (m + 1)) + d + b - 1524.5 -
        2451545 + h / 24;
  return (day);
}


x86 assembly (clang, -O0):
<days>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     113a <days+0x2a>
cmpl   $0x2,-0x8(%rbp)
jne    114c <days+0x3c>
mov    -0x8(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    $0x2,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x126c,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe92(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <floor@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe6c(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <floor@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
add    -0xc(%rbp),%eax
add    -0x20(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe42(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe2e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe15(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<days>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r14d
lea    -0x1(%rsi),%eax
lea    0xc(%rsi),%r12d
cmp    $0x2,%eax
cmovae %esi,%r12d
sbb    $0x0,%edi
movslq %edi,%rax
imul   $0xffffffffae147ae1,%rax,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rbx
add    %ecx,%ebx
imul   $0x51eb851f,%rax,%rbp
mov    %rbp,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rbp
add    %ecx,%ebp
add    $0x126c,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe8b(%rip),%xmm0
call   1030 <floor@plt>
mov    %eax,%r15d
add    $0x1,%r12d
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
mulsd  0xe77(%rip),%xmm0
call   1030 <floor@plt>
add    %r14d,%ebx
add    %ebp,%ebx
add    %r15d,%ebx
add    %ebx,%eax
add    $0x2,%eax
cvtsi2sd %eax,%xmm1
addsd  0xe61(%rip),%xmm1
addsd  0xe61(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
divsd  0xe5b(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @days(i32 %0, i32 %1, i32 %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double %3, double* %8
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %4
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %22
17: ; preds = %14, %4
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 12
store i32 %19, i32* %6
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %5
br label %22
22: ; preds = %17, %14
%23 = load i32, i32* %5
%24 = sdiv i32 %23, 100
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = sub nsw i32 2, %25
%27 = load i32, i32* %9
%28 = sdiv i32 %27, 4
%29 = add nsw i32 %26, %28
store i32 %29, i32* %10
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 4716
%32 = sitofp i32 %31 to double
%33 = fmul double 3.652500e+02, %32
%34 = call i32 @floor(double %33)
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
%37 = sitofp i32 %36 to double
%38 = fmul double 3.060010e+01, %37
%39 = call i32 @floor(double %38)
%40 = add nsw i32 %34, %39
%41 = load i32, i32* %7
%42 = add nsw i32 %40, %41
%43 = load i32, i32* %10
%44 = add nsw i32 %42, %43
%45 = sitofp i32 %44 to double
%46 = fsub double %45, 1.524500e+03
%47 = fsub double %46, 0x4142B42C80000000
%48 = load double, double* %8
%49 = fdiv double %48, 2.400000e+01
%50 = fadd double %47, %49
store double %50, double* %11
%51 = load double, double* %11
ret double %51
}

LLVM IR (-O2):
define double @days(i32 %0, i32 %1, i32 %2, double %3) {
%5 = add i32 %1, -1
%6 = icmp ult i32 %5, 2
%7 = add nsw i32 %1, 12
%8 = select i1 %6, i32 %7, i32 %1
%9 = sext i1 %6 to i32
%10 = add nsw i32 %9, %0
%11 = sdiv i32 %10, -100
%12 = sdiv i32 %10, 400
%13 = add nsw i32 %10, 4716
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 3.652500e+02
%16 = tail call i32 @floor(double %15)
%17 = add nsw i32 %8, 1
%18 = sitofp i32 %17 to double
%19 = fmul double %18, 3.060010e+01
%20 = tail call i32 @floor(double %19)
%21 = add i32 %2, 2
%22 = add i32 %21, %11
%23 = add i32 %22, %12
%24 = add i32 %23, %16
%25 = add i32 %24, %20
%26 = sitofp i32 %25 to double
%27 = fadd double %26, -1.524500e+03
%28 = fadd double %27, 0xC142B42C80000000
%29 = fdiv double %3, 2.400000e+01
%30 = fadd double %29, %28
ret double %30
}