//
// sub_1006CC260 from 0x1006cc260 to 0x1006cd582 (4898 bytes)
//
// 1 xrefs:
// > AppDelegate::applicationDidFinishLaunching @ 0x10073b843
//
// 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:35:37 +0000
//
__int64 __fastcall sub_1006CC260(_QWORD *a1)
{
_QWORD *v1; // r12
std::string *v2; // r14
std::error_code *v3; // rsi
std::__fs::filesystem::path *v4; // rbx
std::error_code *p_dst; // rsi
bool v6; // bl
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v7; // cl
size_t size; // r15
unsigned int v9; // eax
size_t v10; // rbx
bool v11; // bl
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v12; // cl
size_t v13; // r15
unsigned int v14; // eax
size_t v15; // rbx
unsigned __int64 v16; // r14
char v17; // r14
std::__fs::filesystem::path *v18; // r13
size_t v19; // r12
char *v20; // r13
unsigned __int64 v21; // r14
char v22; // r14
std::__fs::filesystem::path *v23; // r13
size_t v24; // r12
std::string *v25; // r14
std::string::pointer data; // rsi
char *v27; // r13
std::string::pointer v28; // rsi
_OWORD *v29; // rsi
std::string *v30; // r13
std::error_code *v31; // r14
void *v32; // rbx
size_t v33; // rsi
unsigned __int64 v34; // r15
unsigned __int64 v35; // r14
char *v36; // rax
char *v37; // r15
char *v38; // r12
char *v39; // r15
std::string *v40; // r15
unsigned int v41; // eax
std::string::pointer v42; // rcx
std::string::size_type v43; // r12
std::string::size_type v44; // r12
int v45; // edx
std::string::size_type v46; // rax
std::string::pointer v47; // rbx
size_t v48; // r14
std::__fs::filesystem::path *v49; // r15
unsigned int v50; // ebx
_QWORD *v51; // r12
__int64 v52; // rbx
std::__fs::filesystem::path *v53; // r14
size_t v54; // r13
size_t v55; // rax
size_t v56; // rbx
char *v57; // r15
std::string *v58; // r15
std::string::pointer v59; // rdi
size_t v60; // r13
__int64 v61; // rax
__int64 v62; // rbx
const char *CString; // rbx
size_t v64; // rax
const std::error_category *v65; // r14
char *v66; // r15
size_t v67; // r13
std::error_code *p_ec; // rsi
char *v69; // rax
size_t v70; // rcx
char *v71; // rax
unsigned int i; // ebx
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v73; // r15
std::string::pointer v74; // r14
size_t v75; // rdx
std::string::pointer v76; // rdi
bool v77; // zf
bool v78; // r13
bool v79; // r12
std::string *v80; // r14
std::string::size_type v81; // rbx
__int64 v82; // rdx
char v83; // r12
char v84; // r14
size_t v85; // rdx
std::string::pointer v86; // rdi
size_t v87; // rax
bool v88; // zf
bool v89; // r15
char *v90; // rbx
float v91; // xmm0_4
__int64 v92; // rdx
std::__fs::filesystem::path *v93; // rbx
char *v94; // r14
std::__fs::filesystem::path *v95; // rax
char *v96; // rax
unsigned int v97; // eax
unsigned __int64 v98; // rax
std::string::pointer v99; // rbx
std::string::size_type v100; // r14
char *v101; // r15
size_t v102; // r13
std::string *p_s1; // rdi
std::error_code *v104; // rsi
std::string *v105; // rax
char v106; // r12
size_t v107; // rbx
unsigned __int64 v108; // r13
std::string *v109; // r14
int v110; // ebx
__int64 v111; // rax
std::error_code *v112; // rdx
__int64 v113; // rax
const std::__fs::filesystem::path *v114; // rdi
const std::__fs::filesystem::path *v115; // rsi
size_t v116; // r15
int v117; // eax
std::string *v118; // rbx
void *v119; // rax
std::string *v120; // rbx
unsigned int v121; // r15d
void **v122; // rbx
void **j; // rbx
void **v124; // r14
void **v125; // rdi
std::string v127; // [rsp+0h] [rbp-1D0h] BYREF
std::string v128; // [rsp+18h] [rbp-1B8h] BYREF
std::string v129; // [rsp+30h] [rbp-1A0h] BYREF
_QWORD *v130; // [rsp+48h] [rbp-188h]
std::string __str; // [rsp+50h] [rbp-180h] BYREF
std::error_code __ec; // [rsp+68h] [rbp-168h] BYREF
void *v133; // [rsp+78h] [rbp-158h]
void *v134[2]; // [rsp+80h] [rbp-150h] BYREF
__int64 v135; // [rsp+90h] [rbp-140h]
std::string v136; // [rsp+98h] [rbp-138h] BYREF
__int64 v137; // [rsp+B0h] [rbp-120h] BYREF
size_t v138; // [rsp+B8h] [rbp-118h]
void *v139; // [rsp+C0h] [rbp-110h]
char *v140; // [rsp+C8h] [rbp-108h]
size_t __n; // [rsp+D0h] [rbp-100h]
char *v142; // [rsp+D8h] [rbp-F8h]
void *v143[2]; // [rsp+E0h] [rbp-F0h] BYREF
void *__p; // [rsp+F0h] [rbp-E0h]
std::string v145; // [rsp+100h] [rbp-D0h] BYREF
size_t v146[2]; // [rsp+120h] [rbp-B0h] BYREF
std::error_code *v147; // [rsp+130h] [rbp-A0h]
unsigned __int64 v148; // [rsp+140h] [rbp-90h]
__int64 v149; // [rsp+148h] [rbp-88h]
void *__s2; // [rsp+150h] [rbp-80h]
unsigned int v151; // [rsp+15Ch] [rbp-74h]
_QWORD *v152; // [rsp+160h] [rbp-70h]
std::string *v153; // [rsp+168h] [rbp-68h]
std::string __s1; // [rsp+170h] [rbp-60h] BYREF
__int128 __dst; // [rsp+190h] [rbp-40h] BYREF
std::__fs::filesystem::path *v156; // [rsp+1A0h] [rbp-30h]
v1 = a1;
sub_1004F5360(&v136);
*(_OWORD *)v134 = 0;
v135 = 0;
LOBYTE(v143[0]) = 18;
strcpy((char *)v143 + 1, "autosave_");
sub_1004F4DD0(&v136, v134, (unsigned __int8 *)v143, nullptr);
if ( ((__int64)v143[0] & 1) != 0 )
operator delete(__p);
*(_OWORD *)v143 = 0;
__p = nullptr;
v2 = (std::string *)v134[0];
__n = (size_t)v134[1];
if ( v134[0] == v134[1] )
{
v121 = 0;
v122 = (void **)v134[0];
if ( v134[0] )
goto LABEL_279;
goto LABEL_286;
}
v3 = nullptr;
v152 = a1;
do
{
v148 = (unsigned __int64)v3;
LOBYTE(__dst) = 20;
*(_QWORD *)((char *)&__dst + 1) = 0x742E6C766C64672ELL;
*(_WORD *)((char *)&__dst + 9) = 28781;
BYTE11(__dst) = 0;
p_dst = (std::error_code *)&__dst;
v6 = sub_1004EE570((unsigned __int8 *)v2, (unsigned __int8 *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(v156);
if ( v6 )
{
v7 = v136.__r_.__value_.__s.0;
if ( (*(_BYTE *)&v136.__r_.__value_.__s.0 & 1) != 0 )
{
size = v136.__r_.__value_.__l.__size_;
v9 = (unsigned int)v2->__r_.__value_.__l.0;
v153 = v2;
if ( (v9 & 1) == 0 )
{
LABEL_13:
v10 = v9 >> 1;
LABEL_22:
v16 = v10 + size;
if ( v10 + size >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
LODWORD(__s2) = v9;
if ( v16 > 0x16 )
{
LODWORD(v149) = v136.__r_.__value_.__l.0;
v19 = (v16 | 7) + 1;
if ( (v16 | 7) == 0x17 )
v19 = 26;
v18 = (std::__fs::filesystem::path *)operator new(v19);
*(_QWORD *)&__dst = v19 | 1;
v156 = v18;
*((_QWORD *)&__dst + 1) = v10 + size;
v17 = v19 | 1;
v1 = v152;
v7 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)v149;
}
else
{
__dst = 0;
v156 = nullptr;
v17 = 2 * v16;
LOBYTE(__dst) = v17;
v18 = nullptr;
}
if ( (v17 & 1) == 0 )
v18 = (std::__fs::filesystem::path *)((char *)&__dst + 1);
v2 = v153;
if ( size )
{
p_dst = (std::error_code *)((char *)&v136.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v7 & 1) != 0 )
p_dst = (std::error_code *)v136.__r_.__value_.__l.__data_;
memmove(v18, p_dst, size);
}
v20 = (char *)v18 + size;
if ( v10 )
{
if ( ((unsigned __int8)__s2 & 1) != 0 )
p_dst = (std::error_code *)v2->__r_.__value_.__l.__data_;
else
p_dst = (std::error_code *)((char *)&v2->__r_.__value_.__l.0 + 1);
memmove(v20, p_dst, v10);
}
v20[v10] = 0;
if ( (__dst & 1) != 0 )
{
v4 = v156;
remove(v156, p_dst);
operator delete(v4);
}
else
{
remove((const std::__fs::filesystem::path *)((char *)&__dst + 1), p_dst);
}
v3 = (std::error_code *)v148;
goto LABEL_7;
}
}
else
{
size = *(_BYTE *)&v136.__r_.__value_.__l.0 >> 1;
v9 = (unsigned int)v2->__r_.__value_.__l.0;
v153 = v2;
if ( (v9 & 1) == 0 )
goto LABEL_13;
}
v10 = v2->__r_.__value_.__l.__size_;
goto LABEL_22;
}
LOBYTE(__dst) = 12;
*(_WORD *)((char *)&__dst + 5) = 27766;
*(_DWORD *)((char *)&__dst + 1) = 1818519342;
BYTE7(__dst) = 0;
v11 = sub_1004EE570((unsigned __int8 *)v2, (unsigned __int8 *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(v156);
v3 = (std::error_code *)v148;
if ( v11 )
{
v12 = v136.__r_.__value_.__s.0;
if ( (*(_BYTE *)&v136.__r_.__value_.__s.0 & 1) != 0 )
{
v13 = v136.__r_.__value_.__l.__size_;
v14 = (unsigned int)v2->__r_.__value_.__l.0;
v153 = v2;
if ( (v14 & 1) == 0 )
{
LABEL_19:
v15 = v14 >> 1;
LABEL_43:
v21 = v15 + v13;
if ( v15 + v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
LODWORD(__s2) = v14;
if ( v21 > 0x16 )
{
LODWORD(v149) = v136.__r_.__value_.__l.0;
v24 = (v21 | 7) + 1;
if ( (v21 | 7) == 0x17 )
v24 = 26;
v23 = (std::__fs::filesystem::path *)operator new(v24);
*(_QWORD *)&__dst = v24 | 1;
v156 = v23;
*((_QWORD *)&__dst + 1) = v15 + v13;
v22 = v24 | 1;
v1 = v152;
v12 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)v149;
}
else
{
__dst = 0;
v156 = nullptr;
v22 = 2 * v21;
LOBYTE(__dst) = v22;
v23 = nullptr;
}
if ( (v22 & 1) == 0 )
v23 = (std::__fs::filesystem::path *)((char *)&__dst + 1);
v25 = v153;
if ( v13 )
{
data = v136.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v12 & 1) != 0 )
data = v136.__r_.__value_.__l.__data_;
memmove(v23, data, v13);
}
v27 = (char *)v23 + v13;
if ( v15 )
{
if ( ((unsigned __int8)__s2 & 1) != 0 )
v28 = v25->__r_.__value_.__l.__data_;
else
v28 = v25->__r_.__value_.__s.__data_;
memmove(v27, v28, v15);
}
v27[v15] = 0;
v29 = (_OWORD *)v148;
if ( v148 >= (unsigned __int64)__p )
{
v32 = v143[0];
v33 = v148 - (unsigned __int64)v143[0];
v34 = 0xAAAAAAAAAAAAAAABLL * ((__int64)(v148 - (unsigned __int64)v143[0]) >> 3);
if ( v34 + 1 > 0xAAAAAAAAAAAAAAALL )
sub_100056A70();
v30 = v25;
v35 = 0x5555555555555556LL * ((signed __int64)((__int64)__p - (unsigned __int64)v143[0]) >> 3);
if ( v35 <= v34 + 1 )
v35 = v34 + 1;
if ( 0xAAAAAAAAAAAAAAABLL * ((signed __int64)((__int64)__p - (unsigned __int64)v143[0]) >> 3) >= 0x555555555555555LL )
v35 = 0xAAAAAAAAAAAAAAALL;
if ( v35 )
{
if ( v35 > 0xAAAAAAAAAAAAAAALL )
sub_10001ADB0();
v36 = (char *)operator new(24 * v35);
}
else
{
v36 = nullptr;
}
v37 = &v36[24 * v34];
v38 = &v36[24 * v35];
*((_QWORD *)v37 + 2) = v156;
*(_OWORD *)v37 = __dst;
v31 = (std::error_code *)(v37 + 24);
v39 = &v37[-v33];
memcpy(v39, v32, v33);
v143[0] = v39;
__p = v38;
if ( v32 )
operator delete(v32);
v1 = v152;
}
else
{
v30 = v25;
*(_QWORD *)(v148 + 16) = v156;
*v29 = __dst;
v31 = (std::error_code *)((char *)v29 + 24);
}
v143[1] = v31;
v3 = v31;
v2 = v30;
goto LABEL_7;
}
}
else
{
v13 = *(_BYTE *)&v136.__r_.__value_.__l.0 >> 1;
v14 = (unsigned int)v2->__r_.__value_.__l.0;
v153 = v2;
if ( (v14 & 1) == 0 )
goto LABEL_19;
}
v15 = v2->__r_.__value_.__l.__size_;
goto LABEL_43;
}
LABEL_7:
++v2;
}
while ( v2 != (std::string *)__n );
v40 = (std::string *)v143[0];
if ( v143[0] != v3 )
{
v130 = v1 + 52;
v151 = 0;
while ( 1 )
{
v41 = (unsigned int)v40->__r_.__value_.__l.0;
if ( (v41 & 1) != 0 )
{
v43 = v40->__r_.__value_.__l.__size_;
v42 = v40->__r_.__value_.__l.__data_;
}
else
{
v42 = v40->__r_.__value_.__s.__data_;
v43 = v41 >> 1;
}
v44 = v43 + 1;
do
{
if ( v44 == 1 )
{
v44 = 0;
if ( (v41 & 1) != 0 )
goto LABEL_89;
LABEL_86:
v46 = (unsigned __int8)v41 >> 1;
if ( v44 <= v46 )
{
v47 = v40->__r_.__value_.__s.__data_;
goto LABEL_91;
}
LABEL_290:
sub_100056810();
}
v45 = (unsigned __int8)v42[v44-- - 2];
}
while ( v45 != 92 && v45 != 47 );
if ( (v41 & 1) == 0 )
goto LABEL_86;
LABEL_89:
v46 = v40->__r_.__value_.__l.__size_;
if ( v46 < v44 )
goto LABEL_290;
v47 = v40->__r_.__value_.__l.__data_;
LABEL_91:
v48 = v46 - v44;
if ( v46 - v44 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v153 = v40;
v148 = (unsigned __int64)v3;
if ( v48 >= 0x17 )
{
v54 = (v48 | 7) + 1;
if ( (v48 | 7) == 0x17 )
v54 = 26;
v49 = (std::__fs::filesystem::path *)operator new(v54);
v156 = v49;
*(_QWORD *)&__dst = v54 | 1;
*((_QWORD *)&__dst + 1) = v48;
LABEL_100:
v3 = (std::error_code *)&v47[v44];
memmove(v49, &v47[v44], v48);
*((_BYTE *)&v49->__pn_.__r_.__value_.__s.0 + v48) = 0;
v50 = (unsigned __int8)__dst;
if ( (__dst & 1) != 0 )
goto LABEL_101;
LABEL_95:
v51 = v152;
if ( (unsigned __int8)v50 >= 0x12u )
{
v52 = v50 >> 1;
v53 = (std::__fs::filesystem::path *)((char *)&__dst + 1);
goto LABEL_103;
}
LABEL_289:
sub_100056810();
}
LOBYTE(__dst) = 2 * v48;
v49 = (std::__fs::filesystem::path *)((char *)&__dst + 1);
if ( v46 != v44 )
goto LABEL_100;
*((_BYTE *)&__dst + v48 + 1) = 0;
v50 = (unsigned __int8)__dst;
if ( (__dst & 1) == 0 )
goto LABEL_95;
LABEL_101:
v52 = *((_QWORD *)&__dst + 1);
v51 = v152;
if ( *((_QWORD *)&__dst + 1) <= 8u )
goto LABEL_289;
v53 = v156;
LABEL_103:
v55 = v52 - 15;
v56 = v52 - 9;
if ( v56 >= v55 )
v56 = v55;
if ( v56 >= 0x17 )
{
v60 = (v56 | 7) + 1;
if ( (v56 | 7) == 0x17 )
v60 = 26;
v57 = (char *)operator new(v60);
v139 = v57;
v137 = v60 | 1;
v138 = v56;
}
else
{
LOBYTE(v137) = 2 * v56;
v57 = (char *)&v137 + 1;
if ( !v56 )
{
BYTE1(v137) = 0;
v58 = v153;
if ( (*(_BYTE *)&v153->__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_108;
LABEL_113:
v59 = v58->__r_.__value_.__l.__data_;
goto LABEL_114;
}
}
v3 = (std::error_code *)((char *)&v53->__pn_.__r_.__value_.__r.__words[1] + 1);
memmove(v57, (char *)&v53->__pn_.__r_.__value_.__r.__words[1] + 1, v56);
v57[v56] = 0;
v58 = v153;
if ( (*(_BYTE *)&v153->__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_113;
LABEL_108:
v59 = v58->__r_.__value_.__s.__data_;
LABEL_114:
v61 = cocos2d::CCString::createWithContentsOfFile(v59);
v62 = v61;
if ( !v61 || !*(_BYTE *)cocos2d::CCString::getCString(v61) )
{
if ( (*(_BYTE *)&v58->__r_.__value_.__s.0 & 1) != 0 )
{
remove((const std::__fs::filesystem::path *)v58->__r_.__value_.__l.__data_, v3);
if ( (v137 & 1) != 0 )
goto LABEL_124;
}
else
{
remove((const std::__fs::filesystem::path *)((char *)&v58->__r_.__value_.__l.0 + 1), v3);
if ( (v137 & 1) != 0 )
goto LABEL_124;
}
goto LABEL_265;
}
CString = (const char *)cocos2d::CCString::getCString(v62);
v64 = strlen(CString);
if ( v64 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v65 = (const std::error_category *)v64;
if ( v64 >= 0x17 )
{
v67 = (v64 | 7) + 1;
if ( (v64 | 7) == 0x17 )
v67 = 26;
v66 = (char *)operator new(v67);
v133 = v66;
*(_QWORD *)&__ec.__val_ = v67 | 1;
__ec.__cat_ = v65;
LABEL_129:
memmove(v66, CString, (size_t)v65);
goto LABEL_130;
}
LOBYTE(__ec.__val_) = 2 * v64;
v66 = (char *)&__ec.__val_ + 1;
if ( v64 )
goto LABEL_129;
LABEL_130:
*((_BYTE *)&v65->__vftable + (_QWORD)v66) = 0;
p_ec = &__ec;
cocos2d::ZipUtils::decompressString(&v127, (char *)&__ec, 0, 11);
v69 = (char *)sub_10058C090((unsigned __int8 *)&v127);
v58 = v153;
v142 = v69;
if ( !v69 )
{
if ( (*(_BYTE *)&v153->__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_184:
remove((const std::__fs::filesystem::path *)v58->__r_.__value_.__l.__data_, p_ec);
if ( (*(_BYTE *)&v127.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_263;
}
else
{
LABEL_134:
remove((const std::__fs::filesystem::path *)((char *)&v58->__r_.__value_.__l.0 + 1), p_ec);
if ( (*(_BYTE *)&v127.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_263;
}
LABEL_185:
operator delete(v127.__r_.__value_.__l.__data_);
if ( (__ec.__val_ & 1) != 0 )
goto LABEL_186;
LABEL_264:
if ( (v137 & 1) == 0 )
goto LABEL_265;
LABEL_124:
operator delete(v139);
if ( (__dst & 1) != 0 )
goto LABEL_266;
goto LABEL_77;
}
if ( (v137 & 1) != 0 )
{
v70 = v138;
v71 = (char *)v139;
}
else
{
v70 = (unsigned __int8)v137 >> 1;
v71 = (char *)&v137 + 1;
}
__s2 = v71;
__n = v70;
v140 = v142;
for ( i = 0; ; ++i )
{
if ( i >= (unsigned int)sub_1007FEF90(v51[45]) )
goto LABEL_151;
v149 = sub_1007FEFE0(v51[45], i);
sub_10053E630(&__s1, v149);
v73 = __s1.__r_.__value_.__s.0;
v74 = __s1.__r_.__value_.__l.__data_;
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
{
v76 = __s1.__r_.__value_.__l.__data_;
v75 = __s1.__r_.__value_.__l.__size_;
}
else
{
v75 = *(_BYTE *)&__s1.__r_.__value_.__l.0 >> 1;
v76 = __s1.__r_.__value_.__s.__data_;
}
v77 = __n == v75;
if ( __n < v75 )
v75 = __n;
v78 = v77;
v79 = memcmp(v76, __s2, v75) == 0;
if ( (*(_BYTE *)&v73 & 1) != 0 )
operator delete(v74);
v58 = v153;
if ( v78 && v79 )
break;
v51 = v152;
}
v51 = v152;
if ( !v149 )
break;
if ( (*(_BYTE *)(v149 + 392) & 1) != 0 )
sub_10001AD30(&__s1, *(const void **)(v149 + 408), *(_QWORD *)(v149 + 400));
else
__s1 = *(std::string *)(v149 + 392);
if ( (v140[392] & 1) != 0 )
{
sub_10001AD30(v146, *((const void **)v140 + 51), *((_QWORD *)v140 + 50));
}
else
{
v147 = *((std::error_code **)v142 + 51);
*(_OWORD *)v146 = *(_OWORD *)(v142 + 392);
}
v83 = v146[0];
p_ec = v147;
v84 = *(_BYTE *)&__s1.__r_.__value_.__s.0 & 1;
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
{
v86 = __s1.__r_.__value_.__l.__data_;
v85 = __s1.__r_.__value_.__l.__size_;
__s2 = v147;
if ( (v146[0] & 1) == 0 )
goto LABEL_173;
LABEL_175:
v87 = v146[1];
}
else
{
v85 = *(_BYTE *)&__s1.__r_.__value_.__l.0 >> 1;
v86 = __s1.__r_.__value_.__s.__data_;
__s2 = v147;
if ( (v146[0] & 1) != 0 )
goto LABEL_175;
LABEL_173:
v87 = LOBYTE(v146[0]) >> 1;
p_ec = (std::error_code *)((char *)v146 + 1);
}
v88 = v87 == v85;
if ( v87 < v85 )
v85 = v87;
LOBYTE(__n) = v88;
v89 = memcmp(v86, p_ec, v85) == 0;
if ( (v83 & 1) != 0 )
{
operator delete(__s2);
v84 = *(_BYTE *)&__s1.__r_.__value_.__s.0 & 1;
}
v51 = v152;
if ( v84 )
operator delete(__s1.__r_.__value_.__l.__data_);
if ( ((unsigned __int8)__n & v89) != 0 )
{
v58 = v153;
if ( (*(_BYTE *)&v153->__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_134;
goto LABEL_184;
}
v58 = v153;
if ( (*(_BYTE *)(v149 + 344) & 1) != 0 )
sub_10001AD30(&__s1, *(const void **)(v149 + 360), *(_QWORD *)(v149 + 352));
else
__s1 = *(std::string *)(v149 + 344);
sub_1006CD870(&v128, &__s1);
std::string::operator=((std::string *)(v142 + 344), &v128);
if ( (*(_BYTE *)&v128.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v128.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__s1.__r_.__value_.__l.__data_);
v82 = i;
LABEL_196:
v90 = v140;
sub_1007FF110(v51[45], v140, v82);
*((_DWORD *)v90 + 285) = 2;
if ( (v90[1440] & 1) != 0 )
{
**((_BYTE **)v90 + 182) = 0;
*((_QWORD *)v90 + 181) = 0;
}
else
{
*((_WORD *)v90 + 720) = 0;
}
v90[784] = 0;
v91 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
*((_DWORD *)v90 + 195) = (int)v91;
*((_DWORD *)v90 + 194) = (int)v91;
GJGameLevel::unverifyCoins(v90);
v90[786] = 1;
if ( (*(_BYTE *)&v58->__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(&__s1, v58->__r_.__value_.__l.__data_, v58->__r_.__value_.__l.__size_);
else
__s1 = *v58;
v92 = (unsigned __int8)__dst >> 1;
v93 = v156;
if ( (__dst & 1) != 0 )
v92 = *((_QWORD *)&__dst + 1);
else
v93 = (std::__fs::filesystem::path *)((char *)&__dst + 1);
if ( v92 >= 10 )
{
v94 = (char *)v93 + v92;
v95 = v93;
do
{
v96 = (char *)memchr(v95, 95, v92 - 9);
if ( !v96 )
break;
if ( !(*(_QWORD *)v96 ^ 0x7265766F6365725FLL | *((unsigned __int16 *)v96 + 4) ^ 0x6465LL) )
{
if ( v96 != v94 && v96 - (char *)v93 != -1 )
goto LABEL_254;
break;
}
v95 = (std::__fs::filesystem::path *)(v96 + 1);
v92 = v94 - (char *)v95;
}
while ( v94 - (char *)v95 >= 10 );
}
v97 = (unsigned int)v58->__r_.__value_.__l.0;
if ( (v97 & 1) != 0 )
{
v98 = v58->__r_.__value_.__l.__size_;
v99 = v58->__r_.__value_.__l.__data_;
}
else
{
v98 = v97 >> 1;
v99 = v58->__r_.__value_.__s.__data_;
}
v100 = v98 - 6;
if ( v98 < 6 )
v100 = v98;
if ( v100 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v100 >= 0x17 )
{
v102 = (v100 | 7) + 1;
if ( (v100 | 7) == 0x17 )
v102 = 26;
v101 = (char *)operator new(v102);
v145.__r_.__value_.__r.__words[2] = (std::string::size_type)v101;
v145.__r_.__value_.__r.__words[0] = v102 | 1;
v145.__r_.__value_.__l.__size_ = v100;
LABEL_224:
memmove(v101, v99, v100);
goto LABEL_225;
}
v145.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v100);
v101 = v145.__r_.__value_.__s.__data_;
if ( v100 )
goto LABEL_224;
LABEL_225:
v101[v100] = 0;
p_s1 = &v145;
v104 = (std::error_code *)"_recovered";
v105 = std::string::append(&v145, "_recovered");
v147 = (std::error_code *)v105->__r_.__value_.__l.__data_;
*(_OWORD *)v146 = *(_OWORD *)&v105->__r_.__value_.__l.0;
*(_OWORD *)&v105->__r_.__value_.__l.0 = 0;
v105->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)&v145.__r_.__value_.__s.0 & 1) != 0 )
{
p_s1 = (std::string *)v145.__r_.__value_.__l.__data_;
operator delete(v145.__r_.__value_.__l.__data_);
}
v106 = v146[0];
if ( (v146[0] & 1) != 0 )
v107 = v146[1];
else
v107 = LOBYTE(v146[0]) >> 1;
v108 = v107 + 6;
if ( v107 + 6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v108 >= 0x17 )
{
v116 = (v108 | 7) + 1;
if ( (v108 | 7) == 0x17 )
v116 = 26;
v109 = (std::string *)operator new(v116);
v145.__r_.__value_.__r.__words[0] = v116 | 1;
v145.__r_.__value_.__r.__words[2] = (std::string::size_type)v109;
v145.__r_.__value_.__l.__size_ = v107 + 6;
v58 = v153;
v104 = (std::error_code *)((char *)v146 + 1);
if ( (v106 & 1) != 0 )
LABEL_234:
v104 = v147;
LABEL_235:
p_s1 = v109;
memmove(v109, v104, v107);
}
else
{
memset(&v145, 0, sizeof(v145));
v145.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v108);
v109 = (std::string *)((char *)&v145.__r_.__value_.__l.0 + 1);
v58 = v153;
if ( v107 )
{
v104 = (std::error_code *)((char *)v146 + 1);
if ( (v146[0] & 1) != 0 )
goto LABEL_234;
goto LABEL_235;
}
}
strcpy((char *)v109 + v107, ".gdlvl");
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
{
p_s1 = (std::string *)__s1.__r_.__value_.__l.__data_;
operator delete(__s1.__r_.__value_.__l.__data_);
}
__s1 = v145;
v110 = 2;
v51 = v152;
do
{
v111 = cocos2d::CCFileUtils::sharedFileUtils(p_s1, v104);
if ( !(*(unsigned __int8 (__fastcall **)(__int64, std::string *))(*(_QWORD *)v111 + 160LL))(v111, &__s1) )
break;
v113 = sub_10088E820("%s%i.gdlvl", *(_BYTE *)&v127.__r_.__value_.__l.0);
p_s1 = &__s1;
v104 = (std::error_code *)cocos2d::CCString::getCString(v113);
std::string::assign(&__s1, (const std::string::value_type *)v104);
++v110;
}
while ( v110 != 100 );
if ( (*(_BYTE *)&v58->__r_.__value_.__s.0 & 1) != 0 )
{
v114 = (const std::__fs::filesystem::path *)v58->__r_.__value_.__l.__data_;
v115 = (const std::__fs::filesystem::path *)((char *)&__s1.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_249;
}
else
{
v114 = (const std::__fs::filesystem::path *)((char *)&v58->__r_.__value_.__l.0 + 1);
v115 = (const std::__fs::filesystem::path *)((char *)&__s1.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_250;
LABEL_249:
v115 = (const std::__fs::filesystem::path *)__s1.__r_.__value_.__l.__data_;
}
LABEL_250:
rename(v114, v115, v112);
if ( v117 )
std::string::operator=(&__s1, v58);
if ( (v146[0] & 1) != 0 )
operator delete(v147);
LABEL_254:
v118 = (std::string *)v51[53];
if ( (unsigned __int64)v118 >= v51[54] )
{
v119 = sub_1000568A0((__int64)v130, (__int64)&__s1);
v51[53] = v119;
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_261;
}
else
{
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
{
v119 = sub_10001AD30((_QWORD *)v51[53], __s1.__r_.__value_.__l.__data_, __s1.__r_.__value_.__l.__size_);
}
else
{
LODWORD(v119) = __s1.__r_.__value_.__r.__words[2];
*v118 = __s1;
}
v120 = v118 + 1;
v51[53] = v120;
v51[53] = v120;
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
LABEL_261:
operator delete(__s1.__r_.__value_.__l.__data_);
}
LOBYTE(v119) = 1;
v151 = (unsigned int)v119;
if ( (*(_BYTE *)&v127.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_185;
LABEL_263:
if ( (__ec.__val_ & 1) == 0 )
goto LABEL_264;
LABEL_186:
operator delete(v133);
if ( (v137 & 1) != 0 )
goto LABEL_124;
LABEL_265:
if ( (__dst & 1) != 0 )
LABEL_266:
operator delete(v156);
LABEL_77:
v40 = v58 + 1;
v3 = (std::error_code *)v148;
if ( v40 == (std::string *)v148 )
{
v40 = (std::string *)v143[0];
if ( !v143[0] )
goto LABEL_278;
goto LABEL_272;
}
}
LABEL_151:
v80 = (std::string *)(v142 + 344);
if ( (v140[344] & 1) != 0 )
sub_10001AD30(&__s1, *((const void **)v140 + 45), *((_QWORD *)v140 + 44));
else
__s1 = *(std::string *)(v142 + 344);
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
{
v81 = __s1.__r_.__value_.__l.__size_;
operator delete(__s1.__r_.__value_.__l.__data_);
if ( v81 )
goto LABEL_156;
}
else if ( __s1.__r_.__value_.__s.0 )
{
LABEL_156:
if ( (*(_BYTE *)&v80->__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(&__s1, *((const void **)v140 + 45), *((_QWORD *)v140 + 44));
else
__s1 = *v80;
sub_1006CD870(&v129, &__s1);
std::string::operator=(v80, &v129);
if ( (*(_BYTE *)&v129.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v129.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__s1.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__s1.__r_.__value_.__l.__data_);
v82 = 0;
goto LABEL_196;
}
strcpy((char *)&__str, "$Recovered Autosave");
std::string::operator=(v80, &__str);
v82 = 0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(__str.__r_.__value_.__l.__data_);
v82 = 0;
}
goto LABEL_196;
}
v151 = 0;
if ( !v143[0] )
goto LABEL_278;
LABEL_272:
for ( j = (void **)v143[1]; j != (void **)v40; j -= 3 )
{
if ( (*(_BYTE *)(j - 3) & 1) != 0 )
operator delete(*(j - 1));
}
operator delete(v40);
LABEL_278:
v121 = v151;
v122 = (void **)v134[0];
if ( v134[0] )
{
LABEL_279:
v124 = (void **)v134[1];
v125 = v122;
if ( v134[1] != v122 )
{
do
{
if ( (*(_BYTE *)(v124 - 3) & 1) != 0 )
operator delete(*(v124 - 1));
v124 -= 3;
}
while ( v124 != v122 );
v125 = (void **)v134[0];
}
v134[1] = v122;
operator delete(v125);
}
LABEL_286:
if ( (*(_BYTE *)&v136.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v136.__r_.__value_.__l.__data_);
LOBYTE(v121) = v121 & 1;
return v121;
}