#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 day_of_year(int, int, int);
int /*<<< orphan*/ month_day(int, int, int *, int *);
int /*<<< orphan*/ printf(char *, int, int, int, ...);
int main() {
  int year, month, day, yearday;
  year = 2000;
  month = 1;
  day = 1;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  month = 12;
  day = 31;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  yearday = 1;
  month_day(year, yearday, &month, &day);
  printf("year: %4i  yearday: %03i  month: %02i  day: %02i\n", year, yearday,
         month, day);
  yearday = 31;
  month_day(year, yearday, &month, &day);
  printf("year: %4i  yearday: %03i  month: %02i  day: %02i\n", year, yearday,
         month, day);
  yearday = 32;
  month_day(year, yearday, &month, &day);
  printf("year: %4i  yearday: %03i  month: %02i  day: %02i\n", year, yearday,
         month, day);
  year = 2016;
  month = 1;
  day = 1;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  month = 12;
  day = 31;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  year = 2017;
  month = 1;
  day = 1;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  month = 12;
  day = 31;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  year = -120;
  month = 18;
  day = 115;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  month = 0;
  day = -31;
  printf("year: %4i  month: %02i  day: %02i  %12s: %i\n", year, month, day,
         "day of year", day_of_year(year, month, day));
  yearday = 367;
  month_day(year, yearday, &month, &day);
  printf("year: %4i  yearday: %03i  month: %02i  day: %02i\n", year, yearday,
         month, day);
  yearday = 0;
  month_day(year, yearday, &month, &day);
  printf("year: %4i  yearday: %03i  month: %02i  day: %02i\n", year, yearday,
         month, day);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7d0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x74(%rbp),%esi
mov    -0x70(%rbp),%edx
mov    -0x6c(%rbp),%ecx
mov    %eax,%r9d
lea    0xe76(%rip),%rdi
lea    0xe9c(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xc,-0xc(%rbp)
movl   $0x1f,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x68(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x60(%rbp),%ecx
mov    %eax,%r9d
lea    0xe27(%rip),%rdi
lea    0xe4d(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1f,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x20,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x7e0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x5c(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    %eax,%r9d
lea    0xd32(%rip),%rdi
lea    0xd58(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xc,-0xc(%rbp)
movl   $0x1f,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x50(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    %eax,%r9d
lea    0xce3(%rip),%rdi
lea    0xd09(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x7e1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    %eax,%r9d
lea    0xc8d(%rip),%rdi
lea    0xcb3(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xc,-0xc(%rbp)
movl   $0x1f,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x38(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    %eax,%r9d
lea    0xc3e(%rip),%rdi
lea    0xc64(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffff88,-0x8(%rbp)
movl   $0x12,-0xc(%rbp)
movl   $0x73,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    %eax,%r9d
lea    0xbe8(%rip),%rdi
lea    0xc0e(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0xffffffe1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <day_of_year@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    %eax,%r9d
lea    0xb99(%rip),%rdi
lea    0xbbf(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x16f,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xb96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xb61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0x7d0,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
lea    0xea8(%rip),%rbx
lea    0xece(%rip),%r14
mov    %rbx,%rdi
mov    $0x7d0,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0xc,0xc(%rsp)
movl   $0x1f,0x8(%rsp)
mov    $0x7d0,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    $0x7d0,%esi
mov    $0xc,%edx
mov    $0x1f,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
mov    $0x7d0,%edi
mov    $0x1,%esi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
lea    0xe49(%rip),%r13
mov    %r13,%rdi
mov    $0x7d0,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7d0,%edi
mov    $0x1f,%esi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %r13,%rdi
mov    $0x7d0,%esi
mov    $0x1f,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7d0,%edi
mov    $0x20,%esi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %r13,%rdi
mov    $0x7d0,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x1,0xc(%rsp)
movl   $0x1,0x8(%rsp)
mov    $0x7e0,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    $0x7e0,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0xc,0xc(%rsp)
movl   $0x1f,0x8(%rsp)
mov    $0x7e0,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    $0x7e0,%esi
mov    $0xc,%edx
mov    $0x1f,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x1,0xc(%rsp)
movl   $0x1,0x8(%rsp)
mov    $0x7e1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    $0x7e1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0xc,0xc(%rsp)
movl   $0x1f,0x8(%rsp)
mov    $0x7e1,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    $0x7e1,%esi
mov    $0xc,%edx
mov    $0x1f,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x12,0xc(%rsp)
movl   $0x73,0x8(%rsp)
mov    $0xffffff88,%edi
mov    $0x12,%esi
mov    $0x73,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    $0xffffff88,%esi
mov    $0x12,%edx
mov    $0x73,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x0,0xc(%rsp)
movl   $0xffffffe1,0x8(%rsp)
ff
mov    $0xffffff88,%edi
xor    %esi,%esi
mov    $0xffffffe1,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    $0xffffff88,%esi
xor    %edx,%edx
mov    $0xffffffe1,%ecx
mov    %r14,%r8
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffff88,%edi
mov    $0x16f,%esi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %r13,%rdi
mov    $0xffffff88,%esi
mov    $0x16f,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffff88,%edi
xor    %esi,%esi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %r13,%rdi
mov    $0xffffff88,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"year: %4i month: %02i day: %02i %12s: %i\0A\00"
@.str.1 = [12 x i8] c"day of year\00"
@.str.2 = [50 x i8] c"year: %4i yearday: %03i month: %02i day: %02i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 2000, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @day_of_year(i32 %9, i32 %10, i32 %11)
%13 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 12, i32* %3
store i32 31, i32* %4
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 @day_of_year(i32 %17, i32 %18, i32 %19)
%21 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15, i32 %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %20)
store i32 1, i32* %5
%22 = load i32, i32* %2
%23 = load i32, i32* %5
%24 = call i32 @month_day(i32 %22, i32 %23, i32* %3, i32* %4)
%25 = load i32, i32* %2
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %26, i32 %27, i32 %28)
store i32 31, i32* %5
%30 = load i32, i32* %2
%31 = load i32, i32* %5
%32 = call i32 @month_day(i32 %30, i32 %31, i32* %3, i32* %4)
%33 = load i32, i32* %2
%34 = load i32, i32* %5
%35 = load i32, i32* %3
%36 = load i32, i32* %4
%37 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34, i32 %35, i32 %36)
store i32 32, i32* %5
%38 = load i32, i32* %2
%39 = load i32, i32* %5
%40 = call i32 @month_day(i32 %38, i32 %39, i32* %3, i32* %4)
%41 = load i32, i32* %2
%42 = load i32, i32* %5
%43 = load i32, i32* %3
%44 = load i32, i32* %4
%45 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %41, i32 %42, i32 %43, i32 %44)
store i32 2016, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = load i32, i32* %4
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = call i32 @day_of_year(i32 %49, i32 %50, i32 %51)
%53 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %46, i32 %47, i32 %48, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %52)
store i32 12, i32* %3
store i32 31, i32* %4
%54 = load i32, i32* %2
%55 = load i32, i32* %3
%56 = load i32, i32* %4
%57 = load i32, i32* %2
%58 = load i32, i32* %3
%59 = load i32, i32* %4
%60 = call i32 @day_of_year(i32 %57, i32 %58, i32 %59)
%61 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %54, i32 %55, i32 %56, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %60)
store i32 2017, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
%62 = load i32, i32* %2
%63 = load i32, i32* %3
%64 = load i32, i32* %4
%65 = load i32, i32* %2
%66 = load i32, i32* %3
%67 = load i32, i32* %4
%68 = call i32 @day_of_year(i32 %65, i32 %66, i32 %67)
%69 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %62, i32 %63, i32 %64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %68)
store i32 12, i32* %3
store i32 31, i32* %4
%70 = load i32, i32* %2
%71 = load i32, i32* %3
%72 = load i32, i32* %4
%73 = load i32, i32* %2
%74 = load i32, i32* %3
%75 = load i32, i32* %4
%76 = call i32 @day_of_year(i32 %73, i32 %74, i32 %75)
%77 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %70, i32 %71, i32 %72, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %76)
store i32 -120, i32* %2
store i32 18, i32* %3
store i32 115, i32* %4
%78 = load i32, i32* %2
%79 = load i32, i32* %3
%80 = load i32, i32* %4
%81 = load i32, i32* %2
%82 = load i32, i32* %3
%83 = load i32, i32* %4
%84 = call i32 @day_of_year(i32 %81, i32 %82, i32 %83)
%85 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %78, i32 %79, i32 %80, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %84)
store i32 0, i32* %3
store i32 -31, i32* %4
%86 = load i32, i32* %2
%87 = load i32, i32* %3
%88 = load i32, i32* %4
%89 = load i32, i32* %2
%90 = load i32, i32* %3
%91 = load i32, i32* %4
%92 = call i32 @day_of_year(i32 %89, i32 %90, i32 %91)
%93 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %86, i32 %87, i32 %88, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %92)
store i32 367, i32* %5
%94 = load i32, i32* %2
%95 = load i32, i32* %5
%96 = call i32 @month_day(i32 %94, i32 %95, i32* %3, i32* %4)
%97 = load i32, i32* %2
%98 = load i32, i32* %5
%99 = load i32, i32* %3
%100 = load i32, i32* %4
%101 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %97, i32 %98, i32 %99, i32 %100)
store i32 0, i32* %5
%102 = load i32, i32* %2
%103 = load i32, i32* %5
%104 = call i32 @month_day(i32 %102, i32 %103, i32* %3, i32* %4)
%105 = load i32, i32* %2
%106 = load i32, i32* %5
%107 = load i32, i32* %3
%108 = load i32, i32* %4
%109 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %105, i32 %106, i32 %107, i32 %108)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"year: %4i month: %02i day: %02i %12s: %i\0A\00"
@.str.1 = [12 x i8] c"day of year\00"
@.str.2 = [50 x i8] c"year: %4i yearday: %03i month: %02i day: %02i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @day_of_year(i32 2000, i32 1, i32 1)
%6 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 2000, i32 1, i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %5)
store i32 12, i32* %1
store i32 31, i32* %2
%7 = tail call i32 @day_of_year(i32 2000, i32 12, i32 31)
%8 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 2000, i32 12, i32 31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @month_day(i32 2000, i32 1, i32* %1, i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 2000, i32 1, i32 %10, i32 %11)
%13 = call i32 @month_day(i32 2000, i32 31, i32* %1, i32* %2)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 2000, i32 31, i32 %14, i32 %15)
%17 = call i32 @month_day(i32 2000, i32 32, i32* %1, i32* %2)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 2000, i32 32, i32 %18, i32 %19)
store i32 1, i32* %1
store i32 1, i32* %2
%21 = call i32 @day_of_year(i32 2016, i32 1, i32 1)
%22 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 2016, i32 1, i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %21)
store i32 12, i32* %1
store i32 31, i32* %2
%23 = call i32 @day_of_year(i32 2016, i32 12, i32 31)
%24 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 2016, i32 12, i32 31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %23)
store i32 1, i32* %1
store i32 1, i32* %2
%25 = call i32 @day_of_year(i32 2017, i32 1, i32 1)
%26 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 2017, i32 1, i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %25)
store i32 12, i32* %1
store i32 31, i32* %2
%27 = call i32 @day_of_year(i32 2017, i32 12, i32 31)
%28 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 2017, i32 12, i32 31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 18, i32* %1
store i32 115, i32* %2
%29 = call i32 @day_of_year(i32 -120, i32 18, i32 115)
%30 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 -120, i32 18, i32 115, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %29)
store i32 0, i32* %1
store i32 -31, i32* %2
%31 = call i32 @day_of_year(i32 -120, i32 0, i32 -31)
%32 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 -120, i32 0, i32 -31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = call i32 @month_day(i32 -120, i32 367, i32* %1, i32* %2)
%34 = load i32, i32* %1
%35 = load i32, i32* %2
%36 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 -120, i32 367, i32 %34, i32 %35)
%37 = call i32 @month_day(i32 -120, i32 0, i32* %1, i32* %2)
%38 = load i32, i32* %1
%39 = load i32, i32* %2
%40 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 -120, i32 0, i32 %38, i32 %39)
ret i32 0
}