\begin{comment}
This is the state machine for mpiexec for smpd.
Graph [mpiexec for smpd],
      [size="7.5, 10"]
\end{comment}
\begin{verbatim}
State [connecting tree],[label="connecting tree"]
	Event [connect]
		Change_State([reading challenge string], [label="connect"])
State [reading challenge string],[label="reading challenge string"]
	Event [data read]
		Change_State([writing challenge response])
State [writing challenge response],[label="writing challenge response"]
	Event [data written]
		Change_State([reading connect result])
State [reading connect result],[label="reading connect result"]
	Event [data read]
		if accept
			Change_State([writing process session request], [label="accept"])
		else reject
			Change_State([closing],[label="reject"])
State [writing process session request],[label="writing process session request"]
	Event [data written]
		Change_State([reading cred request])
State [reading cred request],[label="reading cred request"]
	Event [data read]
		if yes
			Change_State([writing account],[label="yes"])
		else no
			Change_State([reading reconnect request],[label="no"])
State [writing account],[label="writing account"]
	Event [data written]
		Change_State([writing password])
State [writing password],[label="writing password"]
	Event [data written]
		Change_State([reading password result])
State [reading password result],[label="reading password result"]
	Event [data read]
		if accept
			Change_State([reading reconnect request],[label="accept"])
		else reject
			Change_State([closing],[label="reject"])
State [reading reconnect request],[label="reading reconnect request"]
	Event [data read]
		if yes
			Change_State([closing],[label="yes"])
			Change_State([reconnecting],[label="yes" style=dotted])
		else no
			Change_State([writing session header], [label="no"])
State [reconnecting],[label="reconnecting"]
	Event [connect]
		Change_State([writing session header],[label="connect"])
State [writing session header],[label="writing session header"]
	Event [data written]
		if connect_to
			Change_State([reading and writing],[label="connect cmd"])
		else
			Change_State([reading and writing],[label="start_dbs cmd"])
State [reading and writing],[label="reading cmd header and writing cmd"]
	Event [data read]
		Change_State([reading cmd],[label="read"])
	Event [data written]
		Invoke_Action([handle cmd written],[label="written"])
State [reading cmd header],[label="reading cmd header"]
	Event [data read]
		Change_State([reading cmd])
State [reading cmd],[label="reading cmd"]
	Event [data read]
		Invoke_Action([handle cmd])
Action [handle cmd],[label="handle cmd"]
	Change_State([reading and writing],[label="forward"])
	Change_State([reading cmd header])
	Invoke_Action([handle connect],[label="connect"])
	Invoke_Action([handle close],[label="close"])
	Invoke_Action([handle closed],[label="closed"])
	Invoke_Action([handle closed request],[label="closed request"])
Action [handle connect],[label="connect"]
Action [handle close],[label="close"]
Action [handle closed],[label="closed"]
Action [handle closed request],[label="closed request"]
State [closing],[label="closing"]
	Event [closed]
		Change_State([done], [label="closed"])
State [done],[label="done"]
Action [handle cmd written],[label="handle command written"]
	Event [connect written]
		if connect_to
			Change_State([reading and writing],[label="connect cmd"])
		else
			Change_State([reading and writing],[label="start_dbs cmd"])
	Event [start_dbs written]
		Change_State([reading and writing],[label="launch cmd"])
	Event [launch written]
		if next
			// this state change happens but because it is visually the same
			// as 'Event [start_dbs written]', comment it out
			//Change_State([reading and writing],[label="launch cmd"])
		else
			Change_State([reading cmd header])
\end{verbatim}
