#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 get_piece_type(int);
int /*<<< orphan*/ printf(char *, ...);
void print_board(int **board) {
  for (int i = 0; i < (8 * 2) + 1; i++) {
    printf("#");
  }
  printf("\n");
  for (int i = 0; i < 8; i++) {
    printf("#");
    for (int j = 0; j < 8; j++) {
      printf("%c", get_piece_type(board[j][i]));
      printf("#");
    }
    printf("\n");
  }
  for (int i = 0; i < (8 * 2) + 1; i++) {
    printf("#");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x11,-0xc(%rbp)
jge    1159 <print_board+0x39>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <print_board+0x13>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11f7 <print_board+0xd7>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11db <print_board+0xbb>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <print_board+0x6d>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116e <print_board+0x4e>
movl   $0x0,-0x18(%rbp)
cmpl   $0x11,-0x18(%rbp)
jge    1224 <print_board+0x104>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11fe <print_board+0xde>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_board>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    (%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x8(%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x10(%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x18(%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x20(%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x28(%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x30(%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x38(%r14),%rax
mov    (%rax,%rbx,1),%edi
call   1040 <get_piece_type@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x4,%rbx
cmp    $0x20,%rbx
jne    11e0 <print_board+0xc0>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"#\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%c\00"
define void @print_board(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32** %0, i32*** %2
store i32 0, i32* %3
br label %7
7: ; preds = %12, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 17
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %7
15: ; preds = %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %17
17: ; preds = %43, %15
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 8
br i1 %19, label %20, label %46
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %22
22: ; preds = %38, %20
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 8
br i1 %24, label %25, label %41
25: ; preds = %22
%26 = load i32**, i32*** %2
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32*, i32** %26, i64 %28
%30 = load i32*, i32** %29
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = load i32, i32* %33
%35 = call i32 @get_piece_type(i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %38
38: ; preds = %25
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %22
41: ; preds = %22
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %17
46: ; preds = %17
store i32 0, i32* %6
br label %47
47: ; preds = %52, %46
%48 = load i32, i32* %6
%49 = icmp slt i32 %48, 17
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %52
52: ; preds = %50
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %47
55: ; preds = %47
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @print_board(i32** nocapture %0) {
%2 = tail call i32 @putchar(i32 35)
%3 = tail call i32 @putchar(i32 35)
%4 = tail call i32 @putchar(i32 35)
%5 = tail call i32 @putchar(i32 35)
%6 = tail call i32 @putchar(i32 35)
%7 = tail call i32 @putchar(i32 35)
%8 = tail call i32 @putchar(i32 35)
%9 = tail call i32 @putchar(i32 35)
%10 = tail call i32 @putchar(i32 35)
%11 = tail call i32 @putchar(i32 35)
%12 = tail call i32 @putchar(i32 35)
%13 = tail call i32 @putchar(i32 35)
%14 = tail call i32 @putchar(i32 35)
%15 = tail call i32 @putchar(i32 35)
%16 = tail call i32 @putchar(i32 35)
%17 = tail call i32 @putchar(i32 35)
%18 = tail call i32 @putchar(i32 35)
%19 = tail call i32 @putchar(i32 10)
%20 = getelementptr inbounds i32*, i32** %0, i64 1
%21 = getelementptr inbounds i32*, i32** %0, i64 2
%22 = getelementptr inbounds i32*, i32** %0, i64 3
%23 = getelementptr inbounds i32*, i32** %0, i64 4
%24 = getelementptr inbounds i32*, i32** %0, i64 5
%25 = getelementptr inbounds i32*, i32** %0, i64 6
%26 = getelementptr inbounds i32*, i32** %0, i64 7
br label %27
27: ; preds = %1, %27
%28 = phi i64 [ 0, %1 ], [ %79, %27 ]
%29 = tail call i32 @putchar(i32 35)
%30 = load i32*, i32** %0
%31 = getelementptr inbounds i32, i32* %30, i64 %28
%32 = load i32, i32* %31
%33 = tail call i32 @get_piece_type(i32 %32)
%34 = tail call i32 @putchar(i32 %33)
%35 = tail call i32 @putchar(i32 35)
%36 = load i32*, i32** %20
%37 = getelementptr inbounds i32, i32* %36, i64 %28
%38 = load i32, i32* %37
%39 = tail call i32 @get_piece_type(i32 %38)
%40 = tail call i32 @putchar(i32 %39)
%41 = tail call i32 @putchar(i32 35)
%42 = load i32*, i32** %21
%43 = getelementptr inbounds i32, i32* %42, i64 %28
%44 = load i32, i32* %43
%45 = tail call i32 @get_piece_type(i32 %44)
%46 = tail call i32 @putchar(i32 %45)
%47 = tail call i32 @putchar(i32 35)
%48 = load i32*, i32** %22
%49 = getelementptr inbounds i32, i32* %48, i64 %28
%50 = load i32, i32* %49
%51 = tail call i32 @get_piece_type(i32 %50)
%52 = tail call i32 @putchar(i32 %51)
%53 = tail call i32 @putchar(i32 35)
%54 = load i32*, i32** %23
%55 = getelementptr inbounds i32, i32* %54, i64 %28
%56 = load i32, i32* %55
%57 = tail call i32 @get_piece_type(i32 %56)
%58 = tail call i32 @putchar(i32 %57)
%59 = tail call i32 @putchar(i32 35)
%60 = load i32*, i32** %24
%61 = getelementptr inbounds i32, i32* %60, i64 %28
%62 = load i32, i32* %61
%63 = tail call i32 @get_piece_type(i32 %62)
%64 = tail call i32 @putchar(i32 %63)
%65 = tail call i32 @putchar(i32 35)
%66 = load i32*, i32** %25
%67 = getelementptr inbounds i32, i32* %66, i64 %28
%68 = load i32, i32* %67
%69 = tail call i32 @get_piece_type(i32 %68)
%70 = tail call i32 @putchar(i32 %69)
%71 = tail call i32 @putchar(i32 35)
%72 = load i32*, i32** %26
%73 = getelementptr inbounds i32, i32* %72, i64 %28
%74 = load i32, i32* %73
%75 = tail call i32 @get_piece_type(i32 %74)
%76 = tail call i32 @putchar(i32 %75)
%77 = tail call i32 @putchar(i32 35)
%78 = tail call i32 @putchar(i32 10)
%79 = add nuw nsw i64 %28, 1
%80 = icmp eq i64 %79, 8
br i1 %80, label %81, label %27
81: ; preds = %27
%82 = tail call i32 @putchar(i32 35)
%83 = tail call i32 @putchar(i32 35)
%84 = tail call i32 @putchar(i32 35)
%85 = tail call i32 @putchar(i32 35)
%86 = tail call i32 @putchar(i32 35)
%87 = tail call i32 @putchar(i32 35)
%88 = tail call i32 @putchar(i32 35)
%89 = tail call i32 @putchar(i32 35)
%90 = tail call i32 @putchar(i32 35)
%91 = tail call i32 @putchar(i32 35)
%92 = tail call i32 @putchar(i32 35)
%93 = tail call i32 @putchar(i32 35)
%94 = tail call i32 @putchar(i32 35)
%95 = tail call i32 @putchar(i32 35)
%96 = tail call i32 @putchar(i32 35)
%97 = tail call i32 @putchar(i32 35)
%98 = tail call i32 @putchar(i32 35)
%99 = tail call i32 @putchar(i32 10)
ret void
}