//
// BrowseSmartTemplateLayer::createPrefab from 0x9e04e0 to 0x9e05f8 (280 bytes)
//
// 3 xrefs:
// > BrowseSmartTemplateLayer::onTemplateObject @ 0x9e14c8
// > BrowseSmartKeyLayer::createTemplateObjects @ 0x9e18c8
// > ??> @ 0x754c8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall BrowseSmartTemplateLayer::createPrefab(__int64 a1, __int64 a2, int a3)
{
GameManager *v4; // x0
GJSmartTemplate *v5; // x21
EditorUI *m_editorUI; // x20
void *v7; // x0
unsigned int *v9; // x2
int v10; // w1
__int64 v12; // [xsp+50h] [xbp+50h] BYREF
v4 = GameManager::sharedState();
v5 = *(GJSmartTemplate **)(a1 + 632);
m_editorUI = v4->m_levelEditorLayer->m_editorUI;
sub_D18D28(&v12);
EditorUI::createPrefab(m_editorUI, v5, &v12, a3);
v7 = (void *)(v12 - 24);
if ( (__int64 *)(v12 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v12 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v12 - 8);
*(_DWORD *)(v12 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v7);
}
return _stack_chk_guard;
}