#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 c, i;
  i = 1;
  while ((c = getchar()) != EOF) {
    if (c == '"' && i == 1) {
      printf("%s", "``");
      i = 2;
    } else if (c == '"' && i == 2) {
      printf("%s", "''");
      i = 1;
    } else {
      putchar(c);
    }
  }
  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     11d7 <main+0xa7>
cmpl   $0x22,-0x8(%rbp)
jne    1192 <main+0x62>
cmpl   $0x1,-0xc(%rbp)
jne    1192 <main+0x62>
lea    0xe86(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1040 <printf@plt>
movl   $0x2,-0xc(%rbp)
jmp    11d2 <main+0xa2>
cmpl   $0x22,-0x8(%rbp)
jne    11c5 <main+0x95>
cmpl   $0x2,-0xc(%rbp)
jne    11c5 <main+0x95>
lea    0xe53(%rip),%rdi
lea    0xe52(%rip),%rsi
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    11cd <main+0x9d>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11d2 <main+0xa2>
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   %r12
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea2(%rip),%rbx
cmp    (%rbx),%eax
jne    1155 <main+0x25>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebp
lea    0xe9f(%rip),%r12
lea    0xe9b(%rip),%r14
lea    0xe97(%rip),%r15
jmp    1192 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     114a <main+0x1a>
cmp    $0x22,%eax
jne    11b0 <main+0x80>
cmp    $0x1,%ebp
jne    11b0 <main+0x80>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    $0x2,%ebp
jmp    1187 <main+0x57>
xchg   %ax,%ax
cmp    $0x22,%eax
jne    1180 <main+0x50>
cmp    $0x2,%ebp
jne    1180 <main+0x50>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    1187 <main+0x57>

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 = %28, %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 %29
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 34
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
br label %28
16: ; preds = %11, %8
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 34
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %27
24: ; preds = %19, %16
%25 = load i32, i32* %2
%26 = call i32 @putchar(i32 %25)
br label %27
27: ; preds = %24, %22
br label %28
28: ; preds = %27, %14
br label %4
29: ; 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 %24, label %4
4: ; preds = %0, %19
%5 = phi i32 [ %21, %19 ], [ %1, %0 ]
%6 = phi i32 [ %20, %19 ], [ 1, %0 ]
%7 = icmp eq i32 %5, 34
%8 = icmp eq i32 %6, 1
%9 = select i1 %7, i1 %8, i1 false
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %19
12: ; preds = %4
%13 = icmp eq i32 %6, 2
%14 = select i1 %7, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %19
17: ; preds = %12
%18 = tail call i32 @putchar(i32 %5)
br label %19
19: ; preds = %15, %17, %10
%20 = phi i32 [ 2, %10 ], [ 1, %15 ], [ %6, %17 ]
%21 = tail call i32 (...) @getchar()
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %4
24: ; preds = %19, %0
ret i32 0
}