/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1992 by Xerox Corporation.  All rights reserved. */
/* time: February 27, 1992 5:56:16 pm PST */
/* C2C version: October 16, 1990 (native) */
/* ref-counting: off */
/* file: TEditLocksImpl, module: TEditLocksImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
static char versionStamp[] = "@(#)mob←version [2754919512,2579146397] TEditLocksImpl";
typedef unsigned word, *ptr;
typedef unsigned char byte, *bPt;
typedef unsigned short half, *hPt;
typedef struct {word f0, f1, f2, f3, f4, f5;} W6;
typedef W6 *W6Pt;
typedef word (*fPt)();
typedef struct {word f0, f1, f2, f3, f4, f5, f6;} W7;
typedef struct {word f0, f1;} W2;
typedef W2 *W2Pt;
#define SOURCE(p, l) /* source p, l */
#define BCK(idx, lim) ( ((unsigned) idx) >= ((unsigned) lim) ? (XR←RaiseBoundsFault()) : (idx) )
#define MAX(cast, x, y)  ( ( cast x) > ( cast y) ? (x) : (y) )
static void NoName←Q1260();
static void TEditLocksImpl←P0();
static void LockBoth←P60();
static word Lock←P120();
static void LockIt←P180();
static word NoName←Q1320();
static word LockOrder←P240();
static void Unlock←P300();
static void UnlockIt←P360();
static word NoName←Q1380();
static word LockDocAndTdd←P420();
static void UnlockDocAndTdd←P480();
static word WaitingForWrite←P540();
static word GetRoot←P600();
static word LockedGetLock←P720();
static word NoName←Q1440();
static void NoName←Q1500();
static void NoName←Q1560();
static void NoName←Q1620();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\241\200\031\316\300\154\273\372\020\100\164\000\000"};
static struct {unsigned f; char r[4];} string2 = {196611, "\004F\000"};
static struct {unsigned f; char r[4];} string3 = {131076, "\216\251\000"};
static struct {unsigned f; char r[4];} string4 = {65537, "\001\000\000"};
static struct {unsigned f; char r[16];} string5 = {917520, "\216\257\300\363\223\326\161\300\017\164\046\072\104\350\000"};
static struct {unsigned f; char r[16];} string6 = {851984, "\257\300\113\175\243\331\300\252\247\212\133\100\164\000\000"};
static struct {unsigned f; char r[36];} string7 = {2162721, "\006\014\000\001\060\001\064\001\070\001\074\001\100\100\001\100\124\001\100\130\001\100\134\001\100\140\001\100\144\001\100\150\001\000\000"};
static struct {unsigned f; char r[16];} string8 = {851984, "\257\300\343\357\262\137\300\144\166\356\317\100\164\000\000"};
static struct {unsigned f; char r[16];} string9 = {851981, "\006\005\000\001\004\001\054\001\070\001\100\114\001\000\000"};
static struct {unsigned f; char r[16];} string10 = {786448, "LockedViewer\000\000\000"};
static struct {unsigned f; char r[16];} string11 = {786448, "DocumentLock\000\000\000"};
static struct {unsigned f; char r[16];} string12 = {917520, "LockDocAndTdd1\000"};
static struct {unsigned f; char r[16];} string13 = {917520, "LockDocAndTdd2\000"};
static struct {unsigned f; char r[16];} string14 = {851984, "\257\300\244\064\274\130\300\231\272\246\235\100\200\000\000"};
static struct {unsigned f; char r[16];} string15 = {786444, "\006\004\040\001\044\001\050\001\100\124\004\017\000\000\000"};
static struct {unsigned f; char r[16];} string16 = {851984, "\257\300\234\060\361\073\300\103\025\207\123\100\150\000\000"};
static struct {unsigned f; char r[16];} string17 = {851984, "\257\300\240\236\274\315\300\111\163\325\023\100\150\000\000"};
static struct {unsigned f; char r[16];} string18 = {851984, "\257\300\237\211\044\154\300\046\105\033\126\100\150\000\000"};
static struct {unsigned f; char r[16];} string19 = {851984, "\257\300\343\357\262\137\300\144\166\356\317\100\150\000\000"};
static struct {unsigned f; char r[16];} string20 = {851984, "\257\300\071\221\120\257\300\230\321\322\204\100\150\000\000"};
static struct {unsigned f; char r[16];} string21 = {851984, "\257\300\254\253\350\355\300\233\126\335\104\100\150\000\000"};
static struct {unsigned f; char r[16];} string22 = {851984, "\257\300\234\330\257\310\300\272\273\374\141\100\150\000\000"};
static struct {unsigned f; char r[16];} string23 = {851984, "\257\300\241\200\031\316\300\154\273\372\020\100\150\000\000"};
static struct {
   word f0[25]; word f25; word f26; word f27; 
   word f28; word f29; word f30; word f31; 
   word f32; word f33; word f34; word f35; 
   word f36; word f37; word f38; word f39; 
   word f40; word f41; word f42; word f43; 
   word f44; word f45; word f46; word f47; 
   word f48[15]; 
   } globalframe = {
   {0}, (word) LockedGetLock←P720, 0, (word) GetRoot←P600, 
   0, (word) WaitingForWrite←P540, 0, (word) UnlockDocAndTdd←P480, 
   0, (word) LockDocAndTdd←P420, 0, (word) UnlockIt←P360, 
   0, (word) Unlock←P300, 0, (word) LockOrder←P240, 
   0, (word) LockIt←P180, 0, (word) Lock←P120, 
   0, (word) LockBoth←P60, 0, (word) TEditLocksImpl←P0, 
   {0}
   };

