(CommandList
  children: [
    (FuncDef
      name: err_exit
      body: 
        (BraceGroup
          children: [
            (C {(print)} {(-u2)} {(-n)} {(DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">))})
            (C {(print)} {(-u2)} {(-r)} 
              {(${ VSub_Name Command) (Lit_Other "[") ($ VSub_Number "$1") (Lit_Other "]") 
                (Lit_Other ":")
              } 
              {
                (DQ 
                  (BracedVarSub
                    token: <VSub_At "@">
                    suffix_op: (Slice begin:(ArithWord w:{(Lit_Digits 2)}))
                    spids: [90 94]
                  )
                )
              }
            )
            (C {(let)} {(Lit_VarLike "Errors+=") (1)})
          ]
          spids: [61]
        )
      spids: [57 60]
    )
    (C {(alias)} {(Lit_VarLike "err_exit=") (SQ <"err_exit $LINENO">)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:Command)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Number 0>
                suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)})
                spids: [114 119]
              )
            }
          spids: [113]
        )
      ]
      spids: [113]
    )
    (C {(integer)} {(Lit_VarLike "Errors=") (0)})
    (AndOr
      children: [
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:tmp)
              op: Equal
              rhs: 
                {
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(mktemp)} {(-dt)})])
                    left_token: <Left_CommandSub "$(">
                    spids: [128 132]
                  )
                }
              spids: [127]
            )
          ]
          spids: [127]
        )
        (BraceGroup
          children: [
            (Sentence
              child: (C {(err_exit)} {(mktemp)} {(-dt)} {(failed)})
              terminator: <Op_Semi ";">
            )
            (Sentence child:(C {(exit)} {(1)}) terminator:<Op_Semi ";">)
          ]
          spids: [136]
        )
      ]
      op_id: Op_DPipe
    )
    (C {(trap)} {(DQ ("cd /; rm -rf ") ($ VSub_Name "$tmp"))} {(EXIT)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tmp1)
          op: Equal
          rhs: {($ VSub_Name "$tmp") (/tmp1.csv)}
          spids: [165]
        )
      ]
      spids: [165]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tmp2)
          op: Equal
          rhs: {($ VSub_Name "$tmp") (/tmp2.csv)}
          spids: [169]
        )
      ]
      spids: [169]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Name "$tmp1")} spids:[175])
        (HereDoc
          op_id: Redir_DLessDash
          fd: -1
          body: 
            {("CAT,\"CVE CCODE\",\"NECA OCN\",ST,LATA,AP,\"New InterState\n") 
              ("Orig\",\"New Inter\"\"\"\"State\n") ("Term\",\"New IntraState\n") ("Orig\",\"New IntraState\n") ("Term\"\r\n") 
              ("CLEC,XXXX,AAAA,RB,ABC,comp,\" 0.2 \",\" 0.4 \",\" 0.6 \",\" 0.8 \"\r\n") ("CLEC,YYYY,QQQQ,SX,123,mmmm,\" 0.3 \",\" 0.5 \",\" 0.7 \",\" 0.9 \"\r\n")
            }
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [179]
        )
      ]
    )
    (C {(integer)} {(Lit_VarLike "count=") (0)} {(nfields)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:IFS)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Number 2>
                suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(",")})
                spids: [192 196]
              )
            }
          spids: [191]
        )
      ]
      spids: [191]
    )
    (ForEach
      iter_name: j
      iter_words: [{(1)} {(2)}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (C {(typeset)} {(-a)} {(arr)})
            (While
              cond: [(C {(read)} {(-A)} {(-S)} {(arr)})]
              body: 
                (DoGroup
                  children: [
                    (DParen
                      child: 
                        (BinaryAssign
                          op_id: Arith_Equal
                          left: (LhsName name:nfields)
                          right: 
                            (ArithWord
                              w: 
                                {
                                  (BracedVarSub
                                    token: <VSub_Name arr>
                                    prefix_op: VSub_Pound
                                    bracket_op: (WholeArray op_id:Lit_At)
                                    spids: [233 239]
                                  )
                                }
                            )
                        )
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (DParen
                              child: 
                                (ArithBinary
                                  op_id: Arith_DEqual
                                  left: (UnaryAssign op_id:Arith_DPlus child:(LhsName name:count))
                                  right: (ArithWord w:{(Lit_Digits 1)})
                                )
                            )
                          ]
                          action: [
                            (AndOr
                              children: [
                                (DParen
                                  child: 
                                    (ArithBinary
                                      op_id: Arith_DEqual
                                      left: (ArithVarRef name:nfields)
                                      right: (ArithWord w:{(Lit_Digits 10)})
                                    )
                                )
                                (C {(err_exit)} {(SQ <"first record should contain 10 fields">)})
                              ]
                              op_id: Op_DPipe
                            )
                            (AndOr
                              children: [
                                (DBracket
                                  expr: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobDEqual
                                      left: 
                                        {
                                          (BracedVarSub
                                            token: <VSub_Name arr>
                                            bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 7)}))
                                            spids: [275 280]
                                          )
                                        }
                                      right: 
                                        {(SQ <"New Inter\"\"State"> <Lit_EscapedChar "\\n"> <Term>)}
                                    )
                                )
                                (C {(err_exit)} 
                                  {
                                    (SQ <"7th field of record 1 should contain New Inter\"\"State"> 
                                      <Lit_EscapedChar "\\n"> <Term>
                                    )
                                  }
                                )
                              ]
                              op_id: Op_DPipe
                            )
                          ]
                          spids: [-1 255]
                        )
                      ]
                      spids: [-1 303]
                    )
                    (ForExpr
                      init: 
                        (BinaryAssign
                          op_id: Arith_Equal
                          left: (LhsName name:i)
                          right: (ArithWord w:{(Lit_Digits 0)})
                        )
                      cond: 
                        (ArithBinary
                          op_id: Arith_Less
                          left: (ArithVarRef name:i)
                          right: (ArithVarRef name:nfields)
                        )
                      update: (UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i))
                      body: 
                        (DoGroup
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:delim)
                                  op: Equal
                                  rhs: {($ VSub_Name "$IFS")}
                                  spids: [328]
                                )
                              ]
                              spids: [328]
                            )
                            (If
                              arms: [
                                (if_arm
                                  cond: [
                                    (DParen
                                      child: 
                                        (ArithBinary
                                          op_id: Arith_DEqual
                                          left: (ArithVarRef name:i)
                                          right: 
                                            (ArithBinary
                                              op_id: Arith_Minus
                                              left: (ArithVarRef name:nfields)
                                              right: (ArithWord w:{(Lit_Digits 1)})
                                            )
                                        )
                                    )
                                  ]
                                  action: [
                                    (Assignment
                                      keyword: Assign_None
                                      pairs: [
                                        (assign_pair
                                          lhs: (LhsName name:delim)
                                          op: Equal
                                          rhs: {(SQ <Lit_EscapedChar "\\r"> <Lit_EscapedChar "\\n">)}
                                          spids: [348]
                                        )
                                      ]
                                      spids: [348]
                                    )
                                  ]
                                  spids: [-1 346]
                                )
                              ]
                              spids: [-1 355]
                            )
                            (If
                              arms: [
                                (if_arm
                                  cond: [
                                    (DParen
                                      child: 
                                        (ArithBinary
                                          op_id: Arith_DEqual
                                          left: (ArithVarRef name:i)
                                          right: (ArithWord w:{(Lit_Digits 1)})
                                        )
                                    )
                                  ]
                                  action: [
                                    (C {(printf)} {(DQ ("%#q%s"))} 
                                      {
                                        (DQ 
                                          (BracedVarSub
                                            token: <VSub_Name arr>
                                            bracket_op: (ArrayIndex expr:(ArithVarRef name:i))
                                            spids: [377 382]
                                          )
                                        )
                                      } {(DQ ($ VSub_Name "$delim"))}
                                    )
                                  ]
                                  spids: [-1 368]
                                )
                              ]
                              else_action: [
                                (C {(printf)} {(DQ ("%(csv)q%s"))} 
                                  {
                                    (DQ 
                                      (BracedVarSub
                                        token: <VSub_Name arr>
                                        bracket_op: (ArrayIndex expr:(ArithVarRef name:i))
                                        spids: [399 404]
                                      )
                                    )
                                  } {(DQ ($ VSub_Name "$delim"))}
                                )
                              ]
                              spids: [390 412]
                            )
                          ]
                          spids: [326 415]
                        )
                    )
                  ]
                  spids: [228 418]
                )
              redirects: [
                (Redir
                  op_id: Redir_Less
                  fd: -1
                  arg_word: {($ VSub_Name "$tmp1")}
                  spids: [420]
                )
                (Redir
                  op_id: Redir_Great
                  fd: -1
                  arg_word: {($ VSub_Name "$tmp2")}
                  spids: [424]
                )
              ]
            )
          ]
          spids: [208 428]
        )
      spids: [203 -1]
    )
    (AndOr
      children: [
        (SimpleCommand
          words: [{(diff)} {(DQ ($ VSub_Name "$tmp1"))} {(DQ ($ VSub_Name "$tmp2"))}]
          redirects: [
            (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[440])
            (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[443])
          ]
        )
        (C {(err_exit)} 
          {(DQ ("files ") ($ VSub_Name "$tmp1") (" and ") ($ VSub_Name "$tmp2") (" differ"))}
        )
      ]
      op_id: Op_DPipe
    )
    (C {(exit)} 
      {
        (ArithSubPart
          anode: 
            (TernaryOp
              cond: 
                (ArithBinary
                  op_id: Arith_Less
                  left: (ArithVarRef name:Errors)
                  right: (ArithWord w:{(Lit_Digits 125)})
                )
              true_expr: (ArithVarRef name:Errors)
              false_expr: (ArithWord w:{(Lit_Digits 125)})
            )
          spids: [461 470]
        )
      }
    )
  ]
)