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


x86 assembly (clang, -O0):
<is_identifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    1165 <is_identifier+0x45>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     1165 <is_identifier+0x45>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <is_identifier+0xa0>
jmp    116a <is_identifier+0x4a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmpb   $0x0,0x1(%rax)
je     11b9 <is_identifier+0x99>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    11b4 <is_identifier+0x94>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     11b4 <is_identifier+0x94>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <is_identifier+0xa0>
jmp    116a <is_identifier+0x4a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @is_identifier(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
}