RtlpInternEntryCreate

_WORD *__fastcall RtlpInternEntryCreate(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
  unsigned __int64 v4; 
  INT64 v7; 
  _WORD *v8; 
  INT64 v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  __int64 v16; 
  v4 = a4 - *(_QWORD *)a2;
  if( (unsigned __int64)(*(_QWORD *)a2 - 32i64) > 0xFFE0 || v4 > 0x40000000 )
    return 0i64;
  v7 = (**(__int64(__fastcall ***)(INT64, INT64))(a1 + 16))(a1, a4);
  v8 = 0i64;
  v9 = v7;
  if( v7 )
  {
    memset(v7, 0i64);
    *(_WORD *)(v9 + 24) = *(_WORD *)a2;
    v10 = (*(_QWORD *)(v9 + 24) ^ (v4 << 16)) & 0x3FFFFFFF0000i64;
    *(_QWORD *)(v9 + 8) = a3;
    *(_QWORD *)(v9 + 24) ^= v10;
    *(_QWORD *)(v9 + 16) = 1i64;
    *(_DWORD *)(a2 + 24) |= 1u;
    v11 = (unsigned __int16)*(_DWORD *)(v9 + 24);
    if( *(_QWORD *)(a2 + 16) )
    {
      v12 = 0i64;
      do
      {
        v13 = *(_QWORD *)(a2 + 8);
        v14 = v11;
        v15 = *(_QWORD *)(v12 + v13 + 24)
            - ((*(_QWORD *)(v12 + v13 + 24) - 1i64) & (*(_QWORD *)(v12 + v13 + 24) + v11 - 1))
            + v11
            - 1;
        if( v15 != v14 )
          memset(v14 + v9, 0i64);
        v16 = v15 + v9;
        memmove((UINT8 *)(v15 + v9), *(UINT8 **)(v12 + v13), *(_QWORD *)(v12 + v13 + 16));
        v11 = *(_QWORD *)(v12 + v13 + 16) + v15;
        v8 = (_WORD *)((char *)v8 + 1);
        *(_QWORD *)(v12 + v13 + 8) = v16;
        v12 += 32i64;
      }
      while( (unsigned __int64)v8 < *(_QWORD *)(a2 + 16) );
    }
    return(_WORD *)v9;
  }
  return v8;
}

Referenced by:

RtlInternTableIntern