//
// s2i_ASN1_INTEGER from 0xe03914 to 0xe03abc (424 bytes)
//
// 9 xrefs:
// > sub_DF9DF0 @ 0xdf9f40
// > sub_DF9DF0 @ 0xdf9f50
// > sub_DFBBEC @ 0xdfc0ec
// > SXNET_add_id_asc @ 0xe0235c
// > SXNET_get_id_asc @ 0xe024dc
// > X509V3_get_value_int @ 0xe03cf0
// > sub_E0D194 @ 0xe0d5cc
// > sub_E704E0 @ 0xe704e4
// > ??> @ 0x693a8
//
// 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
//
__int64 __fastcall s2i_ASN1_INTEGER(__int64 a1, unsigned __int8 *a2)
{
unsigned __int8 *v2; // x19
int v3; // w0
int v4; // w20
int v5; // w0
__int64 v6; // x19
int v8; // w0
__int64 v9; // x19
__int64 v10; // [xsp+28h] [xbp+28h] BYREF
v2 = a2;
v10 = 0;
if ( !a2 )
{
ERR_put_error(34, 108, 109, (__int64)"crypto/x509v3/v3_utl.c", 132);
return 0;
}
v10 = BN_new();
if ( !v10 )
{
ERR_put_error(34, 108, 65, (__int64)"crypto/x509v3/v3_utl.c", 137);
return 0;
}
v3 = *v2;
v4 = 0;
if ( v3 == 45 )
{
v8 = v2[1];
v4 = 1;
++v2;
if ( v8 != 48 )
goto LABEL_5;
}
else if ( v3 != 48 )
{
goto LABEL_5;
}
if ( (v2[1] & 0xDF) == 0x58 )
{
v2 += 2;
v5 = BN_hex2bn(&v10, v2);
goto LABEL_6;
}
LABEL_5:
v5 = BN_dec2bn(&v10, v2);
LABEL_6:
if ( !v5 || v2[v5] )
{
BN_free(v10);
ERR_put_error(34, 108, 100, (__int64)"crypto/x509v3/v3_utl.c", 159);
return 0;
}
else
{
if ( !v4 || BN_is_zero(v10) )
{
v6 = BN_to_ASN1_INTEGER(v10, 0);
BN_free(v10);
if ( v6 )
return v6;
}
else
{
v9 = BN_to_ASN1_INTEGER(v10, 0);
BN_free(v10);
if ( v9 )
{
*(_DWORD *)(v9 + 4) |= 0x100u;
return v9;
}
}
ERR_put_error(34, 108, 101, (__int64)"crypto/x509v3/v3_utl.c", 170);
return 0;
}
}