RtlCreateAtomTableEx

NTSTATUS __stdcall RtlCreateAtomTableEx(UINT64 NumberOfBuckets, UINT64 Flags, VOID **AtomTableHandle){
  NTSTATUS v3; 
  unsigned int v5; 
  int v6; 
  NTSTATUS result; 
  size_t v8; 
  _RTL_ATOM_TABLE *Atom; 
  _RTL_ATOM_TABLE *v10; 
  ULONGLONG v11; 

  v11 = 0i64;
  v3 = 0;
  v5 = Flags;
  if( *AtomTableHandle )
    return v3;
  v6 = 37;
  if( (unsigned int)NumberOfBuckets > 1 )
    v6 = NumberOfBuckets;
  result = RtlULongLongMult(0x30ui64, (unsigned int)(v6 - 1), &v11);
  if( result >= 0 )
  {
    v8 = v11 + 40;
    if( v11 + 40 < v11 )
      return -1073741675;
    Atom = (_RTL_ATOM_TABLE *)RtlpAllocateAtom(v11 + 40, 0x546D7441ui64);
    v10 = Atom;
    if( !Atom )
      return -1073741801;
    memset(Atom, 0i64, v8);
    v10->NumberOfBuckets = v6;
    if( RtlpInitializeHandleTableForAtomTable(v10) )
    {
      RtlpInitializeLockAtomTable(v10);
      v10->Signature = 1836020801;
      v10->ReferenceCount = 1;
      v10->Flags = v5;
      *AtomTableHandle = v10;
    }
    else
    {
      v3 = -1073741801;
      RtlpFreeAtom(v10);
    }
    return v3;
  }
  return result;
}

Referenced by:

RtlCreateAtomTable