//
// SetupTriggerPopup::toggleLimitValue from 0x10021e6b0 to 0x10021e76e (190 bytes)
//
// 20 xrefs:
// > sub_100272600 @ 0x100272844
// > SetupSongTriggerPopup::init @ 0x1002c030e
// > SetupSongTriggerPopup::init @ 0x1002c0320
// > SetupSongTriggerPopup::init @ 0x1002c050c
// > SetupSFXPopup::init @ 0x1004b1f43
// > SetupSFXPopup::init @ 0x1004b1f55
// > SetupSFXPopup::init @ 0x1004b1f67
// > SetupSFXPopup::init @ 0x1004b2a2a
// > SetupSFXPopup::init @ 0x1004b2a3c
// > SetupSFXPopup::init @ 0x1004b2a4e
// > SetupSFXEditPopup::init @ 0x1004b43b9
// > SetupSFXEditPopup::init @ 0x1004b4abb
// > SetupSFXEditPopup::init @ 0x1004b4acd
// > SetupItemCompareTriggerPopup::init @ 0x1005ad639
// > SetupItemCompareTriggerPopup::init @ 0x1005ad9e0
// > sub_1005B2E60 @ 0x1005b313a
// > AutoSaveSettingsLayer::init @ 0x1005bca28
// > AutoSaveSettingsLayer::init @ 0x1005bceec
// > SetupOptionsTriggerPopup::init @ 0x1006bab45
// > sub_100982340 @ 0x10098268c
//
// 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:27:02 +0000
//
void __fastcall SetupTriggerPopup::toggleLimitValue(__int64 a1, int a2, char a3)
{
_QWORD *v3; // rax
_QWORD *v4; // r13
_QWORD *v5; // r15
_QWORD *v6; // rbx
__int64 v7; // rax
char v8; // [rsp+0h] [rbp-2Ch]
v3 = *(_QWORD **)(a1 + 864);
if ( v3 )
{
while ( 1 )
{
while ( 1 )
{
v5 = v3;
if ( *((_DWORD *)v3 + 7) <= a2 )
break;
v3 = (_QWORD *)*v3;
v4 = v5;
if ( !*v5 )
goto LABEL_8;
}
if ( *((_DWORD *)v3 + 7) >= a2 )
break;
v3 = (_QWORD *)v3[1];
if ( !v3 )
{
v4 = v5 + 1;
goto LABEL_8;
}
}
}
else
{
v4 = (_QWORD *)(a1 + 864);
v5 = (_QWORD *)(a1 + 864);
LABEL_8:
v8 = a3;
v6 = v5;
v5 = operator new(0x28u);
*((_DWORD *)v5 + 7) = a2;
*((_BYTE *)v5 + 32) = 0;
*(_OWORD *)v5 = 0;
v5[2] = v6;
*v4 = v5;
v7 = **(_QWORD **)(a1 + 856);
if ( v7 )
*(_QWORD *)(a1 + 856) = v7;
sub_10001B680(*(__int64 **)(a1 + 864), v5);
++*(_QWORD *)(a1 + 872);
a3 = v8;
}
*((_BYTE *)v5 + 32) = a3;
}