//
// sub_180071FE0 from 0x180071fe0 to 0x1800721f6 (534 bytes)
//
// 2 xrefs:
// > ??> @ 0x180100470
// > ??> @ 0x1801b432c
//
// 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=5
void __fastcall sub_180071FE0(__int64 a1, __int64 a2, _BYTE *a3, int a4)
{
size_t v4; // r15
char v7; // di
void *v8; // r14
size_t v9; // rbx
size_t v10; // r8
size_t v11; // r8
void **v12; // rdx
cocos2d::CCString *v13; // rsi
void *v14; // rcx
void *v15; // rcx
std::string *v16; // rax
std::string *CString; // rax
void *v18[2]; // [rsp+30h] [rbp-78h] BYREF
size_t v19; // [rsp+40h] [rbp-68h]
unsigned __int64 v20; // [rsp+48h] [rbp-60h]
void *Block[2]; // [rsp+50h] [rbp-58h] BYREF
__m128i si128; // [rsp+60h] [rbp-48h]
v4 = a4;
v7 = 0;
if ( *(_DWORD *)(a1 + 144) )
{
v8 = operator new(0x58u);
v9 = -1;
if ( v8 )
{
*(_OWORD *)v18 = 0;
v19 = 0;
v20 = 0;
v10 = -1;
do
++v10;
while ( a3[v10] );
sub_18000CE60(v18, a3, v10);
*(_OWORD *)Block = 0;
si128 = 0;
v11 = v4;
if ( v19 < v4 )
v11 = v19;
v12 = v18;
if ( v20 > 0xF )
v12 = (void **)v18[0];
sub_18000CE60(Block, v12, v11);
v7 = 3;
v13 = (cocos2d::CCString *)cocos2d::CCString::CCString((__int64)v8, (__int64)Block);
}
else
{
v13 = nullptr;
}
if ( (v7 & 2) != 0 )
{
v7 &= ~2u;
if ( si128.m128i_i64[1] > 0xFuLL )
{
v14 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v14);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Block[0]) = 0;
}
if ( (v7 & 1) != 0 && v20 > 0xF )
{
v15 = v18[0];
if ( v20 + 1 >= 0x1000 )
{
v15 = *((void **)v18[0] - 1);
if ( (unsigned __int64)((char *)v18[0] - (char *)v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v15);
}
if ( *(_DWORD *)(a1 + 144) == 1 )
{
CString = cocos2d::CCString::getCString(v13);
do
++v9;
while ( CString->m_data.m_smallStorage._Elems[v9] );
sub_180010050((void **)(a1 + 80), CString, v9);
}
else if ( *(_DWORD *)(a1 + 144) == 3 || (unsigned int)(*(_DWORD *)(a1 + 144) - 4) <= 1 )
{
v16 = cocos2d::CCString::getCString(v13);
do
++v9;
while ( v16->m_data.m_smallStorage._Elems[v9] );
sub_180007CF0((_QWORD *)(a1 + 112), v16, v9);
}
cocos2d::CCObject::release(v13);
}
}