//
// sub_180018CF0 from 0x180018cf0 to 0x180018d64 (116 bytes)
//
// 4 xrefs:
// > sub_180018D70 @ 0x180018e23
// > cocos2d::extension::CCHttpRequest::setRequestData @ 0x18001d267
// > sub_18001D910 @ 0x18001d94a
// > ??> @ 0x18004ab90
//
// 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
//
char *__fastcall sub_180018CF0(_QWORD *a1, size_t a2)
{
void *v4; // rax
void *v5; // rcx
_QWORD *v6; // rax
char *result; // rax
if ( a2 < 0x1000 )
{
if ( a2 )
v6 = operator new(a2);
else
v6 = nullptr;
}
else
{
if ( a2 + 39 < a2 )
Concurrency::cancel_current_task();
v4 = operator new(a2 + 39);
v5 = v4;
if ( !v4 )
invalid_parameter_noinfo_noreturn();
v6 = (_QWORD *)(((unsigned __int64)v4 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*(v6 - 1) = v5;
}
*a1 = v6;
a1[1] = v6;
result = (char *)v6 + a2;
a1[2] = result;
return result;
}