/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1992 by Xerox Corporation.  All rights reserved. */
/* time: July 22, 1992 2:39:29 pm PDT */
/* C2C version: October 16, 1990 (native) */
/* ref-counting: off */
/* file: PriorityQueueImpl, module: PriorityQueueImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
static char versionStamp[] = "@(#)mob←version [1120835715,625239706] PriorityQueueImpl";
typedef unsigned word, *ptr;
typedef unsigned char byte, *bPt;
typedef unsigned short half, *hPt;
typedef word (*fPt)();
typedef struct {word f0, f1, f2, f3, f4, f5;} W6;
#define SOURCE(p, l) /* source p, l */
#define BCK(idx, lim) ( ((unsigned) idx) >= ((unsigned) lim) ? (XR←RaiseBoundsFault()) : (idx) )
#define SGNCK(i) ((int) (word) (i) < 0 ? XR←RaiseArithmeticFault(): i )
static void NoName←Q1080();
static void PriorityQueueImpl←P0();
static word IsPriorityQueue←P60();
static word Create←P120();
static word Predict←P180();
static word Top←P240();
static word Size←P300();
static word Empty←P360();
static void Insert←P420();
static word Remove←P480();
static word Copy←P540();
static word NoName←Q1140();
static void NoName←Q1200();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\222\262\322\070\300\022\075\041\222\100\164\000\000"};
static struct {unsigned f; char r[4];} string2 = {196611, "\004@\240"};
static struct {unsigned f; char r[16];} string3 = {851984, "\257\300\222\262\322\070\300\022\075\041\222\100\200\000\000"};
static struct {unsigned f; char r[12];} string4 = {524296, "\011\000\004\000\040\000\004\001\000\000\000"};
static struct {unsigned f; char r[16];} string5 = {851984, "\257\300\102\316\230\203\300\045\104\146\232\100\164\000\000"};
static struct {unsigned f; char r[16];} string6 = {851984, "\257\300\222\262\322\070\300\022\075\041\222\100\150\000\000"};
static struct {
   word f0[8]; word f8; word f9; word f10; 
   word f11; word f12; word f13; word f14; 
   word f15; word f16; word f17; word f18; 
   word f19; word f20; word f21; word f22; 
   word f23; word f24; word f25; word f26; 
   word f27[2]; 
   } globalframe = {
   {0}, (word) Copy←P540, 0, (word) Remove←P480, 
   0, (word) Insert←P420, 0, (word) Empty←P360, 
   0, (word) Size←P300, 0, (word) Top←P240, 
   0, (word) Predict←P180, 0, (word) Create←P120, 
   0, (word) IsPriorityQueue←P60, 0, (word) PriorityQueueImpl←P0, 
   {0}
   };

static void NoName←Q1080()
   {
   register ptr gf←c093 =  (ptr) &globalframe;
   word var←c6776;
   (* (( (ptr) gf←c093)+4) ) = (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2);
   (* (( (ptr) gf←c093)+5) ) = (word) XR←GetTypeIndex((word) &string3, 0, (word) &string4);
   (void) XR←DeclareGlobalFrame((word) "PriorityQueueImpl", &globalframe, (word) XR←GetTypeIndexS((word) (&string5)), (word) (
         ( (bPt) gf←c093)+104)/* var←c6104 */ );
   var←c6776 = (word) XR←ExportInterface((word) "PriorityQueue", (word) XR←GetTypeIndexS((word) (&string6)), 10);
   (* (( (ptr) gf←c093)+28)/* var←c6744 */  ) = var←c6776;
   (void) XR←ExportVar(var←c6776, 0, (word) (( (bPt) gf←c093)+24));
   (void) XR←ExportVar(var←c6776, 1, (word) (( (bPt) gf←c093)+28));
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+88)/* var←c6040 */ , 67633666);
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+80)/* var←c6008 */ , 67896067);
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+72)/* var←c5976 */ , 67372033);
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+64)/* var←c5944 */ , 67372289);
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+56)/* var←c5912 */ , 67372545);
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+48)/* var←c5880 */ , 526082);
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+40)/* var←c5848 */ , 67373057);
   (void) XR←ExportProcS(var←c6776, (word) (( (bPt) gf←c093)+32)/* var←c5816 */ , 67373313);
   }

