__int64 __fastcall sub_1405F50F8(unsigned int *a1, unsigned int a2, unsigned int a3, _QWORD *a4, _DWORD *a5){
_QWORD *v6;
_DWORD *v7;
VOID **v8;
unsigned int *v9;
VOID **v10;
unsigned int *v11;
int v12;
UINT64 v13;
unsigned int *v14;
unsigned int *v15;
UINT64 v16;
unsigned int *v17;
unsigned int v18;
unsigned int *v19;
unsigned int v20;
unsigned int v21;
unsigned int v22;
VOID **PoolWithTag;
VOID **v24;
_QWORD *v25;
void *v26;
void *v27;
void *v28;
_DWORD *v29;
VOID *v30;
VOID **v31;
const VOID *v32;
VOID **v33;
const VOID *v34;
size_t v35;
size_t v36;
VOID **v37;
void *v38;
void *v39;
void *v40;
unsigned __int64 v41;
__int64 *v42;
unsigned int v43;
unsigned int v44;
__int64 v45;
char v46;
unsigned __int8 v47;
_ACL *v48;
int v49;
unsigned __int8 *v50;
_ACL *v51;
bool v52;
int v53;
unsigned int v54;
int v55;
int v56;
char v57;
int v58;
__int64 v59;
unsigned __int8 *v60;
unsigned __int8 *v61;
UINT64 v62;
__int64 v63;
int v64;
__int64 v65;
int v66;
unsigned int v67;
int v68;
size_t v69;
unsigned int v70;
unsigned int v71;
_ACL *v72;
_ACL *p_Sbz1;
unsigned __int8 v74;
unsigned __int8 *v75;
size_t v76;
int v77;
int v78;
UINT64 v79;
int v80;
int v81;
int v82;
int v83;
int v84;
unsigned int v85;
int v86;
int v87;
int v88;
int v89;
int v90;
int v91;
__int64 v92;
int v93;
__int64 v94;
int v95;
unsigned int v96;
unsigned __int8 *v97;
unsigned int v98;
unsigned __int8 *v99;
int v100;
__int64 v101;
int v102;
__int64 v103;
int v104;
_BYTE *v105;
int v106;
int v107;
int v108;
int v109;
int v110;
int v111;
int v112;
int v113;
PVOID v114;
UINT64 j;
int v116;
size_t v117;
int v118;
UINT64 v119;
char *v120;
unsigned __int64 v121;
size_t v122;
VOID **v123;
int v124;
char *v125;
unsigned int v126;
char *v127;
void *v128;
void *v129;
void *v130;
void *v131;
void *v132;
void *v133;
int v135;
int *v136;
int *v137;
int v138;
__int64 v139;
unsigned int *v140;
int v141;
unsigned int *v142;
__int64 v143;
int *v144;
unsigned int k;
__int64 v146;
unsigned int *v147;
int v148;
unsigned int *v149;
UINT64 v150;
VOID **v151;
VOID *v152;
INT64 v153;
__int64 v154;
__int64 v155;
UINT64 v156;
VOID **v157;
UINT64 v158;
VOID **v159;
void *v160;
void *v161;
void *v162;
int IsAppLicensed;
__int64 v164;
NTSTATUS v165;
int v166;
unsigned int v167;
VOID **v168;
UINT64 v169;
unsigned __int8 v170;
const VOID *v171;
int v172;
__int64 v173;
NTSTATUS v174;
int v175;
unsigned int v176;
VOID **v177;
INT64 v178;
INT64 v179;
UINT64 v180;
unsigned __int8 v181;
unsigned int v182;
const VOID *v183;
const VOID *v184;
int updated;
int v186;
unsigned int v187;
_DWORD *v188;
_DWORD *v189;
int v190;
NTSTATUS v191;
unsigned int v192;
unsigned int v193;
UINT64 v194;
unsigned int v195;
unsigned int v196;
unsigned int v197;
size_t v198;
unsigned int v199;
int v200;
int v201;
VOID **v202;
_DWORD *v203;
int v204;
_DWORD *v205;
bool v206;
unsigned int v207;
NTSTATUS v208;
unsigned int v209;
UINT64 v210;
unsigned int v211;
unsigned int v212;
unsigned int v213;
int v214;
unsigned int v215;
unsigned int v216;
unsigned int v217;
int v218;
VOID **v219;
_DWORD *v220;
int v221;
_DWORD *v222;
unsigned int v223;
__int64 v224;
VOID **v225;
VOID **v226;
_DWORD *v227;
WCHAR *v228;
unsigned int v229;
_DWORD *v230;
int *v231;
int v232;
int v233;
int v234;
NTSTATUS v235;
wchar_t *v236;
UINT64 v237;
unsigned __int64 v238;
size_t v239;
VOID **v240;
unsigned int v241;
unsigned int v242;
int v243;
unsigned int v244;
unsigned int v245;
unsigned int v246;
int v247;
VOID **v248;
_DWORD *v249;
int v250;
_DWORD *v251;
int v252;
unsigned int v253;
_DWORD *v254;
__int64 *v255;
_DWORD *v256;
int v257;
unsigned int v258;
unsigned int v259;
VOID *v260;
VOID **v261;
int v262;
NTSTATUS v263;
unsigned int v264;
int v265;
unsigned int v266;
int v267;
NTSTATUS v268;
unsigned int v269;
int v270;
VOID **v271;
unsigned int *v272;
unsigned int v273;
int v274;
_DWORD *v275;
NTSTATUS v276;
unsigned int v277;
int v278;
_ACL *v279;
unsigned int v280;
size_t v281;
int v282;
size_t v283;
_ACL *v284;
VOID **v285;
unsigned int *v286;
int v287;
NTSTATUS v288;
unsigned int v289;
ULONGLONG v290;
unsigned int v291;
_DWORD *v292;
_QWORD *v293;
const VOID *v294;
__int64 v295;
const VOID *v296;
void *v297;
unsigned int v298;
VOID **v299;
VOID **v300;
unsigned int v301;
ULONGLONG v302;
VOID *v303;
__int64 *v304;
unsigned int v305;
unsigned int v306;
__int64 v307;
unsigned __int8 v308;
unsigned __int64 v309;
VOID **v310;
unsigned int v311;
VOID **v312;
unsigned int v313;
int v314;
size_t v315;
int v316;
int v317;
char v318;
int v319;
__int64 v320;
int v321;
unsigned __int8 *v322;
unsigned __int8 *v323;
__int64 v324;
__int64 v325;
int v326;
__int64 v327;
int v328;
__int64 v329;
unsigned int v330;
size_t v331;
int v332;
_BYTE *v333;
VOID **v334;
char v335;
unsigned __int8 *v336;
size_t v337;
int v338;
UINT64 v339;
UINT64 v340;
__int64 v341;
unsigned __int8 *v342;
int v343;
int v344;
int v345;
int v346;
unsigned __int8 *v347;
__int64 v348;
__int64 v349;
__int64 v350;
int v351;
__int64 v352;
int v353;
unsigned int v354;
int v355;
int v356;
int v357;
int v358;
int v359;
int v360;
unsigned int v361;
int v362;
int v363;
_BYTE *v364;
int v365;
int v366;
int v367;
int v368;
int v369;
int v370;
int v371;
int v372;
int v373;
int v374;
PVOID v375;
__int64 v376;
VOID **v377;
VOID **v378;
UINT64 v379;
unsigned int v380;
VOID **v381;
VOID **v382;
_DWORD *v383;
VOID **v384;
VOID **v385;
NTSTATUS v386;
UINT64 v387;
NTSTATUS v388;
UINT64 v389;
NTSTATUS v390;
_KPROCESSOR_MODE AccessMode;
VOID **v392;
VOID **v393;
_DWORD *v394;
unsigned __int8 v395;
UINT64 NumberOfBytes;
size_t v397[3];
PVOID v398[2];
_ACL *Acl;
UINT64 v400;
PVOID v401[2];
UINT64 v402;
size_t Size[2];
UINT64 uAugend;
UINT64 v405;
UINT64 i;
unsigned int v407;
UINT64 v408;
UINT64 v409;
UINT64 ullAugend;
PVOID P;
__int64 v412;
UINT64 v413;
UINT64 pullResult;
unsigned int v415;
size_t v416;
UINT64 v417;
UINT64 v418;
VOID *Src;
size_t v420;
UINT64 v421;
UINT64 v422;
UINT64 v423;
size_t v424;
unsigned int v425;
size_t v426[3];
PVOID v427;
unsigned int v428;
int AccessStatus;
int v430;
unsigned int v431;
UINT64 v432;
UINT64 v433;
unsigned int v434;
int v435;
unsigned int v436;
int v437;
unsigned int *v438;
UINT64 uAddend;
UINT64 puResult;
int v441;
PVOID v442;
int v443;
int v444;
unsigned int GrantedAccess;
int v446;
int v447;
unsigned int v448[2];
int v449;
int v450;
int v451;
int v452;
int v453;
VOID *v454;
VOID *v455;
int v456;
PVOID v457;
int v458;
int v459;
int v460;
WCHAR *v461;
VOID *v462;
_QWORD *v463;
unsigned int *v464;
__int64 v465;
__int64 v466;
unsigned __int64 v467;
__int64 v468;
__int64 v469;
int v470;
int v471;
int v472;
int v473;
int v474;
int v475;
int v476;
int v477;
int v478;
__int64 v479;
_DWORD *v480;
int *v481;
__int64 *v482;
__int64 v483;
_QWORD *v484;
_DWORD *v485;
int v486;
int v487;
UINT64 v488[2];
UINT64 v489[2];
UINT64 v490[2];
UINT64 v491[2];
UINT64 v492[2];
_SECURITY_SUBJECT_CONTEXT SubjectContext;
_SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
__int128 SecurityDescriptor[2];
__int64 v496;
__int128 v497[2];
__int64 v498;
int *v499;
UINT64 v500;
__int64 v501;
__int64 v502;
__int64 v503;
v484 = a4;
v415 = a3;
v485 = a5;
v394 = 0i64;
v6 = 0i64;
v420 = 0;
v7 = 0i64;
v392 = 0i64;
v8 = 0i64;
v407 = 0;
v9 = 0i64;
v467 = 0i64;
v10 = 0i64;
v438 = 0i64;
v11 = 0i64;
v393 = 0i64;
HIDWORD(v432) = 0;
v428 = 0;
v479 = 0i64;
v446 = 0;
*(_OWORD *)v401 = 0i64;
*(_OWORD *)v398 = 0i64;
if( a2 < 4 )
goto LABEL_2;
v13 = *a1;
v14 = a1 + 1;
Src = a1 + 1;
if( a1 + 1 >= a1 )
{
if( a2 - 4 < (unsigned int)v13 )
{
LABEL_5:
v7 = 0i64;
LABEL_2:
v12 = -1073741762;
v10 = 0i64;
goto LABEL_173;
}
v15 = (unsigned int *)((char *)v14 + v13);
*(_QWORD *)Size = (char *)v14 + v13;
if( (unsigned int *)((char *)v14 + v13) >= v14 && (unsigned int)v13 < 0xFFFFFFFC )
{
if( a2 - ((_DWORD)v13 + 4) < 4 )
goto LABEL_5;
v16 = *v15;
v17 = v15 + 1;
if( v15 + 1 >= v15 )
{
v18 = v13 + 8;
if( (int)v13 + 8 >= (unsigned int)(v13 + 4) )
{
if( a2 - v18 < (unsigned int)v16 )
{
LABEL_12:
v7 = 0i64;
v8 = 0i64;
goto LABEL_2;
}
v19 = (unsigned int *)((char *)v17 + v16);
if( (unsigned int *)((char *)v17 + v16) >= v17 )
{
v20 = v16 + v18;
if( (unsigned int)v16 + v18 >= v18 )
{
if( a2 - v20 < 4 )
goto LABEL_12;
v21 = *v19;
LODWORD(NumberOfBytes) = *v19;
*(_QWORD *)&v397[1] = v19 + 1;
if( v19 + 1 >= v19 )
{
v22 = v20 + 4;
if( v20 + 4 >= v20 )
{
if( a2 - v22 < v21 )
goto LABEL_12;
if( v21 + v22 >= v22 )
{
if( a2 != v21 + v22 || (_DWORD)v16 + (_DWORD)v13 + v21 + 12i64 != a2 )
goto LABEL_12;
PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x30ui64, 542329939i64);
v24 = PoolWithTag;
if( !PoolWithTag )
{
v12 = -1073741801;
goto LABEL_24;
}
*(_OWORD *)PoolWithTag = 0i64;
*((_OWORD *)PoolWithTag + 1) = 0i64;
*((_OWORD *)PoolWithTag + 2) = 0i64;
v30 = Src;
v12 = 0;
if( Src )
{
*(_DWORD *)v24 = v13;
if( (_DWORD)v13 )
{
v31 = ExAllocatePoolWithTag(1ui64, v13, 542329939i64);
if( v31 )
v24[1] = v31;
else
v12 = -1073741801;
v30 = Src;
}
else
{
v12 = -1073741762;
}
if( v12 < 0 )
goto LABEL_61;
memmove(v24[1], v30, v13);
}
v32 = (const VOID *)(*(_QWORD *)Size + 4i64);
if( *(_QWORD *)Size == -4i64 )
{
*((_DWORD *)v24 + 4) = 0;
v24[3] = 0i64;
}
else
{
*((_DWORD *)v24 + 4) = v16;
if( !(_DWORD)v16 )
{
LABEL_50:
v12 = -1073741762;
goto LABEL_61;
}
v33 = ExAllocatePoolWithTag(1ui64, v16, 542329939i64);
if( !v33 )
goto LABEL_52;
v24[3] = v33;
v12 = 0;
memmove(v33, v32, v16);
}
v34 = *(const VOID **)&v397[1];
if( *(_QWORD *)&v397[1] )
{
v35 = NumberOfBytes;
*((_DWORD *)v24 + 8) = NumberOfBytes;
if( !v35 )
goto LABEL_50;
v36 = v35;
v37 = ExAllocatePoolWithTag(1ui64, v35, 542329939i64);
if( !v37 )
{
LABEL_52:
v12 = -1073741801;
goto LABEL_61;
}
v24[5] = v37;
v12 = 0;
memmove(v37, v34, v36);
}
else
{
*((_DWORD *)v24 + 8) = 0;
v24[5] = 0i64;
}
v11 = (unsigned int *)v24;
v24 = 0i64;
LABEL_61:
if( v24 )
{
v38 = v24[1];
if( v38 )
{
ExFreePoolWithTag(v38, 0x20534C53u);
v24[1] = 0i64;
}
v39 = v24[3];
if( v39 )
{
ExFreePoolWithTag(v39, 0x20534C53u);
v24[3] = 0i64;
}
v40 = v24[5];
if( v40 )
{
ExFreePoolWithTag(v40, 0x20534C53u);
v24[5] = 0i64;
}
ExFreePoolWithTag(v24, 0x20534C53u);
}
LABEL_24:
v25 = 0i64;
if( v12 < 0 )
v25 = v11;
if( v12 < 0 )
v11 = 0i64;
Src = v11;
if( v25 )
{
v26 = (void *)v25[1];
if( v26 )
{
ExFreePoolWithTag(v26, 0x20534C53u);
v25[1] = 0i64;
}
v27 = (void *)v25[3];
if( v27 )
{
ExFreePoolWithTag(v27, 0x20534C53u);
v25[3] = 0i64;
}
v28 = (void *)v25[5];
if( v28 )
{
ExFreePoolWithTag(v28, 0x20534C53u);
v25[5] = 0i64;
}
ExFreePoolWithTag(v25, 0x20534C53u);
}
v6 = v11;
if( v12 < 0 )
goto LABEL_171;
HIDWORD(v417) = 0;
v29 = 0i64;
v427 = 0i64;
v12 = 0;
if( v11 )
{
pullResult = *((_QWORD *)v11 + 1);
if( pullResult )
{
v41 = *v11;
if( (_DWORD)v41 )
{
v42 = (__int64 *)*((_QWORD *)v11 + 5);
if( v42 )
{
v43 = v11[8];
if( v43 )
{
v402 = *((_QWORD *)v11 + 3);
if( v402 )
{
v44 = v11[4];
if( v44 )
{
*(_QWORD *)&v426[1] = v41;
LODWORD(v417) = 0;
v412 = 0xFFFFFFFFi64;
if( v43 != 8 || v44 != 160 || v41 <= 8 )
goto LABEL_129;
v45 = *v42;
v46 = v41 - 8;
ullAugend = v41 - 8;
v47 = 0;
v48 = (_ACL *)ExAllocatePoolWithTag(1ui64, v41 - 8, 542329939i64);
v49 = 0;
P = v48;
if( !v48 )
{
v29 = v427;
goto LABEL_129;
}
v50 = (unsigned __int8 *)pullResult;
v51 = v48;
Acl = v48;
v52 = (v46 & 7) == 0;
v53 = v46 & 7;
v502 = v45;
*(_QWORD *)Size = v46 & 7;
v54 = 0;
v405 = pullResult;
if( v52 )
{
HIDWORD(NumberOfBytes) = 0;
LODWORD(v400) = -1;
v397[0] = 0;
}
else
{
LODWORD(v400) = 0;
HIDWORD(NumberOfBytes) = 0;
v55 = -1;
v56 = 0;
if( v53 )
{
v57 = 56;
do
{
v58 = *v50++;
if( v56 >= 4 )
v49 |= v58 << v57;
else
HIDWORD(NumberOfBytes) |= v58 << (v57 - 32);
++v56;
v57 -= 8;
}
while( v56 < v53 );
LODWORD(v400) = v49;
v405 = (UINT64)v50;
}
v59 = 30i64;
v60 = (unsigned __int8 *)(v402 + 126);
v61 = (unsigned __int8 *)(v402 + 158);
v62 = 16i64;
*(_QWORD *)&v397[1] = v402 + 158;
v408 = 16i64;
do
{
v63 = v61[1];
if( (unsigned __int8)v63 < 0x1Fu )
{
v64 = funcs_1405F5698[v63](
v59 + 1,
*(v60 - 2),
*(v60 - 1),
*v60,
v60[1],
(__int64)&v502,
v54);
v62 = v408;
v55 ^= v64;
v61 = *(unsigned __int8 **)&v397[1];
}
v65 = *v61;
if( (unsigned __int8)v65 < 0x1Fu )
{
v66 = funcs_1405F5698[v65](
v59,
*(v60 - 6),
*(v60 - 5),
*(v60 - 4),
*(v60 - 3),
(__int64)&v502,
v55);
v62 = v408;
v54 ^= v66;
v61 = *(unsigned __int8 **)&v397[1];
}
v61 -= 2;
v59 -= 2i64;
v60 -= 8;
*(_QWORD *)&v397[1] = v61;
v408 = --v62;
}
while( v62 );
v54 ^= HIDWORD(NumberOfBytes);
v67 = v400 ^ v55;
v68 = 0;
v69 = Size[0];
v9 = 0i64;
v11 = (unsigned int *)Src;
v70 = v54;
v71 = v67;
v47 = 0;
if( Size[0] )
{
v72 = Acl;
do
{
p_Sbz1 = (_ACL *)&v72->Sbz1;
if( v68 >= 4 )
{
v71 = __ROL4__(v71, 8);
v74 = v71;
}
else
{
v70 = __ROL4__(v70, 8);
v74 = v70;
}
++v68;
v72->AclRevision = v74;
v72 = (_ACL *)((char *)v72 + 1);
}
while( v68 < (int)v69 );
v51 = p_Sbz1;
Acl = p_Sbz1;
}
else
{
v51 = Acl;
}
v50 = (unsigned __int8 *)v405;
if( v69 <= 4 )
{
LODWORD(v45) = v502;
v397[0] = 0;
if( v69 >= 4 )
goto LABEL_108;
v54 = v54 >> (8 * (4 - v69)) << (8 * (4 - v69));
}
else
{
v397[0] = v67 >> (8 * (8 - v69)) << (8 * (8 - v69));
LODWORD(v45) = v502;
}
v51 = Acl;
}
LABEL_108:
v405 = ullAugend >> 3;
if( ullAugend >> 3 )
{
v75 = v50 + 2;
v76 = v397[0];
v77 = v400;
v78 = HIDWORD(NumberOfBytes);
v79 = v402 + 158;
*(_QWORD *)Size = v402 + 126;
v402 = (UINT64)&v51->Sbz2 + 1;
for( i = v79; ; v79 = i )
{
v80 = v75[2] << 8;
v81 = (unsigned __int16)v45;
v82 = v75[3];
v83 = (v75[1] | ((*v75 | ((*(v75 - 1) | (*(v75 - 2) << 8)) << 8)) << 8)) ^ v54;
LODWORD(NumberOfBytes) = v75[1] | ((*v75 | ((*(v75 - 1) | (*(v75 - 2) << 8)) << 8)) << 8);
v84 = v75[5] | ((v75[4] | ((v82 | v80) << 8)) << 8);
v408 = (UINT64)(v75 + 8);
LODWORD(v418) = v84;
v85 = v45 ^ HIDWORD(v502) ^ v83 ^ v84 ^ v76;
v86 = (v85 >> 8) ^ (WORD2(v502) * (WORD1(v502) ^ v85)) ^ v83;
v87 = (WORD1(v502) * __ROR4__(HIDWORD(v502) - v86, 11) - __ROR4__(v86, 12)) ^ v85;
v88 = ((unsigned __int16)v45 * __ROL4__(HIDWORD(v502) ^ v87, 8) - __ROL4__(v87, 2)) ^ v86;
v89 = __ROR4__(v88, 9) ^ (HIWORD(v502) * __ROR4__(v88 - v45, 4)) ^ v87;
v90 = (__ROR4__(v89, 4) + WORD2(v502) * __ROR4__(v45 - v89, 10)) ^ v88;
v91 = (WORD1(v502) * __ROL4__(HIWORD(v502) ^ v90, 4) - __ROR4__(v90, 16)) ^ v89;
v92 = 30i64;
v93 = ((unsigned __int16)v45 * (WORD1(v502) ^ v91) - __ROR4__(v91, 7)) ^ v90;
v94 = 16i64;
Acl = (_ACL *)16;
v95 = (v93 - HIWORD(v502) - v45) ^ v91;
v96 = __ROR4__(v95, 11) ^ (WORD2(v502) * __ROR4__(v45 - v95, 9)) ^ v93;
v97 = *(unsigned __int8 **)Size;
v98 = (WORD1(v502) * (v96 - WORD2(v502)) - (v96 >> 13)) ^ v95;
v99 = (unsigned __int8 *)v79;
*(_QWORD *)&v397[1] = v79;
v100 = (v98 >> 15) ^ (v81 * __ROL4__(v98 - WORD2(v502), 3)) ^ v96;
do
{
v101 = v99[1];
if( (unsigned __int8)v101 < 0x1Fu )
{
v102 = funcs_1405F5698[v101](
v92 + 1,
*(v97 - 2),
*(v97 - 1),
*v97,
v97[1],
(__int64)&v502,
v100);
v94 = (__int64)Acl;
v98 ^= v102;
v99 = *(unsigned __int8 **)&v397[1];
}
v103 = *v99;
if( (unsigned __int8)v103 < 0x1Fu )
{
v104 = funcs_1405F5698[v103](
v92,
*(v97 - 6),
*(v97 - 5),
*(v97 - 4),
*(v97 - 3),
(__int64)&v502,
v98);
v94 = (__int64)Acl;
v100 ^= v104;
v99 = *(unsigned __int8 **)&v397[1];
}
v99 -= 2;
v92 -= 2i64;
v97 -= 8;
*(_QWORD *)&v397[1] = v99;
Acl = (_ACL *)--v94;
}
while( v94 );
v105 = (_BYTE *)v402;
v106 = v78 ^ v100;
v75 = (unsigned __int8 *)v408;
v107 = v77 ^ v98;
v78 = NumberOfBytes;
v77 = v418;
*(_BYTE *)(v402 - 4) = v106;
*v105 = v107;
v108 = __ROR4__(v106, 8);
*(v105 - 5) = v108;
v109 = __ROR4__(v107, 8);
*(v105 - 1) = v109;
v110 = __ROR4__(v108, 8);
*(v105 - 6) = v110;
v111 = __ROR4__(v109, 8);
*(v105 - 2) = v111;
v112 = __ROR4__(v110, 8);
v113 = __ROR4__(v111, 8);
*(v105 - 7) = v112;
*(v105 - 3) = v113;
v76 = __ROR4__(v113, 8);
v54 = __ROR4__(v112, 8);
v52 = v405-- == 1;
v402 = (UINT64)(v105 + 8);
if( v52 )
break;
LODWORD(v45) = v502;
}
v47 = 0;
v12 = HIDWORD(v417);
v11 = (unsigned int *)Src;
v9 = v438;
}
v114 = P;
for( j = 0i64; j < ullAugend; ++j )
v47 ^= *((_BYTE *)P + j);
if( v47 == *(_QWORD *)(ullAugend + pullResult) )
{
v29 = P;
v117 = ullAugend;
v116 = v417;
v114 = 0i64;
v427 = P;
}
else
{
v29 = v427;
v116 = -1073425151;
v117 = v426[1];
}
if( v114 )
{
ExFreePoolWithTag(v114, 0x20534C53u);
v29 = v427;
}
if( v116 >= 0 )
{
v7 = v29;
v394 = v29;
v29 = 0i64;
v420 = v117;
v427 = 0i64;
goto LABEL_130;
}
LABEL_129:
v117 = v420;
v12 = -1073741823;
v7 = 0i64;
LABEL_130:
if( v29 )
{
ExFreePoolWithTag(v29, 0x20534C53u);
v117 = v420;
v427 = 0i64;
}
v6 = v11;
if( v12 < 0 )
goto LABEL_171;
if( v117 < 4 )
goto LABEL_134;
v118 = *v7;
HIDWORD(NumberOfBytes) = *v7;
if( v7 + 1 < v7 )
{
v12 = -1073741675;
goto LABEL_172;
}
if( v117 - 4 < 4 )
{
LABEL_134:
v12 = -1073741762;
LABEL_172:
v8 = 0i64;
v10 = 0i64;
goto LABEL_173;
}
v119 = (unsigned int)v7[1];
v120 = (char *)(v7 + 2);
if( v7 + 2 < v7 + 1 )
goto LABEL_142;
if( v117 - 8 < (unsigned int)v119 )
{
v12 = -1073741762;
LABEL_140:
v6 = v11;
goto LABEL_172;
}
if( (unsigned int)v119 >= 0xFFFFFFF8 )
{
LABEL_142:
v12 = -1073741675;
goto LABEL_140;
}
v121 = (unsigned __int64)&v120[v119];
v122 = v7[1];
if( (char *)v7 + v117 < &v120[v119]
|| (unsigned __int64)v394 + v117 - v119 - (_QWORD)v120 >= 8 )
{
v12 = -1073741762;
goto LABEL_201;
}
memset(v397, 0, sizeof(v397));
v123 = 0i64;
v124 = 0;
if( v7 != (_DWORD *)-8i64 )
{
v125 = (char *)(v7 + 2);
if( v121 < (unsigned __int64)v120 )
{
LABEL_158:
v12 = -1073741675;
goto LABEL_201;
}
if( v121 <= (unsigned __int64)v120 )
goto LABEL_155;
do
{
if( v125 + 4 < v125 )
goto LABEL_158;
if( (unsigned __int64)(v125 + 4) > v121 )
goto LABEL_156;
v126 = *(_DWORD *)v125 + 4;
if( *(_DWORD *)v125 >= 0xFFFFFFFC )
{
v12 = -1073741675;
goto LABEL_167;
}
v471 = *(_DWORD *)v125 + 4;
v127 = &v125[v126];
if( v127 < v125 )
goto LABEL_158;
v125 += v126;
if( (unsigned __int64)v127 > v121 )
goto LABEL_156;
v397[0] = ++v124;
}
while( (unsigned __int64)v127 < v121 );
v123 = *(VOID ***)&v397[1];
LABEL_155:
if( v125 != (char *)v121 )
{
LABEL_156:
v12 = -1073741811;
goto LABEL_201;
}
}
if( (_DWORD)v119 )
{
v123 = ExAllocatePoolWithTag(1ui64, v119, 542329939i64);
*(_QWORD *)&v397[1] = v123;
if( !v123 )
{
v12 = -1073741801;
LABEL_166:
v118 = HIDWORD(NumberOfBytes);
LABEL_167:
if( v12 >= 0 && v118 != LODWORD(v401[0]) )
{
v12 = -1073741762;
LABEL_170:
v6 = v11;
LABEL_171:
v7 = v394;
goto LABEL_172;
}
LABEL_201:
v6 = v11;
if( v12 < 0 )
{
LABEL_564:
v7 = v394;
v8 = 0i64;
v10 = 0i64;
goto LABEL_173;
}
if( v401[1] && LODWORD(v401[0]) )
{
v135 = *(_DWORD *)v401[1];
if( (char *)v401[1] + 4 < v401[1] )
{
v12 = -1073741675;
}
else
{
v472 = *(_DWORD *)v401[1];
v136 = 0i64;
if( v135 )
v136 = (int *)((char *)v401[1] + 4);
v499 = v136;
v12 = 0;
if( v135 != 4 )
{
v12 = -1073741789;
goto LABEL_564;
}
v428 = *v136;
}
}
else
{
v12 = -1073741811;
}
if( v12 < 0 )
goto LABEL_564;
if( !v401[1] || LODWORD(v401[0]) <= 1 )
goto LABEL_214;
v137 = (int *)v401[1];
v138 = 0;
do
{
v139 = (unsigned int)*v137;
v140 = (unsigned int *)(v137 + 1);
if( v137 + 1 < v137 )
goto LABEL_785;
v137 = (int *)((char *)v140 + v139);
if( (unsigned int *)((char *)v140 + v139) < v140 )
goto LABEL_785;
++v138;
}
while( !v138 );
v141 = *v137;
v142 = (unsigned int *)(v137 + 1);
v397[0] = *v137;
if( v137 + 1 < v137 )
{
LABEL_785:
v12 = -1073741675;
goto LABEL_564;
}
v446 = v141;
v143 = 0i64;
if( v141 )
v143 = (__int64)v142;
*(_QWORD *)&v397[1] = v143;
v479 = v143;
if( LODWORD(v401[0]) <= 2 )
{
LABEL_214:
v12 = -1073741811;
goto LABEL_564;
}
v144 = (int *)v401[1];
for( k = 0; k < 2; ++k )
{
v146 = (unsigned int)*v144;
v147 = (unsigned int *)(v144 + 1);
if( v144 + 1 < v144 )
goto LABEL_785;
v144 = (int *)((char *)v147 + v146);
if( (unsigned int *)((char *)v147 + v146) < v147 )
goto LABEL_785;
}
v148 = *v144;
v149 = (unsigned int *)(v144 + 1);
LODWORD(NumberOfBytes) = *v144;
if( v144 + 1 < v144 )
goto LABEL_785;
v473 = v148;
v150 = 0i64;
if( v148 )
v150 = (UINT64)v149;
v402 = v150;
v500 = v150;
v151 = ExAllocatePoolWithTag(1ui64, 0x30ui64, 542329939i64);
v155 = (__int64)v151;
if( !v151 )
{
v12 = -1073741801;
goto LABEL_258;
}
*(_OWORD *)v151 = 0i64;
*((_OWORD *)v151 + 1) = 0i64;
*((_OWORD *)v151 + 2) = 0i64;
v12 = 0;
v153 = *(_QWORD *)&v397[1];
if( *(_QWORD *)&v397[1] )
{
v156 = v397[0];
*(_DWORD *)(v155 + 16) = v397[0];
if( (_DWORD)v156 )
{
v157 = ExAllocatePoolWithTag(1ui64, v156, 542329939i64);
v153 = *(_QWORD *)&v397[1];
if( v157 )
*(_QWORD *)(v155 + 24) = v157;
else
v12 = -1073741801;
LODWORD(v156) = v397[0];
}
else
{
v12 = -1073741762;
}
v154 = (unsigned int)v156;
if( v12 < 0 )
goto LABEL_250;
memmove(*(VOID **)(v155 + 24), (const VOID *)v153, v156);
}
if( v402 )
{
v158 = (unsigned int)NumberOfBytes;
*(_DWORD *)(v155 + 32) = NumberOfBytes;
if( !(_DWORD)v158 )
{
v12 = -1073741762;
goto LABEL_250;
}
*(_QWORD *)Size = v158;
v159 = ExAllocatePoolWithTag(1ui64, v158, 542329939i64);
if( !v159 )
{
v12 = -1073741801;
goto LABEL_250;
}
*(_QWORD *)(v155 + 40) = v159;
v12 = 0;
memmove(v159, (const VOID *)v402, Size[0]);
}
else
{
*(_DWORD *)(v155 + 32) = 0;
*(_QWORD *)(v155 + 40) = 0i64;
}
v9 = (unsigned int *)v155;
v438 = (unsigned int *)v155;
v155 = 0i64;
LABEL_250:
if( v155 )
{
v160 = *(void **)(v155 + 8);
if( v160 )
{
ExFreePoolWithTag(v160, 0x20534C53u);
*(_QWORD *)(v155 + 8) = 0i64;
}
v161 = *(void **)(v155 + 24);
if( v161 )
{
ExFreePoolWithTag(v161, 0x20534C53u);
*(_QWORD *)(v155 + 24) = 0i64;
}
v162 = *(void **)(v155 + 40);
if( v162 )
{
ExFreePoolWithTag(v162, 0x20534C53u);
*(_QWORD *)(v155 + 40) = 0i64;
}
ExFreePoolWithTag((PVOID)v155, 0x20534C53u);
}
LABEL_258:
v6 = v11;
if( v12 < 0 )
goto LABEL_171;
if( v428 > 0x68 )
{
v153 = 204i64;
if( v428 <= 0xCC )
{
switch( v428 )
{
case 0xCCu:
IsAppLicensed = sub_1409632A8(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x69u:
IsAppLicensed = sub_140961B08(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x6Au:
IsAppLicensed = sub_1409612A0(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x6Bu:
IsAppLicensed = sub_1405BD220(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x6Du:
IsAppLicensed = SPCallServerHandleIsAppLicensed(
(INT64)v401,
(INT64)v9,
v154,
(INT64)v398);
goto LABEL_682;
case 0x6Eu:
IsAppLicensed = sub_140960EA4(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x6Fu:
IsAppLicensed = sub_14095FBDC(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x70u:
IsAppLicensed = sub_14095FE3C(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x71u:
IsAppLicensed = SPCallServerHandleClepKdf(
(SSPCallParameters *)v401,
(SSPCallCipherTextData *)v9,
(SSPCallParameters *)v154,
(SSPCallParameters *)v398);
goto LABEL_682;
}
goto LABEL_563;
}
switch( v428 )
{
case 0xCDu:
IsAppLicensed = SPCallServerHandleCheckLicense(
(SSPCallParameters *)v401,
(SSPCallCipherTextData *)v9,
(SSPCallParameters *)v154,
(SSPCallParameters *)v398);
goto LABEL_682;
case 0xCEu:
v444 = 0;
v466 = 8i64;
ZwQuerySystemInformation();
if( v11[4] == 160 )
{
if( (v294 = (const VOID *)*((_QWORD *)v11 + 3),
!memcmp(qword_1409876D0, v294, 0xA0ui64))
&& v9[4] == 160
&& !memcmp(qword_140987B30, *((const VOID **)v9 + 3), 0xA0ui64)
&& v11[8] == 8
&& **((_QWORD **)v11 + 5) == 0x5638EBB72F3355A5i64
&& v9[8] == 8
&& **((_QWORD **)v9 + 5) == 0x9F2DD8784FE939B7ui64
|| !memcmp(qword_140987950, v294, 0xA0ui64)
&& v9[4] == 160
&& !memcmp(qword_140987A90, *((const VOID **)v9 + 3), 0xA0ui64)
&& v11[8] == 8
&& **((_QWORD **)v11 + 5) == 0x5638EBB72F3355A5i64
&& v9[8] == 8
&& **((_QWORD **)v9 + 5) == 0x9F2DD8784FE939B7ui64
|| (v296 = (const VOID *)*((_QWORD *)v11 + 3),
!memcmp(qword_140987310, v296, 0xA0ui64))
&& v9[4] == 160
&& !memcmp(qword_140987590, *((const VOID **)v9 + 3), 0xA0ui64)
&& v11[8] == 8
&& **((_QWORD **)v11 + 5) == 0xF10D668DB2BB8BB9ui64
&& v9[8] == 8
&& **((_QWORD **)v9 + 5) == 0x768DFD321621EA95i64
|| !memcmp(qword_140987090, v296, 0xA0ui64)
&& v9[4] == 160
&& !memcmp(qword_140987270, *((const VOID **)v9 + 3), 0xA0ui64)
&& v11[8] == 8
&& **((_QWORD **)v11 + 5) == 0xF10D668DB2BB8BB9ui64
&& v9[8] == 8
&& **((_QWORD **)v9 + 5) == 0x768DFD321621EA95i64 )
{
IsAppLicensed = sub_1405BD7FC(
(__int64)v401,
(__int64)v9,
v295,
(__int64)v398);
v6 = v11;
goto LABEL_682;
}
}
goto LABEL_308;
case 0xCFu:
IsAppLicensed = sub_140960810(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0xD0u:
IsAppLicensed = SPCallServerHandleGetAppPolicyValue(
(SSPCallParameters *)v401,
(SSPCallCipherTextData *)v9,
(SSPCallParameters *)v154,
(SSPCallParameters *)v398);
goto LABEL_682;
case 0xD1u:
IsAppLicensed = sub_140962840(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0xD2u:
IsAppLicensed = sub_14095F3C0(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0xD3u:
IsAppLicensed = sub_14095EFC4(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
}
if( v428 != 212 )
goto LABEL_563;
v252 = 0;
v465 = 0i64;
v416 = 0;
v425 = 0;
v464 = 0i64;
v463 = 0i64;
v482 = 0i64;
v253 = (unsigned int)v401[0];
v460 = 0;
if( v401[1] && LODWORD(v401[0]) > 3 )
{
v254 = v401[1];
v408 = (UINT64)v401[1];
v426[1] = 0;
while( 1 )
{
LODWORD(NumberOfBytes) = *v254;
v12 = RtlULongLongAdd((ULONGLONG)v254, 4ui64, &v408);
if( v12 < 0 )
break;
v12 = RtlULongLongAdd(v408, (unsigned int)NumberOfBytes, &v408);
if( v12 < 0 )
break;
v254 = (_DWORD *)v408;
if( ++v426[1] >= 3 )
{
LODWORD(NumberOfBytes) = *(_DWORD *)v408;
v12 = RtlULongLongAdd(v408, 4ui64, &v408);
if( v12 >= 0 )
{
v252 = NumberOfBytes;
v255 = (__int64 *)v408;
v460 = NumberOfBytes;
if( !(_DWORD)NumberOfBytes )
v255 = 0i64;
v482 = v255;
}
break;
}
}
if( v12 < 0 )
goto LABEL_421;
if( v252 != 8 )
goto LABEL_384;
v465 = *v255;
}
else
{
v12 = -1073741811;
}
if( v12 < 0 )
goto LABEL_421;
v454 = 0i64;
HIDWORD(v423) = 0;
if( !v401[1] || v253 <= 4 )
{
v12 = -1073741811;
goto LABEL_421;
}
v256 = v401[1];
v257 = 0;
v405 = (UINT64)v401[1];
while( 1 )
{
LODWORD(NumberOfBytes) = *v256;
v12 = RtlULongLongAdd((ULONGLONG)v256, 4ui64, &v405);
if( v12 < 0 )
break;
v12 = RtlULongLongAdd(v405, (unsigned int)NumberOfBytes, &v405);
if( v12 < 0 )
break;
v256 = (_DWORD *)v405;
if( (unsigned int)++v257 >= 4 )
{
v259 = *(_DWORD *)v405;
v12 = RtlULongLongAdd(v405, 4ui64, &v405);
if( v12 >= 0 )
{
v260 = (VOID *)v405;
v258 = v259;
HIDWORD(v423) = v259;
if( !v259 )
v260 = 0i64;
v454 = v260;
}
break;
}
}
if( v12 < 0 )
goto LABEL_421;
if( !v258 )
{
v12 = -1073741762;
goto LABEL_421;
}
v261 = ExAllocatePoolWithTag(1ui64, v258, 542329939i64);
if( !v261 )
{
v12 = -1073741801;
goto LABEL_421;
}
memmove(v261, v454, HIDWORD(v423));
v464 = (unsigned int *)v454;
v416 = HIDWORD(v423);
if( HIDWORD(v423) != 4 )
goto LABEL_583;
v455 = 0i64;
v424 = 0;
if( LODWORD(v401[0]) <= 5 )
{
v12 = -1073741811;
goto LABEL_421;
}
v279 = (_ACL *)v401[1];
Acl = (_ACL *)v401[1];
while( 1 )
{
v280 = *(_DWORD *)&v279->AclRevision;
v12 = RtlULongLongAdd((ULONGLONG)v279, 4ui64, (ULONGLONG *)&Acl);
if( v12 < 0 )
break;
v12 = RtlULongLongAdd((ULONGLONG)Acl, v280, (ULONGLONG *)&Acl);
if( v12 < 0 )
break;
v279 = Acl;
if( (unsigned int)(v282 + 1) >= 5 )
{
v12 = RtlULongLongAdd((ULONGLONG)Acl, 4ui64, (ULONGLONG *)&Acl);
if( v12 >= 0 )
{
v284 = Acl;
v281 = v283;
v424 = v283;
if( !v283 )
v284 = 0i64;
v455 = v284;
}
break;
}
}
if( v12 < 0 )
goto LABEL_421;
if( !v281 )
{
v12 = -1073741762;
goto LABEL_421;
}
v285 = ExAllocatePoolWithTag(1ui64, v281, 542329939i64);
if( !v285 )
{
v12 = -1073741801;
goto LABEL_421;
}
memmove(v285, v455, v424);
v463 = v455;
v416 = v424;
if( v424 != 8 )
{
LABEL_583:
v12 = -1073741306;
goto LABEL_170;
}
v262 = ((__int64(__fastcall *)(_QWORD, _QWORD))qword_140D2C498)(*v464, *v463);
v397[0] = 0;
LODWORD(v417) = 0;
v263 = RtlUIntAdd(4ui64, 4ui64, &v417);
v264 = v425;
v12 = v263;
if( v263 >= 0 )
v264 = v417;
v425 = v264;
if( v263 < 0 )
goto LABEL_421;
v12 = RtlUIntAdd(0i64, v264, (UINT64 *)v397);
if( v12 < 0 )
goto LABEL_421;
HIDWORD(v417) = v267;
v268 = RtlUIntAdd(v266, (unsigned int)(v265 + 8), (UINT64 *)((char *)&v417 + 4));
v12 = v268;
if( v268 >= 0 )
v269 = HIDWORD(v417);
v425 = v269;
if( v268 < 0 )
goto LABEL_421;
v12 = RtlUIntAdd(v397[0], v269, (UINT64 *)v397);
if( v12 < 0 )
goto LABEL_421;
HIDWORD(v398[0]) = v397[0];
if( !v397[0] )
goto LABEL_413;
v271 = ExAllocatePoolWithTag((unsigned int)(v270 + 1), v397[0], 542329939i64);
if( !v271 )
goto LABEL_415;
v398[1] = v271;
LODWORD(v398[0]) = 0;
v443 = v262 | 0x10000000;
v470 = 0;
*(_OWORD *)v491 = 0i64;
v12 = RtlULongLongAdd((ULONGLONG)v271, 4ui64, &v491[1]);
v274 = 0;
if( v12 >= 0 )
{
if( v272 + 2 > (unsigned int *)((char *)v272 + HIDWORD(v398[0])) )
goto LABEL_418;
v275 = (_DWORD *)v491[1];
*v272 = v273;
*v275 = v443;
v274 = ++LODWORD(v398[0]);
}
if( v12 < 0 )
goto LABEL_421;
v483 = v465;
v434 = 0;
*(_OWORD *)v492 = 0i64;
if( v398[1] )
{
v286 = (unsigned int *)v398[1];
v287 = 0;
v402 = (UINT64)v398[1];
if( v274 )
{
do
{
LODWORD(NumberOfBytes) = 0;
v288 = RtlUIntAdd(4ui64, *v286, &NumberOfBytes);
v12 = v288;
if( v288 >= 0 )
v289 = NumberOfBytes;
v434 = v289;
if( v288 < 0 )
goto LABEL_421;
v12 = RtlULongLongAdd(v290, v289, &v402);
if( v12 < 0 )
goto LABEL_421;
v286 = (unsigned int *)v402;
}
while( ++v287 < v291 );
}
v12 = RtlULongLongAdd((ULONGLONG)v286, 4ui64, &v492[1]);
if( v12 < 0 )
{
LABEL_421:
v6 = v11;
v206 = v12 < 0;
goto LABEL_683;
}
if( v292 + 3 > (_DWORD *)((char *)v398[1] + HIDWORD(v398[0])) )
goto LABEL_418;
v293 = (_QWORD *)v492[1];
*v292 = 8;
*v293 = v483;
}
else
{
LODWORD(v418) = 0;
v276 = RtlUIntAdd(v273, 8ui64, &v418);
v12 = v276;
if( v276 >= 0 )
v277 = v418;
v434 = v277;
if( v276 < 0 )
goto LABEL_421;
v12 = RtlUIntAdd(HIDWORD(v398[0]), v277, (UINT64 *)((char *)v398 + 4));
if( v12 < 0 )
goto LABEL_421;
v12 = v278;
}
goto LABEL_420;
}
if( v428 == 104 )
{
IsAppLicensed = sub_14096222C((__int64)v401, (__int64)v9, v154, (__int64)v398);
goto LABEL_682;
}
if( v428 <= 0x17 )
{
if( v428 == 23 )
{
v173 = qword_140D2C4C8;
v448[0] = 0;
memset(v497, 0, sizeof(v497));
v498 = 0i64;
v430 = 0;
memset(&SubjectSecurityContext, 0, sizeof(SubjectSecurityContext));
*(_QWORD *)&v397[1] = qword_140D2C4C8;
v174 = RtlLengthSid(*(_QWORD *)(qword_140D2C4C8 + 392));
v175 = RtlLengthSid(*(_QWORD *)(v173 + 384)) + v174;
v176 = RtlLengthSid(*(_QWORD *)(v173 + 272)) + 32 + v175;
v177 = ExAllocatePoolWithTag(1ui64, v176, 542329939i64);
Acl = (_ACL *)v177;
if( v177 )
{
v12 = RtlCreateAcl((PACL)v177, (_ACL)v176, 2ui64, v180);
if( v12 >= 0 )
{
v12 = RtlpAddKnownAce(
Acl,
2ui64,
0i64,
0x20ui64,
*(VOID **)(*(_QWORD *)&v397[1] + 384i64),
0);
if( v12 >= 0 )
{
v12 = RtlpAddKnownAce(
Acl,
2ui64,
0i64,
0x20ui64,
*(VOID **)(*(_QWORD *)&v397[1] + 392i64),
0);
if( v12 >= 0 )
{
v12 = RtlpAddKnownAce(
Acl,
2ui64,
0i64,
0x20ui64,
*(VOID **)(*(_QWORD *)&v397[1] + 272i64),
0);
if( v12 >= 0 )
{
v12 = RtlCreateSecurityDescriptor(v497, 1ui64);
if( v12 >= 0 )
{
v12 = RtlSetDaclSecurityDescriptor(v497, 1u, Acl, 0);
if( v12 >= 0 )
{
SeCaptureSubjectContext((INT64)&SubjectSecurityContext);
LOBYTE(AccessMode) = 1;
v181 = (unsigned __int8)SeAccessCheck(
v497,
&SubjectSecurityContext,
0,
32,
0,
0i64,
(PGENERIC_MAPPING)&IopFileMapping,
AccessMode,
v448,
&v430);
SeReleaseSubjectContext(&SubjectSecurityContext);
if( !v181 )
v12 = v430;
}
}
}
}
}
}
ExFreePoolWithTag(Acl, 0x20534C53u);
if( v12 >= 0 )
{
v448[1] = 0;
v468 = 8i64;
ZwQuerySystemInformation();
v182 = v11[4];
if( v182 != 160
|| ((v183 = (const VOID *)*((_QWORD *)v11 + 3),
memcmp(qword_140987450, v183, 0xA0ui64))
|| v9[4] != 160
|| memcmp(qword_1409874F0, *((const VOID **)v9 + 3), 0xA0ui64)
|| v11[8] != 8
|| **((_QWORD **)v11 + 5) != 0x35DCEB18766AABAAi64
|| v9[8] != 8
|| **((_QWORD **)v9 + 5) != 0x14CEA8BAE086077Ci64)
&& (memcmp(qword_1409878B0, v183, 0xA0ui64)
|| v9[4] != 160
|| memcmp(qword_140987BD0, *((const VOID **)v9 + 3), 0xA0ui64)
|| v11[8] != 8
|| **((_QWORD **)v11 + 5) != 0xF10D668DB2BB8BB9ui64
|| v9[8] != 8
|| **((_QWORD **)v9 + 5) != 0x768DFD321621EA95i64) )
{
if( v182 != 160 )
goto LABEL_308;
v184 = (const VOID *)*((_QWORD *)v11 + 3);
if( (memcmp(qword_140987C70, v184, 0xA0ui64)
|| v9[4] != 160
|| memcmp(sub_140987130, *((const VOID **)v9 + 3), 0xA0ui64)
|| v11[8] != 8
|| **((_QWORD **)v11 + 5) != 0xA10B922F1A2F2A8Aui64
|| v9[8] != 8
|| **((_QWORD **)v9 + 5) != 0xC349B50B0A716A96ui64)
&& (memcmp(qword_140987630, v184, 0xA0ui64)
|| v9[4] != 160
|| memcmp(qword_140987810, *((const VOID **)v9 + 3), 0xA0ui64)
|| v11[8] != 8
|| **((_QWORD **)v11 + 5) != 0xA6723CF736811074ui64
|| v9[8] != 8
|| **((_QWORD **)v9 + 5) != 0x7511056E178DA076i64) )
{
goto LABEL_308;
}
}
v441 = 0;
v12 = 0;
updated = QueryUpdateFileEaAllowedExt(&v441);
if( updated == -1073741637 || (v12 = updated, updated >= 0) && v441 != 1 )
{
v186 = v12;
if( (KeGetCurrentThread()->ApcState.Process->Protection.Level & 7) == 0 )
v186 = -2147024891;
v12 = v186;
}
}
}
else
{
v12 = -1073741801;
}
v6 = v11;
if( v12 < 0 )
goto LABEL_171;
IsAppLicensed = SPCallServerHandleFileIntegrityUpdate(
(INT64)v401,
v178,
v179,
(INT64)v398);
goto LABEL_682;
}
if( !v428 )
{
IsAppLicensed = SPCallServerHandleQueryPolicy(
(INT64)v401,
(INT64)v9,
v415,
(INT64)v398);
goto LABEL_682;
}
if( v428 != 1 )
{
switch( v428 )
{
case 2u:
IsAppLicensed = SPCallServerHandleAuthenticateCaller(
v153,
(INT64)v9,
v415,
(INT64)v398);
goto LABEL_682;
case 4u:
IsAppLicensed = sub_14095F834(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 5u:
IsAppLicensed = SPCallServerHandleWaitForDisplayWindow(
(INT64)v401,
(INT64)v9,
v154,
(INT64)v398);
goto LABEL_682;
case 6u:
IsAppLicensed = sub_140963760(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 7u:
IsAppLicensed = sub_140961F8C(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 0x16u:
IsAppLicensed = SPCallServerHandleFileUsnQuery(
(INT64)v401,
v152,
v154,
(INT64)v398);
LABEL_682:
v12 = IsAppLicensed;
v206 = IsAppLicensed < 0;
LABEL_683:
if( v206 )
goto LABEL_171;
goto LABEL_684;
}
LABEL_563:
v12 = sub_140962F0C(v153, (int *)v398);
if( v12 < 0 )
goto LABEL_564;
goto LABEL_684;
}
v164 = qword_140D2C4C8;
GrantedAccess = 0;
memset(SecurityDescriptor, 0, sizeof(SecurityDescriptor));
v496 = 0i64;
AccessStatus = 0;
memset(&SubjectContext, 0, sizeof(SubjectContext));
*(_QWORD *)&v397[1] = qword_140D2C4C8;
v165 = RtlLengthSid(*(_QWORD *)(qword_140D2C4C8 + 392));
v166 = RtlLengthSid(*(_QWORD *)(v164 + 384)) + v165;
v167 = RtlLengthSid(*(_QWORD *)(v164 + 272)) + 32 + v166;
v168 = ExAllocatePoolWithTag(1ui64, v167, 542329939i64);
Acl = (_ACL *)v168;
if( !v168 )
{
v12 = -1073741801;
LABEL_279:
v6 = v11;
if( v12 < 0 )
goto LABEL_171;
IsAppLicensed = SPCallServerHandleUpdatePolicies(
(INT64)v401,
(INT64)v9,
v415,
(INT64)v398);
goto LABEL_682;
}
v12 = RtlCreateAcl((PACL)v168, (_ACL)v167, 2ui64, v169);
if( v12 >= 0 )
{
v12 = RtlpAddKnownAce(
Acl,
2ui64,
0i64,
0x20ui64,
*(VOID **)(*(_QWORD *)&v397[1] + 384i64),
0);
if( v12 >= 0 )
{
v12 = RtlpAddKnownAce(
Acl,
2ui64,
0i64,
0x20ui64,
*(VOID **)(*(_QWORD *)&v397[1] + 392i64),
0);
if( v12 >= 0 )
{
v12 = RtlpAddKnownAce(
Acl,
2ui64,
0i64,
0x20ui64,
*(VOID **)(*(_QWORD *)&v397[1] + 272i64),
0);
if( v12 >= 0 )
{
v12 = RtlCreateSecurityDescriptor(SecurityDescriptor, 1ui64);
if( v12 >= 0 )
{
v12 = RtlSetDaclSecurityDescriptor(SecurityDescriptor, 1u, Acl, 0);
if( v12 >= 0 )
{
SeCaptureSubjectContext((INT64)&SubjectContext);
LOBYTE(AccessMode) = 1;
v170 = (unsigned __int8)SeAccessCheck(
SecurityDescriptor,
&SubjectContext,
0,
32,
0,
0i64,
(PGENERIC_MAPPING)&IopFileMapping,
AccessMode,
&GrantedAccess,
&AccessStatus);
SeReleaseSubjectContext(&SubjectContext);
if( !v170 )
v12 = AccessStatus;
}
}
}
}
}
}
ExFreePoolWithTag(Acl, 0x20534C53u);
if( v12 < 0 )
goto LABEL_279;
v458 = 0;
v469 = 8i64;
ZwQuerySystemInformation();
if( v11[4] == 160 )
{
if( (v171 = (const VOID *)*((_QWORD *)v11 + 3),
!memcmp(qword_1409873B0, v171, 0xA0ui64))
&& v9[4] == 160
&& !memcmp(qword_1409879F0, *((const VOID **)v9 + 3), 0xA0ui64)
&& v11[8] == 8
&& **((_QWORD **)v11 + 5) == 0xA564595855B292C4ui64
&& v9[8] == 8
&& **((_QWORD **)v9 + 5) == 0x1B732BD76B4D09FCi64
|| !memcmp(qword_140987770, v171, 0xA0ui64)
&& v9[4] == 160
&& !memcmp(qword_1409871D0, *((const VOID **)v9 + 3), 0xA0ui64)
&& v11[8] == 8
&& **((_QWORD **)v11 + 5) == 0x93278D843BBDC445ui64
&& v9[8] == 8
&& **((_QWORD **)v9 + 5) == 0x6223E824AB21D998i64 )
{
v474 = 0;
v172 = 0;
if( (KeGetCurrentThread()->ApcState.Process->Protection.Level & 7) == 0 )
v172 = -2147024891;
v12 = v172;
goto LABEL_279;
}
}
LABEL_308:
v12 = -2147024891;
goto LABEL_170;
}
if( v428 == 24 )
{
IsAppLicensed = SPCallServerHandleFileIntegrityQuery(
(INT64)v401,
v152,
v154,
(INT64)v398);
goto LABEL_682;
}
if( v428 != 30 )
{
if( v428 != 31 )
{
if( v428 != 37 )
{
switch( v428 )
{
case 'd':
IsAppLicensed = sub_140963044(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 'e':
IsAppLicensed = sub_140962CA8(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
case 'f':
IsAppLicensed = sub_140961F7C();
goto LABEL_682;
case 'g':
IsAppLicensed = sub_1409601E0(
(__int64)v401,
(__int64)v9,
v154,
(__int64)v398);
goto LABEL_682;
}
goto LABEL_563;
}
HIDWORD(uAddend) = 0;
v187 = 0;
v480 = 0i64;
v449 = 0;
if( v401[1] && LODWORD(v401[0]) > 3 )
{
v188 = v401[1];
pullResult = (UINT64)v401[1];
v397[0] = 0;
while( 1 )
{
LODWORD(NumberOfBytes) = *v188;
v12 = RtlULongLongAdd((ULONGLONG)v188, 4ui64, &pullResult);
if( v12 < 0 )
break;
v12 = RtlULongLongAdd(
pullResult,
(unsigned int)NumberOfBytes,
&pullResult);
if( v12 < 0 )
break;
v188 = (_DWORD *)pullResult;
if( ++v397[0] >= 3 )
{
LODWORD(NumberOfBytes) = *(_DWORD *)pullResult;
v12 = RtlULongLongAdd(pullResult, 4ui64, &pullResult);
if( v12 >= 0 )
{
v190 = NumberOfBytes;
v189 = (_DWORD *)pullResult;
v449 = NumberOfBytes;
if( !(_DWORD)NumberOfBytes )
v189 = 0i64;
v480 = v189;
}
break;
}
}
if( v12 >= 0 )
{
if( v190 != 4 )
{
LABEL_384:
v12 = -1073741789;
goto LABEL_421;
}
HIDWORD(uAddend) = *v189;
}
}
else
{
v12 = -1073741811;
}
if( v12 < 0 )
goto LABEL_421;
puResult = 0i64;
v191 = RtlUIntAdd(4ui64, 4ui64, (UINT64 *)((char *)&puResult + 4));
v194 = v193;
v12 = v191;
if( v191 >= 0 )
v194 = HIDWORD(puResult);
v475 = v194;
if( v191 >= 0 )
{
v12 = RtlUIntAdd(0i64, v194, &puResult);
if( v12 >= 0 )
v192 = puResult;
}
if( v12 < 0 )
goto LABEL_421;
v426[0] = 8;
v447 = 0;
v12 = RtlUIntAdd(8ui64, v192, (UINT64 *)v426);
if( v12 < 0 )
goto LABEL_421;
LODWORD(v421) = 0;
v198 = (v426[0] + 7) & 0xFFFFFFF8;
if( v198 >= v426[0] )
{
LODWORD(v421) = (v426[0] + 7) & 0xFFFFFFF8;
v12 = RtlUIntAdd(v198, v195, &v421);
if( v12 >= 0 )
v197 = v421;
}
else
{
v12 = -1073741675;
}
if( v12 >= 0 )
{
LODWORD(uAugend) = 4;
v12 = RtlUIntAdd(4ui64, v197, &uAugend);
if( v12 >= 0 )
{
v12 = RtlUIntAdd((unsigned int)uAugend, v199, &uAugend);
if( v12 >= 0 )
{
v12 = RtlUIntAdd((unsigned int)uAugend, v9[4], &uAugend);
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
(unsigned int)uAugend,
(unsigned int)(v201 + 4),
&uAugend);
if( v12 >= 0 )
{
v12 = RtlUIntAdd((unsigned int)uAugend, v9[8], &uAugend);
if( v12 >= 0 )
v200 = uAugend;
v447 = v200;
}
}
}
}
if( v12 >= 0 )
v187 = v200;
}
if( v12 < 0 )
goto LABEL_421;
if( v415 >= v187 )
dword_140D2C0BC = HIDWORD(uAddend);
HIDWORD(v398[0]) = v196;
if( !v196 )
{
LABEL_413:
v12 = -1073741762;
goto LABEL_421;
}
v202 = ExAllocatePoolWithTag(1ui64, v196, 542329939i64);
if( !v202 )
{
LABEL_415:
v12 = -1073741801;
goto LABEL_421;
}
v398[1] = v202;
LODWORD(v398[0]) = 0;
v450 = 0;
*(_OWORD *)v488 = 0i64;
v476 = 0;
v12 = RtlULongLongAdd((ULONGLONG)v202, 4ui64, &v488[1]);
if( v12 < 0 )
goto LABEL_421;
if( v203 + 2 > (_DWORD *)((char *)v203 + HIDWORD(v398[0])) )
{
LABEL_418:
v12 = -1073741789;
goto LABEL_421;
}
v205 = (_DWORD *)v488[1];
*v203 = v204;
*v205 = v450;
LABEL_420:
++LODWORD(v398[0]);
goto LABEL_421;
}
v207 = 0;
DestinationString.Length = 0;
DestinationString.Buffer = 0i64;
if( ::P )
{
ExFreePoolWithTag(::P, 0x20534C53u);
::P = 0i64;
}
dword_140D2C130 = 0;
dword_140D2C0BC = 0;
LODWORD(v413) = 0;
LODWORD(uAddend) = 0;
v208 = RtlUIntAdd(4ui64, 4ui64, &uAddend);
v210 = v209;
v12 = v208;
if( v208 >= 0 )
v210 = (unsigned int)uAddend;
v477 = v210;
if( v208 >= 0 )
{
v12 = RtlUIntAdd(0i64, v210, &v413);
if( v12 >= 0 )
v207 = v413;
}
if( v12 < 0 )
goto LABEL_452;
HIDWORD(v421) = 8;
v12 = RtlUIntAdd(8ui64, v207, (UINT64 *)((char *)&v421 + 4));
if( v12 >= 0 )
{
LODWORD(v422) = v214;
v215 = (HIDWORD(v421) + 7) & 0xFFFFFFF8;
if( v215 >= HIDWORD(v421) )
{
LODWORD(v422) = (HIDWORD(v421) + 7) & 0xFFFFFFF8;
v12 = RtlUIntAdd(v215, v211, &v422);
if( v12 >= 0 )
v212 = v422;
}
else
{
v12 = -1073741675;
}
if( v12 < 0 )
{
LABEL_452:
v6 = v11;
if( v12 < 0 )
goto LABEL_171;
goto LABEL_684;
}
HIDWORD(uAugend) = v213;
v12 = RtlUIntAdd(v213, v212, (UINT64 *)((char *)&uAugend + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(HIDWORD(uAugend), v216, (UINT64 *)((char *)&uAugend + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
HIDWORD(uAugend),
v9[4],
(UINT64 *)((char *)&uAugend + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
HIDWORD(uAugend),
v217,
(UINT64 *)((char *)&uAugend + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
HIDWORD(uAugend),
v9[8],
(UINT64 *)((char *)&uAugend + 4));
v218 = v451;
if( v12 >= 0 )
v218 = HIDWORD(uAugend);
v451 = v218;
}
}
}
}
}
if( v12 >= 0 )
{
HIDWORD(v398[0]) = v207;
if( v207 )
{
v219 = ExAllocatePoolWithTag(1ui64, v207, 542329939i64);
if( v219 )
{
v398[1] = v219;
LODWORD(v398[0]) = 0;
v452 = 0;
*(_OWORD *)v489 = 0i64;
v478 = 0;
v12 = RtlULongLongAdd((ULONGLONG)v219, 4ui64, &v489[1]);
if( v12 >= 0 )
{
if( v220 + 2 <= (_DWORD *)((char *)v220 + HIDWORD(v398[0])) )
{
v222 = (_DWORD *)v489[1];
*v220 = v221;
*v222 = v452;
++LODWORD(v398[0]);
}
else
{
v12 = -1073741789;
}
}
}
else
{
v12 = -1073741801;
}
}
else
{
v12 = -1073741762;
}
}
goto LABEL_452;
}
v442 = 0i64;
v223 = 0;
v431 = 0;
LODWORD(v224) = 0;
v426[1] = 0;
v435 = 0;
v462 = 0i64;
v436 = 0;
v461 = 0i64;
v437 = 0;
*(_QWORD *)Size = 0i64;
if( v401[1] && LODWORD(v401[0]) > 3 )
{
v227 = v401[1];
P = v401[1];
LODWORD(v413) = 0;
while( 1 )
{
LODWORD(NumberOfBytes) = *v227;
v12 = RtlULongLongAdd((ULONGLONG)v227, 4ui64, (ULONGLONG *)&P);
if( v12 < 0 )
break;
v12 = RtlULongLongAdd(
(ULONGLONG)P,
(unsigned int)NumberOfBytes,
(ULONGLONG *)&P);
if( v12 < 0 )
break;
v227 = P;
LODWORD(v413) = v413 + 1;
if( (unsigned int)v413 >= 3 )
{
LODWORD(NumberOfBytes) = *(_DWORD *)P;
v12 = RtlULongLongAdd((ULONGLONG)P, 4ui64, (ULONGLONG *)&P);
if( v12 >= 0 )
{
v229 = NumberOfBytes;
v228 = (WCHAR *)P;
v437 = NumberOfBytes;
if( !(_DWORD)NumberOfBytes )
v228 = 0i64;
v461 = v228;
}
break;
}
}
if( v12 >= 0 )
{
if( !v229 || (v229 & 1) != 0 )
{
v12 = -1073741762;
goto LABEL_529;
}
if( v228[((unsigned __int64)v229 >> 1) - 1]
|| StringCbLengthW(v228, v229, (UINT64 *)Size) < 0
|| *(_QWORD *)Size + 2i64 != v437 )
{
goto LABEL_476;
}
v224 = *(_QWORD *)Size >> 1;
v462 = v461;
v436 = *(_QWORD *)Size >> 1;
}
}
else
{
v12 = -1073741811;
}
if( v12 < 0 )
goto LABEL_529;
if( 2 * (_DWORD)v224 != -2 )
{
*(_QWORD *)Size = (unsigned int)(2 * v224 + 2);
v225 = ExAllocatePoolWithTag(1ui64, *(UINT64 *)Size, 542329939i64);
v226 = v225;
if( !v225 )
{
v12 = -1073741801;
goto LABEL_529;
}
memmove(v225, v462, Size[0]);
v431 = v436;
v442 = v226;
v481 = 0i64;
v453 = 0;
if( v401[1] && LODWORD(v401[0]) > 4 )
{
v230 = v401[1];
ullAugend = (UINT64)v401[1];
while( 1 )
{
LODWORD(NumberOfBytes) = *v230;
v12 = RtlULongLongAdd((ULONGLONG)v230, 4ui64, &ullAugend);
if( v12 < 0 )
break;
v12 = RtlULongLongAdd(ullAugend, (unsigned int)NumberOfBytes, &ullAugend);
if( v12 < 0 )
break;
v230 = (_DWORD *)ullAugend;
if( (unsigned int)(v233 + 1) >= 4 )
{
v12 = RtlULongLongAdd(ullAugend, 4ui64, &ullAugend);
if( v12 >= 0 )
{
v231 = (int *)ullAugend;
v232 = v234;
v453 = v234;
if( !v234 )
v231 = 0i64;
v481 = v231;
}
break;
}
}
if( v12 < 0 )
goto LABEL_529;
if( v232 != 4 )
{
LABEL_492:
v12 = -1073741789;
goto LABEL_529;
}
v435 = *v231;
}
else
{
v12 = -1073741811;
}
if( v12 >= 0 )
{
LODWORD(v432) = 0;
LODWORD(v433) = 0;
v235 = RtlUIntAdd(4ui64, 4ui64, &v433);
v237 = (unsigned int)v236;
v12 = v235;
if( v235 >= 0 )
v237 = (unsigned int)v433;
v486 = v237;
if( v235 >= 0 )
{
v12 = RtlUIntAdd(0i64, v237, &v432);
if( v12 >= 0 )
v223 = v432;
}
if( v12 >= 0 )
{
if( ::P )
{
ExFreePoolWithTag(::P, 0x20534C53u);
v236 = 0i64;
::P = 0i64;
}
v238 = 2i64 * v431;
DestinationString.Length = (unsigned __int16)v236;
DestinationString.Buffer = v236;
*(_QWORD *)Size = v238;
if( v238 > 0xFFFFFFFF )
{
v12 = -1073741675;
goto LABEL_529;
}
v12 = RtlUIntAdd((unsigned int)v238, 2ui64, (UINT64 *)&v426[1]);
if( v12 < 0 )
goto LABEL_529;
if( !v426[1] )
goto LABEL_506;
v239 = v426[1];
v240 = ExAllocatePoolWithTag(1ui64, v426[1], 542329939i64);
if( !v240 )
{
LABEL_508:
v12 = -1073741801;
goto LABEL_529;
}
::P = v240;
memset(v240, 0i64, v239);
memmove(::P, v442, Size[0]);
RtlInitUnicodeString(&DestinationString, (PCWSTR)::P);
dword_140D2C130 = v435;
HIDWORD(v422) = 8;
v12 = RtlUIntAdd(8ui64, v223, (UINT64 *)((char *)&v422 + 4));
if( v12 >= 0 )
{
LODWORD(v423) = v243;
v244 = (HIDWORD(v422) + 7) & 0xFFFFFFF8;
if( v244 >= HIDWORD(v422) )
{
LODWORD(v423) = (HIDWORD(v422) + 7) & 0xFFFFFFF8;
v12 = RtlUIntAdd(v244, v241, &v423);
if( v12 >= 0 )
v242 = v423;
}
else
{
v12 = -1073741675;
}
if( v12 < 0 )
goto LABEL_529;
LODWORD(v400) = 4;
v12 = RtlUIntAdd(4ui64, v242, &v400);
if( v12 >= 0 )
{
v12 = RtlUIntAdd((unsigned int)v400, v245, &v400);
if( v12 >= 0 )
{
v12 = RtlUIntAdd((unsigned int)v400, v9[4], &v400);
if( v12 >= 0 )
{
v12 = RtlUIntAdd((unsigned int)v400, v246, &v400);
if( v12 >= 0 )
{
v12 = RtlUIntAdd((unsigned int)v400, v9[8], &v400);
v247 = v456;
if( v12 >= 0 )
v247 = v400;
v456 = v247;
}
}
}
}
}
if( v12 >= 0 )
{
HIDWORD(v398[0]) = v223;
if( !v223 )
{
LABEL_506:
v12 = -1073741762;
goto LABEL_529;
}
v248 = ExAllocatePoolWithTag(1ui64, v223, 542329939i64);
if( !v248 )
goto LABEL_508;
v398[1] = v248;
LODWORD(v398[0]) = 0;
v459 = 0;
*(_OWORD *)v490 = 0i64;
v487 = 0;
v12 = RtlULongLongAdd((ULONGLONG)v248, 4ui64, &v490[1]);
if( v12 >= 0 )
{
if( v249 + 2 > (_DWORD *)((char *)v249 + HIDWORD(v398[0])) )
goto LABEL_492;
v251 = (_DWORD *)v490[1];
*v249 = v250;
*v251 = v459;
++LODWORD(v398[0]);
}
}
}
}
LABEL_529:
if( v442 )
{
ExFreePoolWithTag(v442, 0x20534C53u);
v442 = 0i64;
}
v6 = v11;
if( v12 < 0 )
{
v8 = 0i64;
v10 = 0i64;
goto LABEL_533;
}
LABEL_684:
v467 = __rdtsc();
LODWORD(v409) = 8;
v12 = RtlUIntAdd(8ui64, HIDWORD(v398[0]), &v409);
if( v12 >= 0 )
{
v298 = (v409 + 7) & 0xFFFFFFF8;
if( v298 >= (unsigned int)v409 )
{
LODWORD(v409) = (v409 + 7) & 0xFFFFFFF8;
if( v298 )
{
v299 = ExAllocatePoolWithTag(1ui64, v298, 542329939i64);
v297 = 0i64;
v300 = v299;
if( v299 )
{
*(_QWORD *)&v397[1] = v299;
*(_DWORD *)v299 = v398[0];
v12 = RtlULongLongAdd((ULONGLONG)v299, 4ui64, (ULONGLONG *)&v397[1]);
if( v12 >= 0 )
{
v302 = *(_QWORD *)&v397[1];
**(_DWORD **)&v397[1] = HIDWORD(v398[0]);
v12 = RtlULongLongAdd(v302, v301, (ULONGLONG *)&v397[1]);
if( v12 >= 0 )
{
v303 = *(VOID **)&v397[1];
*(VOID **)((char *)v300 + (unsigned int)v409 - 8) = (VOID *)v467;
memmove(v303, v398[1], HIDWORD(v398[0]));
v297 = 0i64;
v392 = v300;
v300 = 0i64;
v407 = v409;
}
}
if( v300 )
{
ExFreePoolWithTag(v300, 0x20534C53u);
v297 = 0i64;
}
}
else
{
v12 = -1073741801;
}
}
else
{
v12 = -1073741762;
}
}
else
{
v12 = -1073741675;
}
}
v8 = v392;
v6 = v11;
if( v12 >= 0 )
{
v457 = v297;
if( !v392 || !v407 )
{
v12 = -1073741811;
v7 = v394;
LABEL_699:
v10 = v393;
goto LABEL_173;
}
v304 = (__int64 *)*((_QWORD *)v9 + 5);
if( v304
&& (v305 = v9[8]) != 0
&& (v405 = *((_QWORD *)v9 + 3)) != 0
&& (v306 = v9[4]) != 0 )
{
if( v305 != 8 )
goto LABEL_756;
if( v306 != 160 )
goto LABEL_756;
v307 = *v304;
v308 = (unsigned __int8)v297;
v309 = (unsigned __int64)v297;
do
v308 ^= *((_BYTE *)v392 + v309++);
while( v309 < v407 );
v395 = v308;
v310 = ExAllocatePoolWithTag(1ui64, v407 + 8i64, 542329939i64);
LODWORD(v297) = 0;
P = v310;
if( v310 )
{
v311 = v407;
v312 = v392;
v503 = v307;
v313 = 0;
*(_QWORD *)&v397[1] = v392;
*(_QWORD *)Size = v310;
v397[0] = 0;
HIDWORD(NumberOfBytes) = 0;
v314 = v407 & 7;
if( (v407 & 7) != 0 )
{
v397[0] = 0;
v315 = 0;
HIDWORD(NumberOfBytes) = 0;
v316 = 0;
v317 = 0;
if( (v407 & 7) != 0 )
{
v318 = 56;
do
{
v319 = *(unsigned __int8 *)v312;
v312 = (VOID **)((char *)v312 + 1);
if( v317 >= 4 )
v315 |= v319 << v318;
else
v316 |= v319 << (v318 - 32);
++v317;
v318 -= 8;
}
while( v317 < v314 );
HIDWORD(NumberOfBytes) = v316;
v397[0] = v315;
*(_QWORD *)&v397[1] = v312;
}
v320 = 16i64;
v321 = -1;
Acl = (_ACL *)16;
v322 = (unsigned __int8 *)(v405 + 126);
v323 = (unsigned __int8 *)(v405 + 158);
v402 = v405 + 158;
v324 = 30i64;
do
{
v325 = v323[1];
if( (unsigned __int8)v325 < 0x1Fu )
{
v326 = funcs_1405F5698[v325](
v324 + 1,
*(v322 - 2),
*(v322 - 1),
*v322,
v322[1],
(__int64)&v503,
v313);
v320 = (__int64)Acl;
v321 ^= v326;
v323 = (unsigned __int8 *)v402;
}
v327 = *v323;
if( (unsigned __int8)v327 < 0x1Fu )
{
v328 = funcs_1405F5698[v327](
v324,
*(v322 - 6),
*(v322 - 5),
*(v322 - 4),
*(v322 - 3),
(__int64)&v503,
v321);
v320 = (__int64)Acl;
v313 ^= v328;
v323 = (unsigned __int8 *)v402;
}
v323 -= 2;
v324 -= 2i64;
v322 -= 8;
v402 = (UINT64)v323;
Acl = (_ACL *)--v320;
}
while( v320 );
v313 ^= HIDWORD(NumberOfBytes);
v329 = v397[0] ^ v321;
LODWORD(v297) = 0;
v308 = v395;
v330 = v313;
v11 = (unsigned int *)Src;
v331 = v397[0] ^ v321;
v332 = 0;
v9 = v438;
v412 = v329;
if( v314 )
{
v333 = *(_BYTE **)Size;
do
{
v334 = (VOID **)(v333 + 1);
if( v332 >= 4 )
{
v331 = __ROL4__(v331, 8);
v335 = v331;
}
else
{
v330 = __ROL4__(v330, 8);
v335 = v330;
}
++v332;
*v333++ = v335;
}
while( v332 < v314 );
LODWORD(v329) = v412;
v310 = v334;
}
else
{
v310 = *(VOID ***)Size;
}
if( (unsigned int)v314 <= 4 )
{
LODWORD(v412) = 0;
if( (unsigned int)v314 < 4 )
v313 = v313 >> (8 * (4 - v314)) << (8 * (4 - v314));
}
else
{
v412 = (unsigned int)v329 >> (8 * (8 - v314)) << (8 * (8 - v314));
}
v312 = *(VOID ***)&v397[1];
v311 = v407;
}
Acl = (_ACL *)((unsigned __int64)v311 >> 3);
if( Acl )
{
v336 = (unsigned __int8 *)v312 + 2;
v337 = v397[0];
v338 = v412;
*(_QWORD *)Size = (char *)v310 + 7;
v339 = v405 + 129;
v340 = v405 + 2;
v408 = v405 + 129;
ullAugend = v405 + 2;
do
{
v341 = 16i64;
v342 = (unsigned __int8 *)v340;
v343 = v336[2] << 8;
v344 = *v336 | ((*(v336 - 1) | (*(v336 - 2) << 8)) << 8);
*(_QWORD *)&v397[1] = 16i64;
v345 = v336[1] | (v344 << 8);
v346 = v345 ^ v313;
v347 = (unsigned __int8 *)v339;
LODWORD(NumberOfBytes) = v336[5] | ((v336[4] | ((v336[3] | v343) << 8)) << 8);
v412 = (unsigned int)NumberOfBytes ^ v338;
v348 = v412;
v349 = 0i64;
v405 = (UINT64)(v336 + 8);
v402 = v339;
do
{
v350 = *(v347 - 1);
if( (unsigned __int8)v350 < 0x1Fu )
{
v351 = funcs_1405F5698[v350](
v349,
*(v342 - 2),
*(v342 - 1),
*v342,
v342[1],
(__int64)&v503,
v348);
v341 = *(_QWORD *)&v397[1];
v346 ^= v351;
v347 = (unsigned __int8 *)v402;
}
v352 = *v347;
if( (unsigned __int8)v352 < 0x1Fu )
{
v353 = funcs_1405F5698[v352](
v349 + 1,
v342[2],
v342[3],
v342[4],
v342[5],
(__int64)&v503,
v346);
v341 = *(_QWORD *)&v397[1];
v348 = v353 ^ (unsigned int)v348;
v347 = (unsigned __int8 *)v402;
}
v347 += 2;
v349 += 2i64;
v342 += 8;
v402 = (UINT64)v347;
*(_QWORD *)&v397[1] = --v341;
}
while( v341 );
v412 = v348;
v354 = (HIWORD(v503)
* ((unsigned __int16)v503 + __ROR4__(~(_DWORD)v348, 5))) ^ v346;
v355 = (v354 >> 10) ^ (WORD1(v503) * (v354 ^ HIWORD(v503))) ^ v348;
v356 = __ROR4__(v355, 10) ^ (WORD2(v503) * __ROR4__(v503 ^ v355, 12)) ^ v354;
v357 = (HIWORD(v503) * __ROR4__(v356 - v503, 14) - __ROL4__(v356, 8)) ^ v355;
v358 = (__ROL4__(v357, 2)
+ (unsigned __int16)v503 * __ROR4__(HIDWORD(v503) + v357, 15)) ^ v356;
v359 = (WORD1(v503) * (WORD2(v503) ^ v358)) ^ __ROR4__(v358, 6) ^ v357;
v360 = (HIDWORD(v503) - (v359 ^ v503)) ^ v358;
v361 = (HIWORD(v503) * __ROL4__(WORD1(v503) ^ v360, 6)
- __ROL4__(v360, 2)) ^ v359;
v362 = ((unsigned __int16)v503 * (v361 - WORD2(v503)) - (v361 >> 13)) ^ v360;
v363 = (WORD1(v503) * __ROR4__(v362 + HIDWORD(v503), 9)
- __ROL4__(v362, 2)) ^ v361;
v364 = *(_BYTE **)Size;
v336 = (unsigned __int8 *)v405;
v340 = ullAugend;
LODWORD(v297) = 0;
v365 = (__ROL4__(v363, 10) + WORD2(v503) * __ROL4__(v363 - v503, 5)) ^ v362;
v366 = v365 ^ v503 ^ HIDWORD(v503) ^ v363;
v367 = HIDWORD(NumberOfBytes) ^ v365;
*(_BYTE *)(*(_QWORD *)Size - 4i64) = v367;
v368 = v337 ^ v366;
v337 = NumberOfBytes;
*v364 = v368;
v369 = __ROR4__(v367, 8);
*(v364 - 5) = v369;
v370 = __ROR4__(v368, 8);
*(v364 - 1) = v370;
v371 = __ROR4__(v369, 8);
*(v364 - 6) = v371;
v372 = __ROR4__(v370, 8);
*(v364 - 2) = v372;
v373 = __ROR4__(v371, 8);
*(v364 - 7) = v373;
v374 = __ROR4__(v372, 8);
*(v364 - 3) = v374;
v338 = __ROR4__(v374, 8);
v313 = __ROR4__(v373, 8);
v52 = Acl == (_ACL *)1;
Acl = (_ACL *)((char *)Acl - 1);
*(_QWORD *)Size = v364 + 8;
v339 = v408;
HIDWORD(NumberOfBytes) = v345;
}
while( !v52 );
v308 = v395;
v11 = (unsigned int *)Src;
v9 = v438;
}
v375 = P;
v376 = v407 + 8i64;
*(_QWORD *)((char *)P + v407) = v308;
v501 = v376;
v457 = v375;
v12 = 0;
if( (_DWORD)v376 )
{
*(_QWORD *)Size = (unsigned int)v376;
v377 = ExAllocatePoolWithTag(1ui64, (unsigned int)v376, 542329939i64);
LODWORD(v297) = 0;
v378 = v377;
if( v377 )
{
memmove(v377, v375, Size[0]);
*((_QWORD *)v9 + 1) = v378;
*v9 = v376;
LODWORD(v297) = 0;
}
else
{
v12 = -1073741801;
}
}
else
{
v12 = -1073741762;
}
}
else
{
LABEL_756:
v12 = -1073741823;
}
if( v457 )
{
ExFreePoolWithTag(v457, 0x20534C53u);
LODWORD(v297) = 0;
v457 = 0i64;
}
v6 = v11;
if( v12 >= 0 )
{
HIDWORD(v433) = (_DWORD)v297;
v379 = *v9;
HIDWORD(NumberOfBytes) = 4;
v12 = RtlUIntAdd(4ui64, v379, (UINT64 *)((char *)&NumberOfBytes + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
HIDWORD(NumberOfBytes),
4ui64,
(UINT64 *)((char *)&NumberOfBytes + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
HIDWORD(NumberOfBytes),
v9[4],
(UINT64 *)((char *)&NumberOfBytes + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
HIDWORD(NumberOfBytes),
4ui64,
(UINT64 *)((char *)&NumberOfBytes + 4));
if( v12 >= 0 )
{
v12 = RtlUIntAdd(
HIDWORD(NumberOfBytes),
v9[8],
(UINT64 *)((char *)&NumberOfBytes + 4));
if( v12 >= 0 )
v380 = HIDWORD(NumberOfBytes);
HIDWORD(v433) = v380;
}
}
}
}
if( v12 >= 0 )
{
if( v380 )
{
v384 = ExAllocatePoolWithTag(1ui64, v380, 542329939i64);
v381 = 0i64;
v385 = v384;
if( v384 )
{
*(_DWORD *)v384 = *v9;
i = (UINT64)v384;
v12 = RtlULongLongAdd((ULONGLONG)v384, 4ui64, &i);
if( v12 < 0 )
goto LABEL_782;
memmove((VOID *)i, *((const VOID **)v9 + 1), *v9);
v386 = RtlULongLongAdd(i, *v9, &i);
v381 = 0i64;
v12 = v386;
if( v386 < 0 )
goto LABEL_782;
v387 = i;
*(_DWORD *)i = v9[4];
v12 = RtlULongLongAdd(v387, 4ui64, &i);
if( v12 < 0 )
goto LABEL_782;
memmove((VOID *)i, *((const VOID **)v9 + 3), v9[4]);
v388 = RtlULongLongAdd(i, v9[4], &i);
v381 = 0i64;
v12 = v388;
if( v388 < 0
|| (v389 = i,
*(_DWORD *)i = v9[8],
v12 = RtlULongLongAdd(v389, 4ui64, &i),
v12 < 0)
|| (memmove((VOID *)i, *((const VOID **)v9 + 5), v9[8]),
v390 = RtlULongLongAdd(i, v9[8], &i),
v381 = 0i64,
v12 = v390,
v390 < 0) )
{
LABEL_782:
v382 = v381;
}
else
{
v382 = v385;
v393 = v385;
v385 = 0i64;
HIDWORD(v432) = HIDWORD(v433);
}
if( v385 )
{
ExFreePoolWithTag(v385, 0x20534C53u);
v381 = 0i64;
}
}
else
{
v12 = -1073741801;
v382 = 0i64;
}
LABEL_771:
v7 = v394;
v6 = v11;
if( v12 >= 0 )
{
v10 = v381;
v383 = v485;
*v484 = v382;
v8 = v392;
*v383 = HIDWORD(v432);
goto LABEL_173;
}
goto LABEL_704;
}
v12 = -1073741762;
}
v382 = 0i64;
goto LABEL_771;
}
}
else
{
v12 = -1073741811;
}
v7 = v394;
LABEL_704:
v8 = v392;
goto LABEL_699;
}
v10 = 0i64;
LABEL_533:
v7 = v394;
goto LABEL_173;
}
LABEL_476:
v12 = -1073741762;
goto LABEL_529;
}
v122 = v119;
}
if( v7 != (_DWORD *)-8i64 )
{
memmove(v123, v120, v122);
v123 = *(VOID ***)&v397[1];
}
v401[1] = v123;
v401[0] = (PVOID)__PAIR64__(v119, v397[0]);
v12 = 0;
goto LABEL_166;
}
}
}
}
v6 = v11;
}
}
}
v12 = -1073741811;
v7 = 0i64;
v8 = 0i64;
v10 = 0i64;
goto LABEL_173;
}
}
}
}
}
}
}
}
}
v12 = -1073741675;
v7 = 0i64;
v8 = 0i64;
LABEL_173:
v401[0] = 0i64;
if( v401[1] )
{
ExFreePoolWithTag(v401[1], 0x20534C53u);
v401[1] = 0i64;
}
v398[0] = 0i64;
if( v398[1] )
{
ExFreePoolWithTag(v398[1], 0x20534C53u);
v398[1] = 0i64;
}
if( v7 )
ExFreePoolWithTag(v7, 0x20534C53u);
if( v6 )
{
v128 = (void *)v6[1];
if( v128 )
{
ExFreePoolWithTag(v128, 0x20534C53u);
v6[1] = 0i64;
}
v129 = (void *)v6[3];
if( v129 )
{
ExFreePoolWithTag(v129, 0x20534C53u);
v6[3] = 0i64;
}
v130 = (void *)v6[5];
if( v130 )
{
ExFreePoolWithTag(v130, 0x20534C53u);
v6[5] = 0i64;
}
ExFreePoolWithTag(v6, 0x20534C53u);
}
if( v10 )
ExFreePoolWithTag(v10, 0x20534C53u);
if( v9 )
{
v131 = (void *)*((_QWORD *)v9 + 1);
if( v131 )
{
ExFreePoolWithTag(v131, 0x20534C53u);
*((_QWORD *)v9 + 1) = 0i64;
}
v132 = (void *)*((_QWORD *)v9 + 3);
if( v132 )
{
ExFreePoolWithTag(v132, 0x20534C53u);
*((_QWORD *)v9 + 3) = 0i64;
}
v133 = (void *)*((_QWORD *)v9 + 5);
if( v133 )
{
ExFreePoolWithTag(v133, 0x20534C53u);
*((_QWORD *)v9 + 5) = 0i64;
}
ExFreePoolWithTag(v9, 0x20534C53u);
}
if( v8 )
ExFreePoolWithTag(v8, 0x20534C53u);
return(unsigned int)v12;
}