//
// sub_180138B78 from 0x180138b78 to 0x180138c19 (161 bytes)
//
// 2 xrefs:
// > _fclose_nolock @ 0x18012fa49
// > ??> @ 0x180203704
//
// 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_180138B78(int a1)
{
int *v2; // [rsp+20h] [rbp-18h] BYREF
int v3; // [rsp+40h] [rbp+8h] BYREF
char v4; // [rsp+48h] [rbp+10h] BYREF
int v5; // [rsp+50h] [rbp+18h] BYREF
int v6; // [rsp+58h] [rbp+20h] BYREF
v3 = a1;
if ( a1 == -2 )
{
*_doserrno() = 0;
*errno() = 9;
}
else
{
if ( a1 >= 0
&& a1 < (unsigned int)dword_1801F5560
&& (*(_BYTE *)(qword_1801F5160[(__int64)a1 >> 6] + 72LL * (a1 & 0x3F) + 56) & 1) != 0 )
{
v5 = a1;
v6 = a1;
v2 = &v3;
return __crt_seh_guarded_call::operator()<_lambda_751a882b2c74d4b022dec766aa51a29a_,_lambda_628dfdc04ba53c8bfc02c9951375f3f5_ &,_lambda_f6c7be5f7998530c34de24c7437d6b54_>(
(__int64)&v4,
&v6,
&v2,
&v5);
}
*_doserrno() = 0;
*errno() = 9;
invalid_parameter_noinfo();
}
return 0xFFFFFFFFLL;
}