//
// sub_1400BD2C0 from 0x1400bd2c0 to 0x1400bd3b9 (249 bytes)
//
// 12 xrefs:
// > AccountReviewPopup::applySelected @ 0x1400b838b
// > AccountReviewPopup::onSelectAll @ 0x1400b875c
// > SFXFolderPickerPopup::onPickFolder @ 0x1400c62e6
// > CustomSongWidget::loadSongInfoFinished @ 0x14016df3f
// > CustomSongWidget::loadSongInfoFailed @ 0x14016e0e7
// > GJKeybindManager::unbindChord @ 0x140389aec
// > GJKeybindManager::unbindChord @ 0x140389b87
// > KeybindSet::unbindChord @ 0x140449679
// > SelectEventLayer::onCustomToggleTriggerValue @ 0x1405fd73b
// > SFXBrowser::onSelectAll @ 0x14061c09b
// > SFXBrowser::cellPerformedAction @ 0x140620207
// > ??> @ 0x140913934
//
// 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:26:17 +0000
//
__int64 __fastcall sub_1400BD2C0(_QWORD *a1, int *a2)
{
_QWORD *v2; // rbp
_QWORD *v4; // r11
_QWORD *v5; // rbx
__int64 *v6; // rax
__int64 *v7; // r8
int v8; // r9d
int v9; // ecx
__int64 result; // rax
_QWORD *v11; // r11
__int64 v12; // rdi
__int64 **v13; // r11
__int64 **v14; // rax
_QWORD *v15; // [rsp+30h] [rbp+8h] BYREF
v2 = (_QWORD *)*a1;
v4 = (_QWORD *)*a1;
v5 = (_QWORD *)*a1;
v6 = *(__int64 **)(*a1 + 8LL);
v7 = v6;
if ( !*((_BYTE *)v6 + 25) )
{
v8 = *a2;
do
{
v9 = *((_DWORD *)v7 + 7);
if ( v9 >= v8 )
{
if ( *((_BYTE *)v5 + 25) && v8 < v9 )
v5 = v7;
v4 = v7;
}
else
{
v7 += 2;
}
v7 = (__int64 *)*v7;
}
while ( !*((_BYTE *)v7 + 25) );
}
if ( !*((_BYTE *)v5 + 25) )
v6 = (__int64 *)*v5;
while ( !*((_BYTE *)v6 + 25) )
{
if ( *a2 >= *((_DWORD *)v6 + 7) )
{
v6 = (__int64 *)v6[2];
}
else
{
v5 = v6;
v6 = (__int64 *)*v6;
}
}
result = sub_1400BD930(v4, v5, v7);
v12 = result;
v15 = v11;
if ( v11 == (_QWORD *)*v2 && *((_BYTE *)v5 + 25) )
{
sub_1400BD250(a1);
}
else
{
if ( v11 == v5 )
return result;
do
{
sub_1400BD5E0(&v15);
v14 = sub_14006A9D0(a1, v13);
j_j_free(v14);
}
while ( v15 != v5 );
}
return v12;
}