#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 */
struct maze {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ maze_build_one_cell_wall(struct maze *, int, int, int, int,
                                            int, int, int, int);
int /*<<< orphan*/ maze_cell_exists(struct maze *, int, int);
scalar_t__ maze_cells_connected(struct maze *, int, int, int, int);
int maze_wall_in(struct maze *mp, int row, int col) {
  if (!maze_cell_exists(mp, row, col))
    return 0;
  if (maze_cells_connected(mp, row, col, row - 1, col))
    maze_build_one_cell_wall(mp, row - 1, col, row, col, row, col, row, col);
  if (maze_cells_connected(mp, row, col, row + 1, col))
    maze_build_one_cell_wall(mp, row + 1, col, row, col, row, col, row, col);
  if (maze_cells_connected(mp, row, col, row, col - 1))
    maze_build_one_cell_wall(mp, row, col - 1, row, col, row, col, row, col);
  if (maze_cells_connected(mp, row, col, row, col + 1))
    maze_build_one_cell_wall(mp, row, col + 1, row, col, row, col, row, col);
  return 1;
}


x86 assembly (clang, -O0):
<maze_wall_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <maze_cell_exists@plt>
cmp    $0x0,%eax
jne    1166 <maze_wall_in+0x36>
movl   $0x0,-0x4(%rbp)
jmp    12cf <maze_wall_in+0x19f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%r8d
call   1050 <maze_cells_connected@plt>
cmp    $0x0,%rax
je     11be <maze_wall_in+0x8e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    -0x14(%rbp),%r10d
mov    -0x18(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <maze_build_one_cell_wall@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%r8d
call   1050 <maze_cells_connected@plt>
cmp    $0x0,%rax
je     1216 <maze_wall_in+0xe6>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    -0x14(%rbp),%r10d
mov    -0x18(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <maze_build_one_cell_wall@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
sub    $0x1,%r8d
call   1050 <maze_cells_connected@plt>
cmp    $0x0,%rax
je     126f <maze_wall_in+0x13f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    -0x14(%rbp),%r10d
mov    -0x18(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <maze_build_one_cell_wall@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
add    $0x1,%r8d
call   1050 <maze_cells_connected@plt>
cmp    $0x0,%rax
je     12c8 <maze_wall_in+0x198>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    -0x14(%rbp),%r10d
mov    -0x18(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <maze_build_one_cell_wall@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maze_wall_in>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
call   1040 <maze_cell_exists@plt>
test   %eax,%eax
je     1245 <maze_wall_in+0x115>
lea    -0x1(%rbx),%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
call   1050 <maze_cells_connected@plt>
test   %rax,%rax
je     1189 <maze_wall_in+0x59>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %ebx,%r9d
push   %r14
push   %rbx
push   %r14
call   1030 <maze_build_one_cell_wall@plt>
add    $0x20,%rsp
lea    0x1(%rbx),%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
call   1050 <maze_cells_connected@plt>
test   %rax,%rax
je     11c5 <maze_wall_in+0x95>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %ebx,%r9d
push   %r14
push   %rbx
push   %r14
call   1030 <maze_build_one_cell_wall@plt>
add    $0x20,%rsp
lea    -0x1(%r14),%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
call   1050 <maze_cells_connected@plt>
test   %rax,%rax
je     1201 <maze_wall_in+0xd1>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %ebx,%r9d
push   %r14
push   %rbx
push   %r14
call   1030 <maze_build_one_cell_wall@plt>
add    $0x20,%rsp
lea    0x1(%r14),%ebp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
call   1050 <maze_cells_connected@plt>
mov    $0x1,%r12d
test   %rax,%rax
je     1248 <maze_wall_in+0x118>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %ebx,%r9d
push   %r14
push   %rbx
push   %r14
call   1030 <maze_build_one_cell_wall@plt>
add    $0x20,%rsp
jmp    1248 <maze_wall_in+0x118>
xor    %r12d,%r12d
mov    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.maze = type { i32 }
define i32 @maze_wall_in(%struct.maze* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.maze*
%6 = alloca i32
%7 = alloca i32
store %struct.maze* %0, %struct.maze** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load %struct.maze*, %struct.maze** %5
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i32 @maze_cell_exists(%struct.maze* %8, i32 %9, i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %3
store i32 0, i32* %4
br label %99
14: ; preds = %3
%15 = load %struct.maze*, %struct.maze** %5
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = sub nsw i32 %18, 1
%20 = load i32, i32* %7
%21 = call i64 @maze_cells_connected(%struct.maze* %15, i32 %16, i32 %17, i32 %19, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %35
23: ; preds = %14
%24 = load %struct.maze*, %struct.maze** %5
%25 = load i32, i32* %6
%26 = sub nsw i32 %25, 1
%27 = load i32, i32* %7
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = call i32 @maze_build_one_cell_wall(%struct.maze* %24, i32 %26, i32 %27, i32 %28, i32 %29, i32 %30, i32 %31, i32 %32, i32 %33)
br label %35
35: ; preds = %23, %14
%36 = load %struct.maze*, %struct.maze** %5
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
%41 = load i32, i32* %7
%42 = call i64 @maze_cells_connected(%struct.maze* %36, i32 %37, i32 %38, i32 %40, i32 %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %56
44: ; preds = %35
%45 = load %struct.maze*, %struct.maze** %5
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
%48 = load i32, i32* %7
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = load i32, i32* %6
%52 = load i32, i32* %7
%53 = load i32, i32* %6
%54 = load i32, i32* %7
%55 = call i32 @maze_build_one_cell_wall(%struct.maze* %45, i32 %47, i32 %48, i32 %49, i32 %50, i32 %51, i32 %52, i32 %53, i32 %54)
br label %56
56: ; preds = %44, %35
%57 = load %struct.maze*, %struct.maze** %5
%58 = load i32, i32* %6
%59 = load i32, i32* %7
%60 = load i32, i32* %6
%61 = load i32, i32* %7
%62 = sub nsw i32 %61, 1
%63 = call i64 @maze_cells_connected(%struct.maze* %57, i32 %58, i32 %59, i32 %60, i32 %62)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %77
65: ; preds = %56
%66 = load %struct.maze*, %struct.maze** %5
%67 = load i32, i32* %6
%68 = load i32, i32* %7
%69 = sub nsw i32 %68, 1
%70 = load i32, i32* %6
%71 = load i32, i32* %7
%72 = load i32, i32* %6
%73 = load i32, i32* %7
%74 = load i32, i32* %6
%75 = load i32, i32* %7
%76 = call i32 @maze_build_one_cell_wall(%struct.maze* %66, i32 %67, i32 %69, i32 %70, i32 %71, i32 %72, i32 %73, i32 %74, i32 %75)
br label %77
77: ; preds = %65, %56
%78 = load %struct.maze*, %struct.maze** %5
%79 = load i32, i32* %6
%80 = load i32, i32* %7
%81 = load i32, i32* %6
%82 = load i32, i32* %7
%83 = add nsw i32 %82, 1
%84 = call i64 @maze_cells_connected(%struct.maze* %78, i32 %79, i32 %80, i32 %81, i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %98
86: ; preds = %77
%87 = load %struct.maze*, %struct.maze** %5
%88 = load i32, i32* %6
%89 = load i32, i32* %7
%90 = add nsw i32 %89, 1
%91 = load i32, i32* %6
%92 = load i32, i32* %7
%93 = load i32, i32* %6
%94 = load i32, i32* %7
%95 = load i32, i32* %6
%96 = load i32, i32* %7
%97 = call i32 @maze_build_one_cell_wall(%struct.maze* %87, i32 %88, i32 %90, i32 %91, i32 %92, i32 %93, i32 %94, i32 %95, i32 %96)
br label %98
98: ; preds = %86, %77
store i32 1, i32* %4
br label %99
99: ; preds = %98, %13
%100 = load i32, i32* %4
ret i32 %100
}

LLVM IR (-O2):
%struct.maze = type { i32 }
define i32 @maze_wall_in(%struct.maze* %0, i32 %1, i32 %2) {
%4 = tail call i32 @maze_cell_exists(%struct.maze* %0, i32 %1, i32 %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %30, label %6
6: ; preds = %3
%7 = add nsw i32 %1, -1
%8 = tail call i64 @maze_cells_connected(%struct.maze* %0, i32 %1, i32 %2, i32 %7, i32 %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @maze_build_one_cell_wall(%struct.maze* %0, i32 %7, i32 %2, i32 %1, i32 %2, i32 %1, i32 %2, i32 %1, i32 %2)
br label %12
12: ; preds = %10, %6
%13 = add nsw i32 %1, 1
%14 = tail call i64 @maze_cells_connected(%struct.maze* %0, i32 %1, i32 %2, i32 %13, i32 %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = tail call i32 @maze_build_one_cell_wall(%struct.maze* %0, i32 %13, i32 %2, i32 %1, i32 %2, i32 %1, i32 %2, i32 %1, i32 %2)
br label %18
18: ; preds = %16, %12
%19 = add nsw i32 %2, -1
%20 = tail call i64 @maze_cells_connected(%struct.maze* %0, i32 %1, i32 %2, i32 %1, i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = tail call i32 @maze_build_one_cell_wall(%struct.maze* %0, i32 %1, i32 %19, i32 %1, i32 %2, i32 %1, i32 %2, i32 %1, i32 %2)
br label %24
24: ; preds = %22, %18
%25 = add nsw i32 %2, 1
%26 = tail call i64 @maze_cells_connected(%struct.maze* %0, i32 %1, i32 %2, i32 %1, i32 %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = tail call i32 @maze_build_one_cell_wall(%struct.maze* %0, i32 %1, i32 %25, i32 %1, i32 %2, i32 %1, i32 %2, i32 %1, i32 %2)
br label %30
30: ; preds = %24, %28, %3
%31 = phi i32 [ 0, %3 ], [ 1, %28 ], [ 1, %24 ]
ret i32 %31
}