//
// sub_D5B14 from 0xd5b14 to 0xd5be4 (208 bytes)
//
// 1 xrefs:
// > sub_6F0D0 @ 0x6f120
//
// 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 12:14:52 +0000
//
__int64 __fastcall sub_D5B14(__int64 a1, __int64 a2)
{
unsigned int (__fastcall *v2)(__int64, __int64, int *); // x8
signed int v6; // w8
signed int v7; // w2
__int64 v8; // x8
int v9; // w8
int v10; // w0
int v11; // [xsp+Ch] [xbp-14h] BYREF
v2 = *(unsigned int (__fastcall **)(__int64, __int64, int *))(a1 + 1016);
if ( v2 )
{
if ( !*(_DWORD *)(a2 + 36) || *(_BYTE *)(a2 + 49) )
return 0;
v11 = 0;
if ( !v2(a1 + 8, a2, &v11) )
{
v6 = *(_DWORD *)(a2 + 36);
v7 = v11 - *(_DWORD *)(a2 + 20);
if ( v7 < 0 && (v7 += v6, v7 < 0) || v7 > v6 )
v7 = 0;
v8 = *(_QWORD *)(a2 + 72);
if ( v8 )
{
v9 = *(_DWORD *)(v8 + 648);
if ( v7 < 3 * v9 )
return 0;
v7 = v7 / v9 * v9 - v9;
}
else if ( v7 < 1 )
{
return 0;
}
sub_D5824(a1, a2, v7);
if ( !v10 )
return 0;
}
*(_BYTE *)(a2 + 49) = 1;
return 0;
}
return 66;
}