//
// cocos2d::extension::CCHttpRequest::setRequestData from 0x18001d1d0 to 0x18001d2fd (301 bytes)
//
// 6 xrefs:
// > ??> @ 0x18002f834
// > ??> @ 0x18002f848
// > ??> @ 0x18002f85c
// > ??> @ 0x18002f870
// > ??> @ 0x18002fdf8
// > ??> @ 0x18004af80
//
// 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
//
void __fastcall cocos2d::extension::CCHttpRequest::setRequestData(
cocos2d::extension::CCHttpRequest *this,
const char *a2,
unsigned int a3)
{
char *v3; // rbx
void **v4; // rdi
size_t v6; // rsi
unsigned __int64 v7; // rdx
unsigned __int64 v8; // rcx
size_t v9; // rbp
char *v10; // rbx
unsigned __int64 v11; // r14
v3 = *((char **)this + 12);
v4 = (void **)((char *)this + 96);
v6 = a3;
v7 = *((_QWORD *)this + 14) - (_QWORD)v3;
if ( a3 <= v7 )
{
v11 = *((_QWORD *)this + 13) - (_QWORD)v3;
if ( a3 <= v11 )
{
memmove(v3, a2, a3);
}
else
{
memmove(v3, a2, *((_QWORD *)this + 13) - (_QWORD)v3);
v3 = (char *)v4[1];
v6 -= v11;
memmove(v3, &a2[v11], v6);
}
v4[1] = &v3[v6];
}
else
{
v8 = v7 >> 1;
v9 = 0x7FFFFFFFFFFFFFFFLL;
if ( v7 <= 0x7FFFFFFFFFFFFFFFLL - (v7 >> 1) )
{
v9 = v8 + v7;
if ( v8 + v7 < a3 )
v9 = a3;
}
if ( v3 )
{
if ( v7 >= 0x1000 )
{
if ( (unsigned __int64)&v3[-*((_QWORD *)v3 - 1) - 8] > 0x1F )
invalid_parameter_noinfo_noreturn();
v3 = *((char **)v3 - 1);
}
j_j_free(v3);
*v4 = nullptr;
v4[1] = nullptr;
v4[2] = nullptr;
}
sub_180018CF0(v4, v9);
v10 = (char *)*v4;
memmove(*v4, a2, v6);
v4[1] = &v10[v6];
}
}