/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1994 by Xerox Corporation.  All rights reserved. */
/* time: March 16, 1994 12:09:49 pm PST */
/* C2C version: January 12, 1994 (sun4) */
/* ref-counting: off */
/* file: UnixSysCallsImpl, module: UnixSysCallsImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
#include <sys/mman.h>
static char versionStamp[] = "@(#)mob←version [3046554432,1988006759] UnixSysCallsImpl";
typedef unsigned word, *ptr;
typedef unsigned char byte, *bPt;
typedef unsigned short half, *hPt;
#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←Q960();
static void UnixSysCallsImpl←P0();
static word Close←P60();
static word FSync←P120();
static word GetDEnts←P180();
static word GetDTableSize←P240();
static word GetDTableSize1←P300();
static word GetTimeOfDay←P360();
static word LSeek←P420();
static word MMap←P480();
static word MUnmap←P540();
static word Open←P600();
static word Read←P660();
static word FStat←P720();
static word Unlink←P780();
static word Write←P840();
static void AssignStat←P900();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\265\226\273\100\300\166\176\223\147\100\150\000\000"};
static struct {unsigned f; char r[16];} string2 = {851984, "\257\300\211\056\077\074\300\127\047\310\242\100\150\000\000"};
static struct {unsigned f; char r[16];} string3 = {851984, "\257\300\061\347\231\302\300\102\104\205\246\100\150\000\000"};
static struct {
   word f0[4]; word f4; word f5; word f6; 
   word f7; 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; word f28; word f29; word f30; 
   word f31; word f32; word f33; word f34; 
   word f35[2]; 
   } globalframe = {
   {0}, (word) AssignStat←P900, 0, (word) Write←P840, 
   0, (word) Unlink←P780, 0, (word) FStat←P720, 
   0, (word) Read←P660, 0, (word) Open←P600, 
   0, (word) MUnmap←P540, 0, (word) MMap←P480, 
   0, (word) LSeek←P420, 0, (word) GetTimeOfDay←P360, 
   0, (word) GetDTableSize1←P300, 0, (word) GetDTableSize←P240, 
   0, (word) GetDEnts←P180, 0, (word) FSync←P120, 
   0, (word) Close←P60, 0, (word) UnixSysCallsImpl←P0, 
   {0}
   };
#define CONSTRUCT←MMAP←FLAGS(shared, private, fixed) ( ((word)(shared))*((word)(MAP←SHARED)) + ((word)(private))*((word)(MAP←PRIVATE)) + ((word)(fixed))*((word)(MAP←FIXED)))

static void NoName←Q960()
   {
   register ptr gf←c070 =  (ptr) &globalframe;
   word var←c12000;
   (void) XR←DeclareGlobalFrame((word) "UnixSysCallsImpl", &globalframe, (word) XR←GetTypeIndexS((word) (&string1)), (word) (
         ( (bPt) gf←c070)+136)/* var←c11488 */ );
   var←c12000 = (word) XR←ExportInterface((word) "UnixSysCalls", (word) XR←GetTypeIndexS((word) (&string2)), 77);
   (* (( (ptr) gf←c070)+36)/* var←c11968 */  ) = var←c12000;
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+128)/* var←c11456 */ , 67372289, (word) "Close");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+120)/* var←c11424 */ , 67373313, (word) "FSync");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+112)/* var←c11392 */ , 67897859, (word) "GetDEnts");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+104)/* var←c11360 */ , 67111936, (word) "GetDTableSize");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+88)/* var←c11296 */ , 67640066, (word) "GetTimeOfDay");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+80)/* var←c11264 */ , 67904515, (word) "LSeek");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+72)/* var←c11232 */ , 68691974, (word) "MMap");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+64)/* var←c11200 */ , 67643650, (word) "MUnmap");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+56)/* var←c11168 */ , 67906563, (word) "Open");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+48)/* var←c11136 */ , 67907587, (word) "Read");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+40)/* var←c11104 */ , 67650050, (word) "FStat");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+32)/* var←c11072 */ , 67389697, (word) "Unlink");
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+24)/* var←c11040 */ , 67914499, (word) "Write");
   var←c12000 = (word) XR←ExportInterface((word) "UnixSysCallExtensions", (word) XR←GetTypeIndexS((word) (&string3)), 1);
   (* (( (ptr) gf←c070)+36)/* var←c11968 */  ) = var←c12000;
   (void) XR←ExportProcS(var←c12000, (word) (( (bPt) gf←c070)+96)/* var←c11328 */ , 67371009, (word) "GetDTableSize1");
   }

