#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*/ scanf(char *, int *);
void menu(int *mododejogo, int *dificuldade, int *quemcomeca) {
  printf("\n-Ha tres modalidades disponiveis: \n");
  printf("Pressione:");
  printf("\n'1' se voce deseja um jogo para dois humanos.");
  printf("\n'2' se voce deseja ver uma partida simulada.");
  printf("\n'3' se voce deseja jogar contra a maquina.\n");
  scanf("%d", &*mododejogo);
  if (*mododejogo == 2 || *mododejogo == 3) {
    printf("\n-Por favor, informe em qual dificuldade voce deseja o desafio:");
    printf("\n'4' - Nivel facil");
    printf("\n'5' - Nivel medio");
    printf("\n'6' - Nivel dificil\n");
    scanf("%d", &*dificuldade);
  }
  if (*mododejogo == 1 || *mododejogo == 3) {
    printf("\n\nO usuario devera escolher em qual 'casa' ele jogara!");
    printf("\n-Exemplo de tabuleiro:\n");
    printf("\n 0 | 1 | 2");
    printf("\n---+---+---");
    printf("\n 3 | 4 | 5");
    printf("\n ---+---+---");
    printf("\n 6 | 7 | 8\n");
    printf("\nOs numeros representam as opcoes de 'casas' para a execucao da "
           "jogada!\n\n");
    printf("\nSE O JOGADOR PRESSIONAR UM NUMERO DE UMA CASA JA OCUPADA, "
           "PERDERA A VEZ!!\n");
  }
  if (*mododejogo == 3) {
    printf("\n-Quem fara o primeiro movimento?\n");
    printf("\nPressione\n'1' para humano ou\n");
    printf("'2' para computador:\n");
    scanf("%d", &*quemcomeca);
  }
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
call   1030 <printf@plt>
lea    0xf22(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf3f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x2,(%rax)
je     119a <menu+0x7a>
mov    -0x8(%rbp),%rax
cmpl   $0x3,(%rax)
jne    11da <menu+0xba>
lea    0xf1c(%rip),%rdi
call   1030 <printf@plt>
lea    0xf50(%rip),%rdi
call   1030 <printf@plt>
lea    0xf57(%rip),%rdi
call   1030 <printf@plt>
lea    0xf5e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xee5(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x1,(%rax)
je     11f4 <menu+0xd4>
mov    -0x8(%rbp),%rax
cmpl   $0x3,(%rax)
jne    1260 <menu+0x140>
lea    0xf3e(%rip),%rdi
call   1030 <printf@plt>
lea    0xf69(%rip),%rdi
call   1030 <printf@plt>
lea    0xf76(%rip),%rdi
call   1030 <printf@plt>
lea    0xf76(%rip),%rdi
call   1030 <printf@plt>
lea    0xf77(%rip),%rdi
call   1030 <printf@plt>
lea    0xf77(%rip),%rdi
call   1030 <printf@plt>
lea    0xf79(%rip),%rdi
call   1030 <printf@plt>
lea    0xf7a(%rip),%rdi
call   1030 <printf@plt>
lea    0xfb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x3,(%rax)
jne    12a1 <menu+0x181>
lea    0xfeb(%rip),%rdi
call   1030 <printf@plt>
lea    0x1002(%rip),%rdi
call   1030 <printf@plt>
lea    0x1015(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe1e(%rip),%rdi
call   1040 <scanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xff6(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
lea    0xfea(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
cmp    $0x2,%ecx
jne    11d6 <menu+0xa6>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
lea    0xf03(%rip),%rdi
call   1040 <printf@plt>
lea    0xf0a(%rip),%rdi
call   1040 <printf@plt>
lea    0x10d8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%eax
or     $0x2,%eax
cmp    $0x3,%eax
jne    128b <menu+0x15b>
lea    0xee8(%rip),%rdi
call   1040 <printf@plt>
lea    0xfeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf07(%rip),%rdi
call   1040 <printf@plt>
lea    0xf07(%rip),%rdi
call   1040 <printf@plt>
lea    0xf08(%rip),%rdi
call   1040 <printf@plt>
lea    0xf08(%rip),%rdi
call   1040 <printf@plt>
lea    0xfc7(%rip),%rdi
call   1030 <puts@plt>
lea    0xfc7(%rip),%rdi
call   1030 <puts@plt>
lea    0x1004(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x3,(%rbx)
jne    128b <menu+0x15b>
lea    0xf31(%rip),%rdi
call   1030 <puts@plt>
lea    0xf47(%rip),%rdi
call   1030 <puts@plt>
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
lea    0xdea(%rip),%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <scanf@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [37 x i8] c"\0A-Ha tres modalidades disponiveis: \0A\00"
@.str.1 = [11 x i8] c"Pressione:\00"
@.str.2 = [47 x i8] c"\0A'1' se voce deseja um jogo para dois humanos.\00"
@.str.3 = [46 x i8] c"\0A'2' se voce deseja ver uma partida simulada.\00"
@.str.4 = [45 x i8] c"\0A'3' se voce deseja jogar contra a maquina.\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [64 x i8] c"\0A-Por favor, informe em qual dificuldade voce deseja o desafio:\00"
@.str.7 = [19 x i8] c"\0A'4' - Nivel facil\00"
@.str.8 = [19 x i8] c"\0A'5' - Nivel medio\00"
@.str.9 = [22 x i8] c"\0A'6' - Nivel dificil\0A\00"
@.str.10 = [55 x i8] c"\0A\0AO usuario devera escolher em qual 'casa' ele jogara!\00"
@.str.11 = [25 x i8] c"\0A-Exemplo de tabuleiro:\0A\00"
@.str.12 = [12 x i8] c"\0A 0 | 1 | 2\00"
@.str.13 = [13 x i8] c"\0A---+---+---\00"
@.str.14 = [12 x i8] c"\0A 3 | 4 | 5\00"
@.str.15 = [14 x i8] c"\0A ---+---+---\00"
@.str.16 = [13 x i8] c"\0A 6 | 7 | 8\0A\00"
@.str.17 = [74 x i8] c"\0AOs numeros representam as opcoes de 'casas' para a execucao da jogada!\0A\0A\00"
@.str.18 = [76 x i8] c"\0ASE O JOGADOR PRESSIONAR UM NUMERO DE UMA CASA JA OCUPADA, PERDERA A VEZ!!\0A\00"
@.str.19 = [35 x i8] c"\0A-Quem fara o primeiro movimento?\0A\00"
@.str.20 = [31 x i8] c"\0APressione\0A'1' para humano ou\0A\00"
@.str.21 = [22 x i8] c"'2' para computador:\0A\00"
define void @menu(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
%12 = load i32*, i32** %4
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %12)
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 2
br i1 %16, label %21, label %17
17: ; preds = %3
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %28
21: ; preds = %17, %3
%22 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%26 = load i32*, i32** %5
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %26)
br label %28
28: ; preds = %21, %17
%29 = load i32*, i32** %4
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 1
br i1 %31, label %36, label %32
32: ; preds = %28
%33 = load i32*, i32** %4
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 3
br i1 %35, label %36, label %46
36: ; preds = %32, %28
%37 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0))
%43 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0))
%44 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.17, i64 0, i64 0))
%45 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.18, i64 0, i64 0))
br label %46
46: ; preds = %36, %32
%47 = load i32*, i32** %4
%48 = load i32, i32* %47
%49 = icmp eq i32 %48, 3
br i1 %49, label %50, label %56
50: ; preds = %46
%51 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0))
%52 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0))
%53 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.21, i64 0, i64 0))
%54 = load i32*, i32** %6
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %54)
br label %56
56: ; preds = %50, %46
ret void
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"Pressione:\00"
@.str.2 = [47 x i8] c"\0A'1' se voce deseja um jogo para dois humanos.\00"
@.str.3 = [46 x i8] c"\0A'2' se voce deseja ver uma partida simulada.\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [64 x i8] c"\0A-Por favor, informe em qual dificuldade voce deseja o desafio:\00"
@.str.7 = [19 x i8] c"\0A'4' - Nivel facil\00"
@.str.8 = [19 x i8] c"\0A'5' - Nivel medio\00"
@.str.10 = [55 x i8] c"\0A\0AO usuario devera escolher em qual 'casa' ele jogara!\00"
@.str.12 = [12 x i8] c"\0A 0 | 1 | 2\00"
@.str.13 = [13 x i8] c"\0A---+---+---\00"
@.str.14 = [12 x i8] c"\0A 3 | 4 | 5\00"
@.str.15 = [14 x i8] c"\0A ---+---+---\00"
@str = [36 x i8] c"\0A-Ha tres modalidades disponiveis: \00"
@str.22 = [44 x i8] c"\0A'3' se voce deseja jogar contra a maquina.\00"
@str.23 = [34 x i8] c"\0A-Quem fara o primeiro movimento?\00"
@str.24 = [30 x i8] c"\0APressione\0A'1' para humano ou\00"
@str.25 = [21 x i8] c"'2' para computador:\00"
@str.26 = [24 x i8] c"\0A-Exemplo de tabuleiro:\00"
@str.27 = [12 x i8] c"\0A 6 | 7 | 8\00"
@str.28 = [73 x i8] c"\0AOs numeros representam as opcoes de 'casas' para a execucao da jogada!\0A\00"
@str.29 = [75 x i8] c"\0ASE O JOGADOR PRESSIONAR UM NUMERO DE UMA CASA JA OCUPADA, PERDERA A VEZ!!\00"
@str.30 = [21 x i8] c"\0A'6' - Nivel dificil\00"
define void @menu(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.22, i64 0, i64 0))
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %0)
%10 = load i32, i32* %0
%11 = and i32 %10, -2
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %3
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.30, i64 0, i64 0))
%18 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %0
br label %20
20: ; preds = %3, %13
%21 = phi i32 [ %10, %3 ], [ %19, %13 ]
switch i32 %21, label %39 [
i32 1, label %22
i32 3, label %22
]
22: ; preds = %20, %20
%23 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.26, i64 0, i64 0))
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
%27 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%28 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.27, i64 0, i64 0))
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.28, i64 0, i64 0))
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.29, i64 0, i64 0))
%32 = load i32, i32* %0
%33 = icmp eq i32 %32, 3
br i1 %33, label %34, label %39
34: ; preds = %22
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.23, i64 0, i64 0))
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.24, i64 0, i64 0))
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.25, i64 0, i64 0))
%38 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
br label %39
39: ; preds = %20, %34, %22
ret void
}