{"type": "func", "start": 4298037840, "end": 4298038170, "name": "GJEffectManager::timeForItem", "pseudocode": "// \n// GJEffectManager::timeForItem from 0x1002eda50 to 0x1002edb9a (330 bytes)\n// \n// 7 xrefs:\n// > GJBaseGameLayer::getItemValue @ 0x10014c2d3\n// > GJBaseGameLayer::activateItemEditTrigger @ 0x10014c700\n// > GJBaseGameLayer::activateItemEditTrigger @ 0x10014c7a9\n// > GJBaseGameLayer::activateItemEditTrigger @ 0x10014c904\n// > GJBaseGameLayer::activateItemCompareTrigger @ 0x10014ce2e\n// > GJBaseGameLayer::activateItemCompareTrigger @ 0x10014d1d6\n// > GJBaseGameLayer::updateTimerLabels @ 0x10014d87e\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\ndouble __fastcall GJEffectManager::timeForItem(GJEffectManager *a1, int a2)\n{\n  int v2; // eax\n  unsigned __int64 v3; // rcx\n  unsigned __int64 value; // rsi\n  double result; // xmm0_8\n  unsigned __int64 v6; // r9\n  unsigned __int64 v7; // r8\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, TimerItem>, void *> *> *v8; // rax\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, TimerItem>, void *> *>::__next_pointer next; // rdi\n  unsigned __int64 v10; // rsi\n  std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, TimerItem>, void *> *>::__next_pointer v11; // rax\n  unsigned __int64 v12; // rax\n\n  v2 = 0;\n  if ( a2 > 0 )\n    v2 = a2;\n  v3 = 9999;\n  if ( v2 < 9999 )\n    v3 = (unsigned int)v2;\n  value = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;\n  result = 0.0;\n  if ( value )\n  {\n    v6 = (0x101010101010101LL\n        * ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)\n          + (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)\n          + ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)\n            + (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))\n         & 0xF0F0F0F0F0F0F0FLL)) >> 56;\n    if ( v6 > 1 )\n    {\n      v7 = v3;\n      if ( value <= v3 )\n        v7 = (unsigned __int16)((unsigned __int16)v3 % (unsigned __int16)value);\n    }\n    else\n    {\n      v7 = ((_DWORD)value + 0x3FFF) & (unsigned int)v3;\n    }\n    v8 = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_[v7];\n    if ( v8 )\n    {\n      next = v8->__next_;\n      if ( v8->__next_ )\n      {\n        if ( (unsigned int)v6 < 2 )\n        {\n          v10 = value - 1;\n          while ( 1 )\n          {\n            v11 = next[1].__next_;\n            if ( v11 == (std::__hash_node_base<std::__hash_node<std::__hash_value_type<int, TimerItem>, void *> *>::__next_pointer)v3 )\n            {\n              if ( LODWORD(next[2].__next_) == (_DWORD)v3 )\n                return *(double *)&next[4].__next_;\n            }\n            else if ( (v10 & (unsigned __int64)v11) != v7 )\n            {\n              return result;\n            }\n            next = next->__next_;\n            if ( !next )\n              return result;\n          }\n        }\n        do\n        {\n          v12 = (unsigned __int64)next[1].__next_;\n          if ( v12 == v3 )\n          {\n            if ( LODWORD(next[2].__next_) == (_DWORD)v3 )\n              return *(double *)&next[4].__next_;\n          }\n          else\n          {\n            if ( v12 < value )\n              goto LABEL_25;\n            if ( (value | v12) >> 32 )\n            {\n              v12 %= value;\nLABEL_25:\n              if ( v12 != v7 )\n                return result;\n              goto LABEL_20;\n            }\n            if ( (unsigned int)v12 % (unsigned int)value != v7 )\n              return result;\n          }\nLABEL_20:\n          next = next->__next_;\n        }\n        while ( next );\n      }\n    }\n  }\n  return result;\n}", "assembly": "; \n; GJEffectManager::timeForItem from 0x1002eda50 to 0x1002edb9a (330 bytes)\n; \n; 7 xrefs:\n; > GJBaseGameLayer::getItemValue @ 0x10014c2d3\n; > GJBaseGameLayer::activateItemEditTrigger @ 0x10014c700\n; > GJBaseGameLayer::activateItemEditTrigger @ 0x10014c7a9\n; > GJBaseGameLayer::activateItemEditTrigger @ 0x10014c904\n; > GJBaseGameLayer::activateItemCompareTrigger @ 0x10014ce2e\n; > GJBaseGameLayer::activateItemCompareTrigger @ 0x10014d1d6\n; > GJBaseGameLayer::updateTimerLabels @ 0x10014d87e\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\nxor     eax, eax                                                       ; +0x0, 0x1002eda50\ntest    esi, esi                                                       ; +0x2, 0x1002eda52\ncmovg   eax, esi                                                       ; +0x4, 0x1002eda54\ncmp     eax, 270Fh                                                     ; +0x7, 0x1002eda57\nmov     ecx, 270Fh                                                     ; +0xc, 0x1002eda5c\ncmovl   ecx, eax                                                       ; +0x11, 0x1002eda61\nmov     rsi, [rdi+398h]                                                ; +0x14, 0x1002eda64\nxorps   xmm0, xmm0                                                     ; +0x1b, 0x1002eda6b\ntest    rsi, rsi                                                       ; +0x1e, 0x1002eda6e\njz      locret_1002EDB99                                               ; +0x21, 0x1002eda71\nmov     rax, rsi                                                       ; +0x27, 0x1002eda77\nshr     rax, 1                                                         ; +0x2a, 0x1002eda7a\nmov     rdx, 5555555555555555h                                         ; +0x2d, 0x1002eda7d\nand     rdx, rax                                                       ; +0x37, 0x1002eda87\nmov     rax, rsi                                                       ; +0x3a, 0x1002eda8a\nsub     rax, rdx                                                       ; +0x3d, 0x1002eda8d\nmov     rdx, 3333333333333333h                                         ; +0x40, 0x1002eda90\nmov     r8, rax                                                        ; +0x4a, 0x1002eda9a\nand     r8, rdx                                                        ; +0x4d, 0x1002eda9d\nshr     rax, 2                                                         ; +0x50, 0x1002edaa0\nand     rax, rdx                                                       ; +0x54, 0x1002edaa4\nadd     rax, r8                                                        ; +0x57, 0x1002edaa7\nmov     rdx, rax                                                       ; +0x5a, 0x1002edaaa\nshr     rdx, 4                                                         ; +0x5d, 0x1002edaad\nadd     rdx, rax                                                       ; +0x61, 0x1002edab1\nmov     rax, 0F0F0F0F0F0F0F0Fh                                         ; +0x64, 0x1002edab4\nand     rax, rdx                                                       ; +0x6e, 0x1002edabe\nmov     r9, 101010101010101h                                           ; +0x71, 0x1002edac1\nimul    r9, rax                                                        ; +0x7b, 0x1002edacb\nshr     r9, 38h                                                        ; +0x7f, 0x1002edacf\ncmp     r9, 1                                                          ; +0x83, 0x1002edad3\nja      short loc_1002EDAE7                                            ; +0x87, 0x1002edad7\nlea     eax, [rsi+3FFFh]                                               ; +0x89, 0x1002edad9\nmov     r8d, ecx                                                       ; +0x8f, 0x1002edadf\nand     r8d, eax                                                       ; +0x92, 0x1002edae2\njmp     short loc_1002EDAFA                                            ; +0x95, 0x1002edae5\nmov     r8, rcx                                                        ; +0x97, 0x1002edae7\ncmp     rsi, rcx                                                       ; +0x9a, 0x1002edaea\nja      short loc_1002EDAFA                                            ; +0x9d, 0x1002edaed\nmov     eax, ecx                                                       ; +0x9f, 0x1002edaef\nxor     edx, edx                                                       ; +0xa1, 0x1002edaf1\ndiv     si                                                             ; +0xa3, 0x1002edaf3\nmovzx   r8d, dx                                                        ; +0xa6, 0x1002edaf6\npush    rbp                                                            ; +0xaa, 0x1002edafa\nmov     rbp, rsp                                                       ; +0xab, 0x1002edafb\nmov     rax, [rdi+390h]                                                ; +0xae, 0x1002edafe\nmov     rax, [rax+r8*8]                                                ; +0xb5, 0x1002edb05\ntest    rax, rax                                                       ; +0xb9, 0x1002edb09\njz      loc_1002EDB98                                                  ; +0xbc, 0x1002edb0c\nmov     rdi, [rax]                                                     ; +0xc2, 0x1002edb12\ntest    rdi, rdi                                                       ; +0xc5, 0x1002edb15\njz      loc_1002EDB98                                                  ; +0xc8, 0x1002edb18\ncmp     r9d, 2                                                         ; +0xce, 0x1002edb1e\njnb     short loc_1002EDB5D                                            ; +0xd2, 0x1002edb22\ndec     rsi                                                            ; +0xd4, 0x1002edb24\njmp     short loc_1002EDB3D                                            ; +0xd7, 0x1002edb27\nalign 10h                                                              ; +0xd9, 0x1002edb29\ncmp     [rdi+10h], ecx                                                 ; +0xe0, 0x1002edb30\njz      short loc_1002EDB93                                            ; +0xe3, 0x1002edb33\nmov     rdi, [rdi]                                                     ; +0xe5, 0x1002edb35\ntest    rdi, rdi                                                       ; +0xe8, 0x1002edb38\njz      short loc_1002EDB98                                            ; +0xeb, 0x1002edb3b\nmov     rax, [rdi+8]                                                   ; +0xed, 0x1002edb3d\ncmp     rax, rcx                                                       ; +0xf1, 0x1002edb41\njz      short loc_1002EDB30                                            ; +0xf4, 0x1002edb44\nand     rax, rsi                                                       ; +0xf6, 0x1002edb46\ncmp     rax, r8                                                        ; +0xf9, 0x1002edb49\njz      short loc_1002EDB35                                            ; +0xfc, 0x1002edb4c\njmp     short loc_1002EDB98                                            ; +0xfe, 0x1002edb4e\ncmp     [rdi+10h], ecx                                                 ; +0x100, 0x1002edb50\njz      short loc_1002EDB93                                            ; +0x103, 0x1002edb53\nmov     rdi, [rdi]                                                     ; +0x105, 0x1002edb55\ntest    rdi, rdi                                                       ; +0x108, 0x1002edb58\njz      short loc_1002EDB98                                            ; +0x10b, 0x1002edb5b\nmov     rax, [rdi+8]                                                   ; +0x10d, 0x1002edb5d\ncmp     rax, rcx                                                       ; +0x111, 0x1002edb61\njz      short loc_1002EDB50                                            ; +0x114, 0x1002edb64\ncmp     rax, rsi                                                       ; +0x116, 0x1002edb66\njb      short loc_1002EDB7F                                            ; +0x119, 0x1002edb69\nmov     rdx, rax                                                       ; +0x11b, 0x1002edb6b\nor      rdx, rsi                                                       ; +0x11e, 0x1002edb6e\nshr     rdx, 20h                                                       ; +0x121, 0x1002edb71\njz      short loc_1002EDB86                                            ; +0x125, 0x1002edb75\nxor     edx, edx                                                       ; +0x127, 0x1002edb77\ndiv     rsi                                                            ; +0x129, 0x1002edb79\nmov     rax, rdx                                                       ; +0x12c, 0x1002edb7c\ncmp     rax, r8                                                        ; +0x12f, 0x1002edb7f\njz      short loc_1002EDB55                                            ; +0x132, 0x1002edb82\njmp     short loc_1002EDB98                                            ; +0x134, 0x1002edb84\nxor     edx, edx                                                       ; +0x136, 0x1002edb86\ndiv     esi                                                            ; +0x138, 0x1002edb88\nmov     eax, edx                                                       ; +0x13a, 0x1002edb8a\ncmp     rax, r8                                                        ; +0x13c, 0x1002edb8c\njz      short loc_1002EDB55                                            ; +0x13f, 0x1002edb8f\njmp     short loc_1002EDB98                                            ; +0x141, 0x1002edb91\nmovsd   xmm0, qword ptr [rdi+20h]                                      ; +0x143, 0x1002edb93\npop     rbp                                                            ; +0x148, 0x1002edb98\nretn                                                                   ; +0x149, 0x1002edb99", "xrefs": ["GJBaseGameLayer::getItemValue @ 0x10014c2d3", "GJBaseGameLayer::activateItemEditTrigger @ 0x10014c700", "GJBaseGameLayer::activateItemEditTrigger @ 0x10014c7a9", "GJBaseGameLayer::activateItemEditTrigger @ 0x10014c904", "GJBaseGameLayer::activateItemCompareTrigger @ 0x10014ce2e", "GJBaseGameLayer::activateItemCompareTrigger @ 0x10014d1d6", "GJBaseGameLayer::updateTimerLabels @ 0x10014d87e"], "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"}