#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*/ printf(char *, ...);
int scanf(char *, char *);
int main() {
  int i = 0;
  char ch;
  while (scanf("%c", &ch) == 1) {
    if (ch == '"') {
      if (i % 2 == 0) {
        printf("``");
      } else {
        printf("''");
      }
      i++;
    } else
      printf("%c", ch);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11b6 <main+0x96>
movsbl -0x9(%rbp),%eax
cmp    $0x22,%eax
jne    119f <main+0x7f>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1183 <main+0x63>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <main+0x71>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b1 <main+0x91>
movsbl -0x9(%rbp),%esi
lea    0xe56(%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   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11a6 <main+0x76>
lea    0xeaa(%rip),%r15
lea    0xea6(%rip),%r12
lea    0xe99(%rip),%r14
lea    0xf(%rsp),%rbx
xor    %ebp,%ebp
jmp    1185 <main+0x55>
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11a6 <main+0x76>
movsbl 0xf(%rsp),%edi
cmp    $0x22,%edi
jne    1170 <main+0x40>
test   $0x1,%bpl
mov    %r12,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
jmp    1175 <main+0x45>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\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 i8
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %26, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %27
7: ; preds = %4
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 34
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32, i32* %2
%13 = srem i32 %12, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %19
17: ; preds = %11
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %26
22: ; preds = %7
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %19
br label %4
27: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [3 x i8] c"``\00"
@.str.2 = [3 x i8] c"''\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %21
4: ; preds = %0, %17
%5 = phi i32 [ %18, %17 ], [ 0, %0 ]
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 34
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = and i32 %5, 1
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, 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)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %11)
%13 = add nsw i32 %5, 1
br label %17
14: ; preds = %4
%15 = sext i8 %6 to i32
%16 = call i32 @putchar(i32 %15)
br label %17
17: ; preds = %14, %8
%18 = phi i32 [ %13, %8 ], [ %5, %14 ]
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%20 = icmp eq i32 %19, 1
br i1 %20, label %4, label %21
21: ; preds = %17, %0
ret i32 0
}