#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*/ clear_flags(char *);
int /*<<< orphan*/ flag_visited_as_disabled(char *);
int /*<<< orphan*/ mark_area_disabled(char *, int, int, char);
int /*<<< orphan*/ printf(char *, int, int, char);
int /*<<< orphan*/ seek_exit(char *, int, int, char, int);
void process_map(char *map, int start_y, int start_x) {
  char player = map[start_y * 80 + start_x];
  {
    if ((3) <= 2)
      printf("Processing map from %d, %d, player %d\n", start_x, start_y,
             player);
  };
  if (start_x > 0)
    if (!seek_exit(map, start_y, start_x - 1, player, (3 << 5))) {
      clear_flags(map);
      mark_area_disabled(map, start_y, start_x - 1, player);
      flag_visited_as_disabled(map);
    } else
      clear_flags(map);
  if (start_x < 80 - 1)
    if (!seek_exit(map, start_y, start_x + 1, player, (2 << 5))) {
      clear_flags(map);
      mark_area_disabled(map, start_y, start_x + 1, player);
      flag_visited_as_disabled(map);
    } else
      clear_flags(map);
  if (start_y > 0)
    if (!seek_exit(map, start_y - 1, start_x, player, (1 << 5))) {
      clear_flags(map);
      mark_area_disabled(map, start_y - 1, start_x, player);
      flag_visited_as_disabled(map);
    } else
      clear_flags(map);
  if (start_y < 22 - 1)
    if (!seek_exit(map, start_y + 1, start_x, player, (0 << 5))) {
      clear_flags(map);
      mark_area_disabled(map, start_y + 1, start_x, player);
      flag_visited_as_disabled(map);
    } else
      clear_flags(map);
}


x86 assembly (clang, -O0):
<process_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x50,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11d0 <process_map+0x90>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
mov    $0x60,%r8d
movsbl -0x11(%rbp),%ecx
call   1030 <seek_exit@plt>
cmp    $0x0,%eax
jne    11c2 <process_map+0x82>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movsbl -0x11(%rbp),%ecx
call   1040 <mark_area_disabled@plt>
mov    -0x8(%rbp),%rdi
call   1050 <flag_visited_as_disabled@plt>
jmp    11cb <process_map+0x8b>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
jmp    11d0 <process_map+0x90>
cmpl   $0x4f,-0x10(%rbp)
jge    123a <process_map+0xfa>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
mov    $0x40,%r8d
movsbl -0x11(%rbp),%ecx
call   1030 <seek_exit@plt>
cmp    $0x0,%eax
jne    122c <process_map+0xec>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
movsbl -0x11(%rbp),%ecx
call   1040 <mark_area_disabled@plt>
mov    -0x8(%rbp),%rdi
call   1050 <flag_visited_as_disabled@plt>
jmp    1235 <process_map+0xf5>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
jmp    123a <process_map+0xfa>
cmpl   $0x0,-0xc(%rbp)
jle    12a4 <process_map+0x164>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    $0x20,%r8d
movsbl -0x11(%rbp),%ecx
call   1030 <seek_exit@plt>
cmp    $0x0,%eax
jne    1296 <process_map+0x156>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
movsbl -0x11(%rbp),%ecx
call   1040 <mark_area_disabled@plt>
mov    -0x8(%rbp),%rdi
call   1050 <flag_visited_as_disabled@plt>
jmp    129f <process_map+0x15f>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
jmp    12a4 <process_map+0x164>
cmpl   $0x15,-0xc(%rbp)
jge    130b <process_map+0x1cb>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
xor    %r8d,%r8d
movsbl -0x11(%rbp),%ecx
call   1030 <seek_exit@plt>
cmp    $0x0,%eax
jne    12fd <process_map+0x1bd>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
movsbl -0x11(%rbp),%ecx
call   1040 <mark_area_disabled@plt>
mov    -0x8(%rbp),%rdi
call   1050 <flag_visited_as_disabled@plt>
jmp    1306 <process_map+0x1c6>
mov    -0x8(%rbp),%rdi
call   1060 <clear_flags@plt>
jmp    130b <process_map+0x1cb>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_map>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbx
lea    (%r15,%r15,4),%eax
shl    $0x4,%eax
add    %edx,%eax
cltq
movsbl (%rdi,%rax,1),%r12d
test   %edx,%edx
jle    11b8 <process_map+0x78>
lea    -0x1(%r14),%r13d
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    $0x60,%r8d
call   1030 <seek_exit@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <clear_flags@plt>
test   %ebp,%ebp
je     1199 <process_map+0x59>
cmp    $0x4e,%r14d
jbe    11b8 <process_map+0x78>
jmp    11e1 <process_map+0xa1>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
call   1040 <mark_area_disabled@plt>
mov    %rbx,%rdi
call   1050 <flag_visited_as_disabled@plt>
cmp    $0x4e,%r14d
ja     11e1 <process_map+0xa1>
lea    0x1(%r14),%r13d
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    $0x40,%r8d
call   1030 <seek_exit@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <clear_flags@plt>
test   %ebp,%ebp
je     1217 <process_map+0xd7>
test   %r15d,%r15d
jle    1256 <process_map+0x116>
lea    -0x1(%r15),%r13d
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
mov    $0x20,%r8d
call   1030 <seek_exit@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <clear_flags@plt>
test   %ebp,%ebp
je     1237 <process_map+0xf7>
cmp    $0x14,%r15d
jbe    1256 <process_map+0x116>
jmp    127c <process_map+0x13c>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
call   1040 <mark_area_disabled@plt>
mov    %rbx,%rdi
call   1050 <flag_visited_as_disabled@plt>
test   %r15d,%r15d
jg     11e6 <process_map+0xa6>
jmp    1256 <process_map+0x116>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
call   1040 <mark_area_disabled@plt>
mov    %rbx,%rdi
call   1050 <flag_visited_as_disabled@plt>
cmp    $0x14,%r15d
ja     127c <process_map+0x13c>
add    $0x1,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
xor    %r8d,%r8d
call   1030 <seek_exit@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <clear_flags@plt>
test   %ebp,%ebp
je     128b <process_map+0x14b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
call   1040 <mark_area_disabled@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <flag_visited_as_disabled@plt>

