#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 */
const char *get_script_type_name(int type) {
  enum {
    TYPE_CLOSED,
    TYPE_OPEN,
    TYPE_RESPAWN,
    TYPE_DEATH,
    TYPE_ENTER,
    TYPE_PICKUP,
    TYPE_BLUERETURN,
    TYPE_REDRETURN,
    TYPE_WHITERETURN,
    TYPE_LIGHTNING = 12,
    TYPE_UNLOADING,
    TYPE_DISCONNECT,
    TYPE_RETURN,
    TYPE_EVENT,
    TYPE_KILL,
    TYPE_REOPEN,
  };
  switch (type) {
  case TYPE_CLOSED:
    return "closed";
  case TYPE_OPEN:
    return "open";
  case TYPE_RESPAWN:
    return "respawn";
  case TYPE_DEATH:
    return "death";
  case TYPE_ENTER:
    return "enter";
  case TYPE_PICKUP:
    return "pickup";
  case TYPE_BLUERETURN:
    return "bluereturn";
  case TYPE_REDRETURN:
    return "redreturn";
  case TYPE_WHITERETURN:
    return "whitereturn";
  case TYPE_LIGHTNING:
    return "lightning";
  case TYPE_UNLOADING:
    return "unloading";
  case TYPE_DISCONNECT:
    return "disconnect";
  case TYPE_RETURN:
    return "return";
  case TYPE_EVENT:
    return "event";
  case TYPE_KILL:
    return "kill";
  case TYPE_REOPEN:
    return "reopen";
  default:
    return NULL;
  }
}


x86 assembly (clang, -O0):
<get_script_type_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x12,%rax
ja     122c <get_script_type_name+0x12c>
mov    -0x18(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf19(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xf78(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xf00(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xef8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xeee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xee4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xed6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xed0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xecc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xe89(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xeab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1234 <get_script_type_name+0x134>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_script_type_name>:
cmp    $0x12,%edi
ja     1114 <get_script_type_name+0x14>
movslq %edi,%rax
lea    0x2ca9(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"closed\00"
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [8 x i8] c"respawn\00"
@.str.3 = [6 x i8] c"death\00"
@.str.4 = [6 x i8] c"enter\00"
@.str.5 = [7 x i8] c"pickup\00"
@.str.6 = [11 x i8] c"bluereturn\00"
@.str.7 = [10 x i8] c"redreturn\00"
@.str.8 = [12 x i8] c"whitereturn\00"
@.str.9 = [10 x i8] c"lightning\00"
@.str.10 = [10 x i8] c"unloading\00"
@.str.11 = [11 x i8] c"disconnect\00"
@.str.12 = [7 x i8] c"return\00"
@.str.13 = [6 x i8] c"event\00"
@.str.14 = [5 x i8] c"kill\00"
@.str.15 = [7 x i8] c"reopen\00"
define i8* @get_script_type_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %21 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 8, label %13
i32 12, label %14
i32 13, label %15
i32 14, label %16
i32 15, label %17
i32 16, label %18
i32 17, label %19
i32 18, label %20
]
5: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
br label %22
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %22
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %22
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %22
9: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %22
10: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %22
11: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %22
12: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %22
13: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %22
14: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %22
15: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %22
16: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %22
17: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %22
18: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %22
19: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %22
20: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %22
21: ; preds = %1
store i8* null, i8** %2
br label %22
22: ; preds = %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@.str = [7 x i8] c"closed\00"
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [8 x i8] c"respawn\00"
@.str.3 = [6 x i8] c"death\00"
@.str.4 = [6 x i8] c"enter\00"
@.str.5 = [7 x i8] c"pickup\00"
@.str.6 = [11 x i8] c"bluereturn\00"
@.str.7 = [10 x i8] c"redreturn\00"
@.str.8 = [12 x i8] c"whitereturn\00"
@.str.9 = [10 x i8] c"lightning\00"
@.str.10 = [10 x i8] c"unloading\00"
@.str.11 = [11 x i8] c"disconnect\00"
@.str.12 = [7 x i8] c"return\00"
@.str.13 = [6 x i8] c"event\00"
@.str.14 = [5 x i8] c"kill\00"
@.str.15 = [7 x i8] c"reopen\00"
@switch.table.get_script_type_name = [19 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* null, i8* null, i8* null, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0)]
define i8* @get_script_type_name(i32 %0) {
%2 = icmp ult i32 %0, 19
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [19 x i8*], [19 x i8*]* @switch.table.get_script_type_name, i64 0, i64 %4
%6 = load i8*, i8** %5
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ null, %1 ]
ret i8* %8
}