CcOkToAddWriteBehindThread

_EXTRA_WORKER_THREAD_ACTION __stdcall CcOkToAddWriteBehindThread(){
  __int64 v0; 
  __int64 v1; 
  __int64 v2; 
  _DWORD *v3; 
  unsigned int v4; 
  unsigned int v5; 
  unsigned int v6; 
  unsigned int v7; 
  __int64 v8; 
  _EXTRA_WORKER_THREAD_ACTION v9; 
  __int64 v10; 
  int v11; 
  int v12; 
  unsigned int v13; 
  int v14; 

  v1 = *(unsigned int *)(v0 + 320);
  v2 = *(_QWORD *)(v0 + 720);
  v3 = (_DWORD *)v0;
  v4 = *(_DWORD *)(v0 + 496);
  v5 = 0;
  v6 = *(_DWORD *)(v2 + 8 * v1);
  v7 = v6 - v4;
  *(_DWORD *)(v2 + 8 * v1) = v4;
  v8 = *(unsigned int *)(v0 + 320);
  v9 = NoAction;
  v10 = *(_QWORD *)(v0 + 720);
  if( v6 < v4 )
    v7 = 0;
  if( (_DWORD)v8 )
    v5 = *(_DWORD *)(v10 + 8i64 * (unsigned int)(v8 - 1) + 4);
  *(_DWORD *)(v10 + 8 * v8 + 4) = v7;
  if( v7 )
  {
    v11 = *(_DWORD *)(v0 + 728);
    if( v7 < v5 )
    {
      if( v11 > 0 )
        v11 = 0;
      v12 = v11 - 1;
    }
    else
    {
      if( v11 < 0 )
        v11 = 0;
      v12 = v11 + 1;
    }
    *(_DWORD *)(v0 + 728) = v12;
    if( v12 == 3 )
    {
      v9 = AddExtraThread;
      *(_DWORD *)(v0 + 728) = 0;
      v13 = *(_DWORD *)(v0 + 320);
      if( v13 < *(_DWORD *)(v0 + 324) )
      {
        *(_DWORD *)(v10 + 8i64 * (v13 + 1)) = *(_DWORD *)(v0 + 496);
        *(_DWORD *)(v10 + 8i64 * (unsigned int)(*(_DWORD *)(v0 + 320) + 1) + 4) = 0;
      }
    }
    else if( v12 == -3 )
    {
      v14 = *(_DWORD *)(v0 + 320);
      v9 = RemoveExtraThread;
      v3[182] = 0;
      if( v14 )
      {
        *(_DWORD *)(v10 + 8i64 * (unsigned int)(v14 - 1)) = v3[124];
        *(_DWORD *)(v10 + 8i64 * (unsigned int)(v3[80] - 1) + 4) = 0;
      }
    }
  }
  return v9;
}

Referenced by:

CcWorkerThread