#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 *, int);
int main(void) {
  char c;
  int inorout = 0;
  int words = 0;
  while ((c = getchar()) != EOF) {
    if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))) {
      if (inorout == 0) {
        inorout = 1;
        words++;
      }
    } else if ((c == ' ') || (c == '\n')) {
      inorout = 0;
    } else {
    }
  }
  printf("%d\n", words);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e97(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11e4 <main+0xc4>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1176 <main+0x56>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    1190 <main+0x70>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     11af <main+0x8f>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     11af <main+0x8f>
cmpl   $0x0,-0xc(%rbp)
jne    11aa <main+0x8a>
movl   $0x1,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11df <main+0xbf>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     11c9 <main+0xa9>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11d5 <main+0xb5>
movl   $0x0,-0xc(%rbp)
jmp    11da <main+0xba>
jmp    11da <main+0xba>
jmp    11df <main+0xbf>
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb4(%rip),%r14
cmp    (%r14),%al
jne    114e <main+0x2e>
lea    0xec0(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1177 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x1,%ebp
adc    $0x0,%ebx
mov    $0x1,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%al
je     1139 <main+0x19>
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
jbe    1160 <main+0x40>
cmp    $0x20,%al
je     118c <main+0x6c>
cmp    $0xa,%al
jne    116b <main+0x4b>
xor    %ebp,%ebp
jmp    116b <main+0x4b>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %45, %0
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %2
%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 %46
11: ; preds = %5
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 97
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 122
br i1 %18, label %27, label %19
19: ; preds = %15, %11
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 65
br i1 %22, label %23, label %34
23: ; preds = %19
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 90
br i1 %26, label %27, label %34
27: ; preds = %23, %15
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27
store i32 1, i32* %3
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %33
33: ; preds = %30, %27
br label %45
34: ; preds = %23, %19
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 32
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 10
br i1 %41, label %42, label %43
42: ; preds = %38, %34
store i32 0, i32* %3
br label %44
43: ; preds = %38
br label %44
44: ; preds = %43, %42
br label %45
45: ; preds = %44, %33
br label %5
46: ; preds = %5
%47 = load i32, i32* %4
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %47)
ret i32 0
}

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 %23, label %4
4: ; preds = %0, %17
%5 = phi i8 [ %20, %17 ], [ %1, %0 ]
%6 = phi i32 [ %19, %17 ], [ 0, %0 ]
%7 = phi i32 [ %18, %17 ], [ 0, %0 ]
%8 = and i8 %5, -33
%9 = add i8 %8, -65
%10 = icmp ult i8 %9, 26
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = icmp eq i32 %7, 0
%13 = zext i1 %12 to i32
%14 = add nsw i32 %6, %13
br label %17
15: ; preds = %4
switch i8 %5, label %17 [
i8 32, label %16
i8 10, label %16
]
16: ; preds = %15, %15
br label %17
17: ; preds = %11, %15, %16
%18 = phi i32 [ 0, %16 ], [ %7, %15 ], [ 1, %11 ]
%19 = phi i32 [ %6, %16 ], [ %6, %15 ], [ %14, %11 ]
%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 = %17, %0
%24 = phi i32 [ 0, %0 ], [ %19, %17 ]
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
}