//
// ParentalGateLayer::generateChallenge from 0x100886d30 to 0x100886f1a (490 bytes)
//
// 3 xrefs:
// > ParentalGateLayer::create @ 0x10087c0ae
// > ParentalGateLayer::init @ 0x100886d21
// > ParentalGateLayer::onDone @ 0x100886f74
//
// This function is hookable on this platform (idp: pc, 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:36:59 +0000
//
__int64 __fastcall ParentalGateLayer::generateChallenge(__int64 a1)
{
int v1; // r14d
int v2; // r15d
int v3; // r14d
int v4; // edx
__int64 v5; // rax
const char *CString; // r15
size_t v7; // rax
std::string::size_type v8; // r14
char *data; // r12
size_t v10; // r13
std::string __dst[2]; // [rsp+0h] [rbp-40h] BYREF
v1 = rand();
v2 = rand();
v3 = v1 % 88 + 12;
if ( __ROR1__(-51 * v3 + 24, 1) <= 0x18u )
{
do
v3 = rand() % 88 + 12;
while ( __ROR1__(-51 * v3 + 24, 1) < 0x19u );
}
v4 = v2 % 88 + 12;
if ( __ROR1__(-51 * (v2 % 88 + 12) + 24, 1) <= 0x18u )
{
do
v4 = rand() % 88 + 12;
while ( __ROR1__(-51 * v4 + 24, 1) < 0x19u );
}
*(_DWORD *)(a1 + 752) = v3 * v4;
v5 = sub_10088E820("%i x %i = ", *(_BYTE *)&__dst[0].__r_.__value_.__l.0);
CString = (const char *)cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
data = (char *)operator new(v10);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v10 + 1;
__dst[0].__r_.__value_.__l.__size_ = v8;
goto LABEL_12;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v7 )
LABEL_12:
memmove(data, CString, v8);
data[v8] = 0;
std::string::operator=((std::string *)(a1 + 696), __dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
std::string::assign((std::string *)(a1 + 720), "");
return NumberInputLayer::updateNumberState(a1);
}