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


x86 assembly (clang, -O0):
<isIdentifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1154 <isIdentifier+0x34>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    1160 <isIdentifier+0x40>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <isIdentifier+0xa8>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c1 <isIdentifier+0xa1>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
jne    119f <isIdentifier+0x7f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    11b0 <isIdentifier+0x90>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11bc <isIdentifier+0x9c>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <isIdentifier+0xa8>
jmp    116c <isIdentifier+0x4c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isIdentifier>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1175 <isIdentifier+0x55>
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isalpha@plt>
test   %eax,%eax
je     1175 <isIdentifier+0x55>
mov    0x1(%rbx),%al
test   %al,%al
je     1170 <isIdentifier+0x50>
add    $0x2,%rbx
jmp    115b <isIdentifier+0x3b>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1170 <isIdentifier+0x50>
movsbl %al,%edi
call   1030 <isalnum@plt>
test   %rax,%rax
jne    1150 <isIdentifier+0x30>
cmpb   $0x5f,-0x1(%rbx)
je     1150 <isIdentifier+0x30>
jmp    1175 <isIdentifier+0x55>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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