#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);
int DayFromYear(int y) {
  return 365 * (y - 1970) + floor((y - 1969) / 4.0) -
         floor((y - 1901) / 100.0) + floor((y - 1601) / 400.0);
}


x86 assembly (clang, -O0):
<DayFromYear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x7b2,%eax
imul   $0x16d,%eax,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x7b1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xed0(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x76d,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe9d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x641,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe6a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DayFromYear>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
imul   $0x16d,%edi,%ebp
lea    -0x7b1(%rbx),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xed2(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
mov    %eax,%r14d
add    %ebp,%r14d
lea    -0x76d(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xeb6(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
sub    %eax,%r14d
add    $0xfffff9bf,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0xe9d(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <floor@plt>
add    %r14d,%eax
add    $0xfff50736,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @DayFromYear(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1970
%5 = mul nsw i32 365, %4
%6 = load i32, i32* %2
%7 = sub nsw i32 %6, 1969
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 4.000000e+00
%10 = fptosi double %9 to i32
%11 = call i32 @floor(i32 %10)
%12 = add nsw i32 %5, %11
%13 = load i32, i32* %2
%14 = sub nsw i32 %13, 1901
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 1.000000e+02
%17 = fptosi double %16 to i32
%18 = call i32 @floor(i32 %17)
%19 = sub nsw i32 %12, %18
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, 1601
%22 = sitofp i32 %21 to double
%23 = fdiv double %22, 4.000000e+02
%24 = fptosi double %23 to i32
%25 = call i32 @floor(i32 %24)
%26 = add nsw i32 %19, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @DayFromYear(i32 %0) {
%2 = mul i32 %0, 365
%3 = add i32 %2, -719050
%4 = add nsw i32 %0, -1969
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 2.500000e-01
%7 = fptosi double %6 to i32
%8 = tail call i32 @floor(i32 %7)
%9 = add nsw i32 %3, %8
%10 = add nsw i32 %0, -1901
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, 1.000000e+02
%13 = fptosi double %12 to i32
%14 = tail call i32 @floor(i32 %13)
%15 = sub i32 %9, %14
%16 = add nsw i32 %0, -1601
%17 = sitofp i32 %16 to double
%18 = fdiv double %17, 4.000000e+02
%19 = fptosi double %18 to i32
%20 = tail call i32 @floor(i32 %19)
%21 = add nsw i32 %15, %20
ret i32 %21
}