//
// sub_A148FC from 0xa148fc to 0xa14a24 (296 bytes)
//
// 1 xrefs:
// > ??> @ 0xd170b0
//
// 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:07:48 +0000
//
int __fastcall sub_A148FC(int a1, int a2, int a3, unsigned int a4)
{
unsigned int i; // r2
_BOOL4 v8; // r3
int v9; // r7
unsigned int v10; // r4
char v11; // r3
int cipher_data; // r8
int v13; // r9
int v14; // r0
unsigned int v15; // r3
unsigned int v17; // [sp+18h] [bp-14h]
unsigned int v18; // [sp+1Ch] [bp-10h]
char v19[4]; // [sp+20h] [bp-Ch] BYREF
_BYTE v20[8]; // [sp+24h] [bp-8h] BYREF
v18 = a4;
if ( a4 > 0x7FFFFFF )
a4 = 0x8000000;
v17 = a4;
for ( i = a4; ; i = v15 )
{
v8 = v18 >= i;
if ( !v18 )
v8 = 0;
if ( !v8 )
break;
v9 = 8 * i;
if ( 8 * i )
{
v10 = 0;
do
{
if ( (((int)*(unsigned __int8 *)(a3 + (v10 >> 3)) >> (~(_BYTE)v10 & 7)) & 1) != 0 )
v11 = 0x80;
else
v11 = 0;
v19[0] = v11;
cipher_data = EVP_CIPHER_CTX_get_cipher_data(a1);
v13 = EVP_CIPHER_CTX_iv_noconst(a1);
v14 = EVP_CIPHER_CTX_encrypting(a1);
DES_cfb_encrypt(v19, v20, 1, 1, cipher_data, v13, v14);
*(_BYTE *)(a2 + (v10 >> 3)) = *(_BYTE *)(a2 + (v10 >> 3)) & ~(128 >> (v10 & 7)) | ((v20[0] & 0x80) >> (v10 & 7));
++v10;
}
while ( v10 != v9 );
}
v15 = v17;
a3 += v17;
a2 += v17;
if ( v17 >= v18 - v17 )
v15 = v18 - v17;
v18 -= v17;
v17 = v15;
}
return 1;
}