#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*/ assert(int);
void mark_area_disabled(char *map, int y, int x, char own_player) {
  assert(x >= 0);
  assert(y >= 0);
  assert(x < 80);
  assert(y < 22);
  char v = map[y * 80 + x];
  if ((v & (1 << 4)) || ((v & 3) == own_player) && !(v & (1 << 3)))
    return;
  map[y * 80 + x] |= (1 << 4);
  mark_area_disabled(map, y - 1, x, own_player);
  mark_area_disabled(map, y + 1, x, own_player);
  mark_area_disabled(map, y, x - 1, own_player);
  mark_area_disabled(map, y, x + 1, own_player);
}


x86 assembly (clang, -O0):
<mark_area_disabled>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpl   $0x0,-0x10(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0xc(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x50,-0x10(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x16,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
imul   $0x50,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
jne    11c2 <mark_area_disabled+0xa2>
movsbl -0x12(%rbp),%eax
and    $0x3,%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    11c7 <mark_area_disabled+0xa7>
movsbl -0x12(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    11c7 <mark_area_disabled+0xa7>
jmp    1237 <mark_area_disabled+0x117>
mov    -0x8(%rbp),%rax
imul   $0x50,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
or     $0x10,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
movsbl -0x11(%rbp),%ecx
call   1030 <mark_area_disabled@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
movsbl -0x11(%rbp),%ecx
call   1030 <mark_area_disabled@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movsbl -0x11(%rbp),%ecx
call   1030 <mark_area_disabled@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
movsbl -0x11(%rbp),%ecx
call   1030 <mark_area_disabled@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mark_area_disabled>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebx
mov    %rdi,%rbp
mov    %esi,%eax
not    %eax
shr    $0x1f,%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
cmp    $0x16,%esi
setl   %al
mov    %eax,0x8(%rsp)
mov    %esi,0x4(%rsp)
movslq %esi,%rax
lea    (%rax,%rax,4),%r15
shl    $0x4,%r15
lea    -0x1(%rax),%ecx
mov    %ecx,(%rsp)
add    $0x1,%eax
mov    %rax,0x10(%rsp)
movslq %edx,%r14
add    %rdi,%r15
mov    %r14d,%r13d
not    %r13d
jmp    11c9 <mark_area_disabled+0xa9>
cs nopw 0x0(%rax,%rax,1)
nop
or     $0x10,%al
mov    %al,(%r15,%r14,1)
movsbl %bl,%r12d
mov    %rbp,%rdi
mov    (%rsp),%esi
mov    %r14d,%edx
mov    %r12d,%ecx
call   1030 <mark_area_disabled@plt>
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
mov    %r14d,%edx
mov    %r12d,%ecx
call   1030 <mark_area_disabled@plt>
lea    -0x1(%r14),%edx
mov    %rbp,%rdi
mov    0x4(%rsp),%esi
mov    %r12d,%ecx
call   1030 <mark_area_disabled@plt>
add    $0x1,%r14
add    $0xffffffff,%r13d
mov    %r13d,%edi
shr    $0x1f,%edi
call   1040 <assert@plt>
mov    0xc(%rsp),%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x50,%r14
setl   %dil
call   1040 <assert@plt>
mov    0x8(%rsp),%edi
call   1040 <assert@plt>
movzbl (%r15,%r14,1),%eax
test   $0x10,%al
jne    1216 <mark_area_disabled+0xf6>
mov    %eax,%ecx
and    $0x3,%ecx
cmp    %ebx,%ecx
jne    1180 <mark_area_disabled+0x60>
mov    %eax,%ecx
and    $0x8,%ecx
jne    1180 <mark_area_disabled+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @mark_area_disabled(i8* %0, i32 %1, i32 %2, i8 signext %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%10 = load i32, i32* %7
%11 = icmp sge i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %6
%15 = icmp sge i32 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 80
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i8*, i8** %5
%27 = load i32, i32* %6
%28 = mul nsw i32 %27, 80
%29 = load i32, i32* %7
%30 = add nsw i32 %28, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %26, i64 %31
%33 = load i8, i8* %32
store i8 %33, i8* %9
%34 = load i8, i8* %9
%35 = sext i8 %34 to i32
%36 = and i32 %35, 16
%37 = icmp ne i32 %36, 0
br i1 %37, label %50, label %38
38: ; preds = %4
%39 = load i8, i8* %9
%40 = sext i8 %39 to i32
%41 = and i32 %40, 3
%42 = load i8, i8* %8
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %41, %43
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load i8, i8* %9
%47 = sext i8 %46 to i32
%48 = and i32 %47, 8
%49 = icmp ne i32 %48, 0
br i1 %49, label %51, label %50
50: ; preds = %45, %4
br label %83
51: ; preds = %45, %38
%52 = load i8*, i8** %5
%53 = load i32, i32* %6
%54 = mul nsw i32 %53, 80
%55 = load i32, i32* %7
%56 = add nsw i32 %54, %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %52, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = or i32 %60, 16
%62 = trunc i32 %61 to i8
store i8 %62, i8* %58
%63 = load i8*, i8** %5
%64 = load i32, i32* %6
%65 = sub nsw i32 %64, 1
%66 = load i32, i32* %7
%67 = load i8, i8* %8
%68 = load i8*, i8** %5
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
%71 = load i32, i32* %7
%72 = load i8, i8* %8
%73 = load i8*, i8** %5
%74 = load i32, i32* %6
%75 = load i32, i32* %7
%76 = sub nsw i32 %75, 1
%77 = load i8, i8* %8
%78 = load i8*, i8** %5
%79 = load i32, i32* %6
%80 = load i32, i32* %7
%81 = add nsw i32 %80, 1
%82 = load i8, i8* %8
br label %83
83: ; preds = %51, %50
ret void
}

LLVM IR (-O2):
define void @mark_area_disabled(i8* %0, i32 %1, i32 %2, i8 signext %3) {
%5 = xor i32 %1, -1
%6 = lshr i32 %5, 31
%7 = icmp slt i32 %1, 22
%8 = zext i1 %7 to i32
%9 = mul nsw i32 %1, 80
%10 = sext i8 %3 to i32
%11 = add nsw i32 %1, -1
%12 = add nsw i32 %1, 1
%13 = sext i32 %2 to i64
%14 = sext i32 %9 to i64
br label %15
15: ; preds = %38, %4
%16 = phi i64 [ %42, %38 ], [ %13, %4 ]
%17 = trunc i64 %16 to i32
%18 = xor i32 %17, -1
%19 = lshr i32 %18, 31
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @assert(i32 %6)
%22 = icmp slt i64 %16, 80
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @assert(i32 %8)
%26 = add nsw i64 %16, %14
%27 = getelementptr inbounds i8, i8* %0, i64 %26
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = and i32 %29, 16
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %43
32: ; preds = %15
%33 = and i32 %29, 3
%34 = icmp eq i32 %33, %10
%35 = and i32 %29, 8
%36 = icmp eq i32 %35, 0
%37 = and i1 %34, %36
br i1 %37, label %43, label %38
38: ; preds = %32
%39 = or i8 %28, 16
store i8 %39, i8* %27
tail call void @mark_area_disabled(i8* %0, i32 %11, i32 %17, i8 signext %3)
tail call void @mark_area_disabled(i8* %0, i32 %12, i32 %17, i8 signext %3)
%40 = trunc i64 %16 to i32
%41 = add i32 %40, -1
tail call void @mark_area_disabled(i8* %0, i32 %1, i32 %41, i8 signext %3)
%42 = add i64 %16, 1
br label %15
43: ; preds = %15, %32
ret void
}