(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:retries) op:Equal rhs:{(DQ (10))} spids:[7])]
      spids: [7]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:action) op:Equal rhs:{(DQ (lock))} spids:[15])]
      spids: [15]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:nullcmd)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(which)} {(true)})])
                  left_token: <Left_Backtick '`'>
                  spids: [25 29]
                )
              )
            }
          spids: [23]
        )
      ]
      spids: [23]
    )
    (While
      cond: [(Sentence child:(C {(getopts)} {(DQ ('lur:'))} {(opt)}) terminator:<Op_Semi ';'>)]
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {($ VSub_Name '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(l)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:action)
                          op: Equal
                          rhs: {(DQ (lock))}
                          spids: [61]
                        )
                      ]
                      spids: [61]
                    )
                  ]
                  spids: [57 59 66 16777215]
                )
                (case_arm
                  pat_list: [{(u)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:action)
                          op: Equal
                          rhs: {(DQ (unlock))}
                          spids: [73]
                        )
                      ]
                      spids: [73]
                    )
                  ]
                  spids: [69 71 78 16777215]
                )
                (case_arm
                  pat_list: [{(r)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:retries)
                          op: Equal
                          rhs: {(DQ ($ VSub_Name '$OPTARG'))}
                          spids: [85]
                        )
                      ]
                      spids: [85]
                    )
                  ]
                  spids: [81 83 90 16777215]
                )
              ]
              spids: [50 54 93]
            )
          ]
          spids: [47 95]
        )
    )
    (C {(shift)} 
      {
        (ArithSubPart
          anode: 
            (ArithBinary
              op_id: Arith_Minus
              left: (ArithWord w:{($ VSub_Name '$OPTIND')})
              right: (ArithWord w:{(Lit_Digits 1)})
            )
          spids: [99 106]
        )
      }
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-eq)} {(0)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: 
                    {
                      (DQ ('Usage: ') ($ VSub_Number '$0') (' [-l|-u] [-r retries] LOCKFILE\n') 
                        ('Where -l requests a lock (the default), -u requests an unlock, -r X \n') ('specifies a max number of retries before it fails (default = ') ($ VSub_Name '$retries') (').\n')
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: T
                  spids: [131]
                )
                (Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[135])
              ]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 123]
        )
      ]
      spids: [16777215 151]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(-z)} 
                  {
                    (DQ 
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [(C {(which)} {(lockfile)}) (C {(grep)} {(-v)} {(SQ <'^no '>)})]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [165 179]
                      )
                    )
                  } {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ($ VSub_Number '$0') (" failed: 'lockfile' utility not found in PATH."))}
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[196])]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 186]
        )
      ]
      spids: [16777215 204]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$action'))} {(Lit_Other '=')} {(DQ (lock))} 
                  {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (Pipeline
                          children: [
                            (SimpleCommand
                              words: [
                                {(lockfile)}
                                {(-1)}
                                {(-r)}
                                {($ VSub_Name '$retries')}
                                {(DQ ($ VSub_Number '$1'))}
                              ]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: 2
                                  arg_word: {(/dev/null)}
                                  spids: [243]
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {(DQ ($ VSub_Number '$0') (": Failed: Couldn't create lockfile in time"))}
                      ]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[258])]
                    )
                    (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
                  ]
                  spids: [16777215 248]
                )
              ]
              spids: [16777215 267]
            )
          ]
          spids: [16777215 224]
        )
      ]
      else_action: [
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: 
                    (C {(Lit_Other '[')} {(KW_Bang '!')} {(-f)} {(DQ ($ VSub_Number '$1'))} 
                      {(Lit_Other ']')}
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [
                (SimpleCommand
                  words: [
                    {(echo)}
                    {
                      (DQ ($ VSub_Number '$0') (': Warning: lockfile ') ($ VSub_Number '$1') 
                        (" doesn't exist to unlock")
                      )
                    }
                  ]
                  redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[303])]
                )
                (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
              ]
              spids: [16777215 291]
            )
          ]
          spids: [16777215 312]
        )
        (C {(rm)} {(-f)} {(DQ ($ VSub_Number '$1'))})
      ]
      spids: [269 323]
    )
    (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
  ]
)