Program: 162961
Project: 162961
Buggy source:
final <KB,RV,VB extends RV,VBI,MVBI extends MetaBytesInterop<RV,? super VBI>>Object onKeyPresentOnReplace(ThreadLocalCopies copies,@NotNull SegmentState segmentState,KB key,long keySize,InstanceOrBytesToInstance<KB,K> toKey,GetValueInterops<VB,VBI,MVBI> getExpectedValueInterops,VB expectedValue,GetValueInterops<VB,VBI,MVBI> getNewValueInterops,VB newValue,ReadValue<RV> readValue,InstanceOrBytesToInstance<? super RV,V> toValue,long pos,long offset,MultiStoreBytes entry,MultiMap searchedHashLookup){
  long valueSizePos=entry.position();
  long valueSize=readValueSize(entry);
  long entryEndAddr=entry.positionAddr() + valueSize;
  RV prevValue;
  if (expectedValue != null) {
    VBI valueInterop=getExpectedValueInterops.getValueInterop(copies);
    MVBI metaValueInterop=getExpectedValueInterops.getMetaValueInterop(copies,valueInterop,expectedValue);
    if (metaValueInterop.size(valueInterop,expectedValue) != valueSize)     return Boolean.FALSE;
    if (!metaValueInterop.startsWith(valueInterop,entry,expectedValue))     return Boolean.FALSE;
    prevValue=expectedValue;
  }
 else {
    prevValue=readValue.readValue(copies,entry,null,valueSize);
  }
  VBI valueInterop=getNewValueInterops.getValueInterop(copies);
  MVBI metaValueInterop=getNewValueInterops.getMetaValueInterop(copies,valueInterop,newValue);
  long newValueSize=metaValueInterop.size(valueInterop,newValue);
  putValue(pos,offset,entry,valueSizePos,entryEndAddr,segmentState,metaValueInterop,valueInterop,newValue,newValueSize,searchedHashLookup);
  onPut(this,segmentState.pos);
  if (bytesEventListener != null) {
    long keyPos=metaDataBytes;
    bytesEventListener.onPut(entry,0L,keyPos,segmentState.valueSizePos,true);
  }
  if (eventListener != null)   eventListener.onPut(toKey.toInstance(copies,key,keySize),toValue.toInstance(copies,newValue,newValueSize),toValue.toInstance(copies,prevValue,valueSize));
  return expectedValue == null ? prevValue : Boolean.TRUE;
}

Fixed version (ground truth):
final <KB,RV,VB extends RV,VBI,MVBI extends MetaBytesInterop<RV,? super VBI>>Object onKeyPresentOnReplace(ThreadLocalCopies copies,@NotNull SegmentState segmentState,KB key,long keySize,InstanceOrBytesToInstance<KB,K> toKey,GetValueInterops<VB,VBI,MVBI> getExpectedValueInterops,VB expectedValue,GetValueInterops<VB,VBI,MVBI> getNewValueInterops,VB newValue,ReadValue<RV> readValue,InstanceOrBytesToInstance<? super RV,V> toValue,long pos,long offset,MultiStoreBytes entry,MultiMap searchedHashLookup){
  long valueSizePos=entry.position();
  long valueSize=valueSizeMarshaller.readSize(entry);
  long sizeOfEverythingBeforeValue=entry.position();
  alignment.alignPositionAddr(entry);
  long entryEndAddr=entry.positionAddr() + valueSize;
  RV prevValue;
  if (expectedValue != null) {
    VBI valueInterop=getExpectedValueInterops.getValueInterop(copies);
    MVBI metaValueInterop=getExpectedValueInterops.getMetaValueInterop(copies,valueInterop,expectedValue);
    if (metaValueInterop.size(valueInterop,expectedValue) != valueSize)     return Boolean.FALSE;
    if (!metaValueInterop.startsWith(valueInterop,entry,expectedValue))     return Boolean.FALSE;
    prevValue=expectedValue;
  }
 else {
    prevValue=readValue.readValue(copies,entry,null,valueSize);
  }
  VBI valueInterop=getNewValueInterops.getValueInterop(copies);
  MVBI metaValueInterop=getNewValueInterops.getMetaValueInterop(copies,valueInterop,newValue);
  long newValueSize=metaValueInterop.size(valueInterop,newValue);
  putValue(pos,offset,entry,valueSizePos,entryEndAddr,segmentState,metaValueInterop,valueInterop,newValue,newValueSize,searchedHashLookup,sizeOfEverythingBeforeValue);
  onPut(this,segmentState.pos);
  if (bytesEventListener != null) {
    long keyPos=metaDataBytes;
    bytesEventListener.onPut(entry,0L,keyPos,segmentState.valueSizePos,true);
  }
  if (eventListener != null)   eventListener.onPut(toKey.toInstance(copies,key,keySize),toValue.toInstance(copies,newValue,newValueSize),toValue.toInstance(copies,prevValue,valueSize));
  return expectedValue == null ? prevValue : Boolean.TRUE;
}