//
// ENGINE_add from 0x101bd84 to 0x101bf50 (460 bytes)
//
// 4 xrefs:
// > sub_10DB098 @ 0x10db52c
// > engine_load_dynamic_int @ 0x10db8b0
// > engine_load_openssl_int @ 0x10dc0d8
// > ??> @ 0xc7828
//
// 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:08 +0000
//
__int64 __fastcall ENGINE_add(__int64 a1)
{
__int64 v2; // x19
const char *v3; // x20
int v4; // w0
__int64 v5; // x0
unsigned int v6; // w19
int v8; // w0
if ( !a1 )
{
ERR_put_error(38, 105, 67, "crypto/engine/eng_list.c", 219);
return 0;
}
if ( !*(_QWORD *)a1 || !*(_QWORD *)(a1 + 8) )
{
ERR_put_error(38, 105, 108, "crypto/engine/eng_list.c", 223);
return 0;
}
CRYPTO_THREAD_write_lock(global_engine_lock);
v2 = qword_1566400;
if ( !qword_1566400 )
{
if ( qword_1566408 )
{
ERR_put_error(38, 120, 110, "crypto/engine/eng_list.c", 74);
goto LABEL_11;
}
*(_QWORD *)(a1 + 176) = 0;
qword_1566400 = a1;
engine_cleanup_add_last((__int64)sub_101C090);
LABEL_17:
v8 = *(_DWORD *)(a1 + 156);
v6 = 1;
*(_QWORD *)(a1 + 184) = 0;
*(_DWORD *)(a1 + 156) = v8 + 1;
qword_1566408 = a1;
goto LABEL_12;
}
v3 = *(const char **)a1;
do
{
v4 = strcmp(*(const char **)v2, v3);
v2 = *(_QWORD *)(v2 + 184);
}
while ( (v2 != 0) > (unsigned int)(v4 == 0) );
if ( !v4 )
{
ERR_put_error(38, 120, 103, "crypto/engine/eng_list.c", 68);
goto LABEL_11;
}
v5 = qword_1566408;
if ( qword_1566408 && !*(_QWORD *)(qword_1566408 + 184) )
{
*(_QWORD *)(qword_1566408 + 184) = a1;
*(_QWORD *)(a1 + 176) = v5;
goto LABEL_17;
}
ERR_put_error(38, 120, 110, "crypto/engine/eng_list.c", 86);
LABEL_11:
v6 = 0;
ERR_put_error(38, 105, 110, "crypto/engine/eng_list.c", 228);
LABEL_12:
CRYPTO_THREAD_unlock(global_engine_lock);
return v6;
}