//
// sub_605C00 from 0x605c00 to 0x605cce (206 bytes)
//
// 2 xrefs:
// > pugi::xml_document::load_file @ 0x605cfa
// > pugi::xml_document::load_file @ 0x605d2e
//
// 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
//
int *__fastcall sub_605C00(int *a1, pugi::xml_document *a2, FILE *stream, unsigned int a4, int a5)
{
signed int v8; // r8
unsigned int v9; // r9
unsigned __int8 *v10; // r0
unsigned __int8 *v11; // r6
size_t v12; // r7
int v13; // r0
if ( !stream )
{
pugi::xml_parse_result::xml_parse_result(a1);
*a1 = 1;
a1[1] = 0;
return a1;
}
fseek(stream, 0, 2);
v8 = ftell(stream);
fseek(stream, 0, 0);
if ( v8 < 0 )
{
fclose(stream);
goto LABEL_13;
}
v9 = v8 + 1;
v10 = (unsigned __int8 *)off_ABAE6C(v8 + 1);
v11 = v10;
if ( !v10 )
{
fclose(stream);
pugi::xml_parse_result::xml_parse_result(a1);
*a1 = 3;
a1[1] = 0;
return a1;
}
v12 = fread(v10, 1u, v8, stream);
fclose(stream);
if ( v12 != v8 )
{
off_ABAE70(v11);
LABEL_13:
pugi::xml_parse_result::xml_parse_result(a1);
*a1 = 2;
a1[1] = 0;
return a1;
}
v13 = sub_601446(a5, v11, v12);
if ( v13 == 1 )
v11[v12] = 0;
else
v9 = v12;
pugi::xml_document::load_buffer_inplace_own(a1, a2, v11, v9, a4, v13);
return a1;
}