//
// ENGINE_ctrl_cmd_string from 0x101acc8 to 0x101af70 (680 bytes)
//
// 10 xrefs:
// > sub_101A2D4 @ 0x101a5a0
// > sub_101A2D4 @ 0x101a5c0
// > sub_101A2D4 @ 0x101a5dc
// > sub_101A2D4 @ 0x101a5fc
// > ENGINE_by_id @ 0x101c1c4
// > ENGINE_by_id @ 0x101c1e4
// > ENGINE_by_id @ 0x101c200
// > ENGINE_by_id @ 0x101c220
// > ENGINE_by_id @ 0x101c240
// > ??> @ 0xa3f90
//
// 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:07 +0000
//
__int64 __fastcall ENGINE_ctrl_cmd_string(__int64 a1, const char *a2, const char *a3, unsigned int a4)
{
__int64 v4; // x20
unsigned int v7; // w22
int v8; // w0
__int64 v10; // x2
char *v11; // [xsp+48h] [xbp+48h] BYREF
v4 = a1;
if ( a1 && a2 )
{
if ( *(_QWORD *)(a1 + 112) && (a1 = ENGINE_ctrl(a1, 13, 0, a2, 0), v7 = a1, (int)a1 > 0) )
{
if ( ENGINE_cmd_is_executable(v4, a1) )
{
v8 = ENGINE_ctrl(v4, 18, (int)v7, nullptr, 0);
if ( v8 < 0 )
{
a4 = 0;
ERR_put_error(38, 171, 110, "crypto/engine/eng_ctrl.c", 279);
}
else if ( (v8 & 4) != 0 )
{
if ( a3 )
{
a4 = 0;
ERR_put_error(38, 171, 136, "crypto/engine/eng_ctrl.c", 288);
}
else
{
return (int)ENGINE_ctrl(v4, v7, 0, nullptr, 0) > 0;
}
}
else if ( a3 )
{
if ( (v8 & 2) != 0 )
{
return (int)ENGINE_ctrl(v4, v7, 0, a3, 0) > 0;
}
else if ( (v8 & 1) != 0 )
{
v10 = strtol(a3, &v11, 10);
if ( a3 == v11 || *v11 )
{
a4 = 0;
ERR_put_error(38, 171, 133, "crypto/engine/eng_ctrl.c", 328);
}
else
{
return (int)ENGINE_ctrl(v4, v7, v10, nullptr, 0) > 0;
}
}
else
{
a4 = 0;
ERR_put_error(38, 171, 110, "crypto/engine/eng_ctrl.c", 322);
}
}
else
{
a4 = 0;
ERR_put_error(38, 171, 135, "crypto/engine/eng_ctrl.c", 304);
}
return a4;
}
ERR_put_error(38, 171, 134, "crypto/engine/eng_ctrl.c", 268);
return 0;
}
else
{
if ( !a4 )
{
ERR_put_error(38, 171, 137, "crypto/engine/eng_ctrl.c", 263);
return a4;
}
ERR_clear_error(a1);
return 1;
}
}
else
{
ERR_put_error(38, 171, 67, "crypto/engine/eng_ctrl.c", 245);
return 0;
}
}