public static Symbol yieldLocalVariableAlias(Symbol variable, int level) {
    if (!(level >= 1)) {
      System.err.print("Safety violation: INTERNAL ERROR: Variable level must be >= 1");
    }
    if (((KeyValueList)(Stella.$LOCALGENSYMTABLE$.get())) == null) {
      return (Stella.localGensym(variable.symbolName));
    }
    { Cons aliases = ((Cons)(((KeyValueList)(Stella.$LOCALGENSYMTABLE$.get())).lookup(variable)));
      Symbol alias = null;

      if (aliases == null) {
        aliases = Stella.NIL;
      }
      if (aliases.length() < level) {
        alias = Stella.localGensym(variable.symbolName);
        ((KeyValueList)(Stella.$LOCALGENSYMTABLE$.get())).insertAt(variable, aliases.concatenate(Cons.cons(alias, Stella.NIL), Stella.NIL));
        return (alias);
      }
      else {
        return (((Symbol)(aliases.nth(level - 1))));
      }
    }
  }