private LabelString getExtendedPointerReferenceMarkup(Program program, Reference ref) {

		Address toAddress = ref.getToAddress();

		Listing listing = program.getListing();
		if (listing.getDefinedDataAt(toAddress) == null) {
			return null;
		}

		ReferenceManager referenceManager = program.getReferenceManager();
		Reference[] referencesFrom = referenceManager.getReferencesFrom(toAddress);
		if (referencesFrom.length != 1 || referencesFrom[0].getReferenceType() != RefType.DATA) {
			// only follow simple DATA reference type which corresponds to a pointer
			return null;
		}

		Symbol symbol = program.getSymbolTable().getSymbol(referencesFrom[0]);
		if (symbol != null && !symbol.isDynamic()) {
			String result = getSymbolLabelString(program, symbol, ref.getFromAddress());
			return new LabelString(result,
				symbol.isExternal() ? LabelString.EXTERNAL : LabelString.CODE_LABEL);
		}
		return null;
	}
Get a LabelString object which corresponds to the specified memory
reference from the specified code unit. Format options are considered
when generating label.

@param fromCodeUnit code unit
@param ref memory reference
@return LabelString representation object
Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java