rem: --noprint;
context: static void simplify_lex_renames(Scheme_Object *wraps, Scheme_Hash_Table *lex_cache){  WRAP_POS w;  WRAP_POS prev;  WRAP_POS w2;  Scheme_Object *stack = scheme_null, *key, *old_key;  Scheme_Object *v, *v2, *v2l, *stx, *name;  long size, vsize, psize, i, j, pos;  /* Although it makes no sense to simplify the rename table itself,     we can simplify it in the context of a particular wrap suffix.     (But don't mutate the wrap list, because that will stomp on     tables that might be needed by a propoagation.)          A lex_cache maps wrap starts w to simplified tables. A lex_cache     is modified by this function, only. */  WRAP_POS_INIT(w, wraps);  WRAP_POS_INIT_END(prev);  old_key = NULL;  while (!WRAP_POS_END_P(w)) {    if (SCHEME_VECTORP(WRAP_POS_FIRST(w))	|| SCHEME_RIBP(WRAP_POS_FIRST(w))) {      /* Lexical rename */      key = WRAP_POS_KEY(w);      if (!SAME_OBJ(key, old_key)) {	v = scheme_hash_get(lex_cache, key);      } else	v = NULL;      old_key = key;      if (v) {	/* Tables here are already simplified. */	WRAP_POS_COPY(prev, w);	/* No non-simplified table can follow a simplified one */	break;      } else {	int add = 0;	v = WRAP_POS_FIRST(w);	if (SCHEME_RIBP(v)) {	  /* A rib certainly isn't simplified yet. */	  add = 1;	} else {	  /* Need to simplify this vector? */	  if (SCHEME_VEC_SIZE(v) == 1)	    v = SCHEME_VEC_ELS(v)[0];	  if ((SCHEME_VEC_SIZE(v) > 2) /* a simplified vec can be empty */	      && !SCHEME_SYMBOLP(SCHEME_VEC_ELS(v)[2])) {	    add = 1;	  }	}	if (add) {	  /* Need to simplify, but do deepest first: */	  if (SCHEME_NULLP(stack) || !SAME_OBJ(SCHEME_CAR(stack), key)) {	    stack = CONS(key, stack);	  }	} else {	  /* This is already simplified. Remember it and stop, because	     no non-simplified table can follow a simplified one. */	  if (WRAP_POS_END_P(prev))	    WRAP_POS_COPY(prev, w);	  break;	}      }    }        WRAP_POS_INC(w);  }  while (!SCHEME_NULLP(stack)) {    key = SCHEME_CAR(stack);    v2l = scheme_null;    WRAP_POS_REVINIT(w, key);    while (!WRAP_POS_REVEND_P(w)) {      v = WRAP_POS_FIRST(w);            if (SCHEME_RIBP(v)	  || (SCHEME_VECTORP(v)	      && (SCHEME_VEC_SIZE(v) > 2) /* a simplified vec can be empty */	      && !SCHEME_SYMBOLP(SCHEME_VEC_ELS(v)[2]))) {	/* This is the place to simplify: */	Scheme_Lexical_Rib *rib = NULL, *init_rib = NULL;	Scheme_Object *skip_ribs = scheme_null;	int ii, vvsize;	if (SCHEME_RIBP(v)) {	  skip_ribs = scheme_make_pair(v, scheme_null);	  init_rib = (Scheme_Lexical_Rib *)v;	  rib = init_rib->next;	  vsize = 0;	  while (rib) {	    vsize += SCHEME_RENAME_LEN(rib->rename);	    rib = rib->next;	  }	  rib = init_rib->next;	} else	  vsize = SCHEME_RENAME_LEN(v);	/* Initial size; may shrink: */	size = vsize;	v2 = scheme_make_vector(2 + (2 * size), NULL);	pos = 0; /* counter for used slots */	/* Local vector (different from i when we have a rib) */	ii = 0;	vvsize= vsize;	for (i = 0; i < vsize; i++) {	  if (rib) {	    v = rib->rename;	    vvsize = SCHEME_RENAME_LEN(v);	    while (ii >= vvsize) {	      ii = 0;	      rib = rib->next;	      v = rib->rename;	      vvsize = SCHEME_RENAME_LEN(v);	    }	  }	  stx = SCHEME_VEC_ELS(v)[2+ii];	  name = SCHEME_STX_VAL(stx);	  SCHEME_VEC_ELS(v2)[2+pos] = name;	  	  {	    /* Either this name is in prev, in which case the answer	       must match this rename's target, or this rename's	       answer applies. */	    Scheme_Object *ok = NULL;	    if (!WRAP_POS_END_P(prev)) {	      WRAP_POS w3;	      Scheme_Object *vp;	      Scheme_Object *other_env;	      other_env = SCHEME_VEC_ELS(v)[2+vvsize+ii];	      if (SCHEME_VOIDP(other_env)) {		noprint++;		other_env = resolve_env(stx, 0, 0, NULL, skip_ribs);		--noprint;		SCHEME_VEC_ELS(v)[2+vvsize+ii] = other_env;	      }	    	      /* Check marks (now that we have the correct barriers). */	      WRAP_POS_INIT(w2, ((Scheme_Stx *)stx)->wraps);	      if (!same_marks(&w2, &w, SCHEME_FALSEP(other_env), other_env, (Scheme_Object *)init_rib)) {		other_env = NULL;	      }	      	      if (other_env) {		WRAP_POS_COPY(w3, prev);		for (; !WRAP_POS_END_P(w3); WRAP_POS_INC(w3)) {		  vp = WRAP_POS_FIRST(w3);		  if (SCHEME_VECTORP(vp)) {		    psize = SCHEME_RENAME_LEN(vp);		    for (j = 0; j < psize; j++) {		      if (SAME_OBJ(SCHEME_VEC_ELS(vp)[2+j], name)) {			if (SAME_OBJ(SCHEME_VEC_ELS(vp)[2+psize+j], other_env)) {			  ok = SCHEME_VEC_ELS(v)[0];			} else {			  ok = NULL; 			  /* Alternate time/space tradeoff: could be			     SCHEME_VEC_ELS(vp)[2+psize+j],			     which is the value from prev */			}			break;		      }		    }		    if (j < psize)		      break;		  }		}		if (WRAP_POS_END_P(w3) && SCHEME_FALSEP(other_env))		  ok = SCHEME_VEC_ELS(v)[0];	      } else		ok = NULL;	    } else	      ok = SCHEME_VEC_ELS(v)[0];	    if (ok) {	      SCHEME_VEC_ELS(v2)[2+size+pos] = ok;	      pos++;	    }	  }	  ii++;	}	if (pos != size) {	  /* Shrink simplified vector */	  if (!pos)	    v2 = empty_simplified;	  else {	    v = v2;	    v2 = scheme_make_vector(2 + (2 * pos), NULL);	    for (i = 0; i < pos; i++) {	      SCHEME_VEC_ELS(v2)[2+i] = SCHEME_VEC_ELS(v)[2+i];	      SCHEME_VEC_ELS(v2)[2+pos+i] = SCHEME_VEC_ELS(v)[2+size+i];	    }	  }	}	SCHEME_VEC_ELS(v2)[0] = scheme_false;	SCHEME_VEC_ELS(v2)[1] = scheme_false;	v2l = CONS(v2, v2l);	WRAP_POS_COPY(prev, w);      }      WRAP_POS_DEC(w);    }    scheme_hash_set(lex_cache, key, v2l);    stack = SCHEME_CDR(stack);  }}