let entangler = "E"
let accent = "#DDEEFF"
style highlighted {
fill: accent
stroke: blue
shape: circle
}
fn entangle(control, target) {
h control
gate entangler on target if control with highlighted
}
fn prepare_ghz(first, second, third) {
entangle(first, second)
x third if second
barrier
}
circuit function_composition {
qubit q[3]: "|0>" -> "GHZ"
prepare_ghz(q[0], q[1], q[2])
gate entangler on q[0], q[2] with highlighted, opacity: 0.7
measure q[0], q[1], q[2]
}