(command.CommandList
  children: [
    (command.Case
      to_match: {($ Id.VSub_Number '$1')}
      arms: [
        (case_arm
          pat_list: [{<-> <Id.Lit_Star '*'>}]
          action: [(C {<set>} {<-> ($ Id.VSub_Hyphen '$-')} {<x>} {<x>})]
          spids: [22 24 -1 35]
        )
      ]
    )
    (command.Case
      to_match: {($ Id.VSub_Pound '$#')}
      arms: [
        (case_arm pat_list:[{<1>}] spids:[44 45 47 -1])
        (case_arm
          pat_list: [{<Id.Lit_Star '*'>}]
          action: [
            (command.Simple
              words: [{<echo>} {(DQ <'Usage: '> ($ Id.VSub_Number '$0') <' <mandir>'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [49 50 -1 68]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cd>} {($ Id.VSub_Number '$1')})
        (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
      ]
    )
    (command.Pipeline
      children: [
        (BraceGroup
          children: [
            (command.ForEach
              iter_name: chap
              iter_words: [{<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.ForEach
                      iter_name: page
                      iter_words: [
                        {<man> ($ Id.VSub_DollarName '$chap') <'/'> <Id.Lit_Star '*'> <.> 
                          ($ Id.VSub_DollarName '$chap')
                        }
                      ]
                      do_arg_iter: F
                      body: 
                        (command.DoGroup
                          children: [
                            (command.If
                              arms: [
                                (if_arm
                                  cond: 
                                    (condition.Shell
                                      commands: [
                                        (command.Sentence
                                          child: 
                                            (C {<test>} {<-f>} {(DQ ($ Id.VSub_DollarName '$page'))})
                                          terminator: <Id.Op_Semi _>
                                        )
                                      ]
                                    )
                                  action: [
                                    (command.Simple
                                      words: [
                                        {<sed>}
                                        {<-e>}
                                        {
                                          (SQ <'s/\t/ /g\n'> <'\t\t\t\ts/"NAME"/NAME/g\n'> 
                                            <'\t\t\t\ts/^\\.Sh/\\.SH/g\n'> <'\t\t\t\t/^\\.SH NAME/,/^\\.SH /!d\n'> <'\t\t\t\t/^\\.SH /d\n'> <'\t\t\t\ts/\\\\f.//g\n'> 
                                            <'\t\t\t\ts/\\\\s[+-].//g\n'> <'\t\t\t\ts/\\\\s.//g\n'> <'\t\t\t\ts/\\\\//\n'> <'\t\t\t\t'>
                                          ) (DQ <'s/ - / ('> ($ Id.VSub_DollarName '$chap') <') - /'>)
                                        }
                                      ]
                                      redirects: [
                                        (redir
                                          op: <Id.Redir_Less '<'>
                                          loc: (redir_loc.Fd fd:0)
                                          arg: {(DQ ($ Id.VSub_DollarName '$page'))}
                                        )
                                      ]
                                      do_fork: T
                                    )
                                  ]
                                  spids: [141 152]
                                )
                              ]
                            )
                          ]
                        )
                    )
                  ]
                )
            )
            (command.ForEach
              iter_name: page
              iter_words: [{<'man1x/'> <Id.Lit_Star '*'> <.1x>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: (C {<test>} {<-f>} {(DQ ($ Id.VSub_DollarName '$page'))})
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (command.Simple
                              words: [
                                {<sed>}
                                {<-e>}
                                {
                                  (SQ <'s/\t/ /g\n'> <'\t\t\t/^\\.CD /!d\n'> <'\t\t\ts/^[^"]*"//\n'> 
                                    <'\t\t\ts/"[^"]*$//\n'> <'\t\t\ts/\\\\(en/-/g\n'> <'\t\t\ts/\\\\f.//g\n'> <'\t\t\ts/\\\\s[+-].//g\n'> <'\t\t\ts/\\\\s.//g\n'> 
                                    <'\t\t\ts/\\\\\\*(M2/MINIX/g\n'> <'\t\t\ts/\\\\//\n'> <'\t\t\t'>
                                  ) (DQ <'s/ - / (1x) - /'>)
                                }
                              ]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Less '<'>
                                  loc: (redir_loc.Fd fd:0)
                                  arg: {(DQ ($ Id.VSub_DollarName '$page'))}
                                )
                              ]
                              do_fork: T
                            )
                          ]
                          spids: [216 227]
                        )
                      ]
                    )
                  ]
                )
            )
            (C {<trap>} {(SQ <'rm -f /tmp/mkw[cmn]$$; exit 1'>)} {<1>} {<2>} {<15>})
            (command.ForEach
              iter_name: chap
              iter_words: [{<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.Simple
                      words: [{<ls>} {<cat> ($ Id.VSub_DollarName '$chap')}]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '2>'>
                          loc: (redir_loc.Fd fd:2)
                          arg: {<'/dev/null'>}
                        )
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/tmp/mkwc'> ($ Id.VSub_Dollar '$$')}
                        )
                      ]
                      do_fork: T
                    )
                    (command.Simple
                      words: [{<ls>} {<man> ($ Id.VSub_DollarName '$chap')}]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '2>'>
                          loc: (redir_loc.Fd fd:2)
                          arg: {<'/dev/null'>}
                        )
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/tmp/mkwm'> ($ Id.VSub_Dollar '$$')}
                        )
                      ]
                      do_fork: T
                    )
                    (command.Simple
                      words: [
                        {<comm>}
                        {<-23>}
                        {<'/tmp/mkwc'> ($ Id.VSub_Dollar '$$')}
                        {<'/tmp/mkwm'> ($ Id.VSub_Dollar '$$')}
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/tmp/mkwn'> ($ Id.VSub_Dollar '$$')}
                        )
                      ]
                      do_fork: T
                    )
                    (command.Simple
                      words: [
                        {<sed>}
                        {<-e>}
                        {
                          (DQ <'/.*'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) <.> 
                            ($ Id.VSub_DollarName '$chap') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'/!d\n'> <'\t\t\ts/'> 
                            (word_part.EscapedLiteral
                              token: <Id.Lit_EscapedChar '\\\\'>
                            ) <.> ($ Id.VSub_DollarName '$chap') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'/ ('> 
                            ($ Id.VSub_DollarName '$chap') <') - ???/'>
                          )
                        }
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_Less '<'>
                          loc: (redir_loc.Fd fd:0)
                          arg: {<'/tmp/mkwn'> ($ Id.VSub_Dollar '$$')}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                )
            )
            (C {<rm>} {<-f>} 
              {<'/tmp/mkw'> <Id.Lit_LBracket '['> <cmn> <Id.Lit_RBracket ']'> ($ Id.VSub_Dollar '$$')}
            )
          ]
        )
        (BraceGroup
          children: [
            (C {<sed>} {<-e>} 
              {(SQ <'s/  */ /g\n'> <'\t\ts/^ //\n'> <'\t\ts/ $//\n'> <'\t\t/^$/d\n'> <'\t\t/-/!d'>)}
            )
          ]
        )
        (BraceGroup
          children: [(C {<sort>} {<-t> (SQ <'('>)} {<Id.Lit_Other '+'> <1>} {<-o>} {<whatis>})]
        )
      ]
      negated: F
    )
  ]
)