sub_1409601E0
INT64 __fastcall sub_1409601E0(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
int v4;
unsigned int v7;
unsigned int *v8;
unsigned int v9;
signed int v10;
unsigned int *v11;
unsigned int i;
__int64 v13;
unsigned int *v14;
unsigned int v15;
__int64 *v16;
__int64 *v17;
unsigned int v18;
unsigned int *v19;
unsigned int j;
__int64 v21;
unsigned int *v22;
unsigned int v23;
unsigned int *v24;
unsigned int *v25;
unsigned int k;
__int64 v27;
unsigned int *v28;
unsigned int v29;
unsigned int *v30;
unsigned int m;
__int64 v32;
unsigned int *v33;
unsigned int v34;
unsigned int *v35;
void *PoolWithTag;
void *v37;
int v38;
unsigned int v39;
unsigned int v40;
unsigned int v41;
int v42;
unsigned int v43;
unsigned int v44;
unsigned int v45;
VOID *v46;
__int64 v47;
int v48;
int v49;
unsigned int v50;
int v51;
unsigned int v52;
unsigned int v53;
_DWORD *v54;
unsigned int v55;
__int64 v56;
unsigned int v57;
int v58;
unsigned int v59;
unsigned int v60;
unsigned __int64 v61;
unsigned int v62;
__int64 v63;
UINT8 *v64;
__int64 v65;
int v66;
unsigned int v67;
unsigned int v68;
__int64 v69;
unsigned int v70;
int v71;
unsigned int v72;
unsigned int v73;
unsigned __int64 v74;
unsigned int v75;
unsigned int v76;
_DWORD *n;
unsigned int v78;
int v80;
void *Src;
__int64 v82;
unsigned int Size;
v4 = 0;
v82 = 0i64;
Size = 0;
v7 = 0;
v8 = *(unsigned int **)(a1 + 8);
v9 = 0;
Src = 0i64;
v80 = 0;
if( v8 && *(_DWORD *)a1 > 3u )
{
v11 = v8;
for( i = 0; i < 3; ++i )
{
v13 = *v11;
v14 = v11 + 1;
if( v11 + 1 < v11 )
goto LABEL_14;
v11 = (unsigned int *)((char *)v14 + v13);
if( (unsigned int *)((char *)v14 + v13) < v14 )
goto LABEL_14;
}
v15 = *v11;
v16 = (__int64 *)(v11 + 1);
if( v11 + 1 < v11 )
{
LABEL_14:
v10 = -1073741675;
}
else
{
v17 = 0i64;
if( v15 )
v17 = v16;
v10 = 0;
if( v15 != 8 )
return(unsigned int)-1073741789;
v82 = *v17;
}
}
else
{
v10 = -1073741811;
}
if( v10 < 0 )
return(unsigned int)v10;
if( !v8 )
return(unsigned int)-1073741811;
v18 = *(_DWORD *)a1;
if( *(_DWORD *)a1 <= 4u )
return(unsigned int)-1073741811;
v19 = v8;
for( j = 0; j < 4; ++j )
{
v21 = *v19;
v22 = v19 + 1;
if( v19 + 1 < v19 )
return(unsigned int)-1073741675;
v19 = (unsigned int *)((char *)v22 + v21);
if( (unsigned int *)((char *)v22 + v21) < v22 )
return(unsigned int)-1073741675;
}
v23 = *v19;
if( v19 + 1 < v19 )
return(unsigned int)-1073741675;
v24 = 0i64;
if( v23 )
v24 = v19 + 1;
if( v18 <= 5 )
return(unsigned int)-1073741811;
v25 = v8;
for( k = 0; k < 5; ++k )
{
v27 = *v25;
v28 = v25 + 1;
if( v25 + 1 < v25 )
return(unsigned int)-1073741675;
v25 = (unsigned int *)((char *)v28 + v27);
if( (unsigned int *)((char *)v28 + v27) < v28 )
return(unsigned int)-1073741675;
}
v29 = *v25;
if( v25 + 1 < v25 )
return(unsigned int)-1073741675;
v30 = 0i64;
if( v29 )
v30 = v25 + 1;
if( v18 > 6 )
{
for( m = 0; m < 6; ++m )
{
v32 = *v8;
v33 = v8 + 1;
if( v8 + 1 < v8 )
goto LABEL_45;
v8 = (unsigned int *)((char *)v33 + v32);
if( (unsigned int *)((char *)v33 + v32) < v33 )
goto LABEL_45;
}
v34 = *v8;
if( v8 + 1 < v8 )
{
LABEL_45:
v10 = -1073741675;
goto LABEL_46;
}
v35 = 0i64;
if( v34 )
v35 = v8 + 1;
v10 = 0;
if( v34 == 4 )
{
v9 = *v35;
Size = *v35;
goto LABEL_46;
}
return(unsigned int)-1073741789;
}
v10 = -1073741811;
LABEL_46:
if( v10 >= 0 )
{
if( v9 )
{
PoolWithTag = ExAllocatePoolWithTag(PagedPool, v9, 0x20534C53ui64);
Src = PoolWithTag;
if( !PoolWithTag )
return(unsigned int)-1073741801;
memset((INT64)PoolWithTag, 0i64);
v9 = Size;
}
else
{
v4 = 1;
}
if( qword_140D2C448 )
{
v37 = 0i64;
if( !v4 )
v37 = Src;
v38 = qword_140D2C448(v24, v23, v30, v29, v37, v9, &v80);
}
else
{
v38 = -1073741637;
}
v39 = Size + 4;
if( Size >= 0xFFFFFFFC )
{
v10 = -1073741675;
}
else
{
if( v39 >= 0xFFFFFFEC || (v7 = Size + 32, Size + 32 < Size + 24) )
{
v10 = -1073741675;
goto LABEL_147;
}
v10 = 0;
}
if( v10 < 0 )
{
LABEL_147:
if( Src )
ExFreePoolWithTag(Src, 0x20534C53u);
return(unsigned int)v10;
}
v40 = 0;
if( v7 >= 0xFFFFFFF8 )
goto LABEL_146;
v41 = (v7 + 15) & 0xFFFFFFF8;
if( v41 >= v7 + 8 )
{
v40 = v41 + 8;
if( v41 + 8 < v41 )
goto LABEL_74;
v10 = 0;
}
else
{
v10 = -1073741675;
}
if( v10 < 0 )
goto LABEL_147;
v42 = *(_DWORD *)(a2 + 16);
v43 = v40 + 4;
v44 = v40 + 8;
if( v44 >= v43 )
{
v45 = v44 + v42;
if( v44 + v42 >= v44 && v45 + 4 >= v45 )
{
v10 = v45 + 4 + *(_DWORD *)(a2 + 32) < v45 + 4 ? 0xC0000095 : 0;
goto LABEL_75;
}
}
LABEL_74:
v10 = -1073741675;
LABEL_75:
if( v10 < 0 )
goto LABEL_147;
if( !a4 )
{
v10 = -1073741811;
goto LABEL_147;
}
v10 = 0;
*(_DWORD *)(a4 + 4) = v7;
if( v7 )
{
v46 = ExAllocatePoolWithTag(PagedPool, v7, 0x20534C53ui64);
if( v46 )
{
*(_QWORD *)(a4 + 8) = v46;
*(_DWORD *)a4 = 0;
}
else
{
v10 = -1073741801;
}
}
else
{
v10 = -1073741762;
}
if( v10 < 0 )
goto LABEL_147;
v47 = *(_QWORD *)(a4 + 8);
v48 = v38 | 0x10000000;
v49 = -1;
if( v47 )
{
v53 = 0;
v54 = *(_DWORD **)(a4 + 8);
if( *(_DWORD *)a4 )
{
while( 1 )
{
v55 = *v54 + 4;
if( *v54 >= 0xFFFFFFFC )
break;
if( (_DWORD *)((char *)v54 + v55) < v54 )
goto LABEL_146;
++v53;
v54 = (_DWORD *)((char *)v54 + v55);
if( v53 >= *(_DWORD *)a4 )
goto LABEL_93;
}
v10 = -1073741675;
}
else
{
LABEL_93:
if( v54 + 1 < v54 )
goto LABEL_146;
v10 = 0;
if( (unsigned __int64)(v54 + 2) > v47 + (unsigned __int64)*(unsigned int *)(a4 + 4) )
goto LABEL_95;
*v54 = 4;
v54[1] = v48;
++*(_DWORD *)a4;
}
}
else
{
v50 = *(_DWORD *)(a4 + 4);
v51 = -1;
v52 = v50 + 8;
if( v50 + 8 >= v50 )
v51 = v50 + 8;
v10 = v52 < v50 ? 0xC0000095 : 0;
*(_DWORD *)(a4 + 4) = v51;
if( v52 >= v50 )
{
++*(_DWORD *)a4;
goto LABEL_99;
}
}
if( v10 < 0 )
goto LABEL_147;
LABEL_99:
v56 = *(_QWORD *)(a4 + 8);
if( v56 )
{
v60 = 0;
v61 = *(_QWORD *)(a4 + 8);
if( *(_DWORD *)a4 )
{
while( 1 )
{
v62 = *(_DWORD *)v61 + 4;
if( *(_DWORD *)v61 >= 0xFFFFFFFC )
break;
if( v61 + v62 < v61 )
goto LABEL_146;
++v60;
v61 += v62;
if( v60 >= *(_DWORD *)a4 )
goto LABEL_108;
}
v10 = -1073741675;
}
else
{
LABEL_108:
if( v61 + 4 < v61 )
goto LABEL_146;
v10 = 0;
if( v61 + 12 > v56 + (unsigned __int64)*(unsigned int *)(a4 + 4) )
goto LABEL_95;
v63 = v82;
*(_DWORD *)v61 = 8;
*(_QWORD *)(v61 + 4) = v63;
++*(_DWORD *)a4;
}
}
else
{
v57 = *(_DWORD *)(a4 + 4);
v58 = -1;
v59 = v57 + 12;
if( v57 + 12 >= v57 )
v58 = v57 + 12;
v10 = v59 < v57 ? 0xC0000095 : 0;
*(_DWORD *)(a4 + 4) = v58;
if( v59 >= v57 )
{
++*(_DWORD *)a4;
goto LABEL_112;
}
}
if( v10 < 0 )
goto LABEL_147;
LABEL_112:
v64 = (UINT8 *)Src;
if( Src )
{
if( !Size )
goto LABEL_114;
}
else if( Size )
{
LABEL_114:
v10 = -1073741811;
goto LABEL_115;
}
v69 = *(_QWORD *)(a4 + 8);
if( v69 )
{
v73 = 0;
v74 = *(_QWORD *)(a4 + 8);
if( !*(_DWORD *)a4 )
{
LABEL_134:
if( v74 + 4 < v74 )
goto LABEL_146;
v10 = 0;
if( v74 + Size + 4i64 > v69 + (unsigned __int64)*(unsigned int *)(a4 + 4) )
goto LABEL_95;
*(_DWORD *)v74 = Size;
if( v64 )
memmove((UINT8 *)(v74 + 4), v64, Size);
++*(_DWORD *)a4;
goto LABEL_115;
}
while( 1 )
{
v75 = *(_DWORD *)v74 + 4;
if( *(_DWORD *)v74 >= 0xFFFFFFFC )
break;
if( v74 + v75 < v74 )
goto LABEL_146;
++v73;
v74 += v75;
if( v73 >= *(_DWORD *)a4 )
goto LABEL_134;
}
}
else if( v39 >= 4 )
{
v70 = *(_DWORD *)(a4 + 4);
v71 = -1;
v72 = v70 + v39;
if( v70 + v39 >= v70 )
v71 = v70 + v39;
v10 = v72 < v70 ? 0xC0000095 : 0;
*(_DWORD *)(a4 + 4) = v71;
if( v72 >= v70 )
{
++*(_DWORD *)a4;
goto LABEL_116;
}
LABEL_115:
if( v10 < 0 )
goto LABEL_147;
LABEL_116:
v65 = *(_QWORD *)(a4 + 8);
v66 = v80;
if( !v65 )
{
v67 = *(_DWORD *)(a4 + 4);
v68 = v67 + 8;
if( v67 + 8 >= v67 )
v49 = v67 + 8;
v10 = v68 < v67 ? 0xC0000095 : 0;
*(_DWORD *)(a4 + 4) = v49;
if( v68 >= v67 )
{
++*(_DWORD *)a4;
v10 = 0;
}
goto LABEL_147;
}
v76 = 0;
for( n = *(_DWORD **)(a4 + 8); v76 < *(_DWORD *)a4; n = (_DWORD *)((char *)n + v78) )
{
v78 = *n + 4;
if( *n >= 0xFFFFFFFC || (_DWORD *)((char *)n + v78) < n )
goto LABEL_146;
++v76;
}
if( n + 1 >= n )
{
v10 = 0;
if( (unsigned __int64)(n + 2) <= v65 + (unsigned __int64)*(unsigned int *)(a4 + 4) )
{
*n = 4;
n[1] = v66;
++*(_DWORD *)a4;
goto LABEL_147;
}
LABEL_95:
v10 = -1073741789;
goto LABEL_147;
}
LABEL_146:
v10 = -1073741675;
goto LABEL_147;
}
v10 = -1073741675;
goto LABEL_115;
}
return(unsigned int)v10;
}Referenced by:
sub_1405F50F8