To piggyback on ale500's suggestion, from command line $, try:
$ grep "^.*//&.*$" state_machine.c | sed s/"^.*\/\/& "//g
This regex extracts every line in state_machine.c which contains the //& token and pipes to stdout, then for each extracted line, sed will remove every character from beginning of line up to and including //& , passing the remainder to stdout. From your example code, return will look something like:
subgraph cluster0 { node [style=filled]
color=midnightblue;
state_init [style=bold,shape=box,peripheries=2,color=black,label="Initialise"]
state_init -> state_next_step [style=bold]
; fontsize=18;label="State Machine"; }
From this point, you can pipe/write to your heart's content.