//
// sub_E5900 from 0xe5900 to 0xe5984 (132 bytes)
//
// 2 xrefs:
// > sub_E5638 @ 0xe565c
// > sub_E5638 @ 0xe5668
//
// 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_E5900(unsigned int **a1)
{
_QWORD *v1; // x19
__int64 result; // x0
__int64 v3; // x8
__int64 i; // x9
__int64 v5; // x2
v1 = *a1;
result = ((__int64 (__fastcall *)(unsigned int **, _QWORD, _QWORD))a1[1])(a1, *((_QWORD *)*a1 + 3), (*a1)[2]);
if ( !(_DWORD)result )
{
if ( *((_DWORD *)v1 + 4) == 1 )
{
v3 = v1[3];
for ( i = 0; ; ++i )
{
v5 = *((int *)v1 + 3);
if ( i >= v5 )
break;
*(_BYTE *)(v3 + i) ^= 0x80u;
}
}
else
{
v5 = *((unsigned int *)v1 + 3);
}
result = FMOD_OS_File_Write(v1[4], v1[3], v5, 0);
if ( !(_DWORD)result )
*((_DWORD *)v1 + 5) += *((_DWORD *)v1 + 3);
}
return result;
}