//
// GJBaseGameLayer::removeReleasedButtons from 0x14033a810 to 0x14033a99f (399 bytes)
//
// 4 xrefs:
// > PlayLayer::resetLevel @ 0x140519a2b
// > ??> @ 0x1408b71c0
// > ??> @ 0x1408b71d0
// > ??> @ 0x14091fb08
//
// 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:37 +0000
//
unsigned __int64 __fastcall GJBaseGameLayer::removeReleasedButtons(__int64 a1)
{
__int64 v1; // r10
__int64 v2; // r9
unsigned __int64 v3; // rbx
unsigned __int64 result; // rax
__int64 v6; // rsi
int v7; // r8d
char v8; // bp
__int64 v9; // r11
unsigned __int64 v10; // rdx
_BYTE *v11; // rax
unsigned __int64 v12; // rax
v1 = *(_QWORD *)(a1 + 13320);
v2 = *(_QWORD *)(a1 + 13312);
v3 = 0;
for ( result = (unsigned __int64)((unsigned __int128)((v1 - v2) * (__int128)0x2AAAAAAAAAAAAAABLL) >> 64) >> 63;
v3 < (v1 - v2) / 24;
result = (unsigned __int64)((unsigned __int128)((v1 - v2) * (__int128)0x2AAAAAAAAAAAAAABLL) >> 64) >> 63 )
{
v6 = 24 * v3;
if ( *(_BYTE *)(24 * v3 + v2 + 4) )
{
v7 = v3 + 1;
v8 = 0;
v9 = v2;
v10 = (v1 - v2) / 24;
if ( (int)v3 + 1 < v10 )
{
v11 = (_BYTE *)(v2 + 24LL * v7 + 4);
while ( *(_DWORD *)(v6 + v2) != *((_DWORD *)v11 - 1) || *(_BYTE *)(v6 + v2 + 5) != v11[1] || *v11 )
{
++v7;
v11 += 24;
if ( v7 >= v10 )
goto LABEL_11;
}
memmove(
(void *)(v2 + 24LL * v7),
(const void *)(v2 + 24LL * v7 + 24),
*(_QWORD *)(a1 + 13320) - (v2 + 24LL * v7 + 24));
*(_QWORD *)(a1 + 13320) -= 24LL;
memmove(
(void *)(v6 + *(_QWORD *)(a1 + 13312)),
(const void *)(v6 + *(_QWORD *)(a1 + 13312) + 24),
*(_QWORD *)(a1 + 13320) - (v6 + *(_QWORD *)(a1 + 13312) + 24));
*(_QWORD *)(a1 + 13320) -= 24LL;
v8 = 1;
v9 = *(_QWORD *)(a1 + 13312);
}
LABEL_11:
v12 = v3 + 1;
v2 = v9;
if ( v8 )
v12 = v3;
v3 = v12;
}
else
{
++v3;
}
v1 = *(_QWORD *)(a1 + 13320);
}
return result;
}