//
// CONF_modules_unload from 0xd8240c to 0xd82528 (284 bytes)
//
// 2 xrefs:
// > conf_modules_free_int @ 0xd82640
// > ??> @ 0x87510
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall CONF_modules_unload(int a1)
{
unsigned int v2; // w19
_QWORD *v3; // x21
__int64 v4; // x1
__int64 result; // x0
__int64 v6; // x21
CONF_modules_finish();
v2 = OPENSSL_sk_num(qword_125D588) - 1;
if ( (v2 & 0x80000000) == 0 )
{
if ( a1 )
{
do
{
v3 = (_QWORD *)OPENSSL_sk_value(qword_125D588, v2);
v4 = v2--;
OPENSSL_sk_delete(qword_125D588, v4);
DSO_free(*v3);
CRYPTO_free(v3[1], "crypto/conf/conf_mod.c", 379);
CRYPTO_free(v3, "crypto/conf/conf_mod.c", 380);
}
while ( v2 != -1 );
}
else
{
do
{
v6 = OPENSSL_sk_value(qword_125D588, v2);
if ( *(int *)(v6 + 32) <= 0 && *(_QWORD *)v6 )
{
OPENSSL_sk_delete(qword_125D588, v2);
DSO_free(*(_QWORD *)v6);
CRYPTO_free(*(_QWORD *)(v6 + 8), "crypto/conf/conf_mod.c", 379);
CRYPTO_free(v6, "crypto/conf/conf_mod.c", 380);
}
--v2;
}
while ( v2 != -1 );
}
}
result = OPENSSL_sk_num(qword_125D588);
if ( !(_DWORD)result )
{
result = OPENSSL_sk_free(qword_125D588);
qword_125D588 = 0;
}
return result;
}