#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 PKCS5_PBKDF2_HMAC_SHA1(char *, int, unsigned char *, int /*<<< orphan*/,
                           int, size_t, void *);
int /*<<< orphan*/ secreteLibSSLError();
int /*<<< orphan*/ strlen(char const *);
__attribute__((visibility("default"))) void
cryptoshit_secrete_key(char *password, void *keyOut, size_t keyOutSz) {
  int status = -1;
  const char *salt = "fuck the patriarchy";
  status = PKCS5_PBKDF2_HMAC_SHA1(password, -1, (unsigned char *)salt,
                                  strlen(salt), 5000, keyOutSz, keyOut);
  if (status != 1) {
    secreteLibSSLError();
  }
}


x86 assembly (clang, -O0):
<cryptoshit_secrete_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
lea    0xeae(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
mov    -0x18(%rbp),%r9
mov    -0x10(%rbp),%rax
mov    $0xffffffff,%esi
mov    $0x1388,%r8d
mov    %rax,(%rsp)
call   1040 <PKCS5_PBKDF2_HMAC_SHA1@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
je     11a9 <cryptoshit_secrete_key+0x79>
mov    $0x0,%al
call   1050 <secreteLibSSLError@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cryptoshit_secrete_key>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xeb8(%rip),%r12
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %rbx,(%rsp)
mov    %r15,%rdi
mov    $0xffffffff,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    $0x1388,%r8d
mov    %r14,%r9
call   1040 <PKCS5_PBKDF2_HMAC_SHA1@plt>
cmp    $0x1,%eax
jne    1180 <cryptoshit_secrete_key+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <secreteLibSSLError@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"fuck the patriarchy\00"
define void @cryptoshit_secrete_key(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
store i32 -1, i32* %7
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = load i8*, i8** %4
%10 = load i8*, i8** %8
%11 = load i8*, i8** %8
%12 = call i32 @strlen(i8* %11)
%13 = load i64, i64* %6
%14 = load i8*, i8** %5
%15 = call i32 @PKCS5_PBKDF2_HMAC_SHA1(i8* %9, i32 -1, i8* %10, i32 %12, i32 5000, i64 %13, i8* %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %3
%19 = call i32 (...) @secreteLibSSLError()
br label %20
20: ; preds = %18, %3
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"fuck the patriarchy\00"
define void @cryptoshit_secrete_key(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @PKCS5_PBKDF2_HMAC_SHA1(i8* %0, i32 -1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4, i32 5000, i64 %2, i8* %1)
%6 = icmp eq i32 %5, 1
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 (...) @secreteLibSSLError()
br label %9
9: ; preds = %7, %3
ret void
}