Amalgams of inverse semigroups and reversible two-counter machines