//
// OCSP_url_svcloc_new from 0x81e768 to 0x81e8b0 (328 bytes)
//
// 1 xrefs:
// > ??> @ 0x64c2c
//
// 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 OCSP_url_svcloc_new(int a1, const char **a2)
{
_DWORD *v4; // r7
int v5; // r0
int v6; // r0
char **v7; // r0
signed int *v8; // r0
int v9; // r4
const char *v10; // t1
char **v11; // r3
char ***v12; // r5
int v13; // r6
v4 = OCSP_SERVICELOC_new();
if ( v4 )
{
v5 = X509_NAME_dup(a1);
*v4 = v5;
if ( v5 )
{
if ( !a2 || !*a2 )
goto LABEL_20;
v6 = OPENSSL_sk_new_null(v5);
v4[1] = v6;
if ( v6 )
{
if ( !*a2 )
{
LABEL_20:
v12 = nullptr;
v9 = 0;
v13 = X509V3_EXT_i2d(371, 0, v4);
goto LABEL_19;
}
while ( 1 )
{
v12 = (char ***)ACCESS_DESCRIPTION_new();
if ( !v12 )
break;
v7 = OBJ_nid2obj(0xB2u);
*v12 = v7;
if ( !v7 || (v7 = (char **)GENERAL_NAME_new(), (v12[1] = v7) == nullptr) )
{
LABEL_17:
v9 = (int)v7;
LABEL_18:
v13 = v9;
goto LABEL_19;
}
v8 = (signed int *)ASN1_IA5STRING_new();
v9 = (int)v8;
if ( !v8 )
goto LABEL_18;
v10 = *a2++;
if ( !ASN1_STRING_set(v8, v10, -1) )
{
v13 = 0;
goto LABEL_19;
}
v11 = v12[1];
v11[1] = (char *)v9;
*v11 = &byte_6;
v7 = (char **)OPENSSL_sk_push(v4[1], v12);
if ( !v7 )
goto LABEL_17;
if ( !a2 || !*a2 )
goto LABEL_20;
}
}
}
}
v12 = nullptr;
v9 = 0;
v13 = 0;
LABEL_19:
ASN1_IA5STRING_free(v9);
ACCESS_DESCRIPTION_free(v12);
OCSP_SERVICELOC_free(v4);
return v13;
}