(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tid)
          op: Equal
          rhs: {(DQ ('dynamic forwarding'))}
          spids: [7]
        )
      ]
      spids: [7]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:FWDPORT)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [(C {(expr)} {($ VSub_Name '$PORT')} {(Lit_Other '+')} {(1)})]
                  )
                left_token: <Left_Backtick '`'>
                spids: [14 22]
              )
            }
          spids: [13]
        )
      ]
      spids: [13]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (AndOr
                  children: [
                    (C {(have_prog)} {(nc)})
                    (Pipeline
                      children: [
                        (SimpleCommand
                          words: [{(nc)} {(-h)}]
                          redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[37])]
                        )
                        (SimpleCommand
                          words: [{(grep)} {(DQ ('proxy address'))}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(/dev/null)}
                              spids: [48]
                            )
                          ]
                        )
                      ]
                      negated: False
                    )
                  ]
                  op_id: Op_DAmp
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:proxycmd)
                  op: Equal
                  rhs: {(DQ ('nc -x 127.0.0.1:') ($ VSub_Name '$FWDPORT') (' -X'))}
                  spids: [55]
                )
              ]
              spids: [55]
            )
          ]
          spids: [-1 52]
        )
        (if_arm
          cond: [(Sentence child:(C {(have_prog)} {(connect)}) terminator:<Op_Semi ';'>)]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:proxycmd)
                  op: Equal
                  rhs: {(DQ ('connect -S 127.0.0.1:') ($ VSub_Name '$FWDPORT') (' -'))}
                  spids: [72]
                )
              ]
              spids: [72]
            )
          ]
          spids: [62 69]
        )
      ]
      else_action: [(C {(echo)} {(DQ ('skipped (no suitable ProxyCommand found)'))}) (C {(exit)} {(0)})]
      spids: [79 93]
    )
    (C {(trace)} {(DQ ('will use ProxyCommand ') ($ VSub_Name '$proxycmd'))})
    (C {(start_sshd)})
    (ForEach
      iter_name: p
      iter_words: [{(${ VSub_Name SSH_PROTOCOLS)}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:n) op:Equal rhs:{(0)} spids:[120])]
              spids: [120]
            )
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:error) op:Equal rhs:{(DQ (1))} spids:[124])]
              spids: [124]
            )
            (C {(trace)} {(DQ ('start dynamic forwarding, fork to background'))})
            (While
              cond: [
                (Sentence
                  child: 
                    (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$error'))} {(-ne)} {(0)} {(-a)} 
                      {(DQ ($ VSub_Name '$n'))} {(-lt)} {(3)} {(Lit_Other ']')}
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (DoGroup
                  children: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:n)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(expr)} {($ VSub_Name '$n')} {(Lit_Other '+')} {(1)})
                                    ]
                                  )
                                left_token: <Left_Backtick '`'>
                                spids: [166 174]
                              )
                            }
                          spids: [165]
                        )
                      ]
                      spids: [165]
                    )
                    (C {(${ VSub_Name SSH)} {(-) ($ VSub_Name '$p')} {(-F)} 
                      {($ VSub_Name '$OBJ') (/ssh_config)} {(-f)} {(-D)} {($ VSub_Name '$FWDPORT')} {(-q)} {(-oExitOnForwardFailure) (Lit_Other '=') (yes)} 
                      {(somehost)} {(exec)} {(sh)} {(-c)} 
                      {(EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
                        (DQ ('echo ') (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) 
                          (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) (' > ') ($ VSub_Name '$OBJ') ('/remote_pid; exec sleep 444')
                        ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">)
                      }
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:error)
                          op: Equal
                          rhs: {($ VSub_QMark '$?')}
                          spids: [225]
                        )
                      ]
                      spids: [225]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$error'))} {(-ne)} {(0)} 
                                  {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(trace)} 
                              {
                                (DQ ('forward failed proto ') ($ VSub_Name '$p') (' attempt ') 
                                  ($ VSub_Name '$n') (' err ') ($ VSub_Name '$error')
                                )
                              }
                            )
                            (C {(sleep)} {($ VSub_Name '$n')})
                          ]
                          spids: [-1 244]
                        )
                      ]
                      spids: [-1 264]
                    )
                  ]
                  spids: [162 267]
                )
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$error'))} {(-ne)} {(0)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(fatal)} {(DQ ('failed to start dynamic forwarding proto ') ($ VSub_Name '$p'))})
                  ]
                  spids: [-1 285]
                )
              ]
              spids: [-1 296]
            )
            (ForEach
              iter_name: s
              iter_words: [{(4)} {(5)}]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (ForEach
                      iter_name: h
                      iter_words: [{(127.0.0.1)} {(localhost)}]
                      do_arg_iter: False
                      body: 
                        (DoGroup
                          children: [
                            (C {(trace)} 
                              {
                                (DQ ('testing ssh protocol ') ($ VSub_Name '$p') (' socks version ') 
                                  ($ VSub_Name '$s') (' host ') ($ VSub_Name '$h')
                                )
                              }
                            )
                            (SimpleCommand
                              words: [
                                {(${ VSub_Name SSH)}
                                {(-F)}
                                {($ VSub_Name '$OBJ') (/ssh_config)}
                                {(-o)}
                                {
                                  (DQ ('ProxyCommand ') (${ VSub_Name proxycmd) (${ VSub_Name s) (' ') 
                                    ($ VSub_Name '$h') (' ') ($ VSub_Name '$PORT')
                                  )
                                }
                                {(somehost)}
                                {(cat)}
                                {($ VSub_Name '$DATA')}
                              ]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: -1
                                  arg_word: {($ VSub_Name '$OBJ') (/ls.copy)}
                                  spids: [375]
                                )
                              ]
                            )
                            (AndOr
                              children: [
                                (C {(test)} {(-f)} {($ VSub_Name '$OBJ') (/ls.copy)})
                                (C {(fail)} {(DQ ('failed copy ') ($ VSub_Name '$DATA'))})
                              ]
                              op_id: Op_DPipe
                            )
                            (AndOr
                              children: [
                                (C {(cmp)} {($ VSub_Name '$DATA')} {($ VSub_Name '$OBJ') (/ls.copy)})
                                (C {(fail)} {(DQ ('corrupted copy of ') ($ VSub_Name '$DATA'))})
                              ]
                              op_id: Op_DPipe
                            )
                          ]
                          spids: [325 415]
                        )
                      spids: [319 323]
                    )
                  ]
                  spids: [311 418]
                )
              spids: [305 309]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {($ VSub_Name '$OBJ') (/remote_pid)} 
                          {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:remote)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [(C {(cat)} {($ VSub_Name '$OBJ') (/remote_pid)})]
                                  )
                                left_token: <Left_Backtick '`'>
                                spids: [438 443]
                              )
                            }
                          spids: [437]
                        )
                      ]
                      spids: [437]
                    )
                    (C {(trace)} {(DQ ('terminate remote shell, pid ') ($ VSub_Name '$remote'))})
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {($ VSub_Name '$remote')} {(-gt)} {(1)} 
                                  {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(C {(kill)} {(-HUP)} {($ VSub_Name '$remote')})]
                          spids: [-1 467]
                        )
                      ]
                      spids: [-1 477]
                    )
                  ]
                  spids: [-1 434]
                )
              ]
              else_action: [(C {(fail)} {(DQ ('no pid file: ') ($ VSub_Name '$OBJ') (/remote_pid))})]
              spids: [480 492]
            )
          ]
          spids: [117 494]
        )
      spids: [111 115]
    )
  ]
)