#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int i, flag;
  char string[1000000 + 1];
  fflush(stdin);
  while (gets(string) != NULL) {
    flag = 1;
    for (i = 0; string[i] != '\0'; i++) {
      if (string[i] == '"') {
        if (flag)
          printf("``");
        else
          printf("''");
        flag ^= 1;
      } else
        putchar(string[i]);
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    -0xf4260(%rbp),%rdi
call   1050 <gets@plt>
cmp    $0x0,%rax
je     121d <main+0xdd>
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
movsbl -0xf4260(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     120e <main+0xce>
movslq -0x14(%rbp),%rax
movsbl -0xf4260(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
jne    11ea <main+0xaa>
cmpl   $0x0,-0x18(%rbp)
je     11d0 <main+0x90>
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
jmp    11dc <main+0x9c>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
xor    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11fb <main+0xbb>
movslq -0x14(%rbp),%rax
movsbl -0xf4260(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
jmp    1200 <main+0xc0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118b <main+0x4b>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1167 <main+0x27>
xor    %eax,%eax
add    $0xf4260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xf4250,%rsp
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    %rsp,%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     11e1 <main+0xa1>
mov    $0x1,%ebp
xor    %ebx,%ebx
mov    %rsp,%r14
lea    0xe88(%rip),%r15
lea    0xe7e(%rip),%r12
jmp    11a5 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %ebp,%ebp
mov    %r12,%rdi
cmove  %r15,%rdi
call   1040 <printf@plt>
xor    $0x1,%ebp
add    $0x1,%rbx
movzbl (%rsp,%rbx,1),%eax
test   %al,%al
je     11c0 <main+0x80>
cmp    $0x22,%al
je     1190 <main+0x50>
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    11a5 <main+0x65>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1050 <gets@plt>
mov    $0x0,%ebx
mov    $0x1,%ebp
test   %rax,%rax
jne    11a5 <main+0x65>
xor    %eax,%eax
add    $0xf4250,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"``\00"
@.str.1 = [3 x i8] c"''\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1000001 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @stdin
%10 = call i32 @fflush(i32 %9)
br label %11
11: ; preds = %50, %2
%12 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %8, i64 0, i64 0
%13 = call i32* @gets(i8* %12)
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %52
15: ; preds = %11
store i32 1, i32* %7
store i32 0, i32* %6
br label %16
16: ; preds = %47, %15
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %8, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %50
23: ; preds = %16
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %8, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 34
br i1 %29, label %30, label %40
30: ; preds = %23
%31 = load i32, i32* %7
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %37
35: ; preds = %30
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
%38 = load i32, i32* %7
%39 = xor i32 %38, 1
store i32 %39, i32* %7
br label %46
40: ; preds = %23
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %8, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = call i32 @putchar(i8 signext %44)
br label %46
46: ; preds = %40, %37
br label %47
47: ; preds = %46
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %16
50: ; preds = %16
%51 = call i32 @putchar(i8 signext 10)
br label %11
52: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"``\00"
@.str.1 = [3 x i8] c"''\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000001 x i8]
%4 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = tail call i32 @fflush(i32 %5)
%7 = call i32* @gets(i8* %4)
%8 = icmp eq i32* %7, null
br i1 %8, label %31, label %9
9: ; preds = %2, %24
%10 = phi i64 [ %25, %24 ], [ 0, %2 ]
%11 = phi i32 [ %26, %24 ], [ 1, %2 ]
%12 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %3, i64 0, i64 %10
%13 = load i8, i8* %12
switch i8 %13, label %19 [
i8 0, label %27
i8 34, label %14
]
14: ; preds = %9
%15 = icmp eq i32 %11, 0
%16 = select i1 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%17 = call i32 @printf(i8* dereferenceable(1) %16)
%18 = xor i32 %11, 1
br label %21
19: ; preds = %9
%20 = call i32 @putchar(i8 signext %13)
br label %21
21: ; preds = %14, %19
%22 = phi i32 [ %18, %14 ], [ %11, %19 ]
%23 = add nuw i64 %10, 1
br label %24
24: ; preds = %21, %27
%25 = phi i64 [ %23, %21 ], [ 0, %27 ]
%26 = phi i32 [ %22, %21 ], [ 1, %27 ]
br label %9
27: ; preds = %9
%28 = call i32 @putchar(i8 signext 10)
%29 = call i32* @gets(i8* %4)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %24
31: ; preds = %27, %2
ret i32 0
}