{"type": "func", "start": 10355936, "end": 10356216, "name": "BrowseSmartTemplateLayer::createPrefab", "pseudocode": "// \n// BrowseSmartTemplateLayer::createPrefab from 0x9e04e0 to 0x9e05f8 (280 bytes)\n// \n// 3 xrefs:\n// > BrowseSmartTemplateLayer::onTemplateObject @ 0x9e14c8\n// > BrowseSmartKeyLayer::createTemplateObjects @ 0x9e18c8\n// > <???> @ 0x754c8\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 BrowseSmartTemplateLayer::createPrefab(__int64 a1, __int64 a2, int a3)\n{\n  GameManager *v4; // x0\n  GJSmartTemplate *v5; // x21\n  EditorUI *m_editorUI; // x20\n  void *v7; // x0\n  unsigned int *v9; // x2\n  int v10; // w1\n  __int64 v12; // [xsp+50h] [xbp+50h] BYREF\n\n  v4 = GameManager::sharedState();\n  v5 = *(GJSmartTemplate **)(a1 + 632);\n  m_editorUI = v4->m_levelEditorLayer->m_editorUI;\n  sub_D18D28(&v12);\n  EditorUI::createPrefab(m_editorUI, v5, &v12, a3);\n  v7 = (void *)(v12 - 24);\n  if ( (__int64 *)(v12 - 24) != &qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v9 = (unsigned int *)(v12 - 8);\n      do\n        v10 = __ldaxr(v9);\n      while ( __stlxr(v10 - 1, v9) );\n    }\n    else\n    {\n      v10 = *(_DWORD *)(v12 - 8);\n      *(_DWORD *)(v12 - 8) = v10 - 1;\n    }\n    if ( v10 <= 0 )\n      operator delete(v7);\n  }\n  return _stack_chk_guard;\n}", "assembly": "; \n; BrowseSmartTemplateLayer::createPrefab from 0x9e04e0 to 0x9e05f8 (280 bytes)\n; \n; 3 xrefs:\n; > BrowseSmartTemplateLayer::onTemplateObject @ 0x9e14c8\n; > BrowseSmartKeyLayer::createTemplateObjects @ 0x9e18c8\n; > <???> @ 0x754c8\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_60]!                                ; +0x0, 0x9e04e0\nMOV             W3, W2                                                 ; +0x4, 0x9e04e4\nMOV             X29, SP                                                ; +0x8, 0x9e04e8\nSTP             X19, X20, [SP,#0x60+var_50]                            ; +0xc, 0x9e04ec\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0x10, 0x9e04f0\nSTR             X21, [SP,#0x60+var_40]                                 ; +0x14, 0x9e04f4\nMOV             X21, X0                                                ; +0x18, 0x9e04f8\nSTR             X3, [X29,#0x60+var_30]                                 ; +0x1c, 0x9e04fc\nSTR             X1, [X29,#0x60+var_28]                                 ; +0x20, 0x9e0500\nADD             X20, X29, #0x60+var_10                                 ; +0x24, 0x9e0504\nLDR             X0, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x28, 0x9e0508\nLDR             X0, [X0]; this                                         ; +0x2c, 0x9e050c\nSTR             X0, [X29,#0x60+var_8]                                  ; +0x30, 0x9e0510\nBL              _ZN11GameManager11sharedStateEv; GameManager::sharedState(void) ; +0x34, 0x9e0514\nLDR             X4, [X0,#0x1E0]                                        ; +0x38, 0x9e0518\nLDR             X1, [X29,#0x60+var_28]                                 ; +0x3c, 0x9e051c\nMOV             X0, X20                                                ; +0x40, 0x9e0520\nLDR             X21, [X21,#0x278]                                      ; +0x44, 0x9e0524\nSTR             X20, [X29,#0x60+var_28]                                ; +0x48, 0x9e0528\nLDR             X20, [X4,#0x3880]                                      ; +0x4c, 0x9e052c\nBL              sub_D18D28                                             ; +0x50, 0x9e0530\nLDR             X2, [X29,#0x60+var_28]                                 ; +0x54, 0x9e0534\nMOV             X1, X21                                                ; +0x58, 0x9e0538\nLDR             X3, [X29,#0x60+var_30]                                 ; +0x5c, 0x9e053c\nMOV             X0, X20                                                ; +0x60, 0x9e0540\nBL              _ZN8EditorUI12createPrefabEP15GJSmartTemplateSsi; EditorUI::createPrefab(GJSmartTemplate *,std::string,int) ; +0x64, 0x9e0544\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x68, 0x9e0548\nLDR             X2, [X29,#0x60+var_10]                                 ; +0x6c, 0x9e054c\nSUB             X0, X2, #0x18; p                                       ; +0x70, 0x9e0550\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x74, 0x9e0554\nCMP             X0, X1                                                 ; +0x78, 0x9e0558\nB.NE            loc_9E0584                                             ; +0x7c, 0x9e055c\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x80, 0x9e0560\nLDR             X1, [X29,#0x60+var_8]                                  ; +0x84, 0x9e0564\nLDR             X0, [X19]                                              ; +0x88, 0x9e0568\nCMP             X1, X0                                                 ; +0x8c, 0x9e056c\nB.NE            loc_9E05C8                                             ; +0x90, 0x9e0570\nLDP             X19, X20, [SP,#0x60+var_50]                            ; +0x94, 0x9e0574\nLDR             X21, [SP,#0x60+var_40]                                 ; +0x98, 0x9e0578\nLDP             X29, X30, [SP+0x60+var_60],#0x60                       ; +0x9c, 0x9e057c\nRET                                                                    ; +0xa0, 0x9e0580\nADRP            X1, #pthread_create_ptr_0@PAGE                         ; +0xa4, 0x9e0584\nLDR             X1, [X1,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0xa8, 0x9e0588\nCBZ             X1, loc_9E05B8                                         ; +0xac, 0x9e058c\nSUB             X2, X2, #8                                             ; +0xb0, 0x9e0590\nLDAXR           W1, [X2]                                               ; +0xb4, 0x9e0594\nSUB             W3, W1, #1                                             ; +0xb8, 0x9e0598\nSTLXR           W4, W3, [X2]                                           ; +0xbc, 0x9e059c\nCBNZ            W4, loc_9E0594                                         ; +0xc0, 0x9e05a0\nCMP             W1, WZR                                                ; +0xc4, 0x9e05a4\nB.GT            loc_9E0560                                             ; +0xc8, 0x9e05a8\nADD             X1, X29, #0x60+var_18                                  ; +0xcc, 0x9e05ac\nBL              j__ZdlPv; operator delete(void *)                      ; +0xd0, 0x9e05b0\nB               loc_9E0560                                             ; +0xd4, 0x9e05b4\nLDUR            W1, [X2,#-8]                                           ; +0xd8, 0x9e05b8\nSUB             W3, W1, #1                                             ; +0xdc, 0x9e05bc\nSTUR            W3, [X2,#-8]                                           ; +0xe0, 0x9e05c0\nB               loc_9E05A4                                             ; +0xe4, 0x9e05c4\nBL              .__stack_chk_fail                                      ; +0xe8, 0x9e05c8\nADRP            X1, #off_122EFE8@PAGE                                  ; +0xec, 0x9e05cc\nMOV             X19, X0                                                ; +0xf0, 0x9e05d0\nLDR             X0, [X29,#0x60+var_10]                                 ; +0xf4, 0x9e05d4\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0xf8, 0x9e05d8\nSUB             X0, X0, #0x18                                          ; +0xfc, 0x9e05dc\nCMP             X0, X1                                                 ; +0x100, 0x9e05e0\nB.EQ            loc_9E05F0                                             ; +0x104, 0x9e05e4\nADD             X1, X29, #0x60+var_18                                  ; +0x108, 0x9e05e8\nBL              sub_4DD5A0                                             ; +0x10c, 0x9e05ec\nMOV             X0, X19                                                ; +0x110, 0x9e05f0\nBL              _Unwind_Resume                                         ; +0x114, 0x9e05f4", "xrefs": ["BrowseSmartTemplateLayer::onTemplateObject @ 0x9e14c8", "BrowseSmartKeyLayer::createTemplateObjects @ 0x9e18c8", "<???> @ 0x754c8"], "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"}