#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 EOF;
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  int c;
  bool line_started;
  fputs("\"", stdout);
  while ((c = fgetc(stdin)) != EOF)
    switch (c) {
    case '\n':
      fputs("\\n\"\n\"", stdout);
      break;
    case '\\':
      fputs("\\\\", stdout);
      break;
    case '"':
      fputs("\\\"", stdout);
      break;
    default:
      fputc(c, stdout);
      break;
    }
  fputs("\"\n", stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e74(%rip),%rcx
cmp    (%rcx),%eax
je     120e <main+0xde>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xa,%eax
je     11aa <main+0x7a>
jmp    1188 <main+0x58>
mov    -0x10(%rbp),%eax
sub    $0x22,%eax
je     11de <main+0xae>
jmp    1199 <main+0x69>
mov    -0x10(%rbp),%eax
sub    $0x5c,%eax
je     11c4 <main+0x94>
jmp    11f8 <main+0xc8>
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
lea    0xe46(%rip),%rdi
call   1030 <fputs@plt>
jmp    1209 <main+0xd9>
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
lea    0xe32(%rip),%rdi
call   1030 <fputs@plt>
jmp    1209 <main+0xd9>
mov    0x2deb(%rip),%rax
mov    (%rax),%esi
lea    0xe1b(%rip),%rdi
call   1030 <fputs@plt>
jmp    1209 <main+0xd9>
mov    -0x8(%rbp),%edi
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
call   1050 <fputc@plt>
jmp    1154 <main+0x24>
mov    0x2dbb(%rip),%rax
mov    (%rax),%esi
lea    0xdee(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e8e(%rip),%r13
mov    0x0(%r13),%esi
lea    0xeb7(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e8f(%rip),%rbx
mov    (%rbx),%edi
call   1040 <fgetc@plt>
mov    0x2e79(%rip),%rbp
cmp    0x0(%rbp),%eax
jne    118d <main+0x5d>
mov    0x0(%r13),%esi
lea    0xe95(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe72(%rip),%r14
lea    0xe6e(%rip),%r12
lea    0xe5e(%rip),%r15
jmp    11c8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13),%esi
mov    %r12,%rdi
call   1030 <fputs@plt>
mov    (%rbx),%edi
call   1040 <fgetc@plt>
cmp    0x0(%rbp),%eax
je     116c <main+0x3c>
cmp    $0x5c,%eax
je     11e0 <main+0xb0>
cmp    $0x22,%eax
je     11b0 <main+0x80>
cmp    $0xa,%eax
jne    11f0 <main+0xc0>
mov    0x0(%r13),%esi
mov    %r15,%rdi
jmp    11b7 <main+0x87>
mov    0x0(%r13),%esi
mov    %r14,%rdi
jmp    11b7 <main+0x87>
nopl   0x0(%rax)
mov    0x0(%r13),%esi
mov    %eax,%edi
call   1050 <fputc@plt>
jmp    11bc <main+0x8c>

LLVM IR (-O0):
@.str = [2 x i8] c"\22\00"
@stdout = global i32 0
@stdin = global i32 0
@EOF = global i32 0
@.str.1 = [6 x i8] c"\\n\22\0A\22\00"
@.str.2 = [3 x i8] c"\\\\\00"
@.str.3 = [3 x i8] c"\\\22\00"
@.str.4 = [3 x i8] c"\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @stdout
%5 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %26, %0
%7 = load i32, i32* @stdin
%8 = call i32 @fgetc(i32 %7)
store i32 %8, i32* %2
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %6
%12 = load i32, i32* %2
switch i32 %12, label %22 [
i32 10, label %13
i32 92, label %16
i32 34, label %19
]
13: ; preds = %11
%14 = load i32, i32* @stdout
%15 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %26
16: ; preds = %11
%17 = load i32, i32* @stdout
%18 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %26
19: ; preds = %11
%20 = load i32, i32* @stdout
%21 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %26
22: ; preds = %11
%23 = load i32, i32* %2
%24 = load i32, i32* @stdout
%25 = call i32 @fputc(i32 %23, i32 %24)
br label %26
26: ; preds = %22, %19, %16, %13
br label %6
27: ; preds = %6
%28 = load i32, i32* @stdout
%29 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"\22\00"
@stdout = global i32 0
@stdin = global i32 0
@EOF = global i32 0
@.str.1 = [6 x i8] c"\\n\22\0A\22\00"
@.str.2 = [3 x i8] c"\\\\\00"
@.str.3 = [3 x i8] c"\\\22\00"
@.str.4 = [3 x i8] c"\22\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stdin
%4 = tail call i32 @fgetc(i32 %3)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %26, label %7
7: ; preds = %0, %21
%8 = phi i32 [ %23, %21 ], [ %4, %0 ]
switch i32 %8, label %18 [
i32 10, label %9
i32 92, label %12
i32 34, label %15
]
9: ; preds = %7
%10 = load i32, i32* @stdout
%11 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %21
12: ; preds = %7
%13 = load i32, i32* @stdout
%14 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %21
15: ; preds = %7
%16 = load i32, i32* @stdout
%17 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %16)
br label %21
18: ; preds = %7
%19 = load i32, i32* @stdout
%20 = tail call i32 @fputc(i32 %8, i32 %19)
br label %21
21: ; preds = %18, %15, %12, %9
%22 = load i32, i32* @stdin
%23 = tail call i32 @fgetc(i32 %22)
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %7
26: ; preds = %21, %0
%27 = load i32, i32* @stdout
%28 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %27)
ret i32 0
}