static void NoName←Q1260()
   {
   register ptr gf←c0114 =  (ptr) &globalframe;
   word var←c16864;
   (* (( (ptr) gf←c0114)+11) ) = (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2);
   (* (( (ptr) gf←c0114)+15) ) = (word) XR←GetTypeIndex((word) &string3, 0, (word) &string4);
   (* (( (ptr) gf←c0114)+16) ) = (word) XR←GetTypeIndex((word) &string5, 0, (word) &string4);
   (* (( (ptr) gf←c0114)+19) ) = (word) XR←GetTypeIndex((word) &string6, 0, (word) &string7);
   (* (( (ptr) gf←c0114)+20) ) = (word) XR←GetTypeIndex((word) &string8, 0, (word) &string9);
   (*  (ptr) (( (bPt) gf←c0114)+84) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c0114)+15) ), (word) &string10);
   (*  (ptr) (( (bPt) gf←c0114)+88) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c0114)+15) ), (word) &string11);
   (*  (ptr) (( (bPt) gf←c0114)+92) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c0114)+16) ), (word) &string12);
   (*  (ptr) (( (bPt) gf←c0114)+96) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c0114)+16) ), (word) &string13);
   (void) XR←DeclareGlobalFrame((word) "TEditLocksImpl", &globalframe, (word) XR←GetTypeIndex((word) &string14, 0, (word) &string15)
      , (word) (( (bPt) gf←c0114)+188)/* var←c16160 */ );
   var←c16864 = (word) XR←ImportInterface((word) "NodeProps", (word) XR←GetTypeIndexS((word) (&string16)), 28);
   (* (( (ptr) gf←c0114)+55)/* var←c16288 */  ) = var←c16864;
   (void) XR←ImportProcS(var←c16864, 67633410);
   (void) XR←ImportProcS(var←c16864, 786435);
   (void) XR←ImportProcS(var←c16864, 67638274);
   (void) XR←ImportProcS(var←c16864, 67638018);
   (void) XR←ImportProcS(var←c16864, 67637762);
   (void) XR←ImportProcS(var←c16864, 1052932);
   var←c16864 = (word) XR←ImportInterface((word) "Process", (word) XR←GetTypeIndexS((word) (&string17)), 22);
   (* (( (ptr) gf←c0114)+58)/* var←c16448 */  ) = var←c16864;
   (void) XR←ImportProcS(var←c16864, 134219776);
   var←c16864 = (word) XR←ImportInterface((word) "MonitoredQueue", (word) XR←GetTypeIndexS((word) (&string18)), 9);
   (* (( (ptr) gf←c0114)+61)/* var←c16704 */  ) = var←c16864;
   (void) XR←ImportProcS(var←c16864, 525058);
   var←c16864 = (word) XR←ImportInterface((word) "TEditDocument", (word) XR←GetTypeIndexS((word) (&string19)), 6);
   (* (( (ptr) gf←c0114)+56)/* var←c16320 */  ) = var←c16864;
   (void) XR←ImportProcS(var←c16864, 262657);
   (void) XR←ImportProcS(var←c16864, 68157700);
   (void) XR←ImportProcS(var←c16864, 67372289);
   var←c16864 = (word) XR←ImportInterface((word) "TEditRefresh", (word) XR←GetTypeIndexS((word) (&string20)), 3);
   (* (( (ptr) gf←c0114)+60)/* var←c16672 */  ) = var←c16864;
   var←c16864 = (word) XR←ImportInterface((word) "ViewerLocks", (word) XR←GetTypeIndexS((word) (&string21)), 9);
   (* (( (ptr) gf←c0114)+59)/* var←c16512 */  ) = var←c16864;
   (void) XR←ImportProcS(var←c16864, 67634946);
   var←c16864 = (word) XR←ImportInterface((word) "ViewerPrivate", (word) XR←GetTypeIndexS((word) (&string22)), 68);
   (* (( (ptr) gf←c0114)+57)/* var←c16416 */  ) = var←c16864;
   (void) XR←ImportProcS(var←c16864, 267265);
   (void) XR←ImportProcS(var←c16864, 267009);
   var←c16864 = (word) XR←ExportInterface((word) "TEditLocks", (word) XR←GetTypeIndexS((word) (&string23)), 7);
   (* (( (ptr) gf←c0114)+62)/* var←c16896 */  ) = var←c16864;
   (void) XR←ExportProcS(var←c16864, (word) (( (bPt) gf←c0114)+172)/* var←c16096 */ , 67895299);
   (void) XR←ExportProcS(var←c16864, (word) (( (bPt) gf←c0114)+180)/* var←c16128 */ , 135528709);
   (void) XR←ExportProcS(var←c16864, (word) (( (bPt) gf←c0114)+156)/* var←c16032 */ , 67633666);
   (void) XR←ExportProcS(var←c16864, (word) (( (bPt) gf←c0114)+148)/* var←c16000 */ , 262913);
   (void) XR←ExportProcS(var←c16864, (word) (( (bPt) gf←c0114)+132)/* var←c15936 */ , 68420613);
   (void) XR←ExportProcS(var←c16864, (word) (( (bPt) gf←c0114)+124)/* var←c15904 */ , 263425);
   (void) XR←ExportProcS(var←c16864, (word) (( (bPt) gf←c0114)+116)/* var←c15872 */ , 67372545);
   }

