(CommandList
  children: [
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (C {(set)} {(-o)} {(errexit)})
    (C {(source)} {(test/common.sh)})
    (C {(source)} {(benchmarks/common.sh)})
    (Assignment
      keyword: Assign_Readonly
      pairs: [(assign_pair lhs:(LhsName name:BASE_DIR) op:Equal rhs:{(_tmp/vm-baseline)} spids:[46])]
      spids: [44]
    )
    (FuncDef
      name: measure
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:provenance)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [63]
                )
              ]
              spids: [61]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:base_dir)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Number 2>
                        suffix_op: 
                          (StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {(_tmp) (Lit_Slash /) (vm-baseline)}
                          )
                        spids: [70 76]
                      )
                    }
                  spids: [69]
                )
              ]
              spids: [67]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:name)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(basename)} {($ VSub_Name '$provenance')})]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [87 91]
                      )
                    }
                  spids: [86]
                )
              ]
              spids: [84]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:prefix)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Name name>
                        suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(.provenance.txt)})
                        spids: [97 101]
                      )
                    }
                  spids: [96]
                )
              ]
              spids: [94]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:host)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(hostname)})])
                        left_token: <Left_CommandSub '$('>
                        spids: [111 113]
                      )
                    }
                  spids: [110]
                )
              ]
              spids: [108]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:out_dir)
                  op: Equal
                  rhs: {(DQ ($ VSub_Name '$base_dir') (/) ($ VSub_Name '$prefix'))}
                  spids: [118]
                )
              ]
              spids: [116]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$out_dir')})
            (Pipeline
              children: [
                (C {(cat)} {($ VSub_Name '$provenance')})
                (While
                  cond: [
                    (Sentence
                      child: (C {(read)} {(_)} {(_)} {(_)} {(sh_path)} {(shell_hash)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  body: 
                    (DoGroup
                      children: [
                        (Assignment
                          keyword: Assign_Local
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:sh_name)
                              op: Equal
                              rhs: 
                                {
                                  (CommandSubPart
                                    command_list: 
                                      (CommandList
                                        children: [(C {(basename)} {($ VSub_Name '$sh_path')})]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [165 169]
                                  )
                                }
                              spids: [164]
                            )
                          ]
                          spids: [162]
                        )
                        (Assignment
                          keyword: Assign_Local
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:out)
                              op: Equal
                              rhs: 
                                {
                                  (DQ ($ VSub_Name '$out_dir') (/) (${ VSub_Name sh_name) (-) 
                                    (${ VSub_Name shell_hash) (.txt)
                                  )
                                }
                              spids: [179]
                            )
                          ]
                          spids: [177]
                        )
                        (SimpleCommand
                          words: [
                            {($ VSub_Name '$sh_path')}
                            {(-c)}
                            {(SQ <'sleep 0.001; cat /proc/$$/status'>)}
                          ]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: 16777215
                              arg_word: {($ VSub_Name '$out')}
                              spids: [202]
                            )
                          ]
                        )
                      ]
                      spids: [159 207]
                    )
                )
              ]
              negated: F
            )
            (C {(echo)})
            (C {(echo)} {(DQ ($ VSub_Name '$out_dir') (':'))})
            (C {(ls)} {(-l)} {($ VSub_Name '$out_dir')})
          ]
          spids: [58]
        )
      spids: [54 57]
    )
    (FuncDef
      name: demo
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              flags: [-a]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:job_dirs)
                  op: Equal
                  rhs: 
                    {
                      (ArrayLiteralPart
                        words: [{($ VSub_Name '$BASE_DIR') (/lisa.2017-) (Lit_Other '*')}]
                      )
                    }
                  spids: [245]
                )
              ]
              spids: [241]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dir1)
                  op: Equal
                  rhs: {($ VSub_Name '$BASE_DIR') (/stage1)}
                  spids: [255]
                )
              ]
              spids: [253]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dir2)
                  op: Equal
                  rhs: {($ VSub_Name '$BASE_DIR') (/stage2)}
                  spids: [262]
                )
              ]
              spids: [260]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$dir1')} {($ VSub_Name '$dir2')})
            (SimpleCommand
              words: [
                {(benchmarks/virtual_memory.py)}
                {(baseline)}
                {
                  (BracedVarSub
                    token: <VSub_Name job_dirs>
                    bracket_op: 
                      (ArrayIndex
                        expr: (ArithUnary op_id:Node_UnaryMinus child:(ArithWord w:{(Lit_Digits 1)}))
                      )
                    spids: [283 289]
                  )
                }
              ]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {($ VSub_Name '$dir1') (/vm-baseline.csv)}
                  spids: [293]
                )
              ]
            )
            (C {(benchmarks/report.R)} {(vm-baseline)} {($ VSub_Name '$dir1')} {($ VSub_Name '$dir2')})
          ]
          spids: [238]
        )
      spids: [234 237]
    )
    (FuncDef
      name: stage1
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:raw_dir)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: 
                          (StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {($ VSub_Name '$BASE_DIR') (Lit_Slash /) (raw)}
                          )
                        spids: [324 330]
                      )
                    }
                  spids: [323]
                )
              ]
              spids: [321]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:out)
                  op: Equal
                  rhs: {($ VSub_Name '$BASE_DIR') (/stage1)}
                  spids: [335]
                )
              ]
              spids: [333]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$out')})
            (Assignment
              keyword: Assign_Local
              flags: [-a]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:m1)
                  op: Equal
                  rhs: 
                    {
                      (ArrayLiteralPart
                        words: [{(../benchmark-data/vm-baseline/flanders.) (Lit_Other '*')}]
                      )
                    }
                  spids: [356]
                )
              ]
              spids: [352]
            )
            (Assignment
              keyword: Assign_Local
              flags: [-a]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:m2)
                  op: Equal
                  rhs: 
                    {
                      (ArrayLiteralPart
                        words: [{(../benchmark-data/vm-baseline/lisa.) (Lit_Other '*')}]
                      )
                    }
                  spids: [367]
                )
              ]
              spids: [363]
            )
            (Assignment
              keyword: Assign_Local
              flags: [-a]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:latest)
                  op: Equal
                  rhs: 
                    {
                      (ArrayLiteralPart
                        words: [
                          {
                            (BracedVarSub
                              token: <VSub_Name m1>
                              bracket_op: 
                                (ArrayIndex
                                  expr: 
                                    (ArithUnary
                                      op_id: Node_UnaryMinus
                                      child: (ArithWord w:{(Lit_Digits 1)})
                                    )
                                )
                              spids: [385 391]
                            )
                          }
                          {
                            (BracedVarSub
                              token: <VSub_Name m2>
                              bracket_op: 
                                (ArrayIndex
                                  expr: 
                                    (ArithUnary
                                      op_id: Node_UnaryMinus
                                      child: (ArithWord w:{(Lit_Digits 1)})
                                    )
                                )
                              spids: [393 399]
                            )
                          }
                        ]
                      )
                    }
                  spids: [383]
                )
              ]
              spids: [379]
            )
            (Pipeline
              children: [
                (C {(benchmarks/virtual_memory.py)} {(baseline)} 
                  {
                    (DQ 
                      (BracedVarSub
                        token: <VSub_Name latest>
                        bracket_op: (WholeArray op_id:Lit_At)
                        spids: [409 414]
                      )
                    )
                  }
                )
                (C {(tee)} {($ VSub_Name '$out') (/vm-baseline.csv)})
              ]
              negated: F
            )
          ]
          spids: [318]
        )
      spids: [314 317]
    )
    (FuncDef
      name: print-report
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:in_dir)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [438]
                )
              ]
              spids: [436]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:base_url)
                  op: Equal
                  rhs: {(SQ <../../web>)}
                  spids: [444]
                )
              ]
              spids: [442]
            )
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: 
                    {
                      (DQ ('<!DOCTYPE html>\n') ('<html>\n') ('  <head>\n') 
                        ('    <title>Virtual Memory Baseline</title>\n') ('    <script type=') (Right_DoubleQuote '"') (text/javascript) (Right_DoubleQuote '"') (' src=') 
                        (Right_DoubleQuote '"') ($ VSub_Name '$base_url') (/table/table-sort.js) (Right_DoubleQuote '"') ('></script>\n') 
                        ('    <link rel=') (Right_DoubleQuote '"') (stylesheet) (Right_DoubleQuote '"') (' type=') (Right_DoubleQuote '"') (text/css) 
                        (Right_DoubleQuote '"') (' href=') (Right_DoubleQuote '"') ($ VSub_Name '$base_url') (/table/table-sort.css) 
                        (Right_DoubleQuote '"') (' />\n') ('    <link rel=') (Right_DoubleQuote '"') (stylesheet) (Right_DoubleQuote '"') (' type=') 
                        (Right_DoubleQuote '"') (text/css) (Right_DoubleQuote '"') (' href=') (Right_DoubleQuote '"') ($ VSub_Name '$base_url') 
                        (/benchmarks.css) (Right_DoubleQuote '"') (' />\n') ('\n') ('  </head>\n') ('  <body>\n') ('    <p id=') 
                        (Right_DoubleQuote '"') (home-link) (Right_DoubleQuote '"') ('>\n') ('      <a href=') (Right_DoubleQuote '"') (/) 
                        (Right_DoubleQuote '"') ('>oilshell.org</a>\n') ('    </p>\n') ('    <h2>Virtual Memory Baseline</h2>\n') ('\n') 
                        ('    <h3>Memory Used at Startup (MB)</h3>\n') ('\n') ('    <p>Running under <code>osh-ovm</code>.  Memory usage is measured in MB\n') 
                        ('    (powers of 10), not MiB (powers of 2).</p>\n') ('\n')
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: T
                  spids: [453]
                )
              ]
            )
            (C {(csv2html)} {($ VSub_Name '$in_dir') (/vm-baseline.csv)})
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: {(DQ ('    <!-- <h3>Shell and Host Details</h3> -->\n'))}
                  do_expansion: True
                  here_end: EOF
                  was_filled: T
                  spids: [534]
                )
              ]
            )
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: {(DQ ('  </body>\n') ('</html>\n'))}
                  do_expansion: True
                  here_end: EOF
                  was_filled: T
                  spids: [551]
                )
              ]
            )
          ]
          spids: [433]
        )
      spids: [429 432]
    )
    (FuncDef
      name: parser-dump-demo
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:out_dir)
                  op: Equal
                  rhs: {(_tmp/virtual-memory)}
                  spids: [586]
                )
              ]
              spids: [584]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$out_dir')})
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:input)
                  op: Equal
                  rhs: {(benchmarks/testdata/abuild)}
                  spids: [608]
                )
              ]
              spids: [606]
            )
            (C {(bin/osh)} {(--parser-mem-dump)} {($ VSub_Name '$out_dir') (/parser.txt)} {(-n)} 
              {(--ast-format)} {(none)} {($ VSub_Name '$input')}
            )
            (C {(grep)} {(SQ <'^Vm'>)} {($ VSub_Name '$out_dir') (/parser.txt)})
          ]
          spids: [581]
        )
      spids: [577 580]
    )
    (FuncDef
      name: runtime-dump-demo
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:out_dir)
                  op: Equal
                  rhs: {(_tmp/virtual-memory)}
                  spids: [664]
                )
              ]
              spids: [662]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$out_dir')})
            (C {(bin/osh)} {(--parser-mem-dump)} {($ VSub_Name '$out_dir') (/parser.txt)} 
              {(--runtime-mem-dump)} {($ VSub_Name '$out_dir') (/runtime.txt)} {(-c)} {(SQ <'echo $(echo hi)'>)}
            )
            (C {(grep)} {(SQ <'^Vm'>)} {($ VSub_Name '$out_dir') (/parser.txt)} 
              {($ VSub_Name '$out_dir') (/runtime.txt)}
            )
          ]
          spids: [650]
        )
      spids: [646 649]
    )
    (C {(DQ ($ VSub_At '$@'))})
  ]
)