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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     118e <main+0x6e>
movsbl -0x9(%rbp),%eax
cmp    $0x61,%eax
jl     1166 <main+0x46>
movsbl -0x9(%rbp),%eax
cmp    $0x7a,%eax
jle    1180 <main+0x60>
movsbl -0x9(%rbp),%eax
cmp    $0x41,%eax
jl     1189 <main+0x69>
movsbl -0x9(%rbp),%eax
cmp    $0x5a,%eax
jg     1189 <main+0x69>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1144 <main+0x24>
xor    %ebx,%ebx
and    $0xdf,%al
add    $0xbf,%al
cmp    $0x1a,%al
adc    $0x0,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1130 <main+0x10>
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 10
br i1 %2, label %13, label %3
3: ; preds = %0, %3
%4 = phi i8 [ %11, %3 ], [ %1, %0 ]
%5 = phi i32 [ %10, %3 ], [ 0, %0 ]
%6 = and i8 %4, -33
%7 = add i8 %6, -65
%8 = icmp ult i8 %7, 26
%9 = zext i1 %8 to i32
%10 = add nuw nsw i32 %5, %9
%11 = tail call signext i8 (...) @getchar()
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %3
13: ; preds = %3, %0
%14 = phi i32 [ 0, %0 ], [ %10, %3 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}