#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();
int /*<<< orphan*/ printf(char *, unsigned long);
main() {
  unsigned long int words = 0;
  char ch;
  int in_word = 0;
  while ((ch = getchar()) != EOF)
    if ((ch == ' ') || (ch == '\t') || (ch == '\n')) {
      if (in_word) {
        words++;
        in_word = 0;
      }
    } else
      in_word = 1;
  printf("%d\n", words);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e96(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11b2 <main+0x92>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
je     1184 <main+0x64>
movsbl -0x11(%rbp),%eax
cmp    $0x9,%eax
je     1184 <main+0x64>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    11a6 <main+0x86>
cmpl   $0x0,-0x18(%rbp)
je     11a1 <main+0x81>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    11ad <main+0x8d>
movl   $0x1,-0x18(%rbp)
jmp    113e <main+0x1e>
mov    -0x10(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r14
cmp    (%r14),%al
jne    1158 <main+0x38>
xor    %ebx,%ebx
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r15
xor    %ecx,%ecx
xor    %ebx,%ebx
jmp    117e <main+0x5e>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%r14),%al
je     113c <main+0x1c>
mov    $0x1,%ebp
cmp    $0x20,%al
ja     1170 <main+0x50>
movzbl %al,%eax
bt     %rax,%r15
jae    1170 <main+0x50>
cmp    $0x1,%ecx
sbb    $0xffffffffffffffff,%rbx
xor    %ebp,%ebp
jmp    1170 <main+0x50>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i32 0, i32* %4
br label %5
5: ; preds = %31, %0
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %3
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %32
11: ; preds = %5
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 9
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %30
23: ; preds = %19, %15, %11
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i64, i64* %2
%28 = add i64 %27, 1
store i64 %28, i64* %2
store i32 0, i32* %4
br label %29
29: ; preds = %26, %23
br label %31
30: ; preds = %19
store i32 1, i32* %4
br label %31
31: ; preds = %30, %29
br label %5
32: ; preds = %5
%33 = load i64, i64* %2
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %33)
%35 = load i32, i32* %1
ret i32 %35
}

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