RtlCompareMemory

SIZE_T __stdcall RtlCompareMemory(VOID *Source1, VOID *Source2, SIZE_T Length){
  _BYTE *v3; 
  _BYTE *v4; 
  __int64 v5; 
  bool v6; 
  SIZE_T v7; 
  bool v8; 
  bool v9; 
  SIZE_T v10; 
  SIZE_T v11; 
  bool v13; 
  SIZE_T v14; 
  v3 = Source1;
  v4 = Source2;
  if( (((unsigned __int8)Source1 ^ (unsigned __int8)Source2) & 7) != 0 || Length < 8 )
  {
    v13 = Length == 0;
    if( Length )
    {
      v14 = Length;
      do
      {
        if( !v14 )
          break;
        v13 = *v3++ == *v4++;
        --v14;
      }
      while( v13 );
      if( !v13 )
        Length -= v14 + 1;
    }
    return Length;
  }
  else
  {
    v5 = -(int)Source1 & 7;
    if( (_DWORD)v5 )
    {
      Length -= (unsigned int)v5;
      v6 = Length == 0;
      do
      {
        if( !v5 )
          break;
        v6 = *v3++ == *v4++;
        --v5;
      }
      while( v6 );
      if( !v6 )
        goto LABEL_19;
    }
    v7 = Length & 0xFFFFFFFFFFFFFFF8ui64;
    if( (Length & 0xFFFFFFFFFFFFFFF8ui64) != 0 )
    {
      Length -= v7;
      v7 >>= 3;
      v8 = v7 == 0;
      do
      {
        if( !v7 )
          break;
        v8 = *(_QWORD *)v3 == *(_QWORD *)v4;
        v3 += 8;
        v4 += 8;
        --v7;
      }
      while( v8 );
      if( !v8 )
      {
        v3 -= 8;
        v4 -= 8;
        v7 = 8 * (v7 + 1);
      }
    }
    v9 = v7 + Length == 0;
    v10 = v7 + Length;
    if( v10 )
    {
      v11 = v10;
      do
      {
        if( !v11 )
          break;
        v9 = *v3++ == *v4++;
        --v11;
      }
      while( v9 );
      if( !v9 )
LABEL_19:
        --v4;
    }
    return v4 - (_BYTE *)Source2;
  }
}

Referenced by:

AlpcpExposeWorkOnBehalfAttribute
BiUpdateBcdObject
CmpCompareNewValueDataAgainstKCBCache
CmpFilterAcpiDockingState
CmpTransUowIsEqual
CompareNamesCaseSensitive
EtwpCalculateUpdateNotification
EtwpClearSessionAndUnreferenceEntry
EtwpTraceStackKey
EtwpTrackBinaryForSession
ExCovReadjustUnloadedModuleEntry
ExpCovIsModulePresent
HalpAuditSlicTables
HalpGenericErrorSourceRecovery
IoReportTargetDeviceChange
IoReportTargetDeviceChangeAsynchronous
IopPnPDispatch
MiCompareUserSidHotPatchNodes
NtAlpcOpenSenderProcess
NtAlpcOpenSenderThread
ObpCompareEntryLevel2
ObpGetTraceIndex
PiDrvDbQuerySyncNodesUpdated
PipGenerateContainerID
PipMigratePnpState
PnpBusTypeGuidGetIndex
PnpCompareInterruptInformation
PnpDeviceRaisePropertyChangeEventWorker
PnpIsNullGuid
PnpNotifyDeviceClassChange
PnpNotifyHwProfileChange
PnpNotifyTargetDeviceChange
PnpRequestHwProfileChangeNotification
PopArePowerSettingsEqual
PopInitSIdle
PpmCompareAndApplyPolicySettings
PpmPerfCalculateQosClassPolicies
RtlGetAppContainerSidType
RtlIsCapabilitySid
RtlIsPackageSid
RtlNormalizeSecurityDescriptor
RtlpHpSizeHeap
RtlpStdLogCapturedStackTrace
SLUpdateLicenseDataInternal
SPCallServerHandleFileIntegrityQuery
SeSecurityDescriptorChangedAuditAlarm
SepCheckCapabilities
SepIsAclEqual
SepIsCapabilitySid
SepIsPackageSid
SepNormalAccessCheck
VfUtilEqualUnicodeString
VhdiInitializeBootDisk
ViCheckTag
ViCopyBackModifiedBuffer
ViDdiDispatchWmiQueryAllData
WbInitializeEncryptionSegment
WheaGetErrPacketFromErrRecord
WmipParseSysIdTable