#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*/ system(char *);
void printMaze(char *maze, int row, int col, int now, int *path) {
  system("clear");
  for (size_t i = 0; i < row; i++) {
    for (size_t j = 0; j < col; j++) {
      if (path[i * col + j])
        printf("%s%c ", "\x1B[35m", maze[i * col + j]);
      else if (i * col + j == now)
        printf("%s%c ", "\x1B[31m", maze[i * col + j]);
      else if (maze[i * col + j] == 'x')
        printf("%s%c ", "\x1B[33m", maze[i * col + j]);
      else if (maze[i * col + j] == '.')
        printf("%s%c ", "\x1B[37m", maze[i * col + j]);
      else
        printf("%s%c ", "\x1B[36m", maze[i * col + j]);
    }
    printf("\n");
  }
  return;
}


x86 assembly (clang, -O0):
<printMaze>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
lea    0xec0(%rip),%rdi
call   1030 <system@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jae    132d <printMaze+0x20d>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmp    %rcx,%rax
jae    130e <printMaze+0x1ee>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11c7 <printMaze+0xa7>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xe52(%rip),%rdi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f8 <printMaze+0x1d8>
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   %rcx,%rax
add    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jne    1216 <printMaze+0xf6>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xe03(%rip),%rdi
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f3 <printMaze+0x1d3>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x78,%eax
jne    1269 <printMaze+0x149>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xdb0(%rip),%rdi
lea    0xdbb(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12ee <printMaze+0x1ce>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    12bc <printMaze+0x19c>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd5d(%rip),%rdi
lea    0xd6e(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12e9 <printMaze+0x1c9>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd2b(%rip),%rdi
lea    0xd42(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12ee <printMaze+0x1ce>
jmp    12f3 <printMaze+0x1d3>
jmp    12f8 <printMaze+0x1d8>
jmp    12fd <printMaze+0x1dd>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1166 <printMaze+0x46>
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    114d <printMaze+0x2d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMaze>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,%rbx
mov    %ecx,%r12d
mov    %edx,0x4(%rsp)
mov    %esi,%ebp
mov    %rdi,0x8(%rsp)
lea    0xeaa(%rip),%rdi
call   1040 <system@plt>
test   %ebp,%ebp
je     126c <printMaze+0x13c>
movslq 0x4(%rsp),%rax
movslq %r12d,%r12
cmp    $0x2,%rax
mov    $0x1,%r14d
cmovae %rax,%r14
movslq %ebp,%rcx
mov    %rcx,0x18(%rsp)
mov    %rax,0x20(%rsp)
lea    0x0(,%rax,4),%rax
mov    %rax,0x10(%rsp)
lea    0xe6c(%rip),%rbp
mov    %r12,%rax
mov    %r12,0x30(%rsp)
mov    0x8(%rsp),%r15
xor    %ecx,%ecx
jmp    11de <printMaze+0xae>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x28(%rsp),%rcx
add    $0x1,%rcx
mov    0x20(%rsp),%rax
add    %rax,%r15
sub    %rax,%r12
add    0x10(%rsp),%rbx
cmp    0x18(%rsp),%rcx
je     126c <printMaze+0x13c>
mov    %rcx,0x28(%rsp)
cmpl   $0x0,0x4(%rsp)
je     11b0 <printMaze+0x80>
xor    %r13d,%r13d
jmp    120f <printMaze+0xdf>
nop
movsbl (%r15,%r13,1),%edx
mov    %rbp,%rdi
lea    0xe0d(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
cmp    %r13,%r14
je     11b0 <printMaze+0x80>
cmpl   $0x0,(%rbx,%r13,4)
jne    11f0 <printMaze+0xc0>
cmp    %r13,%r12
jne    1235 <printMaze+0x105>
mov    0x8(%rsp),%rax
mov    0x30(%rsp),%rcx
movsbl (%rax,%rcx,1),%edx
mov    %rbp,%rdi
lea    0xddf(%rip),%rsi
jmp    11ff <printMaze+0xcf>
movsbl (%r15,%r13,1),%edx
mov    %rbp,%rdi
cmp    $0x2e,%edx
je     1255 <printMaze+0x125>
cmp    $0x78,%dl
jne    1263 <printMaze+0x133>
lea    0xdca(%rip),%rsi
mov    $0x78,%edx
jmp    11ff <printMaze+0xcf>
lea    0xdc2(%rip),%rsi
mov    $0x2e,%edx
jmp    11ff <printMaze+0xcf>
lea    0xdba(%rip),%rsi
jmp    11ff <printMaze+0xcf>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [6 x i8] c"%s%c \00"
@.str.2 = [6 x i8] c"\1B[35m\00"
@.str.3 = [6 x i8] c"\1B[31m\00"
@.str.4 = [6 x i8] c"\1B[33m\00"
@.str.5 = [6 x i8] c"\1B[37m\00"
@.str.6 = [6 x i8] c"\1B[36m\00"
define void @printMaze(i8* nocapture %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4) {
%6 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %1, 0
br i1 %7, label %19, label %8
8: ; preds = %5
%9 = sext i32 %2 to i64
%10 = icmp eq i32 %2, 0
%11 = sext i32 %3 to i64
%12 = call i64 @llvm.umax.i64(i64 %9, i64 1)
%13 = sext i32 %1 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %11
br label %15
15: ; preds = %8, %20
%16 = phi i64 [ 0, %8 ], [ %22, %20 ]
br i1 %10, label %20, label %17
17: ; preds = %15
%18 = mul i64 %16, %9
br label %24
19: ; preds = %20, %5
ret void
20: ; preds = %51, %15
%21 = tail call i32 @putchar(i32 10)
%22 = add nuw i64 %16, 1
%23 = icmp eq i64 %22, %13
br i1 %23, label %19, label %15
24: ; preds = %17, %51
%25 = phi i64 [ 0, %17 ], [ %52, %51 ]
%26 = add i64 %25, %18
%27 = getelementptr inbounds i32, i32* %4, i64 %26
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %24
%31 = getelementptr inbounds i8, i8* %0, i64 %26
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %51
35: ; preds = %24
%36 = icmp eq i64 %26, %11
br i1 %36, label %37, label %41
37: ; preds = %35
%38 = load i8, i8* %14
%39 = sext i8 %38 to i32
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %39)
br label %51
41: ; preds = %35
%42 = getelementptr inbounds i8, i8* %0, i64 %26
%43 = load i8, i8* %42
switch i8 %43, label %48 [
i8 120, label %44
i8 46, label %46
]
44: ; preds = %41
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 120)
br label %51
46: ; preds = %41
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 46)
br label %51
48: ; preds = %41
%49 = sext i8 %43 to i32
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %30, %44, %48, %46, %37
%52 = add nuw i64 %25, 1
%53 = icmp eq i64 %52, %12
br i1 %53, label %20, label %24
}