how much energy is necessary to do the electrolysis?
Havn't we already agreed that HHO generation is something like 80% efficient in commercial plants and theoretically up to 97%? It doesn't matter if the gas produced has 3 times the energy density of petrol, or 1000 times, it's still going to need 3 or 1000 times as much electrical energy to get an equivalent amount of fuel.
but if I use the HHO in an efficient engine that has been designed to use HHO I could get a whole lot more as the gasoline engine waste apx 87% of the energy in the gasoline fuel it uses.
Yes you probably would get some improvement above 13%, but even if it was 3 times as efficient, it still isn't producing as much energy as the HHO generator requires. You could use a fuel cell with what, 80% efficiency? But that too means the power output of the fuel cell will be less than the power needed to produce the HHO at 97% efficiency.