#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ escape(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ unescape(char *, char *);
int main() {
  char src[80] = "foo\nbar\t\tbaz\nnozzle";
  char dest[80] = "";
  escape(dest, src);
  printf("%s\n", dest);
  unescape(dest, src);
  printf("%s\n", dest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1070 <escape@plt>
lea    -0xb0(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <unescape@plt>
lea    -0xb0(%rbp),%rsi
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
movaps 0xefd(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe87(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
lea    0x50(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <escape@plt>
lea    0xe9d(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <unescape@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.src = [80 x i8] c"foo\0Abar\09\09baz\0Anozzle\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
store i32 0, i32* %1
%4 = bitcast [80 x i8]* %2 to i8*
%5 = bitcast [80 x i8]* %3 to i8*
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = call i32 @escape(i8* %6, i8* %7)
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%13 = call i32 @unescape(i8* %11, i8* %12)
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.src = [80 x i8] c"foo\0Abar\09\09baz\0Anozzle\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = call i32 @escape(i8* %4, i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i32 @unescape(i8* %4, i8* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}