static void PriorityQueueImpl←P0(formal←c018, formal←c017)
   word formal←c018;
   word formal←c017;
   {
   /* PriorityQueueImpl: */ 
   }

static word IsPriorityQueue←P60(ref←v2828)
   word ref←v2828;
   {
   register ptr gf←c6808 =  (ptr) &globalframe;
   word var←c2888;
   /* IsPriorityQueue: */ 
SOURCE(198, 131)
SOURCE(257, 72)
   {
      word var←c6136;
      var←c6136 = ref←v2828;
      if ((var←c6136 == 0)) {
         goto lab←L100000;
         };
      if (((* (( (ptr) gf←c6808)+4) ) == XR←GetReferentType(var←c6136))) {
         {
            word pq←v3840;
            pq←v3840 = var←c6136;
SOURCE(289, 13)
            return(1);
            };
         }
      else {
         lab←L100000: ;
SOURCE(315, 14)
         return(0);
         };
      };
   }

static word Create←P120(pred←v2948, data←v2976)
   word pred←v2948;
   word data←v2976;
   {
   register ptr gf←c6840 =  (ptr) &globalframe;
   word var←c3032;
   word pq←v3884;
   /* Create: */ 
SOURCE(335, 149)
SOURCE(407, 64)
   pq←v3884 = XR←NewObject(32, (* (( (ptr) gf←c6840)+4) ));
   (* (( (ptr) pq←v3884)+4) ) = XR←CheckProc(pred←v2948);
   (* (( (ptr) pq←v3884)+5) ) = data←v2976;
SOURCE(473, 11)
   return(pq←v3884);
   }

static word Predict←P180(size←v3092, pred←v3120, data←v3148)
   word size←v3092;
   word pred←v3120;
   word data←v3148;
   {
   register ptr gf←c6872 =  (ptr) &globalframe;
   word var←c3204;
   word pq←v3928;
   /* Predict: */ 
SOURCE(490, 245)
SOURCE(574, 28)
   pq←v3928 = (word) Create←P120(pred←v3120, data←v3148);
SOURCE(604, 37)
   if (( (int)size←v3092 >  (int)1610612733)) {
SOURCE(627, 14)
      size←v3092 = 1610612733;
      };
SOURCE(643, 63)
   if (( (int)size←v3092 >  (int)0)) {
SOURCE(660, 48)
      {
         word seq←v3972;
SOURCE(662, 30)
         {
            word var←c6200;
            word var←c6232;
            word var←c6264;
            var←c6200 = BCK((size←v3092 + 1), 67108863);
            var←c6232 = (var←c6200 << 2);
            var←c6264 = XR←NewObject((4 + var←c6232), (* (( (ptr) gf←c6872)+5) ));
            (*  (ptr) var←c6264 ) = var←c6200;
            seq←v3972 = var←c6264;
            };
SOURCE(694, 12)
         (* (( (ptr) pq←v3928)+7) ) = seq←v3972;
         };
      };
SOURCE(711, 11)
   (* (( (ptr) pq←v3928)+6) ) = 0;
SOURCE(724, 11)
   return(pq←v3928);
   }

static word Top←P240(pq←v3264)
   word pq←v3264;
   {
   register ptr gf←c6904 =  (ptr) &globalframe;
   word var←c6296;
   word var←c3308;
   /* Top: */ 
SOURCE(741, 117)
   (void) (XR←MonitorEntry(pq←v3264));
SOURCE(793, 45)
   if (((* (( (ptr) pq←v3264)+6) ) == 0)) {
SOURCE(813, 25)
      var←c6296 = (word) (( (bPt) gf←c6904)+24);
      (void) (XR←MonitorExit(pq←v3264));
      goto lab←L100001;
      };
SOURCE(840, 18)
   {
      word var←c6360;
      {
         word var←c6328;
         var←c6328 = (* (( (ptr) pq←v3264)+7) );
         {
            word limit7;
            var←c6360 = (* ((( (ptr) var←c6328)+1)+(
                  limit7 = (*  (ptr) var←c6328 ),
                  BCK(1, limit7)
                  )) );
            };
         };
      (void) (XR←MonitorExit(pq←v3264));
      return(var←c6360);
      };
   /* c2c skipped dead code */ 
   lab←L100001: ;
SOURCE(813, 25)
   (void) XR←RaiseError(var←c6296, 0);
   }

