#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 draw(char board[]) {
  int i;
  putchar('\n');
  for (i = 0; i < 9; i += 3) {
    printf(" %c | %c | %c \n", (board[i] == 0) ? ' ' : board[i],
           (board[i + 1] == 0) ? ' ' : board[i + 1],
           (board[i + 2] == 0) ? ' ' : board[i + 2]);
    if (i != 6)
      printf("---*---*---\n");
  }
  return;
}


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    123c <draw+0x11c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1169 <draw+0x49>
mov    $0x20,%eax
mov    %eax,-0x10(%rbp)
jmp    1178 <draw+0x58>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11a5 <draw+0x85>
mov    $0x20,%eax
mov    %eax,-0x18(%rbp)
jmp    11b9 <draw+0x99>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11e6 <draw+0xc6>
mov    $0x20,%eax
mov    %eax,-0x20(%rbp)
jmp    11fa <draw+0xda>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%ecx
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x6,-0xc(%rbp)
je     1229 <draw+0x109>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122e <draw+0x10e>
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <draw+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
test   %al,%al
mov    $0x20,%ebp
cmove  %ebp,%eax
movsbl %al,%esi
movzbl 0x1(%rbx),%eax
test   %al,%al
cmove  %ebp,%eax
movsbl %al,%edx
movzbl 0x2(%rbx),%eax
test   %al,%al
cmove  %ebp,%eax
movsbl %al,%ecx
lea    0xe8d(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8c(%rip),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
movzbl 0x3(%rbx),%eax
test   %al,%al
cmove  %ebp,%eax
movsbl %al,%esi
movzbl 0x4(%rbx),%eax
test   %al,%al
cmove  %ebp,%eax
movsbl %al,%edx
movzbl 0x5(%rbx),%eax
test   %al,%al
cmove  %ebp,%eax
movsbl %al,%ecx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
movzbl 0x6(%rbx),%eax
test   %al,%al
cmove  %ebp,%eax
movzbl 0x7(%rbx),%ecx
test   %cl,%cl
cmove  %ebp,%ecx
movsbl %al,%esi
movsbl %cl,%edx
movzbl 0x8(%rbx),%eax
test   %al,%al
cmove  %ebp,%eax
movsbl %al,%ecx
mov    %r14,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c" %c | %c | %c \0A\00"
@.str.1 = [13 x i8] c"---*---*---\0A\00"
define void @draw(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %3
br label %5
5: ; preds = %70, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 9
br i1 %7, label %8, label %73
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %8
br label %24
17: ; preds = %8
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
br label %24
24: ; preds = %17, %16
%25 = phi i32 [ 32, %16 ], [ %23, %17 ]
%26 = load i8*, i8** %2
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %24
br label %43
35: ; preds = %24
%36 = load i8*, i8** %2
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %36, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
br label %43
43: ; preds = %35, %34
%44 = phi i32 [ 32, %34 ], [ %42, %35 ]
%45 = load i8*, i8** %2
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %45, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %43
br label %62
54: ; preds = %43
%55 = load i8*, i8** %2
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 2
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %55, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
br label %62
62: ; preds = %54, %53
%63 = phi i32 [ 32, %53 ], [ %61, %54 ]
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %44, i32 %63)
%65 = load i32, i32* %3
%66 = icmp ne i32 %65, 6
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %69
69: ; preds = %67, %62
br label %70
70: ; preds = %69
%71 = load i32, i32* %3
%72 = add nsw i32 %71, 3
store i32 %72, i32* %3
br label %5
73: ; preds = %5
ret void
}

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