void draw(board) int board[];
{
  int i, j, row;
  static char out[] = " X  O";
  row = 6;
  for (j = 0; j < 9; j += 3) {
    printf(" %d | %d | %d     ", j, j + 1, j + 2);
    for (i = 0; i < 3; i++) {
      printf("%c ", out[board[j + i]]);
      if (i < 2)
        printf("| ");
    }
    if (j < 4) {
      printf("\n");
      printf("---+---+---   ---+---+---");
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x6,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    11f9 <draw+0xe9>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%ecx
add    $0x2,%ecx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    11b7 <draw+0xa7>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movslq (%rax,%rcx,4),%rcx
lea    0x2eae(%rip),%rax
movsbl (%rax,%rcx,1),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0xc(%rbp)
jge    11a4 <draw+0x94>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <draw+0x99>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <draw+0x48>
cmpl   $0x4,-0x10(%rbp)
jge    11dd <draw+0xcd>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <draw+0x1a>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed1(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
movslq (%rbx),%rax
lea    0xeab(%rip),%rbp
movsbl (%rax,%rbp,1),%esi
lea    0xeb9(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeac(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x4(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x8(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe66(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    $0x3,%esi
mov    $0x4,%edx
mov    $0x5,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xc(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x10(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x14(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    $0x6,%esi
mov    $0x7,%edx
mov    $0x8,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x18(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x1c(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x20(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@draw.out = internal unnamed_addr constant [6 x i8] c" X O\00"
@.str = [19 x i8] c" %d | %d | %d \00"
@.str.1 = [4 x i8] c"%c \00"
@.str.2 = [3 x i8] c"| \00"
@.str.4 = [26 x i8] c"---+---+--- ---+---+---\00"
define void @draw(i32* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i32 2)
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds i32, i32* %0, i64 1
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = getelementptr inbounds i32, i32* %0, i64 2
%19 = load i32, i32* %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = tail call i32 @putchar(i32 10)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%27 = tail call i32 @putchar(i32 10)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 3, i32 4, i32 5)
%29 = getelementptr inbounds i32, i32* %0, i64 3
%30 = load i32, i32* %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%37 = getelementptr inbounds i32, i32* %0, i64 4
%38 = load i32, i32* %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%45 = getelementptr inbounds i32, i32* %0, i64 5
%46 = load i32, i32* %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = tail call i32 @putchar(i32 10)
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%54 = tail call i32 @putchar(i32 10)
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 6, i32 7, i32 8)
%56 = getelementptr inbounds i32, i32* %0, i64 6
%57 = load i32, i32* %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%64 = getelementptr inbounds i32, i32* %0, i64 7
%65 = load i32, i32* %64
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %69)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%72 = getelementptr inbounds i32, i32* %0, i64 8
%73 = load i32, i32* %72
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %77)
%79 = tail call i32 @putchar(i32 10)
%80 = tail call i32 @putchar(i32 10)
ret void
}