(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/oheap)} spids:[49])]
      spids: [47]
    )
    (FuncDef
      name: encode-one
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:script)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [62]
                )
              ]
              spids: [60]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:oheap_out)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                  spids: [68]
                )
              ]
              spids: [66]
            )
            (SimpleCommand
              words: [{(bin/osh)} {(-n)} {(--ast-format)} {(oheap)} {(DQ ($ VSub_Name '$script'))}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {($ VSub_Name '$oheap_out')}
                  spids: [84]
                )
              ]
            )
          ]
          spids: [57]
        )
      spids: [53 56]
    )
    (FuncDef
      name: task-spec
      body: 
        (BraceGroup
          children: [
            (While
              cond: [(Sentence child:(C {(read)} {(path)}) terminator:<Op_Semi ';'>)]
              body: 
                (DoGroup
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ($ VSub_Name '$path') (' _tmp/oheap/') 
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [(C {(basename)} {($ VSub_Name '$path')})]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [113 117]
                          ) (__oheap)
                        )
                      }
                    )
                  ]
                  spids: [105 122]
                )
              redirects: [
                (Redir
                  op_id: Redir_Less
                  fd: 16777215
                  arg_word: {(benchmarks/osh-parser-files.txt)}
                  spids: [124]
                )
              ]
            )
          ]
          spids: [95]
        )
      spids: [91 94]
    )
    (FuncDef
      name: encode-all
      body: 
        (BraceGroup
          children: [
            (C {(mkdir)} {(-p)} {(_tmp/oheap)})
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:times_csv)
                  op: Equal
                  rhs: {(_tmp/oheap/times.csv)}
                  spids: [149]
                )
              ]
              spids: [147]
            )
            (SimpleCommand
              words: [{(echo)} {(SQ <'status,elapsed_secs'>)}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {($ VSub_Name '$times_csv')}
                  spids: [159]
                )
              ]
            )
            (Pipeline
              children: [
                (C {(task-spec)})
                (C {(xargs)} {(-n)} {(2)} {(--verbose)} {(--)} {(benchmarks/time.py)} {(--output)} 
                  {($ VSub_Name '$times_csv')} {(--)} {($ VSub_Number '$0')} {(encode-one)}
                )
              ]
              negated: F
            )
          ]
          spids: [136]
        )
      spids: [132 135]
    )
    (FuncDef
      name: compress-oheap
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:c_dir)
                  op: Equal
                  rhs: {($ VSub_Name '$BASE_DIR') (/oheap-compressed)}
                  spids: [211]
                )
              ]
              spids: [209]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$c_dir')})
            (ForEach
              iter_name: bin
              iter_words: [{(_tmp/oheap/) (Lit_Other '*') (__oheap)}]
              do_arg_iter: F
              body: 
                (DoGroup
                  children: [
                    (Assignment
                      keyword: Assign_Local
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:name)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [(C {(basename)} {($ VSub_Name '$bin')})]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [240 244]
                              )
                            }
                          spids: [239]
                        )
                      ]
                      spids: [237]
                    )
                    (C {(log)} {(DQ ('Compressing ') ($ VSub_Name '$name'))})
                    (SimpleCommand
                      words: [{(gzip)} {(--stdout)} {($ VSub_Name '$bin')}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {($ VSub_Name '$c_dir') (/) ($ VSub_Name '$name') (.gz)}
                          spids: [261]
                        )
                      ]
                    )
                    (SimpleCommand
                      words: [{(xz)} {(--stdout)} {($ VSub_Name '$bin')}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {($ VSub_Name '$c_dir') (/) ($ VSub_Name '$name') (.xz)}
                          spids: [275]
                        )
                      ]
                    )
                  ]
                  spids: [234 283]
                )
              spids: [228 232]
            )
          ]
          spids: [206]
        )
      spids: [202 205]
    )
    (FuncDef
      name: compress-text
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:c_dir)
                  op: Equal
                  rhs: {($ VSub_Name '$BASE_DIR') (/src-compressed)}
                  spids: [297]
                )
              ]
              spids: [295]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$c_dir')})
            (While
              cond: [(Sentence child:(C {(read)} {(src)}) terminator:<Op_Semi ';'>)]
              body: 
                (DoGroup
                  children: [
                    (Assignment
                      keyword: Assign_Local
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:name)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [(C {(basename)} {($ VSub_Name '$src')})]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [323 327]
                              )
                            }
                          spids: [322]
                        )
                      ]
                      spids: [320]
                    )
                    (C {(log)} {(DQ ('Compressing ') ($ VSub_Name '$name'))})
                    (SimpleCommand
                      words: [{(gzip)} {(--stdout)} {($ VSub_Name '$src')}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {($ VSub_Name '$c_dir') (/) (${ VSub_Name name) (__text.gz)}
                          spids: [344]
                        )
                      ]
                    )
                    (SimpleCommand
                      words: [{(xz)} {(--stdout)} {($ VSub_Name '$src')}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {($ VSub_Name '$c_dir') (/) (${ VSub_Name name) (__text.xz)}
                          spids: [360]
                        )
                      ]
                    )
                  ]
                  spids: [317 370]
                )
              redirects: [
                (Redir
                  op_id: Redir_Less
                  fd: 16777215
                  arg_word: {(benchmarks/osh-parser-files.txt)}
                  spids: [372]
                )
              ]
            )
          ]
          spids: [292]
        )
      spids: [288 291]
    )
    (FuncDef
      name: print-size
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:c1)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [389]
                )
              ]
              spids: [387]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:c2)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                  spids: [395]
                )
              ]
              spids: [393]
            )
            (C {(shift)} {(2)})
            (C {(find)} {(DQ ($ VSub_At '$@'))} {(-maxdepth)} {(0)} {(-printf)} 
              {
                (DQ ('%s,') ($ VSub_Name '$c1') (',') ($ VSub_Name '$c2') (',%p') (Lit_Other '\\') (n))
              }
            )
          ]
          spids: [384]
        )
      spids: [380 383]
    )
    (FuncDef
      name: print-csv
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(SQ <'num_bytes,format,compression,path'>)})
            (C {(print-size)} {(text)} {(none)} {(benchmarks/testdata/) (Lit_Other '*')})
            (C {(print-size)} {(text)} {(gz)} 
              {($ VSub_Name '$BASE_DIR') (/src-compressed/) (Lit_Other '*') (.gz)}
            )
            (C {(print-size)} {(text)} {(xz)} 
              {($ VSub_Name '$BASE_DIR') (/src-compressed/) (Lit_Other '*') (.xz)}
            )
            (C {(print-size)} {(oheap)} {(none)} 
              {($ VSub_Name '$BASE_DIR') (/) (Lit_Other '*') (__oheap)}
            )
            (C {(print-size)} {(oheap)} {(gz)} 
              {($ VSub_Name '$BASE_DIR') (/oheap-compressed/) (Lit_Other '*') (.gz)}
            )
            (C {(print-size)} {(oheap)} {(xz)} 
              {($ VSub_Name '$BASE_DIR') (/oheap-compressed/) (Lit_Other '*') (.xz)}
            )
          ]
          spids: [438]
        )
      spids: [434 437]
    )
    (FuncDef
      name: measure
      body: 
        (BraceGroup
          children: [(C {(encode-all)}) (C {(compress-oheap)}) (C {(compress-text)})]
          spids: [533]
        )
      spids: [529 532]
    )
    (FuncDef
      name: stage1
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:out_dir)
                  op: Equal
                  rhs: {($ VSub_Name '$BASE_DIR') (/stage1)}
                  spids: [556]
                )
              ]
              spids: [554]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name '$out_dir')})
            (SimpleCommand
              words: [{(print-csv)}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {($ VSub_Name '$out_dir') (/sizes.csv)}
                  spids: [570]
                )
              ]
            )
          ]
          spids: [551]
        )
      spids: [547 550]
    )
    (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: [587]
                )
              ]
              spids: [585]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:base_url)
                  op: Equal
                  rhs: {(SQ <../../web>)}
                  spids: [593]
                )
              ]
              spids: [591]
            )
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: 
                    {
                      (DQ ('<!DOCTYPE html>\n') ('<html>\n') ('  <head>\n') 
                        ('    <title>OHeap Encoding</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>OHeap Encoding</h2>\n') ('\n') 
                        ('    <h3>Encoding Size (KB)</h3>\n') ('\n') ('    <p>Sizes are in KB (powers of 10), not KiB (powers of 2).</p>\n')
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: T
                  spids: [602]
                )
              ]
            )
            (C {(csv2html)} {($ VSub_Name '$in_dir') (/encoding_size.csv)})
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: {(DQ ('    <h3>Encoding Ratios</h3>\n'))}
                  do_expansion: True
                  here_end: EOF
                  was_filled: T
                  spids: [677]
                )
              ]
            )
            (C {(csv2html)} {($ VSub_Name '$in_dir') (/encoding_ratios.csv)})
            (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: [692]
                )
              ]
            )
          ]
          spids: [582]
        )
      spids: [578 581]
    )
    (FuncDef
      name: decode
      body: 
        (BraceGroup
          children: [
            (ForEach
              iter_name: bin
              iter_words: [{(_tmp/oheap/) (Lit_Other '*') (.oheap)}]
              do_arg_iter: F
              body: 
                (DoGroup
                  children: [
                    (TimeBlock
                      pipeline: 
                        (Pipeline
                          children: [(C {(_tmp/osh_demo)} {($ VSub_Name '$bin')}) (C {(wc)} {(-l)})]
                          negated: F
                        )
                    )
                  ]
                  spids: [838 854]
                )
              spids: [832 836]
            )
          ]
          spids: [824]
        )
      spids: [820 823]
    )
    (C {(DQ ($ VSub_At '$@'))})
  ]
)