void DoEscapes(char *pDest, unsigned char *pSrc) {
  unsigned char *ps;
  char *pd;
  ;
  for (ps = pSrc, pd = pDest; *ps;) {
    switch (*ps) {
    case '"':
      ps++;
      break;
    case '\\':
      ps++;
      switch (*ps++) {
      case 't':
        *pd++ = 0x09;
        break;
      case 'n':
        *pd++ = 0x0A;
        break;
      case 'v':
        *pd++ = 0x0B;
        break;
      case 'f':
        *pd++ = 0x0C;
        break;
      case 'r':
        *pd++ = 0x0D;
        break;
      default:
        *pd = *(ps - 1);
      }
      break;
    default:
      *pd++ = *ps++;
    }
  }
  *pd = 0;
  ;
}


x86 assembly (clang, -O0):
<DoEscapes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1253 <DoEscapes+0x153>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x24(%rbp)
sub    $0x22,%eax
je     1152 <DoEscapes+0x52>
jmp    1141 <DoEscapes+0x41>
mov    -0x24(%rbp),%eax
sub    $0x5c,%eax
je     1163 <DoEscapes+0x63>
jmp    122c <DoEscapes+0x12c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    124e <DoEscapes+0x14e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%eax
add    $0xffffff9a,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x10,%eax
ja     121a <DoEscapes+0x11a>
mov    -0x30(%rbp),%rax
lea    0xe62(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x9,(%rax)
jmp    1227 <DoEscapes+0x127>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0xa,(%rax)
jmp    1227 <DoEscapes+0x127>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0xb,(%rax)
jmp    1227 <DoEscapes+0x127>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0xc,(%rax)
jmp    1227 <DoEscapes+0x127>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0xd,(%rax)
jmp    1227 <DoEscapes+0x127>
mov    -0x18(%rbp),%rax
mov    -0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
jmp    124e <DoEscapes+0x14e>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    111c <DoEscapes+0x1c>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoEscapes>:
lea    0xef9(%rip),%rax
jmp    1110 <DoEscapes+0x10>
movb   $0xd,(%rdi)
add    $0x1,%rdi
movzbl (%rsi),%ecx
cmp    $0x22,%cl
je     1130 <DoEscapes+0x30>
cmp    $0x5c,%cl
je     1140 <DoEscapes+0x40>
test   %cl,%cl
je     1183 <DoEscapes+0x83>
add    $0x1,%rsi
mov    %cl,(%rdi)
add    $0x1,%rdi
jmp    1110 <DoEscapes+0x10>
nopl   (%rax)
add    $0x1,%rsi
jmp    1110 <DoEscapes+0x10>
cs nopw 0x0(%rax,%rax,1)
movzbl 0x1(%rsi),%ecx
add    $0x2,%rsi
lea    -0x66(%rcx),%edx
ror    %edx
cmp    $0x8,%edx
ja     1164 <DoEscapes+0x64>
movslq (%rax,%rdx,4),%rdx
add    %rax,%rdx
jmp    *%rdx
movb   $0xc,(%rdi)
add    $0x1,%rdi
jmp    1110 <DoEscapes+0x10>
mov    %cl,(%rdi)
jmp    1110 <DoEscapes+0x10>
movb   $0xa,(%rdi)
add    $0x1,%rdi
jmp    1110 <DoEscapes+0x10>
movb   $0x9,(%rdi)
add    $0x1,%rdi
jmp    1110 <DoEscapes+0x10>
movb   $0xb,(%rdi)
add    $0x1,%rdi
jmp    1110 <DoEscapes+0x10>
movb   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @DoEscapes(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
store i8* %7, i8** %5
%8 = load i8*, i8** %3
store i8* %8, i8** %6
br label %9
9: ; preds = %54, %2
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %55
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
switch i32 %16, label %48 [
i32 34, label %17
i32 92, label %20
]
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
br label %54
20: ; preds = %13
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %5
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
%25 = load i8, i8* %23
%26 = zext i8 %25 to i32
switch i32 %26, label %42 [
i32 116, label %27
i32 110, label %30
i32 118, label %33
i32 102, label %36
i32 114, label %39
]
27: ; preds = %20
%28 = load i8*, i8** %6
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %6
store i8 9, i8* %28
br label %47
30: ; preds = %20
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %6
store i8 10, i8* %31
br label %47
33: ; preds = %20
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %6
store i8 11, i8* %34
br label %47
36: ; preds = %20
%37 = load i8*, i8** %6
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %6
store i8 12, i8* %37
br label %47
39: ; preds = %20
%40 = load i8*, i8** %6
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %6
store i8 13, i8* %40
br label %47
42: ; preds = %20
%43 = load i8*, i8** %5
%44 = getelementptr inbounds i8, i8* %43, i64 -1
%45 = load i8, i8* %44
%46 = load i8*, i8** %6
store i8 %45, i8* %46
br label %47
47: ; preds = %42, %39, %36, %33, %30, %27
br label %54
48: ; preds = %13
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %5
%51 = load i8, i8* %49
%52 = load i8*, i8** %6
%53 = getelementptr inbounds i8, i8* %52, i32 1
store i8* %53, i8** %6
store i8 %51, i8* %52
br label %54
54: ; preds = %48, %47, %17
br label %9
55: ; preds = %9
%56 = load i8*, i8** %6
store i8 0, i8* %56
ret void
}

LLVM IR (-O2):
define void @DoEscapes(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %18, %2
%4 = phi i8* [ %1, %2 ], [ %19, %18 ]
%5 = phi i8* [ %0, %2 ], [ %20, %18 ]
%6 = load i8, i8* %4
switch i8 %6, label %30 [
i8 0, label %33
i8 34, label %7
i8 92, label %9
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
br label %18
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = getelementptr inbounds i8, i8* %4, i64 2
%12 = load i8, i8* %10
%13 = zext i8 %12 to i32
%14 = add nsw i32 %13, -102
%15 = tail call i32 @llvm.fshl.i32(i32 %14, i32 %14, i32 31)
switch i32 %15, label %29 [
i32 7, label %16
i32 4, label %21
i32 8, label %23
i32 0, label %25
i32 6, label %27
]
16: ; preds = %9
%17 = getelementptr inbounds i8, i8* %5, i64 1
store i8 9, i8* %5
br label %18
18: ; preds = %16, %21, %23, %25, %27, %29, %30, %7
%19 = phi i8* [ %31, %30 ], [ %11, %29 ], [ %11, %27 ], [ %11, %25 ], [ %11, %23 ], [ %11, %21 ], [ %11, %16 ], [ %8, %7 ]
%20 = phi i8* [ %32, %30 ], [ %5, %29 ], [ %28, %27 ], [ %26, %25 ], [ %24, %23 ], [ %22, %21 ], [ %17, %16 ], [ %5, %7 ]
br label %3
21: ; preds = %9
%22 = getelementptr inbounds i8, i8* %5, i64 1
store i8 10, i8* %5
br label %18
23: ; preds = %9
%24 = getelementptr inbounds i8, i8* %5, i64 1
store i8 11, i8* %5
br label %18
25: ; preds = %9
%26 = getelementptr inbounds i8, i8* %5, i64 1
store i8 12, i8* %5
br label %18
27: ; preds = %9
%28 = getelementptr inbounds i8, i8* %5, i64 1
store i8 13, i8* %5
br label %18
29: ; preds = %9
store i8 %12, i8* %5
br label %18
30: ; preds = %3
%31 = getelementptr inbounds i8, i8* %4, i64 1
%32 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %6, i8* %5
br label %18
33: ; preds = %3
store i8 0, i8* %5
ret void
}