//
// tinyxml2::XMLUtil::GetCharacterRef from 0x1800992e0 to 0x180099434 (340 bytes)
//
// 5 xrefs:
// > tinyxml2::StrPair::GetStr @ 0x180099522
// > ??> @ 0x18013e83c
// > ??> @ 0x18013e84c
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b6de0
//
// 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
//
const char *__fastcall tinyxml2::XMLUtil::GetCharacterRef(const char *a1, char *a2, int *a3)
{
unsigned int v3; // edi
const char *result; // rax
char v8; // r9
const char *v9; // rcx
int v10; // ebx
char *v11; // rax
char v12; // cl
char *v13; // rdx
__int64 i; // rsi
int v15; // eax
int v16; // eax
char *v17; // rax
char v18; // cl
char *v19; // rdx
int v20; // eax
v3 = 0;
result = a1 + 1;
*a3 = 0;
if ( a1[1] == 35 )
{
v8 = a1[2];
v9 = a1 + 2;
if ( v8 )
{
v10 = 1;
if ( v8 == 120 )
{
if ( a1[3] )
{
v11 = strchr(a1 + 3, 59);
if ( v11 )
{
if ( *v11 )
{
v12 = *(v11 - 1);
v13 = v11 - 1;
for ( i = v11 - a1; v12 != 120; v3 += v16 )
{
if ( (unsigned __int8)(v12 - 48) > 9u )
{
if ( (unsigned __int8)(v12 - 97) > 5u )
{
if ( (unsigned __int8)(v12 - 65) > 5u )
return nullptr;
v15 = v12 - 55;
}
else
{
v15 = v12 - 87;
}
}
else
{
v15 = v12 - 48;
}
v12 = *--v13;
v16 = v10 * v15;
v10 *= 16;
}
goto LABEL_21;
}
}
}
}
else
{
v17 = strchr(v9, 59);
if ( v17 && *v17 )
{
v18 = *(v17 - 1);
v19 = v17 - 1;
i = v17 - a1;
if ( v18 == 35 )
{
LABEL_21:
tinyxml2::XMLUtil::ConvertUTF32ToUTF8(v3, a2, a3);
return &a1[i + 1];
}
while ( (unsigned __int8)(v18 - 48) <= 9u )
{
--v19;
v20 = v10 * (v18 - 48);
v10 *= 10;
v18 = *v19;
v3 += v20;
if ( *v19 == 35 )
goto LABEL_21;
}
}
}
return nullptr;
}
}
return result;
}