#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*/ isalnum(unsigned char);
scalar_t__ isdigit(unsigned char);
int /*<<< orphan*/ *strchr(char *, unsigned char);
int check_name(char *name) {
  char *set = "!\"#$%&()/,.;?@_`'{}|~";
  int t;
  if (isdigit((unsigned char)name[0]))
    return 1;
  if (name[0] == '.')
    return 1;
  for (t = 0; name[t] != '\0'; t++) {
    if (t == 16)
      return 1;
    if (!isalnum((unsigned char)name[t]) &&
        strchr(set, (unsigned char)name[t]) == NULL)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1169 <check_name+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1216 <check_name+0xe6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1185 <check_name+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1216 <check_name+0xe6>
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     120f <check_name+0xdf>
cmpl   $0x10,-0x1c(%rbp)
jne    11b7 <check_name+0x87>
movl   $0x1,-0x4(%rbp)
jmp    1216 <check_name+0xe6>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1050 <isalnum@plt>
cmp    $0x0,%eax
jne    11fc <check_name+0xcc>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    11fc <check_name+0xcc>
movl   $0x1,-0x4(%rbp)
jmp    1216 <check_name+0xe6>
jmp    1201 <check_name+0xd1>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118c <check_name+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_name>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzbl (%rdi),%edi
call   1030 <isdigit@plt>
mov    $0x1,%r15d
test   %rax,%rax
jne    11a5 <check_name+0x75>
mov    (%rbx),%al
test   %al,%al
je     11a2 <check_name+0x72>
cmp    $0x2e,%al
je     11a5 <check_name+0x75>
xor    %ebp,%ebp
lea    0xea0(%rip),%r14
jmp    117d <check_name+0x4d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%rbx,%rbp,1),%eax
add    $0x1,%rbp
test   %al,%al
je     11a2 <check_name+0x72>
cmp    $0x10,%rbp
je     11a5 <check_name+0x75>
movzbl %al,%edi
call   1050 <isalnum@plt>
test   %eax,%eax
jne    1170 <check_name+0x40>
movzbl (%rbx,%rbp,1),%esi
mov    %r14,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1170 <check_name+0x40>
jmp    11a5 <check_name+0x75>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"!\22#$%&()/,.;?@_`'{}|~\00"
define i32 @check_name(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = call i64 @isdigit(i8 zeroext %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 1, i32* %2
br label %55
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 46
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 1, i32* %2
br label %55
19: ; preds = %12
store i32 0, i32* %5
br label %20
20: ; preds = %51, %19
%21 = load i8*, i8** %3
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %54
28: ; preds = %20
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 16
br i1 %30, label %31, label %32
31: ; preds = %28
store i32 1, i32* %2
br label %55
32: ; preds = %28
%33 = load i8*, i8** %3
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @isalnum(i8 zeroext %37)
%39 = icmp ne i32 %38, 0
br i1 %39, label %50, label %40
40: ; preds = %32
%41 = load i8*, i8** %4
%42 = load i8*, i8** %3
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = call i32* @strchr(i8* %41, i8 zeroext %46)
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %50
49: ; preds = %40
store i32 1, i32* %2
br label %55
50: ; preds = %40, %32
br label %51
51: ; preds = %50
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %20
54: ; preds = %20
store i32 0, i32* %2
br label %55
55: ; preds = %54, %49, %31, %18, %11
%56 = load i32, i32* %2
ret i32 %56
}

LLVM IR (-O2):
@.str = [22 x i8] c"!\22#$%&()/,.;?@_`'{}|~\00"
define i32 @check_name(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isdigit(i8 zeroext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %25
5: ; preds = %1
%6 = load i8, i8* %0
switch i8 %6, label %7 [
i8 46, label %25
i8 0, label %24
]
7: ; preds = %5, %19
%8 = phi i64 [ %20, %19 ], [ 0, %5 ]
%9 = phi i8 [ %22, %19 ], [ %6, %5 ]
%10 = phi i8* [ %21, %19 ], [ %0, %5 ]
%11 = icmp eq i64 %8, 16
br i1 %11, label %25, label %12
12: ; preds = %7
%13 = tail call i32 @isalnum(i8 zeroext %9)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8, i8* %10
%17 = tail call i32* @strchr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8 zeroext %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %25, label %19
19: ; preds = %12, %15
%20 = add nuw nsw i64 %8, 1
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %25, label %7
24: ; preds = %5
br label %25
25: ; preds = %7, %15, %19, %5, %24, %1
%26 = phi i32 [ 1, %1 ], [ 1, %5 ], [ 0, %24 ], [ 1, %7 ], [ 1, %15 ], [ 0, %19 ]
ret i32 %26
}