(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:KB) op:assign_op.Equal rhs:{<1024>} spids:[85])]
    )
    (C {<Id.Lit_Colon ':'>} 
      {
        (braced_var_sub
          token: <Id.VSub_Name TMPDIR>
          suffix_op: (suffix_op.Unary op_id:Id.VTest_Equals arg_word:{<Id.Lit_Slash '/'> <tmp>})
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DEFAULT_MTREE_KEYWORDS)
          op: assign_op.Equal
          rhs: {(DQ <'type,mode,gid,uid,size,link'>)}
          spids: [115]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TEST_IMAGE)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$TMPDIR') <'/test.img'>)}
          spids: [120]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TEST_INPUTS_DIR)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$TMPDIR') <'/inputs'>)}
          spids: [126]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TEST_MD_DEVICE_FILE)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$TMPDIR') <'/md.output'>)}
          spids: [132]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TEST_MOUNT_DIR)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$TMPDIR') <'/mnt'>)}
          spids: [138]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TEST_SPEC_FILE)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$TMPDIR') <'/mtree.spec'>)}
          spids: [144]
        )
      ]
    )
    (command.ShFunction
      name: check_image_contents
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<Id.Lit_VarLike 'directories='> ($ Id.VSub_DollarName '$TEST_INPUTS_DIR')})
            (C {<local>} {<excludes>} {<mtree_excludes_arg>} {<mtree_file>})
            (C {<local>} 
              {<Id.Lit_VarLike 'mtree_keywords='> 
                (DQ ($ Id.VSub_DollarName '$DEFAULT_MTREE_KEYWORDS'))
              }
            )
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: [
                (command.Sentence
                  child: (C {<getopts>} {(DQ <'d:f:m:X:'>)} {<flag>})
                  terminator: <Id.Op_Semi _>
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.Case
                      to_match: {(DQ ($ Id.VSub_DollarName '$flag'))}
                      arms: [
                        (case_arm
                          pat_list: [{<d>}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:directories)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (DQ ($ Id.VSub_DollarName '$directories') <' '> 
                                        ($ Id.VSub_DollarName '$OPTARG')
                                      )
                                    }
                                  spids: [209]
                                )
                              ]
                            )
                          ]
                          spids: [205 206 217 -1]
                        )
                        (case_arm
                          pat_list: [{<f>}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:mtree_file)
                                  op: assign_op.Equal
                                  rhs: {($ Id.VSub_DollarName '$OPTARG')}
                                  spids: [224]
                                )
                              ]
                            )
                          ]
                          spids: [220 221 228 -1]
                        )
                        (case_arm
                          pat_list: [{<m>}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:mtree_keywords)
                                  op: assign_op.Equal
                                  rhs: {($ Id.VSub_DollarName '$OPTARG')}
                                  spids: [235]
                                )
                              ]
                            )
                          ]
                          spids: [231 232 239 -1]
                        )
                        (case_arm
                          pat_list: [{<X>}]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:excludes)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (DQ ($ Id.VSub_DollarName '$excludes') <' '> 
                                        ($ Id.VSub_DollarName '$OPTARG')
                                      )
                                    }
                                  spids: [246]
                                )
                              ]
                            )
                          ]
                          spids: [242 243 254 -1]
                        )
                        (case_arm
                          pat_list: [{<Id.Lit_Star '*'>}]
                          action: [
                            (C {<echo>} 
                              {
                                (DQ 
                                  <
'usage: check_image_contents [-d directory ...] [-f mtree-file] [-m mtree-keywords] [-X exclude]'
                                  >
                                )
                              }
                            )
                            (C {<atf_fail>} {(DQ <'unhandled option: '> ($ Id.VSub_DollarName '$flag'))})
                          ]
                          spids: [257 258 276 -1]
                        )
                      ]
                    )
                  ]
                )
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName '$excludes'))} 
                          {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {<echo>} {(DQ ($ Id.VSub_DollarName '$excludes'))})
                        (command.Simple
                          words: [{<tr>} {(SQ <' '>)} {(SQ <'\\n'>)}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<excludes.txt>}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                      negated: F
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:mtree_excludes_arg)
                          op: assign_op.Equal
                          rhs: {(DQ <'-X excludes.txt'>)}
                          spids: [325]
                        )
                      ]
                    )
                  ]
                  spids: [286 299]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$mtree_file'))} 
                          {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:mtree_file)
                          op: assign_op.Equal
                          rhs: {<input_spec.mtree>}
                          spids: [351]
                        )
                      ]
                    )
                    (command.ForEach
                      iter_name: directory
                      iter_words: [{($ Id.VSub_DollarName '$directories')}]
                      do_arg_iter: F
                      body: 
                        (command.DoGroup
                          children: [
                            (C {<mtree>} {<-c>} {<-k>} {($ Id.VSub_DollarName '$mtree_keywords')} {<-p>} 
                              {($ Id.VSub_DollarName '$directory')} {($ Id.VSub_DollarName '$mtree_excludes_arg')}
                            )
                          ]
                        )
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {($ Id.VSub_DollarName '$mtree_file')}
                        )
                      ]
                    )
                  ]
                  spids: [335 348]
                )
              ]
            )
            (C {<echo>} {(DQ <'<---- Input spec BEGIN ---->'>)})
            (C {<cat>} {($ Id.VSub_DollarName '$mtree_file')})
            (C {<echo>} {(DQ <'<---- Input spec END ---->'>)})
            (C {<atf_check>} {<-e>} {<empty>} {<-o>} {<empty>} {<-s>} 
              {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<mtree>} {<-UW>} {<-f>} {($ Id.VSub_DollarName '$mtree_file')} {<-p>} 
              {($ Id.VSub_DollarName '$TEST_MOUNT_DIR')} {($ Id.VSub_DollarName '$mtree_excludes_arg')}
            )
          ]
        )
    )
    (command.ShFunction
      name: create_test_dirs
      body: 
        (BraceGroup
          children: [
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<mkdir>} {<-m>} {<0777>} {<-p>} {($ Id.VSub_DollarName '$TEST_MOUNT_DIR')}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<mkdir>} {<-m>} {<0777>} {<-p>} {($ Id.VSub_DollarName '$TEST_INPUTS_DIR')}
            )
          ]
        )
    )
    (command.ShFunction
      name: create_test_inputs
      body: 
        (BraceGroup
          children: [
            (C {<create_test_dirs>})
            (C {<cd>} {($ Id.VSub_DollarName '$TEST_INPUTS_DIR')})
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<mkdir>} {<-m>} {<0755>} {<-p>} {<'a/b/1'>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<ln>} {<-s>} {<'a/b'>} {<c>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<d>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<ln>} {<d>} {<e>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<.f>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<mkdir>} {<.g>}
            )
            (C {<atf_check>} {<-e>} {<ignore>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<dd>} {<Id.Lit_VarLike 'if='> <'/dev/zero'>} {<Id.Lit_VarLike 'of='> <i>} {<Id.Lit_VarLike 'count='> <1000>} 
              {<Id.Lit_VarLike 'bs='> <1>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<klmn>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<opqr>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<stuv>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<install>} {<-m>} {<0755>} {<'/dev/null'>} {<wxyz>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00000001>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00000010>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00000011>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00000100>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00000101>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00000110>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00000111>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00001000>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00001001>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00001010>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00001011>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00001100>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00001101>}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} 
              {<touch>} {<0b00001110>}
            )
            (command.ForEach
              iter_name: filesize
              iter_words: [
                {<1>}
                {<512>}
                {
                  (word_part.ArithSub
                    anode: 
                      (arith_expr.Binary
                        op_id: Id.Arith_Star
                        left: {<Id.Lit_Digits 2>}
                        right: {($ Id.VSub_DollarName '$KB')}
                      )
                  )
                }
                {
                  (word_part.ArithSub
                    anode: 
                      (arith_expr.Binary
                        op_id: Id.Arith_Star
                        left: {<Id.Lit_Digits 10>}
                        right: {($ Id.VSub_DollarName '$KB')}
                      )
                  )
                }
                {
                  (word_part.ArithSub
                    anode: 
                      (arith_expr.Binary
                        op_id: Id.Arith_Star
                        left: {<Id.Lit_Digits 512>}
                        right: {($ Id.VSub_DollarName '$KB')}
                      )
                  )
                }
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (C {<atf_check>} {<-e>} {<ignore>} {<-o>} {<empty>} {<-s>} 
                      {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<dd>} {<Id.Lit_VarLike 'if='> <'/dev/zero'>} 
                      {<Id.Lit_VarLike 'of='> (${ Id.VSub_Name filesize) <.file>} {<Id.Lit_VarLike 'bs='> <1>} {<Id.Lit_VarLike 'count='> <1>} 
                      {<Id.Lit_VarLike 'oseek='> (${ Id.VSub_Name filesize)} {<Id.Lit_VarLike 'conv='> <sparse>}
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:files)
                          op: assign_op.Equal
                          rhs: {(DQ (${ Id.VSub_Name files) <' '> (${ Id.VSub_Name filesize) <.file>)}
                          spids: [1084]
                        )
                      ]
                    )
                  ]
                )
            )
            (C {<cd>} {<->})
          ]
        )
    )
    (command.ShFunction
      name: mount_image
      body: 
        (BraceGroup
          children: [
            (C {<atf_check>} {<-e>} {<empty>} {<-o>} 
              {<save> <Id.Lit_Colon ':'> ($ Id.VSub_DollarName '$TEST_MD_DEVICE_FILE')} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<mdconfig>} {<-a>} {<-f>} 
              {($ Id.VSub_DollarName '$TEST_IMAGE')}
            )
            (C {<atf_check>} {<-e>} {<empty>} {<-o>} {<empty>} {<-s>} 
              {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {($ Id.VSub_DollarName '$MOUNT')} 
              {<'/dev/'> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<cat>} {($ Id.VSub_DollarName '$TEST_MD_DEVICE_FILE')})
                )
              } {($ Id.VSub_DollarName '$TEST_MOUNT_DIR')}
            )
          ]
        )
    )
  ]
)