//
// GJBaseGameLayer::removeReleasedButtons from 0x100128ac0 to 0x100128c19 (345 bytes)
//
// 1 xrefs:
// > PlayLayer::resetLevel @ 0x10008d35e
//
// 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 12:24:43 +0000
//
__int64 __fastcall GJBaseGameLayer::removeReleasedButtons(__int64 a1)
{
__int64 result; // rax
size_t v2; // r14
unsigned __int64 v3; // rcx
unsigned __int64 v4; // rbx
int v5; // edx
unsigned __int64 v6; // rsi
__int64 v7; // r10
__int64 v8; // r15
size_t v9; // r12
size_t v10; // r15
__int64 v11; // r14
size_t v12; // r15
__int64 v13; // [rsp+0h] [rbp-30h]
result = *(_QWORD *)(a1 + 12824);
v2 = *(_QWORD *)(a1 + 12832);
if ( v2 != result )
{
v3 = 0xAAAAAAAAAAAAAAABLL * ((__int64)(v2 - result) >> 3);
v4 = 0;
v13 = a1;
do
{
v5 = v4 + 1;
if ( *(_BYTE *)(result + 24 * v4 + 4) == 1 && (v6 = v5, v3 > v5) )
{
v7 = result + 24 * v4;
v8 = result + 24LL * v5;
v9 = v2 - result - 24LL * v5 - 24;
while ( *(_DWORD *)v7 != *(_DWORD *)v8 || *(_BYTE *)(v7 + 5) != *(_BYTE *)(v8 + 5) || *(_BYTE *)(v8 + 4) )
{
++v6;
v8 += 24;
v9 -= 24LL;
if ( v3 <= v6 )
goto LABEL_15;
}
if ( v8 + 24 != v2 )
{
memmove((void *)v8, (const void *)(v8 + 24), v9);
a1 = v13;
result = *(_QWORD *)(v13 + 12824);
}
v10 = v9 + v8;
*(_QWORD *)(a1 + 12832) = v10;
v11 = result + 24 * v4;
v12 = v10 - (v11 + 24);
if ( v12 )
{
memmove((void *)(result + 24 * v4), (const void *)(v11 + 24), v12);
a1 = v13;
result = *(_QWORD *)(v13 + 12824);
}
v2 = v12 + v11;
*(_QWORD *)(a1 + 12832) = v2;
}
else
{
LABEL_15:
++v4;
}
v3 = 0xAAAAAAAAAAAAAAABLL * ((__int64)(v2 - result) >> 3);
}
while ( v4 < v3 );
}
return result;
}