#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*/ CFCUtil_isalnum(char const);
scalar_t__ CFCUtil_islower(char const);
int /*<<< orphan*/ CFCUtil_isupper(char const);
char *strrchr(char const *, char);
int CFCClass_validate_class_name(const char *class_name) {
  const char *last_colon = strrchr(class_name, ':');
  const char *substring = last_colon ? last_colon + 1 : class_name;
  for (;; substring++) {
    if (*substring == 0) {
      return 0;
    } else if (*substring == ':') {
      return 0;
    } else if (CFCUtil_islower(*substring)) {
      break;
    }
  }
  const char *ptr = class_name;
  if (!CFCUtil_isupper(*ptr)) {
    return 0;
  }
  while (*ptr != 0) {
    if (*ptr == 0) {
      break;
    } else if (*ptr == ':') {
      ptr++;
      if (*ptr != ':') {
        return 0;
      }
      ptr++;
      if (!CFCUtil_isupper(*ptr)) {
        return 0;
      }
      ptr++;
    } else if (!CFCUtil_isalnum(*ptr)) {
      return 0;
    } else {
      ptr++;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<CFCClass_validate_class_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117a <CFCClass_validate_class_name+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1182 <CFCClass_validate_class_name+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a6 <CFCClass_validate_class_name+0x66>
movl   $0x0,-0x4(%rbp)
jmp    1309 <CFCClass_validate_class_name+0x1c9>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    11c2 <CFCClass_validate_class_name+0x82>
movl   $0x0,-0x4(%rbp)
jmp    1309 <CFCClass_validate_class_name+0x1c9>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1060 <CFCUtil_islower@plt>
cmp    $0x0,%rax
je     11dd <CFCClass_validate_class_name+0x9d>
jmp    11fd <CFCClass_validate_class_name+0xbd>
jmp    11e2 <CFCClass_validate_class_name+0xa2>
jmp    11e7 <CFCClass_validate_class_name+0xa7>
jmp    11ec <CFCClass_validate_class_name+0xac>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    118a <CFCClass_validate_class_name+0x4a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1040 <CFCUtil_isupper@plt>
cmp    $0x0,%eax
jne    1226 <CFCClass_validate_class_name+0xe6>
movl   $0x0,-0x4(%rbp)
jmp    1309 <CFCClass_validate_class_name+0x1c9>
jmp    122b <CFCClass_validate_class_name+0xeb>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1302 <CFCClass_validate_class_name+0x1c2>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1250 <CFCClass_validate_class_name+0x110>
jmp    1302 <CFCClass_validate_class_name+0x1c2>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    12c6 <CFCClass_validate_class_name+0x186>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     1288 <CFCClass_validate_class_name+0x148>
movl   $0x0,-0x4(%rbp)
jmp    1309 <CFCClass_validate_class_name+0x1c9>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1040 <CFCUtil_isupper@plt>
cmp    $0x0,%eax
jne    12b5 <CFCClass_validate_class_name+0x175>
movl   $0x0,-0x4(%rbp)
jmp    1309 <CFCClass_validate_class_name+0x1c9>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12f8 <CFCClass_validate_class_name+0x1b8>
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1050 <CFCUtil_isalnum@plt>
cmp    $0x0,%eax
jne    12e7 <CFCClass_validate_class_name+0x1a7>
movl   $0x0,-0x4(%rbp)
jmp    1309 <CFCClass_validate_class_name+0x1c9>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12f8 <CFCClass_validate_class_name+0x1b8>
jmp    12fd <CFCClass_validate_class_name+0x1bd>
jmp    122b <CFCClass_validate_class_name+0xeb>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CFCClass_validate_class_name>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x3a,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rbp
test   %rax,%rax
cmove  %rbx,%rbp
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%rbp),%eax
test   %al,%al
je     11cd <CFCClass_validate_class_name+0x8d>
cmp    $0x3a,%al
je     11cd <CFCClass_validate_class_name+0x8d>
movsbl %al,%edi
call   1060 <CFCUtil_islower@plt>
add    $0x1,%rbp
test   %rax,%rax
je     1160 <CFCClass_validate_class_name+0x20>
movsbl (%rbx),%edi
call   1040 <CFCUtil_isupper@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11cf <CFCClass_validate_class_name+0x8f>
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
cmp    $0x3a,%al
je     11b0 <CFCClass_validate_class_name+0x70>
test   %al,%al
je     11d8 <CFCClass_validate_class_name+0x98>
movsbl %al,%edi
call   1050 <CFCUtil_isalnum@plt>
mov    $0x1,%ecx
test   %eax,%eax
jne    11c8 <CFCClass_validate_class_name+0x88>
jmp    11cf <CFCClass_validate_class_name+0x8f>
xchg   %ax,%ax
cmpb   $0x3a,0x1(%rbx)
jne    11cf <CFCClass_validate_class_name+0x8f>
movsbl 0x2(%rbx),%edi
call   1040 <CFCUtil_isupper@plt>
mov    $0x3,%ecx
test   %eax,%eax
je     11cf <CFCClass_validate_class_name+0x8f>
add    %rcx,%rbx
jmp    1190 <CFCClass_validate_class_name+0x50>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%ebp
jmp    11cf <CFCClass_validate_class_name+0x8f>

LLVM IR (-O0):
define i32 @CFCClass_validate_class_name(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @strrchr(i8* %7, i8 signext 58)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 1
br label %16
14: ; preds = %1
%15 = load i8*, i8** %3
br label %16
16: ; preds = %14, %11
%17 = phi i8* [ %13, %11 ], [ %15, %14 ]
store i8* %17, i8** %5
br label %18
18: ; preds = %39, %16
%19 = load i8*, i8** %5
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 0, i32* %2
br label %98
24: ; preds = %18
%25 = load i8*, i8** %5
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 58
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 0, i32* %2
br label %98
30: ; preds = %24
%31 = load i8*, i8** %5
%32 = load i8, i8* %31
%33 = call i64 @CFCUtil_islower(i8 signext %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %30
br label %42
36: ; preds = %30
br label %37
37: ; preds = %36
br label %38
38: ; preds = %37
br label %39
39: ; preds = %38
%40 = load i8*, i8** %5
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %5
br label %18
42: ; preds = %35
%43 = load i8*, i8** %3
store i8* %43, i8** %6
%44 = load i8*, i8** %6
%45 = load i8, i8* %44
%46 = call i32 @CFCUtil_isupper(i8 signext %45)
%47 = icmp ne i32 %46, 0
br i1 %47, label %49, label %48
48: ; preds = %42
store i32 0, i32* %2
br label %98
49: ; preds = %42
br label %50
50: ; preds = %96, %49
%51 = load i8*, i8** %6
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %97
55: ; preds = %50
%56 = load i8*, i8** %6
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %55
br label %97
61: ; preds = %55
%62 = load i8*, i8** %6
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 58
br i1 %65, label %66, label %85
66: ; preds = %61
%67 = load i8*, i8** %6
%68 = getelementptr inbounds i8, i8* %67, i32 1
store i8* %68, i8** %6
%69 = load i8*, i8** %6
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %71, 58
br i1 %72, label %73, label %74
73: ; preds = %66
store i32 0, i32* %2
br label %98
74: ; preds = %66
%75 = load i8*, i8** %6
%76 = getelementptr inbounds i8, i8* %75, i32 1
store i8* %76, i8** %6
%77 = load i8*, i8** %6
%78 = load i8, i8* %77
%79 = call i32 @CFCUtil_isupper(i8 signext %78)
%80 = icmp ne i32 %79, 0
br i1 %80, label %82, label %81
81: ; preds = %74
store i32 0, i32* %2
br label %98
82: ; preds = %74
%83 = load i8*, i8** %6
%84 = getelementptr inbounds i8, i8* %83, i32 1
store i8* %84, i8** %6
br label %95
85: ; preds = %61
%86 = load i8*, i8** %6
%87 = load i8, i8* %86
%88 = call i32 @CFCUtil_isalnum(i8 signext %87)
%89 = icmp ne i32 %88, 0
br i1 %89, label %91, label %90
90: ; preds = %85
store i32 0, i32* %2
br label %98
91: ; preds = %85
%92 = load i8*, i8** %6
%93 = getelementptr inbounds i8, i8* %92, i32 1
store i8* %93, i8** %6
br label %94
94: ; preds = %91
br label %95
95: ; preds = %94, %82
br label %96
96: ; preds = %95
br label %50
97: ; preds = %60, %50
store i32 1, i32* %2
br label %98
98: ; preds = %97, %90, %81, %73, %48, %29, %23
%99 = load i32, i32* %2
ret i32 %99
}

LLVM IR (-O2):
define i32 @CFCClass_validate_class_name(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 58)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
br label %6
6: ; preds = %9, %1
%7 = phi i8* [ %5, %1 ], [ %12, %9 ]
%8 = load i8, i8* %7
switch i8 %8, label %9 [
i8 0, label %35
i8 58, label %35
]
9: ; preds = %6
%10 = tail call i64 @CFCUtil_islower(i8 signext %8)
%11 = icmp eq i64 %10, 0
%12 = getelementptr inbounds i8, i8* %7, i64 1
br i1 %11, label %6, label %13
13: ; preds = %9
%14 = load i8, i8* %0
%15 = tail call i32 @CFCUtil_isupper(i8 signext %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %35, label %17
17: ; preds = %13, %32
%18 = phi i8* [ %34, %32 ], [ %0, %13 ]
%19 = load i8, i8* %18
switch i8 %19, label %29 [
i8 0, label %35
i8 58, label %20
]
20: ; preds = %17
%21 = getelementptr inbounds i8, i8* %18, i64 1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 58
br i1 %23, label %24, label %35
24: ; preds = %20
%25 = getelementptr inbounds i8, i8* %18, i64 2
%26 = load i8, i8* %25
%27 = tail call i32 @CFCUtil_isupper(i8 signext %26)
%28 = icmp eq i32 %27, 0
br i1 %28, label %35, label %32
29: ; preds = %17
%30 = tail call i32 @CFCUtil_isalnum(i8 signext %19)
%31 = icmp eq i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29, %24
%33 = phi i64 [ 3, %24 ], [ 1, %29 ]
%34 = getelementptr inbounds i8, i8* %18, i64 %33
br label %17
35: ; preds = %6, %6, %20, %24, %29, %17, %13
%36 = phi i32 [ 0, %13 ], [ 1, %17 ], [ 0, %29 ], [ 0, %24 ], [ 0, %20 ], [ 0, %6 ], [ 0, %6 ]
ret i32 %36
}