char read_escape_control_char(char c) {
  if (c == 'n')
    return '\n';
  else if (c == 't')
    return '\t';
  else if (c == 'r')
    return '\r';
  else if (c == 'e')
    return '\x1B';
  else if (c == 'b')
    return '\b';
  else if (c == 'f')
    return '\f';
  else if (c == 'v')
    return '\v';
  else if (c == 'a')
    return '\a';
  return c;
}


x86 assembly (clang, -O0):
<read_escape_control_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x6e,%eax
jne    1120 <read_escape_control_char+0x20>
movb   $0xa,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
movsbl -0x2(%rbp),%eax
cmp    $0x74,%eax
jne    1136 <read_escape_control_char+0x36>
movb   $0x9,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
movsbl -0x2(%rbp),%eax
cmp    $0x72,%eax
jne    114c <read_escape_control_char+0x4c>
movb   $0xd,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
movsbl -0x2(%rbp),%eax
cmp    $0x65,%eax
jne    1162 <read_escape_control_char+0x62>
movb   $0x1b,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
movsbl -0x2(%rbp),%eax
cmp    $0x62,%eax
jne    1178 <read_escape_control_char+0x78>
movb   $0x8,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
movsbl -0x2(%rbp),%eax
cmp    $0x66,%eax
jne    118e <read_escape_control_char+0x8e>
movb   $0xc,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
movsbl -0x2(%rbp),%eax
cmp    $0x76,%eax
jne    11a4 <read_escape_control_char+0xa4>
movb   $0xb,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
movsbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jne    11ba <read_escape_control_char+0xba>
movb   $0x7,-0x1(%rbp)
jmp    11e3 <read_escape_control_char+0xe3>
jmp    11bf <read_escape_control_char+0xbf>
jmp    11c4 <read_escape_control_char+0xc4>
jmp    11c9 <read_escape_control_char+0xc9>
jmp    11ce <read_escape_control_char+0xce>
jmp    11d3 <read_escape_control_char+0xd3>
jmp    11d8 <read_escape_control_char+0xd8>
jmp    11dd <read_escape_control_char+0xdd>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_escape_control_char>:
lea    -0x61(%rdi),%ecx
cmp    $0x15,%cl
ja     1123 <read_escape_control_char+0x23>
mov    $0xa,%al
movzbl %cl,%ecx
lea    0xeec(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x7,%al
ret
mov    $0x8,%al
ret
mov    %edi,%eax
ret
mov    $0x1b,%al
ret
mov    $0xc,%al
ret
mov    $0xd,%al
ret
mov    $0x9,%al
ret
mov    $0xb,%al
ret

LLVM IR (-O0):
define signext i8 @read_escape_control_char(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
%6 = icmp eq i32 %5, 110
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 10, i8* %2
br label %52
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 116
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 9, i8* %2
br label %52
13: ; preds = %8
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 114
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 13, i8* %2
br label %52
18: ; preds = %13
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 101
br i1 %21, label %22, label %23
22: ; preds = %18
store i8 27, i8* %2
br label %52
23: ; preds = %18
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 98
br i1 %26, label %27, label %28
27: ; preds = %23
store i8 8, i8* %2
br label %52
28: ; preds = %23
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 102
br i1 %31, label %32, label %33
32: ; preds = %28
store i8 12, i8* %2
br label %52
33: ; preds = %28
%34 = load i8, i8* %3
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 118
br i1 %36, label %37, label %38
37: ; preds = %33
store i8 11, i8* %2
br label %52
38: ; preds = %33
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 97
br i1 %41, label %42, label %43
42: ; preds = %38
store i8 7, i8* %2
br label %52
43: ; preds = %38
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49
%51 = load i8, i8* %3
store i8 %51, i8* %2
br label %52
52: ; preds = %50, %42, %37, %32, %27, %22, %17, %12, %7
%53 = load i8, i8* %2
ret i8 %53
}

LLVM IR (-O2):
define signext i8 @read_escape_control_char(i8 signext %0) {
switch i8 %0, label %9 [
i8 110, label %10
i8 116, label %2
i8 114, label %3
i8 101, label %4
i8 98, label %5
i8 102, label %6
i8 118, label %7
i8 97, label %8
]
2: ; preds = %1
br label %10
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3, %2
%11 = phi i8 [ 9, %2 ], [ 13, %3 ], [ 27, %4 ], [ 8, %5 ], [ 12, %6 ], [ 11, %7 ], [ 7, %8 ], [ %0, %9 ], [ 10, %1 ]
ret i8 %11
}