Program: 50393
Project: 50393
Buggy source:
/** 
 * Reposition the reader on a genomic position. In contrast to skipTo, this method reposition to any position, including position that occured before the position returned last by getPosition().
 * @param position Position to seek to.
 * @throws IOException If an error occurs accessing the index or counts data.
 */
public void reposition(final int position) throws IOException {
  if (!hasIndex) {
    throw new IllegalStateException("String_Node_Str");
  }
  final int r=Arrays.binarySearch(positions,position);
  final int ip=r >= 0 ? r : -(r + 1);
  final int index=r >= 0 ? r : Math.max(0,ip);
  int priorIndex=index - 1;
  if (priorIndex < 0 || index >= positions.length) {
    this.position=position;
    this.count=0;
    deltaCount=0;
    nextTransitionLoaded=false;
    input.position(0);
    endOfStream=false;
    return;
  }
  if (positions[index] == position) {
    this.position=position;
    this.count=counts[index];
    deltaCount=0;
    nextTransitionLoaded=false;
    input.position(offsets[index]);
    endOfStream=false;
    input.readGamma();
    length=input.readGamma();
    return;
  }
 else {
    this.position=positions[priorIndex];
    count=priorIndex < 0 ? 0 : counts[priorIndex];
    input.position(offsets[priorIndex]);
    endOfStream=false;
    nextTransitionLoaded=false;
    currentCount=count;
    deltaCount=0;
    length=0;
    input.readGamma();
    length=input.readGamma();
    while (hasNextTransition()) {
      nextTransition();
      if (getPosition() >= position) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Reposition the reader on a genomic position. In contrast to skipTo, this method reposition to any position, including position that occured before the position returned last by getPosition().
 * @param position Position to seek to.
 * @throws IOException If an error occurs accessing the index or counts data.
 */
public void reposition(final int position) throws IOException {
  if (!hasIndex) {
    throw new IllegalStateException("String_Node_Str");
  }
  final int r=Arrays.binarySearch(positions,position);
  final int ip=r >= 0 ? r : -(r + 1);
  final int index=r >= 0 ? r : Math.max(0,ip);
  int priorIndex=index - 1;
  if (index == positions.length) {
    endOfStream=true;
    return;
  }
  if (priorIndex < 0 || index >= positions.length) {
    this.position=position;
    this.count=0;
    deltaCount=0;
    nextTransitionLoaded=false;
    input.position(0);
    endOfStream=false;
    return;
  }
  if (positions[index] == position) {
    this.position=position;
    this.count=counts[index];
    deltaCount=0;
    nextTransitionLoaded=false;
    input.position(offsets[index]);
    endOfStream=false;
    input.readGamma();
    length=input.readGamma();
    return;
  }
 else {
    this.position=positions[priorIndex];
    count=priorIndex < 0 ? 0 : counts[priorIndex];
    input.position(offsets[priorIndex]);
    endOfStream=false;
    nextTransitionLoaded=false;
    currentCount=count;
    deltaCount=0;
    length=0;
    input.readGamma();
    length=input.readGamma();
    while (hasNextTransition()) {
      nextTransition();
      if (getPosition() >= position) {
        break;
      }
    }
  }
}