#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();
scalar_t__ isspace(int);
int /*<<< orphan*/ putchar(int);
int main(void) {
  bool in_word = false;
  int c = 0;
  while ((c = getchar()) != EOF)
    if (isspace(c)) {
      if (in_word) {
        in_word = false;
        putchar('\n');
      }
    } else {
      in_word = true;
      putchar(c);
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
je     11ac <main+0x7c>
mov    -0xc(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1198 <main+0x68>
cmpl   $0x0,-0x8(%rbp)
je     1193 <main+0x63>
movl   $0x0,-0x8(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11a7 <main+0x77>
movl   $0x1,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <putchar@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   1050 <getchar@plt>
mov    0x2ea3(%rip),%r14
cmp    (%r14),%eax
jne    1157 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
xor    %r15d,%r15d
jmp    117d <main+0x4d>
xchg   %ax,%ax
mov    $0x1,%ebp
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    %ebp,%r15d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     114a <main+0x1a>
mov    %ebx,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1160 <main+0x30>
mov    $0xa,%ebx
xor    %ebp,%ebp
test   %r15d,%r15d
mov    $0x0,%r15d
jne    1165 <main+0x35>
jmp    116f <main+0x3f>

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