NTSTATUS __fastcall PfVerifyScenarioBuffer(PF_SCENARIO_HEADER *Scenario, UINT64 BufferSize, UINT64 *FailedCheck){
int v3;
unsigned __int8 v4;
unsigned int *v6;
unsigned int v7;
__int64 v8;
unsigned int v9;
unsigned int v10;
__int64 v11;
__int64 v12;
__int64 v13;
unsigned __int64 v14;
char *v15;
unsigned __int64 v16;
unsigned __int64 v17;
unsigned __int64 v18;
unsigned __int64 v19;
unsigned __int64 v20;
unsigned __int64 v21;
unsigned __int64 v22;
unsigned __int64 v23;
int v24;
unsigned int v25;
int *v26;
unsigned __int64 v27;
__int64 v28;
unsigned __int64 v29;
unsigned int v30;
__int64 v31;
unsigned int v32;
int v33;
unsigned int v34;
int v35;
int v36;
int v37;
__int64 v38;
__int64 v39;
int *v40;
int v41;
int v42;
int v44;
unsigned __int64 v45;
int v46;
unsigned int v47;
unsigned int v48;
unsigned int v49;
unsigned __int64 v50;
unsigned int *v51;
unsigned int v52;
int v53;
unsigned __int64 v54;
_WORD *v55;
char *v56;
int v57;
int v58;
unsigned __int64 v59;
unsigned __int64 v60;
__int64 v61;
unsigned __int64 v62;
unsigned int v63;
unsigned int v64;
int v65;
_DWORD *v66;
__int64 v67;
int v68;
int v69;
unsigned int v70;
int v71;
_DWORD *v72;
__int64 v73;
unsigned __int64 v74;
unsigned int v75;
__int64 v76;
unsigned __int64 v77;
__int64 v78;
int v79;
unsigned int v80;
int v81;
unsigned __int64 v82;
unsigned int v83;
int v84;
unsigned __int64 v86;
unsigned int v87;
unsigned int v88;
int v89;
unsigned int v90;
int v91;
unsigned int v92;
unsigned __int64 v93;
unsigned __int64 v94;
int *v95;
unsigned __int64 v96;
WCHAR pszDest[40];
v3 = 0;
v4 = 0;
v6 = (unsigned int *)Scenario;
if( (unsigned int)BufferSize < 0x128 )
{
v3 = 10;
}
else if( ((unsigned __int8)Scenario & 7) != 0 )
{
v3 = 15;
}
else if( *Scenario == 30 && Scenario[1] == 1094927187 )
{
if( (unsigned int)BufferSize > 0x10000000 )
{
v3 = 25;
}
else if( (_DWORD)BufferSize == Scenario[3] )
{
if( (unsigned int)Scenario[20] > 1 )
{
v3 = 27;
}
else
{
v7 = Scenario[22];
v90 = v7;
if( v7 > 0x4000
|| (v8 = (unsigned int)Scenario[28], v92 = v8, (unsigned int)v8 > 0x4000)
|| (v9 = Scenario[24], v87 = v9, v9 > 0x100000)
|| (v10 = Scenario[26], v10 > 0x400000) )
{
v3 = 30;
}
else if( v7 && v9 && v10 )
{
if( (unsigned int)(Scenario[51] - 1) > 7 )
{
v3 = 35;
}
else if( PfVerifyScenarioId((__int64)(Scenario + 4)) )
{
v14 = (unsigned __int64)v6 + v6[21];
v93 = v14;
if( (v14 & 3) != 0 )
{
v3 = 38;
}
else if( v14 < (unsigned __int64)v6
|| (v15 = (char *)v6 + v11, v86 = (unsigned __int64)v6 + v11, v14 >= (unsigned __int64)v6 + v11) )
{
v3 = 40;
}
else
{
v16 = 32i64 * v7 + v14 - 1;
if( v16 < (unsigned __int64)v6 || v16 >= (unsigned __int64)v15 )
{
v3 = 45;
}
else
{
v17 = (unsigned __int64)v6 + v6[23];
v94 = v17;
if( (v17 & 3) != 0 )
{
v3 = 47;
}
else if( v17 < (unsigned __int64)v6 || v17 >= (unsigned __int64)v15 )
{
v3 = 50;
}
else
{
v18 = v17 + 8 * v13 - 1;
if( v18 < (unsigned __int64)v6 || v18 >= (unsigned __int64)v15 )
{
v3 = 55;
}
else
{
v19 = (unsigned __int64)v6 + v6[25];
v96 = v19;
if( (v19 & 1) != 0 )
{
v3 = 57;
}
else if( v19 < (unsigned __int64)v6 || v19 >= (unsigned __int64)v15 )
{
v3 = 60;
}
else
{
v20 = v19 + v12 - 1;
if( v20 < (unsigned __int64)v6 || v20 >= (unsigned __int64)v15 )
{
v3 = 70;
}
else
{
v21 = (unsigned __int64)v6 + v6[27];
v82 = v21;
if( (v21 & 7) != 0 )
{
v3 = 72;
}
else if( v21 < (unsigned __int64)v6 || v21 >= (unsigned __int64)v15 )
{
v3 = 73;
}
else
{
v22 = v21 + v6[29] - 1i64;
if( v22 < (unsigned __int64)v6 || v22 >= (unsigned __int64)v15 )
{
v3 = 74;
}
else
{
v23 = 96 * v8 + v21 - 1;
if( v23 < (unsigned __int64)v6 || v23 >= (unsigned __int64)v15 )
{
v3 = 75;
}
else
{
v88 = v6[31];
if( v88 > 7 )
{
v3 = 76;
}
else
{
v83 = 0;
v24 = 0;
v25 = 0;
while( 1 )
{
v26 = (int *)(v14 + 32i64 * v25);
v95 = v26;
v27 = v19 + (unsigned int)v26[3];
if( (v27 & 1) != 0 )
{
v3 = 77;
goto LABEL_67;
}
if( v27 < (unsigned __int64)v6 || v27 >= (unsigned __int64)v15 )
{
v3 = 80;
goto LABEL_67;
}
v28 = (unsigned int)v26[4];
if( !(_DWORD)v28 )
{
v3 = 90;
goto LABEL_67;
}
if( (unsigned int)v28 > 0x400 )
{
v3 = 100;
goto LABEL_67;
}
v29 = (unsigned int)(2 * v28 + 2) + v27 - 1;
if( v29 < (unsigned __int64)v6 || v29 >= (unsigned __int64)v15 )
{
v3 = 110;
goto LABEL_67;
}
if( *(_WORD *)(v27 + 2 * v28) )
{
v3 = 120;
goto LABEL_67;
}
v30 = v26[1];
if( v30 > 0x8000 )
{
v3 = 140;
goto LABEL_67;
}
if( v30 > (unsigned int)v13 )
{
v3 = 150;
goto LABEL_67;
}
v31 = *v26;
v84 = v13 - v30;
if( (_DWORD)v31 == -1 && v30 )
{
v3 = 152;
goto LABEL_67;
}
if( (_DWORD)v31 != v24 && (_DWORD)v31 != -1 )
{
v3 = 153;
goto LABEL_67;
}
v32 = v26[5];
v91 = v30 + v24;
if( (v32 & 0x7F00) == 0 && (v32 & 1) == 0 && (v32 & 0xFE) == 0 )
{
v3 = 155;
goto LABEL_67;
}
v33 = v26[5] & 1;
v89 = v33;
if( (v32 & 1) == 0 && !v26[2] )
{
v3 = 157;
goto LABEL_67;
}
v81 = 0;
v34 = *v26;
v35 = 0;
v36 = 0;
v37 = 0;
if( (int)v31 < (int)(v31 + v30) )
break;
LABEL_75:
if( v35 != v26[2] )
{
v3 = 185;
goto LABEL_67;
}
if( !v33 && (v37 != (unsigned __int8)v32 >> 1 || v36 != ((v32 >> 8) & 0x7F)) )
{
v3 = 187;
goto LABEL_67;
}
v6 = (unsigned int *)Scenario;
++v25;
LODWORD(v13) = v84;
v83 = v25;
if( v25 >= v90 )
{
v45 = v82;
v46 = 1;
if( v84 )
{
v3 = 190;
}
else
{
v47 = v92;
v48 = 0;
v49 = 0;
if( v92 )
{
while( 1 )
{
v50 = v82;
v51 = (unsigned int *)(v45 + 96i64 * v49++);
v52 = v49;
v53 = v51[4];
v93 = *((_QWORD *)v51 + 1);
if( v49 < v47 )
break;
LABEL_86:
v54 = v50 + *v51;
if( (v54 & 1) != 0 )
{
v3 = 195;
goto LABEL_67;
}
if( v54 < (unsigned __int64)Scenario || v54 >= v86 )
{
v3 = 200;
goto LABEL_67;
}
v55 = (_WORD *)(v54 + 2i64 * v51[1]);
if( (PF_SCENARIO_HEADER *)((char *)v55 + 1) < Scenario
|| (unsigned __int64)v55 + 1 >= v86 )
{
v3 = 210;
goto LABEL_67;
}
if( *v55 )
{
v3 = 220;
goto LABEL_67;
}
StringCchPrintfW(pszDest, 0x23ui64, (WCHAR *)L"\\VOLUME{%08lx%08lx-%08lx}");
v56 = (char *)pszDest - v54;
do
{
v57 = *(unsigned __int16 *)&v56[v54];
v58 = *(unsigned __int16 *)v54 - v57;
if( v58 )
break;
v54 += 2i64;
}
while( v57 );
if( v58 )
{
v3 = 222;
goto LABEL_67;
}
v59 = v82 + v51[5];
if( (v59 & 7) != 0 )
{
v3 = 225;
goto LABEL_67;
}
v6 = (unsigned int *)Scenario;
if( v59 < (unsigned __int64)Scenario || (v60 = v86, v59 >= v86) )
{
v3 = 230;
goto LABEL_67;
}
v61 = v51[6];
if( (unsigned int)v61 < 0x18 )
{
v3 = 240;
goto LABEL_67;
}
v62 = v61 + v59 - 1;
if( v62 < (unsigned __int64)Scenario || v62 >= v86 )
{
v3 = 245;
goto LABEL_67;
}
if( *(_DWORD *)v59 != 3 )
{
v3 = 250;
goto LABEL_67;
}
v63 = *(_DWORD *)(v59 + 4);
if( v63 > 0x84000 )
{
v3 = 260;
goto LABEL_67;
}
v64 = Scenario[31];
v65 = 0;
if( v64 )
{
v66 = v51 + 9;
v67 = v64;
do
{
v68 = *v66 + v66[7];
++v66;
v65 += v68;
--v67;
}
while( v67 );
v60 = v86;
}
if( v65 != v63 )
{
v3 = 265;
goto LABEL_67;
}
v69 = 24;
if( v63 )
v69 = 8 * v63 + 16;
if( v69 != (_DWORD)v61 )
{
v3 = 270;
goto LABEL_67;
}
v70 = v51[8];
if( v70 > 0x80000 )
{
v3 = 280;
goto LABEL_67;
}
v71 = 0;
if( v64 )
{
v72 = v51 + 16;
v73 = (unsigned int)Scenario[31];
do
{
v71 += *v72++;
--v73;
}
while( v73 );
}
if( v71 != v70 )
{
v3 = 281;
goto LABEL_67;
}
v48 += v71;
v74 = v82 + v51[7];
if( (v74 & 1) != 0 )
{
v3 = 283;
goto LABEL_67;
}
v75 = 0;
if( v70 )
{
while( v74 >= (unsigned __int64)Scenario && v74 < v60 )
{
if( v74 + 3 < (unsigned __int64)Scenario || v74 + 3 >= v60 )
{
v3 = 290;
goto LABEL_67;
}
v76 = *(unsigned __int16 *)v74;
if( (unsigned __int16)v76 >= 0x400u )
{
v3 = 300;
goto LABEL_67;
}
v77 = v74 + 2 * v76;
if( v77 + 3 < (unsigned __int64)Scenario || v77 + 3 >= v60 )
{
v3 = 310;
goto LABEL_67;
}
if( *(_WORD *)(v77 + 2) )
{
v3 = 320;
goto LABEL_67;
}
++v75;
v74 = v77 + 4;
if( v75 >= v70 )
goto LABEL_128;
}
v3 = 285;
goto LABEL_67;
}
LABEL_128:
v47 = Scenario[28];
if( v49 >= v47 )
goto LABEL_129;
v45 = v82;
}
while( !PfMetadataRecordIsEqual(v50 + 96i64 * v52, &v93, v53) )
{
v52 = v79 + 1;
if( v52 >= v80 )
goto LABEL_86;
}
v3 = 192;
}
else
{
LABEL_129:
if( v48 == v6[30] )
{
if( v48 > 0x80000 )
{
v3 = 340;
}
else
{
v78 = v6[53];
if( v6[54] )
v46 = 0;
if( ((_DWORD)v78 == 0) == v46 )
{
if( (_DWORD)v78
&& StringCbLengthW((WCHAR *)((char *)v6 + v78), v6[54], 0i64) < 0 )
{
v3 = 360;
}
else
{
v4 = 1;
}
}
else
{
v3 = 350;
}
}
}
else
{
v3 = 330;
}
}
}
goto LABEL_67;
}
v24 = v91;
v19 = v96;
v14 = v93;
}
v38 = *v26;
v39 = (int)(v31 + v30);
v40 = (int *)(v94 + 4 + 8 * v31);
while( 1 )
{
v41 = v36;
if( v38 < 0 || v34 >= v87 )
break;
if( v34 != (_DWORD)v31 && *(v40 - 1) <= (unsigned int)*(v40 - 3) )
{
v3 = 165;
goto LABEL_67;
}
v42 = *v40;
if( (*v40 & 1) == 0 && (((unsigned int)*v40 >> 4) & 7) > v88 )
{
v3 = 167;
goto LABEL_67;
}
if( (v42 & 0xE) == 0 )
{
v3 = 173;
goto LABEL_67;
}
if( (*v40 & 1) != 0 )
{
if( (v42 & 8) != 0 )
{
v3 = 175;
goto LABEL_67;
}
}
else
{
++v35;
v44 = 1 << (((unsigned int)*v40 >> 4) & 7);
if( (v42 & 4) != 0 )
v81 |= v44;
v36 |= v44;
if( (v42 & 2) == 0 )
v36 = v41;
}
++v34;
++v38;
v40 += 2;
if( v38 >= v39 )
{
v26 = v95;
v37 = v81;
v33 = v89;
v25 = v83;
v15 = (char *)v86;
goto LABEL_75;
}
}
v3 = 160;
}
}
}
}
}
}
}
}
}
}
}
else
{
v3 = 37;
}
}
else
{
v3 = 33;
}
}
}
else
{
v3 = 26;
}
}
else
{
v3 = 20;
}
LABEL_67:
*(_DWORD *)FailedCheck = v3;
return v4;
}