#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 getnumber();
int /*<<< orphan*/ month_day(int, int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char *monthss[] = {"0",       "January",  "February", "March",  "April",
                     "May",     "June",     "July",     "August", "September",
                     "October", "November", "December"};
  int month, day;
  int y, m, d;
  printf("Calculation of day of the year based on: year, month and day\n");
  printf("Enter year:\n");
  y = getnumber();
  printf("Enter month:\n");
  m = getnumber();
  printf("Enter day:\n");
  d = getnumber();
  printf("For the day %d of the month %s of the year %d, Day of the year is %d "
         "\n\n",
         d, monthss[m], y, day_of_year(y, m, d));
  printf("Calculation of day and month based on: day of the year and year\n");
  printf("Enter year:\n");
  y = getnumber();
  printf("Enter day of the year:\n");
  d = getnumber();
  month_day(y, d, &month, &day);
  printf(
      "For the year: %d and day of the year:%d the month and the day is: %d %s",
      y, d, day, monthss[month]);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c33(%rip),%rsi
mov    $0x68,%edx
call   1070 <memcpy@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getnumber@plt>
mov    %eax,-0x7c(%rbp)
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getnumber@plt>
mov    %eax,-0x80(%rbp)
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getnumber@plt>
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x94(%rbp)
movslq -0x80(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    %rax,-0x90(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x7c(%rbp),%edi
mov    -0x80(%rbp),%esi
mov    -0x84(%rbp),%edx
call   1080 <day_of_year@plt>
mov    -0x94(%rbp),%esi
mov    -0x90(%rbp),%rdx
mov    -0x88(%rbp),%ecx
mov    %eax,%r8d
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getnumber@plt>
mov    %eax,-0x7c(%rbp)
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getnumber@plt>
mov    %eax,-0x84(%rbp)
mov    -0x7c(%rbp),%edi
mov    -0x84(%rbp),%esi
lea    -0x74(%rbp),%rdx
lea    -0x78(%rbp),%rcx
call   1030 <month_day@plt>
mov    -0x7c(%rbp),%esi
mov    -0x84(%rbp),%edx
mov    -0x78(%rbp),%ecx
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%r8
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xf75(%rip),%rdi
call   1030 <puts@plt>
lea    0xffe(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getnumber@plt>
mov    %eax,%r15d
lea    0xf8d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getnumber@plt>
mov    %eax,%ebx
lea    0xf85(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getnumber@plt>
mov    %eax,%ebp
movslq %ebx,%rsi
lea    0x2beb(%rip),%r12
mov    (%r12,%rsi,8),%rbx
mov    %r15d,%edi
mov    %eax,%edx
call   1080 <day_of_year@plt>
lea    0xe7e(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf4a(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getnumber@plt>
mov    %eax,%ebx
lea    0xf79(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getnumber@plt>
mov    %eax,%ebp
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <month_day@plt>
mov    0x8(%rsp),%ecx
movslq 0xc(%rsp),%rax
mov    (%r12,%rax,8),%r8
lea    0xe5b(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [8 x i8] c"January\00"
@.str.2 = [9 x i8] c"February\00"
@.str.3 = [6 x i8] c"March\00"
@.str.4 = [6 x i8] c"April\00"
@.str.5 = [4 x i8] c"May\00"
@.str.6 = [5 x i8] c"June\00"
@.str.7 = [5 x i8] c"July\00"
@.str.8 = [7 x i8] c"August\00"
@.str.9 = [10 x i8] c"September\00"
@.str.10 = [8 x i8] c"October\00"
@.str.11 = [9 x i8] c"November\00"
@.str.12 = [9 x i8] c"December\00"
@__const.main.monthss = [13 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i32 0, i32 0)]
@.str.13 = [62 x i8] c"Calculation of day of the year based on: year, month and day\0A\00"
@.str.14 = [13 x i8] c"Enter year:\0A\00"
@.str.15 = [14 x i8] c"Enter month:\0A\00"
@.str.16 = [12 x i8] c"Enter day:\0A\00"
@.str.17 = [72 x i8] c"For the day %d of the month %s of the year %d, Day of the year is %d \0A\0A\00"
@.str.18 = [65 x i8] c"Calculation of day and month based on: day of the year and year\0A\00"
@.str.19 = [24 x i8] c"Enter day of the year:\0A\00"
@.str.20 = [72 x i8] c"For the year: %d and day of the year:%d the month and the day is: %d %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8*]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [13 x i8*]* %2 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.13, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%11 = call i32 (...) @getnumber()
store i32 %11, i32* %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0))
%13 = call i32 (...) @getnumber()
store i32 %13, i32* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
%15 = call i32 (...) @getnumber()
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = load i32, i32* %5
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 @day_of_year(i32 %22, i32 %23, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.17, i64 0, i64 0), i32 %16, i8* %20, i32 %21, i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.18, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%29 = call i32 (...) @getnumber()
store i32 %29, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.19, i64 0, i64 0))
%31 = call i32 (...) @getnumber()
store i32 %31, i32* %7
%32 = load i32, i32* %5
%33 = load i32, i32* %7
%34 = call i32 @month_day(i32 %32, i32 %33, i32* %3, i32* %4)
%35 = load i32, i32* %5
%36 = load i32, i32* %7
%37 = load i32, i32* %4
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.20, i64 0, i64 0), i32 %35, i32 %36, i32 %37, i8* %41)
%43 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [8 x i8] c"January\00"
@.str.2 = [9 x i8] c"February\00"
@.str.3 = [6 x i8] c"March\00"
@.str.4 = [6 x i8] c"April\00"
@.str.5 = [4 x i8] c"May\00"
@.str.6 = [5 x i8] c"June\00"
@.str.7 = [5 x i8] c"July\00"
@.str.8 = [7 x i8] c"August\00"
@.str.9 = [10 x i8] c"September\00"
@.str.10 = [8 x i8] c"October\00"
@.str.11 = [9 x i8] c"November\00"
@.str.12 = [9 x i8] c"December\00"
@__const.main.monthss = [13 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i32 0, i32 0)]
@.str.17 = [72 x i8] c"For the day %d of the month %s of the year %d, Day of the year is %d \0A\0A\00"
@.str.20 = [72 x i8] c"For the year: %d and day of the year:%d the month and the day is: %d %s\00"
@str = [61 x i8] c"Calculation of day of the year based on: year, month and day\00"
@str.22 = [13 x i8] c"Enter month:\00"
@str.23 = [11 x i8] c"Enter day:\00"
@str.24 = [64 x i8] c"Calculation of day and month based on: day of the year and year\00"
@str.25 = [12 x i8] c"Enter year:\00"
@str.26 = [23 x i8] c"Enter day of the year:\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.25, i64 0, i64 0))
%7 = tail call i32 (...) @getnumber()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.22, i64 0, i64 0))
%9 = tail call i32 (...) @getnumber()
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.23, i64 0, i64 0))
%11 = tail call i32 (...) @getnumber()
%12 = sext i32 %9 to i64
%13 = getelementptr inbounds [13 x i8*], [13 x i8*]* @__const.main.monthss, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @day_of_year(i32 %7, i32 %9, i32 %11)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.17, i64 0, i64 0), i32 %11, i8* %14, i32 %7, i32 %15)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.24, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.25, i64 0, i64 0))
%19 = tail call i32 (...) @getnumber()
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0))
%21 = tail call i32 (...) @getnumber()
%22 = call i32 @month_day(i32 %19, i32 %21, i32* %1, i32* %2)
%23 = load i32, i32* %2
%24 = load i32, i32* %1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [13 x i8*], [13 x i8*]* @__const.main.monthss, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.20, i64 0, i64 0), i32 %19, i32 %21, i32 %23, i8* %27)
%29 = call i32 (...) @getchar()
ret i32 0
}