#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 size_t uint8_t;

/* Variables and functions */
size_t UINT32_MAX;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ earworm_aesenc_round(size_t *, size_t const *);
int /*<<< orphan*/ memcpy(size_t *, size_t const *, size_t);
int /*<<< orphan*/ prf(size_t *, size_t, size_t const *, int, size_t *, size_t);
int /*<<< orphan*/ secure_wipe(size_t *, int);
size_t to_index(size_t *, unsigned int);
scalar_t__ validate_fit(size_t, unsigned int);
void workunit(uint8_t *out, size_t outlen, const uint8_t *secret,
              size_t secretlen, const uint8_t *salt, size_t saltlen,
              unsigned int m_cost, const uint8_t *arena) {
  uint8_t scratchpad[((size_t)16) * ((size_t)4)];
  uint8_t prefixed_salt[((size_t)32) + 5];
  uint8_t arena_index_tmpbuf[((size_t)16) * 2];
  size_t arena_index[2];
  size_t d, l, w;
  assert(validate_fit((((size_t)64) * ((size_t)4)), m_cost) == 0);
  assert(outlen <= UINT32_MAX);
  assert(secretlen <= UINT32_MAX);
  assert(saltlen <= ((size_t)32) + 4);
  prefixed_salt[0] = 0x00;
  memcpy(prefixed_salt + 1, salt, saltlen);
  prf(arena_index_tmpbuf, sizeof arena_index_tmpbuf, secret, secretlen,
      prefixed_salt, saltlen + 1);
  arena_index[0] = to_index(arena_index_tmpbuf, m_cost);
  arena_index[1] = to_index(arena_index_tmpbuf + ((size_t)16), m_cost);
  secure_wipe(arena_index_tmpbuf, sizeof arena_index_tmpbuf);
  prefixed_salt[0] = 0x01;
  prf(scratchpad, sizeof scratchpad, secret, secretlen, prefixed_salt,
      saltlen + 1);
  for (d = 0; d < ((size_t)256); d++) {
    for (l = 0; l < ((size_t)64); l++) {
      for (w = 0; w < ((size_t)4); w++)
        earworm_aesenc_round(scratchpad + ((size_t)16) * w,
                             arena + ((size_t)16) * arena_index[0]++);
    }
    arena_index[0] = to_index(scratchpad, m_cost);
    if (++d == ((size_t)256))
      break;
    for (l = 0; l < ((size_t)64); l++) {
      for (w = 0; w < ((size_t)4); w++)
        earworm_aesenc_round(scratchpad + ((size_t)16) * w,
                             arena + ((size_t)16) * arena_index[1]++);
    }
    arena_index[1] = to_index(scratchpad, m_cost);
  }
  prefixed_salt[0] = 0x02;
  prf(out, outlen, scratchpad, sizeof scratchpad, prefixed_salt, saltlen + 1);
  secure_wipe(scratchpad, sizeof scratchpad);
  secure_wipe(arena_index, sizeof arena_index);
}


