//
// BN_set_bit from 0x7d4f4c to 0x7d4fe0 (148 bytes)
//
// 14 xrefs:
// > BN_MONT_CTX_set @ 0x7d5810
// > BN_MONT_CTX_set @ 0x7d5928
// > EC_GROUP_new_from_ecparameters @ 0x7e6be8
// > EC_GROUP_new_from_ecparameters @ 0x7e6c3c
// > EC_GROUP_new_from_ecparameters @ 0x7e6c58
// > EC_GROUP_new_from_ecparameters @ 0x7e6c6c
// > EC_GROUP_new_from_ecparameters @ 0x7e6c80
// > EC_GROUP_new_from_ecparameters @ 0x7e6c94
// > EC_GROUP_new_from_ecparameters @ 0x7e6ef4
// > EC_GROUP_new_from_ecparameters @ 0x7e6f08
// > BN_reciprocal @ 0x87130c
// > BN_GF2m_mod_sqrt_arr @ 0x8c994c
// > BN_GF2m_arr2poly @ 0x8ca770
// > ??> @ 0x5fc9c
//
// 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 BN_set_bit(int *a1, int a2)
{
int v2; // r6
char v3; // r5
int v4; // r7
int v7; // r0
if ( a2 < 0 )
return 0;
v2 = a2 >> 5;
v3 = a2 & 0x1F;
if ( a2 >> 5 < a1[1] )
{
v4 = *a1;
LABEL_4:
*(_DWORD *)(v4 + 4 * v2) |= 1 << v3;
return 1;
}
if ( bn_wexpand((int)a1, v2 + 1) )
{
v7 = a1[1];
v4 = *a1;
if ( v2 >= v7 )
memset((void *)(*a1 + 4 * v7), 0, 4 * (1 - v7 + v2));
a1[1] = v2 + 1;
goto LABEL_4;
}
return 0;
}