//
// common_lseek<__int64> from 0x180141edc to 0x180141fcb (239 bytes)
//
// 2 xrefs:
// > common_lseek<__int64> @ 0x180142068
// > ??> @ 0x180203cec
//
// 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 10:55:05 +0000
//
__int64 __fastcall common_lseek<__int64>(int a1, __int64 a2, unsigned int a3)
{
__int64 v6; // rsi
__int64 v7; // rdi
if ( a1 == -2 )
{
*_doserrno() = 0;
*errno() = 9;
return -1;
}
if ( a1 < 0
|| a1 >= (unsigned int)dword_1801F5560
|| (v6 = (__int64)a1 >> 6, (*(_BYTE *)(qword_1801F5160[v6] + 72LL * (a1 & 0x3F) + 56) & 1) == 0) )
{
*_doserrno() = 0;
*errno() = 9;
invalid_parameter_noinfo();
return -1;
}
sub_180136164(a1);
v7 = -1;
if ( (*(_BYTE *)(qword_1801F5160[v6] + 72LL * (a1 & 0x3F) + 56) & 1) != 0 )
{
v7 = common_lseek_nolock<__int64>((unsigned int)a1, a2, a3);
}
else
{
*errno() = 9;
*_doserrno() = 0;
}
sub_18013618C(a1);
return v7;
}