(CommandList
  children: [
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (AndOr
                  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 "]")}
                    )
                  ]
                  op_id: Op_DPipe
                )
              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: [-1 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>"))})
            (C {(exit)} {(1)})
          ]
          spids: [-1 99]
        )
      ]
      spids: [-1 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: [-1 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:-1 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:-1 arg_word:{(2)} spids:[239])]
            )
            (C {(exit)} {(2)})
          ]
          spids: [-1 227]
        )
      ]
      spids: [-1 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: False
                            )
                          ]
                          spids: [-1 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: False
                        )
                      ]
                      spids: [327 363]
                    )
                  ]
                  spids: [-1 276]
                )
              ]
              spids: [-1 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: False
      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: [-1 425]
                )
              ]
              spids: [-1 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 (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))})
                (C {(sort)})
                (C {(uniq)})
                (C {(grep)} {(-v)} {(SQ <"^$">)})
                (C {(tr)} {(DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))} {(DQ (" "))})
              ]
              negated: False
            )
          ]
          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: [643 649]
              )
            }
          spids: [642]
        )
      ]
      spids: [642]
    )
    (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: [653 663]
                )
              )
            }
          spids: [651]
        )
      ]
      spids: [651]
    )
    (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: False
      body: 
        (DoGroup
          children: [
            (ForEach
              iter_name: dir
              iter_words: [{($ VSub_Name "$LIBGFORTRAN_DIRS")}]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (AndOr
                                  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 "]")}
                                    )
                                  ]
                                  op_id: Op_DAmp
                                )
                              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: [-1 785]
                                )
                              ]
                              spids: [-1 804]
                            )
                          ]
                          spids: [-1 739]
                        )
                      ]
                      spids: [-1 807]
                    )
                  ]
                  spids: [705 810]
                )
              spids: [701 703]
            )
          ]
          spids: [693 812]
        )
      spids: [689 691]
    )
    (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: [838]
                )
              ]
              spids: [838]
            )
            (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: [-1 864]
                )
              ]
              spids: [-1 879]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:soname)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number "$2"))}
                  spids: [887]
                )
              ]
              spids: [887]
            )
            (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: [915 925]
                              )
                            }
                          spids: [914]
                        )
                      ]
                      spids: [914]
                    )
                    (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: [-1 911]
                )
              ]
              else_action: [
                (C {(patchelf)} {(--set-rpath)} 
                  {(EscapedLiteralPart token:<Lit_EscapedChar "\\$">) (ORIGIN)} {(DQ ($ VSub_Name "$lib_path"))}
                )
              ]
              spids: [954 972]
            )
          ]
          spids: [831]
        )
      spids: [827 830]
    )
    (ForEach
      iter_name: lib
      iter_words: [{(libopenblas)} {(libarpack)} {(libcholmod)} {(liblapack)} {($ VSub_Name "$SONAMES")}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (ForEach
              iter_name: lib_path
              iter_words: [{($ VSub_Name "$private_libdir") (/) ($ VSub_Name "$lib") (Lit_Other "*")}]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (ForEach
                      iter_name: soname
                      iter_words: [{($ VSub_Name "$SONAMES")}]
                      do_arg_iter: False
                      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: [1048 1072]
                        )
                      spids: [1044 1046]
                    )
                  ]
                  spids: [1032 1075]
                )
              spids: [1025 1030]
            )
          ]
          spids: [1009 1077]
        )
      spids: [997 1007]
    )
  ]
)