(command.CommandList
  children: [
    (command.Assignment
      pairs: [
        (assign_pair lhs:(lhs_expr.LhsName name:bases) op:Equal rhs:(word.Empty))
        (assign_pair lhs:(lhs_expr.LhsName name:head) op:Equal rhs:(word.Empty))
        (assign_pair lhs:(lhs_expr.LhsName name:remotes) op:Equal rhs:(word.Empty))
        (assign_pair lhs:(lhs_expr.LhsName name:sep_seen) op:Equal rhs:(word.Empty))
      ]
    )
    (command.ForEach
      iter_name: arg
      do_arg_iter: T
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: 
                {
                  (DQ (',') ($ VSub_DollarName '$sep_seen') (',') ($ VSub_DollarName '$head') (',') 
                    ($ VSub_DollarName '$arg') (',')
                  )
                }
              arms: [
                (case_arm
                  pat_list: [{(Lit_Star '*') (Lit_Comma ',') (--) (Lit_Comma ',')}]
                  action: [
                    (command.Assignment
                      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:sep_seen) op:Equal rhs:{(yes)})]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(Lit_Comma ',') (yes) (Lit_Comma ',') (Lit_Comma ',') (Lit_Star '*')}]
                  action: [
                    (command.Assignment
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:head)
                          op: Equal
                          rhs: {($ VSub_DollarName '$arg')}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(Lit_Comma ',') (yes) (Lit_Comma ',') (Lit_Star '*')}]
                  action: [
                    (command.Assignment
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:remotes)
                          op: Equal
                          rhs: {(DQ ($ VSub_DollarName '$remotes') ($ VSub_DollarName '$arg') (' '))}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(Lit_Star '*')}]
                  action: [
                    (command.Assignment
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:bases)
                          op: Equal
                          rhs: {(DQ ($ VSub_DollarName '$bases') ($ VSub_DollarName '$arg') (' '))}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.Case
      to_match: {(DQ ($ VSub_DollarName '$remotes'))}
      arms: [
        (case_arm
          pat_list: [{(Lit_QMark '?') (Lit_Star '*') (SQ <' '>) (Lit_QMark '?') (Lit_Star '*')}]
          action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)})]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [(C {(test)} {(SQ )} {(Lit_Other '=')} {(DQ ($ VSub_DollarName '$bases'))})]
          action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)})]
        )
      ]
    )
    (C {(git)} {(update-index)} {(-q)} {(--refresh)})
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (C {(git)} {(read-tree)} {(-u)} {(-m)} {(--aggressive)} {($ VSub_DollarName '$bases')} 
          {($ VSub_DollarName '$head')} {($ VSub_DollarName '$remotes')}
        )
        (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(2)})
      ]
    )
    (C {(echo)} {(DQ ('Trying simple merge.'))})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Assignment
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:result_tree)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Simple
                                words: [{(git)} {(write-tree)}]
                                redirects: [
                                  (redir.Redir
                                    op: <Redir_Great '2>'>
                                    fd: 2
                                    arg_word: {(/dev/null)}
                                  )
                                ]
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
          ]
          action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})]
        )
      ]
      else_action: [
        (C {(echo)} {(DQ ('Simple merge failed, trying Automatic merge.'))})
        (command.If
          arms: [
            (if_arm
              cond: [(C {(git-merge-index)} {(-o)} {(git-merge-one-file)} {(-a)})]
              action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})]
            )
          ]
          else_action: [(command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})]
        )
      ]
    )
  ]
)