#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);
int /*<<< orphan*/ CFCUtil_isalpha(char const);
int /*<<< orphan*/ CFCUtil_isupper(char const);
int /*<<< orphan*/ strlen(char const *);
int S_validate_meth_name(const char *meth_name) {
  if (!meth_name || !strlen(meth_name)) {
    return 0;
  }
  int need_upper = 1;
  int need_letter = 1;
  for (;; meth_name++) {
    if (need_upper && !CFCUtil_isupper(*meth_name)) {
      return 0;
    }
    if (need_letter && !CFCUtil_isalpha(*meth_name)) {
      return 0;
    }
    need_upper = 0;
    need_letter = 0;
    if (!*meth_name) {
      return 1;
    }
    if (!CFCUtil_isalnum(*meth_name)) {
      if (*meth_name != '_') {
        return 0;
      }
      need_upper = 1;
    }
  }
}


x86 assembly (clang, -O0):
<S_validate_meth_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1169 <S_validate_meth_name+0x29>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jne    1175 <S_validate_meth_name+0x35>
movl   $0x0,-0x4(%rbp)
jmp    124e <S_validate_meth_name+0x10e>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11ae <S_validate_meth_name+0x6e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <CFCUtil_isupper@plt>
cmp    $0x0,%eax
jne    11ae <S_validate_meth_name+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    124e <S_validate_meth_name+0x10e>
cmpl   $0x0,-0x18(%rbp)
je     11d9 <S_validate_meth_name+0x99>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <CFCUtil_isalpha@plt>
cmp    $0x0,%eax
jne    11d9 <S_validate_meth_name+0x99>
movl   $0x0,-0x4(%rbp)
jmp    124e <S_validate_meth_name+0x10e>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1200 <S_validate_meth_name+0xc0>
movl   $0x1,-0x4(%rbp)
jmp    124e <S_validate_meth_name+0x10e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1060 <CFCUtil_isalnum@plt>
cmp    $0x0,%eax
jne    1238 <S_validate_meth_name+0xf8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     1231 <S_validate_meth_name+0xf1>
movl   $0x0,-0x4(%rbp)
jmp    124e <S_validate_meth_name+0x10e>
movl   $0x1,-0x14(%rbp)
jmp    123d <S_validate_meth_name+0xfd>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1183 <S_validate_meth_name+0x43>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_validate_meth_name>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     11b1 <S_validate_meth_name+0x71>
mov    %rdi,%rbx
call   1040 <strlen@plt>
test   %eax,%eax
je     11b1 <S_validate_meth_name+0x71>
mov    $0x1,%ecx
xor    %ebp,%ebp
jmp    1167 <S_validate_meth_name+0x27>
nop
add    $0x1,%rbx
mov    $0x1,%bpl
test   %ecx,%ecx
je     1177 <S_validate_meth_name+0x37>
movsbl (%rbx),%edi
call   1050 <CFCUtil_isupper@plt>
test   %eax,%eax
je     11a8 <S_validate_meth_name+0x68>
test   $0x1,%bpl
jne    1189 <S_validate_meth_name+0x49>
movsbl (%rbx),%edi
call   1030 <CFCUtil_isalpha@plt>
test   %eax,%eax
je     11a8 <S_validate_meth_name+0x68>
movzbl (%rbx),%eax
test   %al,%al
je     11ac <S_validate_meth_name+0x6c>
movsbl %al,%edi
call   1060 <CFCUtil_isalnum@plt>
xor    %ecx,%ecx
test   %eax,%eax
jne    1160 <S_validate_meth_name+0x20>
mov    $0x1,%ecx
cmpb   $0x5f,(%rbx)
je     1160 <S_validate_meth_name+0x20>
xor    %ebp,%ebp
jmp    11b1 <S_validate_meth_name+0x71>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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