//
// sub_140338500 from 0x140338500 to 0x140338623 (291 bytes)
//
// 3 xrefs:
// > sub_14033B078 @ 0x14033b07f
// > ??> @ 0x1405ac0c8
// > ??> @ 0x1406d52e8
//
// 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
MusicDownloadDelegate *__fastcall sub_140338500(MusicDownloadDelegate *Block, char a2)
{
MusicDownloadDelegate *v4; // rbx
MusicDownloadManager *v5; // rax
cocos2d::CCObject *v6; // rcx
Block->__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[40].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[41].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[42].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[43].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[44].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[51].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[54].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
v4 = Block + 79;
Block[79].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[80].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[81].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[82].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
Block[83].__vftable = (MusicDownloadDelegate_vtbl *)&MusicBrowser::`vftable';
if ( !Block )
v4 = nullptr;
v5 = MusicDownloadManager::sharedState();
MusicDownloadManager::removeMusicDownloadDelegate(v5, v4);
v6 = (cocos2d::CCObject *)Block[85].__vftable;
if ( v6 )
cocos2d::CCObject::release(v6);
FLAlertLayer::dFLAlertLayer((__int64)Block);
if ( (a2 & 1) != 0 )
j_j_free(Block);
return Block;
}