x86 assembly (clang, -O0):
<workunit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x10(%rbp),%esi
mov    $0x100,%edi
call   1070 <validate_fit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x2e35(%rip),%rcx
cmp    (%rcx),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x20(%rbp),%rax
mov    0x2e1a(%rip),%rcx
cmp    (%rcx),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x24,-0x30(%rbp)
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movq   $0x0,-0x360(%rbp)
lea    -0x360(%rbp),%rdi
add    $0x8,%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1060 <memcpy@plt>
lea    -0x460(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
lea    -0x360(%rbp),%r8
mov    -0x30(%rbp),%r9
add    $0x1,%r9
mov    $0x100,%esi
call   1040 <prf@plt>
lea    -0x460(%rbp),%rdi
mov    0x10(%rbp),%esi
call   1080 <to_index@plt>
mov    %rax,-0x470(%rbp)
lea    -0x460(%rbp),%rdi
add    $0x80,%rdi
mov    0x10(%rbp),%esi
call   1080 <to_index@plt>
mov    %rax,-0x468(%rbp)
lea    -0x460(%rbp),%rdi
mov    $0x100,%esi
call   1090 <secure_wipe@plt>
movq   $0x1,-0x360(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
lea    -0x360(%rbp),%r8
mov    -0x30(%rbp),%r9
add    $0x1,%r9
mov    $0x200,%esi
call   1040 <prf@plt>
movq   $0x0,-0x478(%rbp)
cmpq   $0x100,-0x478(%rbp)
jae    1496 <workunit+0x326>
movq   $0x0,-0x480(%rbp)
cmpq   $0x40,-0x480(%rbp)
40
jae    1389 <workunit+0x219>
movq   $0x0,-0x488(%rbp)
cmpq   $0x4,-0x488(%rbp)
04
jae    136d <workunit+0x1fd>
lea    -0x230(%rbp),%rdi
mov    -0x488(%rbp),%rax
shl    $0x4,%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    0x18(%rbp),%rsi
mov    -0x470(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x470(%rbp)
shl    $0x4,%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <earworm_aesenc_round@plt>
mov    -0x488(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x488(%rbp)
jmp    1306 <workunit+0x196>
jmp    1372 <workunit+0x202>
mov    -0x480(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x480(%rbp)
jmp    12ed <workunit+0x17d>
lea    -0x230(%rbp),%rdi
mov    0x10(%rbp),%esi
call   1080 <to_index@plt>
mov    %rax,-0x470(%rbp)
mov    -0x478(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x478(%rbp)
cmp    $0x100,%rax
jne    13c2 <workunit+0x252>
jmp    1496 <workunit+0x326>
movq   $0x0,-0x480(%rbp)
cmpq   $0x40,-0x480(%rbp)
40
jae    1469 <workunit+0x2f9>
movq   $0x0,-0x488(%rbp)
cmpq   $0x4,-0x488(%rbp)
04
jae    144d <workunit+0x2dd>
lea    -0x230(%rbp),%rdi
mov    -0x488(%rbp),%rax
shl    $0x4,%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    0x18(%rbp),%rsi
mov    -0x468(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x468(%rbp)
shl    $0x4,%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <earworm_aesenc_round@plt>
mov    -0x488(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x488(%rbp)
jmp    13e6 <workunit+0x276>
jmp    1452 <workunit+0x2e2>
mov    -0x480(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x480(%rbp)
jmp    13cd <workunit+0x25d>
lea    -0x230(%rbp),%rdi
mov    0x10(%rbp),%esi
call   1080 <to_index@plt>
mov    %rax,-0x468(%rbp)
mov    -0x478(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x478(%rbp)
jmp    12d1 <workunit+0x161>
movq   $0x2,-0x360(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x230(%rbp),%rdx
lea    -0x360(%rbp),%r8
mov    -0x30(%rbp),%r9
add    $0x1,%r9
mov    $0x200,%ecx
call   1040 <prf@plt>
lea    -0x230(%rbp),%rdi
mov    $0x200,%esi
call   1090 <secure_wipe@plt>
lea    -0x470(%rbp),%rdi
mov    $0x10,%esi
call   1090 <secure_wipe@plt>
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<workunit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x478,%rsp
mov    %r9,%r13
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,0x8(%rsp)
mov    %rsi,%rbx
mov    %rdi,0x28(%rsp)
mov    0x4b0(%rsp),%r12d
mov    $0x100,%edi
mov    %r12d,%esi
call   1070 <validate_fit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    0x2e37(%rip),%rbp
xor    %edi,%edi
mov    %rbx,0x30(%rsp)
cmp    %rbx,0x0(%rbp)
setae  %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    %r14,0x0(%rbp)
setae  %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x25,%r13
setb   %dil
call   1050 <assert@plt>
movq   $0x0,0x40(%rsp)
lea    0x48(%rsp),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1060 <memcpy@plt>
add    $0x1,%r13
lea    0x370(%rsp),%rbx
lea    0x40(%rsp),%r8
mov    $0x100,%esi
mov    %rbx,%rdi
mov    0x8(%rsp),%rbp
mov    %rbp,%rdx
mov    %r14d,%ecx
mov    %r13,%r9
call   1040 <prf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
call   1080 <to_index@plt>
mov    %rax,%r15
lea    0x3f0(%rsp),%rdi
mov    %r12d,%esi
call   1080 <to_index@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    $0x100,%esi
call   1090 <secure_wipe@plt>
movq   $0x1,0x40(%rsp)
lea    0x170(%rsp),%rdi
mov    $0x200,%esi
mov    %rbp,%rdx
mov    %r14d,%ecx
lea    0x40(%rsp),%r8
mov    %r13,0x38(%rsp)
mov    %r13,%r9
call   1040 <prf@plt>
lea    0x270(%rsp),%rbp
xor    %eax,%eax
xchg   %ax,%ax
mov    %rax,0x8(%rsp)
mov    %r15,%rbx
shl    $0x7,%rbx
add    0x4b8(%rsp),%rbx
add    $0x4,%r15
xor    %r14d,%r14d
lea    0x2f0(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rbx,%r14,1),%rsi
lea    0x170(%rsp),%rdi
call   1030 <earworm_aesenc_round@plt>
lea    (%rbx,%r14,1),%rsi
add    $0x80,%rsi
lea    0x1f0(%rsp),%rdi
call   1030 <earworm_aesenc_round@plt>
lea    (%rbx,%r14,1),%rsi
add    $0x100,%rsi
mov    %rbp,%rdi
call   1030 <earworm_aesenc_round@plt>
mov    %r15,0x10(%rsp)
lea    (%rbx,%r14,1),%rsi
add    $0x180,%rsi
mov    %r13,%rdi
call   1030 <earworm_aesenc_round@plt>
add    $0x200,%r14
add    $0x4,%r15
cmp    $0x8000,%r14
jne    12d0 <workunit+0x160>
lea    0x170(%rsp),%rdi
mov    0x4b0(%rsp),%esi
call   1080 <to_index@plt>
mov    %rax,%r15
mov    %rax,0x10(%rsp)
mov    %r12,%rbx
shl    $0x7,%rbx
add    0x4b8(%rsp),%rbx
add    $0x4,%r12
mov    %rbp,%r13
xor    %ebp,%ebp
lea    0x1f0(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rbx,%rbp,1),%rsi
lea    0x170(%rsp),%rdi
call   1030 <earworm_aesenc_round@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x80,%rsi
mov    %r14,%rdi
call   1030 <earworm_aesenc_round@plt>
lea    (%rbx,%rbp,1),%rsi
add    $0x100,%rsi
mov    %r13,%rdi
call   1030 <earworm_aesenc_round@plt>
mov    %r12,0x18(%rsp)
lea    (%rbx,%rbp,1),%rsi
add    $0x180,%rsi
lea    0x2f0(%rsp),%rdi
call   1030 <earworm_aesenc_round@plt>
add    $0x200,%rbp
add    $0x4,%r12
cmp    $0x8000,%rbp
jne    1380 <workunit+0x210>
lea    0x170(%rsp),%rdi
mov    0x4b0(%rsp),%esi
call   1080 <to_index@plt>
mov    %rax,%r12
mov    %rax,0x18(%rsp)
mov    0x8(%rsp),%rcx
lea    0x2(%rcx),%rax
cmp    $0xfe,%rcx
mov    %r13,%rbp
jb     12a0 <workunit+0x130>
movq   $0x2,0x40(%rsp)
lea    0x170(%rsp),%rbx
lea    0x40(%rsp),%r8
mov    0x28(%rsp),%rdi
mov    0x30(%rsp),%rsi
mov    %rbx,%rdx
mov    $0x200,%ecx
mov    0x38(%rsp),%r9
call   1040 <prf@plt>
mov    %rbx,%rdi
mov    $0x200,%esi
call   1090 <secure_wipe@plt>
lea    0x10(%rsp),%rdi
mov    $0x10,%esi
call   1090 <secure_wipe@plt>
add    $0x478,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UINT32_MAX = global i64 0
define void @workunit(i64* %0, i64 %1, i64* %2, i64 %3, i64* %4, i64 %5, i32 %6, i64* %7) {
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i64
%13 = alloca i64*
%14 = alloca i64
%15 = alloca i32
%16 = alloca i64*
%17 = alloca [64 x i64]
%18 = alloca [37 x i64]
%19 = alloca [32 x i64]
%20 = alloca [2 x i64]
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
store i64* %0, i64** %9
store i64 %1, i64* %10
store i64* %2, i64** %11
store i64 %3, i64* %12
store i64* %4, i64** %13
store i64 %5, i64* %14
store i32 %6, i32* %15
store i64* %7, i64** %16
%24 = load i32, i32* %15
%25 = call i64 @validate_fit(i64 256, i32 %24)
%26 = icmp eq i64 %25, 0
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load i64, i64* %10
%30 = load i64, i64* @UINT32_MAX
%31 = icmp ule i64 %29, %30
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load i64, i64* %12
%35 = load i64, i64* @UINT32_MAX
%36 = icmp ule i64 %34, %35
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = load i64, i64* %14
%40 = icmp ule i64 %39, 36
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = getelementptr inbounds [37 x i64], [37 x i64]* %18, i64 0, i64 0
store i64 0, i64* %43
%44 = getelementptr inbounds [37 x i64], [37 x i64]* %18, i64 0, i64 0
%45 = getelementptr inbounds i64, i64* %44, i64 1
%46 = load i64*, i64** %13
%47 = load i64, i64* %14
%48 = call i32 @memcpy(i64* %45, i64* %46, i64 %47)
%49 = getelementptr inbounds [32 x i64], [32 x i64]* %19, i64 0, i64 0
%50 = load i64*, i64** %11
%51 = load i64, i64* %12
%52 = trunc i64 %51 to i32
%53 = getelementptr inbounds [37 x i64], [37 x i64]* %18, i64 0, i64 0
%54 = load i64, i64* %14
%55 = add i64 %54, 1
%56 = call i32 @prf(i64* %49, i64 256, i64* %50, i32 %52, i64* %53, i64 %55)
%57 = getelementptr inbounds [32 x i64], [32 x i64]* %19, i64 0, i64 0
%58 = load i32, i32* %15
%59 = call i64 @to_index(i64* %57, i32 %58)
%60 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 0
store i64 %59, i64* %60
%61 = getelementptr inbounds [32 x i64], [32 x i64]* %19, i64 0, i64 0
%62 = getelementptr inbounds i64, i64* %61, i64 16
%63 = load i32, i32* %15
%64 = call i64 @to_index(i64* %62, i32 %63)
%65 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 1
store i64 %64, i64* %65
%66 = getelementptr inbounds [32 x i64], [32 x i64]* %19, i64 0, i64 0
%67 = call i32 @secure_wipe(i64* %66, i32 256)
%68 = getelementptr inbounds [37 x i64], [37 x i64]* %18, i64 0, i64 0
store i64 1, i64* %68
%69 = getelementptr inbounds [64 x i64], [64 x i64]* %17, i64 0, i64 0
%70 = load i64*, i64** %11
%71 = load i64, i64* %12
%72 = trunc i64 %71 to i32
%73 = getelementptr inbounds [37 x i64], [37 x i64]* %18, i64 0, i64 0
%74 = load i64, i64* %14
%75 = add i64 %74, 1
%76 = call i32 @prf(i64* %69, i64 512, i64* %70, i32 %72, i64* %73, i64 %75)
store i64 0, i64* %21
br label %77
77: ; preds = %148, %8
%78 = load i64, i64* %21
%79 = icmp ult i64 %78, 256
br i1 %79, label %80, label %151
80: ; preds = %77
store i64 0, i64* %22
br label %81
81: ; preds = %104, %80
%82 = load i64, i64* %22
%83 = icmp ult i64 %82, 64
br i1 %83, label %84, label %107
84: ; preds = %81
store i64 0, i64* %23
br label %85
85: ; preds = %100, %84
%86 = load i64, i64* %23
%87 = icmp ult i64 %86, 4
br i1 %87, label %88, label %103
88: ; preds = %85
%89 = getelementptr inbounds [64 x i64], [64 x i64]* %17, i64 0, i64 0
%90 = load i64, i64* %23
%91 = mul i64 16, %90
%92 = getelementptr inbounds i64, i64* %89, i64 %91
%93 = load i64*, i64** %16
%94 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 0
%95 = load i64, i64* %94
%96 = add i64 %95, 1
store i64 %96, i64* %94
%97 = mul i64 16, %95
%98 = getelementptr inbounds i64, i64* %93, i64 %97
%99 = call i32 @earworm_aesenc_round(i64* %92, i64* %98)
br label %100
100: ; preds = %88
%101 = load i64, i64* %23
%102 = add i64 %101, 1
store i64 %102, i64* %23
br label %85
103: ; preds = %85
br label %104
104: ; preds = %103
%105 = load i64, i64* %22
%106 = add i64 %105, 1
store i64 %106, i64* %22
br label %81
107: ; preds = %81
%108 = getelementptr inbounds [64 x i64], [64 x i64]* %17, i64 0, i64 0
%109 = load i32, i32* %15
%110 = call i64 @to_index(i64* %108, i32 %109)
%111 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 0
store i64 %110, i64* %111
%112 = load i64, i64* %21
%113 = add i64 %112, 1
store i64 %113, i64* %21
%114 = icmp eq i64 %113, 256
br i1 %114, label %115, label %116
115: ; preds = %107
br label %151
116: ; preds = %107
store i64 0, i64* %22
br label %117
117: ; preds = %140, %116
%118 = load i64, i64* %22
%119 = icmp ult i64 %118, 64
br i1 %119, label %120, label %143
120: ; preds = %117
store i64 0, i64* %23
br label %121
121: ; preds = %136, %120
%122 = load i64, i64* %23
%123 = icmp ult i64 %122, 4
br i1 %123, label %124, label %139
124: ; preds = %121
%125 = getelementptr inbounds [64 x i64], [64 x i64]* %17, i64 0, i64 0
%126 = load i64, i64* %23
%127 = mul i64 16, %126
%128 = getelementptr inbounds i64, i64* %125, i64 %127
%129 = load i64*, i64** %16
%130 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 1
%131 = load i64, i64* %130
%132 = add i64 %131, 1
store i64 %132, i64* %130
%133 = mul i64 16, %131
%134 = getelementptr inbounds i64, i64* %129, i64 %133
%135 = call i32 @earworm_aesenc_round(i64* %128, i64* %134)
br label %136
136: ; preds = %124
%137 = load i64, i64* %23
%138 = add i64 %137, 1
store i64 %138, i64* %23
br label %121
139: ; preds = %121
br label %140
140: ; preds = %139
%141 = load i64, i64* %22
%142 = add i64 %141, 1
store i64 %142, i64* %22
br label %117
143: ; preds = %117
%144 = getelementptr inbounds [64 x i64], [64 x i64]* %17, i64 0, i64 0
%145 = load i32, i32* %15
%146 = call i64 @to_index(i64* %144, i32 %145)
%147 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 1
store i64 %146, i64* %147
br label %148
148: ; preds = %143
%149 = load i64, i64* %21
%150 = add i64 %149, 1
store i64 %150, i64* %21
br label %77
151: ; preds = %115, %77
%152 = getelementptr inbounds [37 x i64], [37 x i64]* %18, i64 0, i64 0
store i64 2, i64* %152
%153 = load i64*, i64** %9
%154 = load i64, i64* %10
%155 = getelementptr inbounds [64 x i64], [64 x i64]* %17, i64 0, i64 0
%156 = getelementptr inbounds [37 x i64], [37 x i64]* %18, i64 0, i64 0
%157 = load i64, i64* %14
%158 = add i64 %157, 1
%159 = call i32 @prf(i64* %153, i64 %154, i64* %155, i32 512, i64* %156, i64 %158)
%160 = getelementptr inbounds [64 x i64], [64 x i64]* %17, i64 0, i64 0
%161 = call i32 @secure_wipe(i64* %160, i32 512)
%162 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 0
%163 = call i32 @secure_wipe(i64* %162, i32 16)
ret void
}

LLVM IR (-O2):
@UINT32_MAX = global i64 0
define void @workunit(i64* %0, i64 %1, i64* %2, i64 %3, i64* %4, i64 %5, i32 %6, i64* %7) {
%9 = alloca [64 x i64]
%10 = alloca [37 x i64]
%11 = alloca [32 x i64]
%12 = alloca [2 x i64]
%13 = bitcast [64 x i64]* %9 to i8*
%14 = bitcast [37 x i64]* %10 to i8*
%15 = bitcast [32 x i64]* %11 to i8*
%16 = bitcast [2 x i64]* %12 to i8*
%17 = tail call i64 @validate_fit(i64 256, i32 %6)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = load i64, i64* @UINT32_MAX
%22 = icmp uge i64 %21, %1
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = load i64, i64* @UINT32_MAX
%26 = icmp uge i64 %25, %3
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = icmp ult i64 %5, 37
%30 = zext i1 %29 to i32
%31 = tail call i32 @assert(i32 %30)
%32 = getelementptr inbounds [37 x i64], [37 x i64]* %10, i64 0, i64 0
store i64 0, i64* %32
%33 = getelementptr inbounds [37 x i64], [37 x i64]* %10, i64 0, i64 1
%34 = call i32 @memcpy(i64* %33, i64* %4, i64 %5)
%35 = getelementptr inbounds [32 x i64], [32 x i64]* %11, i64 0, i64 0
%36 = trunc i64 %3 to i32
%37 = add i64 %5, 1
%38 = call i32 @prf(i64* %35, i64 256, i64* %2, i32 %36, i64* %32, i64 %37)
%39 = call i64 @to_index(i64* %35, i32 %6)
%40 = getelementptr inbounds [2 x i64], [2 x i64]* %12, i64 0, i64 0
%41 = getelementptr inbounds [32 x i64], [32 x i64]* %11, i64 0, i64 16
%42 = call i64 @to_index(i64* %41, i32 %6)
%43 = getelementptr inbounds [2 x i64], [2 x i64]* %12, i64 0, i64 1
%44 = call i32 @secure_wipe(i64* %35, i32 256)
store i64 1, i64* %32
%45 = getelementptr inbounds [64 x i64], [64 x i64]* %9, i64 0, i64 0
%46 = call i32 @prf(i64* %45, i64 512, i64* %2, i32 %36, i64* %32, i64 %37)
%47 = getelementptr inbounds [64 x i64], [64 x i64]* %9, i64 0, i64 16
%48 = getelementptr inbounds [64 x i64], [64 x i64]* %9, i64 0, i64 32
%49 = getelementptr inbounds [64 x i64], [64 x i64]* %9, i64 0, i64 48
br label %50
50: ; preds = %8, %98
%51 = phi i64 [ %42, %8 ], [ %99, %98 ]
%52 = phi i64 [ %39, %8 ], [ %76, %98 ]
%53 = phi i64 [ 0, %8 ], [ %100, %98 ]
br label %54
54: ; preds = %50, %54
%55 = phi i64 [ %52, %50 ], [ %68, %54 ]
%56 = phi i64 [ 0, %50 ], [ %73, %54 ]
%57 = shl i64 %55, 4
%58 = getelementptr inbounds i64, i64* %7, i64 %57
%59 = call i32 @earworm_aesenc_round(i64* %45, i64* %58)
%60 = shl i64 %55, 4
%61 = add i64 %60, 16
%62 = getelementptr inbounds i64, i64* %7, i64 %61
%63 = call i32 @earworm_aesenc_round(i64* %47, i64* %62)
%64 = shl i64 %55, 4
%65 = add i64 %64, 32
%66 = getelementptr inbounds i64, i64* %7, i64 %65
%67 = call i32 @earworm_aesenc_round(i64* %48, i64* %66)
%68 = add i64 %55, 4
store i64 %68, i64* %40
%69 = shl i64 %55, 4
%70 = add i64 %69, 48
%71 = getelementptr inbounds i64, i64* %7, i64 %70
%72 = call i32 @earworm_aesenc_round(i64* %49, i64* %71)
%73 = add nuw nsw i64 %56, 1
%74 = icmp eq i64 %73, 64
br i1 %74, label %75, label %54
75: ; preds = %54
%76 = call i64 @to_index(i64* %45, i32 %6)
store i64 %76, i64* %40
br label %77
77: ; preds = %75, %77
%78 = phi i64 [ %51, %75 ], [ %91, %77 ]
%79 = phi i64 [ 0, %75 ], [ %96, %77 ]
%80 = shl i64 %78, 4
%81 = getelementptr inbounds i64, i64* %7, i64 %80
%82 = call i32 @earworm_aesenc_round(i64* %45, i64* %81)
%83 = shl i64 %78, 4
%84 = add i64 %83, 16
%85 = getelementptr inbounds i64, i64* %7, i64 %84
%86 = call i32 @earworm_aesenc_round(i64* %47, i64* %85)
%87 = shl i64 %78, 4
%88 = add i64 %87, 32
%89 = getelementptr inbounds i64, i64* %7, i64 %88
%90 = call i32 @earworm_aesenc_round(i64* %48, i64* %89)
%91 = add i64 %78, 4
store i64 %91, i64* %43
%92 = shl i64 %78, 4
%93 = add i64 %92, 48
%94 = getelementptr inbounds i64, i64* %7, i64 %93
%95 = call i32 @earworm_aesenc_round(i64* %49, i64* %94)
%96 = add nuw nsw i64 %79, 1
%97 = icmp eq i64 %96, 64
br i1 %97, label %98, label %77
98: ; preds = %77
%99 = call i64 @to_index(i64* %45, i32 %6)
store i64 %99, i64* %43
%100 = add nuw nsw i64 %53, 2
%101 = icmp ult i64 %53, 254
br i1 %101, label %50, label %102
102: ; preds = %98
store i64 2, i64* %32
%103 = call i32 @prf(i64* %0, i64 %1, i64* %45, i32 512, i64* %32, i64 %37)
%104 = call i32 @secure_wipe(i64* %45, i32 512)
%105 = call i32 @secure_wipe(i64* %40, i32 16)
ret void
}