static word Size←P300(pq←v3368)
   word pq←v3368;
   {
   word var←c3412;
   /* Size: */ 
SOURCE(864, 68)
   (void) (XR←MonitorEntry(pq←v3368));
SOURCE(916, 16)
   {
      word var←c6392;
      var←c6392 = (* (( (ptr) pq←v3368)+6) );
      (void) (XR←MonitorExit(pq←v3368));
      return(var←c6392);
      };
   }

static word Empty←P360(pq←v3472)
   word pq←v3472;
   {
   word var←c3516;
   /* Empty: */ 
SOURCE(938, 74)
   (void) (XR←MonitorEntry(pq←v3472));
SOURCE(992, 20)
   {
      word var←c6424;
      var←c6424 = ((* (( (ptr) pq←v3472)+6) ) == 0);
      (void) (XR←MonitorExit(pq←v3472));
      return(var←c6424);
      };
   }

static void Insert←P420(pq←v3576, item←v3604)
   word pq←v3576;
   word item←v3604;
   {
   register ptr gf←c6936 =  (ptr) &globalframe;
   word var←c6456;
   word size←v4016;
   word a←v4044;
   word pred←v4072;
   word data←v4100;
   word space←v4128;
   /* Insert: */ 
SOURCE(1018, 913)
   (void) (XR←MonitorEntry(pq←v3576));
SOURCE(1070, 19)
   size←v4016 = (* (( (ptr) pq←v3576)+6) );
SOURCE(1115, 15)
   a←v4044 = (* (( (ptr) pq←v3576)+7) );
SOURCE(1167, 24)
   pred←v4072 = (* (( (ptr) pq←v3576)+4) );
SOURCE(1219, 19)
   data←v4100 = (* (( (ptr) pq←v3576)+5) );
SOURCE(1273, 43)
   space←v4128 =  ( (a←v4044 == 0) ? 0 : (*  (ptr) a←v4044 ) ) ;
SOURCE(1379, 15)
   size←v4016 = (size←v4016 + 1);
SOURCE(1396, 48)
   if ((size←v4016 >= 1610612733)) {
SOURCE(1420, 24)
      var←c6456 = (word) (( (bPt) gf←c6936)+28);
      (void) (XR←MonitorExit(pq←v3576));
      goto lab←L100003;
      };
SOURCE(1447, 282)
   if ((size←v4016 >= space←v4128)) {
SOURCE(1469, 262)
      {
         word seq←v4212 = 0;
SOURCE(1487, 27)
         if ((space←v4128 == 0)) {
SOURCE(1505, 9)
            space←v4128 = 1;
            };
SOURCE(1516, 117)
         {
            word var←c6488;
            var←c6488 = space←v4128;
            if ((var←c6488 < 2048)) {
SOURCE(1544, 21)
               space←v4128 = SGNCK((space←v4128 + space←v4128));
               }
            else {
               if ((var←c6488 < 1610611709)) {
SOURCE(1585, 20)
                  space←v4128 = (space←v4128 + 1024);
                  }
               else {
SOURCE(1618, 15)
                  space←v4128 = 1610612733;
                  };
               };
            };
SOURCE(1636, 24)
         {
            word var←c6520;
            word var←c6552;
            word var←c6584;
            var←c6520 = BCK(space←v4128, 67108863);
            var←c6552 = (var←c6520 << 2);
            var←c6584 = XR←NewObject((4 + var←c6552), (* (( (ptr) gf←c6936)+5) ));
            (*  (ptr) var←c6584 ) = var←c6520;
            seq←v4212 = var←c6584;
            };
SOURCE(1662, 40)
         {
            register word i←v4256 = 1;
            register word noName←c6616;
            noName←c6616 = size←v4016;
            if ((i←v4256 >= noName←c6616)) {
               goto lab←L100004;
               };
            lab←L100007: ;
SOURCE(1689, 13)
            {
               word limit8;
               word limit9;
               (* ((( (ptr) seq←v4212)+1)+(
                     limit8 = (*  (ptr) seq←v4212 ),
                     BCK(i←v4256, limit8)
                     )) ) = (* ((( (ptr) a←v4044)+1)+(
                     limit9 = (*  (ptr) a←v4044 ),
                     BCK(i←v4256, limit9)
                     )) );
               };
            i←v4256 = (i←v4256 + 1);
            if ((i←v4256 < noName←c6616)) {
               goto lab←L100007;
               };
            lab←L100004: ;
            };
SOURCE(1713, 16)
         (* (( (ptr) pq←v3576)+7) ) = seq←v4212;
         a←v4044 = seq←v4212;
         };
      };
SOURCE(1735, 223)
   {
      word son←v4300;
      word dad←v4328;
SOURCE(1737, 15)
      son←v4300 = size←v4016;
SOURCE(1754, 16)
      dad←v4328 = (son←v4300 >> 1);
SOURCE(1772, 85)
      lab←L100010: ;
      {
         word tc10;
         word limit11;
         if ((dad←v4328 > 0)) {
            tc10 =  (word) (0 != (word) ( *( (fPt) ((*  (ptr) pred←v4072 ))))(item←v3604, (* ((( (ptr) a←v4044)+1)+(
                     limit11 = (*  (ptr) a←v4044 ),
                     BCK(dad←v4328, limit11)
                     )) ), data←v4100, pred←v4072));
            }
         else {
            tc10 =  (word) 0;
            };
         if (tc10) {
            }
         else {
            goto lab←L100008;
            };
         };
SOURCE(1818, 15)
      {
         word limit12;
         word limit13;
         (* ((( (ptr) a←v4044)+1)+(
               limit12 = (*  (ptr) a←v4044 ),
               BCK(son←v4300, limit12)
               )) ) = (* ((( (ptr) a←v4044)+1)+(
               limit13 = (*  (ptr) a←v4044 ),
               BCK(dad←v4328, limit13)
               )) );
         };
SOURCE(1835, 9)
      son←v4300 = dad←v4328;
SOURCE(1846, 11)
      dad←v4328 = (son←v4300 >> 1);
      goto lab←L100010;
      lab←L100008: ;
SOURCE(1868, 13)
      {
         word limit14;
         (* ((( (ptr) a←v4044)+1)+(
               limit14 = (*  (ptr) a←v4044 ),
               BCK(son←v4300, limit14)
               )) ) = item←v3604;
         };
SOURCE(1917, 14)
      (* (( (ptr) pq←v3576)+6) ) = size←v4016;
      };
SOURCE(1018, 913)
   (void) (XR←MonitorExit(pq←v3576));
   return;
   /* c2c skipped dead code */ 
   lab←L100003: ;
SOURCE(1420, 24)
   (void) XR←RaiseError(var←c6456, 0);
   }

