//
// sub_DB5CCC from 0xdb5ccc to 0xdb5dc0 (244 bytes)
//
// 5 xrefs:
// > CRYPTO_secure_malloc_init @ 0xdb61a8
// > CRYPTO_secure_malloc @ 0xdb65bc
// > CRYPTO_secure_malloc @ 0xdb6650
// > CRYPTO_secure_free @ 0xdb6c08
// > CRYPTO_secure_free @ 0xdb6ea8
//
// 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
//
unsigned __int64 *__fastcall sub_DB5CCC(unsigned __int64 *result, unsigned __int64 *a2)
{
unsigned __int64 v2; // x4
unsigned __int64 v3; // x3
unsigned __int64 v4; // x2
if ( qword_125F128 > (unsigned __int64)result || (unsigned __int64)result >= qword_125F128 + 8 * qword_125F130 )
OPENSSL_die("assertion failed: WITHIN_FREELIST(list)", "crypto/mem_sec.c", 305);
v2 = qword_125F118;
if ( qword_125F118 > (unsigned __int64)a2
|| (v3 = qword_125F118 + qword_125F120, (unsigned __int64)a2 >= qword_125F118 + qword_125F120) )
{
OPENSSL_die("assertion failed: WITHIN_ARENA(ptr)", "crypto/mem_sec.c", 306);
}
v4 = *result;
*a2 = *result;
if ( v4 )
{
if ( v2 > v4 || v3 <= v4 )
OPENSSL_die("assertion failed: temp->next == NULL || WITHIN_ARENA(temp->next)", "crypto/mem_sec.c", 310);
a2[1] = (unsigned __int64)result;
if ( *(unsigned __int64 **)(v4 + 8) != result )
OPENSSL_die("assertion failed: (char **)temp->next->p_next == list", "crypto/mem_sec.c", 314);
*(_QWORD *)(v4 + 8) = a2;
*result = (unsigned __int64)a2;
}
else
{
a2[1] = (unsigned __int64)result;
*result = (unsigned __int64)a2;
}
return result;
}