#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);
main() {
  int c, nl, nw, nc, state;
  state = 0;
  nw = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      state = 0;
    } else if (state == 0) {
      state = 1;
      if (nw > 0)
        putchar('\n');
      ++nw;
      putchar(c);
    } else if (state == 1) {
      putchar(c);
    }
    if (c == '\n') {
      nw = 0;
      putchar('\n');
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11fd <main+0xdd>
cmpl   $0x20,-0x8(%rbp)
je     1174 <main+0x54>
cmpl   $0xa,-0x8(%rbp)
je     1174 <main+0x54>
cmpl   $0x9,-0x8(%rbp)
jne    1180 <main+0x60>
movl   $0x0,-0x18(%rbp)
jmp    11dd <main+0xbd>
cmpl   $0x0,-0x18(%rbp)
jne    11be <main+0x9e>
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11a5 <main+0x85>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    11d8 <main+0xb8>
cmpl   $0x1,-0x18(%rbp)
jne    11d3 <main+0xb3>
mov    -0x8(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    11d8 <main+0xb8>
jmp    11dd <main+0xbd>
cmpl   $0xa,-0x8(%rbp)
jne    11f8 <main+0xd8>
movl   $0x0,-0x10(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%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),%r14
cmp    (%r14),%eax
jne    1146 <main+0x26>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
movabs $0x100000600,%r15
xor    %ebp,%ebp
xor    %r12d,%r12d
jmp    116e <main+0x4e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     113b <main+0x1b>
cmp    $0x20,%ebx
ja     1190 <main+0x70>
mov    %ebx,%eax
bt     %rax,%r15
jae    1190 <main+0x70>
xor    %ebp,%ebp
cmp    $0xa,%ebx
jne    1160 <main+0x40>
jmp    11b9 <main+0x99>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %ebp,%ebp
jne    11a7 <main+0x87>
test   %r12d,%r12d
jle    11a3 <main+0x83>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
movsbl %bl,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
cmp    $0xa,%ebx
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
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %4
br label %7
7: ; preds = %49, %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 %50
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 32
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 10
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 9
br i1 %19, label %20, label %21
20: ; preds = %17, %14, %11
store i32 0, i32* %6
br label %44
21: ; preds = %17
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %35
24: ; preds = %21
store i32 1, i32* %6
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @putchar(i8 signext 10)
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
%32 = load i32, i32* %2
%33 = trunc i32 %32 to i8
%34 = call i32 @putchar(i8 signext %33)
br label %43
35: ; preds = %21
%36 = load i32, i32* %6
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i32, i32* %2
%40 = trunc i32 %39 to i8
%41 = call i32 @putchar(i8 signext %40)
br label %42
42: ; preds = %38, %35
br label %43
43: ; preds = %42, %29
br label %44
44: ; preds = %43, %20
%45 = load i32, i32* %2
%46 = icmp eq i32 %45, 10
br i1 %46, label %47, label %49
47: ; preds = %44
store i32 0, i32* %4
%48 = call i32 @putchar(i8 signext 10)
br label %49
49: ; preds = %47, %44
br label %7
50: ; preds = %7
%51 = load i32, i32* %1
ret i32 %51
}

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 %31, label %4
4: ; preds = %0, %26
%5 = phi i32 [ %28, %26 ], [ %1, %0 ]
%6 = phi i32 [ %23, %26 ], [ 0, %0 ]
%7 = phi i32 [ %27, %26 ], [ 0, %0 ]
%8 = icmp eq i32 %5, 10
switch i32 %5, label %9 [
i32 32, label %21
i32 10, label %21
i32 9, label %21
]
9: ; preds = %4
%10 = icmp eq i32 %6, 0
br i1 %10, label %11, label %17
11: ; preds = %9
%12 = icmp sgt i32 %7, 0
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = tail call i32 @putchar(i8 signext 10)
br label %15
15: ; preds = %13, %11
%16 = add nsw i32 %7, 1
br label %17
17: ; preds = %9, %15
%18 = phi i32 [ %16, %15 ], [ %7, %9 ]
%19 = trunc i32 %5 to i8
%20 = tail call i32 @putchar(i8 signext %19)
br label %21
21: ; preds = %17, %4, %4, %4
%22 = phi i32 [ %7, %4 ], [ %7, %4 ], [ %7, %4 ], [ %18, %17 ]
%23 = phi i32 [ 0, %4 ], [ 0, %4 ], [ 0, %4 ], [ 1, %17 ]
br i1 %8, label %24, label %26
24: ; preds = %21
%25 = tail call i32 @putchar(i8 signext 10)
br label %26
26: ; preds = %24, %21
%27 = phi i32 [ 0, %24 ], [ %22, %21 ]
%28 = tail call i32 (...) @getchar()
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %4
31: ; preds = %26, %0
ret i32 0
}