#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*/ Sleep(int);
char getch();
int /*<<< orphan*/ imprimir(int **, int);
scalar_t__ kbhit();
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int mapa[15][15] = {
      {35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35},
      {35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35}};
  char tecla;
  int band, dir, fp, cp, tiempo;
  fp = 2;
  cp = 2;
  mapa[fp][cp] = 169;
  band = 1;
  srand(time(0));
  dir = rand() % 4 + 1;
  imprimir(mapa, dir);
  tiempo = 0;
  while (1) {
    tecla = 0;
    if (kbhit())
      tecla = getch();
    if (tecla == 'r')
      band = 1;
    if (tecla == 'p')
      band = 0;
    if (band) {
      mapa[fp][cp] = 255;
      if (dir == 1) {
        if (mapa[fp][cp + 1] == 255) {
          cp++;
        }
      }
      if (dir == 2) {
        if (mapa[fp][cp - 1] == 255) {
          cp--;
        }
      }
      if (dir == 3) {
        if (mapa[fp + 1][cp] == 255) {
          fp++;
        }
      }
      if (dir == 4) {
        if (mapa[fp - 1][cp] == 255) {
          fp--;
        }
      }
      mapa[fp][cp] = 169;
      imprimir(mapa, dir);
      tiempo++;
      if (tiempo % 10 == 0) {
        dir = rand() % 4 + 1;
      }
    }
    if (tecla == 'p')
      band = 0;
    if (tecla == 'r')
      band = 1;
    Sleep(100);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x3a0(%rbp),%rdi
lea    0xe59(%rip),%rsi
mov    $0x384,%edx
call   1060 <memcpy@plt>
movl   $0x2,-0x3b0(%rbp)
movl   $0x2,-0x3b4(%rbp)
movslq -0x3b0(%rbp),%rcx
lea    -0x3a0(%rbp),%rax
imul   $0x3c,%rcx,%rcx
add    %rcx,%rax
movslq -0x3b4(%rbp),%rcx
movl   $0xa9,(%rax,%rcx,4)
movl   $0x1,-0x3a8(%rbp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x3ac(%rbp)
lea    -0x3a0(%rbp),%rdi
mov    -0x3ac(%rbp),%esi
call   1040 <imprimir@plt>
movl   $0x0,-0x3b8(%rbp)
movb   $0x0,-0x3a1(%rbp)
mov    $0x0,%al
call   1030 <kbhit@plt>
cmp    $0x0,%rax
je     1259 <main+0xd9>
mov    $0x0,%al
call   1080 <getch@plt>
mov    %al,-0x3a1(%rbp)
movsbl -0x3a1(%rbp),%eax
cmp    $0x72,%eax
jne    1273 <main+0xf3>
movl   $0x1,-0x3a8(%rbp)
movsbl -0x3a1(%rbp),%eax
cmp    $0x70,%eax
jne    128d <main+0x10d>
movl   $0x0,-0x3a8(%rbp)
cmpl   $0x0,-0x3a8(%rbp)
je     1471 <main+0x2f1>
movslq -0x3b0(%rbp),%rcx
lea    -0x3a0(%rbp),%rax
imul   $0x3c,%rcx,%rcx
add    %rcx,%rax
movslq -0x3b4(%rbp),%rcx
movl   $0xff,(%rax,%rcx,4)
cmpl   $0x1,-0x3ac(%rbp)
jne    130c <main+0x18c>
movslq -0x3b0(%rbp),%rcx
lea    -0x3a0(%rbp),%rax
imul   $0x3c,%rcx,%rcx
add    %rcx,%rax
mov    -0x3b4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0xff,(%rax,%rcx,4)
jne    1307 <main+0x187>
mov    -0x3b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3b4(%rbp)
jmp    130c <main+0x18c>
cmpl   $0x2,-0x3ac(%rbp)
jne    135b <main+0x1db>
movslq -0x3b0(%rbp),%rcx
lea    -0x3a0(%rbp),%rax
imul   $0x3c,%rcx,%rcx
add    %rcx,%rax
mov    -0x3b4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0xff,(%rax,%rcx,4)
jne    1356 <main+0x1d6>
mov    -0x3b4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3b4(%rbp)
jmp    135b <main+0x1db>
cmpl   $0x3,-0x3ac(%rbp)
jne    13aa <main+0x22a>
mov    -0x3b0(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x3a0(%rbp),%rax
imul   $0x3c,%rcx,%rcx
add    %rcx,%rax
movslq -0x3b4(%rbp),%rcx
cmpl   $0xff,(%rax,%rcx,4)
jne    13a5 <main+0x225>
mov    -0x3b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3b0(%rbp)
jmp    13aa <main+0x22a>
cmpl   $0x4,-0x3ac(%rbp)
jne    13f9 <main+0x279>
mov    -0x3b0(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x3a0(%rbp),%rax
imul   $0x3c,%rcx,%rcx
add    %rcx,%rax
movslq -0x3b4(%rbp),%rcx
cmpl   $0xff,(%rax,%rcx,4)
jne    13f4 <main+0x274>
mov    -0x3b0(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3b0(%rbp)
jmp    13f9 <main+0x279>
movslq -0x3b0(%rbp),%rcx
lea    -0x3a0(%rbp),%rax
imul   $0x3c,%rcx,%rcx
add    %rcx,%rax
movslq -0x3b4(%rbp),%rcx
movl   $0xa9,(%rax,%rcx,4)
lea    -0x3a0(%rbp),%rdi
mov    -0x3ac(%rbp),%esi
call   1040 <imprimir@plt>
mov    -0x3b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3b8(%rbp)
mov    -0x3b8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    146c <main+0x2ec>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x3ac(%rbp)
jmp    1471 <main+0x2f1>
movsbl -0x3a1(%rbp),%eax
cmp    $0x70,%eax
jne    148b <main+0x30b>
movl   $0x0,-0x3a8(%rbp)
movsbl -0x3a1(%rbp),%eax
cmp    $0x72,%eax
jne    14a5 <main+0x325>
movl   $0x1,-0x3a8(%rbp)
mov    $0x64,%edi
call   1090 <Sleep@plt>
jmp    1234 <main+0xb4>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x388,%rsp
lea    0xe78(%rip),%rsi
mov    %rsp,%rbp
mov    $0x384,%edx
mov    %rbp,%rdi
call   1060 <memcpy@plt>
movl   $0xa9,0x80(%rsp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   10a0 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
mov    %rbp,%rdi
mov    %ebx,%esi
call   1040 <imprimir@plt>
mov    $0x2,%r13d
mov    $0x1,%r14d
mov    $0x2,%r12d
xor    %r15d,%r15d
jmp    1224 <main+0xa4>
nopl   0x0(%rax)
cmp    $0x70,%bpl
mov    $0x0,%eax
cmove  %eax,%r14d
cmp    $0x72,%bpl
mov    $0x1,%eax
cmove  %eax,%r14d
mov    $0x64,%edi
call   1090 <Sleep@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <kbhit@plt>
test   %rax,%rax
je     123b <main+0xbb>
xor    %eax,%eax
call   1080 <getch@plt>
mov    %eax,%ebp
cmp    $0x72,%bpl
mov    $0x1,%eax
cmove  %eax,%r14d
cmp    $0x70,%bpl
je     1200 <main+0x80>
test   %r14d,%r14d
je     1200 <main+0x80>
movslq %r13d,%rcx
movslq %r12d,%rax
imul   $0x3c,%rcx,%rcx
add    %rsp,%rcx
movl   $0xff,(%rcx,%rax,4)
lea    -0x1(%rbx),%edx
cmp    $0x3,%edx
ja     12c5 <main+0x145>
lea    0xd8a(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
lea    0x1(%rax),%r12d
cmpl   $0xff,0x4(%rcx,%rax,4)
cmovne %eax,%r12d
jmp    12c5 <main+0x145>
lea    -0x1(%rax),%r12d
cmpl   $0xff,-0x4(%rcx,%rax,4)
cmovne %eax,%r12d
jmp    12c5 <main+0x145>
lea    0x1(%r13),%ecx
jmp    12ad <main+0x12d>
lea    -0x1(%r13),%ecx
movslq %ecx,%rcx
imul   $0x3c,%rcx,%rdx
add    %rsp,%rdx
cmpl   $0xff,(%rdx,%rax,4)
cmovne %r13d,%ecx
mov    %ecx,%r13d
movslq %r13d,%rax
movslq %r12d,%rcx
imul   $0x3c,%rax,%rax
add    %rsp,%rax
movl   $0xa9,(%rax,%rcx,4)
mov    %rsp,%rdi
mov    %ebx,%esi
call   1040 <imprimir@plt>
add    $0x1,%r15d
imul   $0xcccccccd,%r15d,%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999998,%eax
ja     1200 <main+0x80>
xor    %eax,%eax
call   10a0 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
jmp    1200 <main+0x80>

LLVM IR (-O0):
@__const.main.mapa = [15 x [15 x i32]] [[15 x i32] [i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35]]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [15 x [15 x i32]]
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [15 x [15 x i32]]* %6 to i8*
store i32 2, i32* %10
store i32 2, i32* %11
%14 = load i32, i32* %10
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 %15
%17 = load i32, i32* %11
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [15 x i32], [15 x i32]* %16, i64 0, i64 %18
store i32 169, i32* %19
store i32 1, i32* %8
%20 = call i32 @time(i32 0)
%21 = call i32 @srand(i32 %20)
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %9
%25 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 0
%26 = bitcast [15 x i32]* %25 to i32**
%27 = load i32, i32* %9
%28 = call i32 @imprimir(i32** %26, i32 %27)
store i32 0, i32* %12
br label %29
29: ; preds = %2, %152
store i8 0, i8* %7
%30 = call i64 (...) @kbhit()
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call signext i8 (...) @getch()
store i8 %33, i8* %7
br label %34
34: ; preds = %32, %29
%35 = load i8, i8* %7
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 114
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 1, i32* %8
br label %39
39: ; preds = %38, %34
%40 = load i8, i8* %7
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 112
br i1 %42, label %43, label %44
43: ; preds = %39
store i32 0, i32* %8
br label %44
44: ; preds = %43, %39
%45 = load i32, i32* %8
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %142
47: ; preds = %44
%48 = load i32, i32* %10
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 %49
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [15 x i32], [15 x i32]* %50, i64 0, i64 %52
store i32 255, i32* %53
%54 = load i32, i32* %9
%55 = icmp eq i32 %54, 1
br i1 %55, label %56, label %70
56: ; preds = %47
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 %58
%60 = load i32, i32* %11
%61 = add nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [15 x i32], [15 x i32]* %59, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = icmp eq i32 %64, 255
br i1 %65, label %66, label %69
66: ; preds = %56
%67 = load i32, i32* %11
%68 = add nsw i32 %67, 1
store i32 %68, i32* %11
br label %69
69: ; preds = %66, %56
br label %70
70: ; preds = %69, %47
%71 = load i32, i32* %9
%72 = icmp eq i32 %71, 2
br i1 %72, label %73, label %87
73: ; preds = %70
%74 = load i32, i32* %10
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 %75
%77 = load i32, i32* %11
%78 = sub nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [15 x i32], [15 x i32]* %76, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = icmp eq i32 %81, 255
br i1 %82, label %83, label %86
83: ; preds = %73
%84 = load i32, i32* %11
%85 = add nsw i32 %84, -1
store i32 %85, i32* %11
br label %86
86: ; preds = %83, %73
br label %87
87: ; preds = %86, %70
%88 = load i32, i32* %9
%89 = icmp eq i32 %88, 3
br i1 %89, label %90, label %104
90: ; preds = %87
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 %93
%95 = load i32, i32* %11
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [15 x i32], [15 x i32]* %94, i64 0, i64 %96
%98 = load i32, i32* %97
%99 = icmp eq i32 %98, 255
br i1 %99, label %100, label %103
100: ; preds = %90
%101 = load i32, i32* %10
%102 = add nsw i32 %101, 1
store i32 %102, i32* %10
br label %103
103: ; preds = %100, %90
br label %104
104: ; preds = %103, %87
%105 = load i32, i32* %9
%106 = icmp eq i32 %105, 4
br i1 %106, label %107, label %121
107: ; preds = %104
%108 = load i32, i32* %10
%109 = sub nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 %110
%112 = load i32, i32* %11
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [15 x i32], [15 x i32]* %111, i64 0, i64 %113
%115 = load i32, i32* %114
%116 = icmp eq i32 %115, 255
br i1 %116, label %117, label %120
117: ; preds = %107
%118 = load i32, i32* %10
%119 = add nsw i32 %118, -1
store i32 %119, i32* %10
br label %120
120: ; preds = %117, %107
br label %121
121: ; preds = %120, %104
%122 = load i32, i32* %10
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 %123
%125 = load i32, i32* %11
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [15 x i32], [15 x i32]* %124, i64 0, i64 %126
store i32 169, i32* %127
%128 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %6, i64 0, i64 0
%129 = bitcast [15 x i32]* %128 to i32**
%130 = load i32, i32* %9
%131 = call i32 @imprimir(i32** %129, i32 %130)
%132 = load i32, i32* %12
%133 = add nsw i32 %132, 1
store i32 %133, i32* %12
%134 = load i32, i32* %12
%135 = srem i32 %134, 10
%136 = icmp eq i32 %135, 0
br i1 %136, label %137, label %141
137: ; preds = %121
%138 = call i32 (...) @rand()
%139 = srem i32 %138, 4
%140 = add nsw i32 %139, 1
store i32 %140, i32* %9
br label %141
141: ; preds = %137, %121
br label %142
142: ; preds = %141, %44
%143 = load i8, i8* %7
%144 = sext i8 %143 to i32
%145 = icmp eq i32 %144, 112
br i1 %145, label %146, label %147
146: ; preds = %142
store i32 0, i32* %8
br label %147
147: ; preds = %146, %142
%148 = load i8, i8* %7
%149 = sext i8 %148 to i32
%150 = icmp eq i32 %149, 114
br i1 %150, label %151, label %152
151: ; preds = %147
store i32 1, i32* %8
br label %152
152: ; preds = %151, %147
%153 = call i32 @Sleep(i32 100)
br label %29
}

LLVM IR (-O2):
@__const.main.mapa = [15 x [15 x i32]] [[15 x i32] [i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 35], [15 x i32] [i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35, i32 35]]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [15 x [15 x i32]]
%4 = bitcast [15 x [15 x i32]]* %3 to i8*
%5 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 2, i64 2
store i32 169, i32* %5
%6 = tail call i32 @time(i32 0)
%7 = tail call i32 @srand(i32 %6)
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 4
%10 = add nsw i32 %9, 1
%11 = bitcast [15 x [15 x i32]]* %3 to i32**
%12 = call i32 @imprimir(i32** %11, i32 %10)
br label %13
13: ; preds = %76, %2
%14 = phi i32 [ 1, %2 ], [ %82, %76 ]
%15 = phi i32 [ %10, %2 ], [ %77, %76 ]
%16 = phi i32 [ 2, %2 ], [ %78, %76 ]
%17 = phi i32 [ 2, %2 ], [ %79, %76 ]
%18 = phi i32 [ 0, %2 ], [ %80, %76 ]
%19 = call i64 (...) @kbhit()
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %13
%22 = call signext i8 (...) @getch()
br label %23
23: ; preds = %21, %13
%24 = phi i8 [ %22, %21 ], [ 0, %13 ]
%25 = icmp eq i8 %24, 114
%26 = select i1 %25, i32 1, i32 %14
%27 = icmp eq i8 %24, 112
%28 = icmp eq i32 %26, 0
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %76, label %30
30: ; preds = %23
%31 = sext i32 %16 to i64
%32 = sext i32 %17 to i64
%33 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 %31, i64 %32
store i32 255, i32* %33
switch i32 %15, label %62 [
i32 1, label %34
i32 2, label %41
i32 3, label %48
i32 4, label %55
]
34: ; preds = %30
%35 = add nsw i32 %17, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 %31, i64 %36
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 255
%40 = select i1 %39, i32 %35, i32 %17
br label %62
41: ; preds = %30
%42 = add nsw i32 %17, -1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 %31, i64 %43
%45 = load i32, i32* %44
%46 = icmp eq i32 %45, 255
%47 = select i1 %46, i32 %42, i32 %17
br label %62
48: ; preds = %30
%49 = add nsw i32 %16, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 %50, i64 %32
%52 = load i32, i32* %51
%53 = icmp eq i32 %52, 255
%54 = select i1 %53, i32 %49, i32 %16
br label %62
55: ; preds = %30
%56 = add nsw i32 %16, -1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 %57, i64 %32
%59 = load i32, i32* %58
%60 = icmp eq i32 %59, 255
%61 = select i1 %60, i32 %56, i32 %16
br label %62
62: ; preds = %30, %41, %34, %48, %55
%63 = phi i32 [ %17, %55 ], [ %17, %48 ], [ %40, %34 ], [ %47, %41 ], [ %17, %30 ]
%64 = phi i32 [ %61, %55 ], [ %54, %48 ], [ %16, %34 ], [ %16, %41 ], [ %16, %30 ]
%65 = sext i32 %64 to i64
%66 = sext i32 %63 to i64
%67 = getelementptr inbounds [15 x [15 x i32]], [15 x [15 x i32]]* %3, i64 0, i64 %65, i64 %66
store i32 169, i32* %67
%68 = call i32 @imprimir(i32** %11, i32 %15)
%69 = add nsw i32 %18, 1
%70 = srem i32 %69, 10
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %62
%73 = call i32 (...) @rand()
%74 = srem i32 %73, 4
%75 = add nsw i32 %74, 1
br label %76
76: ; preds = %62, %72, %23
%77 = phi i32 [ %75, %72 ], [ %15, %62 ], [ %15, %23 ]
%78 = phi i32 [ %64, %72 ], [ %64, %62 ], [ %16, %23 ]
%79 = phi i32 [ %63, %72 ], [ %63, %62 ], [ %17, %23 ]
%80 = phi i32 [ %69, %72 ], [ %69, %62 ], [ %18, %23 ]
%81 = select i1 %27, i32 0, i32 %26
%82 = select i1 %25, i32 1, i32 %81
%83 = call i32 @Sleep(i32 100)
br label %13
}