#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*/ printf(char *);
print_board(int *board[8]) {
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++)
      printf(board[i][j] ? "Q " : ". ");
    printf("\n");
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<print_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1193 <print_board+0x83>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    1179 <print_board+0x69>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xeab(%rip),%rdi
lea    0xea1(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <print_board+0x24>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <print_board+0x13>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_board>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xebf(%rip),%r15
lea    0xeb5(%rip),%r12
jmp    116d <print_board+0x3d>
nopl   (%rax)
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x8,%rbx
je     1218 <print_board+0xe8>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,(%rax)
mov    %r15,%rdi
je     117c <print_board+0x4c>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,0x4(%rax)
mov    %r15,%rdi
je     1191 <print_board+0x61>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,0x8(%rax)
mov    %r15,%rdi
je     11a6 <print_board+0x76>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,0xc(%rax)
mov    %r15,%rdi
je     11bb <print_board+0x8b>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,0x10(%rax)
mov    %r15,%rdi
je     11d0 <print_board+0xa0>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,0x14(%rax)
mov    %r15,%rdi
je     11e5 <print_board+0xb5>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,0x18(%rax)
mov    %r15,%rdi
je     11fa <print_board+0xca>
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%r14,%rbx,8),%rax
cmpl   $0x0,0x1c(%rax)
mov    %r15,%rdi
je     1150 <print_board+0x20>
mov    %r12,%rdi
jmp    1150 <print_board+0x20>
lea    0xde7(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"Q \00"
@.str.1 = [3 x i8] c". \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
define i32 @print_board(i32** %0) {
%2 = alloca i32
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32
store i32** %0, i32*** %3
store i32 0, i32* %4
br label %6
6: ; preds = %32, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %35
9: ; preds = %6
store i32 0, i32* %5
br label %10
10: ; preds = %27, %9
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 8
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i32**, i32*** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32*, i32** %14, i64 %16
%18 = load i32*, i32** %17
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i64
%25 = select i1 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%26 = call i32 @printf(i8* %25)
br label %27
27: ; preds = %13
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %10
30: ; preds = %10
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %6
35: ; preds = %6
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%37 = load i32, i32* %2
ret i32 %37
}

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