#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 ano, mes, dia;
  printf("Me diga uma quantidade qualquer de dias e eu converto isso em anos, "
         "meses e o resto que sobrar em dias\n");
  scanf("%d", &dia);
  ano = dia / 365;
  dia = dia - ano * 365;
  mes = dia / 30;
  dia = dia - mes * 30;
  printf("Voce me deu %d anos, %d meses e %d dias!\n", ano, mes, dia);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf24(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
imul   $0x16d,-0x8(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
imul   $0x1e,-0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0xffffffffb38cf9b1,%rax,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0x8,%esi
add    %ecx,%esi
imul   $0xfffffe93,%esi,%ecx
add    %eax,%ecx
movslq %ecx,%rax
imul   $0xffffffff88888889,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0x4,%edx
add    %ecx,%edx
imul   $0xffffffe2,%edx,%ecx
add    %eax,%ecx
mov    %ecx,0x4(%rsp)
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [104 x i8] c"Me diga uma quantidade qualquer de dias e eu converto isso em anos, meses e o resto que sobrar em dias\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"Voce me deu %d anos, %d meses e %d dias!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 365
store i32 %8, i32* %2
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = mul nsw i32 %10, 365
%12 = sub nsw i32 %9, %11
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = sdiv i32 %13, 30
store i32 %14, i32* %3
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = mul nsw i32 %16, 30
%18 = sub nsw i32 %15, %17
store i32 %18, i32* %4
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %20, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"Voce me deu %d anos, %d meses e %d dias!\0A\00"
@str = [103 x i8] c"Me diga uma quantidade qualquer de dias e eu converto isso em anos, meses e o resto que sobrar em dias\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 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 = mul nsw i32 %6, -365
%8 = add i32 %7, %5
%9 = sdiv i32 %8, 30
%10 = mul nsw i32 %9, -30
%11 = add i32 %10, %8
store i32 %11, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %9, i32 %11)
ret i32 0
}