//
// bn_sqr_normal from 0x9ecf50 to 0x9ed028 (216 bytes)
//
// 4 xrefs:
// > bn_sqr_recursive @ 0x9ed1a4
// > BN_sqr @ 0x9ed294
// > BN_sqr @ 0x9ed318
// > ??> @ 0x799fc
//
// 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:27 +0000
//
int __fastcall bn_sqr_normal(_DWORD *a1, int *a2, int a3, int a4)
{
int v5; // r9
_DWORD *v8; // r5
int *v9; // r6
int v10; // r4
_DWORD *v11; // r11
int v12; // t1
int v13; // r0
v5 = 2 * a3;
a1[2 * a3 - 1] = 0;
*a1 = 0;
v8 = a1 + 1;
if ( a3 - 1 > 0 )
{
v9 = a2 + 1;
v8[a3 - 1] = bn_mul_words(a1 + 1, a2 + 1, a3 - 1, *a2);
v8 = a1 + 3;
}
else
{
v9 = a2;
}
v10 = a3 - 2;
if ( a3 - 2 > 0 )
{
v11 = &v8[a3 - 3];
do
{
v12 = *v9++;
v13 = bn_mul_add_words(v8, v9, v10--, v12);
v8 += 2;
v11[1] = v13;
++v11;
}
while ( v10 );
}
bn_add_words(a1, a1, a1, v5);
bn_sqr_words(a4, a2, a3);
return bn_add_words(a1, a1, a4, v5);
}