static void UnixSysCallsImpl←P0(formal←c020, formal←c019)
   word formal←c020;
   word formal←c019;
   {
   /* UnixSysCallsImpl: */ 
   }

static word Close←P60(fd←v3048)
   word fd←v3048;
   {
   word var←c3092;
   /* Close: */ 
SOURCE(185, 139)
SOURCE(305, 19)
   return((word) XR←Close(fd←v3048));
   }

static word FSync←P120(fd←v3152)
   word fd←v3152;
   {
   word var←c3196;
   /* FSync: */ 
SOURCE(334, 139)
SOURCE(454, 19)
   return((word) XR←FSync(fd←v3152));
   }

static word GetDEnts←P180(fd←v3256, buf←v3284, nBytes←v3312)
   word fd←v3256;
   word buf←v3284;
   word nBytes←v3312;
   {
   word var←c3356;
   /* GetDEnts: */ 
SOURCE(479, 244)
SOURCE(688, 35)
   return((word) XR←GetDEnts(fd←v3256, buf←v3284, nBytes←v3312));
   }

static word GetDTableSize←P240()
   {
   word var←c3416;
   /* GetDTableSize: */ 
SOURCE(730, 151)
SOURCE(856, 25)
   return((word) XR←GetDTableSize());
   }

static word GetDTableSize1←P300(kind←v3476)
   word kind←v3476;
   {
   word var←c3520;
   /* GetDTableSize1: */ 
SOURCE(887, 199)
SOURCE(1051, 35)
   return((word) XR←GetDTableSize1(kind←v3476));
   }

static word GetTimeOfDay←P360(tp←v3580, tzp←v3608)
   word tp←v3580;
   word tzp←v3608;
   {
   word var←c3652;
   /* GetTimeOfDay: */ 
SOURCE(1097, 250)
SOURCE(1316, 31)
   return((word) XR←GetTimeOfDay(tp←v3580, tzp←v3608));
   }

static word LSeek←P420(d←v3712, offset←v3740, whence←v3768)
   word d←v3712;
   word offset←v3740;
   word whence←v3768;
   {
   word var←c3812;
   /* LSeek: */ 
SOURCE(1354, 210)
SOURCE(1530, 34)
   return((word) XR←LSeek(d←v3712, offset←v3740, whence←v3768));
   }

static word MMap←P480(addr←v3872, nbytes←v3900, prot←v3928, flags←v3956, d←v3984, offset←v4012)
   word addr←v3872;
   word nbytes←v3900;
   word prot←v3928;
   word flags←v3956;
   word d←v3984;
   word offset←v4012;
   {
   word var←c4056;
   word var←c11776;
   /* MMap: */ 
SOURCE(1570, 840)
SOURCE(2243, 167)
   var←c11776 = (word) CONSTRUCT←MMAP←FLAGS( (unsigned) (flags←v3956 & 1),  (unsigned) (((unsigned)flags←v3956 << 30) >> 31),  (unsigned) (((unsigned)flags←v3956 << 28) >> 31))
   ;
   if (((word) XR←MMap(addr←v3872, nbytes←v3900, prot←v3928, var←c11776, d←v3984, offset←v4012) == addr←v3872)) {
      return(0);
      }
   else {
      return( (word) -1);
      };
   }

static word MUnmap←P540(addr←v4116, nbytes←v4144)
   word addr←v4116;
   word nbytes←v4144;
   {
   word var←c4188;
   /* MUnmap: */ 
SOURCE(2416, 198)
SOURCE(2584, 30)
   return((word) XR←MUnmap(addr←v4116, nbytes←v4144));
   }

