//
// ENGINE_remove from 0x7f7ccc to 0x7f7e00 (308 bytes)
//
// 2 xrefs:
// > sub_7F7E18 @ 0x7f7e30
// > ??> @ 0x6252c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall ENGINE_remove(int a1)
{
int v2; // r3
bool v3; // zf
int v4; // r4
bool v5; // zf
int v6; // r2
int v7; // r1
if ( a1 )
{
CRYPTO_THREAD_write_lock(global_engine_lock);
v2 = dword_AD2E84;
v3 = a1 == dword_AD2E84;
if ( a1 != dword_AD2E84 )
v3 = dword_AD2E84 == 0;
v4 = dword_AD2E84;
if ( !v3 )
{
do
{
v4 = *(_DWORD *)(v4 + 96);
v5 = a1 == v4;
if ( a1 != v4 )
v5 = v4 == 0;
}
while ( !v5 );
}
if ( v4 )
{
v6 = *(_DWORD *)(a1 + 96);
if ( v6 )
*(_DWORD *)(v6 + 92) = *(_DWORD *)(a1 + 92);
v7 = *(_DWORD *)(a1 + 92);
if ( v7 )
*(_DWORD *)(v7 + 96) = v6;
if ( a1 == v2 )
dword_AD2E84 = *(_DWORD *)(a1 + 96);
v4 = 1;
if ( a1 == dword_AD2E88 )
dword_AD2E88 = v7;
engine_free_util(a1, 0);
}
else
{
ERR_put_error(38, 121, 105, "crypto/engine/eng_list.c", 117);
ERR_put_error(38, 123, 110, "crypto/engine/eng_list.c", 245);
}
CRYPTO_THREAD_unlock(global_engine_lock);
return v4;
}
else
{
ERR_put_error(38, 123, 67, "crypto/engine/eng_list.c", 240);
return 0;
}
}