//
// GManager::saveGMTo from 0x588774 to 0x5888d0 (348 bytes)
//
// 2 xrefs:
// > GManager::save @ 0x588940
// > ??> @ 0xaa610
//
// 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
//
__int64 __fastcall GManager::saveGMTo(_BYTE *a1, __int64 a2)
{
DS_Dictionary *v4; // x19
char *v5; // x0
pugi::xml_node *m_start; // x0
unsigned int *v8; // x2
int v9; // w1
const char *v10; // [xsp+60h] [xbp+60h] BYREF
v4 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v4);
(*(void (__fastcall **)(_BYTE *, DS_Dictionary *))(*(_QWORD *)a1 + 888LL))(a1, v4);
sub_D18D28(&v10, a2);
GManager::saveData((__int64)a1, v4, &v10);
v5 = (char *)(v10 - 24);
if ( v10 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v10 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *((_DWORD *)v10 - 2);
*((_DWORD *)v10 - 2) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v5);
}
m_start = v4->dictTree.m_start;
a1[329] = 0;
if ( m_start )
operator delete(m_start);
pugi::xml_document::~xml_document(&v4->doc);
operator delete(v4);
return _stack_chk_guard;
}