#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 */
typedef int int16_t;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int16_t t, a = 0, m = 0, d = 0;
  while (scanf("%d", &t) != EOF) {
    if (t >= 365) {
      a = t / 365;
      t %= 365;
    }
    if (t >= 30) {
      m = t / 30;
      t %= 30;
    }
    d = t;
    printf("%d ano(s)\n", a);
    printf("%d mes(es)\n", m);
    printf("%d dia(s)\n", d);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e8d(%rip),%rcx
cmp    (%rcx),%rax
je     11eb <main+0xcb>
cmpl   $0x16d,-0x8(%rbp)
jl     118d <main+0x6d>
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,-0x8(%rbp)
cmpl   $0x1e,-0x8(%rbp)
jl     11b3 <main+0x93>
mov    -0x8(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2ea5(%rip),%r12
cmp    (%r12),%rax
jne    115a <main+0x3a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
lea    0xe9d(%rip),%r13
lea    0x4(%rsp),%rbx
xor    %r15d,%r15d
jmp    11ad <main+0x8d>
nopl   (%rax)
lea    0xe8c(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    (%r12),%rax
je     1149 <main+0x29>
mov    0x4(%rsp),%r14d
cmp    $0x16d,%r14d
jl     11e8 <main+0xc8>
mov    %r14d,%eax
imul   $0x6719f361,%rax,%rax
shr    $0x20,%rax
mov    %r14d,%r15d
sub    %eax,%r15d
shr    %r15d
add    %eax,%r15d
shr    $0x8,%r15d
imul   $0x16d,%r15d,%eax
sub    %eax,%r14d
mov    %r14d,0x4(%rsp)
cmp    $0x1e,%r14d
jl     1170 <main+0x50>
movzwl %r14w,%eax
imul   $0x8889,%eax,%ebp
shr    $0x14,%ebp
mov    %ebp,%eax
shl    $0x5,%eax
mov    %ebp,%ecx
sub    %eax,%ecx
add    %ebp,%ecx
add    %r14d,%ecx
movzwl %cx,%r14d
mov    %r14d,0x4(%rsp)
jmp    1170 <main+0x50>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [11 x i8] c"%d ano(s)\0A\00"
@.str.2 = [12 x i8] c"%d mes(es)\0A\00"
@.str.3 = [11 x i8] c"%d dia(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %26, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %34
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp sge i32 %11, 365
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sdiv i32 %14, 365
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = srem i32 %16, 365
store i32 %17, i32* %2
br label %18
18: ; preds = %13, %10
%19 = load i32, i32* %2
%20 = icmp sge i32 %19, 30
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i32, i32* %2
%23 = sdiv i32 %22, 30
store i32 %23, i32* %4
%24 = load i32, i32* %2
%25 = srem i32 %24, 30
store i32 %25, i32* %2
br label %26
26: ; preds = %21, %18
%27 = load i32, i32* %2
store i32 %27, i32* %5
%28 = load i32, i32* %3
%29 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %4
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %5
%33 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %6
34: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [11 x i8] c"%d ano(s)\0A\00"
@.str.2 = [12 x i8] c"%d mes(es)\0A\00"
@.str.3 = [11 x i8] c"%d dia(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %33, label %6
6: ; preds = %0, %24
%7 = phi i32 [ %26, %24 ], [ 0, %0 ]
%8 = phi i32 [ %16, %24 ], [ 0, %0 ]
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 364
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = udiv i32 %9, 365
%13 = urem i32 %9, 365
store i32 %13, i32* %1
br label %14
14: ; preds = %11, %6
%15 = phi i32 [ %13, %11 ], [ %9, %6 ]
%16 = phi i32 [ %12, %11 ], [ %8, %6 ]
%17 = icmp sgt i32 %15, 29
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = trunc i32 %15 to i16
%20 = udiv i16 %19, 30
%21 = zext i16 %20 to i32
%22 = urem i16 %19, 30
%23 = zext i16 %22 to i32
store i32 %23, i32* %1
br label %24
24: ; preds = %18, %14
%25 = phi i32 [ %23, %18 ], [ %15, %14 ]
%26 = phi i32 [ %21, %18 ], [ %7, %14 ]
%27 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%28 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%29 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%30 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%31 = load i64, i64* @EOF
%32 = icmp eq i64 %30, %31
br i1 %32, label %33, label %6
33: ; preds = %24, %0
ret i32 0
}