Program: 52252
Project: 52252
Buggy source:
@Override public boolean index(final long index){
  long address0=chronicle.indexToIndex() + toAddress0(index);
  long address1=chronicle.bytes().readVolatileLong(address0);
  long address2=0;
  long start=0;
  if (address1 != 0) {
    long offset=address1 + toAddress1(index);
    address2=chronicle.bytes().readVolatileLong(offset);
    if (address2 != 0) {
      wire.bytes().position(address2);
      start=((index / 64L)) * 64L;
    }
  }
  if (address2 == 0) {
    long lastKnownIndex=0;
    long newAddress0=0;
    int count=0;
    for (newAddress0=chronicle.indexToIndex(); count < ((int)(1L << 17L)); newAddress0+=8, count++) {
      long l=chronicle.bytes().readVolatileLong(newAddress0);
      if (l != 0) {
        address1=l;
        if (count > 0)         lastKnownIndex+=(1L << (17L + 6L));
      }
 else       break;
    }
    if (address1 != 0) {
      long newAddress1;
      for (newAddress1=address1, count=0; count < ((int)(1L << 17L)); newAddress1+=8, count++) {
        long l=chronicle.bytes().readVolatileLong(newAddress1);
        if (l != 0) {
          address2=l;
          if (count > 0)           lastKnownIndex+=(1L << (6L));
        }
 else         break;
      }
    }
    if (address2 != 0) {
      wire.bytes().position(address2);
      start=lastKnownIndex;
    }
  }
  final LongValue position=DataValueClasses.newInstance(LongValue.class);
  long last=chronicle.lastIndex();
  for (long i=start; i < last; i++) {
    final long j=i;
    Function<WireIn,Object> reader=wireIn -> {
      if (index == j)       position.setValue(wire.bytes().position() - 4);
      wireIn.bytes().skip(wireIn.bytes().remaining());
      return null;
    }
;
    wire.readDocument(reader);
    if (position.getValue() != 0) {
      wire.bytes().position(position.getValue());
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean index(final long index){
  long address0=chronicle.indexToIndex() + toAddress0(index);
  long address1=chronicle.bytes().readVolatileLong(address0);
  long address2=0;
  long start=0;
  if (address1 != 0) {
    long offset=address1 + toAddress1(index);
    address2=chronicle.bytes().readVolatileLong(offset);
    if (address2 != 0) {
      wire.bytes().position(address2);
      start=((index / 64L)) * 64L;
    }
  }
  if (address2 == 0) {
    long lastKnownIndex=0;
    long newAddress0=0;
    int count=0;
    for (newAddress0=chronicle.indexToIndex(); count < ((int)(1L << 17L)); newAddress0+=8, count++) {
      long l=chronicle.bytes().readVolatileLong(newAddress0);
      if (l != 0) {
        address1=l;
        if (count > 0)         lastKnownIndex+=(1L << (17L + 6L));
      }
 else       break;
    }
    if (address1 != 0) {
      long newAddress1;
      for (newAddress1=address1, count=0; count < ((int)(1L << 17L)); newAddress1+=8, count++) {
        long l=chronicle.bytes().readVolatileLong(newAddress1);
        if (l != 0) {
          address2=l;
          if (count > 0)           lastKnownIndex+=(1L << (6L));
        }
 else         break;
      }
    }
    if (address2 != 0) {
      wire.bytes().position(address2);
      start=lastKnownIndex;
    }
  }
  final LongValue position=codeTemplate.newInstance(LongValue.class);
  long last=chronicle.lastIndex();
  for (long i=start; i < last; i++) {
    final long j=i;
    final Consumer<WireIn> metaDataConsumer=wireIn -> {
      if (index == j)       position.setValue(wire.bytes().position() - 4);
      wireIn.bytes().skip(wireIn.bytes().remaining());
    }
;
    final Consumer<WireIn> dataConsumer=wireIn -> wireIn.bytes().skip(wireIn.bytes().remaining());
    wire.readDocument(metaDataConsumer,dataConsumer);
    if (position.getValue() != 0) {
      wire.bytes().position(position.getValue());
      return true;
    }
  }
  return false;
}