That means I have to live with having the bit of code repeating 9 times and fill up the program memory or using the function and dealing with a stack overflow.
It doesn't really mean that, at all.
When you convert bits of duplicated code to a function, you might need to pay attention to what variables the function is modifying.