public static Stella_Object safeArgumentBoundTo(Stella_Object self) {
    if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(self), Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
      { PatternVariable self000 = ((PatternVariable)(self));

        { Stella_Object value = null;

          if ((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) &&
              (self000.boundToOffset != Stella.NULL_INTEGER)) {
            value = (((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord.variableBindings.theArray)[(self000.boundToOffset)];
          }
          if ((value == null) &&
              (((Stella_Object)(Stella_Object.accessInContext(self000.variableValue, self000.homeContext, false))) != null)) {
            value = Logic.valueOf(self000);
            if (Logic.skolemP(value)) {
              value = null;
            }
          }
          return (value);
        }
      }
    }
    else {
      return (Logic.argumentBoundTo(self));
    }
  }