digraph sortV1{
forcelabels=true
node [shape=box, color="black", fillcolor="lightgray", style="filled"] 
"entry [ENTRY]"[label="entry", xlabel="function vars={items}"];
"exit [EXIT]"[label="exit"];

node [shape=none, color="black", fillcolor="lightgray", style="filled", fontsize="10"];
"slice9 [INVOKE]"[label=<<table BORDER="0" CELLBORDER="0" CELLSPACING="0">
  <tr>
    <td><B>Set</B><BR/>
    	gen={tmp, lhs}<BR/>
    	<font color="red">transfer={tmp}</font><BR/>
    	kill={}
    </td>
    <td BORDER="1"><B>Code Block</B><BR/>    	
        //Slice the array items<br/>
    	int[] tmp = Array.slice(items,start,pivot)<BR/>
        int[] lhs = tmp
    </td>
  </tr>
</table>>, xlabel=<<font color="blue">outside vars={items}</font>>];
"sortV113 [INVOKE]"[label=<<table BORDER="0" CELLBORDER="0" CELLSPACING="0">
  <tr>
    <td><B>Set</B><BR/>
    	gen={tmp1, lhs}<BR/>
    	<font color="red">transfer={tmp1}</font><BR/>
    	kill={lhs}
    </td>
    <td BORDER="1"><B>Code Block</B><BR/>    	
        // Recursively sort the lhs array<br ALIGN="LEFT" />
    	int[] tmp1 = sort(lhs, 0, pivot)<BR/>
        lhs = tmp1
    </td>
  </tr>
</table>>, xlabel=<<font color="blue">outside vars={items}</font>>];
"slice15 [INVOKE]"[label=<<table BORDER="0" CELLBORDER="0" CELLSPACING="0">
  <tr>
    <td><B>Set</B><BR/>
    	gen={tmp2, rhs}<BR/>
    	<font color="red">transfer={tmp2}</font><BR/>
    	kill={}
    </td>	
    <td BORDER="1"><B>Code Block</B><BR/>     	
        //Slice the items array<br/>
    	int[] tmp2 = Array.slice(items,start,pivot)<BR/>
        int[] rhs = tmp2
    </td>
  </tr>
</table>>, xlabel=<<font color="blue">outside vars={items}</font>>];
"sortV120 [INVOKE]"[label=<<table BORDER="0" CELLBORDER="0" CELLSPACING="0">
  <tr>
    <td><B>Set</B><BR/>
    	gen={tmp3, rhs}<BR/>
    	<font color="red">transfer={tmp3}</font><BR/>
    	kill={rhs}
    </td>
    <td BORDER="1"><B>Code Block</B><BR/>    	
        // Recursively sort the rhs array<br/>
    	int[] tmp3 = sort(rhs, 0, end-pivot)<BR/>
        rhs = tmp3
    </td>
  </tr>
</table>>, xlabel=<<font color="blue">outside vars={items}</font>>];
"blklab5 [FREE]"[label="\nfree(lhs)\nfree(rhs)\n//End of if block", xlabel=<<font color="blue">block vars=in={lhs, rhs}</font>>];
"items [RETURN]"[label="//No free variable\nreturn items\n//End of function", xlabel="function vars={items}\n"];


node [shape=hexagon, style="filled", fillcolor="burlywood3"];
"blklab1 [LOOP_HEADER]"[label="Use while-loop\n to merge lhs and rhs...", xlabel=<<font color="goldenrod">Outside vars={items, lhs, rhs}</font>>];
"blklab1 [LOOP_EXIT]"[shape="box", label="//No free vars\nLoop Exit", xlabel=<<font color="goldenrod">block vars=in={}</font>>]
"blklab4 [LOOP_HEADER]"[label="Use while-loop\n to merge remaining lhs...", xlabel=<<font color="plum">Outside vars={items, lhs, rhs}</font>>];
"blklab4 [LOOP_EXIT]"[shape="box", label="//No free vars\nLoop Exit", xlabel=<<font color="plum">block vars=in={}</font>>]
"blklab5 [LOOP_HEADER]"[label="Use while-loop\n to merge remaining rhs...", xlabel=<<font color="springgreen4">Outside vars={items, lhs, rhs}</font>>]
"blklab5 [LOOP_EXIT]" [shape="box", label="//No free vars\nLoop Exit", xlabel=<<font color="springgreen4">block vars=in={}</font>>]

node [shape=box, style="filled", fillcolor="chartreuse2"];
"blklab0 [IF]"[label="if (start+1) < end:", shape="diamond"];
"blklab0 [THEN]"[label="then\n...", xlabel=<<font color="blue">outside vars={items}</font>>];
"blklab0 [ELSE]"[label="else", shape="box"];
"blklab5 [ENDIF]"[label="End if", shape="box"];



subgraph cluster_0 {
    node [style=filled];
    color=blue;
    "blklab0 [THEN]" "slice9 [INVOKE]" "sortV113 [INVOKE]" "slice15 [INVOKE]" "sortV120 [INVOKE]" "blklab1 [LOOP_HEADER]" "blklab4 [LOOP_HEADER]" "blklab5 [LOOP_HEADER]" "blklab5 [FREE]";
    subgraph cluster_1{
        color="goldenrod";
        "blklab1 [LOOP_HEADER]" "blklab1 [LOOP_EXIT]";
        label=<<font color="goldenrod">while-loop#1</font>>;
    }

    subgraph cluster_2{
        color="plum";
        "blklab4 [LOOP_HEADER]" "blklab4 [LOOP_EXIT]";
        label=<<font color="plum">while-loop#2"</font>>;
    }

    subgraph cluster_3{
        color="springgreen4";
        "blklab5 [LOOP_HEADER]" "blklab5 [LOOP_EXIT]";
        label=<<font color="springgreen4">while-loop#3</font>>;
    }

    label=<<font color="blue">if-block-scope#1</font>>;
} 


"entry [ENTRY]"->"blklab0 [IF]";
"blklab0 [IF]"->"blklab0 [THEN]" [label="Yes"];
"blklab0 [IF]"->"blklab0 [ELSE]" [label="No"];  
"blklab0 [THEN]"->"slice9 [INVOKE]" [fontsize="10", fontcolor=blue, headlabel="in={}"];
"slice9 [INVOKE]"->"sortV113 [INVOKE]"[fontsize="10", fontcolor=blue, taillabel="out={lhs}", headlabel="in={lhs}"];
"sortV113 [INVOKE]"->"slice15 [INVOKE]"[fontsize="10", fontcolor=blue, taillabel="out={lhs}", headlabel="in={lhs}"];
"slice15 [INVOKE]"->"sortV120 [INVOKE]"[fontsize="10", fontcolor=blue, taillabel="out={lhs, rhs}", headlabel="in={lhs, rhs}"];
"sortV120 [INVOKE]"->"blklab1 [LOOP_HEADER]"[fontsize="10", fontcolor=blue, taillabel="out={lhs, rhs}", headlabel=<<font color="goldenrod">in={}</font>>];
"blklab1 [LOOP_HEADER]"->"blklab1 [LOOP_HEADER]";
"blklab1 [LOOP_HEADER]"->"blklab1 [LOOP_EXIT]"[fontsize="10", fontcolor=goldenrod, taillabel="out={}", headlabel="in={}"];
"blklab1 [LOOP_EXIT]"->"blklab4 [LOOP_HEADER]"[fontsize="10", fontcolor=plum, headlabel="in={}"];
"blklab4 [LOOP_HEADER]"->"blklab4 [LOOP_HEADER]";
"blklab4 [LOOP_HEADER]"->"blklab4 [LOOP_EXIT]"[fontsize="10", fontcolor=plum, taillabel="out={}", headlabel="in={}"];
"blklab4 [LOOP_EXIT]"->"blklab5 [LOOP_HEADER]"[fontsize="10", fontcolor=springgreen4, headlabel="in={}"];
"blklab5 [LOOP_HEADER]"->"blklab5 [LOOP_HEADER]";
"blklab5 [LOOP_HEADER]"->"blklab5 [LOOP_EXIT]"[fontsize="10", fontcolor=springgreen4, taillabel="out={}", headlabel="in={}"];
"blklab5 [LOOP_EXIT]"->"blklab5 [FREE]" [fontsize="10", fontcolor=blue, headlabel="in={lhs, rhs}"];

"blklab5 [FREE]"->"blklab5 [ENDIF]";
"blklab0 [ELSE]"->"blklab5 [ENDIF]";
"blklab5 [ENDIF]"->"items [RETURN]" ;
"items [RETURN]"->"exit [EXIT]";


{rank=same; "blklab0 [THEN]" "blklab0 [ELSE]"}



}