#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*/ buildpath(int, int, int, int);
int /*<<< orphan*/ displaymaze();
int /*<<< orphan*/ gb_init_rand(int);
int gb_unif_rand(int);
int /*<<< orphan*/ generatemaze(int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
scalar_t__ solvemaze(int, int, int, int);
void lee(int seed) {
  int xd, yd, xa, ya;
  gb_init_rand(seed);
  xd = gb_unif_rand(20);
  yd = gb_unif_rand(40);
  while ((xa = gb_unif_rand(20)) == xd)
    ;
  while ((ya = gb_unif_rand(40)) == yd)
    ;
  generatemaze(seed);
  displaymaze();
  if (solvemaze(xd, yd, xa, ya) == 0)
    printf("No way to go from %d, %d to %d,%d\n", xd, yd, xa, ya);
  else {
    buildpath(xd, yd, xa, ya);
    displaymaze();
  }
}


x86 assembly (clang, -O0):
<lee>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <gb_init_rand@plt>
mov    $0x14,%edi
call   1030 <gb_unif_rand@plt>
mov    %eax,-0x8(%rbp)
mov    $0x28,%edi
call   1030 <gb_unif_rand@plt>
mov    %eax,-0xc(%rbp)
mov    $0x14,%edi
call   1030 <gb_unif_rand@plt>
mov    %eax,-0x10(%rbp)
cmp    -0x8(%rbp),%eax
jne    11b8 <lee+0x48>
jmp    119d <lee+0x2d>
jmp    11bd <lee+0x4d>
mov    $0x28,%edi
call   1030 <gb_unif_rand@plt>
mov    %eax,-0x14(%rbp)
cmp    -0xc(%rbp),%eax
jne    11d8 <lee+0x68>
jmp    11bd <lee+0x4d>
mov    -0x4(%rbp),%edi
call   1070 <generatemaze@plt>
mov    $0x0,%al
call   1060 <displaymaze@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1080 <solvemaze@plt>
cmp    $0x0,%rax
jne    1220 <lee+0xb0>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xdea(%rip),%rdi
call   1050 <printf@plt>
jmp    1238 <lee+0xc8>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <buildpath@plt>
mov    $0x0,%al
call   1060 <displaymaze@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lee>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r15d
call   1090 <gb_init_rand@plt>
mov    $0x14,%edi
call   1030 <gb_unif_rand@plt>
mov    %eax,%r14d
mov    $0x28,%edi
call   1030 <gb_unif_rand@plt>
mov    %eax,%r12d
nopw   0x0(%rax,%rax,1)
mov    $0x14,%edi
call   1030 <gb_unif_rand@plt>
cmp    %r14d,%eax
je     11a0 <lee+0x30>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x28,%edi
call   1030 <gb_unif_rand@plt>
cmp    %r12d,%eax
je     11c0 <lee+0x50>
mov    %eax,%ebp
mov    %r15d,%edi
call   1070 <generatemaze@plt>
xor    %eax,%eax
call   1060 <displaymaze@plt>
mov    %r14d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1080 <solvemaze@plt>
test   %rax,%rax
je     1212 <lee+0xa2>
mov    %r14d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1040 <buildpath@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <displaymaze@plt>
lea    0xde7(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"No way to go from %d, %d to %d,%d\0A\00"
define void @lee(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @gb_init_rand(i32 %7)
%9 = call i32 @gb_unif_rand(i32 20)
store i32 %9, i32* %3
%10 = call i32 @gb_unif_rand(i32 40)
store i32 %10, i32* %4
br label %11
11: ; preds = %15, %1
%12 = call i32 @gb_unif_rand(i32 20)
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11
br label %11
16: ; preds = %11
br label %17
17: ; preds = %21, %16
%18 = call i32 @gb_unif_rand(i32 40)
store i32 %18, i32* %6
%19 = load i32, i32* %4
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
br label %17
22: ; preds = %17
%23 = load i32, i32* %2
%24 = call i32 @generatemaze(i32 %23)
%25 = call i32 (...) @displaymaze()
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = load i32, i32* %6
%30 = call i64 @solvemaze(i32 %26, i32 %27, i32 %28, i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %22
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %34, i32 %35, i32 %36)
br label %45
38: ; preds = %22
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = call i32 @buildpath(i32 %39, i32 %40, i32 %41, i32 %42)
%44 = call i32 (...) @displaymaze()
br label %45
45: ; preds = %38, %32
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"No way to go from %d, %d to %d,%d\0A\00"
define void @lee(i32 %0) {
%2 = tail call i32 @gb_init_rand(i32 %0)
%3 = tail call i32 @gb_unif_rand(i32 20)
%4 = tail call i32 @gb_unif_rand(i32 40)
br label %5
5: ; preds = %5, %1
%6 = tail call i32 @gb_unif_rand(i32 20)
%7 = icmp eq i32 %6, %3
br i1 %7, label %5, label %8
8: ; preds = %5, %8
%9 = tail call i32 @gb_unif_rand(i32 40)
%10 = icmp eq i32 %9, %4
br i1 %10, label %8, label %11
11: ; preds = %8
%12 = tail call i32 @generatemaze(i32 %0)
%13 = tail call i32 (...) @displaymaze()
%14 = tail call i64 @solvemaze(i32 %3, i32 %4, i32 %6, i32 %9)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %6, i32 %9)
br label %21
18: ; preds = %11
%19 = tail call i32 @buildpath(i32 %3, i32 %4, i32 %6, i32 %9)
%20 = tail call i32 (...) @displaymaze()
br label %21
21: ; preds = %18, %16
ret void
}