#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 */
typedef int /*<<< orphan*/ hashPwd;

/* Variables and functions */
int /*<<< orphan*/ Memcpy(char *, char *, int);
int /*<<< orphan*/ Strcat(char *, char *);
char *md5(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
scalar_t__ strlen(char *);
char *HashPassword(char *password) {
  static char hashPwd[(32 * (32 - 3 + 1)) + 1] = "";
  char *md5Pwd = NULL;
  char reMd5Str[3 + 1] = "";
  unsigned long loop = 0;
  if (NULL == password || 0 == strlen(password)) {
    return NULL;
  }
  md5Pwd = md5(password);
  memset(hashPwd, 0, sizeof(hashPwd));
  for (loop = 0; loop < 32 - 3 + 1; loop++) {
    Memcpy(reMd5Str, md5Pwd + loop, 3);
    Strcat(hashPwd, md5(reMd5Str));
  }
  return hashPwd;
}


x86 assembly (clang, -O0):
<HashPassword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     119f <HashPassword+0x4f>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11ac <HashPassword+0x5c>
movq   $0x0,-0x8(%rbp)
jmp    1229 <HashPassword+0xd9>
mov    -0x10(%rbp),%rdi
call   1070 <md5@plt>
mov    %rax,-0x18(%rbp)
lea    0x2ea0(%rip),%rdi
xor    %esi,%esi
mov    $0x3c1,%edx
call   1060 <memset@plt>
movq   $0x0,-0x28(%rbp)
cmpq   $0x1e,-0x28(%rbp)
jae    121e <HashPassword+0xce>
lea    -0x1c(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    -0x28(%rbp),%rsi
mov    $0x3,%edx
call   1040 <Memcpy@plt>
lea    -0x1c(%rbp),%rdi
call   1070 <md5@plt>
mov    %rax,%rsi
lea    0x2e58(%rip),%rdi
call   1030 <Strcat@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11d4 <HashPassword+0x84>
lea    0x2e3b(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HashPassword>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
test   %rdi,%rdi
je     11b0 <HashPassword+0x70>
cmpb   $0x0,(%rdi)
je     11b0 <HashPassword+0x70>
call   1060 <md5@plt>
mov    %rax,%r15
lea    0x2ee7(%rip),%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x3c1,%edx
call   1050 <memset@plt>
lea    0x4(%rsp),%r12
nop
lea    (%r15,%rbx,1),%rsi
mov    %r12,%rdi
mov    $0x3,%edx
call   1040 <Memcpy@plt>
mov    %r12,%rdi
call   1060 <md5@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <Strcat@plt>
add    $0x1,%rbx
cmp    $0x1e,%rbx
jne    1180 <HashPassword+0x40>
jmp    11b3 <HashPassword+0x73>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@HashPassword.hashPwd = internal global [961 x i8] zeroinitializer
define i8* @HashPassword(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [4 x i8]
%6 = alloca i64
store i8* %0, i8** %3
store i8* null, i8** %4
%7 = bitcast [4 x i8]* %5 to i8*
store i64 0, i64* %6
%8 = load i8*, i8** %3
%9 = icmp eq i8* null, %8
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @strlen(i8* %11)
%13 = icmp eq i64 0, %12
br i1 %13, label %14, label %15
14: ; preds = %10, %1
store i8* null, i8** %2
br label %35
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = call i8* @md5(i8* %16)
store i8* %17, i8** %4
%18 = call i32 @memset(i8* getelementptr inbounds ([961 x i8], [961 x i8]* @HashPassword.hashPwd, i64 0, i64 0), i32 0, i32 961)
store i64 0, i64* %6
br label %19
19: ; preds = %31, %15
%20 = load i64, i64* %6
%21 = icmp ult i64 %20, 30
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%24 = load i8*, i8** %4
%25 = load i64, i64* %6
%26 = getelementptr inbounds i8, i8* %24, i64 %25
%27 = call i32 @Memcpy(i8* %23, i8* %26, i32 3)
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%29 = call i8* @md5(i8* %28)
%30 = call i32 @Strcat(i8* getelementptr inbounds ([961 x i8], [961 x i8]* @HashPassword.hashPwd, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %22
%32 = load i64, i64* %6
%33 = add i64 %32, 1
store i64 %33, i64* %6
br label %19
34: ; preds = %19
store i8* getelementptr inbounds ([961 x i8], [961 x i8]* @HashPassword.hashPwd, i64 0, i64 0), i8** %2
br label %35
35: ; preds = %34, %14
%36 = load i8*, i8** %2
ret i8* %36
}

LLVM IR (-O2):
@HashPassword.hashPwd = internal global [961 x i8] zeroinitializer
define i8* @HashPassword(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = icmp eq i8* %0, null
br i1 %4, label %19, label %5
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %5
%9 = tail call i8* @md5(i8* %0)
%10 = tail call i32 @memset(i8* getelementptr inbounds ([961 x i8], [961 x i8]* @HashPassword.hashPwd, i64 0, i64 0), i32 0, i32 961)
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %17, %11 ]
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = call i32 @Memcpy(i8* %3, i8* %13, i32 3)
%15 = call i8* @md5(i8* %3)
%16 = call i32 @Strcat(i8* getelementptr inbounds ([961 x i8], [961 x i8]* @HashPassword.hashPwd, i64 0, i64 0), i8* %15)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, 30
br i1 %18, label %19, label %11
19: ; preds = %11, %1, %5
%20 = phi i8* [ null, %5 ], [ null, %1 ], [ getelementptr inbounds ([961 x i8], [961 x i8]* @HashPassword.hashPwd, i64 0, i64 0), %11 ]
ret i8* %20
}