int main(int argc, char *argv[]) {
  int year, day, month, yearday;
  printf("test day_of_year, input a year, month and day of month:\n");
  scanf("%d %d %d", &year, &month, &day);
  printf("the day of year is: %d\n", day_of_year(year, month, day));
  printf("testing month_day, input a year and day of year:\n");
  scanf("%d %d", &year, &yearday);
  month_day(year, yearday, &month, &day);
  printf("the month is %d, day of month is %d\n", month, day);
  printf("the name of month is: '%s'\n", month_name(month));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1050 <day_of_year@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe79(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
lea    -0x1c(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1030 <month_day@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    $0x0,%al
call   1070 <month_name@plt>
mov    %eax,%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rsp,%r15
lea    0x4(%rsp),%r14
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x8(%rsp),%edi
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
xor    %eax,%eax
call   1060 <day_of_year@plt>
lea    0xe57(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe35(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <month_day@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe21(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%edi
xor    %eax,%eax
call   1080 <month_name@plt>
lea    0xe2e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [57 x i8] c"test day_of_year, input a year, month and day of month:\0A\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [24 x i8] c"the day of year is: %d\0A\00"
@.str.3 = [50 x i8] c"testing month_day, input a year and day of year:\0A\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [37 x i8] c"the month is %d, day of month is %d\0A\00"
@.str.6 = [28 x i8] c"the name of month is: '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %8, i32* %7)
%12 = load i32, i32* %6
%13 = load i32, i32* %8
%14 = load i32, i32* %7
%15 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @day_of_year to i32 (i32, i32, i32, ...)*)(i32 %12, i32 %13, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %6, i32* %9)
%19 = load i32, i32* %6
%20 = load i32, i32* %9
%21 = call i32 (i32, i32, i32*, i32*, ...) bitcast (i32 (...)* @month_day to i32 (i32, i32, i32*, i32*, ...)*)(i32 %19, i32 %20, i32* %8, i32* %7)
%22 = load i32, i32* %8
%23 = load i32, i32* %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %22, i32 %23)
%25 = load i32, i32* %8
%26 = call i32 (i32, ...) bitcast (i32 (...)* @month_name to i32 (i32, ...)*)(i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [24 x i8] c"the day of year is: %d\0A\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [37 x i8] c"the month is %d, day of month is %d\0A\00"
@.str.6 = [28 x i8] c"the name of month is: '%s'\0A\00"
@str = [56 x i8] c"test day_of_year, input a year, month and day of month:\00"
@str.7 = [49 x i8] c"testing month_day, input a year and day of year:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %5, i32* %4)
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @day_of_year to i32 (i32, i32, i32, ...)*)(i32 %13, i32 %14, i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.7, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %6)
%20 = load i32, i32* %3
%21 = load i32, i32* %6
%22 = call i32 (i32, i32, i32*, i32*, ...) bitcast (i32 (...)* @month_day to i32 (i32, i32, i32*, i32*, ...)*)(i32 %20, i32 %21, i32* %5, i32* %4)
%23 = load i32, i32* %5
%24 = load i32, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %5
%27 = call i32 (i32, ...) bitcast (i32 (...)* @month_name to i32 (i32, ...)*)(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %27)
ret i32 0
}