LLVM IR (-O0):
define void @process_map(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = mul nsw i32 %9, 80
%11 = load i32, i32* %6
%12 = add nsw i32 %10, %11
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %8, i64 %13
%15 = load i8, i8* %14
store i8 %15, i8* %7
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %41
18: ; preds = %3
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = load i8, i8* %7
%24 = call i32 @seek_exit(i8* %19, i32 %20, i32 %22, i8 signext %23, i32 96)
%25 = icmp ne i32 %24, 0
br i1 %25, label %37, label %26
26: ; preds = %18
%27 = load i8*, i8** %4
%28 = call i32 @clear_flags(i8* %27)
%29 = load i8*, i8** %4
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = sub nsw i32 %31, 1
%33 = load i8, i8* %7
%34 = call i32 @mark_area_disabled(i8* %29, i32 %30, i32 %32, i8 signext %33)
%35 = load i8*, i8** %4
%36 = call i32 @flag_visited_as_disabled(i8* %35)
br label %40
37: ; preds = %18
%38 = load i8*, i8** %4
%39 = call i32 @clear_flags(i8* %38)
br label %40
40: ; preds = %37, %26
br label %41
41: ; preds = %40, %3
%42 = load i32, i32* %6
%43 = icmp slt i32 %42, 79
br i1 %43, label %44, label %67
44: ; preds = %41
%45 = load i8*, i8** %4
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
%49 = load i8, i8* %7
%50 = call i32 @seek_exit(i8* %45, i32 %46, i32 %48, i8 signext %49, i32 64)
%51 = icmp ne i32 %50, 0
br i1 %51, label %63, label %52
52: ; preds = %44
%53 = load i8*, i8** %4
%54 = call i32 @clear_flags(i8* %53)
%55 = load i8*, i8** %4
%56 = load i32, i32* %5
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
%59 = load i8, i8* %7
%60 = call i32 @mark_area_disabled(i8* %55, i32 %56, i32 %58, i8 signext %59)
%61 = load i8*, i8** %4
%62 = call i32 @flag_visited_as_disabled(i8* %61)
br label %66
63: ; preds = %44
%64 = load i8*, i8** %4
%65 = call i32 @clear_flags(i8* %64)
br label %66
66: ; preds = %63, %52
br label %67
67: ; preds = %66, %41
%68 = load i32, i32* %5
%69 = icmp sgt i32 %68, 0
br i1 %69, label %70, label %93
70: ; preds = %67
%71 = load i8*, i8** %4
%72 = load i32, i32* %5
%73 = sub nsw i32 %72, 1
%74 = load i32, i32* %6
%75 = load i8, i8* %7
%76 = call i32 @seek_exit(i8* %71, i32 %73, i32 %74, i8 signext %75, i32 32)
%77 = icmp ne i32 %76, 0
br i1 %77, label %89, label %78
78: ; preds = %70
%79 = load i8*, i8** %4
%80 = call i32 @clear_flags(i8* %79)
%81 = load i8*, i8** %4
%82 = load i32, i32* %5
%83 = sub nsw i32 %82, 1
%84 = load i32, i32* %6
%85 = load i8, i8* %7
%86 = call i32 @mark_area_disabled(i8* %81, i32 %83, i32 %84, i8 signext %85)
%87 = load i8*, i8** %4
%88 = call i32 @flag_visited_as_disabled(i8* %87)
br label %92
89: ; preds = %70
%90 = load i8*, i8** %4
%91 = call i32 @clear_flags(i8* %90)
br label %92
92: ; preds = %89, %78
br label %93
93: ; preds = %92, %67
%94 = load i32, i32* %5
%95 = icmp slt i32 %94, 21
br i1 %95, label %96, label %119
96: ; preds = %93
%97 = load i8*, i8** %4
%98 = load i32, i32* %5
%99 = add nsw i32 %98, 1
%100 = load i32, i32* %6
%101 = load i8, i8* %7
%102 = call i32 @seek_exit(i8* %97, i32 %99, i32 %100, i8 signext %101, i32 0)
%103 = icmp ne i32 %102, 0
br i1 %103, label %115, label %104
104: ; preds = %96
%105 = load i8*, i8** %4
%106 = call i32 @clear_flags(i8* %105)
%107 = load i8*, i8** %4
%108 = load i32, i32* %5
%109 = add nsw i32 %108, 1
%110 = load i32, i32* %6
%111 = load i8, i8* %7
%112 = call i32 @mark_area_disabled(i8* %107, i32 %109, i32 %110, i8 signext %111)
%113 = load i8*, i8** %4
%114 = call i32 @flag_visited_as_disabled(i8* %113)
br label %118
115: ; preds = %96
%116 = load i8*, i8** %4
%117 = call i32 @clear_flags(i8* %116)
br label %118
118: ; preds = %115, %104
br label %119
119: ; preds = %118, %93
ret void
}

