//
// ParentalGateLayer::generateChallenge from 0x533c7c to 0x533d62 (230 bytes)
//
// 2 xrefs:
// > ParentalGateLayer::init @ 0x533d9a
// > ParentalGateLayer::onDone @ 0x533df4
//
// 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:52:06 +0000
//
int __fastcall ParentalGateLayer::generateChallenge(ParentalGateLayer *this)
{
const char *v2; // r5
int v3; // r4
cocos2d::CCString *v4; // r0
const char *CString; // r5
size_t v6; // r0
char *v8; // r1
size_t v9; // r2
int v10; // [sp+0h] [bp-14h] BYREF
size_t v11; // [sp+4h] [bp-10h]
int v12; // [sp+8h] [bp-Ch]
v2 = (const char *)(rand() % 88 + 12);
v3 = rand() % 88 + 12;
while ( !((int)v2 % 10) )
v2 = (const char *)(rand() % 88 + 12);
while ( !(v3 % 10) )
v3 = rand() % 88 + 12;
*((_DWORD *)this + 142) = v3 * (_DWORD)v2;
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i x %i = ", v2, v3);
v10 = 0;
v11 = 0;
v12 = 0;
CString = (const char *)cocos2d::CCString::getCString(v4);
v6 = strlen(CString);
std::string::__init(&v10, CString, v6);
if ( (int *)((char *)this + 540) != &v10 )
{
if ( (v10 & 1) != 0 )
{
v8 = (char *)v12;
v9 = v11;
}
else
{
v9 = (int)(unsigned __int8)v10 >> 1;
v8 = (char *)&v10 + 1;
}
std::string::assign((_DWORD *)this + 135, v8, v9);
}
std::string::~string((int)&v10);
std::string::assign((int *)this + 138, (char *)&unk_B6B226);
return NumberInputLayer::updateNumberState(this);
}