static int fcn_print_makestyle(RzCore *core, RzList *fcns, char mode) {
	RzListIter *refiter;
	RzListIter *fcniter;
	RzAnalysisFunction *fcn;
	RzAnalysisXRef *xrefi;
	RzList *xrefs = NULL;
	PJ *pj = NULL;

	if (mode == 'j') {
		pj = pj_new();
		pj_a(pj);
	}

	// Iterate over all functions
	rz_list_foreach (fcns, fcniter, fcn) {
		// Get all refs for a function
		xrefs = rz_core_analysis_fcn_get_calls(core, fcn);
		// Uniquify the list by ref->addr
		xrefs = rz_list_uniq(xrefs, (RzListComparator)RzAnalysisRef_cmp);

		// don't enter for functions with 0 refs
		if (!rz_list_empty(xrefs)) {
			if (pj) { // begin json output of function
				pj_o(pj);
				pj_ks(pj, "name", fcn->name);
				pj_kn(pj, "addr", fcn->addr);
				pj_k(pj, "calls");
				pj_a(pj);
			} else {
				rz_cons_printf("%s", fcn->name);
			}

			if (mode == 'm') {
				rz_cons_printf(":\n");
			} else if (mode == 'q') {
				rz_cons_printf(" -> ");
			}
			// Iterate over all refs from a function
			rz_list_foreach (xrefs, refiter, xrefi) {
				RzFlagItem *f = rz_flag_get_i(core->flags, xrefi->to);
				char *dst = rz_str_newf((f ? f->name : "0x%08" PFMT64x), xrefi->to);
				if (pj) { // Append calee json item
					pj_o(pj);
					pj_ks(pj, "name", dst);
					pj_kn(pj, "addr", xrefi->from);
					pj_end(pj); // close referenced item
				} else if (mode == 'q') {
					rz_cons_printf("%s ", dst);
				} else {
					rz_cons_printf("    %s\n", dst);
				}
			}
			if (pj) {
				pj_end(pj); // close list of calls
				pj_end(pj); // close function item
			} else {
				rz_cons_newline();
			}
		}
	}

	if (mode == 'j') {
		pj_end(pj); // close json output
		rz_cons_printf("%s\n", pj_string(pj));
	}
	if (pj) {
		pj_free(pj);
	}
	return 0;
}
static int fcn_print_makestyle(RzCore *core, RzList *fcns, char mode) {
	RzListIter *refiter;
	RzListIter *fcniter;
	RzAnalysisFunction *fcn;
	RzAnalysisXRef *xrefi;
	RzList *xrefs = NULL;
	PJ *pj = NULL;

	if (mode == 'j') {
		pj = pj_new();
		pj_a(pj);
	}

	 
	rz_list_foreach (fcns, fcniter, fcn) {
		 
		xrefs = rz_core_analysis_fcn_get_calls(core, fcn);
		 
		xrefs = rz_list_uniq(xrefs, (RzListComparator)RzAnalysisRef_cmp);

		 
		if (!rz_list_empty(xrefs)) {
			if (pj) {  
				pj_o(pj);
				pj_ks(pj, "name", fcn->name);
				pj_kn(pj, "addr", fcn->addr);
				pj_k(pj, "calls");
				pj_a(pj);
			} else {
				rz_cons_printf("%s", fcn->name);
			}

			if (mode == 'm') {
				rz_cons_printf(":\n");
			} else if (mode == 'q') {
				rz_cons_printf(" -> ");
			}
			 
			rz_list_foreach (xrefs, refiter, xrefi) {
				RzFlagItem *f = rz_flag_get_i(core->flags, xrefi->to);
				char *dst = rz_str_newf((f ? f->name : "0x%08" PFMT64x), xrefi->to);
				if (pj) {  
					pj_o(pj);
					pj_ks(pj, "name", dst);
					pj_kn(pj, "addr", xrefi->from);
					pj_end(pj);  
				} else if (mode == 'q') {
					rz_cons_printf("%s ", dst);
				} else {
					rz_cons_printf("    %s\n", dst);
				}
			}
			if (pj) {
				pj_end(pj);  
				pj_end(pj);  
			} else {
				rz_cons_newline();
			}
		}
	}

	if (mode == 'j') {
		pj_end(pj);  
		rz_cons_printf("%s\n", pj_string(pj));
	}
	if (pj) {
		pj_free(pj);
	}
	return 0;
}