#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 */
size_t strlen(char const *);
size_t strspn(char const *, char *);
int name_is_ok(const char *name, size_t max) {
  size_t len = strlen(name);
  return len > 0 && len <= max &&
         strspn(name, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                      "abcdefghijklmnopqrstuvwxyz"
                      "0123456789-+/;.$_()") == len &&
         name[0] != '-';
}


x86 assembly (clang, -O0):
<name_is_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jbe    1192 <name_is_ok+0x72>
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
ja     1192 <name_is_ok+0x72>
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strspn@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x19(%rbp)
jne    1192 <name_is_ok+0x72>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_is_ok>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbp
add    $0xffffffffffffffff,%rax
xor    %r14d,%r14d
cmp    %rbx,%rax
jae    1160 <name_is_ok+0x40>
lea    0xeb8(%rip),%rsi
mov    %r15,%rdi
call   1040 <strspn@plt>
cmp    %rbp,%rax
jne    1160 <name_is_ok+0x40>
xor    %r14d,%r14d
cmpb   $0x2d,(%r15)
setne  %r14b
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [72 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+/;.$_()\00"
define i32 @name_is_ok(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = icmp ugt i64 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %2
%11 = load i64, i64* %5
%12 = load i64, i64* %4
%13 = icmp ule i64 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = call i64 @strspn(i8* %15, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%17 = load i64, i64* %5
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 45
br label %25
25: ; preds = %19, %14, %10, %2
%26 = phi i1 [ false, %14 ], [ false, %10 ], [ false, %2 ], [ %24, %19 ]
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
@.str = [72 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+/;.$_()\00"
define i32 @name_is_ok(i8* nocapture %0, i64 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = add i64 %3, -1
%5 = icmp ult i64 %4, %1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = tail call i64 @strspn(i8* %0, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, %3
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i8, i8* %0
%11 = icmp ne i8 %10, 45
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %2
%14 = phi i32 [ 0, %6 ], [ 0, %2 ], [ %12, %9 ]
ret i32 %14
}