#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 desenharJogoDaVelha(char *jogodaVelha, int cursorI, int cursorJ) {
  int i, j;
  printf("\n____|____|____\n");
  for (i = 0; i < 3; i++) {
    printf("    |    |    \n");
    for (j = 0; j < 3; j++) {
      if (i == cursorI && j == cursorJ)
        putchar('*');
      else
        putchar(' ');
      printf("%c  %s", jogodaVelha[i * 3 + j], (j + 1 == 3) ? "" : "|");
    }
    printf("\n____|____|____\n");
  }
  printf("    |    |    \n");
}


x86 assembly (clang, -O0):
<desenharJogoDaVelha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1206 <desenharJogoDaVelha+0xe6>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11ea <desenharJogoDaVelha+0xca>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1197 <desenharJogoDaVelha+0x77>
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1197 <desenharJogoDaVelha+0x77>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    11a1 <desenharJogoDaVelha+0x81>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
imul   $0x3,-0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
lea    0xe68(%rip),%rdx
lea    0xe59(%rip),%rax
cmp    $0x3,%ecx
cmove  %rax,%rdx
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1166 <desenharJogoDaVelha+0x46>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <desenharJogoDaVelha+0x27>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<desenharJogoDaVelha>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%r12
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%eax
mov    %ebp,(%rsp)
or     %r15d,%eax
mov    $0x2a,%r14d
mov    $0x20,%edi
cmove  %r14d,%edi
call   1030 <putchar@plt>
movsbl (%r12),%esi
lea    0xe7d(%rip),%rbx
lea    0xe7d(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,0x4(%rsp)
cmp    $0x1,%r15d
mov    $0x20,%r13d
cmove  %r14d,%r13d
cmp    $0x2,%r15d
mov    $0x20,%r15d
cmove  %r14d,%r15d
test   %ebp,%ebp
mov    $0x20,%edi
cmove  %r13d,%edi
mov    $0x20,%ebp
cmove  %r15d,%ebp
call   1030 <putchar@plt>
movsbl 0x1(%r12),%esi
mov    %rbx,%rdi
lea    0xe29(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
call   1030 <putchar@plt>
movsbl 0x2(%r12),%esi
lea    0xe1e(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe0e(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf3(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x4(%rsp)
mov    $0x20,%eax
cmovne %eax,%r14d
cmpl   $0x1,(%rsp)
mov    $0x20,%edi
cmove  %r14d,%edi
mov    $0x20,%ebp
cmove  %r13d,%ebp
mov    $0x20,%ebx
cmove  %r15d,%ebx
call   1030 <putchar@plt>
movsbl 0x3(%r12),%esi
lea    0xda6(%rip),%rdi
lea    0xda6(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
call   1030 <putchar@plt>
movsbl 0x4(%r12),%esi
lea    0xd84(%rip),%rbp
mov    %rbp,%rdi
lea    0xd81(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
movsbl 0x5(%r12),%esi
mov    %rbp,%rdi
mov    %rbp,%rbx
lea    0xd70(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd63(%rip),%rdi
call   1040 <puts@plt>
lea    0xd48(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x2,(%rsp)
mov    $0x20,%eax
cmovne %eax,%r14d
cmovne %eax,%r13d
mov    $0x20,%eax
cmovne %eax,%r15d
mov    %r14d,%edi
call   1030 <putchar@plt>
movsbl 0x6(%r12),%esi
mov    %rbp,%rdi
lea    0xd0f(%rip),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
call   1030 <putchar@plt>
movsbl 0x7(%r12),%esi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%edi
call   1030 <putchar@plt>
movsbl 0x8(%r12),%esi
mov    %rbx,%rdi
lea    0xce2(%rip),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcd5(%rip),%rdi
call   1040 <puts@plt>
lea    0xcba(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

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

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