//
// sub_D46798 from 0xd46798 to 0xd46878 (224 bytes)
//
// 1 xrefs:
// > SSL_CTX_flush_sessions @ 0xd472d0
//
// 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_D46798(__int64 result, _QWORD *a2)
{
__int64 v2; // x3
__int64 v3; // x19
_QWORD *v5; // x1
_QWORD *v6; // x0
_QWORD *v7; // x2
_QWORD *v8; // x3
void (*v9)(void); // x2
v2 = a2[1];
if ( !v2 || v2 > *(_QWORD *)(result + 200) + *(_QWORD *)(result + 192) )
{
v3 = result;
OPENSSL_LH_delete(a2[2], result);
v5 = *(_QWORD **)(v3 + 256);
v6 = (_QWORD *)*a2;
if ( v5 )
{
v7 = *(_QWORD **)(v3 + 248);
if ( v7 )
{
v8 = v6 + 6;
if ( v5 == v6 + 7 )
{
if ( v7 == v8 )
{
v6[6] = 0;
v6[7] = 0;
}
else
{
v6[7] = v7;
v7[32] = v5;
}
}
else if ( v7 == v8 )
{
v6[6] = v5;
v5[31] = v7;
}
else
{
v5[31] = v7;
*(_QWORD *)(*(_QWORD *)(v3 + 248) + 256LL) = v5;
}
*(_QWORD *)(v3 + 256) = 0;
*(_QWORD *)(v3 + 248) = 0;
v6 = (_QWORD *)*a2;
}
}
v9 = (void (*)(void))v6[11];
*(_DWORD *)(v3 + 144) = 1;
if ( v9 )
v9();
return SSL_SESSION_free(v3);
}
return result;
}