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


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x6,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
mov    $0x0,%al
call   1050 <move@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x9,-0x18(%rbp)
jge    122d <draw+0xfd>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11e3 <draw+0xb3>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movslq (%rax,%rcx,4),%rcx
lea    0x2e92(%rip),%rax
movsbl (%rax,%rcx,1),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
cmpl   $0x2,-0x14(%rbp)
jge    11d0 <draw+0xa0>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
jmp    11d5 <draw+0xa5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1184 <draw+0x54>
cmpl   $0x4,-0x18(%rbp)
jge    120d <draw+0xdd>
mov    -0x1c(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x1c(%rbp)
xor    %esi,%esi
mov    $0x0,%al
call   1050 <move@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
mov    -0x1c(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x1c(%rbp)
xor    %esi,%esi
mov    $0x0,%al
call   1050 <move@plt>
mov    -0x18(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x18(%rbp)
jmp    1156 <draw+0x26>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    -0x4(%rbp),%eax
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
mov    $0x6,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <move@plt>
lea    0xeb3(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1030 <printw@plt>
movslq (%rbx),%rax
lea    0xe8d(%rip),%rbp
movsbl (%rax,%rbp,1),%esi
lea    0xe9b(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
lea    0xe8e(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0x4(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0x8(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    $0x7,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <move@plt>
lea    0xe44(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    $0x8,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <move@plt>
mov    %r12,%rdi
mov    $0x3,%esi
mov    $0x4,%edx
mov    $0x5,%ecx
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0xc(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0x10(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0x14(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    $0x9,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <move@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    $0xa,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <move@plt>
mov    %r12,%rdi
mov    $0x6,%esi
mov    $0x7,%edx
mov    $0x8,%ecx
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0x18(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0x1c(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
movslq 0x20(%rbx),%rax
movsbl (%rax,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printw@plt>
mov    $0xb,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <move@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <refresh@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 = [26 x i8] c"---+---+--- ---+---+---\00"
define i32 @draw(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 6, i32* %6
%7 = load i32, i32* %6
%8 = call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %7, i32 0)
store i32 0, i32* %5
br label %9
9: ; preds = %55, %1
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 9
br i1 %11, label %12, label %58
12: ; preds = %9
%13 = load i32, i32* %5
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 2
%18 = call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %15, i32 %17)
store i32 0, i32* %4
br label %19
19: ; preds = %40, %12
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %43
22: ; preds = %19
%23 = load i32*, i32** %3
%24 = load i32, i32* %5
%25 = load i32, i32* %4
%26 = add nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %23, i64 %27
%29 = load i32, i32* %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %4
%36 = icmp slt i32 %35, 2
br i1 %36, label %37, label %39
37: ; preds = %22
%38 = call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37, %22
br label %40
40: ; preds = %39
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %19
43: ; preds = %19
%44 = load i32, i32* %5
%45 = icmp slt i32 %44, 4
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
%49 = call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %48, i32 0)
%50 = call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %46, %43
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
%54 = call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %53, i32 0)
br label %55
55: ; preds = %51
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 3
store i32 %57, i32* %5
br label %9
58: ; preds = %9
%59 = call i32 (...) @refresh()
%60 = load i32, i32* %2
ret i32 %60
}

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.3 = [26 x i8] c"---+---+--- ---+---+---\00"
define i32 @draw(i32* nocapture %0) {
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 6, i32 0)
%3 = tail call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i32 2)
%4 = load i32, i32* %0
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds i32, i32* %0, i64 1
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = getelementptr inbounds i32, i32* %0, i64 2
%20 = load i32, i32* %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 7, i32 0)
%27 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%28 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 8, i32 0)
%29 = tail call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 3, i32 4, i32 5)
%30 = getelementptr inbounds i32, i32* %0, i64 3
%31 = load i32, i32* %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%38 = getelementptr inbounds i32, i32* %0, i64 4
%39 = load i32, i32* %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
%45 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%46 = getelementptr inbounds i32, i32* %0, i64 5
%47 = load i32, i32* %46
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = add nuw nsw i32 8, 1
%54 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %53, i32 0)
%55 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%56 = add nsw i32 %53, 1
%57 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %56, i32 0)
%58 = tail call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 6, i32 7, i32 8)
%59 = getelementptr inbounds i32, i32* %0, i64 6
%60 = load i32, i32* %59
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%66 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%67 = getelementptr inbounds i32, i32* %0, i64 7
%68 = load i32, i32* %67
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %72)
%74 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printw to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%75 = getelementptr inbounds i32, i32* %0, i64 8
%76 = load i32, i32* %75
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [6 x i8], [6 x i8]* @draw.out, i64 0, i64 %77
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %80)
%82 = add nsw i32 %53, 2
%83 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %82, i32 0)
%84 = tail call i32 (...) @refresh()
ret i32 undef
}