char read_char(char *c, char *to) {
  switch (c[0]) {
  case '\\':
    switch (c[1]) {
    case 'a':
      *to = '\a';
      return 2;
      break;
    case 'b':
      *to = '\b';
      return 2;
      break;
    case 'f':
      *to = '\f';
      return 2;
      break;
    case 'n':
      *to = '\n';
      return 2;
      break;
    case 'r':
      *to = '\r';
      return 2;
      break;
    case 't':
      *to = '\t';
      return 2;
      break;
    case 'v':
      *to = '\v';
      return 2;
      break;
    case '\'':
      *to = '\'';
      return 2;
      break;
    case '\"':
      *to = '\"';
      return 2;
      break;
    case '\\':
      *to = '\\';
      return 2;
      break;
    case '?':
      *to = '\?';
      return 2;
      break;
    default:
      break;
    }
    break;
  default:
    *to = c[0];
    return 1;
    break;
  }
}


x86 assembly (clang, -O0):
<read_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
sub    $0x5c,%al
jne    1207 <read_char+0x107>
jmp    111f <read_char+0x1f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x54,%eax
ja     11fd <read_char+0xfd>
mov    -0x20(%rbp),%rax
lea    0xebc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
movb   $0x7,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0x8,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0xc,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0xa,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0xd,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0x9,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0xb,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0x27,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0x22,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0x5c,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
mov    -0x18(%rbp),%rax
movb   $0x3f,(%rax)
movb   $0x2,-0x1(%rbp)
jmp    1217 <read_char+0x117>
jmp    1202 <read_char+0x102>
jmp    1217 <read_char+0x117>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char>:
mov    (%rdi),%cl
mov    $0x1,%al
cmp    $0x5c,%cl
jne    114f <read_char+0x4f>
movsbl 0x1(%rdi),%edx
add    $0xffffffde,%edx
cmp    $0x54,%edx
ja     1151 <read_char+0x51>
mov    $0x2,%al
mov    $0x7,%cl
lea    0xee0(%rip),%rdi
movslq (%rdi,%rdx,4),%rdx
add    %rdi,%rdx
jmp    *%rdx
mov    $0x22,%cl
jmp    114f <read_char+0x4f>
mov    $0x27,%cl
jmp    114f <read_char+0x4f>
mov    $0x3f,%cl
jmp    114f <read_char+0x4f>
mov    $0x5c,%cl
jmp    114f <read_char+0x4f>
mov    $0x8,%cl
jmp    114f <read_char+0x4f>
mov    $0xc,%cl
jmp    114f <read_char+0x4f>
mov    $0xa,%cl
jmp    114f <read_char+0x4f>
mov    $0xd,%cl
jmp    114f <read_char+0x4f>
mov    $0x9,%cl
jmp    114f <read_char+0x4f>
mov    $0xb,%cl
mov    %cl,(%rsi)
ret

LLVM IR (-O0):
define signext i8 @read_char(i8* %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %39 [
i32 92, label %10
]
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %37 [
i32 97, label %15
i32 98, label %17
i32 102, label %19
i32 110, label %21
i32 114, label %23
i32 116, label %25
i32 118, label %27
i32 39, label %29
i32 34, label %31
i32 92, label %33
i32 63, label %35
]
15: ; preds = %10
%16 = load i8*, i8** %5
store i8 7, i8* %16
store i8 2, i8* %3
br label %44
17: ; preds = %10
%18 = load i8*, i8** %5
store i8 8, i8* %18
store i8 2, i8* %3
br label %44
19: ; preds = %10
%20 = load i8*, i8** %5
store i8 12, i8* %20
store i8 2, i8* %3
br label %44
21: ; preds = %10
%22 = load i8*, i8** %5
store i8 10, i8* %22
store i8 2, i8* %3
br label %44
23: ; preds = %10
%24 = load i8*, i8** %5
store i8 13, i8* %24
store i8 2, i8* %3
br label %44
25: ; preds = %10
%26 = load i8*, i8** %5
store i8 9, i8* %26
store i8 2, i8* %3
br label %44
27: ; preds = %10
%28 = load i8*, i8** %5
store i8 11, i8* %28
store i8 2, i8* %3
br label %44
29: ; preds = %10
%30 = load i8*, i8** %5
store i8 39, i8* %30
store i8 2, i8* %3
br label %44
31: ; preds = %10
%32 = load i8*, i8** %5
store i8 34, i8* %32
store i8 2, i8* %3
br label %44
33: ; preds = %10
%34 = load i8*, i8** %5
store i8 92, i8* %34
store i8 2, i8* %3
br label %44
35: ; preds = %10
%36 = load i8*, i8** %5
store i8 63, i8* %36
store i8 2, i8* %3
br label %44
37: ; preds = %10
br label %38
38: ; preds = %37
br label %44
39: ; preds = %2
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = load i8*, i8** %5
store i8 %42, i8* %43
store i8 1, i8* %3
br label %44
44: ; preds = %15, %17, %19, %21, %23, %25, %27, %29, %31, %33, %35, %39, %38
%45 = load i8, i8* %3
ret i8 %45
}

LLVM IR (-O2):
define signext i8 @read_char(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 92
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
switch i32 %8, label %22 [
i32 97, label %19
i32 98, label %9
i32 102, label %10
i32 110, label %11
i32 114, label %12
i32 116, label %13
i32 118, label %14
i32 39, label %15
i32 34, label %16
i32 92, label %17
i32 63, label %18
]
9: ; preds = %5
br label %19
10: ; preds = %5
br label %19
11: ; preds = %5
br label %19
12: ; preds = %5
br label %19
13: ; preds = %5
br label %19
14: ; preds = %5
br label %19
15: ; preds = %5
br label %19
16: ; preds = %5
br label %19
17: ; preds = %5
br label %19
18: ; preds = %5
br label %19
19: ; preds = %2, %5, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9
%20 = phi i8 [ 8, %9 ], [ 12, %10 ], [ 10, %11 ], [ 13, %12 ], [ 9, %13 ], [ 11, %14 ], [ 39, %15 ], [ 34, %16 ], [ 92, %17 ], [ 63, %18 ], [ 7, %5 ], [ %3, %2 ]
%21 = phi i8 [ 2, %9 ], [ 2, %10 ], [ 2, %11 ], [ 2, %12 ], [ 2, %13 ], [ 2, %14 ], [ 2, %15 ], [ 2, %16 ], [ 2, %17 ], [ 2, %18 ], [ 2, %5 ], [ 1, %2 ]
store i8 %20, i8* %1
br label %22
22: ; preds = %19, %5
%23 = phi i8 [ undef, %5 ], [ %21, %19 ]
ret i8 %23
}