#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 month_day(int, int, int *, int *);
char *month_name(int);
int /*<<< orphan*/ printf(char *, int, ...);
int main(void) {
  int day;
  int month;
  int year;
  int year_day;
  day = 13;
  month = 10;
  year = 1984;
  year_day = 287;
  if ((day = day_of_year(year, month, day)) != -1)
    printf("%i\n", day);
  if (month_day(year, year_day, &month, &day) != -1)
    printf("%i %s %i\n", day, month_name(month), year);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x7c0,-0x10(%rbp)
movl   $0x11f,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
je     1196 <main+0x56>
mov    -0x8(%rbp),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
cmp    $0xffffffff,%eax
je     11d7 <main+0x97>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <month_name@plt>
mov    -0x18(%rbp),%esi
mov    %rax,%rdx
mov    -0x10(%rbp),%ecx
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0x8(%rsp)
mov    $0x7c0,%edi
mov    $0xa,%esi
mov    $0xd,%edx
call   1050 <day_of_year@plt>
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
je     117a <main+0x3a>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    $0x7c0,%edi
mov    $0x11f,%esi
call   1030 <month_day@plt>
cmp    $0xffffffff,%eax
je     11bd <main+0x7d>
mov    0xc(%rsp),%ebx
mov    0x8(%rsp),%edi
call   1060 <month_name@plt>
lea    0xe54(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
mov    $0x7c0,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [10 x i8] c"%i %s %i\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 13, i32* %2
store i32 10, i32* %3
store i32 1984, i32* %4
store i32 287, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = call i32 @day_of_year(i32 %6, i32 %7, i32 %8)
store i32 %9, i32* %2
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32, i32* %2
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %0
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32 @month_day(i32 %15, i32 %16, i32* %3, i32* %2)
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = call i8* @month_name(i32 %21)
%23 = load i32, i32* %4
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8* %22, i32 %23)
br label %25
25: ; preds = %19, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [10 x i8] c"%i %s %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 10, i32* %2
%5 = tail call i32 @day_of_year(i32 1984, i32 10, i32 13)
store i32 %5, i32* %1
%6 = icmp eq i32 %5, -1
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %9
9: ; preds = %7, %0
%10 = call i32 @month_day(i32 1984, i32 287, i32* %2, i32* %1)
%11 = icmp eq i32 %10, -1
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i8* @month_name(i32 %14)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %13, i8* %15, i32 1984)
br label %17
17: ; preds = %12, %9
ret i32 0
}