/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1992 by Xerox Corporation.  All rights reserved. */
/* time: July 22, 1992 11:25:37 am PDT */
/* C2C version: October 16, 1990 (native) */
/* ref-counting: off */
/* file: VMChunksImpl, module: VMChunksImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
static char versionStamp[] = "@(#)mob←version [1800547671,957849160] VMChunksImpl";
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;
typedef struct {word f0, f1;} W2;
#define SOURCE(p, l) /* source p, l */
static void NoName←Q840();
static void VMChunksImpl←P0();
static word IsChunk←P60();
static word NarrowChunk←P120();
static word AddressOfChunk←P180();
static word SizeOfChunk←P240();
static word DomainOfChunk←P300();
static word CreateDomain←P360();
static word InitRoot←P780();
static word NewChunk←P420();
static word AllocateChunk←P480();
static void Free←P540();
static void SplitNCreateNext←P600();
static void JoinNRemoveNext←P660();
static void Finalizor←P720();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\153\122\055\127\300\071\027\236\110\100\214\000\000"};
static struct {unsigned f; char r[4];} string2 = {131074, "\003\004\000"};
static struct {unsigned f; char r[16];} string3 = {851984, "\257\300\153\122\055\127\300\071\027\236\110\100\244\000\000"};
static struct {unsigned f; char r[4];} string4 = {131074, "\004\003\000"};
static struct {unsigned f; char r[16];} string5 = {851984, "\257\300\153\122\055\127\300\071\027\236\110\100\230\000\000"};
static struct {unsigned f; char r[4];} string6 = {131074, "\004\014\000"};
static struct {unsigned f; char r[16];} string7 = {851984, "\257\300\153\122\055\127\300\071\027\236\110\100\200\000\000"};
static struct {unsigned f; char r[16];} string8 = {851984, "\257\300\157\176\027\244\300\037\074\133\137\100\150\000\000"};
static struct {unsigned f; char r[16];} string9 = {851984, "\257\300\246\171\266\212\300\131\156\315\206\100\150\000\000"};
static struct {unsigned f; char r[24];} string10 = {1441816, "\211\012\011\104\157\155\141\151\156\122\145\160\300\246\171\266\212\300\131\156\315\206\000"};
static struct {unsigned f; char r[24];} string11 = {1376280, "\211\011\010\103\150\165\156\153\122\145\160\300\246\171\266\212\300\131\156\315\206\000\000"};
static struct {
   word f0[9]; 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; 
   word f28; word f29; word f30; word f31; 
   word f32; word f33; word f34[3]; 
   } globalframe = {
   {0}, (word) Finalizor←P720, 0, (word) JoinNRemoveNext←P660, 
   0, (word) SplitNCreateNext←P600, 0, (word) Free←P540, 
   0, (word) AllocateChunk←P480, 0, (word) NewChunk←P420, 
   0, (word) CreateDomain←P360, 0, (word) DomainOfChunk←P300, 
   0, (word) SizeOfChunk←P240, 0, (word) AddressOfChunk←P180, 
   0, (word) NarrowChunk←P120, 0, (word) IsChunk←P60, 
   0, (word) VMChunksImpl←P0, {0}
   };

