//
// sub_18003D240 from 0x18003d240 to 0x18003d36e (302 bytes)
//
// 6 xrefs:
// > DS_Dictionary::copyFile @ 0x18001948d
// > DS_Dictionary::loadRootSubDictFromCompressedFile @ 0x18001baaf
// > DS_Dictionary::loadRootSubDictFromFile @ 0x18001be61
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x18001d437
// > DS_Dictionary::saveRootSubDictToFile @ 0x18001dc34
// > ??> @ 0x1801b1134
//
// 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
__int64 __fastcall sub_18003D240(__int64 a1)
{
struct cocos2d::CCFileUtils *v2; // rax
__int64 v3; // rdi
unsigned __int64 v4; // rdx
_QWORD *v5; // rcx
_BYTE *v6; // rcx
void *Block; // [rsp+30h] [rbp-38h] BYREF
unsigned __int64 v9; // [rsp+48h] [rbp-20h]
*(_OWORD *)a1 = 0;
*(_QWORD *)(a1 + 16) = 0;
*(_QWORD *)(a1 + 24) = 15;
*(_BYTE *)a1 = 0;
v2 = cocos2d::CCFileUtils::sharedFileUtils();
v3 = ((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, void **))v2->init)(v2, &Block);
if ( a1 != v3 )
{
v4 = *(_QWORD *)(a1 + 24);
if ( v4 > 0xF )
{
v5 = *(_QWORD **)a1;
if ( v4 + 1 >= 0x1000 )
{
if ( (unsigned __int64)v5 - *(v5 - 1) - 8 > 0x1F )
goto LABEL_11;
v5 = (_QWORD *)*(v5 - 1);
}
j_j_free_0(v5);
}
*(_QWORD *)(a1 + 16) = 0;
*(_QWORD *)(a1 + 24) = 15;
*(_BYTE *)a1 = 0;
*(_OWORD *)a1 = *(_OWORD *)v3;
*(_OWORD *)(a1 + 16) = *(_OWORD *)(v3 + 16);
*(_QWORD *)(v3 + 16) = 0;
*(_QWORD *)(v3 + 24) = 15;
*(_BYTE *)v3 = 0;
}
if ( v9 > 0xF )
{
v6 = Block;
if ( v9 + 1 >= 0x1000 )
{
v6 = *((_BYTE **)Block - 1);
if ( (unsigned __int64)((_BYTE *)Block - v6 - 8) > 0x1F )
LABEL_11:
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v6);
}
return a1;
}