//
// sub_1003F4794 from 0x1003f4794 to 0x1003f5148 (2484 bytes)
//
// 1 xrefs:
// > SecretLayer4::init @ 0x1003f3eac
//
// 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 11:04:32 +0000
//
void __fastcall sub_1003F4794(__int64 a1)
{
std::string::size_type size; // x9
__int64 v3; // x19
unsigned __int64 v4; // x8
unsigned int v5; // w20
std::string *p_dst; // x8
std::string::value_type v7; // w0
std::string *v8; // x8
std::string::size_type v9; // x9
std::string::size_type v11; // x20
std::string::size_type v12; // x8
std::string *v13; // x28
std::string::size_type v14; // x27
unsigned __int64 v15; // x24
std::string::size_type v16; // x19
void **v17; // x21
signed __int64 v18; // x22
signed __int64 v19; // x9
char *v20; // x25
char *v21; // x0
int v22; // w20
char *v23; // x0
char *v24; // x23
std::string::size_type v25; // x2
const std::string::value_type *v26; // x3
std::string::size_type v27; // x4
std::string::size_type v28; // x8
_QWORD *v29; // x20
_BOOL4 v30; // w0
_BOOL4 v31; // w20
__int64 v32; // x0
__int64 v33; // x0
_BOOL4 v34; // w0
_BOOL4 v35; // w20
__int64 v36; // x0
__int64 v37; // x0
_BOOL4 v38; // w20
__int64 v39; // x0
__int64 v40; // x0
_BOOL4 v41; // w0
_BOOL4 v42; // w20
__int64 v43; // x0
__int64 v44; // x0
_BOOL4 v45; // w20
__int64 v46; // x0
__int64 v47; // x0
_BOOL4 v48; // w20
__int64 v49; // x0
__int64 v50; // x0
_BOOL4 v51; // w20
__int64 v52; // x0
__int64 v53; // x0
std::string::size_type v54; // x8
__int64 v55; // x0
int v56; // w19
void *v57; // x1
void *v58; // [xsp+0h] [xbp-1B0h] BYREF
char v59; // [xsp+17h] [xbp-199h]
void *v60[2]; // [xsp+18h] [xbp-198h] BYREF
char v61; // [xsp+2Fh] [xbp-181h]
void *v62[2]; // [xsp+30h] [xbp-180h] BYREF
char v63; // [xsp+47h] [xbp-169h]
void *v64[2]; // [xsp+48h] [xbp-168h] BYREF
char v65; // [xsp+5Fh] [xbp-151h]
void *v66[2]; // [xsp+60h] [xbp-150h] BYREF
char v67; // [xsp+77h] [xbp-139h]
void *v68[2]; // [xsp+78h] [xbp-138h] BYREF
char v69; // [xsp+8Fh] [xbp-121h]
void *v70[2]; // [xsp+90h] [xbp-120h] BYREF
char v71; // [xsp+A7h] [xbp-109h]
void *v72[2]; // [xsp+A8h] [xbp-108h] BYREF
char v73; // [xsp+BFh] [xbp-F1h]
void *v74[2]; // [xsp+C0h] [xbp-F0h] BYREF
char v75; // [xsp+D7h] [xbp-D9h]
void *__p[2]; // [xsp+D8h] [xbp-D8h] BYREF
char v77; // [xsp+EFh] [xbp-C1h]
std::string::value_type *v78; // [xsp+F0h] [xbp-C0h] BYREF
std::string::size_type v79; // [xsp+F8h] [xbp-B8h]
unsigned __int8 v80; // [xsp+107h] [xbp-A9h]
void **v81; // [xsp+108h] [xbp-A8h] BYREF
signed __int64 v82; // [xsp+110h] [xbp-A0h]
char v83; // [xsp+11Fh] [xbp-91h]
std::string __dst; // [xsp+120h] [xbp-90h] BYREF
std::string v85; // [xsp+140h] [xbp-70h] BYREF
CCTextInputNode::getString(*(_QWORD *)(a1 + 456), &v85);
if ( SHIBYTE(v85.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, v85.__r_.__value_.__l.__data_, v85.__r_.__value_.__l.__size_);
else
__dst = v85;
size = __dst.__r_.__value_.__l.__size_;
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = SHIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( size )
{
v3 = 0;
v4 = (unsigned __int64)SHIBYTE(__dst.__r_.__value_.__r.__words[2]) >> 63;
v5 = 1;
do
{
if ( (v4 & 1) != 0 )
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
else
p_dst = &__dst;
v7 = __tolower(p_dst->__r_.__value_.__s.__data_[v3]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v8 = &__dst;
else
v8 = (std::string *)__dst.__r_.__value_.__r.__words[0];
v8->__r_.__value_.__s.__data_[v3] = v7;
v3 = v5;
v9 = SHIBYTE(__dst.__r_.__value_.__r.__words[2]);
v4 = (unsigned __int64)SHIBYTE(__dst.__r_.__value_.__r.__words[2]) >> 63;
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v9 = __dst.__r_.__value_.__l.__size_;
}
while ( v9 > v5++ );
}
sub_100009900(&v81, " ");
sub_100009900(&v78, "");
v11 = 0;
v12 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v13 = &__dst;
else
v13 = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v12 = __dst.__r_.__value_.__l.__size_;
v14 = v83;
v15 = (unsigned __int64)v83 >> 63;
v16 = v82;
if ( v83 >= 0 )
v17 = (void **)&v81;
else
v17 = v81;
if ( v83 >= 0 )
v18 = v83;
else
v18 = v82;
while ( !v18 )
{
LABEL_38:
if ( v11 != -1 )
{
if ( (v15 & 1) != 0 )
v25 = v16;
else
v25 = v14;
if ( (v80 & 0x80u) == 0 )
v26 = (const std::string::value_type *)&v78;
else
v26 = v78;
if ( (v80 & 0x80u) == 0 )
v27 = v80;
else
v27 = v79;
std::string::replace(&__dst, v11, v25, v26, v27);
v28 = v80;
if ( (v80 & 0x80u) != 0 )
v28 = v79;
v11 += v28;
v12 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v13 = &__dst;
else
v13 = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v12 = __dst.__r_.__value_.__l.__size_;
v14 = v83;
v15 = (unsigned __int64)v83 >> 63;
v16 = v82;
v17 = v83 >= 0 ? (void **)&v81 : v81;
v18 = v83 >= 0 ? v83 : v82;
if ( v12 >= v11 )
continue;
}
goto LABEL_62;
}
v19 = v12 - v11;
if ( (__int64)(v12 - v11) >= v18 )
{
v20 = (char *)v13 + v12;
v21 = (char *)v13 + v11;
v22 = *(char *)v17;
do
{
if ( v19 - v18 == -1 )
break;
v23 = (char *)memchr(v21, v22, v19 - v18 + 1);
if ( !v23 )
break;
v24 = v23;
if ( !memcmp(v23, v17, v18) )
{
if ( v24 == v20 )
break;
v11 = v24 - (char *)v13;
goto LABEL_38;
}
v21 = v24 + 1;
v19 = v20 - (v24 + 1);
}
while ( v19 >= v18 );
}
LABEL_62:
if ( (char)v80 < 0 )
{
operator delete(v78);
if ( (v83 & 0x80) == 0 )
goto LABEL_64;
}
else if ( (v14 & 0x80) == 0 )
{
goto LABEL_64;
}
operator delete(v81);
LABEL_64:
v29 = *(_QWORD **)(a1 + 456);
sub_100009900(__p, "");
CCTextInputNode::setString(v29, (__int64 *)__p);
if ( v77 < 0 )
operator delete(__p[0]);
sub_100009900(&v81, "darkness");
v30 = sub_1000045BC(&__dst, &v81);
v31 = v30;
if ( v83 < 0 )
{
operator delete(v81);
if ( v31 )
{
LABEL_68:
AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned() )
{
v32 = GameManager::sharedState();
GameManager::reportAchievementWithID(v32, "geometry.ach.v3.secret01", 100, 0);
sub_100009900(v74, "Impressive");
sub_1003F44A4(a1, (__int64 *)v74);
if ( v75 < 0 )
operator delete(v74[0]);
v33 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = -1;
LOWORD(v81) = -256;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v33 + 1072LL))(v33, &v81);
cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 464), 400.0, 0.8, 0.0);
LABEL_125:
*(_DWORD *)(a1 + 440) = 0;
goto LABEL_138;
}
goto LABEL_132;
}
}
else if ( v30 )
{
goto LABEL_68;
}
sub_100009900(&v81, "silence");
v34 = sub_1000045BC(&__dst, &v81);
v35 = v34;
if ( v83 < 0 )
{
operator delete(v81);
if ( v35 )
{
LABEL_77:
AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned() )
{
v36 = GameManager::sharedState();
GameManager::reportAchievementWithID(v36, "geometry.ach.v3.secret02", 100, 0);
sub_100009900(v72, "Something you always ruin...");
sub_1003F44A4(a1, (__int64 *)v72);
if ( v73 < 0 )
operator delete(v72[0]);
v37 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = -1;
LOWORD(v81) = -256;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v37 + 1072LL))(v37, &v81);
cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 464), 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
}
else if ( v34 )
{
goto LABEL_77;
}
sub_100009900(&v81, "river");
if ( sub_1000045BC(&__dst, &v81) )
{
v38 = 1;
}
else
{
sub_100009900(&v78, "ariver");
v38 = sub_1000045BC(&__dst, &v78);
if ( (char)v80 < 0 )
operator delete(v78);
}
if ( v83 < 0 )
{
operator delete(v81);
if ( v38 )
{
LABEL_88:
AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned() )
{
v39 = GameManager::sharedState();
GameManager::reportAchievementWithID(v39, "geometry.ach.v3.secret03", 100, 0);
sub_100009900(v70, "Be like water my friend");
sub_1003F44A4(a1, (__int64 *)v70);
if ( v71 < 0 )
operator delete(v70[0]);
v40 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = -1;
LOWORD(v81) = -256;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v40 + 1072LL))(v40, &v81);
cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 464), 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
}
else if ( v38 )
{
goto LABEL_88;
}
sub_100009900(&v81, "hunger");
v41 = sub_1000045BC(&__dst, &v81);
v42 = v41;
if ( v83 < 0 )
{
operator delete(v81);
if ( v42 )
{
LABEL_95:
AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned() )
{
v43 = GameManager::sharedState();
GameManager::reportAchievementWithID(v43, "geometry.ach.v3.secret04", 100, 0);
sub_100009900(v68, "A pizza would be nice");
sub_1003F44A4(a1, (__int64 *)v68);
if ( v69 < 0 )
operator delete(v68[0]);
v44 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = -1;
LOWORD(v81) = -256;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v44 + 1072LL))(v44, &v81);
cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 464), 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
}
else if ( v41 )
{
goto LABEL_95;
}
sub_100009900(&v81, "volcano");
if ( sub_1000045BC(&__dst, &v81) )
{
v45 = 1;
}
else
{
sub_100009900(&v78, "avolcano");
v45 = sub_1000045BC(&__dst, &v78);
if ( (char)v80 < 0 )
operator delete(v78);
}
if ( v83 < 0 )
operator delete(v81);
if ( v45 )
{
AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned() )
{
v46 = GameManager::sharedState();
GameManager::reportAchievementWithID(v46, "geometry.ach.v3.secret05", 100, 0);
sub_100009900(v66, "Hot answer, well done");
sub_1003F44A4(a1, (__int64 *)v66);
if ( v67 < 0 )
operator delete(v66[0]);
v47 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = -1;
LOWORD(v81) = -256;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v47 + 1072LL))(v47, &v81);
cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 464), 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
sub_100009900(&v81, "backontrack");
v48 = sub_1000045BC(&__dst, &v81);
if ( v83 < 0 )
operator delete(v81);
if ( v48 )
{
AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned() )
{
v49 = GameManager::sharedState();
GameManager::reportAchievementWithID(v49, "geometry.ach.v3.secret06", 100, 0);
sub_100009900(v64, "That's some skill");
sub_1003F44A4(a1, (__int64 *)v64);
if ( v65 < 0 )
operator delete(v64[0]);
v50 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = -1;
LOWORD(v81) = -256;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v50 + 1072LL))(v50, &v81);
cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 464), 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
sub_100009900(&v81, "givemehelper");
v51 = sub_1000045BC(&__dst, &v81);
if ( v83 < 0 )
operator delete(v81);
if ( v51 )
{
AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned() )
{
v52 = GameManager::sharedState();
GameManager::reportAchievementWithID(v52, "geometry.ach.v3.secret07", 100, 0);
sub_100009900(v62, "Is that even a real thing...");
sub_1003F44A4(a1, (__int64 *)v62);
if ( v63 < 0 )
operator delete(v62[0]);
v53 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = -1;
LOWORD(v81) = -256;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v53 + 1072LL))(v53, &v81);
cocos2d::CCLabelBMFont::limitLabelWidth(*(_QWORD *)(a1 + 464), 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
v54 = HIBYTE(v85.__r_.__value_.__r.__words[2]);
if ( (v85.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v54 = v85.__r_.__value_.__l.__size_;
if ( !v54 )
{
LABEL_132:
v56 = *(_DWORD *)(a1 + 440);
sub_1003F44F4(a1);
sub_1003F44A4(a1, (__int64 *)&v58);
if ( v59 < 0 )
operator delete(v58);
v57 = &unk_10076E504;
if ( v56 <= 0 && *(int *)(a1 + 440) <= 0 )
v57 = &unk_10076E501;
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 464) + 1072LL))(*(_QWORD *)(a1 + 464), v57);
goto LABEL_138;
}
sub_1003F53B0(v60, a1);
sub_1003F44A4(a1, (__int64 *)v60);
if ( v61 < 0 )
operator delete(v60[0]);
*(_DWORD *)(a1 + 440) = 0;
v55 = *(_QWORD *)(a1 + 464);
BYTE2(v81) = 0;
LOWORD(v81) = -26881;
(*(void (__fastcall **)(__int64, void ***))(*(_QWORD *)v55 + 1072LL))(v55, &v81);
LABEL_138:
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( SHIBYTE(v85.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v85.__r_.__value_.__l.__data_);
}