//
// BIO_connect from 0xff3644 to 0xff3818 (468 bytes)
//
// 4 xrefs:
// > sub_FF571C @ 0xff5890
// > sub_FF5F74 @ 0xff6128
// > sub_FF6400 @ 0xff65b4
// > ??> @ 0xd8910
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:47 +0000
//
__int64 __fastcall BIO_connect(int a1, unsigned __int16 *a2, char a3)
{
unsigned int should_retry; // w20
struct sockaddr *v7; // x0
socklen_t v8; // w0
unsigned int *v10; // x0
unsigned int *v11; // x0
unsigned int *v12; // x0
struct sockaddr *v13; // [xsp+38h] [xbp+38h]
int v14; // [xsp+4Ch] [xbp+4Ch] BYREF
v14 = 1;
if ( a1 != -1 )
{
if ( BIO_socket_nbio(a1) )
{
if ( (a3 & 4) != 0 && setsockopt(a1, 1, 9, &v14, 4u) )
{
v10 = (unsigned int *)__errno();
should_retry = 0;
ERR_put_error(2, 14, *v10, "crypto/bio/b_sock2.c", 91);
ERR_put_error(32, 138, 137, "crypto/bio/b_sock2.c", 92);
return should_retry;
}
if ( (a3 & 0x10) != 0 && setsockopt(a1, 6, 1, &v14, 4u) )
{
v11 = (unsigned int *)__errno();
should_retry = 0;
ERR_put_error(2, 14, *v11, "crypto/bio/b_sock2.c", 99);
ERR_put_error(32, 138, 138, "crypto/bio/b_sock2.c", 100);
return should_retry;
}
should_retry = 1;
BIO_ADDR_sockaddr();
v13 = v7;
v8 = BIO_ADDR_sockaddr_size(a2);
if ( connect(a1, v13, v8) != -1 )
return should_retry;
should_retry = BIO_sock_should_retry();
if ( !should_retry )
{
v12 = (unsigned int *)__errno();
ERR_put_error(2, 2, *v12, "crypto/bio/b_sock2.c", 108);
ERR_put_error(32, 138, 103, "crypto/bio/b_sock2.c", 109);
return should_retry;
}
}
return 0;
}
ERR_put_error(32, 138, 135, "crypto/bio/b_sock2.c", 82);
return 0;
}