static void TEditLocksImpl←P0(formal←c037, formal←c035)
   word formal←c037;
   word formal←c035;
   {
   register ptr gf←c16928 =  (ptr) &globalframe;
   /* TEditLocksImpl: */ 
SOURCE(476, 5684)
SOURCE(802, 27)
   (* (( (ptr) gf←c16928)+6)/* lockRootViewer←v3028 */  ) = 1;
SOURCE(831, 28)
   (* (( (ptr) gf←c16928)+7)/* lockSplitViewer←v3056 */  ) = 1;
SOURCE(5540, 38)
   {
      word var←c16256;
      var←c16256 = XR←NewObject(68, (* (( (ptr) gf←c16928)+11) ));
      (*  (W6Pt) (( (ptr) var←c16256)+11) ) = (*  (W6Pt) (( (ptr) gf←c16928)+49)/* var←c16224 */  );
      (* (( (ptr) gf←c16928)+8)/* privateLock←v3392 */  ) = var←c16256;
      };
SOURCE(6066, 94)
   {
      word pd24;
      pd24 = (* (( (ptr) (* (( (ptr) gf←c16928)+55)/* var←c16288 */  ))+21) );
      (void) ( *( (fPt) ((*  (ptr) pd24 ))))((* (( (ptr) gf←c16928)+22) ), (* (( (ptr) (* (( (ptr) gf←c16928)+55)/* var←c16288 */  ))+22)
          ), (* (( (ptr) (* (( (ptr) gf←c16928)+55)/* var←c16288 */  ))+23) ), (* (( (ptr) (* (( (ptr) gf←c16928)+55)/* var←c16288 */  ))+24)
          ), pd24);
      };
   }

static void LockBoth←P60(formal←c045, doc1←v3556, doc2←v3584, who←v3612, access1←v3640, access2←v3668)
   word formal←c045;
   word doc1←v3556;
   word doc2←v3584;
   word who←v3612;
   word access1←v3640;
   word access2←v3668;
   {
   register ptr gf←c16960 =  (ptr) &globalframe;
   word lock1←v3712;
   word lock2←v3740;
   /* LockBoth: */ 
SOURCE(862, 398)
SOURCE(862, 398)
   lock1←v3712 = 0;
SOURCE(862, 398)
   lock2←v3740 = 0;
SOURCE(997, 35)
   (* (( (ptr) gf←c16960)+4)/* locksBothCount←v2972 */  ) = ((* (( (ptr) gf←c16960)+4)/* locksBothCount←v2972 */  ) + 1);
SOURCE(1034, 226)
   if ( ( (doc1←v3556 == doc2←v3584) ? (access1←v3640 == 1) : 0 )  ||  ( (doc1←v3556 != doc2←v3584) ? (0 != (word) LockOrder←P240(
      doc1←v3556, doc2←v3584)) : 0 ) ) {
SOURCE(1117, 32)
      lock1←v3712 = (word) Lock←P120(doc1←v3556, who←v3612, access1←v3640);
SOURCE(1151, 32)
      lock2←v3740 = (word) Lock←P120(doc2←v3584, who←v3612, access2←v3668);
      }
   else {
SOURCE(1194, 32)
      lock2←v3740 = (word) Lock←P120(doc2←v3584, who←v3612, access2←v3668);
SOURCE(1228, 32)
      lock1←v3712 = (word) Lock←P120(doc1←v3556, who←v3612, access1←v3640);
      };
   /* removed tail goto */ 
   (*  (ptr) formal←c045 ) = lock1←v3712;
   (* (( (ptr) formal←c045)+1) ) = lock2←v3740;
   return;
   }

static word Lock←P120(doc←v3800, who←v3828, access←v3856)
   word doc←v3800;
   word who←v3828;
   word access←v3856;
   {
   register ptr gf←c16992 =  (ptr) &globalframe;
   word lock←v3900;
   /* Lock: */ 
SOURCE(1268, 860)
SOURCE(1268, 860)
   lock←v3900 = 0;
SOURCE(1374, 16)
   if ((doc←v3800 == 0)) {
SOURCE(1390, 5)
      (void) XR←RaiseUnnamedError();
      };
SOURCE(1397, 731)
   lab←L100003: ;
SOURCE(1397, 731)
   {
      word v←v5072;
      word root←v5100;
      word localViewer←v5128 = 0;
SOURCE(1400, 47)
      {
         word pd25;
         pd25 = (* (( (ptr) (* (( (ptr) gf←c16992)+56)/* var←c16320 */  ))+9) );
         v←v5072 = (word) ( *( (fPt) ((*  (ptr) pd25 ))))(doc←v3800, pd25);
         };
SOURCE(1449, 25)
      root←v5100 = (word) GetRoot←P600(v←v5072);
SOURCE(1503, 40)
      {
         word var←c16352;
         word lock←v15760;
SOURCE(5410, 126)
         lock←v15760 = 0;
SOURCE(5494, 42)
         var←c16352 = (word) LockedGetLock←P720((* (( (ptr) gf←c16992)+8)/* privateLock←v3392 */  ), doc←v3800);
         lock←v3900 = var←c16352;
         };
      if ((lock←v3900 == 0)) {
SOURCE(1537, 6)
         return(lock←v3900);
         };
SOURCE(1545, 217)
      if ((root←v5100 != 0)) {
SOURCE(1566, 61)
         if ( ( (0 != (* (( (ptr) gf←c16992)+6)/* lockRootViewer←v3028 */  )) ? ((* (( (ptr) root←v5100)+21) ) == 0) : 0 ) ) {
SOURCE(1609, 18)
            localViewer←v5128 = root←v5100;
            };
SOURCE(1629, 62)
         if ( ( (0 != (* (( (ptr) gf←c16992)+7)/* lockSplitViewer←v3056 */  )) ? ((* (( (ptr) root←v5100)+21) ) != 0) : 0 ) ) {
SOURCE(1673, 18)
            localViewer←v5128 = root←v5100;
            };
SOURCE(1693, 69)
         if ((localViewer←v5128 != 0)) {
SOURCE(1719, 43)
            {
               word pd26;
               pd26 = (* (( (ptr) (* (( (ptr) gf←c16992)+57)/* var←c16416 */  ))+23) );
               (void) ( *( (fPt) ((*  (ptr) pd26 ))))(localViewer←v5128, pd26);
               };
            };
         };
SOURCE(1767, 284)
      if ((root←v5100 == (word) GetRoot←P600(v←v5072))) {
SOURCE(1795, 256)
         {
            word pd27;
            pd27 = (* (( (ptr) (* (( (ptr) gf←c16992)+56)/* var←c16320 */  ))+9) );
            if (((word) ( *( (fPt) ((*  (ptr) pd27 ))))(doc←v3800, pd27) == v←v5072)) {
SOURCE(1845, 30)
               (void) LockIt←P180(lock←v3900, who←v3828, access←v3856, doc←v3800);
SOURCE(1877, 100)
               {
                  word pd28;
                  pd28 = (* (( (ptr) (* (( (ptr) gf←c16992)+56)/* var←c16320 */  ))+9) );
                  if (((word) ( *( (fPt) ((*  (ptr) pd28 ))))(doc←v3800, pd28) == v←v5072)) {
SOURCE(1927, 50)
                     {
                        word pd29;
                        pd29 = (* (( (ptr) (* (( (ptr) gf←c16992)+55)/* var←c16288 */  ))+4) );
                        (void) ( *( (fPt) ((*  (ptr) pd29 ))))(doc←v3800, (* (( (ptr) gf←c16992)+21) ), localViewer←v5128, pd29);
                        };
SOURCE(1979, 4)
                     goto lab←L100002;
                     };
                  };
SOURCE(1988, 42)
               {
                  word pd30;
                  pd30 = (* (( (ptr) (* (( (ptr) gf←c16992)+55)/* var←c16288 */  ))+4) );
                  (void) ( *( (fPt) ((*  (ptr) pd30 ))))(doc←v3800, (* (( (ptr) gf←c16992)+21) ), 0, pd30);
                  };
SOURCE(2032, 19)
               (void) UnlockIt←P360(lock←v3900, doc←v3800);
               };
            };
         };
SOURCE(2059, 69)
      if ((localViewer←v5128 != 0)) {
SOURCE(2085, 43)
         {
            word pd31;
            pd31 = (* (( (ptr) (* (( (ptr) gf←c16992)+57)/* var←c16416 */  ))+24) );
            (void) ( *( (fPt) ((*  (ptr) pd31 ))))(localViewer←v5128, pd31);
            };
         };
      };
   goto lab←L100003;
   lab←L100002: ;
SOURCE(1268, 860)
   return(lock←v3900);
   }

