(command.CommandList
  children: [
    (C {<set>} {<-o>} {<nounset>})
    (C {<set>} {<-o>} {<pipefail>})
    (C {<set>} {<-o>} {<errexit>})
    (C {<readonly>} 
      {<Id.Lit_VarLike 'ROOTFS_URL='> 
        (SQ 
          <
'http://distfiles.gentoo.org/releases/amd64/autobuilds/20180116T214503Z/stage3-amd64-20180116T214503Z.tar.xz'
          >
        )
      }
    )
    (C {<readonly>} {<Id.Lit_VarLike 'CHROOT_DIR='> <'_chroot/gentoo'>})
    (C {<readonly>} 
      {<Id.Lit_VarLike 'PORTAGE_URL='> 
        (SQ <'http://distfiles.gentoo.org/snapshots/portage-20180202.tar.xz'>)
      }
    )
    (command.ShFunction
      name: download
      body: 
        (BraceGroup
          children: [
            (C {<wget>} {<--no-clobber>} {<--directory>} {<_tmp>} {($ Id.VSub_DollarName '$ROOTFS_URL')})
            (C {<wget>} {<--no-clobber>} {<--directory>} {<_tmp>} {($ Id.VSub_DollarName '$PORTAGE_URL')})
          ]
        )
    )
    (command.ShFunction
      name: _extract
      body: 
        (BraceGroup
          children: [
            (C {<local>} 
              {<Id.Lit_VarLike 'dest='> 
                (braced_var_sub
                  token: <Id.VSub_Number 1>
                  suffix_op: 
                    (suffix_op.Unary
                      tok: <Id.VTest_ColonHyphen ':-'>
                      arg_word: {($ Id.VSub_DollarName '$CHROOT_DIR')}
                    )
                )
              }
            )
            (C {<local>} 
              {<Id.Lit_VarLike 'tarball='> <'_tmp/'> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<basename>} {($ Id.VSub_DollarName '$ROOTFS_URL')})
                )
              }
            )
            (C {<mkdir>} {<-p>} {($ Id.VSub_DollarName '$dest')})
            (command.Simple
              words: [{<tar>} {<--extract>} {<--xz>} {<--directory>} {($ Id.VSub_DollarName '$dest')}]
              redirects: [
                (redir
                  op: <Id.Redir_Less '<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: {($ Id.VSub_DollarName '$tarball')}
                )
              ]
              do_fork: T
            )
          ]
        )
    )
    (command.ShFunction
      name: extract
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: (C {<sudo>} {($ Id.VSub_Number '$0')} {<_extract>} {(DQ ($ Id.VSub_At '$@'))})
              terminator: <Id.Op_Semi _>
            )
          ]
        )
    )
    (command.ShFunction
      name: _extract-portage
      body: 
        (BraceGroup
          children: [
            (C {<local>} 
              {<Id.Lit_VarLike 'dest='> 
                (braced_var_sub
                  token: <Id.VSub_Number 1>
                  suffix_op: 
                    (suffix_op.Unary
                      tok: <Id.VTest_ColonHyphen ':-'>
                      arg_word: {($ Id.VSub_DollarName '$CHROOT_DIR')}
                    )
                )
              }
            )
            (C {<local>} {<Id.Lit_VarLike 'portage_dest='> ($ Id.VSub_DollarName '$dest') <'/usr'>})
            (C {<local>} 
              {<Id.Lit_VarLike 'tarball='> <'_tmp/'> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: (C {<basename>} {($ Id.VSub_DollarName '$PORTAGE_URL')})
                )
              }
            )
            (command.Simple
              words: [
                {<tar>}
                {<--extract>}
                {<--xz>}
                {<--directory>}
                {($ Id.VSub_DollarName '$portage_dest')}
              ]
              redirects: [
                (redir
                  op: <Id.Redir_Less '<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: {($ Id.VSub_DollarName '$tarball')}
                )
              ]
              do_fork: T
            )
          ]
        )
    )
    (command.ShFunction
      name: extract-portage
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: 
                (C {<sudo>} {($ Id.VSub_Number '$0')} {<_extract-portage>} {(DQ ($ Id.VSub_At '$@'))})
              terminator: <Id.Op_Semi _>
            )
          ]
        )
    )
    (command.ShFunction
      name: _mount-dirs
      body: 
        (BraceGroup
          children: [
            (C {<mount>} {<--rbind>} {<'/dev'>} {($ Id.VSub_DollarName '$CHROOT_DIR') <'/dev'>})
            (C {<mount>} {<--make-rslave>} {($ Id.VSub_DollarName '$CHROOT_DIR') <'/dev'>})
            (C {<mount>} {<-t>} {<Id.KW_Proc proc>} {<'/proc'>} 
              {($ Id.VSub_DollarName '$CHROOT_DIR') <'/proc'>}
            )
            (C {<mount>} {<--rbind>} {<'/sys'>} {($ Id.VSub_DollarName '$CHROOT_DIR') <'/sys'>})
            (C {<mount>} {<--make-rslave>} {($ Id.VSub_DollarName '$CHROOT_DIR') <'/sys'>})
            (C {<mount>} {<--rbind>} {<'/tmp'>} {($ Id.VSub_DollarName '$CHROOT_DIR') <'/tmp'>})
          ]
        )
    )
    (command.ShFunction
      name: mount-dirs
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: (C {<sudo>} {($ Id.VSub_Number '$0')} {<_mount-dirs>} {(DQ ($ Id.VSub_At '$@'))})
              terminator: <Id.Op_Semi _>
            )
          ]
        )
    )
    (command.ShFunction
      name: _setup-portage
      body: 
        (BraceGroup
          children: [
            (C {<cp>} {<-v>} 
              {($ Id.VSub_DollarName '$CHROOT_DIR') <'/usr/share/portage/config/make.conf.example'>} {($ Id.VSub_DollarName '$CHROOT_DIR') <'/etc/portage'>}
            )
          ]
        )
    )
    (command.ShFunction
      name: setup-portage
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: 
                (C {<sudo>} {($ Id.VSub_Number '$0')} {<_setup-portage>} {(DQ ($ Id.VSub_At '$@'))})
              terminator: <Id.Op_Semi _>
            )
          ]
        )
    )
    (command.ShFunction
      name: add-oil-build-deps
      body: 
        (BraceGroup
          children: [
            (C {<local>} 
              {<Id.Lit_VarLike 'chroot_dir='> 
                (braced_var_sub
                  token: <Id.VSub_Number 1>
                  suffix_op: 
                    (suffix_op.Unary
                      tok: <Id.VTest_ColonHyphen ':-'>
                      arg_word: {($ Id.VSub_DollarName '$CHROOT_DIR')}
                    )
                )
              }
            )
            (command.Simple
              words: [{<sudo>} {<chroot>} {($ Id.VSub_DollarName '$chroot_dir')} {<'/bin/sh'>}]
              redirects: [
                (redir
                  op: <Id.Redir_DLess '<<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: 
                    (redir_param.HereDoc
                      here_begin: {<EOF>}
                      here_end_span_id: 440
                      stdin_parts: [<'apk update\n'> <'apk add bash make gcc musl-dev \n'>]
                    )
                )
              ]
              do_fork: T
            )
          ]
        )
    )
    (C {(DQ ($ Id.VSub_At '$@'))})
  ]
)