static void NoName←Q840()
   {
   register ptr gf←c063 =  (ptr) &globalframe;
   word var←c6928;
   (* (( (ptr) gf←c063)+5) ) = (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2);
   (* (( (ptr) gf←c063)+6) ) = (word) XR←GetTypeIndex((word) &string3, 0, (word) &string4);
   (* (( (ptr) gf←c063)+8) ) = (word) XR←GetTypeIndex((word) &string5, 0, (word) &string6);
   (void) XR←DeclareGlobalFrame((word) "VMChunksImpl", &globalframe, (word) XR←GetTypeIndex((word) &string7, 0, (word) &string2)
      , (word) (( (bPt) gf←c063)+132)/* var←c6544 */ );
   var←c6928 = (word) XR←ImportInterface((word) "FinalizeOps", (word) XR←GetTypeIndexS((word) (&string8)), 7);
   (* (( (ptr) gf←c063)+35)/* var←c6576 */  ) = var←c6928;
   (void) XR←ImportProcS(var←c6928, 67634178);
   (void) XR←ImportProcS(var←c6928, 67634690);
   var←c6928 = (word) XR←ExportInterface((word) "VMChunks", (word) XR←GetTypeIndexS((word) (&string9)), 9);
   (* (( (ptr) gf←c063)+36)/* var←c6960 */  ) = var←c6928;
   (void) XR←ExportType((word) "DomainRep", (word) XR←GetTypeIndexS((word) (&string10)), (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2)
      );
   (void) XR←ExportType((word) "ChunkRep", (word) XR←GetTypeIndexS((word) (&string11)), (word) XR←GetTypeIndex((word) &string3, 0, (word) &string4)
      );
   (void) XR←ExportProcS(var←c6928, (word) (( (bPt) gf←c063)+84)/* var←c6352 */ , 67633666);
   (void) XR←ExportProcS(var←c6928, (word) (( (bPt) gf←c063)+124)/* var←c6512 */ , 67371777);
   (void) XR←ExportProcS(var←c6928, (word) (( (bPt) gf←c063)+116)/* var←c6480 */ , 67372033);
   (void) XR←ExportProcS(var←c6928, (word) (( (bPt) gf←c063)+68)/* var←c6288 */ , 67634434);
   (void) XR←ExportProcS(var←c6928, (word) (( (bPt) gf←c063)+108)/* var←c6448 */ , 67372545);
   (void) XR←ExportProcS(var←c6928, (word) (( (bPt) gf←c063)+100)/* var←c6416 */ , 67372801);
   (void) XR←ExportProcS(var←c6928, (word) (( (bPt) gf←c063)+92)/* var←c6384 */ , 67373057);
   }

static void VMChunksImpl←P0(formal←c020, formal←c019)
   word formal←c020;
   word formal←c019;
   {
   register ptr gf←c6992 =  (ptr) &globalframe;
   /* VMChunksImpl: */ 
SOURCE(34, 3210)
SOURCE(3053, 81)
   {
      word pd12;
      pd12 = (* (( (ptr) (* (( (ptr) gf←c6992)+35)/* var←c6576 */  ))+10) );
      (* (( (ptr) gf←c6992)+4)/* finalizationQueue←v3028 */  ) = (word) ( *( (fPt) ((*  (ptr) pd12 ))))((word) (( (bPt) gf←c6992)+36)
         /* var←c6160 */ , 3, pd12);
      };
   }

static word IsChunk←P60(x←v3496)
   word x←v3496;
   {
   register ptr gf←c7024 =  (ptr) &globalframe;
   word var←c3556;
   /* IsChunk: */ 
SOURCE(586, 102)
SOURCE(639, 49)
   {
      word tc13;
      if ((x←v3496 != 0)) {
         if ((x←v3496 == 0)) {
            tc13 =  (word) 1;
            }
         else {
            tc13 =  (word) ((* (( (ptr) gf←c7024)+6) ) == XR←GetReferentType(x←v3496));
            };
         }
      else {
         tc13 =  (word) 0;
         };
      return(tc13);
      };
   }

static word NarrowChunk←P120(x←v3616)
   word x←v3616;
   {
   register ptr gf←c7056 =  (ptr) &globalframe;
   word var←c3672;
   /* NarrowChunk: */ 
SOURCE(692, 97)
SOURCE(750, 39)
   return(XR←Narrow(x←v3616, (* (( (ptr) gf←c7056)+6) )));
   }

static word AddressOfChunk←P180(chunk←v3732)
   word chunk←v3732;
   {
   word var←c3776;
   /* AddressOfChunk: */ 
SOURCE(793, 84)
SOURCE(855, 22)
   return((*  (ptr) (*  (ptr) chunk←v3732 ) ));
   }

