char *AI_LinkString(int linktype) {
  char *s;
  if (linktype == 0x00000001)
    s = "LINK_MOVE";
  else if (linktype == 0x00000002)
    s = "LINK_STAIRS";
  else if (linktype == 0x00000004)
    s = "LINK_FALL";
  else if (linktype == 0x00000008)
    s = "LINK_CLIMB";
  else if (linktype == 0x00000010)
    s = "LINK_TELEPORT";
  else if (linktype == 0x00000020)
    s = "LINK_PLATFORM";
  else if (linktype == 0x00000040)
    s = "LINK_JUMPAD";
  else if (linktype == 0x00000080)
    s = "LINK_WATER";
  else if (linktype == 0x00000100)
    s = "LINK_WATERJUMP";
  else if (linktype == 0x00000200)
    s = "LINK_LADDER";
  else if (linktype == 0x00001000)
    s = "LINK_INVALID";
  else if (linktype == 0x00000400)
    s = "LINK_JUMP";
  else if (linktype == 0x00002000)
    s = "LINK_ROCKETJUMP";
  else if (linktype)
    s = "UNKNOWN";
  else
    s = "ZERO";
  return s;
}


x86 assembly (clang, -O0):
<AI_LinkString>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1121 <AI_LinkString+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12d1 <AI_LinkString+0x1d1>
cmpl   $0x2,-0x4(%rbp)
jne    113b <AI_LinkString+0x3b>
lea    0xed8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12cc <AI_LinkString+0x1cc>
cmpl   $0x4,-0x4(%rbp)
jne    1155 <AI_LinkString+0x55>
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12c7 <AI_LinkString+0x1c7>
cmpl   $0x8,-0x4(%rbp)
jne    116f <AI_LinkString+0x6f>
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12c2 <AI_LinkString+0x1c2>
cmpl   $0x10,-0x4(%rbp)
jne    1189 <AI_LinkString+0x89>
lea    0xeab(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12bd <AI_LinkString+0x1bd>
cmpl   $0x20,-0x4(%rbp)
jne    11a3 <AI_LinkString+0xa3>
lea    0xe9f(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b8 <AI_LinkString+0x1b8>
cmpl   $0x40,-0x4(%rbp)
jne    11bd <AI_LinkString+0xbd>
lea    0xe93(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12b3 <AI_LinkString+0x1b3>
cmpl   $0x80,-0x4(%rbp)
jne    11da <AI_LinkString+0xda>
lea    0xe82(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12ae <AI_LinkString+0x1ae>
cmpl   $0x100,-0x4(%rbp)
jne    11f7 <AI_LinkString+0xf7>
lea    0xe70(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12a9 <AI_LinkString+0x1a9>
cmpl   $0x200,-0x4(%rbp)
jne    1214 <AI_LinkString+0x114>
lea    0xe62(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    12a4 <AI_LinkString+0x1a4>
cmpl   $0x1000,-0x4(%rbp)
jne    1231 <AI_LinkString+0x131>
lea    0xe51(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    129f <AI_LinkString+0x19f>
cmpl   $0x400,-0x4(%rbp)
jne    124e <AI_LinkString+0x14e>
lea    0xe41(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    129a <AI_LinkString+0x19a>
cmpl   $0x2000,-0x4(%rbp)
jne    126b <AI_LinkString+0x16b>
lea    0xe2e(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1295 <AI_LinkString+0x195>
cmpl   $0x0,-0x4(%rbp)
je     1285 <AI_LinkString+0x185>
lea    0xe24(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1290 <AI_LinkString+0x190>
lea    0xe1c(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1295 <AI_LinkString+0x195>
jmp    129a <AI_LinkString+0x19a>
jmp    129f <AI_LinkString+0x19f>
jmp    12a4 <AI_LinkString+0x1a4>
jmp    12a9 <AI_LinkString+0x1a9>
jmp    12ae <AI_LinkString+0x1ae>
jmp    12b3 <AI_LinkString+0x1b3>
jmp    12b8 <AI_LinkString+0x1b8>
jmp    12bd <AI_LinkString+0x1bd>
jmp    12c2 <AI_LinkString+0x1c2>
jmp    12c7 <AI_LinkString+0x1c7>
jmp    12cc <AI_LinkString+0x1cc>
jmp    12d1 <AI_LinkString+0x1d1>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AI_LinkString>:
cmp    $0x7f,%edi
jg     112f <AI_LinkString+0x2f>
cmp    $0x40,%edi
ja     11c7 <AI_LinkString+0xc7>
lea    0xfef(%rip),%rax
mov    %edi,%ecx
lea    0xee2(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0x107e(%rip),%rax
ret
cmp    $0x3ff,%edi
jg     1157 <AI_LinkString+0x57>
cmp    $0x80,%edi
je     11a7 <AI_LinkString+0xa7>
cmp    $0x100,%edi
je     11af <AI_LinkString+0xaf>
cmp    $0x200,%edi
jne    11c7 <AI_LinkString+0xc7>
lea    0x101b(%rip),%rax
ret
cmp    $0x400,%edi
je     11b7 <AI_LinkString+0xb7>
cmp    $0x1000,%edi
je     11bf <AI_LinkString+0xbf>
cmp    $0x2000,%edi
jne    11c7 <AI_LinkString+0xc7>
lea    0x101e(%rip),%rax
ret
lea    0xf90(%rip),%rax
ret
lea    0xf94(%rip),%rax
ret
lea    0xf96(%rip),%rax
ret
lea    0xf99(%rip),%rax
ret
lea    0xf9f(%rip),%rax
ret
lea    0xfa5(%rip),%rax
ret
lea    0xfa9(%rip),%rax
ret
lea    0xfac(%rip),%rax
ret
lea    0xfcc(%rip),%rax
ret
lea    0xfb7(%rip),%rax
ret
lea    0xfd6(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"LINK_MOVE\00"
@.str.1 = [12 x i8] c"LINK_STAIRS\00"
@.str.2 = [10 x i8] c"LINK_FALL\00"
@.str.3 = [11 x i8] c"LINK_CLIMB\00"
@.str.4 = [14 x i8] c"LINK_TELEPORT\00"
@.str.5 = [14 x i8] c"LINK_PLATFORM\00"
@.str.6 = [12 x i8] c"LINK_JUMPAD\00"
@.str.7 = [11 x i8] c"LINK_WATER\00"
@.str.8 = [15 x i8] c"LINK_WATERJUMP\00"
@.str.9 = [12 x i8] c"LINK_LADDER\00"
@.str.10 = [13 x i8] c"LINK_INVALID\00"
@.str.11 = [10 x i8] c"LINK_JUMP\00"
@.str.12 = [16 x i8] c"LINK_ROCKETJUMP\00"
@.str.13 = [8 x i8] c"UNKNOWN\00"
@.str.14 = [5 x i8] c"ZERO\00"
define i8* @AI_LinkString(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %3
br label %73
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %72
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 4
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %71
15: ; preds = %11
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 8
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %70
19: ; preds = %15
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 16
br i1 %21, label %22, label %23
22: ; preds = %19
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %69
23: ; preds = %19
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %27
26: ; preds = %23
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %68
27: ; preds = %23
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 64
br i1 %29, label %30, label %31
30: ; preds = %27
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %67
31: ; preds = %27
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 128
br i1 %33, label %34, label %35
34: ; preds = %31
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %66
35: ; preds = %31
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 256
br i1 %37, label %38, label %39
38: ; preds = %35
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %65
39: ; preds = %35
%40 = load i32, i32* %2
%41 = icmp eq i32 %40, 512
br i1 %41, label %42, label %43
42: ; preds = %39
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8** %3
br label %64
43: ; preds = %39
%44 = load i32, i32* %2
%45 = icmp eq i32 %44, 4096
br i1 %45, label %46, label %47
46: ; preds = %43
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8** %3
br label %63
47: ; preds = %43
%48 = load i32, i32* %2
%49 = icmp eq i32 %48, 1024
br i1 %49, label %50, label %51
50: ; preds = %47
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8** %3
br label %62
51: ; preds = %47
%52 = load i32, i32* %2
%53 = icmp eq i32 %52, 8192
br i1 %53, label %54, label %55
54: ; preds = %51
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8** %3
br label %61
55: ; preds = %51
%56 = load i32, i32* %2
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %55
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %3
br label %60
59: ; preds = %55
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8** %3
br label %60
60: ; preds = %59, %58
br label %61
61: ; preds = %60, %54
br label %62
62: ; preds = %61, %50
br label %63
63: ; preds = %62, %46
br label %64
64: ; preds = %63, %42
br label %65
65: ; preds = %64, %38
br label %66
66: ; preds = %65, %34
br label %67
67: ; preds = %66, %30
br label %68
68: ; preds = %67, %26
br label %69
69: ; preds = %68, %22
br label %70
70: ; preds = %69, %18
br label %71
71: ; preds = %70, %14
br label %72
72: ; preds = %71, %10
br label %73
73: ; preds = %72, %6
%74 = load i8*, i8** %3
ret i8* %74
}

LLVM IR (-O2):
@.str = [10 x i8] c"LINK_MOVE\00"
@.str.1 = [12 x i8] c"LINK_STAIRS\00"
@.str.2 = [10 x i8] c"LINK_FALL\00"
@.str.3 = [11 x i8] c"LINK_CLIMB\00"
@.str.4 = [14 x i8] c"LINK_TELEPORT\00"
@.str.5 = [14 x i8] c"LINK_PLATFORM\00"
@.str.6 = [12 x i8] c"LINK_JUMPAD\00"
@.str.7 = [11 x i8] c"LINK_WATER\00"
@.str.8 = [15 x i8] c"LINK_WATERJUMP\00"
@.str.9 = [12 x i8] c"LINK_LADDER\00"
@.str.10 = [13 x i8] c"LINK_INVALID\00"
@.str.11 = [10 x i8] c"LINK_JUMP\00"
@.str.12 = [16 x i8] c"LINK_ROCKETJUMP\00"
@.str.13 = [8 x i8] c"UNKNOWN\00"
@.str.14 = [5 x i8] c"ZERO\00"
define i8* @AI_LinkString(i32 %0) {
switch i32 %0, label %14 [
i32 1, label %16
i32 2, label %2
i32 4, label %3
i32 8, label %4
i32 16, label %5
i32 32, label %6
i32 64, label %7
i32 128, label %8
i32 256, label %9
i32 512, label %10
i32 4096, label %11
i32 1024, label %12
i32 8192, label %13
i32 0, label %15
]
2: ; preds = %1
br label %16
3: ; preds = %1
br label %16
4: ; preds = %1
br label %16
5: ; preds = %1
br label %16
6: ; preds = %1
br label %16
7: ; preds = %1
br label %16
8: ; preds = %1
br label %16
9: ; preds = %1
br label %16
10: ; preds = %1
br label %16
11: ; preds = %1
br label %16
12: ; preds = %1
br label %16
13: ; preds = %1
br label %16
14: ; preds = %1
br label %16
15: ; preds = %1
br label %16
16: ; preds = %1, %2, %4, %6, %8, %10, %12, %14, %15, %13, %11, %9, %7, %5, %3
%17 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), %15 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %17
}