#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 t[] = "he\tllo\n";
  char s[10];
  char w[10];
  printf("Original String = '%s'\n", t);
  escape(s, t);
  printf("Escaped String = '%s'\n", s);
  unescape(s, w);
  printf("Unescaped String = '%s'\n", w);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    -0x16(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <escape@plt>
lea    -0x16(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    -0x16(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <unescape@plt>
lea    -0x20(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movabs $0xa6f6c6c096568,%rax
mov    %rax,0x8(%rsp)
lea    0xeb3(%rip),%rdi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0x1e(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <escape@plt>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0x14(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <unescape@plt>
lea    0xe9f(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.t = [8 x i8] c"he\09llo\0A\00"
@.str = [24 x i8] c"Original String = '%s'\0A\00"
@.str.1 = [23 x i8] c"Escaped String = '%s'\0A\00"
@.str.2 = [25 x i8] c"Unescaped String = '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
store i32 0, i32* %1
%5 = bitcast [8 x i8]* %2 to i8*
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%10 = call i32 @escape(i8* %8, i8* %9)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%15 = call i32 @unescape(i8* %13, i8* %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Original String = '%s'\0A\00"
@.str.1 = [23 x i8] c"Escaped String = '%s'\0A\00"
@.str.2 = [25 x i8] c"Unescaped String = '%s'\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = bitcast i64* %1 to i8*
store i64 2937261226812776, i64* %1
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = call i32 @escape(i8* %5, i8* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%10 = call i32 @unescape(i8* %5, i8* %6)
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}