RtlpInsertUCRBlock

VOID __fastcall RtlpInsertUCRBlock(INT64 a1, INT64 **a2){
  INT64 *v4; 
  __int64 *UCREntry; 
  INT64 *v6; 
  __int64 v7; 
  INT64 v8; 
  INT64 ***v9; 
  INT64 **v10; 
  INT64 *v11; 
  INT64 v12; 
  v4 = a2[5];
  if( v4 )
  {
    UCREntry = RtlpFindUCREntry(a1, (unsigned __int64)v4);
    v6 = (INT64 *)UCREntry[1];
    if( (__int64 *)*v6 == UCREntry )
    {
      *a2 = UCREntry;
      a2[1] = v6;
      *v6 = (INT64)a2;
      UCREntry[1] = (__int64)a2;
    }
    else
    {
      RtlpLogHeapFailure(13i64, 0i64, (UINT64)UCREntry, 0i64, *v6, 0i64);
    }
  }
  v7 = *((unsigned __int8 *)a2 - 2);
  if( (_BYTE)v7 )
    v8 = ((unsigned __int64)(a2 - 2) & 0xFFFFFFFFFFFF0000ui64) - (v7 << 16) + 0x10000;
  else
    v8 = a1;
  v9 = (INT64 ***)(v8 + 96);
  v10 = a2 + 2;
  v11 = *(INT64 **)(v8 + 96);
  v12 = v11[1];
  if( v12 == v8 + 96 )
  {
    *v10 = v11;
    v10[1] = (INT64 *)v9;
    v11[1] = (INT64)v10;
    *v9 = v10;
  }
  else
  {
    RtlpLogHeapFailure(13i64, 0i64, (UINT64)v9, v12, 0i64, 0i64);
  }
}

Referenced by:

RtlpCreateUCREntry
RtlpDeCommitFreeBlock