RZ_API RZ_OWN char *rz_analysis_function_autoname_var(RzAnalysisFunction *fcn, char kind, const char *pfx, int ptr) {
	void **it;
	const ut32 uptr = RZ_ABS(ptr);
	char *varname = rz_str_newf("%s_%xh", pfx, uptr);
	rz_pvector_foreach (&fcn->vars, it) {
		RzAnalysisVar *var = *it;
		if (!strcmp(varname, var->name)) {
			if (var->kind != kind) {
				const char *k = kind == RZ_ANALYSIS_VAR_KIND_SPV ? "sp" : "bp";
				free(varname);
				varname = rz_str_newf("%s_%s_%xh", pfx, k, uptr);
				return varname;
			}
			int i = 2;
			do {
				free(varname);
				varname = rz_str_newf("%s_%xh_%u", pfx, uptr, i++);
			} while (rz_analysis_function_get_var_byname(fcn, varname));
			return varname;
		}
	}
	return varname;
}
RZ_API RZ_OWN char *rz_analysis_function_autoname_var(RzAnalysisFunction *fcn, char kind, const char *pfx, int ptr) {
	void **it;
	const ut32 uptr = RZ_ABS(ptr);
	char *varname = rz_str_newf("%s_%xh", pfx, uptr);
	rz_pvector_foreach (&fcn->vars, it) {
		RzAnalysisVar *var = *it;
		if (!strcmp(varname, var->name)) {
			if (var->kind != kind) {
				const char *k = kind == RZ_ANALYSIS_VAR_KIND_SPV ? "sp" : "bp";
				free(varname);
				varname = rz_str_newf("%s_%s_%xh", pfx, k, uptr);
				return varname;
			}
			int i = 2;
			do {
				free(varname);
				varname = rz_str_newf("%s_%xh_%u", pfx, uptr, i++);
			} while (rz_analysis_function_get_var_byname(fcn, varname));
			return varname;
		}
	}
	return varname;
}