char *pstrunescape(char *str) {
  char *ch;
  char *esc;
  char *ptr;
  for (ptr = ch = str; *ch; ch++, ptr++) {
    if (*ch == '\\' && *(ch + 1)) {
      for (esc = "n\nt\tr\rb\bf\fv\va\a'\'\"\""; *esc; esc += 2)
        if (*(ch + 1) == *esc) {
          *ptr = *(esc + 1);
          ch++;
          break;
        }
    } else
      *ptr = *ch;
  }
  *ptr = '\0';
  return str;
}


x86 assembly (clang, -O0):
<pstrunescape>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d8 <pstrunescape+0xd8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11aa <pstrunescape+0xaa>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     11aa <pstrunescape+0xaa>
lea    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a5 <pstrunescape+0xa5>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    118f <pstrunescape+0x8f>
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a5 <pstrunescape+0xa5>
jmp    1194 <pstrunescape+0x94>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    114d <pstrunescape+0x4d>
jmp    11b6 <pstrunescape+0xb6>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
jmp    11bb <pstrunescape+0xbb>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1114 <pstrunescape+0x14>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pstrunescape>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%rax
lea    0x1040(%rip),%rsi
lea    0xee5(%rip),%rdx
lea    0x1040(%rip),%r9
lea    0x1037(%rip),%r10
lea    0x102a(%rip),%r11
lea    0x1025(%rip),%r14
lea    0x101a(%rip),%r15
lea    0x1011(%rip),%r12
lea    0x1012(%rip),%r13
mov    %rdi,%rbx
jmp    116e <pstrunescape+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %cl,%cl
je     11da <pstrunescape+0xda>
mov    %cl,(%rdi)
add    $0x1,%rbx
add    $0x1,%rdi
movzbl (%rbx),%ecx
cmp    $0x5c,%cl
jne    1160 <pstrunescape+0x60>
movzbl 0x1(%rbx),%ebp
lea    -0x22(%rbp),%r8d
cmp    $0x54,%r8b
ja     119d <pstrunescape+0x9d>
movzbl %r8b,%ecx
movslq (%rdx,%rcx,4),%rbp
add    %rdx,%rbp
mov    %rsi,%rcx
jmp    *%rbp
lea    0xfc9(%rip),%rcx
jmp    11d0 <pstrunescape+0xd0>
test   %bpl,%bpl
je     1164 <pstrunescape+0x64>
jmp    1166 <pstrunescape+0x66>
mov    %r9,%rcx
jmp    11d0 <pstrunescape+0xd0>
mov    %r10,%rcx
jmp    11d0 <pstrunescape+0xd0>
mov    %r11,%rcx
jmp    11d0 <pstrunescape+0xd0>
mov    %r14,%rcx
jmp    11d0 <pstrunescape+0xd0>
mov    %r15,%rcx
jmp    11d0 <pstrunescape+0xd0>
mov    %r12,%rcx
jmp    11d0 <pstrunescape+0xd0>
mov    %r13,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
movzbl 0x1(%rcx),%ecx
jmp    1164 <pstrunescape+0x64>
movb   $0x0,(%rdi)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"n\0At\09r\0Db\08f\0Cv\0Ba\07''\22\22\00"
define i8* @pstrunescape(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %53, %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %58
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 92
br i1 %15, label %16, label %48
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %48
22: ; preds = %16
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %4
br label %23
23: ; preds = %44, %22
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = icmp ne i8 %25, 0
br i1 %26, label %27, label %47
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %31, %34
br i1 %35, label %36, label %43
36: ; preds = %27
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i64 1
%39 = load i8, i8* %38
%40 = load i8*, i8** %5
store i8 %39, i8* %40
%41 = load i8*, i8** %3
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %3
br label %47
43: ; preds = %27
br label %44
44: ; preds = %43
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i64 2
store i8* %46, i8** %4
br label %23
47: ; preds = %36, %23
br label %52
48: ; preds = %16, %11
%49 = load i8*, i8** %3
%50 = load i8, i8* %49
%51 = load i8*, i8** %5
store i8 %50, i8* %51
br label %52
52: ; preds = %48, %47
br label %53
53: ; preds = %52
%54 = load i8*, i8** %3
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %3
%56 = load i8*, i8** %5
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %5
br label %7
58: ; preds = %7
%59 = load i8*, i8** %5
store i8 0, i8* %59
%60 = load i8*, i8** %2
ret i8* %60
}

LLVM IR (-O2):
@.str = [19 x i8] c"n\0At\09r\0Db\08f\0Cv\0Ba\07''\22\22\00"
define i8* @pstrunescape(i8* returned %0) {
br label %2
2: ; preds = %24, %1
%3 = phi i8* [ %0, %1 ], [ %26, %24 ]
%4 = phi i8* [ %0, %1 ], [ %27, %24 ]
%5 = load i8, i8* %3
switch i8 %5, label %21 [
i8 0, label %28
i8 92, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = load i8, i8* %7
switch i8 %8, label %24 [
i8 0, label %21
i8 110, label %17
i8 116, label %9
i8 114, label %10
i8 98, label %11
i8 102, label %12
i8 118, label %13
i8 97, label %14
i8 39, label %15
i8 34, label %16
]
9: ; preds = %6
br label %17
10: ; preds = %6
br label %17
11: ; preds = %6
br label %17
12: ; preds = %6
br label %17
13: ; preds = %6
br label %17
14: ; preds = %6
br label %17
15: ; preds = %6
br label %17
16: ; preds = %6
br label %17
17: ; preds = %6, %16, %15, %14, %13, %12, %11, %10, %9
%18 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 2), %9 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 4), %10 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 6), %11 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 8), %12 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 10), %13 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 12), %14 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 14), %15 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 16), %16 ]
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
br label %21
21: ; preds = %2, %6, %17
%22 = phi i8 [ %20, %17 ], [ %5, %6 ], [ %5, %2 ]
%23 = phi i8* [ %7, %17 ], [ %3, %6 ], [ %3, %2 ]
store i8 %22, i8* %4
br label %24
24: ; preds = %21, %6
%25 = phi i8* [ %3, %6 ], [ %23, %21 ]
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = getelementptr inbounds i8, i8* %4, i64 1
br label %2
28: ; preds = %2
store i8 0, i8* %4
ret i8* %0
}