#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 /*<<< orphan*/ do_charconst();
int /*<<< orphan*/ do_print();
int /*<<< orphan*/ do_string();
int getchar();
int /*<<< orphan*/ putchar(int);
void do_input(void) {
  int c;
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '"':
      do_string();
      break;
    case '\'':
      do_charconst();
      break;
    case '@':
      if ((c = getchar()) == '@') {
        do_print();
      } else if (c == '"') {
        do_string();
      } else if (c == '\'') {
        do_charconst();
      } else if (c == EOF) {
        putchar('@');
      } else {
        putchar('@');
        putchar(c);
      }
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<do_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%eax
je     125b <do_input+0x10b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x22,%eax
je     11a7 <do_input+0x57>
jmp    1185 <do_input+0x35>
mov    -0x8(%rbp),%eax
sub    $0x27,%eax
je     11b3 <do_input+0x63>
jmp    1196 <do_input+0x46>
mov    -0x8(%rbp),%eax
sub    $0x40,%eax
je     11bf <do_input+0x6f>
jmp    1251 <do_input+0x101>
mov    $0x0,%al
call   1060 <do_string@plt>
jmp    1256 <do_input+0x106>
mov    $0x0,%al
call   1050 <do_charconst@plt>
jmp    1256 <do_input+0x106>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x40,%eax
jne    11de <do_input+0x8e>
mov    $0x0,%al
call   1070 <do_print@plt>
jmp    124c <do_input+0xfc>
cmpl   $0x22,-0x4(%rbp)
jne    11f4 <do_input+0xa4>
mov    $0x0,%al
call   1060 <do_string@plt>
jmp    1247 <do_input+0xf7>
cmpl   $0x27,-0x4(%rbp)
jne    120a <do_input+0xba>
mov    $0x0,%al
call   1050 <do_charconst@plt>
jmp    1242 <do_input+0xf2>
mov    -0x4(%rbp),%eax
mov    0x2dd4(%rip),%rcx
cmp    (%rcx),%eax
jne    122b <do_input+0xdb>
mov    $0x40,%edi
call   1030 <putchar@plt>
jmp    123d <do_input+0xed>
mov    $0x40,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    1242 <do_input+0xf2>
jmp    1247 <do_input+0xf7>
jmp    124c <do_input+0xfc>
jmp    1256 <do_input+0x106>
jmp    1256 <do_input+0x106>
jmp    1158 <do_input+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_input>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e86(%rip),%r14
jmp    117e <do_input+0x2e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <do_charconst@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     11f3 <do_input+0xa3>
cmp    $0x40,%eax
je     11a0 <do_input+0x50>
cmp    $0x27,%eax
je     1170 <do_input+0x20>
cmp    $0x22,%eax
jne    1177 <do_input+0x27>
jmp    11d0 <do_input+0x80>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x22,%eax
je     11d0 <do_input+0x80>
mov    %eax,%ebx
cmp    $0x27,%eax
je     1170 <do_input+0x20>
cmp    $0x40,%ebx
jne    11d9 <do_input+0x89>
xor    %eax,%eax
call   1070 <do_print@plt>
jmp    1177 <do_input+0x27>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <do_string@plt>
jmp    1177 <do_input+0x27>
mov    (%r14),%ebp
mov    $0x40,%edi
call   1030 <putchar@plt>
cmp    %ebp,%ebx
je     1177 <do_input+0x27>
mov    %ebx,%edi
call   1030 <putchar@plt>
jmp    1177 <do_input+0x27>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define void @do_input() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %28, label %4
4: ; preds = %0, %24
%5 = phi i32 [ %25, %24 ], [ %1, %0 ]
switch i32 %5, label %24 [
i32 34, label %6
i32 39, label %8
i32 64, label %10
]
6: ; preds = %4
%7 = tail call i32 (...) @do_string()
br label %24
8: ; preds = %4
%9 = tail call i32 (...) @do_charconst()
br label %24
10: ; preds = %4
%11 = tail call i32 (...) @getchar()
switch i32 %11, label %18 [
i32 64, label %12
i32 34, label %14
i32 39, label %16
]
12: ; preds = %10
%13 = tail call i32 (...) @do_print()
br label %24
14: ; preds = %10
%15 = tail call i32 (...) @do_string()
br label %24
16: ; preds = %10
%17 = tail call i32 (...) @do_charconst()
br label %24
18: ; preds = %10
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %11, %19
%21 = tail call i32 @putchar(i32 64)
br i1 %20, label %24, label %22
22: ; preds = %18
%23 = tail call i32 @putchar(i32 %11)
br label %24
24: ; preds = %18, %4, %12, %16, %22, %14, %8, %6
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %4
28: ; preds = %24, %0
ret void
}