(command.CommandList
  children: [
    (command.ShFunction
      name: register_die_hook
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(x)})
            (command.ForEach
              iter_name: x
              iter_words: [{($ Id.VSub_Star '$*')}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {(has)} {($ Id.VSub_DollarName '$x')} 
                          {($ Id.VSub_DollarName '$EBUILD_DEATH_HOOKS')}
                        )
                        (C {(export)} 
                          {(Id.Lit_VarLike 'EBUILD_DEATH_HOOKS=') 
                            (DQ ($ Id.VSub_DollarName '$EBUILD_DEATH_HOOKS') (' ') 
                              ($ Id.VSub_DollarName '$x')
                            )
                          }
                        )
                      ]
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: register_success_hook
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(x)})
            (command.ForEach
              iter_name: x
              iter_words: [{($ Id.VSub_Star '$*')}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (C {(has)} {($ Id.VSub_DollarName '$x')} 
                          {($ Id.VSub_DollarName '$EBUILD_SUCCESS_HOOKS')}
                        )
                        (C {(export)} 
                          {(Id.Lit_VarLike 'EBUILD_SUCCESS_HOOKS=') 
                            (DQ ($ Id.VSub_DollarName '$EBUILD_SUCCESS_HOOKS') (' ') 
                              ($ Id.VSub_DollarName '$x')
                            )
                          }
                        )
                      ]
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: __strip_duplicate_slashes
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: (bool_expr.Unary op_id:Id.BoolUnary_n child:{($ Id.VSub_Number '$1')})
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:127)
                    )
                  ]
                  action: [
                    (C {(local)} {(Id.Lit_VarLike 'removed=') ($ Id.VSub_Number '$1')})
                    (command.WhileUntil
                      keyword: (Token id:Id.KW_While val:while span_id:138)
                      cond: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_GlobDEqual
                                  left: {(${ Id.VSub_Name removed)}
                                  right: {(Id.Lit_Other '*') (//) (Id.Lit_Other '*')}
                                )
                            )
                          terminator: (Token id:Id.Op_Semi val:';' span_id:154)
                        )
                      ]
                      body: 
                        (command.DoGroup
                          children: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:removed)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (braced_var_sub
                                        token: (Token id:Id.VSub_Name val:removed span_id:161)
                                        suffix_op: 
                                          (suffix_op.PatSub
                                            pat: 
                                              {
                                                (word_part.EscapedLiteral
                                                  token: 
                                                    (Token
                                                      id: Id.Lit_EscapedChar
                                                      val: '\\/'
                                                      span_id: 164
                                                    )
                                                ) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\/' span_id:165))
                                              }
                                            replace: {(Id.Lit_Slash /)}
                                            replace_mode: Id.Lit_Slash
                                          )
                                      )
                                    }
                                  spids: [159]
                                )
                              ]
                            )
                          ]
                        )
                    )
                    (C {(echo)} {(DQ (${ Id.VSub_Name removed))})
                  ]
                  spids: [117 129]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: KV_major
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DBracket
                  expr: (bool_expr.Unary op_id:Id.BoolUnary_z child:{($ Id.VSub_Number '$1')})
                )
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Return val:return span_id:205)
                  arg_word: {(1)}
                )
              ]
            )
            (C {(local)} {(Id.Lit_VarLike 'KV=') ($ Id.VSub_At '$@')})
            (C {(echo)} 
              {
                (DQ 
                  (braced_var_sub
                    token: (Token id:Id.VSub_Name val:KV span_id:221)
                    suffix_op: (suffix_op.Unary op_id:Id.VOp1_DPercent arg_word:{('.*')})
                  )
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: KV_minor
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DBracket
                  expr: (bool_expr.Unary op_id:Id.BoolUnary_z child:{($ Id.VSub_Number '$1')})
                )
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Return val:return span_id:247)
                  arg_word: {(1)}
                )
              ]
            )
            (C {(local)} {(Id.Lit_VarLike 'KV=') ($ Id.VSub_At '$@')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:KV)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: (Token id:Id.VSub_Name val:KV span_id:261)
                        suffix_op: (suffix_op.Unary op_id:Id.VOp1_Pound arg_word:{('*.')})
                      )
                    }
                  spids: [259]
                )
              ]
            )
            (C {(echo)} 
              {
                (DQ 
                  (braced_var_sub
                    token: (Token id:Id.VSub_Name val:KV span_id:271)
                    suffix_op: (suffix_op.Unary op_id:Id.VOp1_DPercent arg_word:{('.*')})
                  )
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: KV_micro
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DBracket
                  expr: (bool_expr.Unary op_id:Id.BoolUnary_z child:{($ Id.VSub_Number '$1')})
                )
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Return val:return span_id:297)
                  arg_word: {(1)}
                )
              ]
            )
            (C {(local)} {(Id.Lit_VarLike 'KV=') ($ Id.VSub_At '$@')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:KV)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: (Token id:Id.VSub_Name val:KV span_id:311)
                        suffix_op: (suffix_op.Unary op_id:Id.VOp1_Pound arg_word:{('*.*.')})
                      )
                    }
                  spids: [309]
                )
              ]
            )
            (C {(echo)} 
              {
                (DQ 
                  (braced_var_sub
                    token: (Token id:Id.VSub_Name val:KV span_id:321)
                    suffix_op: (suffix_op.Unary op_id:Id.VOp1_DPercent arg_word:{('[^[:digit:]]*')})
                  )
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: KV_to_int
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DBracket
                  expr: (bool_expr.Unary op_id:Id.BoolUnary_z child:{($ Id.VSub_Number '$1')})
                )
                (command.ControlFlow
                  token: (Token id:Id.ControlFlow_Return val:return span_id:347)
                  arg_word: {(1)}
                )
              ]
            )
            (C {(local)} 
              {(Id.Lit_VarLike 'KV_MAJOR=') 
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:356)
                  command_list: 
                    (command.CommandList
                      children: [(C {(KV_major)} {(DQ ($ Id.VSub_Number '$1'))})]
                    )
                )
              }
            )
            (C {(local)} 
              {(Id.Lit_VarLike 'KV_MINOR=') 
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:368)
                  command_list: 
                    (command.CommandList
                      children: [(C {(KV_minor)} {(DQ ($ Id.VSub_Number '$1'))})]
                    )
                )
              }
            )
            (C {(local)} 
              {(Id.Lit_VarLike 'KV_MICRO=') 
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:380)
                  command_list: 
                    (command.CommandList
                      children: [(C {(KV_micro)} {(DQ ($ Id.VSub_Number '$1'))})]
                    )
                )
              }
            )
            (C {(local)} 
              {(Id.Lit_VarLike 'KV_int=') 
                (word_part.ArithSub
                  anode: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Plus
                      left: 
                        (arith_expr.Binary
                          op_id: Id.Arith_Plus
                          left: 
                            (arith_expr.Binary
                              op_id: Id.Arith_Star
                              left: 
                                (arith_expr.VarRef
                                  token: (Token id:Id.Lit_ArithVarLike val:KV_MAJOR span_id:394)
                                )
                              right: (arith_expr.ArithWord w:{(Id.Lit_Digits 65536)})
                            )
                          right: 
                            (arith_expr.Binary
                              op_id: Id.Arith_Star
                              left: 
                                (arith_expr.VarRef
                                  token: (Token id:Id.Lit_ArithVarLike val:KV_MINOR span_id:402)
                                )
                              right: (arith_expr.ArithWord w:{(Id.Lit_Digits 256)})
                            )
                        )
                      right: 
                        (arith_expr.VarRef
                          token: (Token id:Id.Lit_ArithVarLike val:KV_MICRO span_id:410)
                        )
                    )
                )
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_ge
                              left: {(${ Id.VSub_Name KV_int)}
                              right: {(131584)}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:439)
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ (${ Id.VSub_Name KV_int))})
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Return val:return span_id:453)
                      arg_word: {(0)}
                    )
                  ]
                  spids: [425 441]
                )
              ]
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Return val:return span_id:462)
              arg_word: {(1)}
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:_RC_GET_KV_CACHE)
          op: assign_op.Equal
          rhs: {(DQ )}
          spids: [469]
        )
      ]
    )
    (command.ShFunction
      name: get_KV
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_z
                      child: {(${ Id.VSub_Name _RC_GET_KV_CACHE)}
                    )
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:_RC_GET_KV_CACHE)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (command_sub
                            left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:495)
                            command_list: (command.CommandList children:[(C {(uname)} {(-r)})])
                          )
                        }
                      spids: [494]
                    )
                  ]
                )
              ]
            )
            (C {(echo)} 
              {
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:505)
                  command_list: 
                    (command.CommandList
                      children: [(C {(KV_to_int)} {(DQ (${ Id.VSub_Name _RC_GET_KV_CACHE))})]
                    )
                )
              }
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Return val:return span_id:517)
              arg_word: {($ Id.VSub_QMark '$?')}
            )
          ]
        )
    )
  ]
)