#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ tabaux(int **);
int imprimetab(int tab[3][3]) {
  setlocale(LC_ALL, "");
  int linha, coluna;
  tabaux(tab);
  putchar('\n');
  for (linha = 0; linha < 3; linha++) {
    for (coluna = 0; coluna < 3; coluna++) {
      if (tab[linha][coluna] == 0)
        printf("   ");
      else if (tab[linha][coluna] == 1)
        printf(" X ");
      else
        printf(" O ");
      if (coluna != (3 - 1))
        printf("%lc", L'\u2502');
    }
    putchar('\n');
    if (linha < 3 - 1)
      printf("%lc%lc%lc%lc%lc%lc%lc%lc%lc%lc%lc\n", L'\u2500', L'\u2500',
             L'\u2500', L'\u253c', L'\u2500', L'\u2500', L'\u2500', L'\u253c',
             L'\u2500', L'\u2500', L'\u2500');
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<imprimetab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
call   1060 <setlocale@plt>
mov    -0x8(%rbp),%rdi
call   1030 <tabaux@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    12b2 <imprimetab+0x172>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    1239 <imprimetab+0xf9>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11c6 <imprimetab+0x86>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1209 <imprimetab+0xc9>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    11f6 <imprimetab+0xb6>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1204 <imprimetab+0xc4>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1209 <imprimetab+0xc9>
cmpl   $0x2,-0x10(%rbp)
je     1226 <imprimetab+0xe6>
lea    0xdf2(%rip),%rdi
mov    $0x2502,%esi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    122b <imprimetab+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118c <imprimetab+0x4c>
mov    $0xa,%edi
call   1040 <putchar@plt>
cmpl   $0x2,-0xc(%rbp)
jge    129f <imprimetab+0x15f>
lea    0xdbc(%rip),%rdi
mov    $0x2500,%r9d
mov    $0x253c,%r8d
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
movl   $0x2500,(%rsp)
movl   $0x2500,0x8(%rsp)
movl   $0x253c,0x10(%rsp)
movl   $0x2500,0x18(%rsp)
movl   $0x2500,0x20(%rsp)
movl   $0x2500,0x28(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12a4 <imprimetab+0x164>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117b <imprimetab+0x3b>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimetab>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1060 <setlocale@plt>
mov    %r14,%rdi
call   1030 <tabaux@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    (%r14),%eax
cmp    $0x1,%eax
lea    0xe82(%rip),%r13
lea    0xe7f(%rip),%rbx
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
lea    0xe67(%rip),%rbp
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe61(%rip),%r15
mov    %r15,%rdi
mov    $0x2502,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%r14),%eax
cmp    $0x1,%eax
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x2502,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%eax
cmp    $0x1,%eax
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe00(%rip),%r12
mov    %r12,%rdi
mov    $0x2500,%esi
mov    $0x2500,%edx
mov    $0x2500,%ecx
mov    $0x253c,%r8d
mov    $0x2500,%r9d
xor    %eax,%eax
push   $0x2500
push   $0x2500
push   $0x2500
push   $0x253c
push   $0x2500
push   $0x2500
call   1050 <printf@plt>
add    $0x30,%rsp
mov    0xc(%r14),%eax
cmp    $0x1,%eax
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x2502,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%r14),%eax
cmp    $0x1,%eax
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x2502,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%r14),%eax
cmp    $0x1,%eax
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r12,%rdi
mov    $0x2500,%esi
mov    $0x2500,%edx
mov    $0x2500,%ecx
mov    $0x253c,%r8d
mov    $0x2500,%r9d
xor    %eax,%eax
push   $0x2500
push   $0x2500
push   $0x2500
push   $0x253c
push   $0x2500
push   $0x2500
call   1050 <printf@plt>
add    $0x30,%rsp
mov    0x18(%r14),%eax
cmp    $0x1,%eax
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x2502,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%r14),%eax
cmp    $0x1,%eax
mov    %rbx,%rdi
cmove  %r13,%rdi
test   %eax,%eax
cmove  %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x2502,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%r14),%eax
cmp    $0x1,%eax
cmove  %r13,%rbx
test   %eax,%eax
cmove  %rbp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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