//
// sub_1005DFD4C from 0x1005dfd4c to 0x1005dfe70 (292 bytes)
//
// 1 xrefs:
// > sub_1005DFA08 @ 0x1005dfa44
//
// 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:09:39 +0000
//
__int64 __fastcall sub_1005DFD4C(__int64 *a1)
{
__int64 v2; // x20
__int64 result; // x0
int v4; // w10
int v5; // w9
int v6; // w8
int v7; // w8
signed __int64 v8; // x2
signed __int64 v9; // x8
__int64 v10; // x9
int v11; // [xsp+Ch] [xbp-14h] BYREF
v2 = *a1;
v11 = 0;
result = sub_1005DB990(&v11);
if ( !(_DWORD)result )
{
v4 = *(_DWORD *)(v2 + 28);
v5 = v11 - *(_DWORD *)(v2 + 24);
*(_DWORD *)(v2 + 24) = v11;
if ( v5 <= 1000 )
v6 = v5;
else
v6 = 0;
v7 = v6 * *(_DWORD *)v2 / 1000 + *(_DWORD *)(v2 + 32);
*(_DWORD *)(v2 + 32) = v7;
if ( v7 - v4 >= *(_DWORD *)(v2 + 8) )
{
result = ((__int64 (__fastcall *)(__int64 *, _QWORD))a1[1])(a1, *(_QWORD *)(v2 + 40));
if ( !(_DWORD)result )
{
*(_DWORD *)(v2 + 28) += *(_DWORD *)(v2 + 8);
if ( *(_DWORD *)(v2 + 20) == 1 )
{
v8 = *(unsigned int *)(v2 + 12);
if ( (int)v8 >= 1 )
{
v9 = 0;
v10 = *(_QWORD *)(v2 + 40);
do
{
*(_BYTE *)(v10 + v9++) ^= 0x80u;
v8 = *(int *)(v2 + 12);
}
while ( v9 < v8 );
}
}
else
{
v8 = *(unsigned int *)(v2 + 12);
}
result = sub_1005DB898(*(FILE **)(v2 + 48), *(void **)(v2 + 40), v8, 0);
if ( !(_DWORD)result )
*(_DWORD *)(v2 + 36) += *(_DWORD *)(v2 + 12);
}
}
else
{
sub_1005DB9D4(*(_DWORD *)(v2 + 16));
return 0;
}
}
return result;
}