public Address getReferencedAddress(Address address, boolean getIboIf64bit) {

		int addressSize = address.getSize();
		if (addressSize == 64 && getIboIf64bit) {
			IBO32DataType ibo32 =
				new IBO32DataType(currentProgram.getDataTypeManager());
			int length = ibo32.getLength();
			DumbMemBufferImpl compMemBuffer =
				new DumbMemBufferImpl(currentProgram.getMemory(), address);
			Object value = ibo32.getValue(compMemBuffer, ibo32.getDefaultSettings(), length);
			if (value instanceof Address) {
				Address iboAddress = (Address) value;
				return iboAddress;
			}
			return null;
		}

		try {
			if (addressSize == 32) {
				long offset32 = getInt(address);
				Address newAddr = address.getNewAddress(offset32);
				if (currentProgram.getMemory().contains(newAddr)) {
					return newAddr;
				}
				return null;

			}
			else if (addressSize == 64) {

				long offset64 = getLong(address);
				Address newAddr = address.getNewAddress(offset64);
				if (currentProgram.getMemory().contains(newAddr)) {
					return newAddr;
				}
				return null;

			}
			else {
				return null;
			}
		}
		catch (MemoryAccessException e) {
			return null;
		}

	}
Method to return the referenced address at the given address
Note: this will work whether there is a created reference or not
@param address the address to look for a referenced address at
@param getIboIf64bit if true, get the address corresponding to the image base offset instead 
of the full reference address
@return the first referenced address from the given address
Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/ExtendedFlatProgramAPI.java