I encoded a state |000> applied by a U3 gate, resulting in state: a|000>+b|100>. I need to create a circuit to achieve the desired state (a'|**0>+b'|**1>) with * as any 0 or 1 state. Specifically, if the initial state is |000> then I have to produce a state |**0>, else if the initial state is |100>, I have to produce a state |**1>. Moreover, there is a Pauli-X gate in the middle of the circuit that can act randomly on one of the three qubits. There is also a constraint that qubits 1 and 3 can't be in the same operation, you have to use qubit 2 to transfer it. The circuit will have a structure like this:
left circuit + (Pauli-X gate acts on a random qubit) + right circuit
I've tried to use various ways with CNOT,X,Toffoli and SWAP gates and haven't figured out how to achieve the desired state. Anyone knows how to do it, please help me. Thanks!