static void LockIt←P180(formal←c0137, formal←c0138, formal←c0139, doc←v4044)
   word formal←c0137;
   word formal←c0138;
   word formal←c0139;
   word doc←v4044;
   {
   W7 var←c17024;
   /* declaration of lock←v3960 skipped */ 
   /* declaration of who←v3988 skipped */ 
   /* declaration of access←v4016 skipped */ 
   var←c17024.f4/* lock←v3960 */  = formal←c0137;
   var←c17024.f5/* who←v3988 */  = formal←c0138;
   var←c17024.f6/* access←v4016 */  = formal←c0139;
   /* LockIt: */ 
SOURCE(2143, 684)
   (void) (XR←MonitorEntry(var←c17024.f4/* lock←v3960 */ ));
SOURCE(2233, 594)
   {
      word var←c0128;
      var←c0128 = (word) &var←c17024;
       (void) (word) XR←Enable(( ((word)  (fPt) NoName←Q1320) ), ( ((word)  (fPt) NoName←Q1620) ), var←c0128);
      };
SOURCE(2143, 684)
   (void) (XR←MonitorExit(var←c17024.f4/* lock←v3960 */ ));
   return;
   }

static word NoName←Q1320(formal←c0119)
   word formal←c0119;
   {
   register ptr gf←c0118 =  (ptr) &globalframe;
SOURCE(2256, 18)
   {
      W2 myProcess←v5172;
SOURCE(2256, 18)
      (*  (ptr) (word) &myProcess←v5172 ) = 0;
      (* (( (ptr) (word) &myProcess←v5172) + 1) ) = 0;
SOURCE(2284, 43)
SOURCE(2285, 42)
      {
         word pd32;
         pd32 = (* (( (ptr) (* (( (ptr) gf←c0118)+58)/* var←c16448 */  ))+12) );
         (void) ( *( (fPt) ((*  (ptr) pd32 ))))((word) (&myProcess←v5172), pd32);
         };
SOURCE(2330, 354)
      if (((* (( (ptr) formal←c0119)+6) ) == 0)) {
SOURCE(2352, 79)
         if ( ! XR←EqualWords((( (ptr) (* (( (ptr) formal←c0119)+4) ))+7), &myProcess←v5172, 2)) {
SOURCE(2385, 46)
            lab←L100009: ;
            {
               W2 temp33;
               (*  (ptr) &temp33 ) = 0;
               (* (( (ptr) &temp33) + 1) ) = 0;
               if ( ! XR←EqualWords((( (ptr) (* (( (ptr) formal←c0119)+4) ))+7), &temp33, 2)) {
                  }
               else {
                  goto lab←L100007;
                  };
               };
SOURCE(2413, 18)
            (void) (XR←Wait((* (( (ptr) formal←c0119)+4) ), (word) (( (bPt) (* (( (ptr) formal←c0119)+4) ))+44)));
            goto lab←L100009;
            lab←L100007: ;
            };
         }
      else {
SOURCE(2450, 234)
         if ( ! XR←EqualWords((( (ptr) (* (( (ptr) formal←c0119)+4) ))+7), &myProcess←v5172, 2)) {
SOURCE(2485, 171)
            if (((* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+5) ) > 0)) {
SOURCE(2510, 45)
               (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+4) ) = ((* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+4) ) + 1);
SOURCE(2557, 42)
               lab←L100012: ;
               if (((* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+5) ) > 0)) {
                  }
               else {
                  goto lab←L100010;
                  };
SOURCE(2581, 18)
               (void) (XR←Wait((* (( (ptr) formal←c0119)+4) ), (word) (( (bPt) (* (( (ptr) formal←c0119)+4) ))+44)));
               goto lab←L100012;
               lab←L100010: ;
SOURCE(2610, 46)
               (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+4) ) = ((* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+4) ) - 1);
               };
