//
// sub_BB8FAC from 0xbb8fac to 0xbb904c (160 bytes)
//
// 1 xrefs:
// > sub_BBA814 @ 0xbba814
//
// 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_BB8FAC(__int64 a1, int a2)
{
__int64 v2; // x20
__int64 v4; // x21
__int64 v5; // x19
__int64 result; // x0
v2 = a2;
v4 = a1 + 40LL * a2 + 664;
if ( *(_QWORD *)(a1 + 40LL * a2 + 688) )
{
SSL_shutdown();
SSL_set_connect_state(*(_QWORD *)(v4 + 24));
SSL_free(*(_QWORD *)(v4 + 24));
*(_QWORD *)(v4 + 24) = 0;
}
if ( *(_QWORD *)(v4 + 16) )
{
SSL_CTX_free();
*(_QWORD *)(v4 + 16) = 0;
}
v5 = a1 + 40 * v2 + 744;
if ( *(_QWORD *)(v5 + 24) )
{
SSL_shutdown();
SSL_set_connect_state(*(_QWORD *)(v5 + 24));
SSL_free(*(_QWORD *)(v5 + 24));
*(_QWORD *)(v5 + 24) = 0;
}
result = *(_QWORD *)(v5 + 16);
if ( result )
{
result = SSL_CTX_free();
*(_QWORD *)(v5 + 16) = 0;
}
return result;
}