//
// bn_sqr_words from 0x86a498 to 0x86a550 (184 bytes)
//
// 2 xrefs:
// > bn_sqr_normal @ 0x7d8408
// > ??> @ 0x5ff8c
//
// 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
//
_QWORD *__fastcall bn_sqr_words(_QWORD *result, unsigned int *a2, int a3)
{
unsigned int *v3; // r12
_QWORD *v4; // r3
unsigned __int64 v5; // r4
if ( a3 > 0 )
{
if ( (a3 & 0xFFFFFFFC) == 0 )
goto LABEL_6;
v3 = a2 + 4;
v4 = result + 4;
do
{
a3 -= 4;
*(v4 - 4) = *(v3 - 4) * (unsigned __int64)*(v3 - 4);
a2 = v3;
v5 = *(v3 - 3) * (unsigned __int64)*(v3 - 3);
v3 += 4;
*(v4 - 3) = v5;
result = v4;
*(v4 - 2) = *(v3 - 6) * (unsigned __int64)*(v3 - 6);
*(v4 - 1) = *(v3 - 5) * (unsigned __int64)*(v3 - 5);
v4 += 4;
}
while ( (a3 & 0xFFFFFFFC) != 0 );
if ( a3 )
{
LABEL_6:
*result = *a2 * (unsigned __int64)*a2;
if ( a3 != 1 )
{
result[1] = a2[1] * (unsigned __int64)a2[1];
if ( a3 != 2 )
result[2] = a2[2] * (unsigned __int64)a2[2];
}
}
}
return result;
}