#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*/ main();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int seg() {
  int segundos;
  float min, horas, dias;
  printf("Este programa le permite pasar de segundos a minutos,\n");
  printf("horas o dias\n\n");
  printf("Escriba cuantos segundos quiere convertir y pulse ENTER: ");
  scanf("%d", &segundos);
  if (segundos < 0) {
    printf("Error! El numero de segundos debe ser positivo.\n");
    printf("Saliendo del programa.\n");
  } else {
    min = (float)segundos / 60;
    horas = (float)segundos / 3600;
    dias = (float)segundos / 86400;
    printf("%d segundos equivalen a %.3f minutos.\n", segundos, min);
    printf("%d segundos equivalen a %.3f horas.\n", segundos, horas);
    printf("%d segundos equivalen a %.3f dias.\n", segundos, dias);
  }
  system("pause");
  system("cls");
  main();
}


x86 assembly (clang, -O0):
<seg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf13(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11ad <seg+0x6d>
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123d <seg+0xfd>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  0xe4e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  0xe34(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  0xe1a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xee3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeee(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
call   1030 <system@plt>
lea    0xefe(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1050 <main@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seg>:
sub    $0x18,%rsp
lea    0xf68(%rip),%rdi
call   1030 <puts@plt>
lea    0xf92(%rip),%rdi
call   1030 <puts@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
js     120d <seg+0xbd>
cvtsi2ss %esi,%xmm1
movaps %xmm1,%xmm0
divss  0xe5e(%rip),%xmm0
movaps %xmm1,%xmm2
divss  0xe57(%rip),%xmm2
movss  %xmm2,0x10(%rsp)
divss  0xe4d(%rip),%xmm1
movss  %xmm1,0x14(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe7d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe88(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    1225 <seg+0xd5>
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%rdi
call   1040 <system@plt>
lea    0xe87(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1060 <main@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Este programa le permite pasar de segundos a minutos,\0A\00"
@.str.1 = [15 x i8] c"horas o dias\0A\0A\00"
@.str.2 = [58 x i8] c"Escriba cuantos segundos quiere convertir y pulse ENTER: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [49 x i8] c"Error! El numero de segundos debe ser positivo.\0A\00"
@.str.5 = [24 x i8] c"Saliendo del programa.\0A\00"
@.str.6 = [39 x i8] c"%d segundos equivalen a %.3f minutos.\0A\00"
@.str.7 = [37 x i8] c"%d segundos equivalen a %.3f horas.\0A\00"
@.str.8 = [36 x i8] c"%d segundos equivalen a %.3f dias.\0A\00"
@.str.9 = [6 x i8] c"pause\00"
@.str.10 = [4 x i8] c"cls\00"
define i32 @seg() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %37
15: ; preds = %0
%16 = load i32, i32* %2
%17 = sitofp i32 %16 to float
%18 = fdiv float %17, 6.000000e+01
store float %18, float* %3
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to float
%21 = fdiv float %20, 3.600000e+03
store float %21, float* %4
%22 = load i32, i32* %2
%23 = sitofp i32 %22 to float
%24 = fdiv float %23, 8.640000e+04
store float %24, float* %5
%25 = load i32, i32* %2
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 %25, double %27)
%29 = load i32, i32* %2
%30 = load float, float* %4
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %29, double %31)
%33 = load i32, i32* %2
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %33, double %35)
br label %37
37: ; preds = %15, %12
%38 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%39 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%40 = call i32 (...) @main()
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str.2 = [58 x i8] c"Escriba cuantos segundos quiere convertir y pulse ENTER: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.6 = [39 x i8] c"%d segundos equivalen a %.3f minutos.\0A\00"
@.str.7 = [37 x i8] c"%d segundos equivalen a %.3f horas.\0A\00"
@.str.8 = [36 x i8] c"%d segundos equivalen a %.3f dias.\0A\00"
@.str.9 = [6 x i8] c"pause\00"
@.str.10 = [4 x i8] c"cls\00"
@str = [54 x i8] c"Este programa le permite pasar de segundos a minutos,\00"
@str.11 = [14 x i8] c"horas o dias\0A\00"
@str.12 = [48 x i8] c"Error! El numero de segundos debe ser positivo.\00"
@str.13 = [23 x i8] c"Saliendo del programa.\00"
define i32 @seg() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.12, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.13, i64 0, i64 0))
br label %25
12: ; preds = %0
%13 = sitofp i32 %7 to float
%14 = fdiv float %13, 6.000000e+01
%15 = fdiv float %13, 3.600000e+03
%16 = fdiv float %13, 8.640000e+04
%17 = fpext float %14 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 %7, double %17)
%19 = load i32, i32* %1
%20 = fpext float %15 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %19, double %20)
%22 = load i32, i32* %1
%23 = fpext float %16 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %22, double %23)
br label %25
25: ; preds = %12, %9
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%27 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%28 = call i32 (...) @main()
ret i32 undef
}