#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*/ sendError(char *, int);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int validPassword(char *pass1, char *pass2, int client) {
  if (strcmp(pass1, pass2)) {
    sendError("Password input does not match.", client);
    return 0;
  }
  if (strlen(pass1) < 3) {
    sendError("Requested password is too short.", client);
    return 0;
  }
  if (strlen(pass1) > 32) {
    sendError("Requested password is too long.", client);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<validPassword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1175 <validPassword+0x45>
mov    -0x1c(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1050 <sendError@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <validPassword+0xa6>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x3,%eax
jge    11a2 <validPassword+0x72>
mov    -0x1c(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1050 <sendError@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <validPassword+0xa6>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x20,%eax
jle    11cf <validPassword+0x9f>
mov    -0x1c(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1050 <sendError@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <validPassword+0xa6>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validPassword>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1040 <strcmp@plt>
test   %rax,%rax
je     114b <validPassword+0x1b>
lea    0xeb7(%rip),%rdi
jmp    117c <validPassword+0x4c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x3,%eax
jge    1161 <validPassword+0x31>
lea    0xec0(%rip),%rdi
jmp    117c <validPassword+0x4c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x21,%ecx
jl     1185 <validPassword+0x55>
lea    0xec4(%rip),%rdi
mov    %ebp,%esi
call   1050 <sendError@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Password input does not match.\00"
@.str.1 = [33 x i8] c"Requested password is too short.\00"
@.str.2 = [32 x i8] c"Requested password is too long.\00"
define i32 @validPassword(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i64 @strcmp(i8* %8, i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32, i32* %7
%14 = call i32 @sendError(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 0, i32* %4
br label %30
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* %16)
%18 = icmp slt i32 %17, 3
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %7
%21 = call i32 @sendError(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %20)
store i32 0, i32* %4
br label %30
22: ; preds = %15
%23 = load i8*, i8** %5
%24 = call i32 @strlen(i8* %23)
%25 = icmp sgt i32 %24, 32
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* %7
%28 = call i32 @sendError(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %27)
store i32 0, i32* %4
br label %30
29: ; preds = %22
store i32 1, i32* %4
br label %30
30: ; preds = %29, %26, %19, %12
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@.str = [31 x i8] c"Password input does not match.\00"
@.str.1 = [33 x i8] c"Requested password is too short.\00"
@.str.2 = [32 x i8] c"Requested password is too long.\00"
define i32 @validPassword(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp slt i32 %7, 3
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 @strlen(i8* %0)
%11 = icmp sgt i32 %10, 32
br i1 %11, label %12, label %15
12: ; preds = %9, %6, %3
%13 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), %9 ]
%14 = tail call i32 @sendError(i8* %13, i32 %2)
br label %15
15: ; preds = %12, %9
%16 = phi i32 [ 1, %9 ], [ 0, %12 ]
ret i32 %16
}