(command.CommandList
  children: [
    (C {(export)} {(Lit_VarLike 'PATH=') (/bin) (Lit_Other ':') (/usr/bin)})
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:LC_ALL) op:Equal rhs:{(C)})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:FS) op:Equal rhs:{(SQ <': '>)})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:LIBDEPENDS) op:Equal rhs:{(./_libdeps)})]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:USRSRC)
          op: Equal
          rhs: 
            {
              (braced_var_sub
                token: <VSub_Number 1>
                suffix_op: 
                  (suffix_op.Unary
                    op_id: VTest_ColonHyphen
                    arg_word: {(Lit_Slash /) (usr) (Lit_Slash /) (src)}
                  )
              )
            }
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LIBS)
          op: Equal
          rhs: 
            {
              (DQ ('\n') ('\tlib\n') ('\tgnu/lib\n') ('\tkerberos5/lib\n') ('\tsecure/lib\n') 
                ('\tusr.bin/lex/lib\n') ('\tcddl/lib\n')
              )
            }
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SED_FILTER)
          op: Equal
          rhs: 
            {
              (DQ ('\n') ('sed -E\n') ("    -e's; ;! ;g'\n") ("    -e's;") (Lit_Other '$') (";!;'\n") 
                ("    -e's;-lbsdxml!;lib/libexpat;g'\n") ("    -e's;-lpthread!;lib/libthr;g'\n") ("    -e's;-lm!;lib/msun;g'\n") 
                ("    -e's;-l(ncurses|termcap)!;lib/ncurses/ncurses;g'\n") ("    -e's;-l(gcc)!;gnu/lib/lib") (Lit_Other '\\') ("1;g'\n") 
                ("    -e's;-lssp_nonshared!;gnu/lib/libssp/libssp_nonshared;g'\n") ("    -e's;-l(asn1|hdb|kdc|heimbase|heimntlm|heimsqlite|hx509|krb5|roken|wind)!;kerberos5/lib/lib") 
                (Lit_Other '\\') ("1;g'\n") ("    -e's;-l(crypto|ssh|ssl)!;secure/lib/lib") (Lit_Other '\\') ("1;g'\n") 
                ("    -e's;-l([^!]+)!;lib/lib") (Lit_Other '\\') ("1;g'\n")
              )
            }
        )
      ]
    )
    (command.ShFunction
      name: genlibdepends
      body: 
        (command.BraceGroup
          children: [
            (command.Subshell
              command_list: 
                (command.CommandList
                  children: [
                    (C {(cd)} {(${ VSub_Name USRSRC)})
                    (command.Pipeline
                      children: [
                        (C {(find)} {(-s)} {(${ VSub_Name LIBS)} {(-mindepth)} {(1)} {(-name)} {(Makefile)})
                        (C {(xargs)} {(grep)} {(-l)} {(SQ <'bsd\\.lib\\.mk'>)})
                        (command.WhileUntil
                          keyword: <KW_While while>
                          cond: [
                            (command.Sentence
                              child: (C {(read)} {(makefile)})
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          body: 
                            (command.DoGroup
                              children: [
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:libdir)
                                      op: Equal
                                      rhs: 
                                        {
                                          (command_sub
                                            left_token: <Left_DollarParen '$('>
                                            command_list: 
                                              (command.CommandList
                                                children: [(C {(dirname)} {(${ VSub_Name makefile)})]
                                              )
                                          )
                                        }
                                    )
                                  ]
                                )
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:deps)
                                      op: Equal
                                      rhs: 
                                        {
                                          (command_sub
                                            left_token: <Left_DollarParen '$('>
                                            command_list: 
                                              (command.CommandList
                                                children: [
                                                  (C {(cd)} {(${ VSub_Name libdir)})
                                                  (C {(make)} {(-m)} {(${ VSub_Name USRSRC) (/share/mk)} 
                                                    {(-V)} {(LDADD)}
                                                  )
                                                ]
                                              )
                                          )
                                        }
                                    )
                                  ]
                                )
                                (command.If
                                  arms: [
                                    (if_arm
                                      cond: [
                                        (command.Sentence
                                          child: 
                                            (C {(Lit_LBracket '[')} {(DQ (${ VSub_Name deps))} 
                                              {(Lit_RBracket ']')}
                                            )
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      action: [
                                        (C {(echo)} 
                                          {(${ VSub_Name libdir) (DQ (${ VSub_Name FS)) 
                                            (command_sub
                                              left_token: <Left_DollarParen '$('>
                                              command_list: 
                                                (command.CommandList
                                                  children: [
                                                    (command.Pipeline
                                                      children: [
                                                        (C {(echo)} {(${ VSub_Name deps)})
                                                        (C {(eval)} {(${ VSub_Name SED_FILTER)})
                                                      ]
                                                      negated: F
                                                    )
                                                  ]
                                                )
                                            )
                                          }
                                        )
                                      ]
                                    )
                                  ]
                                )
                              ]
                            )
                        )
                      ]
                      negated: F
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: main
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} {(KW_Bang '!')} {(-f)} {(${ VSub_Name LIBDEPENDS)} 
                          {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [{(genlibdepends)}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_Great '>'>
                          fd: 16777215
                          arg_word: {(${ VSub_Name LIBDEPENDS)}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:prebuild_libs)
                  op: Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(awk)} {(-F) (DQ (${ VSub_Name FS))} {(SQ <'{ print $2 }'>)} 
                                    {(${ VSub_Name LIBDEPENDS)}
                                  )
                                  (C {(tr)} {(SQ <' '>)} {(SQ <'\\n'>)})
                                  (C {(sort)} {(-u)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
            (C {(echo)} {(DQ ('Libraries with dependents:'))})
            (C {(echo)})
            (command.Pipeline
              children: [
                (C {(echo)} {(${ VSub_Name prebuild_libs)})
                (C {(tr)} {(SQ <' '>)} {(SQ <'\\n'>)})
              ]
              negated: F
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('List of interdependencies:'))})
            (C {(echo)})
            (command.Pipeline
              children: [
                (command.ForEach
                  iter_name: lib
                  iter_words: [{(${ VSub_Name prebuild_libs)}]
                  do_arg_iter: F
                  body: 
                    (command.DoGroup
                      children: [
                        (command.AndOr
                          ops: [Op_DPipe]
                          children: [
                            (C {(grep)} {(DQ ('^') (${ VSub_Name lib) (${ VSub_Name FS))} 
                              {(${ VSub_Name LIBDEPENDS)}
                            )
                            (C {(true)})
                          ]
                        )
                      ]
                    )
                )
                (C {(awk)} {(-F) (DQ (${ VSub_Name FS))} 
                  {
                    (SQ <'{\n'> <'\t\tif ($2 in dependents)\n'> 
                      <'\t\t\tdependents[$2]=dependents[$2]" "$1\n'> <'\t\telse\n'> <'\t\t\tdependents[$2]=$1\n'> <'\t}\n'> <'\tEND {\n'> <'\t\tfor (lib in dependents)\n'> 
                      <'\t\t\tprint dependents[lib]": " lib\n'> <'\t}'>
                    )
                  }
                )
                (C {(sort)})
              ]
              negated: F
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
          ]
        )
    )
    (C {(main)})
  ]
)