//
// X509_check_email from 0x85e004 to 0x85e0cc (200 bytes)
//
// 2 xrefs:
// > sub_8424C8 @ 0x842578
// > ??> @ 0x674cc
//
// 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_email(int a1, char *a2, unsigned int a3, __int16 a4)
{
unsigned int v6; // r4
size_t v8; // r0
unsigned int v9; // r2
unsigned int v11; // r6
if ( a2 )
{
v6 = a3;
if ( !a3 )
{
v8 = strlen(a2);
v6 = v8;
if ( v8 > 1 )
{
v9 = v8 - 1;
goto LABEL_6;
}
return sub_85C3A0(a1, a2, v6, a4, 1, nullptr);
}
if ( a3 <= 1 )
{
if ( !memchr(a2, 0, 1u) )
{
v6 = 1;
return sub_85C3A0(a1, a2, v6, a4, 1, nullptr);
}
}
else
{
v11 = a3 - 1;
if ( !memchr(a2, 0, a3 - 1) )
{
v9 = v11;
LABEL_6:
if ( !a2[v9] )
v6 = v9;
return sub_85C3A0(a1, a2, v6, a4, 1, nullptr);
}
}
}
return -2;
}