#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(int);
scalar_t__ isdigit(int);
scalar_t__ strchr(char *, int);
int __config_validate_name(const char *name) {
  const char *p = name;
  if (*p == '\0')
    return ((0));
  if (!isalpha((int)*p) && (*p != '*'))
    return ((0));
  for (++p; *p; ++p) {
    if (!(isalpha((int)*p) || isdigit((int)*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
movsbl (%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
movsbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
jne    1200 <__config_validate_name+0xd0>
mov    -0x18(%rbp),%rax
movsbl (%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,%rbx
movsbl (%rdi),%edi
xor    %ebp,%ebp
test   %edi,%edi
je     11ae <__config_validate_name+0x7e>
call   1050 <isalpha@plt>
test   %rax,%rax
jne    114f <__config_validate_name+0x1f>
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    0xe9f(%rip),%r14
jmp    117b <__config_validate_name+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11a9 <__config_validate_name+0x79>
movsbl %al,%edi
call   1050 <isalpha@plt>
test   %rax,%rax
jne    1170 <__config_validate_name+0x40>
movsbl -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 = [5 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 %54
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i64 @isalpha(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 42
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 0, i32* %2
br label %54
23: ; preds = %17, %11
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
br label %26
26: ; preds = %50, %23
%27 = load i8*, i8** %4
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %30, label %53
30: ; preds = %26
%31 = load i8*, i8** %4
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i64 @isalpha(i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %49, label %36
36: ; preds = %30
%37 = load i8*, i8** %4
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = call i64 @isdigit(i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %49, label %42
42: ; preds = %36
%43 = load i8*, i8** %4
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %49, label %48
48: ; preds = %42
store i32 0, i32* %2
br label %54
49: ; preds = %42, %36, %30
br label %50
50: ; preds = %49
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %4
br label %26
53: ; preds = %26
store i32 1, i32* %2
br label %54
54: ; preds = %53, %48, %22, %10
%55 = load i32, i32* %2
ret i32 %55
}

LLVM IR (-O2):
@.str = [5 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 %35, label %4
4: ; preds = %1
%5 = sext i8 %2 to i32
%6 = tail call i64 @isalpha(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 42
br i1 %10, label %11, label %35
11: ; preds = %8, %4
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %35, label %15
15: ; preds = %11, %31
%16 = phi i8 [ %33, %31 ], [ %13, %11 ]
%17 = phi i8* [ %32, %31 ], [ %12, %11 ]
%18 = sext i8 %16 to i32
%19 = tail call i64 @isalpha(i32 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %31
21: ; preds = %15
%22 = load i8, i8* %17
%23 = sext i8 %22 to i32
%24 = tail call i64 @isdigit(i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i8, i8* %17
%28 = sext i8 %27 to i32
%29 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %15, %21, %26
%32 = getelementptr inbounds i8, i8* %17, i64 1
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %15
35: ; preds = %26, %31, %11, %8, %1
%36 = phi i32 [ 0, %1 ], [ 0, %8 ], [ 1, %11 ], [ 0, %26 ], [ 1, %31 ]
ret i32 %36
}