#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*/ putchar(char);
char repeatString() {
  char e, f;
  putchar('\"');
  e = getchar();
  if (e == EOF)
    return EOF;
  else if (e == '\"') {
    putchar('\"');
    return '\"';
  } else {
    putchar(e);
    while ((f = getchar()) != EOF) {
      if (e != '\\' && f == '\"') {
        putchar('\"');
        return '\"';
      } else {
        putchar(f);
        e = f;
      }
    }
    return EOF;
  }
}


x86 assembly (clang, -O0):
<repeatString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
mov    0x2ea1(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1163 <repeatString+0x43>
mov    0x2e8f(%rip),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
jmp    11f8 <repeatString+0xd8>
movsbl -0x2(%rbp),%eax
cmp    $0x22,%eax
jne    1183 <repeatString+0x63>
mov    $0x22,%edi
call   1030 <putchar@plt>
movb   $0x22,-0x1(%rbp)
jmp    11f8 <repeatString+0xd8>
movsbl -0x2(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x3(%rbp)
movsbl %al,%eax
mov    0x2e48(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ec <repeatString+0xcc>
movsbl -0x2(%rbp),%eax
cmp    $0x5c,%eax
je     11d8 <repeatString+0xb8>
movsbl -0x3(%rbp),%eax
cmp    $0x22,%eax
jne    11d8 <repeatString+0xb8>
mov    $0x22,%edi
call   1030 <putchar@plt>
movb   $0x22,-0x1(%rbp)
jmp    11f8 <repeatString+0xd8>
movsbl -0x3(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
jmp    118c <repeatString+0x6c>
mov    0x2df5(%rip),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeatString>:
push   %r14
push   %rbx
push   %rax
mov    $0x22,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    0x2eaa(%rip),%r14
cmp    (%r14),%al
jne    1150 <repeatString+0x30>
mov    %ebx,%eax
jmp    1180 <repeatString+0x60>
nopw   0x0(%rax,%rax,1)
cmp    $0x22,%bl
je     1174 <repeatString+0x54>
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%al
je     1180 <repeatString+0x60>
mov    %ebx,%ecx
mov    %eax,%ebx
cmp    $0x5c,%cl
jne    1150 <repeatString+0x30>
jmp    1155 <repeatString+0x35>
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0x22,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i8 0
define signext i8 @repeatString() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call i32 @putchar(i8 signext 34)
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %7, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = load i8, i8* @EOF
store i8 %12, i8* %1
br label %45
13: ; preds = %0
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 34
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @putchar(i8 signext 34)
store i8 34, i8* %1
br label %45
19: ; preds = %13
%20 = load i8, i8* %2
%21 = call i32 @putchar(i8 signext %20)
br label %22
22: ; preds = %42, %19
%23 = call signext i8 (...) @getchar()
store i8 %23, i8* %3
%24 = sext i8 %23 to i32
%25 = load i8, i8* @EOF
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %24, %26
br i1 %27, label %28, label %43
28: ; preds = %22
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 92
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = load i8, i8* %3
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 34
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @putchar(i8 signext 34)
store i8 34, i8* %1
br label %45
38: ; preds = %32, %28
%39 = load i8, i8* %3
%40 = call i32 @putchar(i8 signext %39)
%41 = load i8, i8* %3
store i8 %41, i8* %2
br label %42
42: ; preds = %38
br label %22
43: ; preds = %22
%44 = load i8, i8* @EOF
store i8 %44, i8* %1
br label %45
45: ; preds = %43, %36, %17, %11
%46 = load i8, i8* %1
ret i8 %46
}

LLVM IR (-O2):
@EOF = global i8 0
define signext i8 @repeatString() {
%1 = tail call i32 @putchar(i8 signext 34)
%2 = tail call signext i8 (...) @getchar()
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %25, label %5
5: ; preds = %0
%6 = icmp eq i8 %2, 34
br i1 %6, label %23, label %7
7: ; preds = %5
%8 = tail call i32 @putchar(i8 signext %2)
%9 = tail call signext i8 (...) @getchar()
%10 = load i8, i8* @EOF
%11 = icmp eq i8 %9, %10
br i1 %11, label %25, label %12
12: ; preds = %7, %18
%13 = phi i8 [ %20, %18 ], [ %9, %7 ]
%14 = phi i8 [ %13, %18 ], [ %2, %7 ]
%15 = icmp ne i8 %14, 92
%16 = icmp eq i8 %13, 34
%17 = and i1 %15, %16
br i1 %17, label %23, label %18
18: ; preds = %12
%19 = tail call i32 @putchar(i8 signext %13)
%20 = tail call signext i8 (...) @getchar()
%21 = load i8, i8* @EOF
%22 = icmp eq i8 %20, %21
br i1 %22, label %25, label %12
23: ; preds = %12, %5
%24 = tail call i32 @putchar(i8 signext 34)
br label %25
25: ; preds = %18, %23, %7, %0
%26 = phi i8 [ %2, %0 ], [ %9, %7 ], [ 34, %23 ], [ %20, %18 ]
ret i8 %26
}