(command.CommandList
  children: [
    (command.ShFunction
      name: git_rebase__am
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Case
              to_match: {(DQ ($ Id.VSub_DollarName action))}
              arms: [
                (case_arm
                  pat_list: [{<Id.ControlFlow_Continue continue>}]
                  action: [
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (C {<git>} {<am>} {<--resolved>} 
                          {<--resolvemsg> <Id.Lit_Equals '='> (DQ ($ Id.VSub_DollarName resolvemsg))} 
                          {
                            (braced_var_sub
                              left: <Id.Left_DollarBrace '${'>
                              token: <Id.VSub_Name gpg_sign_opt>
                              var_name: gpg_sign_opt
                              suffix_op: 
                                (suffix_op.Unary
                                  op: <Id.VTest_ColonPlus _>
                                  arg_word: {(DQ ($ Id.VSub_DollarName gpg_sign_opt))}
                                )
                              right: <Id.Right_DollarBrace '}'>
                            )
                          }
                        )
                        (C {<move_to_original_branch>})
                      ]
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Return return>)
                  ]
                  spids: [59 60 94 -1]
                )
                (case_arm
                  pat_list: [{<skip>}]
                  action: [
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (C {<git>} {<am>} {<--skip>} 
                          {<--resolvemsg> <Id.Lit_Equals '='> (DQ ($ Id.VSub_DollarName resolvemsg))}
                        )
                        (C {<move_to_original_branch>})
                      ]
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Return return>)
                  ]
                  spids: [96 97 121 -1]
                )
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [(C {<test>} {<-z>} {(DQ ($ Id.VSub_DollarName rebase_root))})]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'revisions='> name:revisions)
                          op: assign_op.Equal
                          rhs: 
                            {($ Id.VSub_DollarName upstream) <Id.Lit_TDot ...> 
                              ($ Id.VSub_DollarName orig_head)
                            }
                          spids: [143]
                        )
                      ]
                      redirects: []
                    )
                  ]
                  spids: [126 140]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'revisions='> name:revisions)
                      op: assign_op.Equal
                      rhs: 
                        {($ Id.VSub_DollarName onto) <Id.Lit_TDot ...> 
                          ($ Id.VSub_DollarName orig_head)
                        }
                      spids: [151]
                    )
                  ]
                  redirects: []
                )
              ]
              redirects: []
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ret='> name:ret)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [159]
                )
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [(C {<test>} {<-n>} {(DQ ($ Id.VSub_DollarName keep_empty))})]
                    )
                  action: [
                    (C {<git>} {<cherry-pick>} 
                      {
                        (braced_var_sub
                          left: <Id.Left_DollarBrace '${'>
                          token: <Id.VSub_Name gpg_sign_opt>
                          var_name: gpg_sign_opt
                          suffix_op: 
                            (suffix_op.Unary
                              op: <Id.VTest_ColonPlus _>
                              arg_word: {(DQ ($ Id.VSub_DollarName gpg_sign_opt))}
                            )
                          right: <Id.Right_DollarBrace '}'>
                        )
                      } {<--allow-empty>} {<--right-only>} {(DQ ($ Id.VSub_DollarName revisions))} 
                      {
                        (braced_var_sub
                          left: <Id.Left_DollarBrace '${'>
                          token: <Id.VSub_Name restrict_revision>
                          var_name: restrict_revision
                          suffix_op: 
                            (suffix_op.Unary
                              op: <Id.VTest_Plus _>
                              arg_word: {<'^'> ($ Id.VSub_DollarName restrict_revision)}
                            )
                          right: <Id.Right_DollarBrace '}'>
                        )
                      }
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ret='> name:ret)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_QMark '?')}
                          spids: [223]
                        )
                      ]
                      redirects: []
                    )
                  ]
                  spids: [162 172]
                )
              ]
              else_action: [
                (C {<rm>} {<-f>} {(DQ ($ Id.VSub_DollarName GIT_DIR) <'/rebased-patches'>)})
                (command.Simple
                  words: [
                    {<git>}
                    {<format-patch>}
                    {<-k>}
                    {<--stdout>}
                    {<--full-index>}
                    {<--cherry-pick>}
                    {<--right-only>}
                    {<--src-prefix> <Id.Lit_Equals '='> <'a/'>}
                    {<--dst-prefix> <Id.Lit_Equals '='> <'b/'>}
                    {<--no-renames>}
                    {<--no-cover-letter>}
                    {(DQ ($ Id.VSub_DollarName revisions))}
                    {
                      (braced_var_sub
                        left: <Id.Left_DollarBrace '${'>
                        token: <Id.VSub_Name restrict_revision>
                        var_name: restrict_revision
                        suffix_op: 
                          (suffix_op.Unary
                            op: <Id.VTest_Plus _>
                            arg_word: {<'^'> ($ Id.VSub_DollarName restrict_revision)}
                          )
                        right: <Id.Right_DollarBrace '}'>
                      )
                    }
                  ]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {(DQ ($ Id.VSub_DollarName GIT_DIR) <'/rebased-patches'>)}
                    )
                  ]
                  more_env: []
                  do_fork: T
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ret='> name:ret)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_QMark '?')}
                      spids: [290]
                    )
                  ]
                  redirects: []
                )
                (command.If
                  arms: [
                    (if_arm
                      cond: 
                        (condition.Shell
                          commands: [
                            (C {<test>} {<0>} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} 
                              {($ Id.VSub_DollarName ret)}
                            )
                          ]
                        )
                      action: [
                        (C {<rm>} {<-f>} {(DQ ($ Id.VSub_DollarName GIT_DIR) <'/rebased-patches'>)})
                        (command.Case
                          to_match: {(DQ ($ Id.VSub_DollarName head_name))}
                          arms: [
                            (case_arm
                              pat_list: [{<'refs/heads/'> <Id.Lit_Star '*'>}]
                              action: [
                                (C {<git>} {<checkout>} {<-q>} {(DQ ($ Id.VSub_DollarName head_name))})
                              ]
                              spids: [329 331 345 -1]
                            )
                            (case_arm
                              pat_list: [{<Id.Lit_Star '*'>}]
                              action: [
                                (C {<git>} {<checkout>} {<-q>} {(DQ ($ Id.VSub_DollarName orig_head))})
                              ]
                              spids: [348 349 363 -1]
                            )
                          ]
                          redirects: []
                        )
                        (command.Simple
                          words: [{<cat>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_GreatAnd '>&'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<2>}
                            )
                            (redir
                              op: <Id.Redir_DLessDash '<<-'>
                              loc: (redir_loc.Fd fd:0)
                              arg: 
                                (redir_param.HereDoc
                                  here_begin: {<EOF>}
                                  here_end_span_id: 388
                                  stdin_parts: [
                                    <'\n'>
                                    <
'git encountered an error while preparing the patches to replay\n'
                                    >
                                    <'these revisions:\n'>
                                    <'\n'>
                                    <'    '>
                                    ($ Id.VSub_DollarName revisions)
                                    <'\n'>
                                    <'\n'>
                                    <'As a result, git cannot rebase them.\n'>
                                  ]
                                )
                            )
                          ]
                          more_env: []
                          do_fork: T
                        )
                        (command.ControlFlow
                          token: <Id.ControlFlow_Return return>
                          arg_word: {($ Id.VSub_DollarName ret)}
                        )
                      ]
                      spids: [295 307]
                    )
                  ]
                  else_action: []
                  redirects: []
                )
                (command.Simple
                  words: [
                    {<git>}
                    {<am>}
                    {($ Id.VSub_DollarName git_am_opt)}
                    {<--rebasing>}
                    {<--resolvemsg> <Id.Lit_Equals '='> (DQ ($ Id.VSub_DollarName resolvemsg))}
                    {
                      (braced_var_sub
                        left: <Id.Left_DollarBrace '${'>
                        token: <Id.VSub_Name gpg_sign_opt>
                        var_name: gpg_sign_opt
                        suffix_op: 
                          (suffix_op.Unary
                            op: <Id.VTest_ColonPlus _>
                            arg_word: {(DQ ($ Id.VSub_DollarName gpg_sign_opt))}
                          )
                        right: <Id.Right_DollarBrace '}'>
                      )
                    }
                  ]
                  redirects: [
                    (redir
                      op: <Id.Redir_Less '<'>
                      loc: (redir_loc.Fd fd:0)
                      arg: {(DQ ($ Id.VSub_DollarName GIT_DIR) <'/rebased-patches'>)}
                    )
                  ]
                  more_env: []
                  do_fork: T
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ret='> name:ret)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_QMark '?')}
                      spids: [430]
                    )
                  ]
                  redirects: []
                )
                (C {<rm>} {<-f>} {(DQ ($ Id.VSub_DollarName GIT_DIR) <'/rebased-patches'>)})
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (C {<test>} {<0>} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} 
                          {($ Id.VSub_DollarName ret)}
                        )
                      ]
                    )
                  action: [
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (C {<test>} {<-d>} {(DQ ($ Id.VSub_DollarName state_dir))})
                        (C {<write_basic_state>})
                      ]
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Return return>
                      arg_word: {($ Id.VSub_DollarName ret)}
                    )
                  ]
                  spids: [447 458]
                )
              ]
              else_action: []
              redirects: []
            )
            (C {<move_to_original_branch>})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (C {<git_rebase__am>})
  ]
)