SOURCE(2659, 25)
            (*  (W2Pt) (( (ptr) (* (( (ptr) formal←c0119)+4) ))+7) ) = myProcess←v5172;
            };
         };
SOURCE(2688, 64)
      if (((* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+5) ) == 0)) {
SOURCE(2709, 25)
         (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+10) ) = (* (( (ptr) formal←c0119)+5) );
         }
      else {
SOURCE(2734, 18)
         (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+9) ) = (* (( (ptr) formal←c0119)+5) );
         };
SOURCE(2754, 25)
      {
         word idx34;
         (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+5) ) = (
            idx34 = (word) ((* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+5) ) + 1),
            BCK(idx34, 256)
            );
         };
SOURCE(2781, 46)
      {
         word x35;
         word x36;
         (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+6) ) = (x35 = (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+6) ),
            x36 = (* (( (ptr) (* (( (ptr) formal←c0119)+4) ))+5) ),
            MAX( (unsigned) , x35, x36));
         };
      };
   return(0);
   }

static word LockOrder←P240(doc1←v4104, doc2←v4132)
   word doc1←v4104;
   word doc2←v4132;
   {
   register ptr gf←c17056 =  (ptr) &globalframe;
   word var←c4176;
   word v1←v5232;
   word v2←v5260;
   /* LockOrder: */ 
SOURCE(2833, 335)
SOURCE(2902, 77)
   {
      word tc37;
      word pd38;
      if ((doc1←v4104 == 0)) {
         tc37 =  (word) 0;
         }
      else {
         pd38 = (* (( (ptr) (* (( (ptr) gf←c17056)+56)/* var←c16320 */  ))+9) );
         tc37 =  (word) ( *( (fPt) ((*  (ptr) pd38 ))))(doc1←v4104, pd38);
         };
      v1←v5232 = tc37;
      };
SOURCE(2981, 77)
   {
      word tc39;
      word pd40;
      if ((doc2←v4132 == 0)) {
         tc39 =  (word) 0;
         }
      else {
         pd40 = (* (( (ptr) (* (( (ptr) gf←c17056)+56)/* var←c16320 */  ))+9) );
         tc39 =  (word) ( *( (fPt) ((*  (ptr) pd40 ))))(doc2←v4132, pd40);
         };
      v2←v5260 = tc39;
      };
SOURCE(3060, 54)
   if ((v1←v5232 != v2←v5260)) {
SOURCE(3076, 38)
      {
         word pd41;
         pd41 = (* (( (ptr) (* (( (ptr) gf←c17056)+59)/* var←c16512 */  ))+11) );
         return((word) ( *( (fPt) ((*  (ptr) pd41 ))))(v1←v5232, v2←v5260, pd41));
         };
      };
SOURCE(3116, 52)
   return(( (int)doc1←v4104 <=  (int)doc2←v4132));
   }

static void Unlock←P300(doc←v4236)
   word doc←v4236;
   {
   register ptr gf←c17088 =  (ptr) &globalframe;
   word lock←v5304 = 0;
   /* Unlock: */ 
SOURCE(3172, 143)
SOURCE(3231, 16)
   if ((doc←v4236 == 0)) {
SOURCE(3247, 5)
      (void) XR←RaiseUnnamedError();
      };
SOURCE(3254, 40)
   {
      word var←c16544;
      word lock←v15712;
SOURCE(5410, 126)
      lock←v15712 = 0;
SOURCE(5494, 42)
      var←c16544 = (word) LockedGetLock←P720((* (( (ptr) gf←c17088)+8)/* privateLock←v3392 */  ), doc←v4236);
      lock←v5304 = var←c16544;
      };
   if ((lock←v5304 == 0)) {
SOURCE(3288, 6)
      return;
      };
SOURCE(3296, 19)
   (void) UnlockIt←P360(lock←v5304, doc←v4236);
   }

static void UnlockIt←P360(formal←c0140, formal←c0141)
   word formal←c0140;
   word formal←c0141;
   {
   W6 var←c17120;
   /* declaration of lock←v4296 skipped */ 
   /* declaration of doc←v4324 skipped */ 
   var←c17120.f4/* lock←v4296 */  = formal←c0140;
   var←c17120.f5/* doc←v4324 */  = formal←c0141;
   /* UnlockIt: */ 
SOURCE(3321, 982)
   (void) (XR←MonitorEntry(var←c17120.f4/* lock←v4296 */ ));
SOURCE(3381, 922)
   {
      word var←c01;
      {
         word var←c0129;
         var←c0129 = (word) &var←c17120;
         var←c01 = (word) XR←Enable(( ((word)  (fPt) NoName←Q1380) ), ( ((word)  (fPt) NoName←Q1560) ), var←c0129);
         };
      if ((var←c01 == 1)) {
         goto lab←L03;
         };
      };
SOURCE(3321, 982)
   (void) (XR←MonitorExit(var←c17120.f4/* lock←v4296 */ ));
   return;
   lab←L03: ;
   return;
   }

