#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*/ board_to_string(char *, float *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ move_go(float *, int, int, int);
int /*<<< orphan*/ string_to_board(char *, float *);
int legal_go(float *b, char *ko, int p, int r, int c) {
  if (b[r * 19 + c])
    return 0;
  char curr[91];
  char next[91];
  board_to_string(curr, b);
  move_go(b, p, r, c);
  board_to_string(next, b);
  string_to_board(curr, b);
  if (memcmp(next, ko, 91) == 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<legal_go>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x13,-0x20(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1187 <legal_go+0x47>
jp     1187 <legal_go+0x47>
jmp    1193 <legal_go+0x53>
movl   $0x0,-0x4(%rbp)
jmp    1201 <legal_go+0xc1>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <board_to_string@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1030 <move_go@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <board_to_string@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <string_to_board@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x5b,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
jne    11fa <legal_go+0xba>
movl   $0x0,-0x4(%rbp)
jmp    1201 <legal_go+0xc1>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<legal_go>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %ecx,%ebp
lea    0x0(%rbp,%rbp,8),%eax
lea    0x0(%rbp,%rax,2),%eax
add    %r8d,%eax
cltq
movss  (%rdi,%rax,4),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11d1 <legal_go+0x91>
jp     11d1 <legal_go+0x91>
mov    %r8d,%r15d
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x60(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <board_to_string@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1030 <move_go@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <board_to_string@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <string_to_board@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x5b,%edx
call   1050 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @legal_go(float* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca float*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [91 x i8]
%13 = alloca [91 x i8]
store float* %0, float** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%14 = load float*, float** %7
%15 = load i32, i32* %10
%16 = mul nsw i32 %15, 19
%17 = load i32, i32* %11
%18 = add nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds float, float* %14, i64 %19
%21 = load float, float* %20
%22 = fcmp une float %21, 0.000000e+00
br i1 %22, label %23, label %24
23: ; preds = %5
store i32 0, i32* %6
br label %45
24: ; preds = %5
%25 = getelementptr inbounds [91 x i8], [91 x i8]* %12, i64 0, i64 0
%26 = load float*, float** %7
%27 = call i32 @board_to_string(i8* %25, float* %26)
%28 = load float*, float** %7
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = load i32, i32* %11
%32 = call i32 @move_go(float* %28, i32 %29, i32 %30, i32 %31)
%33 = getelementptr inbounds [91 x i8], [91 x i8]* %13, i64 0, i64 0
%34 = load float*, float** %7
%35 = call i32 @board_to_string(i8* %33, float* %34)
%36 = getelementptr inbounds [91 x i8], [91 x i8]* %12, i64 0, i64 0
%37 = load float*, float** %7
%38 = call i32 @string_to_board(i8* %36, float* %37)
%39 = getelementptr inbounds [91 x i8], [91 x i8]* %13, i64 0, i64 0
%40 = load i8*, i8** %8
%41 = call i64 @memcmp(i8* %39, i8* %40, i32 91)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %24
store i32 0, i32* %6
br label %45
44: ; preds = %24
store i32 1, i32* %6
br label %45
45: ; preds = %44, %43, %23
%46 = load i32, i32* %6
ret i32 %46
}

LLVM IR (-O2):
define i32 @legal_go(float* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [91 x i8]
%7 = alloca [91 x i8]
%8 = mul nsw i32 %3, 19
%9 = add nsw i32 %8, %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds float, float* %0, i64 %10
%12 = load float, float* %11
%13 = fcmp une float %12, 0.000000e+00
br i1 %13, label %24, label %14
14: ; preds = %5
%15 = getelementptr inbounds [91 x i8], [91 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [91 x i8], [91 x i8]* %7, i64 0, i64 0
%17 = call i32 @board_to_string(i8* %15, float* %0)
%18 = call i32 @move_go(float* %0, i32 %2, i32 %3, i32 %4)
%19 = call i32 @board_to_string(i8* %16, float* %0)
%20 = call i32 @string_to_board(i8* %15, float* %0)
%21 = call i64 @memcmp(i8* %16, i8* %1, i32 91)
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %5, %14
%25 = phi i32 [ %23, %14 ], [ 0, %5 ]
ret i32 %25
}