# include "rag.hh"
# include "nodes.h"
# include "grc.h"

IAT* grnl= NULL;

# include "swbus.h"

PRIVATE void
PROCESINI (r)
    TNODE* r;
{
  TNODE* h[33];
  /* KJT 20/01/23: added "int" type */
  register int i;
  int nr;
  int* grl;

  while (r != NULL) {
    h[0]= r;
    heval (r, h);
    grl= grnl->data[(int)(r->value0)];
    for (i= 0; grl[i] != 0; i++) {
     nr= grl[i];
     switch (nr) {
      case _BUT_definition_1:
	 adclr (-c_gate_decl_list, h[0], 1);
	 adclr (-c_var_decl_list, h[0], 2);
	 adclr (-c_this_BUT_ui, h[0], 3);
	 adclr (-c_this_BUT_ui, h[1], 4);
	 adclr (-c_entry, h[1], 5);
	 adclr (-c_gate_decl_list, h[1], 6);
	 adclr (-c_gate_actual_list, h[1], 7);
	 adclr (-c_var_decl_list, h[1], 8);
	 break;
      case _let_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 9);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 10);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 11);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 12);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 13);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 14);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 15);
	 break;
      case _var_choice_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 16);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 17);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 18);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 19);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 20);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 21);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 22);
	 break;
      case _gate_choice_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 23);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 24);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 25);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 26);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 27);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 28);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 29);
	 break;
      case _par_exp_full_synch_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 30);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 31);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 32);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 33);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 34);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 35);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 36);
	 break;
      case _par_exp_inter_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 37);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 38);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 39);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 40);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 41);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 42);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 43);
	 break;
      case _par_exp_expli_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 44);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 45);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 46);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 47);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 48);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 49);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 50);
	 break;
      case _hiding_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 51);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 52);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 53);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 54);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 55);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 56);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 57);
	 break;
      case _enable_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 58);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 59);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 60);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 61);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 62);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 63);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 64);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 65);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 66);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 67);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 68);
	 break;
      case _disable_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 69);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 70);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 71);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 72);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 73);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 74);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 75);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 76);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 77);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 78);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 79);
	 break;
      case _parallel_full_synch_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 80);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 81);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 82);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 83);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 84);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 85);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 86);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 87);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 88);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 89);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 90);
	 break;
      case _parallel_interleaving_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 91);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 92);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 93);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 94);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 95);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 96);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 97);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 98);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 99);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 100);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 101);
	 break;
      case _parallel_explicit_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 102);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 103);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 104);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 105);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 106);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 107);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 108);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 109);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 110);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 111);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 112);
	 break;
      case _choice_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 113);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 114);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 115);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 116);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 117);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 118);
	 if (h[2] != NULL)
	  adclr (-c_entry, h[2], 119);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 120);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 121);
	 if (h[2] != NULL)
	  adclr (-c_gate_decl_list, h[2], 122);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 123);
	 break;
      case _guard_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 124);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 125);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 126);
	 if (h[3] != NULL)
	  adclr (-c_this_BUT_ui, h[3], 127);
	 if (h[3] != NULL)
	  adclr (-c_entry, h[3], 128);
	 if (h[3] != NULL)
	  adclr (-c_gate_decl_list, h[3], 129);
	 if (h[3] != NULL)
	  adclr (-c_var_decl_list, h[3], 130);
	 break;
      case _external_offer_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 131);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 132);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 133);
	 if (h[0] != NULL)
	  adclr (-c_number_exp, h[0], 134);
	 if (h[0] != NULL)
	  adclr (-c_sort_code, h[0], 135);
	 if (h[3] != NULL)
	  adclr (-c_this_BUT_ui, h[3], 136);
	 if (h[3] != NULL)
	  adclr (-c_entry, h[3], 137);
	 if (h[3] != NULL)
	  adclr (-c_gate_decl_list, h[3], 138);
	 if (h[3] != NULL)
	  adclr (-c_var_decl_list, h[3], 139);
	 if (h[2] != NULL)
	  adclr (-c_this_BUT_ui, h[2], 140);
	 if (h[2] != NULL)
	  adclr (-c_var_decl_list, h[2], 141);
	 if (h[2] != NULL)
	  adclr (-c_local_var_decl, h[2], 142);
	 if (h[2] != NULL)
	  adclr (-c_value_exp_used, h[2], 143);
	 if (h[2] != NULL)
	  adclr (-c_pred_number, h[2], 144);
	 break;
      case _internal_action_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 145);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 146);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 147);
	 if (h[1] != NULL)
	  adclr (-c_this_BUT_ui, h[1], 148);
	 if (h[1] != NULL)
	  adclr (-c_entry, h[1], 149);
	 if (h[1] != NULL)
	  adclr (-c_gate_decl_list, h[1], 150);
	 if (h[1] != NULL)
	  adclr (-c_var_decl_list, h[1], 151);
	 break;
      case _stop_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 152);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 153);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 154);
	 break;
      case _exit_exp_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 155);
	 if (h[0] != NULL)
	  adclr (-c_sort_code, h[0], 156);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 157);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 158);
	 break;
      case _BUT_instantiation_1:
	 if (h[0] != NULL)
	  adclr (-c_lentry, h[0], 159);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 160);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 161);
	 if (h[0] != NULL)
	  adclr (-c_number_var, h[0], 162);
	 break;
      case _relabel_1:
	 adclr (-c_lentry, h[0], 163);
	 adclr (-c_decl_gate, h[0], 164);
	 adclr (-c_decl_var, h[0], 165);
	 adclr (-c_this_BUT_ui, h[1], 166);
	 adclr (-c_entry, h[1], 167);
	 adclr (-c_gate_decl_list, h[1], 168);
	 adclr (-c_var_decl_list, h[1], 169);
	 break;
      case _call_1:
	 adclr (-c_lentry, h[0], 170);
	 adclr (-c_decl_gate, h[0], 171);
	 adclr (-c_decl_var, h[0], 172);
	 break;
      case _var_domain_list_1:
	 if (h[0] != NULL)
	  adclr (-c_product, h[0], 173);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 174);
	 break;
      case _gate_domain_list_1:
	 if (h[0] != NULL)
	  adclr (-c_product, h[0], 175);
	 if (h[0] != NULL)
	  adclr (-c_decl_gate, h[0], 176);
	 break;
      case _gate_domain_1:
	 adclr (-c_product, h[0], 177);
	 break;
      case _ident_equation_list_1:
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 178);
	 break;
      case _experiment_list_1:
	 if (h[0] != NULL)
	  adclr (-c_product, h[0], 179);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 180);
	 if (h[0] != NULL)
	  adclr (-c_value_exp_used, h[0], 181);
	 if (h[0] != NULL)
	  adclr (-c_sort_list, h[0], 182);
	 if (h[0] != NULL)
	  adclr (-c_number_exp, h[0], 183);
	 break;
      case _var_id_1:
	 if (h[0] != NULL)
	  adclr (-c_product, h[0], 184);
	 if (h[0] != NULL)
	  adclr (-c_sort, h[0], 185);
	 break;
      case _value_exp_list_1:
	 if (h[0] != NULL)
	  adclr (-c_number_var, h[0], 186);
	 break;
      case _annotation_list_1:
	 if (h[0] != NULL)
	  adclr (-c_num_delays, h[0], 187);
	 if (h[0] != NULL)
	  adclr (-c_num_waits, h[0], 188);
	 break;
      case _exit_offer_list_1:
	 if (h[0] != NULL)
	  adclr (-c_sort_decl_list, h[0], 189);
	 if (h[0] != NULL)
	  adclr (-c_decl_var, h[0], 190);
	 if (h[0] != NULL)
	  adclr (-c_number_off, h[0], 191);
	 if (h[0] != NULL)
	  adclr (-c_sort_list, h[0], 192);
	 break;
      default:
	 assert ((1 <= nr) && (nr <= LAST_RULE));
      }
    } /* end of while (ngr != NULL) */
    r= succ (r, PREORDER);
  } /* end of while (r != NULL) */
} /* end of PROCESINI */

