(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: <Id.Left_DollarParen '$('>
                    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: <Id.Left_DollarParen '$('>
                    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: <Id.Op_Semi _>
                )
              ]
              action: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:result)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (DQ 
                            (braced_var_sub
                              token: <Id.VSub_Name DD>
                              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: <Id.KW_While while>
          cond: [
            (command.Sentence
              child: 
                (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$thousands')} {<-gt>} {<999>} 
                  {<Id.Lit_RBracket ']'>}
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          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: <Id.KW_While while>
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} 
                          {(braced_var_sub token:<Id.VSub_Name remainder> prefix_op:(Id.VSub_Pound))} {<-lt>} {<3>} {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  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: <Id.VSub_Name TD>
                              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: <Id.Op_Semi _>
                )
              ]
              action: [(C {<echo>} {($ Id.VSub_DollarName '$nicenum')})]
              spids: [244 258]
            )
          ]
        )
      ]
    )
)