(CommandList
  children: [
    (FuncDef
      name: printHelp
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(DQ ('Usage: ') ($ VSub_Number '$0') (' -f find -r replace FILES_TO_RENAME*'))})
            (C {(echo)} {(-e)} {(DQ (Lit_Other '\\') ('t-f The text to find in the filename'))})
            (C {(echo)} {(-e)} 
              {(DQ (Lit_Other '\\') ('t-r The text used to replace with in the filename'))}
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [9]
        )
      spids: [4 8]
    )
    (WhileUntil
      keyword: <KW_While while>
      cond: [(Sentence child:(C {(getopts)} {(DQ ('f:r:'))} {(opt)}) terminator:<Op_Semi ';'>)]
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {(DQ ($ VSub_Name '$opt'))}
              arms: [
                (case_arm
                  pat_list: [{(r)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:replace)
                          op: Equal
                          rhs: {(DQ ($ VSub_Name '$OPTARG'))}
                          spids: [75]
                        )
                      ]
                      spids: [75]
                    )
                  ]
                  spids: [71 73 80 16777215]
                )
                (case_arm
                  pat_list: [{(f)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:fnd)
                          op: Equal
                          rhs: {(DQ ($ VSub_Name '$OPTARG'))}
                          spids: [87]
                        )
                      ]
                      spids: [87]
                    )
                  ]
                  spids: [83 85 92 16777215]
                )
                (case_arm
                  pat_list: [{(Lit_Other '?')}]
                  action: [(C {(printHelp)})]
                  spids: [95 97 101 16777215]
                )
              ]
              spids: [62 68 104]
            )
          ]
          spids: [59 106]
        )
    )
    (C {(shift)} 
      {
        (ArithSubPart
          anode: 
            (ArithBinary
              op_id: Arith_Minus
              left: (ArithWord w:{($ VSub_Name '$OPTIND')})
              right: (ArithWord w:{(Lit_Digits 1)})
            )
          spids: [111 120]
        )
      }
    )
    (If
      arms: [
        (if_arm
          cond: [
            (AndOr
              ops: [Op_DPipe]
              children: [
                (C {(Lit_Other '[')} {(-z)} {($ VSub_Name '$replace')} {(Lit_Other ']')})
                (C {(Lit_Other '[')} {(-z)} {($ VSub_Name '$fnd')} {(Lit_Other ']')})
              ]
            )
          ]
          action: [
            (Sentence
              child: (C {(echo)} {(DQ ('Need a string to find and a string to replace'))})
              terminator: <Op_Semi ';'>
            )
            (C {(printHelp)})
          ]
          spids: [16777215 143]
        )
      ]
      spids: [16777215 156]
    )
    (ForEach
      iter_name: i
      iter_words: [{($ VSub_At '$@')}]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:newname)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_Name '$i')})
                                  (C {(sed)} 
                                    {(DQ (s/) ($ VSub_Name '$fnd') (/) ($ VSub_Name '$replace') (/))}
                                  )
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [171 187]
                      )
                    }
                  spids: [170]
                )
              ]
              spids: [170]
            )
            (C {(mv)} {($ VSub_Name '$i')} {($ VSub_Name '$newname')})
            (C {(echo)} {(DQ ('Renamed file ') ($ VSub_Name '$i') (' to ') ($ VSub_Name '$newname'))})
          ]
          spids: [167 206]
        )
      spids: [164 16777215]
    )
  ]
)