#include "externs.h"

void F257_linebreak (finalwidowpenalty)
/*******************************/
long int   finalwidowpenalty;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register BOOLEAN autobreaking;
  register int   c;
  register T43_internalfontnumber f;
  register T29_smallnumber j;
  register int /* was T32_halfword */ prevp;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
  register int /* was T32_halfword */ s;
  register long help,help1;
  register int shelp,shelp1;
  register T37_memoryword memhelp,memhelp1;

  packbeginline = curlist.mlfield;
  m29997->_TAG._TAG3.hh.rh = mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh;
  if ((curlist.tailfield >= himemmin) || (mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 != 10))
  {
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F90_newpenalty (10000L);
  }
  else
  {
    memptr = &mem[curlist.tailfield - C2_memmin];
    memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 12;
    F108_deleteglueref ((memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh);
    F109_flushnodelist ((memptr+1)->_TAG._TAG3.hh.rh);
    (memptr+1)->_TAG._TAG1._int = 10000;
  }
  mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F86_newparamglue (14);
  F113_popnest ();
  noshrinkerroryet = TRUE;
  memptr = &mem[eqtb[3533]._TAG._TAG3.hh.rh - C2_memmin];
  if ((memptr->_TAG._TAG3.hh._TAG._TAG2.b1 != 0) &&
      ((memptr+3)->_TAG._TAG1._int != 0L))
    eqtb[3533]._TAG._TAG3.hh.rh = F252_finiteshrink(eqtb[3533]._TAG._TAG3.hh.rh);
  memptr = &mem[eqtb[3534]._TAG._TAG3.hh.rh - C2_memmin];
  if ((memptr->_TAG._TAG3.hh._TAG._TAG2.b1 != 0) &&
      ((memptr+3)->_TAG._TAG1._int != 0L))
    eqtb[3534]._TAG._TAG3.hh.rh = F252_finiteshrink(eqtb[3534]._TAG._TAG3.hh.rh);
  q = eqtb[3533]._TAG._TAG3.hh.rh;
  r = eqtb[3534]._TAG._TAG3.hh.rh;
  memptr = &mem[q - C2_memmin];
  memptr1 = &mem[r - C2_memmin];
  background[0] = (memptr+1)->_TAG._TAG1._int + (memptr1+1)->_TAG._TAG1._int;
  background[1] = background[2] = background[3] = background[4] = 0;
  background[1 + memptr->_TAG._TAG3.hh._TAG._TAG2.b0] = (memptr+2)->_TAG._TAG1._int;
  background[1 + memptr1->_TAG._TAG3.hh._TAG._TAG2.b0] += (memptr1+2)->_TAG._TAG1._int;
  background[5] = (memptr+3)->_TAG._TAG1._int + (memptr1+3)->_TAG._TAG1._int;
  minimaldemerits[0] = minimaldemerits[1] = minimaldemerits[2] = minimaldemerits[3] = minimumdemerits = 1073741823;
  if (eqtb[4056]._TAG._TAG3.hh.rh == -32768)
    if (eqtb[5718]._TAG._TAG1._int == 0L)
    {
      lastspecialline = 0;
      secondwidth = eqtb[5704]._TAG._TAG1._int;
      secondindent = 0;
    }
    else
    {
      lastspecialline = eqtb[5308]._TAG._TAG1._int;
      if (lastspecialline<0L)
      {
	lastspecialline = -lastspecialline;
	help = eqtb[5718]._TAG._TAG1._int;
	help1 = eqtb[5704]._TAG._TAG1._int;
	if (help >= 0)
	{
	  firstwidth = help1 - help;
	  firstindent = help;
	}
	else
	{
	  firstwidth = help1 + help;
	  firstindent = 0;
	}
	secondwidth = help1;
	secondindent = 0;
      }
      else
      {
	help = eqtb[5718]._TAG._TAG1._int;
	help1 = eqtb[5704]._TAG._TAG1._int;
	firstwidth = help1;
	firstindent = 0;
	if (help >= 0L)
	{
	  secondwidth = help1 - help;
	  secondindent = help;
	}
	else
	{
	  secondwidth = help1 + help;
	  secondindent = 0;
	}
      }
    }
  else
  {
    lastspecialline = mem[eqtb[4056]._TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh - 1;
    memptr = &mem[eqtb[4056]._TAG._TAG3.hh.rh + lastspecialline + lastspecialline + 2 - C2_memmin];
    secondwidth = memptr->_TAG._TAG1._int;
    secondindent = (memptr-1)->_TAG._TAG1._int;
  }
  if (eqtb[5286]._TAG._TAG1._int == 0)
    easyline = lastspecialline;
  else
    easyline = 32767;
  threshold = eqtb[5267]._TAG._TAG1._int;
  if (threshold >= 0)
  {
#if defined(INITEX) || defined(TRIPTEX)
    if (eqtb[5299]._TAG._TAG1._int > 0)
    {
      F118_begindiagnostic ();
      F19_printnl (787);
    }
# endif
    secondpass = FALSE;
  }
  else
  {
    threshold = eqtb[5268]._TAG._TAG1._int;
    secondpass = TRUE;
#if defined(INITEX) || defined(TRIPTEX)
    if (eqtb[5299]._TAG._TAG1._int > 0)
      F118_begindiagnostic ();
# endif
  }
  while (TRUE)
  {
    q = F77_getnode (3L);
    memptr = &mem[q - C2_memmin];
    memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
    memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = 2;
#ifdef TRIPTEX
    memptr->_TAG._TAG3.hh.rh = 2993;
#else
    memptr->_TAG._TAG3.hh.rh = 29993;
#endif
    (memptr+1)->_TAG._TAG3.hh.rh = -32768;
    (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh = curlist.pgfield + 1;
    (memptr+2)->_TAG._TAG1._int = 0;
    m29993->_TAG._TAG3.hh.rh = q;
    *(sixword
#ifdef M_XENIX
near
#endif
*)(&activewidth[0]) = *(sixword
#ifdef M_XENIX
near
#endif
*)(&background[0]);
  /*  activewidth[0] = background[0];
    activewidth[1] = background[1];
    activewidth[2] = background[2];
    activewidth[3] = background[3];
    activewidth[4] = background[4];
    activewidth[5] = background[5]; */
    passive = -32768;
#ifdef TRIPTEX
    printednode = 2997;
#else
    printednode = 29997;
#endif
    passnumber = 0;
    fontinshortdisplay = 0;
    curp = m29997->_TAG._TAG3.hh.rh;
    autobreaking = TRUE;
    prevp = curp;
#ifdef TRIPTEX
    while ((curp != -32768) && (m29993->_TAG._TAG3.hh.rh != 2993))
#else
    while ((curp != -32768) && (m29993->_TAG._TAG3.hh.rh != 29993))
#endif
    {
      if (curp >= himemmin)
      {
	prevp = curp;
	do
	{
	  memhelp = mem[curp - C2_memmin];
	  f = memhelp._TAG._TAG3.hh._TAG._TAG2.b0;
	  activewidth[0] += fontinfo[widthbase[f] + fontinfo[charbase[f] + memhelp._TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq.b0]._TAG._TAG1._int;
	  curp = memhelp._TAG._TAG3.hh.rh;
	}
	while (curp >= himemmin);
      }
      memptr1 = &mem[curp - C2_memmin];
      switch (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0)
      {
	case 0: 
	case 1: 
	case 2: 
	  activewidth[0] += (memptr1+1)->_TAG._TAG1._int;
	  break;
	case 8: 
	  break;
	case 10: 
	  if (autobreaking)
	  {
	    if (prevp >= himemmin)
	      F253_trybreak (0L, 0);
	    else
	      if (mem[prevp - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 < 9)
		F253_trybreak (0L, 0);
	  }
	  if ((mem[(memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 != 0) && (mem[(memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh + 3 - C2_memmin]._TAG._TAG1._int != 0))
	    (memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh = F252_finiteshrink ((memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh);
	  q = (memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	  memptr = &mem[q - C2_memmin];
	  activewidth[0] += (memptr+1)->_TAG._TAG1._int;
	  activewidth[1 + memptr->_TAG._TAG3.hh._TAG._TAG2.b0] += (memptr+2)->_TAG._TAG1._int;
	  activewidth[5] += (memptr+3)->_TAG._TAG1._int;
	  if (secondpass && autobreaking)
	  {
	    s = memptr1->_TAG._TAG3.hh.rh;
	    if (s != -32768)
	    {
	      while (TRUE)
	      {
		memptr1 = &mem[s - C2_memmin];
		if (s >= himemmin)
		{
		  c = memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 + 128;
		  hf = memptr1->_TAG._TAG3.hh._TAG._TAG2.b0;
		}
		else
		  if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 6)
		  {
		    q = (memptr1+1)->_TAG._TAG3.hh.rh;
		    memptr = &mem[q - C2_memmin];
		    c = memptr->_TAG._TAG3.hh._TAG._TAG2.b1 + 128;
		    hf = memptr->_TAG._TAG3.hh._TAG._TAG2.b0;
		  }
		  else
		    if ((memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 11) && (memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 == 0))
		      c = 128;
		    else
		      if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 8)
			c = 128;
		      else
			goto _31;
		if (c < 128)
		  if (eqtb[4755 + c]._TAG._TAG3.hh.rh != 0)
		    if ((eqtb[4755 + c]._TAG._TAG3.hh.rh == c) || (eqtb[5305]._TAG._TAG1._int > 0))
		      goto _32;
		    else
		      goto _31;
		s = memptr1->_TAG._TAG3.hh.rh;
	      }
	  _32: 
	      hyfchar = hyphenchar[hf];
	      if ((hyfchar < 0L) || (hyfchar > 255L))
		goto _31;
	      ha = s;
	      hn = 0;
	      while (TRUE)
	      {
		memptr1 = &mem[s - C2_memmin];
		if (s >= himemmin)
		{
		  if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 != hf)
		    goto _33;
		  if ((c = memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 + 128) >= 128)
		    goto _33;
		  if ((eqtb[4755 + c]._TAG._TAG3.hh.rh == 0) || (hn == 63))
		    goto _33;
		  hb = s;
		  hu[++hn] = c;
		  hc[hn] = eqtb[4755 + c]._TAG._TAG3.hh.rh - 1;
		}
		else
		  if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 6)
		  {
		    j = hn;
		    q = (memptr1+1)->_TAG._TAG3.hh.rh;
		    if (mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 != hf)
		      goto _33;
		    do
		    {
		      memptr = &mem[q - C2_memmin];
		      if ((c = memptr->_TAG._TAG3.hh._TAG._TAG2.b1 + 128) >= 128)
			goto _33;
		      if ((eqtb[4755 + c]._TAG._TAG3.hh.rh == 0) || (j == 63))
			goto _33;
		      hu[++j] = c;
		      hc[j] = eqtb[4755 + c]._TAG._TAG3.hh.rh - 1;
		      q = memptr->_TAG._TAG3.hh.rh;
		    }
		    while (q != ((int)(-32768)));
		    hb = s;
		    hn = j;
		  }
		  else
		    if ((memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 != 11) || (memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 != 0))
		      goto _33;
		s = memptr1->_TAG._TAG3.hh.rh;
	      }
	  _33: 
	      if (hn < 5)
		goto _31;
	      while (TRUE)
	      {
		memhelp = mem[s - C2_memmin];
		if (s < himemmin)
		  switch (memhelp._TAG._TAG3.hh._TAG._TAG2.b0)
		  {
		    case 6: 
		      break;
		    case 11: 
		      if (memhelp._TAG._TAG3.hh._TAG._TAG2.b1 != 0)
			goto _34;
		      break;
		    case 8: 
		    case 10: 
		    case 12: 
		    case 3: 
		    case 5: 
		    case 4: 
		      goto _34;
		      break;
		    default: 
		      goto _31;
		      break;
		  }
		s = memhelp._TAG._TAG3.hh.rh;
	      }
	  _34: 
	      F256_hyphenate ();
	    }
	_31: 
	      ;
	    }
	  break;
	case 11: 
	  if ((memptr1->_TAG._TAG3.hh.rh < himemmin) && autobreaking)
	    if (mem[memptr1->_TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 10)
	      F253_trybreak (0L, 0);
	  activewidth[0] += (memptr1+1)->_TAG._TAG1._int;
	  break;
	case 6: 
	  f = (memptr1+1)->_TAG._TAG3.hh._TAG._TAG2.b0;
	  activewidth[0] += fontinfo[widthbase[f] + fontinfo[charbase[f] + (memptr1+1)->_TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq.b0]._TAG._TAG1._int;
	  break;
	case 7: 
	  {
	    s = (memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	    discwidth = 0;
	    if (s == -32768)
	      F253_trybreak (eqtb[5271]._TAG._TAG1._int, 1);
	    else
	    {
	      do
	      {
		memptr1 = &mem[s - C2_memmin];
		if (s >= himemmin)
		{
		  f = memptr1->_TAG._TAG3.hh._TAG._TAG2.b0;
		  discwidth += fontinfo[widthbase[f] + fontinfo[charbase[f] + memptr1->_TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq.b0]._TAG._TAG1._int;
		}
		else
		{
		  switch (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0)
		  {
		    case 6: 
		      {
			f = (memptr1+1)->_TAG._TAG3.hh._TAG._TAG2.b0;
			discwidth += fontinfo[widthbase[f] + fontinfo[charbase[f] + (memptr1+1)->_TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq.b0]._TAG._TAG1._int;
		      }
		      break;
		    case 0: 
		    case 1: 
		    case 2: 
		    case 11: 
		      discwidth += (memptr1+1)->_TAG._TAG1._int;
		      break;
		    default: 
		      F42_confusion (790);
		      break;
		  }
		}
		s = memptr1->_TAG._TAG3.hh.rh;
	      }
	      while (s != -32768);
	      activewidth[0] += discwidth;
	      F253_trybreak (eqtb[5270]._TAG._TAG1._int, 1);
	      activewidth[0] -= discwidth;
	    }
	  }
	  break;
	case 9: 
	  autobreaking = memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 == 1;
	  {
	    if ((memptr1->_TAG._TAG3.hh.rh < himemmin) && autobreaking)
	      if (mem[memptr1->_TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 10)
		F253_trybreak (0L, 0);
	    activewidth[0] += (memptr1+1)->_TAG._TAG1._int;
	  }
	  break;
	case 12: 
	  F253_trybreak ((memptr1+1)->_TAG._TAG1._int, 0);
	  break;
	case 4: 
	case 3: 
	case 5: 
	  break;
	default: 
	  F42_confusion (789);
	  break;
      }
      prevp = curp;
      curp = mem[curp - C2_memmin]._TAG._TAG3.hh.rh;
    }
    if (curp == -32768)
    {
      F253_trybreak (-10000L, 1);
#ifdef TRIPTEX
      if (m29993->_TAG._TAG3.hh.rh != 2993)
      {
	r = m29993->_TAG._TAG3.hh.rh;
#else
      if (m29993->_TAG._TAG3.hh.rh != 29993)
      {
	r = m29993->_TAG._TAG3.hh.rh;
#endif
	fewestdemerits = 1073741823;
	do
	{
	  memptr1 = &mem[r - C2_memmin];
	  if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 != 2)
	    if ((memptr1+2)->_TAG._TAG1._int < fewestdemerits)
	    {
	      fewestdemerits = (memptr1+2)->_TAG._TAG1._int;
	      bestbet = r;
	    }
	  r = memptr1->_TAG._TAG3.hh.rh;
	}
#ifdef TRIPTEX
	while (r != 2993);
#else
	while (r != 29993);
#endif
	bestline = mem[bestbet + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
	if (eqtb[5286]._TAG._TAG1._int == 0)
	  goto _30;
	{
	  r = m29993->_TAG._TAG3.hh.rh;
	  actuallooseness = 0;
	  do
	  {
	    memptr1 = &mem[r - C2_memmin];
	    if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 != 2)
	    {
	      linediff = (memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh - bestline;
	      if (((linediff < actuallooseness) && (eqtb[5286]._TAG._TAG1._int <= linediff)) || ((linediff > actuallooseness) && (eqtb[5286]._TAG._TAG1._int >= linediff)))
	      {
		bestbet = r;
		actuallooseness = linediff;
		fewestdemerits = (memptr1+2)->_TAG._TAG1._int;
	      }
	      else
		if ((linediff == actuallooseness) && ((memptr1+2)->_TAG._TAG1._int < fewestdemerits))
		{
		  bestbet = r;
		  fewestdemerits = (memptr1+2)->_TAG._TAG1._int;
		}
	    }
	    r = memptr1->_TAG._TAG3.hh.rh;
	  }
#ifdef TRIPTEX
	  while (r != 2993);
#else
	  while (r != 29993);
#endif
	  bestline = mem[bestbet + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
	}
	if ((actuallooseness == eqtb[5286]._TAG._TAG1._int) || secondpass)
	  goto _30;
      }
    }
    q = m29993->_TAG._TAG3.hh.rh;
#ifdef TRIPTEX
    while (q != 2993)
#else
    while (q != 29993)
#endif
    {
      memhelp = mem[q - C2_memmin];
      curp = memhelp._TAG._TAG3.hh.rh;
      if (memhelp._TAG._TAG3.hh._TAG._TAG2.b0 == 2)
	F78_freenode (q, 7);
      else
	F78_freenode (q, 3);
      q = curp;
    }
    q = passive;
    while (q != -32768)
    {
      curp = mem[q - C2_memmin]._TAG._TAG3.hh.rh;
      F78_freenode (q, 2);
      q = curp;
    }
#if defined(INITEX) || defined(TRIPTEX)
     if (eqtb[5299]._TAG._TAG1._int > 0)
      F19_printnl (788);
# endif
    threshold = eqtb[5268]._TAG._TAG1._int;
    secondpass = TRUE;
  }
_30: 
#if defined(INITEX) || defined(TRIPTEX)
  if (eqtb[5299]._TAG._TAG1._int > 0)
    F119_enddiagnostic (TRUE);
# endif
  F254_postlinebreak (finalwidowpenalty);
  q = m29993->_TAG._TAG3.hh.rh;
#ifdef TRIPTEX
  while (q != 2993)
#else
  while (q != 29993)
#endif
  {
    memhelp = mem[q - C2_memmin];
    curp = memhelp._TAG._TAG3.hh.rh;
    if (memhelp._TAG._TAG3.hh._TAG._TAG2.b0 == 2)
      F78_freenode (q, 7);
    else
      F78_freenode (q, 3);
    q = curp;
  }
  q = passive;
  while (q != ((int)(-32768)))
  {
    curp = mem[q - C2_memmin]._TAG._TAG3.hh.rh;
    F78_freenode (q, 2);
    q = curp;
  }
  packbeginline = 0;
}

void F258_newhyphexceptions ()
/**********************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register T46_hyphpointer h;
  register T29_smallnumber j;
  register T26_strnumber k;
  register T29_smallnumber n;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;
  register T26_strnumber s;
  register T26_strnumber t;
  register T25_poolpointer u;
  register T25_poolpointer v;
  register T37_memoryword memhelp;

  F158_scanleftbrace ();
  n = 0;
  p = (int)(-32768);
  while (TRUE)
  {
    F153_getxtoken (null);
_21: 
    switch (curcmd)
    {
      case 11: 
      case 12: 
      case 67: 
	if (curchr == 45)
	{
	  if (n > 1)
	  {
	    q = F75_getavail ();
	    memhelp._TAG._TAG3.hh.rh = p;
	    memhelp._TAG._TAG3.hh._TAG._TAG1.lh = n;
	    mem[q - C2_memmin] = memhelp;
	    p = q;
	  }
	}
	else
	{
	  if ((curchr > 127) || (eqtb[4755 + curchr]._TAG._TAG3.hh.rh == 0))
	  {
	    F19_printnl (134);
	    F17_print (797);
	    helpptr = 2;
	    helpline[1] = 798;
	    helpline[0] = 799;
	    F39_error ();
	  }
	  else
	    if (n < 63)
	      hc[n++] = eqtb[4755 + curchr]._TAG._TAG3.hh.rh - 1;
	}
	break;
      case 16: 
	F166_scancharnum ();
	curchr = curval;
	curcmd = 67;
	goto _21;
	break;
      case 10: 
      case 2: 
	{
	  if (n > 4)
	  {
	    if ((poolptr + n) > C15_poolsize)
	      F41_overflow (129, (long)C15_poolsize - initpoolptr);
	    h = 0;
	    for (j = 1; j <= n; j++)
	    {
	      h = (h + h + hc[j]) % 307;
	      strpool[poolptr++] = hc[j];
	    }
	    s = F54_makestring ();
	    while (TRUE)
	    {
	      if (p == ((int)(-32768)))
		goto _30;
	      memptr = &mem[p - C2_memmin];
	      if (memptr->_TAG._TAG3.hh._TAG._TAG1.lh < (n - 2))
		goto _30;
	      q = memptr->_TAG._TAG3.hh.rh;
	      memptr->_TAG._TAG3.hh.rh = avail;
	      avail = p;
#if defined(INITEX) || defined(TRIPTEX)
	      dynused--;
# endif
	      p = q;
	    }
	_30: 
	    if (hyphcount == 307)
	      F41_overflow (800, 307L);
	    hyphcount++;
	    while (hyphword[h] != 0)
	    {
	      long help3;
	      k = hyphword[h];
	      if ((strstart[k + 1] - strstart[k]) < (strstart[s + 1] - strstart[s]))
		goto _40;
	      if ((strstart[k + 1] - strstart[k]) > (strstart[s + 1] - strstart[s]))
		goto _45;
	      u = strstart[k];
	      v = strstart[s];
	      help3 = strstart[k + 1];
	      do
	      {
		if (strpool[u] < strpool[v])
		  goto _40;
		if (strpool[u] > strpool[v])
		  goto _45;
		u++;
		v++;
	      }
	      while (u != help3);
	  _40: 
	      q = hyphlist[h];
	      hyphlist[h] = p;
	      p = q;
	      t = hyphword[h];
	      hyphword[h] = s;
	      s = t;
	  _45: 
	      if (h > 0)
		h--;
	      else
		h = 307;
	    }
	    hyphword[h] = s;
	    hyphlist[h] = p;
	  }
	  if (curcmd == 2)
	    return;
	  n = 0;
	  p = (int)(-32768);
	}
	break;
      default: 
	{
	  F19_printnl (134);
	  F17_print (536);
	  F20_printesc (793);
	  F17_print (794);
	  helpptr = 2;
	  helpline[1] = 795;
	  helpline[0] = 796;
	  F39_error ();
	}
	break;
    }
  }
}

#if defined(INITEX) || defined(TRIPTEX)
T31_quarterword F259_newtrieop (d, n, v)
/***********************************/
T29_smallnumber d;
T29_smallnumber n;
T31_quarterword v;
{
  int   h;
  T31_quarterword u;

  h = (int)LABS ((long)n + 313L * (long)d + 361L * (long)v) % 510;
  while (TRUE)
  {
    u = trieophash[h];
    if (u == (-128))
    {
      if (trieopptr == 127)
	return(-128);
      hyfdistance[++trieopptr + 128] = d;
      hyfnum[trieopptr + 128] = n;
      hyfnext[trieopptr + 128] = v;
      trieophash[h] = trieopptr;
      return(trieopptr);
    }
    if (((hyfdistance[u + 128] == d) && (hyfnum[u + 128] == n)) && (hyfnext[u + 128] == v))
      return(u);
    if (h > 0)
      h--;
    else
      h = 510;
  }
}

T45_triepointer F260_trienode (p)
/******************************/
T45_triepointer p;
{
  T45_triepointer h;
  T45_triepointer q;

  h = (int)(LABS ((long)triec[p] + 1009L * (long)trieo[p] + 2718L * (long)triel[p] + 3142L * (long)trier[p]) % C17_triesize);
  while (TRUE)
  {
    q = triehash[h];
    if (q == 0)
    {
      triehash[h] = p;
      return(p);
    }
    if ((((triec[q] == triec[p]) && (trieo[q] == trieo[p])) && (triel[q] == triel[p])) && (trier[q] == trier[p]))
      return(q);
    if (h > 0)
      h--;
    else
      h = C17_triesize;
  }
}

T45_triepointer F261_compresstrie (p)
/**********************************/
T45_triepointer p;
{
  if (p == 0)
    return(0);
  else
  {
    triel[p] = F261_compresstrie (triel[p]);
    trier[p] = F261_compresstrie (trier[p]);
    return(F260_trienode (p));
  }
}

void F262_initpatternmemory ()
/**********************/
{
  int   h;
  T45_triepointer p;

  for (h = 0; h <= 510; h++)
    trieophash[h] = (char)(-128);
  trieopptr = -128;
  triel[0] = 0;
  triec[0] = 0;
  trieptr = 0;
  for (p = 0; p <= C17_triesize; p++)
    triehash[p] = (char)0;
}

void F263_inittriememory ()
/*******************/
{
  T45_triepointer p;

  for (p = 0; p <= trieptr; p++)
    triehash[p] = 0;
  triemax = 128;
  triemin = 128;
  trie[0].rh = 1;
  trietaken[0] = FALSE;
  for (p = 1; p <= 128; p++)
  {
    trie[p]._TAG._TAG1.lh = p - 1;
    trie[p].rh = p + 1;
    trietaken[p] = FALSE;
  }
}

void F264_firstfit (p)
/**************/
T45_triepointer p;
{
  T21_asciicode c;
  T45_triepointer h;
  T45_triepointer q;
  T45_triepointer z;

  c = triec[p];
  if (c < triemin)
    triemin = c;
  z = trie[triemin - 1].rh;
  while (TRUE)
  {
    if (z < c)
      goto _45;
    h = z - c;
    if (triemax < (h + 128))
    {
      if (C17_triesize <= (h + 128))
	F41_overflow (801, (long)C17_triesize);
      do
      {
	trietaken[++triemax] = FALSE;
	trie[triemax].rh = triemax + 1;
	trie[triemax]._TAG._TAG1.lh = triemax - 1;
      }
      while (triemax != (h + 128));
    }
    if (trietaken[h])
      goto _45;
    q = trier[p];
    while (q > 0)
    {
      if (trie[h + triec[q]].rh == 0)
	goto _45;
      q = trier[q];
    }
    goto _40;
_45: 
    z = trie[z].rh;
  }
_40: 
  trietaken[h] = TRUE;
  triehash[p] = h;
  q = p;
  do
  {
    z = h + triec[q];
    trie[trie[z].rh]._TAG._TAG1.lh = trie[z]._TAG._TAG1.lh;
    trie[trie[z]._TAG._TAG1.lh].rh = trie[z].rh;
    trie[z].rh = 0;
    q = trier[q];
  }
  while (q != 0);
}

void F265_triepack (p)
/**************/
T45_triepointer p;
{
  T45_triepointer q;

  do
  {
    q = triel[p];
    if ((q > 0) && (triehash[q] == 0))
    {
      F264_firstfit (q);
      F265_triepack (q);
    }
    p = trier[p];
  }
  while (p != 0);
}

void F266_triefix (p)
/*************/
T45_triepointer p;
{
  T21_asciicode c;
  T45_triepointer q;
  T45_triepointer z;

  z = triehash[p];
  while (p != 0)
  {
    q = triel[p];
    c = triec[p];
    trie[z + c].rh = triehash[q];
    trie[z + c]._TAG._TAG2.b1 = c;
    trie[z + c]._TAG._TAG2.b0 = trieo[p];
    if (q > 0)
      F266_triefix (q);
    p = trier[p];
  }
}

void F267_newpatterns ()
/****************/
{
  T21_asciicode c;
  BOOLEAN digitsensed;
  BOOLEAN firstchild;
  T35_twohalves h;
  T29_smallnumber k;
  T29_smallnumber l;
  T45_triepointer p;
  T45_triepointer q;
  T45_triepointer r;
  T45_triepointer s;
  T31_quarterword v;

  F158_scanleftbrace ();
  F262_initpatternmemory ();
  k = 0;
  hyf[0] = 0;
  digitsensed = FALSE;
  while (TRUE)
  {
    F153_getxtoken (null);
    switch (curcmd)
    {
      case 11: 
      case 12: 
	if ((digitsensed || (curchr < 48)) || (curchr > 57))
	{
	  if (curchr == 46)
	    curchr = 128;
	  else
	  {
	    curchr = eqtb[4755 + curchr]._TAG._TAG3.hh.rh;
	    if (curchr == 0)
	    {
	      F19_printnl (134);
	      F17_print (805);
	      helpptr = 1;
	      helpline[0] = 804;
	      F39_error ();
	      curchr = 128;
	    }
	  }
	  if (k < 63)
	  {
	    hc[++k] = curchr - 1;
	    hyf[k] = 0;
	    digitsensed = FALSE;
	  }
	}
	else
	{
	  hyf[k] = curchr - 48;
	  if (k < 63)
	    digitsensed = TRUE;
	}
	break;
      case 10: 
      case 2: 
	{
	  if (k > 0)
	  {
	    if (hc[1] == 127)
	      hyf[0] = 0;
	    if (hc[k] == 127)
	      hyf[k] = 0;
	    l = k;
	    v = -128;
	    while (TRUE)
	    {
	      if (hyf[l] != 0)
		v = F259_newtrieop (k - l, hyf[l], (char)v);
	      if (l > 0)
		l--;
	      else
		goto _31;
	    }
	_31: 
	    q = 0;
	    while (l < k)
	    {
	      c = hc[++l];
	      p = triel[q];
	      firstchild = TRUE;
	      while ((p > 0) && (c > triec[p]))
	      {
		q = p;
		p = trier[q];
		firstchild = FALSE;
	      }
	      if ((p == 0) || (c < triec[p]))
	      {
		if (trieptr == C17_triesize)
		  F41_overflow (801, (long)C17_triesize);
		trier[++trieptr] = p;
		p = trieptr;
		triel[p] = 0;
		if (firstchild)
		  triel[q] = p;
		else
		  trier[q] = p;
		triec[p] = c;
		trieo[p] = -128;
	      }
	      q = p;
	    }
	    if (trieo[q] != (-128))
	    {
	      F19_printnl (134);
	      F17_print (806);
	      helpptr = 1;
	      helpline[0] = 804;
	      F39_error ();
	    }
	    trieo[q] = v;
	  }
	  if (curcmd == 2)
	    goto _30;
	  k = 0;
	  hyf[0] = 0;
	  digitsensed = FALSE;
	}
	break;
      default: 
	{
	  F19_printnl (134);
	  F17_print (802);
	  F20_printesc (803);
	  helpptr = 1;
	  helpline[0] = 804;
	  F39_error ();
	}
	break;
    }
  }
_30: 
  triel[0] = F261_compresstrie (triel[0]);
  F263_inittriememory ();
  if (triel[0] != 0)
  {
    F264_firstfit (triel[0]);
    F265_triepack (triel[0]);
  }
  r = 0;
  while (trietaken[r])
    r++;
  triehash[0] = r;
  F266_triefix (triel[0]);
  r = 0;
  h.rh = 0;
  h._TAG._TAG2.b0 = -128;
  h._TAG._TAG2.b1 = 0;
  do
  {
    s = trie[r].rh;
    trie[r]=h;
    r = s;
  }
  while (r <= triemax);
}
# endif

int /* was T32_halfword */ F268_prunepagetop (p)
/*******************************/
register int /* was T32_halfword */ p;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register int /* was T32_halfword */ prevp;
  register int /* was T32_halfword */ q;

#ifdef TRIPTEX
  prevp = 2997;
#else
  prevp = 29997;
#endif
  m29997->_TAG._TAG3.hh.rh = p;
  while (p != ((int)(-32768)))
  {
    memptr = &mem[p - C2_memmin];
    switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b0)
    {
      case 0: 
      case 1: 
      case 2: 
	{
	  q = F88_newskipparam (10);
	  mem[prevp - C2_memmin]._TAG._TAG3.hh.rh = q;
	  mem[q - C2_memmin]._TAG._TAG3.hh.rh = p;
	  memptr1 = &mem[tempptr + 1 - C2_memmin];
	  if (memptr1->_TAG._TAG1._int > (memptr+3)->_TAG._TAG1._int)
	    memptr1->_TAG._TAG1._int -= (memptr+3)->_TAG._TAG1._int;
	  else
	    memptr1->_TAG._TAG1._int = 0;
	  p = (int)(-32768);
	}
	break;
      case 8: 
      case 4: 
      case 3: 
	{
	  prevp = p;
	  p = memptr->_TAG._TAG3.hh.rh;
	}
	break;
      case 10: 
      case 11: 
      case 12: 
	{
	  q = p;
	  p = memptr->_TAG._TAG3.hh.rh;
	  mem[q - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
	  mem[prevp - C2_memmin]._TAG._TAG3.hh.rh = p;
	  F109_flushnodelist (q);
	}
	break;
      default: 
	F42_confusion (807);
	break;
    }
  }
  return(m29997->_TAG._TAG3.hh.rh);
}

int /* was T32_halfword */ F269_vertbreak (p, h, d)
/********************************/
register int /* was T32_halfword */ p;
register long int   h;
register long int   d;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register long int   b;
  register int /* was T32_halfword */ bestplace;
  register long int   leastcost;
  register long int   pi;
  register long int   prevdp;
  register int /* was T32_halfword */ prevp;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
  register T29_smallnumber t;

  prevp = p;
  leastcost = 1073741823;
  activewidth[0] = activewidth[1] = activewidth[2] = activewidth[3] = activewidth[4] = activewidth[5] = 0;
  prevdp = 0;
  while (TRUE)
  {
    if (p == ((int)(-32768)))
      pi = -10000;
    else
    {
      memptr = &mem[p - C2_memmin];
      switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b0)
      {
	case 0: 
	case 1: 
	case 2: 
	  activewidth[0] += prevdp + (memptr+3)->_TAG._TAG1._int;
	  prevdp = (memptr+2)->_TAG._TAG1._int;
	  goto _45;
	  break;
	case 8: 
	  goto _45;
	  break;
	case 10: 
	  if (mem[prevp - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 < 9)
	    pi = 0;
	  else
	    goto _90;
	  break;
	case 11: 
	  if (memptr->_TAG._TAG3.hh.rh == ((int)(-32768)))
	    t = 12;
	  else
	    t = mem[memptr->_TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0;
	  if (t == 10)
	    pi = 0;
	  else
	    goto _90;
	  break;
	case 12: 
	  pi = (memptr+1)->_TAG._TAG1._int;
	  break;
	case 4: 
	case 3: 
	  goto _45;
	  break;
	default: 
	  F42_confusion (808);
	  break;
      }
    }
    if (pi < 10000L)
    {
      if (activewidth[0] < h)
	if (((activewidth[2] != 0) || (activewidth[3] != 0)) || (activewidth[4] != 0))
	  b = 0;
	else
	  b = F71_badness (h - activewidth[0], activewidth[1]);
      else
	if ((activewidth[0] - h) > activewidth[5])
	  b = 1073741823;
	else
	  b = F71_badness (activewidth[0] - h, activewidth[5]);
      if (b < 1073741823)
	if (pi <= (-10000L))
	  b = pi;
	else
	  if (b < 10000)
	    b += pi;
	  else
	    b = 100000;
      if (b <= leastcost)
      {
	bestplace = p;
	leastcost = b;
	bestheightplusdepth = activewidth[0] + prevdp;
      }
      if ((b == 1073741823) || (pi <= (-10000)))
	return(bestplace);
    }
    {
      register int shelp;

      if (((shelp=mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0) < 10) || (shelp > 11))
	goto _45;
    }
_90: 
    if (mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 11)
      q = p;
    else
    {
      q = mem[p + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
      memptr = &mem[q - C2_memmin];
      activewidth[1 + memptr->_TAG._TAG3.hh._TAG._TAG2.b0] += (memptr+2)->_TAG._TAG1._int;
      activewidth[5] += (memptr+3)->_TAG._TAG1._int;
      if ((memptr->_TAG._TAG3.hh._TAG._TAG2.b1 != 0) && ((memptr+3)->_TAG._TAG1._int != 0))
      {
	F19_printnl (134);
	F17_print (809);
	helpptr = 4;
	helpline[3] = 810;
	helpline[2] = 811;
	helpline[1] = 812;
	helpline[0] = 776;
	F39_error ();
	r = F85_newspec (q);
	mem[r - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 = 0;
	F108_deleteglueref (q);
	mem[p + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = r;
      }
    }
    activewidth[0] += prevdp + mem[q + 1 - C2_memmin]._TAG._TAG1._int;
    prevdp = 0;
_45: 
    if (prevdp > d)
    {
      activewidth[0] += prevdp - d;
      prevdp = d;
    }
    prevp = p;
    p = mem[prevp - C2_memmin]._TAG._TAG3.hh.rh;
  }
  return(bestplace);
}

int /* was T32_halfword */ F270_vsplit (n, h)
/***************************/
#ifdef VAX
register int n;
#else
register T22_eightbits n;
#endif
long int   h;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ v;

  v = eqtb[4322 + n]._TAG._TAG3.hh.rh;
  if (curmark[3] != ((int)(-32768)))
  {
    F107_deletetokenref (curmark[3]);
    curmark[3] = (int)(-32768);
    F107_deletetokenref (curmark[4]);
    curmark[4] = (int)(-32768);
  }
  if (v == ((int)(-32768)))
  {
    return((int)(-32768));
  }
  memptr = &mem[v - C2_memmin];
  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 != 1)
  {
    F19_printnl (134);
    F17_print (207);
    F20_printesc (813);
    F17_print (814);
    F20_printesc (815);
    helpptr = 2;
    helpline[1] = 816;
    helpline[0] = 817;
    F39_error ();
    return((int)(-32768));
  }
  q = F269_vertbreak ((memptr+5)->_TAG._TAG3.hh.rh, h, eqtb[5707]._TAG._TAG1._int);
  p = (memptr+5)->_TAG._TAG3.hh.rh;
  if (p == q)
    (memptr+5)->_TAG._TAG3.hh.rh = (int)(-32768);
  else
    while (TRUE)
    {
      memptr1 = &mem[p - C2_memmin];
      if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 4)
	if (curmark[3] == ((int)(-32768)))
	{
	  curmark[3] = (memptr1+1)->_TAG._TAG1._int;
	  curmark[4] = curmark[3];
	  mem[curmark[3] - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh += 2;
	}
	else
	{
	  F107_deletetokenref (curmark[4]);
	  curmark[4] = (memptr1+1)->_TAG._TAG1._int;
	  mem[curmark[4] - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh++;
	}
      if (memptr1->_TAG._TAG3.hh.rh == q)
      {
	memptr1->_TAG._TAG3.hh.rh = (int)(-32768);
	goto _30;
      }
      p = memptr1->_TAG._TAG3.hh.rh;
    }
_30: 
  q = F268_prunepagetop (q);
  p = (memptr+5)->_TAG._TAG3.hh.rh;
  F78_freenode (v, 7);
  if (q == ((int)(-32768)))
    eqtb[4322 + n]._TAG._TAG3.hh.rh = (int)(-32768);
  else
    eqtb[4322 + n]._TAG._TAG3.hh.rh = F209_vpackage (q, 0L, 1, 1073741823);
  return(F209_vpackage (p, h, 0, eqtb[5707]._TAG._TAG1._int));
}

void F114_printtotals ()
/****************/
{
  F67_printscaled (pagesofar[1]);
  if (pagesofar[2] != 0)
  {
    F17_print (182);
    F67_printscaled (pagesofar[2]);
    F17_print (207);
  }
  if (pagesofar[3] != 0)
  {
    F17_print (182);
    F67_printscaled (pagesofar[3]);
    F17_print (181);
  }
  if (pagesofar[4] != 0)
  {
    F17_print (182);
    F67_printscaled (pagesofar[4]);
    F17_print (826);
  }
  if (pagesofar[5] != 0)
  {
    F17_print (182);
    F67_printscaled (pagesofar[5]);
    F17_print (827);
  }
  if (pagesofar[6] != 0)
  {
    F17_print (183);
    F67_printscaled (pagesofar[6]);
  }
}

void F271_freezepagespecs (s)
/*********************/
T29_smallnumber s;
{
  pagecontents = s;
  pagesofar[0] = eqtb[5705]._TAG._TAG1._int;
  pagemaxdepth = eqtb[5706]._TAG._TAG1._int;
  pagesofar[7] = pagesofar[1] = pagesofar[2] = pagesofar[3] = pagesofar[4] = pagesofar[5] = pagesofar[6] = 0;
  leastpagecost = 1073741823;
#if defined(INITEX) || defined(TRIPTEX)
  if (eqtb[5300]._TAG._TAG1._int > 0L)
  {
    F118_begindiagnostic ();
    F19_printnl (835);
    F67_printscaled (pagesofar[0]);
    F17_print (836);
    F67_printscaled (pagemaxdepth);
    F119_enddiagnostic (FALSE);
  }
# endif
}

void F272_boxerror (n)
/**************/
#ifdef VAX
register int n;
#else
register T22_eightbits n;
#endif
{
  F39_error ();
  F118_begindiagnostic ();
  F19_printnl (689);
  F106_showbox (eqtb[4322 + n]._TAG._TAG3.hh.rh);
  F119_enddiagnostic (TRUE);
  F109_flushnodelist (eqtb[4322 + n]._TAG._TAG3.hh.rh);
  eqtb[4322 + n]._TAG._TAG3.hh.rh = (int)(-32768);
}

void F273_ensurevbox (n)
/****************/
T22_eightbits n;
{
  register int /* was T32_halfword */ p;

  p = eqtb[4322 + n]._TAG._TAG3.hh.rh;
  if (p != ((int)(-32768)))
    if (mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 0)
    {
      F19_printnl (134);
      F17_print (837);
      helpptr = 3;
      helpline[2] = 838;
      helpline[1] = 839;
      helpline[0] = 840;
      F272_boxerror ((T22_eightbits)n);
    }
}

void F274_fireup (c)
/************/
int /* was T32_halfword */ c;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1, huge *memptr2;
#else
  register T37_memoryword *memptr,*memptr1,*memptr2;
#endif
  register int   n;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ prevp;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
  register int /* was T32_halfword */ s;
  register int /* was T32_halfword */ savesplittopskip;
  register long int   savevbadness;
  register long int   savevfuzz;
  register BOOLEAN wait;

  if (mem[bestpagebreak - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 12)
  {
    F131_geqworddefine (5306, mem[bestpagebreak + 1 - C2_memmin]._TAG._TAG1._int);
    mem[bestpagebreak + 1 - C2_memmin]._TAG._TAG1._int = 10000;
  }
  else
    F131_geqworddefine (5306, 10000L);
  if (curmark[2] != ((int)(-32768)))
  {
    if (curmark[0] != ((int)(-32768)))
      F107_deletetokenref (curmark[0]);
    curmark[0] = curmark[2];
    mem[curmark[0] - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh++;
    F107_deletetokenref (curmark[1]);
    curmark[1] = (int)(-32768);
  }
  if (c == bestpagebreak)
    bestpagebreak = (int)(-32768);
  if (eqtb[4577]._TAG._TAG3.hh.rh != ((int)(-32768)))
  {
    F19_printnl (134);
    F17_print (207);
    F20_printesc (275);
    F17_print (851);
    helpptr = 2;
    helpline[1] = 852;
    helpline[0] = 840;
    F272_boxerror ((T22_eightbits)255);
  }
  insertpenalties = 0;
  savesplittopskip = eqtb[3536]._TAG._TAG3.hh.rh;
  r = m30000->_TAG._TAG3.hh.rh;
#ifdef TRIPTEX
  while (r != 3000)
#else
  while (r != 30000)
#endif
  {
    memptr = &mem[r - C2_memmin];
    if ((memptr+2)->_TAG._TAG3.hh._TAG._TAG1.lh != ((int)(-32768)))
    {
      n = memptr->_TAG._TAG3.hh._TAG._TAG2.b1 + 128;
      F273_ensurevbox ((T22_eightbits)n);
      if (eqtb[4322 + n]._TAG._TAG3.hh.rh == ((int)(-32768)))
	eqtb[4322 + n]._TAG._TAG3.hh.rh = F80_newnullbox ();
      p = eqtb[4322 + n]._TAG._TAG3.hh.rh + 5;
      {
	register int shelp;
	while ((shelp=mem[p - C2_memmin]._TAG._TAG3.hh.rh) != ((int)(-32768)))
	  p = shelp;
      }
      (memptr+2)->_TAG._TAG3.hh.rh = p;
    }
    r = memptr->_TAG._TAG3.hh.rh;
  }
#ifdef TRIPTEX
  q = 2996;
  m29996->_TAG._TAG3.hh.rh = (int)(-32768);
  prevp = 2998;
#else
  q = 29996;
  m29996->_TAG._TAG3.hh.rh = (int)(-32768);
  prevp = 29998;
#endif
  p = mem[prevp - C2_memmin]._TAG._TAG3.hh.rh;
  while (p != bestpagebreak)
  {
    memptr = &mem[p - C2_memmin];
    if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 3)
    {
      r = m30000->_TAG._TAG3.hh.rh;
      memptr1 = &mem[r - C2_memmin];
      while (memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 != memptr->_TAG._TAG3.hh._TAG._TAG2.b1)
      {
	r = memptr1->_TAG._TAG3.hh.rh;
	memptr1 = &mem[r - C2_memmin];
      }
      if ((memptr1+2)->_TAG._TAG3.hh._TAG._TAG1.lh == ((int)(-32768)))
	wait = TRUE;
      else
      {
	wait = FALSE;
	s = (memptr+4)->_TAG._TAG3.hh._TAG._TAG1.lh;
	mem[(memptr1+2)->_TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh.rh = s;
	s = (memptr1+2)->_TAG._TAG3.hh.rh;
	if ((memptr1+2)->_TAG._TAG3.hh._TAG._TAG1.lh == p)
	{
	  if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
	    if (((memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh == p) && ((memptr1+1)->_TAG._TAG3.hh.rh != ((int)(-32768))))
	    {
	      {
		register int shelp;
		while ((shelp=mem[s - C2_memmin]._TAG._TAG3.hh.rh) != (memptr1+1)->_TAG._TAG3.hh.rh)
		  s = shelp;
	      }
	      eqtb[3536]._TAG._TAG3.hh.rh = (memptr+4)->_TAG._TAG3.hh.rh;
	      (memptr+4)->_TAG._TAG3.hh._TAG._TAG1.lh = F268_prunepagetop ((memptr1+1)->_TAG._TAG3.hh.rh);
	      if ((memptr+4)->_TAG._TAG3.hh._TAG._TAG1.lh != ((int)(-32768)))
	      {
		tempptr = F209_vpackage ((memptr+4)->_TAG._TAG3.hh._TAG._TAG1.lh, 0L, 1, 1073741823);
		memptr2 = &mem[tempptr + 2 - C2_memmin];
		(memptr+3)->_TAG._TAG1._int = (memptr2+1)->_TAG._TAG1._int + memptr2->_TAG._TAG1._int;
		F78_freenode (tempptr, 7);
		wait = TRUE;
	      }
	      mem[s - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
	    }
	  (memptr1+2)->_TAG._TAG3.hh._TAG._TAG1.lh = (int)(-32768);
	  n = memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 + 128;
	  tempptr = mem[eqtb[4322 + n]._TAG._TAG3.hh.rh + 5 - C2_memmin]._TAG._TAG3.hh.rh;
	  F78_freenode (eqtb[4322 + n]._TAG._TAG3.hh.rh, 7);
	  eqtb[4322 + n]._TAG._TAG3.hh.rh = F209_vpackage (tempptr, 0L, 1, 1073741823);
	}
	else
	{
	  register int shelp;
	  while ((shelp=mem[s - C2_memmin]._TAG._TAG3.hh.rh) != ((int)(-32768)))
	    s = shelp;
	  (memptr1+2)->_TAG._TAG3.hh.rh = s;
	}
      }
      mem[prevp - C2_memmin]._TAG._TAG3.hh.rh = memptr->_TAG._TAG3.hh.rh;
      memptr->_TAG._TAG3.hh.rh = (int)(-32768);
      if (wait)
      {
	mem[q - C2_memmin]._TAG._TAG3.hh.rh = p;
	q = p;
	insertpenalties++;
      }
      else
      {
	F108_deleteglueref ((memptr+4)->_TAG._TAG3.hh.rh);
	F78_freenode (p, 5);
      }
      p = prevp;
    }
    else
      if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 4)
      {
	if (curmark[1] == ((int)(-32768)))
	{
	  curmark[1] = (memptr+1)->_TAG._TAG1._int;
	  mem[curmark[1] - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh++;
	}
	if (curmark[2] != -32768)
	  F107_deletetokenref (curmark[2]);
	curmark[2] = (memptr+1)->_TAG._TAG1._int;
	mem[curmark[2] - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh++;
      }
    prevp = p;
    p = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
  }
  eqtb[3536]._TAG._TAG3.hh.rh = savesplittopskip;
  if (p != ((int)(-32768)))
  {
    if (m29999->_TAG._TAG3.hh.rh == ((int)(-32768)))
      if (nestptr == 0)
	curlist.tailfield = pagetail;
      else
	nest[0].tailfield = pagetail;
    mem[pagetail - C2_memmin]._TAG._TAG3.hh.rh = m29999->_TAG._TAG3.hh.rh;
    m29999->_TAG._TAG3.hh.rh = p;
    mem[prevp - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
  }
  savevbadness = eqtb[5294]._TAG._TAG1._int;
  eqtb[5294]._TAG._TAG1._int = 10000;
  savevfuzz = eqtb[5710]._TAG._TAG1._int;
  eqtb[5710]._TAG._TAG1._int = 1073741823;
  eqtb[4577]._TAG._TAG3.hh.rh = F209_vpackage (m29998->_TAG._TAG3.hh.rh, bestsize, 0, pagemaxdepth);
  eqtb[5294]._TAG._TAG1._int = savevbadness;
  eqtb[5710]._TAG._TAG1._int = savevfuzz;
  if (lastglue != 32767)
    F108_deleteglueref (lastglue);
  pagecontents = 0;
#ifdef TRIPTEX
  pagetail = 2998;
#else
  pagetail = 29998;
#endif
  m29998->_TAG._TAG3.hh.rh = (int)(-32768);
  lastglue = 32767;
  lastpenalty = 0;
  lastkern = 0;
  pagesofar[7] = 0;
  pagemaxdepth = 0;
#ifdef TRIPTEX
  if (q != 2996)
  {
#else
  if (q != 29996)
  {
#endif
    m29998->_TAG._TAG3.hh.rh = m29996->_TAG._TAG3.hh.rh;
    pagetail = q;
  }
  r = m30000->_TAG._TAG3.hh.rh;
#ifdef TRIPTEX
  while (r != 3000)
#else
  while (r != 30000)
#endif
  {
    q = mem[r - C2_memmin]._TAG._TAG3.hh.rh;
    F78_freenode (r, 4);
    r = q;
  }
#ifdef TRIPTEX
  m30000->_TAG._TAG3.hh.rh = 3000;
#else
  m30000->_TAG._TAG3.hh.rh = 30000;
#endif
  if ((curmark[0] != -32768) && (curmark[1] == -32768))
  {
    curmark[1] = curmark[0];
    mem[curmark[0] - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh++;
  }
  if (eqtb[4057]._TAG._TAG3.hh.rh != ((int)(-32768)))
    if (deadcycles >= eqtb[5307]._TAG._TAG1._int)
    {
      F19_printnl (134);
      F17_print (853);
      F22_printint ((long)deadcycles);
      F17_print (854);
      helpptr = 3;
      helpline[2] = 855;
      helpline[1] = 856;
      helpline[0] = 857;
      F39_error ();
    }
    else
    {
      outputactive = TRUE;
      deadcycles++;
      F112_pushnest ();
      curlist.modefield = -1;
      curlist.auxfield = -65536000;
      curlist.mlfield = -line;
      F140_begintokenlist (eqtb[4057]._TAG._TAG3.hh.rh, (char)6);
      F125_newsavelevel (8);
      F241_normalparagraph ();
      F158_scanleftbrace ();
      return;
    }
  {
    if (m29998->_TAG._TAG3.hh.rh != ((int)(-32768)))
    {
      if (m29999->_TAG._TAG3.hh.rh == ((int)(-32768)))
	if (nestptr == 0)
	  curlist.tailfield = pagetail;
	else
	  nest[0].tailfield = pagetail;
      else
	mem[pagetail - C2_memmin]._TAG._TAG3.hh.rh = m29999->_TAG._TAG3.hh.rh;
      m29999->_TAG._TAG3.hh.rh = m29998->_TAG._TAG3.hh.rh;
      m29998->_TAG._TAG3.hh.rh = (int)(-32768);
#ifdef TRIPTEX
      pagetail = 2998;
#else
      pagetail = 29998;
#endif
    }
    F206_shipout (eqtb[4577]._TAG._TAG3.hh.rh);
    eqtb[4577]._TAG._TAG3.hh.rh = (int)(-32768);
  }
}
