//
// sub_140253870 from 0x140253870 to 0x140253927 (183 bytes)
//
// 3 xrefs:
// > sub_1402518B0 @ 0x140251a41
// > sub_140251A80 @ 0x140251c7b
// > ??> @ 0x1406cf6a8
//
// 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_140253870(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
_QWORD *v6; // rcx
__int64 result; // rax
v6 = *(_QWORD **)a1;
if ( v6 )
{
if ( (unsigned __int64)(96 * ((*(_QWORD *)(a1 + 16) - (_QWORD)v6) / 96LL)) >= 0x1000 )
{
if ( (unsigned __int64)v6 - *(v6 - 1) - 8 > 0x1F )
invalid_parameter_noinfo_noreturn();
v6 = (_QWORD *)*(v6 - 1);
}
j_j_free(v6);
}
*(_QWORD *)a1 = a2;
*(_QWORD *)(a1 + 8) = a2 + 96 * a3;
result = a2 + 96 * a4;
*(_QWORD *)(a1 + 16) = result;
return result;
}