#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(void) {
  int c;
  int blank = 0;
  printf("enter some words:\n");
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (blank == 0)
        putchar('\n');
      blank = 1;
    } else {
      blank = 0;
      putchar(c);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
je     11bd <main+0x8d>
cmpl   $0x20,-0x8(%rbp)
je     1189 <main+0x59>
cmpl   $0x9,-0x8(%rbp)
je     1189 <main+0x59>
cmpl   $0xa,-0x8(%rbp)
jne    11a9 <main+0x79>
cmpl   $0x0,-0xc(%rbp)
jne    119d <main+0x6d>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,-0xc(%rbp)
jmp    11b8 <main+0x88>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1152 <main+0x22>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e9a(%rip),%rbx
cmp    (%rbx),%eax
jne    1159 <main+0x29>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ecx,%ecx
jmp    1184 <main+0x54>
nopw   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%eax
je     1152 <main+0x22>
xor    %ebp,%ebp
cmp    $0x20,%eax
ja     1170 <main+0x40>
mov    %eax,%edx
bt     %rdx,%r14
jae    1170 <main+0x40>
mov    $0x1,%ebp
test   %ecx,%ecx
jne    1177 <main+0x47>
mov    $0xa,%eax
jmp    1170 <main+0x40>

LLVM IR (-O0):
@.str = [19 x i8] c"enter some words:\0A\00"
@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
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %27, %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 %28
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 %24
18: ; preds = %15, %12, %9
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @putchar(i32 10)
br label %23
23: ; preds = %21, %18
store i32 1, i32* %3
br label %27
24: ; preds = %15
store i32 0, i32* %3
%25 = load i32, i32* %2
%26 = call i32 @putchar(i32 %25)
br label %27
27: ; preds = %24, %23
br label %5
28: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@str = [18 x i8] c"enter some words:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %19, label %5
5: ; preds = %0, %14
%6 = phi i32 [ %16, %14 ], [ %2, %0 ]
%7 = phi i32 [ %15, %14 ], [ 0, %0 ]
switch i32 %6, label %10 [
i32 32, label %8
i32 10, label %8
i32 9, label %8
]
8: ; preds = %5, %5, %5
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %14
10: ; preds = %5, %8
%11 = phi i32 [ 10, %8 ], [ %6, %5 ]
%12 = phi i32 [ 1, %8 ], [ 0, %5 ]
%13 = tail call i32 @putchar(i32 %11)
br label %14
14: ; preds = %10, %8
%15 = phi i32 [ 1, %8 ], [ %12, %10 ]
%16 = tail call i32 (...) @getchar()
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %5
19: ; preds = %14, %0
ret i32 0
}