//
// tinyxml2::XMLUtil::GetCharacterRef from 0xb235b4 to 0xb23744 (400 bytes)
//
// 2 xrefs:
// > tinyxml2::StrPair::GetStr @ 0xb239d4
// > ??> @ 0x73a58
//
// 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
//
unsigned __int64 __fastcall tinyxml2::XMLUtil::GetCharacterRef(
tinyxml2::XMLUtil *this,
const char *a2,
char *a3,
int *a4)
{
unsigned __int64 result; // x0
char *v8; // x0
unsigned __int64 v9; // x3
int v10; // w1
signed __int64 v11; // x21
char *v12; // x5
int v13; // w4
int v14; // t1
__int64 v15; // x7
unsigned int v16; // w1
char *v17; // x0
char *v18; // x6
int v19; // w5
unsigned int v20; // t1
unsigned int v21; // w1
int v22; // w4
unsigned __int8 v23; // w7
int v24; // w3
__int64 v25; // x4
*(_DWORD *)a3 = 0;
if ( *((_BYTE *)this + 1) != 35 || !*((_BYTE *)this + 2) )
return (unsigned __int64)this + 1;
if ( *((_BYTE *)this + 2) == 120 )
{
if ( *((_BYTE *)this + 3) )
{
v17 = strchr((const char *)this + 3, 59);
if ( v17 )
{
if ( *v17 )
{
v9 = (unsigned __int8)*(v17 - 1);
v11 = v17 - (char *)this;
v18 = v17 - 1;
if ( (_DWORD)v9 != 120 )
{
v19 = 1;
result = 0;
do
{
v21 = (unsigned __int8)(v9 - 97);
if ( (unsigned __int8)(v9 - 48) <= 9u )
{
result += (unsigned int)((v9 - 48) * v19);
}
else
{
v22 = v9 - 55;
v23 = v9 - 65;
v24 = v9 - 87;
v25 = (unsigned int)(v22 * v19);
if ( v21 > 5 )
{
result += v25;
if ( v23 > 5u )
return 0;
}
else
{
result += (unsigned int)(v24 * v19);
}
}
v20 = (unsigned __int8)*--v18;
v9 = v20;
v19 *= 16;
}
while ( v20 != 120 );
goto LABEL_13;
}
goto LABEL_26;
}
}
}
return 0;
}
v8 = strchr((const char *)this + 2, 59);
if ( !v8 || !*v8 )
return 0;
v10 = (unsigned __int8)*(v8 - 1);
v11 = v8 - (char *)this;
v12 = v8 - 1;
if ( v10 == 35 )
{
LABEL_26:
result = 0;
LABEL_13:
tinyxml2::XMLUtil::ConvertUTF32ToUTF8(result, (__int64)a2, a3, (int *)v9);
return (unsigned __int64)this + v11 + 1;
}
v13 = v10 - 48;
LODWORD(v9) = 1;
result = 0;
if ( (unsigned __int8)(v10 - 48) <= 9u )
{
while ( 1 )
{
v14 = (unsigned __int8)*--v12;
v15 = (unsigned int)(v9 * v13);
v13 = v14 - 48;
result += v15;
v9 = (unsigned int)(10 * v9);
v16 = (unsigned __int8)(v14 - 48);
if ( v14 == 35 )
break;
if ( v16 > 9 )
return 0;
}
goto LABEL_13;
}
return result;
}