//
// GameStatsManager::getSpecialUnlockDescription from 0x7bcea8 to 0x7bd0ac (516 bytes)
//
// 2 xrefs:
// > ItemInfoPopup::init @ 0x795098
// > ??> @ 0x6ca08
//
// 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 __usercall GameStatsManager::getSpecialUnlockDescription@(
GameStatsManager *a1@,
unsigned int a2@,
unsigned int a3@,
__int64 a4@)
{
unsigned __int64 v6; // x0
_QWORD *v7; // x0
char *v8; // x0
_QWORD *v9; // x1
char *v10; // x0
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
_QWORD *v16; // [xsp+48h] [xbp+48h] BYREF
_DWORD *v17; // [xsp+50h] [xbp+50h] BYREF
GameStatsManager::getItemKey(a1, a2, a3, (__int64)&v16);
v6 = sub_CCD1D0(v16, *(v16 - 3), 3339675911LL);
v7 = std::_Hashtable,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_find_before_node(
&a1->m_createSpecialChestItemsMap._M_h._M_buckets,
v6 % a1->m_createSpecialChestItemsMap._M_h._M_bucket_count,
(const void **)&v16,
v6);
if ( !v7 || !*v7 )
{
sub_D153B8(a4, &byte_F288A0);
v9 = v16;
v10 = (char *)(v16 - 3);
if ( v16 - 3 == &qword_124B6B0 )
return a4;
goto LABEL_7;
}
sub_D18D28(&v17);
GameStatsManager::getSpecialRewardDescription((__int64)a1, (const void **)&v17, a4);
v8 = (char *)(v17 - 6);
if ( v17 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = v17 - 2;
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(v17 - 2);
*(v17 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v8);
}
v9 = v16;
v10 = (char *)(v16 - 3);
if ( v16 - 3 != &qword_124B6B0 )
{
LABEL_7:
if ( &pthread_create )
{
v12 = (unsigned int *)(v9 - 1);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *((_DWORD *)v9 - 2);
*((_DWORD *)v9 - 2) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v10);
}
return a4;
}