Let us ignore the temperature in the cylinder for a moment. There is an increases in the number of moles of gas from 13.5 to 17 from the reaction. Thus, from this alone we can judge the entropy or level of disorder increases in this chemical reaction. The molecules have less freedom, the increase of T delta S is less than for the first case. The value of delta G is more negative, the system can do more work.
Engines are complex systems that never approach chemical or thermal equilibrium.
Automotive engineers make difficult calculations in which the heat and temperature and compression and cooling effects cannot be so readily simplified. The above explanation is a gross simplification of one aspect of the role of chemical principles in engine design. You may well look at the above explanation and say it doesn't look as if the slight decrease in entropy change will make much difference in the work available. But consider this. So any advantage taken is a true gain.