//
// sub_790880 from 0x790880 to 0x790ab8 (568 bytes)
//
// 3 xrefs:
// > ssl_cert_new @ 0x790c64
// > ssl_cert_new @ 0x790c70
// > ??> @ 0x790d08
//
// 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 sub_790880(int a1, int a2, int a3, int a4, int a5, _DWORD *a6)
{
int result; // r0
int v10; // r1
int v11; // r2
bool v12; // zf
int v13; // r0
_BOOL4 v14; // r4
_BOOL4 v15; // r3
_BOOL4 v16; // r0
bool v17; // r3
int v18; // r0
if ( a2 )
result = SSL_CTX_get_security_level(a2);
else
result = SSL_get_security_level();
if ( result <= 0 )
{
v12 = a4 == 79;
if ( a4 <= 79 )
v12 = a3 == 262151;
v13 = v12;
return v13 ^ 1;
}
if ( result > 5 )
{
if ( a3 == 15 )
return 0;
if ( a3 <= 15 )
{
if ( a3 != 9 )
{
if ( a3 == 10 )
return 0;
goto LABEL_33;
}
result = 5;
goto LABEL_37;
}
if ( (unsigned int)(a3 - 65537) > 2 )
{
LABEL_33:
v10 = 256;
return a4 >= v10;
}
v10 = 256;
result = 5;
LABEL_16:
if ( a4 < v10 || (a6[4] & 4) != 0 )
return 0;
v11 = a6[6];
if ( (v11 & 1) != 0 )
return 0;
if ( v10 > 160 && (v11 & 2) != 0 )
return 0;
if ( result != 1 )
{
if ( a6[5] == 4 )
return 0;
return result == 2 || (a6[3] & 6) != 0;
}
return result;
}
v10 = *(_DWORD *)&a66666666666666[4 * result + 92];
if ( a3 == 15 )
return result == 1;
if ( a3 > 15 )
{
if ( (unsigned int)(a3 - 65537) > 2 )
return a4 >= v10;
goto LABEL_16;
}
if ( a3 != 9 )
{
if ( a3 == 10 )
return result <= 2;
return a4 >= v10;
}
LABEL_37:
if ( (*(_DWORD *)(*(_DWORD *)(*(_DWORD *)(a1 + 4) + 100) + 52) & 8) == 0 )
{
v14 = result > 1;
if ( a5 > 768 )
v14 = 0;
if ( !v14 )
{
v15 = result > 2;
if ( a5 > 769 )
v15 = 0;
if ( !v15 )
{
v16 = result > 3;
if ( a5 > 770 )
v16 = 0;
return !v16;
}
return 0;
}
return 0;
}
v17 = a5 == 256;
if ( a5 > 65277 )
v17 = 1;
v18 = result > 3 && v17;
return v18 ^ 1;
}