//
// sub_107CE58 from 0x107ce58 to 0x107cfb8 (352 bytes)
//
// 4 xrefs:
// > NAME_CONSTRAINTS_check @ 0x107d214
// > NAME_CONSTRAINTS_check @ 0x107d250
// > NAME_CONSTRAINTS_check @ 0x107d290
// > NAME_CONSTRAINTS_check_CN @ 0x107d398
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:17:08 +0000
//
__int64 __fastcall sub_107CE58(_DWORD *a1, unsigned int **a2)
{
int v4; // w22
int v5; // w19
int v6; // w0
int v7; // w1
__int64 *v8; // x0
int v9; // w0
int v10; // w19
__int64 result; // x0
bool v12; // cc
int v13; // w1
__int64 *v14; // x0
v4 = 0;
v5 = 0;
v6 = OPENSSL_sk_num(*a2);
v7 = 0;
if ( v6 > 0 )
{
do
{
v8 = (__int64 *)OPENSSL_sk_value((__int64)*a2, v7);
if ( *a1 == *(_DWORD *)*v8 )
{
if ( v8[1] || v8[2] )
return 49;
if ( v4 == 2 )
goto LABEL_22;
if ( !v4 )
v4 = 1;
result = sub_107CABC((__int64)a1, *v8);
if ( !(_DWORD)result )
{
LABEL_22:
v4 = 2;
++v5;
}
else
{
if ( (_DWORD)result != 47 )
return result;
++v5;
}
}
else
{
++v5;
}
v9 = OPENSSL_sk_num(*a2);
v7 = v5;
}
while ( v5 < v9 );
}
v10 = 0;
result = 47;
if ( v4 != 1 )
{
while ( 1 )
{
do
{
v12 = v10 < (int)OPENSSL_sk_num(a2[1]);
v13 = v10++;
if ( !v12 )
return 0;
v14 = (__int64 *)OPENSSL_sk_value((__int64)a2[1], v13);
}
while ( *a1 != *(_DWORD *)*v14 );
if ( v14[1] || v14[2] )
return 49;
result = sub_107CABC((__int64)a1, *v14);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result != 47 )
return result;
}
return 48;
}
return result;
}