#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 < 1; 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   $0x1,-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    $0x38,%rsp
mov    %r8,%rbx
mov    %ecx,%r12d
mov    %esi,%ebp
mov    %rdi,0x10(%rsp)
mov    %edx,0xc(%rsp)
call   1060 <printMaze@plt>
lea    0xe95(%rip),%rdi
call   1040 <system@plt>
lea    0xe93(%rip),%rdi
call   1040 <system@plt>
test   %ebp,%ebp
je     1280 <flash+0x140>
movslq 0xc(%rsp),%rax
movslq %r12d,%r12
cmp    $0x2,%rax
mov    $0x1,%r13d
cmovae %rax,%r13
movslq %ebp,%rcx
mov    %rcx,0x20(%rsp)
mov    %rax,0x28(%rsp)
lea    0x0(,%rax,4),%rax
mov    %rax,0x18(%rsp)
mov    %r12,%r14
mov    0x10(%rsp),%rbp
xor    %ecx,%ecx
jmp    11ee <flash+0xae>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x30(%rsp),%rcx
add    $0x1,%rcx
add    0x18(%rsp),%rbx
mov    0x28(%rsp),%rax
add    %rax,%rbp
sub    %rax,%r14
cmp    0x20(%rsp),%rcx
je     1280 <flash+0x140>
mov    %rcx,0x30(%rsp)
cmpl   $0x0,0xc(%rsp)
je     11c0 <flash+0x80>
xor    %r15d,%r15d
jmp    1228 <flash+0xe8>
nop
mov    0x10(%rsp),%rax
movsbl (%rax,%r12,1),%edx
lea    0xdff(%rip),%rdi
lea    0xdfe(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r13
je     11c0 <flash+0x80>
cmp    %r15,%r14
je     1200 <flash+0xc0>
cmpl   $0x0,(%rbx,%r15,4)
je     1244 <flash+0x104>
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    121f <flash+0xdf>
movsbl 0x0(%rbp,%r15,1),%edx
lea    0xdbf(%rip),%rdi
cmp    $0x2e,%edx
je     1269 <flash+0x129>
cmp    $0x78,%dl
jne    1277 <flash+0x137>
lea    0xdbd(%rip),%rsi
mov    $0x78,%edx
jmp    1218 <flash+0xd8>
lea    0xdb5(%rip),%rsi
mov    $0x2e,%edx
jmp    1218 <flash+0xd8>
lea    0xdad(%rip),%rsi
jmp    1218 <flash+0xd8>
lea    0xdaa(%rip),%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <system@plt>

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, 1
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 = tail call i32 @printMaze(i8* %0, i32 %1, i32 %2, i32 %3, i32* %4)
%7 = tail call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %1, 0
br i1 %9, label %21, label %10
10: ; preds = %5
%11 = sext i32 %2 to i64
%12 = icmp eq i32 %2, 0
%13 = sext i32 %3 to i64
%14 = call i64 @llvm.umax.i64(i64 %11, i64 1)
%15 = sext i32 %1 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %13
br label %17
17: ; preds = %10, %23
%18 = phi i64 [ 0, %10 ], [ %25, %23 ]
br i1 %12, label %23, label %19
19: ; preds = %17
%20 = mul i64 %18, %11
br label %27
21: ; preds = %23, %5
%22 = tail call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
ret void
23: ; preds = %51, %17
%24 = tail call i32 @putchar(i32 10)
%25 = add nuw i64 %18, 1
%26 = icmp eq i64 %25, %15
br i1 %26, label %21, label %17
27: ; preds = %19, %51
%28 = phi i64 [ 0, %19 ], [ %52, %51 ]
%29 = add i64 %28, %20
%30 = icmp eq i64 %29, %13
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = load i8, i8* %16
%33 = sext i8 %32 to i32
%34 = 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 %33)
br label %51
35: ; preds = %27
%36 = getelementptr inbounds i32, i32* %4, i64 %29
%37 = load i32, i32* %36
%38 = icmp eq i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %35
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %51
41: ; preds = %35
%42 = getelementptr inbounds i8, i8* %0, i64 %29
%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.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, 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.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, 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.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %31, %44, %48, %46, %39
%52 = add nuw i64 %28, 1
%53 = icmp eq i64 %52, %14
br i1 %53, label %23, label %27
}