#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*/ out;
typedef int /*<<< orphan*/ expected;
typedef int /*<<< orphan*/ EVP_PKEY_CTX;

/* Variables and functions */
int /*<<< orphan*/ EVP_PKEY_CTX_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *EVP_PKEY_CTX_new_id(int /*<<< orphan*/,
                                        int /*<<< orphan*/ *);
scalar_t__ EVP_PKEY_CTX_set1_pbe_pass(int /*<<< orphan*/ *, char *, int);
scalar_t__ EVP_PKEY_CTX_set1_scrypt_salt(int /*<<< orphan*/ *, char *, int);
scalar_t__ EVP_PKEY_CTX_set_scrypt_N(int /*<<< orphan*/ *, int);
scalar_t__ EVP_PKEY_CTX_set_scrypt_maxmem_bytes(int /*<<< orphan*/ *, int);
scalar_t__ EVP_PKEY_CTX_set_scrypt_p(int /*<<< orphan*/ *, int);
scalar_t__ EVP_PKEY_CTX_set_scrypt_r(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ EVP_PKEY_SCRYPT;
scalar_t__ EVP_PKEY_derive(int /*<<< orphan*/ *, unsigned char *, size_t *);
scalar_t__ EVP_PKEY_derive_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ test_error(char *, int, char *);
int /*<<< orphan*/ test_mem_eq(char *, int, char *, char *, unsigned char *,
                               int, unsigned char const *, int);
int test_kdf_scrypt(void) {
  EVP_PKEY_CTX *pctx;
  unsigned char out[64];
  size_t outlen = sizeof(out);
  pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_SCRYPT, NULL);
  if (EVP_PKEY_derive_init(pctx) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               113, "EVP_PKEY_derive_init");
    return 0;
  }
  if (EVP_PKEY_CTX_set1_pbe_pass(pctx, "password", 8) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               117, "EVP_PKEY_CTX_set1_pbe_pass");
    return 0;
  }
  if (EVP_PKEY_CTX_set1_scrypt_salt(pctx, "NaCl", 4) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               121, "EVP_PKEY_CTX_set1_scrypt_salt");
    return 0;
  }
  if (EVP_PKEY_CTX_set_scrypt_N(pctx, 1024) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               125, "EVP_PKEY_CTX_set_scrypt_N");
    return 0;
  }
  if (EVP_PKEY_CTX_set_scrypt_r(pctx, 8) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               129, "EVP_PKEY_CTX_set_scrypt_r");
    return 0;
  }
  if (EVP_PKEY_CTX_set_scrypt_p(pctx, 16) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               133, "EVP_PKEY_CTX_set_scrypt_p");
    return 0;
  }
  if (EVP_PKEY_CTX_set_scrypt_maxmem_bytes(pctx, 16) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               137, "EVP_PKEY_CTX_set_maxmem_bytes");
    return 0;
  }
  if (EVP_PKEY_derive(pctx, out, &outlen) > 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               141, "EVP_PKEY_derive should have failed");
    return 0;
  }
  if (EVP_PKEY_CTX_set_scrypt_maxmem_bytes(pctx, 10 * 1024 * 1024) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               145, "EVP_PKEY_CTX_set_maxmem_bytes");
    return 0;
  }
  if (EVP_PKEY_derive(pctx, out, &outlen) <= 0) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/"
               "heads/master/humble-video-captive/src/main/gnu/openssl/csrc/"
               "test/pkey_meth_kdf_test.c",
               149, "EVP_PKEY_derive");
    return 0;
  }
  {
    const unsigned char expected[sizeof(out)] = {
        0xfd, 0xba, 0xbe, 0x1c, 0x9d, 0x34, 0x72, 0x00, 0x78, 0x56, 0xe7,
        0x19, 0x0d, 0x01, 0xe9, 0xfe, 0x7c, 0x6a, 0xd7, 0xcb, 0xc8, 0x23,
        0x78, 0x30, 0xe7, 0x73, 0x76, 0x63, 0x4b, 0x37, 0x31, 0x62, 0x2e,
        0xaf, 0x30, 0xd9, 0x2e, 0x22, 0xa3, 0x88, 0x6f, 0xf1, 0x09, 0x27,
        0x9d, 0x98, 0x30, 0xda, 0xc7, 0x27, 0xaf, 0xb9, 0x4a, 0x83, 0xee,
        0x6d, 0x83, 0x60, 0xcb, 0xdf, 0xa2, 0xcc, 0x06, 0x40};
    if (!test_mem_eq("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/"
                     "refs/heads/master/humble-video-captive/src/main/gnu/"
                     "openssl/csrc/test/pkey_meth_kdf_test.c",
                     164, "out", "expected", out, sizeof(out), expected,
                     sizeof(expected))) {
      return 0;
    }
  }
  EVP_PKEY_CTX_free(pctx);
  return 1;
}


