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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11b5 <main+0x95>
movsbl -0x9(%rbp),%eax
cmp    $0x22,%eax
jne    119e <main+0x7e>
mov    -0x8(%rbp),%ecx
lea    0xe9a(%rip),%rsi
lea    0xe90(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <main+0x90>
movsbl -0x9(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <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),%al
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    1195 <main+0x65>
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    0x0(%r13),%al
je     114f <main+0x1f>
cmp    $0x22,%al
jne    1180 <main+0x50>
xor    %ebp,%ebp
test   %ebx,%ebx
sete   %bpl
mov    %r12,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%ebx
jmp    1188 <main+0x58>

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

LLVM IR (-O2):
@EOF = global i8 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 signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %21, label %4
4: ; preds = %0, %16
%5 = phi i8 [ %18, %16 ], [ %1, %0 ]
%6 = phi i32 [ %17, %16 ], [ 1, %0 ]
%7 = icmp eq i8 %5, 34
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = icmp eq i32 %6, 0
%10 = select i1 %9, 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)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = zext i1 %9 to i32
br label %16
13: ; preds = %4
%14 = sext i8 %5 to i32
%15 = tail call i32 @putchar(i32 %14)
br label %16
16: ; preds = %13, %8
%17 = phi i32 [ %12, %8 ], [ %6, %13 ]
%18 = tail call signext i8 (...) @getchar()
%19 = load i8, i8* @EOF
%20 = icmp eq i8 %18, %19
br i1 %20, label %21, label %4
21: ; preds = %16, %0
ret i32 0
}