(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tracing)
          op: Equal
          rhs: {(/sys/kernel/debug/tracing)}
          spids: [112]
        )
      ]
      spids: [112]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:flock)
          op: Equal
          rhs: {(/var/tmp/.ftrace-lock)}
          spids: [115]
        )
      ]
      spids: [115]
    )
    (CommandList
      children: [
        (Sentence
          child: 
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:opt_force) op:Equal rhs:{(0)} spids:[118])]
              spids: [118]
            )
          terminator: <Op_Semi ';'>
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:opt_quiet) op:Equal rhs:{(0)} spids:[122])]
          spids: [122]
        )
      ]
    )
    (FuncDef
      name: usage
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (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 op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})
              ]
            )
            (ControlFlow token:<ControlFlow_Exit exit>)
          ]
          spids: [130]
        )
      spids: [126 129]
    )
    (FuncDef
      name: warn
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: (Pipeline children:[(C {(eval)} {(DQ ($ VSub_At '$@'))})] negated:T)
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {
                          (DQ ('WARNING: command failed ') 
                            (EscapedLiteralPart
                              token: <Lit_EscapedChar '\\"'>
                            ) ($ VSub_At '$@') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>)
                          )
                        }
                      ]
                      redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                  ]
                  spids: [16777215 173]
                )
              ]
              spids: [16777215 189]
            )
          ]
          spids: [159]
        )
      spids: [155 158]
    )
    (FuncDef
      name: die
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [198]
        )
      spids: [194 197]
    )
    (FuncDef
      name: vecho
      body: 
        (BraceGroup
          children: [
            (AndOr
              ops: [Op_DAmp]
              children: [
                (DParen child:(ArithVarRef name:opt_quiet) spids:[225 230])
                (ControlFlow token:<ControlFlow_Return return>)
              ]
            )
            (C {(echo)} {(DQ ($ VSub_At '$@'))})
          ]
          spids: [222]
        )
      spids: [218 221]
    )
    (FuncDef
      name: writefile
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:file)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [256]
                )
              ]
              spids: [256]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:string)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                  spids: [260]
                )
              ]
              spids: [260]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (LogicalNot
                              child: (BoolUnary op_id:BoolUnary_w child:{($ VSub_Name '$file')})
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {
                          (DQ ('WARNING: file ') ($ VSub_Name '$file') 
                            (' not writable/exists. Skipping.')
                          )
                        }
                      ]
                      redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (ControlFlow token:<ControlFlow_Return return>)
                  ]
                  spids: [16777215 280]
                )
              ]
              spids: [16777215 298]
            )
            (C {(vecho)} {(DQ ($ VSub_Name '$file') (', before:'))})
            (AndOr
              ops: [Op_DAmp]
              children: [
                (DParen
                  child: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_quiet))
                  spids: [309 316]
                )
                (C {(cat)} {(-n)} {($ VSub_Name '$file')})
              ]
            )
            (C {(warn)} {(DQ ('echo ') ($ VSub_Name '$string') (' > ') ($ VSub_Name '$file'))})
            (C {(vecho)} {(DQ ($ VSub_Name '$file') (', after:'))})
            (AndOr
              ops: [Op_DAmp]
              children: [
                (DParen
                  child: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_quiet))
                  spids: [345 352]
                )
                (C {(cat)} {(-n)} {($ VSub_Name '$file')})
              ]
            )
            (C {(vecho)})
          ]
          spids: [253]
        )
      spids: [249 252]
    )
    (WhileUntil
      keyword: <KW_While while>
      cond: [(C {(getopts)} {(fhq)} {(opt)})]
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {($ VSub_Name '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(f)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:opt_force)
                          op: Equal
                          rhs: {(1)}
                          spids: [392]
                        )
                      ]
                      spids: [392]
                    )
                  ]
                  spids: [389 390 395 16777215]
                )
                (case_arm
                  pat_list: [{(q)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:opt_quiet)
                          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)} 
      {
        (ArithSubPart
          anode: 
            (ArithBinary
              op_id: Arith_Minus
              left: (ArithWord w:{($ VSub_Name '$OPTIND')})
              right: (ArithWord w:{(Lit_Digits 1)})
            )
          spids: [423 432]
        )
      }
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (DBracket expr:(BoolUnary op_id:BoolUnary_e child:{($ VSub_Name '$flock')}))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: (DParen child:(ArithVarRef name:opt_force) spids:[454 459])
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(warn)} {(rm)} {($ VSub_Name '$flock')})]
                  spids: [16777215 462]
                )
              ]
              else_action: [
                (SimpleCommand
                  words: [
                    {(echo)}
                    {(-e)}
                    {(DQ ('ERROR: ftrace lock (') ($ VSub_Name '$flock') (') exists. It shows'))}
                    {
                      (DQ ('ftrace may be in use by PID ') 
                        (CommandSubPart
                          command_list: (CommandList children:[(C {(cat)} {($ VSub_Name '$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 op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                )
                (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)})
    (AndOr
      ops: [Op_DPipe]
      children: [
        (C {(cd)} {($ VSub_Name '$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.))})
  ]
)