#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 tempo1, hh, mm, ss;
  printf("Sou um relogio inteligente, converto de segundos para hora, minuto e "
         "segundos \n");
  printf("Digite quantos segundos eu tenho e vamos brincar!\n");
  scanf("%i", &tempo1);
  hh = tempo1 / 3600;
  tempo1 = tempo1 - hh * 3600;
  mm = tempo1 / 60;
  tempo1 = tempo1 - mm * 60;
  ss = tempo1;
  printf("Voce me deu %d horas, %d minutos e %d segundos", hh, mm, ss);
  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    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf31(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   $0xe10,-0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
imul   $0x3c,-0x10(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xede(%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    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3d(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0xffffffff91a2b3c5,%rax,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0xb,%esi
add    %ecx,%esi
imul   $0xfffff1f0,%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    $0x5,%edx
add    %ecx,%edx
imul   $0xffffffc4,%edx,%ecx
add    %eax,%ecx
mov    %ecx,0x4(%rsp)
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [80 x i8] c"Sou um relogio inteligente, converto de segundos para hora, minuto e segundos \0A\00"
@.str.1 = [51 x i8] c"Digite quantos segundos eu tenho e vamos brincar!\0A\00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [47 x i8] c"Voce me deu %d horas, %d minutos e %d segundos\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 ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 3600
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = mul nsw i32 %12, 3600
%14 = sub nsw i32 %11, %13
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = sdiv i32 %15, 60
store i32 %16, i32* %4
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = mul nsw i32 %18, 60
%20 = sub nsw i32 %17, %19
store i32 %20, i32* %2
%21 = load i32, i32* %2
store i32 %21, i32* %5
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [47 x i8] c"Voce me deu %d horas, %d minutos e %d segundos\00"
@str = [79 x i8] c"Sou um relogio inteligente, converto de segundos para hora, minuto e segundos \00"
@str.4 = [50 x i8] c"Digite quantos segundos eu tenho e vamos brincar!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.4, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = sdiv i32 %6, 3600
%8 = mul nsw i32 %7, -3600
%9 = add i32 %8, %6
%10 = sdiv i32 %9, 60
%11 = mul nsw i32 %10, -60
%12 = add i32 %11, %9
store i32 %12, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %7, i32 %10, i32 %12)
ret i32 0
}