#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*/ F(char *, unsigned char *, int, int, int, unsigned char *);
int strlen(char *);
int PasswordHash(char *password, unsigned char *ssid, int ssidlength,
                 unsigned char *output) {
  if ((strlen(password) > 63) || (ssidlength > 32))
    return 0;
  F(password, ssid, ssidlength, 4096, 1, output);
  F(password, ssid, ssidlength, 4096, 2, &output[20]);
  return 1;
}


x86 assembly (clang, -O0):
<PasswordHash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x3f,%eax
jg     1153 <PasswordHash+0x33>
cmpl   $0x20,-0x1c(%rbp)
jle    115f <PasswordHash+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <PasswordHash+0x88>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%r9
mov    $0x1000,%ecx
mov    $0x1,%r8d
call   1030 <F@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%r9
add    $0x14,%r9
mov    $0x1000,%ecx
mov    $0x2,%r8d
call   1030 <F@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PasswordHash>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r12
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <strlen@plt>
xor    %r14d,%r14d
cmp    $0x20,%ebp
jg     1185 <PasswordHash+0x65>
cmp    $0x3f,%eax
jg     1185 <PasswordHash+0x65>
mov    $0x1,%r14d
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    $0x1000,%ecx
mov    $0x1,%r8d
mov    %r12,%r9
call   1030 <F@plt>
add    $0x14,%r12
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    $0x1000,%ecx
mov    $0x2,%r8d
mov    %r12,%r9
call   1030 <F@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @PasswordHash(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%10 = load i8*, i8** %6
%11 = call i32 @strlen(i8* %10)
%12 = icmp sgt i32 %11, 63
br i1 %12, label %16, label %13
13: ; preds = %4
%14 = load i32, i32* %8
%15 = icmp sgt i32 %14, 32
br i1 %15, label %16, label %17
16: ; preds = %13, %4
store i32 0, i32* %5
br label %29
17: ; preds = %13
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = load i32, i32* %8
%21 = load i8*, i8** %9
%22 = call i32 @F(i8* %18, i8* %19, i32 %20, i32 4096, i32 1, i8* %21)
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = load i32, i32* %8
%26 = load i8*, i8** %9
%27 = getelementptr inbounds i8, i8* %26, i64 20
%28 = call i32 @F(i8* %23, i8* %24, i32 %25, i32 4096, i32 2, i8* %27)
store i32 1, i32* %5
br label %29
29: ; preds = %17, %16
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @PasswordHash(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp sgt i32 %5, 63
%7 = icmp sgt i32 %2, 32
%8 = or i1 %7, %6
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = tail call i32 @F(i8* %0, i8* %1, i32 %2, i32 4096, i32 1, i8* %3)
%11 = getelementptr inbounds i8, i8* %3, i64 20
%12 = tail call i32 @F(i8* %0, i8* %1, i32 %2, i32 4096, i32 2, i8* %11)
br label %13
13: ; preds = %4, %9
%14 = phi i32 [ 1, %9 ], [ 0, %4 ]
ret i32 %14
}