//
// sub_1006C1230 from 0x1006c1230 to 0x1006c1302 (210 bytes)
//
// 6 xrefs:
// > cocos2d::CCTextureCache::addImage @ 0x1006c0f78
// > cocos2d::CCTextureCache::addImage @ 0x1006c0f93
// > cocos2d::CCTextureCache::addImage @ 0x1006c0fab
// > cocos2d::CCTextureCache::addImage @ 0x1006c0fc9
// > cocos2d::CCTextureCache::addImage @ 0x1006c0fe1
// > NewsPopup::onBlockClicked @ 0x10095a82e
//
// 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:35:32 +0000
//
__int64 __fastcall sub_1006C1230(unsigned __int8 *a1, const char *a2, unsigned __int64 a3)
{
unsigned int v4; // r13d
unsigned __int8 *v5; // rbx
unsigned __int64 v6; // r13
signed __int64 v7; // r12
__int64 result; // rax
signed __int64 v9; // rdx
unsigned __int8 *v10; // r13
unsigned __int8 *v11; // rcx
unsigned __int8 *v12; // r14
__int64 v13; // rcx
unsigned __int8 *v14; // r14
size_t v15; // rdx
unsigned __int8 *v16; // rax
int __c; // [rsp+0h] [rbp-2Ch]
v4 = *a1;
if ( (v4 & 1) != 0 )
{
v6 = *((_QWORD *)a1 + 1);
v5 = *((unsigned __int8 **)a1 + 2);
}
else
{
v5 = a1 + 1;
v6 = v4 >> 1;
}
v7 = strlen(a2);
result = -1;
v9 = v6 - a3;
if ( v6 >= a3 )
{
if ( v7 )
{
v10 = &v5[v6];
if ( v9 >= v7 )
{
v14 = &v5[a3];
__c = *a2;
do
{
v15 = v9 - v7 + 1;
if ( !v15 )
break;
v16 = (unsigned __int8 *)memchr(v14, __c, v15);
if ( !v16 )
break;
v12 = v16;
if ( !memcmp(v16, a2, v7) )
{
v11 = v12;
goto LABEL_8;
}
v14 = v12 + 1;
v9 = v10 - v14;
}
while ( v10 - v14 >= v7 );
}
v11 = v10;
v12 = v10;
LABEL_8:
v13 = v11 - v5;
result = -1;
if ( v12 != v10 )
return v13;
}
else
{
return a3;
}
}
return result;
}