#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 */
scalar_t__ bfsOut(int, int, char *, int, int, int *);
int /*<<< orphan*/ findStart(int, int, char *, int *, int *);
int /*<<< orphan*/ printf(char *);
void mazeTraverse(char *maze, int row, int col, int startRow, int startColume) {
  findStart(row, col, maze, &startRow, &startColume);
  int path[1000] = {0};
  path[startRow * col + startColume] = 1;
  if (bfsOut(row, col, maze, startRow * col + startColume,
             startRow * col + startColume, path))
    printf("Success!\n");
  else
    printf("Fail!\n");
  return;
}


x86 assembly (clang, -O0):
<mazeTraverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1060 <findStart@plt>
lea    -0xfc0(%rbp),%rdi
xor    %esi,%esi
mov    $0xfa0,%edx
call   1050 <memset@plt>
mov    -0x14(%rbp),%eax
imul   -0x10(%rbp),%eax
add    -0x18(%rbp),%eax
cltq
movl   $0x1,-0xfc0(%rbp,%rax,4)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
imul   -0x10(%rbp),%r8d
add    -0x18(%rbp),%r8d
lea    -0xfc0(%rbp),%r9
call   1030 <bfsOut@plt>
cmp    $0x0,%rax
je     11e5 <mazeTraverse+0xa5>
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
jmp    11f1 <mazeTraverse+0xb1>
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mazeTraverse>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xfb8,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %ecx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %esi,%edi
mov    %edx,%esi
mov    %r14,%rdx
call   1060 <findStart@plt>
lea    0x10(%rsp),%r15
mov    $0xfa0,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
movslq 0xc(%rsp),%rax
movslq %ebx,%rsi
imul   %rsi,%rax
movslq 0x8(%rsp),%rcx
add    %rax,%rcx
movl   $0x1,0x10(%rsp,%rcx,4)
mov    %ebp,%edi
mov    %r14,%rdx
mov    %ecx,%r8d
mov    %r15,%r9
call   1030 <bfsOut@plt>
test   %rax,%rax
lea    0xe43(%rip),%rax
lea    0xe42(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
add    $0xfb8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Success!\0A\00"
@.str.1 = [7 x i8] c"Fail!\0A\00"
define void @mazeTraverse(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 [1000 x i32]
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
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i8*, i8** %6
%15 = call i32 @findStart(i32 %12, i32 %13, i8* %14, i32* %9, i32* %10)
%16 = bitcast [1000 x i32]* %11 to i8*
%17 = load i32, i32* %9
%18 = load i32, i32* %8
%19 = mul nsw i32 %17, %18
%20 = load i32, i32* %10
%21 = add nsw i32 %19, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1000 x i32], [1000 x i32]* %11, i64 0, i64 %22
store i32 1, i32* %23
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = load i8*, i8** %6
%27 = load i32, i32* %9
%28 = load i32, i32* %8
%29 = mul nsw i32 %27, %28
%30 = load i32, i32* %10
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = mul nsw i32 %32, %33
%35 = load i32, i32* %10
%36 = add nsw i32 %34, %35
%37 = getelementptr inbounds [1000 x i32], [1000 x i32]* %11, i64 0, i64 0
%38 = call i64 @bfsOut(i32 %24, i32 %25, i8* %26, i32 %31, i32 %36, i32* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %5
%41 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %44
42: ; preds = %5
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"Fail!\00"
@str.2 = [9 x i8] c"Success!\00"
define void @mazeTraverse(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1000 x i32]
store i32 %3, i32* %6
store i32 %4, i32* %7
%9 = call i32 @findStart(i32 %1, i32 %2, i8* %0, i32* %6, i32* %7)
%10 = bitcast [1000 x i32]* %8 to i8*
%11 = load i32, i32* %6
%12 = mul nsw i32 %11, %2
%13 = load i32, i32* %7
%14 = add nsw i32 %12, %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 %15
store i32 1, i32* %16
%17 = getelementptr inbounds [1000 x i32], [1000 x i32]* %8, i64 0, i64 0
%18 = call i64 @bfsOut(i32 %1, i32 %2, i8* %0, i32 %14, i32 %14, i32* %17)
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.2, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
ret void
}