//
// tinyxml2::XMLElement::FindOrCreateAttribute from 0x18009cd20 to 0x18009ce4d (301 bytes)
//
// 9 xrefs:
// > tinyxml2::XMLElement::SetAttribute @ 0x18006f3e9
// > cocos2d::CCFileUtils::writeToFile @ 0x1800745f1
// > tinyxml2::XMLElement::ShallowClone @ 0x1800a071b
// > tinyxml2::XMLElement::SetAttribute @ 0x1800d5689
// > tinyxml2::XMLElement::SetAttribute @ 0x1800d56a9
// > tinyxml2::XMLElement::SetAttribute @ 0x1800d56cc
// > tinyxml2::XMLElement::SetAttribute @ 0x1800d56fa
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c1020
//
// This function is hookable on this platform (idp: pc, 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 11:22:12 +0000
//
struct tinyxml2::XMLAttribute *__fastcall tinyxml2::XMLElement::FindOrCreateAttribute(
tinyxml2::XMLElement *this,
const char *a2)
{
__int64 v2; // rdi
__int64 v5; // rbp
const char *v6; // rbx
const char *Str; // rax
const char *v8; // rcx
int v9; // edx
char v10; // al
bool v11; // zf
__int64 v12; // rbx
v2 = *((_QWORD *)this + 12);
v5 = 0;
if ( v2 )
{
while ( 1 )
{
v6 = a2;
Str = tinyxml2::StrPair::GetStr((tinyxml2::StrPair *)(v2 + 8));
v8 = Str;
v9 = 0;
if ( Str == a2 )
return (struct tinyxml2::XMLAttribute *)v2;
v10 = *Str;
if ( !v10 )
goto LABEL_11;
do
{
if ( !*v6 || v10 != *v6 )
break;
v11 = v9 == 0x7FFFFFFF;
if ( v9 == 0x7FFFFFFF )
goto LABEL_9;
v10 = *++v8;
++v6;
++v9;
}
while ( v10 );
v11 = v9 == 0x7FFFFFFF;
LABEL_9:
if ( v11 )
return (struct tinyxml2::XMLAttribute *)v2;
if ( !*v8 )
{
LABEL_11:
if ( !*v6 )
return (struct tinyxml2::XMLAttribute *)v2;
}
v5 = v2;
v2 = *(_QWORD *)(v2 + 56);
if ( !v2 )
goto LABEL_13;
}
}
else
{
LABEL_13:
v12 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*((_QWORD *)this + 1) + 256LL) + 16LL))(*((_QWORD *)this + 1) + 256LL);
*(_DWORD *)(v12 + 8) = 0;
*(_QWORD *)(v12 + 16) = 0;
*(_QWORD *)v12 = &tinyxml2::XMLAttribute::`vftable';
*(_QWORD *)(v12 + 24) = 0;
*(_DWORD *)(v12 + 32) = 0;
*(_QWORD *)(v12 + 40) = 0;
*(_QWORD *)(v12 + 48) = 0;
*(_QWORD *)(v12 + 56) = 0;
*(_QWORD *)(v12 + 64) = *((_QWORD *)this + 1) + 256LL;
if ( v5 )
*(_QWORD *)(v5 + 56) = v12;
else
*((_QWORD *)this + 12) = v12;
tinyxml2::StrPair::SetStr((tinyxml2::StrPair *)(v12 + 8), a2, 0);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(v12 + 64) + 32LL))(*(_QWORD *)(v12 + 64));
return (struct tinyxml2::XMLAttribute *)v12;
}
}