//
// sub_18001E3A0 from 0x18001e3a0 to 0x18001e47a (218 bytes)
//
// 2 xrefs:
// > ??> @ 0x1800ed0c0
// > ??> @ 0x1801b8ce0
//
// 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:27 +0000
//
fpos_t *__fastcall sub_18001E3A0(__int64 a1, fpos_t *a2, __int64 a3, int a4)
{
fpos_t v8; // rcx
fpos_t Position; // [rsp+30h] [rbp+8h] BYREF
if ( std::streambuf::gptr(a1) == a1 + 112 && a4 == 1 && !*(_QWORD *)(a1 + 104) )
--a3;
if ( !*(_QWORD *)(a1 + 128)
|| !sub_180018740(a1)
|| (a3 || a4 != 1) && fseeki64(*(FILE **)(a1 + 128), a3, a4)
|| fgetpos(*(FILE **)(a1 + 128), &Position) )
{
*a2 = -1;
a2[1] = 0;
a2[2] = 0;
}
else
{
sub_180018850(a1);
v8 = *(_QWORD *)(a1 + 116);
*a2 = Position;
a2[2] = v8;
a2[1] = 0;
}
return a2;
}