The first thing they need to do is get better recipes and cooking methods.
They did/do, all the time, by trying new recipe. Recently they had Angus Deluxe burgers, but those were dropped. All that does though is raise costs, not cut them, and likely for a lower marginal profit increase. For example, apparently adding superior Angus Deluxe burgers didn't increase their profits, so your idea of superior recipes and cooking methods didn't work.
Then cut stores, which cuts real estate costs.
Cut wages from minimum to zero? Tell franchise investors who sunk millions into their own restaurant that they should accept their losses, pack up, and leave?
With better recipes and and less stores, they'll attract the customers from the removed stores to the remaining stores, bringing in more revenue per store.
Maybe. They tried recipes, but those don't always work. And they do close unprofitable locations sometimes, but if one restaurant even make $1 in profit, why close it? You're thinking that if A gets X customers, and B gets Y customers, then if you close A, then B will get X + Y customers. But that's simply not true. B may not have the capacity to handle all new customers, and long lines will drive them away, and customers who bought from A location may find B's location inconvenient. And, of course, less jobs for locals.
This is exactly what In-n-Out does: half the stores as McDonalds per area, yet more customers per store, because their food is so good.
If it's so great, how come McDonald's is all over the world, and In-n-Out is only in your area?