char *display_jstate(int js) {
  switch (js) {
  case 0x0002:
    return "KANJI";
  case 0x0004:
    return "KATAKANA";
  case 0x0200:
    return "DISCARD";
  case 0x0010:
    return "ROMAN";
  case 0x0008:
    return "ASCII";
  case 0x0080:
    return "ALPHA";
  case 0x0300:
    return "ETX";
  case 0x0001:
    return "STX";
  case 0x0020:
    return "GREEK";
  case 0x0040:
    return "CYRILLIC";
  case 0x0100:
    return "HALFKATA";
  default:
    return "(UNKNOWN)";
  }
}


x86 assembly (clang, -O0):
<display_jstate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     123d <display_jstate+0x13d>
jmp    111b <display_jstate+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11cd <display_jstate+0xcd>
jmp    112c <display_jstate+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     11dd <display_jstate+0xdd>
jmp    113d <display_jstate+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     120d <display_jstate+0x10d>
jmp    114e <display_jstate+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     11fd <display_jstate+0xfd>
jmp    115f <display_jstate+0x5f>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     124d <display_jstate+0x14d>
jmp    1170 <display_jstate+0x70>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     125d <display_jstate+0x15d>
jmp    1181 <display_jstate+0x81>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
je     121d <display_jstate+0x11d>
jmp    1194 <display_jstate+0x94>
mov    -0x10(%rbp),%eax
sub    $0x100,%eax
je     126d <display_jstate+0x16d>
jmp    11a7 <display_jstate+0xa7>
mov    -0x10(%rbp),%eax
sub    $0x200,%eax
je     11ed <display_jstate+0xed>
jmp    11ba <display_jstate+0xba>
mov    -0x10(%rbp),%eax
sub    $0x300,%eax
je     122d <display_jstate+0x12d>
jmp    127d <display_jstate+0x17d>
lea    0xe2c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xe22(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xe1b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xe13(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xe09(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xdff(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xdf5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xde9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xddd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xdd3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xdcc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1288 <display_jstate+0x188>
lea    0xdc5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_jstate>:
cmp    $0x7f,%edi
jg     1130 <display_jstate+0x30>
add    $0xffffffff,%edi
cmp    $0x3f,%edi
ja     11a0 <display_jstate+0xa0>
lea    0xfe8(%rip),%rax
lea    0xee1(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xffe(%rip),%rax
ret
cmp    $0x1ff,%edi
jg     1150 <display_jstate+0x50>
cmp    $0x80,%edi
je     1190 <display_jstate+0x90>
cmp    $0x100,%edi
jne    11a0 <display_jstate+0xa0>
lea    0xff1(%rip),%rax
ret
cmp    $0x200,%edi
je     1198 <display_jstate+0x98>
cmp    $0x300,%edi
jne    11a0 <display_jstate+0xa0>
lea    0xfc2(%rip),%rax
ret
lea    0xf97(%rip),%rax
ret
lea    0xfa6(%rip),%rax
ret
lea    0xf98(%rip),%rax
ret
lea    0xfaa(%rip),%rax
ret
lea    0xfa8(%rip),%rax
ret
lea    0xf8c(%rip),%rax
ret
lea    0xf70(%rip),%rax
ret
lea    0xfa2(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"KANJI\00"
@.str.1 = [9 x i8] c"KATAKANA\00"
@.str.2 = [8 x i8] c"DISCARD\00"
@.str.3 = [6 x i8] c"ROMAN\00"
@.str.4 = [6 x i8] c"ASCII\00"
@.str.5 = [6 x i8] c"ALPHA\00"
@.str.6 = [4 x i8] c"ETX\00"
@.str.7 = [4 x i8] c"STX\00"
@.str.8 = [6 x i8] c"GREEK\00"
@.str.9 = [9 x i8] c"CYRILLIC\00"
@.str.10 = [9 x i8] c"HALFKATA\00"
@.str.11 = [10 x i8] c"(UNKNOWN)\00"
define i8* @display_jstate(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %16 [
i32 2, label %5
i32 4, label %6
i32 512, label %7
i32 16, label %8
i32 8, label %9
i32 128, label %10
i32 768, label %11
i32 1, label %12
i32 32, label %13
i32 64, label %14
i32 256, label %15
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %17
6: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %17
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %17
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %17
9: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %17
10: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %17
11: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %17
12: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %17
13: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %17
14: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %17
15: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %17
16: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [6 x i8] c"KANJI\00"
@.str.1 = [9 x i8] c"KATAKANA\00"
@.str.2 = [8 x i8] c"DISCARD\00"
@.str.3 = [6 x i8] c"ROMAN\00"
@.str.4 = [6 x i8] c"ASCII\00"
@.str.5 = [6 x i8] c"ALPHA\00"
@.str.6 = [4 x i8] c"ETX\00"
@.str.7 = [4 x i8] c"STX\00"
@.str.8 = [6 x i8] c"GREEK\00"
@.str.9 = [9 x i8] c"CYRILLIC\00"
@.str.10 = [9 x i8] c"HALFKATA\00"
@.str.11 = [10 x i8] c"(UNKNOWN)\00"
define i8* @display_jstate(i32 %0) {
switch i32 %0, label %12 [
i32 2, label %13
i32 4, label %2
i32 512, label %3
i32 16, label %4
i32 8, label %5
i32 128, label %6
i32 768, label %7
i32 1, label %8
i32 32, label %9
i32 64, label %10
i32 256, label %11
]
2: ; preds = %1
br label %13
3: ; preds = %1
br label %13
4: ; preds = %1
br label %13
5: ; preds = %1
br label %13
6: ; preds = %1
br label %13
7: ; preds = %1
br label %13
8: ; preds = %1
br label %13
9: ; preds = %1
br label %13
10: ; preds = %1
br label %13
11: ; preds = %1
br label %13
12: ; preds = %1
br label %13
13: ; preds = %1, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%14 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %14
}