//
// sub_CF28C8 from 0xcf28c8 to 0xcf2930 (104 bytes)
//
// 1 xrefs:
// > ??> @ 0x121d878
//
// 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_CF28C8(__int64 a1, unsigned int a2)
{
unsigned __int64 v2; // x2
_BOOL4 v3; // w3
v2 = *(_QWORD *)(a1 + 16);
if ( *(_QWORD *)(a1 + 8) >= v2 )
return (unsigned int)-1;
if ( a2 != -1 )
{
v3 = *(unsigned __int8 *)(v2 - 1) == (unsigned __int8)a2;
if ( *(unsigned __int8 *)(v2 - 1) == (unsigned __int8)a2 || (*(_DWORD *)(a1 + 64) & 0x10) != 0 )
{
*(_QWORD *)(a1 + 16) = v2 - 1;
if ( !v3 )
*(_BYTE *)(v2 - 1) = a2;
return a2;
}
return (unsigned int)-1;
}
*(_QWORD *)(a1 + 16) = v2 - 1;
return 0;
}