PopMarshalSettingValues

INT64 __fastcall PopMarshalSettingValues(INT64 a1, INT64 a2, UINT64 a3, UINT64 *a4){
  unsigned int v5; 
  unsigned int v7; 
  __int64 v8; 
  __int64 i; 
  __int64 v10; 
  _DWORD *v11; 
  void *v12; 
  __int64 j; 
  PVOID v14; 
  unsigned int v15; 
  unsigned int v16; 
  __int64 k; 
  _DWORD *v18; 
  PVOID P[2]; 
  __int64 v22; 
  v5 = a3;
  *(_OWORD *)P = 0i64;
  v22 = 0i64;
  v7 = 0;
  v8 = dword_140C23D0C;
  for( i = 0i64; (unsigned int)i < 3; i = (unsigned int)(i + 1) )
  {
    v10 = (unsigned int)i;
    if( (*(_DWORD *)(a1 + 52) & 8) != 0 )
    {
      P[i] = *(PVOID *)(a1 + 8 * v8 + 64);
    }
    else
    {
      v12 = *(void **)(a1 + 8 * i + 64);
      P[i] = v12;
      v10 = (unsigned int)i;
      if( (_DWORD)i == 2 )
      {
        v10 = 2i64;
        if( !v12 )
          P[i] = P[1];
      }
    }
    v7 += 8;
    v11 = P[v10];
    if( v11 )
    {
      ++*v11;
      v7 += v11[1];
    }
  }
  if( v5 < v7 )
  {
    v16 = -1073741789;
  }
  else
  {
    for( j = 0i64; (unsigned int)j < 3; j = (unsigned int)(j + 1) )
    {
      v14 = P[j];
      if( v14 )
      {
        *(_DWORD *)a2 = *((_DWORD *)v14 + 2);
        *(_DWORD *)(a2 + 4) = *((_DWORD *)v14 + 1);
        v15 = *((_DWORD *)v14 + 1);
        memmove((UINT8 *)(a2 + 8), (UINT8 *)v14 + 12, v15);
      }
      else
      {
        *(_DWORD *)a2 = 0;
        *(_DWORD *)(a2 + 4) = 0;
        v15 = 0;
      }
      a2 += v15 + 8;
    }
    *(_DWORD *)a4 = v7;
    v16 = 0;
  }
  for( k = 0i64; (unsigned int)k < 3; k = (unsigned int)(k + 1) )
  {
    v18 = P[k];
    if( v18 )
    {
      if( (*v18)-- == 1 )
        ExFreePoolWithTag(v18, 0x74655350u);
    }
  }
  return v16;
}

Referenced by:

PopDispatchNotificationsToList
PopGetSettingValue