#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(int /*<<< orphan*/);
char *strrchr(char *, char);
int isidentifier(char *s) {
  while (*s) {
    char *p = strrchr("_-.,/~+", *s);
    if (!isalnum(*s++) && (p == NULL))
      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
cmpb   $0x0,(%rax)
je     118c <isidentifier+0x6c>
mov    -0x10(%rbp),%rax
lea    0xebc(%rip),%rdi
movsbl (%rax),%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    1187 <isidentifier+0x67>
cmpq   $0x0,-0x18(%rbp)
jne    1187 <isidentifier+0x67>
movl   $0x0,-0x4(%rbp)
jmp    1193 <isidentifier+0x73>
jmp    112c <isidentifier+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isidentifier>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xecf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%ebp
test   %ebp,%ebp
je     116c <isidentifier+0x4c>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <strrchr@plt>
mov    %rax,%r15
add    $0x1,%rbx
mov    %ebp,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
jne    1140 <isidentifier+0x20>
test   %r15,%r15
jne    1140 <isidentifier+0x20>
xor    %eax,%eax
jmp    1171 <isidentifier+0x51>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"_-.,/~+\00"
define i32 @isidentifier(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
br label %5
5: ; preds = %23, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call i8* @strrchr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %11)
store i8* %12, i8** %4
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = call i32 @isalnum(i32 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %9
%20 = load i8*, i8** %4
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 0, i32* %2
br label %25
23: ; preds = %19, %9
br label %5
24: ; preds = %5
store i32 1, i32* %2
br label %25
25: ; preds = %24, %22
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [8 x i8] c"_-.,/~+\00"
define i32 @isidentifier(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %8, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = tail call i8* @strrchr(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %4)
%8 = getelementptr inbounds i8, i8* %3, i64 1
%9 = sext i8 %4 to i32
%10 = tail call i32 @isalnum(i32 %9)
%11 = icmp ne i32 %10, 0
%12 = icmp ne i8* %7, null
%13 = select i1 %11, i1 true, i1 %12
br i1 %13, label %2, label %14
14: ; preds = %6, %2
%15 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %15
}