(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:TMP)
          op: Equal
          rhs: 
            {
              (word_part.BracedVarSub
                token: <VSub_Name TMP>
                suffix_op: 
                  (suffix_op.StringUnary
                    op_id: VTest_ColonHyphen
                    arg_word: {(Lit_Slash /) (tmp)}
                  )
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:TMP) op:Equal)]
    )
    (command.FuncDef
      name: log
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_Number '$0') (': ') ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '1>&'> fd:1 arg_word:{(2)})]
            )
          ]
        )
    )
    (command.FuncDef
      name: die
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_Number '$0') (' ERROR: ') ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '1>&'> fd:1 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.FuncDef
      name: show_help
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(cat)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 127
                  stdin_parts: [
                    ('Usage: ./configure [OPTION]\n')
                    ('\n')
                    ('Detects system settings before a build of Oil.\n')
                    ('\n')
                    ('  --prefix            Prefix for the bin/ directory [/usr/local]\n')
                    ('  --with-readline     Fail unless readline is available.\n')
                    ("  --without-readline  Don't compile with readline, even if it's available.\n")
                    ("\t\t      The shell won't have any interactive features.\n")
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:FLAG_prefix) op:Equal rhs:{(SQ </usr/local>)})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:FLAG_with_readline) op:Equal rhs:{(SQ )})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:FLAG_without_readline) op:Equal rhs:{(SQ )})]
    )
    (command.WhileUntil
      keyword: <KW_While while>
      cond: [(command.Sentence child:(C {(true)}) terminator:<Op_Semi ';'>)]
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {(DQ ($ VSub_Number '$1'))}
              arms: [
                (case_arm
                  pat_list: [{(SQ )}]
                  action: [(command.ControlFlow token:<ControlFlow_Break break>)]
                )
                (case_arm
                  pat_list: [{(--help)}]
                  action: [
                    (C {(show_help)})
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(0)}
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(--with-readline)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:FLAG_with_readline)
                          op: Equal
                          rhs: {(1)}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(--without-readline)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:FLAG_without_readline)
                          op: Equal
                          rhs: {(1)}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(--prefix) (Lit_Other '=') (Lit_Other '*')}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:FLAG_prefix)
                          op: Equal
                          rhs: 
                            {
                              (word_part.CommandSubPart
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {(expr)} {(DQ ($ VSub_Number '$1'))} {(Lit_Other ':')} 
                                        {(SQ <'--prefix=\\(.*\\)'>)}
                                      )
                                    ]
                                  )
                                left_token: <Left_DollarParen '$('>
                              )
                            }
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(--prefix)}]
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: (C {(test)} {($ VSub_Pound '$#')} {(-eq)} {(1)})
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(C {(die)} {(DQ ('--prefix requires an argument'))})]
                        )
                      ]
                    )
                    (C {(shift)})
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:FLAG_prefix)
                          op: Equal
                          rhs: {($ VSub_Number '$1')}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [(C {(die)} {(DQ ("Invalid argument '") ($ VSub_Number '$1') ("'"))})]
                )
              ]
            )
            (C {(shift)})
          ]
        )
    )
    (command.FuncDef
      name: cc_quiet
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(cc)} {(DQ ($ VSub_At '$@'))} {(-o)} {(/dev/null)}]
              redirects: [
                (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})
                (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: cc_or_die
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (command.SimpleCommand
                              words: [{(cc)} {(DQ ($ VSub_At '$@'))}]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {($ VSub_DollarName '$TMP') (/cc.log)}
                                )
                                (redir.Redir
                                  op: <Redir_GreatAnd '2>&'>
                                  fd: 2
                                  arg_word: {(1)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(log)} {(DQ ("Error running 'cc ") ($ VSub_At '$@') ("':"))})
                    (C {(cat)} {($ VSub_DollarName '$TMP') (/cc.log)})
                    (C {(die)} {(DQ ('Fatal compile error running feature test'))})
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: cc_statement
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:pp_var)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:prog)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$2'))}
                )
              ]
            )
            (command.SimpleCommand
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$TMP') (/cc_statement.c)}
                )
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 456
                  stdin_parts: [('int main() {\n') ('  ') ($ VSub_DollarName '$prog') ('\n') ('}\n')]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(cc_quiet)} {($ VSub_DollarName '$TMP') (/cc_statement.c)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ ('#define ') ($ VSub_DollarName '$pp_var') (' 1'))})
                    (command.ControlFlow
                      token: <ControlFlow_Return return>
                      arg_word: {(0)}
                    )
                  ]
                )
              ]
              else_action: [(command.ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})]
            )
          ]
        )
    )
    (command.FuncDef
      name: detect_readline
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(cc_quiet)} {(build/detect-readline.c)} {(-l)} {(readline)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(SQ <'HAVE_READLINE=1'>)})]
                )
              ]
              else_action: [
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (C {(test)} {(DQ ($ VSub_DollarName '$FLAG_with_readline'))} 
                              {(Lit_Other '=')} {(1)}
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (C {(die)} 
                          {(SQ <'readline was not detected on the system (--with-readline passed).'>)}
                        )
                      ]
                    )
                  ]
                )
                (C {(echo)} {(SQ <'HAVE_READLINE='>)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: detect_and_echo_vars
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(test)} {(DQ ($ VSub_DollarName '$FLAG_without_readline'))} 
                          {(Lit_Other '=')} {(1)}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(SQ <'HAVE_READLINE='>)})]
                )
              ]
              else_action: [(C {(detect_readline)})]
            )
            (C {(echo)} {(DQ ('PREFIX=') ($ VSub_DollarName '$FLAG_prefix'))})
          ]
        )
    )
    (command.FuncDef
      name: cc_print_expr
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:c_expr)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (command.SimpleCommand
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$TMP') (/print_expr.c)}
                )
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 661
                  stdin_parts: [
                    ('#include <stdio.h>\n')
                    ('#include <sys/types.h>  /* size_t, pid_t */\n')
                    ('\n')
                    ('int main() {\n')
                    ('  printf(')
                    (Right_DoubleQuote '"')
                    ('%lu')
                    (Right_DoubleQuote '"')
                    (', ')
                    ($ VSub_DollarName '$c_expr')
                    (');\n')
                    ('}\n')
                  ]
                )
              ]
            )
            (C {(cc_or_die)} {(-o)} {($ VSub_DollarName '$TMP') (/print_expr)} 
              {($ VSub_DollarName '$TMP') (/print_expr.c)}
            )
            (command.SimpleCommand
              words: [{($ VSub_DollarName '$TMP') (/print_expr)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$TMP') (/print_expr.out)}
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: check_sizeof
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:pp_var)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:c_type)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$2'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:min_bytes)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$3'))}
                )
              ]
            )
            (C {(cc_print_expr)} {(DQ ('sizeof(') ($ VSub_DollarName '$c_type') (')'))})
            (command.Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:actual_bytes) op:Equal)]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:actual_bytes)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(cat)} {($ VSub_DollarName '$TMP') (/print_expr.out)})]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    }
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Op_DAmp]
                          children: [
                            (C {(test)} {(-n)} {(DQ ($ VSub_DollarName '$min_bytes'))})
                            (C {(test)} {(DQ ($ VSub_DollarName '$actual_bytes'))} {(-lt)} 
                              {(DQ ($ VSub_DollarName '$min_bytes'))}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(die)} 
                      {
                        (DQ ('sizeof(') ($ VSub_DollarName '$c_type') (') should be at least ') 
                          ($ VSub_DollarName '$min_bytes') ('; got ') ($ VSub_DollarName '$actual_bytes')
                        )
                      }
                    )
                  ]
                )
              ]
            )
            (C {(echo)} 
              {
                (DQ ('#define ') ($ VSub_DollarName '$pp_var') (' ') ($ VSub_DollarName '$actual_bytes'))
              }
            )
          ]
        )
    )
    (command.FuncDef
      name: detect_c_language
      body: 
        (command.BraceGroup
          children: [
            (C {(check_sizeof)} {(SIZEOF_INT)} {(SQ <int>)} {(4)})
            (C {(check_sizeof)} {(SIZEOF_LONG)} {(SQ <long>)} {(4)})
            (C {(check_sizeof)} {(SIZEOF_VOID_P)} {(SQ <'void *'>)} {(4)})
            (C {(check_sizeof)} {(SIZEOF_SHORT)} {(SQ <short>)} {(2)})
            (C {(check_sizeof)} {(SIZEOF_FLOAT)} {(SQ <float>)} {(4)})
            (C {(check_sizeof)} {(SIZEOF_DOUBLE)} {(SQ <double>)} {(8)})
            (C {(check_sizeof)} {(SIZEOF_SIZE_T)} {(SQ <size_t>)} {(4)})
            (C {(check_sizeof)} {(SIZEOF_FPOS_T)} {(SQ <fpos_t>)} {(4)})
            (C {(check_sizeof)} {(SIZEOF_PID_T)} {(SQ <pid_t>)} {(4)})
            (C {(check_sizeof)} {(SIZEOF_OFF_T)} {(SQ <off_t>)} {(SQ )})
            (C {(check_sizeof)} {(SIZEOF_TIME_T)} {(SQ <time_t>)} {(SQ )})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(cc_statement)} {(HAVE_LONG_LONG)} {(SQ <'long long x; x = (long long)0;'>)})
                  ]
                  action: [(C {(check_sizeof)} {(SIZEOF_LONG_LONG)} {(SQ <'long long'>)} {(8)})]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(cc_statement)} {(HAVE_LONG_DOUBLE)} 
                      {(SQ <'long double x; x = (long double)0;'>)}
                    )
                  ]
                  action: [(C {(check_sizeof)} {(SIZEOF_LONG_DOUBLE)} {(SQ <'long double'>)} {(8)})]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(cc_statement)} {(HAVE_C99_BOOL)} {(SQ <'_Bool x; x = (_Bool)0;'>)})]
                  action: [(C {(check_sizeof)} {(SIZEOF__BOOL)} {(SQ <_Bool>)} {(1)})]
                )
              ]
            )
            (C {(echo)} {(SQ <'#define HAVE_WCHAR_H 1'>)})
            (C {(echo)} {(SQ <'#define SIZEOF_WCHAR_T 4'>)})
            (command.SimpleCommand
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$TMP') (/detect_va_list.c)}
                )
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 1144
                  stdin_parts: [
                    ('#include <stdarg.h>  /* C89 */\n')
                    ('int main() {\n')
                    ('  va_list list1, list2;\n')
                    ('  list1 = list2;\n')
                    ('}\n')
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(cc_quiet)} {($ VSub_DollarName '$TMP') (/detect_va_list.c)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(SQ )})]
                )
              ]
              else_action: [(C {(echo)} {(SQ <'#define VA_LIST_IS_ARRAY 1'>)})]
            )
          ]
        )
    )
    (command.FuncDef
      name: main
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [(C {(cc_quiet)} {(build/detect-cc.c)})]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(die)} {(DQ ("Couldn't compile a basic C program (cc not installed?)"))})]
                )
              ]
            )
            (C {(mkdir)} {(-p)} {(_build)})
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:sh_out)
                  op: Equal
                  rhs: {(_build/detected-config.sh)}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:c_out)
                  op: Equal
                  rhs: {(_build/detected-config.h)}
                )
              ]
            )
            (command.SimpleCommand
              words: [{(detect_and_echo_vars)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$sh_out')}
                )
              ]
            )
            (command.SimpleCommand
              words: [{(detect_c_language)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$c_out')}
                )
              ]
            )
            (C {(log)} 
              {(DQ ('Wrote ') ($ VSub_DollarName '$sh_out') (' and ') ($ VSub_DollarName '$c_out'))}
            )
          ]
        )
    )
    (command.FuncDef
      name: unittest
      body: 
        (command.BraceGroup
          children: [
            (C {(cc_print_expr)} {(SQ <'sizeof(int)'>)})
            (command.Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:actual) op:Equal)]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:actual)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(cat)} {($ VSub_DollarName '$TMP') (/print_expr.out)})]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    }
                )
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(test)} {(DQ ($ VSub_DollarName '$actual'))} {(Lit_Other '=')} {(4)})
                (C {(die)} {(DQ ('Expected 4, got ') ($ VSub_DollarName '$actual'))})
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(check_sizeof)} {(SIZEOF_INT)} {(SQ <int>)} {(4)})
                (C {(die)} {(DQ (FAILED))})
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(cc_statement)} {(HAVE_INT)} {(SQ <'int x = (int)0;'>)})
                (C {(die)} {(DQ (FAILED))})
              ]
            )
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(cc_statement)} {(HAVE_FOO)} {(SQ <'foo x = (foo)0;'>)})
                (C {(die)} {(DQ ('Expected to fail'))})
              ]
            )
          ]
        )
    )
    (C {(main)} {(DQ ($ VSub_At '$@'))})
  ]
)