//
// X509_check_host from 0x85df3c to 0x85e004 (200 bytes)
//
// 2 xrefs:
// > sub_8424C8 @ 0x842554
// > ??> @ 0x674bc
//
// 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
//
int __fastcall X509_check_host(int a1, char *a2, unsigned int a3, __int16 a4, unsigned __int8 **a5)
{
unsigned int v7; // r4
size_t v9; // r0
unsigned int v10; // r2
unsigned int v12; // r6
if ( a2 )
{
v7 = a3;
if ( !a3 )
{
v9 = strlen(a2);
v7 = v9;
if ( v9 > 1 )
{
v10 = v9 - 1;
goto LABEL_6;
}
return sub_85C3A0(a1, a2, v7, a4, 2, a5);
}
if ( a3 <= 1 )
{
if ( !memchr(a2, 0, 1u) )
{
v7 = 1;
return sub_85C3A0(a1, a2, v7, a4, 2, a5);
}
}
else
{
v12 = a3 - 1;
if ( !memchr(a2, 0, a3 - 1) )
{
v10 = v12;
LABEL_6:
if ( !a2[v10] )
v7 = v10;
return sub_85C3A0(a1, a2, v7, a4, 2, a5);
}
}
}
return -2;
}