#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*/ copiar_tablero(char *, char *);
int /*<<< orphan*/ cumple_reglas(char *, char, int, int, int, int);
scalar_t__ jugador_en_jaque(char *, char);
int /*<<< orphan*/ realizar_jugada(char *, int, int, int, int);
int es_mov_valido(char *ptablero, char jugador, int fi, int ci, int ff,
                  int cf) {
  if (!cumple_reglas(ptablero, jugador, fi, ci, ff, cf))
    return 0;
  char copia_tablero[64];
  copiar_tablero(ptablero, copia_tablero);
  realizar_jugada(copia_tablero, fi, ci, ff, cf);
  if (jugador_en_jaque(copia_tablero, jugador))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<es_mov_valido>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x11(%rbp),%al
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
movsbl %al,%esi
call   1060 <cumple_reglas@plt>
cmp    $0x0,%eax
jne    1192 <es_mov_valido+0x52>
movl   $0x0,-0x4(%rbp)
jmp    11df <es_mov_valido+0x9f>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <copiar_tablero@plt>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
call   1050 <realizar_jugada@plt>
lea    -0x70(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <jugador_en_jaque@plt>
cmp    $0x0,%rax
je     11d8 <es_mov_valido+0x98>
movl   $0x0,-0x4(%rbp)
jmp    11df <es_mov_valido+0x9f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<es_mov_valido>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9d,%r15d
mov    %r8d,%r12d
mov    %ecx,%r13d
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
call   1060 <cumple_reglas@plt>
test   %eax,%eax
je     11a2 <es_mov_valido+0x62>
mov    %rsp,%rsi
mov    %rbp,%rdi
mov    %rsi,%rbp
call   1040 <copiar_tablero@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
call   1050 <realizar_jugada@plt>
movsbl %r14b,%esi
mov    %rbp,%rdi
call   1030 <jugador_en_jaque@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
jmp    11a4 <es_mov_valido+0x64>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @es_mov_valido(i8* %0, i8 signext %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [64 x i8]
store i8* %0, i8** %8
store i8 %1, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%15 = load i8*, i8** %8
%16 = load i8, i8* %9
%17 = load i32, i32* %10
%18 = load i32, i32* %11
%19 = load i32, i32* %12
%20 = load i32, i32* %13
%21 = call i32 @cumple_reglas(i8* %15, i8 signext %16, i32 %17, i32 %18, i32 %19, i32 %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %6
store i32 0, i32* %7
br label %40
24: ; preds = %6
%25 = load i8*, i8** %8
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 0
%27 = call i32 @copiar_tablero(i8* %25, i8* %26)
%28 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 0
%29 = load i32, i32* %10
%30 = load i32, i32* %11
%31 = load i32, i32* %12
%32 = load i32, i32* %13
%33 = call i32 @realizar_jugada(i8* %28, i32 %29, i32 %30, i32 %31, i32 %32)
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 0
%35 = load i8, i8* %9
%36 = call i64 @jugador_en_jaque(i8* %34, i8 signext %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %24
store i32 0, i32* %7
br label %40
39: ; preds = %24
store i32 1, i32* %7
br label %40
40: ; preds = %39, %38, %23
%41 = load i32, i32* %7
ret i32 %41
}

LLVM IR (-O2):
define i32 @es_mov_valido(i8* %0, i8 signext %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [64 x i8]
%8 = tail call i32 @cumple_reglas(i8* %0, i8 signext %1, i32 %2, i32 %3, i32 %4, i32 %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %6
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%12 = call i32 @copiar_tablero(i8* %0, i8* %11)
%13 = call i32 @realizar_jugada(i8* %11, i32 %2, i32 %3, i32 %4, i32 %5)
%14 = call i64 @jugador_en_jaque(i8* %11, i8 signext %1)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %6, %10
%18 = phi i32 [ %16, %10 ], [ 0, %6 ]
ret i32 %18
}