#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*/ dont_escape(char *, char *);
int /*<<< orphan*/ escape(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char s[20];
  char t[20] = "1:\tYo\ffoo\n";
  char s2[20];
  char t2[20] = "1:\\tYo\\ffoo\\n";
  escape(s, t);
  printf("%s\n", s);
  dont_escape(s2, t2);
  printf("%s\n", s2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xeb5(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xeb3(%rip),%eax
mov    %eax,-0x70(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <escape@plt>
lea    -0x20(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <dont_escape@plt>
lea    -0x60(%rbp),%rsi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0x60(%rsp),%rbx
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <escape@plt>
lea    0xebd(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0x40(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <dont_escape@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.t = [20 x i8] c"1:\09Yo\0Cfoo\0A\00\00\00\00\00\00\00\00\00\00"
@__const.main.t2 = [20 x i8] c"1:\\tYo\\ffoo\\n\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
store i32 0, i32* %1
%6 = bitcast [20 x i8]* %3 to i8*
%7 = bitcast [20 x i8]* %5 to i8*
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = call i32 @escape(i8* %8, i8* %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%15 = call i32 @dont_escape(i8* %13, i8* %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.t = [20 x i8] c"1:\09Yo\0Cfoo\0A\00\00\00\00\00\00\00\00\00\00"
@__const.main.t2 = [20 x i8] c"1:\\tYo\\ffoo\\n\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = call i32 @escape(i8* %5, i8* %6)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%11 = call i32 @dont_escape(i8* %7, i8* %8)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}