//
// sub_180021F00 from 0x180021f00 to 0x180021f7c (124 bytes)
//
// 3 xrefs:
// > ??> @ 0x1800ed0a0
// > ??> @ 0x1801b8f20
// > ??> @ 0x1801b8f2c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:21:28 +0000
//
__int64 __fastcall sub_180021F00(__int64 a1)
{
unsigned __int64 v2; // rbx
__int64 result; // rax
unsigned int v4; // ebx
if ( std::streambuf::gptr(a1) )
{
v2 = std::streambuf::egptr(a1);
if ( std::streambuf::gptr(a1) < v2 )
return *(unsigned __int8 *)std::streambuf::gptr(a1);
}
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 56LL))(a1);
v4 = result;
if ( (_DWORD)result != -1 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 32LL))(a1, (unsigned int)result);
return v4;
}
return result;
}