//
// KeybindSet::bindChord from 0x7991dc to 0x7992f0 (276 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:59:47 +0000
//
_DWORD *__fastcall KeybindSet::bindChord(_DWORD *this, int a2, int a3)
{
_DWORD *v3; // r8
_DWORD *v6; // r3
int v7; // r2
_DWORD *v8; // r1
_DWORD *v9; // r5
_DWORD *v10; // r4
_DWORD *v11; // r0
int v12; // r3
int v13; // r3
_DWORD *v14; // r3
int v15; // r2
_DWORD *v16; // r2
_DWORD *v17; // r5
_DWORD *v18; // r0
int v19; // r3
int v20; // r3
_DWORD v21[3]; // [sp+0h] [bp-Ch] BYREF
v21[0] = this;
v21[1] = a2;
v21[2] = a3;
v3 = this;
v6 = (_DWORD *)*(this + 2);
if ( v6 )
{
while ( 1 )
{
v7 = v6[4];
if ( a3 >= v7 )
{
if ( v7 >= a3 )
{
v21[0] = v6;
v9 = v21;
goto LABEL_11;
}
v8 = (_DWORD *)v6[1];
if ( !v8 )
{
v21[0] = v6;
v9 = v6 + 1;
goto LABEL_11;
}
}
else
{
v8 = (_DWORD *)*v6;
if ( !*v6 )
{
v21[0] = v6;
v9 = v6;
goto LABEL_11;
}
}
v6 = v8;
}
}
v9 = this + 2;
v21[0] = this + 2;
LABEL_11:
v10 = (_DWORD *)*v9;
if ( !*v9 )
{
v11 = (_DWORD *)operator new(0x20u);
v11[6] = 0;
v11[7] = 0;
v10 = v11;
*v11 = 0;
v11[1] = 0;
v12 = v21[0];
v11[4] = a3;
v11[5] = v11 + 6;
v11[2] = v12;
*v9 = v11;
v13 = *(_DWORD *)v3[1];
if ( v13 )
v3[1] = v13;
this = std::__tree_balance_after_insert *>((_DWORD *)v3[2], (_DWORD *)*v9);
++v3[3];
}
v14 = (_DWORD *)v10[6];
if ( v14 )
{
while ( 1 )
{
v15 = v14[4];
if ( a2 >= v15 )
{
if ( v15 >= a2 )
{
v21[0] = v14;
v17 = v21;
goto LABEL_25;
}
v16 = (_DWORD *)v14[1];
if ( !v16 )
{
v21[0] = v14;
v17 = v14 + 1;
goto LABEL_25;
}
}
else
{
v16 = (_DWORD *)*v14;
if ( !*v14 )
{
v21[0] = v14;
v17 = v14;
goto LABEL_25;
}
}
v14 = v16;
}
}
v17 = v10 + 6;
v21[0] = v10 + 6;
LABEL_25:
if ( !*v17 )
{
v18 = (_DWORD *)operator new(0x14u);
v19 = v21[0];
v18[4] = a2;
*v18 = 0;
v18[1] = 0;
v18[2] = v19;
*v17 = v18;
v20 = *(_DWORD *)v10[5];
if ( v20 )
v10[5] = v20;
this = std::__tree_balance_after_insert *>((_DWORD *)v10[6], (_DWORD *)*v17);
++v10[7];
}
*((_BYTE *)v3 + 16) = 1;
return this;
}