public static Vector copyVariablesVector(Vector self, KeyValueMap mapping) {
    if (self.emptyP()) {
      return (Logic.ZERO_VARIABLES_VECTOR);
    }
    { Vector copy = Vector.newVector(self.length());

      { PatternVariable vbl = null;
        Vector vector000 = self;
        int index000 = 0;
        int length000 = vector000.length();
        int i = Stella.NULL_INTEGER;
        int iter000 = 0;

        for (;index000 < length000; index000 = index000 + 1, iter000 = iter000 + 1) {
          vbl = ((PatternVariable)((vector000.theArray)[index000]));
          i = iter000;
          { PatternVariable vblcopy = PatternVariable.copyVariable(vbl, mapping);

            if (((Integer)(Logic.$BOUNDTOOFFSETCOUNTER$.get())).intValue() != Stella.NULL_INTEGER) {
              vblcopy.boundToOffset = ((Integer)(Logic.$BOUNDTOOFFSETCOUNTER$.get())).intValue();
              Native.setIntSpecial(Logic.$BOUNDTOOFFSETCOUNTER$, ((Integer)(Logic.$BOUNDTOOFFSETCOUNTER$.get())).intValue() + 1);
            }
            (copy.theArray)[i] = vblcopy;
          }
        }
      }
      return (copy);
    }
  }