(command.CommandList
  children: [
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (C {(set)} {(-o)} {(errexit)})
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:ROOTFS_URL)
          op: Equal
          rhs: 
            {
              (SQ 
                <
'http://distfiles.gentoo.org/releases/amd64/autobuilds/20180116T214503Z/stage3-amd64-20180116T214503Z.tar.xz'
                >
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:CHROOT_DIR) op:Equal rhs:{(_chroot/gentoo)})]
    )
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:PORTAGE_URL)
          op: Equal
          rhs: {(SQ <'http://distfiles.gentoo.org/snapshots/portage-20180202.tar.xz'>)}
        )
      ]
    )
    (command.FuncDef
      name: download
      body: 
        (command.BraceGroup
          children: [
            (C {(wget)} {(--no-clobber)} {(--directory)} {(_tmp)} {($ VSub_DollarName '$ROOTFS_URL')})
            (C {(wget)} {(--no-clobber)} {(--directory)} {(_tmp)} {($ VSub_DollarName '$PORTAGE_URL')})
          ]
        )
    )
    (command.FuncDef
      name: _extract
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:dest)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: 
                          (suffix_op.StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {($ VSub_DollarName '$CHROOT_DIR')}
                          )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:tarball)
                  op: Equal
                  rhs: 
                    {(_tmp/) 
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(basename)} {($ VSub_DollarName '$ROOTFS_URL')})]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    }
                )
              ]
            )
            (C {(mkdir)} {(-p)} {($ VSub_DollarName '$dest')})
            (command.SimpleCommand
              words: [{(tar)} {(--extract)} {(--xz)} {(--directory)} {($ VSub_DollarName '$dest')}]
              redirects: [
                (redir.Redir
                  op: <Redir_Less '<'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$tarball')}
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: extract
      body: 
        (command.BraceGroup
          children: [
            (command.Sentence
              child: (C {(sudo)} {($ VSub_Number '$0')} {(_extract)} {(DQ ($ VSub_At '$@'))})
              terminator: <Op_Semi ';'>
            )
          ]
        )
    )
    (command.FuncDef
      name: _extract-portage
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:dest)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: 
                          (suffix_op.StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {($ VSub_DollarName '$CHROOT_DIR')}
                          )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:portage_dest)
                  op: Equal
                  rhs: {($ VSub_DollarName '$dest') (/usr)}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:tarball)
                  op: Equal
                  rhs: 
                    {(_tmp/) 
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(basename)} {($ VSub_DollarName '$PORTAGE_URL')})]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    }
                )
              ]
            )
            (command.SimpleCommand
              words: [{(tar)} {(--extract)} {(--xz)} {(--directory)} {($ VSub_DollarName '$portage_dest')}]
              redirects: [
                (redir.Redir
                  op: <Redir_Less '<'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$tarball')}
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: extract-portage
      body: 
        (command.BraceGroup
          children: [
            (command.Sentence
              child: (C {(sudo)} {($ VSub_Number '$0')} {(_extract-portage)} {(DQ ($ VSub_At '$@'))})
              terminator: <Op_Semi ';'>
            )
          ]
        )
    )
    (command.FuncDef
      name: _mount-dirs
      body: 
        (command.BraceGroup
          children: [
            (C {(mount)} {(--rbind)} {(/dev)} {($ VSub_DollarName '$CHROOT_DIR') (/dev)})
            (C {(mount)} {(--make-rslave)} {($ VSub_DollarName '$CHROOT_DIR') (/dev)})
            (C {(mount)} {(-t)} {(proc)} {(/proc)} {($ VSub_DollarName '$CHROOT_DIR') (/proc)})
            (C {(mount)} {(--rbind)} {(/sys)} {($ VSub_DollarName '$CHROOT_DIR') (/sys)})
            (C {(mount)} {(--make-rslave)} {($ VSub_DollarName '$CHROOT_DIR') (/sys)})
            (C {(mount)} {(--rbind)} {(/tmp)} {($ VSub_DollarName '$CHROOT_DIR') (/tmp)})
          ]
        )
    )
    (command.FuncDef
      name: mount-dirs
      body: 
        (command.BraceGroup
          children: [
            (command.Sentence
              child: (C {(sudo)} {($ VSub_Number '$0')} {(_mount-dirs)} {(DQ ($ VSub_At '$@'))})
              terminator: <Op_Semi ';'>
            )
          ]
        )
    )
    (command.FuncDef
      name: _setup-portage
      body: 
        (command.BraceGroup
          children: [
            (C {(cp)} {(-v)} 
              {($ VSub_DollarName '$CHROOT_DIR') (/usr/share/portage/config/make.conf.example)} {($ VSub_DollarName '$CHROOT_DIR') (/etc/portage)}
            )
          ]
        )
    )
    (command.FuncDef
      name: setup-portage
      body: 
        (command.BraceGroup
          children: [
            (command.Sentence
              child: (C {(sudo)} {($ VSub_Number '$0')} {(_setup-portage)} {(DQ ($ VSub_At '$@'))})
              terminator: <Op_Semi ';'>
            )
          ]
        )
    )
    (command.FuncDef
      name: add-oil-build-deps
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:chroot_dir)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: 
                          (suffix_op.StringUnary
                            op_id: VTest_ColonHyphen
                            arg_word: {($ VSub_DollarName '$CHROOT_DIR')}
                          )
                      )
                    }
                )
              ]
            )
            (command.SimpleCommand
              words: [{(sudo)} {(chroot)} {($ VSub_DollarName '$chroot_dir')} {(/bin/sh)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 440
                  stdin_parts: [('apk update\n') ('apk add bash make gcc musl-dev \n')]
                )
              ]
            )
          ]
        )
    )
    (C {(DQ ($ VSub_At '$@'))})
  ]
)