(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: [112]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:flock)
          op: assign_op.Equal
          rhs: {</var/tmp/.ftrace-lock>}
          spids: [115]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_force)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [118]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:opt_quiet)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [122]
            )
          ]
        )
      ]
    )
    (command.ShFunction
      name: usage
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{<cat>}]
              redirects: [
                (redir.HereDoc
                  op: <Id.Redir_DLessDash '<<-'>
                  fd: -1
                  here_begin: {<END>}
                  here_end_span_id: 148
                  stdin_parts: [
                    <'USAGE: reset-ftrace [-fhq]\n'>
                    <'                 -f              # force: delete ftrace lock file\n'>
                    <'                 -q              # quiet: reset, but say nothing\n'>
                    <'                 -h              # this usage message\n'>
                    <'  eg,\n'>
                    <'       reset-ftrace              # disable active ftrace session\n'>
                  ]
                )
                (redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})
              ]
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
        )
    )
    (command.ShFunction
      name: warn
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (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.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                    )
                  ]
                  spids: [162 173]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: die
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.ShFunction
      name: vecho
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DParen
                  child: (arith_expr.VarRef token:<Id.Lit_ArithVarLike opt_quiet>)
                )
                (command.ControlFlow token:<Id.ControlFlow_Return return>)
              ]
            )
            (C {<echo>} {(DQ ($ Id.VSub_At '$@'))})
          ]
        )
    )
    (command.ShFunction
      name: writefile
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:file)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [256]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:string)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [260]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.LogicalNot
                              child: 
                                (bool_expr.Unary
                                  op_id: Id.BoolUnary_w
                                  child: {($ Id.VSub_DollarName '$file')}
                                )
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'WARNING: file '> ($ Id.VSub_DollarName '$file') 
                            <' not writable/exists. Skipping.'>
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Return return>)
                  ]
                  spids: [267 280]
                )
              ]
            )
            (C {<vecho>} {(DQ ($ Id.VSub_DollarName '$file') <', before:'>)})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DParen
                  child: 
                    (arith_expr.Unary
                      op_id: Id.Arith_Bang
                      child: (arith_expr.VarRef token:<Id.Lit_ArithVarLike opt_quiet>)
                    )
                )
                (C {<cat>} {<-n>} {($ Id.VSub_DollarName '$file')})
              ]
            )
            (C {<warn>} 
              {(DQ <'echo '> ($ Id.VSub_DollarName '$string') <' > '> ($ Id.VSub_DollarName '$file'))}
            )
            (C {<vecho>} {(DQ ($ Id.VSub_DollarName '$file') <', after:'>)})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DParen
                  child: 
                    (arith_expr.Unary
                      op_id: Id.Arith_Bang
                      child: (arith_expr.VarRef token:<Id.Lit_ArithVarLike opt_quiet>)
                    )
                )
                (C {<cat>} {<-n>} {($ Id.VSub_DollarName '$file')})
              ]
            )
            (C {<vecho>})
          ]
        )
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: [(C {<getopts>} {<fhq>} {<opt>})]
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{<f>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:opt_force)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [392]
                        )
                      ]
                    )
                  ]
                  spids: [389 390 395 -1]
                )
                (case_arm
                  pat_list: [{<q>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:opt_quiet)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [401]
                        )
                      ]
                    )
                  ]
                  spids: [398 399 404 -1]
                )
                (case_arm
                  pat_list: [{<h>} {<Id.Lit_QMark '?'>}]
                  action: [(C {<usage>})]
                  spids: [407 410 414 -1]
                )
              ]
            )
          ]
        )
    )
    (C {<shift>} 
      {
        (word_part.ArithSub
          anode: 
            (arith_expr.Binary
              op_id: Id.Arith_Minus
              left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$OPTIND')})
              right: (arith_expr.ArithWord w:{<Id.Lit_Digits 1>})
            )
        )
      }
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: (bool_expr.Unary op_id:Id.BoolUnary_e child:{($ Id.VSub_DollarName '$flock')})
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DParen
                          child: (arith_expr.VarRef token:<Id.Lit_ArithVarLike opt_force>)
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [(C {<warn>} {<rm>} {($ Id.VSub_DollarName '$flock')})]
                  spids: [452 462]
                )
              ]
              else_action: [
                (command.Simple
                  words: [
                    {<echo>}
                    {<-e>}
                    {
                      (DQ <'ERROR: ftrace lock ('> ($ Id.VSub_DollarName '$flock') 
                        <') exists. It shows'>
                      )
                    }
                    {
                      (DQ <'ftrace may be in use by PID '> 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          command_list: 
                            (command.CommandList
                              children: [(C {<cat>} {($ Id.VSub_DollarName '$flock')})]
                            )
                        ) <.> <Id.Lit_Other '\\'> <'nDouble check'>
                      )
                    }
                    {(DQ <'to see if that PID is still active. If not, consider'>)}
                    {(DQ <'using -f to force a reset. Exiting.'>)}
                  ]
                  redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                )
                (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              ]
            )
          ]
          spids: [438 449]
        )
      ]
    )
    (C {<vecho>} {(DQ <'Reseting ftrace state...'>)})
    (C {<vecho>})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cd>} {($ Id.VSub_DollarName '$tracing')})
        (C {<die>} {(DQ <'ERROR: accessing tracing. Root user? Kernel has FTRACE?'>)})
      ]
    )
    (C {<writefile>} {<current_tracer>} {<nop>})
    (C {<writefile>} {<set_ftrace_filter>})
    (C {<writefile>} {<set_graph_function>})
    (C {<writefile>} {<set_ftrace_pid>})
    (C {<writefile>} {<events/enable>} {<0>})
    (C {<writefile>} {<tracing_thresh>} {<0>})
    (C {<writefile>} {<kprobe_events>})
    (C {<writefile>} {<tracing_on>} {<1>})
    (C {<vecho>} {(DQ <Done.>)})
  ]
)