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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
mov    0x2e8e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11d3 <main+0xa3>
cmpl   $0x0,-0x8(%rbp)
je     11a6 <main+0x76>
movsbl -0x9(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1198 <main+0x68>
movl   $0x0,-0x8(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11a1 <main+0x71>
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ce <main+0x9e>
movsbl -0x9(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
jne    11c9 <main+0x99>
movl   $0x1,-0x8(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ce <main+0x9e>
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea6(%rip),%r14
cmp    (%r14),%al
jne    114e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebx
xor    %ebp,%ebp
jmp    117c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl %bl,%ebx
mov    %al,%bpl
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     1147 <main+0x17>
movsbl %bl,%edi
call   1040 <isspace@plt>
test   %ebp,%ebp
je     11a0 <main+0x70>
xor    %ebp,%ebp
test   %rax,%rax
sete   %al
je     1160 <main+0x30>
mov    $0xa,%ebx
jmp    1163 <main+0x33>
nopl   0x0(%rax)
xor    %ebp,%ebp
test   %rax,%rax
jne    116e <main+0x3e>
mov    $0x1,%ebp
jmp    1166 <main+0x36>

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

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