//
// cocos2d::CCFileUtils::getPathForFilename from 0x180070330 to 0x1800705f8 (712 bytes)
//
// 4 xrefs:
// > cocos2d::CCFileUtilsWin32::getPathForFilename @ 0x18007a40f
// > ??> @ 0x180100410
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b4230
//
// 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=3
_QWORD *__fastcall cocos2d::CCFileUtils::getPathForFilename(
__int64 a1,
_QWORD *a2,
__int64 a3,
unsigned __int64 *a4,
__int64 a5)
{
unsigned __int8 *v6; // rbx
int v8; // edi
unsigned __int64 v9; // r12
unsigned __int64 v10; // r13
size_t v11; // r15
__int64 v12; // rax
unsigned __int64 v13; // rdi
size_t v14; // r8
unsigned __int8 *v15; // rdx
unsigned __int64 v16; // rax
size_t v17; // rax
void *v18; // rcx
void **v19; // rdx
const void *v20; // rdx
__int64 v21; // rax
void *v22; // rcx
void *v23; // rcx
void *v24; // rcx
void *v27[2]; // [rsp+40h] [rbp-61h] BYREF
__int128 v28; // [rsp+50h] [rbp-51h]
void *v29[2]; // [rsp+60h] [rbp-41h] BYREF
__int128 v30; // [rsp+70h] [rbp-31h]
void *Block[2]; // [rsp+80h] [rbp-21h] BYREF
__int128 v32; // [rsp+90h] [rbp-11h]
v6 = (unsigned __int8 *)a3;
v8 = 0;
sub_180016C80((__int64)Block, a3);
*(_OWORD *)v29 = 0;
v9 = 0;
*(_QWORD *)&v30 = 0;
v10 = 15;
*((_QWORD *)&v30 + 1) = 15;
LOBYTE(v29[0]) = 0;
v11 = -1;
v12 = sub_18006E890((unsigned __int8 **)v6, byte_1800EB828, 0xFFFFFFFFFFFFFFFFuLL);
if ( v12 != -1 )
{
*(_OWORD *)v27 = 0;
v28 = 0;
v13 = v12 + 1;
v14 = v12 + 1;
if ( *((_QWORD *)v6 + 2) < (unsigned __int64)(v12 + 1) )
v14 = *((_QWORD *)v6 + 2);
v15 = v6;
if ( *((_QWORD *)v6 + 3) > 0xFu )
v15 = *(unsigned __int8 **)v6;
sub_18000CE60(v27, v15, v14);
*(_OWORD *)v29 = *(_OWORD *)v27;
v30 = v28;
*(_OWORD *)v27 = 0;
v28 = 0;
v16 = *((_QWORD *)v6 + 2);
if ( v16 < v13 )
std::vector::_Xlen();
v17 = v16 - v13;
if ( v17 != -1 )
v11 = v17;
if ( *((_QWORD *)v6 + 3) > 0xFu )
v6 = *(unsigned __int8 **)v6;
sub_18000CE60(v27, &v6[v13], v11);
v8 = 6;
if ( *((_QWORD *)&v32 + 1) > 0xFu )
{
v18 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v32 + 1) + 1LL) >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v18);
}
*(_OWORD *)Block = *(_OWORD *)v27;
v32 = v28;
v10 = *((_QWORD *)&v30 + 1);
v9 = v30;
}
sub_180016C80((__int64)a2, a5);
v19 = v29;
if ( v10 > 0xF )
v19 = (void **)v29[0];
sub_180007CF0(a2, v19, v9);
v20 = a4;
if ( a4[3] > 0xF )
v20 = (const void *)*a4;
sub_180007CF0(a2, v20, a4[2]);
v21 = (*(__int64 (__fastcall **)(__int64, void **, _QWORD *, void **, unsigned int))(*(_QWORD *)a1 + 224LL))(
a1,
v27,
a2,
Block,
v8 | 1u);
sub_1800656E0((__int64)a2, v21);
if ( *((_QWORD *)&v28 + 1) > 0xFu )
{
v22 = v27[0];
if ( (unsigned __int64)(*((_QWORD *)&v28 + 1) + 1LL) >= 0x1000 )
{
v22 = *((void **)v27[0] - 1);
if ( (unsigned __int64)((char *)v27[0] - (char *)v22 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v22);
}
if ( *((_QWORD *)&v30 + 1) > 0xFu )
{
v23 = v29[0];
if ( (unsigned __int64)(*((_QWORD *)&v30 + 1) + 1LL) >= 0x1000 )
{
v23 = *((void **)v29[0] - 1);
if ( (unsigned __int64)((char *)v29[0] - (char *)v23 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v23);
}
if ( *((_QWORD *)&v32 + 1) > 0xFu )
{
v24 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v32 + 1) + 1LL) >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v24);
}
return a2;
}