#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*/ IsFirstNickChar(char const);
int /*<<< orphan*/ IsSecondNickChar(char const);
int strlen(char const *);
int IsValidNick(const char *nick) {
  int ret = 1;
  int i;
  if (strlen(nick) > 63) {
    ret = 0;
  } else if (!IsFirstNickChar(nick[0])) {
    ret = 0;
  } else {
    for (i = 1; nick[i] != '\0'; i++) {
      if (!IsSecondNickChar(nick[i])) {
        ret = 0;
        break;
      }
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<IsValidNick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x3f,%eax
jle    1161 <IsValidNick+0x31>
movl   $0x0,-0xc(%rbp)
jmp    11e1 <IsValidNick+0xb1>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <IsFirstNickChar@plt>
cmp    $0x0,%eax
jne    1182 <IsValidNick+0x52>
movl   $0x0,-0xc(%rbp)
jmp    11dc <IsValidNick+0xac>
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11d7 <IsValidNick+0xa7>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <IsSecondNickChar@plt>
cmp    $0x0,%eax
jne    11c4 <IsValidNick+0x94>
movl   $0x0,-0xc(%rbp)
jmp    11d7 <IsValidNick+0xa7>
jmp    11c9 <IsValidNick+0x99>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1189 <IsValidNick+0x59>
jmp    11dc <IsValidNick+0xac>
jmp    11e1 <IsValidNick+0xb1>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsValidNick>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
xor    %ebp,%ebp
cmp    $0x3f,%eax
jg     117c <IsValidNick+0x4c>
movsbl (%rbx),%edi
call   1030 <IsFirstNickChar@plt>
test   %eax,%eax
je     117c <IsValidNick+0x4c>
mov    0x1(%rbx),%al
test   %al,%al
je     1177 <IsValidNick+0x47>
add    $0x2,%rbx
nopl   0x0(%rax)
movsbl %al,%edi
call   1050 <IsSecondNickChar@plt>
test   %eax,%eax
je     117c <IsValidNick+0x4c>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <IsValidNick+0x30>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @IsValidNick(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = icmp sgt i32 %6, 63
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %3
br label %40
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = call i32 @IsFirstNickChar(i8 signext %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %9
store i32 0, i32* %3
br label %39
16: ; preds = %9
store i32 1, i32* %4
br label %17
17: ; preds = %35, %16
%18 = load i8*, i8** %2
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %38
25: ; preds = %17
%26 = load i8*, i8** %2
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = call i32 @IsSecondNickChar(i8 signext %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %34, label %33
33: ; preds = %25
store i32 0, i32* %3
br label %38
34: ; preds = %25
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %17
38: ; preds = %33, %17
br label %39
39: ; preds = %38, %15
br label %40
40: ; preds = %39, %8
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
define i32 @IsValidNick(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 63
br i1 %3, label %22, label %4
4: ; preds = %1
%5 = load i8, i8* %0
%6 = tail call i32 @IsFirstNickChar(i8 signext %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %22, label %8
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %22, label %16
12: ; preds = %16
%13 = getelementptr inbounds i8, i8* %0, i64 %21
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %8, %12
%17 = phi i64 [ %21, %12 ], [ 1, %8 ]
%18 = phi i8 [ %14, %12 ], [ %10, %8 ]
%19 = tail call i32 @IsSecondNickChar(i8 signext %18)
%20 = icmp eq i32 %19, 0
%21 = add nuw i64 %17, 1
br i1 %20, label %22, label %12
22: ; preds = %12, %16, %8, %4, %1
%23 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 1, %8 ], [ 1, %12 ], [ 0, %16 ]
ret i32 %23
}