/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1992 by Xerox Corporation.  All rights reserved. */
/* time: February 21, 1992 11:10:07 pm PST */
/* C2C version: October 16, 1990 (native) */
/* ref-counting: off */
/* file: ScaledImpl, module: ScaledImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
static char versionStamp[] = "@(#)mob←version [1463625265,2617748339] ScaledImpl";
typedef unsigned word, *ptr;
typedef unsigned char byte, *bPt;
typedef unsigned short half, *hPt;
typedef word (*fPt)();
typedef struct {word f0, f1;} W2;
#define SOURCE(p, l) /* source p, l */
#define INEG(x)  ( (word) ( - ((int) (word) (x)) ) )
#define BCK(idx, lim) ( ((unsigned) idx) >= ((unsigned) lim) ? (XR←RaiseBoundsFault()) : (idx) )
static double fc15 = 0.5;
static void NoName←Q1056();
static void ScaledImpl←P0();
static word TIMES←P120();
static word DIVIDE←P180();
static word FromReal←P240();
static word Float←P300();
static word Halve←P360();
static word Scale←P420();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\127\075\046\061\300\234\007\253\163\100\164\000\000"};
static struct {unsigned f; char r[16];} string2 = {851984, "\257\300\325\357\120\064\300\204\001\046\072\100\150\000\000"};
static struct {unsigned f; char r[16];} string3 = {851984, "\257\300\246\205\220\035\300\344\000\142\023\100\150\000\000"};
static struct {unsigned f; char r[16];} string4 = {851984, "\257\300\346\312\312\137\300\332\074\046\072\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[4]; 
   } globalframe = {
   {0}, (word) Scale←P420, 0, (word) Halve←P360, 
   0, (word) Float←P300, 0, (word) FromReal←P240, 
   0, (word) DIVIDE←P180, 0, (word) TIMES←P120, 
   0, (word) ScaledImpl←P0, {0}
   };

static void NoName←Q1056()
   {
   register ptr gf←c051 =  (ptr) &globalframe;
   word var←c7124;
   (void) XR←DeclareGlobalFrame((word) "ScaledImpl", &globalframe, (word) XR←GetTypeIndexS((word) (&string1)), (word) (( (bPt) gf←c051)+64)
      /* var←c6484 */ );
   var←c7124 = (word) XR←ImportInterface((word) "DReal", (word) XR←GetTypeIndexS((word) (&string2)), 7);
   (* (( (ptr) gf←c051)+19)/* var←c6996 */  ) = var←c7124;
   (void) XR←ImportProcS(var←c7124, 135004162);
   (void) XR←ImportProcS(var←c7124, 134742529);
   var←c7124 = (word) XR←ImportInterface((word) "Real", (word) XR←GetTypeIndexS((word) (&string3)), 11);
   (* (( (ptr) gf←c051)+18)/* var←c6868 */  ) = var←c7124;
   (void) XR←ImportProcS(var←c7124, 67633154);
   (void) XR←ImportProcS(var←c7124, 67371521);
   var←c7124 = (word) XR←ExportInterface((word) "Scaled", (word) XR←GetTypeIndexS((word) (&string4)), 19);
   (* (( (ptr) gf←c051)+20)/* var←c7156 */  ) = var←c7124;
   (void) XR←ExportProcS(var←c7124, (word) (( (bPt) gf←c051)+40)/* var←c6388 */ , 67371777);
   (void) XR←ExportProcS(var←c7124, (word) (( (bPt) gf←c051)+56)/* var←c6452 */ , 67634946);
   (void) XR←ExportProcS(var←c7124, (word) (( (bPt) gf←c051)+48)/* var←c6420 */ , 67635202);
   (void) XR←ExportProcS(var←c7124, (word) (( (bPt) gf←c051)+32)/* var←c6356 */ , 67375105);
   (void) XR←ExportProcS(var←c7124, (word) (( (bPt) gf←c051)+16)/* var←c6292 */ , 67637506);
   (void) XR←ExportProcS(var←c7124, (word) (( (bPt) gf←c051)+24)/* var←c6324 */ , 67375617);
   }

static void ScaledImpl←P0(formal←c013, formal←c012)
   word formal←c013;
   word formal←c012;
   {
   /* ScaledImpl: */ 
   }

static word TIMES←P120(a←v2988, b←v3016)
   word a←v2988;
   word b←v3016;
   {
   word var←c3060;
   word pos←v3664;
   word prod←v3692 = 0;
   word var←c6612;
   word n←v5996;
   /* TIMES: */ 
SOURCE(299, 401)
SOURCE(352, 40)
   pos←v3664 = (( (int)a←v2988 <  (int)0) == ( (int)b←v3016 <  (int)0));
SOURCE(407, 33)
   if (( (int)a←v2988 <  (int)0)) {
SOURCE(427, 13)
      {
         word var←c6548;
         word i←v4636;
         i←v4636 = INEG(a←v2988);
         var←c6548 = i←v4636;
         a←v2988 = var←c6548;
         };
      };
SOURCE(442, 33)
   if (( (int)b←v3016 <  (int)0)) {
SOURCE(462, 13)
      {
         word var←c6580;
         word i←v6232;
         i←v6232 = INEG(b←v3016);
         var←c6580 = i←v6232;
         b←v3016 = var←c6580;
         };
      };
SOURCE(477, 70)
   n←v5996 = ((( (((unsigned)a←v2988 << 16) >> 16) ) * ( (((unsigned)b←v3016 << 16) >> 16) )) + 32768);
   var←c6612 = (n←v5996 >> 16);
   prod←v3692 = (prod←v3692 & 4294901760) | (( (((unsigned)var←c6612 << 16) >> 16) ));
SOURCE(549, 21)
   {
      word idx5;
      prod←v3692 = (prod←v3692 & 65535) | (((
               idx5 = (word) (((unsigned)a←v2988 >> 16) * ((unsigned)b←v3016 >> 16)),
               BCK(idx5, 65536)
               )) << 16);
      };
SOURCE(572, 84)
   prod←v3692 = ((prod←v3692 + (((unsigned)a←v2988 >> 16) * ( (((unsigned)b←v3016 << 16) >> 16) ))) + (((unsigned)a←v2988 >> 16) * ( (((unsigned)b←v3016 << 16) >> 16) )));
SOURCE(658, 42)
   if ((0 != pos←v3664)) {
      return(prod←v3692);
      }
   else {
      {
         word var←c6676;
         word i←v6188;
         i←v6188 = INEG(prod←v3692);
         var←c6676 = i←v6188;
         return(var←c6676);
         };
      };
   }

