#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(char);
int /*<<< orphan*/ isalpha(char);
int strlen(char *);
int checklabel(char *name) {
  register char c;
  if (strlen(name) > 48)
    return 0;
  c = *name;
  if (c == '*' && name[1] == 0)
    return 1;
  if (!isalpha(c) && c != '_' && c != '.')
    return 0;
  while ((c = *++name) != 0)
    if (!isalnum(c) && c != '_' && c != '.')
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<checklabel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x30,%eax
jle    115a <checklabel+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    122f <checklabel+0xff>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x2a,%eax
jne    118d <checklabel+0x5d>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    118d <checklabel+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    122f <checklabel+0xff>
movsbl -0x11(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%eax
jne    11c5 <checklabel+0x95>
movsbl -0x11(%rbp),%eax
cmp    $0x5f,%eax
je     11c5 <checklabel+0x95>
movsbl -0x11(%rbp),%eax
cmp    $0x2e,%eax
je     11c5 <checklabel+0x95>
movl   $0x0,-0x4(%rbp)
jmp    122f <checklabel+0xff>
jmp    11ca <checklabel+0x9a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1228 <checklabel+0xf8>
movsbl -0x11(%rbp),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%eax
jne    1223 <checklabel+0xf3>
movsbl -0x11(%rbp),%eax
cmp    $0x5f,%eax
je     1223 <checklabel+0xf3>
movsbl -0x11(%rbp),%eax
cmp    $0x2e,%eax
je     1223 <checklabel+0xf3>
movl   $0x0,-0x4(%rbp)
jmp    122f <checklabel+0xff>
jmp    11ca <checklabel+0x9a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checklabel>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
call   1030 <strlen@plt>
xor    %r14d,%r14d
cmp    $0x30,%eax
jg     119a <checklabel+0x6a>
mov    0x0(%rbp),%bl
cmp    $0x2a,%bl
jne    1152 <checklabel+0x22>
cmpb   $0x0,0x1(%rbp)
je     1194 <checklabel+0x64>
movsbl %bl,%edi
call   1050 <isalpha@plt>
test   %eax,%eax
je     11a2 <checklabel+0x72>
mov    0x1(%rbp),%bl
test   %bl,%bl
je     1194 <checklabel+0x64>
add    $0x2,%rbp
jmp    117c <checklabel+0x4c>
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%rbp),%ebx
add    $0x1,%rbp
test   %bl,%bl
je     1194 <checklabel+0x64>
movsbl %bl,%edi
call   1040 <isalnum@plt>
test   %eax,%eax
jne    1170 <checklabel+0x40>
cmp    $0x2e,%bl
je     1170 <checklabel+0x40>
cmp    $0x5f,%bl
je     1170 <checklabel+0x40>
jmp    119a <checklabel+0x6a>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
cmp    $0x5f,%bl
je     115e <checklabel+0x2e>
cmp    $0x2e,%bl
je     115e <checklabel+0x2e>
jmp    119a <checklabel+0x6a>

LLVM IR (-O0):
define i32 @checklabel(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = icmp sgt i32 %6, 48
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %57
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
store i8 %11, i8* %4
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 42
br i1 %14, label %15, label %22
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 1, i32* %2
br label %57
22: ; preds = %15, %9
%23 = load i8, i8* %4
%24 = call i32 @isalpha(i8 signext %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %35, label %26
26: ; preds = %22
%27 = load i8, i8* %4
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 95
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = load i8, i8* %4
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 46
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 0, i32* %2
br label %57
35: ; preds = %30, %26, %22
br label %36
36: ; preds = %55, %35
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %3
%39 = load i8, i8* %38
store i8 %39, i8* %4
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %56
42: ; preds = %36
%43 = load i8, i8* %4
%44 = call i32 @isalnum(i8 signext %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %55, label %46
46: ; preds = %42
%47 = load i8, i8* %4
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 95
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = load i8, i8* %4
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 46
br i1 %53, label %54, label %55
54: ; preds = %50
store i32 0, i32* %2
br label %57
55: ; preds = %50, %46, %42
br label %36
56: ; preds = %36
store i32 1, i32* %2
br label %57
57: ; preds = %56, %54, %34, %21, %8
%58 = load i32, i32* %2
ret i32 %58
}

LLVM IR (-O2):
define i32 @checklabel(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 48
br i1 %3, label %31, label %4
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 42
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %31, label %11
11: ; preds = %7, %4
%12 = tail call i32 @isalpha(i8 signext %5)
%13 = freeze i32 %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
switch i8 %5, label %31 [
i8 95, label %16
i8 46, label %16
]
16: ; preds = %11, %15, %15
%17 = getelementptr inbounds i8, i8* %0, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %16, %26
%21 = phi i8 [ %28, %26 ], [ %18, %16 ]
%22 = phi i8* [ %27, %26 ], [ %17, %16 ]
%23 = tail call i32 @isalnum(i8 signext %21)
%24 = freeze i32 %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %20, %30, %30
%27 = getelementptr inbounds i8, i8* %22, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %31, label %20
30: ; preds = %20
switch i8 %21, label %31 [
i8 95, label %26
i8 46, label %26
]
31: ; preds = %30, %26, %16, %15, %7, %1
%32 = phi i32 [ 0, %1 ], [ 1, %7 ], [ 0, %15 ], [ 1, %16 ], [ 0, %30 ], [ 1, %26 ]
ret i32 %32
}