(CommandList
  children: [
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (AndOr
                  ops: [Op_DPipe]
                  children: [
                    (C {(Lit_Other '[')} {(DQ ($ VSub_Number '$1'))} {(Lit_Other '=') (Lit_Other '=')} 
                      {(DQ (--verbose))} {(Lit_Other ']')}
                    )
                    (C {(Lit_Other '[')} {(DQ ($ VSub_Number '$1'))} {(Lit_Other '=') (Lit_Other '=')} 
                      {(DQ (-v))} {(Lit_Other ']')}
                    )
                  ]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(shift)} {(1)})
            (FuncDef
              name: debug
              body: 
                (BraceGroup
                  children: [
                    (Sentence
                      child: (C {(echo)} {(DQ ($ VSub_Star '$*'))})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [59]
                )
              spids: [55 58]
            )
          ]
          spids: [16777215 49]
        )
      ]
      else_action: [
        (FuncDef
          name: debug
          body: 
            (BraceGroup
              children: [(Sentence child:(C {(Lit_Other ':')}) terminator:<Op_Semi ';'>)]
              spids: [76]
            )
          spids: [72 75]
        )
      ]
      spids: [70 83]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Number '$1'))} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Usage: ') ($ VSub_Number '$0') (' <private_libdir>'))})
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 99]
        )
      ]
      spids: [16777215 115]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:UNAME)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(uname)} {(-s)})])
                  left_token: <Left_CommandSub '$('>
                  spids: [120 124]
                )
              )
            }
          spids: [118]
        )
      ]
      spids: [118]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$UNAME'))} {(Lit_Other '=')} {(DQ (Linux))} 
                  {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:SHLIB_EXT) op:Equal rhs:{(DQ (so))} spids:[147])]
              spids: [147]
            )
          ]
          spids: [16777215 144]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$UNAME'))} {(Lit_Other '=')} {(DQ (Darwin))} 
                  {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:SHLIB_EXT)
                  op: Equal
                  rhs: {(DQ (dylib))}
                  spids: [172]
                )
              ]
              spids: [172]
            )
          ]
          spids: [152 169]
        )
      ]
      else_action: [
        (SimpleCommand
          words: [
            {(echo)}
            {
              (DQ ("WARNING: Could not autodetect platform type ('uname -s' == ") 
                ($ VSub_Name '$UNAME') ('); assuming Linux')
              )
            }
          ]
          redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[188])]
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:UNAME) op:Equal rhs:{(DQ (Linux))} spids:[192])]
          spids: [192]
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:SHLIB_EXT) op:Equal rhs:{(DQ (so))} spids:[198])]
          spids: [198]
        )
      ]
      spids: [177 203]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:private_libdir)
          op: Equal
          rhs: {($ VSub_Number '$1')}
          spids: [206]
        )
      ]
      spids: [206]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-f)} 
                  {(DQ ($ VSub_Name '$private_libdir') (/libarpack.) ($ VSub_Name '$SHLIB_EXT'))} {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ('ERROR: Could not open ') ($ VSub_Name '$private_libdir') (/libarpack.) 
                    ($ VSub_Name '$SHLIB_EXT')
                  )
                }
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[239])]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)})
          ]
          spids: [16777215 227]
        )
      ]
      spids: [16777215 247]
    )
    (FuncDef
      name: find_shlib
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:lib_path)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                  spids: [257]
                )
              ]
              spids: [257]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$lib_path'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$UNAME'))} {(Lit_Other '=')} 
                                  {(DQ (Linux))} {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Pipeline
                              children: [
                                (C {(ldd)} {(DQ ($ VSub_Name '$lib_path'))})
                                (C {(grep)} {($ VSub_Number '$2')})
                                (C {(cut)} {(-d) (SQ <' '>)} {(-f3)})
                                (C {(xargs)})
                              ]
                              negated: F
                            )
                          ]
                          spids: [16777215 296]
                        )
                      ]
                      else_action: [
                        (Pipeline
                          children: [
                            (C {(otool)} {(-L)} {(DQ ($ VSub_Name '$lib_path'))})
                            (C {(grep)} {($ VSub_Number '$2')})
                            (C {(cut)} {(-d) (SQ <' '>)} {(-f1)})
                            (C {(xargs)})
                          ]
                          negated: F
                        )
                      ]
                      spids: [327 363]
                    )
                  ]
                  spids: [16777215 276]
                )
              ]
              spids: [16777215 366]
            )
          ]
          spids: [254]
        )
      spids: [250 253]
    )
    (FuncDef
      name: private_libname
      body: 
        (BraceGroup
          children: [
            (C {(echo)} 
              {
                (DQ ($ VSub_Name '$private_libdir') (/lib) ($ VSub_Number '$1') (.) 
                  ($ VSub_Name '$SHLIB_EXT')
                )
              }
            )
          ]
          spids: [375]
        )
      spids: [371 374]
    )
    (ForEach
      iter_name: lib
      iter_words: [{(arpack)} {(lapack)}]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} 
                          {
                            (DQ ($ VSub_Name '$private_libdir') (/lib) ($ VSub_Name '$lib') (.) 
                              ($ VSub_Name '$SHLIB_EXT')
                            )
                          } {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBGFORTRAN_PATH)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(find_shlib)} 
                                        {
                                          (DQ 
                                            (CommandSubPart
                                              command_list: 
                                                (CommandList
                                                  children: [
                                                    (C {(private_libname)} {($ VSub_Name '$lib')})
                                                  ]
                                                )
                                              left_token: <Left_CommandSub '$('>
                                              spids: [441 445]
                                            )
                                          )
                                        } {(libgfortran)}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [437 449]
                              )
                            }
                          spids: [436]
                        )
                      ]
                      spids: [436]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBGCC_PATH)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(find_shlib)} 
                                        {
                                          (DQ 
                                            (CommandSubPart
                                              command_list: 
                                                (CommandList
                                                  children: [
                                                    (C {(private_libname)} {($ VSub_Name '$lib')})
                                                  ]
                                                )
                                              left_token: <Left_CommandSub '$('>
                                              spids: [457 461]
                                            )
                                          )
                                        } {(libgcc_s)}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [453 465]
                              )
                            }
                          spids: [452]
                        )
                      ]
                      spids: [452]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBQUADMATH_PATH)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(find_shlib)} 
                                        {
                                          (DQ 
                                            (CommandSubPart
                                              command_list: 
                                                (CommandList
                                                  children: [
                                                    (C {(private_libname)} {($ VSub_Name '$lib')})
                                                  ]
                                                )
                                              left_token: <Left_CommandSub '$('>
                                              spids: [473 477]
                                            )
                                          )
                                        } {(libquadmath)}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [469 481]
                              )
                            }
                          spids: [468]
                        )
                      ]
                      spids: [468]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBGFORTRAN_DIRS)
                          op: Equal
                          rhs: 
                            {
                              (DQ ($ VSub_Name '$LIBGFORTRAN_DIRS') (' ') 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(dirname)} {($ VSub_Name '$LIBGFORTRAN_PATH')})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [497 501]
                                )
                              )
                            }
                          spids: [493]
                        )
                      ]
                      spids: [493]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBGFORTRAN_DIRS)
                          op: Equal
                          rhs: 
                            {
                              (DQ ($ VSub_Name '$LIBGFORTRAN_DIRS') (' ') 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(dirname)} {($ VSub_Name '$LIBGCC_PATH')})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [509 513]
                                )
                              )
                            }
                          spids: [505]
                        )
                      ]
                      spids: [505]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBGFORTRAN_DIRS)
                          op: Equal
                          rhs: 
                            {
                              (DQ ($ VSub_Name '$LIBGFORTRAN_DIRS') (' ') 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(dirname)} {($ VSub_Name '$LIBQUADMATH_PATH')})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [521 525]
                                )
                              )
                            }
                          spids: [517]
                        )
                      ]
                      spids: [517]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBGFORTRAN_SONAMES)
                          op: Equal
                          rhs: 
                            {
                              (DQ ($ VSub_Name '$LIBGFORTRAN_SONAMES') (' ') 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [
                                        (C {(basename)} {(DQ ($ VSub_Name '$LIBGFORTRAN_PATH'))})
                                      ]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [538 544]
                                )
                              )
                            }
                          spids: [534]
                        )
                      ]
                      spids: [534]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBGCC_SONAMES)
                          op: Equal
                          rhs: 
                            {
                              (DQ ($ VSub_Name '$LIBGCC_SONAMES') (' ') 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(basename)} {(DQ ($ VSub_Name '$LIBGCC_PATH'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [552 558]
                                )
                              )
                            }
                          spids: [548]
                        )
                      ]
                      spids: [548]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LIBQUADMATH_SONAMES)
                          op: Equal
                          rhs: 
                            {
                              (DQ ($ VSub_Name '$LIBQUADMATH_SONAMES') (' ') 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [
                                        (C {(basename)} {(DQ ($ VSub_Name '$LIBQUADMATH_PATH'))})
                                      ]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [566 572]
                                )
                              )
                            }
                          spids: [562]
                        )
                      ]
                      spids: [562]
                    )
                  ]
                  spids: [16777215 425]
                )
              ]
              spids: [16777215 576]
            )
          ]
          spids: [405 578]
        )
      spids: [399 403]
    )
    (FuncDef
      name: uniquify
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(echo)} {(DQ ($ VSub_Number '$1'))})
                (C {(tr)} {(DQ (' '))} {(DQ (Lit_Other '\\') (n))})
                (C {(sort)})
                (C {(uniq)})
                (C {(grep)} {(-v)} {(SQ <'^$'>)})
                (C {(tr)} {(DQ (Lit_Other '\\') (n))} {(DQ (' '))})
              ]
              negated: F
            )
          ]
          spids: [588]
        )
      spids: [584 587]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:LIBGFORTRAN_DIRS)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [(C {(uniquify)} {(DQ ($ VSub_Name '$LIBGFORTRAN_DIRS'))})]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [645 651]
              )
            }
          spids: [644]
        )
      ]
      spids: [644]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:SONAMES)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (C {(uniquify)} 
                          {
                            (DQ ($ VSub_Name '$LIBGFORTRAN_SONAMES') (' ') 
                              ($ VSub_Name '$LIBGCC_SONAMES') (' ') ($ VSub_Name '$LIBQUADMATH_SONAMES')
                            )
                          }
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [655 665]
                )
              )
            }
          spids: [653]
        )
      ]
      spids: [653]
    )
    (C {(debug)} {(DQ ('Discovered traces of libgfortran within ') ($ VSub_Name '$LIBGFORTRAN_DIRS'))})
    (C {(debug)} {(DQ ('Got SONAMES of ') ($ VSub_Name '$SONAMES'))})
    (ForEach
      iter_name: soname
      iter_words: [{($ VSub_Name '$SONAMES')}]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (ForEach
              iter_name: dir
              iter_words: [{($ VSub_Name '$LIBGFORTRAN_DIRS')}]
              do_arg_iter: F
              body: 
                (DoGroup
                  children: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (AndOr
                                  ops: [Op_DAmp]
                                  children: [
                                    (C {(Lit_Other '[')} {(KW_Bang '!')} {(-f)} 
                                      {
                                        (DQ ($ VSub_Name '$private_libdir') (/) ($ VSub_Name '$soname'))
                                      } {(Lit_Other ']')}
                                    )
                                    (C {(Lit_Other '[')} {(-f)} 
                                      {(DQ ($ VSub_Name '$dir') (/) ($ VSub_Name '$soname'))} {(Lit_Other ']')}
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(cp)} {(-v)} {(DQ ($ VSub_Name '$dir') (/) ($ VSub_Name '$soname'))} 
                              {(DQ ($ VSub_Name '$private_libdir'))}
                            )
                            (C {(chmod)} {(755)} 
                              {(DQ ($ VSub_Name '$private_libdir') (/) ($ VSub_Name '$soname'))}
                            )
                            (If
                              arms: [
                                (if_arm
                                  cond: [
                                    (Sentence
                                      child: 
                                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$UNAME'))} 
                                          {(Lit_Other '=')} {(DQ (Darwin))} {(Lit_Other ']')}
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                  ]
                                  action: [
                                    (C {(install_name_tool)} {(-id)} 
                                      {(DQ ('@rpath/') ($ VSub_Name '$soname'))} {(DQ ($ VSub_Name '$private_libdir') (/) ($ VSub_Name '$soname'))}
                                    )
                                  ]
                                  spids: [16777215 787]
                                )
                              ]
                              spids: [16777215 806]
                            )
                          ]
                          spids: [16777215 741]
                        )
                      ]
                      spids: [16777215 809]
                    )
                  ]
                  spids: [707 812]
                )
              spids: [703 705]
            )
          ]
          spids: [695 814]
        )
      spids: [691 693]
    )
    (FuncDef
      name: change_linkage
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:lib_path)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                  spids: [840]
                )
              ]
              spids: [840]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(KW_Bang '!')} {(-f)} {(DQ ($ VSub_Name '$lib_path'))} 
                          {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(debug)} {(DQ ('  ') ($ VSub_Name '$lib_path') (" doesn't exist, skipping"))})
                    (ControlFlow token:<ControlFlow_Return return>)
                  ]
                  spids: [16777215 866]
                )
              ]
              spids: [16777215 881]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:soname)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$2'))}
                  spids: [889]
                )
              ]
              spids: [889]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$UNAME'))} {(Lit_Other '=')} 
                          {(DQ (Darwin))} {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:old_link)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(find_shlib)} {(DQ ($ VSub_Name '$lib_path'))} 
                                        {(DQ ($ VSub_Name '$soname'))}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [917 927]
                              )
                            }
                          spids: [916]
                        )
                      ]
                      spids: [916]
                    )
                    (C {(echo)} {(DQ (' ') ($ VSub_Name '$old_link'))})
                    (C {(install_name_tool)} {(-change)} {(DQ ($ VSub_Name '$old_link'))} 
                      {(DQ ('@rpath/') ($ VSub_Name '$soname'))} {(DQ ($ VSub_Name '$lib_path'))}
                    )
                  ]
                  spids: [16777215 913]
                )
              ]
              else_action: [
                (C {(patchelf)} {(--set-rpath)} 
                  {(EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) (ORIGIN)} {(DQ ($ VSub_Name '$lib_path'))}
                )
              ]
              spids: [956 974]
            )
          ]
          spids: [833]
        )
      spids: [829 832]
    )
    (ForEach
      iter_name: lib
      iter_words: [{(libopenblas)} {(libarpack)} {(libcholmod)} {(liblapack)} {($ VSub_Name '$SONAMES')}]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (ForEach
              iter_name: lib_path
              iter_words: [{($ VSub_Name '$private_libdir') (/) ($ VSub_Name '$lib') (Lit_Other '*')}]
              do_arg_iter: F
              body: 
                (DoGroup
                  children: [
                    (ForEach
                      iter_name: soname
                      iter_words: [{($ VSub_Name '$SONAMES')}]
                      do_arg_iter: F
                      body: 
                        (DoGroup
                          children: [
                            (C {(debug)} 
                              {
                                (DQ ('changing linkage of ') ($ VSub_Name '$lib_path') (' to ') 
                                  ($ VSub_Name '$soname')
                                )
                              }
                            )
                            (C {(change_linkage)} {(DQ ($ VSub_Name '$lib_path'))} 
                              {(DQ ($ VSub_Name '$soname'))}
                            )
                          ]
                          spids: [1050 1074]
                        )
                      spids: [1046 1048]
                    )
                  ]
                  spids: [1034 1077]
                )
              spids: [1027 1032]
            )
          ]
          spids: [1011 1079]
        )
      spids: [999 1009]
    )
  ]
)