//
// sub_10020C178 from 0x10020c178 to 0x10020c1e8 (112 bytes)
//
// 6 xrefs:
// > sub_1001EDBA4 @ 0x1001edbc4
// > sub_10020C12C @ 0x10020c148
// > sub_10020C12C @ 0x10020c154
// > sub_10020C12C @ 0x10020c160
// > sub_10020C564 @ 0x10020c60c
// > sub_10020C68C @ 0x10020c6b8
//
// 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_10020C178(__int64 result, __int64 *a2)
{
__int64 v2; // x8
_QWORD *v3; // x1
__int64 v4; // x10
__int64 v5; // t1
__int64 v6; // x11
__int64 v7; // x11
unsigned __int64 v8; // x10
unsigned __int64 v9; // x11
v2 = *a2;
*a2 = 0;
*(_QWORD *)result = v2;
v5 = a2[2];
v3 = a2 + 2;
v4 = v5;
v6 = *(v3 - 1);
*(_QWORD *)(result + 16) = v5;
*(_QWORD *)(result + 8) = v6;
*(v3 - 1) = 0;
v7 = v3[1];
*(_QWORD *)(result + 24) = v7;
*(_DWORD *)(result + 32) = *((_DWORD *)v3 + 4);
if ( v7 )
{
v8 = *(_QWORD *)(v4 + 8);
v9 = *(_QWORD *)(result + 8);
if ( (v9 & (v9 - 1)) != 0 )
{
if ( v8 >= v9 )
v8 %= v9;
}
else
{
v8 &= v9 - 1;
}
*(_QWORD *)(v2 + 8 * v8) = result + 16;
*v3 = 0;
v3[1] = 0;
}
return result;
}