static word DIVIDE←P180(a←v3120, b←v3148)
   word a←v3120;
   word b←v3148;
   {
   word var←c3192;
   /* DIVIDE: */ 
SOURCE(706, 89)
SOURCE(760, 35)
   {
      word var←c6740;
      {
         word x6;
         word x7;
         *(float*)&var←c6740 = (
            x6 = (word) Float←P300(a←v3120),  *(float*)&x6
            ) / (
            x7 = (word) Float←P300(b←v3148),  *(float*)&x7
            );
         };
      return((word) FromReal←P240(var←c6740));
      };
   }

static word FromReal←P240(real←v3252)
   word real←v3252;
   {
   register ptr gf←c7188 =  (ptr) &globalframe;
   word var←c3296;
   /* FromReal: */ 
SOURCE(801, 115)
SOURCE(856, 60)
   {
      word var←c6804;
      word var←c6836;
      word i←v6140;
      {
         word pd9;
         {
            word pd8;
            pd8 = (* (( (ptr) (* (( (ptr) gf←c7188)+18)/* var←c6868 */  ))+4) );
            var←c6836 = (word) ( *( (fPt) ((*  (ptr) pd8 ))))(real←v3252, 16, pd8);
            };
         pd9 = (* (( (ptr) (* (( (ptr) gf←c7188)+18)/* var←c6868 */  ))+6) );
         i←v6140 = (word) ( *( (fPt) ((*  (ptr) pd9 ))))(var←c6836, pd9);
         };
      var←c6804 = i←v6140;
      return(var←c6804);
      };
   }

static word Float←P300(a←v3356)
   word a←v3356;
   {
   register ptr gf←c7220 =  (ptr) &globalframe;
   word var←c3400;
   /* Float: */ 
SOURCE(920, 95)
SOURCE(969, 46)
   {
      word pd10;
      float tf11;
      pd10 = (* (( (ptr) (* (( (ptr) gf←c7220)+18)/* var←c6868 */  ))+4) );
      return((word) ( *( (fPt) ((*  (ptr) pd10 ))))((
            tf11 = (float)(int)a←v3356,  *(word*)&tf11
            ),  (word) -16, pd10));
      };
   }

static word Halve←P360(a←v3460)
   word a←v3460;
   {
   register ptr gf←c7252 =  (ptr) &globalframe;
   word var←c3504;
   /* Halve: */ 
SOURCE(1019, 107)
SOURCE(1069, 57)
   {
      word var←c6964;
      W2 var←c042;
      word i←v6092;
      {
         word pd12;
         W2 x13;
         W2 D14;
         pd12 = (* (( (ptr) (* (( (ptr) gf←c7252)+19)/* var←c6996 */  ))+6) );
         XR←DFloatInt(&D14, a←v3460);
         XR←DRealMulI(&x13, &D14, &fc15);
         (void) ( *( (fPt) ((*  (ptr) pd12 ))))((word) &var←c042, x13, pd12);
         };
      i←v6092 = XR←IntDIntI(&var←c042);
      var←c6964 = i←v6092;
      return(var←c6964);
      };
   }

static word Scale←P420(a←v3564, scale←v3592)
   word a←v3564;
   word scale←v3592;
   {
   register ptr gf←c7284 =  (ptr) &globalframe;
   word var←c3636;
   /* Scale: */ 
SOURCE(1132, 133)
SOURCE(1198, 67)
   {
      word var←c7060;
      W2 var←c7092;
      W2 var←c049;
      W2 var←c050;
      word i←v6044;
      {
         word pd16;
         W2 D17;
         pd16 = (* (( (ptr) (* (( (ptr) gf←c7284)+19)/* var←c6996 */  ))+4) );
         XR←DFloatInt(&D17, a←v3564);
         (void) ( *( (fPt) ((*  (ptr) pd16 ))))((word) &var←c049, D17, scale←v3592, pd16);
         };
      var←c7092 = var←c049;
      {
         word pd18;
         pd18 = (* (( (ptr) (* (( (ptr) gf←c7284)+19)/* var←c6996 */  ))+6) );
         (void) ( *( (fPt) ((*  (ptr) pd18 ))))((word) &var←c050, var←c7092, pd18);
         };
      i←v6044 = XR←IntDIntI(&var←c050);
      var←c7060 = i←v6044;
      return(var←c7060);
      };
   }

/* file: ScaledImpl, module: ScaledImpl, compiled at: February 21, 1992 11:10:07 pm PST */ 
extern void XR←install←ScaledImpl() {
   NoName←Q1056();
   }
extern void XR←run←ScaledImpl() { XR←Start(&globalframe); }