(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DIR)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:23)
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {(cd)} 
                              {
                                (DQ 
                                  (command_sub
                                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:28)
                                    command_list: 
                                      (command.CommandList
                                        children: [
                                          (C {(dirname)} 
                                            {
                                              (DQ 
                                                (braced_var_sub
                                                  token: 
                                                    (Token
                                                      id: Id.VSub_Name
                                                      val: BASH_SOURCE
                                                      span_id: 34
                                                    )
                                                  bracket_op: 
                                                    (bracket_op.ArrayIndex
                                                      expr: 
                                                        (arith_expr.ArithWord
                                                          w: {(Id.Lit_Digits 0)}
                                                        )
                                                    )
                                                )
                                              )
                                            }
                                          )
                                        ]
                                      )
                                  )
                                )
                              }
                            )
                            (C {(pwd)})
                          ]
                        )
                      ]
                    )
                )
              )
            }
          spids: [21]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:REOPT)
          op: assign_op.Equal
          rhs: {(DQ )}
          spids: [52]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:REC) op:assign_op.Equal rhs:{(DQ )} spids:[57])]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_f
                      child: {($ Id.VSub_DollarName '$DIR') (/reopt.sh)}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:72)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:REOPT)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$DIR') (/reopt.sh))}
                  spids: [77]
                )
              ]
            )
          ]
          spids: [62 74]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_f
                      child: {($ Id.VSub_DollarName '$DIR') (/reopt)}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:96)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:REOPT)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$DIR') (/reopt))}
                  spids: [101]
                )
              ]
            )
          ]
          spids: [86 98]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {(-z)} {(DQ ($ Id.VSub_DollarName '$REOPT'))} 
                  {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:121)
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Couldn't find reopt"))})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:133)
              arg_word: {(1)}
            )
          ]
          spids: [110 123]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_f
                      child: {($ Id.VSub_DollarName '$DIR') (/rec.sh)}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:150)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:REC)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$DIR') (/rec.sh))}
                  spids: [155]
                )
              ]
            )
          ]
          spids: [140 152]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Unary
                      op_id: Id.BoolUnary_f
                      child: {($ Id.VSub_DollarName '$DIR') (/rec)}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:174)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:REC)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$DIR') (/rec))}
                  spids: [179]
                )
              ]
            )
          ]
          spids: [164 176]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {(-z)} {(DQ ($ Id.VSub_DollarName '$REC'))} 
                  {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:199)
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Couldn't find rec"))})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:211)
              arg_word: {(1)}
            )
          ]
          spids: [188 201]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:OCAMLOPTIDX)
          op: assign_op.Equal
          rhs: {(-1)}
          spids: [225]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:OCAMLCIDX)
          op: assign_op.Equal
          rhs: {(-1)}
          spids: [228]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:USEOCAMLFIND)
          op: assign_op.Equal
          rhs: {(-1)}
          spids: [231]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:i) op:assign_op.Equal rhs:{(1)} spids:[238])]
    )
    (command.ForEach
      iter_name: var
      iter_words: [{(DQ ($ Id.VSub_At '$@'))}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobEqual
                              left: {($ Id.VSub_DollarName '$var')}
                              right: {(DQ (-ocamlopt))}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:267)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:OCAMLOPTIDX)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$i')}
                          spids: [273]
                        )
                      ]
                    )
                  ]
                  spids: [254 270]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobEqual
                              left: {($ Id.VSub_DollarName '$var')}
                              right: {(DQ (-ocamlc))}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:294)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:OCAMLCIDX)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$i')}
                          spids: [300]
                        )
                      ]
                    )
                  ]
                  spids: [281 297]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobEqual
                              left: {($ Id.VSub_DollarName '$var')}
                              right: {(DQ (-use-ocamlfind))}
                            )
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:321)
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:USEOCAMLFIND)
                          op: assign_op.Equal
                          rhs: {(1)}
                          spids: [327]
                        )
                      ]
                    )
                  ]
                  spids: [308 324]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:i)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_DollarName '$i') (Id.Lit_Other '+') (1)}
                  spids: [334]
                )
              ]
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:OCAMLOPT)
          op: assign_op.Equal
          rhs: {(DQ (ocamlopt.opt))}
          spids: [345]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_ne
                      left: {($ Id.VSub_DollarName '$OCAMLOPTIDX')}
                      right: {(-1)}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:361)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:VALUEIDX)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: 
                              (arith_expr.VarRef
                                token: (Token id:Id.Lit_ArithVarLike val:OCAMLOPTIDX span_id:372)
                              )
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [370]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:OCAMLOPT)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: (Token id:Id.VSub_Name val:VALUEIDX span_id:382)
                        prefix_op: (Id.VSub_Bang)
                      )
                    }
                  spids: [379]
                )
              ]
            )
            (C {(Id.KW_Set set)} {(--)} 
              {
                (DQ 
                  (braced_var_sub
                    token: (Token id:Id.VSub_At val:'@' span_id:396)
                    suffix_op: 
                      (suffix_op.Slice
                        begin: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                        length: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Minus
                            left: 
                              (arith_expr.VarRef
                                token: (Token id:Id.Lit_ArithVarLike val:OCAMLOPTIDX span_id:400)
                              )
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                  )
                )
              } 
              {
                (DQ 
                  (braced_var_sub
                    token: (Token id:Id.VSub_At val:'@' span_id:408)
                    suffix_op: 
                      (suffix_op.Slice
                        begin: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: 
                              (arith_expr.VarRef
                                token: (Token id:Id.Lit_ArithVarLike val:VALUEIDX span_id:411)
                              )
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                  )
                )
              }
            )
          ]
          spids: [350 363]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:OCAMLC)
          op: assign_op.Equal
          rhs: {(DQ (ocamlc.opt))}
          spids: [423]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_ne
                      left: {($ Id.VSub_DollarName '$OCAMLCIDX')}
                      right: {(-1)}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:439)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:VALUEIDX)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: 
                              (arith_expr.VarRef
                                token: (Token id:Id.Lit_ArithVarLike val:OCAMLCIDX span_id:450)
                              )
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [448]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:OCAMLC)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: (Token id:Id.VSub_Name val:VALUEIDX span_id:460)
                        prefix_op: (Id.VSub_Bang)
                      )
                    }
                  spids: [457]
                )
              ]
            )
            (C {(Id.KW_Set set)} {(--)} 
              {
                (DQ 
                  (braced_var_sub
                    token: (Token id:Id.VSub_At val:'@' span_id:474)
                    suffix_op: 
                      (suffix_op.Slice
                        begin: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                        length: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Minus
                            left: 
                              (arith_expr.VarRef
                                token: (Token id:Id.Lit_ArithVarLike val:OCAMLCIDX span_id:478)
                              )
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                  )
                )
              } 
              {
                (DQ 
                  (braced_var_sub
                    token: (Token id:Id.VSub_At val:'@' span_id:486)
                    suffix_op: 
                      (suffix_op.Slice
                        begin: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: 
                              (arith_expr.VarRef
                                token: (Token id:Id.Lit_ArithVarLike val:VALUEIDX span_id:489)
                              )
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                  )
                )
              }
            )
          ]
          spids: [428 441]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_ne
                      left: {($ Id.VSub_DollarName '$USEOCAMLFIND')}
                      right: {(-1)}
                    )
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:509)
            )
          ]
          action: [
            (C {(env)} 
              {(Id.Lit_VarLike 'OCAMLFIND_COMMANDS=') 
                (DQ ('ocamlopt=') ($ Id.VSub_DollarName '$REOPT') (' ocamlc=') 
                  ($ Id.VSub_DollarName '$REC')
                )
              } {(reasonbuild)} {(DQ ($ Id.VSub_At '$@'))}
            )
          ]
          spids: [498 511]
        )
      ]
      else_action: [
        (C {(reasonbuild)} {(-ocamlopt)} 
          {
            (DQ ('env OCAMLOPT=') 
              (word_part.EscapedLiteral
                token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:543)
              ) ($ Id.VSub_DollarName '$OCAMLOPT') 
              (word_part.EscapedLiteral
                token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:545)
              ) (' ') ($ Id.VSub_DollarName '$REOPT')
            )
          } {(-ocamlc)} 
          {
            (DQ ('env OCAMLC=') 
              (word_part.EscapedLiteral
                token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:554)
              ) ($ Id.VSub_DollarName '$OCAMLC') 
              (word_part.EscapedLiteral
                token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:556)
              ) (' ') ($ Id.VSub_DollarName '$REC')
            )
          } {(DQ ($ Id.VSub_At '$@'))}
        )
      ]
    )
  ]
)