//
// CRYPTO_secure_actual_size from 0x1035404 to 0x1035598 (404 bytes)
//
// 1 xrefs:
// > ??> @ 0x4e838
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:16:23 +0000
//
unsigned __int64 __fastcall CRYPTO_secure_actual_size(unsigned __int64 a1)
{
unsigned __int64 v2; // x1
int v3; // w4
__int64 v4; // x5
unsigned __int64 v5; // x19
unsigned __int64 v6; // x20
unsigned __int64 v7; // x20
CRYPTO_THREAD_write_lock(qword_1567F60);
if ( a1 < qword_1567F18 || a1 >= qword_1567F18 + qword_1567F20 )
OPENSSL_die("assertion failed: WITHIN_ARENA(ptr)", "crypto/mem_sec.c", 574);
v2 = (a1 + qword_1567F20 - qword_1567F18) / qword_1567F38;
v3 = qword_1567F30 - 1;
if ( v2 )
{
v4 = qword_1567F40;
if ( ((*(unsigned __int8 *)(qword_1567F40 + (v2 >> 3)) >> (v2 & 7)) & 1) == 0 )
{
do
{
if ( (v2 & 1) != 0 )
OPENSSL_die("assertion failed: (bit & 1) == 0", "crypto/mem_sec.c", 259);
v2 >>= 1;
--v3;
}
while ( v2 && ((*(unsigned __int8 *)(qword_1567F40 + (v2 >> 3)) >> (v2 & 7)) & 1) == 0 );
}
}
else
{
v4 = qword_1567F40;
}
if ( v3 < 0 || qword_1567F30 <= v3 )
OPENSSL_die("assertion failed: list >= 0 && list < sh.freelist_size", "crypto/mem_sec.c", 270);
v5 = (unsigned __int64)qword_1567F20 >> v3;
v6 = a1 - qword_1567F18;
if ( ((((unsigned __int64)qword_1567F20 >> v3) - 1) & v6) != 0 )
sub_632B7C();
v7 = v6 / v5 + (1LL << v3);
if ( !v7 || v7 >= qword_1567F50 )
OPENSSL_die("assertion failed: bit > 0 && bit < sh.bittable_size", "crypto/mem_sec.c", 273);
if ( (*(unsigned __int8 *)(v4 + (v7 >> 3)) & (unsigned int)(1LL << (v7 & 7))) == 0 )
OPENSSL_die("assertion failed: sh_testbit(ptr, list, sh.bittable)", "crypto/mem_sec.c", 578);
CRYPTO_THREAD_unlock(qword_1567F60);
return v5;
}