{"type": "func", "start": 4296327456, "end": 4296327798, "name": "GJBaseGameLayer::addObjectCounter", "pseudocode": "// \n// GJBaseGameLayer::addObjectCounter from 0x10014c120 to 0x10014c276 (342 bytes)\n// \n// 3 xrefs:\n// > PlayLayer::addObject @ 0x1000b20b2\n// > LevelEditorLayer::init @ 0x1000dc061\n// > LevelEditorLayer::recreateGroups @ 0x1000f102f\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 __fastcall GJBaseGameLayer::addObjectCounter(GJBaseGameLayer *a1, LabelGameObject *a2)\n{\n  int m_shownSpecial; // eax\n  std::unordered_map<int, std::vector<LabelGameObject *>> *p_m_timeLabelObjects; // rdi\n  __int64 v5; // r14\n  LabelGameObject **v6; // r15\n  unsigned __int64 v7; // rax\n  __int64 v8; // rbx\n  __int64 v9; // rsi\n  signed __int64 v10; // r15\n  __int64 v11; // rdi\n  __int64 v12; // rax\n  unsigned __int64 v13; // r12\n  _QWORD *v14; // r13\n  void *v15; // r12\n  int *v16; // [rsp+0h] [rbp-50h] BYREF\n  void *__src; // [rsp+8h] [rbp-48h]\n  int v18; // [rsp+14h] [rbp-3Ch] BYREF\n  __int64 v19; // [rsp+18h] [rbp-38h]\n  char v20[41]; // [rsp+27h] [rbp-29h] BYREF\n\n  m_shownSpecial = a2->m_shownSpecial;\n  if ( m_shownSpecial >= 0 )\n    m_shownSpecial = a2->m_itemID;\n  v18 = m_shownSpecial;\n  if ( a2->m_isTimeCounter )\n    p_m_timeLabelObjects = &a1->m_timeLabelObjects;\n  else\n    p_m_timeLabelObjects = &a1->m_labelObjects;\n  v16 = &v18;\n  v5 = sub_100171870(p_m_timeLabelObjects, &v18, &unk_100816AE0, &v16, v20);\n  v6 = *(LabelGameObject ***)(v5 + 32);\n  v7 = *(_QWORD *)(v5 + 40);\n  if ( (unsigned __int64)v6 >= v7 )\n  {\n    v9 = *(_QWORD *)(v5 + 24);\n    v10 = (signed __int64)v6 - v9;\n    v11 = v10 >> 3;\n    if ( (unsigned __int64)((v10 >> 3) + 1) >> 61 )\n      sub_100171D30();\n    v12 = v7 - v9;\n    v13 = v12 >> 2;\n    if ( v12 >> 2 <= (unsigned __int64)((v10 >> 3) + 1) )\n      v13 = (v10 >> 3) + 1;\n    if ( (unsigned __int64)v12 >= 0x7FFFFFFFFFFFFFF8LL )\n      v13 = 0x1FFFFFFFFFFFFFFFLL;\n    __src = *(void **)(v5 + 24);\n    if ( v13 )\n    {\n      v19 = v10 >> 3;\n      if ( v13 > 0x1FFFFFFFFFFFFFFFLL )\n        sub_100054850();\n      v14 = operator new(8 * v13);\n      v11 = v19;\n    }\n    else\n    {\n      v14 = nullptr;\n    }\n    v19 = (__int64)&v14[v13];\n    v14[v11] = a2;\n    v8 = (__int64)&v14[v11 + 1];\n    v15 = __src;\n    memcpy(v14, __src, v10);\n    *(_QWORD *)(v5 + 24) = v14;\n    *(_QWORD *)(v5 + 32) = v8;\n    *(_QWORD *)(v5 + 40) = v19;\n    if ( v15 )\n      operator delete(v15);\n  }\n  else\n  {\n    *v6 = a2;\n    v8 = (__int64)(v6 + 1);\n  }\n  *(_QWORD *)(v5 + 32) = v8;\n}", "assembly": "; \n; GJBaseGameLayer::addObjectCounter from 0x10014c120 to 0x10014c276 (342 bytes)\n; \n; 3 xrefs:\n; > PlayLayer::addObject @ 0x1000b20b2\n; > LevelEditorLayer::init @ 0x1000dc061\n; > LevelEditorLayer::recreateGroups @ 0x1000f102f\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\npush    rbp                                                            ; +0x0, 0x10014c120\nmov     rbp, rsp                                                       ; +0x1, 0x10014c121\npush    r15                                                            ; +0x4, 0x10014c124\npush    r14                                                            ; +0x6, 0x10014c126\npush    r13                                                            ; +0x8, 0x10014c128\npush    r12                                                            ; +0xa, 0x10014c12a\npush    rbx                                                            ; +0xc, 0x10014c12c\nsub     rsp, 28h                                                       ; +0xd, 0x10014c12d\nmov     rbx, rsi                                                       ; +0x11, 0x10014c131\nmov     eax, [rsi+764h]                                                ; +0x14, 0x10014c134\ntest    eax, eax                                                       ; +0x1a, 0x10014c13a\njs      short loc_10014C144                                            ; +0x1c, 0x10014c13c\nmov     eax, [rbx+690h]                                                ; +0x1e, 0x10014c13e\nmov     [rbp+var_3C], eax                                              ; +0x24, 0x10014c144\ncmp     byte ptr [rbx+768h], 1                                         ; +0x27, 0x10014c147\njnz     short loc_10014C159                                            ; +0x2e, 0x10014c14e\nadd     rdi, 0F30h                                                     ; +0x30, 0x10014c150\njmp     short loc_10014C160                                            ; +0x37, 0x10014c157\nadd     rdi, 0F08h                                                     ; +0x39, 0x10014c159\nlea     rsi, [rbp+var_3C]                                              ; +0x40, 0x10014c160\nmov     [rbp+var_50], rsi                                              ; +0x44, 0x10014c164\nlea     rdx, unk_100816AE0                                             ; +0x48, 0x10014c168\nlea     rcx, [rbp+var_50]                                              ; +0x4f, 0x10014c16f\nlea     r8, [rbp+var_29]                                               ; +0x53, 0x10014c173\ncall    sub_100171870                                                  ; +0x57, 0x10014c177\nmov     r14, rax                                                       ; +0x5c, 0x10014c17c\nmov     r15, [rax+20h]                                                 ; +0x5f, 0x10014c17f\nmov     rax, [rax+28h]                                                 ; +0x63, 0x10014c183\ncmp     r15, rax                                                       ; +0x67, 0x10014c187\njnb     short loc_10014C19B                                            ; +0x6a, 0x10014c18a\nmov     [r15], rbx                                                     ; +0x6c, 0x10014c18c\nadd     r15, 8                                                         ; +0x6f, 0x10014c18f\nmov     rbx, r15                                                       ; +0x73, 0x10014c193\njmp     loc_10014C259                                                  ; +0x76, 0x10014c196\nmov     rsi, [r14+18h]                                                 ; +0x7b, 0x10014c19b\nsub     r15, rsi                                                       ; +0x7f, 0x10014c19f\nmov     rdi, r15                                                       ; +0x82, 0x10014c1a2\nsar     rdi, 3                                                         ; +0x85, 0x10014c1a5\nlea     rdx, [rdi+1]                                                   ; +0x89, 0x10014c1a9\nmov     rcx, rdx                                                       ; +0x8d, 0x10014c1ad\nshr     rcx, 3Dh                                                       ; +0x90, 0x10014c1b0\njnz     loc_10014C26C                                                  ; +0x94, 0x10014c1b4\nmov     rcx, 1FFFFFFFFFFFFFFFh                                         ; +0x9a, 0x10014c1ba\nsub     rax, rsi                                                       ; +0xa4, 0x10014c1c4\nmov     r12, rax                                                       ; +0xa7, 0x10014c1c7\nsar     r12, 2                                                         ; +0xaa, 0x10014c1ca\ncmp     r12, rdx                                                       ; +0xae, 0x10014c1ce\ncmovbe  r12, rdx                                                       ; +0xb1, 0x10014c1d1\nmov     rdx, 7FFFFFFFFFFFFFF8h                                         ; +0xb5, 0x10014c1d5\ncmp     rax, rdx                                                       ; +0xbf, 0x10014c1df\ncmovnb  r12, rcx                                                       ; +0xc2, 0x10014c1e2\ntest    r12, r12                                                       ; +0xc6, 0x10014c1e6\nmov     [rbp+__src], rsi                                               ; +0xc9, 0x10014c1e9\njz      short loc_10014C20E                                            ; +0xcd, 0x10014c1ed\nmov     [rbp+var_38], rdi                                              ; +0xcf, 0x10014c1ef\ncmp     r12, rcx                                                       ; +0xd3, 0x10014c1f3\nja      short loc_10014C271                                            ; +0xd6, 0x10014c1f6\nlea     rdi, ds:0[r12*8]; __sz                                         ; +0xd8, 0x10014c1f8\ncall    __Znwm; operator new(ulong)                                    ; +0xe0, 0x10014c200\nmov     r13, rax                                                       ; +0xe5, 0x10014c205\nmov     rdi, [rbp+var_38]                                              ; +0xe8, 0x10014c208\njmp     short loc_10014C211                                            ; +0xec, 0x10014c20c\nxor     r13d, r13d                                                     ; +0xee, 0x10014c20e\nlea     rax, ds:0[r12*8]                                               ; +0xf1, 0x10014c211\nadd     rax, r13                                                       ; +0xf9, 0x10014c219\nmov     [rbp+var_38], rax                                              ; +0xfc, 0x10014c21c\nmov     [r13+rdi*8+0], rbx                                             ; +0x100, 0x10014c220\nlea     rbx, [r13+rdi*8+8]                                             ; +0x105, 0x10014c225\nmov     rdi, r13; __dst                                                ; +0x10a, 0x10014c22a\nmov     r12, [rbp+__src]                                               ; +0x10d, 0x10014c22d\nmov     rsi, r12; __src                                                ; +0x111, 0x10014c231\nmov     rdx, r15; __n                                                  ; +0x114, 0x10014c234\ncall    _memcpy                                                        ; +0x117, 0x10014c237\nmov     [r14+18h], r13                                                 ; +0x11c, 0x10014c23c\nmov     [r14+20h], rbx                                                 ; +0x120, 0x10014c240\nmov     rax, [rbp+var_38]                                              ; +0x124, 0x10014c244\nmov     [r14+28h], rax                                                 ; +0x128, 0x10014c248\ntest    r12, r12                                                       ; +0x12c, 0x10014c24c\njz      short loc_10014C259                                            ; +0x12f, 0x10014c24f\nmov     rdi, r12; __p                                                  ; +0x131, 0x10014c251\ncall    __ZdlPv; operator delete(void *)                               ; +0x134, 0x10014c254\nmov     [r14+20h], rbx                                                 ; +0x139, 0x10014c259\nadd     rsp, 28h                                                       ; +0x13d, 0x10014c25d\npop     rbx                                                            ; +0x141, 0x10014c261\npop     r12                                                            ; +0x142, 0x10014c262\npop     r13                                                            ; +0x144, 0x10014c264\npop     r14                                                            ; +0x146, 0x10014c266\npop     r15                                                            ; +0x148, 0x10014c268\npop     rbp                                                            ; +0x14a, 0x10014c26a\nretn                                                                   ; +0x14b, 0x10014c26b\ncall    sub_100171D30                                                  ; +0x14c, 0x10014c26c\ncall    sub_100054850                                                  ; +0x151, 0x10014c271", "xrefs": ["PlayLayer::addObject @ 0x1000b20b2", "LevelEditorLayer::init @ 0x1000dc061", "LevelEditorLayer::recreateGroups @ 0x1000f102f"], "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"}