#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*/ EXIT_FAILURE;
int /*<<< orphan*/ escape_sequence();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int inside_string(void) {
  int c;
  putchar('"');
  while (c = getchar()) {
    switch (c) {
    case '\\':
      escape_sequence();
      break;
    case '"':
      putchar(c);
      return 0;
    case EOF:
      printf("\nUnmatch double quotes\n");
      exit(EXIT_FAILURE);
    default:
      putchar(c);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<inside_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     11f4 <inside_string+0xa4>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x22,%eax
je     11b9 <inside_string+0x69>
jmp    1189 <inside_string+0x39>
mov    -0xc(%rbp),%eax
sub    $0x5c,%eax
je     11ad <inside_string+0x5d>
jmp    119a <inside_string+0x4a>
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
je     11cd <inside_string+0x7d>
jmp    11e7 <inside_string+0x97>
mov    $0x0,%al
call   1060 <escape_sequence@plt>
jmp    11ef <inside_string+0x9f>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
jmp    11fb <inside_string+0xab>
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1162 <inside_string+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inside_string>:
push   %rax
mov    $0x22,%edi
jmp    1169 <inside_string+0x19>
nopl   0x0(%rax,%rax,1)
cmp    $0x80,%eax
je     11a7 <inside_string+0x57>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x5b,%eax
jle    1190 <inside_string+0x40>
cmp    $0x5c,%eax
jne    1160 <inside_string+0x10>
xor    %eax,%eax
call   1060 <escape_sequence@plt>
jmp    116e <inside_string+0x1e>
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
je     11a3 <inside_string+0x53>
cmp    $0x22,%eax
jne    1167 <inside_string+0x17>
mov    $0x22,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe52(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0AUnmatch double quotes\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @inside_string() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @putchar(i32 34)
br label %4
4: ; preds = %21, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = load i32, i32* %2
switch i32 %8, label %18 [
i32 92, label %9
i32 34, label %11
i32 128, label %14
]
9: ; preds = %7
%10 = call i32 (...) @escape_sequence()
br label %21
11: ; preds = %7
%12 = load i32, i32* %2
%13 = call i32 @putchar(i32 %12)
store i32 0, i32* %1
br label %23
14: ; preds = %7
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %7
%19 = load i32, i32* %2
%20 = call i32 @putchar(i32 %19)
br label %21
21: ; preds = %18, %9
br label %4
22: ; preds = %4
store i32 0, i32* %1
br label %23
23: ; preds = %22, %11
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [23 x i8] c"\0AUnmatch double quotes\00"
define i32 @inside_string() {
%1 = tail call i32 @putchar(i32 34)
br label %2
2: ; preds = %14, %0
%3 = tail call i32 (...) @getchar()
switch i32 %3, label %12 [
i32 0, label %15
i32 92, label %4
i32 34, label %6
i32 128, label %8
]
4: ; preds = %2
%5 = tail call i32 (...) @escape_sequence()
br label %14
6: ; preds = %2
%7 = tail call i32 @putchar(i32 34)
br label %15
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = tail call i32 @putchar(i32 %3)
br label %14
14: ; preds = %12, %4
br label %2
15: ; preds = %2, %6
ret i32 0
}