@@ -0,0 +1,1329 @@
+#!/usr/bin/env python%0A%0A# Copyright 2016 Stanford University%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A#%0A%0Afrom __future__ import print_function%0Aimport subprocess, sys%0A%0Adef process(graph, output_filename):%0A    proc = subprocess.Popen(%5B'dot', '-Kdot', '-Tpdf', '-o', output_filename%5D, stdin = subprocess.PIPE)%0A    proc.communicate(graph)%0A    if proc.returncode != 0:%0A        assert False%0A%0Adef driver(prefix, suffix):%0A    run = %5B%5D%0A    acc = False%0A    num = 1%0A    for line in sys.stdin.read().split('%5Cn'):%0A        if line == 'digraph %7B':%0A            acc = True%0A        if acc:%0A            run.append(line)%0A        if acc and line == '%7D':%0A            acc = False%0A            process('%5Cn'.join(run), '%25s%25s%25s' %25 (prefix, num, suffix))%0A            run = %5B%5D%0A            num += 1%0A%0Aif __name__ == '__main__':%0A    driver('test_', '.pdf')%0A

Add visualization script for RDIR flow graphs.