//
// sub_C14FB0 from 0xc14fb0 to 0xc150b4 (260 bytes)
//
// 2 xrefs:
// > sub_C14E0C @ 0xc14ea0
// > sub_C14E0C @ 0xc14eac
//
// 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_C14FB0(_QWORD *a1, __int64 a2, __int64 a3, unsigned int a4, __int64 a5, _DWORD *a6)
{
__int64 v6; // x19
unsigned int v8; // w22
__int64 v13; // x4
__int64 result; // x0
unsigned int v15; // w1
__int64 v16; // x0
int v17; // w20
v6 = a1[75];
v8 = *(_DWORD *)(v6 + 40);
if ( v8 )
{
v13 = *(_QWORD *)(v6 + 24);
}
else
{
v16 = (*(__int64 (__fastcall **)(_QWORD *, _QWORD, _QWORD, _QWORD, __int64))(a1[1] + 56LL))(
a1,
*(_QWORD *)(v6 + 16),
*(unsigned int *)(v6 + 36),
*(unsigned int *)(v6 + 32),
1);
v8 = *(_DWORD *)(v6 + 40);
v13 = v16;
*(_QWORD *)(v6 + 24) = v16;
}
(*(void (__fastcall **)(_QWORD *, __int64, __int64, _QWORD, __int64, __int64, _QWORD))(a1[80] + 8LL))(
a1,
a2,
a3,
a4,
v13,
v6 + 40,
*(unsigned int *)(v6 + 32));
result = *(unsigned int *)(v6 + 40);
if ( (unsigned int)result > v8 )
{
v17 = result - v8;
(*(void (__fastcall **)(_QWORD *, __int64, _QWORD, _QWORD))(a1[82] + 8LL))(
a1,
*(_QWORD *)(v6 + 24) + 8LL * v8,
0,
(unsigned int)result - v8);
*a6 += v17;
result = *(unsigned int *)(v6 + 40);
}
v15 = *(_DWORD *)(v6 + 32);
if ( v15 <= (unsigned int)result )
{
result = *(unsigned int *)(v6 + 36);
*(_DWORD *)(v6 + 40) = 0;
*(_DWORD *)(v6 + 36) = result + v15;
}
return result;
}