circuit annotations {
layout {
gate_size: 22
corner_radius: 3
comment_width: 72
}
qubit q[3]: "|0>" -> "out"
labels "data", "work", "flag" on q[0..3] with fill: yellow
brace left "input" on q[0..3] with stroke: blue
h q[0]
note "decode" on q[1]
equals "encode" on q[0..3] braced both with fill: "#F3F3F3", stroke: teal
brace right "result" on q[0..3] with stroke: purple
cut on q[0..3] as "stage" with stroke: red
x q[2] if q[0]
brace both "repeat" on q[0..3] with stroke: blue
}