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


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    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e97(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ed <main+0xcd>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     1183 <main+0x63>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1183 <main+0x63>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    118f <main+0x6f>
movl   $0x0,-0x10(%rbp)
jmp    11e8 <main+0xc8>
cmpl   $0x0,-0x10(%rbp)
jne    11cb <main+0xab>
cmpl   $0x0,-0xc(%rbp)
je     11ad <main+0x8d>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e3 <main+0xc3>
cmpl   $0x1,-0x10(%rbp)
jne    11de <main+0xbe>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    11e3 <main+0xc3>
jmp    11e8 <main+0xc8>
jmp    113d <main+0x1d>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%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),%r14
cmp    (%r14),%al
jne    1150 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
movabs $0x100000600,%r15
xor    %eax,%eax
xor    %r12d,%r12d
jmp    1191 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %eax,%eax
je     11a3 <main+0x83>
movsbl %bl,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    %ebp,%eax
cmp    (%r14),%bl
je     113b <main+0x1b>
cmp    $0x20,%bl
ja     1170 <main+0x50>
xor    %ebp,%ebp
movzbl %bl,%ecx
bt     %rcx,%r15
jb     1181 <main+0x61>
jmp    1170 <main+0x50>
test   %r12d,%r12d
je     11b2 <main+0x92>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsbl %bl,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
jmp    117c <main+0x5c>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%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 = %45, %0
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %2
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %46
11: ; preds = %5
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 10
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 9
br i1 %22, label %23, label %24
23: ; preds = %19, %15, %11
store i32 0, i32* %4
br label %45
24: ; preds = %19
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @putchar(i8 signext 10)
br label %32
32: ; preds = %30, %27
%33 = load i8, i8* %2
%34 = call i32 @putchar(i8 signext %33)
store i32 1, i32* %4
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %44
37: ; preds = %24
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i8, i8* %2
%42 = call i32 @putchar(i8 signext %41)
br label %43
43: ; preds = %40, %37
br label %44
44: ; preds = %43, %32
br label %45
45: ; preds = %44, %23
br label %5
46: ; preds = %5
%47 = call i32 @putchar(i8 signext 10)
%48 = load i32, i32* %1
ret i32 %48
}

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