PfpFlushEventBuffers

NTSTATUS __stdcall PfpFlushEventBuffers(){
  _SLIST_ENTRY *v0; 
  int v1; 
  _SLIST_ENTRY *v2; 
  _SLIST_ENTRY *v3; 
  _SLIST_ENTRY *v4; 
  _SLIST_ENTRY *v5; 
  _SLIST_ENTRY *v6; 
  _SLIST_ENTRY *v9; 
  INT64 a5; 

  v0 = 0i64;
  v1 = 0;
  PfFbBufferListFlushStandby((_SLIST_ENTRY *)&stru_140C4DB30 + 499);
  RtlpInterlockedFlushSList();
  v3 = v2;
  if( v2 )
  {
    do
    {
      v4 = v3;
      v3 = v3->Next;
      v4->Next = v0;
      v0 = v4;
    }
    while( v3 );
    while( 1 )
    {
      v5 = v0;
      v0 = v0->Next;
      v6 = v5 + 3;
      if( *((_DWORD *)&v5[2].Next + 2) )
        break;
LABEL_6:
      if( v1 < 0 )
        goto LABEL_9;
      LODWORD(a5) = 1;
      PfFbBufferListInsertInFree(
        (_EX_RUNDOWN_REF *)&stru_140C4DB30 + 998,
        v5,
        (unsigned int)(LODWORD(v5[2].Next) - (_DWORD)v5),
        *((unsigned int *)&v5[2].Next + 3),
        a5);
      if( !v0 )
        return v1;
    }
    while( 1 )
    {
      v1 = PfpCopyEvent(v6);
      if( v1 < 0 )
        break;
      v6 += (LODWORD(v6->Next) >> 2) & 0x3FF;
      if( (*((_DWORD *)&v5[2].Next + 2))-- == 1 )
        goto LABEL_6;
    }
LABEL_9:
    memmove(&v5[3], v6, LODWORD(v5[2].Next) - (_DWORD)v6);
    PfTFullEventListAdd(v5);
    while( v0 )
    {
      v9 = v0;
      v0 = v0->Next;
      PfTFullEventListAdd(v9);
    }
  }
  return v1;
}

Referenced by:

PfpFlushBuffers