Program: 149700
Project: 149700
Buggy source:
/** 
 * Copy copyBytes from src to dst. Assumption either the ranges are non overlapping, or src >= dst + 4. Also, src and dst are 4 byte aligned and numBytes is a multiple of 4.
 * @param dst the destination addr
 * @param src the source addr
 * @param numBytes the number of bytes top copy
 */
public static void aligned32Copy(Address dst,Address src,int copyBytes){
  if (VM.VerifyAssertions) {
    VM._assert(copyBytes >= 0);
    VM._assert((copyBytes & (BYTES_IN_INT - 1)) == 0);
    VM._assert(src.toWord().and(Word.fromIntZeroExtend(BYTES_IN_INT - 1)).isZero());
    VM._assert(dst.toWord().and(Word.fromIntZeroExtend(BYTES_IN_INT - 1)).isZero());
    VM._assert(src.plus(copyBytes).LE(dst) || src.GE(dst.plus(BYTES_IN_INT)));
  }
  if (USE_NATIVE && copyBytes > NATIVE_THRESHOLD) {
    memcopy(dst,src,copyBytes);
  }
 else {
    Offset numBytes=Offset.fromIntSignExtend(copyBytes);
    if (BYTES_IN_COPY == 8 && copyBytes != 0) {
      Word wordMask=Word.fromIntZeroExtend(BYTES_IN_COPY - 1);
      Word srcAlignment=src.toWord().and(wordMask);
      if (srcAlignment.EQ(dst.toWord().and(wordMask))) {
        Offset i=Offset.zero();
        if (srcAlignment.EQ(Word.fromIntZeroExtend(BYTES_IN_INT))) {
          copy4Bytes(dst.plus(i),src.plus(i));
          i=i.plus(BYTES_IN_INT);
        }
        Word endAlignment=srcAlignment.plus(numBytes).and(wordMask);
        numBytes=numBytes.minus(endAlignment.toOffset());
        for (; i.sLT(numBytes); i=i.plus(BYTES_IN_COPY)) {
          copy8Bytes(dst.plus(i),src.plus(i));
        }
        if (!endAlignment.isZero()) {
          copy4Bytes(dst.plus(i),src.plus(i));
        }
        return;
      }
    }
    for (Offset i=Offset.zero(); i.sLT(numBytes); i=i.plus(BYTES_IN_INT)) {
      copy4Bytes(dst.plus(i),src.plus(i));
    }
  }
}

Fixed version (ground truth):
/** 
 * Copy copyBytes from src to dst. Assumption either the ranges are non overlapping, or src >= dst + 4. Also, src and dst are 4 byte aligned and numBytes is a multiple of 4.
 * @param dst the destination addr
 * @param src the source addr
 * @param copyBytes the number of bytes top copy
 */
public static void aligned32Copy(Address dst,Address src,int copyBytes){
  if (VM.VerifyAssertions) {
    VM._assert(copyBytes >= 0);
    VM._assert((copyBytes & (BYTES_IN_INT - 1)) == 0);
    VM._assert(src.toWord().and(Word.fromIntZeroExtend(BYTES_IN_INT - 1)).isZero());
    VM._assert(dst.toWord().and(Word.fromIntZeroExtend(BYTES_IN_INT - 1)).isZero());
    VM._assert(src.plus(copyBytes).LE(dst) || src.GE(dst.plus(BYTES_IN_INT)));
  }
  if (USE_NATIVE && copyBytes > NATIVE_THRESHOLD) {
    memcopy(dst,src,copyBytes);
  }
 else {
    Offset numBytes=Offset.fromIntSignExtend(copyBytes);
    if (BYTES_IN_COPY == 8 && copyBytes != 0) {
      Word wordMask=Word.fromIntZeroExtend(BYTES_IN_COPY - 1);
      Word srcAlignment=src.toWord().and(wordMask);
      if (srcAlignment.EQ(dst.toWord().and(wordMask))) {
        Offset i=Offset.zero();
        if (srcAlignment.EQ(Word.fromIntZeroExtend(BYTES_IN_INT))) {
          copy4Bytes(dst.plus(i),src.plus(i));
          i=i.plus(BYTES_IN_INT);
        }
        Word endAlignment=srcAlignment.plus(numBytes).and(wordMask);
        numBytes=numBytes.minus(endAlignment.toOffset());
        for (; i.sLT(numBytes); i=i.plus(BYTES_IN_COPY)) {
          copy8Bytes(dst.plus(i),src.plus(i));
        }
        if (!endAlignment.isZero()) {
          copy4Bytes(dst.plus(i),src.plus(i));
        }
        return;
      }
    }
    for (Offset i=Offset.zero(); i.sLT(numBytes); i=i.plus(BYTES_IN_INT)) {
      copy4Bytes(dst.plus(i),src.plus(i));
    }
  }
}