//
// sub_1004CC170 from 0x1004cc170 to 0x1004cc209 (153 bytes)
//
// 2 xrefs:
// > cocos2d::CCTMXMapInfo::startElement @ 0x1004c9c26
// > cocos2d::CCTMXMapInfo::startElement @ 0x1004c9c46
//
// This function is hookable on this platform (idp: pc, 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 12:31:10 +0000
//
__int64 __fastcall sub_1004CC170(unsigned __int8 *a1, char *a2, unsigned __int64 a3)
{
unsigned int v4; // r15d
unsigned __int8 *v5; // r14
unsigned __int64 v6; // r15
size_t v7; // rax
size_t v8; // r12
unsigned __int64 v9; // rax
unsigned __int64 v10; // r13
v4 = *a1;
if ( (v4 & 1) != 0 )
{
v6 = *((_QWORD *)a1 + 1);
v5 = *((unsigned __int8 **)a1 + 2);
v7 = strlen(a2);
if ( !v7 )
return -1;
}
else
{
v5 = a1 + 1;
v6 = v4 >> 1;
v7 = strlen(a2);
if ( !v7 )
return -1;
}
v8 = v7;
v9 = a3;
v10 = a3 + 1;
if ( v6 <= v9 )
v10 = v6;
while ( v10 )
{
if ( memchr(a2, (char)v5[--v10], v8) )
return v10;
}
return -1;
}