#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 */
char *libshadow_md5_crypt(char *, char *);
int random();
char *doencrypt(char *plaintext) {
  char *hash, salt[12] = "";
  static char saltChars[] =
      "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
  salt[0] = saltChars[random() % 64];
  salt[1] = saltChars[random() % 64];
  salt[2] = saltChars[random() % 64];
  salt[3] = saltChars[random() % 64];
  salt[4] = saltChars[random() % 64];
  salt[5] = saltChars[random() % 64];
  salt[6] = saltChars[random() % 64];
  salt[7] = saltChars[random() % 64];
  salt[8] = 0;
  hash = libshadow_md5_crypt(plaintext, salt);
  return hash;
}


x86 assembly (clang, -O0):
<doencrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x1c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2edb(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2ebc(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x1b(%rbp)
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2e9d(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x1a(%rbp)
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2e7e(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2e5f(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x18(%rbp)
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2e40(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x17(%rbp)
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2e21(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x16(%rbp)
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x40,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2e02(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
movb   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <libshadow_md5_crypt@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doencrypt>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movb   $0x0,0x17(%rsp)
movw   $0x0,0x15(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
lea    0xead(%rip),%rbx
mov    (%rax,%rbx,1),%al
mov    %al,0xc(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
mov    (%rax,%rbx,1),%al
mov    %al,0xd(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
mov    (%rax,%rbx,1),%al
mov    %al,0xe(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
mov    (%rax,%rbx,1),%al
mov    %al,0xf(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
mov    (%rax,%rbx,1),%al
mov    %al,0x10(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
mov    (%rax,%rbx,1),%al
mov    %al,0x11(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
mov    (%rax,%rbx,1),%al
mov    %al,0x12(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
lea    0x3f(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
cltq
mov    (%rax,%rbx,1),%al
mov    %al,0x13(%rsp)
movb   $0x0,0x14(%rsp)
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1030 <libshadow_md5_crypt@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@doencrypt.saltChars = internal global [65 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./\00"
define i8* @doencrypt(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [12 x i8]
store i8* %0, i8** %2
%5 = bitcast [12 x i8]* %4 to i8*
%6 = call i32 (...) @random()
%7 = srem i32 %6, 64
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
store i8 %10, i8* %11
%12 = call i32 (...) @random()
%13 = srem i32 %12, 64
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 1
store i8 %16, i8* %17
%18 = call i32 (...) @random()
%19 = srem i32 %18, 64
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 2
store i8 %22, i8* %23
%24 = call i32 (...) @random()
%25 = srem i32 %24, 64
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 3
store i8 %28, i8* %29
%30 = call i32 (...) @random()
%31 = srem i32 %30, 64
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 4
store i8 %34, i8* %35
%36 = call i32 (...) @random()
%37 = srem i32 %36, 64
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 5
store i8 %40, i8* %41
%42 = call i32 (...) @random()
%43 = srem i32 %42, 64
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 6
store i8 %46, i8* %47
%48 = call i32 (...) @random()
%49 = srem i32 %48, 64
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 7
store i8 %52, i8* %53
%54 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 8
store i8 0, i8* %54
%55 = load i8*, i8** %2
%56 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%57 = call i8* @libshadow_md5_crypt(i8* %55, i8* %56)
store i8* %57, i8** %3
%58 = load i8*, i8** %3
ret i8* %58
}

LLVM IR (-O2):
@doencrypt.saltChars = internal unnamed_addr constant [65 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./\00"
define i8* @doencrypt(i8* %0) {
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 9
%5 = tail call i32 (...) @random()
%6 = srem i32 %5, 64
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %3
%10 = tail call i32 (...) @random()
%11 = srem i32 %10, 64
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 1
store i8 %14, i8* %15
%16 = tail call i32 (...) @random()
%17 = srem i32 %16, 64
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 2
store i8 %20, i8* %21
%22 = tail call i32 (...) @random()
%23 = srem i32 %22, 64
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 3
store i8 %26, i8* %27
%28 = tail call i32 (...) @random()
%29 = srem i32 %28, 64
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 4
store i8 %32, i8* %33
%34 = tail call i32 (...) @random()
%35 = srem i32 %34, 64
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 5
store i8 %38, i8* %39
%40 = tail call i32 (...) @random()
%41 = srem i32 %40, 64
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 6
store i8 %44, i8* %45
%46 = tail call i32 (...) @random()
%47 = srem i32 %46, 64
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [65 x i8], [65 x i8]* @doencrypt.saltChars, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 7
store i8 %50, i8* %51
%52 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 8
store i8 0, i8* %52
%53 = call i8* @libshadow_md5_crypt(i8* %0, i8* %3)
ret i8* %53
}