(CommandList
  children: [
    (AndOr
      ops: [Op_DPipe]
      children: [
        (C {(Lit_Other '[')} {(-n)} {(DQ ($ VSub_Name '$PROJROOT'))} {(Lit_Other ']')})
        (BraceGroup
          children: [
            (Sentence
              child: 
                (SimpleCommand
                  words: [{(echo)} {(DQ ('Require environment var PROJROOT'))}]
                  redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                )
              terminator: <Op_Semi ';'>
            )
            (Sentence
              child: (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [16]
        )
      ]
    )
    (SimpleCommand
      words: [{(echo)} {(DQ (' -> Checking Version'))}]
      redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:version_parts)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (Pipeline
                        children: [
                          (C {(grep)} {(-i)} {(version)} {($ VSub_Name '$PROJROOT') (/Changes)})
                          (C {(head)} {(-n)} {(1)})
                          (C {(sed)} {(-ne)} 
                            {
                              (SQ 
                                <
's/Version *\\([0-9]*\\)\\.\\([0-9]*\\)\\.\\([0-9]*\\)[^0-9]*\\([-0-9]*\\)/\\1 \\2 \\3 \\4/p'
                                >
                              )
                            }
                          )
                        ]
                        negated: F
                      )
                    ]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [46 73]
              )
            }
          spids: [45]
        )
      ]
      spids: [45]
    )
    (SimpleCommand
      words: [{(read)} {(major)} {(minor)} {(release)} {(date)}]
      redirects: [
        (HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(END)}
          here_end_span_id: 91
          stdin_parts: [($ VSub_Name '$version_parts') ('\n')]
        )
      ]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:extra) op:Equal rhs:{(SQ )} spids:[92])]
      spids: [92]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$major'))} {(-o)} {(-z)} 
                  {(DQ ($ VSub_Name '$date'))} {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [{(echo)} {(DQ ("Can't get version from ./Changes"))}]
              redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 117]
        )
      ]
      spids: [16777215 134]
    )
    (SimpleCommand
      words: [
        {(echo)}
        {
          (DQ ('    Changes version is ') ($ VSub_Name '$major') (.) ($ VSub_Name '$minor') (.) 
            ($ VSub_Name '$release') (' (') ($ VSub_Name '$date') (')')
          )
        }
      ]
      redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(-d)} {(DQ ($ VSub_Name '$PROJROOT') (/.git))} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(export)} {(Lit_VarLike 'GIT_DIR=') (DQ ($ VSub_Name '$PROJROOT') (/.git))})
            (C {(export)} {(Lit_VarLike 'GIT_WORK_TREE=') (DQ ($ VSub_Name '$PROJROOT'))})
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:head_hash)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (C {(git)} {(log)} {(-n)} {(1)} 
                                {(--format) (Lit_Other '=') (format) (Lit_Other ':') (Lit_Other '%') (h)}
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [189 204]
                      )
                    }
                  spids: [188]
                )
              ]
              spids: [188]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:tag_hash)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (SimpleCommand
                                words: [
                                  {(git)}
                                  {(log)}
                                  {(-n)}
                                  {(1)}
                                  {(--format) (Lit_Other '=') (format) (Lit_Other ':') (Lit_Other '%') 
                                    (h)
                                  }
                                  {(v) ($ VSub_Name '$major') (.) ($ VSub_Name '$minor') (.) 
                                    ($ VSub_Name '$release')
                                  }
                                  {(--)}
                                ]
                                redirects: [(Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [208 235]
                      )
                    }
                  spids: [207]
                )
              ]
              spids: [207]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:git_dirty)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [(C {(git)} {(status)} {(--porcelain)}) (C {(wc)} {(-l)})]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [239 251]
                      )
                    }
                  spids: [238]
                )
              ]
              spids: [238]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$git_dirty'))} {(-gt)} {(0)} {(-o)} 
                          {(DQ ($ VSub_Name '$tag_hash'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ ($ VSub_Name '$head_hash'))} {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [{(echo)} {(DQ ('    Git state differs from ./Changes'))}]
                      redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:extra)
                          op: Equal
                          rhs: {(DQ ($ VSub_Name '$head_hash'))}
                          spids: [295]
                        )
                      ]
                      spids: [295]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:date)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [
                                        (Pipeline
                                          children: [
                                            (C {(git)} {(log)} {(-n)} {(1)} 
                                              {(--format) (Lit_Other '=') (format) (Lit_Other ':') 
                                                (Lit_Other '%') (ci)
                                              }
                                            )
                                            (C {(sed)} {(-e)} {(SQ <'s/ /T/;s/ //'>)})
                                          ]
                                          negated: F
                                        )
                                      ]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [303 328]
                                )
                              )
                            }
                          spids: [301]
                        )
                      ]
                      spids: [301]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$git_dirty'))} {(-gt)} {(0)} 
                                  {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:extra)
                                  op: Equal
                                  rhs: {(DQ ($ VSub_Name '$extra') ('+changes'))}
                                  spids: [350]
                                )
                              ]
                              spids: [350]
                            )
                            (Sentence
                              child: 
                                (Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (LhsName name:date)
                                      op: Equal
                                      rhs: 
                                        {
                                          (CommandSubPart
                                            command_list: 
                                              (CommandList
                                                children: [(C {(date)} {(DQ ('+%Y-%m-%dT%H:%M:%S'))})]
                                              )
                                            left_token: <Left_Backtick '`'>
                                            spids: [358 364]
                                          )
                                        }
                                      spids: [357]
                                    )
                                  ]
                                  spids: [357]
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          spids: [16777215 347]
                        )
                      ]
                      spids: [16777215 368]
                    )
                  ]
                  spids: [16777215 282]
                )
              ]
              spids: [16777215 371]
            )
          ]
          spids: [16777215 168]
        )
      ]
      spids: [16777215 373]
    )
    (Sentence
      child: 
        (SimpleCommand
          words: [
            {(echo)}
            {
              (DQ ('    Version is ') ($ VSub_Name '$major') (' ') ($ VSub_Name '$minor') (' ') 
                ($ VSub_Name '$release') (' ') ($ VSub_Name '$extra') (' ') ($ VSub_Name '$date')
              )
            }
          ]
          redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
        )
      terminator: <Op_Semi ';'>
    )
    (Sentence
      child: 
        (AndOr
          ops: [Op_DAmp Op_DPipe]
          children: [
            (C {(Lit_Other '[')} {(-n)} {(DQ ($ VSub_Name '$extra'))} {(Lit_Other ']')})
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:suffix)
                  op: Equal
                  rhs: {(DQ (-) ($ VSub_Name '$extra'))}
                  spids: [408]
                )
              ]
              spids: [408]
            )
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:suffix) op:Equal rhs:{(SQ )} spids:[416])]
              spids: [416]
            )
          ]
        )
      terminator: <Op_Semi ';'>
    )
    (SimpleCommand
      words: [{(echo)} {(DQ (' -> Regenerating Version.c'))}]
      redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(END)}
          here_end_span_id: 469
          stdin_parts: [
            ('/* Generated by build-version.sh */\n')
            ('\n')
            ('const int CGLVER_Major=')
            ($ VSub_Name '$major')
            (';\n')
            ('const int CGLVER_Minor=')
            ($ VSub_Name '$minor')
            (';\n')
            ('const int CGLVER_Release=')
            ($ VSub_Name '$release')
            (';\n')
            ('const char* CGLVER_Extra=')
            (Right_DoubleQuote '"')
            ($ VSub_Name '$extra')
            (Right_DoubleQuote '"')
            (';\n')
            ('const char* CGLVER_Date=')
            (Right_DoubleQuote '"')
            ($ VSub_Name '$date')
            (Right_DoubleQuote '"')
            (';\n')
            ('const char* CGLVER_String=')
            (Right_DoubleQuote '"')
            ($ VSub_Name '$major')
            (.)
            ($ VSub_Name '$minor')
            (.)
            ($ VSub_Name '$release')
            ($ VSub_Name '$suffix')
            (Right_DoubleQuote '"')
            (';\n')
            ('\n')
          ]
        )
      ]
    )
  ]
)