static bool found_xref(RzCore *core, ut64 at, ut64 xref_to, RzAnalysisXRefType type, PJ *pj, int rad, int cfg_debug, bool cfg_analysis_strings) {
	// Validate the reference. If virtual addressing is enabled, we
	// allow only references to virtual addresses in order to reduce
	// the number of false positives. In debugger mode, the reference
	// must point to a mapped memory region.
	if (type == RZ_ANALYSIS_REF_TYPE_NULL) {
		return false;
	}
	if (cfg_debug) {
		if (!rz_debug_map_get(core->dbg, xref_to)) {
			return false;
		}
	} else if (core->io->va) {
		if (!rz_io_is_valid_offset(core->io, xref_to, 0)) {
			return false;
		}
	}
	if (!rad) {
		if (cfg_analysis_strings && type == RZ_ANALYSIS_REF_TYPE_DATA) {
			int len = 0;
			char *str_string = is_string_at(core, xref_to, &len);
			if (str_string) {
				rz_name_filter(str_string, -1, true);
				char *str_flagname = rz_str_newf("str.%s", str_string);
				rz_flag_space_push(core->flags, RZ_FLAGS_FS_STRINGS);
				(void)rz_flag_set(core->flags, str_flagname, xref_to, 1);
				rz_flag_space_pop(core->flags);
				free(str_flagname);
				if (len > 0) {
					rz_meta_set(core->analysis, RZ_META_TYPE_STRING, xref_to,
						len, (const char *)str_string);
				}
				free(str_string);
			}
		}
		// Add to SDB
		if (xref_to) {
			rz_analysis_xrefs_set(core->analysis, at, xref_to, type);
		}
	} else if (rad == 'j') {
		char *key = sdb_fmt("0x%" PFMT64x, xref_to);
		char *value = sdb_fmt("0x%" PFMT64x, at);
		pj_ks(pj, key, value);
	} else {
		int len = 0;
		// Display in rizin commands format
		char *cmd;
		switch (type) {
		case RZ_ANALYSIS_REF_TYPE_CODE: cmd = "axc"; break;
		case RZ_ANALYSIS_REF_TYPE_CALL: cmd = "axC"; break;
		case RZ_ANALYSIS_REF_TYPE_DATA: cmd = "axd"; break;
		default: cmd = "ax"; break;
		}
		rz_cons_printf("%s 0x%08" PFMT64x " 0x%08" PFMT64x "\n", cmd, xref_to, at);
		if (cfg_analysis_strings && type == RZ_ANALYSIS_REF_TYPE_DATA) {
			char *str_flagname = is_string_at(core, xref_to, &len);
			if (str_flagname) {
				ut64 str_addr = xref_to;
				rz_name_filter(str_flagname, -1, true);
				rz_cons_printf("f str.%s=0x%" PFMT64x "\n", str_flagname, str_addr);
				rz_cons_printf("Cs %d @ 0x%" PFMT64x "\n", len, str_addr);
				free(str_flagname);
			}
		}
	}
	return true;
}
static bool found_xref(RzCore *core, ut64 at, ut64 xref_to, RzAnalysisXRefType type, PJ *pj, int rad, int cfg_debug, bool cfg_analysis_strings) {
	 
	 
	 
	 
	if (type == RZ_ANALYSIS_REF_TYPE_NULL) {
		return false;
	}
	if (cfg_debug) {
		if (!rz_debug_map_get(core->dbg, xref_to)) {
			return false;
		}
	} else if (core->io->va) {
		if (!rz_io_is_valid_offset(core->io, xref_to, 0)) {
			return false;
		}
	}
	if (!rad) {
		if (cfg_analysis_strings && type == RZ_ANALYSIS_REF_TYPE_DATA) {
			int len = 0;
			char *str_string = is_string_at(core, xref_to, &len);
			if (str_string) {
				rz_name_filter(str_string, -1, true);
				char *str_flagname = rz_str_newf("str.%s", str_string);
				rz_flag_space_push(core->flags, RZ_FLAGS_FS_STRINGS);
				(void)rz_flag_set(core->flags, str_flagname, xref_to, 1);
				rz_flag_space_pop(core->flags);
				free(str_flagname);
				if (len > 0) {
					rz_meta_set(core->analysis, RZ_META_TYPE_STRING, xref_to,
						len, (const char *)str_string);
				}
				free(str_string);
			}
		}
		 
		if (xref_to) {
			rz_analysis_xrefs_set(core->analysis, at, xref_to, type);
		}
	} else if (rad == 'j') {
		char *key = sdb_fmt("0x%" PFMT64x, xref_to);
		char *value = sdb_fmt("0x%" PFMT64x, at);
		pj_ks(pj, key, value);
	} else {
		int len = 0;
		 
		char *cmd;
		switch (type) {
		case RZ_ANALYSIS_REF_TYPE_CODE: cmd = "axc"; break;
		case RZ_ANALYSIS_REF_TYPE_CALL: cmd = "axC"; break;
		case RZ_ANALYSIS_REF_TYPE_DATA: cmd = "axd"; break;
		default: cmd = "ax"; break;
		}
		rz_cons_printf("%s 0x%08" PFMT64x " 0x%08" PFMT64x "\n", cmd, xref_to, at);
		if (cfg_analysis_strings && type == RZ_ANALYSIS_REF_TYPE_DATA) {
			char *str_flagname = is_string_at(core, xref_to, &len);
			if (str_flagname) {
				ut64 str_addr = xref_to;
				rz_name_filter(str_flagname, -1, true);
				rz_cons_printf("f str.%s=0x%" PFMT64x "\n", str_flagname, str_addr);
				rz_cons_printf("Cs %d @ 0x%" PFMT64x "\n", len, str_addr);
				free(str_flagname);
			}
		}
	}
	return true;
}