//
// tinyxml2::XMLDocument::LoadFile from 0x18009d7b0 to 0x18009d8e0 (304 bytes)
//
// 3 xrefs:
// > tinyxml2::XMLDocument::LoadFile @ 0x18009d93f
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c1110
//
// 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
//
__int64 __fastcall tinyxml2::XMLDocument::LoadFile(__int64 a1, FILE *a2)
{
void *v4; // rcx
size_t v5; // rbx
void *v6; // rax
__int64 result; // rax
char *v8; // rbx
char i; // al
tinyxml2::XMLNode::DeleteChildren((tinyxml2::XMLNode *)a1);
v4 = *(void **)(a1 + 120);
*(_DWORD *)(a1 + 92) = 0;
*(_QWORD *)(a1 + 104) = 0;
*(_QWORD *)(a1 + 112) = 0;
j_j_free_0(v4);
*(_QWORD *)(a1 + 120) = 0;
fseek(a2, 0, 2);
v5 = ftell(a2);
fseek(a2, 0, 0);
if ( !v5 )
return *(unsigned int *)(a1 + 92);
v6 = (void *)sub_1800E4C6C(v5 + 1);
*(_QWORD *)(a1 + 120) = v6;
if ( fread(v6, 1u, v5, a2) == v5 )
{
*(_BYTE *)(v5 + *(_QWORD *)(a1 + 120)) = 0;
v8 = *(char **)(a1 + 120);
for ( i = *v8; i >= 0; i = *++v8 )
{
if ( !isspace((unsigned __int8)i) )
break;
}
*(_BYTE *)(a1 + 88) = 0;
if ( *v8 == -17 && v8[1] == -69 && v8[2] == -65 )
{
*(_BYTE *)(a1 + 88) = 1;
v8 += 3;
}
if ( !v8 || !*v8 )
{
*(_DWORD *)(a1 + 92) = 15;
result = 15;
goto LABEL_16;
}
(*(void (__fastcall **)(__int64, char *, _QWORD))(*(_QWORD *)a1 + 120LL))(a1, v8, 0);
return *(unsigned int *)(a1 + 92);
}
*(_DWORD *)(a1 + 92) = 5;
result = 5;
LABEL_16:
*(_QWORD *)(a1 + 112) = 0;
*(_QWORD *)(a1 + 104) = 0;
return result;
}