static word SizeOfChunk←P240(chunk←v3836)
   word chunk←v3836;
   {
   word var←c3880;
   /* SizeOfChunk: */ 
SOURCE(881, 81)
SOURCE(940, 22)
   return((* (( (ptr) (*  (ptr) chunk←v3836 ))+1) ));
   }

static word DomainOfChunk←P300(chunk←v3940)
   word chunk←v3940;
   {
   word var←c3984;
   /* DomainOfChunk: */ 
SOURCE(966, 82)
SOURCE(1029, 19)
   return((* (( (ptr) chunk←v3940)+1) ));
   }

static word CreateDomain←P360(startAddress←v4044, size←v4072)
   word startAddress←v4044;
   word size←v4072;
   {
   W6 var←c7088;
   register ptr gf←c7120 =  (ptr) &globalframe;
   word d←v4116;
   /* declaration of var←c6640 skipped */ 
   /* CreateDomain: */ 
SOURCE(1052, 307)
   {
      word tmpAddr14;
      tmpAddr14 = (word) (( (ptr) &var←c7088)+4)/* var←c6640 */ ;
      (*  (ptr) tmpAddr14 ) = ( ((word)  (fPt) InitRoot←P780) );
      (* (( (ptr) tmpAddr14) + 1) ) = 1;
      };
SOURCE(1052, 307)
   d←v4116 = 0;
SOURCE(1302, 18)
   d←v4116 = XR←NewObject(20, (* (( (ptr) gf←c7120)+5) ));
SOURCE(1322, 37)
   (* (( (ptr) d←v4116)+4) ) = (word) InitRoot←P780(startAddress←v4044, size←v4072, (word) (( (bPt) &var←c7088)+16)/* var←c6640 */ )
   ;
SOURCE(1052, 307)
   return(d←v4116);
   }

static word InitRoot←P780(startAddress←v4820, size←v4848, formal←c7184)
   word startAddress←v4820;
   word size←v4848;
   word formal←c7184;
   {
   register ptr gf←c7152 =  (ptr) &globalframe;
   word c←v4892;
   formal←c7184 = (formal←c7184 - 16);
   /* InitRoot: */ 
SOURCE(1135, 162)
SOURCE(1135, 162)
   c←v4892 = 0;
SOURCE(1217, 21)
   c←v4892 = XR←NewObject(20, (* (( (ptr) gf←c7152)+8) ));
SOURCE(1240, 13)
   (* (( (ptr) c←v4892)+1) ) = size←v4848;
SOURCE(1255, 21)
   (*  (ptr) c←v4892 ) = startAddress←v4820;
SOURCE(1278, 19)
   (* (( (ptr) c←v4892)+3) ) = c←v4892;
   (* (( (ptr) c←v4892)+2) ) = c←v4892;
SOURCE(1135, 162)
   return(c←v4892);
   }

static word NewChunk←P420(domain←v4176, c←v4204)
   word domain←v4176;
   word c←v4204;
   {
   register ptr gf←c7216 =  (ptr) &globalframe;
   word ch←v4260;
   /* NewChunk: */ 
SOURCE(1419, 204)
SOURCE(1419, 204)
   ch←v4260 = 0;
SOURCE(1496, 46)
   {
      word var←c6768;
      var←c6768 = XR←NewObject(8, (* (( (ptr) gf←c7216)+6) ));
      (*  (ptr) var←c6768 ) = c←v4204;
      (* (( (ptr) var←c6768)+1) ) = domain←v4176;
      ch←v4260 = var←c6768;
      };
SOURCE(1544, 17)
   (* (( (ptr) c←v4204)+4) ) = 1;
SOURCE(1564, 59)
   {
      word var←c6800;
      word pd15;
      pd15 = (* (( (ptr) (* (( (ptr) gf←c7216)+35)/* var←c6576 */  ))+8) );
      var←c6800 = (word) ( *( (fPt) ((*  (ptr) pd15 ))))(ch←v4260, (* (( (ptr) gf←c7216)+4)/* finalizationQueue←v3028 */  ), pd15)
      ;
      };
SOURCE(1419, 204)
   return(ch←v4260);
   }

