/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1993 by Xerox Corporation.  All rights reserved. */
/* time: January 28, 1993 4:06:48 pm PST */
/* C2C version: January 27, 1993 (sun4) */
/* ref-counting: off */
/* file: FinalizeOpsImpl, module: FinalizeOpsImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
static char versionStamp[] = "@(#)mob←version [2596585603,1001728106] FinalizeOpsImpl";
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;} W5;
typedef struct {word f0, f1;} W2;
#define SOURCE(p, l) /* source p, l */
static void NoName←Q1176();
static void FinalizeOpsImpl←P0();
static word IsCallQueue←P60();
static word NarrowCallQueue←P120();
static word IsFinalizeOpsHandle←P180();
static word EnableFinalization←P240();
static word ReenableFinalization←P300();
static word CreateCallQueue←P360();
static word HandleToObject←P420();
static word Forward←P600();
static word Fetch←P660();
static void CallQueueProcess←P720();
static word NoName←Q1236();
static void MainQueueProcess←P780();
static void NoName←Q1296();
static word NoName←Q1356();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\232\304\300\203\300\073\265\050\152\100\200\000\000"};
static struct {unsigned f; char r[4];} string2 = {196611, "\004A\200"};
static struct {unsigned f; char r[80];} string3 = {5111888, "\260\006\005\146\151\162\163\164\216\211\022\021\106\151\156\141\154\151\172\141\142\154\145\117\142\152\145\143\164\300\250\013\333\033\300\120\151\334\170\005\004\162\145\163\164\214\216\211\022\021\106\151\156\141\154\151\172\141\142\154\145\117\142\152\145\143\164\300\250\013\333\033\300\120\151\334\170\261\000"};
static struct {unsigned f; char r[4];} string4 = {131074, "\004\003\000"};
static struct {unsigned f; char r[16];} string5 = {851984, "\257\300\232\304\300\203\300\073\265\050\152\100\164\000\000"};
static struct {unsigned f; char r[4];} string6 = {196611, "\004C\000"};
static struct {unsigned f; char r[16];} string7 = {851984, "\257\300\250\013\333\033\300\120\151\334\170\100\150\000\000"};
static struct {unsigned f; char r[16];} string8 = {851984, "\257\300\240\236\274\315\300\111\163\325\023\100\150\000\000"};
static struct {unsigned f; char r[16];} string9 = {851984, "\257\300\157\176\027\244\300\037\074\133\137\100\150\000\000"};
static struct {unsigned f; char r[28];} string10 = {1638428, "\211\015\014\103\141\154\154\121\165\145\165\145\122\145\160\300\157\176\027\244\300\037\074\133\137\000\000"};
static struct {
   word f0[13]; 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; word f35; 
   word f36[4]; 
   } globalframe = {
   {0}, (word) MainQueueProcess←P780, 0, (word) CallQueueProcess←P720, 
   0, (word) Fetch←P660, 0, (word) Forward←P600, 
   0, (word) HandleToObject←P420, 0, (word) CreateCallQueue←P360, 
   0, (word) ReenableFinalization←P300, 0, (word) EnableFinalization←P240, 
   0, (word) IsFinalizeOpsHandle←P180, 0, (word) NarrowCallQueue←P120, 
   0, (word) IsCallQueue←P60, 0, (word) FinalizeOpsImpl←P0, 
   {0}
   };

