#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(int);
int /*<<< orphan*/ puts(char *);
wc_3(void) {
  int c, linestarted = 0;
  puts("Say something");
  while ((c = getchar()) != EOF)
    if (c == ' ' || c == '\n' || c == '\t') {
      if (!linestarted) {
        putchar('\n');
        linestarted = 1;
      }
    } else {
      putchar(c);
      linestarted = 0;
    }
}


x86 assembly (clang, -O0):
<wc_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%eax
je     11b6 <wc_3+0x86>
cmpl   $0x20,-0x8(%rbp)
je     1182 <wc_3+0x52>
cmpl   $0xa,-0x8(%rbp)
je     1182 <wc_3+0x52>
cmpl   $0x9,-0x8(%rbp)
jne    11a2 <wc_3+0x72>
cmpl   $0x0,-0xc(%rbp)
jne    119d <wc_3+0x6d>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,-0xc(%rbp)
jmp    11b1 <wc_3+0x81>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    114b <wc_3+0x1b>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wc_3>:
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    1157 <wc_3+0x27>
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ecx,%ecx
jmp    1184 <wc_3+0x54>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%eax
je     1152 <wc_3+0x22>
xor    %ebp,%ebp
cmp    $0x20,%eax
ja     1170 <wc_3+0x40>
mov    %eax,%edx
bt     %rdx,%r14
jae    1170 <wc_3+0x40>
mov    $0x1,%ebp
test   %ecx,%ecx
jne    1177 <wc_3+0x47>
mov    $0xa,%eax
jmp    1170 <wc_3+0x40>

LLVM IR (-O0):
@.str = [14 x i8] c"Say something\00"
@EOF = global i32 0
define i32 @wc_3() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %3
%4 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 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, 10
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 9
br i1 %17, label %18, label %24
18: ; preds = %15, %12, %9
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 @putchar(i32 10)
store i32 1, i32* %3
br label %23
23: ; preds = %21, %18
br label %27
24: ; preds = %15
%25 = load i32, i32* %2
%26 = call i32 @putchar(i32 %25)
store i32 0, i32* %3
br label %27
27: ; preds = %24, %23
br label %5
28: ; preds = %5
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [14 x i8] c"Say something\00"
@EOF = global i32 0
define i32 @wc_3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 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 undef
}