Writing an analog pot debounce as a function

Suggestions on how to clean this spaghetti up?

Sure. You have a function that reads a potentiometer value. If you want to debounce the output of that function, the debouncing belongs in that function.

Although, debouncing is the wrong term. Potentiometers do not bounce like mechanical switches. So, you really should be clear on what you are trying to accomplish.

Let me ask this. If you have multiple pots, how can you "debounce" them all using one "last value" variable?