//
// sub_C8A15C from 0xc8a15c to 0xc8a238 (220 bytes)
//
// 1 xrefs:
// > sub_C8B49C @ 0xc8b4c8
//
// 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_C8A15C(__int64 result, __int64 a2)
{
int v2; // w6
int v3; // w10
_DWORD *v4; // x13
int v5; // w14
__int64 v6; // x12
int v7; // w2
int v8; // w11
int v9; // w9
int v10; // w7
_DWORD *v11; // x5
int v12; // w4
int v13; // w3
int v14; // w7
v2 = *(_DWORD *)(result + 8);
v3 = v2 * *(_DWORD *)(result + 52);
if ( v2 > 0 )
{
v4 = *(_DWORD **)(result + 96);
v5 = *(_DWORD *)(result + 8);
v6 = 0;
do
{
v7 = *(_DWORD *)(result + 36);
v8 = v5;
if ( *(int *)(result + 44) <= 1 )
v9 = *(unsigned __int8 *)(a2 + v6);
else
v9 = *(unsigned __int8 *)(a2 + v2 + v6);
v10 = *(unsigned __int8 *)(a2 + v6) - v9;
v11 = v4;
v12 = v6 + v2;
for ( *v4 = v10 * v7 + v9 * v7; v3 > v12; *v11 = v10 * v7 + v9 * v13 )
{
v7 -= *(_DWORD *)(result + 40);
if ( v7 < 0 )
{
v8 += v2;
v14 = v9;
v13 = *(_DWORD *)(result + 36);
v11 += v2;
v9 = *(unsigned __int8 *)(a2 + v8);
v7 += v13;
v10 = v14 - v9;
}
else
{
v13 = *(_DWORD *)(result + 36);
v11 += v2;
}
v12 += v2;
}
++v6;
++v4;
++v5;
}
while ( v2 > (int)v6 );
}
return result;
}