#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ strcpy(char *, char *);
void menu_principal(char *monstro1, char *monstro2) {
  printf("King of Tokyo\n\n");
  printf("Jogador escolha um monstro:\n---------------------------\n");
  printf("1-Godzilla\n2-Feto Gigante Zumbi "
         "Nazista\n3-Pac-Man\n4-Blanca\n5-Penha\n6-Nemesis\n\n0-SAIR\n\n");
  int escolha;
  do {
    scanf("%d", &escolha);
  } while (escolha < 0 || escolha > 6);
  if (escolha == 0)
    exit(0);
  char *monstros[] = {"",        "Godzilla", "Feto Gigante Zumbi Nazista",
                      "Pac-Man", "Blanca",   "Penha",
                      "Nemesis"};
  strcpy(monstro1, monstros[escolha]);
  printf("VOCE ESCOLHEU: %s\n\n", monstro1);
}


x86 assembly (clang, -O0):
<menu_principal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf0f(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x51(%rbp)
jl     11b3 <menu_principal+0x63>
cmpl   $0x6,-0x14(%rbp)
setg   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    118a <menu_principal+0x3a>
cmpl   $0x0,-0x14(%rbp)
jne    11cf <menu_principal+0x7f>
xor    %edi,%edi
call   1070 <exit@plt>
lea    -0x50(%rbp),%rdi
lea    0x2c06(%rip),%rsi
mov    $0x38,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rsi
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_principal>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
lea    0xef5(%rip),%rdi
call   1040 <puts@plt>
lea    0xef8(%rip),%rdi
call   1040 <puts@plt>
lea    0xf24(%rip),%rdi
call   1040 <puts@plt>
lea    0xe79(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x6,%rax
ja     1190 <menu_principal+0x40>
test   %rax,%rax
je     11db <menu_principal+0x8b>
lea    0xf47(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xe7d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"King of Tokyo\0A\0A\00"
@.str.1 = [57 x i8] c"Jogador escolha um monstro:\0A---------------------------\0A\00"
@.str.2 = [87 x i8] c"1-Godzilla\0A2-Feto Gigante Zumbi Nazista\0A3-Pac-Man\0A4-Blanca\0A5-Penha\0A6-Nemesis\0A\0A0-SAIR\0A\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [9 x i8] c"Godzilla\00"
@.str.6 = [27 x i8] c"Feto Gigante Zumbi Nazista\00"
@.str.7 = [8 x i8] c"Pac-Man\00"
@.str.8 = [7 x i8] c"Blanca\00"
@.str.9 = [6 x i8] c"Penha\00"
@.str.10 = [8 x i8] c"Nemesis\00"
@__const.menu_principal.monstros = [7 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0)]
@.str.11 = [20 x i8] c"VOCE ESCOLHEU: %s\0A\0A\00"
define void @menu_principal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [7 x i8*]
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %18, %2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
br label %12
12: ; preds = %10
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp sgt i32 %16, 6
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ true, %12 ], [ %17, %15 ]
br i1 %19, label %10, label %20
20: ; preds = %18
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @exit(i32 0)
unreachable
25: ; preds = %20
%26 = bitcast [7 x i8*]* %6 to i8*
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [7 x i8*], [7 x i8*]* %6, i64 0, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @strcpy(i8* %27, i8* %31)
%33 = load i8*, i8** %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i8* %33)
ret void
}

LLVM IR (-O2):
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [9 x i8] c"Godzilla\00"
@.str.6 = [27 x i8] c"Feto Gigante Zumbi Nazista\00"
@.str.7 = [8 x i8] c"Pac-Man\00"
@.str.8 = [7 x i8] c"Blanca\00"
@.str.9 = [6 x i8] c"Penha\00"
@.str.10 = [8 x i8] c"Nemesis\00"
@reltable.menu_principal = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.menu_principal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.menu_principal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.menu_principal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.7 to i64), i64 ptrtoint ([7 x i32]* @reltable.menu_principal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.8 to i64), i64 ptrtoint ([7 x i32]* @reltable.menu_principal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.9 to i64), i64 ptrtoint ([7 x i32]* @reltable.menu_principal to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([7 x i32]* @reltable.menu_principal to i64)) to i32)]
@.str.11 = [20 x i8] c"VOCE ESCOLHEU: %s\0A\0A\00"
@str = [15 x i8] c"King of Tokyo\0A\00"
@str.12 = [56 x i8] c"Jogador escolha um monstro:\0A---------------------------\00"
@str.13 = [86 x i8] c"1-Godzilla\0A2-Feto Gigante Zumbi Nazista\0A3-Pac-Man\0A4-Blanca\0A5-Penha\0A6-Nemesis\0A\0A0-SAIR\0A\00"
define void @menu_principal(i8* %0, i8* nocapture readnone %1) {
%3 = alloca i32
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.12, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @str.13, i64 0, i64 0))
%7 = bitcast i32* %3 to i8*
br label %8
8: ; preds = %8, %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp ugt i32 %10, 6
br i1 %11, label %8, label %12
12: ; preds = %8
%13 = icmp eq i32 %10, 0
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %12
%17 = zext i32 %10 to i64
%18 = shl i64 %17, 2
%19 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.menu_principal to i8*), i64 %18)
%20 = call i32 @strcpy(i8* %0, i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i8* %0)
ret void
}