//
// SSL_set_bio from 0xd3f714 to 0xd3f7ec (216 bytes)
//
// 5 xrefs:
// > sub_BB78D0 @ 0xbb853c
// > sub_D2F9E8 @ 0xd2fb08
// > sub_D2F9E8 @ 0xd2fe3c
// > SSL_set_fd @ 0xd3f8ac
// > ??> @ 0x698e8
//
// 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 SSL_set_bio(__int64 a1, __int64 a2, __int64 a3)
{
bool v6; // zf
__int64 v7; // x0
__int64 result; // x0
__int64 rbio; // x22
if ( a2 != SSL_get_rbio(a1) || (result = SSL_get_wbio(a1), a3 != result) )
{
if ( a2 == a3 && a2 )
BIO_up_ref(a2);
v6 = a2 == SSL_get_rbio(a1);
v7 = a1;
if ( !v6 )
{
if ( a3 == SSL_get_wbio(a1) )
{
rbio = SSL_get_rbio(a1);
if ( rbio != SSL_get_wbio(a1) )
return SSL_set0_rbio(a1, a2);
}
SSL_set0_rbio(a1, a2);
v7 = a1;
}
return SSL_set0_wbio(v7, a3);
}
return result;
}