//
// sub_8240F4 from 0x8240f4 to 0x8241a0 (172 bytes)
//
// 0 xrefs:
//
// 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:01:53 +0000
//
size_t __fastcall sub_8240F4(void *a1, int a2, int a3, int a4)
{
int v4; // r4
size_t v6; // r5
__int64 v7; // r2
const void *v8; // r1
__int64 v9; // r2
size_t result; // r0
int v11; // r5
int v12; // r2
int v13; // r2
v4 = *(_DWORD *)(*(_DWORD *)a4 + 332);
if ( !*(_QWORD *)(v4 + 8) )
return 0;
v6 = a3 * a2;
*(_BYTE *)(*(_DWORD *)a4 + 331) = *(_DWORD *)(v4 + 88) == 1;
v7 = *(_QWORD *)(v4 + 8);
v8 = *(const void **)(v4 + 16);
if ( v6 < v7 )
{
memcpy(a1, v8, v6);
v13 = *(_DWORD *)(v4 + 16);
*(_QWORD *)(v4 + 8) -= v6;
*(_DWORD *)(v4 + 16) = v6 + v13;
return v6;
}
else
{
memcpy(a1, v8, v7);
v9 = *(_QWORD *)(v4 + 80);
result = *(_DWORD *)(v4 + 8);
if ( v9 )
{
v11 = *(_DWORD *)(v4 + 72);
*(_QWORD *)(v4 + 8) = v9;
v12 = *(_DWORD *)(v4 + 64);
*(_DWORD *)(v4 + 16) = v11;
*(_DWORD *)(*(_DWORD *)a4 + 34728) = v12;
*(_DWORD *)(*(_DWORD *)a4 + 34732) = *(_DWORD *)(v4 + 68);
*(_QWORD *)(v4 + 80) = 0;
++*(_DWORD *)(v4 + 88);
}
else
{
*(_QWORD *)(v4 + 8) = 0;
}
}
return result;
}