static word Open←P600(path←v4248, flags←v4276, mode←v4304)
   word path←v4248;
   word flags←v4276;
   word mode←v4304;
   {
   word var←c4348;
   /* Open: */ 
SOURCE(2622, 222)
SOURCE(2811, 33)
   return((word) XR←Open(path←v4248, flags←v4276, mode←v4304));
   }

static word Read←P660(d←v4408, buf←v4436, nBytes←v4464)
   word d←v4408;
   word buf←v4436;
   word nBytes←v4464;
   {
   word var←c4508;
   /* Read: */ 
SOURCE(2851, 225)
SOURCE(3046, 30)
   return((word) XR←Read(d←v4408, buf←v4436, nBytes←v4464));
   }

static word FStat←P720(fd←v4568, buf←v4596)
   word fd←v4568;
   word buf←v4596;
   {
   word var←c4640;
   word res←v8248;
   /* FStat: */ 
SOURCE(3091, 212)
SOURCE(3265, 25)
   res←v8248 = (word) XR←FStat(fd←v4568, buf←v4596);
SOURCE(3292, 11)
   return(res←v8248);
   }

static word Unlink←P780(path←v4700)
   word path←v4700;
   {
   word var←c4744;
   /* Unlink: */ 
SOURCE(3312, 159)
SOURCE(3449, 22)
   return((word) XR←Unlink(path←v4700));
   }

static word Write←P840(d←v4804, buf←v4832, nBytes←v4860)
   word d←v4804;
   word buf←v4832;
   word nBytes←v4860;
   {
   word var←c4904;
   /* Write: */ 
SOURCE(3480, 203)
SOURCE(3652, 31)
   return((word) XR←Write(d←v4804, buf←v4832, nBytes←v4860));
   }

