//
// sub_1007013E0 from 0x1007013e0 to 0x1007014a4 (196 bytes)
//
// 2 xrefs:
// > sub_1007014D8 @ 0x100701544
// > ??> @ 0x1009e9108
//
// This function is hookable on this platform (idp: arm, 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:12:48 +0000
//
__int64 __fastcall sub_1007013E0(__int64 a1, void *a2, __int64 a3)
{
size_t *v6; // x23
unsigned __int64 v7; // x8
char *v8; // x0
size_t v9; // x2
char *v10; // x1
v6 = *(size_t **)(a1 + 48);
sub_100700768(a1, 15);
if ( (a3 & 0x80000000) != 0 )
{
v7 = *v6;
}
else
{
v7 = *v6;
if ( (int)a3 <= *v6 )
a3 = (unsigned int)a3;
else
a3 = (unsigned int)v7;
if ( a2 && (int)a3 >= 1 )
{
memcpy(a2, (const void *)v6[1], (int)a3);
v8 = (char *)v6[1];
v9 = *v6 - (int)a3;
*v6 = v9;
v10 = &v8[(int)a3];
if ( (*(_BYTE *)(a1 + 33) & 2) != 0 )
v6[1] = (size_t)v10;
else
memmove(v8, v10, v9);
return a3;
}
}
if ( !v7 )
{
a3 = *(unsigned int *)(a1 + 40);
if ( (_DWORD)a3 )
sub_100700784(a1, 9);
else
return 0;
}
return a3;
}