#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 jogo();
int menu();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int running = 1;
  int estado = 0;
  while (running == 1) {
    printf("ESTADO = %d\n", estado);
    switch (estado) {
    case 0:
      estado = menu();
      break;
    case 1:
      printf("COMEÇAR O JOGO\n");
      estado = jogo();
      break;
    case 3:
      running = 0;
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11d5 <main+0xa5>
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     119d <main+0x6d>
jmp    117b <main+0x4b>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     11ac <main+0x7c>
jmp    118c <main+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     11c9 <main+0x99>
jmp    11d0 <main+0xa0>
mov    $0x0,%al
call   1030 <menu@plt>
mov    %eax,-0xc(%rbp)
jmp    11d0 <main+0xa0>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <jogo@plt>
mov    %eax,-0xc(%rbp)
jmp    11d0 <main+0xa0>
movl   $0x0,-0x8(%rbp)
jmp    114d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xeb5(%rip),%rbx
lea    0xebb(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x3,%ebp
je     1198 <main+0x58>
cmp    $0x1,%ebp
je     1185 <main+0x45>
test   %ebp,%ebp
jne    1160 <main+0x20>
xor    %eax,%eax
call   1040 <menu@plt>
mov    %eax,%ebp
jmp    1160 <main+0x20>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <jogo@plt>
mov    %eax,%ebp
jmp    1160 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"ESTADO = %d\0A\00"
@.str.1 = [17 x i8] c"COME\C3\87AR O JOGO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %17, %0
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %3
switch i32 %10, label %17 [
i32 0, label %11
i32 1, label %13
i32 3, label %16
]
11: ; preds = %7
%12 = call i32 (...) @menu()
store i32 %12, i32* %3
br label %17
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (...) @jogo()
store i32 %15, i32* %3
br label %17
16: ; preds = %7
store i32 0, i32* %2
br label %17
17: ; preds = %7, %16, %13, %11
br label %4
18: ; preds = %4
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [13 x i8] c"ESTADO = %d\0A\00"
@str = [16 x i8] c"COME\C3\87AR O JOGO\00"
define i32 @main() {
br label %1
1: ; preds = %10, %0
%2 = phi i32 [ 0, %0 ], [ %11, %10 ]
br label %3
3: ; preds = %1, %3
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
switch i32 %2, label %3 [
i32 0, label %5
i32 1, label %7
i32 3, label %12
]
5: ; preds = %3
%6 = tail call i32 (...) @menu()
br label %10
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (...) @jogo()
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
br label %1
12: ; preds = %3
ret i32 0
}