memcmp

NTSTATUS __stdcall memcmp(const VOID *buf1, const VOID *buf2, UINT64 count){
  signed __int64 v3; 
  bool v4; 
  UINT64 v6; 
  unsigned __int64 v7; 
  UINT64 v8; 

  v3 = (_BYTE *)buf2 - (_BYTE *)buf1;
  if( count < 8 )
    goto LABEL_6;
  for( ; ((unsigned __int8)buf1 & 7) != 0; --count )
  {
    v4 = *(_BYTE *)buf1 < *((_BYTE *)buf1 + v3);
    if( *(_BYTE *)buf1 != *((_BYTE *)buf1 + v3) )
      return -v4 - (v4 - 1);
    buf1 = (char *)buf1 + 1;
  }
  if( !(count >> 3) )
  {
LABEL_6:
    if( !count )
      return 0;
    while( 1 )
    {
      v4 = *(_BYTE *)buf1 < *((_BYTE *)buf1 + v3);
      if( *(_BYTE *)buf1 != *((_BYTE *)buf1 + v3) )
        break;
      buf1 = (char *)buf1 + 1;
      if( !--count )
        return 0;
    }
    return -v4 - (v4 - 1);
  }
  v6 = count >> 5;
  if( count >> 5 )
  {
    while( 1 )
    {
      v7 = *(_QWORD *)buf1;
      if( *(_QWORD *)buf1 != *(_QWORD *)((char *)buf1 + v3) )
        break;
      v7 = *((_QWORD *)buf1 + 1);
      if( v7 != *(_QWORD *)((char *)buf1 + v3 + 8) )
        goto LABEL_24;
      v7 = *((_QWORD *)buf1 + 2);
      if( v7 != *(_QWORD *)((char *)buf1 + v3 + 16) )
        goto LABEL_23;
      v7 = *((_QWORD *)buf1 + 3);
      if( v7 != *(_QWORD *)((char *)buf1 + v3 + 24) )
      {
        buf1 = (char *)buf1 + 8;
LABEL_23:
        buf1 = (char *)buf1 + 8;
LABEL_24:
        buf1 = (char *)buf1 + 8;
        break;
      }
      buf1 = (char *)buf1 + 32;
      if( !--v6 )
      {
        count &= 0x1Fu;
        goto LABEL_18;
      }
    }
  }
  else
  {
LABEL_18:
    v8 = count >> 3;
    if( !(count >> 3) )
      goto LABEL_6;
    while( 1 )
    {
      v7 = *(_QWORD *)buf1;
      if( *(_QWORD *)buf1 != *(_QWORD *)((char *)buf1 + v3) )
        break;
      buf1 = (char *)buf1 + 8;
      if( !--v8 )
      {
        count &= 7u;
        goto LABEL_6;
      }
    }
  }
  v4 = _byteswap_uint64(v7) < _byteswap_uint64(*(_QWORD *)((char *)buf1 + v3));
  return -v4 - (v4 - 1);
}

Referenced by:

AlpcpEnterStateChangeEventMessageLog
AuthzBasepCompareOctetStringOperands
AuthzBasepEqualUnicodeStringCaseSensitive
AuthzBasepFindSecurityAttributeValue
BiExportEfiBootManager
BiUpdateEfiEntry
CmGetDeviceMappedPropertyFromComposite
CmpFindMatchingDescriptorCell
CmpGetBiosDate
CompareEventEntry
EtwpCompareGuid
EtwpGenerateFileName
EtwpStartLogger
EtwpUpdateDisallowedGuids
ExpKdPullRemoteFileForUser
ExpWnfFindScopeInstance
FsRtlIsDbcsInExpression
FsRtlNotifyFilterReportChange
HalMatchAcpiOemTableId
HalpAcpiDetectMachineSpecificActions
HalpAcpiGetRsdt
HalpAcpiIsCachedTableCompromised
IoRaiseInformationalHardError
IopIsKnownGoodLegacyFsFilter
IovpExamineIrpStackForwarding
KiDisplayBlueScreen
MiComputeBadImageHeaderType
MiIdealClusterPage
NtSetSystemInformation
ObLogSecurityDescriptor
PfSnEndProcessTrace
PfSnPrefetchCacheEntryUpdate
PiDcCompareUpdateProperties
PiDevCfgResolveVariableExpression
PiDmObjectProcessPropertyChange
PiDmObjectUpdateCachedObjectProperty
PiPnpRtlCmActionCallback
PiPnpRtlObjectActionCallback
PiSwDoesCreateChangesRequireReEnum
PipCheckSystemFirmwareUpdated
PnpProcessTargetDeviceEvent
PopApplyPolicy
PopEtAggregateFind
PropertyEval
RtlAreNamesEqual
RtlEqualSid
RtlFindAceBySid
RtlFindUnicodeSubstring
RtlReplaceSidInSd
RtlSidDominates
RtlSidHashLookup
RtlpCheckDynamicTimeZoneInformation
RtlpInternEntryMatch
RtlpIsNameInExpressionPrivate
RtlpOwnerAcesPresent
RtlpUpdateDynamicTimeZones
SLQueryLicenseValueInternal
SLUpdateLicenseDataInternal
SMKM_STORE::SmStCompareRegionDataCallback
SPCallServerHandleQueryPolicy
SdbpCheckMatchingRegistryValue
SeAccessCheckWithHintWithAdminlessChecks
SeExamineSacl
SepExamineSaclEx
SepMandatoryIntegrityCheck
SepMaximumAccessCheck
SepNormalAccessCheck
SepPotentialGlobalTableAttribute
SepSecureBootManifestCompareElements
SepSecureBootValidateBcdDataAgainstBcdRule
SepSidInSidAndAttributes
TraitsCompare
ViCtxEqualExtendedState
sub_1405F50F8