static word NoName←Q1380(formal←c0123)
   word formal←c0123;
   {
   register ptr gf←c0122 =  (ptr) &globalframe;
SOURCE(3404, 57)
   {
      word v←v5348;
      W2 var←c073;
      word var←c16608;
SOURCE(3404, 57)
      {
         word pd42;
         pd42 = (* (( (ptr) (* (( (ptr) gf←c0122)+55)/* var←c16288 */  ))+5) );
         v←v5348 = XR←Narrow((word) ( *( (fPt) ((*  (ptr) pd42 ))))((* (( (ptr) formal←c0123)+5) ), (* (( (ptr) gf←c0122)+21) ), pd42)
            , (* (( (ptr) gf←c0122)+19) ));
         };
SOURCE(3463, 23)
      if (((* (( (ptr) formal←c0123)+4) ) == 0)) {
SOURCE(3480, 6)
         (void) (XR←MonitorExit(* (( (ptr) formal←c0123)+4) ));
         return(1);
         };
SOURCE(3488, 24)
      if (((* (( (ptr) (* (( (ptr) formal←c0123)+4) ))+5) ) <= 0)) {
SOURCE(3512, 5)
         (void) XR←RaiseUnnamedError();
         };
SOURCE(3527, 73)
SOURCE(3528, 67)
      {
         word tc43;
         W2 temp44;
         (*  (ptr) &temp44 ) = 0;
         (* (( (ptr) &temp44) + 1) ) = 0;
         if ( ! XR←EqualWords((( (ptr) (* (( (ptr) formal←c0123)+4) ))+7), &temp44, 2)) {
            {
               word pd45;
               pd45 = (* (( (ptr) (* (( (ptr) gf←c0122)+58)/* var←c16448 */  ))+12) );
               (void) ( *( (fPt) ((*  (ptr) pd45 ))))((word) (&var←c073), pd45);
               };
            tc43 =  (word)  ! XR←EqualWords((( (ptr) (* (( (ptr) formal←c0123)+4) ))+7), &var←c073, 2);
            }
         else {
            tc43 =  (word) 0;
            };
         if (tc43) {
SOURCE(3595, 5)
            (void) XR←RaiseUnnamedError();
            };
         };
      {
         word idx46;
         var←c16608 = (
            idx46 = (word) ((* (( (ptr) (* (( (ptr) formal←c0123)+4) ))+5) ) - 1),
            BCK(idx46, 256)
            );
         };
      (* (( (ptr) (* (( (ptr) formal←c0123)+4) ))+5) ) = var←c16608;
      if ((var←c16608 > 0)) {
         }
      else {
         {
            W2 temp47;
            (*  (ptr) &temp47 ) = 0;
            (* (( (ptr) &temp47) + 1) ) = 0;
            if ( ! XR←EqualWords((( (ptr) (* (( (ptr) formal←c0123)+4) ))+7), &temp47, 2)) {
SOURCE(3711, 404)
               {
                  word viewer←v5392;
SOURCE(3713, 66)
                  {
                     word pd48;
                     pd48 = (* (( (ptr) (* (( (ptr) gf←c0122)+56)/* var←c16320 */  ))+9) );
                     viewer←v5392 = (word) ( *( (fPt) ((*  (ptr) pd48 ))))((* ((( (ptr) formal←c0123)+5)) ), pd48);
                     };
SOURCE(3781, 40)
                  if ((viewer←v5392 != v←v5348)) {
SOURCE(3800, 21)
                     (* (( (ptr) gf←c0122)+5)/* dubious←v3000 */  ) = ((* (( (ptr) gf←c0122)+5)/* dubious←v3000 */  ) + 1);
                     };
SOURCE(3823, 267)
                  if ((viewer←v5392 != 0)) {
SOURCE(3846, 177)
                     {
                        register word v←v5436;
                        v←v5436 = viewer←v5392;
                        lab←L100019: ;
                        if ((v←v5436 != 0)) {
                           }
                        else {
                           goto lab←L100016;
                           };
SOURCE(3908, 80)
                        {
                           word var←c16640;
                           var←c16640 = (* (( (ptr) v←v5436)+26) );
                           if ((var←c16640 == 0)) {
/*1*/   goto lab←L100020;
/*1*/   };
                           if (((* (( (ptr) gf←c0122)+20) ) == XR←GetReferentType(var←c16640))) {
/*1*/   {
/*1*/      word tdd←v5480;
/*1*/      tdd←v5480 = var←c16640;
SOURCE(3972, 16)
/*1*/      (* (( (ptr) tdd←v5480)+9) ) = 1;
/*1*/      };
/*1*/   }
                           else {
/*1*/   lab←L100020: ;
/*1*/   };
                           };
SOURCE(3999, 24)
                        if (((* (( (ptr) v←v5436)+21) ) == viewer←v5392)) {
SOURCE(4023, 4)
                           goto lab←L100017;
                           };
                        v←v5436 = (* (( (ptr) v←v5436)+21) );
                        goto lab←L100019;
                        lab←L100016: ;
                        lab←L100017: ;
                        };
SOURCE(4038, 52)
                     {
                        word pd49;
                        pd49 = (* (( (ptr) (* (( (ptr) gf←c0122)+61)/* var←c16704 */  ))+7) );
                        (void) ( *( (fPt) ((*  (ptr) pd49 ))))((* (( (ptr) formal←c0123)+5) ), (*  (ptr) (* (( (ptr) (* (( (ptr) gf←c0122)+60)/* var←c16672 */  ))+4)
                            ) ), pd49);
                        };
                     };
SOURCE(4095, 18)
                  {
                     word tmpAddr50;
                     tmpAddr50 = (word) (( (ptr) (* (( (ptr) formal←c0123)+4) ))+7);
                     (*  (ptr) tmpAddr50 ) = 0;
                     (* (( (ptr) tmpAddr50) + 1) ) = 0;
                     };
                  };
               };
            };
SOURCE(4127, 42)
         {
            word pd51;
            pd51 = (* (( (ptr) (* (( (ptr) gf←c0122)+55)/* var←c16288 */  ))+4) );
            (void) ( *( (fPt) ((*  (ptr) pd51 ))))((* (( (ptr) formal←c0123)+5) ), (* (( (ptr) gf←c0122)+21) ), 0, pd51);
            };
SOURCE(4171, 34)
         (* (( (ptr) (* (( (ptr) formal←c0123)+4) ))+9) ) = 0;
         (* (( (ptr) (* (( (ptr) formal←c0123)+4) ))+10) ) = 0;
SOURCE(4207, 17)
         (* (( (ptr) (* (( (ptr) formal←c0123)+4) ))+6) ) = 0;
SOURCE(4226, 23)
         (void) (XR←Broadcast((word) (( (bPt) (* (( (ptr) formal←c0123)+4) ))+44)));
         };
SOURCE(4254, 49)
      if ((v←v5348 != 0)) {
SOURCE(4270, 33)
         {
            word pd52;
            pd52 = (* (( (ptr) (* (( (ptr) gf←c0122)+57)/* var←c16416 */  ))+24) );
            (void) ( *( (fPt) ((*  (ptr) pd52 ))))(v←v5348, pd52);
            };
         };
      };
   return(0);
   }

