#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 getchar();
int /*<<< orphan*/ putchar(char);
int main(void) {
  int c, prevstate, state;
  prevstate = state = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      prevstate = state;
      state = 0;
    } else {
      prevstate = state;
      state = 1;
      putchar('*');
    }
    if (prevstate == 1 && state == 0) {
      prevstate = state;
      state = 0;
      putchar('\n');
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11cd <main+0xad>
cmpl   $0x20,-0x8(%rbp)
je     1174 <main+0x54>
cmpl   $0x9,-0x8(%rbp)
je     1174 <main+0x54>
cmpl   $0xa,-0x8(%rbp)
jne    1186 <main+0x66>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    119d <main+0x7d>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    $0x2a,%edi
call   1030 <putchar@plt>
cmpl   $0x1,-0xc(%rbp)
jne    11c8 <main+0xa8>
cmpl   $0x0,-0x10(%rbp)
jne    11c8 <main+0xa8>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb2(%rip),%r15
cmp    (%r15),%eax
jne    1146 <main+0x26>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
jmp    116f <main+0x4f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %r12d,%ebp
cmp    (%r15),%eax
je     113b <main+0x1b>
cmp    $0x20,%eax
sete   %cl
lea    -0x9(%rax),%edx
cmp    $0x2,%edx
setb   %bl
or     %cl,%bl
cmp    $0x20,%eax
ja     1190 <main+0x70>
xor    %r12d,%r12d
mov    %eax,%eax
bt     %rax,%r14
jb     11a0 <main+0x80>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x1,%r12d
cmp    $0x1,%ebp
setne  %al
xor    $0x1,%bl
or     %al,%bl
jne    1160 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r12d,%r12d
jmp    1160 <main+0x40>

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

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