//
// s2i_ASN1_INTEGER from 0xa71c18 to 0xa71dc8 (432 bytes)
//
// 9 xrefs:
// > sub_A67680 @ 0xa6775c
// > sub_A67680 @ 0xa67770
// > sub_A69710 @ 0xa69b50
// > SXNET_add_id_asc @ 0xa706d0
// > SXNET_get_id_asc @ 0xa70824
// > X509V3_get_value_int @ 0xa72054
// > sub_A79B7C @ 0xa7a17c
// > sub_AD977C @ 0xad9780
// > ??> @ 0x8258c
//
// 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:42 +0000
//
int __fastcall s2i_ASN1_INTEGER(int a1, unsigned __int8 *a2)
{
int v2; // r5
unsigned __int8 *v3; // r4
int v4; // r3
int v5; // r0
int v6; // r4
int v8; // r4
int **v9; // [sp+Ch] [bp-4h] BYREF
v2 = 0;
v3 = a2;
v9 = nullptr;
if ( a2 )
{
v9 = (int **)BN_new();
if ( v9 )
{
v4 = *v3;
if ( v4 == 45 )
{
v4 = v3[1];
v2 = 1;
++v3;
}
if ( v4 == 48 && (v3[1] & 0xDF) == 0x58 )
{
v3 += 2;
v5 = BN_hex2bn(&v9, v3);
}
else
{
v5 = BN_dec2bn(&v9, v3);
}
if ( !v5 || v3[v5] )
{
BN_free((int)v9);
ERR_put_error(34, 108, 100, (int)"crypto/x509v3/v3_utl.c", 159);
return 0;
}
else
{
if ( !v2 || BN_is_zero((int)v9) )
{
v6 = BN_to_ASN1_INTEGER(v9, 0);
BN_free((int)v9);
if ( v6 )
return v6;
}
else
{
v8 = BN_to_ASN1_INTEGER(v9, 0);
BN_free((int)v9);
if ( v8 )
{
*(_DWORD *)(v8 + 4) |= 0x100u;
return v8;
}
}
ERR_put_error(34, 108, 101, (int)"crypto/x509v3/v3_utl.c", 170);
return 0;
}
}
else
{
ERR_put_error(34, 108, 65, (int)"crypto/x509v3/v3_utl.c", 137);
return 0;
}
}
else
{
ERR_put_error(34, 108, 109, (int)"crypto/x509v3/v3_utl.c", 132);
return 0;
}
}