#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*/ removeBottomWall(int **, int, int);
int /*<<< orphan*/ removeLeftWall(int **, int, int);
int /*<<< orphan*/ removeRightWall(int **, int, int);
int /*<<< orphan*/ removeTopWall(int **, int, int);
int /*<<< orphan*/ shuffle(int *, int);
scalar_t__ squareVisited(int **, int, int);
void removeWalls(int (*maze)[13], int (*visited)[13 / 2], int startRow,
                 int startCol) {
  visited[startRow][startCol] = 1;
  int i;
  int order[4] = {0, 1, 2, 3};
  for (i = 0; i < 6; i++)
    shuffle(order, 4);
  for (i = 0; i < 4; i++) {
    if (order[i] == 0) {
      if (startRow > 0 &&
          (squareVisited(visited, startRow - 1, startCol) == 0)) {
        removeTopWall(maze, startRow, startCol);
        removeWalls(maze, visited, startRow - 1, startCol);
      }
    }
    if (order[i] == 1) {
      if ((startRow < (13 / 2) - 1) &&
          (squareVisited(visited, startRow + 1, startCol) == 0)) {
        removeBottomWall(maze, startRow, startCol);
        removeWalls(maze, visited, startRow + 1, startCol);
      }
    }
    if (order[i] == 2) {
      if ((startCol > 0) &&
          (squareVisited(visited, startRow, startCol - 1) == 0)) {
        removeLeftWall(maze, startRow, startCol);
        removeWalls(maze, visited, startRow, startCol - 1);
      }
    }
    if (order[i] == 3) {
      if ((startCol < (13 / 2) - 1) &&
          (squareVisited(visited, startRow, startCol + 1) == 0)) {
        removeRightWall(maze, startRow, startCol);
        removeWalls(maze, visited, startRow, startCol + 1);
      }
    }
  }
}


