#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 */
int /*<<< orphan*/ isalnum(char const);
int /*<<< orphan*/ isalpha(char const);
int isvalididentifier(char const *name) {
  if (!isalpha(*name) && *name != '_')
    return 0;
  while (*++name)
    if (!isalnum(*name) && *name != '_')
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isvalididentifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    115d <isvalididentifier+0x3d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     115d <isvalididentifier+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <isvalididentifier+0x98>
jmp    1162 <isvalididentifier+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,0x1(%rax)
je     11b1 <isvalididentifier+0x91>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    11ac <isvalididentifier+0x8c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     11ac <isvalididentifier+0x8c>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <isvalididentifier+0x98>
jmp    1162 <isvalididentifier+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isvalididentifier>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isalpha@plt>
test   %eax,%eax
jne    1139 <isvalididentifier+0x19>
xor    %ebp,%ebp
cmpb   $0x5f,(%rbx)
jne    116f <isvalididentifier+0x4f>
mov    0x1(%rbx),%al
mov    $0x1,%ebp
test   %al,%al
je     116f <isvalididentifier+0x4f>
add    $0x2,%rbx
jmp    115b <isvalididentifier+0x3b>
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     116f <isvalididentifier+0x4f>
movsbl %al,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
jne    1150 <isvalididentifier+0x30>
cmpb   $0x5f,-0x1(%rbx)
je     1150 <isvalididentifier+0x30>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isvalididentifier(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = call i32 @isalpha(i8 signext %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 95
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 0, i32* %2
br label %33
14: ; preds = %8, %1
br label %15
15: ; preds = %31, %14
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = call i32 @isalnum(i8 signext %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 95
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 0, i32* %2
br label %33
31: ; preds = %25, %20
br label %15
32: ; preds = %15
store i32 1, i32* %2
br label %33
33: ; preds = %32, %30, %13
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @isvalididentifier(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @isalpha(i8 signext %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 95
br i1 %7, label %8, label %24
8: ; preds = %5, %1
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %8, %20
%13 = phi i8 [ %22, %20 ], [ %10, %8 ]
%14 = phi i8* [ %21, %20 ], [ %9, %8 ]
%15 = tail call i32 @isalnum(i8 signext %13)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8, i8* %14
%19 = icmp eq i8 %18, 95
br i1 %19, label %20, label %24
20: ; preds = %17, %12
%21 = getelementptr inbounds i8, i8* %14, i64 1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %12
24: ; preds = %17, %20, %8, %5
%25 = phi i32 [ 0, %5 ], [ 1, %8 ], [ 0, %17 ], [ 1, %20 ]
ret i32 %25
}