Tailoring magnetization reversal of a single-domain bar nanomagnet via its end geometry