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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%eax
je     121a <main+0xfa>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    118e <main+0x6e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x20,-0x14(%rbp)
je     11ac <main+0x8c>
cmpl   $0xa,-0x14(%rbp)
je     11ac <main+0x8c>
cmpl   $0x9,-0x14(%rbp)
jne    11d3 <main+0xb3>
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    11ce <main+0xae>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,-0x28(%rbp)
jmp    1215 <main+0xf5>
cmpl   $0x0,-0x24(%rbp)
jne    1201 <main+0xe1>
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    1210 <main+0xf0>
movl   $0x0,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    1215 <main+0xf5>
jmp    1159 <main+0x39>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%rbx
cmp    (%rbx),%eax
jne    113d <main+0x1d>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ecx,%ecx
jmp    1164 <main+0x44>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%eax
je     1136 <main+0x16>
xor    %ebp,%ebp
cmp    $0x20,%eax
ja     1150 <main+0x30>
mov    %eax,%edx
bt     %rdx,%r14
jae    1150 <main+0x30>
mov    $0x1,%ebp
test   %ecx,%ecx
jne    1157 <main+0x37>
mov    $0xa,%eax
jmp    1150 <main+0x30>

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

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