x86 assembly (clang, -O0):
<removeWalls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0xe59(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe56(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jge    11e3 <removeWalls+0x73>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1030 <shuffle@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bd <removeWalls+0x4d>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1383 <removeWalls+0x213>
movslq -0x1c(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
jne    1253 <removeWalls+0xe3>
cmpl   $0x0,-0x14(%rbp)
jle    124e <removeWalls+0xde>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x18(%rbp),%edx
call   1060 <squareVisited@plt>
cmp    $0x0,%rax
jne    124e <removeWalls+0xde>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1090 <removeTopWall@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1080 <removeWalls@plt>
jmp    1253 <removeWalls+0xe3>
movslq -0x1c(%rbp),%rax
cmpl   $0x1,-0x30(%rbp,%rax,4)
jne    12b2 <removeWalls+0x142>
cmpl   $0x5,-0x14(%rbp)
jge    12ad <removeWalls+0x13d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
call   1060 <squareVisited@plt>
cmp    $0x0,%rax
jne    12ad <removeWalls+0x13d>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <removeBottomWall@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1080 <removeWalls@plt>
jmp    12b2 <removeWalls+0x142>
movslq -0x1c(%rbp),%rax
cmpl   $0x2,-0x30(%rbp,%rax,4)
jne    1311 <removeWalls+0x1a1>
cmpl   $0x0,-0x18(%rbp)
jle    130c <removeWalls+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
call   1060 <squareVisited@plt>
cmp    $0x0,%rax
jne    130c <removeWalls+0x19c>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1070 <removeLeftWall@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
call   1080 <removeWalls@plt>
jmp    1311 <removeWalls+0x1a1>
movslq -0x1c(%rbp),%rax
cmpl   $0x3,-0x30(%rbp,%rax,4)
jne    1370 <removeWalls+0x200>
cmpl   $0x5,-0x18(%rbp)
jge    136b <removeWalls+0x1fb>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
call   1060 <squareVisited@plt>
cmp    $0x0,%rax
jne    136b <removeWalls+0x1fb>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <removeRightWall@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
call   1080 <removeWalls@plt>
jmp    1370 <removeWalls+0x200>
jmp    1375 <removeWalls+0x205>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ea <removeWalls+0x7a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeWalls>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
movslq %edx,%r13
movslq %ecx,%r12
lea    0x0(%r13,%r13,2),%rax
lea    (%rsi,%rax,8),%rax
movl   $0x1,(%rax,%r12,4)
movaps 0xe5a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <shuffle@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <shuffle@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <shuffle@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <shuffle@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <shuffle@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <shuffle@plt>
lea    -0x1(%r13),%eax
mov    %eax,0xc(%rsp)
add    $0x1,%r13d
mov    %r13,0x20(%rsp)
lea    -0x1(%r12),%eax
mov    %eax,0x8(%rsp)
add    $0x1,%r12d
mov    %r12,%r13
xor    %r12d,%r12d
jmp    123e <removeWalls+0xce>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    $0x4,%r12
je     134c <removeWalls+0x1dc>
test   %ebp,%ebp
jle    1280 <removeWalls+0x110>
cmpl   $0x0,0x10(%rsp,%r12,4)
jne    1280 <removeWalls+0x110>
mov    %r14,%rdi
mov    0xc(%rsp),%esi
mov    %ebx,%edx
call   1060 <squareVisited@plt>
test   %rax,%rax
jne    1280 <removeWalls+0x110>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1090 <removeTopWall@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    0xc(%rsp),%edx
mov    %ebx,%ecx
call   1080 <removeWalls@plt>
nopw   0x0(%rax,%rax,1)
cmp    $0x4,%ebp
jg     12c0 <removeWalls+0x150>
cmpl   $0x1,0x10(%rsp,%r12,4)
jne    12c0 <removeWalls+0x150>
mov    %r14,%rdi
mov    0x20(%rsp),%rsi
mov    %ebx,%edx
call   1060 <squareVisited@plt>
test   %rax,%rax
jne    12c0 <removeWalls+0x150>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1050 <removeBottomWall@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    0x20(%rsp),%rdx
mov    %ebx,%ecx
call   1080 <removeWalls@plt>
nop
test   %ebx,%ebx
jle    1300 <removeWalls+0x190>
cmpl   $0x2,0x10(%rsp,%r12,4)
jne    1300 <removeWalls+0x190>
mov    %r14,%rdi
mov    %ebp,%esi
mov    0x8(%rsp),%edx
call   1060 <squareVisited@plt>
test   %rax,%rax
jne    1300 <removeWalls+0x190>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1070 <removeLeftWall@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    0x8(%rsp),%ecx
call   1080 <removeWalls@plt>
nopl   0x0(%rax)
cmp    $0x4,%ebx
jg     1230 <removeWalls+0xc0>
cmpl   $0x3,0x10(%rsp,%r12,4)
jne    1230 <removeWalls+0xc0>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
call   1060 <squareVisited@plt>
test   %rax,%rax
jne    1230 <removeWalls+0xc0>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <removeRightWall@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r13d,%ecx
call   1080 <removeWalls@plt>
jmp    1230 <removeWalls+0xc0>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.removeWalls.order = [4 x i32] [i32 0, i32 1, i32 2, i32 3]
define void @removeWalls([13 x i32]* %0, [6 x i32]* %1, i32 %2, i32 %3) {
%5 = alloca [13 x i32]*
%6 = alloca [6 x i32]*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [4 x i32]
store [13 x i32]* %0, [13 x i32]** %5
store [6 x i32]* %1, [6 x i32]** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load [6 x i32]*, [6 x i32]** %6
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %11, i64 %13
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %14, i64 0, i64 %16
store i32 1, i32* %17
%18 = bitcast [4 x i32]* %10 to i8*
store i32 0, i32* %9
br label %19
19: ; preds = %25, %4
%20 = load i32, i32* %9
%21 = icmp slt i32 %20, 6
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%24 = call i32 @shuffle(i32* %23, i32 4)
br label %25
25: ; preds = %22
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %19
28: ; preds = %19
store i32 0, i32* %9
br label %29
29: ; preds = %149, %28
%30 = load i32, i32* %9
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %152
32: ; preds = %29
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %61
38: ; preds = %32
%39 = load i32, i32* %7
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %60
41: ; preds = %38
%42 = load [6 x i32]*, [6 x i32]** %6
%43 = bitcast [6 x i32]* %42 to i32**
%44 = load i32, i32* %7
%45 = sub nsw i32 %44, 1
%46 = load i32, i32* %8
%47 = call i64 @squareVisited(i32** %43, i32 %45, i32 %46)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %60
49: ; preds = %41
%50 = load [13 x i32]*, [13 x i32]** %5
%51 = bitcast [13 x i32]* %50 to i32**
%52 = load i32, i32* %7
%53 = load i32, i32* %8
%54 = call i32 @removeTopWall(i32** %51, i32 %52, i32 %53)
%55 = load [13 x i32]*, [13 x i32]** %5
%56 = load [6 x i32]*, [6 x i32]** %6
%57 = load i32, i32* %7
%58 = sub nsw i32 %57, 1
%59 = load i32, i32* %8
br label %60
60: ; preds = %49, %41, %38
br label %61
61: ; preds = %60, %32
%62 = load i32, i32* %9
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = icmp eq i32 %65, 1
br i1 %66, label %67, label %90
67: ; preds = %61
%68 = load i32, i32* %7
%69 = icmp slt i32 %68, 5
br i1 %69, label %70, label %89
70: ; preds = %67
%71 = load [6 x i32]*, [6 x i32]** %6
%72 = bitcast [6 x i32]* %71 to i32**
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
%75 = load i32, i32* %8
%76 = call i64 @squareVisited(i32** %72, i32 %74, i32 %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %89
78: ; preds = %70
%79 = load [13 x i32]*, [13 x i32]** %5
%80 = bitcast [13 x i32]* %79 to i32**
%81 = load i32, i32* %7
%82 = load i32, i32* %8
%83 = call i32 @removeBottomWall(i32** %80, i32 %81, i32 %82)
%84 = load [13 x i32]*, [13 x i32]** %5
%85 = load [6 x i32]*, [6 x i32]** %6
%86 = load i32, i32* %7
%87 = add nsw i32 %86, 1
%88 = load i32, i32* %8
br label %89
89: ; preds = %78, %70, %67
br label %90
90: ; preds = %89, %61
%91 = load i32, i32* %9
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 %92
%94 = load i32, i32* %93
%95 = icmp eq i32 %94, 2
br i1 %95, label %96, label %119
96: ; preds = %90
%97 = load i32, i32* %8
%98 = icmp sgt i32 %97, 0
br i1 %98, label %99, label %118
99: ; preds = %96
%100 = load [6 x i32]*, [6 x i32]** %6
%101 = bitcast [6 x i32]* %100 to i32**
%102 = load i32, i32* %7
%103 = load i32, i32* %8
%104 = sub nsw i32 %103, 1
%105 = call i64 @squareVisited(i32** %101, i32 %102, i32 %104)
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %118
107: ; preds = %99
%108 = load [13 x i32]*, [13 x i32]** %5
%109 = bitcast [13 x i32]* %108 to i32**
%110 = load i32, i32* %7
%111 = load i32, i32* %8
%112 = call i32 @removeLeftWall(i32** %109, i32 %110, i32 %111)
%113 = load [13 x i32]*, [13 x i32]** %5
%114 = load [6 x i32]*, [6 x i32]** %6
%115 = load i32, i32* %7
%116 = load i32, i32* %8
%117 = sub nsw i32 %116, 1
br label %118
118: ; preds = %107, %99, %96
br label %119
119: ; preds = %118, %90
%120 = load i32, i32* %9
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 %121
%123 = load i32, i32* %122
%124 = icmp eq i32 %123, 3
br i1 %124, label %125, label %148
125: ; preds = %119
%126 = load i32, i32* %8
%127 = icmp slt i32 %126, 5
br i1 %127, label %128, label %147
128: ; preds = %125
%129 = load [6 x i32]*, [6 x i32]** %6
%130 = bitcast [6 x i32]* %129 to i32**
%131 = load i32, i32* %7
%132 = load i32, i32* %8
%133 = add nsw i32 %132, 1
%134 = call i64 @squareVisited(i32** %130, i32 %131, i32 %133)
%135 = icmp eq i64 %134, 0
br i1 %135, label %136, label %147
136: ; preds = %128
%137 = load [13 x i32]*, [13 x i32]** %5
%138 = bitcast [13 x i32]* %137 to i32**
%139 = load i32, i32* %7
%140 = load i32, i32* %8
%141 = call i32 @removeRightWall(i32** %138, i32 %139, i32 %140)
%142 = load [13 x i32]*, [13 x i32]** %5
%143 = load [6 x i32]*, [6 x i32]** %6
%144 = load i32, i32* %7
%145 = load i32, i32* %8
%146 = add nsw i32 %145, 1
br label %147
147: ; preds = %136, %128, %125
br label %148
148: ; preds = %147, %119
br label %149
149: ; preds = %148
%150 = load i32, i32* %9
%151 = add nsw i32 %150, 1
store i32 %151, i32* %9
br label %29
152: ; preds = %29
ret void
}

LLVM IR (-O2):
@__const.removeWalls.order = [4 x i32] [i32 0, i32 1, i32 2, i32 3]
define void @removeWalls([13 x i32]* %0, [6 x i32]* %1, i32 %2, i32 %3) {
%5 = alloca [4 x i32]
%6 = sext i32 %2 to i64
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 %6, i64 %7
store i32 1, i32* %8
%9 = bitcast [4 x i32]* %5 to i8*
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%11 = call i32 @shuffle(i32* %10, i32 4)
%12 = call i32 @shuffle(i32* %10, i32 4)
%13 = call i32 @shuffle(i32* %10, i32 4)
%14 = call i32 @shuffle(i32* %10, i32 4)
%15 = call i32 @shuffle(i32* %10, i32 4)
%16 = call i32 @shuffle(i32* %10, i32 4)
%17 = icmp sgt i32 %2, 0
%18 = bitcast [6 x i32]* %1 to i32**
%19 = add nsw i32 %2, -1
%20 = bitcast [13 x i32]* %0 to i32**
%21 = icmp slt i32 %2, 5
%22 = add nsw i32 %2, 1
%23 = icmp sgt i32 %3, 0
%24 = add nsw i32 %3, -1
%25 = icmp slt i32 %3, 5
%26 = add nsw i32 %3, 1
br label %27
27: ; preds = %4, %65
%28 = phi i64 [ 0, %4 ], [ %66, %65 ]
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 0
%32 = and i1 %17, %31
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = call i64 @squareVisited(i32** %18, i32 %19, i32 %3)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @removeTopWall(i32** %20, i32 %2, i32 %3)
br label %38
38: ; preds = %33, %36, %27
%39 = load i32, i32* %29
%40 = icmp eq i32 %39, 1
%41 = and i1 %21, %40
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = call i64 @squareVisited(i32** %18, i32 %22, i32 %3)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 @removeBottomWall(i32** %20, i32 %2, i32 %3)
br label %47
47: ; preds = %42, %45, %38
%48 = load i32, i32* %29
%49 = icmp eq i32 %48, 2
%50 = and i1 %23, %49
br i1 %50, label %51, label %56
51: ; preds = %47
%52 = call i64 @squareVisited(i32** %18, i32 %2, i32 %24)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 @removeLeftWall(i32** %20, i32 %2, i32 %3)
br label %56
56: ; preds = %51, %54, %47
%57 = load i32, i32* %29
%58 = icmp eq i32 %57, 3
%59 = and i1 %25, %58
br i1 %59, label %60, label %65
60: ; preds = %56
%61 = call i64 @squareVisited(i32** %18, i32 %2, i32 %26)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 @removeRightWall(i32** %20, i32 %2, i32 %3)
br label %65
65: ; preds = %56, %63, %60
%66 = add nuw nsw i64 %28, 1
%67 = icmp eq i64 %66, 4
br i1 %67, label %68, label %27
68: ; preds = %65
ret void
}