static void NoName←Q1176()
   {
   register ptr gf←c074 =  (ptr) &globalframe;
   word var←c8312;
   (* (( (ptr) gf←c074)+10) ) = (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2);
   (* (( (ptr) gf←c074)+12) ) = (word) XR←GetTypeIndex((word) &string3, 0, (word) &string4);
   (void) XR←DeclareGlobalFrame((word) "FinalizeOpsImpl", &globalframe, (word) XR←GetTypeIndex((word) &string5, 0, (word) &string6)
      , (word) (( (bPt) gf←c074)+140)/* var←c7864 */ );
   var←c8312 = (word) XR←ImportInterface((word) "Finalize", (word) XR←GetTypeIndexS((word) (&string7)), 14);
   (* (( (ptr) gf←c074)+37)/* var←c7896 */  ) = var←c8312;
   (void) XR←ImportProcS(var←c8312, 67374081);
   (void) XR←ImportProcS(var←c8312, 67373057);
   (void) XR←ImportProcS(var←c8312, 67634690);
   (void) XR←ImportProcS(var←c8312, 67896323);
   (void) XR←ImportProcS(var←c8312, 67373313);
   (void) XR←ImportProcS(var←c8312, 67111424);
   var←c8312 = (word) XR←ImportInterface((word) "Process", (word) XR←GetTypeIndexS((word) (&string8)), 22);
   (* (( (ptr) gf←c074)+38)/* var←c8184 */  ) = var←c8312;
   (void) XR←ImportProcS(var←c8312, 264449);
   (void) XR←ImportProcS(var←c8312, 526081);
   var←c8312 = (word) XR←ExportInterface((word) "FinalizeOps", (word) XR←GetTypeIndexS((word) (&string9)), 7);
   (* (( (ptr) gf←c074)+39)/* var←c8344 */  ) = var←c8312;
   (void) XR←ExportProcS(var←c8312, (word) (( (bPt) gf←c074)+116)/* var←c7768 */ , 67371009);
   (void) XR←ExportType((word) "CallQueueRep", (word) XR←GetTypeIndexS((word) (&string10)), (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2)
      );
   (void) XR←ExportProcS(var←c8312, (word) (( (bPt) gf←c074)+132)/* var←c7832 */ , 67371521);
   (void) XR←ExportProcS(var←c8312, (word) (( (bPt) gf←c074)+124)/* var←c7800 */ , 67371777);
   (void) XR←ExportProcS(var←c8312, (word) (( (bPt) gf←c074)+108)/* var←c7736 */ , 67634178);
   (void) XR←ExportProcS(var←c8312, (word) (( (bPt) gf←c074)+100)/* var←c7704 */ , 67372289);
   (void) XR←ExportProcS(var←c8312, (word) (( (bPt) gf←c074)+92)/* var←c7672 */ , 67634690);
   }

static void FinalizeOpsImpl←P0(formal←c023, formal←c022)
   word formal←c023;
   word formal←c022;
   {
   register ptr gf←c8376 =  (ptr) &globalframe;
   /* FinalizeOpsImpl: */ 
SOURCE(46, 2957)
SOURCE(430, 49)
   {
      word pd11;
      pd11 = (* (( (ptr) (* (( (ptr) gf←c8376)+37)/* var←c7896 */  ))+14) );
      (* (( (ptr) gf←c8376)+8)/* fq←v2664 */  ) = (word) ( *( (fPt) ((*  (ptr) pd11 ))))(pd11);
      };
   }

static word IsCallQueue←P60(x←v3528)
   word x←v3528;
   {
   register ptr gf←c8408 =  (ptr) &globalframe;
   word var←c3588;
   /* IsCallQueue: */ 
SOURCE(482, 83)
SOURCE(535, 30)
   {
      word tc12;
      if ((x←v3528 == 0)) {
         tc12 =  (word) 1;
         }
      else {
         tc12 =  (word) ((* (( (ptr) gf←c8408)+10) ) == XR←GetReferentType(x←v3528));
         };
      return(tc12);
      };
   }

static word NarrowCallQueue←P120(x←v3648)
   word x←v3648;
   {
   register ptr gf←c8440 =  (ptr) &globalframe;
   word var←c3704;
   /* NarrowCallQueue: */ 
SOURCE(568, 92)
SOURCE(630, 30)
   return(XR←Narrow(x←v3648, (* (( (ptr) gf←c8440)+10) )));
   }

