#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 (i * col + j == now)
          printf("%s%c ", "\x1B[35m", maze[i * col + j]);
        else if (path[i * col + j])
          printf("  ");
        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    1370 <flash+0x240>
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    1353 <flash+0x223>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmp    %rcx,%rax
jae    1334 <flash+0x204>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   %rcx,%rax
add    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jne    120b <flash+0xdb>
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    0xe18(%rip),%rdi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    131e <flash+0x1ee>
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     123c <flash+0x10c>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1319 <flash+0x1e9>
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    128f <flash+0x15f>
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    0xd94(%rip),%rdi
lea    0xd9c(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1314 <flash+0x1e4>
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    12e2 <flash+0x1b2>
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    0xd41(%rip),%rdi
lea    0xd4f(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    130f <flash+0x1df>
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    0xd0f(%rip),%rdi
lea    0xd23(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1314 <flash+0x1e4>
jmp    1319 <flash+0x1e9>
jmp    131e <flash+0x1ee>
jmp    1323 <flash+0x1f3>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11ab <flash+0x7b>
lea    0xcf6(%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    0xcd9(%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,%r15d
cmovae %rdx,%r15
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    0xe7a(%rip),%rdi
call   1040 <system@plt>
mov    0x28(%rsp),%rax
add    $0x1,%rax
cmp    $0xa,%rax
je     12f4 <flash+0x1b4>
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    0x20(%rsp),%rbp
mov    0x8(%rsp),%rbx
mov    0x18(%rsp),%r13
xor    %r14d,%r14d
jmp    1259 <flash+0x119>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    0x30(%rsp),%r13
mov    0x40(%rsp),%rax
add    %rax,%rbx
sub    %rax,%rbp
cmp    0x38(%rsp),%r14
je     11b0 <flash+0x70>
cmpl   $0x0,0x4(%rsp)
je     1230 <flash+0xf0>
xor    %r12d,%r12d
jmp    129c <flash+0x15c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%rax
mov    0x20(%rsp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xd8b(%rip),%rdi
lea    0xd8a(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r15
je     1230 <flash+0xf0>
cmp    %r12,%rbp
je     1270 <flash+0x130>
cmpl   $0x0,0x0(%r13,%r12,4)
je     12b9 <flash+0x179>
lea    0xd6c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1293 <flash+0x153>
movsbl (%rbx,%r12,1),%edx
lea    0xd4b(%rip),%rdi
cmp    $0x2e,%edx
je     12dd <flash+0x19d>
cmp    $0x78,%dl
jne    12eb <flash+0x1ab>
lea    0xd49(%rip),%rsi
mov    $0x78,%edx
jmp    128c <flash+0x14c>
lea    0xd41(%rip),%rsi
mov    $0x2e,%edx
jmp    128c <flash+0x14c>
lea    0xd39(%rip),%rsi
jmp    128c <flash+0x14c>
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 = [6 x i8] c"%s%c \00"
@.str.3 = [6 x i8] c"\1B[35m\00"
@.str.4 = [3 x i8] c" \00"
@.str.5 = [6 x i8] c"\1B[33m\00"
@.str.6 = [6 x i8] c"\1B[37m\00"
@.str.7 = [6 x i8] c"\1B[36m\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [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 = %146, %5
%15 = load i64, i64* %11
%16 = icmp ult i64 %15, 10
br i1 %16, label %17, label %149
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 = %141, %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 %144
31: ; preds = %26
store i64 0, i64* %13
br label %32
32: ; preds = %136, %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 %139
37: ; preds = %32
%38 = load i64, i64* %12
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = mul i64 %38, %40
%42 = load i64, i64* %13
%43 = add i64 %41, %42
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = icmp eq i64 %43, %45
br i1 %46, label %47, label %59
47: ; preds = %37
%48 = load i8*, i8** %6
%49 = load i64, i64* %12
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = mul i64 %49, %51
%53 = load i64, i64* %13
%54 = add i64 %52, %53
%55 = getelementptr inbounds i8, i8* %48, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %57)
br label %135
59: ; preds = %37
%60 = load i32*, i32** %10
%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 = getelementptr inbounds i32, i32* %60, i64 %66
%68 = load i32, i32* %67
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %59
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %134
72: ; preds = %59
%73 = load i8*, i8** %6
%74 = load i64, i64* %12
%75 = load i32, i32* %8
%76 = sext i32 %75 to i64
%77 = mul i64 %74, %76
%78 = load i64, i64* %13
%79 = add i64 %77, %78
%80 = getelementptr inbounds i8, i8* %73, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 120
br i1 %83, label %84, label %96
84: ; preds = %72
%85 = load i8*, i8** %6
%86 = load i64, i64* %12
%87 = load i32, i32* %8
%88 = sext i32 %87 to i64
%89 = mul i64 %86, %88
%90 = load i64, i64* %13
%91 = add i64 %89, %90
%92 = getelementptr inbounds i8, i8* %85, i64 %91
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %94)
br label %133
96: ; preds = %72
%97 = load i8*, i8** %6
%98 = load i64, i64* %12
%99 = load i32, i32* %8
%100 = sext i32 %99 to i64
%101 = mul i64 %98, %100
%102 = load i64, i64* %13
%103 = add i64 %101, %102
%104 = getelementptr inbounds i8, i8* %97, i64 %103
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 46
br i1 %107, label %108, label %120
108: ; preds = %96
%109 = load i8*, i8** %6
%110 = load i64, i64* %12
%111 = load i32, i32* %8
%112 = sext i32 %111 to i64
%113 = mul i64 %110, %112
%114 = load i64, i64* %13
%115 = add i64 %113, %114
%116 = getelementptr inbounds i8, i8* %109, i64 %115
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %118)
br label %132
120: ; preds = %96
%121 = load i8*, i8** %6
%122 = load i64, i64* %12
%123 = load i32, i32* %8
%124 = sext i32 %123 to i64
%125 = mul i64 %122, %124
%126 = load i64, i64* %13
%127 = add i64 %125, %126
%128 = getelementptr inbounds i8, i8* %121, i64 %127
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %130)
br label %132
132: ; preds = %120, %108
br label %133
133: ; preds = %132, %84
br label %134
134: ; preds = %133, %70
br label %135
135: ; preds = %134, %47
br label %136
136: ; preds = %135
%137 = load i64, i64* %13
%138 = add i64 %137, 1
store i64 %138, i64* %13
br label %32
139: ; preds = %32
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %141
141: ; preds = %139
%142 = load i64, i64* %12
%143 = add i64 %142, 1
store i64 %143, i64* %12
br label %26
144: ; preds = %26
%145 = call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %146
146: ; preds = %144
%147 = load i64, i64* %11
%148 = add i64 %147, 1
store i64 %148, i64* %11
br label %14
149: ; 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 = [6 x i8] c"%s%c \00"
@.str.3 = [6 x i8] c"\1B[35m\00"
@.str.4 = [3 x i8] c" \00"
@.str.5 = [6 x i8] c"\1B[33m\00"
@.str.6 = [6 x i8] c"\1B[37m\00"
@.str.7 = [6 x i8] c"\1B[36m\00"
@.str.9 = [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.9, 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 = %56, %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, %56
%33 = phi i64 [ 0, %22 ], [ %57, %56 ]
%34 = add i64 %33, %23
%35 = icmp eq i64 %34, %9
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i8, i8* %13
%38 = sext i8 %37 to i32
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %56
40: ; preds = %32
%41 = getelementptr inbounds i32, i32* %4, i64 %34
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %40
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %56
46: ; preds = %40
%47 = getelementptr inbounds i8, i8* %0, i64 %34
%48 = load i8, i8* %47
switch i8 %48, label %53 [
i8 120, label %49
i8 46, label %51
]
49: ; preds = %46
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 120)
br label %56
51: ; preds = %46
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 46)
br label %56
53: ; preds = %46
%54 = sext i8 %48 to i32
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %36, %49, %53, %51, %44
%57 = add nuw i64 %33, 1
%58 = icmp eq i64 %57, %10
br i1 %58, label %28, label %32
}