#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 *, ...);
int /*<<< orphan*/ putchar(char);
void print_board(int board[]) {
  printf("+---------+---------+---------+\n");
  for (int line = 0; line < 9; line++) {
    putchar('|');
    for (int col = 0; col < 9; col++) {
      int c = board[line * 9 + col];
      if (0 == c) {
        printf(" . ");
      } else {
        printf(" %d ", c);
      }
      if (0 == (col + 1) % 3) {
        putchar('|');
      }
    }
    printf("\n");
    if (0 == (line + 1) % 3) {
      printf("+---------+---------+---------+\n");
    }
  }
}


x86 assembly (clang, -O0):
<print_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1225 <print_board+0x105>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    11de <print_board+0xbe>
mov    -0x8(%rbp),%rax
imul   $0x9,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jne    1198 <print_board+0x78>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a9 <print_board+0x89>
mov    -0x14(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    11cb <print_board+0xab>
mov    $0x7c,%edi
call   1030 <putchar@plt>
jmp    11d0 <print_board+0xb0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115c <print_board+0x3c>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    1212 <print_board+0xf2>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1217 <print_board+0xf7>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <print_board+0x21>
add    $0x20,%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,%r15
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb3(%rip),%r12
xor    %ebx,%ebx
jmp    1191 <print_board+0x61>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%rbx
add    $0x1,%rbx
imul   $0xaaaaaaab,%ebx,%eax
cmp    $0x55555556,%eax
jb     1220 <print_board+0xf0>
add    $0x24,%r15
cmp    $0x9,%rbx
je     1231 <print_board+0x101>
mov    %rbx,(%rsp)
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0x1,%bl
xor    %r14d,%r14d
jmp    11bc <print_board+0x8c>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%bl
mov    %rbp,%r14
cmp    $0x9,%rbp
je     1160 <print_board+0x30>
movzbl %bl,%eax
imul   $0xab,%eax,%eax
shr    $0x9,%eax
lea    (%rax,%rax,2),%r13d
add    $0xff,%r13b
mov    (%r15,%r14,4),%esi
test   %esi,%esi
je     11f0 <print_board+0xc0>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11fe <print_board+0xce>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl %r13b,%eax
lea    0x1(%r14),%rbp
cmp    %r14b,%al
jne    11b0 <print_board+0x80>
mov    $0x7c,%edi
call   1030 <putchar@plt>
jmp    11b0 <print_board+0x80>
nopw   0x0(%rax,%rax,1)
lea    0xde2(%rip),%rdi
call   1040 <puts@plt>
jmp    1183 <print_board+0x53>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c" . \00"
@.str.2 = [5 x i8] c" %d \00"
@str.4 = [32 x i8] c"+---------+---------+---------+\00"
define void @print_board(i32* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
br label %4
3: ; preds = %35
ret void
4: ; preds = %1, %35
%5 = phi i64 [ 0, %1 ], [ %10, %35 ]
%6 = tail call i32 @putchar(i8 signext 124)
%7 = mul nuw nsw i64 %5, 9
br label %14
8: ; preds = %31
%9 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%10 = add nuw nsw i64 %5, 1
%11 = trunc i64 %10 to i32
%12 = urem i32 %11, 3
%13 = icmp eq i32 %12, 0
br i1 %13, label %33, label %35
14: ; preds = %4, %31
%15 = phi i64 [ 0, %4 ], [ %25, %31 ]
%16 = add nuw nsw i64 %15, %7
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %24
22: ; preds = %14
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %24
24: ; preds = %22, %20
%25 = add nuw nsw i64 %15, 1
%26 = trunc i64 %25 to i8
%27 = urem i8 %26, 3
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = tail call i32 @putchar(i8 signext 124)
br label %31
31: ; preds = %29, %24
%32 = icmp eq i64 %25, 9
br i1 %32, label %8, label %14
33: ; preds = %8
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
br label %35
35: ; preds = %8, %33
%36 = icmp eq i64 %10, 9
br i1 %36, label %3, label %4
}