To enable the compiler to perform optimizations more efficiently, it is a good idea in general to keep functions small and simple. There are several ways of achieving this goal. For example, you can:
minimize the number of parameters passed to and from functions
return multiple values from a function through the registers using __value_in_regs
where possible, qualify functions as __pure.