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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     11a4 <main+0x84>
mov    -0x8(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
cmpl   $0x9,-0x8(%rbp)
je     1178 <main+0x58>
cmpl   $0xa,-0x8(%rbp)
je     1178 <main+0x58>
cmpl   $0x20,-0x8(%rbp)
jne    1198 <main+0x78>
cmpl   $0x1,-0xc(%rbp)
jne    118c <main+0x6c>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    119f <main+0x7f>
movl   $0x1,-0xc(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%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),%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
jmp    1171 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    %r12d,%ebp
cmp    (%r14),%eax
je     113b <main+0x1b>
movsbl %bl,%edi
call   1030 <putchar@plt>
mov    $0x1,%r12d
cmp    $0x20,%ebx
ja     1160 <main+0x40>
mov    %ebx,%eax
bt     %rax,%r15
jae    1160 <main+0x40>
xor    %r12d,%r12d
cmp    $0x1,%ebp
jne    1160 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x40>

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