//
// AccountRegisterLayer::onSubmit from 0x1004966a0 to 0x100496dcc (1836 bytes)
//
// 1 xrefs:
// > AccountRegisterLayer::init @ 0x100495740
//
// 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
//
void __fastcall AccountRegisterLayer::onSubmit(AccountRegisterLayer *a1, cocos2d::CCObject *a2)
{
double v3; // xmm0_8
cocos2d::CCLabelBMFont **p_m_usernameLabel; // rbx
unsigned __int64 v5; // r14
unsigned __int64 v6; // r14
size_t v7; // r14
char *v8; // rdi
size_t v9; // r15
char *v10; // rsi
size_t v11; // rdx
char *v12; // r14
unsigned int v13; // eax
__int64 v14; // rcx
int v15; // edx
__int64 v16; // rsi
int v17; // edi
bool v18; // r14
int v19; // r8d
size_t v20; // r14
char *v21; // rdi
size_t v22; // r15
char *v23; // rsi
size_t v24; // rdx
GJAccountManager *v25; // r14
int v26; // r9d
int v27; // r10d
int v28; // r9d
int v29; // r10d
int v30; // r9d
int v31; // r10d
int v32; // r9d
bool v33; // r14
void *v34[3]; // [rsp+0h] [rbp-140h] BYREF
void *v35[3]; // [rsp+18h] [rbp-128h] BYREF
__int128 v36; // [rsp+30h] [rbp-110h] BYREF
void *__p; // [rsp+40h] [rbp-100h]
__int128 v38; // [rsp+50h] [rbp-F0h] BYREF
void *v39; // [rsp+60h] [rbp-E0h]
char __s[16]; // [rsp+70h] [rbp-D0h] BYREF
void *v41; // [rsp+80h] [rbp-C0h]
__int128 v42; // [rsp+90h] [rbp-B0h] BYREF
void *v43; // [rsp+A0h] [rbp-A0h]
size_t v44[2]; // [rsp+B0h] [rbp-90h] BYREF
void *__s2; // [rsp+C0h] [rbp-80h]
size_t v46[2]; // [rsp+C8h] [rbp-78h] BYREF
void *v47; // [rsp+D8h] [rbp-68h]
__int128 __s1; // [rsp+E0h] [rbp-60h] BYREF
void *v49; // [rsp+F0h] [rbp-50h]
__int128 v50; // [rsp+F8h] [rbp-48h] BYREF
void *v51; // [rsp+108h] [rbp-38h]
__int128 v52; // [rsp+110h] [rbp-30h] BYREF
void *v53; // [rsp+120h] [rbp-20h]
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_usernameLabel->setString)(
a1->m_usernameLabel,
"Username: (shown to other players)");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_usernameLabel->setColor)(
a1->m_usernameLabel,
&unk_10081D314);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_passwordLabel->setString)(
a1->m_passwordLabel,
"Password:");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_passwordLabel->setColor)(
a1->m_passwordLabel,
&unk_10081D314);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_confirmPasswordLabel->setString)(
a1->m_confirmPasswordLabel,
"Confirm Password:");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_confirmPasswordLabel->setColor)(
a1->m_confirmPasswordLabel,
&unk_10081D314);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_emailLabel->setString)(a1->m_emailLabel, "Email:");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_emailLabel->setColor)(a1->m_emailLabel, &unk_10081D314);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_verifyEmailLabel->setString)(
a1->m_verifyEmailLabel,
"Verify Email:");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_verifyEmailLabel->setColor)(
a1->m_verifyEmailLabel,
&unk_10081D314);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_verifyEmailLabel->setString)(
a1->m_verifyEmailLabel,
"Verify Email:");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_verifyEmailLabel->setColor)(
a1->m_verifyEmailLabel,
&unk_10081D314);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_usernameField->onClickTrackNode)(a1->m_usernameField, 0);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_passwordField->onClickTrackNode)(a1->m_passwordField, 0);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_confirmPasswordField->onClickTrackNode)(
a1->m_confirmPasswordField,
0);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_emailField->onClickTrackNode)(a1->m_emailField, 0);
v3 = ((double (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_verifyEmailField->onClickTrackNode)(
a1->m_verifyEmailField,
0);
CCTextInputNode::getString(&v52, (__int64)a1->m_usernameField, v3);
CCTextInputNode::getString(&__s1, (__int64)a1->m_passwordField, v3);
CCTextInputNode::getString(v44, (__int64)a1->m_confirmPasswordField, v3);
CCTextInputNode::getString(&v50, (__int64)a1->m_emailField, v3);
CCTextInputNode::getString(v46, (__int64)a1->m_verifyEmailField, v3);
if ( (v52 & 1) != 0 )
{
sub_100006B70(&v36, v53, *((unsigned __int64 *)&v52 + 1), v3);
}
else
{
__p = v53;
v3 = *(double *)&v52;
v36 = v52;
}
if ( (v36 & 1) != 0 )
{
v5 = *((_QWORD *)&v36 + 1);
operator delete(__p);
if ( v5 <= 2 )
goto LABEL_6;
}
else if ( (unsigned __int8)v36 <= 4u )
{
LABEL_6:
p_m_usernameLabel = &a1->m_usernameLabel;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))(*p_m_usernameLabel)->setString)(
*p_m_usernameLabel,
"Too short. Minimum 3 characters");
LABEL_67:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))(*p_m_usernameLabel)->setColor)(
*p_m_usernameLabel,
&unk_10081D311);
goto LABEL_68;
}
if ( (__s1 & 1) != 0 )
{
sub_100006B70(&v38, v49, *((unsigned __int64 *)&__s1 + 1), v3);
}
else
{
v39 = v49;
v3 = *(double *)&__s1;
v38 = __s1;
}
if ( (v38 & 1) != 0 )
{
v6 = *((_QWORD *)&v38 + 1);
operator delete(v39);
if ( v6 <= 5 )
goto LABEL_13;
}
else if ( (unsigned __int8)v38 <= 0xAu )
{
LABEL_13:
p_m_usernameLabel = &a1->m_passwordLabel;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))(*p_m_usernameLabel)->setString)(
*p_m_usernameLabel,
"Too short. Minimum 6 characters");
goto LABEL_67;
}
if ( (__s1 & 1) != 0 )
{
v7 = *((_QWORD *)&__s1 + 1);
v8 = (char *)v49;
}
else
{
v7 = (unsigned __int8)__s1 >> 1;
v8 = (char *)&__s1 + 1;
}
v9 = LOBYTE(v44[0]) >> 1;
if ( (v44[0] & 1) != 0 )
v9 = v44[1];
v10 = (char *)v44 + 1;
if ( (v44[0] & 1) != 0 )
v10 = (char *)__s2;
v11 = v7;
if ( v9 < v7 )
v11 = v9;
if ( memcmp(v8, v10, v11) || v9 != v7 )
{
p_m_usernameLabel = &a1->m_confirmPasswordLabel;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))(*p_m_usernameLabel)->setString)(
*p_m_usernameLabel,
"Passwords do not match");
goto LABEL_67;
}
if ( (v50 & 1) != 0 )
{
sub_100006B70(__s, v51, *((unsigned __int64 *)&v50 + 1), v3);
}
else
{
v41 = v51;
v3 = *(double *)&v50;
*(_OWORD *)__s = v50;
}
if ( (__s[0] & 1) != 0 )
{
v12 = (char *)v41;
if ( !v41 )
{
LABEL_54:
p_m_usernameLabel = &a1->m_emailLabel;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))(*p_m_usernameLabel)->setString)(
*p_m_usernameLabel,
"Email is invalid");
goto LABEL_67;
}
}
else
{
v12 = &__s[1];
}
if ( (unsigned __int8)((*v12 & 0xDF) - 65) > 0x19u )
{
v18 = 0;
goto LABEL_49;
}
v13 = strlen(v12);
if ( v13 )
{
v14 = v13 & 3;
if ( (unsigned __int64)v13 - 1 < 3 )
{
v15 = -1;
v16 = 0;
v17 = -1;
LABEL_37:
if ( (v13 & 3) != 0 )
{
do
{
v19 = (unsigned __int8)v12[v16];
if ( v19 == 46 )
{
v15 = v16;
}
else if ( v19 == 64 )
{
v17 = v16;
}
++v16;
--v14;
}
while ( v14 );
}
v18 = 0;
if ( v17 != -1 && v15 != -1 && v17 <= v15 )
{
v18 = v15 < (int)(v13 - 1);
if ( (__s[0] & 1) == 0 )
goto LABEL_51;
LABEL_50:
operator delete(v41);
goto LABEL_51;
}
LABEL_49:
if ( (__s[0] & 1) == 0 )
goto LABEL_51;
goto LABEL_50;
}
v15 = -1;
v16 = 0;
v17 = -1;
while ( 1 )
{
v26 = (unsigned __int8)v12[v16];
if ( v26 == 46 )
{
v15 = v16;
v27 = (unsigned __int8)v12[v16 + 1];
v28 = v16 + 1;
if ( v27 == 46 )
goto LABEL_97;
}
else
{
if ( v26 == 64 )
v17 = v16;
v27 = (unsigned __int8)v12[v16 + 1];
v28 = v16 + 1;
if ( v27 == 46 )
{
LABEL_97:
v15 = v28;
v29 = (unsigned __int8)v12[v16 + 2];
v30 = v16 + 2;
if ( v29 == 46 )
goto LABEL_98;
goto LABEL_92;
}
}
if ( v27 == 64 )
v17 = v28;
v29 = (unsigned __int8)v12[v16 + 2];
v30 = v16 + 2;
if ( v29 == 46 )
{
LABEL_98:
v15 = v30;
v31 = (unsigned __int8)v12[v16 + 3];
v32 = v16 + 3;
if ( v31 != 46 )
goto LABEL_99;
goto LABEL_83;
}
LABEL_92:
if ( v29 == 64 )
v17 = v30;
v31 = (unsigned __int8)v12[v16 + 3];
v32 = v16 + 3;
if ( v31 != 46 )
{
LABEL_99:
if ( v31 == 64 )
v17 = v32;
goto LABEL_84;
}
LABEL_83:
v15 = v32;
LABEL_84:
v16 += 4;
if ( v13 - v14 == v16 )
goto LABEL_37;
}
}
v18 = 0;
if ( (__s[0] & 1) != 0 )
goto LABEL_50;
LABEL_51:
if ( !v18 )
goto LABEL_54;
if ( (v50 & 1) != 0 )
{
v20 = *((_QWORD *)&v50 + 1);
v21 = (char *)v51;
}
else
{
v20 = (unsigned __int8)v50 >> 1;
v21 = (char *)&v50 + 1;
}
v22 = LOBYTE(v46[0]) >> 1;
if ( (v46[0] & 1) != 0 )
v22 = v46[1];
v23 = (char *)v46 + 1;
if ( (v46[0] & 1) != 0 )
v23 = (char *)v47;
v24 = v20;
if ( v22 < v20 )
v24 = v22;
if ( memcmp(v21, v23, v24) || v22 != v20 )
{
p_m_usernameLabel = &a1->m_verifyEmailLabel;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))(*p_m_usernameLabel)->setString)(
*p_m_usernameLabel,
"Emails do not match");
goto LABEL_67;
}
GJAccountManager::sharedState()->m_accountRegisterDelegate = &a1->GJAccountRegisterDelegate;
v25 = GJAccountManager::sharedState();
if ( (v52 & 1) != 0 )
{
sub_100006B70(&v42, v53, *((unsigned __int64 *)&v52 + 1), v3);
}
else
{
v43 = v53;
v3 = *(double *)&v52;
v42 = v52;
}
CCTextInputNode::getString(v34, (__int64)a1->m_passwordField, v3);
CCTextInputNode::getString(v35, (__int64)a1->m_emailField, v3);
v33 = GJAccountManager::registerAccount(v25);
if ( ((__int64)v35[0] & 1) != 0 )
{
operator delete(v35[2]);
if ( ((__int64)v34[0] & 1) == 0 )
{
LABEL_104:
if ( (v42 & 1) == 0 )
goto LABEL_105;
LABEL_109:
operator delete(v43);
if ( v33 )
goto LABEL_106;
goto LABEL_110;
}
}
else if ( ((__int64)v34[0] & 1) == 0 )
{
goto LABEL_104;
}
operator delete(v34[2]);
if ( (v42 & 1) != 0 )
goto LABEL_109;
LABEL_105:
if ( v33 )
{
LABEL_106:
AccountRegisterLayer::showLoadingUI(a1);
goto LABEL_68;
}
LABEL_110:
((void (__fastcall *)(AccountRegisterLayer *, __int64))a1->registerAccountFailed)(a1, 0xFFFFFFFFLL);
LABEL_68:
if ( (v46[0] & 1) != 0 )
{
operator delete(v47);
if ( (v50 & 1) == 0 )
{
LABEL_70:
if ( (v44[0] & 1) == 0 )
goto LABEL_71;
goto LABEL_77;
}
}
else if ( (v50 & 1) == 0 )
{
goto LABEL_70;
}
operator delete(v51);
if ( (v44[0] & 1) == 0 )
{
LABEL_71:
if ( (__s1 & 1) == 0 )
goto LABEL_72;
goto LABEL_78;
}
LABEL_77:
operator delete(__s2);
if ( (__s1 & 1) == 0 )
{
LABEL_72:
if ( (v52 & 1) == 0 )
return;
goto LABEL_73;
}
LABEL_78:
operator delete(v49);
if ( (v52 & 1) != 0 )
LABEL_73:
operator delete(v53);
}