I would even consider turning it upside down and having the pins reflect the variables.
Basically this -
Loop -
Gather inputs
Process inputs to calculate outputs
Set the outputs
Repeat
If some of your inputs happen to be outputs set in 4) its ok to gather them back in 1) its a little bit less efficient, but also a little bit more maintainable as the only state you will ever have for your outputs is the state that they are in rather than your best efforts are tracking their state using variables - we all make mistakes, this approach avoids a lot of potential mistakes.