#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;
scalar_t__ feof(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ *strstr(char const *, char *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
int main() {
  int c;
  int first_punc, fresh_line;
  const char *word_separators = " \t,.;\'\"\\!:?/=+*-()[]{}<>\n";
  fresh_line = 1;
  first_punc = 1;
  printf("=========================\n");
  while ((c = getchar()) != EOF) {
    if (!fresh_line && strstr(word_separators, (char *)&c)) {
      if (c == '\'' && !feof(stdin) && first_punc) {
        c = getchar();
        if (strstr(word_separators, (char *)&c) == NULL)
          putchar('\'');
        ungetc(c, stdin);
      } else if (c != '\n' && first_punc) {
        first_punc = 0;
        if (!feof(stdin))
          putchar('\n');
      }
    }
    if (strstr(word_separators, (char *)&c) == NULL) {
      fresh_line = 0;
      first_punc = 1;
      putchar(c);
    }
    if (feof(stdin)) {
      fresh_line = 1;
      first_punc = 1;
      printf("--------------------\n");
    }
  }
  printf("\n=========================\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e3b(%rip),%rcx
cmp    (%rcx),%eax
je     12eb <main+0x18b>
cmpl   $0x0,-0x10(%rbp)
jne    1287 <main+0x127>
mov    -0x18(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     1287 <main+0x127>
cmpl   $0x27,-0x8(%rbp)
jne    123b <main+0xdb>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%rax
jne    123b <main+0xdb>
cmpl   $0x0,-0xc(%rbp)
je     123b <main+0xdb>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
jne    1225 <main+0xc5>
mov    $0x27,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%edi
mov    0x2db9(%rip),%rax
mov    (%rax),%esi
call   1070 <ungetc@plt>
jmp    1282 <main+0x122>
cmpl   $0xa,-0x8(%rbp)
je     127d <main+0x11d>
cmpl   $0x0,-0xc(%rbp)
je     127d <main+0x11d>
movl   $0x0,-0xc(%rbp)
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%rax
jne    1278 <main+0x118>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    127d <main+0x11d>
jmp    1282 <main+0x122>
jmp    1287 <main+0x127>
mov    -0x18(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
jne    12b4 <main+0x154>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%rax
je     12e6 <main+0x186>
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xd39(%rip),%rdi
call   1040 <printf@plt>
jmp    1194 <main+0x34>
lea    0xd3e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
mov    %eax,0x4(%rsp)
mov    0x2e55(%rip),%rax
cmp    (%rax),%ebp
jne    11ac <main+0x4c>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r12d
lea    0xe47(%rip),%r14
lea    0x4(%rsp),%rbx
mov    0x2e23(%rip),%r13
mov    $0x1,%r15d
jmp    11e8 <main+0x88>
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
mov    %eax,0x4(%rsp)
mov    0x2dfc(%rip),%rax
cmp    (%rax),%ebp
je     118f <main+0x2f>
test   %r15d,%r15d
je     1240 <main+0xe0>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
jne    120d <main+0xad>
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    $0x1,%r12d
xor    %r15d,%r15d
mov    0x0(%r13),%edi
call   1060 <feof@plt>
test   %rax,%rax
je     11d0 <main+0x70>
lea    0xe13(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r15d
mov    $0x1,%r12d
jmp    11d0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     11ed <main+0x8d>
cmp    $0x27,%ebp
jne    12a5 <main+0x145>
mov    0x0(%r13),%edi
call   1060 <feof@plt>
test   %rax,%rax
jne    12a5 <main+0x145>
test   %r12d,%r12d
je     12a5 <main+0x145>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
mov    %eax,0x4(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
jne    128f <main+0x12f>
mov    $0x27,%edi
call   1030 <putchar@plt>
mov    0x0(%r13),%esi
mov    %ebp,%edi
call   1070 <ungetc@plt>
mov    $0x1,%r12d
jmp    11ed <main+0x8d>
cmp    $0xa,%ebp
je     11ed <main+0x8d>
test   %r12d,%r12d
je     11ed <main+0x8d>
mov    0x0(%r13),%edi
call   1060 <feof@plt>
xor    %r12d,%r12d
test   %rax,%rax
jne    11ed <main+0x8d>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11ed <main+0x8d>

LLVM IR (-O0):
@.str = [26 x i8] c" \09,.;'\22\\!:?/=+*-()[]{}<>\0A\00"
@.str.1 = [27 x i8] c"=========================\0A\00"
@EOF = global i32 0
@stdin = global i32 0
@.str.2 = [22 x i8] c"--------------------\0A\00"
@.str.3 = [28 x i8] c"\0A=========================\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %5
store i32 1, i32* %4
store i32 1, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %70, %0
%8 = call i32 (...) @getchar()
store i32 %8, i32* %2
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %71
11: ; preds = %7
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %56, label %14
14: ; preds = %11
%15 = load i8*, i8** %5
%16 = bitcast i32* %2 to i8*
%17 = call i32* @strstr(i8* %15, i8* %16)
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %56
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 39
br i1 %21, label %22, label %41
22: ; preds = %19
%23 = load i32, i32* @stdin
%24 = call i64 @feof(i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %41, label %26
26: ; preds = %22
%27 = load i32, i32* %3
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %41
29: ; preds = %26
%30 = call i32 (...) @getchar()
store i32 %30, i32* %2
%31 = load i8*, i8** %5
%32 = bitcast i32* %2 to i8*
%33 = call i32* @strstr(i8* %31, i8* %32)
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = call i32 @putchar(i32 39)
br label %37
37: ; preds = %35, %29
%38 = load i32, i32* %2
%39 = load i32, i32* @stdin
%40 = call i32 @ungetc(i32 %38, i32 %39)
br label %55
41: ; preds = %26, %22, %19
%42 = load i32, i32* %2
%43 = icmp ne i32 %42, 10
br i1 %43, label %44, label %54
44: ; preds = %41
%45 = load i32, i32* %3
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %54
47: ; preds = %44
store i32 0, i32* %3
%48 = load i32, i32* @stdin
%49 = call i64 @feof(i32 %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %47
%52 = call i32 @putchar(i32 10)
br label %53
53: ; preds = %51, %47
br label %54
54: ; preds = %53, %44, %41
br label %55
55: ; preds = %54, %37
br label %56
56: ; preds = %55, %14, %11
%57 = load i8*, i8** %5
%58 = bitcast i32* %2 to i8*
%59 = call i32* @strstr(i8* %57, i8* %58)
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %64
61: ; preds = %56
store i32 0, i32* %4
store i32 1, i32* %3
%62 = load i32, i32* %2
%63 = call i32 @putchar(i32 %62)
br label %64
64: ; preds = %61, %56
%65 = load i32, i32* @stdin
%66 = call i64 @feof(i32 %65)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %64
store i32 1, i32* %4
store i32 1, i32* %3
%69 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %70
70: ; preds = %68, %64
br label %7
71: ; preds = %7
%72 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c" \09,.;'\22\\!:?/=+*-()[]{}<>\0A\00"
@EOF = global i32 0
@stdin = global i32 0
@str = [26 x i8] c"=========================\00"
@str.4 = [27 x i8] c"\0A=========================\00"
@str.5 = [21 x i8] c"--------------------\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
store i32 %4, i32* %1
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %63, label %7
7: ; preds = %0, %57
%8 = phi i32 [ %60, %57 ], [ %4, %0 ]
%9 = phi i32 [ %59, %57 ], [ 1, %0 ]
%10 = phi i32 [ %58, %57 ], [ 1, %0 ]
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %42
12: ; preds = %7
%13 = call i32* @strstr(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2)
%14 = icmp eq i32* %13, null
br i1 %14, label %42, label %15
15: ; preds = %12
%16 = icmp eq i32 %8, 39
br i1 %16, label %17, label %32
17: ; preds = %15
%18 = load i32, i32* @stdin
%19 = tail call i64 @feof(i32 %18)
%20 = icmp eq i64 %19, 0
%21 = icmp ne i32 %9, 0
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %23, label %32
23: ; preds = %17
%24 = tail call i32 (...) @getchar()
store i32 %24, i32* %1
%25 = call i32* @strstr(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2)
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = tail call i32 @putchar(i32 39)
br label %29
29: ; preds = %27, %23
%30 = load i32, i32* @stdin
%31 = tail call i32 @ungetc(i32 %24, i32 %30)
br label %42
32: ; preds = %17, %15
%33 = icmp ne i32 %8, 10
%34 = icmp ne i32 %9, 0
%35 = select i1 %33, i1 %34, i1 false
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i32, i32* @stdin
%38 = tail call i64 @feof(i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = tail call i32 @putchar(i32 10)
br label %42
42: ; preds = %29, %36, %40, %32, %12, %7
%43 = phi i32 [ %8, %7 ], [ %24, %29 ], [ %8, %36 ], [ %8, %40 ], [ %8, %32 ], [ %8, %12 ]
%44 = phi i32 [ %9, %7 ], [ 1, %29 ], [ 0, %36 ], [ 0, %40 ], [ %9, %32 ], [ %9, %12 ]
%45 = call i32* @strstr(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2)
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %49
47: ; preds = %42
%48 = tail call i32 @putchar(i32 %43)
br label %49
49: ; preds = %47, %42
%50 = phi i32 [ 0, %47 ], [ %10, %42 ]
%51 = phi i32 [ 1, %47 ], [ %44, %42 ]
%52 = load i32, i32* @stdin
%53 = tail call i64 @feof(i32 %52)
%54 = icmp eq i64 %53, 0
br i1 %54, label %57, label %55
55: ; preds = %49
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0))
br label %57
57: ; preds = %55, %49
%58 = phi i32 [ 1, %55 ], [ %50, %49 ]
%59 = phi i32 [ 1, %55 ], [ %51, %49 ]
%60 = tail call i32 (...) @getchar()
store i32 %60, i32* %1
%61 = load i32, i32* @EOF
%62 = icmp eq i32 %60, %61
br i1 %62, label %63, label %7
63: ; preds = %57, %0
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}