//
// sub_1400BDBE0 from 0x1400bdbe0 to 0x1400bdc7b (155 bytes)
//
// 15 xrefs:
// > sub_1400BD3C0 @ 0x1400bd4cd
// > EmotePickerPopup::onBuildWindowContent @ 0x140123e8c
// > GJBaseGameLayer::init @ 0x14030cfa2
// > GJBaseGameLayer::init @ 0x14030cffb
// > GJBaseGameLayer::init @ 0x14030d6e8
// > GJEffectManager::init @ 0x1403650b8
// > GJEffectManager::init @ 0x140365177
// > sub_1403C0830 @ 0x1403c09aa
// > LevelEditorLayer::init @ 0x1403edf6b
// > LevelEditorLayer::init @ 0x1403ee328
// > sub_140403620 @ 0x140403d16
// > MusicDownloadManager::noteSFXUsed @ 0x140484f9e
// > sub_14049CCB0 @ 0x14049cd93
// > sub_140668F10 @ 0x140668fd7
// > ??> @ 0x140913a00
//
// 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_1400BDBE0(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
_QWORD *v6; // rcx
__int64 result; // rax
v6 = *(_QWORD **)a1;
if ( v6 )
{
if ( ((*(_QWORD *)(a1 + 16) - (_QWORD)v6) & 0xFFFFFFFFFFFFFFF8uLL) >= 0x1000 )
{
if ( (unsigned __int64)v6 - *(v6 - 1) - 8 > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
v6 = (_QWORD *)*(v6 - 1);
}
j_j_free(v6);
}
*(_QWORD *)a1 = a2;
*(_QWORD *)(a1 + 8) = a2 + 8 * a3;
result = a2 + 8 * a4;
*(_QWORD *)(a1 + 16) = result;
return result;
}