Program: 63811
Project: 63811
Buggy source:
static void transferPointer(SegmentBuilder dstSegment,int dstOffset,SegmentBuilder srcSegment,int srcOffset,int srcTargetOffset){
  long src=srcSegment.get(srcOffset);
  long srcTarget=srcSegment.get(srcTargetOffset);
  if (dstSegment == srcSegment) {
    if (WirePointer.kind(src) == WirePointer.STRUCT && StructPointer.wordSize(src) == 0) {
      WirePointer.setKindAndTargetForEmptyStruct(dstSegment.buffer,dstOffset);
    }
 else {
      WirePointer.setKindAndTarget(dstSegment.buffer,dstOffset,WirePointer.kind(src),srcTargetOffset);
      dstSegment.buffer.putInt(dstOffset * Constants.BYTES_PER_WORD + 4,srcSegment.buffer.getInt(srcOffset * Constants.BYTES_PER_WORD + 4));
    }
  }
 else {
    int landingPadOffset=srcSegment.allocate(1);
    if (landingPadOffset == SegmentBuilder.FAILED_ALLOCATION) {
      BuilderArena.AllocateResult allocation=srcSegment.getArena().allocate(2);
      SegmentBuilder farSegment=allocation.segment;
      landingPadOffset=allocation.offset;
      FarPointer.set(farSegment.buffer,landingPadOffset,false,srcTargetOffset);
      FarPointer.setSegmentId(farSegment.buffer,landingPadOffset,srcSegment.id);
      WirePointer.setKindWithZeroOffset(farSegment.buffer,landingPadOffset + 1,WirePointer.kind(srcTarget));
      farSegment.buffer.putInt((landingPadOffset + 1) * Constants.BYTES_PER_WORD + 4,srcSegment.buffer.getInt(srcOffset * Constants.BYTES_PER_WORD + 4));
      FarPointer.set(dstSegment.buffer,dstOffset,true,landingPadOffset);
      FarPointer.setSegmentId(dstSegment.buffer,dstOffset,farSegment.id);
    }
 else {
      WirePointer.setKindAndTarget(srcSegment.buffer,landingPadOffset,WirePointer.kind(srcTarget),srcTargetOffset);
      srcSegment.buffer.putInt(landingPadOffset * Constants.BYTES_PER_WORD + 4,srcSegment.buffer.getInt(srcOffset * Constants.BYTES_PER_WORD + 4));
      FarPointer.set(dstSegment.buffer,dstOffset,false,landingPadOffset);
      FarPointer.setSegmentId(dstSegment.buffer,dstOffset,srcSegment.id);
    }
  }
}

Fixed version (ground truth):
static void transferPointer(SegmentBuilder dstSegment,int dstOffset,SegmentBuilder srcSegment,int srcOffset,int srcTargetOffset){
  long src=srcSegment.get(srcOffset);
  long srcTarget=srcSegment.get(srcTargetOffset);
  if (dstSegment == srcSegment) {
    if (WirePointer.kind(src) == WirePointer.STRUCT && StructPointer.wordSize(src) == 0) {
      WirePointer.setKindAndTargetForEmptyStruct(dstSegment.buffer,dstOffset);
    }
 else {
      WirePointer.setKindAndTarget(dstSegment.buffer,dstOffset,WirePointer.kind(src),srcTargetOffset);
    }
    dstSegment.buffer.putInt(dstOffset * Constants.BYTES_PER_WORD + 4,srcSegment.buffer.getInt(srcOffset * Constants.BYTES_PER_WORD + 4));
  }
 else {
    int landingPadOffset=srcSegment.allocate(1);
    if (landingPadOffset == SegmentBuilder.FAILED_ALLOCATION) {
      BuilderArena.AllocateResult allocation=srcSegment.getArena().allocate(2);
      SegmentBuilder farSegment=allocation.segment;
      landingPadOffset=allocation.offset;
      FarPointer.set(farSegment.buffer,landingPadOffset,false,srcTargetOffset);
      FarPointer.setSegmentId(farSegment.buffer,landingPadOffset,srcSegment.id);
      WirePointer.setKindWithZeroOffset(farSegment.buffer,landingPadOffset + 1,WirePointer.kind(srcTarget));
      farSegment.buffer.putInt((landingPadOffset + 1) * Constants.BYTES_PER_WORD + 4,srcSegment.buffer.getInt(srcOffset * Constants.BYTES_PER_WORD + 4));
      FarPointer.set(dstSegment.buffer,dstOffset,true,landingPadOffset);
      FarPointer.setSegmentId(dstSegment.buffer,dstOffset,farSegment.id);
    }
 else {
      WirePointer.setKindAndTarget(srcSegment.buffer,landingPadOffset,WirePointer.kind(srcTarget),srcTargetOffset);
      srcSegment.buffer.putInt(landingPadOffset * Constants.BYTES_PER_WORD + 4,srcSegment.buffer.getInt(srcOffset * Constants.BYTES_PER_WORD + 4));
      FarPointer.set(dstSegment.buffer,dstOffset,false,landingPadOffset);
      FarPointer.setSegmentId(dstSegment.buffer,dstOffset,srcSegment.id);
    }
  }
}