#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*/ presentar_menu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main(void) {
  int opcion;
  presentar_menu();
  scanf("%d", &opcion);
  switch (opcion) {
  case 1:
    printf("Ha elegido la opcion 1 \n");
    break;
  case 2:
    printf("Ha elegido la opcion 2 \n");
    break;
  case 3:
    printf("Ha elegido la opcion 3 \n");
    break;
  case 4:
    printf("Ha elegido la opcion 4 \n");
    break;
  default:
    printf("La opcion debe ser 1, 2, 3 o 4 \n");
    system("PAUSE");
    main();
    break;
  }
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1070 <presentar_menu@plt>
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11e3 <main+0x93>
mov    -0x10(%rbp),%rax
lea    0xe6a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
jmp    1200 <main+0xb0>
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
jmp    1200 <main+0xb0>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
jmp    1200 <main+0xb0>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
jmp    1200 <main+0xb0>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
call   1030 <system@plt>
call   1050 <main@plt>
lea    0xe91(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <presentar_menu@plt>
lea    0xeb1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     118e <main+0x3e>
lea    0xe84(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed5(%rip),%rdi
jmp    11c6 <main+0x76>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rdi
call   1040 <system@plt>
call   1050 <main@plt>
jmp    11cb <main+0x7b>
lea    0xe95(%rip),%rdi
jmp    11c6 <main+0x76>
lea    0xe74(%rip),%rdi
jmp    11c6 <main+0x76>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
lea    0xe41(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [25 x i8] c"Ha elegido la opcion 1 \0A\00"
@.str.2 = [25 x i8] c"Ha elegido la opcion 2 \0A\00"
@.str.3 = [25 x i8] c"Ha elegido la opcion 3 \0A\00"
@.str.4 = [25 x i8] c"Ha elegido la opcion 4 \0A\00"
@.str.5 = [33 x i8] c"La opcion debe ser 1, 2, 3 o 4 \0A\00"
@.str.6 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @presentar_menu()
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
switch i32 %5, label %14 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
]
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %18
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %18
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %18
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %18
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @main()
br label %18
18: ; preds = %14, %12, %10, %8, %6
%19 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.6 = [6 x i8] c"PAUSE\00"
@str = [24 x i8] c"Ha elegido la opcion 4 \00"
@str.7 = [24 x i8] c"Ha elegido la opcion 3 \00"
@str.8 = [24 x i8] c"Ha elegido la opcion 2 \00"
@str.9 = [24 x i8] c"Ha elegido la opcion 1 \00"
@str.10 = [32 x i8] c"La opcion debe ser 1, 2, 3 o 4 \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @presentar_menu()
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %14 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
]
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.9, i64 0, i64 0))
br label %18
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.8, i64 0, i64 0))
br label %18
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.7, i64 0, i64 0))
br label %18
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %18
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.10, i64 0, i64 0))
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @main()
br label %18
18: ; preds = %14, %12, %10, %8, %6
%19 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}