runQCBuilderToBlazeBuilder :: GateToQCBuilder g => Builder -> QCBuilder g (QCComponent g) -> Builder
runQCBuilderToBlazeBuilder nl circuit =
    fromString ".v " <> vars <> nl <>
    fromString ".i " <> vars <> nl <>
    fromString ".o " <> vars <> nl <>
    fromString ".ol " <> vars <> nl <>
    Foldable.foldMap (uncurry (subcomponentToQCBuilder nl)) subcomps <>
    fromString "BEGIN" <> nl <>
    stepsToQCBuilder nl mainSteps <>
    fromString "END" <> nl
  where
    (QCComponent mainTouched mainSteps, subcomps) =
        runWriter $ evalStateT (unwrapQCBuilder circuit) 0
    vars =
        touchedToQCBuilder mainTouched

runQCBuilderToBlazeBuilder :: GateToQCBuilder g => Builder -> QCBuilder g (QCComponent g) -> Builder
runQCBuilderToBlazeBuilder nl circuit =
    fromString ".v " <> vars <> nl <>
    fromString ".i " <> vars <> nl <>
    fromString ".o " <> vars <> nl <>
    fromString ".ol " <> vars <> nl <>
    Foldable.foldMap (uncurry (subcomponentToQCBuilder nl)) subcomps <>
    fromString "BEGIN" <> nl <>
    stepsToQCBuilder nl mainSteps <>
    fromString "END" <> nl
  where
    (QCComponent mainTouched mainSteps, subcomps) =
        runWriter $ evalStateT (unwrapQCBuilder circuit) 0
    vars =
        touchedToQCBuilder mainTouched

runQCBuilderToBlazeBuilder nl circuit =
    fromString ".v " <> vars <> nl <>
    fromString ".i " <> vars <> nl <>
    fromString ".o " <> vars <> nl <>
    fromString ".ol " <> vars <> nl <>
    Foldable.foldMap (uncurry (subcomponentToQCBuilder nl)) subcomps <>
    fromString "BEGIN" <> nl <>
    stepsToQCBuilder nl mainSteps <>
    fromString "END" <> nl
  where
    (QCComponent mainTouched mainSteps, subcomps) =
        runWriter $ evalStateT (unwrapQCBuilder circuit) 0
    vars =
        touchedToQCBuilder mainTouched
