#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*/ break_down_wall(int **, int **, int, int);
int /*<<< orphan*/ break_left_wall(int **, int **, int, int);
int /*<<< orphan*/ break_right_wall(int **, int **, int, int);
int /*<<< orphan*/ break_up_wall(int **, int **, int, int);
scalar_t__ is_down_breakable(int **, int, int);
scalar_t__ is_left_breakable(int **, int, int);
scalar_t__ is_right_breakable(int **, int, int);
scalar_t__ is_up_breakable(int **, int, int);
int maze_not_complete(int **);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
void assemble_maze(int maze[25][25], int v_walls[25][25 - 1],
                   int h_walls[25 - 1][25]) {
  int num1, num2, num3, check;
  srand((time(0)));
  check = maze_not_complete(maze);
  while (check == 1) {
    num1 = rand() % 25;
    num2 = rand() % 25;
    num3 = rand() % 4 + 1;
    if (num3 == 1) {
      if (is_left_breakable(maze, num1, num2)) {
        break_left_wall(maze, v_walls, num1, num2);
      }
    }
    if (num3 == 2) {
      if (is_right_breakable(maze, num1, num2)) {
        break_right_wall(maze, v_walls, num1, num2);
      }
    }
    if (num3 == 3) {
      if (is_up_breakable(maze, num1, num2)) {
        break_up_wall(maze, h_walls, num1, num2);
      }
    }
    if (num3 == 4) {
      if (is_down_breakable(maze, num1, num2)) {
        break_down_wall(maze, h_walls, num1, num2);
      }
    }
    check = maze_not_complete(maze);
  }
}


