#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 */
struct gff3Ann {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gff3AnnErr(struct gff3Ann *, char *, char *);
scalar_t__ isalnum(char);
int isalpha(char);
int checkAttrTag(struct gff3Ann *g3a, char *tag) {
  char *tc = tag;
  int isOk = isalpha(*tc);
  for (tc++; isOk && (*tc != '\0'); tc++)
    isOk = (*tc == '_') || isalnum(*tc);
  if (!isOk)
    gff3AnnErr(g3a,
               "invalid attribute tag, must start with an alphabetic character "
               "and be composed of alphanumeric or underscore characters: %s",
               tag);
  return isOk;
}


x86 assembly (clang, -O0):
<checkAttrTag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isalpha@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
je     1182 <checkAttrTag+0x52>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1192 <checkAttrTag+0x62>
jmp    11d9 <checkAttrTag+0xa9>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x5f,%ecx
mov    %al,-0x1e(%rbp)
je     11bd <checkAttrTag+0x8d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1163 <checkAttrTag+0x33>
cmpl   $0x0,-0x1c(%rbp)
jne    11f7 <checkAttrTag+0xc7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe0e(%rip),%rsi
call   1040 <gff3AnnErr@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkAttrTag>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
movsbl (%rsi),%edi
call   1050 <isalpha@plt>
test   %eax,%eax
je     1172 <checkAttrTag+0x42>
lea    0x1(%r15),%rbx
jmp    1159 <checkAttrTag+0x29>
nopl   (%rax)
add    $0x1,%rbx
mov    $0x1,%eax
movzbl (%rbx),%ecx
cmp    $0x5f,%cl
je     1150 <checkAttrTag+0x20>
test   %cl,%cl
je     1186 <checkAttrTag+0x56>
movsbl %cl,%edi
call   1030 <isalnum@plt>
test   %rax,%rax
jne    1150 <checkAttrTag+0x20>
lea    0xe87(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1040 <gff3AnnErr@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.gff3Ann = type { i32 }
@.str = [124 x i8] c"invalid attribute tag, must start with an alphabetic character and be composed of alphanumeric or underscore characters: %s\00"
define i32 @checkAttrTag(%struct.gff3Ann* %0, i8* %1) {
%3 = alloca %struct.gff3Ann*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store %struct.gff3Ann* %0, %struct.gff3Ann** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = call i32 @isalpha(i8 signext %9)
store i32 %10, i32* %6
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %5
br label %13
13: ; preds = %36, %2
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %16, %13
%22 = phi i1 [ false, %13 ], [ %20, %16 ]
br i1 %22, label %23, label %39
23: ; preds = %21
%24 = load i8*, i8** %5
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 95
br i1 %27, label %33, label %28
28: ; preds = %23
%29 = load i8*, i8** %5
%30 = load i8, i8* %29
%31 = call i64 @isalnum(i8 signext %30)
%32 = icmp ne i64 %31, 0
br label %33
33: ; preds = %28, %23
%34 = phi i1 [ true, %23 ], [ %32, %28 ]
%35 = zext i1 %34 to i32
store i32 %35, i32* %6
br label %36
36: ; preds = %33
%37 = load i8*, i8** %5
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %5
br label %13
39: ; preds = %21
%40 = load i32, i32* %6
%41 = icmp ne i32 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %39
%43 = load %struct.gff3Ann*, %struct.gff3Ann** %3
%44 = load i8*, i8** %4
%45 = call i32 @gff3AnnErr(%struct.gff3Ann* %43, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %42, %39
%47 = load i32, i32* %6
ret i32 %47
}

LLVM IR (-O2):
%struct.gff3Ann = type { i32 }
@.str = [124 x i8] c"invalid attribute tag, must start with an alphabetic character and be composed of alphanumeric or underscore characters: %s\00"
define i32 @checkAttrTag(%struct.gff3Ann* %0, i8* %1) {
%3 = load i8, i8* %1
%4 = tail call i32 @isalpha(i8 signext %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %2, %11
%7 = phi i8* [ %9, %11 ], [ %1, %2 ]
%8 = phi i32 [ 1, %11 ], [ %4, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %9
switch i8 %10, label %12 [
i8 0, label %17
i8 95, label %11
]
11: ; preds = %6, %12
br label %6
12: ; preds = %6
%13 = tail call i64 @isalnum(i8 signext %10)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %11
15: ; preds = %12, %2
%16 = tail call i32 @gff3AnnErr(%struct.gff3Ann* %0, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %17
17: ; preds = %6, %15
%18 = phi i32 [ 0, %15 ], [ %8, %6 ]
ret i32 %18
}