//
// X509_cmp from 0xa533b8 to 0xa5344c (148 bytes)
//
// 8 xrefs:
// > ssl_cert_select_current @ 0x9a60dc
// > X509_OBJECT_retrieve_match @ 0xa54bb4
// > sub_A56A08 @ 0xa56a6c
// > sub_A572AC @ 0xa5742c
// > sub_A589E0 @ 0xa58e44
// > sub_A5AEB8 @ 0xa5b264
// > CMS_add0_cert @ 0xa8a4e8
// > ??> @ 0x74cbc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:08:24 +0000
//
int __fastcall X509_cmp(int a1, int a2)
{
int v4; // r3
int result; // r0
signed int v6; // r2
signed int v7; // r3
X509_check_purpose(a1, -1, 0);
X509_check_purpose(a2, -1, 0);
v4 = memcmp((const void *)(a1 + 160), (const void *)(a2 + 160), 0x14u);
if ( v4 )
return v4;
result = *(_DWORD *)(a1 + 68);
if ( result )
return v4;
if ( !*(_DWORD *)(a2 + 68) )
{
v6 = *(_DWORD *)(a1 + 64);
v7 = *(_DWORD *)(a2 + 64);
if ( v6 < v7 )
{
return -1;
}
else if ( v6 <= v7 )
{
return memcmp(*(const void **)(a1 + 60), *(const void **)(a2 + 60), v6);
}
else
{
return 1;
}
}
return result;
}