#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*/ changePlayerName();
int /*<<< orphan*/ changePlayerSymbol();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void configure() {
  int op = 0;
  while (op != 3) {
    printf("\033[2J");
    printf("###################################################################"
           "##########\n");
    printf("#                             Velha - Configure                    "
           "         #\n");
    printf("#                                                                  "
           "         #\n");
    printf("#                              1) Change player name               "
           "         #\n");
    printf("#                                                                  "
           "         #\n");
    printf("#                              2) Change player symbol             "
           "         #\n");
    printf("#                                                                  "
           "         #\n");
    printf("#                              3) Back                             "
           "         #\n");
    printf("#                                                                  "
           "         #\n");
    printf("###################################################################"
           "##########\n");
    printf("\n\n///> ");
    scanf("%d", &op);
    if (op == 1) {
      changePlayerName();
    } else if (op == 2) {
      changePlayerSymbol();
    }
  }
}


x86 assembly (clang, -O0):
<configure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     122a <configure+0xea>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
call   1040 <printf@plt>
lea    0xf1f(%rip),%rdi
call   1040 <printf@plt>
lea    0xf62(%rip),%rdi
call   1040 <printf@plt>
lea    0xf07(%rip),%rdi
call   1040 <printf@plt>
lea    0xf99(%rip),%rdi
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
call   1040 <printf@plt>
lea    0xfd0(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
lea    0xffb(%rip),%rdi
call   1040 <printf@plt>
lea    0xff7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    120f <configure+0xcf>
mov    $0x0,%al
call   1030 <changePlayerName@plt>
jmp    1225 <configure+0xe5>
cmpl   $0x2,-0x4(%rbp)
jne    1220 <configure+0xe0>
mov    $0x0,%al
call   1060 <changePlayerSymbol@plt>
jmp    1225 <configure+0xe5>
jmp    114f <configure+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configure>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x102c(%rip),%r12
lea    0xfd7(%rip),%rbx
lea    0xf82(%rip),%r14
lea    0xe86(%rip),%r15
lea    0xe87(%rip),%r13
lea    0x4(%rsp),%rbp
jmp    11a4 <configure+0x54>
nopl   (%rax)
xor    %eax,%eax
call   1070 <changePlayerSymbol@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     1241 <configure+0xf1>
lea    0xe55(%rip),%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xe51(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1190 <configure+0x40>
cmp    $0x1,%eax
jne    119b <configure+0x4b>
xor    %eax,%eax
call   1040 <changePlayerName@plt>
jmp    1197 <configure+0x47>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [79 x i8] c"#############################################################################\0A\00"
@.str.2 = [79 x i8] c"# Velha - Configure #\0A\00"
@.str.3 = [79 x i8] c"# #\0A\00"
@.str.4 = [79 x i8] c"# 1) Change player name #\0A\00"
@.str.5 = [79 x i8] c"# 2) Change player symbol #\0A\00"
@.str.6 = [79 x i8] c"# 3) Back #\0A\00"
@.str.7 = [8 x i8] c"\0A\0A///> \00"
@.str.8 = [3 x i8] c"%d\00"
define void @configure() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %29, %0
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 3
br i1 %4, label %5, label %30
5: ; preds = %2
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %5
%22 = call i32 (...) @changePlayerName()
br label %29
23: ; preds = %5
%24 = load i32, i32* %1
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (...) @changePlayerSymbol()
br label %28
28: ; preds = %26, %23
br label %29
29: ; preds = %28, %21
br label %2
30: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
@.str.7 = [8 x i8] c"\0A\0A///> \00"
@.str.8 = [3 x i8] c"%d\00"
@str.9 = [78 x i8] c"# Velha - Configure #\00"
@str.11 = [78 x i8] c"# 1) Change player name #\00"
@str.13 = [78 x i8] c"# 2) Change player symbol #\00"
@str.15 = [78 x i8] c"# 3) Back #\00"
@str.16 = [78 x i8] c"# #\00"
@str.17 = [78 x i8] c"#############################################################################\00"
define void @configure() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %24
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.17, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.9, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.16, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.11, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.16, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.13, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.16, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.15, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.16, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.17, i64 0, i64 0))
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
switch i32 %17, label %24 [
i32 1, label %18
i32 2, label %20
]
18: ; preds = %3
%19 = call i32 (...) @changePlayerName()
br label %22
20: ; preds = %3
%21 = call i32 (...) @changePlayerSymbol()
br label %22
22: ; preds = %18, %20
%23 = load i32, i32* %1
br label %24
24: ; preds = %22, %3
%25 = phi i32 [ %23, %22 ], [ %17, %3 ]
%26 = icmp eq i32 %25, 3
br i1 %26, label %27, label %3
27: ; preds = %24
ret void
}