private int decode(byte[] data, int offset, Reference[] result) {
		long symbolID = -1;
		long addr = getLong(data, offset);
		offset += 8;
		RefListFlagsV0 flags = new RefListFlagsV0(data[offset++]);
		RefType refType = RefTypeFactory.get(data[offset++]);
		byte opIndex = data[offset++];

		SourceType source = flags.getSource();

		long offsetOrShift = 0;

		if (flags.hasSymbolID()) {
			symbolID = getLong(data, offset);
			offset += 8;
		}
		Address from = isFrom ? address : addrMap.decodeAddress(addr);
		Address to = isFrom ? addrMap.decodeAddress(addr) : address;
		if (flags.isOffsetRef() || flags.isShiftRef()) {
			offsetOrShift = getLong(data, offset);
			offset += 8;
			if (flags.isShiftRef()) {
				result[0] =
					new ShiftedReferenceDB(program, from, to, refType, opIndex, source,
						flags.isPrimary(), symbolID, (int) offsetOrShift);
			}
			else {
				result[0] =
					new OffsetReferenceDB(program, from, to, refType, opIndex, source,
						flags.isPrimary(), symbolID, offsetOrShift);
			}
		}
		else if (to.isExternalAddress()) {
			result[0] = new ExternalReferenceDB(program, from, to, refType, opIndex, source);
		}
		else if (from.equals(Address.EXT_FROM_ADDRESS)) {
			result[0] =
				new EntryPointReferenceDB(from, to, refType, opIndex, source, flags.isPrimary(),
					symbolID);
		}
		else if (to.isStackAddress()) {
			result[0] =
				new StackReferenceDB(program, from, to, refType, opIndex, source,
					flags.isPrimary(), symbolID);
		}
		else {
			result[0] =
				new MemReferenceDB(program, from, to, refType, opIndex, source, flags.isPrimary(),
					symbolID);
		}
		return offset;
	}
Construct reference list for existing record
@param rec existing refList record
@param adapter entry record storage adapter
@param addrMap address map for encoding/decoding addresses
@param program may be null for upgrade in which 
		case resulting reference objects are not suitable for general use.
@param cache RefList object cache
@param isFrom true for from-adapter use, false for to-adapter use
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/references/RefListV0.java