//
// sub_100676C9C from 0x100676c9c to 0x100676d68 (204 bytes)
//
// 2 xrefs:
// > sub_100673C98 @ 0x10067567c
// > sub_100676A74 @ 0x100676bf8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 11:11:12 +0000
//
signed __int64 __fastcall sub_100676C9C(void *a1, __int64 a2, __int64 a3, __int64 *a4)
{
__int64 v6; // x21
signed __int64 v7; // x2
signed __int64 v8; // x19
const void *v9; // x1
signed __int64 v10; // x9
__int64 v11; // x8
__int64 v12; // x9
__int64 v13; // x9
v6 = *(_QWORD *)(*a4 + 536);
v7 = *(_QWORD *)(v6 + 8);
if ( !v7 )
return 0;
v8 = a3 * a2;
*(_BYTE *)(*a4 + 531) = *(_DWORD *)(v6 + 120) == 1;
v9 = *(const void **)(v6 + 16);
if ( v7 <= v8 )
{
memcpy(a1, v9, v7);
v8 = *(_QWORD *)(v6 + 8);
v11 = *(_QWORD *)(v6 + 112);
if ( v11 )
{
v12 = *(_QWORD *)(v6 + 104);
*(_QWORD *)(v6 + 8) = v11;
*(_QWORD *)(v6 + 16) = v12;
v13 = *a4;
*(_QWORD *)(v13 + 35656) = *(_QWORD *)(v6 + 88);
*(_QWORD *)(v13 + 35664) = *(_QWORD *)(v6 + 96);
++*(_DWORD *)(v6 + 120);
*(_QWORD *)(v6 + 112) = 0;
}
else
{
*(_QWORD *)(v6 + 8) = 0;
}
}
else
{
memcpy(a1, v9, v8);
v10 = *(_QWORD *)(v6 + 16) + v8;
*(_QWORD *)(v6 + 8) -= v8;
*(_QWORD *)(v6 + 16) = v10;
}
return v8;
}