//
// sub_9E077C from 0x9e077c to 0x9e0a34 (696 bytes)
//
// 2 xrefs:
// > BIO_ADDR_service_string @ 0x9e0aa0
// > BIO_ADDR_hostname_string @ 0x9e0af8
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:20 +0000
//
int __fastcall sub_9E077C(unsigned __int16 *a1, int a2, int *a3, int *a4)
{
const struct sockaddr *v8; // r0
int v9; // r10
const struct sockaddr *v10; // r11
socklen_t v11; // r0
int v12; // r0
int v13; // r10
const char *v14; // r0
int v15; // r2
int v17; // r0
int v18; // r0
int v19; // r4
unsigned int v20; // r0
_DWORD *v21; // r0
_DWORD v22[8]; // [sp+14h] [bp-428h] BYREF
_DWORD v23[258]; // [sp+34h] [bp-408h] BYREF
memset(v23, 0, 1025);
memset(v22, 0, sizeof(v22));
BIO_ADDR_sockaddr();
if ( a2 )
v9 = 10;
else
v9 = 0;
v10 = v8;
v11 = BIO_ADDR_sockaddr_size(a1);
v12 = getnameinfo(v10, v11, (char *)v23, 0x401u, (char *)v22, 0x20u, v9);
v13 = v12;
if ( v12 )
{
if ( v12 == 11 )
{
v21 = (_DWORD *)_errno();
ERR_put_error(2, 13, *v21, "crypto/bio/b_addr.c", 210);
ERR_put_error(32, 134, 2, "crypto/bio/b_addr.c", 211);
}
else
{
ERR_put_error(32, 134, 2, "crypto/bio/b_addr.c", 215);
v14 = gai_strerror(v13);
ERR_add_error_data(1, v14, v15);
}
return 0;
}
if ( LOBYTE(v22[0]) )
{
if ( a3 )
{
LABEL_10:
v17 = CRYPTO_strdup(v23, "crypto/bio/b_addr.c", 233);
*a3 = v17;
if ( !a4 )
{
if ( v17 )
return 1;
CRYPTO_free(0, "crypto/bio/b_addr.c", 250);
*a3 = 0;
LABEL_16:
ERR_put_error(32, 134, 65, "crypto/bio/b_addr.c", 257);
return 0;
}
v18 = CRYPTO_strdup(v22, "crypto/bio/b_addr.c", 235);
*a4 = v18;
if ( !*a3 )
{
CRYPTO_free(0, "crypto/bio/b_addr.c", 250);
*a3 = 0;
goto LABEL_14;
}
v19 = v18;
LABEL_19:
if ( v19 )
return 1;
if ( !a3 )
goto LABEL_15;
CRYPTO_free(*a3, "crypto/bio/b_addr.c", 250);
*a3 = 0;
LABEL_14:
v19 = *a4;
LABEL_15:
CRYPTO_free(v19, "crypto/bio/b_addr.c", 254);
*a4 = 0;
goto LABEL_16;
}
}
else
{
v20 = BIO_ADDR_rawport(a1);
BIO_snprintf(v22, 32, "%d", (unsigned __int16)(v20 >> 8) | (unsigned __int16)((_WORD)v20 << 8));
if ( a3 )
goto LABEL_10;
}
if ( a4 )
{
v19 = CRYPTO_strdup(v22, "crypto/bio/b_addr.c", 235);
*a4 = v19;
goto LABEL_19;
}
return 1;
}