//
// sub_18001C0E0 from 0x18001c0e0 to 0x18001c222 (322 bytes)
//
// 3 xrefs:
// > sub_180016630 @ 0x180016717
// > sub_180016750 @ 0x180016831
// > ??> @ 0x1801b8b3c
//
// 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
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall sub_18001C0E0(__int64 a1, const char *a2, int a3, int a4)
{
FILE *v5; // rdi
__int64 v6; // rax
std::codecvt_base *v7; // rdi
void (__fastcall ***v8)(_QWORD, __int64); // rax
char **Pointer; // [rsp+40h] [rbp-28h] BYREF
char **Base; // [rsp+48h] [rbp-20h] BYREF
__int64 v12; // [rsp+50h] [rbp-18h]
int *Count; // [rsp+70h] [rbp+8h] BYREF
if ( *(_QWORD *)(a1 + 128) )
return 0;
v5 = std::_Fiopen(a2, a3, a4);
if ( !v5 )
return 0;
*(_BYTE *)(a1 + 124) = 1;
*(_BYTE *)(a1 + 113) = 0;
std::streambuf::_Init(a1);
Base = nullptr;
Pointer = nullptr;
Count = nullptr;
get_stream_buffer_pointers(v5, &Base, &Pointer, &Count);
std::streambuf::_Init(a1);
*(_QWORD *)(a1 + 128) = v5;
*(_QWORD *)(a1 + 116) = qword_1801B2388;
*(_QWORD *)(a1 + 104) = 0;
v6 = std::streambuf::getloc(a1, &Base);
v7 = (std::codecvt_base *)sub_180016430(v6);
if ( std::codecvt_base::always_noconv(v7) )
{
*(_QWORD *)(a1 + 104) = 0;
}
else
{
*(_QWORD *)(a1 + 104) = v7;
std::streambuf::_Init(a1);
}
if ( v12 )
{
v8 = (void (__fastcall ***)(_QWORD, __int64))(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 16LL))(v12);
if ( v8 )
(**v8)(v8, 1);
}
return a1;
}