//
// sub_1005E6FBC from 0x1005e6fbc to 0x1005e7094 (216 bytes)
//
// 3 xrefs:
// > ??> @ 0x10083cf40
// > ??> @ 0x10083cf98
// > ??> @ 0x10083cff0
//
// 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_1005E6FBC(__int64 a1, __int64 a2, unsigned __int64 __src)
{
const void *v3; // x20
unsigned __int64 v4; // x19
unsigned __int64 v5; // x2
v3 = (const void *)__src;
if ( a2 | __src )
{
v4 = *(_QWORD *)(a1 + 120);
if ( a2 )
{
sub_10059ADB0();
sub_1005A5B88(
(unsigned __int64 *)(v4 + 256),
v4,
(void (__fastcall *)(unsigned __int64 *, unsigned __int64 *, unsigned __int64))sub_10059B434);
*(_QWORD *)(v4 + 672) = 0;
if ( v3 || *(_DWORD *)(v4 + 252) && (v3 = *(const void **)(v4 + 648)) != nullptr )
{
sub_1005A5CFC(v4 + 256, (unsigned __int64)v3, *(int *)(v4 + 656));
*(_DWORD *)(v4 + 252) = 1;
}
*(_DWORD *)(v4 + 248) = 1;
}
else
{
v5 = *(int *)(v4 + 656);
if ( *(_DWORD *)(v4 + 248) )
sub_1005A5CFC(v4 + 256, (unsigned __int64)v3, v5);
else
memcpy(*(void **)(v4 + 648), v3, v5);
*(_DWORD *)(v4 + 252) = 1;
*(_DWORD *)(v4 + 664) = 0;
}
}
return 1;
}