If cocaine were legal, most people would tend to use it in milder forms, as they have done in the past. (eg, the recipe for coca-cola used to include cocaine).
With heroin, the physical harm is almost ENTIRELY due to illegality - when a heroin addict can get the drug cheaply and in a known dosage and use it safely, they don't really have a problem. Our moral puritanism says being addicted is JUST BAD so we pass laws that CAUSE most of the harm we attribute to the drug.
Cocaine isn't quite like that. If you take a lot of cocaine it can cause nasty psychological symptoms - paranoia during use, depression between uses. On the other hand, cocaine is quite a lot like caffeine (and other stimulants) in this regard. Too much of any psychoactive drug is bad, but in moderation it's safe enough and has often been used by truck drivers who need to stay awake. Or people who need to be extra creative (eg: Robin Williams)
Even for this drug, the net harm of illegality almost certainly exceeds the net benefit. One could imagine a world in which making cocaine illegal stopped anyone from doing cocaine, but that's not the world we actually live in. The world we actually live in, it's generally accepted that our last two presidents used cocaine in school - it's not really fair to throw people in jail and take away their kids and their stuff because they were poor and used cocaine while people who are rich and use cocaine just get away with it. Which is what the current regime seems to amount to.