{"type": "func", "start": 6027356, "end": 6027628, "name": "FindBPMLayer::playMusic", "pseudocode": "// \n// FindBPMLayer::playMusic from 0x5bf85c to 0x5bf96c (272 bytes)\n// \n// 2 xrefs:\n// > <???> @ 0xb1a80\n// > <???> @ 0x1146ab8\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nvoid FindBPMLayer::playMusic(FindBPMLayer *a1)\n{\n  FMODAudioEngine *v2; // x22\n  MusicDownloadManager *v3; // x0\n  void *v4; // x0\n  unsigned int *v5; // x2\n  int v6; // w1\n  __int64 v7; // [xsp+40h] [xbp+40h] BYREF\n\n  v2 = FMODAudioEngine::sharedEngine();\n  v3 = MusicDownloadManager::sharedState();\n  MusicDownloadManager::pathForSong(&v7, v3, a1->m_songID);\n  FMODAudioEngine::loadAndPlayMusic(v2, (__int64)&v7, (unsigned int)(float)(a1->m_elapsed * 1000.0), 0);\n  v4 = (void *)(v7 - 24);\n  if ( (__int64 *)(v7 - 24) != &qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v5 = (unsigned int *)(v7 - 8);\n      do\n        v6 = __ldaxr(v5);\n      while ( __stlxr(v6 - 1, v5) );\n    }\n    else\n    {\n      v6 = *(_DWORD *)(v7 - 8);\n      *(_DWORD *)(v7 - 8) = v6 - 1;\n    }\n    if ( v6 <= 0 )\n      operator delete(v4);\n  }\n}", "assembly": "; \n; FindBPMLayer::playMusic from 0x5bf85c to 0x5bf96c (272 bytes)\n; \n; 2 xrefs:\n; > <???> @ 0xb1a80\n; > <???> @ 0x1146ab8\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nSTP             X29, X30, [SP,#var_50]!                                ; +0x0, 0x5bf85c\nMOV             X29, SP                                                ; +0x4, 0x5bf860\nSTP             X19, X20, [SP,#0x50+var_40]                            ; +0x8, 0x5bf864\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x5bf868\nADD             X20, X29, #0x50+var_10                                 ; +0x10, 0x5bf86c\nSTP             X21, X22, [SP,#0x50+var_30]                            ; +0x14, 0x5bf870\nMOV             X21, X0                                                ; +0x18, 0x5bf874\nLDR             X0, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x1c, 0x5bf878\nLDR             X0, [X0]; this                                         ; +0x20, 0x5bf87c\nSTR             X0, [X29,#0x50+var_8]                                  ; +0x24, 0x5bf880\nBL              _ZN15FMODAudioEngine12sharedEngineEv; FMODAudioEngine::sharedEngine(void) ; +0x28, 0x5bf884\nMOV             X22, X0                                                ; +0x2c, 0x5bf888\nBL              _ZN20MusicDownloadManager11sharedStateEv; MusicDownloadManager::sharedState(void) ; +0x30, 0x5bf88c\nLDR             W1, [X21,#0x2C8]; int                                  ; +0x34, 0x5bf890\nMOV             X8, X20                                                ; +0x38, 0x5bf894\nBL              _ZN20MusicDownloadManager11pathForSongEi; MusicDownloadManager::pathForSong(int) ; +0x3c, 0x5bf898\nLDR             S0, [X21,#0x2B0]                                       ; +0x40, 0x5bf89c\nMOV             X0, X22                                                ; +0x44, 0x5bf8a0\nLDR             S1, =0x447A0000                                        ; +0x48, 0x5bf8a4\nMOV             X1, X20                                                ; +0x4c, 0x5bf8a8\nMOV             W3, #0                                                 ; +0x50, 0x5bf8ac\nFMUL            S0, S0, S1                                             ; +0x54, 0x5bf8b0\nFCVTZU          W2, S0                                                 ; +0x58, 0x5bf8b4\nBL              _ZN15FMODAudioEngine16loadAndPlayMusicESsji; FMODAudioEngine::loadAndPlayMusic(std::string,uint,int) ; +0x5c, 0x5bf8b8\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x60, 0x5bf8bc\nLDR             X2, [X29,#0x50+var_10]                                 ; +0x64, 0x5bf8c0\nSUB             X0, X2, #0x18; p                                       ; +0x68, 0x5bf8c4\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x6c, 0x5bf8c8\nCMP             X0, X1                                                 ; +0x70, 0x5bf8cc\nB.NE            loc_5BF8F8                                             ; +0x74, 0x5bf8d0\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x78, 0x5bf8d4\nLDR             X1, [X29,#0x50+var_8]                                  ; +0x7c, 0x5bf8d8\nLDR             X0, [X19]                                              ; +0x80, 0x5bf8dc\nCMP             X1, X0                                                 ; +0x84, 0x5bf8e0\nB.NE            loc_5BF93C                                             ; +0x88, 0x5bf8e4\nLDP             X19, X20, [SP,#0x50+var_40]                            ; +0x8c, 0x5bf8e8\nLDP             X21, X22, [SP,#0x50+var_30]                            ; +0x90, 0x5bf8ec\nLDP             X29, X30, [SP+0x50+var_50],#0x50                       ; +0x94, 0x5bf8f0\nRET                                                                    ; +0x98, 0x5bf8f4\nADRP            X1, #pthread_create_ptr_0@PAGE                         ; +0x9c, 0x5bf8f8\nLDR             X1, [X1,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0xa0, 0x5bf8fc\nCBZ             X1, loc_5BF92C                                         ; +0xa4, 0x5bf900\nSUB             X2, X2, #8                                             ; +0xa8, 0x5bf904\nLDAXR           W1, [X2]                                               ; +0xac, 0x5bf908\nSUB             W3, W1, #1                                             ; +0xb0, 0x5bf90c\nSTLXR           W4, W3, [X2]                                           ; +0xb4, 0x5bf910\nCBNZ            W4, loc_5BF908                                         ; +0xb8, 0x5bf914\nCMP             W1, WZR                                                ; +0xbc, 0x5bf918\nB.GT            loc_5BF8D4                                             ; +0xc0, 0x5bf91c\nADD             X1, X29, #0x50+var_18                                  ; +0xc4, 0x5bf920\nBL              j__ZdlPv; operator delete(void *)                      ; +0xc8, 0x5bf924\nB               loc_5BF8D4                                             ; +0xcc, 0x5bf928\nLDUR            W1, [X2,#-8]                                           ; +0xd0, 0x5bf92c\nSUB             W3, W1, #1                                             ; +0xd4, 0x5bf930\nSTUR            W3, [X2,#-8]                                           ; +0xd8, 0x5bf934\nB               loc_5BF918                                             ; +0xdc, 0x5bf938\nBL              .__stack_chk_fail                                      ; +0xe0, 0x5bf93c\nADRP            X1, #off_122EFE8@PAGE                                  ; +0xe4, 0x5bf940\nMOV             X19, X0                                                ; +0xe8, 0x5bf944\nLDR             X0, [X29,#0x50+var_10]                                 ; +0xec, 0x5bf948\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0xf0, 0x5bf94c\nSUB             X0, X0, #0x18                                          ; +0xf4, 0x5bf950\nCMP             X0, X1                                                 ; +0xf8, 0x5bf954\nB.EQ            loc_5BF964                                             ; +0xfc, 0x5bf958\nADD             X1, X29, #0x50+var_18                                  ; +0x100, 0x5bf95c\nBL              sub_4DB3D0                                             ; +0x104, 0x5bf960\nMOV             X0, X19                                                ; +0x108, 0x5bf964\nBL              _Unwind_Resume                                         ; +0x10c, 0x5bf968", "xrefs": ["<???> @ 0xb1a80", "<???> @ 0x1146ab8"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}