+ flat_blurb (stdout);
+}
+
+int
+hist_check_address (unsigned address)
+{
+ unsigned i;
+
+ for (i = 0; i < num_histograms; ++i)
+ if (histograms[i].lowpc <= address && address < histograms[i].highpc)
+ return 1;
+
+ return 0;
+}
+
+#if ! defined(min)
+#define min(a,b) (((a)<(b)) ? (a) : (b))
+#endif
+#if ! defined(max)
+#define max(a,b) (((a)>(b)) ? (a) : (b))
+#endif
+
+void
+hist_clip_symbol_address (bfd_vma *p_lowpc, bfd_vma *p_highpc)
+{
+ unsigned i;
+ int found = 0;
+
+ if (num_histograms == 0)
+ {
+ *p_highpc = *p_lowpc;
+ return;
+ }
+
+ for (i = 0; i < num_histograms; ++i)
+ {
+ bfd_vma common_low, common_high;
+ common_low = max (histograms[i].lowpc, *p_lowpc);
+ common_high = min (histograms[i].highpc, *p_highpc);
+
+ if (common_low < common_high)
+ {
+ if (found)
+ {
+ fprintf (stderr,
+ _("%s: found a symbol that covers "
+ "several histogram records"),
+ whoami);
+ done (1);
+ }
+
+ found = 1;
+ *p_lowpc = common_low;
+ *p_highpc = common_high;
+ }
+ }
+
+ if (!found)
+ *p_highpc = *p_lowpc;
+}
+
+/* Find and return exising histogram record having the same lowpc and
+ highpc as passed via the parameters. Return NULL if nothing is found.
+ The return value is valid until any new histogram is read. */
+static histogram *
+find_histogram (bfd_vma lowpc, bfd_vma highpc)
+{
+ unsigned i;
+ for (i = 0; i < num_histograms; ++i)
+ {
+ if (histograms[i].lowpc == lowpc && histograms[i].highpc == highpc)
+ return &histograms[i];
+ }
+ return 0;
+}
+
+/* Given a PC, return histogram record which address range include this PC.
+ Return NULL if there's no such record. */
+static histogram *
+find_histogram_for_pc (bfd_vma pc)
+{
+ unsigned i;
+ for (i = 0; i < num_histograms; ++i)