//
// tinyxml2::XMLDocument::Parse from 0xd982cc to 0xd983c0 (244 bytes)
//
// 3 xrefs:
// > cocos2d::CCSAXParser::parse @ 0xd745d0
// > sub_D904E4 @ 0xd9058c
// > ??> @ 0xb0680
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:08:22 +0000
//
__int64 __fastcall tinyxml2::XMLDocument::Parse(tinyxml2::XMLDocument *this, char *a2, size_t a3)
{
void *v6; // x0
bool *v7; // x2
int v8; // w0
unsigned __int8 *BOM; // x0
int v11; // t1
tinyxml2::XMLNode::DeleteChildren((tinyxml2::XMLNode **)this);
tinyxml2::XMLDocument::InitDocument(this);
if ( !a2 || !*a2 )
goto LABEL_9;
if ( a3 == -1 )
a3 = strlen(a2);
v6 = (void *)operator new[](a3 + 1);
*((_QWORD *)this + 15) = v6;
memcpy(v6, a2, a3);
*(_BYTE *)(*((_QWORD *)this + 15) + a3) = 0;
v8 = (unsigned __int8)*a2;
if ( (v8 & 0x80) == 0 )
{
do
{
if ( !isspace(v8) )
break;
v11 = (unsigned __int8)*++a2;
v8 = v11;
}
while ( (v11 & 0x80) == 0 );
}
BOM = tinyxml2::XMLUtil::ReadBOM((unsigned __int8 *)a2, (char *)this + 88, v7);
if ( BOM && *BOM )
{
(*(void (__fastcall **)(tinyxml2::XMLDocument *, _QWORD, _QWORD))(*(_QWORD *)this + 120LL))(
this,
*((_QWORD *)this + 15),
0);
return *((unsigned int *)this + 23);
}
else
{
LABEL_9:
tinyxml2::XMLDocument::SetError((__int64)this, 15, 0, 0);
return *((unsigned int *)this + 23);
}
}