//
// cocos2d::CCArray::createWithContentsOfFileThreadSafe from 0x180006be0 to 0x180006d88 (424 bytes)
//
// 3 xrefs:
// > cocos2d::CCArray::createWithContentsOfFile @ 0x180006bb6
// > ??> @ 0x1801438a8
// > ??> @ 0x1801ad954
//
// 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
//
// Hidden C++ exception states: #wind=1
struct cocos2d::CCArray *__fastcall cocos2d::CCArray::createWithContentsOfFileThreadSafe(const char *Src)
{
_QWORD *v2; // rdi
size_t v3; // rbx
__int64 v4; // rsi
size_t v5; // rax
void *v6; // rax
struct cocos2d::CCFileUtils *v7; // rax
__int64 v8; // rbx
void *v9; // rcx
void *Block[2]; // [rsp+20h] [rbp-38h] BYREF
size_t v12; // [rsp+30h] [rbp-28h]
unsigned __int64 v13; // [rsp+38h] [rbp-20h]
*(_OWORD *)Block = 0;
v2 = nullptr;
v12 = 0;
v13 = 0;
v3 = -1;
do
++v3;
while ( Src[v3] );
v4 = 0x7FFFFFFFFFFFFFFFLL;
if ( v3 > 0x7FFFFFFFFFFFFFFFLL )
std::vector::_Xlen();
v13 = 15;
if ( v3 <= 0xF )
{
v12 = v3;
memcpy(Block, Src, v3);
*((_BYTE *)Block + v3) = 0;
goto LABEL_18;
}
if ( (v3 | 0xF) > 0x7FFFFFFFFFFFFFFFLL )
{
v5 = 0x8000000000000027uLL;
LABEL_8:
v6 = operator new(v5);
if ( !v6 )
goto LABEL_21;
v2 = (_QWORD *)(((unsigned __int64)v6 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*(v2 - 1) = v6;
goto LABEL_17;
}
v4 = v3 | 0xF;
if ( (v3 | 0xF) < 0x16 )
v4 = 22;
if ( (unsigned __int64)(v4 + 1) >= 0x1000 )
{
v5 = v4 + 40;
if ( v4 + 40 < (unsigned __int64)(v4 + 1) )
Concurrency::cancel_current_task();
goto LABEL_8;
}
if ( v4 != -1 )
v2 = operator new(v4 + 1);
LABEL_17:
Block[0] = v2;
v12 = v3;
v13 = v4;
memcpy(v2, Src, v3);
*((_BYTE *)v2 + v3) = 0;
LABEL_18:
v7 = cocos2d::CCFileUtils::sharedFileUtils();
v8 = ((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, void **))v7->__vftable[1].~CCFileUtils)(v7, Block);
if ( v13 > 0xF )
{
v9 = Block[0];
if ( v13 + 1 >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
LABEL_21:
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v9);
}
return (struct cocos2d::CCArray *)v8;
}