(command.CommandList
  children: [
    (command.ShFunction
      name: cleanExit
      body: 
        (command.BraceGroup
          children: [
            (C {(rm)} {(-f)} {(${ Id.VSub_Name choices)})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:112)
              arg_word: 
                {
                  (braced_var_sub
                    token: (Token id:Id.VSub_Number val:1 span_id:115)
                    suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(0)})
                  )
                }
            )
          ]
        )
    )
    (C {(trap)} {(SQ (Token id:Id.Lit_Chars val:'cleanExit 1' span_id:126))} {(1)} {(2)} {(3)} {(5)} {(15)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:choices)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: (Token id:Id.VSub_Name val:TMP span_id:145)
                suffix_op: 
                  (suffix_op.Unary
                    op_id: Id.VTest_ColonHyphen
                    arg_word: {(Id.Lit_Slash /) (tmp)}
                  )
              ) (/_spkrtest_choices.) ($ Id.VSub_Dollar '$$')
            }
          spids: [143]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:speaker)
          op: assign_op.Equal
          rhs: {(/dev/speaker)}
          spids: [153]
        )
      ]
    )
    (C {(test)} {(-w)} {(${ Id.VSub_Name speaker)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (C {(Id.Lit_LBracket '[')} {($ Id.VSub_QMark '$?')} {(-ne)} {(0)} {(Id.Lit_RBracket ']')})
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ('You have no write access to ') ($ Id.VSub_DollarName '$speaker') 
                  (' or the speaker device is')
                )
              }
            )
            (C {(echo)} {(DQ ('not enabled in kernel. Cannot play any melody! See spkr(4).'))})
            (C {(sleep)} {(2)})
            (C {(cleanExit)} {(1)})
          ]
          spids: [165 177]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [
            {(/usr/bin/dialog)}
            {(--title)}
            {(DQ ('Speaker test'))}
            {(--checklist)}
            {(DQ ('Please select the melodies you wish to play (space for select)'))}
            {(0)}
            {(0)}
            {(0)}
            {(reveille)}
            {(DQ (Reveille))}
            {(OFF)}
            {(contact)}
            {(DQ ('Contact theme from Close Encounters'))}
            {(OFF)}
            {(dance)}
            {(DQ ('Lord of the Dance (aka Simple Gifts)'))}
            {(OFF)}
            {(loony)}
            {(DQ ('Loony Toons theme'))}
            {(OFF)}
            {(sinister)}
            {(DQ ("Standard villain's entrance music"))}
            {(OFF)}
            {(rightstuff)}
            {(DQ ("A trope from 'The Right Stuff' score by Bill Conti"))}
            {(OFF)}
            {(toccata)}
            {(DQ ("Opening bars of Bach's Toccata and Fugue in D Minor"))}
            {(OFF)}
            {(startrek)}
            {(DQ ('Opening bars of the theme from Star Trek Classic'))}
            {(OFF)}
          ]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'2>' span_id:314)
              fd: 2
              arg_word: {(${ Id.VSub_Name choices)}
            )
          ]
        )
        (C {(cleanExit)} {(0)})
      ]
    )
    (C {(echo)} {(DQ )})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tunes)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: (Token id:Id.Left_Backtick val:'`' span_id:334)
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.Pipeline
                          children: [
                            (C {(cat)} {(${ Id.VSub_Name choices)})
                            (C {(tr)} {(-d)} {(SQ (Token id:Id.Lit_Chars val:'"' span_id:352))})
                          ]
                          negated: F
                        )
                      ]
                    )
                )
              )
            }
          spids: [332]
        )
      ]
    )
    (command.ForEach
      iter_name: tune
      iter_words: [
        {
          (braced_var_sub
            token: (Token id:Id.VSub_Name val:tunes span_id:364)
            suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(DEFAULT)})
          )
        }
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: 
                {
                  (braced_var_sub
                    token: (Token id:Id.VSub_Name val:tune span_id:375)
                    suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(NULL)})
                  )
                }
              arms: [
                (case_arm
                  pat_list: [{(DEFAULT)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ('(default melody)'))}
                          spids: [387]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: {(DQ (ec))}
                          spids: [393]
                        )
                      ]
                    )
                  ]
                  spids: [383 384 399 -1]
                )
                (case_arm
                  pat_list: [{(reveille)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ (Reveille))}
                          spids: [406]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (
't255l8c.f.afc~c.f.afc~c.f.afc.f.a..f.~c.f.afc~c.f.afc~c.f.afc~c.f..'
                                )
                              )
                            }
                          spids: [412]
                        )
                      ]
                    )
                  ]
                  spids: [402 403 418 -1]
                )
                (case_arm
                  pat_list: [{(contact)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ('Contact theme from Close Encounters'))}
                          spids: [425]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: {(DQ ('<cd<a#~<a#>f'))}
                          spids: [431]
                        )
                      ]
                    )
                  ]
                  spids: [421 422 437 -1]
                )
                (case_arm
                  pat_list: [{(dance)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ('Lord of the Dance (aka Simple Gifts)'))}
                          spids: [444]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (
't240<cfcfgagaa#b#>dc<a#a.~fg.gaa#.agagegc.~cfcfgagaa#b#>dc<a#a.~fg.gga.agfgfgf.'
                                )
                              )
                            }
                          spids: [450]
                        )
                      ]
                    )
                  ]
                  spids: [440 441 456 -1]
                )
                (case_arm
                  pat_list: [{(loony)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ('Loony Toons theme'))}
                          spids: [463]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: {(DQ ('t255cf8f8edc<a>~cf8f8edd#e~ce8cdce8cd.<a>c8c8c#def8af8'))}
                          spids: [469]
                        )
                      ]
                    )
                  ]
                  spids: [459 460 475 -1]
                )
                (case_arm
                  pat_list: [{(sinister)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ("standard villain's entrance music"))}
                          spids: [482]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: {(DQ ('mst200o2ola.l8bc.~a.~>l2d#'))}
                          spids: [488]
                        )
                      ]
                    )
                  ]
                  spids: [478 479 494 -1]
                )
                (case_arm
                  pat_list: [{(rightstuff)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ("a trope from 'The Right Stuff' score by Bill Conti"))}
                          spids: [501]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: {(DQ ('olcega.a8f>cd2bgc.c8dee2'))}
                          spids: [507]
                        )
                      ]
                    )
                  ]
                  spids: [497 498 513 -1]
                )
                (case_arm
                  pat_list: [{(toccata)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ("opening bars of Bach's Toccata and Fugue in D Minor"))}
                          spids: [520]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: {(DQ ('msl16oldcd4mll8pcb-agf+4.g4p4<msl16dcd4mll8pa.a+f+4p16g4'))}
                          spids: [526]
                        )
                      ]
                    )
                  ]
                  spids: [516 517 532 -1]
                )
                (case_arm
                  pat_list: [{(startrek)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:title)
                          op: assign_op.Equal
                          rhs: {(DQ ('opening bars of the theme from Star Trek Classic'))}
                          spids: [539]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:music)
                          op: assign_op.Equal
                          rhs: {(DQ ('l2b.f+.p16a.c+.p l4mn<b.>e8a2mspg+e8c+f+8b2'))}
                          spids: [545]
                        )
                      ]
                    )
                  ]
                  spids: [535 536 551 -1]
                )
              ]
            )
            (C {(echo)} {(DQ ('Title: ') (${ Id.VSub_Name title))})
            (command.Simple
              words: [{(echo)} {(${ Id.VSub_Name music)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:573)
                  fd: -1
                  arg_word: {(${ Id.VSub_Name speaker)}
                )
              ]
            )
            (C {(sleep)} {(1)})
          ]
        )
    )
    (C {(cleanExit)} {(0)})
  ]
)