//
// BIO_parse_hostserv from 0x7cc004 to 0x7cc234 (560 bytes)
//
// 3 xrefs:
// > BIO_get_accept_socket @ 0x7cefe8
// > sub_7D1934 @ 0x7d1bd8
// > ??> @ 0x5f47c
//
// 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_parse_hostserv(const char *a1, int *a2, int *a3, int a4)
{
const char *v4; // r4
char *v8; // r5
char *v9; // r0
const char *v11; // r6
size_t v12; // r5
size_t v13; // r9
char *v14; // r0
bool v15; // zf
int v16; // r0
bool v17; // zf
bool v18; // zf
int v19; // r0
v4 = a1;
if ( *a1 != 91 )
{
v8 = strrchr(a1, 58);
v9 = strchr(v4, 58);
if ( v9 != v8 )
{
ERR_put_error(32, 136, 129, "crypto/bio/b_addr.c", 544);
return 0;
}
if ( v9 )
{
v11 = v9 + 1;
v12 = v9 - v4;
v13 = strlen(v9 + 1);
goto LABEL_6;
}
if ( a4 )
{
v11 = v4;
v13 = strlen(v4);
goto LABEL_25;
}
v12 = strlen(v4);
LABEL_10:
v15 = v4 == nullptr;
if ( v4 )
v15 = a2 == nullptr;
if ( v15 )
return 1;
v13 = 0;
v11 = nullptr;
goto LABEL_14;
}
v14 = strchr(a1, 93);
if ( !v14 )
goto LABEL_7;
++v4;
v12 = v14 - v4;
if ( !v14[1] )
goto LABEL_10;
if ( v14[1] != 58 )
goto LABEL_7;
v11 = v14 + 2;
v13 = strlen(v14 + 2);
LABEL_6:
if ( strchr(v11, 58) )
{
LABEL_7:
ERR_put_error(32, 136, 130, "crypto/bio/b_addr.c", 547);
return 0;
}
v17 = v4 == nullptr;
if ( v4 )
v17 = a2 == nullptr;
if ( !v17 )
{
LABEL_14:
if ( !v12 || v12 == 1 && *v4 == 42 )
{
*a2 = 0;
}
else
{
v16 = CRYPTO_strndup(v4, v12, "crypto/bio/b_addr.c", 526);
*a2 = v16;
if ( !v16 )
{
LABEL_18:
ERR_put_error(32, 136, 65, "crypto/bio/b_addr.c", 550);
return 0;
}
}
}
LABEL_25:
v18 = v11 == nullptr;
if ( v11 )
v18 = a3 == nullptr;
if ( !v18 )
{
if ( !v13 || v13 == 1 && *v11 == 42 )
{
*a3 = 0;
}
else
{
v19 = CRYPTO_strndup(v11, v13, "crypto/bio/b_addr.c", 536);
*a3 = v19;
if ( !v19 )
goto LABEL_18;
}
}
return 1;
}