//
// GameStatsManager::isSecretCoinValid from 0x8d6588 to 0x8d6834 (684 bytes)
//
// 2 xrefs:
// > GameStatsManager::dataLoaded @ 0x8e9104
// > ??> @ 0xe70e8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:56:42 +0000
//
bool __fastcall GameStatsManager::isSecretCoinValid(int a1, unsigned __int8 *a2)
{
char *v2; // x19
unsigned __int64 v3; // x1
_BOOL4 v4; // w21
char *v5; // x0
const char *v7; // x0
int v8; // w21
const char *v9; // x0
int v10; // w0
bool v11; // w0
char *v12; // x19
bool v13; // w0
char *v14; // x19
void *v15; // [xsp+38h] [xbp+38h] BYREF
char *v16; // [xsp+40h] [xbp+40h]
__int64 v17; // [xsp+48h] [xbp+48h]
__int64 v18[2]; // [xsp+50h] [xbp+50h] BYREF
void *v19; // [xsp+60h] [xbp+60h]
__int64 v20[2]; // [xsp+68h] [xbp+68h] BYREF
void *v21; // [xsp+78h] [xbp+78h]
__int64 v22[2]; // [xsp+80h] [xbp+80h] BYREF
void *v23; // [xsp+90h] [xbp+90h]
v15 = nullptr;
v16 = nullptr;
v17 = 0;
sub_8D60A8(a2, &byte_11528B0, (__int64 *)&v15);
v2 = (char *)v15;
v3 = 0xAAAAAAAAAAAAAAABLL * ((v16 - (_BYTE *)v15) >> 3);
if ( v3 == 2 )
{
v18[0] = 0;
v18[1] = 0;
v19 = nullptr;
std::string::__init(v18, "secret04", 8u);
v11 = sub_8C9338((__int64)(v2 + 24), (__int64)v18);
v4 = v11;
if ( !v11 )
{
v12 = (char *)v15 + 24;
v20[0] = 0;
v20[1] = 0;
v21 = nullptr;
std::string::__init(v20, "secret06", 8u);
v13 = sub_8C9338((__int64)v12, (__int64)v20);
v4 = v13;
if ( !v13 )
{
v14 = (char *)v15 + 24;
v22[0] = 0;
v22[1] = 0;
v23 = nullptr;
std::string::__init(v22, "secretB03", 9u);
v4 = sub_8C9338((__int64)v14, (__int64)v22);
if ( (v22[0] & 1) != 0 )
operator delete(v23);
}
if ( (v20[0] & 1) != 0 )
operator delete(v21);
}
if ( (v18[0] & 1) != 0 )
operator delete(v19);
v2 = (char *)v15;
LABEL_3:
if ( !v2 )
return v4;
goto LABEL_4;
}
v4 = 0;
if ( v3 != 3 )
goto LABEL_3;
v7 = (char *)v15 + 25;
if ( (*((_BYTE *)&off_18 + (_QWORD)v15) & 1) != 0 )
v7 = *(const char **)((char *)&qword_28 + (_QWORD)v15);
v8 = atoi(v7);
v9 = v2 + 49;
if ( (*((_BYTE *)&dword_30 + (_QWORD)v2) & 1) != 0 )
v9 = *(const char **)((char *)&dword_40 + (_QWORD)v2);
v10 = atoi(v9);
v4 = v8 > 0 && ((unsigned int)(v8 - 5001) <= 3 || v8 <= 22);
if ( v4 )
v4 = (unsigned int)(v10 - 1) <= 2;
LABEL_4:
v5 = v16;
if ( v16 != v2 )
{
do
{
v16 = v5 - 24;
if ( (*(v5 - 24) & 1) != 0 )
operator delete(*((void **)v5 - 1));
v5 = v16;
}
while ( v16 != v2 );
v2 = (char *)v15;
}
operator delete(v2);
return v4;
}