//
// RC2_encrypt from 0xdcfbcc to 0xdcfd00 (308 bytes)
//
// 7 xrefs:
// > RC2_cbc_encrypt @ 0xdcff68
// > RC2_cbc_encrypt @ 0xdd02b4
// > RC2_ecb_encrypt @ 0xdd04c8
// > RC2_cfb64_encrypt @ 0xdd0aa0
// > RC2_cfb64_encrypt @ 0xdd0b7c
// > RC2_ofb64_encrypt @ 0xdd0d2c
// > ??> @ 0x639d8
//
// 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
//
unsigned __int64 *__fastcall RC2_encrypt(unsigned __int64 *result, int *a2)
{
int v2; // w11
int *v3; // x10
int v4; // w5
int v5; // w9
int v6; // w8
int v7; // w12
unsigned __int64 v8; // x3
unsigned __int64 v9; // x2
unsigned __int16 v10; // w4
__int16 v11; // w3
__int16 v12; // w6
unsigned int v13; // w7
unsigned int v14; // w6
unsigned int v15; // w5
v2 = 5;
v3 = a2;
v4 = *a2;
LOWORD(v5) = *result;
LOWORD(v6) = result[1];
v7 = 3;
v8 = *result >> 16;
v9 = result[1] >> 16;
while ( 1 )
{
v10 = (v8 & ~(_WORD)v9) + (v9 & v6) + v5 + v4;
v11 = v8 + v3[1];
v12 = v6 + v3[2];
v3 += 4;
v5 = (2 * v10) | (v10 >> 15);
--v2;
v13 = (unsigned __int16)(v11 + (((2 * v10) | (v10 >> 15)) & v9) + (v6 & ~((2 * v10) | (v10 >> 15))));
LODWORD(v8) = (4 * v13) | (v13 >> 14);
v14 = (unsigned __int16)(v12
+ (((4 * v13) | (v13 >> 14)) & ((2 * v10) | (v10 >> 15)))
+ (v9 & ~((4 * v13) | (v13 >> 14))));
v6 = (8 * v14) | (v14 >> 13);
v15 = (unsigned __int16)(v9 + *(v3 - 1) + (v6 & ((4 * v13) | (v13 >> 14))) + (((2 * v10) | (v10 >> 15)) & ~(_WORD)v6));
LODWORD(v9) = (32 * v15) | (v15 >> 11);
if ( v2 )
goto LABEL_8;
if ( !--v7 )
break;
if ( v7 == 2 )
v2 = 6;
else
v2 = 5;
LOWORD(v5) = ((2 * v10) | (v10 >> 15)) + a2[v9 & 0x3F];
LODWORD(v8) = v8 + a2[v5 & 0x3F];
v6 += a2[v8 & 0x3F];
LODWORD(v9) = v9 + a2[v6 & 0x3F];
LABEL_8:
v4 = *v3;
}
*result = ((unsigned __int64)(unsigned __int16)v8 << 16) | (unsigned __int16)((2 * v10) | (v10 >> 15));
result[1] = ((unsigned __int64)(unsigned __int16)v9 << 16) | (unsigned __int16)v6;
return result;
}