#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 */
scalar_t__ is_black_field(int, int);
int /*<<< orphan*/ printf(char *, ...);
void print_board(int board[][8]) {
  int i, j;
  printf("    0   1   2   3   4   5   6   7 \n");
  printf("  +---+---+---+---+---+---+---+---+\n");
  for (i = 0; i < 8; i++) {
    printf("%d ", i);
    for (j = 0; j < 8; j++) {
      printf("|");
      if (is_black_field(i, j))
        printf("\x1b[40m");
      else
        printf("\x1b[47m");
      if (board[i][j] == 1)
        printf(" "
               "\u26C0"
               " ");
      else if (board[i][j] == -1)
        printf(" "
               "\u26C2"
               " ");
      else
        printf("   ");
      printf("\x1b[0m");
    }
    printf("|\n");
    printf("  +---+---+---+---+---+---+---+---+\n");
  }
  printf("Note, that colors may vary depending on your settings\n");
  printf("White piece - "
         "\u26C0"
         ", black piece - "
         "\u26C2"
         "\t");
}


x86 assembly (clang, -O0):
<print_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1278 <print_board+0x158>
mov    -0xc(%rbp),%esi
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    124e <print_board+0x12e>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <is_black_field@plt>
cmp    $0x0,%rax
je     11b1 <print_board+0x91>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bf <print_board+0x9f>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    11ef <print_board+0xcf>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1232 <print_board+0x112>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    121f <print_board+0xff>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122d <print_board+0x10d>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1232 <print_board+0x112>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1171 <print_board+0x51>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <print_board+0x2f>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_board>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xef6(%rip),%rdi
call   1050 <puts@plt>
lea    0xf45(%rip),%rdi
call   1050 <puts@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
lea    0xe89(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %r14d,%r14d
lea    0xe92(%rip),%r13
lea    0xe7f(%rip),%r15
lea    0xe88(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1040 <is_black_field@plt>
test   %rax,%rax
lea    0xe46(%rip),%rdi
lea    0xe45(%rip),%rax
cmove  %rax,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx,%r14,4),%eax
cmp    $0xffffffff,%eax
mov    %r13,%rdi
lea    0xe35(%rip),%rcx
cmove  %rcx,%rdi
cmp    $0x1,%eax
cmove  %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r14
cmp    $0x8,%r14
jne    11a0 <print_board+0x60>
lea    0xe96(%rip),%rdi
call   1050 <puts@plt>
lea    0xe8c(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%rbp
add    $0x20,%rbx
cmp    $0x8,%rbp
jne    1170 <print_board+0x30>
lea    0xe36(%rip),%rdi
call   1050 <puts@plt>
lea    0xde1(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c" 0 1 2 3 4 5 6 7 \0A\00"
@.str.1 = [37 x i8] c" +---+---+---+---+---+---+---+---+\0A\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"|\00"
@.str.4 = [6 x i8] c"\1B[40m\00"
@.str.5 = [6 x i8] c"\1B[47m\00"
@.str.6 = [6 x i8] c" \E2\9B\80 \00"
@.str.7 = [6 x i8] c" \E2\9B\82 \00"
@.str.8 = [4 x i8] c" \00"
@.str.9 = [5 x i8] c"\1B[0m\00"
@.str.10 = [3 x i8] c"|\0A\00"
@.str.11 = [55 x i8] c"Note, that colors may vary depending on your settings\0A\00"
@.str.12 = [38 x i8] c"White piece - \E2\9B\80, black piece - \E2\9B\82\09\00"
define void @print_board([8 x i32]* %0) {
%2 = alloca [8 x i32]*
%3 = alloca i32
%4 = alloca i32
store [8 x i32]* %0, [8 x i32]** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %61, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %64
10: ; preds = %7
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %11)
store i32 0, i32* %4
br label %13
13: ; preds = %55, %10
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 8
br i1 %15, label %16, label %58
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i64 @is_black_field(i32 %18, i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %26
24: ; preds = %16
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = load [8 x i32]*, [8 x i32]** %2
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [8 x i32], [8 x i32]* %27, i64 %29
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [8 x i32], [8 x i32]* %30, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %38
36: ; preds = %26
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %53
38: ; preds = %26
%39 = load [8 x i32]*, [8 x i32]** %2
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [8 x i32], [8 x i32]* %39, i64 %41
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [8 x i32], [8 x i32]* %42, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %50
48: ; preds = %38
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %52
50: ; preds = %38
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
br label %53
53: ; preds = %52, %36
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %55
55: ; preds = %53
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %13
58: ; preds = %13
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %61
61: ; preds = %58
%62 = load i32, i32* %3
%63 = add nsw i32 %62, 1
store i32 %63, i32* %3
br label %7
64: ; preds = %7
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.11, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%d \00"
@.str.4 = [6 x i8] c"\1B[40m\00"
@.str.5 = [6 x i8] c"\1B[47m\00"
@.str.6 = [6 x i8] c" \E2\9B\80 \00"
@.str.7 = [6 x i8] c" \E2\9B\82 \00"
@.str.8 = [4 x i8] c" \00"
@.str.9 = [5 x i8] c"\1B[0m\00"
@.str.12 = [38 x i8] c"White piece - \E2\9B\80, black piece - \E2\9B\82\09\00"
@str = [35 x i8] c" 0 1 2 3 4 5 6 7 \00"
@str.14 = [54 x i8] c"Note, that colors may vary depending on your settings\00"
@str.15 = [2 x i8] c"|\00"
@str.16 = [36 x i8] c" +---+---+---+---+---+---+---+---+\00"
define void @print_board([8 x i32]* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.16, i64 0, i64 0))
br label %4
4: ; preds = %1, %26
%5 = phi i64 [ 0, %1 ], [ %29, %26 ]
%6 = trunc i64 %5 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %24, %8 ]
%10 = tail call i32 @putchar(i32 124)
%11 = trunc i64 %9 to i32
%12 = tail call i64 @is_black_field(i32 %6, i32 %11)
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %14)
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %0, i64 %5, i64 %9
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, -1
%19 = select i1 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0)
%20 = icmp eq i32 %17, 1
%21 = select i1 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %19
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %21)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%24 = add nuw nsw i64 %9, 1
%25 = icmp eq i64 %24, 8
br i1 %25, label %26, label %8
26: ; preds = %8
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.16, i64 0, i64 0))
%29 = add nuw nsw i64 %5, 1
%30 = icmp eq i64 %29, 8
br i1 %30, label %31, label %4
31: ; preds = %26
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.14, i64 0, i64 0))
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0))
ret void
}