//
// sub_18001C550 from 0x18001c550 to 0x18001c66a (282 bytes)
//
// 2 xrefs:
// > ??> @ 0x1800ed090
// > ??> @ 0x1801b8b90
//
// 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:26 +0000
//
__int64 __fastcall sub_18001C550(_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;
}