#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 position_choice(int lc) {
  int p;
  if (lc == 0)
    printf("\nEscolha a linha: \n");
  else if (lc == 1)
    printf("\nEscolha a coluna: \n");
  else if (lc == 2)
    printf("\nEscolha a direcao: \n");
  scanf("%d", &p);
  return p;
}


x86 assembly (clang, -O0):
<position_choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1146 <position_choice+0x26>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <position_choice+0x61>
cmpl   $0x1,-0x4(%rbp)
jne    1161 <position_choice+0x41>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <position_choice+0x5c>
cmpl   $0x2,-0x4(%rbp)
jne    1177 <position_choice+0x57>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <position_choice+0x5c>
jmp    1181 <position_choice+0x61>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<position_choice>:
push   %rax
cmp    $0x2,%edi
ja     113c <position_choice+0x1c>
movslq %edi,%rax
lea    0xf10(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0AEscolha a linha: \0A\00"
@.str.1 = [21 x i8] c"\0AEscolha a coluna: \0A\00"
@.str.2 = [22 x i8] c"\0AEscolha a direcao: \0A\00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @position_choice(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %20
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %19
13: ; preds = %8
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
br label %19
19: ; preds = %18, %11
br label %20
20: ; preds = %19, %6
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str.3 = [3 x i8] c"%d\00"
@str = [21 x i8] c"\0AEscolha a direcao: \00"
@str.4 = [20 x i8] c"\0AEscolha a coluna: \00"
@str.5 = [19 x i8] c"\0AEscolha a linha: \00"
@reltable.position_choice = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @str.5 to i64), i64 ptrtoint ([3 x i32]* @reltable.position_choice to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.position_choice to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @str to i64), i64 ptrtoint ([3 x i32]* @reltable.position_choice to i64)) to i32)]
define i32 @position_choice(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp ult i32 %0, 3
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = sext i32 %0 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.position_choice to i8*), i64 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
br label %10
10: ; preds = %1, %5
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
ret i32 %12
}