//
// sub_100163DB4 from 0x100163db4 to 0x100163e10 (92 bytes)
//
// 1 xrefs:
// > ??> @ 0x10079bc58
//
// 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_100163DB4(__int64 a1, __int64 a2)
{
unsigned __int64 v2; // x8
if ( !*(_QWORD *)(a1 + 120) )
return 0xFFFFFFFFLL;
v2 = *(_QWORD *)(a1 + 24);
if ( *(_QWORD *)(a1 + 16) >= v2 )
return 0xFFFFFFFFLL;
if ( (_DWORD)a2 == -1 )
{
a2 = 0;
*(_QWORD *)(a1 + 24) = v2 - 1;
return a2;
}
if ( (*(_BYTE *)(a1 + 392) & 0x10) == 0 && *(unsigned __int8 *)(v2 - 1) != (unsigned __int8)a2 )
return 0xFFFFFFFFLL;
*(_QWORD *)(a1 + 24) = v2 - 1;
*(_BYTE *)(v2 - 1) = a2;
return a2;
}