static void AssignStat←P900(s4←v5972, ssp←v6000)
   word s4←v5972;
   word ssp←v6000;
   {
   /* AssignStat: */ 
SOURCE(5060, 652)
SOURCE(5141, 16)
   {
      word idx4;
      (*  (hPt) s4←v5972 ) = ((
         idx4 = (word) ((*  (ptr) ssp←v6000 ) + 32768),
         BCK(idx4, 65536)
         ) - 32768);
      };
SOURCE(5159, 16)
   (* (( (ptr) s4←v5972)+1) ) = (* (( (ptr) ssp←v6000)+4) );
SOURCE(5177, 26)
   {
      word tadr5;
      tadr5 = (word) (( (ptr) s4←v5972) + 2);
      (*  (ptr) tadr5 ) = ((*  (ptr) tadr5 ) & 268435455) | (((word) ( * (bPt) (( (bPt) ssp←v6000)+22) >> 4)) << 28);
      };
SOURCE(5205, 28)
   {
      word tadr6;
      tadr6 = (word) (( (ptr) s4←v5972) + 2);
      (*  (ptr) tadr6 ) = ((*  (ptr) tadr6 ) & 4160749567) | (((word) (((unsigned)(* (( (bPt) ssp←v6000)+22) ) << 28) >> 31)) << 27)
      ;
      };
SOURCE(5235, 28)
   {
      word tadr7;
      tadr7 = (word) (( (ptr) s4←v5972) + 2);
      (*  (ptr) tadr7 ) = ((*  (ptr) tadr7 ) & 4227858431) | (((word) (((unsigned)(* (( (bPt) ssp←v6000)+22) ) << 29) >> 31)) << 26)
      ;
      };
SOURCE(5265, 28)
   {
      word tadr8;
      tadr8 = (word) (( (ptr) s4←v5972) + 2);
      (*  (ptr) tadr8 ) = ((*  (ptr) tadr8 ) & 4261412863) | (((word) (((unsigned)(* (( (bPt) ssp←v6000)+22) ) << 30) >> 31)) << 25)
      ;
      };
SOURCE(5295, 30)
   {
      word tadr9;
      tadr9 = (word) (( (ptr) s4←v5972) + 2);
      (*  (ptr) tadr9 ) = ((*  (ptr) tadr9 ) & 4265607167) | (((word) (((unsigned)(* (( (hPt) ssp←v6000)+11) ) << 23) >> 29)) << 22)
      ;
      };
SOURCE(5327, 30)
   {
      word tadr10;
      tadr10 = (word) (( (ptr) s4←v5972) + 2);
      (*  (ptr) tadr10 ) = ((*  (ptr) tadr10 ) & 4291297279) | (((word) (((unsigned)(* (( (bPt) ssp←v6000)+23) ) << 26) >> 29))
          << 19);
      };
SOURCE(5359, 32)
   {
      word tadr11;
      tadr11 = (word) (( (ptr) s4←v5972) + 2);
      (*  (ptr) tadr11 ) = ((*  (ptr) tadr11 ) & 4294508543) | (((word) ((* (( (bPt) ssp←v6000)+23) ) & 7)) << 16);
      };
SOURCE(5393, 20)
   {
      word idx12;
      (* (( (hPt) s4←v5972)+5) ) = (
         idx12 = (* (( (ptr) ssp←v6000)+6) ),
         BCK(idx12, 32768)
         );
      };
SOURCE(5415, 16)
   {
      word idx13;
      (* (( (hPt) s4←v5972)+6) ) = ((
         idx13 = (word) ((* (( (ptr) ssp←v6000)+7) ) + 32768),
         BCK(idx13, 65536)
         ) - 32768);
      };
SOURCE(5433, 16)
   {
      word idx14;
      (* (( (hPt) s4←v5972)+7) ) = ((
         idx14 = (word) ((* (( (ptr) ssp←v6000)+8) ) + 32768),
         BCK(idx14, 65536)
         ) - 32768);
      };
SOURCE(5451, 18)
   {
      word idx15;
      (* (( (hPt) s4←v5972)+8) ) = ((
         idx15 = (word) ((* (( (ptr) ssp←v6000)+9) ) + 32768),
         BCK(idx15, 65536)
         ) - 32768);
      };
SOURCE(5471, 18)
   {
      word idx16;
      (* (( (ptr) s4←v5972)+5) ) = (
         idx16 = (* (( (ptr) ssp←v6000)+12) ),
         SGNCK(idx16)
         );
      };
SOURCE(5491, 24)
   {
      word idx17;
      (* (( (ptr) s4←v5972)+6) ) = (
         idx17 = (* (( (ptr) ssp←v6000)+14) ),
         SGNCK(idx17)
         );
      };
SOURCE(5517, 26)
   {
      word idx18;
      (* (( (ptr) s4←v5972)+7) ) = (
         idx18 = (* (( (ptr) ssp←v6000)+15) ),
         SGNCK(idx18)
         );
      };
SOURCE(5545, 24)
   {
      word idx19;
      (* (( (ptr) s4←v5972)+8) ) = (
         idx19 = (* (( (ptr) ssp←v6000)+16) ),
         SGNCK(idx19)
         );
      };
SOURCE(5571, 26)
   {
      word idx20;
      (* (( (ptr) s4←v5972)+9) ) = (
         idx20 = (* (( (ptr) ssp←v6000)+17) ),
         SGNCK(idx20)
         );
      };
SOURCE(5599, 24)
   {
      word idx21;
      (* (( (ptr) s4←v5972)+10) ) = (
         idx21 = (* (( (ptr) ssp←v6000)+18) ),
         SGNCK(idx21)
         );
      };
SOURCE(5625, 26)
   {
      word idx22;
      (* (( (ptr) s4←v5972)+11) ) = (
         idx22 = (* (( (ptr) ssp←v6000)+19) ),
         SGNCK(idx22)
         );
      };
SOURCE(5653, 17)
   (* (( (ptr) s4←v5972)+12) ) = 4096;
SOURCE(5680, 32)
   (* (( (ptr) s4←v5972)+13) ) = ((* (( (ptr) s4←v5972)+5) ) / (* (( (ptr) s4←v5972)+12) ));
   }

/* file: UnixSysCallsImpl, module: UnixSysCallsImpl, compiled at: March 16, 1994 12:09:49 pm PST */ 
extern void XR←install←UnixSysCallsImpl() {
   NoName←Q960();
   }
extern void XR←run←UnixSysCallsImpl() { XR←Start(&globalframe); }