#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int segundos;
  printf("Dados los segundos por teclado, calcular cuantas horas segundos y "
         "minutos representan");
  getchar();
  do {
    system("clear");
    printf("\n¿Cuantos segundos quieres calcular?: ");
    scanf("%d", &segundos);
  } while (segundos < 1);
  system("clear");
  printf("%d segundos son:\n\n%d horas\n", segundos, segundos / 3600);
  printf("%d minutos\n", (segundos % 3600) / 60);
  printf("%d segundos", (segundos % 3600) % 60);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xeeb(%rip),%rdi
call   1030 <system@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     1164 <main+0x24>
lea    0xeb7(%rip),%rdi
call   1030 <system@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xef2(%rip),%r14
lea    0xef1(%rip),%r15
lea    0xf12(%rip),%r12
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <system@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1180 <main+0x40>
lea    0xeab(%rip),%rdi
call   1030 <system@plt>
movslq 0x4(%rsp),%rsi
imul   $0xffffffff91a2b3c5,%rsi,%rdx
shr    $0x20,%rdx
add    %esi,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0xb,%edx
add    %eax,%edx
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xb,%ecx
add    %edx,%ecx
imul   $0xe10,%ecx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%eax
movswl %ax,%ecx
shr    $0xf,%eax
sar    $0x5,%ecx
add    %eax,%ecx
movswl %cx,%esi
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xb,%ecx
add    %edx,%ecx
imul   $0xe10,%ecx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
sar    $0x5,%edx
add    %ecx,%edx
imul   $0x3c,%edx,%ecx
sub    %ecx,%eax
movswl %ax,%esi
lea    0xe35(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [86 x i8] c"Dados los segundos por teclado, calcular cuantas horas segundos y minutos representan\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.2 = [40 x i8] c"\0A\C2\BFCuantos segundos quieres calcular?: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [28 x i8] c"%d segundos son:\0A\0A%d horas\0A\00"
@.str.5 = [12 x i8] c"%d minutos\0A\00"
@.str.6 = [12 x i8] c"%d segundos\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @getchar()
br label %5
5: ; preds = %9, %0
%6 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %5
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
br i1 %11, label %5, label %12
12: ; preds = %9
%13 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = sdiv i32 %15, 3600
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 %14, i32 %16)
%18 = load i32, i32* %2
%19 = srem i32 %18, 3600
%20 = sdiv i32 %19, 60
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %2
%23 = srem i32 %22, 3600
%24 = srem i32 %23, 60
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [86 x i8] c"Dados los segundos por teclado, calcular cuantas horas segundos y minutos representan\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.2 = [40 x i8] c"\0A\C2\BFCuantos segundos quieres calcular?: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [28 x i8] c"%d segundos son:\0A\0A%d horas\0A\00"
@.str.5 = [12 x i8] c"%d minutos\0A\00"
@.str.6 = [12 x i8] c"%d segundos\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
br label %5
5: ; preds = %5, %0
%6 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 1
br i1 %10, label %5, label %11
11: ; preds = %5
%12 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = sdiv i32 %13, 3600
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %1
%17 = srem i32 %16, 3600
%18 = trunc i32 %17 to i16
%19 = sdiv i16 %18, 60
%20 = sext i16 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
%23 = srem i32 %22, 3600
%24 = trunc i32 %23 to i16
%25 = srem i16 %24, 60
%26 = sext i16 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %26)
ret i32 0
}