#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) && !isdigit((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    1233 <__config_validate_name+0x103>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
jne    11a8 <__config_validate_name+0x78>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    11a8 <__config_validate_name+0x78>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
je     11a8 <__config_validate_name+0x78>
movl   $0x0,-0x4(%rbp)
jmp    1233 <__config_validate_name+0x103>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     122c <__config_validate_name+0xfc>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
jne    1216 <__config_validate_name+0xe6>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    1216 <__config_validate_name+0xe6>
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
lea    0xe05(%rip),%rdi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    1216 <__config_validate_name+0xe6>
movl   $0x0,-0x4(%rbp)
jmp    1233 <__config_validate_name+0x103>
jmp    121b <__config_validate_name+0xeb>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11b4 <__config_validate_name+0x84>
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    115c <__config_validate_name+0x2c>
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    115c <__config_validate_name+0x2c>
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    0xe92(%rip),%r14
jmp    117b <__config_validate_name+0x4b>
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 = [6 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 %60
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 %29, label %17
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i64 @isdigit(i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %17
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 42
br i1 %27, label %28, label %29
28: ; preds = %23
store i32 0, i32* %2
br label %60
29: ; preds = %23, %17, %11
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
br label %32
32: ; preds = %56, %29
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = icmp ne i8 %34, 0
br i1 %35, label %36, label %59
36: ; preds = %32
%37 = load i8*, i8** %4
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = call i64 @isalpha(i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %55, label %42
42: ; preds = %36
%43 = load i8*, i8** %4
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = call i64 @isdigit(i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %55, label %48
48: ; preds = %42
%49 = load i8*, i8** %4
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %55, label %54
54: ; preds = %48
store i32 0, i32* %2
br label %60
55: ; preds = %48, %42, %36
br label %56
56: ; preds = %55
%57 = load i8*, i8** %4
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %4
br label %32
59: ; preds = %32
store i32 1, i32* %2
br label %60
60: ; preds = %59, %54, %28, %10
%61 = load i32, i32* %2
ret i32 %61
}

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