#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__ isalpha(unsigned char);
scalar_t__ isdigit(unsigned char);
scalar_t__ strchr(char *, int);
int __config_validate_name(const char *name) {
  const char *p = name;
  if (*p == '\0')
    return ((0));
  if (!isalpha((unsigned char)*p) && (*p != '*'))
    return ((0));
  for (++p; *p; ++p) {
    if (!(isalpha((unsigned char)*p) || isdigit((unsigned char)*p) ||
          strchr("*_-", (int)*p)))
      return ((0));
  }
  return ((1));
}


x86 assembly (clang, -O0):
<__config_validate_name>:
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),%eax
cmp    $0x0,%eax
jne    1160 <__config_validate_name+0x30>
movl   $0x0,-0x4(%rbp)
jmp    121d <__config_validate_name+0xed>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
jne    1192 <__config_validate_name+0x62>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
je     1192 <__config_validate_name+0x62>
movl   $0x0,-0x4(%rbp)
jmp    121d <__config_validate_name+0xed>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1216 <__config_validate_name+0xe6>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
jne    1200 <__config_validate_name+0xd0>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    1200 <__config_validate_name+0xd0>
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
lea    0xe1b(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    1200 <__config_validate_name+0xd0>
movl   $0x0,-0x4(%rbp)
jmp    121d <__config_validate_name+0xed>
jmp    1205 <__config_validate_name+0xd5>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    119e <__config_validate_name+0x6e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__config_validate_name>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
xor    %ebp,%ebp
test   %al,%al
je     11ae <__config_validate_name+0x7e>
mov    %rdi,%rbx
movzbl %al,%edi
call   1050 <isalpha@plt>
test   %rax,%rax
jne    1151 <__config_validate_name+0x21>
cmpb   $0x2a,(%rbx)
jne    11ae <__config_validate_name+0x7e>
mov    0x1(%rbx),%al
test   %al,%al
je     11a9 <__config_validate_name+0x79>
add    $0x2,%rbx
lea    0xe9d(%rip),%r14
jmp    117b <__config_validate_name+0x4b>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11a9 <__config_validate_name+0x79>
movzbl %al,%edi
call   1050 <isalpha@plt>
test   %rax,%rax
jne    1170 <__config_validate_name+0x40>
movzbl -0x1(%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1170 <__config_validate_name+0x40>
movsbl -0x1(%rbx),%esi
mov    %r14,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1170 <__config_validate_name+0x40>
jmp    11ae <__config_validate_name+0x7e>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"*_-\00"
define i32 @__config_validate_name(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 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %51
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = call i64 @isalpha(i8 zeroext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 42
br i1 %20, label %21, label %22
21: ; preds = %16
store i32 0, i32* %2
br label %51
22: ; preds = %16, %11
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
br label %25
25: ; preds = %47, %22
%26 = load i8*, i8** %4
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %50
29: ; preds = %25
%30 = load i8*, i8** %4
%31 = load i8, i8* %30
%32 = call i64 @isalpha(i8 zeroext %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %46, label %34
34: ; preds = %29
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = call i64 @isdigit(i8 zeroext %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %46, label %39
39: ; preds = %34
%40 = load i8*, i8** %4
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = call i64 @strchr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %39
store i32 0, i32* %2
br label %51
46: ; preds = %39, %34, %29
br label %47
47: ; preds = %46
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %4
br label %25
50: ; preds = %25
store i32 1, i32* %2
br label %51
51: ; preds = %50, %45, %21, %10
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
@.str = [4 x i8] c"*_-\00"
define i32 @__config_validate_name(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %32, label %4
4: ; preds = %1
%5 = tail call i64 @isalpha(i8 zeroext %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 42
br i1 %9, label %10, label %32
10: ; preds = %7, %4
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %32, label %14
14: ; preds = %10, %28
%15 = phi i8 [ %30, %28 ], [ %12, %10 ]
%16 = phi i8* [ %29, %28 ], [ %11, %10 ]
%17 = tail call i64 @isalpha(i8 zeroext %15)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %14
%20 = load i8, i8* %16
%21 = tail call i64 @isdigit(i8 zeroext %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %16
%25 = sext i8 %24 to i32
%26 = tail call i64 @strchr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %14, %19, %23
%29 = getelementptr inbounds i8, i8* %16, i64 1
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %32, label %14
32: ; preds = %23, %28, %10, %7, %1
%33 = phi i32 [ 0, %1 ], [ 0, %7 ], [ 1, %10 ], [ 0, %23 ], [ 1, %28 ]
ret i32 %33
}