#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*/ free_comando(unsigned int);
unsigned int handle_input();
int /*<<< orphan*/ print_output();
int /*<<< orphan*/ printf(char *);
unsigned int process_comando(unsigned int);
int main(void) {
  unsigned int i = 0, j = 0;
  while (1) {
    j = handle_input();
    if (j > 0) {
      i = process_comando(j);
      if (i == 1) {
        free_comando(j);
        return 0;
      }
      print_output();
      free_comando(j);
    } else if (j == -1) {
      printf("FALLO DE MEMORIA");
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <handle_input@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jbe    11be <main+0x6e>
mov    -0xc(%rbp),%edi
call   1040 <process_comando@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11aa <main+0x5a>
mov    -0xc(%rbp),%edi
call   1070 <free_comando@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ea <main+0x9a>
mov    $0x0,%al
call   1060 <print_output@plt>
mov    -0xc(%rbp),%edi
call   1070 <free_comando@plt>
jmp    11e5 <main+0x95>
cmpl   $0xffffffff,-0xc(%rbp)
jne    11e0 <main+0x90>
lea    0xe31(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ea <main+0x9a>
jmp    11e5 <main+0x95>
jmp    116d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <handle_input@plt>
test   %eax,%eax
je     1150 <main+0x10>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <process_comando@plt>
cmp    $0x1,%eax
je     1179 <main+0x39>
xor    %eax,%eax
call   1050 <print_output@plt>
mov    %ebx,%edi
call   1060 <free_comando@plt>
jmp    1150 <main+0x10>
mov    %ebx,%edi
call   1060 <free_comando@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"FALLO DE MEMORIA\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %0, %26
%5 = call i32 (...) @handle_input()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ugt i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i32, i32* %3
%10 = call i32 @process_comando(i32 %9)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* %3
%15 = call i32 @free_comando(i32 %14)
store i32 0, i32* %1
br label %27
16: ; preds = %8
%17 = call i32 (...) @print_output()
%18 = load i32, i32* %3
%19 = call i32 @free_comando(i32 %18)
br label %26
20: ; preds = %4
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %27
25: ; preds = %20
br label %26
26: ; preds = %25, %16
br label %4
27: ; preds = %23, %13
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %4, %0
%2 = tail call i32 (...) @handle_input()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1, %10
br label %1
5: ; preds = %1
%6 = tail call i32 @process_comando(i32 %2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @free_comando(i32 %2)
ret i32 0
10: ; preds = %5
%11 = tail call i32 (...) @print_output()
%12 = tail call i32 @free_comando(i32 %2)
br label %4
}