#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*/ isalnum(char);
int /*<<< orphan*/ isspace(char);
int xlate(char input) {
  switch (input) {
  case 0:
    return 0;
  case '\"':
    return 1;
  case '\'':
    return 2;
  case '{':
    return 3;
  case '}':
    return 4;
  case '$':
    return 5;
  case '\\':
    return 6;
  default:
    if (isalnum(input) || input == '_') {
      return 7;
    } else if (isspace(input)) {
      return 8;
    } else {
      return 9;
    }
  }
}


x86 assembly (clang, -O0):
<xlate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     11a8 <xlate+0x88>
jmp    1142 <xlate+0x22>
mov    -0xc(%rbp),%eax
sub    $0x22,%eax
je     11b4 <xlate+0x94>
jmp    1153 <xlate+0x33>
mov    -0xc(%rbp),%eax
sub    $0x24,%eax
je     11e4 <xlate+0xc4>
jmp    1164 <xlate+0x44>
mov    -0xc(%rbp),%eax
sub    $0x27,%eax
je     11c0 <xlate+0xa0>
jmp    1175 <xlate+0x55>
mov    -0xc(%rbp),%eax
sub    $0x5c,%eax
je     11f0 <xlate+0xd0>
jmp    1186 <xlate+0x66>
mov    -0xc(%rbp),%eax
sub    $0x7b,%eax
je     11cc <xlate+0xac>
jmp    1197 <xlate+0x77>
mov    -0xc(%rbp),%eax
sub    $0x7d,%eax
je     11d8 <xlate+0xb8>
jmp    11fc <xlate+0xdc>
movl   $0x0,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movl   $0x1,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movl   $0x2,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movl   $0x3,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movl   $0x4,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movl   $0x5,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movl   $0x6,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movsbl -0x5(%rbp),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    121b <xlate+0xfb>
movsbl -0x5(%rbp),%eax
cmp    $0x5f,%eax
jne    1227 <xlate+0x107>
movl   $0x7,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movsbl -0x5(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
je     1245 <xlate+0x125>
movl   $0x8,-0x4(%rbp)
jmp    124c <xlate+0x12c>
movl   $0x9,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xlate>:
push   %rbx
mov    %edi,%eax
cmp    $0x5b,%edi
jg     1146 <xlate+0x26>
cmp    $0x27,%eax
ja     1178 <xlate+0x58>
mov    %eax,%ecx
lea    0xeca(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%eax
pop    %rbx
ret
cmp    $0x5c,%eax
je     116a <xlate+0x4a>
cmp    $0x7b,%eax
je     1171 <xlate+0x51>
cmp    $0x7d,%eax
jne    1178 <xlate+0x58>
mov    $0x4,%eax
pop    %rbx
ret
mov    $0x5,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x6,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret
movsbl %al,%ebx
mov    %ebx,%edi
call   1030 <isalnum@plt>
mov    %eax,%ecx
mov    $0x7,%eax
cmp    $0x5f,%bl
je     11a5 <xlate+0x85>
test   %ecx,%ecx
jne    11a5 <xlate+0x85>
mov    %ebx,%edi
call   1040 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
or     $0x8,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @xlate(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %13 [
i32 0, label %6
i32 34, label %7
i32 39, label %8
i32 123, label %9
i32 125, label %10
i32 36, label %11
i32 92, label %12
]
6: ; preds = %1
store i32 0, i32* %2
br label %28
7: ; preds = %1
store i32 1, i32* %2
br label %28
8: ; preds = %1
store i32 2, i32* %2
br label %28
9: ; preds = %1
store i32 3, i32* %2
br label %28
10: ; preds = %1
store i32 4, i32* %2
br label %28
11: ; preds = %1
store i32 5, i32* %2
br label %28
12: ; preds = %1
store i32 6, i32* %2
br label %28
13: ; preds = %1
%14 = load i8, i8* %3
%15 = call i32 @isalnum(i8 signext %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 95
br i1 %20, label %21, label %22
21: ; preds = %17, %13
store i32 7, i32* %2
br label %28
22: ; preds = %17
%23 = load i8, i8* %3
%24 = call i32 @isspace(i8 signext %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 8, i32* %2
br label %28
27: ; preds = %22
store i32 9, i32* %2
br label %28
28: ; preds = %27, %26, %21, %12, %11, %10, %9, %8, %7, %6
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @xlate(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %9 [
i32 0, label %18
i32 34, label %3
i32 39, label %4
i32 123, label %5
i32 125, label %6
i32 36, label %7
i32 92, label %8
]
3: ; preds = %1
br label %18
4: ; preds = %1
br label %18
5: ; preds = %1
br label %18
6: ; preds = %1
br label %18
7: ; preds = %1
br label %18
8: ; preds = %1
br label %18
9: ; preds = %1
%10 = tail call i32 @isalnum(i8 signext %0)
%11 = icmp ne i32 %10, 0
%12 = icmp eq i8 %0, 95
%13 = or i1 %12, %11
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = tail call i32 @isspace(i8 signext %0)
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i32 9, i32 8
br label %18
18: ; preds = %14, %9, %1, %8, %7, %6, %5, %4, %3
%19 = phi i32 [ 6, %8 ], [ 5, %7 ], [ 4, %6 ], [ 3, %5 ], [ 2, %4 ], [ 1, %3 ], [ %2, %1 ], [ 7, %9 ], [ %17, %14 ]
ret i32 %19
}