#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(c);
    }
    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     11ce <main+0xae>
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    119e <main+0x7e>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
cmpl   $0x1,-0xc(%rbp)
jne    11c9 <main+0xa9>
cmpl   $0x0,-0x10(%rbp)
jne    11c9 <main+0xa9>
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,%ecx
bt     %rcx,%r14
jb     119e <main+0x7e>
movsbl %al,%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 = %34, %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 %35
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 %25
20: ; preds = %15
%21 = load i32, i32* %4
store i32 %21, i32* %3
store i32 1, i32* %4
%22 = load i32, i32* %2
%23 = trunc i32 %22 to i8
%24 = call i32 @putchar(i8 signext %23)
br label %25
25: ; preds = %20, %18
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %4
store i32 %32, i32* %3
store i32 0, i32* %4
%33 = call i32 @putchar(i8 signext 10)
br label %34
34: ; preds = %31, %28, %25
br label %5
35: ; 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 %25, label %4
4: ; preds = %0, %20
%5 = phi i32 [ %22, %20 ], [ %1, %0 ]
%6 = phi i32 [ %21, %20 ], [ 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 %14
i32 10, label %14
i32 9, label %14
]
11: ; preds = %4
%12 = trunc i32 %5 to i8
%13 = tail call i32 @putchar(i8 signext %12)
br label %14
14: ; preds = %4, %4, %4, %11
%15 = phi i32 [ 1, %11 ], [ 0, %4 ], [ 0, %4 ], [ 0, %4 ]
%16 = icmp eq i32 %6, 1
%17 = and i1 %16, %10
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = tail call i32 @putchar(i8 signext 10)
br label %20
20: ; preds = %18, %14
%21 = phi i32 [ 0, %18 ], [ %15, %14 ]
%22 = tail call i32 (...) @getchar()
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %4
25: ; preds = %20, %0
ret i32 0
}