#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 *, ...);
void print_board(char tictac[3][3]) {
  int r, c;
  for (r = 0; r < 3; ++r) {
    printf("|");
    for (c = 0; c < 3; ++c) {
      printf("%c", tictac[r][c]);
    }
    printf("|\n");
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<print_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    119b <print_board+0x8b>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    117f <print_board+0x6f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x3,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <print_board+0x32>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_board+0x13>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_board>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl (%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x2(%rbx),%edi
call   1030 <putchar@plt>
lea    0xeb0(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x3(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x4(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x5(%rbx),%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
movsbl 0x6(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x7(%rbx),%edi
call   1030 <putchar@plt>
movsbl 0x8(%rbx),%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe45(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@str = [2 x i8] c"\0A\00"
@str.4 = [2 x i8] c"|\00"
define void @print_board([3 x i8]* nocapture %0) {
%2 = tail call i32 @putchar(i32 124)
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 0
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = tail call i32 @putchar(i32 %5)
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = tail call i32 @putchar(i32 %9)
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = tail call i32 @putchar(i32 %13)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%16 = tail call i32 @putchar(i32 124)
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = tail call i32 @putchar(i32 %19)
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 1
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = tail call i32 @putchar(i32 %23)
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 2
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = tail call i32 @putchar(i32 %27)
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%30 = tail call i32 @putchar(i32 124)
%31 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = tail call i32 @putchar(i32 %33)
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 1
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = tail call i32 @putchar(i32 %37)
%39 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 2
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = tail call i32 @putchar(i32 %41)
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}