static word IsFinalizeOpsHandle←P180(handle←v3764)
   word handle←v3764;
   {
   register ptr gf←c8472 =  (ptr) &globalframe;
   word var←c3808;
   /* IsFinalizeOpsHandle: */ 
SOURCE(663, 183)
SOURCE(741, 105)
   {
      word var←c7960;
      {
         word pd13;
         pd13 = (* (( (ptr) (* (( (ptr) gf←c8472)+37)/* var←c7896 */  ))+13) );
         var←c7960 = (word) ( *( (fPt) ((*  (ptr) pd13 ))))(handle←v3764, pd13);
         };
      if ((var←c7960 == 0)) {
         goto lab←L100000;
         };
      if (((* (( (ptr) gf←c8472)+10) ) == XR←GetReferentType(var←c7960))) {
         {
            word cq←v5060;
            cq←v5060 = var←c7960;
SOURCE(806, 13)
            return(1);
            };
         }
      else {
         lab←L100000: ;
SOURCE(832, 14)
         return(0);
         };
      };
   }

static word EnableFinalization←P240(object←v3868, callQueue←v3896)
   word object←v3868;
   word callQueue←v3896;
   {
   register ptr gf←c8504 =  (ptr) &globalframe;
   word handle←v3952;
   /* EnableFinalization: */ 
SOURCE(852, 168)
SOURCE(852, 168)
   handle←v3952 = 0;
SOURCE(961, 59)
   {
      word pd14;
      pd14 = (* (( (ptr) (* (( (ptr) gf←c8504)+37)/* var←c7896 */  ))+8) );
      handle←v3952 = (word) ( *( (fPt) ((*  (ptr) pd14 ))))(object←v3868, (* (( (ptr) gf←c8504)+8)/* fq←v2664 */  ), callQueue←v3896, pd14)
      ;
      };
SOURCE(852, 168)
   return(handle←v3952);
   }

static word ReenableFinalization←P300(handle←v4012)
   word handle←v4012;
   {
   register ptr gf←c8536 =  (ptr) &globalframe;
   word oldState←v4056;
   /* ReenableFinalization: */ 
SOURCE(1025, 219)
SOURCE(1127, 117)
   {
      word var←c7992;
      {
         word pd15;
         pd15 = (* (( (ptr) (* (( (ptr) gf←c8536)+37)/* var←c7896 */  ))+13) );
         var←c7992 = (word) ( *( (fPt) ((*  (ptr) pd15 ))))(handle←v4012, pd15);
         };
      if ((var←c7992 == 0)) {
         goto lab←L100001;
         };
      if (((* (( (ptr) gf←c8536)+10) ) == XR←GetReferentType(var←c7992))) {
         {
            word cq←v5104;
            cq←v5104 = var←c7992;
SOURCE(1192, 52)
            {
               word pd16;
               pd16 = (* (( (ptr) (* (( (ptr) gf←c8536)+37)/* var←c7896 */  ))+10) );
               oldState←v4056 = (word) ( *( (fPt) ((*  (ptr) pd16 ))))(handle←v4012, (* (( (ptr) gf←c8536)+8)/* fq←v2664 */  ), pd16);
               };
            };
         }
      else {
         lab←L100001: ;
SOURCE(1257, 5)
         (void) XR←RaiseUnnamedError();
         };
      };
SOURCE(1025, 219)
   return(oldState←v4056);
   }

static word CreateCallQueue←P360(finalize←v4116, priority←v4144)
   word finalize←v4116;
   word priority←v4144;
   {
   register ptr gf←c8568 =  (ptr) &globalframe;
   word cq←v4188;
   /* CreateCallQueue: */ 
SOURCE(1267, 204)
SOURCE(1267, 204)
   cq←v4188 = 0;
SOURCE(1406, 65)
   {
      word var←c8024;
      var←c8024 = XR←NewObject(36, (* (( (ptr) gf←c8568)+10) ));
      (* (( (ptr) var←c8024)+4) ) = XR←CheckProc(finalize←v4116);
      (* (( (ptr) var←c8024)+5) ) = priority←v4144;
      cq←v4188 = var←c8024;
      };
SOURCE(1267, 204)
   return(cq←v4188);
   }