static word LockDocAndTdd←P420(tdd←v4384, who←v4412, access←v4440, interrupt←v4468, defer←v4496)
   word tdd←v4384;
   word who←v4412;
   word access←v4440;
   word interrupt←v4468;
   word defer←v4496;
   {
   register ptr gf←c17152 =  (ptr) &globalframe;
   word lock←v4540;
   /* LockDocAndTdd: */ 
SOURCE(4309, 611)
SOURCE(4309, 611)
   lock←v4540 = 0;
SOURCE(4475, 88)
   {
      word pd53;
      pd53 = (* (( (ptr) (* (( (ptr) gf←c17152)+56)/* var←c16320 */  ))+5) );
      if ((0 == (word) ( *( (fPt) ((*  (ptr) pd53 ))))(tdd←v4384, (* (( (ptr) gf←c17152)+23) ), interrupt←v4468, defer←v4496, pd53)
      )) {
SOURCE(4551, 12)
         return(0);
         };
      };
SOURCE(4565, 355)
   lab←L100023: ;
SOURCE(4565, 355)
   {
      word doc←v5524;
SOURCE(4568, 28)
      doc←v5524 = (*  (ptr) tdd←v4384 );
SOURCE(4598, 25)
      {
         word pd54;
         pd54 = (* (( (ptr) (* (( (ptr) gf←c17152)+56)/* var←c16320 */  ))+6) );
         (void) ( *( (fPt) ((*  (ptr) pd54 ))))(tdd←v4384, pd54);
         };
SOURCE(4677, 28)
      if ((doc←v5524 == 0)) {
SOURCE(4693, 12)
         return(0);
         };
SOURCE(4707, 29)
      lock←v4540 = (word) Lock←P120(doc←v5524, who←v4412, access←v4440);
SOURCE(4738, 112)
      {
         word pd55;
         pd55 = (* (( (ptr) (* (( (ptr) gf←c17152)+56)/* var←c16320 */  ))+5) );
         if ((0 == (word) ( *( (fPt) ((*  (ptr) pd55 ))))(tdd←v4384, (* (( (ptr) gf←c17152)+24) ), interrupt←v4468, defer←v4496, pd55)
         )) {
SOURCE(4816, 19)
            (void) UnlockIt←P360(lock←v4540, doc←v5524);
SOURCE(4837, 13)
            return(0);
            };
         };
SOURCE(4853, 29)
      if (((*  (ptr) tdd←v4384 ) == doc←v5524)) {
SOURCE(4876, 6)
         return(lock←v4540);
         };
SOURCE(4901, 19)
      (void) UnlockIt←P360(lock←v4540, doc←v5524);
      };
   goto lab←L100023;
   }

static void UnlockDocAndTdd←P480(tdd←v4600)
   word tdd←v4600;
   {
   register ptr gf←c17184 =  (ptr) &globalframe;
   /* UnlockDocAndTdd: */ 
SOURCE(4991, 136)
SOURCE(5063, 37)
   if (((*  (ptr) tdd←v4600 ) != 0)) {
SOURCE(5084, 16)
      (void) Unlock←P300((*  (ptr) (tdd←v4600) ));
      };
SOURCE(5102, 25)
   {
      word pd56;
      pd56 = (* (( (ptr) (* (( (ptr) gf←c17184)+56)/* var←c16320 */  ))+6) );
      (void) ( *( (fPt) ((*  (ptr) pd56 ))))(tdd←v4600, pd56);
      };
   }

static word WaitingForWrite←P540(lock←v4660)
   word lock←v4660;
   {
   word var←c4704;
   /* WaitingForWrite: */ 
SOURCE(5133, 97)
SOURCE(5197, 33)
   return(( (int)(* (( (ptr) lock←v4660)+4) ) >  (int)0));
   }

static word GetRoot←P600(viewer←v4764)
   word viewer←v4764;
   {
   word root←v4808;
   /* GetRoot: */ 
SOURCE(5236, 159)
SOURCE(5236, 159)
   root←v4808 = 0;
SOURCE(5294, 13)
   root←v4808 = viewer←v4764;
SOURCE(5309, 86)
   if ((root←v4808 != 0)) {
SOURCE(5328, 67)
      lab←L100026: ;
SOURCE(5328, 67)
      {
         word next←v5568;
SOURCE(5331, 26)
         next←v5568 = (* (( (ptr) root←v4808)+22) );
SOURCE(5359, 19)
         if ((next←v5568 == 0)) {
SOURCE(5378, 4)
            goto lab←L100025;
            };
SOURCE(5384, 11)
         root←v4808 = next←v5568;
         };
      goto lab←L100026;
      lab←L100025: ;
      };
SOURCE(5236, 159)
   return(root←v4808);
   }

