(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:Z)
          op: assign_op.Equal
          rhs: {(DQ <compress>)}
          spids: [17]
        )
        (assign_pair
          lhs: (sh_lhs_expr.Name name:gz)
          op: assign_op.Equal
          rhs: {(DQ <gzip>)}
          spids: [22]
        )
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bz)
          op: assign_op.Equal
          rhs: {(DQ <bzip2>)}
          spids: [27]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:Zout)
          op: assign_op.Equal
          rhs: {(DQ <'/tmp/bestcompress.'> ($ Id.VSub_Dollar '$$') <.Z>)}
          spids: [32]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:gzout)
          op: assign_op.Equal
          rhs: {(DQ <'/tmp/bestcompress.'> ($ Id.VSub_Dollar '$$') <.gz>)}
          spids: [39]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bzout)
          op: assign_op.Equal
          rhs: {(DQ <'/tmp/bestcompress.'> ($ Id.VSub_Dollar '$$') <.bz>)}
          spids: [46]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:skipcompressed)
          op: assign_op.Equal
          rhs: {<1>}
          spids: [53]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} 
                      {(DQ <-a>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:skipcompressed)
                      op: assign_op.Equal
                      rhs: {<0>}
                      spids: [78]
                    )
                  ]
                )
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
          ]
          spids: [57 75]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-eq>} {<0>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ <'Usage: '> ($ Id.VSub_Number '$0') 
                        <' [-a] file or files to optimally compress'>
                      )
                    }
                  ]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [88 101]
        )
      ]
    )
    (C {<trap>} 
      {
        (DQ <'/bin/rm -f '> ($ Id.VSub_DollarName '$Zout') <' '> ($ Id.VSub_DollarName '$gzout') <' '> 
          ($ Id.VSub_DollarName '$bzout')
        )
      } {<EXIT>}
    )
    (command.ForEach
      iter_name: name
      iter_words: [{(DQ ($ Id.VSub_At '$@'))}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-f>} 
                              {(DQ ($ Id.VSub_DollarName '$name'))} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ ($ Id.VSub_Number '$0') <': file '> ($ Id.VSub_DollarName '$name') 
                            <' not found. Skipped.'>
                          )
                        }
                      ]
                      redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                      do_fork: T
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Continue continue>)
                  ]
                  spids: [151 167]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} 
                              {
                                (DQ 
                                  (command_sub
                                    left_token: <Id.Left_DollarParen '$('>
                                    child: 
                                      (command.Pipeline
                                        children: [
                                          (C {<echo>} {($ Id.VSub_DollarName '$name')})
                                          (C {<egrep>} {(SQ <'(\\.Z$|\\.gz$|\\.bz2$)'>)})
                                        ]
                                        negated: F
                                      )
                                  )
                                )
                              } {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ )} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} 
                                      {($ Id.VSub_DollarName '$skipcompressed')} {<-eq>} {<1>} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (C {<echo>} 
                              {
                                (DQ <'Skipped file '> (${ Id.VSub_Name name) 
                                  <': It\'s already compressed.'>
                                )
                              }
                            )
                            (command.ControlFlow
                              token: <Id.ControlFlow_Continue continue>
                            )
                          ]
                          spids: [224 238]
                        )
                      ]
                      else_action: [
                        (C {<echo>} 
                          {
                            (DQ <'Warning: Trying to double-compress '> ($ Id.VSub_DollarName '$name'))
                          }
                        )
                      ]
                    )
                  ]
                  spids: [191 221]
                )
              ]
            )
            (command.Sentence
              child: 
                (command.Simple
                  words: [{($ Id.VSub_DollarName '$Z')}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Less '<'>
                      loc: (redir_loc.Fd fd:0)
                      arg: {(DQ ($ Id.VSub_DollarName '$name'))}
                    )
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {($ Id.VSub_DollarName '$Zout')}
                    )
                  ]
                  do_fork: T
                )
              terminator: <Id.Op_Amp _>
            )
            (command.Sentence
              child: 
                (command.Simple
                  words: [{($ Id.VSub_DollarName '$gz')}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Less '<'>
                      loc: (redir_loc.Fd fd:0)
                      arg: {(DQ ($ Id.VSub_DollarName '$name'))}
                    )
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {($ Id.VSub_DollarName '$gzout')}
                    )
                  ]
                  do_fork: T
                )
              terminator: <Id.Op_Amp _>
            )
            (command.Sentence
              child: 
                (command.Simple
                  words: [{($ Id.VSub_DollarName '$bz')}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Less '<'>
                      loc: (redir_loc.Fd fd:0)
                      arg: {(DQ ($ Id.VSub_DollarName '$name'))}
                    )
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {($ Id.VSub_DollarName '$bzout')}
                    )
                  ]
                  do_fork: T
                )
              terminator: <Id.Op_Amp _>
            )
            (C {<wait>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:smallest)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (command.Pipeline
                              children: [
                                (C {<ls>} {<-l>} {(DQ ($ Id.VSub_DollarName '$name'))} 
                                  {($ Id.VSub_DollarName '$Zout')} {($ Id.VSub_DollarName '$gzout')} {($ Id.VSub_DollarName '$bzout')}
                                )
                                (C {<awk>} {(SQ <'{print $5"="NR}'>)})
                                (C {<sort>} {<-n>})
                                (C {<cut>} {<-d> <Id.Lit_Equals '='>} {<-f2>})
                                (C {<head>} {<-1>})
                              ]
                              negated: F
                            )
                        )
                      )
                    }
                  spids: [335]
                )
              ]
            )
            (command.Case
              to_match: {(DQ ($ Id.VSub_DollarName '$smallest'))}
              arms: [
                (case_arm
                  pat_list: [{<1>}]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'No space savings by compressing '> ($ Id.VSub_DollarName '$name') 
                          <'. Left as is.'>
                        )
                      }
                    )
                  ]
                  spids: [396 398 409 -1]
                )
                (case_arm
                  pat_list: [{<2>}]
                  action: [
                    (C {<echo>} {<Best>} {<compression>} {<is>} {<with>} {<compress.>} {<File>} {<renamed>} 
                      {(${ Id.VSub_Name name) <.Z>}
                    )
                    (command.Sentence
                      child: 
                        (C {<mv>} {($ Id.VSub_DollarName '$Zout')} {(DQ (${ Id.VSub_Name name) <.Z>)})
                      terminator: <Id.Op_Semi _>
                    )
                    (C {<rm>} {<-f>} {(DQ ($ Id.VSub_DollarName '$name'))})
                  ]
                  spids: [412 414 460 -1]
                )
                (case_arm
                  pat_list: [{<3>}]
                  action: [
                    (C {<echo>} {<Best>} {<compression>} {<is>} {<with>} {<gzip.>} {<File>} {<renamed>} 
                      {(${ Id.VSub_Name name) <.gz>}
                    )
                    (command.Sentence
                      child: 
                        (C {<mv>} {($ Id.VSub_DollarName '$gzout')} {(DQ (${ Id.VSub_Name name) <.gz>)})
                      terminator: <Id.Op_Semi _>
                    )
                    (C {<rm>} {<-f>} {(DQ ($ Id.VSub_DollarName '$name'))})
                  ]
                  spids: [463 465 511 -1]
                )
                (case_arm
                  pat_list: [{<4>}]
                  action: [
                    (C {<echo>} {<Best>} {<compression>} {<is>} {<with>} {<bzip2.>} {<File>} {<renamed>} 
                      {(${ Id.VSub_Name name) <.bz2>}
                    )
                    (command.Sentence
                      child: 
                        (C {<mv>} {($ Id.VSub_DollarName '$bzout')} {(DQ (${ Id.VSub_Name name) <.bz2>)})
                      terminator: <Id.Op_Semi _>
                    )
                    (C {<rm>} {<-f>} {(DQ ($ Id.VSub_DollarName '$name'))})
                  ]
                  spids: [514 516 -1 562]
                )
              ]
            )
          ]
        )
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)