(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: [124]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_duration)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [127]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:duration)
                  op: assign_op.Equal
                  rhs: (word.Empty)
                  spids: [131]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_interval)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [134]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:interval)
                  op: assign_op.Equal
                  rhs: {<999999>}
                  spids: [138]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:opt_timestamp)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [142]
            )
          ]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_tail)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [145]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:tcmd)
                  op: assign_op.Equal
                  rhs: {<cat>}
                  spids: [149]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:ttext)
              op: assign_op.Equal
              rhs: (word.Empty)
              spids: [153]
            )
          ]
        )
      ]
    )
    (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: 217
                      stdin_parts: [
                        <'USAGE: funccount [-hT] [-i secs] [-d secs] [-t top] funcstring\n'>
                        <'                 -d seconds      # total duration of trace\n'>
                        <'                 -h              # this usage message\n'>
                        <'                 -i seconds      # interval summary\n'>
                        <'                 -t top          # show top num entries only\n'>
                        <'                 -T              # include timestamp (for -i)\n'>
                        <'  eg,\n'>
                        <'       funccount \'vfs*\'          # trace all funcs that match '>
                        <Id.Right_DoubleQuote '"'>
                        <'vfs*'>
                        <Id.Right_DoubleQuote '"'>
                        <'\n'>
                        <'       funccount -d 5 \'tcp*\'     # trace '>
                        <Id.Right_DoubleQuote '"'>
                        <'tcp*'>
                        <Id.Right_DoubleQuote '"'>
                        <' funcs for 5 seconds\n'>
                        <'       funccount -t 10 \'ext3*\'   # show top 10 '>
                        <Id.Right_DoubleQuote '"'>
                        <'ext3*'>
                        <Id.Right_DoubleQuote '"'>
                        <' funcs\n'>
                        <'       funccount -i 1 \'ext3*\'    # summary every 1 second\n'>
                        <'       funccount -i 1 -d 5 \'ext3*\' # 5 x 1 second summaries\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: [231 242]
                )
              ]
            )
          ]
        )
    )
    (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>} {<d> <Id.Lit_Colon ':'> <hi> <Id.Lit_Colon ':'> <t> <Id.Lit_Colon ':'> <T>} 
              {<opt>}
            )
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{<d>}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:opt_duration)
                              op: assign_op.Equal
                              rhs: {<1>}
                              spids: [317]
                            )
                          ]
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:duration)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$OPTARG')}
                          spids: [321]
                        )
                      ]
                    )
                  ]
                  spids: [314 315 324 -1]
                )
                (case_arm
                  pat_list: [{<i>}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:opt_interval)
                              op: assign_op.Equal
                              rhs: {<1>}
                              spids: [330]
                            )
                          ]
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:interval)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$OPTARG')}
                          spids: [334]
                        )
                      ]
                    )
                  ]
                  spids: [327 328 337 -1]
                )
                (case_arm
                  pat_list: [{<t>}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:opt_tail)
                              op: assign_op.Equal
                              rhs: {<1>}
                              spids: [343]
                            )
                          ]
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:tnum)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$OPTARG')}
                          spids: [347]
                        )
                      ]
                    )
                  ]
                  spids: [340 341 350 -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: [356]
                        )
                      ]
                    )
                  ]
                  spids: [353 354 359 -1]
                )
                (case_arm
                  pat_list: [{<h>} {<Id.Lit_QMark '?'>}]
                  action: [(C {<usage>})]
                  spids: [362 365 369 -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.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.DParen
          child: 
            (arith_expr.Binary
              op_id: Id.Arith_DEqual
              left: {($ Id.VSub_Pound '$#')}
              right: {<Id.Lit_Digits 0>}
            )
        )
        (C {<usage>})
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:funcs)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_Number '$1'))}
          spids: [408]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: (command.DParen child:<Id.Lit_ArithVarLike opt_tail>)
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:tcmd)
                  op: assign_op.Equal
                  rhs: {(DQ <'tail -'> ($ Id.VSub_DollarName '$tnum'))}
                  spids: [426]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:ttext)
                  op: assign_op.Equal
                  rhs: {(DQ <' Top '> ($ Id.VSub_DollarName '$tnum') <' only.'>)}
                  spids: [433]
                )
              ]
            )
          ]
          spids: [413 423]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: (command.DParen child:<Id.Lit_ArithVarLike opt_duration>)
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} 
              {
                (DQ <'Tracing '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) 
                  ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' for '> 
                  ($ Id.VSub_DollarName '$duration') <' seconds.'> ($ Id.VSub_DollarName '$ttext') <..>
                )
              }
            )
          ]
          spids: [442 452]
        )
      ]
      else_action: [
        (C {<echo>} 
          {
            (DQ <'Tracing '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) 
              ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <.> ($ Id.VSub_DollarName '$ttext') 
              <'.. Ctrl-C to end.'>
            )
          }
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.DParen
          child: 
            (arith_expr.Binary
              op_id: Id.Arith_DAmp
              left: <Id.Lit_ArithVarLike opt_duration>
              right: (arith_expr.Unary op_id:Id.Arith_Bang child:<Id.Lit_ArithVarLike opt_interval>)
            )
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:interval)
              op: assign_op.Equal
              rhs: {($ Id.VSub_DollarName '$duration')}
              spids: [500]
            )
          ]
        )
      ]
    )
    (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: [{<echo>} {(DQ ($ Id.VSub_DollarName '$funcs'))}]
          redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<set_ftrace_filter>})]
          do_fork: T
        )
        (C {<die>} 
          {
            (DQ <'ERROR: enabling '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) 
              ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <'. 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.'>)} 
              {(DQ <'Have CONFIG_FUNCTION_PROFILER? Exiting.'>)}
            )
          ]
          spids: [563 576]
        )
      ]
    )
    (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: [603]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:secs)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [607]
            )
          ]
        )
      ]
    )
    (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')})
            (C {<echo>})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [(command.DParen child:<Id.Lit_ArithVarLike opt_timestamp>) (C {<date>})]
            )
            (C {<printf>} {(DQ <'%-30s %8s'> <Id.Lit_BadBackslash '\\'> <n>)} {(DQ <FUNC>)} {(DQ <COUNT>)})
            (command.Pipeline
              children: [
                (C {<cat>} {<'trace_stat/function'> <Id.Lit_Star '*'>})
                (C {<awk>} 
                  {
                    (SQ <'\n'> <'\t# skip headers by matching on the numeric hit column\n'> 
                      <'\t$2 ~ /[0-9]/ { a[$1] += $2 }\n'> <'\tEND {\n'> <'\t\tfor (k in a) {\n'> <'\t\t\tprintf "%-30s %8d\\n", k,  a[k]\n'> <'\t\t}\n'> <'\t}'>
                    )
                  }
                )
                (C {<sort>} {<-n>} {<-k2>})
                (C {($ Id.VSub_DollarName '$tcmd')})
              ]
              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'>)})
  ]
)