//
// sub_D16A88 from 0xd16a88 to 0xd16b08 (128 bytes)
//
// 10 xrefs:
// > localStorageInit @ 0xaaebb8
// > cocos2d::CCLabelAtlas::initWithString @ 0xae1d7c
// > cocos2d::CCFileUtils::addSuffix @ 0xb04430
// > cocos2d::CCFileUtils::addSuffix @ 0xb0444c
// > cocos2d::CCFileUtils::getPathForFilename @ 0xb052f8
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0xb1bdb4
// > cocos2d::CCTMXMapInfo::startElement @ 0xb3c650
// > cocos2d::CCTMXMapInfo::startElement @ 0xb3c670
// > cocos2d::CCTMXMapInfo::startElement @ 0xb3cbfc
// > cocos2d::CCTMXMapInfo::startElement @ 0xb3cc1c
//
// 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_D16A88(__int64 *a1, void *a2, unsigned __int64 a3, size_t a4)
{
__int64 v4; // x21
__int64 v5; // x0
unsigned __int64 v7; // x0
unsigned __int64 v10; // x19
v4 = *a1;
v5 = *(_QWORD *)(*a1 - 24);
if ( !a4 || !v5 )
return -1;
v7 = v5 - 1;
if ( a3 > v7 )
v10 = v7;
else
v10 = a3;
while ( !memchr(a2, *(unsigned __int8 *)(v4 + v10), a4) )
{
if ( !v10 )
return -1;
--v10;
}
return v10;
}