#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 = day_of_year(2018, 8, 19);
  printf("%d\n", day);
  day = day_of_year(2018, 13, 19);
  printf("%d\n", day);
  day = day_of_year(2018, 12, 39);
  printf("%d\n", day);
  day = day_of_year(2018, 12, 0);
  printf("%d\n", day);
  int month;
  month_day(2018, 231, &month, &day);
  printf("%d, %d\n", month, day);
  month_day(2018, -1, &month, &day);
  printf("%d, %d\n", month, day);
  month_day(2018, 1234, &month, &day);
  printf("%d, %d\n", month, day);
  month_day(2018, 365, &month, &day);
  printf("%d, %d\n", month, day);
  month_day(2018, 366, &month, &day);
  printf("%d, %d\n", month, day);
  month_day(2016, 366, &month, &day);
  printf("%d, %d\n", month, day);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7e2,%edi
mov    $0x8,%esi
mov    $0x13,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xd,%esi
mov    $0x13,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xc,%esi
mov    $0x27,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xc,%esi
xor    %edx,%edx
call   1050 <day_of_year@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xe7,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xffffffff,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0x4d2,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0x16d,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0x16e,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7e0,%edi
mov    $0x16e,%esi
lea    -0xc(%rbp),%rdx
lea    -0x8(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x7e2,%edi
mov    $0x8,%esi
mov    $0x13,%edx
call   1050 <day_of_year@plt>
lea    0xeb0(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xd,%esi
mov    $0x13,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xc,%esi
mov    $0x27,%edx
call   1050 <day_of_year@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xc,%esi
xor    %edx,%edx
call   1050 <day_of_year@plt>
mov    %eax,0x8(%rsp)
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r14
mov    $0x7e2,%edi
mov    $0xe7,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe11(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0xffffffff,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0x4d2,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0x16d,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e2,%edi
mov    $0x16e,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7e0,%edi
mov    $0x16e,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <month_day@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [8 x i8] c"%d, %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 2018, i32 8, i32 19)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @day_of_year(i32 2018, i32 13, i32 19)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @day_of_year(i32 2018, i32 12, i32 39)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @day_of_year(i32 2018, i32 12, i32 0)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20)
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26)
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %29)
%31 = load i32, i32* %3
%32 = load i32, i32* %2
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [8 x i8] c"%d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @day_of_year(i32 2018, i32 8, i32 19)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @day_of_year(i32 2018, i32 13, i32 19)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @day_of_year(i32 2018, i32 12, i32 39)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @day_of_year(i32 2018, i32 12, i32 0)
store i32 %10, i32* %1
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = bitcast i32* %2 to i8*
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %2
%17 = load i32, i32* %1
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
%19 = load i32, i32* %2
%20 = load i32, i32* %1
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20)
%22 = load i32, i32* %2
%23 = load i32, i32* %1
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %1
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26)
%28 = load i32, i32* %2
%29 = load i32, i32* %1
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %29)
ret i32 0
}