https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110845
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Gcc has an heuristic for main where gcc knows that main is called only once and does not inline as much into a function that will ever be called exactly once. My bet if you Rename main to foo, gcc will inline f and g into that.