#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 */
#define ACCOUNTING 137
#define BOOT_TIME 136
#define DEAD_PROCESS 135
#define EMPTY 134
#define INIT_PROCESS 133
#define LOGIN_PROCESS 132
#define NEW_TIME 131
#define OLD_TIME 130
#define RUN_LVL 129
#define USER_PROCESS 128
const char *type_to_string(short ut_type) {
  switch (ut_type) {
  case EMPTY:
    return "EMPTY";
  case RUN_LVL:
    return "RUN_LEVEL";
  case BOOT_TIME:
    return "BOOT_TIME";
  case NEW_TIME:
    return "NEW_TIME";
  case OLD_TIME:
    return "OLD_TIME";
  case INIT_PROCESS:
    return "INIT_PROCESS";
  case LOGIN_PROCESS:
    return "LOGIN_PROCESS";
  case USER_PROCESS:
    return "USER_PROCESS";
  case DEAD_PROCESS:
    return "DEAD_PROCESS";
  case ACCOUNTING:
    return "ACCOUNTING";
  }
  return "ERROR";
}


x86 assembly (clang, -O0):
<type_to_string>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x9,%eax
ja     11d5 <type_to_string+0xd5>
mov    -0x18(%rbp),%rax
lea    0xed4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeec(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xedc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xed6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xecf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <type_to_string+0xe0>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_to_string>:
add    $0xffffff80,%edi
cmp    $0x9,%edi
ja     111a <type_to_string+0x1a>
movslq %edi,%rax
lea    0xf62(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xf4b(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"EMPTY\00"
@.str.1 = [10 x i8] c"RUN_LEVEL\00"
@.str.2 = [10 x i8] c"BOOT_TIME\00"
@.str.3 = [9 x i8] c"NEW_TIME\00"
@.str.4 = [9 x i8] c"OLD_TIME\00"
@.str.5 = [13 x i8] c"INIT_PROCESS\00"
@.str.6 = [14 x i8] c"LOGIN_PROCESS\00"
@.str.7 = [13 x i8] c"USER_PROCESS\00"
@.str.8 = [13 x i8] c"DEAD_PROCESS\00"
@.str.9 = [11 x i8] c"ACCOUNTING\00"
@.str.10 = [6 x i8] c"ERROR\00"
define i8* @type_to_string(i16 signext %0) {
%2 = alloca i8*
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
switch i32 %5, label %16 [
i32 134, label %6
i32 129, label %7
i32 136, label %8
i32 131, label %9
i32 130, label %10
i32 133, label %11
i32 132, label %12
i32 128, label %13
i32 135, label %14
i32 137, label %15
]
6: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %17
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %17
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %17
9: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %17
10: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %17
11: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %17
12: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %17
13: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %17
14: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %17
15: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %17
16: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [6 x i8] c"EMPTY\00"
@.str.1 = [10 x i8] c"RUN_LEVEL\00"
@.str.2 = [10 x i8] c"BOOT_TIME\00"
@.str.3 = [9 x i8] c"NEW_TIME\00"
@.str.4 = [9 x i8] c"OLD_TIME\00"
@.str.5 = [13 x i8] c"INIT_PROCESS\00"
@.str.6 = [14 x i8] c"LOGIN_PROCESS\00"
@.str.7 = [13 x i8] c"USER_PROCESS\00"
@.str.8 = [13 x i8] c"DEAD_PROCESS\00"
@.str.9 = [11 x i8] c"ACCOUNTING\00"
@.str.10 = [6 x i8] c"ERROR\00"
@reltable.type_to_string = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.type_to_string to i64)) to i32)]
define i8* @type_to_string(i16 signext %0) {
%2 = sext i16 %0 to i32
%3 = add nsw i32 %2, -128
%4 = icmp ult i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.type_to_string to i8*), i64 %7)
br label %9
9: ; preds = %1, %5
%10 = phi i8* [ %8, %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), %1 ]
ret i8* %10
}