//
// RC2_ecb_encrypt from 0xdd0414 to 0xdd04d0 (188 bytes)
//
// 2 xrefs:
// > sub_DA825C @ 0xda82c8
// > ??> @ 0x74e08
//
// 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_ecb_encrypt(unsigned __int8 *a1, _BYTE *a2, int *a3, int a4)
{
__int64 v5; // x9
unsigned __int64 v6; // x11
__int64 v7; // x7
__int64 v8; // x4
int v9; // w1
unsigned __int64 v10; // x0
unsigned __int64 v11; // x3
unsigned __int64 v12; // x2
unsigned __int64 result; // x0
unsigned __int64 v14; // [xsp+20h] [xbp+20h] BYREF
unsigned __int64 v15; // [xsp+28h] [xbp+28h]
v5 = a1[5];
v6 = (unsigned __int64)a1[6] << 16;
v7 = a1[4];
v8 = a1[7];
v14 = ((unsigned __int64)a1[2] << 16) | ((unsigned __int64)a1[1] << 8) | *a1 | ((unsigned __int64)a1[3] << 24);
v15 = v6 | (v5 << 8) | v7 | (v8 << 24);
if ( a4 )
RC2_encrypt(&v14, a3);
else
RC2_decrypt(&v14, (__int64)a3);
v9 = v14;
v10 = v15;
*a2 = v14;
a2[4] = v10;
v11 = v10 >> 8;
v12 = v10 >> 16;
a2[1] = BYTE1(v9);
a2[2] = BYTE2(v9);
result = v10 >> 24;
a2[3] = HIBYTE(v9);
a2[5] = v11;
a2[6] = v12;
a2[7] = result;
return result;
}