#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*/ printMaze(char *, int, int, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
void flash(char *maze, int row, int col, int now, int *path) {
  for (size_t t = 0; t < 10; t++) {
    printMaze(maze, row, col, now, path);
    system("sleep 0.3");
    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  ", "\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");
    }
    system("sleep 0.2");
  }
  return;
}


x86 assembly (clang, -O0):
<flash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0xa,-0x28(%rbp)
jae    138f <flash+0x25f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1050 <printMaze@plt>
lea    0xe87(%rip),%rdi
call   1030 <system@plt>
lea    0xe85(%rip),%rdi
call   1030 <system@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jae    1372 <flash+0x242>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmp    %rcx,%rax
jae    1353 <flash+0x223>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     120c <flash+0xdc>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xe17(%rip),%rdi
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    133d <flash+0x20d>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   %rcx,%rax
add    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jne    125b <flash+0x12b>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xdd3(%rip),%rdi
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1338 <flash+0x208>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x78,%eax
jne    12ae <flash+0x17e>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd80(%rip),%rdi
lea    0xd85(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1333 <flash+0x203>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    1301 <flash+0x1d1>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd2d(%rip),%rdi
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    132e <flash+0x1fe>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rdx
imul   %rdx,%rcx
add    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xcfb(%rip),%rdi
lea    0xd0c(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1333 <flash+0x203>
jmp    1338 <flash+0x208>
jmp    133d <flash+0x20d>
jmp    1342 <flash+0x212>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11ab <flash+0x7b>
lea    0xcdf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1192 <flash+0x62>
lea    0xcc2(%rip),%rdi
call   1030 <system@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1151 <flash+0x21>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flash>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,0x18(%rsp)
mov    %rdi,0x8(%rsp)
mov    %edx,0x4(%rsp)
movslq %edx,%rdx
mov    %ecx,0x14(%rsp)
movslq %ecx,%rax
mov    %rax,0x20(%rsp)
cmp    $0x2,%rdx
mov    $0x1,%r14d
cmovae %rdx,%r14
cmp    $0x2,%esi
mov    $0x1,%eax
mov    %esi,0x10(%rsp)
cmovae %esi,%eax
cltq
mov    %rax,0x38(%rsp)
mov    %rdx,0x40(%rsp)
lea    0x0(,%rdx,4),%rax
mov    %rax,0x30(%rsp)
xor    %eax,%eax
jmp    11cf <flash+0x8f>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe82(%rip),%rdi
call   1040 <system@plt>
mov    0x28(%rsp),%rax
add    $0x1,%rax
cmp    $0xa,%rax
je     12fb <flash+0x1bb>
mov    %rax,0x28(%rsp)
mov    0x8(%rsp),%rdi
mov    0x10(%rsp),%ebx
mov    %ebx,%esi
mov    0x4(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8
call   1060 <printMaze@plt>
lea    0xe08(%rip),%rdi
call   1040 <system@plt>
lea    0xe06(%rip),%rdi
call   1040 <system@plt>
test   %ebx,%ebx
je     11b0 <flash+0x70>
mov    0x18(%rsp),%rbp
mov    0x20(%rsp),%rbx
mov    0x8(%rsp),%r13
xor    %r12d,%r12d
jmp    1259 <flash+0x119>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
mov    0x40(%rsp),%rax
add    %rax,%r13
sub    %rax,%rbx
add    0x30(%rsp),%rbp
cmp    0x38(%rsp),%r12
je     11b0 <flash+0x70>
cmpl   $0x0,0x4(%rsp)
je     1230 <flash+0xf0>
xor    %r15d,%r15d
jmp    1294 <flash+0x154>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x0(%r13,%r15,1),%edx
lea    0xd93(%rip),%rdi
lea    0xd91(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r14
je     1230 <flash+0xf0>
cmpl   $0x0,0x0(%rbp,%r15,4)
jne    1270 <flash+0x130>
cmp    %r15,%rbx
jne    12bf <flash+0x17f>
mov    0x8(%rsp),%rax
mov    0x20(%rsp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd65(%rip),%rdi
lea    0xd64(%rip),%rsi
jmp    1284 <flash+0x144>
movsbl 0x0(%r13,%r15,1),%edx
lea    0xd4f(%rip),%rdi
cmp    $0x2e,%edx
je     12e4 <flash+0x1a4>
cmp    $0x78,%dl
jne    12f2 <flash+0x1b2>
lea    0xd4a(%rip),%rsi
mov    $0x78,%edx
jmp    1284 <flash+0x144>
lea    0xd42(%rip),%rsi
mov    $0x2e,%edx
jmp    1284 <flash+0x144>
lea    0xd3a(%rip),%rsi
jmp    1284 <flash+0x144>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"sleep 0.3\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.2 = [5 x i8] c"%s \00"
@.str.3 = [6 x i8] c"\1B[35m\00"
@.str.4 = [6 x i8] c"%s%c \00"
@.str.5 = [6 x i8] c"\1B[31m\00"
@.str.6 = [6 x i8] c"\1B[33m\00"
@.str.7 = [6 x i8] c"\1B[37m\00"
@.str.8 = [6 x i8] c"\1B[36m\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [10 x i8] c"sleep 0.2\00"
define void @flash(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
%13 = 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
store i64 0, i64* %11
br label %14
14: ; preds = %156, %5
%15 = load i64, i64* %11
%16 = icmp ult i64 %15, 10
br i1 %16, label %17, label %159
17: ; preds = %14
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = load i32*, i32** %10
%23 = call i32 @printMaze(i8* %18, i32 %19, i32 %20, i32 %21, i32* %22)
%24 = call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %12
br label %26
26: ; preds = %151, %17
%27 = load i64, i64* %12
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = icmp ult i64 %27, %29
br i1 %30, label %31, label %154
31: ; preds = %26
store i64 0, i64* %13
br label %32
32: ; preds = %146, %31
%33 = load i64, i64* %13
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = icmp ult i64 %33, %35
br i1 %36, label %37, label %149
37: ; preds = %32
%38 = load i32*, i32** %10
%39 = load i64, i64* %12
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = mul i64 %39, %41
%43 = load i64, i64* %13
%44 = add i64 %42, %43
%45 = getelementptr inbounds i32, i32* %38, i64 %44
%46 = load i32, i32* %45
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %60
48: ; preds = %37
%49 = load i8*, i8** %6
%50 = load i64, i64* %12
%51 = load i32, i32* %8
%52 = sext i32 %51 to i64
%53 = mul i64 %50, %52
%54 = load i64, i64* %13
%55 = add i64 %53, %54
%56 = getelementptr inbounds i8, i8* %49, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %58)
br label %145
60: ; preds = %37
%61 = load i64, i64* %12
%62 = load i32, i32* %8
%63 = sext i32 %62 to i64
%64 = mul i64 %61, %63
%65 = load i64, i64* %13
%66 = add i64 %64, %65
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = icmp eq i64 %66, %68
br i1 %69, label %70, label %82
70: ; preds = %60
%71 = load i8*, i8** %6
%72 = load i64, i64* %12
%73 = load i32, i32* %8
%74 = sext i32 %73 to i64
%75 = mul i64 %72, %74
%76 = load i64, i64* %13
%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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %80)
br label %144
82: ; preds = %60
%83 = load i8*, i8** %6
%84 = load i64, i64* %12
%85 = load i32, i32* %8
%86 = sext i32 %85 to i64
%87 = mul i64 %84, %86
%88 = load i64, i64* %13
%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 = icmp eq i32 %92, 120
br i1 %93, label %94, label %106
94: ; preds = %82
%95 = load i8*, i8** %6
%96 = load i64, i64* %12
%97 = load i32, i32* %8
%98 = sext i32 %97 to i64
%99 = mul i64 %96, %98
%100 = load i64, i64* %13
%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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %104)
br label %143
106: ; preds = %82
%107 = load i8*, i8** %6
%108 = load i64, i64* %12
%109 = load i32, i32* %8
%110 = sext i32 %109 to i64
%111 = mul i64 %108, %110
%112 = load i64, i64* %13
%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 = icmp eq i32 %116, 46
br i1 %117, label %118, label %130
118: ; preds = %106
%119 = load i8*, i8** %6
%120 = load i64, i64* %12
%121 = load i32, i32* %8
%122 = sext i32 %121 to i64
%123 = mul i64 %120, %122
%124 = load i64, i64* %13
%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.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %128)
br label %142
130: ; preds = %106
%131 = load i8*, i8** %6
%132 = load i64, i64* %12
%133 = load i32, i32* %8
%134 = sext i32 %133 to i64
%135 = mul i64 %132, %134
%136 = load i64, i64* %13
%137 = add i64 %135, %136
%138 = getelementptr inbounds i8, i8* %131, i64 %137
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %140)
br label %142
142: ; preds = %130, %118
br label %143
143: ; preds = %142, %94
br label %144
144: ; preds = %143, %70
br label %145
145: ; preds = %144, %48
br label %146
146: ; preds = %145
%147 = load i64, i64* %13
%148 = add i64 %147, 1
store i64 %148, i64* %13
br label %32
149: ; preds = %32
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %151
151: ; preds = %149
%152 = load i64, i64* %12
%153 = add i64 %152, 1
store i64 %153, i64* %12
br label %26
154: ; preds = %26
%155 = call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
br label %156
156: ; preds = %154
%157 = load i64, i64* %11
%158 = add i64 %157, 1
store i64 %158, i64* %11
br label %14
159: ; preds = %14
ret void
}

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