if ((button & IN_USE) && (oldbutton && IN_USE)) function1(id) if ((!button & IN_USE) && (oldbutton & IN_USE)) function2(id)