//
// OPENSSL_sk_find_ex from 0x838c6c to 0x838d28 (188 bytes)
//
// 1 xrefs:
// > ??> @ 0x667fc
//
// 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 OPENSSL_sk_find_ex(int a1, int a2)
{
int v3; // r0
int result; // r0
int v5; // r12
_DWORD *v6; // r2
int v7; // t1
int v8; // [sp+Ch] [bp-4h] BYREF
v8 = a2;
if ( !a1 )
return -1;
if ( !*(_DWORD *)(a1 + 16) )
{
v5 = *(_DWORD *)a1;
if ( *(int *)a1 > 0 )
{
v6 = *(_DWORD **)(a1 + 4);
if ( a2 == *v6 )
return *(_DWORD *)(a1 + 16);
result = *(_DWORD *)(a1 + 16);
while ( ++result != v5 )
{
v7 = v6[1];
++v6;
if ( a2 == v7 )
return result;
}
}
return -1;
}
OPENSSL_sk_sort(a1);
if ( !v8 )
return -1;
v3 = OBJ_bsearch_ex_((int)&v8, *(_DWORD *)(a1 + 4), *(_DWORD *)a1, 4, *(int (__fastcall **)(int, int))(a1 + 16), 1);
if ( !v3 )
return -1;
return (v3 - *(_DWORD *)(a1 + 4)) >> 2;
}