(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {(DQ ($ VSub_Pound '$#'))} {(-ne)} {(DQ (3))} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Simple
              words: [
                {(echo)}
                {
                  (DQ ('Usage: ') 
                    (word_part.CommandSub
                      left_token: <Left_Backtick '`'>
                      command_list: 
                        (command.CommandList
                          children: [(C {(basename)} {($ VSub_Number '$0')})]
                        )
                    ) (' <image_filename> <partition # (1,2,...)> <mount point>')
                  )
                }
              ]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.Assignment
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:FILE) op:Equal rhs:{($ VSub_Number '$1')})]
    )
    (command.Assignment
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:PART) op:Equal rhs:{($ VSub_Number '$2')})]
    )
    (command.Assignment
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:DEST) op:Equal rhs:{($ VSub_Number '$3')})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [{(parted)} {(--version)}]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(/dev/null)}
                    )
                    (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
                  ]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:UNITS)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (command.Simple
                                    words: [
                                      {(parted)}
                                      {(-s)}
                                      {($ VSub_DollarName '$FILE')}
                                      {(unit)}
                                      {(s)}
                                      {(print)}
                                    ]
                                    redirects: [
                                      (redir.Redir
                                        op: <Redir_Great '2>'>
                                        fd: 2
                                        arg_word: {(/dev/null)}
                                      )
                                    ]
                                  )
                                  (C {(grep)} {(DQ (' ') ($ VSub_DollarName '$PART') (' '))})
                                  (C {(tr)} {(-d)} {(SQ <s>)})
                                  (C {(awk)} {(SQ <'{print $2}'>)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
          ]
        )
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [{(fdisk)} {(-v)}]
                  redirects: [
                    (redir.Redir
                      op: <Redir_Great '>'>
                      fd: 16777215
                      arg_word: {(/dev/null)}
                    )
                    (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
                  ]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:UNITS)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSub
                        left_token: <Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (command.Simple
                                    words: [{(fdisk)} {(-lu)} {($ VSub_DollarName '$FILE')}]
                                    redirects: [
                                      (redir.Redir
                                        op: <Redir_Great '2>'>
                                        fd: 2
                                        arg_word: {(/dev/null)}
                                      )
                                    ]
                                  )
                                  (C {(grep)} 
                                    {
                                      (DQ ($ VSub_DollarName '$FILE') ($ VSub_DollarName '$PART') (' '))
                                    }
                                  )
                                  (C {(tr)} {(-d)} {(SQ <'*'>)})
                                  (C {(awk)} {(SQ <'{print $2}'>)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                )
              ]
            )
          ]
        )
      ]
      else_action: [
        (command.Simple
          words: [{(echo)} {(DQ ("Can't find the fdisk or parted utils. Are you root?"))}]
          redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
        )
        (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
      ]
    )
    (command.Assignment
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:OFFSET)
          op: Equal
          rhs: 
            {
              (word_part.CommandSub
                left_token: <Left_Backtick '`'>
                command_list: 
                  (command.CommandList
                    children: [(C {(expr)} {(512)} {(SQ <'*'>)} {($ VSub_DollarName '$UNITS')})]
                  )
              )
            }
        )
      ]
    )
    (C {(mount)} {(-o)} {(loop) (Lit_Comma ',') (Lit_VarLike 'offset=') ($ VSub_DollarName '$OFFSET')} 
      {($ VSub_DollarName '$FILE')} {($ VSub_DollarName '$DEST')}
    )
  ]
)