void ProcessEscapeChars(const char *Input, char *Output) {
  int n;
  bwx_DEBUG(__FUNCTION__);
  n = 0;
  while (*Input != '\0') {
    switch (*Input) {
    case '\n':
      *Output = '\\';
      Output++;
      *Output = 'n';
      Output++;
      break;
    case '\t':
      *Output = '\\';
      Output++;
      *Output = 't';
      Output++;
      break;
    case '\"':
      *Output = '\\';
      Output++;
      *Output = '"';
      Output++;
      break;
    default:
      *Output = *Input;
      Output++;
      break;
    }
    Input++;
    *Output = '\0';
    n++;
    if (n > 60) {
      *Output = '\"';
      Output++;
      *Output = '\n';
      Output++;
      *Output = '\"';
      Output++;
      *Output = '\0';
      n = 0;
    }
  }
}


x86 assembly (clang, -O0):
<ProcessEscapeChars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <bwx_DEBUG@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     128a <ProcessEscapeChars+0x17a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x18(%rbp)
sub    $0x9,%eax
je     11aa <ProcessEscapeChars+0x9a>
jmp    115d <ProcessEscapeChars+0x4d>
mov    -0x18(%rbp),%eax
sub    $0xa,%eax
je     117f <ProcessEscapeChars+0x6f>
jmp    116e <ProcessEscapeChars+0x5e>
mov    -0x18(%rbp),%eax
sub    $0x22,%eax
je     11d5 <ProcessEscapeChars+0xc5>
jmp    1200 <ProcessEscapeChars+0xf0>
mov    -0x10(%rbp),%rax
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x6e,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1218 <ProcessEscapeChars+0x108>
mov    -0x10(%rbp),%rax
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x74,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1218 <ProcessEscapeChars+0x108>
mov    -0x10(%rbp),%rax
movb   $0x5c,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x22,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1218 <ProcessEscapeChars+0x108>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x3c,-0x14(%rbp)
jle    1285 <ProcessEscapeChars+0x175>
mov    -0x10(%rbp),%rax
movb   $0x22,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x22,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x14(%rbp)
jmp    1135 <ProcessEscapeChars+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProcessEscapeChars>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xedf(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <bwx_DEBUG@plt>
mov    (%r14),%al
test   %al,%al
je     11b9 <ProcessEscapeChars+0xa9>
add    $0x1,%r14
jmp    115b <ProcessEscapeChars+0x4b>
nopl   0x0(%rax,%rax,1)
movl   $0x220a22,(%rcx)
add    $0x3,%rcx
xor    %ebp,%ebp
movzbl (%r14),%eax
add    $0x1,%r14
mov    %rcx,%rbx
test   %al,%al
je     11b9 <ProcessEscapeChars+0xa9>
movsbl %al,%ecx
cmp    $0x9,%ecx
je     1190 <ProcessEscapeChars+0x80>
cmp    $0x22,%ecx
je     1180 <ProcessEscapeChars+0x70>
cmp    $0xa,%ecx
jne    11a0 <ProcessEscapeChars+0x90>
movw   $0x6e5c,(%rbx)
mov    $0x2,%eax
jmp    11a7 <ProcessEscapeChars+0x97>
nopl   0x0(%rax)
movw   $0x225c,(%rbx)
mov    $0x2,%eax
jmp    11a7 <ProcessEscapeChars+0x97>
nopl   0x0(%rax)
movw   $0x745c,(%rbx)
mov    $0x2,%eax
jmp    11a7 <ProcessEscapeChars+0x97>
nopl   0x0(%rax)
mov    %al,(%rbx)
mov    $0x1,%eax
lea    (%rbx,%rax,1),%rcx
movb   $0x0,(%rbx,%rax,1)
cmp    $0x3c,%ebp
jge    1140 <ProcessEscapeChars+0x30>
add    $0x1,%ebp
jmp    114c <ProcessEscapeChars+0x3c>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__FUNCTION__.ProcessEscapeChars = [19 x i8] c"ProcessEscapeChars\00"
define void @ProcessEscapeChars(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.ProcessEscapeChars, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %62, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %63
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %37 [
i32 10, label %16
i32 9, label %23
i32 34, label %30
]
16: ; preds = %12
%17 = load i8*, i8** %4
store i8 92, i8* %17
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
%20 = load i8*, i8** %4
store i8 110, i8* %20
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %4
br label %43
23: ; preds = %12
%24 = load i8*, i8** %4
store i8 92, i8* %24
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
%27 = load i8*, i8** %4
store i8 116, i8* %27
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %4
br label %43
30: ; preds = %12
%31 = load i8*, i8** %4
store i8 92, i8* %31
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %4
%34 = load i8*, i8** %4
store i8 34, i8* %34
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %4
br label %43
37: ; preds = %12
%38 = load i8*, i8** %3
%39 = load i8, i8* %38
%40 = load i8*, i8** %4
store i8 %39, i8* %40
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %4
br label %43
43: ; preds = %37, %30, %23, %16
%44 = load i8*, i8** %3
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %3
%46 = load i8*, i8** %4
store i8 0, i8* %46
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
%49 = load i32, i32* %5
%50 = icmp sgt i32 %49, 60
br i1 %50, label %51, label %62
51: ; preds = %43
%52 = load i8*, i8** %4
store i8 34, i8* %52
%53 = load i8*, i8** %4
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %4
%55 = load i8*, i8** %4
store i8 10, i8* %55
%56 = load i8*, i8** %4
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %4
%58 = load i8*, i8** %4
store i8 34, i8* %58
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %4
%61 = load i8*, i8** %4
store i8 0, i8* %61
store i32 0, i32* %5
br label %62
62: ; preds = %51, %43
br label %7
63: ; preds = %7
ret void
}

LLVM IR (-O2):
@__FUNCTION__.ProcessEscapeChars = [19 x i8] c"ProcessEscapeChars\00"
define void @ProcessEscapeChars(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @bwx_DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.ProcessEscapeChars, i64 0, i64 0))
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %34, label %6
6: ; preds = %2, %29
%7 = phi i8 [ %32, %29 ], [ %4, %2 ]
%8 = phi i32 [ %31, %29 ], [ 0, %2 ]
%9 = phi i8* [ %30, %29 ], [ %1, %2 ]
%10 = phi i8* [ %22, %29 ], [ %0, %2 ]
%11 = sext i8 %7 to i32
switch i32 %11, label %18 [
i32 10, label %12
i32 9, label %14
i32 34, label %16
]
12: ; preds = %6
store i8 92, i8* %9
%13 = getelementptr inbounds i8, i8* %9, i64 1
store i8 110, i8* %13
br label %19
14: ; preds = %6
store i8 92, i8* %9
%15 = getelementptr inbounds i8, i8* %9, i64 1
store i8 116, i8* %15
br label %19
16: ; preds = %6
store i8 92, i8* %9
%17 = getelementptr inbounds i8, i8* %9, i64 1
store i8 34, i8* %17
br label %19
18: ; preds = %6
store i8 %7, i8* %9
br label %19
19: ; preds = %18, %16, %14, %12
%20 = phi i64 [ 1, %18 ], [ 2, %16 ], [ 2, %14 ], [ 2, %12 ]
%21 = getelementptr inbounds i8, i8* %9, i64 %20
%22 = getelementptr inbounds i8, i8* %10, i64 1
store i8 0, i8* %21
%23 = add nsw i32 %8, 1
%24 = icmp sgt i32 %8, 59
br i1 %24, label %25, label %29
25: ; preds = %19
store i8 34, i8* %21
%26 = getelementptr inbounds i8, i8* %21, i64 1
store i8 10, i8* %26
%27 = getelementptr inbounds i8, i8* %21, i64 2
store i8 34, i8* %27
%28 = getelementptr inbounds i8, i8* %21, i64 3
store i8 0, i8* %28
br label %29
29: ; preds = %25, %19
%30 = phi i8* [ %28, %25 ], [ %21, %19 ]
%31 = phi i32 [ 0, %25 ], [ %23, %19 ]
%32 = load i8, i8* %22
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %6
34: ; preds = %29, %2
ret void
}