static word LockedGetLock←P720(formal←c0142, formal←c0143)
   word formal←c0142;
   word formal←c0143;
   {
   W7 var←c17216;
   /* declaration of lock←v4972 skipped */ 
   /* declaration of root←v5000 skipped */ 
   /* declaration of var←c02 skipped */ 
   word var←c5044;
   var←c17216.f4/* lock←v4972 */  = formal←c0142;
   var←c17216.f5/* root←v5000 */  = formal←c0143;
   /* LockedGetLock: */ 
SOURCE(5665, 397)
   (void) (XR←MonitorEntry(var←c17216.f4/* lock←v4972 */ ));
SOURCE(5749, 313)
   {
      word var←c03;
      {
         word var←c0130;
         var←c0130 = (word) &var←c17216;
         var←c03 = (word) XR←Enable(( ((word)  (fPt) NoName←Q1440) ), ( ((word)  (fPt) NoName←Q1500) ), var←c0130);
         };
      /* removed trivial cond node */ 
      };
   return(var←c17216.f6/* var←c02 */ );
   }

static word NoName←Q1440(formal←c0127)
   word formal←c0127;
   {
   register ptr gf←c0126 =  (ptr) &globalframe;
SOURCE(5772, 31)
   if (((* (( (ptr) formal←c0127)+5) ) == 0)) {
SOURCE(5791, 12)
      (void) (XR←MonitorExit(* (( (ptr) formal←c0127)+4) ));
      (* (( (ptr) formal←c0127)+6) ) = 0;
      return(1);
      };
SOURCE(5805, 41)
   if (((* (( (ptr) formal←c0127)+5) ) == (* (( (ptr) gf←c0126)+9)/* lastRoot←v3420 */  ))) {
SOURCE(5829, 17)
      {
         word var←c16736;
         var←c16736 = (* (( (ptr) gf←c0126)+10)/* lastLock←v3448 */  );
         (void) (XR←MonitorExit(* (( (ptr) formal←c0127)+4) ));
         (* (( (ptr) formal←c0127)+6) ) = var←c16736;
         return(1);
         };
      };
SOURCE(5848, 15)
   (* (( (ptr) gf←c0126)+9)/* lastRoot←v3420 */  ) = (* (( (ptr) formal←c0127)+5) );
SOURCE(5865, 57)
   {
      word pd57;
      pd57 = (* (( (ptr) (* (( (ptr) gf←c0126)+55)/* var←c16288 */  ))+5) );
      (* (( (ptr) gf←c0126)+10)/* lastLock←v3448 */  ) = XR←Narrow((word) ( *( (fPt) ((*  (ptr) pd57 ))))((* (( (ptr) formal←c0127)+5)
             ), (* (( (ptr) gf←c0126)+22) ), pd57), (* (( (ptr) gf←c0126)+11) ));
      };
SOURCE(5924, 40)
   if (((* (( (ptr) gf←c0126)+10)/* lastLock←v3448 */  ) != 0)) {
SOURCE(5947, 17)
      {
         word var←c16768;
         var←c16768 = (* (( (ptr) gf←c0126)+10)/* lastLock←v3448 */  );
         (void) (XR←MonitorExit(* (( (ptr) formal←c0127)+4) ));
         (* (( (ptr) formal←c0127)+6) ) = var←c16768;
         return(1);
         };
      };
SOURCE(5966, 26)
   {
      word var←c16800;
      var←c16800 = XR←NewObject(68, (* (( (ptr) gf←c0126)+11) ));
      (*  (W6Pt) (( (ptr) var←c16800)+11) ) = (*  (W6Pt) (( (ptr) gf←c0126)+49)/* var←c16224 */  );
      (* (( (ptr) gf←c0126)+10)/* lastLock←v3448 */  ) = var←c16800;
      };
SOURCE(5994, 48)
   {
      word pd58;
      pd58 = (* (( (ptr) (* (( (ptr) gf←c0126)+55)/* var←c16288 */  ))+4) );
      (void) ( *( (fPt) ((*  (ptr) pd58 ))))((* (( (ptr) formal←c0127)+5) ), (* (( (ptr) gf←c0126)+22) ), (* (( (ptr) gf←c0126)+10)
         /* lastLock←v3448 */  ), pd58);
      };
SOURCE(6044, 18)
   {
      word var←c16832;
      var←c16832 = (* (( (ptr) gf←c0126)+10)/* lastLock←v3448 */  );
      (void) (XR←MonitorExit(* (( (ptr) formal←c0127)+4) ));
      (* (( (ptr) formal←c0127)+6) ) = var←c16832;
      return(1);
      };
   /* c2c skipped dead code */ 
   }

static void NoName←Q1500(formal←c0103, formal←c200008, formal←c200009, formal←c200010, formal←c200011)
   word formal←c0103;
   word formal←c200008;
   word formal←c200009;
   word formal←c200010;
   word formal←c200011;
   {
   if ((formal←c200009 == XR←Unwind)) {
      (void) (XR←MonitorExit(* (( (ptr) formal←c200008)+4) ));
      };
   (*  (ptr) formal←c0103 ) = 0;
   (* (( (ptr) formal←c0103)+1) ) = 0;
   return;
   }

static void NoName←Q1560(formal←c0108, formal←c200004, formal←c200005, formal←c200006, formal←c200007)
   word formal←c0108;
   word formal←c200004;
   word formal←c200005;
   word formal←c200006;
   word formal←c200007;
   {
   if ((formal←c200005 == XR←Unwind)) {
      (void) (XR←MonitorExit(* (( (ptr) formal←c200004)+4) ));
      };
   (*  (ptr) formal←c0108 ) = 0;
   (* (( (ptr) formal←c0108)+1) ) = 0;
   return;
   }

static void NoName←Q1620(formal←c0113, formal←c200000, formal←c200001, formal←c200002, formal←c200003)
   word formal←c0113;
   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←c0113 ) = 0;
   (* (( (ptr) formal←c0113)+1) ) = 0;
   return;
   }

/* file: TEditLocksImpl, module: TEditLocksImpl, compiled at: February 27, 1992 5:56:15 pm PST */ 
extern void XR←install←TEditLocksImpl() {
   NoName←Q1260();
   }
extern void XR←run←TEditLocksImpl() { XR←Start(&globalframe); }