Reorders a set of moves, to produce correct behavior Nodes can be in 3 states: RO - value is only read. Those are not added to writtenNodes array. RW - value is read 1 or more times and written 1 time. Indices of these nodes are at the beginning of writtenNodes WO - value is only written. Indices are at the end of writtenNodes.