#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int op, op2, op3;
  do {
    puts("Aventura Interactiva\n");
    printf("1.Entrar\n2.Salir\n\nOpcion: ");
    scanf("%d", &op);
    switch (op) {
    case 1:
      printf("\nEn una noche oscura, a lo lejos se pueden observar ");
      puts("un par de ojos, brillantes y rojos ");
      puts("Si quieres acercarte a ellos, presiona 1, si quieres correr! 2");
      printf("Opcion: ");
      scanf("%d", &op2);
      switch (op2) {
      case 1:
        puts("Por suerte no era un moustro, solo un conejo hambriento...");
        break;
      case 2:
        puts("Te preguntaras ¿ A que criatura pertenecian esos ojos ?");
        puts("Para volver y averiguarlo presiona 1, volver a la aventura 2");
        printf("Opcion: ");
        scanf("%d", &op3);
        switch (op3) {
        case 1:
          puts("Desaparecieron !\n");
          break;
        case 2:
          break;
        default:
          puts("Opcion invalida!");
          break;
        }
        break;
      default:
        puts("Opcion invalida!");
        break;
      }
      break;
    case 2:
      break;
    default:
      puts("Opcion invalida!");
      break;
    }
  } while (op != 2);
  puts("Saliendo...");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     118c <main+0x5c>
jmp    117b <main+0x4b>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1293 <main+0x163>
jmp    1298 <main+0x168>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     11f1 <main+0xc1>
jmp    11e0 <main+0xb0>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1202 <main+0xd2>
jmp    1282 <main+0x152>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
jmp    128e <main+0x15e>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
lea    0xe04(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     125b <main+0x12b>
jmp    124a <main+0x11a>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     126c <main+0x13c>
jmp    1271 <main+0x141>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
jmp    127d <main+0x14d>
jmp    127d <main+0x14d>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
jmp    128e <main+0x15e>
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
jmp    12a4 <main+0x174>
jmp    12a4 <main+0x174>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
jmp    12a9 <main+0x179>
cmpl   $0x2,-0x8(%rbp)
jne    113f <main+0xf>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%r14
lea    0xeca(%rip),%r15
lea    0xede(%rip),%rbx
lea    0xc(%rsp),%r12
lea    0x1030(%rip),%r13
lea    0xec2(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     11b0 <main+0x80>
mov    %r13,%rdi
cmp    $0x2,%eax
jne    1253 <main+0x123>
jmp    1263 <main+0x133>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
lea    0xed8(%rip),%rdi
cmp    $0x1,%eax
je     1253 <main+0x123>
cmp    $0x2,%eax
jne    1250 <main+0x120>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
lea    0xf47(%rip),%rdi
cmp    $0x1,%eax
je     1253 <main+0x123>
cmp    $0x2,%eax
jne    1250 <main+0x120>
cmpl   $0x2,0xc(%rsp)
jne    1170 <main+0x40>
jmp    1263 <main+0x133>
nopl   (%rax)
mov    %r13,%rdi
call   1030 <puts@plt>
cmpl   $0x2,0xc(%rsp)
jne    1170 <main+0x40>
lea    0xf36(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Aventura Interactiva\0A\00"
@.str.1 = [27 x i8] c"1.Entrar\0A2.Salir\0A\0AOpcion: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [53 x i8] c"\0AEn una noche oscura, a lo lejos se pueden observar \00"
@.str.4 = [36 x i8] c"un par de ojos, brillantes y rojos \00"
@.str.5 = [63 x i8] c"Si quieres acercarte a ellos, presiona 1, si quieres correr! 2\00"
@.str.6 = [9 x i8] c"Opcion: \00"
@.str.7 = [59 x i8] c"Por suerte no era un moustro, solo un conejo hambriento...\00"
@.str.8 = [57 x i8] c"Te preguntaras \C2\BF A que criatura pertenecian esos ojos ?\00"
@.str.9 = [61 x i8] c"Para volver y averiguarlo presiona 1, volver a la aventura 2\00"
@.str.10 = [18 x i8] c"Desaparecieron !\0A\00"
@.str.11 = [17 x i8] c"Opcion invalida!\00"
@.str.12 = [12 x i8] c"Saliendo...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %38, %0
%6 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %35 [
i32 1, label %10
i32 2, label %34
]
10: ; preds = %5
%11 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
switch i32 %16, label %31 [
i32 1, label %17
i32 2, label %19
]
17: ; preds = %10
%18 = call i32 @puts(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0))
br label %33
19: ; preds = %10
%20 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0))
%21 = call i32 @puts(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.9, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%24 = load i32, i32* %4
switch i32 %24, label %28 [
i32 1, label %25
i32 2, label %27
]
25: ; preds = %19
%26 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
br label %30
27: ; preds = %19
br label %30
28: ; preds = %19
%29 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %30
30: ; preds = %28, %27, %25
br label %33
31: ; preds = %10
%32 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %33
33: ; preds = %31, %30, %17
br label %37
34: ; preds = %5
br label %37
35: ; preds = %5
%36 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %37
37: ; preds = %35, %34, %33
br label %38
38: ; preds = %37
%39 = load i32, i32* %2
%40 = icmp ne i32 %39, 2
br i1 %40, label %5, label %41
41: ; preds = %38
%42 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Aventura Interactiva\0A\00"
@.str.1 = [27 x i8] c"1.Entrar\0A2.Salir\0A\0AOpcion: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [53 x i8] c"\0AEn una noche oscura, a lo lejos se pueden observar \00"
@.str.4 = [36 x i8] c"un par de ojos, brillantes y rojos \00"
@.str.5 = [63 x i8] c"Si quieres acercarte a ellos, presiona 1, si quieres correr! 2\00"
@.str.6 = [9 x i8] c"Opcion: \00"
@.str.7 = [59 x i8] c"Por suerte no era un moustro, solo un conejo hambriento...\00"
@.str.8 = [57 x i8] c"Te preguntaras \C2\BF A que criatura pertenecian esos ojos ?\00"
@.str.9 = [61 x i8] c"Para volver y averiguarlo presiona 1, volver a la aventura 2\00"
@.str.10 = [18 x i8] c"Desaparecieron !\0A\00"
@.str.11 = [17 x i8] c"Opcion invalida!\00"
@.str.12 = [12 x i8] c"Saliendo...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %30, %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
switch i32 %11, label %27 [
i32 1, label %12
i32 2, label %33
]
12: ; preds = %7
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
switch i32 %18, label %26 [
i32 1, label %27
i32 2, label %19
]
19: ; preds = %12
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.9, i64 0, i64 0))
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%24 = load i32, i32* %3
switch i32 %24, label %25 [
i32 1, label %27
i32 2, label %30
]
25: ; preds = %19
br label %27
26: ; preds = %12
br label %27
27: ; preds = %7, %19, %12, %26, %25
%28 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), %25 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), %26 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), %12 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), %19 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), %7 ]
%29 = call i32 @puts(i8* dereferenceable(1) %28)
br label %30
30: ; preds = %27, %19
%31 = load i32, i32* %1
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %7
33: ; preds = %7, %30
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
ret i32 0
}