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

/* Variables and functions */
size_t UINT32_MAX;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ earworm_PBKDF2_SHA256(int /*<<< orphan*/ const *, size_t,
                                         int /*<<< orphan*/ const *, size_t,
                                         int, int /*<<< orphan*/ *, size_t);
void prf(uint8_t *out, size_t outlen, const uint8_t *secret, size_t secretlen,
         const uint8_t *salt, size_t saltlen) {
  assert((outlen >> 5) <= UINT32_MAX);
  earworm_PBKDF2_SHA256(secret, secretlen, salt, saltlen, 1, out, outlen);
}


x86 assembly (clang, -O0):
<prf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
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),%rax
shr    $0x5,%rax
mov    0x2ea9(%rip),%rcx
cmp    (%rcx),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x8(%rbp),%r9
mov    -0x10(%rbp),%rax
mov    $0x1,%r8d
mov    %rax,(%rsp)
call   1040 <earworm_PBKDF2_SHA256@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsi,%rax
shr    $0x5,%rax
mov    0x2ead(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
setbe  %dil
call   1030 <assert@plt>
mov    %rbx,(%rsp)
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    $0x1,%r8d
mov    %rbp,%r9
call   1040 <earworm_PBKDF2_SHA256@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UINT32_MAX = global i64 0
define void @prf(i32* %0, i64 %1, i32* %2, i64 %3, i32* %4, i64 %5) {
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i64
store i32* %0, i32** %7
store i64 %1, i64* %8
store i32* %2, i32** %9
store i64 %3, i64* %10
store i32* %4, i32** %11
store i64 %5, i64* %12
%13 = load i64, i64* %8
%14 = lshr i64 %13, 5
%15 = load i64, i64* @UINT32_MAX
%16 = icmp ule i64 %14, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32*, i32** %9
%20 = load i64, i64* %10
%21 = load i32*, i32** %11
%22 = load i64, i64* %12
%23 = load i32*, i32** %7
%24 = load i64, i64* %8
%25 = call i32 @earworm_PBKDF2_SHA256(i32* %19, i64 %20, i32* %21, i64 %22, i32 1, i32* %23, i64 %24)
ret void
}

LLVM IR (-O2):
@UINT32_MAX = global i64 0
define void @prf(i32* %0, i64 %1, i32* %2, i64 %3, i32* %4, i64 %5) {
%7 = lshr i64 %1, 5
%8 = load i64, i64* @UINT32_MAX
%9 = icmp ule i64 %7, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i32 @earworm_PBKDF2_SHA256(i32* %2, i64 %3, i32* %4, i64 %5, i32 1, i32* %0, i64 %1)
ret void
}