(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_LBracket '[')} {($ VSub_Pound '$#')} {(-ne)} {(1)} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 40
                  stdin_parts: [
                    ('Usage: ')
                    ($ VSub_Number '$0')
                    (' <VERSION_NUMBER>\n')
                    ('\n')
                    ('Example:\n')
                    ('  ')
                    (Lit_Other '$')
                    (' ')
                    ($ VSub_Number '$0')
                    (' 3.0.0\n')
                    ('\n')
                    (
'This script will download pre-built protoc binaries from maven repository and\n'
                    )
                    (
'create the Google.Protobuf.Tools package. Well-known type .proto files will also\n'
                    )
                    ('be included.\n')
                  ]
                )
              ]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:VERSION_NUMBER)
          op: Equal
          rhs: {($ VSub_Number '$1')}
        )
      ]
    )
    (C {(declare)} {(-a)} 
      {(Lit_VarLike 'FILE_NAMES=') 
        (sh_array_literal
          left: <Op_LParen '('>
          words: [
            {(windows_x86)}
            {(windows-x86_32.exe)}
            {(windows_x64)}
            {(windows-x86_64.exe)}
            {(macosx_x86)}
            {(osx-x86_32.exe)}
            {(macosx_x64)}
            {(osx-x86_64.exe)}
            {(linux_x86)}
            {(linux-x86_32.exe)}
            {(linux_x64)}
            {(linux-x86_64.exe)}
          ]
        )
      }
    )
    (C {(KW_Set set)} {(-e)})
    (C {(mkdir)} {(-p)} {(protoc)})
    (command.ForExpr
      init: 
        (arith_expr.BinaryAssign
          op_id: Arith_Equal
          left: (sh_lhs_expr.Name name:i)
          right: (arith_expr.ArithWord w:{(Lit_Digits 0)})
        )
      cond: 
        (arith_expr.Binary
          op_id: Arith_Less
          left: (arith_expr.VarRef token:<Lit_ArithVarLike i>)
          right: 
            (arith_expr.ArithWord
              w: 
                {
                  (braced_var_sub
                    token: <VSub_Name FILE_NAMES>
                    prefix_op: VSub_Pound
                    bracket_op: (bracket_op.WholeArray op_id:Lit_At)
                  )
                }
            )
        )
      update: 
        (arith_expr.BinaryAssign
          op_id: Arith_PlusEqual
          left: (sh_lhs_expr.Name name:i)
          right: (arith_expr.ArithWord w:{(Lit_Digits 2)})
        )
      body: 
        (command.DoGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:DIR_NAME)
                  op: Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <VSub_Name FILE_NAMES>
                        bracket_op: 
                          (bracket_op.ArrayIndex
                            expr: (arith_expr.ArithWord w:{($ VSub_DollarName '$i')})
                          )
                      )
                    }
                )
              ]
            )
            (C {(mkdir)} {(-p)} {(protoc/) ($ VSub_DollarName '$DIR_NAME')})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_LBracket '[')} 
                          {
                            (braced_var_sub
                              token: <VSub_Name DIR_NAME>
                              suffix_op: 
                                (suffix_op.Slice
                                  begin: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                  length: (arith_expr.ArithWord w:{(Lit_Digits 3)})
                                )
                            )
                          } {(Lit_Equals '=')} {(DQ (win))} {(Lit_RBracket ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:TARGET_BINARY)
                          op: Equal
                          rhs: {(DQ (protoc.exe))}
                        )
                      ]
                    )
                  ]
                )
              ]
              else_action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:TARGET_BINARY)
                      op: Equal
                      rhs: {(DQ (protoc))}
                    )
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BINARY_NAME)
                  op: Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <VSub_Name FILE_NAMES>
                        bracket_op: 
                          (bracket_op.ArrayIndex
                            expr: 
                              (arith_expr.ArithWord
                                w: 
                                  {
                                    (word_part.ArithSub
                                      anode: 
                                        (arith_expr.Binary
                                          op_id: Arith_Plus
                                          left: (arith_expr.ArithWord w:{($ VSub_DollarName '$i')})
                                          right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                        )
                                    )
                                  }
                              )
                          )
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:BINARY_URL)
                  op: Equal
                  rhs: 
                    {(http) (Lit_Other ':') (//repo1.maven.org/maven2/com/google/protobuf/protoc/) 
                      (${ VSub_Name VERSION_NUMBER) (/protoc-) (${ VSub_Name VERSION_NUMBER) (-) (${ VSub_Name BINARY_NAME)
                    }
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [
                                {(wget)}
                                {(${ VSub_Name BINARY_URL)}
                                {(-O)}
                                {(protoc/) ($ VSub_DollarName '$DIR_NAME') (/) 
                                  ($ VSub_DollarName '$TARGET_BINARY')
                                }
                              ]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_AndGreat '&>'>
                                  fd: 16777215
                                  arg_word: {(/dev/null)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [{(echo)} {(DQ ('[ERROR] Failed to download ') (${ VSub_Name BINARY_URL))}]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (command.Simple
                      words: [
                        {(echo)}
                        {
                          (DQ ('[ERROR] Skipped ') ($ VSub_DollarName '$protoc') (-) 
                            (${ VSub_Name VERSION_NAME) (-) (${ VSub_Name DIR_NAME)
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (command.ControlFlow token:<ControlFlow_Continue continue>)
                  ]
                )
              ]
            )
          ]
        )
    )
    (C {(nuget)} {(pack)} {(Google.Protobuf.Tools.nuspec)})
  ]
)