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


x86 assembly (clang, -O0):
<day_from_year>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xf0e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xef0(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xedc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xebb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe99(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe85(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe42(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<day_from_year>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  0xeda(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xed0(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xecc(%rip),%xmm0
call   1030 <floor@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xec1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xeb7(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
divsd  0xeb1(%rip),%xmm0
call   1030 <floor@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0xe96(%rip),%xmm0
divsd  0xe96(%rip),%xmm0
call   1030 <floor@plt>
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @day_from_year(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 1.970000e+03
%5 = load double, double* %2
%6 = fsub double %5, 1.969000e+03
%7 = fdiv double %6, 4.000000e+00
%8 = call double @llvm.floor.f64(double %7)
%9 = call double @llvm.fmuladd.f64(double 3.650000e+02, double %4, double %8)
%10 = load double, double* %2
%11 = fsub double %10, 1.901000e+03
%12 = fdiv double %11, 1.000000e+02
%13 = call double @llvm.floor.f64(double %12)
%14 = fsub double %9, %13
%15 = load double, double* %2
%16 = fsub double %15, 1.601000e+03
%17 = fdiv double %16, 4.000000e+02
%18 = call double @llvm.floor.f64(double %17)
%19 = fadd double %14, %18
ret double %19
}

LLVM IR (-O2):
define double @day_from_year(double %0) {
%2 = fadd double %0, -1.970000e+03
%3 = fadd double %0, -1.969000e+03
%4 = fmul double %3, 2.500000e-01
%5 = tail call double @llvm.floor.f64(double %4)
%6 = tail call double @llvm.fmuladd.f64(double %2, double 3.650000e+02, double %5)
%7 = fadd double %0, -1.901000e+03
%8 = fdiv double %7, 1.000000e+02
%9 = tail call double @llvm.floor.f64(double %8)
%10 = fsub double %6, %9
%11 = fadd double %0, -1.601000e+03
%12 = fdiv double %11, 4.000000e+02
%13 = tail call double @llvm.floor.f64(double %12)
%14 = fadd double %13, %10
ret double %14
}