{"type": "func", "start": 9208676, "end": 9208936, "name": "GJOptionsLayer::countForPage", "pseudocode": "// \n// GJOptionsLayer::countForPage from 0x8c8364 to 0x8c8468 (260 bytes)\n// \n// 3 xrefs:\n// > GJOptionsLayer::nextPosition @ 0x8c8500\n// > GJOptionsLayer::incrementCountForPage @ 0x8c85bc\n// > <???> @ 0x3ebf8\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\nint GJOptionsLayer::countForPage(GJOptionsLayer *a1, int a2)\n{\n  cocos2d::CCDictionary *m_values; // x21\n  char *v3; // x0\n  cocos2d::CCString *v4; // x0\n  int v5; // w20\n  char *v6; // x0\n  unsigned int *v8; // x2\n  int v9; // w1\n  std::string v10; // [xsp+40h] [xbp+40h] BYREF\n\n  m_values = a1->m_values;\n  v3 = (char *)GJOptionsLayer::pageKey(a1, a2);\n  sub_D153B8((int)&v10, v3);\n  v4 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(m_values, &v10);\n  v5 = cocos2d::CCString::intValue(v4);\n  v6 = (char *)v10.m_data.m_data - 24;\n  if ( (__int64 *)v10.m_data.m_data - 3 != &qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v8 = (unsigned int *)((char *)v10.m_data.m_data - 8);\n      do\n        v9 = __ldaxr(v8);\n      while ( __stlxr(v9 - 1, v8) );\n    }\n    else\n    {\n      v9 = *((_DWORD *)v10.m_data.m_data - 2);\n      *((_DWORD *)v10.m_data.m_data - 2) = v9 - 1;\n    }\n    if ( v9 <= 0 )\n      operator delete(v6);\n  }\n  return v5;\n}", "assembly": "; \n; GJOptionsLayer::countForPage from 0x8c8364 to 0x8c8468 (260 bytes)\n; \n; 3 xrefs:\n; > GJOptionsLayer::nextPosition @ 0x8c8500\n; > GJOptionsLayer::incrementCountForPage @ 0x8c85bc\n; > <???> @ 0x3ebf8\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, 0x8c8364\nMOV             X29, SP                                                ; +0x4, 0x8c8368\nSTP             X19, X20, [SP,#0x50+var_40]                            ; +0x8, 0x8c836c\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x8c8370\nSTR             X21, [SP,#0x50+var_30]                                 ; +0x10, 0x8c8374\nADD             X20, X29, #0x50+var_10                                 ; +0x14, 0x8c8378\nLDR             X21, [X0,#0x3E0]                                       ; +0x18, 0x8c837c\nLDR             X2, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x1c, 0x8c8380\nLDR             X2, [X2]                                               ; +0x20, 0x8c8384\nSTR             X2, [X29,#0x50+var_8]                                  ; +0x24, 0x8c8388\nBL              _ZN14GJOptionsLayer7pageKeyEi; GJOptionsLayer::pageKey(int) ; +0x28, 0x8c838c\nMOV             X1, X0; char *                                         ; +0x2c, 0x8c8390\nADD             X2, X29, #0x50+var_20                                  ; +0x30, 0x8c8394\nMOV             X0, X20; int                                           ; +0x34, 0x8c8398\nBL              sub_D153B8                                             ; +0x38, 0x8c839c\nMOV             X0, X21                                                ; +0x3c, 0x8c83a0\nMOV             X1, X20                                                ; +0x40, 0x8c83a4\nBL              _ZN7cocos2d12CCDictionary11valueForKeyERKSs; cocos2d::CCDictionary::valueForKey(std::string const&) ; +0x44, 0x8c83a8\nBL              _ZNK7cocos2d8CCString8intValueEv; cocos2d::CCString::intValue(void) ; +0x48, 0x8c83ac\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x4c, 0x8c83b0\nLDR             X2, [X29,#0x50+var_10]                                 ; +0x50, 0x8c83b4\nMOV             W20, W0                                                ; +0x54, 0x8c83b8\nSUB             X0, X2, #0x18; p                                       ; +0x58, 0x8c83bc\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x5c, 0x8c83c0\nCMP             X0, X1                                                 ; +0x60, 0x8c83c4\nB.NE            loc_8C83F4                                             ; +0x64, 0x8c83c8\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x68, 0x8c83cc\nMOV             W0, W20                                                ; +0x6c, 0x8c83d0\nLDR             X2, [X29,#0x50+var_8]                                  ; +0x70, 0x8c83d4\nLDR             X1, [X19]                                              ; +0x74, 0x8c83d8\nCMP             X2, X1                                                 ; +0x78, 0x8c83dc\nB.NE            loc_8C8438                                             ; +0x7c, 0x8c83e0\nLDP             X19, X20, [SP,#0x50+var_40]                            ; +0x80, 0x8c83e4\nLDR             X21, [SP,#0x50+var_30]                                 ; +0x84, 0x8c83e8\nLDP             X29, X30, [SP+0x50+var_50],#0x50                       ; +0x88, 0x8c83ec\nRET                                                                    ; +0x8c, 0x8c83f0\nADRP            X1, #pthread_create_ptr_0@PAGE                         ; +0x90, 0x8c83f4\nLDR             X1, [X1,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0x94, 0x8c83f8\nCBZ             X1, loc_8C8428                                         ; +0x98, 0x8c83fc\nSUB             X2, X2, #8                                             ; +0x9c, 0x8c8400\nLDAXR           W1, [X2]                                               ; +0xa0, 0x8c8404\nSUB             W3, W1, #1                                             ; +0xa4, 0x8c8408\nSTLXR           W4, W3, [X2]                                           ; +0xa8, 0x8c840c\nCBNZ            W4, loc_8C8404                                         ; +0xac, 0x8c8410\nCMP             W1, WZR                                                ; +0xb0, 0x8c8414\nB.GT            loc_8C83CC                                             ; +0xb4, 0x8c8418\nADD             X1, X29, #0x50+var_18                                  ; +0xb8, 0x8c841c\nBL              j__ZdlPv; operator delete(void *)                      ; +0xbc, 0x8c8420\nB               loc_8C83CC                                             ; +0xc0, 0x8c8424\nLDUR            W1, [X2,#-8]                                           ; +0xc4, 0x8c8428\nSUB             W3, W1, #1                                             ; +0xc8, 0x8c842c\nSTUR            W3, [X2,#-8]                                           ; +0xcc, 0x8c8430\nB               loc_8C8414                                             ; +0xd0, 0x8c8434\nBL              .__stack_chk_fail                                      ; +0xd4, 0x8c8438\nADRP            X1, #off_122EFE8@PAGE                                  ; +0xd8, 0x8c843c\nMOV             X19, X0                                                ; +0xdc, 0x8c8440\nLDR             X0, [X29,#0x50+var_10]                                 ; +0xe0, 0x8c8444\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0xe4, 0x8c8448\nSUB             X0, X0, #0x18                                          ; +0xe8, 0x8c844c\nCMP             X0, X1                                                 ; +0xec, 0x8c8450\nB.EQ            loc_8C8460                                             ; +0xf0, 0x8c8454\nADD             X1, X29, #0x50+var_18                                  ; +0xf4, 0x8c8458\nBL              sub_4DC698                                             ; +0xf8, 0x8c845c\nMOV             X0, X19                                                ; +0xfc, 0x8c8460\nBL              _Unwind_Resume                                         ; +0x100, 0x8c8464", "xrefs": ["GJOptionsLayer::nextPosition @ 0x8c8500", "GJOptionsLayer::incrementCountForPage @ 0x8c85bc", "<???> @ 0x3ebf8"], "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"}