//
// GameLevelManager::onGetLevelRateInfoCompleted from 0x6f9dfc to 0x6fa024 (552 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x731d94
// > ??> @ 0x33768
//
// 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 __fastcall GameLevelManager::onGetLevelRateInfoCompleted(
GameLevelManager *a1,
const void **a2,
const char **a3)
{
unsigned int SplitIntFromKey; // w25
_DWORD *v6; // x26
unsigned __int64 v7; // x27
unsigned __int64 v8; // x20
size_t v9; // x2
int v10; // w19
__int64 v11; // x20
__int64 *v12; // x0
LevelRateInfoDelegate *v13; // x0
LevelRateInfoDelegate *m_levelRateInfoDelegate; // x19
void (__fastcall *rateInfoFinished)(LevelRateInfoDelegate *__hidden, int, std::string); // x22
long double v17; // q0
char *v18; // x19
unsigned int *v19; // x26
int v20; // w0
unsigned int *v21; // x26
int v22; // w1
void *v24; // [xsp+80h] [xbp+80h] BYREF
GameLevelManager::removeDLFromActive(a1, *a3);
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(a1, *a3, 1);
sub_D153B8((int)&v24, "-1");
v6 = v24;
v7 = *((_QWORD *)v24 - 3);
v8 = *((_QWORD *)*a2 - 3);
if ( v7 > v8 )
v9 = *((_QWORD *)*a2 - 3);
else
v9 = *((_QWORD *)v24 - 3);
v10 = memcmp(*a2, v24, v9);
if ( v10 || (v10 = 0x7FFFFFFF, v11 = v8 - v7, v11 > 0x7FFFFFFF) )
{
v12 = (__int64 *)(v6 - 6);
if ( v6 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v12 = (__int64 *)(v6 - 6);
if ( v11 >= (__int64)0xFFFFFFFF80000000LL )
v10 = v11;
else
v10 = 0x80000000;
if ( v12 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v21 = v6 - 2;
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(v6 - 2);
*(v6 - 2) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v12);
LABEL_7:
if ( v10 )
{
m_levelRateInfoDelegate = a1->m_levelRateInfoDelegate;
if ( m_levelRateInfoDelegate )
{
rateInfoFinished = m_levelRateInfoDelegate->rateInfoFinished;
*(__n128 *)&v17 = sub_D18D28(&v24, a2);
((void (__fastcall *)(LevelRateInfoDelegate *, _QWORD, void **, long double))rateInfoFinished)(
m_levelRateInfoDelegate,
SplitIntFromKey,
&v24,
v17);
v18 = (char *)v24 - 24;
if ( (char *)v24 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)((char *)v24 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v24 - 2);
*((_DWORD *)v24 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v18);
}
}
}
else
{
v13 = a1->m_levelRateInfoDelegate;
if ( v13 )
v13->rateInfoFailed(v13, SplitIntFromKey, 0);
}
return _stack_chk_guard;
}