#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 /*<<< orphan*/ putchar(char);
int main(void) {
  int month = 0;
  int day = 0;
  printf("Aug 05, 1966, is day %03d of the year\n", day_of_year(1966, 8, 5));
  printf("Jan 01, 2000, is day %03d of the year\n", day_of_year(2000, 1, 1));
  printf("Dec 31, 1999, is day %03d of the year\n", day_of_year(1999, 12, 31));
  printf("Dec 31, 2000, is day %03d of the year\n", day_of_year(2000, 12, 31));
  printf("Dec 31, 3000, is day %03d of the year\n", day_of_year(3000, 12, 31));
  printf("Dec 31, 2004, is day %03d of the year\n", day_of_year(2004, 12, 31));
  (void)putchar('\n');
  printf(
      "Attempting a negative year returns                             : %d\n",
      day_of_year(-1, 8, 5));
  printf(
      "Attempting a month number less than one returns                : %d\n",
      day_of_year(1966, 0, 5));
  printf(
      "Attempting a month number greater than 12 returns              : %d\n",
      day_of_year(1966, 13, 5));
  printf(
      "Attempting a day number less than one returns                  : %d\n",
      day_of_year(1966, 8, 0));
  printf(
      "Attempting a day greater than 31 returns                       : %d\n",
      day_of_year(1966, 8, 32));
  printf(
      "Attempting a day greater than 30 in April returns              : %d\n",
      day_of_year(1966, 4, 31));
  printf(
      "Attempting a day greater than 29 in February returns           : %d\n",
      day_of_year(1966, 2, 30));
  printf(
      "Attempting a day greater than 28 in a non-leap February returns: %d\n",
      day_of_year(1999, 2, 29));
  (void)putchar('\n');
  month_day(1966, 217, &month, &day);
  printf("Day %03d occurs in month %02d on day %02d of year %04d\n", 217, month,
         day, 1966);
  month_day(2000, 1, &month, &day);
  printf("Day %03d occurs in month %02d on day %02d of year %04d\n", 1, month,
         day, 2000);
  month_day(1999, 365, &month, &day);
  printf("Day %03d occurs in month %02d on day %02d of year %04d\n", 365, month,
         day, 1999);
  month_day(2000, 366, &month, &day);
  printf("Day %03d occurs in month %02d on day %02d of year %04d\n", 366, month,
         day, 2000);
  month_day(3000, 365, &month, &day);
  printf("Day %03d occurs in month %02d on day %02d of year %04d\n", 365, month,
         day, 3000);
  month_day(2004, 366, &month, &day);
  printf("Day %03d occurs in month %02d on day %02d of year %04d\n", 366, month,
         day, 2004);
  (void)putchar('\n');
  month_day(-1, 365, &month, &day);
  printf("Attempting a negative year returns                                 : "
         "month %d, day %d\n",
         month, day);
  month_day(2004, 0, &month, &day);
  printf("Attempting a day number less than one returns                      : "
         "month %d, day %d\n",
         month, day);
  month_day(2004, 367, &month, &day);
  printf("Attempting a day number greater than 366 returns                   : "
         "month %d, day %d\n",
         month, day);
  month_day(2003, 366, &month, &day);
  printf("Attempting a day number greater than 365 in a non-leap year returns: "
         "month %d, day %d\n",
         month, day);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x7ae,%edi
mov    $0x8,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7cf,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xbb8,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d4,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%edi
mov    $0x8,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7ae,%edi
xor    %esi,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0xd,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x8,%esi
mov    $0x20,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x4,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xf3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x2,%esi
mov    $0x1e,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xf5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7cf,%edi
mov    $0x2,%esi
mov    $0x1d,%edx
call   1060 <day_of_year@plt>
mov    %eax,%esi
lea    0xf7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x7ae,%edi
mov    $0xd9,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xf8e(%rip),%rdi
mov    $0xd9,%esi
mov    $0x7ae,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0x1,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xf58(%rip),%rdi
mov    $0x1,%esi
mov    $0x7d0,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7cf,%edi
mov    $0x16d,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xf22(%rip),%rdi
mov    $0x16d,%esi
mov    $0x7cf,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0x16e,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeec(%rip),%rdi
mov    $0x16e,%esi
mov    $0x7d0,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xbb8,%edi
mov    $0x16d,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeb6(%rip),%rdi
mov    $0x16d,%esi
mov    $0xbb8,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d4,%edi
mov    $0x16e,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe80(%rip),%rdi
mov    $0x16e,%esi
mov    $0x7d4,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%edi
mov    $0x16d,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d4,%edi
xor    %esi,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d4,%edi
mov    $0x16f,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x7d3,%edi
mov    $0x16e,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x7ae,%edi
mov    $0x8,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1060 <day_of_year@plt>
lea    0xe8f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7cf,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
lea    0xe92(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xbb8,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
lea    0xe98(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d4,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%edi
mov    $0x8,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7ae,%edi
xor    %esi,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0xd,%esi
mov    $0x5,%edx
call   1060 <day_of_year@plt>
lea    0xed9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1060 <day_of_year@plt>
lea    0xefd(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x8,%esi
mov    $0x20,%edx
call   1060 <day_of_year@plt>
lea    0xf1e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x4,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
lea    0xf3f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7ae,%edi
mov    $0x2,%esi
mov    $0x1e,%edx
call   1060 <day_of_year@plt>
lea    0xf60(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7cf,%edi
mov    $0x2,%esi
mov    $0x1d,%edx
call   1060 <day_of_year@plt>
lea    0xf81(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r14
mov    $0x7ae,%edi
mov    $0xd9,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xf85(%rip),%rbx
mov    %rbx,%rdi
mov    $0xd9,%esi
mov    $0x7ae,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0x1,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x7d0,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7cf,%edi
mov    $0x16d,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x16d,%esi
mov    $0x7cf,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d0,%edi
mov    $0x16e,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x16e,%esi
mov    $0x7d0,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xbb8,%edi
mov    $0x16d,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x16d,%esi
mov    $0xbb8,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d4,%edi
mov    $0x16e,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x16e,%esi
mov    $0x7d4,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%edi
mov    $0x16d,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d4,%edi
xor    %esi,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d4,%edi
mov    $0x16f,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d3,%edi
mov    $0x16e,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xf07(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Aug 05, 1966, is day %03d of the year\0A\00"
@.str.1 = [39 x i8] c"Jan 01, 2000, is day %03d of the year\0A\00"
@.str.2 = [39 x i8] c"Dec 31, 1999, is day %03d of the year\0A\00"
@.str.3 = [39 x i8] c"Dec 31, 2000, is day %03d of the year\0A\00"
@.str.4 = [39 x i8] c"Dec 31, 3000, is day %03d of the year\0A\00"
@.str.5 = [39 x i8] c"Dec 31, 2004, is day %03d of the year\0A\00"
@.str.6 = [69 x i8] c"Attempting a negative year returns : %d\0A\00"
@.str.7 = [69 x i8] c"Attempting a month number less than one returns : %d\0A\00"
@.str.8 = [69 x i8] c"Attempting a month number greater than 12 returns : %d\0A\00"
@.str.9 = [69 x i8] c"Attempting a day number less than one returns : %d\0A\00"
@.str.10 = [69 x i8] c"Attempting a day greater than 31 returns : %d\0A\00"
@.str.11 = [69 x i8] c"Attempting a day greater than 30 in April returns : %d\0A\00"
@.str.12 = [69 x i8] c"Attempting a day greater than 29 in February returns : %d\0A\00"
@.str.13 = [69 x i8] c"Attempting a day greater than 28 in a non-leap February returns: %d\0A\00"
@.str.14 = [56 x i8] c"Day %03d occurs in month %02d on day %02d of year %04d\0A\00"
@.str.15 = [87 x i8] c"Attempting a negative year returns : month %d, day %d\0A\00"
@.str.16 = [87 x i8] c"Attempting a day number less than one returns : month %d, day %d\0A\00"
@.str.17 = [87 x i8] c"Attempting a day number greater than 366 returns : month %d, day %d\0A\00"
@.str.18 = [87 x i8] c"Attempting a day number greater than 365 in a non-leap year returns: month %d, day %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 @day_of_year(i32 1966, i32 8, i32 5)
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @day_of_year(i32 2000, i32 1, i32 1)
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @day_of_year(i32 1999, i32 12, i32 31)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = call i32 @day_of_year(i32 2000, i32 12, i32 31)
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = call i32 @day_of_year(i32 3000, i32 12, i32 31)
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = call i32 @day_of_year(i32 2004, i32 12, i32 31)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%16 = call i32 @putchar(i8 signext 10)
%17 = call i32 @day_of_year(i32 -1, i32 8, i32 5)
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.6, i64 0, i64 0), i32 %17)
%19 = call i32 @day_of_year(i32 1966, i32 0, i32 5)
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.7, i64 0, i64 0), i32 %19)
%21 = call i32 @day_of_year(i32 1966, i32 13, i32 5)
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.8, i64 0, i64 0), i32 %21)
%23 = call i32 @day_of_year(i32 1966, i32 8, i32 0)
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.9, i64 0, i64 0), i32 %23)
%25 = call i32 @day_of_year(i32 1966, i32 8, i32 32)
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.10, i64 0, i64 0), i32 %25)
%27 = call i32 @day_of_year(i32 1966, i32 4, i32 31)
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.11, i64 0, i64 0), i32 %27)
%29 = call i32 @day_of_year(i32 1966, i32 2, i32 30)
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.12, i64 0, i64 0), i32 %29)
%31 = call i32 @day_of_year(i32 1999, i32 2, i32 29)
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.13, i64 0, i64 0), i32 %31)
%33 = call i32 @putchar(i8 signext 10)
%34 = call i32 @month_day(i32 1966, i32 217, i32* %2, i32* %3)
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 217, i32 %35, i32 %36, i32 1966)
%38 = call i32 @month_day(i32 2000, i32 1, i32* %2, i32* %3)
%39 = load i32, i32* %2
%40 = load i32, i32* %3
%41 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 1, i32 %39, i32 %40, i32 2000)
%42 = call i32 @month_day(i32 1999, i32 365, i32* %2, i32* %3)
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 365, i32 %43, i32 %44, i32 1999)
%46 = call i32 @month_day(i32 2000, i32 366, i32* %2, i32* %3)
%47 = load i32, i32* %2
%48 = load i32, i32* %3
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 366, i32 %47, i32 %48, i32 2000)
%50 = call i32 @month_day(i32 3000, i32 365, i32* %2, i32* %3)
%51 = load i32, i32* %2
%52 = load i32, i32* %3
%53 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 365, i32 %51, i32 %52, i32 3000)
%54 = call i32 @month_day(i32 2004, i32 366, i32* %2, i32* %3)
%55 = load i32, i32* %2
%56 = load i32, i32* %3
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 366, i32 %55, i32 %56, i32 2004)
%58 = call i32 @putchar(i8 signext 10)
%59 = call i32 @month_day(i32 -1, i32 365, i32* %2, i32* %3)
%60 = load i32, i32* %2
%61 = load i32, i32* %3
%62 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.15, i64 0, i64 0), i32 %60, i32 %61)
%63 = call i32 @month_day(i32 2004, i32 0, i32* %2, i32* %3)
%64 = load i32, i32* %2
%65 = load i32, i32* %3
%66 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.16, i64 0, i64 0), i32 %64, i32 %65)
%67 = call i32 @month_day(i32 2004, i32 367, i32* %2, i32* %3)
%68 = load i32, i32* %2
%69 = load i32, i32* %3
%70 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.17, i64 0, i64 0), i32 %68, i32 %69)
%71 = call i32 @month_day(i32 2003, i32 366, i32* %2, i32* %3)
%72 = load i32, i32* %2
%73 = load i32, i32* %3
%74 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.18, i64 0, i64 0), i32 %72, i32 %73)
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"Aug 05, 1966, is day %03d of the year\0A\00"
@.str.1 = [39 x i8] c"Jan 01, 2000, is day %03d of the year\0A\00"
@.str.2 = [39 x i8] c"Dec 31, 1999, is day %03d of the year\0A\00"
@.str.3 = [39 x i8] c"Dec 31, 2000, is day %03d of the year\0A\00"
@.str.4 = [39 x i8] c"Dec 31, 3000, is day %03d of the year\0A\00"
@.str.5 = [39 x i8] c"Dec 31, 2004, is day %03d of the year\0A\00"
@.str.6 = [69 x i8] c"Attempting a negative year returns : %d\0A\00"
@.str.7 = [69 x i8] c"Attempting a month number less than one returns : %d\0A\00"
@.str.8 = [69 x i8] c"Attempting a month number greater than 12 returns : %d\0A\00"
@.str.9 = [69 x i8] c"Attempting a day number less than one returns : %d\0A\00"
@.str.10 = [69 x i8] c"Attempting a day greater than 31 returns : %d\0A\00"
@.str.11 = [69 x i8] c"Attempting a day greater than 30 in April returns : %d\0A\00"
@.str.12 = [69 x i8] c"Attempting a day greater than 29 in February returns : %d\0A\00"
@.str.13 = [69 x i8] c"Attempting a day greater than 28 in a non-leap February returns: %d\0A\00"
@.str.14 = [56 x i8] c"Day %03d occurs in month %02d on day %02d of year %04d\0A\00"
@.str.15 = [87 x i8] c"Attempting a negative year returns : month %d, day %d\0A\00"
@.str.16 = [87 x i8] c"Attempting a day number less than one returns : month %d, day %d\0A\00"
@.str.17 = [87 x i8] c"Attempting a day number greater than 366 returns : month %d, day %d\0A\00"
@.str.18 = [87 x i8] c"Attempting a day number greater than 365 in a non-leap year returns: month %d, day %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @day_of_year(i32 1966, i32 8, i32 5)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @day_of_year(i32 2000, i32 1, i32 1)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @day_of_year(i32 1999, i32 12, i32 31)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = tail call i32 @day_of_year(i32 2000, i32 12, i32 31)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = tail call i32 @day_of_year(i32 3000, i32 12, i32 31)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = tail call i32 @day_of_year(i32 2004, i32 12, i32 31)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = tail call i32 @putchar(i8 signext 10)
%18 = tail call i32 @day_of_year(i32 -1, i32 8, i32 5)
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.6, i64 0, i64 0), i32 %18)
%20 = tail call i32 @day_of_year(i32 1966, i32 0, i32 5)
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.7, i64 0, i64 0), i32 %20)
%22 = tail call i32 @day_of_year(i32 1966, i32 13, i32 5)
%23 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.8, i64 0, i64 0), i32 %22)
%24 = tail call i32 @day_of_year(i32 1966, i32 8, i32 0)
%25 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.9, i64 0, i64 0), i32 %24)
%26 = tail call i32 @day_of_year(i32 1966, i32 8, i32 32)
%27 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.10, i64 0, i64 0), i32 %26)
%28 = tail call i32 @day_of_year(i32 1966, i32 4, i32 31)
%29 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.11, i64 0, i64 0), i32 %28)
%30 = tail call i32 @day_of_year(i32 1966, i32 2, i32 30)
%31 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.12, i64 0, i64 0), i32 %30)
%32 = tail call i32 @day_of_year(i32 1999, i32 2, i32 29)
%33 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.13, i64 0, i64 0), i32 %32)
%34 = tail call i32 @putchar(i8 signext 10)
%35 = call i32 @month_day(i32 1966, i32 217, i32* %1, i32* %2)
%36 = load i32, i32* %1
%37 = load i32, i32* %2
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 217, i32 %36, i32 %37, i32 1966)
%39 = call i32 @month_day(i32 2000, i32 1, i32* %1, i32* %2)
%40 = load i32, i32* %1
%41 = load i32, i32* %2
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 1, i32 %40, i32 %41, i32 2000)
%43 = call i32 @month_day(i32 1999, i32 365, i32* %1, i32* %2)
%44 = load i32, i32* %1
%45 = load i32, i32* %2
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 365, i32 %44, i32 %45, i32 1999)
%47 = call i32 @month_day(i32 2000, i32 366, i32* %1, i32* %2)
%48 = load i32, i32* %1
%49 = load i32, i32* %2
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 366, i32 %48, i32 %49, i32 2000)
%51 = call i32 @month_day(i32 3000, i32 365, i32* %1, i32* %2)
%52 = load i32, i32* %1
%53 = load i32, i32* %2
%54 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 365, i32 %52, i32 %53, i32 3000)
%55 = call i32 @month_day(i32 2004, i32 366, i32* %1, i32* %2)
%56 = load i32, i32* %1
%57 = load i32, i32* %2
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i32 366, i32 %56, i32 %57, i32 2004)
%59 = call i32 @putchar(i8 signext 10)
%60 = call i32 @month_day(i32 -1, i32 365, i32* %1, i32* %2)
%61 = load i32, i32* %1
%62 = load i32, i32* %2
%63 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.15, i64 0, i64 0), i32 %61, i32 %62)
%64 = call i32 @month_day(i32 2004, i32 0, i32* %1, i32* %2)
%65 = load i32, i32* %1
%66 = load i32, i32* %2
%67 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.16, i64 0, i64 0), i32 %65, i32 %66)
%68 = call i32 @month_day(i32 2004, i32 367, i32* %1, i32* %2)
%69 = load i32, i32* %1
%70 = load i32, i32* %2
%71 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.17, i64 0, i64 0), i32 %69, i32 %70)
%72 = call i32 @month_day(i32 2003, i32 366, i32* %1, i32* %2)
%73 = load i32, i32* %1
%74 = load i32, i32* %2
%75 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.18, i64 0, i64 0), i32 %73, i32 %74)
ret i32 0
}