//
// cocos2d::CCString::createWithData from 0xad39dc to 0xad3ae8 (268 bytes)
//
// 2 xrefs:
// > cocos2d::CCString::createWithContentsOfFile @ 0xad3c98
// > ??> @ 0x56a60
//
// 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
//
cocos2d::CCString *cocos2d::CCString::createWithData(const unsigned __int8 *a1, unsigned __int64 a2)
{
char *v4; // x0
char *v5; // x20
cocos2d::CCString *v6; // x21
void *v7; // x0
unsigned int *v9; // x2
int v10; // w1
__int64 v11; // [xsp+40h] [xbp+40h] BYREF
if ( !a1 )
return nullptr;
v4 = (char *)malloc(a2 + 1);
v5 = v4;
if ( !v4 )
return nullptr;
v4[a2] = 0;
if ( a2 )
memcpy(v4, a1, a2);
sub_D153B8((int)&v11, v5);
v6 = (cocos2d::CCString *)cocos2d::CCString::create();
v7 = (void *)(v11 - 24);
if ( (__int64 *)(v11 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v11 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v11 - 8);
*(_DWORD *)(v11 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v7);
}
free(v5);
return v6;
}