#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*/ system(char *);
void saida(int controle, int saida) {
  switch (controle) {
  case 1:
    printf("******* JOGO DA VELHA *****\n\n1. Multiplayer\n2. Single "
           "Player\n3. Exit\n");
    break;
  case 2:
    printf("Dificuldade: \n2. Easy\n3. Hard\n");
    break;
  case 3:
    system("/usr/bin/clear");
    break;
  case 4:
    printf("Digite a jogada jogador 2\n");
    break;
  case 5:
    printf("Digite a jogada jogador 1\n");
    break;
  case 6:
    printf("Posicao invalida! \n");
    break;
  case 7:
    printf("Jogador 2 o 'O' ganhou\n");
    break;
  case 8:
    printf("Jogador 1 o 'X' ganhou\n");
    break;
  case 9:
    printf("\nVelhou\n");
    break;
  case 10:
    printf("O");
    break;
  case 11:
    printf("\nSaindo\n");
    break;
  case 12:
    printf("Joguei no %d", saida);
    break;
  }
}


x86 assembly (clang, -O0):
<saida>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xb,%eax
ja     1237 <saida+0x117>
mov    -0x10(%rbp),%rax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf11(%rip),%rdi
call   1030 <system@plt>
jmp    1237 <saida+0x117>
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1237 <saida+0x117>
mov    -0x8(%rbp),%esi
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saida>:
add    $0xffffffff,%edi
cmp    $0xb,%edi
ja     11ec <saida+0xac>
lea    0xead(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf8c(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xf62(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xeb5(%rip),%rdi
jmp    1050 <system@plt>
lea    0xf30(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xf0a(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xeeb(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xec8(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xea5(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xe91(%rip),%rdi
jmp    1040 <puts@plt>
mov    $0x4f,%edi
jmp    1030 <putchar@plt>
lea    0xe73(%rip),%rdi
jmp    1040 <puts@plt>
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
jmp    1060 <printf@plt>
ret

LLVM IR (-O0):
@.str = [70 x i8] c"******* JOGO DA VELHA *****\0A\0A1. Multiplayer\0A2. Single Player\0A3. Exit\0A\00"
@.str.1 = [31 x i8] c"Dificuldade: \0A2. Easy\0A3. Hard\0A\00"
@.str.2 = [15 x i8] c"/usr/bin/clear\00"
@.str.3 = [27 x i8] c"Digite a jogada jogador 2\0A\00"
@.str.4 = [27 x i8] c"Digite a jogada jogador 1\0A\00"
@.str.5 = [20 x i8] c"Posicao invalida! \0A\00"
@.str.6 = [24 x i8] c"Jogador 2 o 'O' ganhou\0A\00"
@.str.7 = [24 x i8] c"Jogador 1 o 'X' ganhou\0A\00"
@.str.8 = [9 x i8] c"\0AVelhou\0A\00"
@.str.9 = [2 x i8] c"O\00"
@.str.10 = [9 x i8] c"\0ASaindo\0A\00"
@.str.11 = [13 x i8] c"Joguei no %d\00"
define void @saida(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
switch i32 %5, label %31 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
i32 8, label %20
i32 9, label %22
i32 10, label %24
i32 11, label %26
i32 12, label %28
]
6: ; preds = %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
br label %31
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %31
10: ; preds = %2
%11 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %31
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %31
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %31
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %31
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %31
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %31
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %31
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %31
26: ; preds = %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
br label %31
28: ; preds = %2
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %2, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
@.str.2 = [15 x i8] c"/usr/bin/clear\00"
@.str.11 = [13 x i8] c"Joguei no %d\00"
@str = [8 x i8] c"\0ASaindo\00"
@str.12 = [8 x i8] c"\0AVelhou\00"
@str.13 = [23 x i8] c"Jogador 1 o 'X' ganhou\00"
@str.14 = [23 x i8] c"Jogador 2 o 'O' ganhou\00"
@str.15 = [19 x i8] c"Posicao invalida! \00"
@str.16 = [26 x i8] c"Digite a jogada jogador 1\00"
@str.17 = [26 x i8] c"Digite a jogada jogador 2\00"
@str.18 = [30 x i8] c"Dificuldade: \0A2. Easy\0A3. Hard\00"
@str.19 = [69 x i8] c"******* JOGO DA VELHA *****\0A\0A1. Multiplayer\0A2. Single Player\0A3. Exit\00"
define void @saida(i32 %0, i32 %1) {
switch i32 %0, label %27 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 4, label %9
i32 5, label %11
i32 6, label %13
i32 7, label %15
i32 8, label %17
i32 9, label %19
i32 10, label %21
i32 11, label %23
i32 12, label %25
]
3: ; preds = %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str.19, i64 0, i64 0))
br label %27
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.18, i64 0, i64 0))
br label %27
7: ; preds = %2
%8 = tail call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %27
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.17, i64 0, i64 0))
br label %27
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.16, i64 0, i64 0))
br label %27
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.15, i64 0, i64 0))
br label %27
15: ; preds = %2
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.14, i64 0, i64 0))
br label %27
17: ; preds = %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.13, i64 0, i64 0))
br label %27
19: ; preds = %2
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.12, i64 0, i64 0))
br label %27
21: ; preds = %2
%22 = tail call i32 @putchar(i32 79)
br label %27
23: ; preds = %2
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %27
25: ; preds = %2
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %1)
br label %27
27: ; preds = %2, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3
ret void
}