//
// RC2_encrypt from 0xa3f064 to 0xa3f19c (312 bytes)
//
// 7 xrefs:
// > RC2_cbc_encrypt @ 0xa3f3e8
// > RC2_cbc_encrypt @ 0xa3f81c
// > RC2_ecb_encrypt @ 0xa3f99c
// > RC2_cfb64_encrypt @ 0xa3fc20
// > RC2_cfb64_encrypt @ 0xa3fd1c
// > RC2_ofb64_encrypt @ 0xa3fe54
// > ??> @ 0x7fb4c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:08:12 +0000
//
int *__fastcall RC2_encrypt(int *result, _DWORD *a2)
{
unsigned int v2; // r8
int v3; // lr
unsigned int v4; // r4
unsigned int v5; // r3
int v6; // r12
_DWORD *v7; // r5
int v8; // r7
int v9; // r6
int v10; // t1
unsigned int v11; // lr
unsigned int v12; // r4
unsigned int v13; // r3
v2 = (unsigned __int16)result[1];
v3 = (unsigned __int16)*result;
v4 = HIWORD(*result);
v5 = HIWORD(result[1]);
v6 = *a2;
v7 = a2;
v8 = 3;
v9 = 5;
while ( 1 )
{
v11 = ((v4 & ~v5) + (v5 & v2) + v3 + v6) << 16;
v3 = (v11 >> 15) | (v11 >> 31);
v12 = (v4 + v7[1] + (v3 & v5) + (v2 & ~v3)) << 16;
v4 = (v12 >> 14) | (v12 >> 30);
v2 = (8 * (v2 + v7[2] + (v4 & v3) + (v5 & ~v4))) & 0x7FFFF | ((v2 + v7[2] + (v4 & v3) + (v5 & ~v4)) << 16 >> 29);
v13 = (v5 + v7[3] + (v2 & v4) + (v3 & ~v2)) << 16;
v5 = (v13 >> 11) | (v13 >> 27);
if ( --v9 )
goto LABEL_7;
if ( !--v8 )
break;
v3 += a2[v5 & 0x3F];
if ( v8 == 2 )
v9 = 6;
v4 += a2[v3 & 0x3F];
if ( v8 != 2 )
v9 = 5;
v2 += a2[v4 & 0x3F];
v5 += a2[v2 & 0x3F];
LABEL_7:
v10 = v7[4];
v7 += 4;
v6 = v10;
}
*result = (unsigned __int16)v3 | (v4 << 16);
result[1] = (unsigned __int16)v2 | (v5 << 16);
return result;
}