//
// BN_GF2m_poly2arr from 0x8c9d40 to 0x8c9de0 (160 bytes)
//
// 8 xrefs:
// > ec_GF2m_simple_group_set_curve @ 0x889a50
// > BN_GF2m_mod @ 0x8c9e00
// > BN_GF2m_mod_mul @ 0x8ca2b8
// > BN_GF2m_mod_sqr @ 0x8ca424
// > BN_GF2m_mod_exp @ 0x8ca4fc
// > BN_GF2m_mod_sqrt @ 0x8ca5dc
// > BN_GF2m_mod_solve_quad @ 0x8ca6bc
// > ??> @ 0x6a8fc
//
// 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_GF2m_poly2arr(int **a1, int a2, int a3)
{
int result; // r0
int *v7; // r4
int *v8; // r2
int v9; // r12
int *v10; // r4
int v11; // r5
int v12; // lr
int v13; // t1
int v14; // r3
unsigned int v15; // r12
result = BN_is_zero((int)a1);
if ( result )
return 0;
v7 = a1[1];
if ( (int)v7 - 1 >= 0 )
{
v8 = *a1;
v9 = 32 * ((_DWORD)v7 - 1);
v10 = &(*a1)[(_DWORD)v7];
v11 = v9 - 1;
do
{
v13 = *--v10;
v12 = v13;
if ( v13 )
{
v14 = v11 + 32;
v15 = 0x80000000;
while ( 1 )
{
if ( (v12 & v15) != 0 )
{
if ( a3 > result )
*(_DWORD *)(a2 + 4 * result) = v14;
++result;
}
--v14;
v15 >>= 1;
if ( v14 == v11 )
break;
v12 = *v10;
}
}
v11 -= 32;
}
while ( v10 != v8 );
}
if ( a3 > result )
*(_DWORD *)(a2 + 4 * result++) = -1;
return result;
}