//
// sub_100580E68 from 0x100580e68 to 0x10058108c (548 bytes)
//
// 2 xrefs:
// > sub_1005834D0 @ 0x100585568
// > sub_1005834D0 @ 0x1005856dc
//
// 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
//
bool __fastcall sub_100580E68(const char *a1, const char *a2)
{
_BOOL8 v3; // x21
char *v4; // x19
const char *v5; // x0
char *v6; // x20
size_t v7; // x8
size_t v8; // x8
char *v9; // x21
char *v10; // x0
unsigned __int8 *v11; // x22
char *v12; // x0
bool v13; // zf
_BOOL4 v14; // w0
char *v16; // x23
__int64 v17; // [xsp+10h] [xbp-50h] BYREF
_BYTE v18[8]; // [xsp+28h] [xbp-38h] BYREF
v3 = 0;
if ( a1 && a2 && *a1 )
{
if ( *a2 )
{
v4 = off_10085DEC8(a1);
if ( v4 )
{
v5 = off_10085DEC8(a2);
v6 = (char *)v5;
if ( !v5 )
{
v3 = 0;
LABEL_28:
off_10085DEB8(v4);
return v3;
}
v7 = strlen(v5) - 1;
if ( v6[v7] == 46 )
v6[v7] = 0;
v8 = strlen(v4) - 1;
if ( v4[v8] == 46 )
v4[v8] = 0;
v9 = strchr(v4, 42);
if ( !v9 )
goto LABEL_25;
if ( inet_pton(2, v6, v18) > 0 )
{
v3 = 0;
LABEL_27:
off_10085DEB8(v6);
goto LABEL_28;
}
if ( inet_pton(30, v6, &v17) > 0 )
{
v3 = 0;
goto LABEL_27;
}
v10 = strchr(v4, 46);
v11 = (unsigned __int8 *)v10;
if ( v10
&& ((v12 = strchr(v10 + 1, 46), v9 <= (char *)v11) ? (v13 = v12 == nullptr) : (v13 = 1),
!v13 && !sub_10057405C((unsigned __int8 *)v4, "xn--", 4)) )
{
v16 = strchr(v6, 46);
if ( !v16 )
{
v3 = 0;
goto LABEL_27;
}
if ( !sub_100573FB8(v11, v16) )
{
v3 = 0;
goto LABEL_27;
}
if ( v16 - v6 < v11 - (unsigned __int8 *)v4 )
{
v3 = 0;
goto LABEL_27;
}
if ( !sub_10057405C((unsigned __int8 *)v4, v6, v9 - v4) )
{
v3 = 0;
goto LABEL_27;
}
v14 = sub_10057405C(
(unsigned __int8 *)v9 + 1,
&v16[-(v11 - (unsigned __int8 *)(v9 + 1))],
v11 - (unsigned __int8 *)(v9 + 1));
}
else
{
LABEL_25:
v14 = sub_100573FB8((unsigned __int8 *)v4, v6);
}
v3 = v14;
goto LABEL_27;
}
return 0;
}
else
{
return 0;
}
}
return v3;
}