#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("clear");
    printf("******* JOGO DA VELHA *******");
    printf("\n\n1. 1 jogador\n2. 2 jogadores\n3. Sair\n");
    scanf("%d", &jogs);
    if (jogs == 1) {
      printf("Dificuldade: \n1. Facil\n2. Dificil\n");
      scanf("%d", &jogs);
      if (jogs == 2)
        jogs = 4;
    }
  }
  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    11be <show_menu+0x8e>
lea    0xeb0(%rip),%rdi
call   1030 <system@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    11b9 <show_menu+0x89>
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x2,-0x4(%rbp)
jne    11b4 <show_menu+0x84>
movl   $0x4,-0x4(%rbp)
jmp    11b9 <show_menu+0x89>
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    0xea5(%rip),%r15
lea    0xebf(%rip),%r12
lea    0xeb5(%rip),%r13
lea    0x4(%rsp),%rbx
lea    0xed2(%rip),%rbp
jmp    1184 <show_menu+0x44>
nopl   (%rax)
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    $0x1,%eax
jne    1180 <show_menu+0x40>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jne    1180 <show_menu+0x40>
mov    $0x4,%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 = [30 x i8] c"******* JOGO DA VELHA *******\00"
@.str.2 = [39 x i8] c"\0A\0A1. 1 jogador\0A2. 2 jogadores\0A3. Sair\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [35 x i8] c"Dificuldade: \0A1. Facil\0A2. Dificil\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 ([6 x i8], [6 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 ([39 x i8], [39 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, 1
br i1 %11, label %12, label %19
12: ; preds = %5
%13 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 4, i32* %1
br label %18
18: ; preds = %17, %12
br label %19
19: ; preds = %18, %5
br label %2
20: ; preds = %2
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [30 x i8] c"******* JOGO DA VELHA *******\00"
@.str.3 = [3 x i8] c"%d\00"
@str = [38 x i8] c"\0A\0A1. 1 jogador\0A2. 2 jogadores\0A3. Sair\00"
@str.5 = [34 x i8] c"Dificuldade: \0A1. Facil\0A2. Dificil\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, %15
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 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 ([38 x i8], [38 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
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 2
br i1 %14, label %18, label %15
15: ; preds = %10, %3
%16 = phi i32 [ %13, %10 ], [ %8, %3 ]
%17 = icmp eq i32 %16, 0
br i1 %17, label %3, label %18
18: ; preds = %15, %10
%19 = phi i32 [ 4, %10 ], [ %16, %15 ]
ret i32 %19
}