#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*/ place(int *, int /*<<< orphan*/);
int /*<<< orphan*/ place_opt(int *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ test_is_col_free();
int /*<<< orphan*/ test_is_diag_free();
int /*<<< orphan*/ test_is_row_free();
int main() {
  int counter = 0;
  if (!test_is_row_free()) {
    printf("Is row free test failed!\n");
    counter++;
  }
  if (!test_is_col_free()) {
    printf("Is col free test failed!\n");
    counter++;
  }
  if (!test_is_diag_free()) {
    printf("Is diag free test failed!\n");
    counter++;
  }
  printf("%d tests failed.\n", counter);
  int board[64] = {0};
  place(board, 0);
  int array[8] = {0};
  place_opt(array, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test_is_row_free@plt>
cmp    $0x0,%eax
jne    11b0 <main+0x40>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <test_is_col_free@plt>
cmp    $0x0,%eax
jne    11d7 <main+0x67>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1080 <test_is_diag_free@plt>
cmp    $0x0,%eax
jne    11fe <main+0x8e>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
call   1090 <place@plt>
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
call   1030 <place_opt@plt>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x120,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <test_is_row_free@plt>
test   %eax,%eax
jne    1196 <main+0x26>
lea    0xe86(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebx
xor    %eax,%eax
call   1070 <test_is_col_free@plt>
test   %eax,%eax
jne    11b0 <main+0x40>
lea    0xe83(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1080 <test_is_diag_free@plt>
test   %eax,%eax
jne    11ca <main+0x5a>
lea    0xe82(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
lea    0xe2f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
xor    %esi,%esi
call   1090 <place@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <place_opt@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Is row free test failed!\0A\00"
@.str.1 = [26 x i8] c"Is col free test failed!\0A\00"
@.str.2 = [27 x i8] c"Is diag free test failed!\0A\00"
@.str.3 = [18 x i8] c"%d tests failed.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [64 x i32]
%4 = alloca [8 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 (...) @test_is_row_free()
%6 = icmp ne i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %11
11: ; preds = %7, %0
%12 = call i32 (...) @test_is_col_free()
%13 = icmp ne i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %18
18: ; preds = %14, %11
%19 = call i32 (...) @test_is_diag_free()
%20 = icmp ne i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %25
25: ; preds = %21, %18
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = bitcast [64 x i32]* %3 to i8*
%29 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%30 = call i32 @place(i32* %29, i32 0)
%31 = bitcast [8 x i32]* %4 to i8*
%32 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%33 = call i32 @place_opt(i32* %32, i32 0)
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str.3 = [18 x i8] c"%d tests failed.\0A\00"
@str = [25 x i8] c"Is row free test failed!\00"
@str.4 = [25 x i8] c"Is col free test failed!\00"
@str.5 = [26 x i8] c"Is diag free test failed!\00"
define i32 @main() {
%1 = alloca [64 x i32]
%2 = alloca [8 x i32]
%3 = tail call i32 (...) @test_is_row_free()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = phi i32 [ 0, %0 ], [ 1, %5 ]
%9 = tail call i32 (...) @test_is_col_free()
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%13 = add nuw nsw i32 %8, 1
br label %14
14: ; preds = %11, %7
%15 = phi i32 [ %8, %7 ], [ %13, %11 ]
%16 = tail call i32 (...) @test_is_diag_free()
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
%20 = add nuw nsw i32 %15, 1
br label %21
21: ; preds = %18, %14
%22 = phi i32 [ %15, %14 ], [ %20, %18 ]
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = bitcast [64 x i32]* %1 to i8*
%25 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 0
%26 = call i32 @place(i32* %25, i32 0)
%27 = bitcast [8 x i32]* %2 to i8*
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%29 = call i32 @place_opt(i32* %28, i32 0)
ret i32 0
}