public final static Reference[] getOffcutXReferences(CodeUnit cu, int maxXRefs) {
		Program prog = cu.getProgram();
		if (prog == null) {
			return EMPTY_REF_ARRAY;
		}
		List<Reference> offcutList = new ArrayList<>();
		// Lookup the offcut xrefs...
		//
		if (cu.getLength() > 1) {
			ReferenceManager refMgr = prog.getReferenceManager();
			AddressSet set =
				new AddressSet(cu.getMinAddress().add(1), cu.getMaxAddress());
			AddressIterator iter = refMgr.getReferenceDestinationIterator(set, true);
			while (iter.hasNext()) {
				Address addr = iter.next();
				ReferenceIterator refIter = refMgr.getReferencesTo(addr);
				while (refIter.hasNext()) {
					Reference ref = refIter.next();
					offcutList.add(ref);
					if (maxXRefs > 0 && offcutList.size() == maxXRefs) {
						break;
					}
				}
			}
		}
		Reference[] arr = new Reference[offcutList.size()];
		offcutList.toArray(arr);
		Arrays.sort(arr);
		return arr;
	}
Returns an array containing all offcut xref references to the specified code unit

@param cu the code unit to generate the offcut xrefs
@param maxXRefs max number of offcut xrefs to get, or -1 to get all offcut references

@return array of all offcut xrefs to the code unit
Ghidra/Features/Base/src/main/java/ghidra/app/util/XReferenceUtil.java