//
// sub_51DD24 from 0x51dd24 to 0x51de6e (330 bytes)
//
// 2 xrefs:
// > GameStatsManager::createReward @ 0x51dea2
// > GameStatsManager::isSecretCoinValid @ 0x51df96
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:51:50 +0000
//
int __fastcall sub_51DD24(unsigned __int8 *a1, char *a2, int *a3)
{
int v3; // r7
int v6; // r4
unsigned __int8 *v8; // r8
size_t v9; // r0
int v10; // r4
unsigned __int8 *v11; // r7
unsigned __int8 *first_of; // r0
int v13; // r9
unsigned int v14; // r8
int v15; // r3
int v16; // r3
int *v17; // r0
int v18; // r4
unsigned __int8 *v19; // r9
unsigned int v20; // r4
size_t v21; // r0
unsigned __int8 *v22; // r4
unsigned __int8 *v23; // r0
int v25; // [sp+8h] [bp-1Ch]
int v26[3]; // [sp+10h] [bp-14h] BYREF
v6 = *a1;
if ( (v6 & 1) != 0 )
{
v8 = *((unsigned __int8 **)a1 + 2);
}
else
{
v8 = a1 + 1;
v3 = v6 >> 1;
}
if ( (v6 & 1) != 0 )
v3 = *((_DWORD *)a1 + 1);
v9 = strlen(a2);
if ( v3
&& v9
&& (v11 = &v8[v3],
first_of = std::__find_first_of_ce(
v8,
v11,
(int)a2,
(int)&a2[v9],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
first_of != v11) )
{
v10 = first_of - v8;
}
else
{
v10 = -1;
}
v13 = *a1;
v14 = 0;
if ( (v13 & 1) != 0 )
v15 = *((_DWORD *)a1 + 1);
else
v15 = v13 >> 1;
v25 = v15;
while ( 1 )
{
std::string::basic_string(v26, a1, v14, v10 - v14);
if ( (v26[0] & 1) != 0 )
v16 = v26[1];
else
v16 = (int)LOBYTE(v26[0]) >> 1;
if ( v16 || v14 != v25 )
{
v17 = (int *)a3[1];
if ( v17 == (int *)a3[2] )
{
std::vector::__push_back_slow_path(a3, (int)v26);
}
else
{
if ( v17 )
std::string::basic_string(v17, (int)v26);
a3[1] += 12;
}
}
if ( v10 == -1 )
break;
v14 = v10 + 1;
v18 = *a1;
if ( (v18 & 1) != 0 )
{
v19 = *((unsigned __int8 **)a1 + 2);
v20 = *((_DWORD *)a1 + 1);
}
else
{
v19 = a1 + 1;
v20 = v18 >> 1;
}
v21 = strlen(a2);
if ( v14 >= v20
|| !v21
|| (v22 = &v19[v20],
v23 = std::__find_first_of_ce(
&v19[v14],
v22,
(int)a2,
(int)&a2[v21],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
v23 == v22) )
{
v10 = -1;
}
else
{
v10 = v23 - v19;
}
std::string::~string((int)v26);
}
return std::string::~string((int)v26);
}