//
// sub_1005883FC from 0x1005883fc to 0x100588520 (292 bytes)
//
// 1 xrefs:
// > sub_100587CE8 @ 0x100587ce8
//
// 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:08:33 +0000
//
__int64 __fastcall sub_1005883FC(__int64 a1, __int64 a2, int a3, _DWORD *a4)
{
__int64 v5; // x0
int v7; // w20
__int64 v9; // x8
unsigned int v10; // w9
int v11; // w9
int v13; // w23
unsigned int v14; // w9
int v15; // w8
int v16; // w24
v5 = *(_QWORD *)(a1 + 376);
if ( !v5 )
return 31;
v7 = a3;
v9 = *(_QWORD *)(a1 + 8);
v10 = *(_DWORD *)(v9 + 8) - 2;
if ( v10 > 3 )
{
v11 = 1;
if ( !a3 )
goto LABEL_14;
LABEL_7:
v13 = v11 * *(_DWORD *)(v9 + 12);
do
{
v14 = *(_DWORD *)(a1 + 464);
if ( !v14 )
{
*(_DWORD *)(a1 + 460) = 0;
sub_10060E4C0(a1, *(_QWORD *)(a1 + 376));
v14 = *(_DWORD *)(a1 + 464);
if ( !v14 )
break;
}
v15 = *(_DWORD *)(a1 + 460);
v16 = v7;
if ( v15 + v7 >= v14 )
{
v16 = v14 - v15;
*(_DWORD *)(a1 + 464) = 0;
}
memcpy(
(void *)(a2 + (unsigned int)(*a4 * v13)),
(const void *)(*(_QWORD *)(a1 + 440) + (unsigned int)(v15 * v13)),
(unsigned int)(v16 * v13));
*(_DWORD *)(a1 + 460) += v16;
*a4 += v16;
v7 -= v16;
}
while ( v7 );
v5 = *(_QWORD *)(a1 + 376);
goto LABEL_14;
}
v11 = dword_100770DE0[v10];
if ( a3 )
goto LABEL_7;
LABEL_14:
if ( (unsigned int)sub_10060E25C(v5) != 4 )
return 0;
*a4 = 0;
return 16;
}