//
// sub_D168E0 from 0xd168e0 to 0xd1696c (140 bytes)
//
// 80 xrefs:
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x57393c
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x5739f8
// > GameToolbox::stringSetupToDict @ 0x5813a8
// > GameToolbox::stringSetupToDict @ 0x581468
// > sub_583398 @ 0x583400
// > sub_583398 @ 0x58349c
// > GameToolbox::stringSetupToMap @ 0x584700
// > GameToolbox::stringSetupToMap @ 0x584778
// > SpriteAnimationManager::createAnimations @ 0x58ed48
// > SpriteAnimationManager::createAnimations @ 0x58edf4
// > sub_5BFAA8 @ 0x5bfb14
// > sub_5BFAA8 @ 0x5bfbb4
// > PlayLayer::prepareCreateObjectsFromSetup @ 0x5d5d34
// > PlayLayer::prepareCreateObjectsFromSetup @ 0x5d5dd4
// > GameManager::getUnlockForAchievement @ 0x5e9424
// > GameManager::getUnlockForAchievement @ 0x5e94d0
// > sub_5EE82C @ 0x5ee894
// > sub_5EE82C @ 0x5ee930
// > LevelTools::createStarPackDict @ 0x606020
// > LevelTools::createStarPackDict @ 0x6060dc
// > AchievementCell::loadFromDict @ 0x60dd9c
// > AchievementCell::loadFromDict @ 0x60de54
// > sub_66B910 @ 0x66b978
// > sub_66B910 @ 0x66ba14
// > LevelEditorLayer::init @ 0x67cf74
// > LevelEditorLayer::init @ 0x67d03c
// > sub_6B6FCC @ 0x6b7034
// > sub_6B6FCC @ 0x6b70d0
// > LevelBrowserLayer::setupPageInfo @ 0x6e8f3c
// > LevelBrowserLayer::setupPageInfo @ 0x6e8ffc
// > sub_6F004C @ 0x6f00bc
// > sub_6F004C @ 0x6f0164
// > parseLevelLeaderboardKey @ 0x719c68
// > parseLevelLeaderboardKey @ 0x719d1c
// > GJLevelList::parseListLevels @ 0x72eda0
// > GJLevelList::parseListLevels @ 0x72ee34
// > sub_74769C @ 0x7476f0
// > sub_74769C @ 0x747790
// > sub_752D7C @ 0x752de8
// > sub_752D7C @ 0x752e88
// > EventLinkTrigger::customObjectSetup @ 0x771a50
// > EventLinkTrigger::customObjectSetup @ 0x771afc
// > AudioEffectsLayer::init @ 0x78ef84
// > AudioEffectsLayer::init @ 0x78f03c
// > sub_7A19E8 @ 0x7a1a58
// > sub_7A19E8 @ 0x7a1b00
// > sub_7AEA8C @ 0x7aeaf4
// > sub_7AEA8C @ 0x7aeb90
// > AchievementBar::init @ 0x7d7a00
// > AchievementBar::init @ 0x7d7ab8
// > InfoLayer::setupPageInfo @ 0x7e382c
// > InfoLayer::setupPageInfo @ 0x7e38e8
// > sub_82052C @ 0x82059c
// > sub_82052C @ 0x820644
// > sub_830154 @ 0x8301bc
// > sub_830154 @ 0x830258
// > sub_844C0C @ 0x844c7c
// > sub_844C0C @ 0x844d24
// > GJBaseGameLayer::updateLayerCapacity @ 0x86d128
// > GJBaseGameLayer::updateLayerCapacity @ 0x86d1dc
// > GJBaseGameLayer::updateLayerCapacity @ 0x86d3e0
// > GJBaseGameLayer::updateLayerCapacity @ 0x86d494
// > sub_8A7F28 @ 0x8a7f90
// > sub_8A7F28 @ 0x8a802c
// > GJEffectManager::setupFromString @ 0x8c071c
// > GJEffectManager::setupFromString @ 0x8c07d8
// > MessagesProfilePage::setupPageInfo @ 0x8f3fd0
// > MessagesProfilePage::setupPageInfo @ 0x8f408c
// > FRequestProfilePage::setupPageInfo @ 0x8f64b4
// > FRequestProfilePage::setupPageInfo @ 0x8f6570
// > ProfilePage::setupPageInfo @ 0x8ff48c
// > ProfilePage::setupPageInfo @ 0x8ff548
// > sub_900FBC @ 0x901010
// > sub_900FBC @ 0x9010b0
// > TopArtistsLayer::setupPageInfo @ 0x96669c
// > TopArtistsLayer::setupPageInfo @ 0x966758
// > sub_980C40 @ 0x980cb0
// > sub_980C40 @ 0x980d58
// > sub_D1696C @ 0xd16974
// > sub_D16978 @ 0xd169b0
//
// 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_D168E0(__int64 *a1, void *a2, unsigned __int64 a3, size_t a4)
{
unsigned __int64 v7; // x19
unsigned __int64 result; // x0
__int64 v9; // x21
unsigned __int64 v10; // x23
v7 = a3;
result = -1;
if ( a4 )
{
v9 = *a1;
v10 = *(_QWORD *)(*a1 - 24);
if ( v10 > a3 )
{
while ( !memchr(a2, *(unsigned __int8 *)(v9 + v7), a4) )
{
if ( v10 <= ++v7 )
return -1;
}
return v7;
}
}
return result;
}