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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
je     11d4 <main+0xa4>
cmpl   $0x20,-0x8(%rbp)
je     1184 <main+0x54>
cmpl   $0x9,-0x8(%rbp)
je     1184 <main+0x54>
cmpl   $0xa,-0x8(%rbp)
jne    1190 <main+0x60>
movl   $0x0,-0x10(%rbp)
jmp    11a6 <main+0x76>
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0xc(%rbp)
jne    11cf <main+0x9f>
cmpl   $0x0,-0x10(%rbp)
jne    11cf <main+0x9f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe36(%rip),%rdi
call   1040 <printf@plt>
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r15
cmp    (%r15),%eax
jne    1147 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebp,%ebp
jmp    116c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%eax
je     113a <main+0x1a>
cmp    $0x20,%eax
sete   %cl
lea    -0x9(%rax),%edx
cmp    $0x2,%edx
setb   %bl
or     %cl,%bl
cmp    $0x20,%eax
ja     118a <main+0x6a>
mov    %eax,%ecx
bt     %rcx,%r14
jb     1193 <main+0x73>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
test   %ebp,%ebp
setne  %al
xor    $0x1,%bl
or     %al,%bl
jne    1160 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
jmp    1160 <main+0x40>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
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 %19
18: ; preds = %15, %12, %9
store i32 0, i32* %4
br label %22
19: ; preds = %15
store i32 1, i32* %4
store i32 0, i32* %3
%20 = load i32, i32* %2
%21 = call i32 @putchar(i32 %20)
br label %22
22: ; preds = %19, %18
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %28, %25, %22
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(i32 %5)
br label %13
13: ; preds = %4, %4, %4, %11
%14 = phi i32 [ 0, %11 ], [ %6, %4 ], [ %6, %4 ], [ %6, %4 ]
%15 = icmp eq i32 %14, 0
%16 = and i1 %10, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @putchar(i32 10)
br label %19
19: ; preds = %17, %13
%20 = phi i32 [ 1, %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
}