#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__ mazeUtility(int, int **, int /*<<< orphan*/, int /*<<< orphan*/,
                       int **);
int /*<<< orphan*/ printMaze(int, int **);
int /*<<< orphan*/ printf(char *);
void solveMaze(int size, int maze[size][size]) {
  int i, j, sol[size][size];
  for (i = 0; i < size; i++)
    for (j = 0; j < size; j++)
      sol[i][j] = 0;
  if (mazeUtility(size, maze, 0, 0, sol)) {
    printf("The solution for this maze exists\n");
    printf("The solution maze wrt given maze is (follow the 1's):: \n");
    printMaze(size, sol);
  } else
    printf("There is no solution for the given maze\n");
}


x86 assembly (clang, -O0):
<solveMaze>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e3 <solveMaze+0xb3>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d0 <solveMaze+0xa0>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rdx
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1194 <solveMaze+0x64>
jmp    11d5 <solveMaze+0xa5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1181 <solveMaze+0x51>
mov    -0x38(%rbp),%r8
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1050 <mazeUtility@plt>
cmp    $0x0,%rax
je     122a <solveMaze+0xfa>
lea    0xdf8(%rip),%rdi
call   1030 <printf@plt>
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1040 <printMaze@plt>
jmp    1236 <solveMaze+0x106>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveMaze>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,-0x48(%rbp)
mov    %edi,%r15d
mov    %edi,%ecx
mov    %rcx,%rax
imul   %rcx,%rax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
test   %edi,%edi
jle    1286 <solveMaze+0x146>
mov    %r15d,-0x2c(%rbp)
lea    0x0(,%rcx,4),%r14
lea    -0x1(%rcx),%rax
mov    %ecx,%r12d
and    $0x7,%r12d
cmp    $0x7,%rax
mov    %r13,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
jae    11aa <solveMaze+0x6a>
xor    %ebx,%ebx
jmp    1250 <solveMaze+0x110>
mov    %ecx,%eax
and    $0xfffffff8,%eax
mov    %rax,-0x58(%rbp)
shl    $0x5,%rcx
mov    %rcx,-0x50(%rbp)
xor    %ebx,%ebx
nopl   (%rax)
mov    %r13,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
lea    (%r14,%r13,1),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r14,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r14,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r14,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r14,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r14,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r14,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    $0x8,%rbx
add    -0x50(%rbp),%r13
cmp    %rbx,-0x58(%rbp)
jne    11c0 <solveMaze+0x80>
test   %r12,%r12
mov    -0x2c(%rbp),%r15d
mov    -0x40(%rbp),%r13
mov    -0x38(%rbp),%rax
je     1286 <solveMaze+0x146>
imul   %rax,%rbx
lea    0x0(,%rbx,4),%rbx
add    %r13,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r14,%rbx
add    $0xffffffffffffffff,%r12
jne    1270 <solveMaze+0x130>
mov    %r15d,%edi
mov    -0x48(%rbp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r13,%r8
call   1060 <mazeUtility@plt>
test   %rax,%rax
je     12c3 <solveMaze+0x183>
lea    0xd83(%rip),%rdi
call   1030 <puts@plt>
lea    0xd99(%rip),%rdi
call   1030 <puts@plt>
mov    %r15d,%edi
mov    %r13,%rsi
call   1050 <printMaze@plt>
jmp    12cf <solveMaze+0x18f>
lea    0xd36(%rip),%rdi
call   1030 <puts@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"The solution for this maze exists\0A\00"
@.str.1 = [57 x i8] c"The solution maze wrt given maze is (follow the 1's):: \0A\00"
@.str.2 = [41 x i8] c"There is no solution for the given maze\0A\00"
define void @solveMaze(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
store i32 %0, i32* %3
store i32* %1, i32** %4
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = load i32, i32* %3
%15 = zext i32 %14 to i64
%16 = load i32, i32* %3
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %7
%19 = mul nuw i64 %15, %17
%20 = alloca i32, i64 %19
store i64 %15, i64* %8
store i64 %17, i64* %9
store i32 0, i32* %5
br label %21
21: ; preds = %42, %2
%22 = load i32, i32* %5
%23 = load i32, i32* %3
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %45
25: ; preds = %21
store i32 0, i32* %6
br label %26
26: ; preds = %38, %25
%27 = load i32, i32* %6
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = mul nsw i64 %32, %17
%34 = getelementptr inbounds i32, i32* %20, i64 %33
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
store i32 0, i32* %37
br label %38
38: ; preds = %30
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %26
41: ; preds = %26
br label %42
42: ; preds = %41
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %21
45: ; preds = %21
%46 = load i32, i32* %3
%47 = load i32*, i32** %4
%48 = bitcast i32* %47 to i32**
%49 = bitcast i32* %20 to i32**
%50 = call i64 @mazeUtility(i32 %46, i32** %48, i32 0, i32 0, i32** %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %45
%53 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%54 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%55 = load i32, i32* %3
%56 = bitcast i32* %20 to i32**
%57 = call i32 @printMaze(i32 %55, i32** %56)
br label %60
58: ; preds = %45
%59 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %58, %52
%61 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@str = [40 x i8] c"There is no solution for the given maze\00"
@str.3 = [34 x i8] c"The solution for this maze exists\00"
@str.4 = [56 x i8] c"The solution maze wrt given maze is (follow the 1's):: \00"
define void @solveMaze(i32 %0, i32* %1) {
%3 = zext i32 %0 to i64
%4 = mul nuw i64 %3, %3
%5 = alloca i32, i64 %4
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %63
7: ; preds = %2
%8 = shl nuw nsw i64 %3, 2
%9 = add nsw i64 %3, -1
%10 = and i64 %3, 7
%11 = icmp ult i64 %9, 7
br i1 %11, label %51, label %12
12: ; preds = %7
%13 = and i64 %3, 4294967288
br label %14
14: ; preds = %14, %12
%15 = phi i64 [ 0, %12 ], [ %48, %14 ]
%16 = phi i64 [ 0, %12 ], [ %49, %14 ]
%17 = mul nuw nsw i64 %15, %3
%18 = getelementptr i32, i32* %5, i64 %17
%19 = bitcast i32* %18 to i8*
%20 = or i64 %15, 1
%21 = mul nuw nsw i64 %20, %3
%22 = getelementptr i32, i32* %5, i64 %21
%23 = bitcast i32* %22 to i8*
%24 = or i64 %15, 2
%25 = mul nuw nsw i64 %24, %3
%26 = getelementptr i32, i32* %5, i64 %25
%27 = bitcast i32* %26 to i8*
%28 = or i64 %15, 3
%29 = mul nuw nsw i64 %28, %3
%30 = getelementptr i32, i32* %5, i64 %29
%31 = bitcast i32* %30 to i8*
%32 = or i64 %15, 4
%33 = mul nuw nsw i64 %32, %3
%34 = getelementptr i32, i32* %5, i64 %33
%35 = bitcast i32* %34 to i8*
%36 = or i64 %15, 5
%37 = mul nuw nsw i64 %36, %3
%38 = getelementptr i32, i32* %5, i64 %37
%39 = bitcast i32* %38 to i8*
%40 = or i64 %15, 6
%41 = mul nuw nsw i64 %40, %3
%42 = getelementptr i32, i32* %5, i64 %41
%43 = bitcast i32* %42 to i8*
%44 = or i64 %15, 7
%45 = mul nuw nsw i64 %44, %3
%46 = getelementptr i32, i32* %5, i64 %45
%47 = bitcast i32* %46 to i8*
%48 = add nuw nsw i64 %15, 8
%49 = add i64 %16, 8
%50 = icmp eq i64 %49, %13
br i1 %50, label %51, label %14
51: ; preds = %14, %7
%52 = phi i64 [ 0, %7 ], [ %48, %14 ]
%53 = icmp eq i64 %10, 0
br i1 %53, label %63, label %54
54: ; preds = %51, %54
%55 = phi i64 [ %60, %54 ], [ %52, %51 ]
%56 = phi i64 [ %61, %54 ], [ 0, %51 ]
%57 = mul nuw nsw i64 %55, %3
%58 = getelementptr i32, i32* %5, i64 %57
%59 = bitcast i32* %58 to i8*
%60 = add nuw nsw i64 %55, 1
%61 = add i64 %56, 1
%62 = icmp eq i64 %61, %10
br i1 %62, label %63, label %54
63: ; preds = %51, %54, %2
%64 = bitcast i32* %1 to i32**
%65 = bitcast i32* %5 to i32**
%66 = call i64 @mazeUtility(i32 %0, i32** %64, i32 0, i32 0, i32** %65)
%67 = icmp eq i64 %66, 0
br i1 %67, label %72, label %68
68: ; preds = %63
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0))
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.4, i64 0, i64 0))
%71 = call i32 @printMaze(i32 %0, i32** %65)
br label %74
72: ; preds = %63
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
br label %74
74: ; preds = %72, %68
ret void
}