LLVM IR (-O2):
define void @process_map(i8* %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, 80
%5 = add nsw i32 %4, %2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = add nsw i32 %2, -1
%12 = tail call i32 @seek_exit(i8* %0, i32 %1, i32 %11, i8 signext %8, i32 96)
%13 = icmp eq i32 %12, 0
%14 = tail call i32 @clear_flags(i8* %0)
br i1 %13, label %15, label %18
15: ; preds = %10
%16 = tail call i32 @mark_area_disabled(i8* %0, i32 %1, i32 %11, i8 signext %8)
%17 = tail call i32 @flag_visited_as_disabled(i8* %0)
br label %18
18: ; preds = %10, %15
%19 = icmp ult i32 %2, 79
br i1 %19, label %20, label %28
20: ; preds = %3, %18
%21 = add nsw i32 %2, 1
%22 = tail call i32 @seek_exit(i8* %0, i32 %1, i32 %21, i8 signext %8, i32 64)
%23 = icmp eq i32 %22, 0
%24 = tail call i32 @clear_flags(i8* %0)
br i1 %23, label %25, label %28
25: ; preds = %20
%26 = tail call i32 @mark_area_disabled(i8* %0, i32 %1, i32 %21, i8 signext %8)
%27 = tail call i32 @flag_visited_as_disabled(i8* %0)
br label %28
28: ; preds = %20, %25, %18
%29 = icmp sgt i32 %1, 0
br i1 %29, label %30, label %40
30: ; preds = %28
%31 = add nsw i32 %1, -1
%32 = tail call i32 @seek_exit(i8* %0, i32 %31, i32 %2, i8 signext %8, i32 32)
%33 = icmp eq i32 %32, 0
%34 = tail call i32 @clear_flags(i8* %0)
br i1 %33, label %35, label %38
35: ; preds = %30
%36 = tail call i32 @mark_area_disabled(i8* %0, i32 %31, i32 %2, i8 signext %8)
%37 = tail call i32 @flag_visited_as_disabled(i8* %0)
br label %38
38: ; preds = %30, %35
%39 = icmp ult i32 %1, 21
br i1 %39, label %40, label %48
40: ; preds = %28, %38
%41 = add nsw i32 %1, 1
%42 = tail call i32 @seek_exit(i8* %0, i32 %41, i32 %2, i8 signext %8, i32 0)
%43 = icmp eq i32 %42, 0
%44 = tail call i32 @clear_flags(i8* %0)
br i1 %43, label %45, label %48
45: ; preds = %40
%46 = tail call i32 @mark_area_disabled(i8* %0, i32 %41, i32 %2, i8 signext %8)
%47 = tail call i32 @flag_visited_as_disabled(i8* %0)
br label %48
48: ; preds = %40, %45, %38
ret void
}