//
// KeybindSet::bindChord from 0xcf4314 to 0xcf44f8 (484 bytes)
//
// 2 xrefs:
// > ??> @ 0xd7fe0
// > ??> @ 0x1504470
//
// This function is hookable on this platform (idp: arm, 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 13:06:47 +0000
//
__int64 __fastcall KeybindSet::bindChord(KeybindSet *this, int a2, int a3)
{
__int64 **v5; // x24
__int64 v6; // x19
int v7; // w0
bool v8; // cc
__int64 v9; // x0
int v10; // w0
__int64 **v11; // x20
__int64 *v12; // x1
__int64 v13; // x0
__int64 *v14; // x0
int v15; // w1
bool v16; // cc
__int64 *v17; // x1
int v18; // w1
__int64 v19; // x0
__int64 v20; // x1
char *v23; // [xsp+50h] [xbp+50h]
__int64 **v24; // [xsp+50h] [xbp+50h]
v5 = (__int64 **)((char *)this + 16);
v6 = *((_QWORD *)this + 2);
if ( v6 )
{
v7 = *(_DWORD *)(v6 + 32);
v8 = v7 < a3;
if ( v7 <= a3 )
goto LABEL_5;
while ( 1 )
{
v9 = *(_QWORD *)v6;
if ( !*(_QWORD *)v6 )
break;
while ( 1 )
{
v6 = v9;
v10 = *(_DWORD *)(v9 + 32);
v8 = v10 < a3;
if ( v10 > a3 )
break;
LABEL_5:
if ( !v8 )
{
v14 = *(__int64 **)(v6 + 48);
v11 = (__int64 **)(v6 + 48);
if ( !v14 )
goto LABEL_13;
goto LABEL_15;
}
v9 = *(_QWORD *)(v6 + 8);
if ( !v9 )
{
v23 = (char *)v6;
v5 = (__int64 **)(v6 + 8);
goto LABEL_10;
}
}
}
v23 = (char *)v6;
v5 = (__int64 **)v6;
}
else
{
v23 = (char *)this + 16;
}
LABEL_10:
v6 = operator new(0x40u);
v11 = (__int64 **)(v6 + 48);
*(_QWORD *)v6 = 0;
v12 = (__int64 *)v6;
*(_DWORD *)(v6 + 32) = a3;
*(_QWORD *)(v6 + 48) = 0;
*(_QWORD *)(v6 + 56) = 0;
*(_QWORD *)(v6 + 40) = v6 + 48;
*(_QWORD *)(v6 + 8) = 0;
*(_QWORD *)(v6 + 16) = v23;
*v5 = (__int64 *)v6;
v13 = **((_QWORD **)this + 1);
if ( v13 )
{
*((_QWORD *)this + 1) = v13;
v12 = *v5;
}
std::__tree_balance_after_insert *>(*((__int64 **)this + 2), v12);
++*((_QWORD *)this + 3);
v14 = *(__int64 **)(v6 + 48);
if ( v14 )
{
LABEL_15:
v15 = *((_DWORD *)v14 + 7);
v16 = v15 < a2;
if ( v15 <= a2 )
goto LABEL_18;
while ( 1 )
{
v17 = (__int64 *)*v14;
if ( !*v14 )
break;
while ( 1 )
{
v14 = v17;
v18 = *((_DWORD *)v17 + 7);
v16 = v18 < a2;
if ( v18 > a2 )
break;
LABEL_18:
if ( !v16 )
goto LABEL_26;
v17 = (__int64 *)v14[1];
if ( !v17 )
{
v24 = (__int64 **)v14;
v11 = (__int64 **)(v14 + 1);
goto LABEL_23;
}
}
}
v24 = (__int64 **)v14;
v11 = (__int64 **)v14;
}
else
{
LABEL_13:
v24 = v11;
}
LABEL_23:
v19 = operator new(0x20u);
*(_DWORD *)(v19 + 28) = a2;
*(_QWORD *)v19 = 0;
*(_QWORD *)(v19 + 8) = 0;
*(_QWORD *)(v19 + 16) = v24;
*v11 = (__int64 *)v19;
v20 = **(_QWORD **)(v6 + 40);
if ( v20 )
{
*(_QWORD *)(v6 + 40) = v20;
std::__tree_balance_after_insert *>(*(__int64 **)(v6 + 48), *v11);
}
else
{
std::__tree_balance_after_insert *>(*(__int64 **)(v6 + 48), (__int64 *)v19);
}
++*(_QWORD *)(v6 + 56);
LABEL_26:
*((_BYTE *)this + 32) = 1;
return _stack_chk_guard;
}