#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*/ getchar();
int /*<<< orphan*/ instrucao();
int /*<<< orphan*/ modos_jogo(int);
int /*<<< orphan*/ nome_decorado();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int opcao;
  do {
    system("clear");
    nome_decorado();
    printf("%c Digite o n%cmero correspondente ao modo de jogo:\n\n", 16, 163);
    printf("  1 %c Jogar no modo autom%ctico\n", 175, 160);
    printf("  2 %c Jogar no modo manual\n", 175);
    printf("  3 %c Instru%c%ces\n\n > ", 175, 135, 228);
    scanf("%d", &opcao);
    if (opcao == 3)
      instrucao();
  } while ((opcao != 1 && opcao != 2 && opcao != 3) || opcao == 3);
  modos_jogo(opcao);
  printf("\n\nObrigado por jogar :)\nPressione qualquer tecla para encerrar o "
         "jogo... ");
  getchar();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1050 <system@plt>
mov    $0x0,%al
call   1040 <nome_decorado@plt>
lea    0xe6d(%rip),%rdi
mov    $0x10,%esi
mov    $0xa3,%edx
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    $0xaf,%esi
mov    $0xa0,%edx
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0xaf,%esi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0xaf,%esi
mov    $0x87,%edx
mov    $0xe4,%ecx
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0x3,-0x8(%rbp)
jne    1213 <main+0xa3>
mov    $0x0,%al
call   1070 <instrucao@plt>
jmp    1218 <main+0xa8>
cmpl   $0x1,-0x8(%rbp)
je     123b <main+0xcb>
cmpl   $0x2,-0x8(%rbp)
je     123b <main+0xcb>
mov    $0x1,%al
cmpl   $0x3,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jne    1245 <main+0xd5>
cmpl   $0x3,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    117f <main+0xf>
mov    -0x8(%rbp),%edi
call   1030 <modos_jogo@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe84(%rip),%r15
lea    0xeb3(%rip),%r12
lea    0xece(%rip),%r13
lea    0xee4(%rip),%rbx
lea    0xef6(%rip),%rbp
lea    0x4(%rsp),%r14
jmp    11bc <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x3(%rdi),%eax
cmp    $0xfffffffe,%eax
jae    1247 <main+0xd7>
lea    0xe3d(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
call   1040 <nome_decorado@plt>
mov    %r15,%rdi
mov    $0x10,%esi
mov    $0xa3,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    $0xaf,%esi
mov    $0xa0,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
mov    $0xaf,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0xaf,%esi
mov    $0x87,%edx
mov    $0xe4,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
cmp    $0x3,%edi
jne    11b0 <main+0x40>
xor    %eax,%eax
call   1070 <instrucao@plt>
mov    0x4(%rsp),%edi
jmp    11b0 <main+0x40>
call   1030 <modos_jogo@plt>
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [54 x i8] c"%c Digite o n%cmero correspondente ao modo de jogo:\0A\0A\00"
@.str.2 = [34 x i8] c" 1 %c Jogar no modo autom%ctico\0A\00"
@.str.3 = [29 x i8] c" 2 %c Jogar no modo manual\0A\00"
@.str.4 = [25 x i8] c" 3 %c Instru%c%ces\0A\0A > \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [74 x i8] c"\0A\0AObrigado por jogar :)\0APressione qualquer tecla para encerrar o jogo... \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %28, %0
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @nome_decorado()
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 16, i32 163)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 175, i32 160)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 175)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 175, i32 135, i32 228)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 (...) @instrucao()
br label %15
15: ; preds = %13, %3
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = icmp ne i32 %17, 1
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp ne i32 %23, 3
br i1 %24, label %28, label %25
25: ; preds = %22, %19, %16
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 3
br label %28
28: ; preds = %25, %22
%29 = phi i1 [ true, %22 ], [ %27, %25 ]
br i1 %29, label %3, label %30
30: ; preds = %28
%31 = load i32, i32* %2
%32 = call i32 @modos_jogo(i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.6, i64 0, i64 0))
%34 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [54 x i8] c"%c Digite o n%cmero correspondente ao modo de jogo:\0A\0A\00"
@.str.2 = [34 x i8] c" 1 %c Jogar no modo autom%ctico\0A\00"
@.str.3 = [29 x i8] c" 2 %c Jogar no modo manual\0A\00"
@.str.4 = [25 x i8] c" 3 %c Instru%c%ces\0A\0A > \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [74 x i8] c"\0A\0AObrigado por jogar :)\0APressione qualquer tecla para encerrar o jogo... \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %16, %0
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @nome_decorado()
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 16, i32 163)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 175, i32 160)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 175)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 175, i32 135, i32 228)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = call i32 (...) @instrucao()
%15 = load i32, i32* %1
br label %16
16: ; preds = %3, %13
%17 = phi i32 [ %11, %3 ], [ %15, %13 ]
%18 = add i32 %17, -3
%19 = icmp ult i32 %18, -2
br i1 %19, label %3, label %20
20: ; preds = %16
%21 = call i32 @modos_jogo(i32 %17)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 (...) @getchar()
ret i32 0
}