#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(void) {
  char s[200];
  char p[200];
  char t[200] = "ab\tc\nd";
  escape(s, t);
  printf("%s\n--\n", t);
  printf("%s\n--\n", s);
  unescape(p, s);
  printf("%s\n--\n", s);
  printf("%s\n--\n", p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x270(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1040 <memset@plt>
movb   $0x61,-0x270(%rbp)
movb   $0x62,-0x26f(%rbp)
movb   $0x9,-0x26e(%rbp)
movb   $0x63,-0x26d(%rbp)
movb   $0xa,-0x26c(%rbp)
movb   $0x64,-0x26b(%rbp)
lea    -0xd0(%rbp),%rdi
lea    -0x270(%rbp),%rsi
call   1060 <escape@plt>
lea    -0x270(%rbp),%rsi
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
lea    -0xd0(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1050 <unescape@plt>
lea    -0xd0(%rbp),%rsi
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rsi
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x270,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0xc0(%rsp)
movl   $0x63096261,(%rsp)
movw   $0x640a,0x4(%rsp)
lea    0x1a0(%rsp),%r15
mov    %rsp,%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <escape@plt>
lea    0xe43(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    0xd0(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <unescape@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x270,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s\0A--\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i8]
%3 = alloca [200 x i8]
%4 = alloca [200 x i8]
store i32 0, i32* %1
%5 = bitcast [200 x i8]* %4 to i8*
%6 = bitcast i8* %5 to [200 x i8]*
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i32 0, i32 0
store i8 97, i8* %7
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i32 0, i32 1
store i8 98, i8* %8
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i32 0, i32 2
store i8 9, i8* %9
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i32 0, i32 3
store i8 99, i8* %10
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i32 0, i32 4
store i8 10, i8* %11
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i32 0, i32 5
store i8 100, i8* %12
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%15 = call i32 @escape(i8* %13, i8* %14)
%16 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%22 = call i32 @unescape(i8* %20, i8* %21)
%23 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%26 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s\0A--\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = alloca [200 x i8]
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
store i8 97, i8* %6
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 1
store i8 98, i8* %7
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 2
store i8 9, i8* %8
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 3
store i8 99, i8* %9
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 4
store i8 10, i8* %10
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 5
store i8 100, i8* %11
%12 = call i32 @escape(i8* %4, i8* %6)
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6)
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4)
%15 = call i32 @unescape(i8* %5, i8* %4)
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4)
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}