#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*/ time_t;

/* Variables and functions */
char *crypt(char *, char *);
int /*<<< orphan*/ rand();
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ to64(char *, int /*<<< orphan*/, int);
void EncryptPasswdMD5(char *pw) {
  char cSalt[] = "$1$01234567$";
  char *cpw;
  (void)srand((int)time((time_t *)NULL));
  to64(&cSalt[3], rand(), 8);
  cpw = crypt(pw, cSalt);
  strcpy(pw, cpw);
}


x86 assembly (clang, -O0):
<EncryptPasswdMD5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xe8d(%rip),%rax
mov    %rax,-0x15(%rbp)
mov    0xe8b(%rip),%eax
mov    %eax,-0xd(%rbp)
mov    0xe86(%rip),%al
mov    %al,-0x9(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    -0x15(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
mov    $0x8,%edx
call   1050 <to64@plt>
mov    -0x8(%rbp),%rdi
lea    -0x15(%rbp),%rsi
call   1040 <crypt@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EncryptPasswdMD5>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movabs $0x24373635343332,%rax
mov    %rax,0xd(%rsp)
movabs $0x3433323130243124,%rax
32 33 34
mov    %rax,0x8(%rsp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xb(%rsp),%r14
xor    %eax,%eax
call   1080 <rand@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x8,%edx
call   1050 <to64@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <crypt@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.EncryptPasswdMD5.cSalt = [13 x i8] c"$1$01234567$\00"
define void @EncryptPasswdMD5(i8* %0) {
%2 = alloca i8*
%3 = alloca [13 x i8]
%4 = alloca i8*
store i8* %0, i8** %2
%5 = bitcast [13 x i8]* %3 to i8*
%6 = call i64 @time(i32* null)
%7 = trunc i64 %6 to i32
%8 = call i32 @srand(i32 %7)
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 3
%10 = call i32 (...) @rand()
%11 = call i32 @to64(i8* %9, i32 %10, i32 8)
%12 = load i8*, i8** %2
%13 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%14 = call i8* @crypt(i8* %12, i8* %13)
store i8* %14, i8** %4
%15 = load i8*, i8** %2
%16 = load i8*, i8** %4
%17 = call i32 @strcpy(i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
@__const.EncryptPasswdMD5.cSalt = [13 x i8] c"$1$01234567$\00"
define void @EncryptPasswdMD5(i8* %0) {
%2 = alloca [13 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @time(i32* null)
%5 = trunc i64 %4 to i32
%6 = tail call i32 @srand(i32 %5)
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 3
%8 = tail call i32 (...) @rand()
%9 = call i32 @to64(i8* %7, i32 %8, i32 8)
%10 = call i8* @crypt(i8* %0, i8* %3)
%11 = call i32 @strcpy(i8* %0, i8* %10)
ret void
}