//
// BN_mask_bits from 0x9e9e68 to 0x9e9ec4 (92 bytes)
//
// 3 xrefs:
// > dsa_builtin_paramgen @ 0xa95408
// > dsa_builtin_paramgen2 @ 0xa95f48
// > ??> @ 0x7975c
//
// 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:07:26 +0000
//
int __fastcall BN_mask_bits(int *a1, int a2)
{
int v2; // r12
int v3; // r3
bool v4; // zf
int v5; // r1
if ( a2 < 0 )
return 0;
v3 = a2 >> 5;
if ( a2 >> 5 >= a1[1] )
return 0;
v5 = a2 & 0x1F;
v4 = v5 == 0;
if ( v5 )
{
v2 = *a1;
a1[1] = v3 + 1;
v5 = *(_DWORD *)(v2 + 4 * v3) & ~(-1 << v5);
}
else
{
a1[1] = v3;
}
if ( !v4 )
*(_DWORD *)(v2 + 4 * v3) = v5;
bn_correct_top(a1);
return 1;
}