static word AllocateChunk←P480(domain←v4320, size←v4348)
   word domain←v4320;
   word size←v4348;
   {
   word var←c4392;
   word root←v4932;
   word c←v4960;
   /* AllocateChunk: */ 
SOURCE(1627, 526)
   (void) (XR←MonitorEntry(domain←v4320));
SOURCE(1709, 36)
   root←v4932 = (* (( (ptr) domain←v4320)+4) );
SOURCE(1747, 26)
   c←v4960 = root←v4932;
SOURCE(1775, 57)
   size←v4348 = (((size←v4348 + 7) >> 3) << 3);
SOURCE(1835, 27)
   if ((size←v4348 == 0)) {
SOURCE(1850, 12)
      (void) (XR←MonitorExit(domain←v4320));
      return(0);
      };
SOURCE(1864, 8)
   c←v4960 = root←v4932;
SOURCE(1874, 97)
   lab←L100002: ;
SOURCE(1877, 64)
   if ( ( (0 == (* (( (ptr) c←v4960)+4) )) ? ((* (( (ptr) c←v4960)+1) ) == size←v4348) : 0 ) ) {
SOURCE(1914, 27)
      {
         word var←c6832;
         var←c6832 = (word) NewChunk←P420(domain←v4320, c←v4960);
         (void) (XR←MonitorExit(domain←v4320));
         return(var←c6832);
         };
      };
SOURCE(1944, 10)
   c←v4960 = (* (( (ptr) c←v4960)+3) );
SOURCE(1956, 15)
   if ((c←v4960 == root←v4932)) {
SOURCE(1971, 4)
      goto lab←L100001;
      };
   goto lab←L100002;
   lab←L100001: ;
SOURCE(1987, 8)
   c←v4960 = root←v4932;
SOURCE(1997, 128)
   lab←L100005: ;
SOURCE(2000, 93)
   if ( ( (0 == (* (( (ptr) c←v4960)+4) )) ? ((* (( (ptr) c←v4960)+1) ) > size←v4348) : 0 ) ) {
SOURCE(2038, 25)
      (void) SplitNCreateNext←P600(c←v4960, size←v4348);
SOURCE(2065, 28)
      {
         word var←c6864;
         var←c6864 = (word) NewChunk←P420(domain←v4320, c←v4960);
         (void) (XR←MonitorExit(domain←v4320));
         return(var←c6864);
         };
      };
SOURCE(2098, 10)
   c←v4960 = (* (( (ptr) c←v4960)+3) );
SOURCE(2110, 15)
   if ((c←v4960 == root←v4932)) {
SOURCE(2125, 4)
      goto lab←L100004;
      };
   goto lab←L100005;
   lab←L100004: ;
SOURCE(2141, 12)
   (void) (XR←MonitorExit(domain←v4320));
   return(0);
   }

static void Free←P540(domain←v4452, c←v4480)
   word domain←v4452;
   word c←v4480;
   {
   /* Free: */ 
SOURCE(2159, 215)
   (void) (XR←MonitorEntry(domain←v4452));
SOURCE(2218, 20)
   if ((0 == (* (( (ptr) c←v4480)+4) ))) {
SOURCE(2238, 5)
      (void) XR←RaiseUnnamedError();
      };
SOURCE(2245, 18)
   (* (( (ptr) c←v4480)+4) ) = 0;
SOURCE(2265, 51)
   if ((0 == (* (( (ptr) (* (( (ptr) c←v4480)+3) ))+4) ))) {
SOURCE(2290, 26)
      (void) JoinNRemoveNext←P660(domain←v4452, c←v4480);
      };
SOURCE(2318, 56)
   if ((0 == (* (( (ptr) (* (( (ptr) c←v4480)+2) ))+4) ))) {
SOURCE(2343, 31)
      (void) JoinNRemoveNext←P660(domain←v4452, (* (( (ptr) c←v4480)+2) ));
      };
SOURCE(2159, 215)
   (void) (XR←MonitorExit(domain←v4452));
   return;
   }

