#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 teststr1[100] = "This is a test string of special characters: \\a, \\b, "
                       "\\f, \\n, \\r, \\t, \\v, \\', \x5C\x22, \\?";
  char teststr2[100] = "";
  char teststr3[100] = "";
  unescape(teststr1, teststr2);
  escape(teststr2, teststr3);
  printf("Test String 1: %s\n", teststr1);
  printf("Test String 2: %s\n", teststr2);
  printf("Test String 3: %s\n", teststr3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x150,%rsp
movaps 0xf0d(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xe91(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xe72(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movl   $0x0,0x140(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movl   $0x0,0xd0(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe0(%rsp),%r14
lea    0x70(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <unescape@plt>
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <escape@plt>
lea    0xe36(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xe3e(%rip),%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.teststr1 = [100 x i8] c"This is a test string of special characters: \\a, \\b, \\f, \\n, \\r, \\t, \\v, \\', \\\22, \\?\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [19 x i8] c"Test String 1: %s\0A\00"
@.str.1 = [19 x i8] c"Test String 2: %s\0A\00"
@.str.2 = [19 x i8] c"Test String 3: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
store i32 0, i32* %1
%5 = bitcast [100 x i8]* %2 to i8*
%6 = bitcast [100 x i8]* %3 to i8*
%7 = bitcast [100 x i8]* %4 to i8*
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call i32 @unescape(i8* %8, i8* %9)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%13 = call i32 @escape(i8* %11, i8* %12)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.teststr1 = [100 x i8] c"This is a test string of special characters: \\a, \\b, \\f, \\n, \\r, \\t, \\v, \\', \\\22, \\?\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [19 x i8] c"Test String 1: %s\0A\00"
@.str.1 = [19 x i8] c"Test String 2: %s\0A\00"
@.str.2 = [19 x i8] c"Test String 3: %s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = call i32 @unescape(i8* %4, i8* %5)
%8 = call i32 @escape(i8* %5, i8* %6)
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}