private static RefType getMemRefType(Instruction instr, Address memAddr) {

		long memOffset = memAddr.getAddressableWordOffset();

		RefType refType = null;
		Varnode offsetVarnode = null;
		Varnode valueVarnode = null;
		for (PcodeOp op : instr.getPcode()) {
			Varnode[] inputs = op.getInputs();
			if (op.getOpcode() == PcodeOp.INT_ZEXT || op.getOpcode() == PcodeOp.COPY) {
				if (inputs[0].isConstant() && inputs[0].getOffset() == memOffset) {
					offsetVarnode = op.getOutput();
					refType = RefType.DATA;
					continue;
				}
			} // TODO: Could track copy of offsetVarnode thus producing multiple offsetVarnodes
			if (op.getOpcode() == PcodeOp.STORE) {
				if (memAddr.getAddressSpace().getUnique() == inputs[0].getSpace() &&
					(memOffset == inputs[1].getOffset() || inputs[1].equals(offsetVarnode))) {
					if (refType != null && refType.isRead()) {
						return RefType.READ_WRITE;
					}
					refType = RefType.WRITE;
				}
			}
			else if (op.getOpcode() == PcodeOp.LOAD) {
				if (memAddr.getAddressSpace().getSpaceID() == inputs[0].getOffset() &&
					(memOffset == inputs[1].getOffset() || inputs[1].equals(offsetVarnode))) {
					if (refType != null && refType.isWrite()) {
						return RefType.READ_WRITE;
					}
					refType = RefType.READ;
					valueVarnode = op.getOutput();
				}
			}
			else {
				for (Varnode in : inputs) {
					if (refType == null && in.isConstant() && in.getOffset() == memOffset) {
						refType = RefType.DATA;
					}
					// changed to only compare the address offsets because of problem with overlay spaces
					// probably should look into why one is in an overlay and the other isn't when
					// they should match
					else if (in.isAddress() && in.getAddress().getOffset() == memAddr.getOffset()) {
						if (refType != null && refType.isWrite()) {
							return RefType.READ_WRITE;
						}
						refType = RefType.READ;
					}
				}
			}
			if (valueVarnode != null && isFlowOp(op) && valueVarnode.equals(inputs[0])) {
				return RefType.INDIRECTION;
			}
		}
		return refType;
	}
Return default flow-type without terminator
@param inst the instruction
@return call/jump flow type or null
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/symbol/RefTypeFactory.java