#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*/ putchar(char);
int main() {
  char *foo =
      "#include <stdio.h>\nint main() {\n  char *foo = \"@@\";\n  int i,j;\n  "
      "for(i=0;foo[i];i++) {\n    if(foo[i]==foo[i+1] && foo[i]=='@') {\n      "
      "for(j=0;foo[j];j++) {\n        if(foo[j]=='\\n') { putchar('\\\\'); "
      "putchar('n'); } \n        else if(foo[j]=='\\\\') { putchar('\\\\'); "
      "putchar('\\\\'); }\n        else if(foo[j]=='\"') { putchar('\\\\'); "
      "putchar('\"'); }\n        else putchar(foo[j]);\n      }\n      i++; \n "
      "   }\n    else putchar(foo[i]);\n  }\n  putchar('\\n');\n  return 0;\n}";
  int i, j;
  for (i = 0; foo[i]; i++) {
    if (foo[i] == foo[i + 1] && foo[i] == '@') {
      for (j = 0; foo[j]; j++) {
        if (foo[j] == '\n') {
          putchar('\\');
          putchar('n');
        } else if (foo[j] == '\\') {
          putchar('\\');
          putchar('\\');
        } else if (foo[j] == '"') {
          putchar('\\');
          putchar('"');
        } else
          putchar(foo[j]);
      }
      i++;
    } else
      putchar(foo[i]);
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1280 <main+0x170>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    125c <main+0x14c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x40,%eax
jne    125c <main+0x14c>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     124e <main+0x13e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    11c4 <main+0xb4>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
jmp    123b <main+0x12b>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    11f2 <main+0xe2>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
jmp    1236 <main+0x126>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    1220 <main+0x110>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x22,%edi
call   1030 <putchar@plt>
jmp    1231 <main+0x121>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    1236 <main+0x126>
jmp    123b <main+0x12b>
jmp    1240 <main+0x130>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1184 <main+0x74>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    126d <main+0x15d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    1272 <main+0x162>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <main+0x21>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
lea    0xedf(%rip),%r15
jmp    1145 <main+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %cl,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    $0x1ca,%r14d
je     11a8 <main+0x98>
movslq %r14d,%rax
mov    (%rax,%r15,1),%cl
cmp    $0x40,%cl
jne    1130 <main+0x20>
cmpb   $0x40,0x1(%rax,%r15,1)
jne    1130 <main+0x20>
add    $0x1,%rax
mov    %eax,%r14d
mov    $0x23,%bl
mov    $0x1,%ebp
jmp    1197 <main+0x87>
nopl   0x0(%rax)
mov    $0x6e,%bl
mov    $0x5c,%edi
call   1030 <putchar@plt>
movsbl %bl,%edi
call   1030 <putchar@plt>
movzbl 0x0(%rbp,%r15,1),%ebx
add    $0x1,%rbp
cmp    $0x1cb,%rbp
je     1138 <main+0x28>
cmp    $0xa,%bl
je     1170 <main+0x60>
cmp    $0x22,%bl
je     1172 <main+0x62>
cmp    $0x5c,%bl
je     1172 <main+0x62>
jmp    117c <main+0x6c>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [459 x i8] c"#include <stdio.h>\0Aint main() {\0A char *foo = \22@@\22;\0A int i,j;\0A for(i=0;foo[i];i++) {\0A if(foo[i]==foo[i+1] && foo[i]=='@') {\0A for(j=0;foo[j];j++) {\0A if(foo[j]=='\\n') { putchar('\\\\'); putchar('n'); } \0A else if(foo[j]=='\\\\') { putchar('\\\\'); putchar('\\\\'); }\0A else if(foo[j]=='\22') { putchar('\\\\'); putchar('\22'); }\0A else putchar(foo[j]);\0A }\0A i++; \0A }\0A else putchar(foo[i]);\0A }\0A putchar('\\n');\0A return 0;\0A}\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([459 x i8], [459 x i8]* @.str, i64 0, i64 0), i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %100, %0
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %103
12: ; preds = %5
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %18, %25
br i1 %26, label %27, label %92
27: ; preds = %12
%28 = load i8*, i8** %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 64
br i1 %34, label %35, label %92
35: ; preds = %27
store i32 0, i32* %4
br label %36
36: ; preds = %86, %35
%37 = load i8*, i8** %2
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = icmp ne i8 %41, 0
br i1 %42, label %43, label %89
43: ; preds = %36
%44 = load i8*, i8** %2
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 10
br i1 %50, label %51, label %54
51: ; preds = %43
%52 = call i32 @putchar(i8 signext 92)
%53 = call i32 @putchar(i8 signext 110)
br label %85
54: ; preds = %43
%55 = load i8*, i8** %2
%56 = load i32, i32* %4
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 92
br i1 %61, label %62, label %65
62: ; preds = %54
%63 = call i32 @putchar(i8 signext 92)
%64 = call i32 @putchar(i8 signext 92)
br label %84
65: ; preds = %54
%66 = load i8*, i8** %2
%67 = load i32, i32* %4
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 34
br i1 %72, label %73, label %76
73: ; preds = %65
%74 = call i32 @putchar(i8 signext 92)
%75 = call i32 @putchar(i8 signext 34)
br label %83
76: ; preds = %65
%77 = load i8*, i8** %2
%78 = load i32, i32* %4
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %77, i64 %79
%81 = load i8, i8* %80
%82 = call i32 @putchar(i8 signext %81)
br label %83
83: ; preds = %76, %73
br label %84
84: ; preds = %83, %62
br label %85
85: ; preds = %84, %51
br label %86
86: ; preds = %85
%87 = load i32, i32* %4
%88 = add nsw i32 %87, 1
store i32 %88, i32* %4
br label %36
89: ; preds = %36
%90 = load i32, i32* %3
%91 = add nsw i32 %90, 1
store i32 %91, i32* %3
br label %99
92: ; preds = %27, %12
%93 = load i8*, i8** %2
%94 = load i32, i32* %3
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = load i8, i8* %96
%98 = call i32 @putchar(i8 signext %97)
br label %99
99: ; preds = %92, %89
br label %100
100: ; preds = %99
%101 = load i32, i32* %3
%102 = add nsw i32 %101, 1
store i32 %102, i32* %3
br label %5
103: ; preds = %5
%104 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [459 x i8] c"#include <stdio.h>\0Aint main() {\0A char *foo = \22@@\22;\0A int i,j;\0A for(i=0;foo[i];i++) {\0A if(foo[i]==foo[i+1] && foo[i]=='@') {\0A for(j=0;foo[j];j++) {\0A if(foo[j]=='\\n') { putchar('\\\\'); putchar('n'); } \0A else if(foo[j]=='\\\\') { putchar('\\\\'); putchar('\\\\'); }\0A else if(foo[j]=='\22') { putchar('\\\\'); putchar('\22'); }\0A else putchar(foo[j]);\0A }\0A i++; \0A }\0A else putchar(foo[i]);\0A }\0A putchar('\\n');\0A return 0;\0A}\00"
define i32 @main() {
br label %1
1: ; preds = %0, %30
%2 = phi i32 [ 0, %0 ], [ %32, %30 ]
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds [459 x i8], [459 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
%6 = add nsw i32 %2, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [459 x i8], [459 x i8]* @.str, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %5, 64
%11 = icmp eq i8 %9, 64
%12 = and i1 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %1, %21
%14 = phi i64 [ %24, %21 ], [ 0, %1 ]
%15 = phi i8 [ %26, %21 ], [ 35, %1 ]
switch i8 %15, label %21 [
i8 10, label %18
i8 92, label %16
i8 34, label %17
]
16: ; preds = %13
br label %18
17: ; preds = %13
br label %18
18: ; preds = %13, %16, %17
%19 = phi i8 [ %15, %16 ], [ %15, %17 ], [ 110, %13 ]
%20 = tail call i32 @putchar(i8 signext 92)
br label %21
21: ; preds = %18, %13
%22 = phi i8 [ %15, %13 ], [ %19, %18 ]
%23 = tail call i32 @putchar(i8 signext %22)
%24 = add nuw nsw i64 %14, 1
%25 = getelementptr inbounds [459 x i8], [459 x i8]* @.str, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i64 %24, 458
br i1 %27, label %30, label %13
28: ; preds = %1
%29 = tail call i32 @putchar(i8 signext %5)
br label %30
30: ; preds = %21, %28
%31 = phi i32 [ %2, %28 ], [ %6, %21 ]
%32 = add nsw i32 %31, 1
%33 = icmp eq i32 %32, 458
br i1 %33, label %34, label %1
34: ; preds = %30
%35 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}