//
// BN_mod_lshift_quick from 0x1097d70 to 0x1097e6c (252 bytes)
//
// 4 xrefs:
// > ec_GFp_simple_dbl @ 0x1018114
// > ec_GFp_simple_dbl @ 0x1018188
// > BN_mod_lshift @ 0x1097eb4
// > ??> @ 0xfad80
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:17:24 +0000
//
__int64 __fastcall BN_mod_lshift_quick(unsigned __int64 *a1, __int64 a2, int a3, __int64 *a4)
{
int v7; // w19
int v8; // w19
if ( a1 != (unsigned __int64 *)a2 && !BN_copy(a1, a2) )
return 0;
while ( 1 )
{
if ( a3 <= 0 )
return 1;
v7 = BN_num_bits((__int64)a4);
v8 = v7 - BN_num_bits((__int64)a1);
if ( v8 < 0 )
break;
if ( v8 > a3 )
{
v8 = a3;
LABEL_13:
if ( !(unsigned int)BN_lshift((__int64)a1, (__int64 *)a1, v8) )
return 0;
a3 -= v8;
goto LABEL_9;
}
if ( v8 )
goto LABEL_13;
if ( !(unsigned int)BN_lshift1((__int64)a1, (__int64 *)a1) )
return 0;
--a3;
LABEL_9:
if ( (BN_cmp((__int64 *)a1, a4) & 0x80000000) == 0 && !(unsigned int)BN_sub((__int64)a1, (__int64)a1, (__int64)a4) )
return 0;
}
ERR_put_error(3, 119, 110, (__int64)"crypto/bn/bn_mod.c", 174);
return 0;
}