//
// sub_1033F44 from 0x1033f44 to 0x103402c (232 bytes)
//
// 5 xrefs:
// > CRYPTO_secure_malloc_init @ 0x10344fc
// > CRYPTO_secure_malloc @ 0x103490c
// > CRYPTO_secure_malloc @ 0x10349a0
// > CRYPTO_secure_malloc @ 0x1034b74
// > CRYPTO_secure_free @ 0x10351f8
//
// 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 sub_1033F44(__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_1567F30 <= a2 )
OPENSSL_die("assertion failed: list >= 0 && list < sh.freelist_size", "crypto/mem_sec.c", 293);
v3 = a1 - qword_1567F18;
if ( ((((unsigned __int64)qword_1567F20 >> a2) - 1) & v3) != 0 )
OPENSSL_die("assertion failed: ((ptr - sh.arena) & ((sh.arena_size >> list) - 1)) == 0", "crypto/mem_sec.c", 294);
v4 = v3 / ((unsigned __int64)qword_1567F20 >> a2) + (1LL << a2);
if ( !v4 || v4 >= qword_1567F50 )
OPENSSL_die("assertion failed: bit > 0 && bit < sh.bittable_size", "crypto/mem_sec.c", 296);
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", 297);
*(_BYTE *)(a3 + v5) = v7 | (1LL << v6);
return result;
}