If the US just gave support to one bad guy to restrain the other, greater, bad guy, I could see some sense in it. But I don't understand giving support to both bad guys.
That they might destroy each other?
Moreover, remember that Iran was part of the clandestine "triangular trade" that was supplying the Sandinistas in Nicaragua.
Inadvertently, the ayatollahs were helping us win a battle against Communism in Central American.
I'm sure the Nicaraguans would approve...