#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 *);
int /*<<< orphan*/ system(char *);
int show_menu() {
  int jogs = 0;
  while (jogs == 0) {
    system("/usr/bin/clear");
    printf("******* JOGO DA VELHA *******");
    printf("\n\n1 multiplayer\n2  alone\n3. Sair\n");
    scanf("%d", &jogs);
    if (jogs == 3) {
      jogs = 4;
    }
    if (jogs == 2) {
      printf("Dificuldade: \n2. easy\n3. hard\n");
      scanf("%d", &jogs);
    }
  }
  return jogs;
}


x86 assembly (clang, -O0):
<show_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11b9 <show_menu+0x89>
lea    0xeb0(%rip),%rdi
call   1030 <system@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x3,-0x4(%rbp)
jne    118e <show_menu+0x5e>
movl   $0x4,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    11b4 <show_menu+0x84>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
jmp    113f <show_menu+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xea6(%rip),%r14
lea    0xeae(%rip),%r15
lea    0xec8(%rip),%r12
lea    0xebe(%rip),%r13
lea    0x4(%rsp),%rbx
lea    0xed6(%rip),%rbp
jmp    119b <show_menu+0x5b>
nopl   (%rax)
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jne    11d1 <show_menu+0x91>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1180 <show_menu+0x40>
cmp    $0x3,%eax
jne    1197 <show_menu+0x57>
mov    $0x4,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"/usr/bin/clear\00"
@.str.1 = [30 x i8] c"******* JOGO DA VELHA *******\00"
@.str.2 = [34 x i8] c"\0A\0A1 multiplayer\0A2 alone\0A3. Sair\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [31 x i8] c"Dificuldade: \0A2. easy\0A3. hard\0A\00"
define i32 @show_menu() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %19, %0
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %20
5: ; preds = %2
%6 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 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* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 3
br i1 %11, label %12, label %13
12: ; preds = %5
store i32 4, i32* %1
br label %13
13: ; preds = %12, %5
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
br label %19
19: ; preds = %16, %13
br label %2
20: ; preds = %2
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [15 x i8] c"/usr/bin/clear\00"
@.str.1 = [30 x i8] c"******* JOGO DA VELHA *******\00"
@.str.3 = [3 x i8] c"%d\00"
@str = [33 x i8] c"\0A\0A1 multiplayer\0A2 alone\0A3. Sair\00"
@str.5 = [30 x i8] c"Dificuldade: \0A2. easy\0A3. hard\00"
define i32 @show_menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %13
%4 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %13 [
i32 3, label %16
i32 2, label %9
]
9: ; preds = %3
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
br label %13
13: ; preds = %3, %9
%14 = phi i32 [ %8, %3 ], [ %12, %9 ]
%15 = icmp eq i32 %14, 0
br i1 %15, label %3, label %16
16: ; preds = %13, %3
%17 = phi i32 [ 4, %3 ], [ %14, %13 ]
ret i32 %17
}