//
// GJRateLevelLayer::rateInfoFinished from 0x822924 to 0x822a4c (296 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'GJRateLevelLayer::rateInfoFinished @ 0x822a50
// > ??> @ 0x61620
// > ??> @ 0x11879b8
//
// 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 GJRateLevelLayer::rateInfoFinished(__int64 a1, int a2)
{
void *v4; // x0
unsigned int *v5; // x2
int v6; // w1
__int64 v7; // [xsp+50h] [xbp+50h] BYREF
if ( a2 == *(_DWORD *)(*(_QWORD *)(a1 + 1000) + 328LL) - *(_DWORD *)(*(_QWORD *)(a1 + 1000) + 332LL) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1072) + 328LL))(*(_QWORD *)(a1 + 1072), 0);
sub_D18D28(&v7);
GJRateLevelLayer::setupRateInfo(a1, &v7);
v4 = (void *)(v7 - 24);
if ( (__int64 *)(v7 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v5 = (unsigned int *)(v7 - 8);
do
v6 = __ldaxr(v5);
while ( __stlxr(v6 - 1, v5) );
}
else
{
v6 = *(_DWORD *)(v7 - 8);
*(_DWORD *)(v7 - 8) = v6 - 1;
}
if ( v6 <= 0 )
operator delete(v4);
}
}
return _stack_chk_guard;
}