static word HandleToObject←P420(handle←v4248)
   word handle←v4248;
   {
   register ptr gf←c8600 =  (ptr) &globalframe;
   word object←v4292;
   /* HandleToObject: */ 
SOURCE(1477, 112)
SOURCE(1477, 112)
   object←v4292 = 0;
SOURCE(1548, 41)
   {
      word pd17;
      pd17 = (* (( (ptr) (* (( (ptr) gf←c8600)+37)/* var←c7896 */  ))+12) );
      return((word) ( *( (fPt) ((*  (ptr) pd17 ))))(handle←v4248, pd17));
      };
   }

static word Forward←P600(cq←v4780, h←v4808)
   word cq←v4780;
   word h←v4808;
   {
   register ptr gf←c8632 =  (ptr) &globalframe;
   word mustFork←v4852;
   word list←v5148;
   /* Forward: */ 
SOURCE(1904, 245)
   (void) (XR←MonitorEntry((word) (( (bPt) gf←c8632)+16)/* LOCK←v2524 */ ));
SOURCE(1904, 245)
   mustFork←v4852 = 0;
SOURCE(1988, 6)
   {
      word l←v7432;
      word h←v7464;
      h←v7464 = h←v4808;
SOURCE(1734, 164)
      l←v7432 = 0;
SOURCE(1808, 12)
      l←v7432 = (* (( (ptr) gf←c8632)+9)/* freeList←v2888 */  );
SOURCE(1822, 76)
      if ((l←v7432 == 0)) {
SOURCE(1836, 17)
         {
            word var←c8120;
            word var←c8152;
            var←c8120 = XR←NewObject(8, (* (( (ptr) gf←c8632)+12) ));
            var←c8152 = var←c8120;
            (*  (ptr) var←c8152 ) = h←v7464;
            l←v7432 = var←c8120;
            };
         }
      else {
SOURCE(1854, 17)
         (* (( (ptr) gf←c8632)+9)/* freeList←v2888 */  ) = (* (( (ptr) l←v7432)+1) );
SOURCE(1873, 11)
         (*  (ptr) l←v7432 ) = h←v7464;
SOURCE(1886, 12)
         (* (( (ptr) l←v7432)+1) ) = 0;
         };
SOURCE(1734, 164)
      list←v5148 = l←v7432;
      };
SOURCE(2023, 62)
   if (((* (( (ptr) cq←v4780)+7) ) == 0)) {
SOURCE(2045, 21)
      (* (( (ptr) cq←v4780)+7) ) = list←v5148;
      }
   else {
SOURCE(2066, 19)
      (* (( (ptr) (* (( (ptr) cq←v4780)+8) ))+1) ) = list←v5148;
      };
SOURCE(2087, 14)
   (* (( (ptr) cq←v4780)+8) ) = list←v5148;
SOURCE(2103, 46)
   if ((0 == (* (( (ptr) cq←v4780)+6) ))) {
SOURCE(2122, 27)
      mustFork←v4852 = 1;
      (* (( (ptr) cq←v4780)+6) ) = 1;
      };
SOURCE(1904, 245)
   (void) (XR←MonitorExit((word) (( (bPt) gf←c8632)+16)/* LOCK←v2524 */ ));
   return(mustFork←v4852);
   }

static word Fetch←P660(cq←v4912)
   word cq←v4912;
   {
   register ptr gf←c8664 =  (ptr) &globalframe;
   word h←v4956;
   word l←v5276;
   /* Fetch: */ 
SOURCE(2156, 180)
   (void) (XR←MonitorEntry((word) (( (bPt) gf←c8664)+16)/* LOCK←v2524 */ ));
SOURCE(2156, 180)
   h←v4956 = 0;
SOURCE(2220, 3)
   l←v5276 = (* (( (ptr) cq←v4912)+7) );
SOURCE(2250, 86)
   if ((l←v5276 != 0)) {
SOURCE(2266, 11)
      h←v4956 = (*  (ptr) l←v5276 );
SOURCE(2279, 17)
      (* (( (ptr) cq←v4912)+7) ) = (* (( (ptr) l←v5276)+1) );
SOURCE(2298, 14)
      {
         word l←v7384;
         l←v7384 = l←v5276;
SOURCE(1683, 13)
         (*  (ptr) l←v7384 ) = 0;
SOURCE(1698, 17)
         (* (( (ptr) l←v7384)+1) ) = (* (( (ptr) gf←c8664)+9)/* freeList←v2888 */  );
SOURCE(1717, 13)
         (* (( (ptr) gf←c8664)+9)/* freeList←v2888 */  ) = l←v7384;
         };
      }
   else {
SOURCE(2319, 17)
      (* (( (ptr) cq←v4912)+6) ) = 0;
      };
SOURCE(2156, 180)
   (void) (XR←MonitorExit((word) (( (bPt) gf←c8664)+16)/* LOCK←v2524 */ ));
   return(h←v4956);
   }

