//
// BIO_get_port from 0x7cee50 to 0x7cef5c (268 bytes)
//
// 1 xrefs:
// > ??> @ 0x5f60c
//
// 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 BIO_get_port(const char *a1, _WORD *a2)
{
int v4; // r5
int v6; // r0
_WORD *v7; // r0
unsigned int v8; // r0
struct addrinfo *v9; // [sp+Ch] [bp-4h] BYREF
v9 = nullptr;
if ( a1 )
{
if ( BIO_sock_init() != 1 )
return 0;
v6 = BIO_lookup(nullptr, a1, 0, 2u, 1, &v9);
v4 = v6;
if ( v6 )
{
if ( BIO_ADDRINFO_family((int)v9) == 2 )
{
v7 = (_WORD *)BIO_ADDRINFO_address((int)v9);
v8 = BIO_ADDR_rawport(v7);
v4 = 1;
*a2 = (v8 >> 8) | ((_WORD)v8 << 8);
}
else
{
v4 = 0;
ERR_put_error(32, 107, 141, "crypto/bio/b_sock.c", 79);
}
BIO_ADDRINFO_free(v9);
}
else
{
ERR_add_error_data(2, "host=", a1);
}
return v4;
}
else
{
ERR_put_error(32, 107, 113, "crypto/bio/b_sock.c", 69);
return 0;
}
}