#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*/ border_e_horizontal_rock(unsigned char *);
int /*<<< orphan*/ border_n_vertical_rock(unsigned char *);
int /*<<< orphan*/ border_ne_ext_corner_rock(unsigned char *);
int /*<<< orphan*/ border_ne_ext_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_ne_int_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_nw_ext_corner_rock(unsigned char *);
int /*<<< orphan*/ border_nw_ext_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_nw_int_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_s_vertical_rock(unsigned char *);
int /*<<< orphan*/ border_se_ext_corner_rock(unsigned char *);
int /*<<< orphan*/ border_se_ext_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_se_int_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_sw_ext_corner_rock(unsigned char *);
int /*<<< orphan*/ border_sw_ext_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_sw_int_diagonal_rock(unsigned char *);
int /*<<< orphan*/ border_w_horizontal_rock(unsigned char *);
int /*<<< orphan*/ borderless_rock(unsigned char *);
int dispatch_terrain_rock(unsigned char adjacent_same, unsigned char *pic) {
  switch (adjacent_same) {
  case 0xD6:
  case 0xD7:
  case 0xF6:
  case 0xF7:
    border_w_horizontal_rock(pic);
    break;
  case 0x6B:
  case 0x6F:
  case 0xEB:
  case 0xEF:
    border_e_horizontal_rock(pic);
    break;
  case 0xF8:
  case 0xF9:
  case 0xFC:
  case 0xFD:
    border_n_vertical_rock(pic);
    break;
  case 0x1F:
  case 0x3F:
  case 0x9F:
  case 0xBF:
    border_s_vertical_rock(pic);
    break;
  case 0xD4:
  case 0xF0:
  case 0xF4:
    border_nw_ext_diagonal_rock(pic);
    break;
  case 0xE8:
  case 0xE9:
  case 0x69:
    border_ne_ext_diagonal_rock(pic);
    break;
  case 0x96:
  case 0x97:
  case 0x17:
    border_sw_ext_diagonal_rock(pic);
    break;
  case 0x2B:
  case 0x2F:
  case 0x0F:
    border_se_ext_diagonal_rock(pic);
    break;
  case 0xFE:
    border_nw_int_diagonal_rock(pic);
    break;
  case 0xFB:
    border_ne_int_diagonal_rock(pic);
    break;
  case 0xDF:
    border_sw_int_diagonal_rock(pic);
    break;
  case 0x7F:
    border_se_int_diagonal_rock(pic);
    break;
  case 0xD0:
    border_nw_ext_corner_rock(pic);
    break;
  case 0x68:
    border_ne_ext_corner_rock(pic);
    break;
  case 0x16:
    border_sw_ext_corner_rock(pic);
    break;
  case 0x0B:
    border_se_ext_corner_rock(pic);
    break;
  case 0xFF:
    borderless_rock(pic);
    break;
  default:
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<dispatch_terrain_rock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x5(%rbp),%eax
add    $0xfffffff5,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xf4,%eax
ja     133c <dispatch_terrain_rock+0x12c>
mov    -0x18(%rbp),%rax
lea    0xdbb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1110 <border_w_horizontal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1050 <border_e_horizontal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1060 <border_n_vertical_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1090 <border_s_vertical_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1130 <border_nw_ext_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   10e0 <border_ne_ext_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   10c0 <border_sw_ext_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1100 <border_se_ext_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   10b0 <border_nw_int_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1070 <border_ne_int_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   10f0 <border_sw_int_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1120 <border_se_int_diagonal_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1080 <border_nw_ext_corner_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   10d0 <border_ne_ext_corner_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1030 <border_sw_ext_corner_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   1040 <border_se_ext_corner_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
mov    -0x10(%rbp),%rdi
call   10a0 <borderless_rock@plt>
jmp    1348 <dispatch_terrain_rock+0x138>
movl   $0x1,-0x4(%rbp)
jmp    134f <dispatch_terrain_rock+0x13f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispatch_terrain_rock>:
push   %rax
mov    $0x1,%eax
add    $0x6a,%dil
cmp    $0xe9,%dil
ja     12ee <dispatch_terrain_rock+0xde>
movzbl %dil,%ecx
lea    0xdd1(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    %rsi,%rdi
call   1090 <border_s_vertical_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1110 <border_w_horizontal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1050 <border_e_horizontal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1060 <border_n_vertical_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   10c0 <border_sw_ext_diagonal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1130 <border_nw_ext_diagonal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   10e0 <border_ne_ext_diagonal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1100 <border_se_ext_diagonal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1080 <border_nw_ext_corner_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   10f0 <border_sw_int_diagonal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1070 <border_ne_int_diagonal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   10b0 <border_nw_int_diagonal_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   10a0 <borderless_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1040 <border_se_ext_corner_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1030 <border_sw_ext_corner_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   10d0 <border_ne_ext_corner_rock@plt>
jmp    12ec <dispatch_terrain_rock+0xdc>
mov    %rsi,%rdi
call   1120 <border_se_int_diagonal_rock@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dispatch_terrain_rock(i8 zeroext %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8*
store i8 %0, i8* %4
store i8* %1, i8** %5
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
switch i32 %7, label %59 [
i32 214, label %8
i32 215, label %8
i32 246, label %8
i32 247, label %8
i32 107, label %11
i32 111, label %11
i32 235, label %11
i32 239, label %11
i32 248, label %14
i32 249, label %14
i32 252, label %14
i32 253, label %14
i32 31, label %17
i32 63, label %17
i32 159, label %17
i32 191, label %17
i32 212, label %20
i32 240, label %20
i32 244, label %20
i32 232, label %23
i32 233, label %23
i32 105, label %23
i32 150, label %26
i32 151, label %26
i32 23, label %26
i32 43, label %29
i32 47, label %29
i32 15, label %29
i32 254, label %32
i32 251, label %35
i32 223, label %38
i32 127, label %41
i32 208, label %44
i32 104, label %47
i32 22, label %50
i32 11, label %53
i32 255, label %56
]
8: ; preds = %2, %2, %2, %2
%9 = load i8*, i8** %5
%10 = call i32 @border_w_horizontal_rock(i8* %9)
br label %60
11: ; preds = %2, %2, %2, %2
%12 = load i8*, i8** %5
%13 = call i32 @border_e_horizontal_rock(i8* %12)
br label %60
14: ; preds = %2, %2, %2, %2
%15 = load i8*, i8** %5
%16 = call i32 @border_n_vertical_rock(i8* %15)
br label %60
17: ; preds = %2, %2, %2, %2
%18 = load i8*, i8** %5
%19 = call i32 @border_s_vertical_rock(i8* %18)
br label %60
20: ; preds = %2, %2, %2
%21 = load i8*, i8** %5
%22 = call i32 @border_nw_ext_diagonal_rock(i8* %21)
br label %60
23: ; preds = %2, %2, %2
%24 = load i8*, i8** %5
%25 = call i32 @border_ne_ext_diagonal_rock(i8* %24)
br label %60
26: ; preds = %2, %2, %2
%27 = load i8*, i8** %5
%28 = call i32 @border_sw_ext_diagonal_rock(i8* %27)
br label %60
29: ; preds = %2, %2, %2
%30 = load i8*, i8** %5
%31 = call i32 @border_se_ext_diagonal_rock(i8* %30)
br label %60
32: ; preds = %2
%33 = load i8*, i8** %5
%34 = call i32 @border_nw_int_diagonal_rock(i8* %33)
br label %60
35: ; preds = %2
%36 = load i8*, i8** %5
%37 = call i32 @border_ne_int_diagonal_rock(i8* %36)
br label %60
38: ; preds = %2
%39 = load i8*, i8** %5
%40 = call i32 @border_sw_int_diagonal_rock(i8* %39)
br label %60
41: ; preds = %2
%42 = load i8*, i8** %5
%43 = call i32 @border_se_int_diagonal_rock(i8* %42)
br label %60
44: ; preds = %2
%45 = load i8*, i8** %5
%46 = call i32 @border_nw_ext_corner_rock(i8* %45)
br label %60
47: ; preds = %2
%48 = load i8*, i8** %5
%49 = call i32 @border_ne_ext_corner_rock(i8* %48)
br label %60
50: ; preds = %2
%51 = load i8*, i8** %5
%52 = call i32 @border_sw_ext_corner_rock(i8* %51)
br label %60
53: ; preds = %2
%54 = load i8*, i8** %5
%55 = call i32 @border_se_ext_corner_rock(i8* %54)
br label %60
56: ; preds = %2
%57 = load i8*, i8** %5
%58 = call i32 @borderless_rock(i8* %57)
br label %60
59: ; preds = %2
store i32 1, i32* %3
br label %61
60: ; preds = %56, %53, %50, %47, %44, %41, %38, %35, %32, %29, %26, %23, %20, %17, %14, %11, %8
store i32 0, i32* %3
br label %61
61: ; preds = %60, %59
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
define i32 @dispatch_terrain_rock(i8 zeroext %0, i8* %1) {
switch i8 %0, label %37 [
i8 -42, label %3
i8 -41, label %3
i8 -10, label %3
i8 -9, label %3
i8 107, label %5
i8 111, label %5
i8 -21, label %5
i8 -17, label %5
i8 -8, label %7
i8 -7, label %7
i8 -4, label %7
i8 -3, label %7
i8 31, label %9
i8 63, label %9
i8 -97, label %9
i8 -65, label %9
i8 -44, label %11
i8 -16, label %11
i8 -12, label %11
i8 -24, label %13
i8 -23, label %13
i8 105, label %13
i8 -106, label %15
i8 -105, label %15
i8 23, label %15
i8 43, label %17
i8 47, label %17
i8 15, label %17
i8 -2, label %19
i8 -5, label %21
i8 -33, label %23
i8 127, label %25
i8 -48, label %27
i8 104, label %29
i8 22, label %31
i8 11, label %33
i8 -1, label %35
]
3: ; preds = %2, %2, %2, %2
%4 = tail call i32 @border_w_horizontal_rock(i8* %1)
br label %37
5: ; preds = %2, %2, %2, %2
%6 = tail call i32 @border_e_horizontal_rock(i8* %1)
br label %37
7: ; preds = %2, %2, %2, %2
%8 = tail call i32 @border_n_vertical_rock(i8* %1)
br label %37
9: ; preds = %2, %2, %2, %2
%10 = tail call i32 @border_s_vertical_rock(i8* %1)
br label %37
11: ; preds = %2, %2, %2
%12 = tail call i32 @border_nw_ext_diagonal_rock(i8* %1)
br label %37
13: ; preds = %2, %2, %2
%14 = tail call i32 @border_ne_ext_diagonal_rock(i8* %1)
br label %37
15: ; preds = %2, %2, %2
%16 = tail call i32 @border_sw_ext_diagonal_rock(i8* %1)
br label %37
17: ; preds = %2, %2, %2
%18 = tail call i32 @border_se_ext_diagonal_rock(i8* %1)
br label %37
19: ; preds = %2
%20 = tail call i32 @border_nw_int_diagonal_rock(i8* %1)
br label %37
21: ; preds = %2
%22 = tail call i32 @border_ne_int_diagonal_rock(i8* %1)
br label %37
23: ; preds = %2
%24 = tail call i32 @border_sw_int_diagonal_rock(i8* %1)
br label %37
25: ; preds = %2
%26 = tail call i32 @border_se_int_diagonal_rock(i8* %1)
br label %37
27: ; preds = %2
%28 = tail call i32 @border_nw_ext_corner_rock(i8* %1)
br label %37
29: ; preds = %2
%30 = tail call i32 @border_ne_ext_corner_rock(i8* %1)
br label %37
31: ; preds = %2
%32 = tail call i32 @border_sw_ext_corner_rock(i8* %1)
br label %37
33: ; preds = %2
%34 = tail call i32 @border_se_ext_corner_rock(i8* %1)
br label %37
35: ; preds = %2
%36 = tail call i32 @borderless_rock(i8* %1)
br label %37
37: ; preds = %3, %5, %7, %9, %11, %13, %15, %17, %19, %21, %23, %25, %27, %29, %31, %33, %35, %2
%38 = phi i32 [ 1, %2 ], [ 0, %35 ], [ 0, %33 ], [ 0, %31 ], [ 0, %29 ], [ 0, %27 ], [ 0, %25 ], [ 0, %23 ], [ 0, %21 ], [ 0, %19 ], [ 0, %17 ], [ 0, %15 ], [ 0, %13 ], [ 0, %11 ], [ 0, %9 ], [ 0, %7 ], [ 0, %5 ], [ 0, %3 ]
ret i32 %38
}