#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(char *);
int /*<<< orphan*/ imprimir_autores(int, char **);
int /*<<< orphan*/ imprimir_pid(int, char **);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ salir();
scalar_t__ strcmp(char *, char *);
int trocear_cadena(char *, char **);
void procesar_entrada(char *entrada) {
  char *comando_troceado[1024];
  int numero_trozos = trocear_cadena(entrada, comando_troceado);
  if (numero_trozos > 0) {
    if (strcmp("exit", comando_troceado[0]) == 0 ||
        strcmp("end", comando_troceado[0]) == 0 ||
        strcmp("fin", comando_troceado[0]) == 0) {
      salir();
    } else if (strcmp("autores", comando_troceado[0]) == 0) {
      imprimir_autores(numero_trozos, comando_troceado);
    } else if (strcmp("pid", comando_troceado[0]) == 0) {
      imprimir_pid(numero_trozos, comando_troceado);
    } else {
      printf("Comando desconocido: %s\n", comando_troceado[0]);
    }
  }
  free(entrada);
}


x86 assembly (clang, -O0):
<procesar_entrada>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x2010(%rbp),%rsi
call   1080 <trocear_cadena@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
jle    128f <procesar_entrada+0x11f>
mov    -0x2010(%rbp),%rsi
lea    0xe50(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     11f9 <procesar_entrada+0x89>
mov    -0x2010(%rbp),%rsi
lea    0xe38(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     11f9 <procesar_entrada+0x89>
mov    -0x2010(%rbp),%rsi
lea    0xe1f(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1205 <procesar_entrada+0x95>
mov    $0x0,%al
call   1070 <salir@plt>
jmp    128a <procesar_entrada+0x11a>
mov    -0x2010(%rbp),%rsi
lea    0xdfa(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1239 <procesar_entrada+0xc9>
mov    -0x2014(%rbp),%edi
lea    -0x2010(%rbp),%rsi
call   1060 <imprimir_autores@plt>
jmp    1285 <procesar_entrada+0x115>
mov    -0x2010(%rbp),%rsi
lea    0xdce(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    126d <procesar_entrada+0xfd>
mov    -0x2014(%rbp),%edi
lea    -0x2010(%rbp),%rsi
call   1040 <imprimir_pid@plt>
jmp    1280 <procesar_entrada+0x110>
mov    -0x2010(%rbp),%rsi
lea    0xd9e(%rip),%rdi
call   1050 <printf@plt>
jmp    1285 <procesar_entrada+0x115>
jmp    128a <procesar_entrada+0x11a>
jmp    128f <procesar_entrada+0x11f>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procesar_entrada>:
push   %rbp
push   %rbx
sub    $0x2008,%rsp
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1080 <trocear_cadena@plt>
test   %eax,%eax
jle    1210 <procesar_entrada+0xa0>
mov    %eax,%ebp
mov    (%rsp),%rsi
lea    0xe67(%rip),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1209 <procesar_entrada+0x99>
mov    (%rsp),%rsi
lea    0xe57(%rip),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1209 <procesar_entrada+0x99>
mov    (%rsp),%rsi
lea    0xe46(%rip),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1209 <procesar_entrada+0x99>
mov    (%rsp),%rsi
lea    0xe35(%rip),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1222 <procesar_entrada+0xb2>
mov    (%rsp),%rsi
lea    0xe28(%rip),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     122e <procesar_entrada+0xbe>
mov    (%rsp),%rsi
lea    0xe17(%rip),%rdi
call   1050 <printf@plt>
jmp    1210 <procesar_entrada+0xa0>
xor    %eax,%eax
call   1070 <salir@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x2008,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rsp,%rsi
mov    %ebp,%edi
call   1060 <imprimir_autores@plt>
jmp    1210 <procesar_entrada+0xa0>
mov    %rsp,%rsi
mov    %ebp,%edi
call   1040 <imprimir_pid@plt>
jmp    1210 <procesar_entrada+0xa0>

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
@.str.1 = [4 x i8] c"end\00"
@.str.2 = [4 x i8] c"fin\00"
@.str.3 = [8 x i8] c"autores\00"
@.str.4 = [4 x i8] c"pid\00"
@.str.5 = [25 x i8] c"Comando desconocido: %s\0A\00"
define void @procesar_entrada(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8*]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%7 = call i32 @trocear_cadena(i8* %5, i8** %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %52
10: ; preds = %1
%11 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %25, label %15
15: ; preds = %10
%16 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %15
%21 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20, %15, %10
%26 = call i32 (...) @salir()
br label %51
27: ; preds = %20
%28 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %27
%33 = load i32, i32* %4
%34 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%35 = call i32 @imprimir_autores(i32 %33, i8** %34)
br label %50
36: ; preds = %27
%37 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%38 = load i8*, i8** %37
%39 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = load i32, i32* %4
%43 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%44 = call i32 @imprimir_pid(i32 %42, i8** %43)
br label %49
45: ; preds = %36
%46 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %3, i64 0, i64 0
%47 = load i8*, i8** %46
%48 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %45, %41
br label %50
50: ; preds = %49, %32
br label %51
51: ; preds = %50, %25
br label %52
52: ; preds = %51, %1
%53 = load i8*, i8** %2
%54 = call i32 @free(i8* %53)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
@.str.1 = [4 x i8] c"end\00"
@.str.2 = [4 x i8] c"fin\00"
@.str.3 = [8 x i8] c"autores\00"
@.str.4 = [4 x i8] c"pid\00"
@.str.5 = [25 x i8] c"Comando desconocido: %s\0A\00"
define void @procesar_entrada(i8* %0) {
%2 = alloca [1024 x i8*]
%3 = bitcast [1024 x i8*]* %2 to i8*
%4 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %2, i64 0, i64 0
%5 = call i32 @trocear_cadena(i8* %0, i8** %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %36
7: ; preds = %1
%8 = load i8*, i8** %4
%9 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15, %11, %7
%20 = call i32 (...) @salir()
br label %36
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @imprimir_autores(i32 %5, i8** %4)
br label %36
27: ; preds = %21
%28 = load i8*, i8** %4
%29 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @imprimir_pid(i32 %5, i8** %4)
br label %36
33: ; preds = %27
%34 = load i8*, i8** %4
%35 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %19, %31, %33, %25, %1
%37 = call i32 @free(i8* %0)
ret void
}