# Post-selection in QASM

In some quantum algorithms (for example HHL or quantum machine learning algorithms) an ancilla qubit(s) is measured firstly and based on result of the measurement other qubit(s) are measured or not. For example, in this case, qubit $$|c\rangle$$ is measured if the ancilla is in state $$|0\rangle$$:

So far, I did post-selection manually. This means that I took all results with ancilla being in a particular state ($$|0\rangle$$ in the example above), removed others and finally normalized remained distribution to have sum of probabilities equal to 1.

My question is whether is it possible to do so in more elegant way in QASM on IBM Q Experience. This means to define which qubit is the ancilla, set which values of the ancilla has to be measured in order to measure other qubit(s) and get a conditional distribution of measured qubits under condition that ancilla is in some predfined state.