#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*/ kreski(int);
int /*<<< orphan*/ litery(int);
int /*<<< orphan*/ printf(char *, ...);
void render(int size, int tab[5][5], int cursor_x, int cursor_y) {
  int j, k;
  char sp;
  litery(size);
  kreski(size);
  sp = '_';
  for (j = 0; j < size; j++) {
    printf("%d", j + 1);
    printf("\t|");
    if (j == size - 1) {
      sp = '_';
    }
    for (k = 0; k < size; k++) {
      if (tab[j][k] == 0) {
        if (j == cursor_x && k == cursor_y) {
          printf("\x1b[42;1m"
                 "%c"
                 "\x1b[0m",
                 sp);
        } else {
          printf("\x1b[0m"
                 "%c"
                 "\x1b[0m",
                 sp);
        }
      } else {
        if (j == cursor_x && k == cursor_y) {
          printf("\x1b[42m"
                 "%c"
                 "\x1b[0m",
                 sp);
        } else {
          printf("\x1b[43m"
                 "%c"
                 "\x1b[0m",
                 sp);
        }
      }
      printf("|");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<render>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <litery@plt>
mov    -0x4(%rbp),%edi
call   1050 <kreski@plt>
movb   $0x5f,-0x21(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1297 <render+0x167>
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11a3 <render+0x73>
movb   $0x5f,-0x21(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    127b <render+0x14b>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1219 <render+0xe9>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1202 <render+0xd2>
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1202 <render+0xd2>
movsbl -0x21(%rbp),%esi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1214 <render+0xe4>
movsbl -0x21(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125f <render+0x12f>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1248 <render+0x118>
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1248 <render+0x118>
movsbl -0x21(%rbp),%esi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125a <render+0x12a>
movsbl -0x21(%rbp),%esi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125f <render+0x12f>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11aa <render+0x7a>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1160 <render+0x30>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%r12d
call   1040 <litery@plt>
mov    %r12d,%edi
call   1060 <kreski@plt>
test   %r12d,%r12d
jle    1229 <render+0xe9>
mov    %r15d,%r13d
mov    %r14d,%ebp
mov    %r12d,%r14d
xor    %r15d,%r15d
nopl   0x0(%rax)
lea    0x1(%r15),%rsi
lea    0xe75(%rip),%rdi
mov    %rsi,(%rsp)
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    %r15,%rax
xor    %rbp,%rax
mov    %r13,%rcx
xor    %r12,%rcx
or     %rax,%rcx
lea    0xe4e(%rip),%rax
lea    0xe39(%rip),%rcx
cmove  %rcx,%rax
lea    0xe53(%rip),%rdi
lea    0xe40(%rip),%rcx
cmove  %rcx,%rdi
cmpl   $0x0,(%rbx,%r12,4)
cmove  %rax,%rdi
mov    $0x5f,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
cmp    %r12,%r14
jne    11b0 <render+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x14,%rbx
mov    (%rsp),%rax
mov    %rax,%r15
cmp    %r14,%rax
jne    1180 <render+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"\09|\00"
@.str.2 = [14 x i8] c"\1B[42;1m%c\1B[0m\00"
@.str.3 = [11 x i8] c"\1B[0m%c\1B[0m\00"
@.str.4 = [12 x i8] c"\1B[42m%c\1B[0m\00"
@.str.5 = [12 x i8] c"\1B[43m%c\1B[0m\00"
define void @render(i32 %0, [5 x i32]* nocapture %1, i32 %2, i32 %3) {
%5 = tail call i32 @litery(i32 %0)
%6 = tail call i32 @kreski(i32 %0)
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %36
8: ; preds = %4
%9 = zext i32 %3 to i64
%10 = zext i32 %2 to i64
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %33, %8
%13 = phi i64 [ 0, %8 ], [ %14, %33 ]
%14 = add nuw nsw i64 %13, 1
%15 = trunc i64 %14 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %13, %10
br label %19
19: ; preds = %12, %19
%20 = phi i64 [ 0, %12 ], [ %31, %19 ]
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 %13, i64 %20
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
%24 = icmp eq i64 %20, %9
%25 = select i1 %18, i1 %24, i1 false
%26 = select i1 %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0)
%27 = select i1 %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0)
%28 = select i1 %23, i8* %26, i8* %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %28, i32 95)
%30 = tail call i32 @putchar(i32 124)
%31 = add nuw nsw i64 %20, 1
%32 = icmp eq i64 %31, %11
br i1 %32, label %33, label %19
33: ; preds = %19
%34 = tail call i32 @putchar(i32 10)
%35 = icmp eq i64 %14, %11
br i1 %35, label %36, label %12
36: ; preds = %33, %4
ret void
}