#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 main() {
  int month;
  int day;
  printf("\n%d should be 1", day_of_year(2014, 1, 1));
  printf("\n%d should be 60", day_of_year(2014, 3, 1));
  printf("\n%d should be 61", day_of_year(2016, 3, 1));
  month_day(2014, 1, &month, &day);
  printf("\n%d, %d should be 1, 1", month, day);
  month_day(2014, 60, &month, &day);
  printf("\n%d, %d should be 3, 1", month, day);
  month_day(2016, 60, &month, &day);
  printf("\n%d, %d should be 2, 29", month, day);
  day_of_year(2014, 13, 1);
  day_of_year(2014, 1, 44);
  month_day(2014, 400, &month, &day);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x7de,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1050 <day_of_year@plt>
mov    %eax,%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7de,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e0,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
mov    %eax,%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7de,%edi
mov    $0x1,%esi
lea    -0x4(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7de,%edi
mov    $0x3c,%esi
lea    -0x4(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e0,%edi
mov    $0x3c,%esi
lea    -0x4(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7de,%edi
mov    $0xd,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
mov    $0x7de,%edi
mov    $0x1,%esi
mov    $0x2c,%edx
call   1050 <day_of_year@plt>
mov    $0x7de,%edi
mov    $0x190,%esi
lea    -0x4(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x7de,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1060 <day_of_year@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7de,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1060 <day_of_year@plt>
lea    0xe8d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7e0,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1060 <day_of_year@plt>
lea    0xe7a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    $0x7de,%edi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7de,%edi
mov    $0x3c,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7e0,%edi
mov    $0x3c,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe31(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7de,%edi
mov    $0xd,%esi
mov    $0x1,%edx
call   1060 <day_of_year@plt>
mov    $0x7de,%edi
mov    $0x1,%esi
mov    $0x2c,%edx
call   1060 <day_of_year@plt>
mov    $0x7de,%edi
mov    $0x190,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <month_day@plt>
lea    0xdfe(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0A%d should be 1\00"
@.str.1 = [17 x i8] c"\0A%d should be 60\00"
@.str.2 = [17 x i8] c"\0A%d should be 61\00"
@.str.3 = [23 x i8] c"\0A%d, %d should be 1, 1\00"
@.str.4 = [23 x i8] c"\0A%d, %d should be 3, 1\00"
@.str.5 = [24 x i8] c"\0A%d, %d should be 2, 29\00"
@.str.6 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @day_of_year(i32 2014, i32 1, i32 1)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @day_of_year(i32 2014, i32 3, i32 1)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 @day_of_year(i32 2016, i32 3, i32 1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = call i32 @month_day(i32 2014, i32 1, i32* %1, i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %11)
%13 = call i32 @month_day(i32 2014, i32 60, i32* %1, i32* %2)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %14, i32 %15)
%17 = call i32 @month_day(i32 2016, i32 60, i32* %1, i32* %2)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %18, i32 %19)
%21 = call i32 @day_of_year(i32 2014, i32 13, i32 1)
%22 = call i32 @day_of_year(i32 2014, i32 1, i32 44)
%23 = call i32 @month_day(i32 2014, i32 400, i32* %1, i32* %2)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0A%d should be 1\00"
@.str.1 = [17 x i8] c"\0A%d should be 60\00"
@.str.2 = [17 x i8] c"\0A%d should be 61\00"
@.str.3 = [23 x i8] c"\0A%d, %d should be 1, 1\00"
@.str.4 = [23 x i8] c"\0A%d, %d should be 3, 1\00"
@.str.5 = [24 x i8] c"\0A%d, %d should be 2, 29\00"
@str = [2 x i8] c"\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 2014, i32 1, i32 1)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @day_of_year(i32 2014, i32 3, i32 1)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @day_of_year(i32 2016, i32 3, i32 1)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = call i32 @month_day(i32 2014, i32 1, i32* %1, i32* %2)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %12, i32 %13)
%15 = call i32 @month_day(i32 2014, i32 60, i32* %1, i32* %2)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %17)
%19 = call i32 @month_day(i32 2016, i32 60, i32* %1, i32* %2)
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %20, i32 %21)
%23 = call i32 @day_of_year(i32 2014, i32 13, i32 1)
%24 = call i32 @day_of_year(i32 2014, i32 1, i32 44)
%25 = call i32 @month_day(i32 2014, i32 400, i32* %1, i32* %2)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}