//
// sub_18001C6F0 from 0x18001c6f0 to 0x18001c80a (282 bytes)
//
// 2 xrefs:
// > ??> @ 0x1800e7030
// > ??> @ 0x1801aeb0c
//
// 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_18001C6F0(_QWORD *a1, unsigned int a2)
{
unsigned __int64 v4; // rbx
FILE *v6; // rdx
_BYTE *v7; // rbx
if ( std::streambuf::gptr(a1) )
{
v4 = std::streambuf::eback(a1);
if ( v4 < std::streambuf::gptr(a1) && (a2 == -1 || *(unsigned __int8 *)(std::streambuf::gptr(a1) - 1) == a2) )
{
std::streambuf::_Gndec(a1);
if ( a2 == -1 )
return 0;
return a2;
}
}
v6 = (FILE *)a1[16];
if ( !v6 || a2 == -1 )
return 0xFFFFFFFFLL;
if ( !a1[13] && ungetc((unsigned __int8)a2, v6) != -1 )
return a2;
v7 = a1 + 14;
if ( (_QWORD *)std::streambuf::gptr(a1) == a1 + 14 )
return 0xFFFFFFFFLL;
*v7 = a2;
if ( (_BYTE *)std::streambuf::eback(a1) != v7 )
{
a1[17] = std::streambuf::eback(a1);
a1[18] = std::streambuf::egptr(a1);
}
std::streambuf::setg(a1, a1 + 14, a1 + 14, (char *)a1 + 113);
return a2;
}