//
// sub_100581E70 from 0x100581e70 to 0x100581fc4 (340 bytes)
//
// 2 xrefs:
// > ??> @ 0x10082ed78
// > ??> @ 0x10082edf8
//
// 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
//
__int64 __fastcall sub_100581E70(__int64 *a1)
{
_QWORD *v2; // x19
__int64 v3; // x0
__int64 result; // x0
const char *v5; // x0
int v6; // w9
char *v7; // x0
char *v8; // x20
char *v9; // x0
char *v10; // x8
char *v11; // x10
void *v12; // [xsp+8h] [xbp-18h] BYREF
v2 = off_10085DED0(1u, 0x20u);
v3 = *a1;
*(_QWORD *)(*a1 + 536) = v2;
if ( !v2 )
return 27;
result = sub_10056123C(v3, *(char **)(v3 + 35584), 0, &v12, nullptr, 1);
if ( !(_DWORD)result )
{
v5 = (const char *)v12;
v6 = *(unsigned __int8 *)v12;
if ( v6 == 47 || v6 == 92 )
v5 = (char *)v12 + 1;
v7 = off_10085DEC8(v5);
v8 = v7;
v2[1] = v7;
if ( v7 )
{
v9 = strchr(v7, 47);
if ( v9 || (v9 = strchr(v8, 92)) != nullptr )
{
*v9 = 0;
v10 = v9 + 1;
v2[2] = v9 + 1;
while ( *v10 )
{
if ( *v10 == 47 )
*v10 = 92;
v11 = v9 + 2;
v9 = v10;
v10 = v11;
}
off_10085DEB8(v12);
return 0;
}
else
{
off_10085DEB8(v12);
return 3;
}
}
else
{
off_10085DEB8(v12);
return 27;
}
}
return result;
}