#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(void) {
  char c;
  char state = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (state == 1) {
        putchar('\n');
        state = 0;
      }
    } else {
      putchar(c);
      state = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x6(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2ea1(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ab <main+0x8b>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     1179 <main+0x59>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     1179 <main+0x59>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    1199 <main+0x79>
movsbl -0x6(%rbp),%eax
cmp    $0x1,%eax
jne    1194 <main+0x74>
mov    $0xa,%edi
call   1030 <putchar@plt>
movb   $0x0,-0x6(%rbp)
jmp    11a6 <main+0x86>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
movb   $0x1,-0x6(%rbp)
jmp    1133 <main+0x13>
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),%al
jne    1147 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ebx,%ebx
jmp    1176 <main+0x56>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %ebp,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%al
je     113a <main+0x1a>
mov    $0x1,%bpl
cmp    $0x20,%al
ja     1160 <main+0x40>
movzbl %al,%ecx
bt     %rcx,%r14
jae    1160 <main+0x40>
cmp    $0x1,%bl
jne    116a <main+0x4a>
mov    $0xa,%al
xor    %ebp,%ebp
jmp    1160 <main+0x40>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %3
br label %4
4: ; preds = %32, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %33
10: ; preds = %4
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 32
br i1 %13, label %22, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 9
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %29
22: ; preds = %18, %14, %10
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 @putchar(i8 signext 10)
store i8 0, i8* %3
br label %28
28: ; preds = %26, %22
br label %32
29: ; preds = %18
%30 = load i8, i8* %2
%31 = call i32 @putchar(i8 signext %30)
store i8 1, i8* %3
br label %32
32: ; preds = %29, %28
br label %4
33: ; preds = %4
ret i32 0
}

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 %18, label %4
4: ; preds = %0, %13
%5 = phi i8 [ %15, %13 ], [ %1, %0 ]
%6 = phi i8 [ %14, %13 ], [ 0, %0 ]
switch i8 %5, label %9 [
i8 32, label %7
i8 10, label %7
i8 9, label %7
]
7: ; preds = %4, %4, %4
%8 = icmp eq i8 %6, 1
br i1 %8, label %9, label %13
9: ; preds = %4, %7
%10 = phi i8 [ 10, %7 ], [ %5, %4 ]
%11 = phi i8 [ 0, %7 ], [ 1, %4 ]
%12 = tail call i32 @putchar(i8 signext %10)
br label %13
13: ; preds = %9, %7
%14 = phi i8 [ %6, %7 ], [ %11, %9 ]
%15 = tail call signext i8 (...) @getchar()
%16 = load i8, i8* @EOF
%17 = icmp eq i8 %15, %16
br i1 %17, label %18, label %4
18: ; preds = %13, %0
ret i32 0
}