RtlpInternEntryCreate

_WORD *__fastcall RtlpInternEntryCreate(__int64 a1, __int64 a2, __int64 a3, __int64 a4){
  unsigned __int64 v4; 
  _WORD *v7; 
  unsigned __int64 v8; 
  _WORD *v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  char *v16; 

  v4 = a4 - *(_QWORD *)a2;
  if( (unsigned __int64)(*(_QWORD *)a2 - 32i64) > 0xFFE0 || v4 > 0x40000000 )
    return 0i64;
  v7 = (_WORD *)(**(__int64(__fastcall ***)(__int64, __int64))(a1 + 16))(a1, a4);
  v8 = 0i64;
  v9 = v7;
  if( v7 )
  {
    memset(v7, 0i64, *(_QWORD *)a2);
    v9[12] = *(_WORD *)a2;
    v10 = (*((_QWORD *)v9 + 3) ^ (v4 << 16)) & 0x3FFFFFFF0000i64;
    *((_QWORD *)v9 + 1) = a3;
    *((_QWORD *)v9 + 3) ^= v10;
    *((_QWORD *)v9 + 2) = 1i64;
    *(_DWORD *)(a2 + 24) |= 1u;
    v11 = (unsigned __int16)*((_DWORD *)v9 + 6);
    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((char *)v9 + v14, 0i64, v15 - v14);
        v16 = (char *)v9 + v15;
        memmove((char *)v9 + v15, *(const VOID **)(v12 + v13), *(_QWORD *)(v12 + v13 + 16));
        v11 = *(_QWORD *)(v12 + v13 + 16) + v15;
        ++v8;
        *(_QWORD *)(v12 + v13 + 8) = v16;
        v12 += 32i64;
      }
      while( v8 < *(_QWORD *)(a2 + 16) );
    }
    return v9;
  }
  return(_WORD *)v8;
}

Referenced by:

RtlInternTableIntern