(CommandList
  children: [
    (FuncDef
      name: update_command
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:update_to_head)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [9]
                )
              ]
              spids: [7]
            )
            (Subshell
              child: 
                (CommandList
                  children: [
                    (AndOr
                      children: [
                        (C {(cd)} 
                          {
                            (DQ 
                              (CommandSubPart
                                command_list: (CommandList children:[(C {(asdf_dir)})])
                                left_token: <Left_CommandSub "$(">
                                spids: [20 22]
                              )
                            )
                          }
                        )
                        (C {(exit)} {(1)})
                      ]
                      op_id: Op_DPipe
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other "[")} {(-f)} {(asdf_updates_disabled)} {(Lit_Other "]")})
                              terminator: <Op_Semi ";">
                            )
                          ]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ 
                                  (
"Update command disabled. Please use the package manager that you used to install asdf to upgrade asdf."
                                  )
                                )
                              }
                            )
                          ]
                          spids: [-1 44]
                        )
                      ]
                      else_action: [(C {(do_update)} {(DQ ($ VSub_Name "$update_to_head"))})]
                      spids: [54 64]
                    )
                  ]
                )
              spids: [14 67]
            )
          ]
          spids: [4]
        )
      spids: [0 3]
    )
    (FuncDef
      name: do_update
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:update_to_head)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [81]
                )
              ]
              spids: [79]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$update_to_head"))} {(Lit_Other "=")} 
                          {(DQ (--head))} {(Lit_Other "]")}
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(git)} {(checkout)} {(master)})
                    (C {(git)} {(pull)} {(origin)} {(master)})
                    (C {(echo)} {(DQ ("Updated asdf to latest on the master branch"))})
                  ]
                  spids: [-1 103]
                )
              ]
              else_action: [
                (AndOr
                  children: [(C {(git)} {(fetch)} {(--tags)}) (C {(exit)} {(1)})]
                  op_id: Op_DPipe
                )
                (AndOr
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:tag)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (Pipeline
                                        children: [
                                          (C {(git)} {(tag)})
                                          (C {(sort_versions)})
                                          (C {(sed)} {(SQ <"$!d">)})
                                        ]
                                        negated: False
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub "$(">
                                spids: [159 175]
                              )
                            }
                          spids: [158]
                        )
                      ]
                      spids: [158]
                    )
                    (C {(exit)} {(1)})
                  ]
                  op_id: Op_DPipe
                )
                (AndOr
                  children: [(C {(git)} {(checkout)} {(DQ ($ VSub_Name "$tag"))}) (C {(exit)} {(1)})]
                  op_id: Op_DPipe
                )
                (C {(echo)} {(DQ ("Updated asdf to release ") ($ VSub_Name "$tag"))})
              ]
              spids: [138 212]
            )
          ]
          spids: [76]
        )
      spids: [72 75]
    )
    (FuncDef
      name: sort_versions
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(sed)} {(SQ <"h; s/[+-]/./g; s/.p\\([[:digit:]]\\)/.z\\1/; s/$/.z/; G; s/\\n/ /">)})
                (SimpleCommand
                  words: [
                    {(sort)}
                    {(-t.)}
                    {(-k)}
                    {(1) (Lit_Comma ",") (1)}
                    {(-k)}
                    {(2) (Lit_Comma ",") (2n)}
                    {(-k)}
                    {(3) (Lit_Comma ",") (3n)}
                    {(-k)}
                    {(4) (Lit_Comma ",") (4n)}
                    {(-k)}
                    {(5) (Lit_Comma ",") (5n)}
                  ]
                  more_env: [(env_pair name:LC_ALL val:{(C)} spids:[237])]
                )
                (C {(awk)} {(SQ <"{print $2}">)})
              ]
              negated: False
            )
          ]
          spids: [224]
        )
      spids: [220 223]
    )
  ]
)