//
// sub_600C68 from 0x600c68 to 0x600cde (118 bytes)
//
// 4 xrefs:
// > sub_600CE4 @ 0x600d04
// > sub_602224 @ 0x602246
// > sub_6022A8 @ 0x60234e
// > pugi::xml_node::append_buffer @ 0x6058b0
//
// 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
//
// write access to const memory has been detected, the output may be wrong!
unsigned int __fastcall sub_600C68(int a1, unsigned int a2, unsigned int *a3)
{
int v4; // r0
unsigned int result; // r0
_DWORD *v8; // r3
_DWORD *v9; // r2
_DWORD *v10; // r3
int v11; // r2
if ( a2 <= 0x2000 )
v4 = 0x8000;
else
v4 = a2;
result = (unsigned int)((void *(__fastcall *)(size_t))off_ABAE6C)(v4 + 56);
if ( result )
{
v8 = (_DWORD *)((result + 31) & 0xFFFFFFE0);
if ( !v8 )
{
*(_DWORD *)byte_4 = result;
__und(0xFFu);
}
*(_DWORD *)&byte_4[(result + 31) & 0xFFFFFFE0] = result;
*v8 = 0;
result = (result + 31) & 0xFFFFFFE0;
v8[2] = 0;
v8[3] = 0;
v9 = *(_DWORD **)a1;
v8[4] = 0;
v8[5] = 0;
*v8 = *v9;
}
*a3 = result;
if ( result )
{
v10 = *(_DWORD **)a1;
if ( a2 > 0x2000 )
{
v11 = v10[2];
*(_DWORD *)(result + 12) = v10;
}
else
{
v11 = *(_DWORD *)(a1 + 4);
}
if ( a2 > 0x2000 )
{
*(_DWORD *)(result + 8) = v11;
v11 = v10[2];
}
else
{
v10[4] = v11;
}
if ( a2 > 0x2000 )
{
*(_DWORD *)(v11 + 12) = result;
}
else
{
*(_DWORD *)(result + 8) = v10;
v10[3] = result;
}
if ( a2 > 0x2000 )
{
v10[2] = result;
}
else
{
*(_DWORD *)a1 = result;
*(_DWORD *)(a1 + 4) = a2;
}
result += 24;
*(_DWORD *)(result - 8) = a2;
}
return result;
}