char char_unesc(char u) {
  switch (u) {
  case 'a':
    return '\a';
  case 'b':
    return '\b';
  case 'f':
    return '\f';
  case 'n':
    return '\n';
  case 'r':
    return '\r';
  case 't':
    return '\t';
  case 'v':
    return '\v';
  case '\\':
    return '\\';
  case '\'':
    return '\'';
  case '\"':
    return '\"';
  case '\?':
    return '\?';
  default:
    return u;
  }
}


x86 assembly (clang, -O0):
<char_unesc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x54,%eax
ja     1197 <char_unesc+0x97>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x7,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0x8,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0xc,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0xa,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0xd,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0x9,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0xb,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0x5c,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0x27,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0x22,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
movb   $0x3f,-0x1(%rbp)
jmp    119d <char_unesc+0x9d>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_unesc>:
lea    -0x22(%rdi),%ecx
cmp    $0x54,%ecx
ja     111d <char_unesc+0x1d>
mov    $0x7,%al
lea    0xeef(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x22,%al
ret
mov    %edi,%eax
ret
mov    $0x27,%al
ret
mov    $0x3f,%al
ret
mov    $0x5c,%al
ret
mov    $0x8,%al
ret
mov    $0xc,%al
ret
mov    $0xa,%al
ret
mov    $0xd,%al
ret
mov    $0x9,%al
ret
mov    $0xb,%al
ret

LLVM IR (-O0):
define signext i8 @char_unesc(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %17 [
i32 97, label %6
i32 98, label %7
i32 102, label %8
i32 110, label %9
i32 114, label %10
i32 116, label %11
i32 118, label %12
i32 92, label %13
i32 39, label %14
i32 34, label %15
i32 63, label %16
]
6: ; preds = %1
store i8 7, i8* %2
br label %19
7: ; preds = %1
store i8 8, i8* %2
br label %19
8: ; preds = %1
store i8 12, i8* %2
br label %19
9: ; preds = %1
store i8 10, i8* %2
br label %19
10: ; preds = %1
store i8 13, i8* %2
br label %19
11: ; preds = %1
store i8 9, i8* %2
br label %19
12: ; preds = %1
store i8 11, i8* %2
br label %19
13: ; preds = %1
store i8 92, i8* %2
br label %19
14: ; preds = %1
store i8 39, i8* %2
br label %19
15: ; preds = %1
store i8 34, i8* %2
br label %19
16: ; preds = %1
store i8 63, i8* %2
br label %19
17: ; preds = %1
%18 = load i8, i8* %3
store i8 %18, i8* %2
br label %19
19: ; preds = %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @char_unesc(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %13 [
i32 97, label %14
i32 98, label %3
i32 102, label %4
i32 110, label %5
i32 114, label %6
i32 116, label %7
i32 118, label %8
i32 92, label %9
i32 39, label %10
i32 34, label %11
i32 63, label %12
]
3: ; preds = %1
br label %14
4: ; preds = %1
br label %14
5: ; preds = %1
br label %14
6: ; preds = %1
br label %14
7: ; preds = %1
br label %14
8: ; preds = %1
br label %14
9: ; preds = %1
br label %14
10: ; preds = %1
br label %14
11: ; preds = %1
br label %14
12: ; preds = %1
br label %14
13: ; preds = %1
br label %14
14: ; preds = %1, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
%15 = phi i8 [ %0, %13 ], [ 63, %12 ], [ 34, %11 ], [ 39, %10 ], [ 92, %9 ], [ 11, %8 ], [ 9, %7 ], [ 13, %6 ], [ 10, %5 ], [ 12, %4 ], [ 8, %3 ], [ 7, %1 ]
ret i8 %15
}