RtlExtractBitMapEx

VOID __fastcall RtlExtractBitMapEx(_QWORD *a1, INT64 a2, UINT64 a3, UINT64 a4){
  unsigned __int64 v4; 
  UINT64 v8; 
  unsigned __int64 v9; 
  unsigned __int64 v10; 
  UINT64 v11; 
  __int64 *v12; 
  UINT64 v13; 
  __int64 *v14; 
  __int64 v15; 
  unsigned __int64 v16; 
  unsigned __int64 v17; 
  unsigned __int64 v18; 
  __int64 v19; 
  __int64 v20; 
  v4 = *(_QWORD *)a2;
  if( a4 > *a1 - a3 )
    a4 = *a1 - a3;
  if( a4 <= v4 )
    v4 = a4;
  if( v4 )
  {
    v8 = a3 >> 3;
    if( (a3 & 7) != 0 )
    {
      v12 = *(__int64 **)(a2 + 8);
      v13 = a3 & 0x3F;
      v14 = (__int64 *)(a1[1] + 8 * (a3 >> 6));
      v15 = 1i64 << v13;
      if( v4 >= 0x40 )
      {
        v16 = v4 >> 6;
        v4 += -64i64 * (v4 >> 6);
        do
        {
          v17 = ~(v15 - 1) & *v14++;
          v18 = v17 >> v13;
          *v12 = v18;
          *v12++ = v18 | (((v15 - 1) & *v14) << (64 - (unsigned __int8)v13));
          --v16;
        }
        while( v16 );
      }
      if( v4 )
      {
        v19 = *v14;
        v20 = *v12 & ~((1i64 << v4) - 1);
        if( v4 > 64 - v13 )
          *v12 = ((v19 & (unsigned __int64)~(v15 - 1)) >> v13) | ((v14[1] & ((1i64 << ((unsigned __int8)v4
                                                                                     + (unsigned __int8)v13
                                                                                     - 64))
                                                                           - 1)) << (64 - (unsigned __int8)v13)) | v20;
        else
          *v12 = v20 | ((v19 & (unsigned __int64)(((1i64 << v4) - 1) << v13)) >> v13);
      }
    }
    else
    {
      v9 = v4;
      v10 = v4 & 7;
      v11 = v9 >> 3;
      if( v11 )
        memmove(*(UINT8 **)(a2 + 8), (UINT8 *)(v8 + a1[1]), v11);
      if( v10 )
        *(_BYTE *)(v11 + *(_QWORD *)(a2 + 8)) = *(_BYTE *)(v8 + a1[1] + v11) & ((1 << v10) - 1) | *(_BYTE *)(v11 + *(_QWORD *)(a2 + 8)) & ~((1 << v10) - 1);
    }
  }
}

Referenced by:

RtlShiftLeftBitMapEx