//
// sub_A235E8 from 0xa235e8 to 0xa236c0 (216 bytes)
//
// 4 xrefs:
// > CRYPTO_secure_malloc @ 0xa240d4
// > CRYPTO_secure_free @ 0xa245f8
// > CRYPTO_secure_free @ 0xa24748
// > CRYPTO_secure_free @ 0xa2482c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:57 +0000
//
unsigned int __fastcall sub_A235E8(int a1, int a2, int a3)
{
char v3; // r4
unsigned int v4; // r1
unsigned int v5; // r0
unsigned int result; // r0
unsigned int v7; // r3
v3 = a2;
if ( a2 < 0 || a2 >= dword_D35768 )
OPENSSL_die("assertion failed: list >= 0 && list < sh.freelist_size", "crypto/mem_sec.c", 281);
v4 = (unsigned int)dword_D35760 >> a2;
v5 = a1 - dword_D3575C;
if ( ((v4 - 1) & v5) != 0 )
OPENSSL_die("assertion failed: ((ptr - sh.arena) & ((sh.arena_size >> list) - 1)) == 0", "crypto/mem_sec.c", 282);
result = v5 / v4 + (1 << v3);
if ( !result || result >= dword_D35778 )
OPENSSL_die("assertion failed: bit > 0 && bit < sh.bittable_size", "crypto/mem_sec.c", 284);
v7 = *(unsigned __int8 *)(a3 + (result >> 3));
if ( ((v7 >> (result & 7)) & 1) == 0 )
OPENSSL_die("assertion failed: TESTBIT(table, bit)", "crypto/mem_sec.c", 285);
*(_BYTE *)(a3 + (result >> 3)) = v7 & ~(1 << (result & 7));
return result;
}