static void CallQueueProcess←P720(formal←c092)
   word formal←c092;
   {
   W5 var←c8696;
   /* declaration of cq←v5016 skipped */ 
   register ptr gf←c8728 =  (ptr) &globalframe;
   var←c8696.f4/* cq←v5016 */  = formal←c092;
   /* CallQueueProcess: */ 
SOURCE(2342, 194)
SOURCE(2385, 32)
   {
      word pd18;
      pd18 = (* (( (ptr) (* (( (ptr) gf←c8728)+38)/* var←c8184 */  ))+13) );
      (void) ( *( (fPt) ((*  (ptr) pd18 ))))((* ((( (ptr) var←c8696.f4/* cq←v5016 */ )+5)) ), pd18);
      };
SOURCE(2419, 117)
   lab←L100005: ;
SOURCE(2422, 114)
   {
      word var←c01;
      {
         word var←c089;
         var←c089 = (word) &var←c8696;
         var←c01 = (word) XR←Enable(( ((word)  (fPt) NoName←Q1236) ), ( ((word)  (fPt) NoName←Q1296) ), var←c089);
         };
      if ((var←c01 == 2)) {
         goto lab←L100005;
         }
      else {
         if ((var←c01 == 1)) {
            goto lab←L02;
            };
         };
      };
   goto lab←L100005;
   lab←L02: ;
   return;
   }

static word NoName←Q1236(formal←c087)
   word formal←c087;
   {
   register ptr gf←c086 =  (ptr) &globalframe;
SOURCE(2446, 90)
   lab←L100010: ;
SOURCE(2446, 90)
   {
      word h←v5404;
SOURCE(2449, 21)
      h←v5404 = (word) Fetch←P660((* ((( (ptr) formal←c087)+4)) ));
SOURCE(2472, 20)
      if ((h←v5404 == 0)) {
SOURCE(2486, 6)
         return(1);
         };
SOURCE(2494, 42)
      {
         word var←c8216;
         {
            word pd19;
            pd19 = (* (( (ptr) (* (( (ptr) gf←c086)+37)/* var←c7896 */  ))+12) );
            var←c8216 = (word) ( *( (fPt) ((*  (ptr) pd19 ))))(h←v5404, pd19);
            };
         {
            word pd20;
            pd20 = (* (( (ptr) (* (( (ptr) formal←c087)+4) ))+4) );
            (void) ( *( (fPt) ((*  (ptr) pd20 ))))(h←v5404, var←c8216, pd20);
            };
         };
      };
   goto lab←L100010;
   /* c2c skipped dead code */ 
   }

