#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*/ humanoVShumano(int **);
int /*<<< orphan*/ humanoVSpc(int **, int);
int /*<<< orphan*/ pcVSpc(int **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int imprimemenu(int tab[3][3], int vez) {
  int opt;
  printf("Bem vindo ao jogo da velha de NATAL!\n");
  printf("Escolha seu tipo de jogo: ");
  printf("\n1-Player vs Player \n2-Player vs PC \n3-PC vs PC\n");
  scanf("%d", &opt);
  switch (opt) {
  case 1:
    printf("Player vs Player\n");
    humanoVShumano(tab);
    break;
  case 2:
    printf("Player vs PC\n");
    humanoVSpc(tab, vez);
    break;
  case 3:
    printf("PC vs PC\n");
    pcVSpc(tab, vez);
    break;
  default:
    printf("ERRO. Obrigado por jogar!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<imprimemenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     11c9 <imprimemenu+0x79>
jmp    11a7 <imprimemenu+0x57>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11e3 <imprimemenu+0x93>
jmp    11b8 <imprimemenu+0x68>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1200 <imprimemenu+0xb0>
jmp    121d <imprimemenu+0xcd>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <humanoVShumano@plt>
jmp    1229 <imprimemenu+0xd9>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <humanoVSpc@plt>
jmp    1229 <imprimemenu+0xd9>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <pcVSpc@plt>
jmp    1229 <imprimemenu+0xd9>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimemenu>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe88(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11c6 <imprimemenu+0x66>
cmp    $0x2,%eax
je     11de <imprimemenu+0x7e>
cmp    $0x1,%eax
jne    11f6 <imprimemenu+0x96>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <humanoVShumano@plt>
jmp    1202 <imprimemenu+0xa2>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <pcVSpc@plt>
jmp    1202 <imprimemenu+0xa2>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1080 <humanoVSpc@plt>
jmp    1202 <imprimemenu+0xa2>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Bem vindo ao jogo da velha de NATAL!\0A\00"
@.str.1 = [27 x i8] c"Escolha seu tipo de jogo: \00"
@.str.2 = [49 x i8] c"\0A1-Player vs Player \0A2-Player vs PC \0A3-PC vs PC\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [18 x i8] c"Player vs Player\0A\00"
@.str.5 = [14 x i8] c"Player vs PC\0A\00"
@.str.6 = [10 x i8] c"PC vs PC\0A\00"
@.str.7 = [27 x i8] c"ERRO. Obrigado por jogar!\0A\00"
define i32 @imprimemenu([3 x i32]* %0, i32 %1) {
%3 = alloca [3 x i32]*
%4 = alloca i32
%5 = alloca i32
store [3 x i32]* %0, [3 x i32]** %3
store i32 %1, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 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 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%10 = load i32, i32* %5
switch i32 %10, label %28 [
i32 1, label %11
i32 2, label %16
i32 3, label %22
]
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%13 = load [3 x i32]*, [3 x i32]** %3
%14 = bitcast [3 x i32]* %13 to i32**
%15 = call i32 @humanoVShumano(i32** %14)
br label %30
16: ; preds = %2
%17 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%18 = load [3 x i32]*, [3 x i32]** %3
%19 = bitcast [3 x i32]* %18 to i32**
%20 = load i32, i32* %4
%21 = call i32 @humanoVSpc(i32** %19, i32 %20)
br label %30
22: ; preds = %2
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%24 = load [3 x i32]*, [3 x i32]** %3
%25 = bitcast [3 x i32]* %24 to i32**
%26 = load i32, i32* %4
%27 = call i32 @pcVSpc(i32** %25, i32 %26)
br label %30
28: ; preds = %2
%29 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
br label %30
30: ; preds = %28, %22, %16, %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"Escolha seu tipo de jogo: \00"
@.str.3 = [3 x i8] c"%d\00"
@str = [37 x i8] c"Bem vindo ao jogo da velha de NATAL!\00"
@str.8 = [48 x i8] c"\0A1-Player vs Player \0A2-Player vs PC \0A3-PC vs PC\00"
@str.9 = [9 x i8] c"PC vs PC\00"
@str.10 = [13 x i8] c"Player vs PC\00"
@str.11 = [17 x i8] c"Player vs Player\00"
@str.12 = [26 x i8] c"ERRO. Obrigado por jogar!\00"
define i32 @imprimemenu([3 x i32]* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.8, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
switch i32 %9, label %22 [
i32 1, label %10
i32 2, label %14
i32 3, label %18
]
10: ; preds = %2
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.11, i64 0, i64 0))
%12 = bitcast [3 x i32]* %0 to i32**
%13 = call i32 @humanoVShumano(i32** %12)
br label %24
14: ; preds = %2
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
%16 = bitcast [3 x i32]* %0 to i32**
%17 = call i32 @humanoVSpc(i32** %16, i32 %1)
br label %24
18: ; preds = %2
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
%20 = bitcast [3 x i32]* %0 to i32**
%21 = call i32 @pcVSpc(i32** %20, i32 %1)
br label %24
22: ; preds = %2
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.12, i64 0, i64 0))
br label %24
24: ; preds = %22, %18, %14, %10
ret i32 0
}