{"type": "func", "start": 6443034544, "end": 6443035204, "name": "cocos2d::CCSpriteBatchNode::insertChild", "pseudocode": "// \n// cocos2d::CCSpriteBatchNode::insertChild from 0x18008e7b0 to 0x18008ea44 (660 bytes)\n// \n// 4 xrefs:\n// > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008e96c\n// > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008ea18\n// > <???> @ 0x1801438a8\n// > <???> @ 0x1801b6030\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 cocos2d::CCSpriteBatchNode::insertChild(\n        cocos2d::CCSpriteBatchNode *this,\n        struct cocos2d::CCSprite *a2,\n        unsigned int a3)\n{\n  cocos2d::CCSprite_vtbl *v6; // rax\n  __int64 v7; // rdx\n  int v8; // ebx\n  cocos2d::CCTextureAtlas *m_pobTextureAtlas; // rcx\n  __int128 v10; // xmm1\n  __int128 v11; // xmm0\n  __int128 v12; // xmm1\n  __int128 v13; // xmm0\n  __int128 v14; // xmm1\n  cocos2d::ccArray *data; // rbx\n  __int64 j; // r8\n  cocos2d::CCObject *v17; // rdx\n  struct cocos2d::CCSprite **v18; // r14\n  __int64 v19; // rbx\n  unsigned __int64 k; // rdi\n  struct cocos2d::CCSprite *v21; // rbx\n  int v22; // eax\n  unsigned int v23; // eax\n  struct cocos2d::CCSprite **v24; // r14\n  __int64 v25; // rbx\n  unsigned __int64 i; // rdi\n  struct cocos2d::CCSprite *v27; // rbx\n  int v28; // eax\n  unsigned int v29; // eax\n  struct cocos2d::_ccV3F_C4B_T2F_Quad v30; // [rsp+20h] [rbp-98h] BYREF\n\n  ((void (__fastcall *)(struct cocos2d::CCSprite *, cocos2d::CCSpriteBatchNode *))a2->setBatchNode)(a2, this);\n  v6 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;\n  LOBYTE(v7) = 1;\n  a2->m_uAtlasIndex = a3;\n  ((void (__fastcall *)(struct cocos2d::CCSprite *, __int64))v6->setDirty)(a2, v7);\n  if ( a2->m_bDontDraw )\n  {\n    if ( ((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) )\n    {\n      if ( **(_DWORD **)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) + 56) )\n      {\n        v24 = *(struct cocos2d::CCSprite ***)(*(_QWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2)\n                                                        + 56)\n                                            + 16LL);\n        v25 = **(unsigned int **)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) + 56);\n        for ( i = *(_QWORD *)(*(_QWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) + 56)\n                            + 16LL)\n                + 8 * v25\n                - 8; (unsigned __int64)v24 <= i; ++v24 )\n        {\n          v27 = *v24;\n          if ( !*v24 )\n            break;\n          v28 = ((__int64 (__fastcall *)(struct cocos2d::CCSprite *))v27->getZOrder)(*v24);\n          v29 = cocos2d::CCSpriteBatchNode::atlasIndexForChild(this, v27, v28);\n          cocos2d::CCSpriteBatchNode::insertChild(this, v27, v29);\n        }\n      }\n    }\n  }\n  else\n  {\n    v8 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getCapacity)(this->m_pobTextureAtlas);\n    if ( ((unsigned int (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getTotalQuads)(this->m_pobTextureAtlas) == v8 )\n      cocos2d::CCSpriteBatchNode::increaseAtlasCapacity(this);\n    m_pobTextureAtlas = this->m_pobTextureAtlas;\n    v10 = *(_OWORD *)&a2->m_sQuad.tl.texCoords.u;\n    *(_OWORD *)&v30.tl.vertices.x = *(_OWORD *)&a2->m_sQuad.tl.vertices.x;\n    v11 = *(_OWORD *)&a2->m_sQuad.bl.vertices.z;\n    *(_OWORD *)&v30.tl.texCoords.u = v10;\n    v12 = *(_OWORD *)&a2->m_sQuad.tr.vertices.x;\n    *(_OWORD *)&v30.bl.vertices.z = v11;\n    v13 = *(_OWORD *)&a2->m_sQuad.tr.texCoords.u;\n    *(_OWORD *)&v30.tr.vertices.x = v12;\n    v14 = *(_OWORD *)&a2->m_sQuad.br.vertices.z;\n    *(_OWORD *)&v30.tr.texCoords.u = v13;\n    *(_OWORD *)&v30.br.vertices.z = v14;\n    cocos2d::CCTextureAtlas::insertQuad(m_pobTextureAtlas, &v30, a3);\n    data = this->m_pobDescendants->data;\n    sub_18009DBB0(data, a2, a3);\n    for ( j = a3 + 1; (unsigned int)j < data->num; ++v17[6].m_uAutoReleaseCount )\n    {\n      v17 = data->arr[j];\n      j = (unsigned int)(j + 1);\n    }\n    if ( ((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) )\n    {\n      if ( **(_DWORD **)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) + 56) )\n      {\n        v18 = *(struct cocos2d::CCSprite ***)(*(_QWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2)\n                                                        + 56)\n                                            + 16LL);\n        v19 = **(unsigned int **)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) + 56);\n        for ( k = *(_QWORD *)(*(_QWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2) + 56)\n                            + 16LL)\n                + 8 * v19\n                - 8; (unsigned __int64)v18 <= k; ++v18 )\n        {\n          v21 = *v18;\n          if ( !*v18 )\n            break;\n          v22 = ((__int64 (__fastcall *)(struct cocos2d::CCSprite *))v21->getZOrder)(*v18);\n          v23 = cocos2d::CCSpriteBatchNode::atlasIndexForChild(this, v21, v22);\n          cocos2d::CCSpriteBatchNode::insertChild(this, v21, v23);\n        }\n      }\n    }\n  }\n}", "assembly": "; \n; cocos2d::CCSpriteBatchNode::insertChild from 0x18008e7b0 to 0x18008ea44 (660 bytes)\n; \n; 4 xrefs:\n; > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008e96c\n; > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008ea18\n; > <???> @ 0x1801438a8\n; > <???> @ 0x1801b6030\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    rbx                                                            ; +0x0, 0x18008e7b0\npush    rbp                                                            ; +0x2, 0x18008e7b2\npush    rsi                                                            ; +0x3, 0x18008e7b3\npush    rdi                                                            ; +0x4, 0x18008e7b4\npush    r14                                                            ; +0x5, 0x18008e7b5\nsub     rsp, 90h                                                       ; +0x7, 0x18008e7b7\nmov     rax, cs:__security_cookie                                      ; +0xe, 0x18008e7be\nxor     rax, rsp                                                       ; +0x15, 0x18008e7c5\nmov     [rsp+0B8h+var_38], rax                                         ; +0x18, 0x18008e7c8\nmov     rax, [rdx]                                                     ; +0x20, 0x18008e7d0\nmov     rdi, rdx                                                       ; +0x23, 0x18008e7d3\nmov     rsi, rcx                                                       ; +0x26, 0x18008e7d6\nmov     rdx, rcx                                                       ; +0x29, 0x18008e7d9\nmov     rcx, rdi                                                       ; +0x2c, 0x18008e7dc\nmov     ebp, r8d                                                       ; +0x2f, 0x18008e7df\ncall    qword ptr [rax+3B8h]                                           ; +0x32, 0x18008e7e2\nmov     rax, [rdi]                                                     ; +0x38, 0x18008e7e8\nmov     dl, 1                                                          ; +0x3b, 0x18008e7eb\nmov     rcx, rdi                                                       ; +0x3d, 0x18008e7ed\nmov     [rdi+168h], ebp                                                ; +0x40, 0x18008e7f0\ncall    qword ptr [rax+408h]                                           ; +0x46, 0x18008e7f6\ncmp     byte ptr [rdi+22Fh], 0                                         ; +0x4c, 0x18008e7fc\njnz     loc_18008E97F                                                  ; +0x53, 0x18008e803\nmov     rcx, [rsi+148h]                                                ; +0x59, 0x18008e809\nmov     rax, [rcx]                                                     ; +0x60, 0x18008e810\ncall    qword ptr [rax+50h]                                            ; +0x63, 0x18008e813\nmov     rcx, [rsi+148h]                                                ; +0x66, 0x18008e816\nmov     ebx, eax                                                       ; +0x6d, 0x18008e81d\nmov     rdx, [rcx]                                                     ; +0x6f, 0x18008e81f\ncall    qword ptr [rdx+48h]                                            ; +0x72, 0x18008e822\ncmp     eax, ebx                                                       ; +0x75, 0x18008e825\njnz     short loc_18008E831                                            ; +0x77, 0x18008e827\nmov     rcx, rsi; this                                                 ; +0x79, 0x18008e829\ncall    ?increaseAtlasCapacity@CCSpriteBatchNode@cocos2d@@QEAAXXZ; cocos2d::CCSpriteBatchNode::increaseAtlasCapacity(void) ; +0x7c, 0x18008e82c\nmovups  xmm0, xmmword ptr [rdi+1CCh]                                   ; +0x81, 0x18008e831\nmov     rcx, [rsi+148h]; this                                          ; +0x88, 0x18008e838\nmov     r8d, ebp; unsigned int                                         ; +0x8f, 0x18008e83f\nmovups  xmm1, xmmword ptr [rdi+1DCh]                                   ; +0x92, 0x18008e842\nlea     rdx, [rsp+0B8h+var_98]; struct cocos2d::_ccV3F_C4B_T2F_Quad *  ; +0x99, 0x18008e849\nmovaps  [rsp+0B8h+var_98], xmm0                                        ; +0x9e, 0x18008e84e\nmovups  xmm0, xmmword ptr [rdi+1ECh]                                   ; +0xa3, 0x18008e853\nmovaps  [rsp+0B8h+var_88], xmm1                                        ; +0xaa, 0x18008e85a\nmovups  xmm1, xmmword ptr [rdi+1FCh]                                   ; +0xaf, 0x18008e85f\nmovaps  [rsp+0B8h+var_78], xmm0                                        ; +0xb6, 0x18008e866\nmovups  xmm0, xmmword ptr [rdi+20Ch]                                   ; +0xbb, 0x18008e86b\nmovaps  [rsp+0B8h+var_68], xmm1                                        ; +0xc2, 0x18008e872\nmovups  xmm1, xmmword ptr [rdi+21Ch]                                   ; +0xc7, 0x18008e877\nmovaps  [rsp+0B8h+var_58], xmm0                                        ; +0xce, 0x18008e87e\nmovaps  [rsp+0B8h+var_48], xmm1                                        ; +0xd3, 0x18008e883\ncall    ?insertQuad@CCTextureAtlas@cocos2d@@QEAAXPEAU_ccV3F_C4B_T2F_Quad@2@I@Z; cocos2d::CCTextureAtlas::insertQuad(cocos2d::_ccV3F_C4B_T2F_Quad *,uint) ; +0xd8, 0x18008e888\nmov     rax, [rsi+158h]                                                ; +0xdd, 0x18008e88d\nmov     r8d, ebp                                                       ; +0xe4, 0x18008e894\nmov     rdx, rdi                                                       ; +0xe7, 0x18008e897\nmov     rbx, [rax+38h]                                                 ; +0xea, 0x18008e89a\nmov     rcx, rbx                                                       ; +0xee, 0x18008e89e\ncall    sub_18009DBB0                                                  ; +0xf1, 0x18008e8a1\nlea     r8d, [rbp+1]                                                   ; +0xf6, 0x18008e8a6\ncmp     r8d, [rbx]                                                     ; +0xfa, 0x18008e8aa\njnb     short loc_18008E8C6                                            ; +0xfd, 0x18008e8ad\nnop                                                                    ; +0xff, 0x18008e8af\nmov     rax, [rbx+10h]                                                 ; +0x100, 0x18008e8b0\nmov     rdx, [rax+r8*8]                                                ; +0x104, 0x18008e8b4\ninc     r8d                                                            ; +0x108, 0x18008e8b8\ninc     dword ptr [rdx+168h]                                           ; +0x10b, 0x18008e8bb\ncmp     r8d, [rbx]                                                     ; +0x111, 0x18008e8c1\njb      short loc_18008E8B0                                            ; +0x114, 0x18008e8c4\nmov     rax, [rdi]                                                     ; +0x116, 0x18008e8c6\nmov     rcx, rdi                                                       ; +0x119, 0x18008e8c9\ncall    qword ptr [rax+1D0h]                                           ; +0x11c, 0x18008e8cc\ntest    rax, rax                                                       ; +0x122, 0x18008e8d2\njz      loc_18008EA26                                                  ; +0x125, 0x18008e8d5\nmov     rax, [rdi]                                                     ; +0x12b, 0x18008e8db\nmov     rcx, rdi                                                       ; +0x12e, 0x18008e8de\ncall    qword ptr [rax+1D0h]                                           ; +0x131, 0x18008e8e1\nmov     rcx, [rax+38h]                                                 ; +0x137, 0x18008e8e7\ncmp     dword ptr [rcx], 0                                             ; +0x13b, 0x18008e8eb\njbe     loc_18008EA26                                                  ; +0x13e, 0x18008e8ee\nmov     rax, [rdi]                                                     ; +0x144, 0x18008e8f4\nmov     rcx, rdi                                                       ; +0x147, 0x18008e8f7\ncall    qword ptr [rax+1D0h]                                           ; +0x14a, 0x18008e8fa\nmov     rcx, rdi                                                       ; +0x150, 0x18008e900\nmov     rdx, [rax+38h]                                                 ; +0x153, 0x18008e903\nmov     rax, [rdi]                                                     ; +0x157, 0x18008e907\nmov     r14, [rdx+10h]                                                 ; +0x15a, 0x18008e90a\ncall    qword ptr [rax+1D0h]                                           ; +0x15e, 0x18008e90e\nmov     rcx, rdi                                                       ; +0x164, 0x18008e914\nmov     rdx, [rax+38h]                                                 ; +0x167, 0x18008e917\nmov     rax, [rdi]                                                     ; +0x16b, 0x18008e91b\nmov     ebx, [rdx]                                                     ; +0x16e, 0x18008e91e\ncall    qword ptr [rax+1D0h]                                           ; +0x170, 0x18008e920\nlea     rdi, ds:0FFFFFFFFFFFFFFF8h[rbx*8]                              ; +0x176, 0x18008e926\nmov     rcx, [rax+38h]                                                 ; +0x17e, 0x18008e92e\nadd     rdi, [rcx+10h]                                                 ; +0x182, 0x18008e932\ncmp     r14, rdi                                                       ; +0x186, 0x18008e936\nja      loc_18008EA26                                                  ; +0x189, 0x18008e939\nnop                                                                    ; +0x18f, 0x18008e93f\nmov     rbx, [r14]                                                     ; +0x190, 0x18008e940\ntest    rbx, rbx                                                       ; +0x193, 0x18008e943\njz      loc_18008EA26                                                  ; +0x196, 0x18008e946\nmov     rax, [rbx]                                                     ; +0x19c, 0x18008e94c\nmov     rcx, rbx                                                       ; +0x19f, 0x18008e94f\ncall    qword ptr [rax+60h]                                            ; +0x1a2, 0x18008e952\nmov     rdx, rbx; struct cocos2d::CCSprite *                           ; +0x1a5, 0x18008e955\nmov     rcx, rsi; this                                                 ; +0x1a8, 0x18008e958\nmov     r8d, eax; int                                                  ; +0x1ab, 0x18008e95b\ncall    ?atlasIndexForChild@CCSpriteBatchNode@cocos2d@@QEAAIPEAVCCSprite@2@H@Z; cocos2d::CCSpriteBatchNode::atlasIndexForChild(cocos2d::CCSprite *,int) ; +0x1ae, 0x18008e95e\nmov     r8d, eax; unsigned int                                         ; +0x1b3, 0x18008e963\nmov     rdx, rbx; struct cocos2d::CCSprite *                           ; +0x1b6, 0x18008e966\nmov     rcx, rsi; this                                                 ; +0x1b9, 0x18008e969\ncall    ?insertChild@CCSpriteBatchNode@cocos2d@@QEAAXPEAVCCSprite@2@I@Z; cocos2d::CCSpriteBatchNode::insertChild(cocos2d::CCSprite *,uint) ; +0x1bc, 0x18008e96c\nadd     r14, 8                                                         ; +0x1c1, 0x18008e971\ncmp     r14, rdi                                                       ; +0x1c5, 0x18008e975\njbe     short loc_18008E940                                            ; +0x1c8, 0x18008e978\njmp     loc_18008EA26                                                  ; +0x1ca, 0x18008e97a\nmov     rax, [rdi]                                                     ; +0x1cf, 0x18008e97f\nmov     rcx, rdi                                                       ; +0x1d2, 0x18008e982\ncall    qword ptr [rax+1D0h]                                           ; +0x1d5, 0x18008e985\ntest    rax, rax                                                       ; +0x1db, 0x18008e98b\njz      loc_18008EA26                                                  ; +0x1de, 0x18008e98e\nmov     rax, [rdi]                                                     ; +0x1e4, 0x18008e994\nmov     rcx, rdi                                                       ; +0x1e7, 0x18008e997\ncall    qword ptr [rax+1D0h]                                           ; +0x1ea, 0x18008e99a\nmov     rcx, [rax+38h]                                                 ; +0x1f0, 0x18008e9a0\ncmp     dword ptr [rcx], 0                                             ; +0x1f4, 0x18008e9a4\njbe     short loc_18008EA26                                            ; +0x1f7, 0x18008e9a7\nmov     rax, [rdi]                                                     ; +0x1f9, 0x18008e9a9\nmov     rcx, rdi                                                       ; +0x1fc, 0x18008e9ac\ncall    qword ptr [rax+1D0h]                                           ; +0x1ff, 0x18008e9af\nmov     rcx, [rax+38h]                                                 ; +0x205, 0x18008e9b5\nmov     rax, [rdi]                                                     ; +0x209, 0x18008e9b9\nmov     r14, [rcx+10h]                                                 ; +0x20c, 0x18008e9bc\nmov     rcx, rdi                                                       ; +0x210, 0x18008e9c0\ncall    qword ptr [rax+1D0h]                                           ; +0x213, 0x18008e9c3\nmov     rcx, [rax+38h]                                                 ; +0x219, 0x18008e9c9\nmov     rax, [rdi]                                                     ; +0x21d, 0x18008e9cd\nmov     ebx, [rcx]                                                     ; +0x220, 0x18008e9d0\nmov     rcx, rdi                                                       ; +0x222, 0x18008e9d2\ncall    qword ptr [rax+1D0h]                                           ; +0x225, 0x18008e9d5\nlea     rdi, ds:0FFFFFFFFFFFFFFF8h[rbx*8]                              ; +0x22b, 0x18008e9db\nmov     rcx, [rax+38h]                                                 ; +0x233, 0x18008e9e3\nadd     rdi, [rcx+10h]                                                 ; +0x237, 0x18008e9e7\ncmp     r14, rdi                                                       ; +0x23b, 0x18008e9eb\nja      short loc_18008EA26                                            ; +0x23e, 0x18008e9ee\nmov     rbx, [r14]                                                     ; +0x240, 0x18008e9f0\ntest    rbx, rbx                                                       ; +0x243, 0x18008e9f3\njz      short loc_18008EA26                                            ; +0x246, 0x18008e9f6\nmov     rax, [rbx]                                                     ; +0x248, 0x18008e9f8\nmov     rcx, rbx                                                       ; +0x24b, 0x18008e9fb\ncall    qword ptr [rax+60h]                                            ; +0x24e, 0x18008e9fe\nmov     rdx, rbx; struct cocos2d::CCSprite *                           ; +0x251, 0x18008ea01\nmov     rcx, rsi; this                                                 ; +0x254, 0x18008ea04\nmov     r8d, eax; int                                                  ; +0x257, 0x18008ea07\ncall    ?atlasIndexForChild@CCSpriteBatchNode@cocos2d@@QEAAIPEAVCCSprite@2@H@Z; cocos2d::CCSpriteBatchNode::atlasIndexForChild(cocos2d::CCSprite *,int) ; +0x25a, 0x18008ea0a\nmov     r8d, eax; unsigned int                                         ; +0x25f, 0x18008ea0f\nmov     rdx, rbx; struct cocos2d::CCSprite *                           ; +0x262, 0x18008ea12\nmov     rcx, rsi; this                                                 ; +0x265, 0x18008ea15\ncall    ?insertChild@CCSpriteBatchNode@cocos2d@@QEAAXPEAVCCSprite@2@I@Z; cocos2d::CCSpriteBatchNode::insertChild(cocos2d::CCSprite *,uint) ; +0x268, 0x18008ea18\nadd     r14, 8                                                         ; +0x26d, 0x18008ea1d\ncmp     r14, rdi                                                       ; +0x271, 0x18008ea21\njbe     short loc_18008E9F0                                            ; +0x274, 0x18008ea24\nmov     rcx, [rsp+0B8h+var_38]                                         ; +0x276, 0x18008ea26\nxor     rcx, rsp; StackCookie                                          ; +0x27e, 0x18008ea2e\ncall    __security_check_cookie                                        ; +0x281, 0x18008ea31\nadd     rsp, 90h                                                       ; +0x286, 0x18008ea36\npop     r14                                                            ; +0x28d, 0x18008ea3d\npop     rdi                                                            ; +0x28f, 0x18008ea3f\npop     rsi                                                            ; +0x290, 0x18008ea40\npop     rbp                                                            ; +0x291, 0x18008ea41\npop     rbx                                                            ; +0x292, 0x18008ea42\nretn                                                                   ; +0x293, 0x18008ea43", "xrefs": ["cocos2d::CCSpriteBatchNode::insertChild @ 0x18008e96c", "cocos2d::CCSpriteBatchNode::insertChild @ 0x18008ea18", "<???> @ 0x1801438a8", "<???> @ 0x1801b6030"], "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"}