#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*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
scalar_t__ isalpha(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  FILE *fp;
  int c;
  int n = 0;
  if ((argc = 2)) {
    fp = fopen(argv[1], "r");
    while (((c = getc(fp)) != EOF) && isalpha(getc(fp))) {
      n++;
    }
  }
  printf("%d\n", n);
}


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   $0x2,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1173 <main+0x33>
jmp    11ea <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
mov    0x2e46(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x21(%rbp)
je     11c7 <main+0x87>
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11d7 <main+0x97>
jmp    11e5 <main+0xa5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    118b <main+0x4b>
jmp    11ea <main+0xaa>
mov    -0x20(%rbp),%esi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x8(%rsi),%rdi
lea    0xeb1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <getc@plt>
mov    0x2e82(%rip),%r14
xor    %ebp,%ebp
cmp    (%r14),%eax
je     1194 <main+0x54>
xor    %ebp,%ebp
nop
mov    %rbx,%rdi
call   1060 <getc@plt>
mov    %eax,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
je     1194 <main+0x54>
add    $0x1,%ebp
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    (%r14),%eax
jne    1170 <main+0x30>
lea    0xe67(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 2, i32* %4
br i1 true, label %9, label %30
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %6
br label %14
14: ; preds = %26, %9
%15 = load i32*, i32** %6
%16 = call i32 @getc(i32* %15)
store i32 %16, i32* %7
%17 = load i32, i32* @EOF
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i32*, i32** %6
%21 = call i32 @getc(i32* %20)
%22 = call i64 @isalpha(i32 %21)
%23 = icmp ne i64 %22, 0
br label %24
24: ; preds = %19, %14
%25 = phi i1 [ false, %14 ], [ %23, %19 ]
br i1 %25, label %26, label %29
26: ; preds = %24
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %14
29: ; preds = %24
br label %30
30: ; preds = %29, %2
%31 = load i32, i32* %8
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %3
ret i32 %33
}

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 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @getc(i32* %5)
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %19, label %9
9: ; preds = %2, %14
%10 = phi i32 [ %15, %14 ], [ 0, %2 ]
%11 = tail call i32 @getc(i32* %5)
%12 = tail call i64 @isalpha(i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = add nuw nsw i32 %10, 1
%16 = tail call i32 @getc(i32* %5)
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %9
19: ; preds = %14, %9, %2
%20 = phi i32 [ 0, %2 ], [ %10, %9 ], [ %15, %14 ]
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}