#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 */
typedef int int32_t;

/* Variables and functions */
int getCell(int, int, int);
int /*<<< orphan*/ putchar(int);
void printBoard(int32_t tab) {
  int32_t i;
  int32_t j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      if (getCell(tab, i, j) == 0)
        putchar('-');
      else if (getCell(tab, i, j) == 1)
        putchar('X');
      else
        putchar('O');
    }
    putchar(10);
  }
  putchar(10);
}


x86 assembly (clang, -O0):
<printBoard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11d3 <printBoard+0xb3>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    11bb <printBoard+0x9b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <getCell@plt>
cmp    $0x0,%eax
jne    1173 <printBoard+0x53>
mov    $0x2d,%edi
call   1030 <putchar@plt>
jmp    11a8 <printBoard+0x88>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <getCell@plt>
cmp    $0x1,%eax
jne    1199 <printBoard+0x79>
mov    $0x58,%edi
call   1030 <putchar@plt>
jmp    11a3 <printBoard+0x83>
mov    $0x4f,%edi
call   1030 <putchar@plt>
jmp    11a8 <printBoard+0x88>
jmp    11ad <printBoard+0x8d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <printBoard+0x23>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <printBoard+0x12>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBoard>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %esi,%esi
xor    %edx,%edx
call   1040 <getCell@plt>
mov    $0x2d,%ebp
mov    $0x2d,%edi
test   %eax,%eax
je     1155 <printBoard+0x35>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%edi
add    $0x4f,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <getCell@plt>
test   %eax,%eax
je     1188 <printBoard+0x68>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%ebp
add    $0x4f,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <getCell@plt>
mov    $0x2d,%ebp
mov    $0x2d,%edi
test   %eax,%eax
je     11c7 <printBoard+0xa7>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%edi
add    $0x4f,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <getCell@plt>
test   %eax,%eax
je     1204 <printBoard+0xe4>
mov    %ebx,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%ebp
add    $0x4f,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <getCell@plt>
mov    $0x2d,%ebp
mov    $0x2d,%edi
test   %eax,%eax
je     1249 <printBoard+0x129>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%edi
add    $0x4f,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <getCell@plt>
test   %eax,%eax
je     1282 <printBoard+0x162>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%ebp
add    $0x4f,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <getCell@plt>
mov    $0x2d,%ebp
mov    $0x2d,%edi
test   %eax,%eax
je     12cb <printBoard+0x1ab>
mov    %ebx,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%edi
add    $0x4f,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1040 <getCell@plt>
test   %eax,%eax
je     1304 <printBoard+0x1e4>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%ebp
add    $0x4f,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x2,%edx
call   1040 <getCell@plt>
test   %eax,%eax
je     1341 <printBoard+0x221>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x2,%edx
call   1040 <getCell@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
lea    (%rcx,%rcx,8),%edi
add    $0x4f,%edi
jmp    1346 <printBoard+0x226>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @printBoard(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %37, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %40
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %32, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %35
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @getCell(i32 %13, i32 %14, i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @putchar(i32 45)
br label %31
20: ; preds = %12
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @getCell(i32 %21, i32 %22, i32 %23)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 @putchar(i32 88)
br label %30
28: ; preds = %20
%29 = call i32 @putchar(i32 79)
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %18
br label %32
32: ; preds = %31
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %9
35: ; preds = %9
%36 = call i32 @putchar(i32 10)
br label %37
37: ; preds = %35
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %5
40: ; preds = %5
%41 = call i32 @putchar(i32 10)
ret void
}

LLVM IR (-O2):
define void @printBoard(i32 %0) {
%2 = tail call i32 @getCell(i32 %0, i32 0, i32 0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @getCell(i32 %0, i32 0, i32 0)
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i32 88, i32 79
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 45, %1 ], [ %7, %4 ]
%10 = tail call i32 @putchar(i32 %9)
%11 = tail call i32 @getCell(i32 %0, i32 0, i32 1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = tail call i32 @getCell(i32 %0, i32 0, i32 1)
%15 = icmp eq i32 %14, 1
%16 = select i1 %15, i32 88, i32 79
br label %17
17: ; preds = %8, %13
%18 = phi i32 [ %16, %13 ], [ 45, %8 ]
%19 = tail call i32 @putchar(i32 %18)
%20 = tail call i32 @getCell(i32 %0, i32 0, i32 2)
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %17
%23 = tail call i32 @getCell(i32 %0, i32 0, i32 2)
%24 = icmp eq i32 %23, 1
%25 = select i1 %24, i32 88, i32 79
br label %26
26: ; preds = %17, %22
%27 = phi i32 [ %25, %22 ], [ 45, %17 ]
%28 = tail call i32 @putchar(i32 %27)
%29 = tail call i32 @putchar(i32 10)
%30 = tail call i32 @getCell(i32 %0, i32 1, i32 0)
%31 = icmp eq i32 %30, 0
br i1 %31, label %36, label %32
32: ; preds = %26
%33 = tail call i32 @getCell(i32 %0, i32 1, i32 0)
%34 = icmp eq i32 %33, 1
%35 = select i1 %34, i32 88, i32 79
br label %36
36: ; preds = %32, %26
%37 = phi i32 [ 45, %26 ], [ %35, %32 ]
%38 = tail call i32 @putchar(i32 %37)
%39 = tail call i32 @getCell(i32 %0, i32 1, i32 1)
%40 = icmp eq i32 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %36
%42 = tail call i32 @getCell(i32 %0, i32 1, i32 1)
%43 = icmp eq i32 %42, 1
%44 = select i1 %43, i32 88, i32 79
br label %45
45: ; preds = %41, %36
%46 = phi i32 [ %44, %41 ], [ 45, %36 ]
%47 = tail call i32 @putchar(i32 %46)
%48 = tail call i32 @getCell(i32 %0, i32 1, i32 2)
%49 = icmp eq i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %45
%51 = tail call i32 @getCell(i32 %0, i32 1, i32 2)
%52 = icmp eq i32 %51, 1
%53 = select i1 %52, i32 88, i32 79
br label %54
54: ; preds = %50, %45
%55 = phi i32 [ %53, %50 ], [ 45, %45 ]
%56 = tail call i32 @putchar(i32 %55)
%57 = tail call i32 @putchar(i32 10)
%58 = tail call i32 @getCell(i32 %0, i32 2, i32 0)
%59 = icmp eq i32 %58, 0
br i1 %59, label %64, label %60
60: ; preds = %54
%61 = tail call i32 @getCell(i32 %0, i32 2, i32 0)
%62 = icmp eq i32 %61, 1
%63 = select i1 %62, i32 88, i32 79
br label %64
64: ; preds = %60, %54
%65 = phi i32 [ 45, %54 ], [ %63, %60 ]
%66 = tail call i32 @putchar(i32 %65)
%67 = tail call i32 @getCell(i32 %0, i32 2, i32 1)
%68 = icmp eq i32 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %64
%70 = tail call i32 @getCell(i32 %0, i32 2, i32 1)
%71 = icmp eq i32 %70, 1
%72 = select i1 %71, i32 88, i32 79
br label %73
73: ; preds = %69, %64
%74 = phi i32 [ %72, %69 ], [ 45, %64 ]
%75 = tail call i32 @putchar(i32 %74)
%76 = tail call i32 @getCell(i32 %0, i32 2, i32 2)
%77 = icmp eq i32 %76, 0
br i1 %77, label %82, label %78
78: ; preds = %73
%79 = tail call i32 @getCell(i32 %0, i32 2, i32 2)
%80 = icmp eq i32 %79, 1
%81 = select i1 %80, i32 88, i32 79
br label %82
82: ; preds = %78, %73
%83 = phi i32 [ %81, %78 ], [ 45, %73 ]
%84 = tail call i32 @putchar(i32 %83)
%85 = tail call i32 @putchar(i32 10)
%86 = tail call i32 @putchar(i32 10)
ret void
}