//
// sub_1400CDBF0 from 0x1400cdbf0 to 0x1400cdcd0 (224 bytes)
//
// 50 xrefs:
// > CustomSongWidget::updateWithMultiAssets @ 0x1400cc45f
// > CustomSongWidget::updateWithMultiAssets @ 0x1400cc560
// > CustomSongWidget::downloadAssetFinished @ 0x1400cd501
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215b1f
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215b3b
// > GJBaseGameLayer::toggleDualMode @ 0x140216ab0
// > GJBaseGameLayer::activatePlayerControlTrigger @ 0x140217561
// > GJBaseGameLayer::activatePlayerControlTrigger @ 0x1402175ff
// > GJBaseGameLayer::activatePlayerControlTrigger @ 0x14021765d
// > GJBaseGameLayer::activatePlayerControlTrigger @ 0x140217711
// > GJBaseGameLayer::activatePlayerControlTrigger @ 0x1402177ae
// > GJBaseGameLayer::activatePlayerControlTrigger @ 0x140217815
// > MenuGameLayer::tryJump @ 0x1403321e9
// > MenuGameLayer::resetPlayer @ 0x140332b14
// > MenuGameLayer::resetPlayer @ 0x140332ec9
// > MenuGameLayer::resetPlayer @ 0x140332ff6
// > PlayerObject::switchedDirTo @ 0x140397e61
// > PlayerObject::switchedDirTo @ 0x140397e84
// > PlayerObject::pushButton @ 0x140397f65
// > PlayerObject::releaseButton @ 0x140398225
// > PlayerObject::releaseAllButtons @ 0x14039f142
// > PlayerObject::releaseAllButtons @ 0x14039f1e0
// > PlayerObject::releaseAllButtons @ 0x14039f25b
// > PlayerObject::lockPlayer @ 0x14039f325
// > PlayerObject::disablePlayerControls @ 0x14039f422
// > PlayerObject::disablePlayerControls @ 0x14039f488
// > PlayerObject::enablePlayerControls @ 0x14039f52b
// > PlayerObject::enablePlayerControls @ 0x14039f552
// > PlayerObject::enablePlayerControls @ 0x14039f56a
// > PlayerObject::enablePlayerControls @ 0x14039f5d0
// > PlayerObject::enablePlayerControls @ 0x14039f5f7
// > PlayerObject::enablePlayerControls @ 0x14039f60f
// > PlayerObject::enablePlayerControls @ 0x14039f676
// > SetupOptionsTriggerPopup::init @ 0x140436653
// > SetupSFXPopup::init @ 0x14044777f
// > SetupSFXPopup::init @ 0x14044779b
// > SetupSFXPopup::init @ 0x1404477b7
// > SetupSFXPopup::init @ 0x14044826d
// > SetupSFXPopup::init @ 0x140448289
// > SetupSFXPopup::init @ 0x1404482a5
// > SetupSFXEditPopup::init @ 0x140449c07
// > SetupSFXEditPopup::init @ 0x14044a0bb
// > SetupSFXEditPopup::init @ 0x14044a0d1
// > SetupSongTriggerPopup::init @ 0x14045cfc5
// > SetupSongTriggerPopup::init @ 0x14045cfdf
// > SetupSongTriggerPopup::init @ 0x14045d1ca
// > SetupItemCompareTriggerPopup::init @ 0x14046d72d
// > SetupItemCompareTriggerPopup::init @ 0x14046db0d
// > SetupTriggerPopup::valueChanged @ 0x140479bc8
// > ??> @ 0x1406c8460
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall sub_1400CDBF0(__int64 *a1, int *a2)
{
__int64 v4; // rbx
__int64 v5; // rax
__int64 v6; // r8
int v7; // r9d
_DWORD *v8; // rax
__int128 v10; // [rsp+20h] [rbp-38h] BYREF
__int128 v11; // [rsp+30h] [rbp-28h]
v4 = *a1;
v5 = *(_QWORD *)(*a1 + 8);
*(_QWORD *)&v11 = v5;
DWORD2(v11) = 0;
v6 = v4;
if ( !*(_BYTE *)(v5 + 25) )
{
v7 = *a2;
do
{
*(_QWORD *)&v11 = v5;
if ( *(_DWORD *)(v5 + 28) >= v7 )
{
DWORD2(v11) = 1;
v6 = v5;
v5 = *(_QWORD *)v5;
}
else
{
DWORD2(v11) = 0;
v5 = *(_QWORD *)(v5 + 16);
}
}
while ( !*(_BYTE *)(v5 + 25) );
}
if ( *(_BYTE *)(v6 + 25) || *a2 < *(_DWORD *)(v6 + 28) )
{
if ( a1[1] == 0x666666666666666LL )
sub_140052E40();
v10 = (unsigned __int64)a1;
v8 = operator new(0x28u);
v8[7] = *a2;
*((_BYTE *)v8 + 32) = 0;
*(_QWORD *)v8 = v4;
*((_QWORD *)v8 + 1) = v4;
*((_QWORD *)v8 + 2) = v4;
*((_WORD *)v8 + 12) = 0;
v10 = v11;
v6 = sub_1400636D0(a1, (__int64)&v10, (__int64)v8);
}
return v6 + 32;
}