#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 sec_hours(int);
int sec_minutes(int);
int subtraction(int, int);
int main(int argc, const char *argv[]) {
  int seconds, hours, minutes, aux1, aux2, sec;
  printf("Insira os segundos: \n");
  scanf("%d", &seconds);
  hours = sec_hours(seconds);
  aux1 = seconds - (hours * 3600);
  minutes = sec_minutes(aux1);
  aux2 = ((hours * 3600) + (minutes * 60));
  sec = subtraction(seconds, aux2);
  printf("%d segundos equivalem a %d horas, %d minutos e %d segundos \n",
         seconds, hours, minutes, sec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1050 <sec_hours@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
imul   $0xe10,-0x18(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <sec_minutes@plt>
mov    %eax,-0x1c(%rbp)
imul   $0xe10,-0x18(%rbp),%eax
imul   $0x3c,-0x1c(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1060 <subtraction@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8d
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe85(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
call   1060 <sec_hours@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%edi
imul   $0xe10,%eax,%ebx
sub    %ebx,%edi
call   1030 <sec_minutes@plt>
mov    %eax,%ebp
imul   $0x3c,%eax,%esi
add    %ebx,%esi
mov    0xc(%rsp),%edi
call   1070 <subtraction@plt>
mov    0xc(%rsp),%esi
lea    0xe46(%rip),%rdi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Insira os segundos: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [61 x i8] c"%d segundos equivalem a %d horas, %d minutos e %d segundos \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
%15 = call i32 @sec_hours(i32 %14)
store i32 %15, i32* %7
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = mul nsw i32 %17, 3600
%19 = sub nsw i32 %16, %18
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = call i32 @sec_minutes(i32 %20)
store i32 %21, i32* %8
%22 = load i32, i32* %7
%23 = mul nsw i32 %22, 3600
%24 = load i32, i32* %8
%25 = mul nsw i32 %24, 60
%26 = add nsw i32 %23, %25
store i32 %26, i32* %10
%27 = load i32, i32* %6
%28 = load i32, i32* %10
%29 = call i32 @subtraction(i32 %27, i32 %28)
store i32 %29, i32* %11
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = load i32, i32* %11
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %31, i32 %32, i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [61 x i8] c"%d segundos equivalem a %d horas, %d minutos e %d segundos \0A\00"
@str = [21 x i8] c"Insira os segundos: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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* %3)
%7 = load i32, i32* %3
%8 = call i32 @sec_hours(i32 %7)
%9 = load i32, i32* %3
%10 = mul nsw i32 %8, 3600
%11 = sub nsw i32 %9, %10
%12 = call i32 @sec_minutes(i32 %11)
%13 = mul nsw i32 %12, 60
%14 = add nsw i32 %13, %10
%15 = load i32, i32* %3
%16 = call i32 @subtraction(i32 %15, i32 %14)
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %8, i32 %12, i32 %16)
ret i32 0
}