//
// sub_D16E44 from 0xd16e44 to 0xd16ed4 (144 bytes)
//
// 1 xrefs:
// > formatTags @ 0x7de940
//
// 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
//
unsigned __int64 __fastcall sub_D16E44(__int64 *a1, void *a2, unsigned __int64 a3, size_t a4)
{
__int64 v4; // x20
unsigned __int64 result; // x0
__int64 v6; // x4
unsigned __int64 v9; // x19
v4 = *a1;
result = -1;
v6 = *(_QWORD *)(v4 - 24);
if ( v6 )
{
if ( a3 > v6 - 1 )
v9 = v6 - 1;
else
v9 = a3;
while ( 1 )
{
if ( !memchr(a2, *(unsigned __int8 *)(v4 + v9), a4) )
return v9;
if ( !v9 )
break;
--v9;
}
return -1;
}
return result;
}