(command.CommandList
  children: [
    (command.ShFunction
      name: setupvars
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IMG)
                  op: assign_op.Equal
                  rhs: {<fsimage>}
                  spids: [18]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:TDBASE64)
                  op: assign_op.Equal
                  rhs: 
                    {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<atf_get_srcdir>})) 
                      <'/testdata.tar.gz.base64'>
                    }
                  spids: [22]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:GOODMD5)
                  op: assign_op.Equal
                  rhs: 
                    {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<atf_get_srcdir>})) 
                      <'/testdata.md5'>
                    }
                  spids: [29]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} 
                              {
                                (command_sub
                                  left_token: <Id.Left_DollarParen '$('>
                                  child: (C {<sysctl>} {<-n>} {<hw.byteorder>})
                                )
                              } {<Id.Lit_Equals '='>} {(DQ <1234>)} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:BYTESWAP)
                          op: assign_op.Equal
                          rhs: {<be>}
                          spids: [64]
                        )
                      ]
                    )
                  ]
                  spids: [40 61]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:BYTESWAP)
                      op: assign_op.Equal
                      rhs: {<le>}
                      spids: [71]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_case
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'name='> (DQ (${ Id.VSub_Number 1))})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'check_function='> (DQ (${ Id.VSub_Number 1))})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (C {<atf_test_case>} {(DQ (${ Id.VSub_Name name))} {<cleanup>})
            (C {<eval>} 
              {(DQ (${ Id.VSub_Name name) <'_head() { '> <'\t\tatf_set '>) <require.user> (DQ <' '>) 
                <root> (DQ <' ; '> <'\t\tatf_set '>) <require.progs> (DQ <' '>) <rump_ffs> (DQ <' ; '> <'\t}'>)
              }
            )
            (C {<eval>} 
              {
                (DQ (${ Id.VSub_Name name) <'_body() { '> <'\t\t'> (${ Id.VSub_Name check_function) <' '>)
              } {(DQ (${ Id.VSub_At '@'))} {(DQ <'; '> <'\t}'>)}
            )
            (C {<eval>} 
              {
                (DQ (${ Id.VSub_Name name) <'_cleanup() { '> <'\t\tumount -f mnt  ; '> 
                  <'\t\t: reset error ; '> <'\t}'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_case_xfail
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'name='> (DQ (${ Id.VSub_Number 1))})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'reason='> (DQ (${ Id.VSub_Number 1))})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'check_function='> (DQ (${ Id.VSub_Number 1))})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (C {<atf_test_case>} {(DQ (${ Id.VSub_Name name))} {<cleanup>})
            (C {<eval>} 
              {(DQ (${ Id.VSub_Name name) <'_head() { '> <'\t\tatf_set '>) <require.user> (DQ <' '>) 
                <root> (DQ <' ; '> <'\t}'>)
              }
            )
            (C {<eval>} 
              {(DQ (${ Id.VSub_Name name) <'_body() { '> <'\t\tatf_expect_fail '>) 
                (${ Id.VSub_Name reason) (DQ <' ; '> <'\t\t'> (${ Id.VSub_Name check_function) <' '>)
              } {(DQ (${ Id.VSub_At '@'))} {(DQ <'; '> <'\t}'>)}
            )
            (C {<eval>} 
              {
                (DQ (${ Id.VSub_Name name) <'_cleanup() { '> <'\t\tumount -f mnt  ; '> 
                  <'\t\t: reset error ; '> <'\t}'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: copy_data
      body: 
        (BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {<uudecode>} {<-p>} {(${ Id.VSub_Name TDBASE64)})
                (command.Subshell
                  child: 
                    (command.CommandList
                      children: [
                        (command.Sentence
                          child: (C {<cd>} {<mnt>})
                          terminator: <Id.Op_Semi _>
                        )
                        (C {<tar>} {<xzf>} {<->} {<'-s/testdata/TD'> ($ Id.VSub_Number '$1') <'/'>})
                      ]
                    )
                )
              ]
              negated: F
            )
          ]
        )
    )
    (command.ShFunction
      name: copy_multiple
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<i>})
            (command.ForEach
              iter_name: i
              iter_words: [
                {
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: (C {<seq>} {($ Id.VSub_Number '$1')})
                  )
                }
              ]
              do_arg_iter: F
              body: (command.DoGroup children:[(C {<copy_data>} {($ Id.VSub_DollarName '$i')})])
            )
          ]
        )
    )
    (command.ShFunction
      name: remove_data
      body: (BraceGroup children:[(C {<rm>} {<-rf>} {<'mnt/TD'> ($ Id.VSub_Number '$1')})])
    )
    (command.ShFunction
      name: remove_multiple
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<i>})
            (command.ForEach
              iter_name: i
              iter_words: [
                {
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: (C {<seq>} {($ Id.VSub_Number '$1')})
                  )
                }
              ]
              do_arg_iter: F
              body: (command.DoGroup children:[(C {<remove_data>} {($ Id.VSub_DollarName '$i')})])
            )
          ]
        )
    )
    (command.ShFunction
      name: check_data
      body: 
        (BraceGroup
          children: [
            (command.Subshell
              child: 
                (command.AndOr
                  ops: [Id.Op_DAmp]
                  children: [
                    (C {<cd>} {<'mnt/TD'> ($ Id.VSub_Number '$1')})
                    (C {<md5>} {<Id.Lit_Star '*'>})
                  ]
                )
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<TD> ($ Id.VSub_Number '$1') <.md5>}
                )
              ]
            )
            (C {<atf_check>} {<diff>} {<-u>} {(${ Id.VSub_Name GOODMD5)} 
              {<TD> ($ Id.VSub_Number '$1') <.md5>}
            )
          ]
        )
    )
    (command.ShFunction
      name: check_data_range
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<i>})
            (command.ForEach
              iter_name: i
              iter_words: [
                {
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: (C {<seq>} {($ Id.VSub_Number '$1')} {($ Id.VSub_Number '$2')})
                  )
                }
              ]
              do_arg_iter: F
              body: (command.DoGroup children:[(C {<check_data>} {($ Id.VSub_DollarName '$i')})])
            )
          ]
        )
    )
    (command.ShFunction
      name: resize_ffs
      body: 
        (BraceGroup
          children: [
            (C {<echo>} {(DQ <'in resize_ffs:'>)} {(${ Id.VSub_At '@')})
            (C {<local>} {<Id.Lit_VarLike 'bs='> ($ Id.VSub_Number '$1')})
            (C {<local>} {<Id.Lit_VarLike 'fragsz='> ($ Id.VSub_Number '$2')})
            (C {<local>} {<Id.Lit_VarLike 'osize='> ($ Id.VSub_Number '$3')})
            (C {<local>} {<Id.Lit_VarLike 'nsize='> ($ Id.VSub_Number '$4')})
            (C {<local>} {<Id.Lit_VarLike 'fslevel='> ($ Id.VSub_Number '$5')})
            (C {<local>} {<Id.Lit_VarLike 'numdata='> ($ Id.VSub_Number '$6')})
            (C {<local>} {<Id.Lit_VarLike 'swap='> ($ Id.VSub_Number '$7')})
            (C {<mkdir>} {<-p>} {<mnt>})
            (C {<echo>} 
              {(DQ <'bs is '> (${ Id.VSub_Name bs) <' numdata is '> (${ Id.VSub_Name numdata))}
            )
            (C {<echo>} {(DQ <'****resizing fs with blocksize '> (${ Id.VSub_Name bs))})
            (C {<local>} 
              {<Id.Lit_VarLike 'fpi='> 
                (word_part.ArithSub
                  anode: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Star
                      left: <Id.Lit_ArithVarLike fragsz>
                      right: {<Id.Lit_Digits 4>}
                    )
                )
              }
            )
            (C {<local>} {<i>})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$fpi')} {<-gt>} {<16384>} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:i)
                          op: assign_op.Equal
                          rhs: {(DQ <'-i 16384'>)}
                          spids: [715]
                        )
                      ]
                    )
                  ]
                  spids: [699 712]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<x> ($ Id.VSub_DollarName '$swap')} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<x>} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<newfs>} {<-B>} {(${ Id.VSub_Name BYTESWAP)} {<-O> (${ Id.VSub_Name fslevel)} 
                      {<-b>} {(${ Id.VSub_Name bs)} {<-f>} {(${ Id.VSub_Name fragsz)} {<-s>} {(${ Id.VSub_Name osize)} 
                      {(${ Id.VSub_Name i)} {<-F>} {(${ Id.VSub_Name IMG)}
                    )
                  ]
                  spids: [724 739]
                )
              ]
              else_action: [
                (C {<newfs>} {<-O> (${ Id.VSub_Name fslevel)} {<-b>} {(${ Id.VSub_Name bs)} {<-f>} 
                  {(${ Id.VSub_Name fragsz)} {<-s>} {(${ Id.VSub_Name osize)} {(${ Id.VSub_Name i)} {<-F>} {(${ Id.VSub_Name IMG)}
                )
              ]
            )
            (C {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-e>} {<ignore>} 
              {<rump_ffs>} {(${ Id.VSub_Name IMG)} {<mnt>}
            )
            (C {<copy_multiple>} {(${ Id.VSub_Name numdata)})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name nsize)} {<-lt>} 
                              {(${ Id.VSub_Name osize)} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<local>} 
                      {<Id.Lit_VarLike 'remove='> 
                        (word_part.ArithSub
                          anode: 
                            (arith_expr.Binary
                              op_id: Id.Arith_Minus
                              left: <Id.Lit_ArithVarLike numdata>
                              right: 
                                (arith_expr.Binary
                                  op_id: Id.Arith_Slash
                                  left: 
                                    (arith_expr.Binary
                                      op_id: Id.Arith_Star
                                      left: <Id.Lit_ArithVarLike numdata>
                                      right: <Id.Lit_ArithVarLike nsize>
                                    )
                                  right: <Id.Lit_ArithVarLike osize>
                                )
                            )
                        )
                      }
                    )
                    (C {<local>} 
                      {<Id.Lit_VarLike 'dataleft='> 
                        (word_part.ArithSub
                          anode: 
                            (arith_expr.Binary
                              op_id: Id.Arith_Minus
                              left: <Id.Lit_ArithVarLike numdata>
                              right: <Id.Lit_ArithVarLike remove>
                            )
                        )
                      }
                    )
                    (C {<echo>} {<remove>} {<is>} {($ Id.VSub_DollarName '$remove')} {<dataleft>} {<is>} 
                      {($ Id.VSub_DollarName '$dataleft')}
                    )
                    (C {<remove_multiple>} {(${ Id.VSub_Name remove)})
                  ]
                  spids: [864 881]
                )
              ]
            )
            (C {<umount>} {<mnt>})
            (C {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<ignore>} 
              {<resize_ffs>} {<-c>} {<-y>} {<-s>} {(${ Id.VSub_Name nsize)} {(${ Id.VSub_Name IMG)}
            )
            (C {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<ignore>} 
              {<resize_ffs>} {<-y>} {<-s>} {(${ Id.VSub_Name nsize)} {(${ Id.VSub_Name IMG)}
            )
            (C {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<ignore>} 
              {<fsck_ffs>} {<-f>} {<-n>} {<-F>} {(${ Id.VSub_Name IMG)}
            )
            (C {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-e>} {<ignore>} 
              {<rump_ffs>} {(${ Id.VSub_Name IMG)} {<mnt>}
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name nsize)} {<-lt>} 
                              {(${ Id.VSub_Name osize)} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<check_data_range>} 
                      {
                        (word_part.ArithSub
                          anode: 
                            (arith_expr.Binary
                              op_id: Id.Arith_Plus
                              left: <Id.Lit_ArithVarLike remove>
                              right: {<Id.Lit_Digits 1>}
                            )
                        )
                      } {(${ Id.VSub_Name numdata)}
                    )
                  ]
                  spids: [1051 1068]
                )
              ]
              else_action: [(C {<check_data_range>} {<1>} {(${ Id.VSub_Name numdata)})]
            )
            (C {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <1>} {<-o>} {<ignore>} 
              {<resize_ffs>} {<-c>} {<-y>} {<-s>} {(${ Id.VSub_Name nsize)} {(${ Id.VSub_Name IMG)}
            )
            (C {<umount>} {<mnt>})
          ]
        )
    )
  ]
)