#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 *crypt(char *, char *);
unsigned long getpid();
unsigned long time(int /*<<< orphan*/ *);
char *passCrypt(char *in) {
  unsigned long seed[2];
  char salt[] = "$1$........";
  const char *seedchars =
      "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  int i;
  seed[0] = time(NULL);
  seed[1] = getpid() ^ (seed[0] >> 14 & 0x30000);
  for (i = 0; i < 8; i++)
    salt[3 + i] = seedchars[(seed[i / 5] >> (i % 5) * 6) & 0x3f];
  return crypt(in, salt);
}


x86 assembly (clang, -O0):
<passCrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x2c(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x24(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x38(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x20(%rbp),%rcx
shr    $0xe,%rcx
and    $0x30000,%rcx
xor    %rcx,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x8,-0x3c(%rbp)
jge    11f5 <passCrypt+0xc5>
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cltq
mov    -0x20(%rbp,%rax,8),%rax
mov    %rax,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    -0x50(%rbp),%rax
mov    %edx,%ecx
mov    -0x48(%rbp),%rdx
imul   $0x6,%ecx,%ecx
mov    %ecx,%ecx
shr    %cl,%rdx
mov    %rdx,%rcx
and    $0x3f,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x3c(%rbp),%eax
add    $0x3,%eax
cltq
mov    %cl,-0x2c(%rbp,%rax,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    118c <passCrypt+0x5c>
mov    -0x8(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <crypt@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<passCrypt>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movabs $0x2e2e2e2e2e243124,%rax
2e 2e 2e
mov    %rax,0x8(%rsp)
movl   $0x2e2e2e,0x10(%rsp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %ebx,%ecx
shr    $0xe,%ecx
and    $0x30000,%ecx
xor    %eax,%ecx
mov    %ebx,%esi
and    $0x3f,%esi
lea    0xe91(%rip),%rdi
mov    (%rsi,%rdi,1),%dl
mov    %dl,0xb(%rsp)
mov    %ebx,%edx
shr    $0x6,%edx
and    $0x3f,%edx
mov    (%rdx,%rdi,1),%dl
mov    %dl,0xc(%rsp)
mov    %ebx,%edx
shr    $0xc,%edx
and    $0x3f,%edx
mov    (%rdx,%rdi,1),%dl
mov    %dl,0xd(%rsp)
mov    %ebx,%edx
shr    $0x12,%edx
and    $0x3f,%edx
mov    (%rdx,%rdi,1),%dl
mov    %dl,0xe(%rsp)
shr    $0x18,%ebx
and    $0x3f,%ebx
mov    (%rbx,%rdi,1),%dl
mov    %dl,0xf(%rsp)
mov    %eax,%edx
and    $0x3f,%edx
mov    (%rdx,%rdi,1),%dl
mov    %dl,0x10(%rsp)
shr    $0x6,%eax
and    $0x3f,%eax
mov    (%rax,%rdi,1),%al
mov    %al,0x11(%rsp)
shr    $0xc,%ecx
and    $0x3f,%ecx
mov    (%rcx,%rdi,1),%al
mov    %al,0x12(%rsp)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <crypt@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.passCrypt.salt = [12 x i8] c"$1$........\00"
@.str = [65 x i8] c"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\00"
define i8* @passCrypt(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i64]
%4 = alloca [12 x i8]
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %2
%7 = bitcast [12 x i8]* %4 to i8*
store i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8** %5
%8 = call i64 @time(i32* null)
%9 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
store i64 %8, i64* %9
%10 = call i64 (...) @getpid()
%11 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
%12 = load i64, i64* %11
%13 = lshr i64 %12, 14
%14 = and i64 %13, 196608
%15 = xor i64 %10, %14
%16 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 1
store i64 %15, i64* %16
store i32 0, i32* %6
br label %17
17: ; preds = %39, %1
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 8
br i1 %19, label %20, label %42
20: ; preds = %17
%21 = load i8*, i8** %5
%22 = load i32, i32* %6
%23 = sdiv i32 %22, 5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 %24
%26 = load i64, i64* %25
%27 = load i32, i32* %6
%28 = srem i32 %27, 5
%29 = mul nsw i32 %28, 6
%30 = zext i32 %29 to i64
%31 = lshr i64 %26, %30
%32 = and i64 %31, 63
%33 = getelementptr inbounds i8, i8* %21, i64 %32
%34 = load i8, i8* %33
%35 = load i32, i32* %6
%36 = add nsw i32 3, %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 %37
store i8 %34, i8* %38
br label %39
39: ; preds = %20
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %17
42: ; preds = %17
%43 = load i8*, i8** %2
%44 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%45 = call i8* @crypt(i8* %43, i8* %44)
ret i8* %45
}

LLVM IR (-O2):
@__const.passCrypt.salt = [12 x i8] c"$1$........\00"
@.str = [65 x i8] c"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\00"
define i8* @passCrypt(i8* %0) {
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @time(i32* null)
%5 = tail call i64 (...) @getpid()
%6 = lshr i64 %4, 14
%7 = and i64 %6, 196608
%8 = xor i64 %5, %7
%9 = and i64 %4, 63
%10 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 3
store i8 %11, i8* %12
%13 = lshr i64 %4, 6
%14 = and i64 %13, 63
%15 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 4
store i8 %16, i8* %17
%18 = lshr i64 %4, 12
%19 = and i64 %18, 63
%20 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 5
store i8 %21, i8* %22
%23 = lshr i64 %4, 18
%24 = and i64 %23, 63
%25 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 6
store i8 %26, i8* %27
%28 = lshr i64 %4, 24
%29 = and i64 %28, 63
%30 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 7
store i8 %31, i8* %32
%33 = and i64 %5, 63
%34 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 8
store i8 %35, i8* %36
%37 = lshr i64 %5, 6
%38 = and i64 %37, 63
%39 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 9
store i8 %40, i8* %41
%42 = lshr i64 %8, 12
%43 = and i64 %42, 63
%44 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 10
store i8 %45, i8* %46
%47 = call i8* @crypt(i8* %0, i8* %3)
ret i8* %47
}