RtlpCopyLegacyContextX86

VOID __stdcall RtlpCopyLegacyContextX86(
        INT64 Operation,
        _X86_NT5_CONTEXT *Destination,
        UINT64 ContextFlags,
        _X86_NT5_CONTEXT *Source){
  __int64 v4; 
  _X86_NT5_CONTEXT *v5; 
  _X86_NT5_CONTEXT *v6; 
  __int128 v7; 

  *Destination = ContextFlags & 0x67FFFFFF;
  if( (_BYTE)Operation )
  {
    if( (ContextFlags & 0x40000000) != 0 )
      *Destination = ContextFlags & 0x67FFFFFF | *Source & 0x98000000;
    if( (ContextFlags & 0x10001) == 65537 )
    {
      Destination[45] = Source[45];
      Destination[46] = Source[46];
      Destination[47] = Source[47];
      Destination[48] = Source[48];
      Destination[49] = Source[49];
      Destination[50] = Source[50];
    }
    if( (ContextFlags & 0x10002) == 65538 )
    {
      Destination[39] = Source[39];
      Destination[40] = Source[40];
      Destination[41] = Source[41];
      Destination[43] = Source[43];
      Destination[42] = Source[42];
      Destination[44] = Source[44];
    }
    if( (ContextFlags & 0x10004) == 65540 )
    {
      Destination[35] = Source[35];
      Destination[36] = Source[36];
      Destination[37] = Source[37];
      Destination[38] = Source[38];
    }
    if( (ContextFlags & 0x10008) == 65544 )
    {
      *(_OWORD *)(Destination + 7) = *(_OWORD *)(Source + 7);
      *(_OWORD *)(Destination + 11) = *(_OWORD *)(Source + 11);
      *(_OWORD *)(Destination + 15) = *(_OWORD *)(Source + 15);
      *(_OWORD *)(Destination + 19) = *(_OWORD *)(Source + 19);
      *(_OWORD *)(Destination + 23) = *(_OWORD *)(Source + 23);
      *(_OWORD *)(Destination + 27) = *(_OWORD *)(Source + 27);
      *(_OWORD *)(Destination + 31) = *(_OWORD *)(Source + 31);
    }
    if( (ContextFlags & 0x10010) == 65552 )
    {
      Destination[1] = Source[1];
      Destination[2] = Source[2];
      Destination[3] = Source[3];
      Destination[4] = Source[4];
      Destination[5] = Source[5];
      Destination[6] = Source[6];
    }
    if( (ContextFlags & 0x10020) == 65568 )
    {
      v4 = 2i64;
      v5 = Destination + 51;
      v6 = Source + 51;
      do
      {
        *(_OWORD *)v5 = *(_OWORD *)v6;
        *((_OWORD *)v5 + 1) = *((_OWORD *)v6 + 1);
        *((_OWORD *)v5 + 2) = *((_OWORD *)v6 + 2);
        *((_OWORD *)v5 + 3) = *((_OWORD *)v6 + 3);
        *((_OWORD *)v5 + 4) = *((_OWORD *)v6 + 4);
        *((_OWORD *)v5 + 5) = *((_OWORD *)v6 + 5);
        *((_OWORD *)v5 + 6) = *((_OWORD *)v6 + 6);
        v5 += 32;
        v7 = *((_OWORD *)v6 + 7);
        v6 += 32;
        *((_OWORD *)v5 - 1) = v7;
        --v4;
      }
      while( v4 );
      *(_OWORD *)v5 = *(_OWORD *)v6;
      *((_OWORD *)v5 + 1) = *((_OWORD *)v6 + 1);
    }
  }
}

Referenced by:

RtlpCopyExtendedContext
RtlpCopyLegacyContext