#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 getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(int);
int main() {
  int ch, q = 1;
  while ((ch = getchar()) != EOF) {
    if (ch != '\"') {
      putchar(ch);
    } else {
      printf("%s", q ? "``" : "''");
      q = !q;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
je     11b0 <main+0x80>
cmpl   $0x22,-0x8(%rbp)
je     1176 <main+0x46>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ab <main+0x7b>
mov    -0xc(%rbp),%ecx
lea    0xe86(%rip),%rsi
lea    0xe7c(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x16>
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
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e9f(%rip),%r13
cmp    0x0(%r13),%eax
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebx
lea    0xe9a(%rip),%r15
lea    0xe90(%rip),%r12
lea    0xe86(%rip),%r14
jmp    11a6 <main+0x76>
nopl   0x0(%rax)
xor    %ebp,%ebp
test   %ebx,%ebx
sete   %bpl
mov    %r12,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %ebp,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    0x0(%r13),%eax
je     114f <main+0x1f>
cmp    $0x22,%eax
je     1180 <main+0x50>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1199 <main+0x69>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"``\00"
@.str.2 = [3 x i8] c"''\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
br label %4
4: ; preds = %24, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %25
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 34
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = call i32 @putchar(i32 %12)
br label %24
14: ; preds = %8
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, 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.2, i64 0, i64 0)
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
%23 = zext i1 %22 to i32
store i32 %23, i32* %3
br label %24
24: ; preds = %14, %11
br label %4
25: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"``\00"
@.str.2 = [3 x i8] c"''\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %20, label %4
4: ; preds = %0, %15
%5 = phi i32 [ %17, %15 ], [ %1, %0 ]
%6 = phi i32 [ %16, %15 ], [ 1, %0 ]
%7 = icmp eq i32 %5, 34
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @putchar(i32 %5)
br label %15
10: ; preds = %4
%11 = icmp eq i32 %6, 0
%12 = select i1 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = zext i1 %11 to i32
br label %15
15: ; preds = %10, %8
%16 = phi i32 [ %6, %8 ], [ %14, %10 ]
%17 = tail call i32 (...) @getchar()
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %4
20: ; preds = %15, %0
ret i32 0
}