//
// sub_815280 from 0x815280 to 0x81534e (206 bytes)
//
// 2 xrefs:
// > pugi::xml_document::load_file @ 0x81537a
// > pugi::xml_document::load_file @ 0x8153ae
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:01:41 +0000
//
int *__fastcall sub_815280(int *a1, unsigned __int8 **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_D2006C(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_D20070(v11);
LABEL_13:
pugi::xml_parse_result::xml_parse_result(a1);
*a1 = 2;
a1[1] = 0;
return a1;
}
v13 = sub_810A0A(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;
}