//
// sub_C8651C from 0xc8651c to 0xc86580 (100 bytes)
//
// 1 xrefs:
// > sub_C89A88 @ 0xc89aec
//
// 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
//
__int64 __fastcall sub_C8651C(__int64 result, int a2, int a3, int a4, char a5, __int64 a6)
{
bool v6; // cc
int v7; // w3
__int64 v8; // x1
__int64 v9; // x8
int v10; // w7
v6 = a4 <= 0;
v7 = a4 - 1;
if ( !v6 )
{
v8 = 4LL * a2;
do
{
if ( a3 > 0 )
{
v9 = 0;
do
{
v10 = *(_DWORD *)(result + 4 * v9++);
++*(_DWORD *)(a6
+ 4LL * (unsigned __int8)(BYTE2(v10) - (((unsigned int)((__int64)(__int16)v10 >> 8) * a5) >> 5)));
}
while ( a3 > (int)v9 );
}
--v7;
result += v8;
}
while ( v7 != -1 );
}
return result;
}