//
// GJSmartBlockPreview::create from 0x9d5ef8 to 0x9d6064 (364 bytes)
//
// 3 xrefs:
// > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x9dea54
// > BrowseSmartKeyLayer::init @ 0x9e0978
// > ??> @ 0x91458
//
// 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 GJSmartBlockPreview::create()
{
__int64 v0; // x19
_BOOL4 v1; // w22
void *v2; // x0
__int64 v3; // x1
__int64 v4; // x0
unsigned int *v6; // x2
int v7; // w1
__int64 v8; // [xsp+50h] [xbp+50h] BYREF
v0 = operator new(0x160u);
cocos2d::CCNode::CCNode((cocos2d::CCNode *)v0);
*(_QWORD *)v0 = &off_11C9C70;
*(_QWORD *)(v0 + 328) = 0;
*(_QWORD *)(v0 + 336) = 0;
*(_QWORD *)(v0 + 320) = &byte_124B6C8;
*(_BYTE *)(v0 + 344) = 0;
sub_D18D28(&v8);
v1 = GJSmartBlockPreview::init((cocos2d::CCNode *)v0, (__int64)&v8);
v2 = (void *)(v8 - 24);
if ( (__int64 *)(v8 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v6 = (unsigned int *)(v8 - 8);
do
v7 = __ldaxr(v6);
while ( __stlxr(v7 - 1, v6) );
}
else
{
v7 = *(_DWORD *)(v8 - 8);
*(_DWORD *)(v8 - 8) = v7 - 1;
}
if ( v7 <= 0 )
operator delete(v2);
}
if ( v1 )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v0);
}
else
{
v3 = *(_QWORD *)v0;
v4 = v0;
v0 = 0;
(*(void (__fastcall **)(__int64))(v3 + 16))(v4);
}
return v0;
}