//
// bn_sqr_words from 0xe13440 to 0xe13508 (200 bytes)
//
// 2 xrefs:
// > bn_sqr_normal @ 0xd7efec
// > ??> @ 0x6fe10
//
// 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 bn_sqr_words(__int64 result, unsigned __int64 *a2, int a3)
{
unsigned __int64 v3; // x3
if ( a3 > 0 )
{
if ( (a3 & 0xFFFFFFFC) == 0 )
goto LABEL_5;
do
{
v3 = *a2;
a2 += 4;
*(_QWORD *)(result + 8) = (v3 * (unsigned __int128)v3) >> 64;
result += 64;
*(_QWORD *)(result - 64) = v3 * v3;
a3 -= 4;
*(_OWORD *)(result - 48) = *(a2 - 3) * (unsigned __int128)*(a2 - 3);
*(_OWORD *)(result - 32) = *(a2 - 2) * (unsigned __int128)*(a2 - 2);
*(_OWORD *)(result - 16) = *(a2 - 1) * (unsigned __int128)*(a2 - 1);
}
while ( (a3 & 0xFFFFFFFC) != 0 );
if ( a3 )
{
LABEL_5:
*(_OWORD *)result = *a2 * (unsigned __int128)*a2;
if ( a3 != 1 )
{
*(_OWORD *)(result + 16) = a2[1] * (unsigned __int128)a2[1];
if ( a3 != 2 )
*(_OWORD *)(result + 32) = a2[2] * (unsigned __int128)a2[2];
}
}
}
return result;
}