//
// RateDemonLayer::onRate from 0x933dc0 to 0x933f38 (376 bytes)
//
// 3 xrefs:
// > ??> @ 0xaee40
// > RateDemonLayer::init @ 0x9343dc
// > ??> @ 0x122e0c8
//
// 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
//
void RateDemonLayer::onRate(RateDemonLayer *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // x0
UploadActionPopup *m_popup; // x0
UploadActionPopup *v5; // x0
void *v6; // x3
unsigned int *v7; // x2
int v8; // w0
__int64 v9; // [xsp+40h] [xbp+40h] BYREF
if ( a1->m_demonRate != -1 )
{
v3 = GameLevelManager::sharedState();
if ( GameLevelManager::rateDemon(v3, a1->m_levelID, a1->m_demonRate, a1->m_moderator) )
{
if ( !a1->m_moderator )
{
LABEL_4:
RateDemonLayer::onClose(a1, nullptr);
return;
}
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
m_popup = a1->m_popup;
if ( m_popup )
m_popup->m_delegate = nullptr;
sub_D153B8((int)&v9, "Sending rating...");
v5 = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate);
a1->m_popup = v5;
v6 = (void *)(v9 - 24);
if ( (__int64 *)(v9 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v9 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v6);
v5 = a1->m_popup;
}
v5->show(v5);
}
if ( !a1->m_moderator )
goto LABEL_4;
}
}