#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 const);
int /*<<< orphan*/ isalpha(char const);
int checkNamespaceFormat(const char *name_space) {
  const char *it_ns = name_space;
  if (*it_ns == '~')
    it_ns++;
  while (*it_ns != '\0') {
    if (*it_ns == '/') {
      if (*(it_ns + 1) == '\0' || !isalpha(*(it_ns + 1)))
        return 0;
      it_ns++;
    } else {
      if (!isalnum(*it_ns) && *it_ns != '_')
        return 0;
    }
    it_ns++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<checkNamespaceFormat>:
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    $0x7e,%eax
jne    1150 <checkNamespaceFormat+0x30>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1155 <checkNamespaceFormat+0x35>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1200 <checkNamespaceFormat+0xe0>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11b9 <checkNamespaceFormat+0x99>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     119c <checkNamespaceFormat+0x7c>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    11a8 <checkNamespaceFormat+0x88>
movl   $0x0,-0x4(%rbp)
jmp    1207 <checkNamespaceFormat+0xe7>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <checkNamespaceFormat+0xcf>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    11ea <checkNamespaceFormat+0xca>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     11ea <checkNamespaceFormat+0xca>
movl   $0x0,-0x4(%rbp)
jmp    1207 <checkNamespaceFormat+0xe7>
jmp    11ef <checkNamespaceFormat+0xcf>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1155 <checkNamespaceFormat+0x35>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkNamespaceFormat>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
cmpb   $0x7e,(%rdi)
sete   %bl
add    %rdi,%rbx
xor    %ebp,%ebp
jmp    1144 <checkNamespaceFormat+0x24>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2f,%al
je     1170 <checkNamespaceFormat+0x50>
test   %al,%al
je     118a <checkNamespaceFormat+0x6a>
movsbl %al,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
jne    1140 <checkNamespaceFormat+0x20>
cmpb   $0x5f,(%rbx)
je     1140 <checkNamespaceFormat+0x20>
jmp    1191 <checkNamespaceFormat+0x71>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
test   %al,%al
je     1193 <checkNamespaceFormat+0x73>
movsbl %al,%edi
call   1040 <isalpha@plt>
test   %eax,%eax
je     1193 <checkNamespaceFormat+0x73>
add    $0x1,%rbx
jmp    1140 <checkNamespaceFormat+0x20>
mov    $0x1,%ebp
jmp    1193 <checkNamespaceFormat+0x73>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @checkNamespaceFormat(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 126
%4 = zext i1 %3 to i64
%5 = getelementptr i8, i8* %0, i64 %4
br label %6
6: ; preds = %22, %1
%7 = phi i8* [ %5, %1 ], [ %24, %22 ]
%8 = load i8, i8* %7
switch i8 %8, label %16 [
i8 0, label %25
i8 47, label %9
]
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %9
%14 = tail call i32 @isalpha(i8 signext %11)
%15 = icmp eq i32 %14, 0
br i1 %15, label %25, label %22
16: ; preds = %6
%17 = tail call i32 @isalnum(i8 signext %8)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i8, i8* %7
%21 = icmp eq i8 %20, 95
br i1 %21, label %22, label %25
22: ; preds = %13, %16, %19
%23 = phi i8* [ %7, %16 ], [ %7, %19 ], [ %10, %13 ]
%24 = getelementptr inbounds i8, i8* %23, i64 1
br label %6
25: ; preds = %6, %19, %9, %13
%26 = phi i32 [ 0, %13 ], [ 0, %9 ], [ 0, %19 ], [ 1, %6 ]
ret i32 %26
}