{"type": "func", "start": 4294996000, "end": 4294996200, "name": "GJSmartTemplate::getTotalChanceForPrefab", "pseudocode": "// \n// GJSmartTemplate::getTotalChanceForPrefab from 0x100007020 to 0x1000070e8 (200 bytes)\n// \n// 3 xrefs:\n// > GJSmartTemplate::getRandomPrefab @ 0x100006164\n// > BrowseSmartKeyLayer::init @ 0x100072c94\n// > BrowseSmartKeyLayer::updateChanceValues @ 0x100073990\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\n__int64 __fastcall GJSmartTemplate::getTotalChanceForPrefab(__int64 a1, __int64 a2)\n{\n  __int64 v3; // x0\n  __int64 v4; // x19\n  __int64 result; // x0\n  unsigned int *v6; // x8\n  __int64 v7; // x9\n  unsigned __int64 v8; // x8\n  unsigned __int64 v9; // x9\n  void *__p[2]; // [xsp+0h] [xbp-30h] BYREF\n  __int64 v11; // [xsp+10h] [xbp-20h]\n\n  if ( *(char *)(a2 + 23) < 0 )\n  {\n    sub_1000097D0(__p, *(void **)a2);\n  }\n  else\n  {\n    *(_OWORD *)__p = *(_OWORD *)a2;\n    v11 = *(_QWORD *)(a2 + 16);\n  }\n  v3 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 56), __p);\n  v4 = v3;\n  if ( SHIBYTE(v11) < 0 )\n  {\n    operator delete(__p[0]);\n    if ( !v4 )\n      return 0;\n  }\n  else if ( !v3 )\n  {\n    return 0;\n  }\n  result = sub_10024A36C(v4);\n  if ( !(_DWORD)result )\n    return result;\n  v6 = *(unsigned int **)(v4 + 56);\n  v7 = *v6;\n  if ( !(_DWORD)v7 )\n    return 0;\n  result = 0;\n  v8 = *((_QWORD *)v6 + 2);\n  v9 = v8 + 8 * v7 - 8;\n  do\n  {\n    if ( !*(_QWORD *)v8 )\n      break;\n    result = (unsigned int)(*(_DWORD *)(*(_QWORD *)v8 + 108LL) + result);\n    v8 += 8LL;\n  }\n  while ( v8 <= v9 );\n  return result;\n}", "assembly": "; \n; GJSmartTemplate::getTotalChanceForPrefab from 0x100007020 to 0x1000070e8 (200 bytes)\n; \n; 3 xrefs:\n; > GJSmartTemplate::getRandomPrefab @ 0x100006164\n; > BrowseSmartKeyLayer::init @ 0x100072c94\n; > BrowseSmartKeyLayer::updateChanceValues @ 0x100073990\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\nSUB             SP, SP, #0x40                                          ; +0x0, 0x100007020\nSTP             X20, X19, [SP,#0x30+var_10]                            ; +0x4, 0x100007024\nSTP             X29, X30, [SP,#0x30+var_s0]                            ; +0x8, 0x100007028\nADD             X29, SP, #0x30                                         ; +0xc, 0x10000702c\nMOV             X19, X0                                                ; +0x10, 0x100007030\nLDRSB           W8, [X1,#0x17]                                         ; +0x14, 0x100007034\nTBNZ            W8, #0x1F, loc_100007050                               ; +0x18, 0x100007038\nLDR             Q0, [X1]                                               ; +0x1c, 0x10000703c\nSTR             Q0, [SP,#0x30+__p]                                     ; +0x20, 0x100007040\nLDR             X8, [X1,#0x10]                                         ; +0x24, 0x100007044\nSTR             X8, [SP,#0x30+var_20]                                  ; +0x28, 0x100007048\nB               loc_100007060                                          ; +0x2c, 0x10000704c\nLDP             X8, X2, [X1]                                           ; +0x30, 0x100007050\nMOV             X0, SP; __dst                                          ; +0x34, 0x100007054\nMOV             X1, X8; __src                                          ; +0x38, 0x100007058\nBL              sub_1000097D0                                          ; +0x3c, 0x10000705c\nLDR             X0, [X19,#0x38]                                        ; +0x40, 0x100007060\nMOV             X1, SP                                                 ; +0x44, 0x100007064\nBL              cocos2d__CCDictionary__objectForKey_1                  ; +0x48, 0x100007068\nMOV             X19, X0                                                ; +0x4c, 0x10000706c\nLDRSB           W8, [SP,#0x30+var_20+7]                                ; +0x50, 0x100007070\nTBNZ            W8, #0x1F, loc_100007080                               ; +0x54, 0x100007074\nCBNZ            X19, loc_10000708C                                     ; +0x58, 0x100007078\nB               loc_1000070D4                                          ; +0x5c, 0x10000707c\nLDR             X0, [SP,#0x30+__p]; __p                                ; +0x60, 0x100007080\nBL              __ZdlPv; operator delete(void *)                       ; +0x64, 0x100007084\nCBZ             X19, loc_1000070D4                                     ; +0x68, 0x100007088\nMOV             X0, X19                                                ; +0x6c, 0x10000708c\nBL              sub_10024A36C                                          ; +0x70, 0x100007090\nCBZ             W0, loc_1000070D8                                      ; +0x74, 0x100007094\nLDR             X8, [X19,#0x38]                                        ; +0x78, 0x100007098\nLDR             W9, [X8]                                               ; +0x7c, 0x10000709c\nCBZ             W9, loc_1000070D4                                      ; +0x80, 0x1000070a0\nMOV             W0, #0                                                 ; +0x84, 0x1000070a4\nLDR             X8, [X8,#0x10]                                         ; +0x88, 0x1000070a8\nADD             X9, X8, X9,LSL#3                                       ; +0x8c, 0x1000070ac\nSUB             X9, X9, #8                                             ; +0x90, 0x1000070b0\nLDR             X10, [X8]                                              ; +0x94, 0x1000070b4\nCBZ             X10, loc_1000070D8                                     ; +0x98, 0x1000070b8\nLDR             W10, [X10,#0x6C]                                       ; +0x9c, 0x1000070bc\nADD             W0, W10, W0                                            ; +0xa0, 0x1000070c0\nADD             X8, X8, #8                                             ; +0xa4, 0x1000070c4\nCMP             X8, X9                                                 ; +0xa8, 0x1000070c8\nB.LS            loc_1000070B4                                          ; +0xac, 0x1000070cc\nB               loc_1000070D8                                          ; +0xb0, 0x1000070d0\nMOV             W0, #0                                                 ; +0xb4, 0x1000070d4\nLDP             X29, X30, [SP,#0x30+var_s0]                            ; +0xb8, 0x1000070d8\nLDP             X20, X19, [SP,#0x30+var_10]                            ; +0xbc, 0x1000070dc\nADD             SP, SP, #0x40 ; '@'                                    ; +0xc0, 0x1000070e0\nRET                                                                    ; +0xc4, 0x1000070e4", "xrefs": ["GJSmartTemplate::getRandomPrefab @ 0x100006164", "BrowseSmartKeyLayer::init @ 0x100072c94", "BrowseSmartKeyLayer::updateChanceValues @ 0x100073990"], "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"}