INT64 __fastcall MiInsertProcessVads(ULONG_PTR a1, _QWORD **a2){
_QWORD *v2;
unsigned int v3;
_QWORD *v6;
INT64 result;
v2 = *a2;
v3 = 0;
if( *a2 )
{
while( 1 )
{
v6 = (_QWORD *)*v2;
result = MiInsertVadCharges((__int64)v2, a1);
v3 = result;
if( (int)result < 0 )
break;
MiGetWsAndInsertVad(v2);
v2 = v6;
if( !v6 )
goto LABEL_4;
}
*a2 = v2;
}
else
{
LABEL_4:
*a2 = 0i64;
return v3;
}
return result;
}