#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*/ fromEscape(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ toEscape(char *, char *);
int main() {
  char oldString[15] = "fish	tab there";
  char newString[15 + 2] = "";
  for (int i = 0; i < (15 + 2) - 1; i++) {
    newString[i] = ' ';
    printf("This is ... %d\n", i);
  }
  for (int i = 0; oldString[i] != '\0'; i++) {
    printf("old string: %d\n", i);
  }
  for (int i = 0; newString[i] != '\0'; i++) {
    printf("new string: %d\n", i);
  }
  toEscape(newString, oldString);
  char evenNewerString[15];
  for (int i = 0; i < 15; i++) {
    evenNewerString[i] = ' ';
  }
  fromEscape(evenNewerString, newString);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xea8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xea2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe9a(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1050 <memset@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jge    11be <main+0x7e>
movslq -0x34(%rbp),%rax
movb   $0x20,-0x30(%rbp,%rax,1)
mov    -0x34(%rbp),%esi
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118e <main+0x4e>
movl   $0x0,-0x38(%rbp)
movslq -0x38(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11f4 <main+0xb4>
mov    -0x38(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11c5 <main+0x85>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     122a <main+0xea>
mov    -0x3c(%rbp),%esi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11fb <main+0xbb>
lea    -0x30(%rbp),%rdi
lea    -0x13(%rbp),%rsi
call   1060 <toEscape@plt>
movl   $0x0,-0x50(%rbp)
cmpl   $0xf,-0x50(%rbp)
jge    125f <main+0x11f>
movslq -0x50(%rbp),%rax
movb   $0x20,-0x4b(%rbp,%rax,1)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    123e <main+0xfe>
lea    -0x4b(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <fromEscape@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movabs $0x65726568742062,%rax
mov    %rax,0x7(%rsp)
movabs $0x6261740968736966,%rax
74 61 62
mov    %rax,(%rsp)
movb   $0x0,0x20(%rsp)
lea    0xebf(%rip),%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0xb,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0xc,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0xd,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0xe,%esi
call   1040 <printf@plt>
movaps 0xdd7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    $0xf,%esi
call   1040 <printf@plt>
lea    0xded(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
cmpb   $0x0,0x1(%rsp,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1250 <main+0x120>
xor    %ebx,%ebx
lea    0xdd1(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
cmpb   $0x0,0x11(%rsp,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1270 <main+0x140>
lea    0x10(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <toEscape@plt>
movabs $0x2020202020202020,%rax
20 20 20
mov    %rax,0x2f(%rsp)
mov    %rax,0x28(%rsp)
lea    0x28(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <fromEscape@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.oldString = [15 x i8] c"fish\09tab there\00"
@.str = [16 x i8] c"This is ... %d\0A\00"
@.str.1 = [16 x i8] c"old string: %d\0A\00"
@.str.2 = [16 x i8] c"new string: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [17 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [15 x i8]
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [15 x i8]* %2 to i8*
%10 = bitcast [17 x i8]* %3 to i8*
store i32 0, i32* %4
br label %11
11: ; preds = %20, %0
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 16
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 %16
store i8 32, i8* %17
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %11
23: ; preds = %11
store i32 0, i32* %5
br label %24
24: ; preds = %34, %23
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %24
%32 = load i32, i32* %5
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %24
37: ; preds = %24
store i32 0, i32* %6
br label %38
38: ; preds = %48, %37
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load i32, i32* %6
%47 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %45
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %38
51: ; preds = %38
%52 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%53 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%54 = call i32 @toEscape(i8* %52, i8* %53)
store i32 0, i32* %8
br label %55
55: ; preds = %62, %51
%56 = load i32, i32* %8
%57 = icmp slt i32 %56, 15
br i1 %57, label %58, label %65
58: ; preds = %55
%59 = load i32, i32* %8
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 %60
store i8 32, i8* %61
br label %62
62: ; preds = %58
%63 = load i32, i32* %8
%64 = add nsw i32 %63, 1
store i32 %64, i32* %8
br label %55
65: ; preds = %55
%66 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%67 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%68 = call i32 @fromEscape(i8* %66, i8* %67)
%69 = load i32, i32* %1
ret i32 %69
}

LLVM IR (-O2):
@__const.main.oldString = [15 x i8] c"fish\09tab there\00"
@.str = [16 x i8] c"This is ... %d\0A\00"
@.str.1 = [16 x i8] c"old string: %d\0A\00"
@.str.2 = [16 x i8] c"new string: %d\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [17 x i8]
%3 = alloca [15 x i8]
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 16
store i8 0, i8* %6
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 3)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 5)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 6)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 7)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 8)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 9)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 10)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 11)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 12)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 13)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 14)
%22 = bitcast [17 x i8]* %2 to <16 x i8>*
store <16 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>, <16 x i8>* %22
%23 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
br label %24
24: ; preds = %0, %24
%25 = phi i64 [ 0, %0 ], [ %28, %24 ]
%26 = trunc i64 %25 to i32
%27 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = add nuw i64 %25, 1
%29 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %37, label %24
32: ; preds = %37
%33 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%34 = call i32 @toEscape(i8* %5, i8* %4)
%35 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%36 = call i32 @fromEscape(i8* %35, i8* %5)
ret i32 0
37: ; preds = %24, %37
%38 = phi i64 [ %41, %37 ], [ 0, %24 ]
%39 = trunc i64 %38 to i32
%40 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = add nuw i64 %38, 1
%42 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 0
br i1 %44, label %32, label %37
}