#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, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int N, dia[3] = {0, 0, 0};
  scanf(" %d", &N);
  while (N > 0) {
    if (N >= 365) {
      dia[0]++;
      N -= 365;
    } else if (N >= 30) {
      dia[1]++;
      N -= 30;
    } else if (N > 0) {
      dia[2]++;
      N -= 1;
    }
  }
  printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n", dia[0], dia[1], dia[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11db <main+0xab>
cmpl   $0x16d,-0x8(%rbp)
jl     118f <main+0x5f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x16d,%eax
mov    %eax,-0x8(%rbp)
jmp    11d6 <main+0xa6>
cmpl   $0x1e,-0x8(%rbp)
jl     11b0 <main+0x80>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1e,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <main+0xa1>
cmpl   $0x0,-0x8(%rbp)
jle    11cc <main+0x9c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <main+0xa1>
jmp    11d6 <main+0xa6>
jmp    115f <main+0x2f>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe19(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1188 <main+0x68>
xor    %ecx,%ecx
xor    %edx,%edx
xor    %esi,%esi
jmp    1160 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%esi
add    $0xfffffe93,%eax
mov    %eax,0x4(%rsp)
test   %eax,%eax
je     118e <main+0x6e>
cmp    $0x16d,%eax
jae    1150 <main+0x30>
cmp    $0x1e,%eax
jb     1180 <main+0x60>
add    $0x1,%edx
add    $0xffffffe2,%eax
jmp    1158 <main+0x38>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ecx
add    $0xffffffff,%eax
jmp    1158 <main+0x38>
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %d\00"
@.str.1 = [32 x i8] c"%d ano(s)\0A%d mes(es)\0A%d dia(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
store i32 0, i32* %1
%4 = bitcast [3 x i32]* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %38, %0
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %39
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp sge i32 %10, 365
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 365
store i32 %17, i32* %2
br label %38
18: ; preds = %9
%19 = load i32, i32* %2
%20 = icmp sge i32 %19, 30
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 30
store i32 %26, i32* %2
br label %37
27: ; preds = %18
%28 = load i32, i32* %2
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
store i32 %33, i32* %31
%34 = load i32, i32* %2
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %2
br label %36
36: ; preds = %30, %27
br label %37
37: ; preds = %36, %21
br label %38
38: ; preds = %37, %12
br label %6
39: ; preds = %6
%40 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%41 = load i32, i32* %40
%42 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%43 = load i32, i32* %42
%44 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%45 = load i32, i32* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %41, i32 %43, i32 %45)
ret i32 0
}

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