#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 decrypt_byte(unsigned long *, unsigned long const *);
int /*<<< orphan*/ init_keys(char const *, unsigned long *,
                             unsigned long const *);
int rand();
int /*<<< orphan*/ srand(unsigned int);
unsigned long time(int /*<<< orphan*/ *);
int /*<<< orphan*/ update_keys(unsigned long *, unsigned long const *, int);
int crypthead(const char *passwd, unsigned char *buf, int bufSize,
              unsigned long *pkeys, const unsigned long *pcrc_32_tab,
              unsigned long crcForCrypting) {
  int n;
  int t;
  int c;
  unsigned char header[12 - 2];
  static unsigned calls = 0;
  if (bufSize < 12)
    return 0;
  if (++calls == 1) {
    srand((unsigned)(time(NULL) ^ 3141592654UL));
  }
  init_keys(passwd, pkeys, pcrc_32_tab);
  for (n = 0; n < 12 - 2; n++) {
    c = (rand() >> 7) & 0xff;
    header[n] = (unsigned char)(t = decrypt_byte(pkeys, pcrc_32_tab),
                                update_keys(pkeys, pcrc_32_tab, c), t ^ (c));
  }
  init_keys(passwd, pkeys, pcrc_32_tab);
  for (n = 0; n < 12 - 2; n++) {
    buf[n] = (unsigned char)(t = decrypt_byte(pkeys, pcrc_32_tab),
                             update_keys(pkeys, pcrc_32_tab, header[n]),
                             t ^ (header[n]));
  }
  buf[n++] = (unsigned char)(t = decrypt_byte(pkeys, pcrc_32_tab),
                             update_keys(pkeys, pcrc_32_tab,
                                         (int)(crcForCrypting >> 16) & 0xff),
                             t ^ ((int)(crcForCrypting >> 16) & 0xff));
  buf[n++] = (unsigned char)(t = decrypt_byte(pkeys, pcrc_32_tab),
                             update_keys(pkeys, pcrc_32_tab,
                                         (int)(crcForCrypting >> 24) & 0xff),
                             t ^ ((int)(crcForCrypting >> 24) & 0xff));
  return n;
}