static void SplitNCreateNext←P600(c←v4552, nbytes←v4580)
   word c←v4552;
   word nbytes←v4580;
   {
   register ptr gf←c7248 =  (ptr) &globalframe;
   word new←v5028;
   /* SplitNCreateNext: */ 
SOURCE(2380, 316)
SOURCE(2452, 41)
   new←v5028 = XR←NewObject(20, (* (( (ptr) gf←c7248)+8) ));
SOURCE(2495, 37)
   if ((0 != (* (( (ptr) c←v4552)+4) )) || (nbytes←v4580 >= (* (( (ptr) c←v4552)+1) ))) {
SOURCE(2532, 5)
      (void) XR←RaiseUnnamedError();
      };
SOURCE(2559, 26)
   (* (( (ptr) new←v5028)+1) ) = ((* (( (ptr) c←v4552)+1) ) - nbytes←v4580);
SOURCE(2587, 15)
   (* (( (ptr) c←v4552)+1) ) = nbytes←v4580;
SOURCE(2604, 26)
   (*  (ptr) new←v5028 ) = ((*  (ptr) c←v4552 ) + nbytes←v4580);
SOURCE(2632, 17)
   (* (( (ptr) new←v5028)+3) ) = (* (( (ptr) c←v4552)+3) );
SOURCE(2651, 12)
   (* (( (ptr) new←v5028)+2) ) = c←v4552;
SOURCE(2665, 17)
   (* (( (ptr) (* (( (ptr) c←v4552)+3) ))+2) ) = new←v5028;
SOURCE(2684, 12)
   (* (( (ptr) c←v4552)+3) ) = new←v5028;
   }

static void JoinNRemoveNext←P660(domain←v4652, c←v4680)
   word domain←v4652;
   word c←v4680;
   {
   word root←v5084;
   word remove←v5112;
   /* JoinNRemoveNext: */ 
SOURCE(2702, 345)
SOURCE(2775, 36)
   root←v5084 = (* (( (ptr) domain←v4652)+4) );
SOURCE(2813, 33)
   remove←v5112 = (* (( (ptr) c←v4680)+3) );
SOURCE(2848, 26)
   if ((remove←v5112 == root←v5084)) {
SOURCE(2868, 6)
      return;
      };
SOURCE(2911, 38)
   if ((0 != (* (( (ptr) c←v4680)+4) )) || (0 != (* (( (ptr) remove←v5112)+4) ))) {
SOURCE(2949, 5)
      (void) XR←RaiseUnnamedError();
      };
SOURCE(2976, 20)
   (* (( (ptr) c←v4680)+3) ) = (* (( (ptr) remove←v5112)+3) );
SOURCE(2998, 20)
   (* (( (ptr) (* (( (ptr) remove←v5112)+3) ))+2) ) = c←v4680;
SOURCE(3020, 27)
   (* (( (ptr) c←v4680)+1) ) = ((* (( (ptr) c←v4680)+1) ) + (* (( (ptr) remove←v5112)+1) ));
   }

static void Finalizor←P720(handle←v5844, object←v5872)
   word handle←v5844;
   word object←v5872;
   {
   register ptr gf←c7280 =  (ptr) &globalframe;
   word chunk←v5180;
   /* Finalizor: */ 
SOURCE(3136, 108)
SOURCE(3176, 42)
   chunk←v5180 = XR←Narrow(object←v5872, (* (( (ptr) gf←c7280)+6) ));
SOURCE(3220, 24)
   (void) Free←P540((* (( (ptr) chunk←v5180)+1) ), (*  (ptr) chunk←v5180 ));
   }

/* file: VMChunksImpl, module: VMChunksImpl, compiled at: July 22, 1992 11:25:36 am PDT */ 
extern void XR←install←VMChunksImpl() {
   NoName←Q840();
   }
extern void XR←run←VMChunksImpl() { XR←Start(&globalframe); }