//
// BN_lshift from 0x7d80dc to 0x7d820c (304 bytes)
//
// 14 xrefs:
// > BN_MONT_CTX_set @ 0x7d5880
// > BN_div_word @ 0x7d8834
// > ec_GFp_simple_group_check_discriminant @ 0x7f3348
// > OBJ_obj2txt @ 0x81c9dc
// > BN_div @ 0x86c4c0
// > BN_div @ 0x86c4e4
// > BN_gcd @ 0x86f0d8
// > int_bn_mod_inverse @ 0x86f788
// > BN_mod_lshift_quick @ 0x87055c
// > dsa_builtin_paramgen @ 0x880390
// > dsa_builtin_paramgen @ 0x8807c0
// > dsa_builtin_paramgen2 @ 0x881078
// > dsa_builtin_paramgen2 @ 0x881304
// > ??> @ 0x5fdcc
//
// 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_lshift(_DWORD *a1, int *a2, int a3)
{
char v3; // r7
int v5; // r5
int v6; // r3
int v7; // r1
int result; // r0
_DWORD *v10; // r0
char v11; // r1
int v12; // r12
int v13; // lr
int v14; // r10
size_t v15; // r2
int *v16; // r3
int v17; // r12
unsigned int v18; // t1
int v19; // r7
int v20; // r3
_DWORD *v21; // r2
int v22; // r3
int v23; // t1
v3 = a3;
if ( a3 < 0 )
{
ERR_put_error(3, 145, 119, "crypto/bn/bn_shift.c", 91);
return 0;
}
v5 = a3 >> 5;
v6 = a2[3];
v7 = (a3 >> 5) + a2[1] + 1;
a1[3] = v6;
result = bn_wexpand((int)a1, v7);
if ( result )
{
v10 = (_DWORD *)*a1;
v11 = v3 & 0x1F;
v12 = *a2;
*(_DWORD *)(*a1 + 4 * (v5 + a2[1])) = 0;
if ( (v3 & 0x1F) != 0 )
{
v13 = a2[1];
if ( v13 - 1 >= 0 )
{
v14 = v10[v5 + v13];
v15 = 4 * v5;
v16 = &v10[v5 + v13];
v17 = v12 + 4 * v13;
do
{
v18 = *(_DWORD *)(v17 - 4);
v17 -= 4;
v19 = v14 | (v18 >> (32 - v11));
v14 = v18 << v11;
*v16 = v19;
*--v16 = v18 << v11;
}
while ( v16 != &v10[v5] );
goto LABEL_7;
}
}
else
{
v20 = a2[1];
if ( v20 - 1 >= 0 )
{
v21 = &v10[v5 - 1 + v20];
v22 = v12 + 4 * v20;
do
{
v23 = *(_DWORD *)(v22 - 4);
v22 -= 4;
*v21-- = v23;
}
while ( v22 != v12 );
}
}
v15 = 4 * v5;
LABEL_7:
memset(v10, 0, v15);
a1[1] = v5 + a2[1] + 1;
bn_correct_top(a1);
return 1;
}
return result;
}