x86 assembly (clang, -O0):
<test_kdf_scrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movq   $0x40,-0x58(%rbp)
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <EVP_PKEY_CTX_new_id@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <EVP_PKEY_derive_init@plt>
cmp    $0x0,%rax
jg     1230 <test_kdf_scrypt+0x60>
lea    0xded(%rip),%rdi
mov    $0x71,%esi
lea    0xead(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x8,%edx
call   10c0 <EVP_PKEY_CTX_set1_pbe_pass@plt>
cmp    $0x0,%rax
jg     1273 <test_kdf_scrypt+0xa3>
lea    0xdaa(%rip),%rdi
mov    $0x75,%esi
lea    0xe88(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
lea    0xe87(%rip),%rsi
mov    $0x4,%edx
call   1040 <EVP_PKEY_CTX_set1_scrypt_salt@plt>
cmp    $0x0,%rax
jg     12b6 <test_kdf_scrypt+0xe6>
lea    0xd67(%rip),%rdi
mov    $0x79,%esi
lea    0xe65(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
mov    $0x400,%esi
call   1030 <EVP_PKEY_CTX_set_scrypt_N@plt>
cmp    $0x0,%rax
jg     12f2 <test_kdf_scrypt+0x122>
lea    0xd2b(%rip),%rdi
mov    $0x7d,%esi
lea    0xe47(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
mov    $0x8,%esi
call   1060 <EVP_PKEY_CTX_set_scrypt_r@plt>
cmp    $0x0,%rax
jg     132e <test_kdf_scrypt+0x15e>
lea    0xcef(%rip),%rdi
mov    $0x81,%esi
lea    0xe25(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
mov    $0x10,%esi
call   1050 <EVP_PKEY_CTX_set_scrypt_p@plt>
cmp    $0x0,%rax
jg     136a <test_kdf_scrypt+0x19a>
lea    0xcb3(%rip),%rdi
mov    $0x85,%esi
lea    0xe03(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
mov    $0x10,%esi
call   10a0 <EVP_PKEY_CTX_set_scrypt_maxmem_bytes@plt>
cmp    $0x0,%rax
jg     13a6 <test_kdf_scrypt+0x1d6>
lea    0xc77(%rip),%rdi
mov    $0x89,%esi
lea    0xde1(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   10b0 <EVP_PKEY_derive@plt>
cmp    $0x0,%rax
jle    13e5 <test_kdf_scrypt+0x215>
lea    0xc38(%rip),%rdi
mov    $0x8d,%esi
lea    0xdc0(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
mov    $0xa00000,%esi
call   10a0 <EVP_PKEY_CTX_set_scrypt_maxmem_bytes@plt>
cmp    $0x0,%rax
jg     1421 <test_kdf_scrypt+0x251>
lea    0xbfc(%rip),%rdi
mov    $0x91,%esi
lea    0xd66(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   10b0 <EVP_PKEY_derive@plt>
cmp    $0x0,%rax
jg     1460 <test_kdf_scrypt+0x290>
lea    0xbbd(%rip),%rdi
mov    $0x95,%esi
lea    0xd68(%rip),%rdx
call   10e0 <test_error@plt>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
lea    -0xa0(%rbp),%rdi
lea    0xd72(%rip),%rsi
mov    $0x40,%edx
call   1080 <memcpy@plt>
lea    -0x50(%rbp),%r8
lea    -0xa0(%rbp),%rax
lea    0xb76(%rip),%rdi
mov    $0xa4,%esi
lea    0xd31(%rip),%rdx
lea    0xd2e(%rip),%rcx
mov    $0x40,%r9d
mov    %rax,(%rsp)
movl   $0x40,0x8(%rsp)
call   10d0 <test_mem_eq@plt>
cmp    $0x0,%eax
jne    14c9 <test_kdf_scrypt+0x2f9>
movl   $0x0,-0x4(%rbp)
jmp    14d9 <test_kdf_scrypt+0x309>
mov    -0x10(%rbp),%rdi
call   10f0 <EVP_PKEY_CTX_free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_kdf_scrypt>:
push   %r14
push   %rbx
sub    $0x98,%rsp
movq   $0x40,0x8(%rsp)
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
xor    %ebx,%ebx
xor    %esi,%esi
call   1080 <EVP_PKEY_CTX_new_id@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <EVP_PKEY_derive_init@plt>
test   %rax,%rax
jle    12be <test_kdf_scrypt+0xfe>
lea    0xee1(%rip),%rsi
mov    %r14,%rdi
mov    $0x8,%edx
call   10b0 <EVP_PKEY_CTX_set1_pbe_pass@plt>
test   %rax,%rax
jle    12db <test_kdf_scrypt+0x11b>
lea    0xee8(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1040 <EVP_PKEY_CTX_set1_scrypt_salt@plt>
test   %rax,%rax
jle    12f0 <test_kdf_scrypt+0x130>
mov    %r14,%rdi
mov    $0x400,%esi
call   1030 <EVP_PKEY_CTX_set_scrypt_N@plt>
test   %rax,%rax
jle    1305 <test_kdf_scrypt+0x145>
mov    %r14,%rdi
mov    $0x8,%esi
call   1060 <EVP_PKEY_CTX_set_scrypt_r@plt>
test   %rax,%rax
jle    131a <test_kdf_scrypt+0x15a>
mov    %r14,%rdi
mov    $0x10,%esi
call   1050 <EVP_PKEY_CTX_set_scrypt_p@plt>
test   %rax,%rax
jle    132f <test_kdf_scrypt+0x16f>
mov    %r14,%rdi
mov    $0x10,%esi
call   1090 <EVP_PKEY_CTX_set_scrypt_maxmem_bytes@plt>
test   %rax,%rax
jle    1344 <test_kdf_scrypt+0x184>
lea    0x50(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
call   10a0 <EVP_PKEY_derive@plt>
test   %rax,%rax
jle    136b <test_kdf_scrypt+0x1ab>
lea    0xd53(%rip),%rdi
lea    0xee0(%rip),%rdx
mov    $0x8d,%esi
jmp    1357 <test_kdf_scrypt+0x197>
lea    0xd3b(%rip),%rdi
lea    0xe00(%rip),%rdx
mov    $0x71,%esi
call   10d0 <test_error@plt>
jmp    135e <test_kdf_scrypt+0x19e>
lea    0xd1e(%rip),%rdi
lea    0xe01(%rip),%rdx
mov    $0x75,%esi
jmp    1357 <test_kdf_scrypt+0x197>
lea    0xd09(%rip),%rdi
lea    0xe0c(%rip),%rdx
mov    $0x79,%esi
jmp    1357 <test_kdf_scrypt+0x197>
lea    0xcf4(%rip),%rdi
lea    0xe15(%rip),%rdx
mov    $0x7d,%esi
jmp    1357 <test_kdf_scrypt+0x197>
lea    0xcdf(%rip),%rdi
lea    0xe1a(%rip),%rdx
mov    $0x81,%esi
jmp    1357 <test_kdf_scrypt+0x197>
lea    0xcca(%rip),%rdi
lea    0xe1f(%rip),%rdx
mov    $0x85,%esi
jmp    1357 <test_kdf_scrypt+0x197>
lea    0xcb5(%rip),%rdi
lea    0xe24(%rip),%rdx
mov    $0x89,%esi
call   10d0 <test_error@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
mov    $0xa00000,%esi
call   1090 <EVP_PKEY_CTX_set_scrypt_maxmem_bytes@plt>
test   %rax,%rax
jle    141c <test_kdf_scrypt+0x25c>
lea    0x50(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
call   10a0 <EVP_PKEY_derive@plt>
test   %rax,%rax
jle    1434 <test_kdf_scrypt+0x274>
movaps 0xe6d(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe51(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe35(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe19(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rax
lea    0xc28(%rip),%rdi
lea    0xde8(%rip),%rdx
lea    0xde5(%rip),%rcx
lea    0x50(%rsp),%r8
mov    $0xa4,%esi
mov    $0x40,%r9d
push   $0x40
push   %rax
call   10c0 <test_mem_eq@plt>
add    $0x10,%rsp
test   %eax,%eax
je     135c <test_kdf_scrypt+0x19c>
mov    %r14,%rdi
call   10e0 <EVP_PKEY_CTX_free@plt>
mov    $0x1,%ebx
jmp    135e <test_kdf_scrypt+0x19e>
lea    0xbdd(%rip),%rdi
lea    0xd4c(%rip),%rdx
mov    $0x91,%esi
jmp    1357 <test_kdf_scrypt+0x197>
lea    0xbc5(%rip),%rdi
lea    0xd75(%rip),%rdx
mov    $0x95,%esi
jmp    1357 <test_kdf_scrypt+0x197>

LLVM IR (-O0):
@EVP_PKEY_SCRYPT = global i32 0
@.str = [204 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/pkey_meth_kdf_test.c\00"
@.str.1 = [21 x i8] c"EVP_PKEY_derive_init\00"
@.str.2 = [9 x i8] c"password\00"
@.str.3 = [27 x i8] c"EVP_PKEY_CTX_set1_pbe_pass\00"
@.str.4 = [5 x i8] c"NaCl\00"
@.str.5 = [30 x i8] c"EVP_PKEY_CTX_set1_scrypt_salt\00"
@.str.6 = [26 x i8] c"EVP_PKEY_CTX_set_scrypt_N\00"
@.str.7 = [26 x i8] c"EVP_PKEY_CTX_set_scrypt_r\00"
@.str.8 = [26 x i8] c"EVP_PKEY_CTX_set_scrypt_p\00"
@.str.9 = [30 x i8] c"EVP_PKEY_CTX_set_maxmem_bytes\00"
@.str.10 = [35 x i8] c"EVP_PKEY_derive should have failed\00"
@.str.11 = [16 x i8] c"EVP_PKEY_derive\00"
@__const.test_kdf_scrypt.expected = [64 x i8] c"\FD\BA\BE\1C\9D4r\00xV\E7\19\0D\01\E9\FE|j\D7\CB\C8#x0\E7svcK71b.\AF0\D9.\22\A3\88o\F1\09'\9D\980\DA\C7'\AF\B9J\83\EEm\83`\CB\DF\A2\CC\06@"
@.str.12 = [4 x i8] c"out\00"
@.str.13 = [9 x i8] c"expected\00"
define i32 @test_kdf_scrypt() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [64 x i8]
%4 = alloca i64
%5 = alloca [64 x i8]
store i64 64, i64* %4
%6 = load i32, i32* @EVP_PKEY_SCRYPT
%7 = call i32* @EVP_PKEY_CTX_new_id(i32 %6, i32* null)
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = call i64 @EVP_PKEY_derive_init(i32* %8)
%10 = icmp sle i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 113, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %79
13: ; preds = %0
%14 = load i32*, i32** %2
%15 = call i64 @EVP_PKEY_CTX_set1_pbe_pass(i32* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%16 = icmp sle i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 117, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %79
19: ; preds = %13
%20 = load i32*, i32** %2
%21 = call i64 @EVP_PKEY_CTX_set1_scrypt_salt(i32* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%22 = icmp sle i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 121, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %79
25: ; preds = %19
%26 = load i32*, i32** %2
%27 = call i64 @EVP_PKEY_CTX_set_scrypt_N(i32* %26, i32 1024)
%28 = icmp sle i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 125, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %1
br label %79
31: ; preds = %25
%32 = load i32*, i32** %2
%33 = call i64 @EVP_PKEY_CTX_set_scrypt_r(i32* %32, i32 8)
%34 = icmp sle i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 129, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %79
37: ; preds = %31
%38 = load i32*, i32** %2
%39 = call i64 @EVP_PKEY_CTX_set_scrypt_p(i32* %38, i32 16)
%40 = icmp sle i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 133, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %79
43: ; preds = %37
%44 = load i32*, i32** %2
%45 = call i64 @EVP_PKEY_CTX_set_scrypt_maxmem_bytes(i32* %44, i32 16)
%46 = icmp sle i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 137, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %1
br label %79
49: ; preds = %43
%50 = load i32*, i32** %2
%51 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%52 = call i64 @EVP_PKEY_derive(i32* %50, i8* %51, i64* %4)
%53 = icmp sgt i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 141, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %79
56: ; preds = %49
%57 = load i32*, i32** %2
%58 = call i64 @EVP_PKEY_CTX_set_scrypt_maxmem_bytes(i32* %57, i32 10485760)
%59 = icmp sle i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 145, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %1
br label %79
62: ; preds = %56
%63 = load i32*, i32** %2
%64 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%65 = call i64 @EVP_PKEY_derive(i32* %63, i8* %64, i64* %4)
%66 = icmp sle i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 149, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %1
br label %79
69: ; preds = %62
%70 = bitcast [64 x i8]* %5 to i8*
%71 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%72 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%73 = call i32 @test_mem_eq(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 164, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i8* %71, i32 64, i8* %72, i32 64)
%74 = icmp ne i32 %73, 0
br i1 %74, label %76, label %75
75: ; preds = %69
store i32 0, i32* %1
br label %79
76: ; preds = %69
%77 = load i32*, i32** %2
%78 = call i32 @EVP_PKEY_CTX_free(i32* %77)
store i32 1, i32* %1
br label %79
79: ; preds = %76, %75, %67, %60, %54, %47, %41, %35, %29, %23, %17, %11
%80 = load i32, i32* %1
ret i32 %80
}

LLVM IR (-O2):
@EVP_PKEY_SCRYPT = global i32 0
@.str = [204 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/pkey_meth_kdf_test.c\00"
@.str.1 = [21 x i8] c"EVP_PKEY_derive_init\00"
@.str.2 = [9 x i8] c"password\00"
@.str.3 = [27 x i8] c"EVP_PKEY_CTX_set1_pbe_pass\00"
@.str.4 = [5 x i8] c"NaCl\00"
@.str.5 = [30 x i8] c"EVP_PKEY_CTX_set1_scrypt_salt\00"
@.str.6 = [26 x i8] c"EVP_PKEY_CTX_set_scrypt_N\00"
@.str.7 = [26 x i8] c"EVP_PKEY_CTX_set_scrypt_r\00"
@.str.8 = [26 x i8] c"EVP_PKEY_CTX_set_scrypt_p\00"
@.str.9 = [30 x i8] c"EVP_PKEY_CTX_set_maxmem_bytes\00"
@.str.10 = [35 x i8] c"EVP_PKEY_derive should have failed\00"
@.str.11 = [16 x i8] c"EVP_PKEY_derive\00"
@__const.test_kdf_scrypt.expected = [64 x i8] c"\FD\BA\BE\1C\9D4r\00xV\E7\19\0D\01\E9\FE|j\D7\CB\C8#x0\E7svcK71b.\AF0\D9.\22\A3\88o\F1\09'\9D\980\DA\C7'\AF\B9J\83\EEm\83`\CB\DF\A2\CC\06@"
@.str.12 = [4 x i8] c"out\00"
@.str.13 = [9 x i8] c"expected\00"
define i32 @test_kdf_scrypt() {
%1 = alloca [64 x i8]
%2 = alloca i64
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%5 = bitcast i64* %2 to i8*
store i64 64, i64* %2
%6 = load i32, i32* @EVP_PKEY_SCRYPT
%7 = tail call i32* @EVP_PKEY_CTX_new_id(i32 %6, i32* null)
%8 = tail call i64 @EVP_PKEY_derive_init(i32* %7)
%9 = icmp slt i64 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = tail call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 113, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %63
12: ; preds = %0
%13 = tail call i64 @EVP_PKEY_CTX_set1_pbe_pass(i32* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 8)
%14 = icmp slt i64 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 117, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %63
17: ; preds = %12
%18 = tail call i64 @EVP_PKEY_CTX_set1_scrypt_salt(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%19 = icmp slt i64 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 121, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %63
22: ; preds = %17
%23 = tail call i64 @EVP_PKEY_CTX_set_scrypt_N(i32* %7, i32 1024)
%24 = icmp slt i64 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 125, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %63
27: ; preds = %22
%28 = tail call i64 @EVP_PKEY_CTX_set_scrypt_r(i32* %7, i32 8)
%29 = icmp slt i64 %28, 1
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = tail call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 129, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
br label %63
32: ; preds = %27
%33 = tail call i64 @EVP_PKEY_CTX_set_scrypt_p(i32* %7, i32 16)
%34 = icmp slt i64 %33, 1
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = tail call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 133, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %63
37: ; preds = %32
%38 = tail call i64 @EVP_PKEY_CTX_set_scrypt_maxmem_bytes(i32* %7, i32 16)
%39 = icmp slt i64 %38, 1
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = tail call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 137, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %63
42: ; preds = %37
%43 = call i64 @EVP_PKEY_derive(i32* %7, i8* %4, i64* %2)
%44 = icmp sgt i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 141, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
br label %63
47: ; preds = %42
%48 = call i64 @EVP_PKEY_CTX_set_scrypt_maxmem_bytes(i32* %7, i32 10485760)
%49 = icmp slt i64 %48, 1
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 145, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %63
52: ; preds = %47
%53 = call i64 @EVP_PKEY_derive(i32* %7, i8* %4, i64* %2)
%54 = icmp slt i64 %53, 1
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @test_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 149, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %63
57: ; preds = %52
%58 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%59 = call i32 @test_mem_eq(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i32 164, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i8* %4, i32 64, i8* %58, i32 64)
%60 = icmp eq i32 %59, 0
br i1 %60, label %63, label %61
61: ; preds = %57
%62 = call i32 @EVP_PKEY_CTX_free(i32* %7)
br label %63
63: ; preds = %57, %61, %55, %50, %45, %40, %35, %30, %25, %20, %15, %10
%64 = phi i32 [ 0, %10 ], [ 0, %15 ], [ 0, %20 ], [ 0, %25 ], [ 0, %30 ], [ 0, %35 ], [ 0, %40 ], [ 0, %45 ], [ 0, %50 ], [ 0, %55 ], [ 1, %61 ], [ 0, %57 ]
ret i32 %64
}