//
// tinyxml2::XMLDocument::NewElement from 0x180099ed0 to 0x180099f8e (190 bytes)
//
// 16 xrefs:
// > sub_18006F980 @ 0x18006f999
// > sub_18006F980 @ 0x18006f9ea
// > sub_18006F980 @ 0x18006fa49
// > sub_18006F980 @ 0x18006faa3
// > sub_18006FB70 @ 0x18006fbb7
// > sub_18006FB70 @ 0x18006fc13
// > cocos2d::CCFileUtils::writeToFile @ 0x180072285
// > cocos2d::CCFileUtils::writeToFile @ 0x18007229f
// > tinyxml2::XMLElement::ShallowClone @ 0x18009ca5d
// > cocos2d::CCUserDefault::createXMLFile @ 0x18009e85f
// > cocos2d::CCUserDefault::setBoolForKey @ 0x18009f327
// > cocos2d::CCUserDefault::setDoubleForKey @ 0x18009f49e
// > cocos2d::CCUserDefault::setIntegerForKey @ 0x18009f5d9
// > cocos2d::CCUserDefault::setStringForKey @ 0x18009f6e5
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b6ee8
//
// 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
//
struct tinyxml2::XMLElement *__fastcall tinyxml2::XMLDocument::NewElement(tinyxml2::XMLDocument *this, const char *a2)
{
char *v2; // rdi
__int64 v5; // rsi
__int64 v6; // rbx
void *v7; // rax
__int64 v8; // rcx
v2 = (char *)this + 128;
v5 = (*(__int64 (__fastcall **)(char *))(*((_QWORD *)this + 16) + 16LL))((char *)this + 128);
*(_QWORD *)(v5 + 8) = this;
v6 = -1;
*(_QWORD *)(v5 + 16) = 0;
*(_QWORD *)(v5 + 48) = 0;
*(_QWORD *)(v5 + 56) = 0;
*(_QWORD *)(v5 + 64) = 0;
*(_QWORD *)(v5 + 72) = 0;
*(_QWORD *)v5 = &tinyxml2::XMLElement::`vftable';
*(_DWORD *)(v5 + 88) = 0;
*(_QWORD *)(v5 + 96) = 0;
*(_QWORD *)(v5 + 80) = v2;
*(_DWORD *)(v5 + 24) = 0;
*(_QWORD *)(v5 + 32) = 0;
*(_QWORD *)(v5 + 40) = 0;
do
++v6;
while ( a2[v6] );
v7 = operator new(v6 + 1);
*(_QWORD *)(v5 + 32) = v7;
memcpy(v7, a2, v6 + 1);
v8 = *(_QWORD *)(v5 + 32);
*(_DWORD *)(v5 + 24) = 512;
*(_QWORD *)(v5 + 40) = v6 + v8;
return (struct tinyxml2::XMLElement *)v5;
}