Code snippet · op08/code_clean1.txt
bool __fastcall sub_14003bd30(
ctx *this,
const std::filesystem::__cxx11::path *a2,
__int64 a3,
__int64 a4)
{
double **v4; // rdi
__int64 v5; // rdx
__int64 v6; // rdx
double **v7; // rbx
double **i; // rbx
__int64 v9; // r8
_BYTE *v10; // rax
_BYTE *v11; // rdx
unsigned __int64 v12; // rdx
__int64 v13; // rax
_BYTE *v14; // rcx
_DWORD *v15; // r8
_DWORD *v16; // rdx
__int64 v17; // rcx
_QWORD *v18; // rdi
__int64 v19; // rsi
unsigned __int64 v20; // r8
_QWORD *v21; // rax
double *v22; // rsi
_QWORD *v23; // rdx
__int64 v24; // rcx
_QWORD *v25; // rax
_QWORD *v26; // rdi
_QWORD *v27; // rdx
__int64 v28; // rcx
unsigned __int64 v29; // r8
_QWORD *v30; // rax
_QWORD *v31; // rdx
__int64 v32; // rcx
_QWORD *v33; // rax
_QWORD *v34; // rdx
__int64 v35; // rcx
unsigned __int64 v36; // rdx
size_t v37; // rcx
__int64 v38; // rax
__int64 v39; // rdx
double *v40; // rcx
_QWORD *v41; // rax
_QWORD *v42; // rdx
__int64 v43; // rcx
double *v44; // rcx
_BYTE *v45; // rax
_BYTE *v46; // rdx
char *v47; // r8
_WORD *v48; // r9
_WORD *v49; // rcx
__int64 v50; // rax
char v51; // r12
double *v52; // rcx
double *v53; // r8
double v54; // rdx
__int64 v55; // rax
__int64 v56; // rdx
__int64 v57; // rax
_DWORD *v58; // r10
_DWORD *v59; // r8
int v60; // ecx
__int64 v61; // r9
_DWORD *v62; // r10
_DWORD *v63; // r8
unsigned int v64; // ecx
__int64 v65; // r9
_DWORD *v66; // r10
_DWORD *v67; // r8
int v68; // ecx
__int64 v69; // r9
_DWORD *v70; // r10
_DWORD *v71; // r8
int v72; // ecx
__int64 v73; // r9
_DWORD *v74; // r10
_DWORD *v75; // r8
int v76; // ecx
__int64 v77; // r9
double *v78; // r10
_DWORD *v79; // r8
__int64 v80; // rcx
__int64 v81; // r9
__int64 v82; // rdx
__int64 v83; // r8
__int64 v84; // rbx
__int64 v85; // rbx
__int64 v86; // rdx
__int64 v88; // r8
__int64 v89; // r9
__int64 v90; // r8
__int64 v91; // r9
__int64 v92; // r8
__int64 v93; // r9
__int64 v94; // r8
__int64 v95; // r9
__int64 v96; // r8
__int64 v97; // r9
__int64 v98; // r8
__int64 v99; // r9
size_t v100; // [rsp+48h] [rbp-230h]
double **v101; // [rsp+70h] [rbp-208h]
unsigned int v102; // [rsp+94h] [rbp-1E4h]
__int64 v103; // [rsp+A0h] [rbp-1D8h] BYREF
_QWORD *v104; // [rsp+A8h] [rbp-1D0h]
unsigned __int64 v105; // [rsp+B8h] [rbp-1C0h] BYREF
__int64 *v106; // [rsp+C0h] [rbp-1B8h] BYREF
__int64 v107; // [rsp+C8h] [rbp-1B0h]
__int64 v108; // [rsp+D0h] [rbp-1A8h] BYREF
_QWORD *v109; // [rsp+E0h] [rbp-198h] BYREF
unsigned __int64 v110; // [rsp+E8h] [rbp-190h]
_QWORD v111[2]; // [rsp+F0h] [rbp-188h] BYREF
_QWORD *v112; // [rsp+100h] [rbp-178h]
__int64 v113; // [rsp+108h] [rbp-170h]
_QWORD v114[2]; // [rsp+110h] [rbp-168h] BYREF
_QWORD *v115; // [rsp+120h] [rbp-158h] BYREF
__int64 v116; // [rsp+128h] [rbp-150h]
_QWORD v117[2]; // [rsp+130h] [rbp-148h] BYREF
_QWORD v118[2]; // [rsp+140h] [rbp-138h] BYREF
_QWORD v119[2]; // [rsp+150h] [rbp-128h] BYREF
_QWORD v120[2]; // [rsp+160h] [rbp-118h] BYREF
_QWORD v121[2]; // [rsp+170h] [rbp-108h] BYREF
_QWORD v122[2]; // [rsp+180h] [rbp-F8h] BYREF
_QWORD v123[2]; // [rsp+190h] [rbp-E8h] BYREF
_QWORD *v124; // [rsp+1A0h] [rbp-D8h] BYREF
__int64 v125; // [rsp+1A8h] [rbp-D0h]
_QWORD Block[2]; // [rsp+1B0h] [rbp-C8h] BYREF
__int64 v127; // [rsp+1C0h] [rbp-B8h] BYREF
size_t Size; // [rsp+1D0h] [rbp-A8h] BYREF
unsigned __int64 v129; // [rsp+1D8h] [rbp-A0h]
_QWORD v130[2]; // [rsp+1E0h] [rbp-98h] BYREF
__int64 v131; // [rsp+1F0h] [rbp-88h] BYREF
double *v132; // [rsp+200h] [rbp-78h] BYREF
double *v133; // [rsp+208h] [rbp-70h]
double Src[2]; // [rsp+210h] [rbp-68h] BYREF
_QWORD v135[11]; // [rsp+220h] [rbp-58h] BYREF
std::__ostream_insert<char,std::char_traits<char>>(
refptr__ZSt4cout,
a2,
"\n[*] Zipping extensions...",
refptr__ZSt4cout,
26);
v4 = &v132;
std::endl<char,std::char_traits<char>>(&v132, a2, v5, refptr__ZSt4cout);
std::string::basic_string<std::allocator<char>>(&v132, a2, "ext_backup", &v106);
std::filesystem::__cxx11::path::path<std::string,std::filesystem::__cxx11::path>(&v132, a2, v106, &v132, v107);
std::filesystem::create_directories((std::filesystem *)&v132, a2);
v6 = v135[0];
if ( v135[0] )
std::filesystem::__cxx11::path::_List::_Impl_deleter::operator()(&v132, a2, v135[0], v135);
((void (__fastcall *)(double **, const std::filesystem::__cxx11::path *, __int64, double **))std::wstring::_M_dispose)(
&v132,
a2,
v6,
&v132);
v7 = *(double ***)(a4 + 24);
v101 = *(double ***)(a4 + 32);
if ( v101 != v7 )
{
v102 = 0;
for ( i = v7 + 20; ; i += 27 )
{
v9 = (__int64)*(i - 19);
v109 = v111;
std::string::_M_construct<true>(v4, a2, *(i - 20), &v109, v9);
v10 = v109;
v11 = (char *)v109 + v110;
if ( v109 != (_QWORD *)((char *)v109 + v110) )
{
do
{
if ( *v10 == 32 )
*v10 = 95;
++v10;
}
while ( v10 != v11 );
}
v12 = (unsigned __int64)*(i - 15);
v13 = 8;
Size = (size_t)v130;
v14 = *(i - 16);
if ( v12 <= 8 )
v13 = v12;
if ( v12 == 1 )
{
LOBYTE(v130[0]) = *v14;
}
else if ( v12 )
{
v15 = v130;
v16 = *(i - 16);
if ( (unsigned int)v13 >= 8 )
{
LODWORD(v82) = 0;
do
{
v83 = (unsigned int)v82;
v82 = (unsigned int)(v82 + 8);
*(_QWORD *)((char *)v130 + v83) = *(_QWORD *)&v14[v83];
}
while ( (unsigned int)v82 < ((unsigned int)v13 & 0xFFFFFFF8) );
v15 = (_DWORD *)((char *)v130 + v82);
v16 = &v14[v82];
}
v17 = 0;
if ( (v13 & 4) != 0 )
{
*v15 = *v16;
v17 = 4;
}
if ( (v13 & 2) != 0 )
{
*(_WORD *)((char *)v15 + v17) = *(_WORD *)((char *)v16 + v17);
v17 += 2;
}
if ( (v13 & 1) != 0 )
*((_BYTE *)v15 + v17) = *((_BYTE *)v16 + v17);
}
v129 = v13;
*((_BYTE *)v130 + v13) = 0;
v18 = *(i - 11);
v19 = (__int64)*(i - 12);
v115 = v117;
v116 = 0;
LOBYTE(v117[0]) = 0;
std::string::reserve(v18, v19, (char *)v18 + 1, &v115);
if ( 0x7FFFFFFFFFFFFFFELL - v116 < (unsigned __int64)v18 )
JUMPOUT(0x140259015LL);
std::string::_M_append(v18, v19, v19, &v115, v18);
if ( v116 == 0x7FFFFFFFFFFFFFFELL )
JUMPOUT(0x140259009LL);
std::string::_M_append(v18, v19, "_", &v115, 1);
v20 = (unsigned __int64)*(i - 7);
if ( 0x7FFFFFFFFFFFFFFELL - v116 < v20 )
JUMPOUT(0x140258FFDLL);
v21 = (_QWORD *)std::string::_M_append(v18, v19, *(i - 8), &v115, v20);
v22 = (double *)v119;
v23 = v21 + 2;
v118[0] = v119;
if ( (_QWORD *)*v21 != v21 + 2 )
{
v118[0] = *v21;
v119[0] = v21[2];
goto LABEL_25;
}
v18 = (_QWORD *)v21[1];
v58 = v119;
v59 = v21 + 2;
v60 = (_DWORD)v18 + 1;
if ( (unsigned int)((_DWORD)v18 + 1) >= 8 )
{
LODWORD(v88) = 0;
do
{
v89 = (unsigned int)v88;
v18 = v119;
v88 = (unsigned int)(v88 + 8);
*(_QWORD *)((char *)v119 + v89) = *(_QWORD *)((char *)v23 + v89);
}
while ( (unsigned int)v88 < (v60 & 0xFFFFFFF8) );
v58 = (_DWORD *)((char *)v119 + v88);
v61 = 0;
v59 = (_DWORD *)((char *)v23 + v88);
if ( (v60 & 4) == 0 )
{
LABEL_108:
if ( (v60 & 2) == 0 )
goto LABEL_109;
goto LABEL_189;
}
}
else
{
v61 = 0;
if ( (v60 & 4) == 0 )
goto LABEL_108;
}
*v58 = *v59;
v61 = 4;
if ( (v60 & 2) == 0 )
{
LABEL_109:
if ( (v60 & 1) == 0 )
goto LABEL_25;
LABEL_110:
*((_BYTE *)v58 + v61) = *((_BYTE *)v59 + v61);
goto LABEL_25;
}
LABEL_189:
*(_WORD *)((char *)v58 + v61) = *(_WORD *)((char *)v59 + v61);
v61 += 2;
if ( (v60 & 1) != 0 )
goto LABEL_110;
LABEL_25:
v24 = v21[1];
*v21 = v23;
v21[1] = 0;
v118[1] = v24;
*((_BYTE *)v21 + 16) = 0;
if ( v24 == 0x7FFFFFFFFFFFFFFELL )
JUMPOUT(0x140258FBELL);
v25 = (_QWORD *)std::string::_M_append(v18, v119, "_", v118, 1);
v26 = v121;
v27 = v25 + 2;
v120[0] = v121;
if ( (_QWORD *)*v25 != v25 + 2 )
{
v120[0] = *v25;
v121[0] = v25[2];
goto LABEL_28;
}
v26 = (_QWORD *)v25[1];
v74 = v121;
v75 = v25 + 2;
v76 = (_DWORD)v26 + 1;
if ( (unsigned int)((_DWORD)v26 + 1) >= 8 )
{
LODWORD(v90) = 0;
do
{
v91 = (unsigned int)v90;
v26 = v121;
v90 = (unsigned int)(v90 + 8);
*(_QWORD *)((char *)v121 + v91) = *(_QWORD *)((char *)v27 + v91);
}
while ( (unsigned int)v90 < (v76 & 0xFFFFFFF8) );
v74 = (_DWORD *)((char *)v121 + v90);
v77 = 0;
v75 = (_DWORD *)((char *)v27 + v90);
if ( (v76 & 4) == 0 )
{
LABEL_131:
if ( (v76 & 2) == 0 )
goto LABEL_132;
goto LABEL_181;
}
}
else
{
v77 = 0;
if ( (v76 & 4) == 0 )
goto LABEL_131;
}
*v74 = *v75;
v77 = 4;
if ( (v76 & 2) == 0 )
{
LABEL_132:
if ( (v76 & 1) == 0 )
goto LABEL_28;
LABEL_133:
*((_BYTE *)v74 + v77) = *((_BYTE *)v75 + v77);
goto LABEL_28;
}
LABEL_181:
*(_WORD *)((char *)v74 + v77) = *(_WORD *)((char *)v75 + v77);
v77 += 2;
if ( (v76 & 1) != 0 )
goto LABEL_133;
LABEL_28:
v28 = v25[1];
*v25 = v27;
v25[1] = 0;
v29 = v110;
*((_BYTE *)v25 + 16) = 0;
v120[1] = v28;
if ( 0x7FFFFFFFFFFFFFFELL - v28 < v29 )
JUMPOUT(0x140258F3FLL);
v30 = (_QWORD *)std::string::_M_append(v26, v119, v109, v120, v29);
v31 = v30 + 2;
v122[0] = v123;
if ( (_QWORD *)*v30 != v30 + 2 )
{
v122[0] = *v30;
v123[0] = v30[2];
goto LABEL_31;
}
v26 = (_QWORD *)v30[1];
v70 = v123;
v71 = v30 + 2;
v72 = (_DWORD)v26 + 1;
if ( (unsigned int)((_DWORD)v26 + 1) >= 8 )
{
LODWORD(v92) = 0;
do
{
v93 = (unsigned int)v92;
v92 = (unsigned int)(v92 + 8);
*(_QWORD *)((char *)v123 + v93) = *(_QWORD *)((char *)v31 + v93);
}
while ( (unsigned int)v92 < (v72 & 0xFFFFFFF8) );
v70 = (_DWORD *)((char *)v123 + v92);
v73 = 0;
v71 = (_DWORD *)((char *)v31 + v92);
if ( (v72 & 4) == 0 )
{
LABEL_126:
if ( (v72 & 2) == 0 )
goto LABEL_127;
goto LABEL_183;
}
}
else
{
v73 = 0;
if ( (v72 & 4) == 0 )
goto LABEL_126;
}
*v70 = *v71;
v73 = 4;
if ( (v72 & 2) == 0 )
{
LABEL_127:
if ( (v72 & 1) == 0 )
goto LABEL_31;
LABEL_128:
*((_BYTE *)v70 + v73) = *((_BYTE *)v71 + v73);
goto LABEL_31;
}
LABEL_183:
*(_WORD *)((char *)v70 + v73) = *(_WORD *)((char *)v71 + v73);
v73 += 2;
if ( (v72 & 1) != 0 )
goto LABEL_128;
LABEL_31:
v32 = v30[1];
*v30 = v31;
v30[1] = 0;
v122[1] = v32;
*((_BYTE *)v30 + 16) = 0;
if ( v32 == 0x7FFFFFFFFFFFFFFELL )
JUMPOUT(0x140258F10LL);
v33 = (_QWORD *)std::string::_M_append(v26, v119, "_", v122, 1);
v4 = (double **)Block;
v34 = v33 + 2;
v124 = Block;
if ( (_QWORD *)*v33 != v33 + 2 )
{
v124 = (_QWORD *)*v33;
Block[0] = v33[2];
goto LABEL_34;
}
v22 = (double *)v33[1];
v66 = Block;
v67 = v33 + 2;
v68 = (_DWORD)v22 + 1;
if ( (unsigned int)((_DWORD)v22 + 1) >= 8 )
{
LODWORD(v94) = 0;
do
{
v95 = (unsigned int)v94;
v94 = (unsigned int)(v94 + 8);
*(_QWORD *)((char *)Block + v95) = *(_QWORD *)((char *)v34 + v95);
}
while ( (unsigned int)v94 < (v68 & 0xFFFFFFF8) );
v66 = (_DWORD *)((char *)Block + v94);
v69 = 0;
v67 = (_DWORD *)((char *)v34 + v94);
if ( (v68 & 4) == 0 )
{
LABEL_121:
if ( (v68 & 2) == 0 )
goto LABEL_122;
goto LABEL_185;
}
}
else
{
v69 = 0;
if ( (v68 & 4) == 0 )
goto LABEL_121;
}
*v66 = *v67;
v69 = 4;
if ( (v68 & 2) == 0 )
{
LABEL_122:
if ( (v68 & 1) == 0 )
goto LABEL_34;
LABEL_123:
*((_BYTE *)v66 + v69) = *((_BYTE *)v67 + v69);
goto LABEL_34;
}
LABEL_185:
*(_WORD *)((char *)v66 + v69) = *(_WORD *)((char *)v67 + v69);
v69 += 2;
if ( (v68 & 1) != 0 )
goto LABEL_123;
LABEL_34:
v35 = v33[1];
*v33 = v34;
v33[1] = 0;
v125 = v35;
*((_BYTE *)v33 + 16) = 0;
v36 = v125 + v129;
if ( v124 == Block )
{
if ( v36 <= 0xF )
{
v37 = Size;
goto LABEL_39;
}
v37 = Size;
if ( (_QWORD *)Size == v130 )
goto LABEL_39;
}
else
{
v37 = Size;
if ( Block[0] >= v36 || (_QWORD *)Size == v130 )
{
LABEL_38:
if ( 0x7FFFFFFFFFFFFFFELL - v125 < v129 )
JUMPOUT(0x140258EDFLL);
LABEL_39:
v38 = std::string::_M_append(Block, v22, v37, &v124, v129);
v22 = Src;
v39 = v38 + 16;
v132 = Src;
if ( *(_QWORD *)v38 != v38 + 16 )
{
v132 = *(double **)v38;
Src[0] = *(double *)(v38 + 16);
LABEL_41:
v40 = *(double **)(v38 + 8);
*(_QWORD *)v38 = v39;
*(_QWORD *)(v38 + 8) = 0;
v133 = v40;
*(_BYTE *)(v38 + 16) = 0;
goto LABEL_42;
}
v78 = Src;
v79 = (_DWORD *)(v38 + 16);
v80 = *(_QWORD *)(v38 + 8) + 1LL;
if ( (unsigned int)v80 >= 8 )
{
LODWORD(v98) = 0;
do
{
v99 = (unsigned int)v98;
v98 = (unsigned int)(v98 + 8);
*(double *)((char *)Src + v99) = *(double *)(v39 + v99);
}
while ( (unsigned int)v98 < ((unsigned int)v80 & 0xFFFFFFF8) );
v78 = (double *)((char *)Src + v98);
v79 = (_DWORD *)(v39 + v98);
}
v81 = 0;
if ( (v80 & 4) != 0 )
{
*(_DWORD *)v78 = *v79;
v81 = 4;
if ( (v80 & 2) == 0 )
goto LABEL_137;
}
else if ( (v80 & 2) == 0 )
{
LABEL_137:
if ( (v80 & 1) == 0 )
goto LABEL_41;
LABEL_138:
*((_BYTE *)v78 + v81) = *((_BYTE *)v79 + v81);
goto LABEL_41;
}
*(_WORD *)((char *)v78 + v81) = *(_WORD *)((char *)v79 + v81);
v81 += 2;
if ( (v80 & 1) == 0 )
goto LABEL_41;
goto LABEL_138;
}
}
if ( v130[0] < v36 )
goto LABEL_38;
v57 = std::string::_M_replace(Block, v22, 0, &Size, 0);
std::string::basic_string(Block, v22, v57, &v132);
LABEL_42:
if ( (unsigned __int64)v133 - 0x7FFFFFFFFFFFFFFBLL <= 3 )
JUMPOUT(0x140258E6BLL);
v41 = (_QWORD *)std::string::_M_append(Block, v22, ".zip", &v132, 4);
v42 = v41 + 2;
v112 = v114;
if ( (_QWORD *)*v41 != v41 + 2 )
{
v112 = (_QWORD *)*v41;
v114[0] = v41[2];
goto LABEL_45;
}
v62 = v114;
v63 = v41 + 2;
v64 = v41[1] + 1;
if ( v64 >= 8 )
{
LODWORD(v96) = 0;
do
{
v97 = (unsigned int)v96;
v96 = (unsigned int)(v96 + 8);
*(_QWORD *)((char *)v114 + v97) = *(_QWORD *)((char *)v42 + v97);
}
while ( (unsigned int)v96 < (v64 & 0xFFFFFFF8) );
v62 = (_DWORD *)((char *)v114 + v96);
v65 = 0;
v63 = (_DWORD *)((char *)v42 + v96);
if ( (v64 & 4) == 0 )
{
LABEL_113:
if ( (v64 & 2) == 0 )
goto LABEL_114;
goto LABEL_187;
}
}
else
{
v65 = 0;
if ( (v64 & 4) == 0 )
goto LABEL_113;
}
*v62 = *v63;
v65 = 4;
if ( (v64 & 2) == 0 )
{
LABEL_114:
if ( (v64 & 1) == 0 )
goto LABEL_45;
LABEL_115:
*((_BYTE *)v62 + v65) = *((_BYTE *)v63 + v65);
goto LABEL_45;
}
LABEL_187:
*(_WORD *)((char *)v62 + v65) = *(_WORD *)((char *)v63 + v65);
v65 += 2;
if ( (v64 & 1) != 0 )
goto LABEL_115;
LABEL_45:
v43 = v41[1];
*v41 = v42;
*((_BYTE *)v41 + 16) = 0;
v113 = v43;
v44 = v132;
v41[1] = 0;
if ( v44 != Src )
((void (__fastcall *)(_QWORD *, double *, __int64))operator delete)(Block, Src, *(_QWORD *)&Src[0] + 1LL);
if ( v124 != Block )
((void (__fastcall *)(_QWORD *, double *, __int64))operator delete)(Block, Src, Block[0] + 1LL);
if ( (_QWORD *)v122[0] != v123 )
((void (__fastcall *)(_QWORD *, double *, __int64))operator delete)(Block, Src, v123[0] + 1LL);
if ( (_QWORD *)v120[0] != v121 )
((void (__fastcall *)(_QWORD *, double *, __int64))operator delete)(Block, Src, v121[0] + 1LL);
if ( (_QWORD *)v118[0] != v119 )
((void (__fastcall *)(_QWORD *, double *, __int64))operator delete)(Block, Src, v119[0] + 1LL);
if ( v115 != v117 )
((void (__fastcall *)(_QWORD *, double *, __int64))operator delete)(Block, Src, v117[0] + 1LL);
if ( (_QWORD *)Size != v130 )
((void (__fastcall *)(_QWORD *, double *, __int64))operator delete)(Block, Src, v130[0] + 1LL);
v45 = v112;
v46 = (char *)v112 + v113;
if ( v112 == (_QWORD *)((char *)v112 + v113) )
{
v47 = (char *)v112 + v113;
}
else
{
do
{
if ( *v45 == 32 )
*v45 = 95;
++v45;
}
while ( v45 != v46 );
v46 = v112;
v47 = (char *)v112 + v113;
}
std::filesystem::__cxx11::path::_S_convert<char>(Block, Src, v46, &v132, v47);
std::filesystem::__cxx11::path::_List::_List((std::filesystem::__cxx11::path::_List *)Block);
std::filesystem::__cxx11::path::_M_split_cmpts((std::filesystem::__cxx11::path *)Block);
std::filesystem::__cxx11::path::_S_convert<char>(Block, Src, v106, &Size, (char *)v106 + v107);
std::filesystem::__cxx11::path::_List::_List((std::filesystem::__cxx11::path::_List *)Block);
std::filesystem::__cxx11::path::_M_split_cmpts((std::filesystem::__cxx11::path *)Block);
v124 = Block;
v48 = (_WORD *)Size;
v105 = v129;
if ( v129 <= 7 )
{
v49 = Block;
if ( v129 )
goto LABEL_66;
LABEL_101:
*v49 = *v48;
v50 = 0;
goto LABEL_67;
}
v100 = Size;
v124 = (_QWORD *)std::wstring::_M_create(Block, Src, &v105, &v124, 0, Size);
v49 = v124;
v48 = (_WORD *)v100;
Block[0] = v105;
if ( !v105 )
goto LABEL_101;
v50 = -1;
if ( v105 != -1 )
{
LABEL_66:
memcpy_0(Block, Src, (size_t)v48);
v50 = v105;
}
LABEL_67:
v125 = v50;
std::filesystem::__cxx11::path::_List::_List(
(std::filesystem::__cxx11::path::_List *)Block,
(const std::filesystem::__cxx11::path::_List *)Src);
std::filesystem::__cxx11::path::operator/=(Blo
... (truncated, 6004 more chars)
Evaluated model output (what the LLM said about the code) · op08/result_Qwen359B1.txt
### 1. Functionality Description
The function `sub_14003bd30` is a file archiving utility integrated into a larger application context (`ctx`). Its primary purpose is to iterate through a list of file paths, sanitize their names, create a backup directory, and compress them into `.zip` archives.
Key behaviors include:
* **Directory Creation:** It creates a directory named `ext_backup` to store the archives.
* **File Iteration:** It loops through a data structure pointed to by `a4`, processing file paths stored within it.
* **Filename Sanitization:** It replaces spaces (`32`) with underscores (`95`) in filenames to ensure compatibility with archive formats.
* **Compression:** It calls a member function `ctx::ZipDirectory` to perform the actual zipping operation.
* **Logging:** It outputs progress messages to the console (e.g., `[*] Zipping extensions...`, `[+] Zipped: ...`).
* **Memory Management:** It performs extensive manual memory management using `operator delete` and custom pointer arithmetic, suggesting a non-standard memory allocator or obfuscation technique.
### 2. Well-Known Algorithms
* **File Archiving (Zip):** The code explicitly appends the `.zip` extension (`std::string::_M_append(..., ".zip", ...)`) and calls `ctx::ZipDirectory`, indicating the use of the ZIP compression format.
* **String Sanitization:** The logic `if ( *v10 == 32 ) *v10 = 95;` is a standard string sanitization technique used to remove special characters that might cause issues in file systems or archive headers.
* **Memory Allocation:** The code uses `double **` to manage memory for strings and paths. This is not a standard C++ practice and suggests a custom memory manager or a specific library implementation (possibly a custom string class or obfuscation wrapper).
### 3. Indicators of Compromise (IOCs)
* **File Paths / Directories:**
* `ext_backup` (Created via `std::filesystem::create_directories`)
* **Strings / Signatures:**
* `[*] Zipping extensions...`
* `[+] Zipped: <source> -> <destination>`
* `[!] Failed to zip: <path>`
* `0x84BDA12F684BDA13LL` (Large constant used in calculation)
* **Commands / Scripts:**
* `std::filesystem::create_directories`
* `std::filesystem::__cxx11::path::_M_split_cmpts`
* **IP Addresses / Domains:** None identified in this snippet.
* **Registry Keys:** None identified in this snippet.
### 4. MITRE ATT&CK Mapping
| Technique ID | Technique Name | Justification |
| :--- | :--- | :--- |
| **T1560** | **Archive Collected Data** | The function explicitly creates `.zip` files and logs "Zipping extensions...", indicating the archiving of data. |
| **T1005** | **Data from Local System** | The function accesses local file paths (`std::filesystem::__cxx11::path`) and iterates through them to process them. |
| **T1027** | **Obfuscated Files or Information** | The use of `double **` for string storage and manual memory management (`operator delete`) is atypical for standard C++ and may be used to hide strings or logic from static analysis. |
| **T1059** | **Command and Scripting Interpreter** | While not executing a shell command directly, the manipulation of file paths and execution of file system operations (`create_directories`, `ZipDirectory`) falls under the broader category of executing code to manipulate the file system. |
### 5. Obfuscation or Evasion Techniques
* **Unusual Data Types:** The code uses `double **` (pointer to pointer to double) to store strings and paths. This is highly unusual for standard C++ and is a common technique in malware to bypass static analysis tools that expect standard types like `char *` or `std::string`.
* **Pointer Arithmetic:** The loop iterates using `i += 27` and accesses data via `*(i - 19)`, `*(i - 20)`, etc. This suggests a flattened data structure or a custom memory layout designed to confuse decompilers.
* **Manual Memory Management:** The code explicitly calls `operator delete` with custom arguments (`Block`, `Src`, `Size`). This indicates a custom memory allocator, which can be used to evade memory scanning tools or to manage memory in a way that is difficult to trace.
* **Virtual Calls:** The function `ctx::ZipDirectory` is called via a member function pointer, which can make it harder to trace the exact implementation of the zipping logic without dynamic analysis.
### 6. Observed Facts vs. Inferred Behavior
| Category | Details |
| :--- | :--- |
| **Observed Facts** | 1. The function prints `[*] Zipping extensions...` to `cout`.<br>2. It calls `std::filesystem::create_directories` on a path derived from `a2` + "ext_backup".<br>3. It replaces ASCII 32 (space) with ASCII 95 (underscore) in strings.<br>4. It appends the string `.zip` to file paths.<br>5. It calls `ctx::ZipDirectory`.<br>6. It uses `double **` for memory management.<br>7. It uses a constant `0x84BDA12F684BDA13LL` in a calculation. |
| **Inferred Behavior** | 1. The malware is archiving files to a directory named `ext_backup`.<br>2. The malware is sanitizing filenames to prevent errors during archiving.<br>3. The use of `double **` is likely an obfuscation technique to hide strings from analysis.<br>4. The function returns a boolean indicating success based on the count of zipped items.<br>5. The large constant `0x84BDA12F684BDA13LL` might be a hash, version identifier, or checksum related to the archiving process. |