The "gasoline fuel cells" convert the hydrocarbon (usually diesel or a biofuel) to hydrogen and carbon dioxide using a well-known industrial process called steam reforming. There are actually a couple of similar reactions as well, most of which also require water and heat.
What allows such fuel cells to have reduced CO2 emissions compared to internal combustion engines (ICEs) is the fact that fuel cells are much more efficient. A well-tuned fuel cell system can be 40% efficient (electrical energy out / chemical energy in); that is reduced somewhat by the electric motor, but electric motors are actually quite efficient. An ICE is lucky to be 20% efficient. So, for the same power you emit considerably less CO2 using a fuel cell system than an ICE. It would still be better not to emit ANY CO2, but we aren't quite there yet.
It is easier to write an incorrect program than understand a correct one.