//
// sub_5E17FC from 0x5e17fc to 0x5e1868 (108 bytes)
//
// 0 xrefs:
//
// 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
//
int __fastcall sub_5E17FC(_DWORD *a1, char *a2, int a3)
{
__int64 v3; // r8
int v6; // r4
bool v7; // cf
int v8; // r2
size_t v9; // r5
char *v10; // r0
v3 = a3;
v6 = 0;
while ( 1 )
{
if ( !v3 )
return v6;
v7 = HIDWORD(v3) == 0;
v8 = a1[2];
if ( !HIDWORD(v3) )
v7 = (unsigned int)v3 <= 0x7FFFFFFF;
v9 = v7 ? v3 : 0x80000000;
if ( (signed int)(v9 + v8) > a1[1] )
break;
v6 += v9;
v10 = (char *)memcpy(a2, (const void *)(*a1 + v8), v9);
v3 -= v9;
a1[2] += v9;
a2 = &v10[v9];
}
return 0;
}