#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*/ isdigit(char const);
int /*<<< orphan*/ isupper(char const);
int /*<<< orphan*/ strchr(char *, char const);
int is_variable(const char *s) {
  for (; *s; s++)
    if (!isupper(*s) && !isdigit(*s) && !strchr("_-", *s))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_variable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b1 <is_variable+0x81>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isupper@plt>
cmp    $0x0,%eax
jne    119b <is_variable+0x6b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    119b <is_variable+0x6b>
mov    -0x10(%rbp),%rax
lea    0xe82(%rip),%rdi
movsbl (%rax),%esi
call   1040 <strchr@plt>
cmp    $0x0,%eax
jne    119b <is_variable+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <is_variable+0x88>
jmp    11a0 <is_variable+0x70>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113c <is_variable+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_variable>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     1185 <is_variable+0x55>
mov    %rdi,%rbx
lea    0xeb7(%rip),%r14
jmp    115c <is_variable+0x2c>
nopl   0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1185 <is_variable+0x55>
movsbl %al,%edi
call   1050 <isupper@plt>
test   %eax,%eax
jne    1150 <is_variable+0x20>
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1150 <is_variable+0x20>
movsbl (%rbx),%esi
mov    %r14,%rdi
call   1040 <strchr@plt>
test   %eax,%eax
jne    1150 <is_variable+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"_-\00"
define i32 @is_variable(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %25, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %28
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i32 @isupper(i8 signext %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %24, label %13
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = call i32 @isdigit(i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = call i32 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %18
store i32 0, i32* %2
br label %29
24: ; preds = %18, %13, %8
br label %25
25: ; preds = %24
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
br label %4
28: ; preds = %4
store i32 1, i32* %2
br label %29
29: ; preds = %28, %23
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
@.str = [3 x i8] c"_-\00"
define i32 @is_variable(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %21, label %4
4: ; preds = %1, %17
%5 = phi i8 [ %19, %17 ], [ %2, %1 ]
%6 = phi i8* [ %18, %17 ], [ %0, %1 ]
%7 = tail call i32 @isupper(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i8, i8* %6
%11 = tail call i32 @isdigit(i8 signext %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i8, i8* %6
%15 = tail call i32 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %4, %9, %13
%18 = getelementptr inbounds i8, i8* %6, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %4
21: ; preds = %13, %17, %1
%22 = phi i32 [ 1, %1 ], [ 1, %17 ], [ 0, %13 ]
ret i32 %22
}