#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 */
#define EOF 128
int /*<<< orphan*/ error(char *);
int getchar();
void do_string(void) {
  int c;
  for (;;) {
    switch (c = getchar()) {
    case '"':
      return;
    case '\\':
      c = getchar();
      if (c == EOF) {
        error("syntax error: unexpected EOF");
      }
      break;
    case EOF:
      error("syntax error: unexpected EOF");
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<do_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0x22,%eax
je     1169 <do_string+0x49>
jmp    1145 <do_string+0x25>
mov    -0x8(%rbp),%eax
sub    $0x5c,%eax
je     116f <do_string+0x4f>
jmp    1156 <do_string+0x36>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
je     1197 <do_string+0x77>
jmp    11a8 <do_string+0x88>
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x80,-0x4(%rbp)
jne    1192 <do_string+0x72>
lea    0xe73(%rip),%rdi
call   1040 <error@plt>
jmp    11ad <do_string+0x8d>
lea    0xe62(%rip),%rdi
call   1040 <error@plt>
jmp    11ad <do_string+0x8d>
jmp    11ad <do_string+0x8d>
jmp    1128 <do_string+0x8>

x86 assembly (clang, -O2):
<do_string>:
push   %rbx
lea    0xed8(%rip),%rbx
jmp    1138 <do_string+0x18>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <error@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0x5c,%eax
je     1160 <do_string+0x40>
cmp    $0x80,%eax
je     1130 <do_string+0x10>
cmp    $0x22,%eax
jne    1138 <do_string+0x18>
jmp    1170 <do_string+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0x80,%eax
jne    1138 <do_string+0x18>
jmp    1130 <do_string+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"syntax error: unexpected EOF\00"
define void @do_string() {
%1 = alloca i32
br label %2
2: ; preds = %15, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
switch i32 %3, label %14 [
i32 34, label %4
i32 92, label %5
i32 128, label %12
]
4: ; preds = %2
ret void
5: ; preds = %2
%6 = call i32 (...) @getchar()
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 128
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
br label %15
12: ; preds = %2
%13 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %12, %11
br label %2
}

LLVM IR (-O2):
@.str = [29 x i8] c"syntax error: unexpected EOF\00"
define void @do_string() {
br label %1
1: ; preds = %9, %0
%2 = tail call i32 (...) @getchar()
switch i32 %2, label %9 [
i32 34, label %3
i32 92, label %4
i32 128, label %7
]
3: ; preds = %1
ret void
4: ; preds = %1
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %5, 128
br i1 %6, label %7, label %9
7: ; preds = %1, %4
%8 = tail call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1, %4
br label %1
}