(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:tracing spids:[112])
          op: Equal
          rhs: {(/sys/kernel/debug/tracing)}
          spids: [112]
        )
      ]
      spids: [112]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:flock spids:[115])
          op: Equal
          rhs: {(/var/tmp/.ftrace-lock)}
          spids: [115]
        )
      ]
      spids: [115]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:opt_force spids:[118])
                  op: Equal
                  rhs: {(0)}
                  spids: [118]
                )
              ]
              spids: [118]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (lhs_expr.LhsName name:opt_quiet spids:[122])
              op: Equal
              rhs: {(0)}
              spids: [122]
            )
          ]
          spids: [122]
        )
      ]
    )
    (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: 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:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})
              ]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit>)
          ]
          spids: [130]
        )
      spids: [126 129]
    )
    (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 173]
                )
              ]
              spids: [16777215 189]
            )
          ]
          spids: [159]
        )
      spids: [155 158]
    )
    (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: [198]
        )
      spids: [194 197]
    )
    (command.FuncDef
      name: vecho
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_quiet>)
                  spids: [225 230]
                )
                (command.ControlFlow token:<ControlFlow_Return return>)
              ]
            )
            (C {(echo)} {(DQ ($ VSub_At '$@'))})
          ]
          spids: [222]
        )
      spids: [218 221]
    )
    (command.FuncDef
      name: writefile
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:file spids:[256])
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [256]
                )
              ]
              spids: [256]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:string spids:[260])
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                  spids: [260]
                )
              ]
              spids: [260]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.LogicalNot
                              child: 
                                (bool_expr.BoolUnary
                                  op_id: BoolUnary_w
                                  child: {($ VSub_DollarName '$file')}
                                )
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.SimpleCommand
                      words: [
                        {(echo)}
                        {
                          (DQ ('WARNING: file ') ($ VSub_DollarName '$file') 
                            (' not writable/exists. Skipping.')
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (command.ControlFlow token:<ControlFlow_Return return>)
                  ]
                  spids: [16777215 280]
                )
              ]
              spids: [16777215 298]
            )
            (C {(vecho)} {(DQ ($ VSub_DollarName '$file') (', before:'))})
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: 
                    (arith_expr.ArithUnary
                      op_id: Arith_Bang
                      child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_quiet>)
                    )
                  spids: [309 316]
                )
                (C {(cat)} {(-n)} {($ VSub_DollarName '$file')})
              ]
            )
            (C {(warn)} 
              {(DQ ('echo ') ($ VSub_DollarName '$string') (' > ') ($ VSub_DollarName '$file'))}
            )
            (C {(vecho)} {(DQ ($ VSub_DollarName '$file') (', after:'))})
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: 
                    (arith_expr.ArithUnary
                      op_id: Arith_Bang
                      child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_quiet>)
                    )
                  spids: [345 352]
                )
                (C {(cat)} {(-n)} {($ VSub_DollarName '$file')})
              ]
            )
            (C {(vecho)})
          ]
          spids: [253]
        )
      spids: [249 252]
    )
    (command.WhileUntil
      keyword: <KW_While while>
      cond: [(C {(getopts)} {(fhq)} {(opt)})]
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(f)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:opt_force spids:[392])
                          op: Equal
                          rhs: {(1)}
                          spids: [392]
                        )
                      ]
                      spids: [392]
                    )
                  ]
                  spids: [389 390 395 16777215]
                )
                (case_arm
                  pat_list: [{(q)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:opt_quiet spids:[401])
                          op: Equal
                          rhs: {(1)}
                          spids: [401]
                        )
                      ]
                      spids: [401]
                    )
                  ]
                  spids: [398 399 404 16777215]
                )
                (case_arm
                  pat_list: [{(h)} {(Lit_Other '?')}]
                  action: [(C {(usage)})]
                  spids: [407 410 414 16777215]
                )
              ]
              spids: [382 386 417]
            )
          ]
          spids: [379 419]
        )
    )
    (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: [423 432]
        )
      }
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: (bool_expr.BoolUnary op_id:BoolUnary_e child:{($ VSub_DollarName '$flock')})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DParen
                          child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_force>)
                          spids: [454 459]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(warn)} {(rm)} {($ VSub_DollarName '$flock')})]
                  spids: [16777215 462]
                )
              ]
              else_action: [
                (command.SimpleCommand
                  words: [
                    {(echo)}
                    {(-e)}
                    {
                      (DQ ('ERROR: ftrace lock (') ($ VSub_DollarName '$flock') (') exists. It shows'))
                    }
                    {
                      (DQ ('ftrace may be in use by PID ') 
                        (word_part.CommandSubPart
                          command_list: 
                            (command.CommandList
                              children: [(C {(cat)} {($ VSub_DollarName '$flock')})]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [492 496]
                        ) (.) (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:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                )
                (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
              ]
              spids: [472 520]
            )
          ]
          spids: [16777215 449]
        )
      ]
      spids: [16777215 522]
    )
    (C {(vecho)} {(DQ ('Reseting ftrace state...'))})
    (C {(vecho)})
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (C {(cd)} {($ 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.))})
  ]
)