//
// sub_1403541C0 from 0x1403541c0 to 0x1403542ca (266 bytes)
//
// 4 xrefs:
// > GameObject::playDestroyObjectAnim @ 0x1402a84bd
// > GameObject::playDestroyObjectAnim @ 0x1402a84e4
// > GameObject::playDestroyObjectAnim @ 0x1402a84f9
// > ??> @ 0x1409205b8
//
// This function is hookable on this platform (idp: pc, 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:30:48 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall sub_1403541C0(__int64 *a1, int *a2)
{
__int64 v4; // rsi
__int64 v5; // r8
__int64 v6; // r9
int v7; // r10d
int v8; // eax
__int64 *v9; // rax
__int128 v11; // [rsp+20h] [rbp-38h] BYREF
__int128 v12; // [rsp+30h] [rbp-28h]
v4 = *a1;
v5 = *(_QWORD *)(*a1 + 8);
*(_QWORD *)&v12 = v5;
DWORD2(v12) = 0;
v6 = v4;
if ( !*(_BYTE *)(v5 + 25) )
{
v7 = *a2;
do
{
*(_QWORD *)&v12 = v5;
if ( *(_DWORD *)(v5 + 28) < v7 || *(_DWORD *)(v5 + 28) <= v7 && *(_DWORD *)(v5 + 32) < a2[1] )
{
DWORD2(v12) = 0;
v5 += 16;
}
else
{
DWORD2(v12) = 1;
v6 = v5;
}
v5 = *(_QWORD *)v5;
}
while ( !*(_BYTE *)(v5 + 25) );
}
if ( *(_BYTE *)(v6 + 25) || (v8 = *(_DWORD *)(v6 + 28), *a2 < v8) || *a2 <= v8 && a2[1] < *(_DWORD *)(v6 + 32) )
{
if ( a1[1] == 0x555555555555555LL )
sub_14005BD90(a1, a2, v5);
v11 = (unsigned __int64)a1;
v9 = (__int64 *)operator new(0x30u);
*(__int64 *)((char *)v9 + 28) = *(_QWORD *)a2;
*(__int64 *)((char *)v9 + 36) = 0;
*v9 = v4;
v9[1] = v4;
v9[2] = v4;
*((_WORD *)v9 + 12) = 0;
v11 = v12;
v6 = sub_14006A770(a1, (__int64)&v11, (__int64)v9);
}
return v6 + 36;
}