(command.CommandList
  children: [
    (C {(Id.KW_Set set)} {(-o)} {(nounset)})
    (C {(Id.KW_Set set)} {(-o)} {(pipefail)})
    (C {(Id.KW_Set set)} {(-o)} {(errexit)})
    (C {(source)} {(test/common.sh)})
    (command.ShFunction
      name: process-file
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Id.Lit_VarLike 'proj=') ($ Id.VSub_Number '$1')})
            (C {(local)} {(Id.Lit_VarLike 'abs_path=') ($ Id.VSub_Number '$2')})
            (C {(local)} {(Id.Lit_VarLike 'rel_path=') ($ Id.VSub_Number '$3')})
            (C {(local)} 
              {(Id.Lit_VarLike 'raw_base=') (_tmp/wild/raw/) ($ Id.VSub_DollarName '$proj') (/) 
                ($ Id.VSub_DollarName '$rel_path')
              }
            )
            (C {(local)} 
              {(Id.Lit_VarLike 'www_base=') (_tmp/wild/www/) ($ Id.VSub_DollarName '$proj') (/) 
                ($ Id.VSub_DollarName '$rel_path')
              }
            )
            (C {(mkdir)} {(-p)} 
              {
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:85)
                  command_list: 
                    (command.CommandList
                      children: [(C {(dirname)} {($ Id.VSub_DollarName '$raw_base')})]
                    )
                )
              }
            )
            (C {(mkdir)} {(-p)} 
              {
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:96)
                  command_list: 
                    (command.CommandList
                      children: [(C {(dirname)} {($ Id.VSub_DollarName '$www_base')})]
                    )
                )
              }
            )
            (C {(log)} 
              {
                (DQ ('--- Processing ') ($ Id.VSub_DollarName '$proj') (' - ') 
                  ($ Id.VSub_DollarName '$rel_path')
                )
              }
            )
            (command.Simple
              words: [{(wc)} {($ Id.VSub_DollarName '$abs_path')}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:127)
                  fd: -1
                  arg_word: {(${ Id.VSub_Name raw_base) (__wc.txt)}
                )
              ]
            )
            (C {(cp)} {($ Id.VSub_DollarName '$abs_path')} {(${ Id.VSub_Name www_base) (.txt)})
            (C {(local)} {(Id.Lit_VarLike 'task_file=') (${ Id.VSub_Name raw_base) (__parse.task.txt)})
            (C {(local)} 
              {(Id.Lit_VarLike 'stderr_file=') (${ Id.VSub_Name raw_base) (__parse.stderr.txt)}
            )
            (C {(local)} {(Id.Lit_VarLike 'out_file=') (${ Id.VSub_Name www_base) (__ast.html)})
            (command.Simple
              words: [
                {(run-task-with-status)}
                {($ Id.VSub_DollarName '$task_file')}
                {(bin/osh)}
                {(--ast-format)}
                {(abbrev-html)}
                {(-n)}
                {($ Id.VSub_DollarName '$abs_path')}
              ]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:201)
                  fd: -1
                  arg_word: {($ Id.VSub_DollarName '$out_file')}
                )
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'2>' span_id:205)
                  fd: 2
                  arg_word: {($ Id.VSub_DollarName '$stderr_file')}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:task_file)
                  op: assign_op.Equal
                  rhs: {(${ Id.VSub_Name raw_base) (__osh2oil.task.txt)}
                  spids: [215]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:stderr_file)
                  op: assign_op.Equal
                  rhs: {(${ Id.VSub_Name raw_base) (__osh2oil.stderr.txt)}
                  spids: [222]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:out_file)
                  op: assign_op.Equal
                  rhs: {(${ Id.VSub_Name www_base) (__oil.txt)}
                  spids: [229]
                )
              ]
            )
            (command.Simple
              words: [
                {(run-task-with-status)}
                {($ Id.VSub_DollarName '$task_file')}
                {($ Id.VSub_DollarName '$OSH')}
                {(-n)}
                {(--fix)}
                {($ Id.VSub_DollarName '$abs_path')}
              ]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:253)
                  fd: -1
                  arg_word: {($ Id.VSub_DollarName '$out_file')}
                )
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'2>' span_id:257)
                  fd: 2
                  arg_word: {($ Id.VSub_DollarName '$stderr_file')}
                )
              ]
            )
          ]
        )
    )
    (C {(readonly)} {(Id.Lit_VarLike 'NUM_TASKS=') (200)})
    (C {(readonly)} {(Id.Lit_VarLike 'MANIFEST=') (_tmp/wild/MANIFEST.txt)})
    (command.ShFunction
      name: parse-in-parallel
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Id.Lit_VarLike 'failed=') (SQ )})
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {(xargs)} {(-n)} {(3)} {(-P)} {($ Id.VSub_DollarName '$JOBS')} {(--)} 
                  {($ Id.VSub_Number '$0')} {(process-file)}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:failed)
                      op: assign_op.Equal
                      rhs: {(1)}
                      spids: [307]
                    )
                  ]
                )
              ]
            )
            (C {(tree)} {(-L)} {(3)} {(_tmp/wild)})
          ]
        )
    )
    (command.ShFunction
      name: parse-and-report
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} 
              {(Id.Lit_VarLike 'manifest_regex=') 
                (braced_var_sub
                  token: (Token id:Id.VSub_Number val:1 span_id:345)
                  suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{})
                )
              }
            )
            (command.TimeBlock
              pipeline: 
                (command.BraceGroup
                  children: [
                    (C {(test/wild.sh)} {(write-manifest)})
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$manifest_regex'))})
                              terminator: (Token id:Id.Op_Semi val:';' span_id:374)
                            )
                          ]
                          action: [
                            (command.Pipeline
                              children: [
                                (C {(egrep)} {(--)} {(DQ ($ Id.VSub_DollarName '$manifest_regex'))} 
                                  {($ Id.VSub_DollarName '$MANIFEST')}
                                )
                                (C {(parse-in-parallel)})
                              ]
                              negated: F
                            )
                          ]
                          spids: [365 376]
                        )
                      ]
                      else_action: [
                        (command.Pipeline
                          children: [
                            (C {(cat)} {($ Id.VSub_DollarName '$MANIFEST')})
                            (C {(parse-in-parallel)})
                          ]
                          negated: F
                        )
                      ]
                    )
                    (C {(make-report)})
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: wild-report
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(test/wild_report.py)} {(DQ ($ Id.VSub_At '$@'))}]
              more_env: [
                (env_pair
                  name: PYTHONPATH
                  val: {(Id.Lit_TildeLike '~') (/hg/json-template/python)}
                  spids: [425]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: _link
      body: 
        (command.BraceGroup
          children: [(C {(ln)} {(-s)} {(-f)} {(-v)} {(DQ ($ Id.VSub_At '$@'))})]
        )
    )
    (command.ShFunction
      name: make-report
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(cat)} {($ Id.VSub_DollarName '$MANIFEST')})
                (C {(wild-report)} {(summarize-dirs)})
              ]
              negated: F
            )
            (C {(_link)} 
              (word.BracedTree
                parts: [
                  ($ Id.VSub_DollarName '$PWD')
                  (/web/osh-to-oil.)
                  (word_part.BracedTuple words:[{(html)} {(js)}])
                ]
              ) {(_tmp/wild/www)}
            )
            (C {(_link)} {($ Id.VSub_DollarName '$PWD') (/web)} {(_tmp)})
          ]
        )
    )
    (command.ShFunction
      name: test-wild-report
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(egrep)} {(--)} {(SQ (Token id:Id.Lit_Chars val:'^oil|^perf-tools' span_id:527))} 
                  {($ Id.VSub_DollarName '$MANIFEST')}
                )
                (C {(wild-report)} {(summarize-dirs)})
              ]
              negated: F
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(test)} 
                  {
                    (DQ 
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:546)
                        command_list: 
                          (command.CommandList
                            children: [(C {(basename)} {($ Id.VSub_Number '$0')})]
                          )
                      )
                    )
                  } {(Id.Lit_Equals '=')} {(SQ (Token id:Id.Lit_Chars val:wild-runner.sh span_id:556))}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:558)
            )
          ]
          action: [(C {(DQ ($ Id.VSub_At '$@'))})]
          spids: [541 560]
        )
      ]
    )
  ]
)