//
// sub_140354DF0 from 0x140354df0 to 0x140354f01 (273 bytes)
//
// 7 xrefs:
// > GJBaseGameLayer::gameEventTriggered @ 0x14033acff
// > GJBaseGameLayer::activateEventTrigger @ 0x14033ae86
// > GJBaseGameLayer::activateEventTrigger @ 0x14033af74
// > GJEffectManager::registerRotationCommand @ 0x1403699a0
// > GJEffectManager::registerRotationCommand @ 0x1403699be
// > sub_14052A7F0 @ 0x14052a9f2
// > ??> @ 0x1409207ec
//
// 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_140354DF0(unsigned __int64 a1, int *a2)
{
_QWORD *v3; // rdi
__int64 v4; // rsi
__int64 v5; // rax
__int64 v6; // r8
int v7; // r9d
int v8; // eax
__int64 *v9; // rax
__int128 v11; // [rsp+20h] [rbp-38h] BYREF
__int128 v12; // [rsp+30h] [rbp-28h]
v3 = (_QWORD *)a1;
v4 = *(_QWORD *)a1;
v5 = *(_QWORD *)(*(_QWORD *)a1 + 8LL);
*(_QWORD *)&v12 = v5;
DWORD2(v12) = 0;
v6 = v4;
if ( !*(_BYTE *)(v5 + 25) )
{
v7 = *a2;
do
{
*(_QWORD *)&v12 = v5;
if ( *(_DWORD *)(v5 + 32) < v7
|| *(_DWORD *)(v5 + 32) <= v7 && (a1 = (unsigned int)a2[1], *(_DWORD *)(v5 + 36) < (int)a1) )
{
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 + 32), *a2 < v8) || *a2 <= v8 && a2[1] < *(_DWORD *)(v6 + 36) )
{
if ( v3[1] == 0x3FFFFFFFFFFFFFFLL )
sub_14005BD90(a1, a2, v6);
v11 = (unsigned __int64)v3;
v9 = (__int64 *)operator new(0x40u);
v9[4] = *(_QWORD *)a2;
v9[5] = 0;
v9[6] = 0;
v9[7] = 0;
*v9 = v4;
v9[1] = v4;
v9[2] = v4;
*((_WORD *)v9 + 12) = 0;
v11 = v12;
v6 = sub_14006A770(v3, (__int64)&v11, (__int64)v9);
}
return v6 + 40;
}