PUBLIC CLR_TYPE
eval (nar, r)
    int nar;
    TNODE* r;
{
  TNODE* h[33];

  if (r == NULL) return (CLR_TYPE)NULL;
  switch (nar) {
  case 1:
    h[0]= r;
    heval (h[0], h);

     if (find_attr (c_gate_decl, h[0]) != NULL)
	return (CLR_TYPE) INTappend ((INTlist)fdclr (c_gate_decl,h[0], nar),
			 (INTlist)fdclr (c_decl_gate,h[1], nar));
      return (CLR_TYPE) fdclr (c_decl_gate,h[1], nar);
  case 2:
    h[0]= r;
    heval (h[0], h);

     if (find_attr (c_var_list, h[0]) != NULL)
       paramtbl[(int)fdclr (c_this_BUT_ui,h[0], nar)] =
	 (INTlist)takeclr (c_var_list, h[0]);
     if (debug_code)
       if (find_attr (c_var_list, h[0]) != NULL)
	  return (CLR_TYPE) INTappend ((INTlist)fdclr (c_var_list,h[0], nar),
			   (INTlist)fdclr (c_decl_var,h[1], nar));
       else
	  return (CLR_TYPE) fdclr (c_decl_var,h[1], nar);
     else
	return (CLR_TYPE) NULL;
  case 3:
    h[0]= r;
    heval (h[0], h);

     if (h[0]->father->sons == h[0])   /* It is itself, so it's the first */
	return (CLR_TYPE) 0;
      return (CLR_TYPE) id2ui (fdclr (c_BUT_number,h[0], nar));
  case 4:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 5:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) 0;
  case 6:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 7:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (find_attr (c_gate_decl, h[0]) != NULL)
	return (CLR_TYPE) fdclr (c_gate_decl,h[0], nar);
      return (CLR_TYPE) NULL;
  case 8:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 9:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 10:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_gate,h[2], nar);
  case 11:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 12:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 13:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[3] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[3], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[3], nar)) > 0)
	 nentry += ndw;
     }
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 14:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 15:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (debug_code)
	return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
     else
	return (CLR_TYPE) INTappend ((INTlist)fdclr (c_var_decl_list,h[0], nar),
			 (INTlist)fdclr (c_decl_var,h[1], nar));
  case 16:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 17:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_gate,h[2], nar);
  case 18:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 19:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 20:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[3] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[3], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[3], nar)) > 0)
	 nentry += ndw;
     }
     if ((int)fdclr (c_product,h[1], nar) > 1)
       nentry += (2*(int)fdclr (c_product,h[1], nar) - 1);
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 21:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 22:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (debug_code)
	return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
     else
	return (CLR_TYPE) INTappend ((INTlist)fdclr (c_var_decl_list,h[0], nar),
			 (INTlist)fdclr (c_decl_var,h[1], nar));
  case 23:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 24:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_gate,h[1], nar),
		       (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 25:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[2], nar);
  case 26:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 27:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[3] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[3], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[3], nar)) > 0)
	 nentry += ndw;
     }
     if ((int)fdclr (c_product,h[1], nar) > 1)
       nentry += (2*(int)fdclr (c_product,h[1], nar) - 1);
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 28:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 29:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 30:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 31:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_gate,h[1], nar),
		       (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 32:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[2], nar);
  case 33:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 34:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[3] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[3], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[3], nar)) > 0)
	 nentry += ndw;
     }
     if ((int)fdclr (c_product,h[1], nar) > 1)
       nentry += (2*(int)fdclr (c_product,h[1], nar) - 1);
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 35:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 36:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 37:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 38:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_gate,h[1], nar),
		       (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 39:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[2], nar);
  case 40:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 41:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[3] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[3], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[3], nar)) > 0)
	 nentry += ndw;
     }
     if ((int)fdclr (c_product,h[1], nar) > 1)
       nentry += (2*(int)fdclr (c_product,h[1], nar) - 1);
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 42:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 43:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 44:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 45:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_gate,h[1], nar),
		       (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 46:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[2], nar);
  case 47:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 48:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[3] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[3], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[3], nar)) > 0)
	 nentry += ndw;
     }
     if ((int)fdclr (c_product,h[1], nar) > 1)
       nentry += (2*(int)fdclr (c_product,h[1], nar) - 1);
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 49:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 50:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 51:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[1], nar);
  case 52:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_gate_decl,h[0], nar),
		       (INTlist)fdclr (c_decl_gate,h[1], nar));
  case 53:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[1], nar);
  case 54:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 55:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[2] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[2], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[2], nar)) > 0)
	 nentry += ndw;
     }
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 56:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 57:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 58:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 59:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_gate,h[1], nar),
		       (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 60:
    h[0]= r;
    heval (h[0], h);

     if (find_attr (c_var_list, h[0]) != NULL)
	return (CLR_TYPE) INTappend (INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
				    (INTlist)fdclr (c_var_list,h[0], nar)),
			 (INTlist)fdclr (c_decl_var,h[2], nar));
      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 61:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 62:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 63:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + 1);
  case 64:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_lentry,h[1], nar) + 1);
  case 65:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 66:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (debug_code)
	return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
     else
       if (find_attr (c_var_list, h[0]) != NULL)
	  return (CLR_TYPE) INTappend ((INTlist)fdclr (c_var_decl_list,h[0], nar),
			   (INTlist)fdclr (c_var_list,h[0], nar));
       else
	  return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 67:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 68:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (debug_code)
	return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
     else
       if (find_attr (c_var_list, h[0]) != NULL)
	  return (CLR_TYPE) INTappend ((INTlist)fdclr (c_var_decl_list,h[0], nar),
			   (INTlist)fdclr (c_var_list,h[0], nar));
       else
	  return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 69:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 70:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_gate,h[1], nar),
		       (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 71:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 72:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 73:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 74:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + 1);
  case 75:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_lentry,h[1], nar) + 1);
  case 76:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 77:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 78:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 79:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 80:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 81:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTmerge ((INTlist)fdclr (c_decl_gate,h[1], nar),
		      (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 82:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 83:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 84:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 85:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + 1);
  case 86:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_lentry,h[1], nar) + 1);
  case 87:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 88:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 89:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 90:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 91:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 92:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTmerge ((INTlist)fdclr (c_decl_gate,h[1], nar),
		      (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 93:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 94:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 95:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 96:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + 1);
  case 97:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_lentry,h[1], nar) + 1);
  case 98:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 99:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 100:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 101:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 102:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 103:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTmerge ((INTlist)fdclr (c_decl_gate,h[1], nar),
		       (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 104:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 105:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 106:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 107:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + 1);
  case 108:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_lentry,h[1], nar) + 1);
  case 109:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 110:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 111:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 112:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 113:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[2], nar);
  case 114:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTmerge ((INTlist)fdclr (c_decl_gate,h[1], nar),
		      (INTlist)fdclr (c_decl_gate,h[2], nar));
  case 115:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
		       (INTlist)fdclr (c_decl_var,h[2], nar));
  case 116:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 117:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 118:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + 1);
  case 119:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_lentry,h[1], nar) + 1);
  case 120:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 121:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 122:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 123:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 124:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[3], nar);
  case 125:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_gate,h[3], nar);
  case 126:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[3], nar);
  case 127:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 128:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[4] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[4], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[4], nar)) > 0)
	 nentry += ndw;
     }
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 129:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 130:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 131:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[3], nar);
  case 132:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_gate,h[3], nar);
  case 133:
    h[0]= r;
    heval (h[0], h);

     if (h[1] != NULL)
	return (CLR_TYPE) INTappend ((INTlist)fdclr (c_decl_var,h[1], nar),
			 (INTlist)fdclr (c_decl_var,h[3], nar));
      return (CLR_TYPE) fdclr (c_decl_var,h[3], nar);
  case 134:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) (h[1] == NULL) ? 0 : fdclr (c_number_exp,h[1], nar);
  case 135:
    h[0]= r;
    heval (h[0], h);

     if (h[1] == NULL)
	return (CLR_TYPE) IAT_IL_add ((INTlist)NULL, sort_tbl);
      return (CLR_TYPE) IAT_IL_add ((INTlist)fdclr (c_sort_list,h[1], nar), sort_tbl);
  case 136:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 137:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[4] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[4], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[4], nar)) > 0)
	 nentry += ndw;
     }
     if (h[1] != NULL)
       if ((int)fdclr (c_product,h[1], nar) > 1)
	 nentry += (2*(int)fdclr (c_product,h[1], nar) - 1);
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 138:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 139:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (debug_code)
	return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
     else
       if (h[1] != NULL)
	  return (CLR_TYPE) INTappend ((INTlist)fdclr (c_var_decl_list,h[0], nar),
			   (INTlist)fdclr (c_decl_var,h[1], nar));
       else
	  return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 140:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 141:
    h[0]= gt_ft (r);
    heval (h[0], h);

     if (debug_code)
	return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
     else
       if (h[1] != NULL)
	  return (CLR_TYPE) INTappend ((INTlist)fdclr (c_var_decl_list,h[0], nar),
			   (INTlist)fdclr (c_decl_var,h[1], nar));
       else
	  return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 142:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[1], nar);
  case 143:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_value_exp_used,h[1], nar);
  case 144:
    h[0]= gt_ft (r);
    heval (h[0], h);

       /* In pred_tbl the pointers to the predicates are stored  */
       /* as integers. A number is associated to each predicate: */
       /* that which is  return (CLR_TYPE)ed as the index of the table.      */
      return (CLR_TYPE) ITadd ((int)h[2], pred_tbl);
  case 145:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[1], nar);
  case 146:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_gate,h[1], nar);
  case 147:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[1], nar);
  case 148:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 149:
    h[0]= gt_ft (r);
    heval (h[0], h);
  {
     int nentry = 1, ndw;
     if (h[2] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[2], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[2], nar)) > 0)
	 nentry += ndw;
     }
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 150:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 151:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 152:
    h[0]= r;
    heval (h[0], h);
  {
     int p2;
     int nentry = 0, ndw;
     p2 = INTlength ((INTlist)fdclr (c_var_decl_list,h[0], nar));
     if (p2 > max_val)
       max_val = p2;
     if (h[1] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[1], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[1], nar)) > 0)
	 nentry += ndw;
     }
     uptvs ((int)fdclr (c_this_BUT_ui,h[0], nar),
	    varl2sortl ((INTlist)fdclr (c_var_decl_list,h[0], nar)));
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 153:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) NULL;
  case 154:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) NULL;
  case 155:
    h[0]= r;
    heval (h[0], h);
  {
     int p2;
     int nentry = 0, ndw;
     p2 = INTlength ((INTlist)fdclr (c_var_decl_list,h[0], nar));
     if (h[1] != NULL)
       p2 += INTlength ((INTlist)fdclr (c_decl_var,h[1], nar));
     if (p2 > max_val)
       max_val = p2;
     if (h[2] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[2], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[2], nar)) > 0)
	 nentry += ndw;
     }
     if (h[1] != NULL)
       uptvs ((int)fdclr (c_this_BUT_ui,h[0], nar),
	      INTappend (varl2sortl ((INTlist)fdclr (c_var_decl_list,h[0], nar)),
			 (INTlist)fdclr (c_sort_decl_list,h[1], nar)));
     else
       uptvs ((int)fdclr (c_this_BUT_ui,h[0], nar),
	      varl2sortl ((INTlist)fdclr (c_var_decl_list,h[0], nar)));
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 156:
    h[0]= r;
    heval (h[0], h);

     if (h[1] == NULL)
	return (CLR_TYPE) IAT_IL_add ((INTlist)NULL, sort_tbl);
      return (CLR_TYPE) IAT_IL_add ((INTlist)fdclr (c_sort_list,h[1], nar), sort_tbl);
  case 157:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) NULL;
  case 158:
    h[0]= r;
    heval (h[0], h);

     if (h[1] != NULL)
	return (CLR_TYPE) fdclr (c_decl_var,h[1], nar);
      return (CLR_TYPE) NULL;
  case 159:
    h[0]= r;
    heval (h[0], h);
  {
     int p2;
     int nentry = 0, ndw;
     p2 = INTlength ((INTlist)fdclr (c_var_decl_list,h[0], nar));
     if (p2 > max_val)
       max_val = p2;
     if (h[2] != NULL) {
       if ((ndw = (int)fdclr (c_num_delays,h[2], nar)) > 0)
	 nentry += ndw;
       if ((ndw = (int)fdclr (c_num_waits,h[2], nar)) > 0)
	 nentry += ndw;
     }
     uptvs ((int)fdclr (c_this_BUT_ui,h[0], nar),
	    varl2sortl ((INTlist)fdclr (c_var_decl_list,h[0], nar)));
      return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + nentry);
  }
  case 160:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) NULL;
  case 161:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) NULL;
  case 162:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) (h[1] == NULL) ? 0 : fdclr (c_number_var,h[1], nar);
  case 163:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_lentry,h[1], nar);
  case 164:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) INTmerge ((INTlist)fdclr (c_gate_decl,h[0], nar),
		      (INTlist)fdclr (c_decl_gate,h[1], nar));
  case 165:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_decl_var,h[1], nar);
  case 166:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_this_BUT_ui,h[0], nar);
  case 167:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) ((int)fdclr (c_entry,h[0], nar) + 1);
  case 168:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_gate_decl_list,h[0], nar);
  case 169:
    h[0]= gt_ft (r);
    heval (h[0], h);
   return (CLR_TYPE) fdclr (c_var_decl_list,h[0], nar);
  case 170:
    h[0]= r;
    heval (h[0], h);
  {
     uptvs ((int)fdclr (c_this_BUT_ui,h[0], nar),
	    varl2sortl ((INTlist)fdclr (c_var_decl_list,h[0], nar)));
      return (CLR_TYPE) fdclr (c_entry,h[0], nar);
  }
  case 171:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) NULL;
  case 172:
    h[0]= r;
    heval (h[0], h);
   return (CLR_TYPE) NULL;
  case 173:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     int    product = 1;
     TNODE* aux = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       product *= (int)fdclr (c_product, aux, nar);
      return (CLR_TYPE) product;
  }
  case 174:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist il = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       il = INTcons ((int)takeclr (c_var_id, aux), il);
      return (CLR_TYPE) INTrev (il);
  }
  case 175:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     int    product = 1;
     TNODE* aux = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       product *= (int)fdclr (c_product, aux, nar);
      return (CLR_TYPE) product;
  }
  case 176:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist il = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       il = INTappend (il, (INTlist)takeclr (c_gate_decl, aux));
      return (CLR_TYPE) il;
  }
  case 177:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) (INTlength ((INTlist)fdclr (c_gate_decl,h[0], nar)) *
	     INTlength ((INTlist)fdclr (c_gate_list,h[0], nar)));
  case 178:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist l = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       l = INTappend (l, (INTlist)find_attr (c_var_list, aux)->value);
      return (CLR_TYPE) l;
  }
  case 179:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     int    product = 1;
     TNODE* aux = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       if (aux->type == tvar_id)
	 if ((int)fdclr (c_product, aux, nar) > 0)
	   product *= (int)takeclr (c_product, aux);
      return (CLR_TYPE) product;
  }
  case 180:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist sl = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       if (aux->type == tvar_id)
	 sl = INTcons ((int)takeclr (c_var_id, aux), sl);
      return (CLR_TYPE) INTrev (sl);
  }
  case 181:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist sl = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       if (aux->type == tvar_id)
	 sl = INTcons ((int)takeclr (c_var_id, aux), sl);
       else
	 sl = INTcons ((int)takeclr (c_idref, aux), sl);
      return (CLR_TYPE) INTrev (sl);
  }
  case 182:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist sl = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       sl = INTcons ((int)fdclr (c_sort, aux, nar), sl);
      return (CLR_TYPE) INTrev (sl);
  }
  case 183:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     int cntr = 0;
     TNODE *aux = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux), cntr++)
       ;  /* EMPTY */
      return (CLR_TYPE) cntr;
  }
  case 184:
    h[0]= r;
    heval (h[0], h);
  {
     int product = 0;
     TNODE *aux = NULL;
     if (h[1] != NULL)
       for (aux = gt_fs (h[1]);
	    aux != NULL;
	    aux = gt_rb (aux))
	 if (find_attr (c_default, aux) != NULL)
	   product++;
      return (CLR_TYPE) product;
  }
  case 185:
    h[0]= r;
    heval (h[0], h);

      return (CLR_TYPE) ATfind (ATable, (int)fdclr (c_var_id,h[0], nar), c_sort)->value;
  case 186:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     int cntr = 0;
     TNODE *aux = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux), cntr++)
       ;  /* EMPTY */
      return (CLR_TYPE) cntr;
  }
  case 187:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     int num = 0;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       if (find_attr (c_delay, aux) != NULL)
	 num++;
      return (CLR_TYPE) num;
  }
  case 188:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     int num = 0;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       if (find_attr (c_wait, aux) != NULL)
	 num++;
      return (CLR_TYPE) num;
  }
  case 189:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;   /* sorts list of declared -virtual- variables */
     INTlist dvl = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       if (aux->type == tsort_id)
	 dvl = INTcons (id2ui (fdclr (c_sort, aux, nar)), dvl);
      return (CLR_TYPE) INTrev (dvl);
  }
  case 190:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist dvl = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       if (aux->type == tsort_id)     /* 0 is a non existing variable */
	 dvl = INTcons (0, dvl);      /* i.e., virtual                */
      return (CLR_TYPE) INTrev (dvl);
  }
  case 191:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     int cntr = 0;
     TNODE *aux = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux), cntr++)
       ;  /* EMPTY */
      return (CLR_TYPE) cntr;
  }
  case 192:
    h[0]= r;
    h[1]= gt_fs (h[0]);
    h[5]= gt_ls (h[0]);
  {
     TNODE *aux = NULL;
     INTlist sl = NULL;
     for (aux = gt_fs (h[0]);
	  aux != NULL;
	  aux = gt_rb (aux))
       sl = INTcons ((int)fdclr (c_sort, aux, nar), sl);
      return (CLR_TYPE) INTrev (sl);
  }
     }
  return (CLR_TYPE)NULL;
}





PUBLIC void
rag (r)
    TNODE* r;
{
  PROCESINI (r);
  if (ragerrors == 0)
    todo (r);
} /* end of rag */
