(command.ShFunction
  name: nicenumber
  body: 
    (command.BraceGroup
      children: [
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:integer)
              op: assign_op.Equal
              rhs: 
                {
                  (command_sub
                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:37)
                    command_list: 
                      (command.CommandList
                        children: [
                          (command.Pipeline
                            children: [
                              (C {(echo)} {($ Id.VSub_Number '$1')})
                              (C {(cut)} {(-d.)} {(-f1)})
                            ]
                            negated: F
                          )
                        ]
                      )
                  )
                }
              spids: [36]
            )
          ]
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:decimal)
              op: assign_op.Equal
              rhs: 
                {
                  (command_sub
                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:56)
                    command_list: 
                      (command.CommandList
                        children: [
                          (command.Pipeline
                            children: [
                              (C {(echo)} {($ Id.VSub_Number '$1')})
                              (C {(cut)} {(-d.)} {(-f2)})
                            ]
                            negated: F
                          )
                        ]
                      )
                  )
                }
              spids: [55]
            )
          ]
        )
        (command.If
          arms: [
            (if_arm
              cond: [
                (command.Sentence
                  child: 
                    (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$decimal'))} 
                      {(Id.KW_Bang '!') (Id.Lit_Equals '=')} {(DQ ($ Id.VSub_Number '$1'))} {(Id.Lit_RBracket ']')}
                    )
                  terminator: (Token id:Id.Op_Semi val:';' span_id:95)
                )
              ]
              action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:result)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (DQ 
                            (braced_var_sub
                              token: (Token id:Id.VSub_Name val:DD span_id:107)
                              suffix_op: 
                                (suffix_op.Unary
                                  op_id: Id.VTest_ColonEquals
                                  arg_word: {(" '.'")}
                                )
                            ) ($ Id.VSub_DollarName '$decimal')
                          )
                        }
                      spids: [104]
                    )
                  ]
                )
              ]
              spids: [79 97]
            )
          ]
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:thousands)
              op: assign_op.Equal
              rhs: {($ Id.VSub_DollarName '$integer')}
              spids: [119]
            )
          ]
        )
        (command.WhileUntil
          keyword: (Token id:Id.KW_While val:while span_id:124)
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$thousands')} {(-gt)} {(999)} 
                  {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:135)
            )
          ]
          body: 
            (command.DoGroup
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:remainder)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (word_part.ArithSub
                            anode: 
                              (arith_expr.Binary
                                op_id: Id.Arith_Percent
                                left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$thousands')})
                                right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1000)})
                              )
                          )
                        }
                      spids: [140]
                    )
                  ]
                )
                (command.WhileUntil
                  keyword: (Token id:Id.KW_While val:while span_id:160)
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} 
                          {
                            (braced_var_sub
                              token: (Token id:Id.VSub_Name val:remainder span_id:166)
                              prefix_op: (Id.VSub_Pound)
                            )
                          } {(-lt)} {(3)} {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:175)
                    )
                  ]
                  body: 
                    (command.DoGroup
                      children: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:remainder)
                              op: assign_op.Equal
                              rhs: {(DQ (0) ($ Id.VSub_DollarName '$remainder'))}
                              spids: [183]
                            )
                          ]
                        )
                      ]
                    )
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:result)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (DQ 
                            (braced_var_sub
                              token: (Token id:Id.VSub_Name val:TD span_id:197)
                              suffix_op: 
                                (suffix_op.Unary
                                  op_id: Id.VTest_ColonEquals
                                  arg_word: {(DQ (','))}
                                )
                            ) (${ Id.VSub_Name remainder) (${ Id.VSub_Name result)
                          )
                        }
                      spids: [194]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:thousands)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (word_part.ArithSub
                            anode: 
                              (arith_expr.Binary
                                op_id: Id.Arith_Slash
                                left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$thousands')})
                                right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1000)})
                              )
                          )
                        }
                      spids: [215]
                    )
                  ]
                )
              ]
            )
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:nicenum)
              op: assign_op.Equal
              rhs: {(DQ (${ Id.VSub_Name thousands) (${ Id.VSub_Name result))}
              spids: [233]
            )
          ]
        )
        (command.If
          arms: [
            (if_arm
              cond: [
                (command.Sentence
                  child: 
                    (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-z)} {($ Id.VSub_Number '$2')} 
                      {(Id.Lit_RBracket ']')}
                    )
                  terminator: (Token id:Id.Op_Semi val:';' span_id:256)
                )
              ]
              action: [(C {(echo)} {($ Id.VSub_DollarName '$nicenum')})]
              spids: [244 258]
            )
          ]
        )
      ]
    )
)