{"type": "func", "start": 5730228, "end": 5730476, "name": "CCPartAnimSprite::getSpriteForKey", "pseudocode": "// \n// CCPartAnimSprite::getSpriteForKey from 0x576fb4 to 0x5770ac (248 bytes)\n// \n// 4 xrefs:\n// > GJRobotSprite::updateColors @ 0x8e2d78\n// > GJRobotSprite::updateColors @ 0x8e2d8c\n// > GJRobotSprite::updateColors @ 0x8e2da0\n// > <???> @ 0xb30a0\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\nCCSpritePart *CCPartAnimSprite::getSpriteForKey(CCPartAnimSprite *a1, const char *a2)\n{\n  cocos2d::CCDictionary *m_spritePartIDs; // x21\n  CCSpritePart *v3; // x20\n  char *v4; // x0\n  unsigned int *v6; // x2\n  int v7; // w1\n  std::string v8; // [xsp+40h] [xbp+40h] BYREF\n\n  m_spritePartIDs = a1->m_spritePartIDs;\n  sub_D153B8((int)&v8, (char *)a2);\n  v3 = (CCSpritePart *)cocos2d::CCDictionary::objectForKey(m_spritePartIDs, &v8);\n  v4 = (char *)v8.m_data.m_data - 24;\n  if ( (__int64 *)v8.m_data.m_data - 3 != &qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v6 = (unsigned int *)((char *)v8.m_data.m_data - 8);\n      do\n        v7 = __ldaxr(v6);\n      while ( __stlxr(v7 - 1, v6) );\n    }\n    else\n    {\n      v7 = *((_DWORD *)v8.m_data.m_data - 2);\n      *((_DWORD *)v8.m_data.m_data - 2) = v7 - 1;\n    }\n    if ( v7 <= 0 )\n      operator delete(v4);\n  }\n  return v3;\n}", "assembly": "; \n; CCPartAnimSprite::getSpriteForKey from 0x576fb4 to 0x5770ac (248 bytes)\n; \n; 4 xrefs:\n; > GJRobotSprite::updateColors @ 0x8e2d78\n; > GJRobotSprite::updateColors @ 0x8e2d8c\n; > GJRobotSprite::updateColors @ 0x8e2da0\n; > <???> @ 0xb30a0\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, 0x576fb4\nMOV             X29, SP                                                ; +0x4, 0x576fb8\nSTP             X19, X20, [SP,#0x50+var_40]                            ; +0x8, 0x576fbc\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x576fc0\nADD             X20, X29, #0x50+var_10                                 ; +0x10, 0x576fc4\nSTR             X21, [SP,#0x50+var_30]                                 ; +0x14, 0x576fc8\nADD             X2, X29, #0x50+var_20                                  ; +0x18, 0x576fcc\nLDR             X21, [X0,#0x258]                                       ; +0x1c, 0x576fd0\nMOV             X0, X20; int                                           ; +0x20, 0x576fd4\nLDR             X3, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x24, 0x576fd8\nLDR             X3, [X3]                                               ; +0x28, 0x576fdc\nSTR             X3, [X29,#0x50+var_8]                                  ; +0x2c, 0x576fe0\nBL              sub_D153B8                                             ; +0x30, 0x576fe4\nMOV             X0, X21                                                ; +0x34, 0x576fe8\nMOV             X1, X20                                                ; +0x38, 0x576fec\nBL              _ZN7cocos2d12CCDictionary12objectForKeyERKSs; cocos2d::CCDictionary::objectForKey(std::string const&) ; +0x3c, 0x576ff0\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x40, 0x576ff4\nLDR             X2, [X29,#0x50+var_10]                                 ; +0x44, 0x576ff8\nMOV             X20, X0                                                ; +0x48, 0x576ffc\nSUB             X0, X2, #0x18; p                                       ; +0x4c, 0x577000\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x50, 0x577004\nCMP             X0, X1                                                 ; +0x54, 0x577008\nB.NE            loc_577038                                             ; +0x58, 0x57700c\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x5c, 0x577010\nMOV             X0, X20                                                ; +0x60, 0x577014\nLDR             X2, [X29,#0x50+var_8]                                  ; +0x64, 0x577018\nLDR             X1, [X19]                                              ; +0x68, 0x57701c\nCMP             X2, X1                                                 ; +0x6c, 0x577020\nB.NE            loc_57707C                                             ; +0x70, 0x577024\nLDP             X19, X20, [SP,#0x50+var_40]                            ; +0x74, 0x577028\nLDR             X21, [SP,#0x50+var_30]                                 ; +0x78, 0x57702c\nLDP             X29, X30, [SP+0x50+var_50],#0x50                       ; +0x7c, 0x577030\nRET                                                                    ; +0x80, 0x577034\nADRP            X1, #pthread_create_ptr_0@PAGE                         ; +0x84, 0x577038\nLDR             X1, [X1,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0x88, 0x57703c\nCBZ             X1, loc_57706C                                         ; +0x8c, 0x577040\nSUB             X2, X2, #8                                             ; +0x90, 0x577044\nLDAXR           W1, [X2]                                               ; +0x94, 0x577048\nSUB             W3, W1, #1                                             ; +0x98, 0x57704c\nSTLXR           W4, W3, [X2]                                           ; +0x9c, 0x577050\nCBNZ            W4, loc_577048                                         ; +0xa0, 0x577054\nCMP             W1, WZR                                                ; +0xa4, 0x577058\nB.GT            loc_577010                                             ; +0xa8, 0x57705c\nADD             X1, X29, #0x50+var_18                                  ; +0xac, 0x577060\nBL              j__ZdlPv; operator delete(void *)                      ; +0xb0, 0x577064\nB               loc_577010                                             ; +0xb4, 0x577068\nLDUR            W1, [X2,#-8]                                           ; +0xb8, 0x57706c\nSUB             W3, W1, #1                                             ; +0xbc, 0x577070\nSTUR            W3, [X2,#-8]                                           ; +0xc0, 0x577074\nB               loc_577058                                             ; +0xc4, 0x577078\nBL              .__stack_chk_fail                                      ; +0xc8, 0x57707c\nADRP            X1, #off_122EFE8@PAGE                                  ; +0xcc, 0x577080\nMOV             X19, X0                                                ; +0xd0, 0x577084\nLDR             X0, [X29,#0x50+var_10]                                 ; +0xd4, 0x577088\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0xd8, 0x57708c\nSUB             X0, X0, #0x18                                          ; +0xdc, 0x577090\nCMP             X0, X1                                                 ; +0xe0, 0x577094\nB.EQ            loc_5770A4                                             ; +0xe4, 0x577098\nADD             X1, X29, #0x50+var_18                                  ; +0xe8, 0x57709c\nBL              sub_4DB080                                             ; +0xec, 0x5770a0\nMOV             X0, X19                                                ; +0xf0, 0x5770a4\nBL              _Unwind_Resume                                         ; +0xf4, 0x5770a8", "xrefs": ["GJRobotSprite::updateColors @ 0x8e2d78", "GJRobotSprite::updateColors @ 0x8e2d8c", "GJRobotSprite::updateColors @ 0x8e2da0", "<???> @ 0xb30a0"], "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"}