#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*/ jogada_valida(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int jogada_correta(int vetor_posicao[9], int i) {
  int jogada;
  do {
    if (i % 2 == 0) {
      printf("Digite a jogada jogador 2\n");
    } else {
      printf("Digite a jogada jogador 1\n");
    }
    scanf("%d", &jogada);
  } while ((jogada > 9 || jogada < 1) || !jogada_valida(vetor_posicao, jogada));
  return jogada;
}


x86 assembly (clang, -O0):
<jogada_correta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1164 <jogada_correta+0x34>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    1170 <jogada_correta+0x40>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x9,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jg     11b5 <jogada_correta+0x85>
mov    $0x1,%al
cmpl   $0x1,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jl     11b5 <jogada_correta+0x85>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1050 <jogada_valida@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    113f <jogada_correta+0xf>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jogada_correta>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
test   $0x1,%sil
lea    0xed7(%rip),%rax
lea    0xeb6(%rip),%rbx
cmove  %rax,%rbx
lea    0xea8(%rip),%r15
lea    0x4(%rsp),%r12
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    -0xa(%rsi),%eax
cmp    $0xfffffff7,%eax
jb     1160 <jogada_correta+0x30>
mov    %r14,%rdi
call   1050 <jogada_valida@plt>
test   %eax,%eax
je     1160 <jogada_correta+0x30>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Digite a jogada jogador 2\0A\00"
@.str.1 = [27 x i8] c"Digite a jogada jogador 1\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @jogada_correta(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
br label %6
6: ; preds = %28, %2
%7 = load i32, i32* %4
%8 = srem i32 %7, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %14
12: ; preds = %6
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
br label %16
16: ; preds = %14
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, 9
br i1 %18, label %28, label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 1
br i1 %21, label %28, label %22
22: ; preds = %19
%23 = load i32*, i32** %3
%24 = load i32, i32* %5
%25 = call i32 @jogada_valida(i32* %23, i32 %24)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br label %28
28: ; preds = %22, %19, %16
%29 = phi i1 [ true, %19 ], [ true, %16 ], [ %27, %22 ]
br i1 %29, label %6, label %30
30: ; preds = %28
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@str = [26 x i8] c"Digite a jogada jogador 1\00"
@str.3 = [26 x i8] c"Digite a jogada jogador 2\00"
define i32 @jogada_correta(i32* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = and i32 %1, 1
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0)
br label %8
8: ; preds = %17, %2
%9 = call i32 @puts(i8* dereferenceable(1) %7)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = add i32 %11, -10
%13 = icmp ult i32 %12, -9
br i1 %13, label %17, label %14
14: ; preds = %8
%15 = call i32 @jogada_valida(i32* %0, i32 %11)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14, %8
br label %8
18: ; preds = %14
%19 = load i32, i32* %3
ret i32 %19
}