//
// BIO_parse_hostserv from 0xd72050 to 0xd72280 (560 bytes)
//
// 3 xrefs:
// > BIO_get_accept_socket @ 0xd74e68
// > sub_D777D0 @ 0xd77a88
// > ??> @ 0xadc10
//
// 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
//
__int64 __fastcall BIO_parse_hostserv(const char *a1, __int64 *a2, __int64 *a3, int a4)
{
const char *v4; // x19
char *v7; // x20
char *v8; // x0
const char *v10; // x21
size_t v11; // x20
size_t v12; // x24
char *v13; // x0
__int64 v14; // x0
__int64 v15; // x0
v4 = a1;
if ( *a1 != 91 )
{
v7 = strrchr(a1, 58);
v8 = strchr(v4, 58);
if ( v8 != v7 )
{
ERR_put_error(32, 136, 129, "crypto/bio/b_addr.c", 544);
return 0;
}
if ( v8 )
{
v10 = v8 + 1;
v11 = v8 - v4;
v12 = strlen(v8 + 1);
goto LABEL_7;
}
if ( a4 )
{
v10 = v4;
v12 = strlen(v4);
goto LABEL_21;
}
v11 = strlen(v4);
LABEL_11:
if ( !v4 || !a2 )
return 1;
v12 = 0;
v10 = nullptr;
if ( !v11 )
goto LABEL_20;
goto LABEL_14;
}
v13 = strchr(a1, 93);
if ( !v13 )
goto LABEL_8;
++v4;
v11 = v13 - v4;
if ( !v13[1] )
goto LABEL_11;
if ( v13[1] != 58 )
goto LABEL_8;
v10 = v13 + 2;
v12 = strlen(v13 + 2);
LABEL_7:
if ( strchr(v10, 58) )
{
LABEL_8:
ERR_put_error(32, 136, 130, "crypto/bio/b_addr.c", 547);
return 0;
}
if ( !v4 || !a2 )
goto LABEL_21;
if ( !v11 )
{
LABEL_20:
*a2 = 0;
goto LABEL_21;
}
LABEL_14:
if ( v11 == 1 && *v4 == 42 )
goto LABEL_20;
v14 = CRYPTO_strndup(v4, v11, "crypto/bio/b_addr.c", 526);
*a2 = v14;
if ( !v14 )
goto LABEL_17;
LABEL_21:
if ( v10 && a3 )
{
if ( v12 && (v12 != 1 || *v10 != 42) )
{
v15 = CRYPTO_strndup(v10, v12, "crypto/bio/b_addr.c", 536);
*a3 = v15;
if ( v15 )
return 1;
LABEL_17:
ERR_put_error(32, 136, 65, "crypto/bio/b_addr.c", 550);
return 0;
}
*a3 = 0;
}
return 1;
}