static word Remove←P480(pq←v3664)
   word pq←v3664;
   {
   register ptr gf←c6968 =  (ptr) &globalframe;
   word var←c6680;
   word var←c3708;
   word size←v4372;
   word a←v4400;
   word best←v4428 = 0;
   word item←v4456 = 0;
   word pred←v4484;
   word data←v4512;
   /* Remove: */ 
SOURCE(1966, 1080)
   (void) (XR←MonitorEntry(pq←v3664));
SOURCE(2021, 19)
   size←v4372 = (* (( (ptr) pq←v3664)+6) );
SOURCE(2067, 15)
   a←v4400 = (* (( (ptr) pq←v3664)+7) );
SOURCE(2224, 24)
   pred←v4484 = (* (( (ptr) pq←v3664)+4) );
SOURCE(2277, 19)
   data←v4512 = (* (( (ptr) pq←v3664)+5) );
SOURCE(2331, 42)
   if ((size←v4372 == 0)) {
SOURCE(2348, 25)
      var←c6680 = (word) (( (bPt) gf←c6968)+24);
      (void) (XR←MonitorExit(pq←v3664));
      goto lab←L100012;
      };
SOURCE(2376, 11)
   {
      word limit15;
      best←v4428 = (* ((( (ptr) a←v4400)+1)+(
            limit15 = (*  (ptr) a←v4400 ),
            BCK(1, limit15)
            )) );
      };
SOURCE(2421, 14)
   {
      word limit16;
      item←v4456 = (* ((( (ptr) a←v4400)+1)+(
            limit16 = (*  (ptr) a←v4400 ),
            BCK(size←v4372, limit16)
            )) );
      };
SOURCE(2463, 13)
   {
      word limit17;
      (* ((( (ptr) a←v4400)+1)+(
            limit17 = (*  (ptr) a←v4400 ),
            BCK(size←v4372, limit17)
            )) ) = 0;
      };
SOURCE(2478, 15)
   size←v4372 = SGNCK((size←v4372 - 1));
SOURCE(2519, 14)
   (* (( (ptr) pq←v3664)+6) ) = size←v4372;
SOURCE(2568, 30)
   if ((size←v4372 == 0)) {
SOURCE(2585, 13)
      (void) (XR←MonitorExit(pq←v3664));
      return(best←v4428);
      };
SOURCE(2601, 428)
   {
      word dad←v4568 = 1;
      word maxdad←v4596;
SOURCE(2662, 22)
      maxdad←v4596 = (size←v4372 >> 1);
SOURCE(2721, 282)
      lab←L100015: ;
      if ((dad←v4568 <= maxdad←v4596)) {
         }
      else {
         goto lab←L100013;
         };
      {
         word son←v4640;
         word sonItem←v4668;
SOURCE(2744, 20)
         son←v4640 = SGNCK((dad←v4568 + dad←v4568));
SOURCE(2766, 22)
         {
            word limit18;
            sonItem←v4668 = (* ((( (ptr) a←v4400)+1)+(
                  limit18 = (*  (ptr) a←v4400 ),
                  BCK(son←v4640, limit18)
                  )) );
            };
SOURCE(2790, 138)
         if ((son←v4640 < size←v4372)) {
SOURCE(2809, 124)
            {
               word nson←v4712;
               word nsonItem←v4740;
SOURCE(2811, 19)
               nson←v4712 = (son←v4640 + 1);
SOURCE(2832, 24)
               {
                  word limit19;
                  nsonItem←v4740 = (* ((( (ptr) a←v4400)+1)+(
                        limit19 = (*  (ptr) a←v4400 ),
                        BCK(nson←v4712, limit19)
                        )) );
                  };
SOURCE(2858, 70)
               if ((0 != (word) ( *( (fPt) ((*  (ptr) pred←v4484 ))))(nsonItem←v4740, sonItem←v4668, data←v4512, pred←v4484))) {
SOURCE(2898, 10)
                  son←v4640 = nson←v4712;
SOURCE(2910, 18)
                  sonItem←v4668 = nsonItem←v4740;
                  };
               };
            };
SOURCE(2936, 34)
         if ((0 != (word) ( *( (fPt) ((*  (ptr) pred←v4484 ))))(item←v4456, sonItem←v4668, data←v4512, pred←v4484))) {
SOURCE(2970, 4)
            goto lab←L100014;
            };
SOURCE(2976, 16)
         {
            word limit20;
            (* ((( (ptr) a←v4400)+1)+(
                  limit20 = (*  (ptr) a←v4400 ),
                  BCK(dad←v4568, limit20)
                  )) ) = sonItem←v4668;
            };
SOURCE(2994, 9)
         dad←v4568 = son←v4640;
         };
      goto lab←L100015;
      lab←L100013: ;
      lab←L100014: ;
SOURCE(3014, 13)
      {
         word limit21;
         (* ((( (ptr) a←v4400)+1)+(
               limit21 = (*  (ptr) a←v4400 ),
               BCK(dad←v4568, limit21)
               )) ) = item←v4456;
         };
      };
SOURCE(3033, 13)
   (void) (XR←MonitorExit(pq←v3664));
   return(best←v4428);
   /* c2c skipped dead code */ 
   lab←L100012: ;
SOURCE(2348, 25)
   (void) XR←RaiseError(var←c6680, 0);
   }