static void MainQueueProcess←P780()
   {
   register ptr gf←c8760 =  (ptr) &globalframe;
   /* MainQueueProcess: */ 
SOURCE(2560, 338)
SOURCE(2590, 47)
   {
      word pd21;
      pd21 = (* (( (ptr) (* (( (ptr) gf←c8760)+38)/* var←c8184 */  ))+13) );
      (void) ( *( (fPt) ((*  (ptr) pd21 ))))(3, pd21);
      };
SOURCE(2639, 259)
   lab←L100013: ;
SOURCE(2639, 259)
   {
      word handle←v5448;
SOURCE(2642, 43)
      {
         word pd22;
         pd22 = (* (( (ptr) (* (( (ptr) gf←c8760)+37)/* var←c7896 */  ))+16) );
         handle←v5448 = (word) ( *( (fPt) ((*  (ptr) pd22 ))))((* ((( (ptr) gf←c8760)+8)/* fq←v2664 */ ) ), pd22);
         };
SOURCE(2687, 211)
      if ((handle←v5448 != 0)) {
SOURCE(2708, 157)
         {
            word var←c8248;
            {
               word pd23;
               pd23 = (* (( (ptr) (* (( (ptr) gf←c8760)+37)/* var←c7896 */  ))+13) );
               var←c8248 = (word) ( *( (fPt) ((*  (ptr) pd23 ))))(handle←v5448, pd23);
               };
            if ((var←c8248 == 0)) {
               goto lab←L100014;
               };
            if (((* (( (ptr) gf←c8760)+10) ) == XR←GetReferentType(var←c8248))) {
               {
                  word cq←v5492;
                  cq←v5492 = var←c8248;
SOURCE(2775, 90)
                  if ((0 != (word) Forward←P600(cq←v5492, handle←v5448))) {
SOURCE(2820, 45)
SOURCE(2822, 41)
                     {
                        W2 var←c8280;
                        {
                           W2 var←c065;
                           word var←c064;
                           var←c064 = XR←ExtensionAlloc(5);
                           {
/*1*/   word tmpAddr24;
/*1*/   tmpAddr24 = (word) var←c064;
/*1*/   (*  (ptr) tmpAddr24 ) = ( ((word)  (fPt) NoName←Q1356) );
/*1*/   (* (( (ptr) tmpAddr24) + 1) ) = 0;
/*1*/   (* (( (ptr) tmpAddr24) + 2) ) = (word) (( (bPt) gf←c8760)+60)/* var←c7544 */ ;
/*1*/   (* (( (ptr) tmpAddr24) + 3) ) = 0;
/*1*/   (* (( (ptr) tmpAddr24) + 4) ) = cq←v5492;
/*1*/   };
                           (void) XR←Fork((word) &var←c065, var←c064);
                           var←c8280 = var←c065;
                           };
                        {
                           word pd25;
                           pd25 = (* (( (ptr) (* (( (ptr) gf←c8760)+38)/* var←c8184 */  ))+11) );
                           (void) ( *( (fPt) ((*  (ptr) pd25 ))))(var←c8280, pd25);
                           };
                        };
                     };
                  };
               }
            else {
               lab←L100014: ;
               };
            };
SOURCE(2886, 12)
         handle←v5448 = 0;
         };
      };
   goto lab←L100013;
   }

static void NoName←Q1296(formal←c073, formal←c200000, formal←c200001, formal←c200002, formal←c200003)
   word formal←c073;
   word formal←c200000;
   word formal←c200001;
   word formal←c200002;
   word formal←c200003;
   {
   if ((formal←c200001 == XR←Aborted)) {
SOURCE(2440, 4)
      (*  (ptr) formal←c073 ) = 2;
      (* (( (ptr) formal←c073)+1) ) = 2;
      return;
      };
   (*  (ptr) formal←c073 ) = 0;
   (* (( (ptr) formal←c073)+1) ) = 0;
   return;
   }

static word NoName←Q1356(formal←c066)
   word formal←c066;
   {
   word var←c068;
   word var←c067;
   /* intermediary proc for a FORK, nArgs: 1, nRets: 0 */ 
   var←c068 = (* (( (ptr) formal←c066)+4) );
   var←c067 = (* (( (ptr) formal←c066)+2) );
   formal←c066 = XR←ExtensionFree(formal←c066);
   (void) ( *( (fPt) ((*  (ptr) var←c067 ))))(var←c068, var←c067);
   return(0);
   }

/* file: FinalizeOpsImpl, module: FinalizeOpsImpl, compiled at: January 28, 1993 4:06:47 pm PST */ 
extern void XR←install←FinalizeOpsImpl() {
   NoName←Q1176();
   }
extern void XR←run←FinalizeOpsImpl() { XR←Start(&globalframe); }