#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 /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int day_of_year(int, int, int);
  void month_day(int, int, int *, int *);
  int day, month;
  day = day_of_year(1982, 2, 21);
  printf("Feb 21, 1982 was the %d day of the year\n", day);
  month_day(2014, 137, &month, &day);
  printf("The 137th day of 2014 is day %d of month %d\n", day, month);
  day_of_year(1920, 14, 5);
  day_of_year(1991, 2, 29);
  day_of_year(1992, 2, 29);
  month_day(2012, 366, &month, &day);
  month_day(2013, 366, &month, &day);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7be,%edi
mov    $0x2,%esi
mov    $0x15,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7de,%edi
mov    $0x89,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x780,%edi
mov    $0xe,%esi
mov    $0x5,%edx
call   1050 <day_of_year@plt>
mov    $0x7c7,%edi
mov    $0x2,%esi
mov    $0x1d,%edx
call   1050 <day_of_year@plt>
mov    $0x7c8,%edi
mov    $0x2,%esi
mov    $0x1d,%edx
call   1050 <day_of_year@plt>
mov    $0x7dc,%edi
mov    $0x16e,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    $0x7dd,%edi
mov    $0x16e,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x7be,%edi
mov    $0x2,%esi
mov    $0x15,%edx
call   1050 <day_of_year@plt>
mov    %eax,(%rsp)
lea    0xeae(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    $0x7de,%edi
mov    $0x89,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x780,%edi
mov    $0xe,%esi
mov    $0x5,%edx
call   1050 <day_of_year@plt>
mov    $0x7c7,%edi
mov    $0x2,%esi
mov    $0x1d,%edx
call   1050 <day_of_year@plt>
mov    $0x7c8,%edi
mov    $0x2,%esi
mov    $0x1d,%edx
call   1050 <day_of_year@plt>
mov    $0x7dc,%edi
mov    $0x16e,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    $0x7dd,%edi
mov    $0x16e,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Feb 21, 1982 was the %d day of the year\0A\00"
@.str.1 = [45 x i8] c"The 137th day of 2014 is day %d of month %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @day_of_year(i32 1982, i32 2, i32 21)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
%10 = call i32 @day_of_year(i32 1920, i32 14, i32 5)
%11 = call i32 @day_of_year(i32 1991, i32 2, i32 29)
%12 = call i32 @day_of_year(i32 1992, i32 2, i32 29)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Feb 21, 1982 was the %d day of the year\0A\00"
@.str.1 = [45 x i8] c"The 137th day of 2014 is day %d of 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 1982, i32 2, i32 21)
store i32 %5, i32* %1
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
%10 = call i32 @day_of_year(i32 1920, i32 14, i32 5)
%11 = call i32 @day_of_year(i32 1991, i32 2, i32 29)
%12 = call i32 @day_of_year(i32 1992, i32 2, i32 29)
ret i32 0
}