x86 assembly (clang, -O0):
<crypthead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
cmpl   $0xc,-0x1c(%rbp)
jge    1195 <crypthead+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1361 <crypthead+0x201>
mov    0x2eb9(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eb0(%rip)
cmp    $0x1,%eax
jne    11ca <crypthead+0x6a>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
movabs $0xbb40e64e,%rcx
xor    %rcx,%rax
mov    %eax,%edi
call   1040 <srand@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <init_keys@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    123c <crypthead+0xdc>
mov    $0x0,%al
call   1080 <rand@plt>
sar    $0x7,%eax
and    $0xff,%eax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   1030 <update_keys@plt>
mov    -0x40(%rbp),%eax
xor    -0x44(%rbp),%eax
mov    %al,%cl
movslq -0x3c(%rbp),%rax
mov    %cl,-0x4e(%rbp,%rax,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11e2 <crypthead+0x82>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <init_keys@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    12ad <crypthead+0x14d>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq -0x3c(%rbp),%rax
movzbl -0x4e(%rbp,%rax,1),%edx
call   1030 <update_keys@plt>
mov    -0x40(%rbp),%eax
movslq -0x3c(%rbp),%rcx
movzbl -0x4e(%rbp,%rcx,1),%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1254 <crypthead+0xf4>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rax
shr    $0x10,%rax
mov    %eax,%edx
and    $0xff,%edx
call   1030 <update_keys@plt>
mov    -0x40(%rbp),%eax
mov    -0x38(%rbp),%rcx
shr    $0x10,%rcx
and    $0xff,%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x3c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rax
shr    $0x18,%rax
mov    %eax,%edx
and    $0xff,%edx
call   1030 <update_keys@plt>
mov    -0x40(%rbp),%eax
mov    -0x38(%rbp),%rcx
shr    $0x18,%rcx
and    $0xff,%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x3c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypthead>:
xor    %eax,%eax
cmp    $0xc,%edx
jl     1597 <crypthead+0x437>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdi,%rbx
mov    %rsi,0x38(%rsp)
mov    %r9,0x40(%rsp)
mov    0x2ec2(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2eb9(%rip)
test   %eax,%eax
jne    11b2 <crypthead+0x52>
xor    %edi,%edi
call   1060 <time@plt>
xor    $0xbb40e64e,%eax
mov    %eax,%edi
call   1040 <srand@plt>
mov    %rbx,0x30(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <init_keys@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x2c(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x28(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x24(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x20(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x1c(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x18(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x14(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0x10(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r13d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,0xc(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebp
shr    $0x7,%ebp
movzbl %bpl,%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %ebx,%r14d
mov    0x30(%rsp),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <init_keys@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x2c(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    0x38(%rsp),%r13
mov    %bpl,0x0(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x28(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x1(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x24(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x2(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x20(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x3(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x1c(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x4(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x18(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x5(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x14(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x6(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x7(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
mov    0xc(%rsp),%ebx
movzbl %bl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %ebx,%ebp
mov    %bpl,0x8(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
movzbl %r14b,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %r14d,%ebp
mov    %bpl,0x9(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%r14d
mov    0x40(%rsp),%rbx
mov    %ebx,%ebp
shr    $0x10,%ebp
movzbl %bpl,%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <update_keys@plt>
xor    %r14d,%ebp
mov    %bpl,0xa(%r13)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <decrypt_byte@plt>
mov    %eax,%ebp
shr    $0x18,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <update_keys@plt>
xor    %ebp,%ebx
mov    %bl,0xb(%r13)
mov    $0xc,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@crypthead.calls = internal global i32 0
define i32 @crypthead(i8* %0, i8* %1, i32 %2, i64* %3, i64* %4, i64 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i64*
%12 = alloca i64*
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [10 x i8]
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i64* %3, i64** %11
store i64* %4, i64** %12
store i64 %5, i64* %13
%18 = load i32, i32* %10
%19 = icmp slt i32 %18, 12
br i1 %19, label %20, label %21
20: ; preds = %6
store i32 0, i32* %7
br label %140
21: ; preds = %6
%22 = load i32, i32* @crypthead.calls
%23 = add i32 %22, 1
store i32 %23, i32* @crypthead.calls
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = call i64 @time(i32* null)
%27 = xor i64 %26, 3141592654
%28 = trunc i64 %27 to i32
%29 = call i32 @srand(i32 %28)
br label %30
30: ; preds = %25, %21
%31 = load i8*, i8** %8
%32 = load i64*, i64** %11
%33 = load i64*, i64** %12
%34 = call i32 @init_keys(i8* %31, i64* %32, i64* %33)
store i32 0, i32* %14
br label %35
35: ; preds = %56, %30
%36 = load i32, i32* %14
%37 = icmp slt i32 %36, 10
br i1 %37, label %38, label %59
38: ; preds = %35
%39 = call i32 (...) @rand()
%40 = ashr i32 %39, 7
%41 = and i32 %40, 255
store i32 %41, i32* %16
%42 = load i64*, i64** %11
%43 = load i64*, i64** %12
%44 = call i32 @decrypt_byte(i64* %42, i64* %43)
store i32 %44, i32* %15
%45 = load i64*, i64** %11
%46 = load i64*, i64** %12
%47 = load i32, i32* %16
%48 = call i32 @update_keys(i64* %45, i64* %46, i32 %47)
%49 = load i32, i32* %15
%50 = load i32, i32* %16
%51 = xor i32 %49, %50
%52 = trunc i32 %51 to i8
%53 = load i32, i32* %14
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 %54
store i8 %52, i8* %55
br label %56
56: ; preds = %38
%57 = load i32, i32* %14
%58 = add nsw i32 %57, 1
store i32 %58, i32* %14
br label %35
59: ; preds = %35
%60 = load i8*, i8** %8
%61 = load i64*, i64** %11
%62 = load i64*, i64** %12
%63 = call i32 @init_keys(i8* %60, i64* %61, i64* %62)
store i32 0, i32* %14
br label %64
64: ; preds = %91, %59
%65 = load i32, i32* %14
%66 = icmp slt i32 %65, 10
br i1 %66, label %67, label %94
67: ; preds = %64
%68 = load i64*, i64** %11
%69 = load i64*, i64** %12
%70 = call i32 @decrypt_byte(i64* %68, i64* %69)
store i32 %70, i32* %15
%71 = load i64*, i64** %11
%72 = load i64*, i64** %12
%73 = load i32, i32* %14
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = zext i8 %76 to i32
%78 = call i32 @update_keys(i64* %71, i64* %72, i32 %77)
%79 = load i32, i32* %15
%80 = load i32, i32* %14
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = xor i32 %79, %84
%86 = trunc i32 %85 to i8
%87 = load i8*, i8** %9
%88 = load i32, i32* %14
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
store i8 %86, i8* %90
br label %91
91: ; preds = %67
%92 = load i32, i32* %14
%93 = add nsw i32 %92, 1
store i32 %93, i32* %14
br label %64
94: ; preds = %64
%95 = load i64*, i64** %11
%96 = load i64*, i64** %12
%97 = call i32 @decrypt_byte(i64* %95, i64* %96)
store i32 %97, i32* %15
%98 = load i64*, i64** %11
%99 = load i64*, i64** %12
%100 = load i64, i64* %13
%101 = lshr i64 %100, 16
%102 = trunc i64 %101 to i32
%103 = and i32 %102, 255
%104 = call i32 @update_keys(i64* %98, i64* %99, i32 %103)
%105 = load i32, i32* %15
%106 = load i64, i64* %13
%107 = lshr i64 %106, 16
%108 = trunc i64 %107 to i32
%109 = and i32 %108, 255
%110 = xor i32 %105, %109
%111 = trunc i32 %110 to i8
%112 = load i8*, i8** %9
%113 = load i32, i32* %14
%114 = add nsw i32 %113, 1
store i32 %114, i32* %14
%115 = sext i32 %113 to i64
%116 = getelementptr inbounds i8, i8* %112, i64 %115
store i8 %111, i8* %116
%117 = load i64*, i64** %11
%118 = load i64*, i64** %12
%119 = call i32 @decrypt_byte(i64* %117, i64* %118)
store i32 %119, i32* %15
%120 = load i64*, i64** %11
%121 = load i64*, i64** %12
%122 = load i64, i64* %13
%123 = lshr i64 %122, 24
%124 = trunc i64 %123 to i32
%125 = and i32 %124, 255
%126 = call i32 @update_keys(i64* %120, i64* %121, i32 %125)
%127 = load i32, i32* %15
%128 = load i64, i64* %13
%129 = lshr i64 %128, 24
%130 = trunc i64 %129 to i32
%131 = and i32 %130, 255
%132 = xor i32 %127, %131
%133 = trunc i32 %132 to i8
%134 = load i8*, i8** %9
%135 = load i32, i32* %14
%136 = add nsw i32 %135, 1
store i32 %136, i32* %14
%137 = sext i32 %135 to i64
%138 = getelementptr inbounds i8, i8* %134, i64 %137
store i8 %133, i8* %138
%139 = load i32, i32* %14
store i32 %139, i32* %7
br label %140
140: ; preds = %94, %20
%141 = load i32, i32* %7
ret i32 %141
}

LLVM IR (-O2):
@crypthead.calls = internal unnamed_addr global i32 0
define i32 @crypthead(i8* %0, i8* nocapture writeonly %1, i32 %2, i64* %3, i64* %4, i64 %5) {
%7 = icmp slt i32 %2, 12
br i1 %7, label %153, label %8
8: ; preds = %6
%9 = load i32, i32* @crypthead.calls
%10 = add i32 %9, 1
store i32 %10, i32* @crypthead.calls
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = tail call i64 @time(i32* null)
%14 = trunc i64 %13 to i32
%15 = xor i32 %14, -1153374642
%16 = tail call i32 @srand(i32 %15)
br label %17
17: ; preds = %12, %8
%18 = tail call i32 @init_keys(i8* %0, i64* %3, i64* %4)
%19 = tail call i32 (...) @rand()
%20 = lshr i32 %19, 7
%21 = and i32 %20, 255
%22 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%23 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %21)
%24 = xor i32 %22, %20
%25 = tail call i32 (...) @rand()
%26 = lshr i32 %25, 7
%27 = and i32 %26, 255
%28 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%29 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %27)
%30 = xor i32 %28, %26
%31 = tail call i32 (...) @rand()
%32 = lshr i32 %31, 7
%33 = and i32 %32, 255
%34 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%35 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %33)
%36 = xor i32 %34, %32
%37 = tail call i32 (...) @rand()
%38 = lshr i32 %37, 7
%39 = and i32 %38, 255
%40 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%41 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %39)
%42 = xor i32 %40, %38
%43 = tail call i32 (...) @rand()
%44 = lshr i32 %43, 7
%45 = and i32 %44, 255
%46 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%47 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %45)
%48 = xor i32 %46, %44
%49 = tail call i32 (...) @rand()
%50 = lshr i32 %49, 7
%51 = and i32 %50, 255
%52 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%53 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %51)
%54 = xor i32 %52, %50
%55 = tail call i32 (...) @rand()
%56 = lshr i32 %55, 7
%57 = and i32 %56, 255
%58 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%59 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %57)
%60 = xor i32 %58, %56
%61 = tail call i32 (...) @rand()
%62 = lshr i32 %61, 7
%63 = and i32 %62, 255
%64 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%65 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %63)
%66 = xor i32 %64, %62
%67 = tail call i32 (...) @rand()
%68 = lshr i32 %67, 7
%69 = and i32 %68, 255
%70 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%71 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %69)
%72 = xor i32 %70, %68
%73 = tail call i32 (...) @rand()
%74 = lshr i32 %73, 7
%75 = and i32 %74, 255
%76 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%77 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %75)
%78 = xor i32 %76, %74
%79 = tail call i32 @init_keys(i8* %0, i64* %3, i64* %4)
%80 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%81 = and i32 %24, 255
%82 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %81)
%83 = xor i32 %24, %80
%84 = trunc i32 %83 to i8
store i8 %84, i8* %1
%85 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%86 = and i32 %30, 255
%87 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %86)
%88 = xor i32 %30, %85
%89 = trunc i32 %88 to i8
%90 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %89, i8* %90
%91 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%92 = and i32 %36, 255
%93 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %92)
%94 = xor i32 %36, %91
%95 = trunc i32 %94 to i8
%96 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %95, i8* %96
%97 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%98 = and i32 %42, 255
%99 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %98)
%100 = xor i32 %42, %97
%101 = trunc i32 %100 to i8
%102 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %101, i8* %102
%103 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%104 = and i32 %48, 255
%105 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %104)
%106 = xor i32 %48, %103
%107 = trunc i32 %106 to i8
%108 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %107, i8* %108
%109 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%110 = and i32 %54, 255
%111 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %110)
%112 = xor i32 %54, %109
%113 = trunc i32 %112 to i8
%114 = getelementptr inbounds i8, i8* %1, i64 5
store i8 %113, i8* %114
%115 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%116 = and i32 %60, 255
%117 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %116)
%118 = xor i32 %60, %115
%119 = trunc i32 %118 to i8
%120 = getelementptr inbounds i8, i8* %1, i64 6
store i8 %119, i8* %120
%121 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%122 = and i32 %66, 255
%123 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %122)
%124 = xor i32 %66, %121
%125 = trunc i32 %124 to i8
%126 = getelementptr inbounds i8, i8* %1, i64 7
store i8 %125, i8* %126
%127 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%128 = and i32 %72, 255
%129 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %128)
%130 = xor i32 %72, %127
%131 = trunc i32 %130 to i8
%132 = getelementptr inbounds i8, i8* %1, i64 8
store i8 %131, i8* %132
%133 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%134 = and i32 %78, 255
%135 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %134)
%136 = xor i32 %78, %133
%137 = trunc i32 %136 to i8
%138 = getelementptr inbounds i8, i8* %1, i64 9
store i8 %137, i8* %138
%139 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%140 = trunc i64 %5 to i32
%141 = lshr i32 %140, 16
%142 = and i32 %141, 255
%143 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %142)
%144 = xor i32 %139, %141
%145 = trunc i32 %144 to i8
%146 = getelementptr inbounds i8, i8* %1, i64 10
store i8 %145, i8* %146
%147 = tail call i32 @decrypt_byte(i64* %3, i64* %4)
%148 = lshr i32 %140, 24
%149 = tail call i32 @update_keys(i64* %3, i64* %4, i32 %148)
%150 = xor i32 %147, %148
%151 = trunc i32 %150 to i8
%152 = getelementptr inbounds i8, i8* %1, i64 11
store i8 %151, i8* %152
br label %153
153: ; preds = %6, %17
%154 = phi i32 [ 12, %17 ], [ 0, %6 ]
ret i32 %154
}