//
// sub_857F64 from 0x857f64 to 0x858098 (308 bytes)
//
// 4 xrefs:
// > NAME_CONSTRAINTS_check @ 0x8582c4
// > NAME_CONSTRAINTS_check @ 0x858308
// > NAME_CONSTRAINTS_check @ 0x85834c
// > NAME_CONSTRAINTS_check_CN @ 0x858434
//
// 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 sub_857F64(_DWORD *a1, int *a2)
{
int v2; // r7
signed int i; // r4
int v6; // r0
int result; // r0
signed int v8; // r4
int v9; // r0
unsigned int v10; // r1
int v12; // r0
v2 = 0;
for ( i = 0; i < OPENSSL_sk_num(*a2); ++i )
{
v6 = OPENSSL_sk_value((_DWORD *)*a2, i);
if ( *a1 == **(_DWORD **)v6 )
{
if ( *(_DWORD *)(v6 + 4) || *(_DWORD *)(v6 + 8) )
return 49;
if ( v2 == 2 )
goto LABEL_13;
result = sub_857C1C((int)a1, *(_DWORD **)v6);
if ( !v2 )
v2 = 1;
if ( !result )
{
LABEL_13:
v2 = 2;
}
else if ( result != 47 )
{
return result;
}
}
}
if ( v2 == 1 )
return 47;
v8 = 0;
while ( 1 )
{
do
{
v9 = OPENSSL_sk_num(a2[1]);
v10 = v8;
if ( v8++ >= v9 )
return 0;
v12 = OPENSSL_sk_value((_DWORD *)a2[1], v10);
}
while ( *a1 != **(_DWORD **)v12 );
if ( *(_DWORD *)(v12 + 4) || *(_DWORD *)(v12 + 8) )
return 49;
result = sub_857C1C((int)a1, *(_DWORD **)v12);
if ( !result )
break;
if ( result != 47 )
return result;
}
return 48;
}