//
// GJSmartTemplate::getNoCornerKey from 0x9d0bcc to 0x9d0d70 (420 bytes)
//
// 9 xrefs:
// > GJSmartTemplate::saveRemap @ 0x9d26e8
// > GJSmartTemplate::saveRemap @ 0x9d276c
// > GJSmartTemplate::saveRemap @ 0x9d28c0
// > GJSmartTemplate::saveRemap @ 0x9d2a1c
// > GJSmartTemplate::getPrefab @ 0x9d3920
// > GJSmartTemplate::getPrefab @ 0x9d39d0
// > GJSmartTemplate::getPrefab @ 0x9d3c0c
// > GJSmartTemplate::scanForPrefab @ 0x9d84f8
// > ??> @ 0xc0fa8
//
// 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
//
_QWORD *__usercall GJSmartTemplate::getNoCornerKey@(const void **a1@, _QWORD *a2@)
{
void *v4; // x23
const void *v5; // x1
size_t v6; // x22
size_t v7; // x20
size_t v8; // x2
size_t v9; // x20
char *v10; // x0
char *v11; // x2
unsigned int *v13; // x0
int v14; // w1
void *v15; // [xsp+50h] [xbp+50h] BYREF
if ( *((_QWORD *)*a1 - 3) )
{
sub_D14F84(&v15, a1, 0, 5);
sub_D15FD4(&v15, "0000", 4);
v4 = v15;
v5 = *a1;
v6 = *((_QWORD *)*a1 - 3);
v7 = *((_QWORD *)v15 - 3);
if ( v6 > v7 )
v8 = *((_QWORD *)v15 - 3);
else
v8 = v6;
if ( memcmp(v15, v5, v8) || (v9 = v7 - v6, v9 + 0x80000000 > 0xFFFFFFFF) || (_DWORD)v9 )
{
*a2 = v4;
v10 = &byte_124B6C8;
v15 = &byte_124B6C8;
}
else
{
sub_D153B8((int)a2, &byte_F288A0);
v10 = (char *)v15;
}
v11 = v10 - 24;
if ( v10 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v10 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v10 - 2);
*((_DWORD *)v10 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v11);
}
}
else
{
sub_D153B8((int)a2, &byte_F288A0);
}
return a2;
}