#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*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int numDays, years, months, days;
  printf("Enter number of days: ");
  scanf("%d", &numDays);
  years = numDays / 365;
  months = (numDays % 365) / 30;
  days = ((numDays % 365) % 30);
  printf("%d days make %d years, %d months, %d days", numDays, years, months,
         days);
  printf("\nEnter number of years: ");
  scanf("%d", &years);
  printf("Enter number of months: ");
  scanf("%d", &months);
  printf("Enter number of days: ");
  scanf("%d", &days);
  numDays = years * 365 + months * 30 + days;
  printf("%d years, %d months, %d days make %d days", years, months, days,
         numDays);
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4c(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe10(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
imul   $0x16d,-0xc(%rbp),%eax
imul   $0x1e,-0x10(%rbp),%ecx
add    %ecx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@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    0xec0(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%r15
lea    0xc(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rsi
imul   $0xffffffffb38cf9b1,%rsi,%rdx
shr    $0x20,%rdx
add    %esi,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x8,%edx
add    %eax,%edx
mov    %edx,0x8(%rsp)
imul   $0x16d,%edx,%eax
mov    %esi,%r8d
sub    %eax,%r8d
movswl %r8w,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %r8d,%eax
movzwl %ax,%eax
movswl %ax,%edi
shr    $0xf,%eax
sar    $0x4,%edi
add    %eax,%edi
movswl %di,%ecx
mov    %ecx,0x4(%rsp)
mov    %edi,%eax
shl    $0x5,%eax
mov    %edi,%ebx
sub    %eax,%ebx
add    %edi,%ebx
add    %r8d,%ebx
movswl %bx,%r8d
mov    %r8d,(%rsp)
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%esi
imul   $0x16d,%esi,%eax
mov    0x4(%rsp),%edx
mov    %edx,%r8d
shl    $0x5,%r8d
sub    %edx,%r8d
sub    %edx,%r8d
add    %eax,%r8d
mov    (%rsp),%ecx
add    %ecx,%r8d
mov    %r8d,0xc(%rsp)
lea    0xe28(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter number of days: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"%d days make %d years, %d months, %d days\00"
@.str.3 = [25 x i8] c"\0AEnter number of years: \00"
@.str.4 = [25 x i8] c"Enter number of months: \00"
@.str.5 = [42 x i8] c"%d years, %d months, %d days make %d days\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 365
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = srem i32 %10, 365
%12 = sdiv i32 %11, 30
store i32 %12, i32* %4
%13 = load i32, i32* %2
%14 = srem i32 %13, 365
%15 = srem i32 %14, 30
store i32 %15, i32* %5
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17, i32 %18, i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%27 = load i32, i32* %3
%28 = mul nsw i32 %27, 365
%29 = load i32, i32* %4
%30 = mul nsw i32 %29, 30
%31 = add nsw i32 %28, %30
%32 = load i32, i32* %5
%33 = add nsw i32 %31, %32
store i32 %33, i32* %2
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = load i32, i32* %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %34, i32 %35, i32 %36, i32 %37)
%39 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter number of days: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"%d days make %d years, %d months, %d days\00"
@.str.3 = [25 x i8] c"\0AEnter number of years: \00"
@.str.4 = [25 x i8] c"Enter number of months: \00"
@.str.5 = [42 x i8] c"%d years, %d months, %d days make %d days\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = sdiv i32 %11, 365
store i32 %12, i32* %2
%13 = srem i32 %11, 365
%14 = trunc i32 %13 to i16
%15 = sdiv i16 %14, 30
%16 = sext i16 %15 to i32
store i32 %16, i32* %3
%17 = srem i16 %14, 30
%18 = sext i16 %17 to i32
store i32 %18, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %12, i32 %16, i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%26 = load i32, i32* %2
%27 = mul nsw i32 %26, 365
%28 = load i32, i32* %3
%29 = mul nsw i32 %28, 30
%30 = add nsw i32 %29, %27
%31 = load i32, i32* %4
%32 = add nsw i32 %30, %31
store i32 %32, i32* %1
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %26, i32 %28, i32 %31, i32 %32)
%34 = call i32 (...) @getch()
ret i32 0
}