//
// SSL_set_bio from 0x7967a0 to 0x796860 (192 bytes)
//
// 5 xrefs:
// > sub_643938 @ 0x64426a
// > sub_785EB0 @ 0x786248
// > sub_785EB0 @ 0x786278
// > SSL_set_fd @ 0x796920
// > ??> @ 0x5533c
//
// 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 SSL_set_bio(int a1, int a2, int a3)
{
_BOOL4 v6; // r3
bool v7; // zf
int v8; // r0
int result; // r0
int rbio; // r7
if ( a2 != SSL_get_rbio(a1) || (result = SSL_get_wbio(a1), a3 != result) )
{
v6 = a2 == a3;
if ( !a2 )
v6 = 0;
if ( v6 )
BIO_up_ref(a2);
v7 = a2 == SSL_get_rbio(a1);
v8 = a1;
if ( !v7 )
{
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);
v8 = a1;
}
return SSL_set0_wbio(v8, a3);
}
return result;
}