const char *CL_TranslateStringBuf(const char *string) {
  char *p;
  int i, l;
  static char buf[32000];
  CL_TranslateString(string, buf);
  while ((p = strstr(buf, "\\n")) != ((void *)0)) {
    *p = '\n';
    p++;
    l = strlen(p);
    for (i = 0; i < l; i++) {
      *p = *(p + 1);
      p++;
    }
  }
  return buf;
}


x86 assembly (clang, -O0):
<CL_TranslateStringBuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0x2f09(%rip),%rsi
mov    $0x0,%al
call   1040 <CL_TranslateString@plt>
lea    0x2efb(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11cd <CL_TranslateStringBuf+0x9d>
mov    -0x10(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11c8 <CL_TranslateStringBuf+0x98>
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1195 <CL_TranslateStringBuf+0x65>
jmp    114e <CL_TranslateStringBuf+0x1e>
lea    0x2e7c(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_TranslateStringBuf>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0x2f01(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <CL_TranslateString@plt>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     11b9 <CL_TranslateStringBuf+0x79>
mov    %rax,%rbx
lea    0x2ed9(%rip),%r14
lea    0xe82(%rip),%r15
jmp    1193 <CL_TranslateStringBuf+0x53>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strstr@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11b9 <CL_TranslateStringBuf+0x79>
movb   $0xa,(%rbx)
lea    0x1(%rbx),%r12
mov    %r12,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1180 <CL_TranslateStringBuf+0x40>
add    $0x2,%rbx
mov    %eax,%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <memmove@plt>
jmp    1180 <CL_TranslateStringBuf+0x40>
lea    0x2e90(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@CL_TranslateStringBuf.buf = internal global [32000 x i8] zeroinitializer
@.str = [3 x i8] c"\\n\00"
define i8* @CL_TranslateStringBuf(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @CL_TranslateString to i32 (i8*, i8*, ...)*)(i8* %6, i8* getelementptr inbounds ([32000 x i8], [32000 x i8]* @CL_TranslateStringBuf.buf, i64 0, i64 0))
br label %8
8: ; preds = %32, %1
%9 = call i8* @strstr(i8* getelementptr inbounds ([32000 x i8], [32000 x i8]* @CL_TranslateStringBuf.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %33
11: ; preds = %8
%12 = load i8*, i8** %3
store i8 10, i8* %12
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = call i64 @strlen(i8* %15)
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
store i32 0, i32* %4
br label %18
18: ; preds = %29, %11
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = load i8*, i8** %3
store i8 %25, i8* %26
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
br label %29
29: ; preds = %22
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %18
32: ; preds = %18
br label %8
33: ; preds = %8
ret i8* getelementptr inbounds ([32000 x i8], [32000 x i8]* @CL_TranslateStringBuf.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@CL_TranslateStringBuf.buf = internal global [32000 x i8] zeroinitializer
@.str = [3 x i8] c"\\n\00"
define i8* @CL_TranslateStringBuf(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @CL_TranslateString to i32 (i8*, i8*, ...)*)(i8* %0, i8* getelementptr inbounds ([32000 x i8], [32000 x i8]* @CL_TranslateStringBuf.buf, i64 0, i64 0))
%3 = tail call i8* @strstr(i8* dereferenceable(1) getelementptr inbounds ([32000 x i8], [32000 x i8]* @CL_TranslateStringBuf.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %17, label %8
5: ; preds = %14, %8
%6 = tail call i8* @strstr(i8* dereferenceable(1) getelementptr inbounds ([32000 x i8], [32000 x i8]* @CL_TranslateStringBuf.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %17, label %8
8: ; preds = %1, %5
%9 = phi i8* [ %6, %5 ], [ %3, %1 ]
store i8 10, i8* %9
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = tail call i64 @strlen(i8* %10)
%12 = trunc i64 %11 to i32
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %8
%15 = getelementptr i8, i8* %9, i64 2
%16 = and i64 %11, 4294967295
br label %5
17: ; preds = %5, %1
ret i8* getelementptr inbounds ([32000 x i8], [32000 x i8]* @CL_TranslateStringBuf.buf, i64 0, i64 0)
}