//
// sub_89D04 from 0x89d04 to 0x89db8 (180 bytes)
//
// 1 xrefs:
// > sub_89028 @ 0x89028
//
// 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_89D04(__int64 a1, int a2, unsigned int a3)
{
int v3; // w8
__int64 result; // x0
__int64 v6; // x8
int v7; // [xsp+Ch] [xbp-4h] BYREF
if ( a2 < 0 )
return 32;
v3 = *(_DWORD *)(a1 + 24);
if ( v3 )
{
if ( v3 <= a2 )
return 32;
}
if ( (*(_DWORD *)(*(_QWORD *)(a1 + 368) + 404LL) & 1) == 0 )
return 0;
v7 = 0;
if ( *(_DWORD *)(a1 + 408) != a2 )
*(_DWORD *)(a1 + 408) = a2;
v6 = *(_QWORD *)(a1 + 8) + 56LL * a2;
result = sub_5C280(a3, &v7, *(_DWORD *)(v6 + 12), *(_DWORD *)(v6 + 8));
if ( !(_DWORD)result )
return sub_E08C0(
*(_QWORD *)(a1 + 368),
(unsigned int)(v7 + *(_DWORD *)(*(_QWORD *)(a1 + 400) + 296LL * *(int *)(a1 + 408) + 256)));
return result;
}