//
// sub_D79018 from 0xd79018 to 0xd790cc (180 bytes)
//
// 2 xrefs:
// > ??> @ 0x1122480
// > ??> @ 0x11224d0
//
// 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_D79018(__int64 a1, void *a2, int a3)
{
__int64 v5; // x20
unsigned __int64 v7; // x2
__int64 v8; // x1
v5 = *(_QWORD *)(*(_QWORD *)(a1 + 48) + 8LL);
BIO_clear_flags(a1, 15);
v7 = *(_QWORD *)v5;
if ( (a3 & 0x80000000) == 0 )
{
if ( v7 < a3 )
a3 = *(_QWORD *)v5;
if ( a3 > 0 && a2 )
{
memcpy(a2, *(const void **)(v5 + 8), a3);
v8 = *(_QWORD *)(v5 + 8);
*(_QWORD *)v5 -= a3;
*(_QWORD *)(v5 + 8) = v8 + a3;
return (unsigned int)a3;
}
}
if ( v7 )
return (unsigned int)a3;
a3 = *(_DWORD *)(a1 + 40);
if ( !a3 )
return (unsigned int)a3;
BIO_set_flags(a1, 9);
return (unsigned int)a3;
}