#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(void) {
  int ret = 0;
  int year = 2000;
  int month = 5;
  int day = 5;
  int yearday = 0;
  int pmonth = 0, pday = 0;
  yearday = day_of_year(year, month, day);
  printf("\nThe day of the year for %d-%d-%d is %d\n", day, month, year,
         yearday);
  month_day(year, yearday, &pmonth, &pday);
  printf("\nFor the yearday %d the day is %d and the month is %d\n", yearday,
         pmonth, pday);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x7d0,-0xc(%rbp)
movl   $0x5,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x7d0,%edi
mov    $0x5,%esi
mov    $0x5,%edx
call   1050 <day_of_year@plt>
mov    %eax,%ebx
lea    0xe9e(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    $0x7d0,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    $0x7d0,%edi
mov    %ebx,%esi
call   1030 <month_day@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xe89(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\0AThe day of the year for %d-%d-%d is %d\0A\00"
@.str.1 = [55 x i8] c"\0AFor the yearday %d the day is %d and the month is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 2000, i32* %3
store i32 5, i32* %4
store i32 5, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = call i32 @day_of_year(i32 %9, i32 %10, i32 %11)
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = load i32, i32* %6
%17 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %3
%19 = load i32, i32* %6
%20 = call i32 @month_day(i32 %18, i32 %19, i32* %7, i32* %8)
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [41 x i8] c"\0AThe day of the year for %d-%d-%d is %d\0A\00"
@.str.1 = [55 x i8] c"\0AFor the yearday %d the day is %d and the month is %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 2000, i32 5, i32 5)
%6 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 5, i32 5, i32 2000, i32 %5)
%7 = call i32 @month_day(i32 2000, i32 %5, i32* %1, i32* %2)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %8, i32 %9)
ret i32 0
}