#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*/ getchar();
int /*<<< orphan*/ month_day(int, int, int *, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(void) {
  int day = 31;
  int mon = 3;
  int year = 2016;
  int dayOfYear = 0;
  dayOfYear = day_of_year(year, mon, day);
  printf("%02d/%02d/%d, day of year: %d\n", day, mon, year, dayOfYear);
  ++dayOfYear;
  month_day(year, dayOfYear, &mon, &day);
  printf("%02d/%02d/%d, day of year: %d\n", day, mon, year, dayOfYear);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x7e0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1060 <day_of_year@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x1f,0x4(%rsp)
movl   $0x3,(%rsp)
mov    $0x7e0,%edi
mov    $0x3,%esi
mov    $0x1f,%edx
call   1060 <day_of_year@plt>
mov    %eax,%ebx
lea    0xe90(%rip),%r14
mov    %r14,%rdi
mov    $0x1f,%esi
mov    $0x3,%edx
mov    $0x7e0,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
add    $0x1,%ebx
mov    %rsp,%rdx
lea    0x4(%rsp),%rcx
mov    $0x7e0,%edi
mov    %ebx,%esi
call   1030 <month_day@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %r14,%rdi
mov    $0x7e0,%ecx
mov    %ebx,%r8d
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"%02d/%02d/%d, day of year: %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
store i32 31, i32* %2
store i32 3, i32* %3
store i32 2016, i32* %4
store i32 0, 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* %5
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @month_day(i32 %17, i32 %18, i32* %3, i32* %2)
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21, i32 %22, i32 %23)
%25 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"%02d/%02d/%d, day of year: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 31, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 3, i32* %2
%5 = tail call i32 @day_of_year(i32 2016, i32 3, i32 31)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 31, i32 3, i32 2016, i32 %5)
%7 = add nsw i32 %5, 1
%8 = call i32 @month_day(i32 2016, i32 %7, i32* %2, i32* %1)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 2016, i32 %7)
%12 = call i32 (...) @getchar()
ret i32 0
}