//
// sub_140249850 from 0x140249850 to 0x140249952 (258 bytes)
//
// 4 xrefs:
// > GameObject::playDestroyObjectAnim @ 0x1401ab248
// > GameObject::playDestroyObjectAnim @ 0x1401ab262
// > GameObject::playDestroyObjectAnim @ 0x1401ab276
// > ??> @ 0x1406ce904
//
// 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
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall sub_140249850(__int64 *a1, int *a2)
{
__int64 v4; // r9
__int64 v5; // r8
int v6; // r10d
__int64 v7; // rbx
__int64 *v8; // rax
__int128 v10; // [rsp+20h] [rbp-38h] BYREF
__int128 v11; // [rsp+30h] [rbp-28h]
v4 = *a1;
v5 = *(_QWORD *)(*a1 + 8);
*(_QWORD *)&v11 = v5;
DWORD2(v11) = 0;
if ( !*(_BYTE *)(v5 + 25) )
{
v6 = *a2;
do
{
*(_QWORD *)&v11 = v5;
if ( *(_DWORD *)(v5 + 28) < v6 || *(_DWORD *)(v5 + 28) <= v6 && *(_DWORD *)(v5 + 32) < a2[1] )
{
DWORD2(v11) = 0;
v5 = *(_QWORD *)(v5 + 16);
}
else
{
DWORD2(v11) = 1;
v4 = v5;
v5 = *(_QWORD *)v5;
}
}
while ( !*(_BYTE *)(v5 + 25) );
}
if ( *(_BYTE *)(v4 + 25) || *a2 < *(_DWORD *)(v4 + 28) || *a2 <= *(_DWORD *)(v4 + 28) && a2[1] < *(_DWORD *)(v4 + 32) )
{
if ( a1[1] == 0x555555555555555LL )
sub_140052E40(a1, a2, v5);
v7 = *a1;
v10 = (unsigned __int64)a1;
v8 = (__int64 *)operator new(0x30u);
*(__int64 *)((char *)v8 + 28) = *(_QWORD *)a2;
*(__int64 *)((char *)v8 + 36) = 0;
*v8 = v7;
v8[1] = v7;
v8[2] = v7;
*((_WORD *)v8 + 12) = 0;
v10 = v11;
v4 = sub_1400636D0(a1, (__int64)&v10, (__int64)v8);
}
return v4 + 36;
}