#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 CFCClass_validate_class_name_component(char const *);
int /*<<< orphan*/ CFCUtil_isupper(char const);
scalar_t__ strlen(char const *);
int S_validate_nickname(const char *nickname) {
  const char *ptr;
  for (ptr = nickname;; ptr++) {
    if (*ptr == 0) {
      if (strlen(nickname)) {
        return 1;
      } else {
        break;
      }
    } else if (!CFCUtil_isupper(*ptr)) {
      break;
    }
  }
  return CFCClass_validate_class_name_component(nickname);
}


x86 assembly (clang, -O0):
<S_validate_nickname>:
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    $0x0,%eax
jne    1178 <S_validate_nickname+0x48>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     1173 <S_validate_nickname+0x43>
movl   $0x1,-0x4(%rbp)
jmp    11b9 <S_validate_nickname+0x89>
jmp    11ad <S_validate_nickname+0x7d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <CFCUtil_isupper@plt>
cmp    $0x0,%eax
jne    1192 <S_validate_nickname+0x62>
jmp    11ad <S_validate_nickname+0x7d>
jmp    1197 <S_validate_nickname+0x67>
jmp    119c <S_validate_nickname+0x6c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1144 <S_validate_nickname+0x14>
mov    -0x10(%rbp),%rdi
call   1050 <CFCClass_validate_class_name_component@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_validate_nickname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     116a <S_validate_nickname+0x4a>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <CFCUtil_isupper@plt>
test   %eax,%eax
je     116a <S_validate_nickname+0x4a>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <S_validate_nickname+0x20>
cmpb   $0x0,(%r14)
je     116a <S_validate_nickname+0x4a>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <CFCClass_validate_class_name_component@plt>

LLVM IR (-O0):
define i32 @S_validate_nickname(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
br label %6
6: ; preds = %25, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = call i64 @strlen(i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %2
br label %31
16: ; preds = %11
br label %28
17: ; preds = %6
%18 = load i8*, i8** %4
%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
br label %28
23: ; preds = %17
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %4
br label %6
28: ; preds = %22, %16
%29 = load i8*, i8** %3
%30 = call i32 @CFCClass_validate_class_name_component(i8* %29)
store i32 %30, i32* %2
br label %31
31: ; preds = %28, %15
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @S_validate_nickname(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %10
4: ; preds = %10
%5 = load i8, i8* %15
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 0
br i1 %9, label %16, label %18
10: ; preds = %1, %4
%11 = phi i8 [ %5, %4 ], [ %2, %1 ]
%12 = phi i8* [ %15, %4 ], [ %0, %1 ]
%13 = tail call i32 @CFCUtil_isupper(i8 signext %11)
%14 = icmp eq i32 %13, 0
%15 = getelementptr inbounds i8, i8* %12, i64 1
br i1 %14, label %16, label %4
16: ; preds = %10, %1, %7
%17 = tail call i32 @CFCClass_validate_class_name_component(i8* %0)
br label %18
18: ; preds = %7, %16
%19 = phi i32 [ %17, %16 ], [ 1, %7 ]
ret i32 %19
}