(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:tracing spids:[166])
          op: Equal
          rhs: {(/sys/kernel/debug/tracing)}
          spids: [166]
        )
      ]
      spids: [166]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:interval spids:[169])
                  op: Equal
                  rhs: {(1)}
                  spids: [169]
                )
              ]
              spids: [169]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:opt_timestamp spids:[173])
                  op: Equal
                  rhs: {(0)}
                  spids: [173]
                )
              ]
              spids: [173]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:opt_debug spids:[177])
              op: Equal
              rhs: {(0)}
              spids: [177]
            )
          ]
          spids: [177]
        )
      ]
    )
    (C {(trap)} {(SQ <'quit=1'>)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)})
    (command.FuncDef
      name: usage
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(cat)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLessDash '<<-'>
                  fd: 16777215
                  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.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})
              ]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit>)
          ]
          spids: [204]
        )
      spids: [200 203]
    )
    (command.FuncDef
      name: warn
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [(C {(eval)} {(DQ ($ VSub_At '$@'))})]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.SimpleCommand
                      words: [
                        {(echo)}
                        {
                          (DQ ('WARNING: command failed ') 
                            (word_part.EscapedLiteralPart
                              token: <Lit_EscapedChar '\\"'>
                            ) ($ VSub_At '$@') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>)
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                  ]
                  spids: [16777215 251]
                )
              ]
              spids: [16777215 267]
            )
          ]
          spids: [237]
        )
      spids: [233 236]
    )
    (command.FuncDef
      name: die
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [276]
        )
      spids: [272 275]
    )
    (command.WhileUntil
      keyword: <KW_While while>
      cond: [(C {(getopts)} {(Dht)} {(opt)})]
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(D)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:opt_debug spids:[320])
                          op: Equal
                          rhs: {(1)}
                          spids: [320]
                        )
                      ]
                      spids: [320]
                    )
                  ]
                  spids: [317 318 323 16777215]
                )
                (case_arm
                  pat_list: [{(t)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:opt_timestamp spids:[329])
                          op: Equal
                          rhs: {(1)}
                          spids: [329]
                        )
                      ]
                      spids: [329]
                    )
                  ]
                  spids: [326 327 332 16777215]
                )
                (case_arm
                  pat_list: [{(h)} {(Lit_Other '?')}]
                  action: [(C {(usage)})]
                  spids: [335 338 342 16777215]
                )
              ]
              spids: [310 314 345]
            )
          ]
          spids: [307 347]
        )
    )
    (C {(shift)} 
      {
        (word_part.ArithSubPart
          anode: 
            (arith_expr.ArithBinary
              op_id: Arith_Minus
              left: (arith_expr.ArithWord w:{($ VSub_DollarName '$OPTIND')})
              right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
            )
          spids: [351 360]
        )
      }
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DParen
                  child: (arith_expr.ArithWord w:{($ VSub_Pound '$#')})
                  spids: [368 373]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:interval spids:[379])
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [379]
                )
              ]
              spids: [379]
            )
          ]
          spids: [16777215 376]
        )
      ]
      spids: [16777215 382]
    )
    (C {(echo)} 
      {
        (DQ ('Counting cache functions... Output every ') ($ VSub_DollarName '$interval') (' seconds.'))
      }
    )
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (C {(cd)} {($ 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) (Lit_Other '=') (1)})
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (command.SimpleCommand
          words: [
            {(printf)}
            {
              (DQ (mark_page_accessed) (Lit_Other '\\') (nmark_buffer_dirty) (Lit_Other '\\') 
                (nadd_to_page_cache_lru) (Lit_Other '\\') (naccount_page_dirtied) (Lit_Other '\\') (n)
              )
            }
          ]
          redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(set_ftrace_filter)})]
        )
        (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: [
            (command.Sentence
              child: 
                (command.Pipeline
                  children: [
                    (command.SimpleCommand
                      words: [{(echo)} {(1)}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_Great '>'>
                          fd: 16777215
                          arg_word: {(function_profile_enabled)}
                        )
                      ]
                    )
                  ]
                  negated: T
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.SimpleCommand
              words: [{(echo)}]
              redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(set_ftrace_filter)})]
            )
            (C {(die)} 
              {(DQ ('ERROR: enabling function profiling. Have CONFIG_FUNCTION_PROFILER? Exiting.'))}
            )
          ]
          spids: [16777215 476]
        )
      ]
      spids: [16777215 492]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (command.DParen
          child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_timestamp>)
          spids: [495 500]
        )
        (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: [Op_DAmp]
      children: [
        (command.DParen
          child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_debug>)
          spids: [534 539]
        )
        (C {(printf)} {(DQ ('  DEBUG'))})
      ]
    )
    (C {(echo)})
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:quit spids:[555])
                  op: Equal
                  rhs: {(0)}
                  spids: [555]
                )
              ]
              spids: [555]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:secs spids:[559])
              op: Equal
              rhs: {(0)}
              spids: [559]
            )
          ]
          spids: [559]
        )
      ]
    )
    (command.WhileUntil
      keyword: <KW_While while>
      cond: [
        (command.Sentence
          child: 
            (command.DParen
              child: 
                (arith_expr.ArithBinary
                  op_id: Arith_DAmp
                  left: 
                    (arith_expr.ArithUnary
                      op_id: Arith_Bang
                      child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike quit>)
                    )
                  right: 
                    (arith_expr.ArithBinary
                      op_id: Arith_DPipe
                      left: 
                        (arith_expr.ArithUnary
                          op_id: Arith_Bang
                          child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_duration>)
                        )
                      right: 
                        (arith_expr.ArithBinary
                          op_id: Arith_Less
                          left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike secs>)
                          right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike duration>)
                        )
                    )
                )
              spids: [564 585]
            )
          terminator: <Op_Semi ';'>
        )
      ]
      body: 
        (command.DoGroup
          children: [
            (command.DParen
              child: 
                (arith_expr.BinaryAssign
                  op_id: Arith_PlusEqual
                  left: (lhs_expr.LhsName name:secs spids:[593])
                  right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike interval>)
                )
              spids: [591 600]
            )
            (command.SimpleCommand
              words: [{(echo)} {(0)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {(function_profile_enabled)}
                )
              ]
            )
            (command.SimpleCommand
              words: [{(echo)} {(1)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {(function_profile_enabled)}
                )
              ]
            )
            (C {(sleep)} {($ VSub_DollarName '$interval')})
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_timestamp>)
                  spids: [627 632]
                )
                (C {(printf)} {(DQ ('%(%H:%M:%S)T '))} {(-1)})
              ]
            )
            (command.Pipeline
              children: [
                (C {(cat)} {(/proc/meminfo)} {(trace_stat/function) (Lit_Other '*')})
                (C {(awk)} {(-v)} {(Lit_VarLike 'debug=') ($ 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
            )
          ]
          spids: [588 694]
        )
    )
    (command.SimpleCommand
      words: [{(echo)}]
      redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
    )
    (command.SimpleCommand
      words: [{(echo)} {(DQ ('Ending tracing...'))}]
      redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
    )
    (C {(warn)} {(DQ ('echo 0 > function_profile_enabled'))})
    (C {(warn)} {(DQ ('echo > set_ftrace_filter'))})
  ]
)