(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:convargs)
          op: Equal
          rhs: {(DQ ('-unsharp 0x.5 -resize'))}
          spids: [10]
        )
      ]
      spids: [10]
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:count) op:Equal rhs:{(0)} spids:[15])]
          spids: [15]
        )
      terminator: <Op_Semi ';'>
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:exact) op:Equal rhs:{(DQ )} spids:[19])]
          spids: [19]
        )
      terminator: <Op_Semi ';'>
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:fit) op:Equal rhs:{(DQ )} spids:[24])]
      spids: [24]
    )
    (FuncDef
      name: usage
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ('Usage: ') 
                    (CommandSubPart
                      command_list: (CommandList children:[(C {(basename)} {($ VSub_Number '$0')})])
                      left_token: <Left_CommandSub '$('>
                      spids: [40 44]
                    ) (' (-e|-f) thumbnail-size image [image] [image]')
                  )
                }
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[48])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('-e  resize to exact dimensions, ignoring original proportions'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[58])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('-f  fit image into specified dimensions, retaiing proportion'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[68])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('-s  strip EXIF information (make ready for Web use)'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[79])]
            )
            (C {(echo)} {(DQ ('    please use WIDTHxHEIGHT for requested size (e.g., 100x100)'))})
            (C {(exit)} {(1)})
          ]
          spids: [33]
        )
      spids: [29 32]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-eq)} {(0)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(usage)})]
          spids: [-1 118]
        )
      ]
      spids: [-1 123]
    )
    (While
      cond: [(Sentence child:(C {(getopts)} {(DQ ('e:f:s'))} {(opt)}) terminator:<Op_Semi ';'>)]
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {($ VSub_Name '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(e)}]
                  action: [
                    (Sentence
                      child: 
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:exact)
                              op: Equal
                              rhs: {(DQ ($ VSub_Name '$OPTARG'))}
                              spids: [151]
                            )
                          ]
                          spids: [151]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [147 149 157 -1]
                )
                (case_arm
                  pat_list: [{(f)}]
                  action: [
                    (Sentence
                      child: 
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:fit)
                              op: Equal
                              rhs: {(DQ ($ VSub_Name '$OPTARG'))}
                              spids: [164]
                            )
                          ]
                          spids: [164]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [160 162 170 -1]
                )
                (case_arm
                  pat_list: [{(s)}]
                  action: [
                    (Sentence
                      child: 
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:strip)
                              op: Equal
                              rhs: {(DQ (-strip))}
                              spids: [177]
                            )
                          ]
                          spids: [177]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  spids: [173 175 183 -1]
                )
                (case_arm
                  pat_list: [{(Lit_Other '?')}]
                  action: [(Sentence child:(C {(usage)}) terminator:<Op_Semi ';'>)]
                  spids: [186 188 193 -1]
                )
              ]
              spids: [140 144 196]
            )
          ]
          spids: [137 198]
        )
    )
    (C {(shift)} 
      {
        (ArithSubPart
          anode: 
            (ArithBinary
              op_id: Arith_Minus
              left: (ArithWord w:{($ VSub_Name '$OPTIND')})
              right: (ArithWord w:{(Lit_Digits 1)})
            )
          spids: [202 209]
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:rwidth)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Pipeline
                          children: [
                            (C {(echo)} {($ VSub_Name '$exact')} {($ VSub_Name '$fit')})
                            (C {(cut)} {(-dx)} {(-f1)})
                          ]
                          negated: False
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [218 232]
                )
              )
            }
          spids: [216]
        )
      ]
      spids: [216]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:rheight)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Pipeline
                          children: [
                            (C {(echo)} {($ VSub_Name '$exact')} {($ VSub_Name '$fit')})
                            (C {(cut)} {(-dx)} {(-f2)})
                          ]
                          negated: False
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [240 254]
                )
              )
            }
          spids: [238]
        )
      ]
      spids: [238]
    )
    (ForEach
      iter_name: image
      do_arg_iter: True
      body: 
        (DoGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:width)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (C {(identify)} {(-format)} {(DQ ('%w'))} {(DQ ($ VSub_Name '$image'))})
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [270 282]
                        )
                      )
                    }
                  spids: [268]
                )
              ]
              spids: [268]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:height)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (C {(identify)} {(-format)} {(DQ ('%h'))} {(DQ ($ VSub_Name '$image'))})
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [288 300]
                        )
                      )
                    }
                  spids: [286]
                )
              ]
              spids: [286]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {($ VSub_Name '$width')} {(-le)} {($ VSub_Name '$rwidth')} 
                          {(-a)} {($ VSub_Name '$height')} {(-le)} {($ VSub_Name '$rheight')} {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('Image ') ($ VSub_Name '$image') 
                          (' is already smaller than reqeusted dimensions. Skipped.')
                        )
                      }
                    )
                  ]
                  spids: [-1 331]
                )
              ]
              else_action: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:suffix)
                      op: Equal
                      rhs: 
                        {
                          (DQ 
                            (CommandSubPart
                              command_list: 
                                (CommandList
                                  children: [
                                    (Pipeline
                                      children: [
                                        (C {(echo)} {($ VSub_Name '$image')})
                                        (C {(rev)})
                                        (C {(cut)} {(-d.)} {(-f1)})
                                        (C {(rev)})
                                      ]
                                      negated: False
                                    )
                                  ]
                                )
                              left_token: <Left_CommandSub '$('>
                              spids: [353 373]
                            )
                          )
                        }
                      spids: [351]
                    )
                  ]
                  spids: [351]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:prefix)
                      op: Equal
                      rhs: 
                        {
                          (DQ 
                            (CommandSubPart
                              command_list: 
                                (CommandList
                                  children: [
                                    (Pipeline
                                      children: [
                                        (C {(echo)} {($ VSub_Name '$image')})
                                        (C {(rev)})
                                        (C {(cut)} {(-d.)} {(-f2-)})
                                        (C {(rev)})
                                      ]
                                      negated: False
                                    )
                                  ]
                                )
                              left_token: <Left_CommandSub '$('>
                              spids: [379 399]
                            )
                          )
                        }
                      spids: [377]
                    )
                  ]
                  spids: [377]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:newname)
                      op: Equal
                      rhs: {(DQ ($ VSub_Name '$prefix') (-thumb.) ($ VSub_Name '$suffix'))}
                      spids: [403]
                    )
                  ]
                  spids: [403]
                )
                (If
                  arms: [
                    (if_arm
                      cond: [
                        (Sentence
                          child: 
                            (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$fit'))} {(Lit_Other ']')})
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:size)
                              op: Equal
                              rhs: {(DQ ($ VSub_Name '$exact') ('!'))}
                              spids: [435]
                            )
                          ]
                          spids: [435]
                        )
                        (C {(echo)} 
                          {
                            (DQ ('Creating ') (${ VSub_Name rwidth) (x) (${ VSub_Name rheight) 
                              (' (exact size) thumbnail for file ') ($ VSub_Name '$image')
                            )
                          }
                        )
                      ]
                      spids: [-1 432]
                    )
                  ]
                  else_action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:size)
                          op: Equal
                          rhs: {(DQ ($ VSub_Name '$fit'))}
                          spids: [461]
                        )
                      ]
                      spids: [461]
                    )
                    (C {(echo)} 
                      {
                        (DQ ('Creating ') (${ VSub_Name rwidth) (x) (${ VSub_Name rheight) 
                          (' (max dimensions) thumbnail for file ') ($ VSub_Name '$image')
                        )
                      }
                    )
                  ]
                  spids: [458 483]
                )
                (C {(convert)} {(DQ ($ VSub_Name '$image'))} {($ VSub_Name '$strip')} 
                  {($ VSub_Name '$convargs')} {(DQ ($ VSub_Name '$size'))} {(DQ ($ VSub_Name '$newname'))}
                )
              ]
              spids: [343 506]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:count)
                  op: Equal
                  rhs: 
                    {
                      (ArithSubPart
                        anode: 
                          (ArithBinary
                            op_id: Arith_Plus
                            left: (ArithWord w:{($ VSub_Name '$count')})
                            right: (ArithWord w:{(Lit_Digits 1)})
                          )
                        spids: [510 519]
                      )
                    }
                  spids: [509]
                )
              ]
              spids: [509]
            )
          ]
          spids: [265 521]
        )
      spids: [-1 -1]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_Name '$count')} {(-eq)} {(0)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(echo)} {(DQ ('Warning: no images found to process.'))})]
          spids: [-1 538]
        )
      ]
      spids: [-1 547]
    )
    (C {(exit)} {(0)})
  ]
)