You can also use an array of function pointers to keep the code down as well. For example:
void btn1Action() { // stuff }
void btn2Action() { // stuff }
void btn3Action() { // stuff }
void btn4Action() { // stuff }
void (*btnActions)[4]() = { btn1Action, btn2Action, btn3Action, btn4Action };
This would allow a single for loop to check for the edge, run the function if it's found, and update the last state variable.