//
// sub_180020E60 from 0x180020e60 to 0x180020f3e (222 bytes)
//
// 4 xrefs:
// > ??> @ 0x1800ed0d0
// > ??> @ 0x18013cadc
// > ??> @ 0x18013caec
// > ??> @ 0x1801b8e54
//
// 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:28 +0000
//
__int64 __fastcall sub_180020E60(__int64 a1, char *a2, size_t a3)
{
bool v5; // zf
int v6; // r8d
FILE *v7; // rcx
FILE *v8; // rdi
int *Count; // [rsp+60h] [rbp+8h] BYREF
char **Pointer; // [rsp+68h] [rbp+10h] BYREF
char **Base; // [rsp+70h] [rbp+18h] BYREF
if ( a2 || (v5 = a3 == 0, v6 = 4, !v5) )
v6 = 0;
v7 = *(FILE **)(a1 + 128);
if ( !v7 || setvbuf(v7, a2, v6, a3) )
return 0;
v8 = *(FILE **)(a1 + 128);
*(_BYTE *)(a1 + 124) = 1;
*(_BYTE *)(a1 + 113) = 0;
std::streambuf::_Init(a1);
if ( v8 )
{
Base = nullptr;
Pointer = nullptr;
Count = nullptr;
get_stream_buffer_pointers(v8, &Base, &Pointer, &Count);
std::streambuf::_Init(a1);
}
*(_QWORD *)(a1 + 128) = v8;
*(_QWORD *)(a1 + 116) = qword_1801B2388;
*(_QWORD *)(a1 + 104) = 0;
return a1;
}