#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__ alnum(char);
int /*<<< orphan*/ letter(char);
bool identifier(char *name) {
  if (!letter(*name))
    return false;
  name++;
  while (*name) {
    if (!(alnum(*name) || *name == '_'))
      return false;
    name++;
  }
  return true;
}


x86 assembly (clang, -O0):
<identifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <letter@plt>
cmp    $0x0,%eax
jne    114d <identifier+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <identifier+0x90>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a9 <identifier+0x89>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <alnum@plt>
cmp    $0x0,%rax
jne    1198 <identifier+0x78>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     1198 <identifier+0x78>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <identifier+0x90>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1159 <identifier+0x39>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

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