static word Copy←P540(formal←c0104)
   word formal←c0104;
   {
   W6 var←c7000;
   /* declaration of pq←v3768 skipped */ 
   /* declaration of var←c01 skipped */ 
   word var←c3812;
   var←c7000.f4/* pq←v3768 */  = formal←c0104;
   /* Copy: */ 
SOURCE(3052, 261)
   (void) (XR←MonitorEntry(var←c7000.f4/* pq←v3768 */ ));
SOURCE(3104, 209)
   {
      word var←c02;
      {
         word var←c0101;
         var←c0101 = (word) &var←c7000;
         var←c02 = (word) XR←Enable(( ((word)  (fPt) NoName←Q1140) ), ( ((word)  (fPt) NoName←Q1200) ), var←c0101);
         };
      /* removed trivial cond node */ 
      };
   return(var←c7000.f5/* var←c01 */ );
   }

static word NoName←Q1140(formal←c0100)
   word formal←c0100;
   {
SOURCE(3127, 19)
   {
      word size←v4784;
      word npq←v4812;
      word src←v4840;
      word dst←v4868;
SOURCE(3127, 19)
      size←v4784 = (* (( (ptr) (* (( (ptr) formal←c0100)+4) ))+6) );
SOURCE(3148, 42)
      npq←v4812 = (word) Predict←P180(size←v4784, (* (( (ptr) (* (( (ptr) formal←c0100)+4) ))+4) ), (* (( (ptr) (* (( (ptr) formal←c0100)+4)
             ))+5) ));
SOURCE(3192, 17)
      src←v4840 = (* (( (ptr) (* (( (ptr) formal←c0100)+4) ))+7) );
SOURCE(3211, 18)
      dst←v4868 = (* (( (ptr) npq←v4812)+7) );
SOURCE(3231, 42)
      {
         register word i←v4912 = 1;
         register word noName←c6712;
         noName←c6712 = size←v4784;
         if ((i←v4912 >= noName←c6712)) {
            goto lab←L100019;
            };
         lab←L100022: ;
SOURCE(3258, 15)
         {
            word limit22;
            word limit23;
            (* ((( (ptr) dst←v4868)+1)+(
                  limit22 = (*  (ptr) dst←v4868 ),
                  BCK(i←v4912, limit22)
                  )) ) = (* ((( (ptr) src←v4840)+1)+(
                  limit23 = (*  (ptr) src←v4840 ),
                  BCK(i←v4912, limit23)
                  )) );
            };
         i←v4912 = (i←v4912 + 1);
         if ((i←v4912 < noName←c6712)) {
            goto lab←L100022;
            };
         lab←L100019: ;
         };
SOURCE(3284, 15)
      (* (( (ptr) npq←v4812)+6) ) = size←v4784;
SOURCE(3301, 12)
      (void) (XR←MonitorExit(* (( (ptr) formal←c0100)+4) ));
      (* (( (ptr) formal←c0100)+5) ) = npq←v4812;
      return(1);
      };
   /* c2c skipped dead code */ 
   }

static void NoName←Q1200(formal←c092, formal←c200000, formal←c200001, formal←c200002, formal←c200003)
   word formal←c092;
   word formal←c200000;
   word formal←c200001;
   word formal←c200002;
   word formal←c200003;
   {
   if ((formal←c200001 == XR←Unwind)) {
      (void) (XR←MonitorExit(* (( (ptr) formal←c200000)+4) ));
      };
   (*  (ptr) formal←c092 ) = 0;
   (* (( (ptr) formal←c092)+1) ) = 0;
   return;
   }

/* file: PriorityQueueImpl, module: PriorityQueueImpl, compiled at: July 22, 1992 2:39:28 pm PDT */ 
extern void XR←install←PriorityQueueImpl() {
   NoName←Q1080();
   }
extern void XR←run←PriorityQueueImpl() { XR←Start(&globalframe); }