#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 main() {
  int month, day, yearday, ret;
  ret = day_of_year(2015, 13, 1);
  printf("13th month exists? %d\n", ret);
  ret = day_of_year(2015, 1, 32);
  printf("32nd day exists? %d\n", ret);
  month_day(2015, 370, &month, &day);
  printf("370th yearday exists? day = %d, month = %d\n", day, month);
  ret = day_of_year(1981, 1, 1);
  printf("1st day of 1st month exists? %d\n", ret);
  ret = day_of_year(2015, 12, 31);
  printf("31st of 12th month exists? %d\n", ret);
  month_day(2015, 90, &month, &day);
  printf("90th day of year exists? day = %d, month = %d\n", day, month);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7df,%edi
mov    $0xd,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7df,%edi
mov    $0x1,%esi
mov    $0x20,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7df,%edi
mov    $0x172,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7bd,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1050 <day_of_year@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7df,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7df,%edi
mov    $0x5a,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x7df,%edi
mov    $0xd,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7df,%edi
mov    $0x1,%esi
mov    $0x20,%edx
call   1050 <day_of_year@plt>
lea    0xea4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    $0x7df,%edi
mov    $0x172,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7bd,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1050 <day_of_year@plt>
lea    0xe8f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7df,%edi
mov    $0xc,%esi
mov    $0x1f,%edx
call   1050 <day_of_year@plt>
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7df,%edi
mov    $0x5a,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"13th month exists? %d\0A\00"
@.str.1 = [21 x i8] c"32nd day exists? %d\0A\00"
@.str.2 = [44 x i8] c"370th yearday exists? day = %d, month = %d\0A\00"
@.str.3 = [33 x i8] c"1st day of 1st month exists? %d\0A\00"
@.str.4 = [31 x i8] c"31st of 12th month exists? %d\0A\00"
@.str.5 = [47 x i8] c"90th day of year exists? day = %d, month = %d\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
%6 = call i32 @day_of_year(i32 2015, i32 13, i32 1)
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @day_of_year(i32 2015, i32 1, i32 32)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 @month_day(i32 2015, i32 370, i32* %2, i32* %3)
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14)
%16 = call i32 @day_of_year(i32 1981, i32 1, i32 1)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = call i32 @day_of_year(i32 2015, i32 12, i32 31)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i32 @month_day(i32 2015, i32 90, i32* %2, i32* %3)
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"13th month exists? %d\0A\00"
@.str.1 = [21 x i8] c"32nd day exists? %d\0A\00"
@.str.2 = [44 x i8] c"370th yearday exists? day = %d, month = %d\0A\00"
@.str.3 = [33 x i8] c"1st day of 1st month exists? %d\0A\00"
@.str.4 = [31 x i8] c"31st of 12th month exists? %d\0A\00"
@.str.5 = [47 x i8] c"90th day of year exists? day = %d, month = %d\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 2015, i32 13, i32 1)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @day_of_year(i32 2015, i32 1, i32 32)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @month_day(i32 2015, i32 370, i32* %1, i32* %2)
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %11)
%13 = call i32 @day_of_year(i32 1981, i32 1, i32 1)
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = call i32 @day_of_year(i32 2015, i32 12, i32 31)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = call i32 @month_day(i32 2015, i32 90, i32* %1, i32* %2)
%18 = load i32, i32* %2
%19 = load i32, i32* %1
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %18, i32 %19)
ret i32 0
}