//
// sub_103402C from 0x103402c to 0x1034120 (244 bytes)
//
// 5 xrefs:
// > CRYPTO_secure_malloc_init @ 0x1034508
// > CRYPTO_secure_malloc @ 0x103491c
// > CRYPTO_secure_malloc @ 0x10349b0
// > CRYPTO_secure_free @ 0x1034f68
// > CRYPTO_secure_free @ 0x1035208
//
// 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_103402C(unsigned __int64 *result, unsigned __int64 *a2)
{
unsigned __int64 v2; // x4
unsigned __int64 v3; // x3
unsigned __int64 v4; // x2
if ( qword_1567F28 > (unsigned __int64)result || (unsigned __int64)result >= qword_1567F28 + 8 * qword_1567F30 )
OPENSSL_die("assertion failed: WITHIN_FREELIST(list)", "crypto/mem_sec.c", 305);
v2 = qword_1567F18;
if ( qword_1567F18 > (unsigned __int64)a2
|| (v3 = qword_1567F18 + qword_1567F20, (unsigned __int64)a2 >= qword_1567F18 + qword_1567F20) )
{
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;
}