//
// sub_DB5DC0 from 0xdb5dc0 to 0xdb5ea8 (232 bytes)
//
// 4 xrefs:
// > CRYPTO_secure_malloc @ 0xdb6738
// > CRYPTO_secure_free @ 0xdb6bf4
// > CRYPTO_secure_free @ 0xdb6cd4
// > CRYPTO_secure_free @ 0xdb6db0
//
// 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_DB5DC0(__int64 a1, int a2, __int64 a3)
{
unsigned __int64 v3; // x0
unsigned __int64 v4; // x1
unsigned __int64 v5; // x3
char v6; // w1
unsigned __int8 v7; // w5
unsigned __int64 result; // x0
if ( a2 < 0 || qword_125F130 <= a2 )
OPENSSL_die("assertion failed: list >= 0 && list < sh.freelist_size", "crypto/mem_sec.c", 281);
v3 = a1 - qword_125F118;
if ( ((((unsigned __int64)qword_125F120 >> a2) - 1) & v3) != 0 )
OPENSSL_die("assertion failed: ((ptr - sh.arena) & ((sh.arena_size >> list) - 1)) == 0", "crypto/mem_sec.c", 282);
v4 = v3 / ((unsigned __int64)qword_125F120 >> a2) + (1LL << a2);
if ( !v4 || v4 >= qword_125F150 )
OPENSSL_die("assertion failed: bit > 0 && bit < sh.bittable_size", "crypto/mem_sec.c", 284);
v5 = v4 >> 3;
v6 = v4 & 7;
v7 = *(_BYTE *)(a3 + v5);
result = (unsigned __int64)v7 >> v6;
if ( (result & 1) == 0 )
OPENSSL_die("assertion failed: TESTBIT(table, bit)", "crypto/mem_sec.c", 285);
*(_BYTE *)(a3 + v5) = v7 & ~(unsigned __int8)(1LL << v6);
return result;
}