#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 /*<<< orphan*/ assert(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  FILE *file;
  char buffer[1024], ch;
  int length = 0, i, done = 0, nread;
  if (argc != 2) {
    fprintf(stderr, "Usage:\n\ngetlength seqfile\n");
    exit(1);
  }
  file = fopen(argv[1], "r");
  assert(file);
  fgets(buffer, 1024, file);
  while (!feof(file) && !done) {
    nread = fread(buffer, 1, 1024, file);
    for (i = 0; i < nread; i++) {
      ch = buffer[i];
      if (ch == '>') {
        done = 1;
        break;
      }
      if (((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) || ch == '.' ||
          ch == '-')
        length++;
    }
  }
  fclose(file);
  printf("%d\n", length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x428(%rbp)
movl   $0x0,-0x430(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11e6 <main+0x56>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe29(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe26(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <assert@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1060 <fgets@plt>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x435(%rbp)
jne    124a <main+0xba>
cmpl   $0x0,-0x430(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x435(%rbp)
mov    -0x435(%rbp),%al
test   $0x1,%al
jne    125d <main+0xcd>
jmp    1359 <main+0x1c9>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
mov    %eax,-0x434(%rbp)
movl   $0x0,-0x42c(%rbp)
mov    -0x42c(%rbp),%eax
cmp    -0x434(%rbp),%eax
jge    1354 <main+0x1c4>
movslq -0x42c(%rbp),%rax
mov    -0x420(%rbp,%rax,1),%al
mov    %al,-0x421(%rbp)
movsbl -0x421(%rbp),%eax
cmp    $0x3e,%eax
jne    12cc <main+0x13c>
movl   $0x1,-0x430(%rbp)
jmp    1354 <main+0x1c4>
movsbl -0x421(%rbp),%eax
cmp    $0x41,%eax
jl     12ec <main+0x15c>
movsbl -0x421(%rbp),%eax
cmp    $0x5a,%eax
jle    132c <main+0x19c>
movsbl -0x421(%rbp),%eax
cmp    $0x61,%eax
jl     130c <main+0x17c>
movsbl -0x421(%rbp),%eax
cmp    $0x7a,%eax
jle    132c <main+0x19c>
movsbl -0x421(%rbp),%eax
cmp    $0x2e,%eax
je     132c <main+0x19c>
movsbl -0x421(%rbp),%eax
cmp    $0x2d,%eax
jne    133b <main+0x1ab>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    1340 <main+0x1b0>
mov    -0x42c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x42c(%rbp)
jmp    1287 <main+0xf7>
jmp    121c <main+0x8c>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x428(%rbp),%esi
lea    0xcae(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
cmp    $0x2,%edi
jne    1287 <main+0xf7>
mov    0x8(%rsi),%rdi
lea    0xe6a(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <assert@plt>
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
mov    %r14,%rdi
call   1090 <feof@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     1205 <main+0x75>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0xe2f(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
mov    %rsp,%r15
jmp    121e <main+0x8e>
nopl   0x0(%rax)
xor    %ebp,%ebp
mov    %r14,%rdi
call   1090 <feof@plt>
or     %ebp,%eax
jne    11df <main+0x4f>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1030 <fread@plt>
test   %eax,%eax
jle    1210 <main+0x80>
mov    %eax,%eax
xor    %ecx,%ecx
jmp    124c <main+0xbc>
nopl   (%rax)
add    $0x1,%ebx
add    $0x1,%rcx
cmp    %rcx,%rax
je     1210 <main+0x80>
movzbl (%rsp,%rcx,1),%edx
cmp    $0x3e,%dl
je     1280 <main+0xf0>
lea    -0x41(%rdx),%esi
cmp    $0x1a,%sil
jb     1240 <main+0xb0>
lea    -0x2d(%rdx),%esi
cmp    $0x2,%sil
jb     1240 <main+0xb0>
add    $0x9f,%dl
cmp    $0x19,%dl
ja     1243 <main+0xb3>
jmp    1240 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebp
jmp    1212 <main+0x82>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
lea    0xd69(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Usage:\0A\0Agetlength seqfile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [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 [1024 x i8]
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %11
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %6
%24 = load i32*, i32** %6
%25 = call i32 @assert(i32* %24)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%27 = load i32*, i32** %6
%28 = call i32 @fgets(i8* %26, i32 1024, i32* %27)
br label %29
29: ; preds = %87, %19
%30 = load i32*, i32** %6
%31 = call i32 @feof(i32* %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = load i32, i32* %11
%35 = icmp ne i32 %34, 0
%36 = xor i1 %35, true
br label %37
37: ; preds = %33, %29
%38 = phi i1 [ false, %29 ], [ %36, %33 ]
br i1 %38, label %39, label %88
39: ; preds = %37
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%41 = load i32*, i32** %6
%42 = call i32 @fread(i8* %40, i32 1, i32 1024, i32* %41)
store i32 %42, i32* %12
store i32 0, i32* %10
br label %43
43: ; preds = %84, %39
%44 = load i32, i32* %10
%45 = load i32, i32* %12
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %87
47: ; preds = %43
%48 = load i32, i32* %10
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %49
%51 = load i8, i8* %50
store i8 %51, i8* %8
%52 = load i8, i8* %8
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 62
br i1 %54, label %55, label %56
55: ; preds = %47
store i32 1, i32* %11
br label %87
56: ; preds = %47
%57 = load i8, i8* %8
%58 = sext i8 %57 to i32
%59 = icmp sge i32 %58, 65
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = load i8, i8* %8
%62 = sext i8 %61 to i32
%63 = icmp sle i32 %62, 90
br i1 %63, label %80, label %64
64: ; preds = %60, %56
%65 = load i8, i8* %8
%66 = sext i8 %65 to i32
%67 = icmp sge i32 %66, 97
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = load i8, i8* %8
%70 = sext i8 %69 to i32
%71 = icmp sle i32 %70, 122
br i1 %71, label %80, label %72
72: ; preds = %68, %64
%73 = load i8, i8* %8
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 46
br i1 %75, label %80, label %76
76: ; preds = %72
%77 = load i8, i8* %8
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 45
br i1 %79, label %80, label %83
80: ; preds = %76, %72, %68, %60
%81 = load i32, i32* %9
%82 = add nsw i32 %81, 1
store i32 %82, i32* %9
br label %83
83: ; preds = %80, %76
br label %84
84: ; preds = %83
%85 = load i32, i32* %10
%86 = add nsw i32 %85, 1
store i32 %86, i32* %10
br label %43
87: ; preds = %55, %43
br label %29
88: ; preds = %37
%89 = load i32*, i32** %6
%90 = call i32 @fclose(i32* %89)
%91 = load i32, i32* %9
%92 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %91)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Usage:\0A\0Agetlength seqfile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @assert(i32* %13)
%15 = call i32 @fgets(i8* %4, i32 1024, i32* %13)
%16 = call i32 @feof(i32* %13)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %51
18: ; preds = %10, %45
%19 = phi i32 [ %46, %45 ], [ 0, %10 ]
%20 = call i32 @fread(i8* %4, i32 1, i32 1024, i32* %13)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %45
22: ; preds = %18
%23 = zext i32 %20 to i64
br label %24
24: ; preds = %22, %41
%25 = phi i64 [ 0, %22 ], [ %43, %41 ]
%26 = phi i32 [ %19, %22 ], [ %42, %41 ]
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %25
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 62
br i1 %29, label %45, label %30
30: ; preds = %24
%31 = add i8 %28, -65
%32 = icmp ult i8 %31, 26
br i1 %32, label %39, label %33
33: ; preds = %30
%34 = add i8 %28, -97
%35 = icmp ult i8 %34, 26
%36 = add i8 %28, -45
%37 = icmp ult i8 %36, 2
%38 = or i1 %37, %35
br i1 %38, label %39, label %41
39: ; preds = %33, %30
%40 = add nsw i32 %26, 1
br label %41
41: ; preds = %39, %33
%42 = phi i32 [ %40, %39 ], [ %26, %33 ]
%43 = add nuw nsw i64 %25, 1
%44 = icmp eq i64 %43, %23
br i1 %44, label %45, label %24
45: ; preds = %41, %24, %18
%46 = phi i32 [ %19, %18 ], [ %26, %24 ], [ %42, %41 ]
%47 = phi i32 [ 0, %18 ], [ 1, %24 ], [ 0, %41 ]
%48 = call i32 @feof(i32* %13)
%49 = or i32 %48, %47
%50 = icmp eq i32 %49, 0
br i1 %50, label %18, label %51
51: ; preds = %45, %10
%52 = phi i32 [ 0, %10 ], [ %46, %45 ]
%53 = call i32 @fclose(i32* %13)
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %52)
ret i32 0
}