//
// sub_140178810 from 0x140178810 to 0x140178862 (82 bytes)
//
// 1 xrefs:
// > ??> @ 0x14055bc00
//
// 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_140178810(__int64 a1, unsigned int a2)
{
unsigned __int64 v2; // r8
v2 = **(_QWORD **)(a1 + 56);
if ( !v2
|| v2 <= **(_QWORD **)(a1 + 24)
|| a2 != -1 && (_BYTE)a2 != *(_BYTE *)(v2 - 1) && (*(_BYTE *)(a1 + 112) & 2) != 0 )
{
return 0xFFFFFFFFLL;
}
++**(_DWORD **)(a1 + 80);
--**(_QWORD **)(a1 + 56);
if ( a2 == -1 )
return 0;
else
***(_BYTE ***)(a1 + 56) = a2;
return a2;
}