(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tracing)
          op: assign_op.Equal
          rhs: {<'/sys/kernel/debug/tracing'>}
          spids: [166]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:interval)
                  op: assign_op.Equal
                  rhs: {<1>}
                  spids: [169]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_timestamp)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [173]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:opt_debug)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [177]
            )
          ]
        )
      ]
    )
    (C {<trap>} {(SQ <'quit=1'>)} {<INT>} {<QUIT>} {<TERM>} {<PIPE>} {<HUP>})
    (command.ShFunction
      name: usage
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<cat>}]
              redirects: [
                (redir
                  op: <Id.Redir_DLessDash '<<-'>
                  loc: (redir_loc.Fd fd:0)
                  arg: 
                    (redir_param.HereDoc
                      here_begin: {<END>}
                      here_end_span_id: 226
                      stdin_parts: [
                        <'USAGE: cachestat [-Dht] [interval]\n'>
                        <'                 -D              # print debug counters\n'>
                        <'                 -h              # this usage message\n'>
                        <'                 -t              # include timestamp\n'>
                        <'                 interval        # output interval in secs (default 1)\n'>
                        <'  eg,\n'>
                        <'       cachestat                 # show stats every second\n'>
                        <'       cachestat 5               # show stats every 5 seconds\n'>
                        <'\n'>
                        <'See the man page and example file for more info.\n'>
                      ]
                    )
                )
                (redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})
              ]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
        )
    )
    (command.ShFunction
      name: warn
      body: 
        (BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.Pipeline
                              children: [(C {<eval>} {(DQ ($ Id.VSub_At '$@'))})]
                              negated: T
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'WARNING: command failed '> 
                            (word_part.EscapedLiteral
                              token: <Id.Lit_EscapedChar '\\"'>
                            ) ($ Id.VSub_At '$@') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>)
                          )
                        }
                      ]
                      redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                      do_fork: T
                    )
                  ]
                  spids: [240 251]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: die
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: (condition.Shell commands:[(C {<getopts>} {<Dht>} {<opt>})])
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{<D>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:opt_debug)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [320]
                        )
                      ]
                    )
                  ]
                  spids: [317 318 323 -1]
                )
                (case_arm
                  pat_list: [{<t>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:opt_timestamp)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [329]
                        )
                      ]
                    )
                  ]
                  spids: [326 327 332 -1]
                )
                (case_arm
                  pat_list: [{<h>} {<Id.Lit_QMark '?'>}]
                  action: [(C {<usage>})]
                  spids: [335 338 342 -1]
                )
              ]
            )
          ]
        )
    )
    (C {<shift>} 
      {
        (word_part.ArithSub
          anode: 
            (arith_expr.Binary
              op_id: Id.Arith_Minus
              left: {($ Id.VSub_DollarName '$OPTIND')}
              right: {<Id.Lit_Digits 1>}
            )
        )
      }
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: (command.DParen child:{($ Id.VSub_Pound '$#')})
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:interval)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [379]
                )
              ]
            )
          ]
          spids: [366 376]
        )
      ]
    )
    (C {<echo>} 
      {
        (DQ <'Counting cache functions... Output every '> ($ Id.VSub_DollarName '$interval') 
          <' seconds.'>
        )
      }
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cd>} {($ Id.VSub_DollarName '$tracing')})
        (C {<die>} 
          {
            (DQ <'ERROR: accessing tracing. Root user? Kernel has FTRACE?\n'> 
              <'    debugfs mounted? (mount -t debugfs debugfs /sys/kernel/debug)'>
            )
          }
        )
      ]
    )
    (C {<sysctl>} {<-q>} {<kernel.ftrace_enabled> <Id.Lit_Equals '='> <1>})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [
            {<printf>}
            {
              (DQ <mark_page_accessed> <Id.Lit_BadBackslash '\\'> <nmark_buffer_dirty> 
                <Id.Lit_BadBackslash '\\'> <nadd_to_page_cache_lru> <Id.Lit_BadBackslash '\\'> <naccount_page_dirtied> <Id.Lit_BadBackslash '\\'> 
                <n>
              )
            }
          ]
          redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<set_ftrace_filter>})]
          do_fork: T
        )
        (C {<die>} {(DQ <'ERROR: tracing these four kernel functions: mark_page_accessed,'>)} 
          {
            (DQ 
              <
'mark_buffer_dirty, add_to_page_cache_lru and account_page_dirtied (unknown kernel version?). Exiting.'
              >
            )
          }
        )
      ]
    )
    (C {<warn>} {(DQ <'echo nop > current_tracer'>)})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.Pipeline
                      children: [
                        (command.Simple
                          words: [{<echo>} {<1>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<function_profile_enabled>}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                      negated: T
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<set_ftrace_filter>}
                )
              ]
              do_fork: T
            )
            (C {<die>} 
              {(DQ <'ERROR: enabling function profiling. Have CONFIG_FUNCTION_PROFILER? Exiting.'>)}
            )
          ]
          spids: [463 476]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.DParen child:<Id.Lit_ArithVarLike opt_timestamp>)
        (C {<printf>} {(DQ <'%-8s '>)} {<TIME>})
      ]
    )
    (C {<printf>} {(DQ <'%8s %8s %8s %8s %12s %10s'>)} {<HITS>} {<MISSES>} {<DIRTIES>} {<RATIO>} 
      {(DQ <BUFFERS_MB>)} {(DQ <CACHE_MB>)}
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [(command.DParen child:<Id.Lit_ArithVarLike opt_debug>) (C {<printf>} {(DQ <'  DEBUG'>)})]
    )
    (C {<echo>})
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:quit)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [555]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:secs)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [559]
            )
          ]
        )
      ]
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: 
        (condition.Shell
          commands: [
            (command.Sentence
              child: 
                (command.DParen
                  child: 
                    (arith_expr.Binary
                      op_id: Id.Arith_DAmp
                      left: (arith_expr.Unary op_id:Id.Arith_Bang child:<Id.Lit_ArithVarLike quit>)
                      right: 
                        (arith_expr.Binary
                          op_id: Id.Arith_DPipe
                          left: 
                            (arith_expr.Unary
                              op_id: Id.Arith_Bang
                              child: <Id.Lit_ArithVarLike opt_duration>
                            )
                          right: 
                            (arith_expr.Binary
                              op_id: Id.Arith_Less
                              left: <Id.Lit_ArithVarLike secs>
                              right: <Id.Lit_ArithVarLike duration>
                            )
                        )
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (command.DParen
              child: 
                (arith_expr.BinaryAssign
                  op_id: Id.Arith_PlusEqual
                  left: <Id.Lit_ArithVarLike secs>
                  right: <Id.Lit_ArithVarLike interval>
                )
            )
            (command.Simple
              words: [{<echo>} {<0>}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<function_profile_enabled>}
                )
              ]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {<1>}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<function_profile_enabled>}
                )
              ]
              do_fork: T
            )
            (C {<sleep>} {($ Id.VSub_DollarName '$interval')})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DParen child:<Id.Lit_ArithVarLike opt_timestamp>)
                (C {<printf>} {(DQ <'%(%H:%M:%S)T '>)} {<-1>})
              ]
            )
            (command.Pipeline
              children: [
                (C {<cat>} {<'/proc/meminfo'>} {<'trace_stat/function'> <Id.Lit_Star '*'>})
                (C {<awk>} {<-v>} {<Id.Lit_VarLike 'debug='> ($ Id.VSub_DollarName '$opt_debug')} 
                  {
                    (SQ <'\n'> <'\t# match meminfo stats:\n'> 
                      <'\t$1 == "Buffers:" && $3 == "kB" { buffers_mb = $2 / 1024 }\n'> <'\t$1 == "Cached:" && $3 == "kB" { cached_mb = $2 / 1024 }\n'> 
                      <'\t# identify and save trace counts:\n'> <'\t$2 ~ /[0-9]/ && $3 != "kB" { a[$1] += $2 }\n'> <'\tEND {\n'> 
                      <'\t\tmpa = a["mark_page_accessed"]\n'> <'\t\tmbd = a["mark_buffer_dirty"]\n'> <'\t\tapcl = a["add_to_page_cache_lru"]\n'> 
                      <'\t\tapd = a["account_page_dirtied"]\n'> <'\n'> <'\t\ttotal = mpa - mbd\n'> <'\t\tmisses = apcl - apd\n'> <'\t\tif (misses < 0)\n'> 
                      <'\t\t\tmisses = 0\n'> <'\t\thits = total - misses\n'> <'\n'> <'\t\tratio = 100 * hits / total\n'> 
                      <'\t\tprintf "%8d %8d %8d %7.1f%% %12.0f %10.0f", hits, misses, mbd,\n'> <'\t\t    ratio, buffers_mb, cached_mb\n'> <'\t\tif (debug)\n'> 
                      <'\t\t\tprintf "  (%d %d %d %d)", mpa, mbd, apcl, apd\n'> <'\t\tprintf "\\n"\n'> <'\t}'>
                    )
                  }
                )
              ]
              negated: F
            )
          ]
        )
    )
    (command.Simple
      words: [{<echo>}]
      redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})]
      do_fork: T
    )
    (command.Simple
      words: [{<echo>} {(DQ <'Ending tracing...'>)}]
      redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})]
      do_fork: T
    )
    (C {<warn>} {(DQ <'echo 0 > function_profile_enabled'>)})
    (C {<warn>} {(DQ <'echo > set_ftrace_filter'>)})
  ]
)