#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int day, year, month, remDays;
  printf("Enter a number of days: ");
  scanf("%d", &day);
  year = day / 365;
  remDays = day % 365;
  month = remDays / 30;
  day = remDays % 30;
  printf("\n Year: %d, Month: %d, Day: %d", year, month, day);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%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,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%r8
imul   $0xffffffffb38cf9b1,%r8,%rsi
shr    $0x20,%rsi
add    %r8d,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0x8,%esi
add    %ecx,%esi
imul   $0x16d,%esi,%ecx
sub    %ecx,%r8d
movswl %r8w,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %r8d,%ecx
movzwl %cx,%ecx
movswl %cx,%eax
shr    $0xf,%ecx
sar    $0x4,%eax
add    %ecx,%eax
movswl %ax,%edx
mov    %eax,%ecx
shl    $0x5,%ecx
mov    %eax,%edi
sub    %ecx,%edi
add    %eax,%edi
add    %r8d,%edi
movswl %di,%ecx
mov    %ecx,0x4(%rsp)
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter a number of days: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"\0A Year: %d, Month: %d, Day: %d\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 ([25 x i8], [25 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
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = sdiv i32 %12, 30
store i32 %13, i32* %4
%14 = load i32, i32* %5
%15 = srem i32 %14, 30
store i32 %15, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter a number of days: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"\0A Year: %d, Month: %d, Day: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = sdiv i32 %5, 365
%7 = srem i32 %5, 365
%8 = trunc i32 %7 to i16
%9 = sdiv i16 %8, 30
%10 = sext i16 %9 to i32
%11 = srem i16 %8, 30
%12 = sext i16 %11 to i32
store i32 %12, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %10, i32 %12)
ret i32 0
}