EtwpCreatePerfectHashFunction
__int64 __fastcall EtwpCreatePerfectHashFunction(char a1, UINT16 *a2, unsigned __int16 a3, __int64 a4){
unsigned __int8 v4;
__int64 v5;
_QWORD *v7;
unsigned __int16 v8;
UINT8 v9;
int v10;
unsigned __int16 v11;
__int16 v12;
char v13;
unsigned __int16 v14;
unsigned __int16 *p_Value;
__int64 v16;
unsigned __int16 *v17;
__int64 v18;
__int64 v19;
UINT8 v20;
UINT16 v21;
unsigned __int16 v22;
UINT16 v23;
VOID **PoolWithTag;
__int64 v25;
UINT16 MaxIndirectMappedCount;
int v29;
_QWORD *v30;
_ETW_PERFECT_HASH_TABLE_VALUE PerfectHashTable[128];
v4 = 0;
v5 = a3;
v7 = (_QWORD *)a4;
v30 = (_QWORD *)a4;
v8 = 0;
MaxIndirectMappedCount = 0;
v9 = 0;
v10 = a3 - 1;
v11 = 1;
v12 = 63;
v29 = 63;
if( v10 > 1 )
{
do
v11 = (2 * v11) | 1;
while( v11 < v10 );
if( v11 > 0x40u )
return 3221225473i64;
}
LABEL_4:
v13 = 0;
while( 1 )
{
v14 = 0;
p_Value = &PerfectHashTable[0].Value;
v16 = 128i64;
do
{
*p_Value = -1;
p_Value += 2;
--v16;
}
while( v16 );
if( (_WORD)v5 )
{
v17 = a2;
v18 = v5;
do
{
v19 = (unsigned __int16)(v11 & __ROR2__(*v17, v13));
if( PerfectHashTable[v19].Value == 0xFFFF )
{
++v14;
PerfectHashTable[v19].Value = *v17;
}
++v17;
--v18;
}
while( v18 );
v7 = v30;
v12 = v29;
}
v20 = v13;
v21 = v11;
if( v14 <= v8 )
v20 = v9;
if( v14 <= v8 )
v21 = v12;
v22 = v14;
v9 = v20;
if( v14 <= v8 )
v22 = v8;
v8 = v22;
if( v14 == (_WORD)v5 )
break;
++v13;
v12 = v21;
v29 = v21;
if( (unsigned __int8)v13 >= 0x10u )
{
v11 = (2 * v11) | 1;
if( v11 <= 0x40u )
goto LABEL_4;
break;
}
}
if( !v22 )
return 3221225473i64;
v23 = EtwpFillPerfectHashTable(a2, v5, v20, v21, PerfectHashTable, &MaxIndirectMappedCount);
PoolWithTag = ExAllocatePoolWithTag(0x200ui64, (unsigned __int16)(4 * v23 + 10), 1182233669i64);
if( !PoolWithTag )
return 3221225495i64;
*((_BYTE *)PoolWithTag + 1) = v9;
*((_WORD *)PoolWithTag + 1) = v21;
*((_WORD *)PoolWithTag + 2) = v23;
*(_BYTE *)PoolWithTag = a1 != 0;
if( v23 )
{
do
{
v25 = v4++;
*(_ETW_PERFECT_HASH_TABLE_VALUE *)((char *)PoolWithTag + 4 * v25 + 6) = PerfectHashTable[v25];
}
while( v4 < v23 );
}
*v7 = PoolWithTag;
return 0i64;
}Referenced by:
EtwpAllocateFilter