#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 */
scalar_t__ sanitizeInput(char *, int);
int /*<<< orphan*/ sendError(char *, int);
int strlen(char *);
int validRealname(char *realname, int client) {
  if (sanitizeInput(realname, 1)) {
    sendError("Invalid characters in requested name.", client);
    return 0;
  }
  if (strlen(realname) < 3) {
    sendError("Requested name is too short.", client);
    return 0;
  }
  if (strlen(realname) > 64) {
    sendError("Requested name is too long.", client);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<validRealname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <sanitizeInput@plt>
cmp    $0x0,%rax
je     1172 <validRealname+0x42>
mov    -0x14(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1050 <sendError@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <validRealname+0xa3>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x3,%eax
jge    119f <validRealname+0x6f>
mov    -0x14(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1050 <sendError@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <validRealname+0xa3>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
jle    11cc <validRealname+0x9c>
mov    -0x14(%rbp),%esi
lea    0xe88(%rip),%rdi
call   1050 <sendError@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <validRealname+0xa3>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validRealname>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x1,%esi
call   1040 <sanitizeInput@plt>
test   %rax,%rax
je     1150 <validRealname+0x20>
lea    0xeb2(%rip),%rdi
jmp    1181 <validRealname+0x51>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x3,%eax
jge    1166 <validRealname+0x36>
lea    0xec2(%rip),%rdi
jmp    1181 <validRealname+0x51>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x41,%ecx
jl     118a <validRealname+0x5a>
lea    0xec2(%rip),%rdi
mov    %ebp,%esi
call   1050 <sendError@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Invalid characters in requested name.\00"
@.str.1 = [29 x i8] c"Requested name is too short.\00"
@.str.2 = [28 x i8] c"Requested name is too long.\00"
define i32 @validRealname(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = call i64 @sanitizeInput(i8* %6, i32 1)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %5
%11 = call i32 @sendError(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 0, i32* %3
br label %27
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @strlen(i8* %13)
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %5
%18 = call i32 @sendError(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %17)
store i32 0, i32* %3
br label %27
19: ; preds = %12
%20 = load i8*, i8** %4
%21 = call i32 @strlen(i8* %20)
%22 = icmp sgt i32 %21, 64
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %5
%25 = call i32 @sendError(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %24)
store i32 0, i32* %3
br label %27
26: ; preds = %19
store i32 1, i32* %3
br label %27
27: ; preds = %26, %23, %16, %9
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [38 x i8] c"Invalid characters in requested name.\00"
@.str.1 = [29 x i8] c"Requested name is too short.\00"
@.str.2 = [28 x i8] c"Requested name is too long.\00"
define i32 @validRealname(i8* %0, i32 %1) {
%3 = tail call i64 @sanitizeInput(i8* %0, i32 1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp slt i32 %6, 3
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i32 @strlen(i8* %0)
%10 = icmp sgt i32 %9, 64
br i1 %10, label %11, label %14
11: ; preds = %8, %5, %2
%12 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), %8 ]
%13 = tail call i32 @sendError(i8* %12, i32 %1)
br label %14
14: ; preds = %11, %8
%15 = phi i32 [ 1, %8 ], [ 0, %11 ]
ret i32 %15
}