#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_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ border_n_vertical_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ border_ne_ext_corner_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ border_ne_ext_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_ne_int_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_nesw_double_diagonal_dirt(unsigned char *,
                                                    unsigned char *);
int /*<<< orphan*/ border_nw_ext_corner_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ border_nw_ext_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_nw_int_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_nwse_double_diagonal_dirt(unsigned char *,
                                                    unsigned char *);
int /*<<< orphan*/ border_s_vertical_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ border_se_ext_corner_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ border_se_ext_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_se_int_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_sw_ext_corner_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ border_sw_ext_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_sw_int_diagonal_dirt(unsigned char *,
                                               unsigned char *);
int /*<<< orphan*/ border_w_horizontal_dirt(unsigned char *, unsigned char *);
int /*<<< orphan*/ borderless_dirt(unsigned char *);
int dispatch_terrain_dirt(unsigned char adjacent_sand, unsigned char *pic,
                          unsigned char *mirr) {
  switch (adjacent_sand) {
  case 0x08:
  case 0x09:
  case 0x28:
  case 0x29:
    border_w_horizontal_dirt(pic, mirr);
    break;
  case 0x10:
  case 0x14:
  case 0x90:
  case 0x94:
    border_e_horizontal_dirt(pic, mirr);
    break;
  case 0xC0:
  case 0xE0:
  case 0x40:
  case 0x60:
    border_s_vertical_dirt(pic, mirr);
    break;
  case 0x02:
  case 0x03:
  case 0x06:
  case 0x07:
    border_n_vertical_dirt(pic, mirr);
    break;
  case 0x2F:
    border_nw_ext_corner_dirt(pic, mirr);
    break;
  case 0xE9:
    border_sw_ext_corner_dirt(pic, mirr);
    break;
  case 0x97:
    border_ne_ext_corner_dirt(pic, mirr);
    break;
  case 0xF4:
    border_se_ext_corner_dirt(pic, mirr);
    break;
  case 0x80:
    border_se_int_diagonal_dirt(pic, mirr);
    break;
  case 0x04:
    border_ne_int_diagonal_dirt(pic, mirr);
    break;
  case 0x20:
    border_sw_int_diagonal_dirt(pic, mirr);
    break;
  case 0x01:
    border_nw_int_diagonal_dirt(pic, mirr);
    break;
  case 0x0B:
  case 0x0F:
  case 0x2B:
    border_nw_ext_diagonal_dirt(pic, mirr);
    break;
  case 0x68:
  case 0x69:
  case 0xE8:
    border_sw_ext_diagonal_dirt(pic, mirr);
    break;
  case 0x16:
  case 0x17:
  case 0x96:
    border_ne_ext_diagonal_dirt(pic, mirr);
    break;
  case 0xD0:
  case 0xD4:
  case 0xF0:
    border_se_ext_diagonal_dirt(pic, mirr);
    break;
  case 0x81:
    border_nesw_double_diagonal_dirt(pic, mirr);
    break;
  case 0x24:
    border_nwse_double_diagonal_dirt(pic, mirr);
    break;
  case 0x00:
    borderless_dirt(pic);
    break;
  default:
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<dispatch_terrain_dirt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movzbl -0x5(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0xf4,%rax
ja     13c0 <dispatch_terrain_dirt+0x190>
mov    -0x20(%rbp),%rax
lea    0xd9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1130 <border_w_horizontal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10c0 <border_e_horizontal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10f0 <border_s_vertical_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1150 <border_n_vertical_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10e0 <border_nw_ext_corner_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1110 <border_sw_ext_corner_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1140 <border_ne_ext_corner_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1120 <border_se_ext_corner_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1100 <border_se_int_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <border_ne_int_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <border_sw_int_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <border_nw_int_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10d0 <border_nw_ext_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <border_sw_ext_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <border_ne_ext_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <border_se_ext_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <border_nesw_double_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <border_nwse_double_diagonal_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
mov    -0x10(%rbp),%rdi
call   10a0 <borderless_dirt@plt>
jmp    13cc <dispatch_terrain_dirt+0x19c>
movl   $0x1,-0x4(%rbp)
jmp    13d3 <dispatch_terrain_dirt+0x1a3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispatch_terrain_dirt>:
push   %rax
mov    $0x1,%eax
add    $0x80,%dil
cmp    $0xe9,%dil
ja     1364 <dispatch_terrain_dirt+0x134>
movzbl %dil,%ecx
lea    0xdb1(%rip),%rdi
movslq (%rdi,%rcx,4),%rcx
add    %rdi,%rcx
jmp    *%rcx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   10c0 <border_e_horizontal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   10f0 <border_s_vertical_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1150 <border_n_vertical_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1130 <border_w_horizontal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   10b0 <border_ne_ext_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1050 <border_se_ext_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1060 <border_sw_ext_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   10d0 <border_nw_ext_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1100 <border_se_int_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1090 <border_nesw_double_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1140 <border_ne_ext_corner_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1110 <border_sw_ext_corner_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1120 <border_se_ext_corner_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
call   10a0 <borderless_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1080 <border_nw_int_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <border_ne_int_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1070 <border_sw_int_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <border_nwse_double_diagonal_dirt@plt>
jmp    1362 <dispatch_terrain_dirt+0x132>
mov    %rsi,%rdi
mov    %rdx,%rsi
call   10e0 <border_nw_ext_corner_dirt@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dispatch_terrain_dirt(i8 zeroext %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8*
%7 = alloca i8*
store i8 %0, i8* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
switch i32 %9, label %85 [
i32 8, label %10
i32 9, label %10
i32 40, label %10
i32 41, label %10
i32 16, label %14
i32 20, label %14
i32 144, label %14
i32 148, label %14
i32 192, label %18
i32 224, label %18
i32 64, label %18
i32 96, label %18
i32 2, label %22
i32 3, label %22
i32 6, label %22
i32 7, label %22
i32 47, label %26
i32 233, label %30
i32 151, label %34
i32 244, label %38
i32 128, label %42
i32 4, label %46
i32 32, label %50
i32 1, label %54
i32 11, label %58
i32 15, label %58
i32 43, label %58
i32 104, label %62
i32 105, label %62
i32 232, label %62
i32 22, label %66
i32 23, label %66
i32 150, label %66
i32 208, label %70
i32 212, label %70
i32 240, label %70
i32 129, label %74
i32 36, label %78
i32 0, label %82
]
10: ; preds = %3, %3, %3, %3
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = call i32 @border_w_horizontal_dirt(i8* %11, i8* %12)
br label %86
14: ; preds = %3, %3, %3, %3
%15 = load i8*, i8** %6
%16 = load i8*, i8** %7
%17 = call i32 @border_e_horizontal_dirt(i8* %15, i8* %16)
br label %86
18: ; preds = %3, %3, %3, %3
%19 = load i8*, i8** %6
%20 = load i8*, i8** %7
%21 = call i32 @border_s_vertical_dirt(i8* %19, i8* %20)
br label %86
22: ; preds = %3, %3, %3, %3
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = call i32 @border_n_vertical_dirt(i8* %23, i8* %24)
br label %86
26: ; preds = %3
%27 = load i8*, i8** %6
%28 = load i8*, i8** %7
%29 = call i32 @border_nw_ext_corner_dirt(i8* %27, i8* %28)
br label %86
30: ; preds = %3
%31 = load i8*, i8** %6
%32 = load i8*, i8** %7
%33 = call i32 @border_sw_ext_corner_dirt(i8* %31, i8* %32)
br label %86
34: ; preds = %3
%35 = load i8*, i8** %6
%36 = load i8*, i8** %7
%37 = call i32 @border_ne_ext_corner_dirt(i8* %35, i8* %36)
br label %86
38: ; preds = %3
%39 = load i8*, i8** %6
%40 = load i8*, i8** %7
%41 = call i32 @border_se_ext_corner_dirt(i8* %39, i8* %40)
br label %86
42: ; preds = %3
%43 = load i8*, i8** %6
%44 = load i8*, i8** %7
%45 = call i32 @border_se_int_diagonal_dirt(i8* %43, i8* %44)
br label %86
46: ; preds = %3
%47 = load i8*, i8** %6
%48 = load i8*, i8** %7
%49 = call i32 @border_ne_int_diagonal_dirt(i8* %47, i8* %48)
br label %86
50: ; preds = %3
%51 = load i8*, i8** %6
%52 = load i8*, i8** %7
%53 = call i32 @border_sw_int_diagonal_dirt(i8* %51, i8* %52)
br label %86
54: ; preds = %3
%55 = load i8*, i8** %6
%56 = load i8*, i8** %7
%57 = call i32 @border_nw_int_diagonal_dirt(i8* %55, i8* %56)
br label %86
58: ; preds = %3, %3, %3
%59 = load i8*, i8** %6
%60 = load i8*, i8** %7
%61 = call i32 @border_nw_ext_diagonal_dirt(i8* %59, i8* %60)
br label %86
62: ; preds = %3, %3, %3
%63 = load i8*, i8** %6
%64 = load i8*, i8** %7
%65 = call i32 @border_sw_ext_diagonal_dirt(i8* %63, i8* %64)
br label %86
66: ; preds = %3, %3, %3
%67 = load i8*, i8** %6
%68 = load i8*, i8** %7
%69 = call i32 @border_ne_ext_diagonal_dirt(i8* %67, i8* %68)
br label %86
70: ; preds = %3, %3, %3
%71 = load i8*, i8** %6
%72 = load i8*, i8** %7
%73 = call i32 @border_se_ext_diagonal_dirt(i8* %71, i8* %72)
br label %86
74: ; preds = %3
%75 = load i8*, i8** %6
%76 = load i8*, i8** %7
%77 = call i32 @border_nesw_double_diagonal_dirt(i8* %75, i8* %76)
br label %86
78: ; preds = %3
%79 = load i8*, i8** %6
%80 = load i8*, i8** %7
%81 = call i32 @border_nwse_double_diagonal_dirt(i8* %79, i8* %80)
br label %86
82: ; preds = %3
%83 = load i8*, i8** %6
%84 = call i32 @borderless_dirt(i8* %83)
br label %86
85: ; preds = %3
store i32 1, i32* %4
br label %87
86: ; preds = %82, %78, %74, %70, %66, %62, %58, %54, %50, %46, %42, %38, %34, %30, %26, %22, %18, %14, %10
store i32 0, i32* %4
br label %87
87: ; preds = %86, %85
%88 = load i32, i32* %4
ret i32 %88
}

LLVM IR (-O2):
define i32 @dispatch_terrain_dirt(i8 zeroext %0, i8* %1, i8* %2) {
switch i8 %0, label %42 [
i8 8, label %4
i8 9, label %4
i8 40, label %4
i8 41, label %4
i8 16, label %6
i8 20, label %6
i8 -112, label %6
i8 -108, label %6
i8 -64, label %8
i8 -32, label %8
i8 64, label %8
i8 96, label %8
i8 2, label %10
i8 3, label %10
i8 6, label %10
i8 7, label %10
i8 47, label %12
i8 -23, label %14
i8 -105, label %16
i8 -12, label %18
i8 -128, label %20
i8 4, label %22
i8 32, label %24
i8 1, label %26
i8 11, label %28
i8 15, label %28
i8 43, label %28
i8 104, label %30
i8 105, label %30
i8 -24, label %30
i8 22, label %32
i8 23, label %32
i8 -106, label %32
i8 -48, label %34
i8 -44, label %34
i8 -16, label %34
i8 -127, label %36
i8 36, label %38
i8 0, label %40
]
4: ; preds = %3, %3, %3, %3
%5 = tail call i32 @border_w_horizontal_dirt(i8* %1, i8* %2)
br label %42
6: ; preds = %3, %3, %3, %3
%7 = tail call i32 @border_e_horizontal_dirt(i8* %1, i8* %2)
br label %42
8: ; preds = %3, %3, %3, %3
%9 = tail call i32 @border_s_vertical_dirt(i8* %1, i8* %2)
br label %42
10: ; preds = %3, %3, %3, %3
%11 = tail call i32 @border_n_vertical_dirt(i8* %1, i8* %2)
br label %42
12: ; preds = %3
%13 = tail call i32 @border_nw_ext_corner_dirt(i8* %1, i8* %2)
br label %42
14: ; preds = %3
%15 = tail call i32 @border_sw_ext_corner_dirt(i8* %1, i8* %2)
br label %42
16: ; preds = %3
%17 = tail call i32 @border_ne_ext_corner_dirt(i8* %1, i8* %2)
br label %42
18: ; preds = %3
%19 = tail call i32 @border_se_ext_corner_dirt(i8* %1, i8* %2)
br label %42
20: ; preds = %3
%21 = tail call i32 @border_se_int_diagonal_dirt(i8* %1, i8* %2)
br label %42
22: ; preds = %3
%23 = tail call i32 @border_ne_int_diagonal_dirt(i8* %1, i8* %2)
br label %42
24: ; preds = %3
%25 = tail call i32 @border_sw_int_diagonal_dirt(i8* %1, i8* %2)
br label %42
26: ; preds = %3
%27 = tail call i32 @border_nw_int_diagonal_dirt(i8* %1, i8* %2)
br label %42
28: ; preds = %3, %3, %3
%29 = tail call i32 @border_nw_ext_diagonal_dirt(i8* %1, i8* %2)
br label %42
30: ; preds = %3, %3, %3
%31 = tail call i32 @border_sw_ext_diagonal_dirt(i8* %1, i8* %2)
br label %42
32: ; preds = %3, %3, %3
%33 = tail call i32 @border_ne_ext_diagonal_dirt(i8* %1, i8* %2)
br label %42
34: ; preds = %3, %3, %3
%35 = tail call i32 @border_se_ext_diagonal_dirt(i8* %1, i8* %2)
br label %42
36: ; preds = %3
%37 = tail call i32 @border_nesw_double_diagonal_dirt(i8* %1, i8* %2)
br label %42
38: ; preds = %3
%39 = tail call i32 @border_nwse_double_diagonal_dirt(i8* %1, i8* %2)
br label %42
40: ; preds = %3
%41 = tail call i32 @borderless_dirt(i8* %1)
br label %42
42: ; preds = %4, %6, %8, %10, %12, %14, %16, %18, %20, %22, %24, %26, %28, %30, %32, %34, %36, %38, %40, %3
%43 = phi i32 [ 1, %3 ], [ 0, %40 ], [ 0, %38 ], [ 0, %36 ], [ 0, %34 ], [ 0, %32 ], [ 0, %30 ], [ 0, %28 ], [ 0, %26 ], [ 0, %24 ], [ 0, %22 ], [ 0, %20 ], [ 0, %18 ], [ 0, %16 ], [ 0, %14 ], [ 0, %12 ], [ 0, %10 ], [ 0, %8 ], [ 0, %6 ], [ 0, %4 ]
ret i32 %43
}