x86 assembly (clang, -O0):
<assemble_maze>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0x8(%rbp),%rdi
call   10a0 <maze_not_complete@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
jne    132e <assemble_maze+0x16e>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x19,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x19,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    126c <assemble_maze+0xac>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10c0 <is_left_breakable@plt>
cmp    $0x0,%rax
je     1267 <assemble_maze+0xa7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1060 <break_left_wall@plt>
jmp    126c <assemble_maze+0xac>
cmpl   $0x2,-0x24(%rbp)
jne    12a7 <assemble_maze+0xe7>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1080 <is_right_breakable@plt>
cmp    $0x0,%rax
je     12a2 <assemble_maze+0xe2>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   10b0 <break_right_wall@plt>
jmp    12a7 <assemble_maze+0xe7>
cmpl   $0x3,-0x24(%rbp)
jne    12e2 <assemble_maze+0x122>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   10e0 <is_up_breakable@plt>
cmp    $0x0,%rax
je     12dd <assemble_maze+0x11d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1070 <break_up_wall@plt>
jmp    12e2 <assemble_maze+0x122>
cmpl   $0x4,-0x24(%rbp)
jne    131d <assemble_maze+0x15d>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1050 <is_down_breakable@plt>
cmp    $0x0,%rax
je     1318 <assemble_maze+0x158>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1090 <break_down_wall@plt>
jmp    131d <assemble_maze+0x15d>
mov    -0x8(%rbp),%rdi
call   10a0 <maze_not_complete@plt>
mov    %eax,-0x28(%rbp)
jmp    11ee <assemble_maze+0x2e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assemble_maze>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
mov    %rsi,%r15
mov    %rdi,%r12
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    %r12,%rdi
call   10a0 <maze_not_complete@plt>
cmp    $0x1,%eax
jne    133c <assemble_maze+0x17c>
lea    0xe05(%rip),%r14
jmp    1211 <assemble_maze+0x51>
nopl   (%rax)
mov    %r12,%rdi
call   10a0 <maze_not_complete@plt>
cmp    $0x1,%eax
jne    133c <assemble_maze+0x17c>
xor    %eax,%eax
call   10d0 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10d0 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10d0 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
cmp    $0x3,%eax
ja     1200 <assemble_maze+0x40>
movslq %ebp,%r13
imul   $0x51eb851f,%r13,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%r13d
movslq %ebx,%rbx
imul   $0x51eb851f,%rbx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%ebx
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
call   10c0 <is_left_breakable@plt>
test   %rax,%rax
je     1200 <assemble_maze+0x40>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
call   1060 <break_left_wall@plt>
jmp    1200 <assemble_maze+0x40>
nop
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
call   1080 <is_right_breakable@plt>
test   %rax,%rax
je     1200 <assemble_maze+0x40>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
call   10b0 <break_right_wall@plt>
jmp    1200 <assemble_maze+0x40>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
call   10e0 <is_up_breakable@plt>
test   %rax,%rax
je     1200 <assemble_maze+0x40>
mov    %r12,%rdi
mov    (%rsp),%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
call   1070 <break_up_wall@plt>
jmp    1200 <assemble_maze+0x40>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
call   1050 <is_down_breakable@plt>
test   %rax,%rax
je     1200 <assemble_maze+0x40>
mov    %r12,%rdi
mov    (%rsp),%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
call   1090 <break_down_wall@plt>
jmp    1200 <assemble_maze+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @assemble_maze([25 x i32]* %0, [24 x i32]* %1, [25 x i32]* %2) {
%4 = alloca [25 x i32]*
%5 = alloca [24 x i32]*
%6 = alloca [25 x i32]*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store [25 x i32]* %0, [25 x i32]** %4
store [24 x i32]* %1, [24 x i32]** %5
store [25 x i32]* %2, [25 x i32]** %6
%11 = call i32 @time(i32 0)
%12 = call i32 @srand(i32 %11)
%13 = load [25 x i32]*, [25 x i32]** %4
%14 = bitcast [25 x i32]* %13 to i32**
%15 = call i32 @maze_not_complete(i32** %14)
store i32 %15, i32* %10
br label %16
16: ; preds = %102, %3
%17 = load i32, i32* %10
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %106
19: ; preds = %16
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 25
store i32 %21, i32* %7
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 25
store i32 %23, i32* %8
%24 = call i32 (...) @rand()
%25 = srem i32 %24, 4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
%27 = load i32, i32* %9
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %45
29: ; preds = %19
%30 = load [25 x i32]*, [25 x i32]** %4
%31 = bitcast [25 x i32]* %30 to i32**
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = call i64 @is_left_breakable(i32** %31, i32 %32, i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %44
36: ; preds = %29
%37 = load [25 x i32]*, [25 x i32]** %4
%38 = bitcast [25 x i32]* %37 to i32**
%39 = load [24 x i32]*, [24 x i32]** %5
%40 = bitcast [24 x i32]* %39 to i32**
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = call i32 @break_left_wall(i32** %38, i32** %40, i32 %41, i32 %42)
br label %44
44: ; preds = %36, %29
br label %45
45: ; preds = %44, %19
%46 = load i32, i32* %9
%47 = icmp eq i32 %46, 2
br i1 %47, label %48, label %64
48: ; preds = %45
%49 = load [25 x i32]*, [25 x i32]** %4
%50 = bitcast [25 x i32]* %49 to i32**
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = call i64 @is_right_breakable(i32** %50, i32 %51, i32 %52)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %63
55: ; preds = %48
%56 = load [25 x i32]*, [25 x i32]** %4
%57 = bitcast [25 x i32]* %56 to i32**
%58 = load [24 x i32]*, [24 x i32]** %5
%59 = bitcast [24 x i32]* %58 to i32**
%60 = load i32, i32* %7
%61 = load i32, i32* %8
%62 = call i32 @break_right_wall(i32** %57, i32** %59, i32 %60, i32 %61)
br label %63
63: ; preds = %55, %48
br label %64
64: ; preds = %63, %45
%65 = load i32, i32* %9
%66 = icmp eq i32 %65, 3
br i1 %66, label %67, label %83
67: ; preds = %64
%68 = load [25 x i32]*, [25 x i32]** %4
%69 = bitcast [25 x i32]* %68 to i32**
%70 = load i32, i32* %7
%71 = load i32, i32* %8
%72 = call i64 @is_up_breakable(i32** %69, i32 %70, i32 %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %82
74: ; preds = %67
%75 = load [25 x i32]*, [25 x i32]** %4
%76 = bitcast [25 x i32]* %75 to i32**
%77 = load [25 x i32]*, [25 x i32]** %6
%78 = bitcast [25 x i32]* %77 to i32**
%79 = load i32, i32* %7
%80 = load i32, i32* %8
%81 = call i32 @break_up_wall(i32** %76, i32** %78, i32 %79, i32 %80)
br label %82
82: ; preds = %74, %67
br label %83
83: ; preds = %82, %64
%84 = load i32, i32* %9
%85 = icmp eq i32 %84, 4
br i1 %85, label %86, label %102
86: ; preds = %83
%87 = load [25 x i32]*, [25 x i32]** %4
%88 = bitcast [25 x i32]* %87 to i32**
%89 = load i32, i32* %7
%90 = load i32, i32* %8
%91 = call i64 @is_down_breakable(i32** %88, i32 %89, i32 %90)
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %101
93: ; preds = %86
%94 = load [25 x i32]*, [25 x i32]** %4
%95 = bitcast [25 x i32]* %94 to i32**
%96 = load [25 x i32]*, [25 x i32]** %6
%97 = bitcast [25 x i32]* %96 to i32**
%98 = load i32, i32* %7
%99 = load i32, i32* %8
%100 = call i32 @break_down_wall(i32** %95, i32** %97, i32 %98, i32 %99)
br label %101
101: ; preds = %93, %86
br label %102
102: ; preds = %101, %83
%103 = load [25 x i32]*, [25 x i32]** %4
%104 = bitcast [25 x i32]* %103 to i32**
%105 = call i32 @maze_not_complete(i32** %104)
store i32 %105, i32* %10
br label %16
106: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @assemble_maze([25 x i32]* %0, [24 x i32]* %1, [25 x i32]* %2) {
%4 = tail call i32 @time(i32 0)
%5 = tail call i32 @srand(i32 %4)
%6 = bitcast [25 x i32]* %0 to i32**
%7 = tail call i32 @maze_not_complete(i32** %6)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %42
9: ; preds = %3
%10 = bitcast [25 x i32]* %2 to i32**
%11 = bitcast [24 x i32]* %1 to i32**
br label %12
12: ; preds = %9, %39
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 25
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 25
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 4
switch i32 %18, label %39 [
i32 0, label %19
i32 1, label %24
i32 2, label %29
i32 3, label %34
]
19: ; preds = %12
%20 = tail call i64 @is_left_breakable(i32** %6, i32 %14, i32 %16)
%21 = icmp eq i64 %20, 0
br i1 %21, label %39, label %22
22: ; preds = %19
%23 = tail call i32 @break_left_wall(i32** %6, i32** %11, i32 %14, i32 %16)
br label %39
24: ; preds = %12
%25 = tail call i64 @is_right_breakable(i32** %6, i32 %14, i32 %16)
%26 = icmp eq i64 %25, 0
br i1 %26, label %39, label %27
27: ; preds = %24
%28 = tail call i32 @break_right_wall(i32** %6, i32** %11, i32 %14, i32 %16)
br label %39
29: ; preds = %12
%30 = tail call i64 @is_up_breakable(i32** %6, i32 %14, i32 %16)
%31 = icmp eq i64 %30, 0
br i1 %31, label %39, label %32
32: ; preds = %29
%33 = tail call i32 @break_up_wall(i32** %6, i32** %10, i32 %14, i32 %16)
br label %39
34: ; preds = %12
%35 = tail call i64 @is_down_breakable(i32** %6, i32 %14, i32 %16)
%36 = icmp eq i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = tail call i32 @break_down_wall(i32** %6, i32** %10, i32 %14, i32 %16)
br label %39
39: ; preds = %12, %22, %19, %32, %29, %27, %24, %34, %37
%40 = tail call i32 @maze_not_complete(i32** %6)
%41 = icmp eq i32 %40, 1
br i1 %41, label %12, label %42
42: ; preds = %39, %3
ret void
}