(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:DIR)
          op: Equal
          rhs: 
            {
              (DQ 
                (word_part.CommandSubPart
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.AndOr
                          ops: [Op_DAmp]
                          children: [
                            (C {(cd)} 
                              {
                                (DQ 
                                  (word_part.CommandSubPart
                                    command_list: 
                                      (command.CommandList
                                        children: [
                                          (C {(dirname)} 
                                            {
                                              (DQ 
                                                (word_part.BracedVarSub
                                                  token: <VSub_Name BASH_SOURCE>
                                                  bracket_op: 
                                                    (bracket_op.ArrayIndex
                                                      expr: (arith_expr.ArithWord w:{(Lit_Digits 0)})
                                                    )
                                                )
                                              )
                                            }
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                  )
                                )
                              }
                            )
                            (C {(pwd)})
                          ]
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                )
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:REOPT) op:Equal rhs:{(DQ )})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:REC) op:Equal rhs:{(DQ )})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolUnary
                      op_id: BoolUnary_f
                      child: {($ VSub_DollarName '$DIR') (/reopt.sh)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:REOPT)
                  op: Equal
                  rhs: {(DQ ($ VSub_DollarName '$DIR') (/reopt.sh))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolUnary
                      op_id: BoolUnary_f
                      child: {($ VSub_DollarName '$DIR') (/reopt)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:REOPT)
                  op: Equal
                  rhs: {(DQ ($ VSub_DollarName '$DIR') (/reopt))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_DollarName '$REOPT'))} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Couldn't find reopt"))})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolUnary
                      op_id: BoolUnary_f
                      child: {($ VSub_DollarName '$DIR') (/rec.sh)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:REC)
                  op: Equal
                  rhs: {(DQ ($ VSub_DollarName '$DIR') (/rec.sh))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolUnary
                      op_id: BoolUnary_f
                      child: {($ VSub_DollarName '$DIR') (/rec)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:REC)
                  op: Equal
                  rhs: {(DQ ($ VSub_DollarName '$DIR') (/rec))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_DollarName '$REC'))} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Couldn't find rec"))})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:OCAMLOPTIDX) op:Equal rhs:{(-1)})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:OCAMLCIDX) op:Equal rhs:{(-1)})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:USEOCAMLFIND) op:Equal rhs:{(-1)})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:i) op:Equal rhs:{(1)})]
    )
    (command.ForEach
      iter_name: var
      iter_words: [{(DQ ($ VSub_At '$@'))}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_GlobEqual
                              left: {($ VSub_DollarName '$var')}
                              right: {(DQ (-ocamlopt))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:OCAMLOPTIDX)
                          op: Equal
                          rhs: {($ VSub_DollarName '$i')}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_GlobEqual
                              left: {($ VSub_DollarName '$var')}
                              right: {(DQ (-ocamlc))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:OCAMLCIDX)
                          op: Equal
                          rhs: {($ VSub_DollarName '$i')}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_GlobEqual
                              left: {($ VSub_DollarName '$var')}
                              right: {(DQ (-use-ocamlfind))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:USEOCAMLFIND) op:Equal rhs:{(1)})]
                    )
                  ]
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:i)
                  op: Equal
                  rhs: {($ VSub_DollarName '$i') (Lit_Other '+') (1)}
                )
              ]
            )
          ]
        )
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:OCAMLOPT) op:Equal rhs:{(DQ (ocamlopt.opt))})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolBinary
                      op_id: BoolBinary_ne
                      left: {($ VSub_DollarName '$OCAMLOPTIDX')}
                      right: {(-1)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:VALUEIDX)
                  op: Equal
                  rhs: 
                    {
                      (word_part.ArithSubPart
                        anode: 
                          (arith_expr.ArithBinary
                            op_id: Arith_Plus
                            left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike OCAMLOPTIDX>)
                            right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                          )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:OCAMLOPT)
                  op: Equal
                  rhs: {(word_part.BracedVarSub token:<VSub_Name VALUEIDX> prefix_op:VSub_Bang)}
                )
              ]
            )
            (C {(set)} {(--)} 
              {
                (DQ 
                  (word_part.BracedVarSub
                    token: <VSub_At '@'>
                    suffix_op: 
                      (suffix_op.Slice
                        begin: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                        length: 
                          (arith_expr.ArithBinary
                            op_id: Arith_Minus
                            left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike OCAMLOPTIDX>)
                            right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                          )
                      )
                  )
                )
              } 
              {
                (DQ 
                  (word_part.BracedVarSub
                    token: <VSub_At '@'>
                    suffix_op: 
                      (suffix_op.Slice
                        begin: 
                          (arith_expr.ArithBinary
                            op_id: Arith_Plus
                            left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike VALUEIDX>)
                            right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                          )
                      )
                  )
                )
              }
            )
          ]
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:OCAMLC) op:Equal rhs:{(DQ (ocamlc.opt))})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolBinary
                      op_id: BoolBinary_ne
                      left: {($ VSub_DollarName '$OCAMLCIDX')}
                      right: {(-1)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:VALUEIDX)
                  op: Equal
                  rhs: 
                    {
                      (word_part.ArithSubPart
                        anode: 
                          (arith_expr.ArithBinary
                            op_id: Arith_Plus
                            left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike OCAMLCIDX>)
                            right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                          )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:OCAMLC)
                  op: Equal
                  rhs: {(word_part.BracedVarSub token:<VSub_Name VALUEIDX> prefix_op:VSub_Bang)}
                )
              ]
            )
            (C {(set)} {(--)} 
              {
                (DQ 
                  (word_part.BracedVarSub
                    token: <VSub_At '@'>
                    suffix_op: 
                      (suffix_op.Slice
                        begin: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                        length: 
                          (arith_expr.ArithBinary
                            op_id: Arith_Minus
                            left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike OCAMLCIDX>)
                            right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                          )
                      )
                  )
                )
              } 
              {
                (DQ 
                  (word_part.BracedVarSub
                    token: <VSub_At '@'>
                    suffix_op: 
                      (suffix_op.Slice
                        begin: 
                          (arith_expr.ArithBinary
                            op_id: Arith_Plus
                            left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike VALUEIDX>)
                            right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                          )
                      )
                  )
                )
              }
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.BoolBinary
                      op_id: BoolBinary_ne
                      left: {($ VSub_DollarName '$USEOCAMLFIND')}
                      right: {(-1)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(env)} 
              {(Lit_VarLike 'OCAMLFIND_COMMANDS=') 
                (DQ ('ocamlopt=') ($ VSub_DollarName '$REOPT') (' ocamlc=') ($ VSub_DollarName '$REC'))
              } {(reasonbuild)} {(DQ ($ VSub_At '$@'))}
            )
          ]
        )
      ]
      else_action: [
        (C {(reasonbuild)} {(-ocamlopt)} 
          {
            (DQ ('env OCAMLOPT=') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
              ($ VSub_DollarName '$OCAMLOPT') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' ') ($ VSub_DollarName '$REOPT')
            )
          } {(-ocamlc)} 
          {
            (DQ ('env OCAMLC=') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
              ($ VSub_DollarName '$OCAMLC') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' ') ($ VSub_DollarName '$REC')
            )
          } {(DQ ($ VSub_At '$@'))}
        )
      ]
    )
  ]
)