#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
int main(int argv, char *argc[]) {
  FILE *in;
  int c, flag = 0, palavra = 0;
  if (argv > 1) {
    in = fopen(argc[1], "r");
    while ((c = getc(in)) != EOF) {
      if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
        if (flag)
          continue;
        palavra++;
        flag = 1;
      }
      if (c == ' ' || c == '\n') {
        flag = 0;
      }
    }
    printf("%d\n", palavra);
    fclose(in);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1220 <main+0xe0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe83(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e4f(%rip),%rcx
cmp    (%rcx),%eax
je     1208 <main+0xc8>
cmpl   $0x61,-0x1c(%rbp)
jl     11b5 <main+0x75>
cmpl   $0x7a,-0x1c(%rbp)
jle    11c9 <main+0x89>
cmpl   $0x41,-0x1c(%rbp)
jl     11e8 <main+0xa8>
cmpl   $0x5a,-0x1c(%rbp)
jg     11e8 <main+0xa8>
cmpl   $0x0,-0x20(%rbp)
je     11d8 <main+0x98>
jmp    1186 <main+0x46>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x20(%rbp)
cmpl   $0x20,-0x1c(%rbp)
je     11fc <main+0xbc>
cmpl   $0xa,-0x1c(%rbp)
jne    1203 <main+0xc3>
movl   $0x0,-0x20(%rbp)
jmp    1186 <main+0x46>
mov    -0x24(%rbp),%esi
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jl     11d9 <main+0x99>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
lea    0xea5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
mov    0x2e7c(%rip),%r15
xor    %r14d,%r14d
jmp    1180 <main+0x40>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    (%r15),%eax
je     11b8 <main+0x78>
mov    %eax,%ecx
and    $0xffffffdf,%ecx
add    $0xffffffbf,%ecx
cmp    $0x19,%ecx
ja     11ac <main+0x6c>
test   %ebp,%ebp
mov    $0x1,%ebp
jne    1180 <main+0x40>
add    $0x1,%r14d
mov    $0x1,%ebp
cmp    $0x20,%eax
je     1171 <main+0x31>
cmp    $0xa,%eax
je     1171 <main+0x31>
jmp    1180 <main+0x40>
lea    0xe43(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %33
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %27, %4
%9 = phi i32 [ 0, %4 ], [ %28, %27 ]
%10 = phi i32 [ 0, %4 ], [ %26, %27 ]
br label %11
11: ; preds = %8, %20
%12 = phi i32 [ 1, %20 ], [ %9, %8 ]
%13 = tail call i32 @getc(i32* %7)
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %30, label %16
16: ; preds = %11
%17 = and i32 %13, -33
%18 = add i32 %17, -65
%19 = icmp ult i32 %18, 26
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = icmp eq i32 %12, 0
br i1 %21, label %22, label %11
22: ; preds = %20
%23 = add nsw i32 %10, 1
br label %24
24: ; preds = %16, %22
%25 = phi i32 [ 1, %22 ], [ %12, %16 ]
%26 = phi i32 [ %23, %22 ], [ %10, %16 ]
switch i32 %13, label %27 [
i32 32, label %29
i32 10, label %29
]
27: ; preds = %24, %29
%28 = phi i32 [ 0, %29 ], [ %25, %24 ]
br label %8
29: ; preds = %24, %24
br label %27
30: ; preds = %11
%31 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%32 = tail call i32 @fclose(i32* %7)
br label %33
33: ; preds = %30, %2
ret i32 0
}