//
// sub_10054FB84 from 0x10054fb84 to 0x10054fcd4 (336 bytes)
//
// 6 xrefs:
// > sub_10054DB30 @ 0x10054e090
// > sub_100551254 @ 0x100551984
// > sub_100551254 @ 0x1005519e4
// > sub_100551254 @ 0x100551fd0
// > sub_100551254 @ 0x100552064
// > sub_10057C160 @ 0x10057c790
//
// 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
//
_BYTE *__fastcall sub_10054FB84(__int64 a1)
{
char *v1; // x8
int v2; // w9
int v3; // t1
bool v4; // w10
char *v5; // x19
unsigned __int8 v6; // w8
__uint32_t v7; // w0
int v8; // t1
char *v9; // x20
__int64 v10; // x0
__uint32_t v11; // w0
signed __int64 v12; // x21
_BYTE *v13; // x0
_BYTE *v14; // x20
size_t v15; // x21
v1 = (char *)(a1 - 1);
do
{
v3 = (unsigned __int8)*++v1;
v2 = v3;
v4 = v3 != 0;
}
while ( v3 != 58 && v4 );
if ( v2 )
v5 = v1 + 1;
else
v5 = v1;
v6 = *v5;
if ( *v5 )
{
do
{
if ( (char)v6 < 0 )
v7 = __maskrune(v6, 0x4000u);
else
v7 = _DefaultRuneLocale.__runetype[v6] & 0x4000;
if ( !v7 )
break;
v8 = (unsigned __int8)*++v5;
v6 = v8;
}
while ( v8 );
}
v9 = strchr(v5, 13);
if ( !v9 )
{
v9 = strchr(v5, 10);
if ( !v9 )
{
v9 = &v5[strlen(v5)];
if ( !v9 )
return nullptr;
}
}
for ( ; v9 > v5; --v9 )
{
v10 = (unsigned __int8)*v9;
if ( *v9 < 0 )
v11 = __maskrune(v10, 0x4000u);
else
v11 = _DefaultRuneLocale.__runetype[v10] & 0x4000;
if ( !v11 )
break;
}
v12 = v9 - v5;
v13 = off_10085DEB0(v9 - v5 + 2);
v14 = v13;
if ( !v13 )
return nullptr;
v15 = v12 + 1;
memcpy(v13, v5, v15);
v14[v15] = 0;
return v14;
}