(CommandList
  children: [
    (FuncDef
      name: err
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:exitcode)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [33]
                )
              ]
              spids: [31]
            )
            (C {(shift)})
            (SimpleCommand
              words: [{(echo)} {(DQ ('ERROR: ') ($ VSub_At '$@'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[47])]
            )
            (ControlFlow
              token: <ControlFlow_Exit exit>
              arg_word: {($ VSub_Name '$exitcode')}
            )
          ]
          spids: [28]
        )
      spids: [22 27]
    )
    (FuncDef
      name: warn
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ('WARN : ') ($ VSub_At '$@'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[74])]
            )
          ]
          spids: [64]
        )
      spids: [58 63]
    )
    (FuncDef
      name: info
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolUnary op_id:BoolUnary_n child:{(DQ ($ VSub_Name '$VERBOSE'))})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [{(echo)} {(DQ ('INFO : ') ($ VSub_At '$@'))}]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[112])]
                    )
                  ]
                  spids: [16777215 102]
                )
              ]
              spids: [16777215 116]
            )
          ]
          spids: [86]
        )
      spids: [80 85]
    )
    (C {(export)} {(Lit_VarLike 'PROC_DIR=') (/proc/net/pktgen)})
    (FuncDef
      name: pg_ctrl
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:proc_file)
                  op: Equal
                  rhs: {(DQ (pgctrl))}
                  spids: [167]
                )
              ]
              spids: [165]
            )
            (C {(proc_cmd)} {(${ VSub_Name proc_file)} {(DQ ($ VSub_At '$@'))})
          ]
          spids: [162]
        )
      spids: [156 161]
    )
    (FuncDef
      name: pg_thread
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:thread)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [197]
                )
              ]
              spids: [195]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:proc_file)
                  op: Equal
                  rhs: {(DQ (kpktgend_) (${ VSub_Name thread))}
                  spids: [203]
                )
              ]
              spids: [201]
            )
            (C {(shift)})
            (C {(proc_cmd)} {(${ VSub_Name proc_file)} {(DQ ($ VSub_At '$@'))})
          ]
          spids: [192]
        )
      spids: [186 191]
    )
    (FuncDef
      name: pg_set
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dev)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [239]
                )
              ]
              spids: [237]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:proc_file)
                  op: Equal
                  rhs: {(DQ ($ VSub_Name '$dev'))}
                  spids: [245]
                )
              ]
              spids: [243]
            )
            (C {(shift)})
            (C {(proc_cmd)} {(${ VSub_Name proc_file)} {(DQ ($ VSub_At '$@'))})
          ]
          spids: [234]
        )
      spids: [228 233]
    )
    (FuncDef
      name: proc_cmd
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:result) op:Equal spids:[284])]
              spids: [282]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:proc_file)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [289]
                )
              ]
              spids: [287]
            )
            (C {(shift)})
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:proc_ctrl)
                  op: Equal
                  rhs: {(${ VSub_Name PROC_DIR) (/) ($ VSub_Name '$proc_file')}
                  spids: [302]
                )
              ]
              spids: [300]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (LogicalNot
                              child: 
                                (BoolUnary
                                  op_id: BoolUnary_e
                                  child: {(DQ ($ VSub_Name '$proc_ctrl'))}
                                )
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(err)} {(3)} 
                      {
                        (DQ ('proc file:') ($ VSub_Name '$proc_ctrl') 
                          (' does not exists (dev added to thread?)')
                        )
                      }
                    )
                  ]
                  spids: [16777215 325]
                )
              ]
              else_action: [
                (If
                  arms: [
                    (if_arm
                      cond: [
                        (Sentence
                          child: 
                            (DBracket
                              expr: 
                                (LogicalNot
                                  child: 
                                    (BoolUnary
                                      op_id: BoolUnary_w
                                      child: {(DQ ($ VSub_Name '$proc_ctrl'))}
                                    )
                                )
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (C {(err)} {(4)} 
                          {
                            (DQ ('proc file:') ($ VSub_Name '$proc_ctrl') (' not writable, not root?!'))
                          }
                        )
                      ]
                      spids: [16777215 357]
                    )
                  ]
                  spids: [16777215 371]
                )
              ]
              spids: [339 374]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$DEBUG'))}
                              right: {(DQ (yes))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ ('cmd: ') ($ VSub_At '$@') (' > ') ($ VSub_Name '$proc_ctrl'))})
                  ]
                  spids: [16777215 395]
                )
              ]
              spids: [16777215 408]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {(DQ ($ VSub_Name '$proc_ctrl'))}
                  spids: [421]
                )
              ]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:status)
                  op: Equal
                  rhs: {($ VSub_QMark '$?')}
                  spids: [430]
                )
              ]
              spids: [428]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:result)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(grep)} {(DQ ('Result: OK:'))} {($ VSub_Name '$proc_ctrl')})]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [436 444]
                      )
                    }
                  spids: [435]
                )
              ]
              spids: [435]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$result'))}
                              right: {(DQ )}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [{(grep)} {(DQ ('Result:'))} {($ VSub_Name '$proc_ctrl')}]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[478])]
                    )
                  ]
                  spids: [16777215 467]
                )
              ]
              spids: [16777215 482]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DParen
                          child: 
                            (ArithBinary
                              op_id: Arith_NEqual
                              left: (ArithWord w:{($ VSub_Name '$status')})
                              right: (ArithWord w:{(Lit_Digits 0)})
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(err)} {(5)} 
                      {
                        (DQ ('Write error(') ($ VSub_Name '$status') (') occurred cmd: ') 
                          (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_At '$@') (' > ') ($ VSub_Name '$proc_ctrl') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>)
                        )
                      }
                    )
                  ]
                  spids: [16777215 499]
                )
              ]
              spids: [16777215 518]
            )
          ]
          spids: [279]
        )
      spids: [273 278]
    )
    (FuncDef
      name: pgset
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:result) op:Equal spids:[537])]
              spids: [535]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$DEBUG'))}
                              right: {(DQ (yes))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ ('cmd: ') ($ VSub_Number '$1') (' > ') ($ VSub_Name '$PGDEV'))})
                  ]
                  spids: [16777215 558]
                )
              ]
              spids: [16777215 571]
            )
            (SimpleCommand
              words: [{(echo)} {($ VSub_Number '$1')}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {($ VSub_Name '$PGDEV')}
                  spids: [578]
                )
              ]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:status)
                  op: Equal
                  rhs: {($ VSub_QMark '$?')}
                  spids: [585]
                )
              ]
              spids: [583]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:result)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(cat)} {($ VSub_Name '$PGDEV')})
                                  (C {(fgrep)} {(DQ ('Result: OK:'))})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [591 603]
                      )
                    }
                  spids: [590]
                )
              ]
              spids: [590]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$result'))}
                              right: {(DQ )}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Pipeline
                      children: [
                        (C {(cat)} {($ VSub_Name '$PGDEV')})
                        (C {(fgrep)} {(Result) (Lit_Other ':')})
                      ]
                      negated: F
                    )
                  ]
                  spids: [16777215 622]
                )
              ]
              spids: [16777215 637]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DParen
                          child: 
                            (ArithBinary
                              op_id: Arith_NEqual
                              left: (ArithWord w:{($ VSub_Name '$status')})
                              right: (ArithWord w:{(Lit_Digits 0)})
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(err)} {(5)} 
                      {
                        (DQ ('Write error(') ($ VSub_Name '$status') (') occurred cmd: ') 
                          (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Number '$1') (' > ') ($ VSub_Name '$PGDEV') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>)
                        )
                      }
                    )
                  ]
                  spids: [16777215 654]
                )
              ]
              spids: [16777215 673]
            )
          ]
          spids: [532]
        )
      spids: [526 531]
    )
    (FuncDef
      name: root_check_run_with_sudo
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$EUID'))} {(-ne)} {(0)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {(-x)} {($ VSub_Number '$0')} {(Lit_Other ']')})
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(info)} {(DQ ('Not root, running with sudo'))})
                            (C {(sudo)} {(DQ ($ VSub_Number '$0'))} {(DQ ($ VSub_At '$@'))})
                            (ControlFlow
                              token: <ControlFlow_Exit exit>
                              arg_word: {($ VSub_QMark '$?')}
                            )
                          ]
                          spids: [16777215 728]
                        )
                      ]
                      spids: [16777215 757]
                    )
                    (C {(err)} {(4)} {(DQ ('cannot perform sudo run of ') ($ VSub_Number '$0'))})
                  ]
                  spids: [16777215 714]
                )
              ]
              spids: [16777215 770]
            )
          ]
          spids: [688]
        )
      spids: [682 687]
    )
  ]
)