#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int);
int /*<<< orphan*/ stdout;
char elegirTurno() {
  char turno;
  int ficha = -1;
  do {
    if (ficha != -1) {
      printf("\n\t >>>>>>>>Debe elegir una ficha permitida.");
    }
    printf("\nFichas\n\t 1.X\n\t 2.O\nElija una ficha: ");
    fflush(stdout);
    scanf("%d", ficha);
  } while (ficha != 1 || ficha != 2);
  if (ficha == 1) {
    turno = 'x';
  } else if (ficha == 2) {
    turno = 'o';
  }
  return turno;
}


x86 assembly (clang, -O0):
<elegirTurno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     1155 <elegirTurno+0x25>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x8(%rbp),%esi
lea    0xed9(%rip),%rdi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jne    1197 <elegirTurno+0x67>
cmpl   $0x2,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113f <elegirTurno+0xf>
cmpl   $0x1,-0x8(%rbp)
jne    11b5 <elegirTurno+0x85>
movb   $0x78,-0x1(%rbp)
jmp    11c8 <elegirTurno+0x98>
cmpl   $0x2,-0x8(%rbp)
jne    11c3 <elegirTurno+0x93>
movb   $0x6f,-0x1(%rbp)
jmp    11c8 <elegirTurno+0x98>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elegirTurno>:
push   %r15
push   %r14
push   %rbx
lea    0xec4(%rip),%r14
mov    0x2e9d(%rip),%r15
lea    0xedc(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%r15),%edi
call   1040 <fflush@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   1050 <scanf@plt>
jmp    1150 <elegirTurno+0x20>

LLVM IR (-O0):
@.str = [44 x i8] c"\0A\09 >>>>>>>>Debe elegir una ficha permitida.\00"
@.str.1 = [38 x i8] c"\0AFichas\0A\09 1.X\0A\09 2.O\0AElija una ficha: \00"
@stdout = global i32 0
@.str.2 = [3 x i8] c"%d\00"
define signext i8 @elegirTurno() {
%1 = alloca i8
%2 = alloca i32
store i32 -1, i32* %2
br label %3
3: ; preds = %20, %0
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 1
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 2
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ true, %14 ], [ %19, %17 ]
br i1 %21, label %3, label %22
22: ; preds = %20
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %26
25: ; preds = %22
store i8 120, i8* %1
br label %31
26: ; preds = %22
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %30
29: ; preds = %26
store i8 111, i8* %1
br label %30
30: ; preds = %29, %26
br label %31
31: ; preds = %30, %25
%32 = load i8, i8* %1
ret i8 %32
}

LLVM IR (-O2):
@.str.1 = [38 x i8] c"\0AFichas\0A\09 1.X\0A\09 2.O\0AElija una ficha: \00"
@stdout = global i32 0
@.str.2 = [3 x i8] c"%d\00"
define signext i8 @elegirTurno() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 -1)
br label %1
}