// A switch on a measured register, as an exporter writes it: q[2] is flipped // when the register reads 1 or 2. Each register value has probability 1/4. OPENQASM 3.0; include "stdgates.inc"; bit[2] c; bit[1] d; qubit[3] q; h q[0]; h q[1]; c[0] = measure q[0]; c[1] = measure q[1]; switch (c) { case 0 { } case 1, 2 { x q[2]; } default { } } d[0] = measure q[2];