int escape(int in[], int out[]) {
  switch (in[1]) {
  case '\a':
    out[0] = '\\';
    out[1] = 'a';
    return 1;
  case '\b':
    out[0] = '\\';
    out[1] = 'b';
    return 1;
  case '\f':
    out[0] = '\\';
    out[1] = 'f';
    return 1;
  case '\n':
    out[0] = '\\';
    out[1] = 'n';
    return 1;
  case '\r':
    out[0] = '\\';
    out[1] = 'r';
    return 1;
  case '\t':
    out[0] = '\\';
    out[1] = 't';
    return 1;
  case '\v':
    out[0] = '\\';
    out[1] = 'v';
    return 1;
  case '\?':
    out[0] = '\\';
    out[1] = '?';
    return 1;
  case '\'':
    out[0] = '\\';
    out[1] = '\'';
    return 1;
  case '\"':
    out[0] = '\\';
    out[1] = '"';
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<escape>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
add    $0xfffffff9,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x38,%eax
ja     1283 <escape+0x183>
mov    -0x20(%rbp),%rax
lea    0xed0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x61,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x62,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x66,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x6e,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x72,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x74,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x76,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x3f,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x27,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
mov    -0x18(%rbp),%rax
movl   $0x5c,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x22,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    128a <escape+0x18a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<escape>:
mov    0x4(%rdi),%edx
xor    %eax,%eax
lea    -0x7(%rdx),%edi
cmp    $0x38,%edi
ja     1165 <escape+0x65>
mov    $0x61,%r8d
lea    0xee6(%rip),%rcx
movslq (%rcx,%rdi,4),%rdi
add    %rcx,%rdi
jmp    *%rdi
mov    %edx,%r8d
jmp    1156 <escape+0x56>
mov    $0x62,%r8d
jmp    1156 <escape+0x56>
mov    $0x74,%r8d
jmp    1156 <escape+0x56>
mov    $0x6e,%r8d
jmp    1156 <escape+0x56>
mov    $0x66,%r8d
jmp    1156 <escape+0x56>
mov    $0x72,%r8d
jmp    1156 <escape+0x56>
mov    $0x76,%r8d
movl   $0x5c,(%rsi)
mov    %r8d,0x4(%rsi)
mov    $0x1,%eax
ret

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

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