//
// sub_614074 from 0x614074 to 0x614120 (172 bytes)
//
// 0 xrefs:
//
// 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
//
size_t __fastcall sub_614074(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;
}