(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]
    )
    (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_id: Redir_DLessDash
                  fd: 16777215
                  body: 
                    {
                      (DQ ('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')
                      )
                    }
                  do_expansion: True
                  here_end: END
                  was_filled: T
                  spids: [135]
                )
                (Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[138])
              ]
            )
            (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_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[177])]
                    )
                  ]
                  spids: [16777215 172]
                )
              ]
              spids: [16777215 188]
            )
          ]
          spids: [158]
        )
      spids: [154 157]
    )
    (FuncDef
      name: die
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[202])]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [197]
        )
      spids: [193 196]
    )
    (FuncDef
      name: vecho
      body: 
        (BraceGroup
          children: [
            (AndOr
              ops: [Op_DAmp]
              children: [
                (DParen child:(ArithVarRef name:opt_quiet))
                (ControlFlow token:<ControlFlow_Return return>)
              ]
            )
            (C {(echo)} {(DQ ($ VSub_At '$@'))})
          ]
          spids: [221]
        )
      spids: [217 220]
    )
    (FuncDef
      name: writefile
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:file)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [255]
                )
              ]
              spids: [255]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:string)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                  spids: [259]
                )
              ]
              spids: [259]
            )
            (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_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[284])]
                    )
                    (ControlFlow token:<ControlFlow_Return return>)
                  ]
                  spids: [16777215 279]
                )
              ]
              spids: [16777215 297]
            )
            (C {(vecho)} {(DQ ($ VSub_Name '$file') (', before:'))})
            (AndOr
              ops: [Op_DAmp]
              children: [
                (DParen
                  child: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_quiet))
                )
                (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))
                )
                (C {(cat)} {(-n)} {($ VSub_Name '$file')})
              ]
            )
            (C {(vecho)})
          ]
          spids: [252]
        )
      spids: [248 251]
    )
    (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: [391]
                        )
                      ]
                      spids: [391]
                    )
                  ]
                  spids: [388 389 394 16777215]
                )
                (case_arm
                  pat_list: [{(q)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:opt_quiet)
                          op: Equal
                          rhs: {(1)}
                          spids: [400]
                        )
                      ]
                      spids: [400]
                    )
                  ]
                  spids: [397 398 403 16777215]
                )
                (case_arm
                  pat_list: [{(h)} {(Lit_Other '?')}]
                  action: [(C {(usage)})]
                  spids: [406 409 413 16777215]
                )
              ]
              spids: [381 385 416]
            )
          ]
          spids: [378 418]
        )
    )
    (C {(shift)} 
      {
        (ArithSubPart
          anode: 
            (ArithBinary
              op_id: Arith_Minus
              left: (ArithWord w:{($ VSub_Name '$OPTIND')})
              right: (ArithWord w:{(Lit_Digits 1)})
            )
          spids: [422 431]
        )
      }
    )
    (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))
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(warn)} {(rm)} {($ VSub_Name '$flock')})]
                  spids: [16777215 461]
                )
              ]
              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: [491 495]
                        ) (.) (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_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[478])]
                )
                (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
              ]
              spids: [471 519]
            )
          ]
          spids: [16777215 448]
        )
      ]
      spids: [16777215 521]
    )
    (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.))})
  ]
)