//
// KeybindingsManager::keyToCommandForGroup from 0x8542c8 to 0x854498 (464 bytes)
//
// 1 xrefs:
// > ??> @ 0x86ca0
//
// 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
//
// local variable allocation has failed, the output may be wrong!
cocos2d::CCDictionary *KeybindingsManager::keyToCommandForGroup(KeybindingsManager *a1, GJKeyGroup a2)
{
cocos2d::CCString *v3; // x0
char *CString; // x24
cocos2d::CCDictionary *m_keyToCommandDict; // x20
cocos2d::CCDictionary *v6; // x20
char *v7; // x0
unsigned int *v9; // x1
int v10; // w2
cocos2d::CCDictionary *v11; // x25
char *v12; // x21
unsigned int *v13; // x1
int v14; // w0
std::string v15; // [xsp+60h] [xbp+60h] BYREF
v3 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", *(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v3);
m_keyToCommandDict = a1->m_keyToCommandDict;
sub_D153B8((int)&v15, CString);
v6 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(m_keyToCommandDict, &v15);
v7 = (char *)v15.m_data.m_data - 24;
if ( (__int64 *)v15.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_2;
if ( &pthread_create )
{
v9 = (unsigned int *)((char *)v15.m_data.m_data - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v15.m_data.m_data - 2);
*((_DWORD *)v15.m_data.m_data - 2) = v10 - 1;
}
if ( v10 > 0 )
{
LABEL_2:
if ( v6 )
return v6;
}
else
{
operator delete(v7);
if ( v6 )
return v6;
}
v6 = cocos2d::CCDictionary::create();
v11 = a1->m_keyToCommandDict;
sub_D153B8((int)&v15, CString);
cocos2d::CCDictionary::setObject((int)v11, v6);
v12 = (char *)v15.m_data.m_data - 24;
if ( (__int64 *)v15.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)((char *)v15.m_data.m_data - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v15.m_data.m_data - 2);
*((_DWORD *)v15.m_data.m_data - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v12);
}
return v6;
}