char parse_char(char *cc) {
  if (*cc == '\\') {
    switch (*(++cc)) {
    case 'n':
      return '\n';
    case 'r':
      return '\r';
    case '\'':
      return '\'';
    case '\"':
      return '\"';
    case '0':
      return '\0';
    case 'v':
      return '\v';
    case '\\':
      return '\\';
    default:
      return 0;
    }
  } else
    return *cc;
}


x86 assembly (clang, -O0):
<parse_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11ea <parse_char+0xea>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x22,%eax
je     11bd <parse_char+0xbd>
jmp    113c <parse_char+0x3c>
mov    -0x14(%rbp),%eax
sub    $0x27,%eax
je     11b4 <parse_char+0xb4>
jmp    114d <parse_char+0x4d>
mov    -0x14(%rbp),%eax
sub    $0x30,%eax
je     11c6 <parse_char+0xc6>
jmp    115e <parse_char+0x5e>
mov    -0x14(%rbp),%eax
sub    $0x5c,%eax
je     11d8 <parse_char+0xd8>
jmp    116f <parse_char+0x6f>
mov    -0x14(%rbp),%eax
sub    $0x6e,%eax
je     11a2 <parse_char+0xa2>
jmp    1180 <parse_char+0x80>
mov    -0x14(%rbp),%eax
sub    $0x72,%eax
je     11ab <parse_char+0xab>
jmp    1191 <parse_char+0x91>
mov    -0x14(%rbp),%eax
sub    $0x76,%eax
je     11cf <parse_char+0xcf>
jmp    11e1 <parse_char+0xe1>
movb   $0xa,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
movb   $0xd,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
movb   $0x27,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
movb   $0x22,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
movb   $0x0,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
movb   $0xb,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
movb   $0x5c,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
movb   $0x0,-0x1(%rbp)
jmp    11f3 <parse_char+0xf3>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_char>:
mov    (%rdi),%al
cmp    $0x5c,%al
jne    112b <parse_char+0x2b>
movsbl 0x1(%rdi),%ecx
cmp    $0x5b,%ecx
jle    112c <parse_char+0x2c>
add    $0xffffffa4,%ecx
cmp    $0x1a,%ecx
ja     1139 <parse_char+0x39>
mov    $0xa,%al
lea    0xee0(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x5c,%al
ret
cmp    $0x22,%ecx
je     1142 <parse_char+0x42>
cmp    $0x27,%ecx
je     1145 <parse_char+0x45>
cmp    $0x30,%ecx
xor    %eax,%eax
ret
mov    $0xd,%al
ret
mov    $0xb,%al
ret
mov    $0x22,%al
ret
mov    $0x27,%al
ret

LLVM IR (-O0):
define signext i8 @parse_char(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 92
br i1 %7, label %8, label %21
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %20 [
i32 110, label %13
i32 114, label %14
i32 39, label %15
i32 34, label %16
i32 48, label %17
i32 118, label %18
i32 92, label %19
]
13: ; preds = %8
store i8 10, i8* %2
br label %24
14: ; preds = %8
store i8 13, i8* %2
br label %24
15: ; preds = %8
store i8 39, i8* %2
br label %24
16: ; preds = %8
store i8 34, i8* %2
br label %24
17: ; preds = %8
store i8 0, i8* %2
br label %24
18: ; preds = %8
store i8 11, i8* %2
br label %24
19: ; preds = %8
store i8 92, i8* %2
br label %24
20: ; preds = %8
store i8 0, i8* %2
br label %24
21: ; preds = %1
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
store i8 %23, i8* %2
br label %24
24: ; preds = %21, %20, %19, %18, %17, %16, %15, %14, %13
%25 = load i8, i8* %2
ret i8 %25
}

LLVM IR (-O2):
define signext i8 @parse_char(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 92
br i1 %3, label %4, label %15
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %14 [
i32 110, label %15
i32 114, label %8
i32 39, label %9
i32 34, label %10
i32 48, label %11
i32 118, label %12
i32 92, label %13
]
8: ; preds = %4
br label %15
9: ; preds = %4
br label %15
10: ; preds = %4
br label %15
11: ; preds = %4
br label %15
12: ; preds = %4
br label %15
13: ; preds = %4
br label %15
14: ; preds = %4
br label %15
15: ; preds = %1, %4, %14, %13, %12, %11, %10, %9, %8
%16 = phi i8 [ 0, %14 ], [ 92, %13 ], [ 11, %12 ], [ 0, %11 ], [ 34, %10 ], [ 39, %9 ], [ 13, %8 ], [ 10, %4 ], [ %2, %1 ]
ret i8 %16
}