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


x86 assembly (clang, -O0):
<isSymbolString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    116b <isSymbolString+0x4b>
movsbl -0x11(%rbp),%eax
cmp    $0x5f,%eax
je     116b <isSymbolString+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <isSymbolString+0xa8>
jmp    1170 <isSymbolString+0x50>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     11c1 <isSymbolString+0xa1>
movsbl -0x11(%rbp),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
jne    11bc <isSymbolString+0x9c>
movsbl -0x11(%rbp),%eax
cmp    $0x5f,%eax
je     11bc <isSymbolString+0x9c>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <isSymbolString+0xa8>
jmp    1170 <isSymbolString+0x50>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isSymbolString>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
movsbl (%rdi),%ebx
mov    %ebx,%edi
call   1040 <isalpha@plt>
xor    %r14d,%r14d
cmp    $0x5f,%ebx
je     113d <isSymbolString+0x1d>
test   %eax,%eax
je     1176 <isSymbolString+0x56>
add    $0x1,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%rbp),%ebx
test   %bl,%bl
je     1170 <isSymbolString+0x50>
movsbl %bl,%edi
call   1030 <isalnum@plt>
add    $0x1,%rbp
test   %rax,%rax
jne    1150 <isSymbolString+0x30>
cmp    $0x5f,%bl
je     1150 <isSymbolString+0x30>
jmp    1176 <isSymbolString+0x56>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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