#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 time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int time(int /*<<< orphan*/ *);
int main() {
  time_t seconds;
  seconds = time(NULL);
  printf("Horas desde 1 de Janeiro de 1970 = %ld\n", seconds / 3600);
  printf("Dias desde 1 de Janeiro de 1970 = %ld\n", (seconds / 3600) / 24);
  printf("Anos desde 1 de Janeiro de 1970 = %ld\n",
         ((seconds / 3600) / 24) / 365);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1040 <time@plt>
movslq %eax,%rbx
imul   $0xffffffff91a2b3c5,%rbx,%rsi
shr    $0x20,%rsi
add    %ebx,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0xb,%esi
add    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
imul   $0xffffffffc22e4507,%rbx,%rsi
shr    $0x20,%rsi
add    %ebx,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x10,%esi
add    %eax,%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
imul   $0x4418a47b,%rbx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x37,%rsi
add    %eax,%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Horas desde 1 de Janeiro de 1970 = %ld\0A\00"
@.str.1 = [39 x i8] c"Dias desde 1 de Janeiro de 1970 = %ld\0A\00"
@.str.2 = [39 x i8] c"Anos desde 1 de Janeiro de 1970 = %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 3600
%6 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 3600
%9 = sdiv i32 %8, 24
%10 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 3600
%13 = sdiv i32 %12, 24
%14 = sdiv i32 %13, 365
%15 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Horas desde 1 de Janeiro de 1970 = %ld\0A\00"
@.str.1 = [39 x i8] c"Dias desde 1 de Janeiro de 1970 = %ld\0A\00"
@.str.2 = [39 x i8] c"Anos desde 1 de Janeiro de 1970 = %ld\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = sdiv i32 %1, 3600
%3 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = sdiv i32 %1, 86400
%5 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = sdiv i32 %1, 31536000
%7 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}