OpenStringDestination

original_code:
int OpenStringDestination(
  void *theEnv,
  char *name,
  char *str,
  unsigned maximumPosition)
  {
   struct stringRouter *newStringRouter;
   if (FindStringRouter(theEnv,name) != ((void *)0)) return(0);
   newStringRouter = ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct stringRouter)] == ((void *)0)) ? ((struct stringRouter *) genalloc(theEnv,(unsigned) sizeof(struct stringRouter))) : ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct stringRouter)]), ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct stringRouter)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next, ((struct stringRouter *) ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr)));
   newStringRouter->name = (char *) gm1(theEnv,(int) strlen(name) + 1);
   strcpy(newStringRouter->name,name);
   newStringRouter->str = str;
   newStringRouter->currentPosition = 0;
   newStringRouter->readWriteType = 1;
   newStringRouter->maximumPosition = maximumPosition;
   newStringRouter->next = ((struct stringRouterData *) (((struct environmentData *) theEnv)->theData[48]))->ListOfStringRouters;
   ((struct stringRouterData *) (((struct environmentData *) theEnv)->theData[48]))->ListOfStringRouters = newStringRouter;
   return(1);
  }

canonical_original_code:
int OpenStringDestination(void *theEnv, char *name, char *str, unsigned int maximumPosition)
  {
   struct stringRouter *newStringRouter;
   if (FindStringRouter(theEnv,name) != ((void *)0)) return(0);
   newStringRouter = ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct stringRouter)] == ((void *)0)) ? ((struct stringRouter *) genalloc(theEnv,(unsigned int) sizeof(struct stringRouter))) : ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct stringRouter)]), ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct stringRouter)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next, ((struct stringRouter *) ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr)));
   newStringRouter->name = (char *) gm1(theEnv,(int) strlen(name) + 1);
   strcpy(newStringRouter->name,name);
   newStringRouter->str = str;
   newStringRouter->currentPosition = 0;
   newStringRouter->readWriteType = 1;
   newStringRouter->maximumPosition = maximumPosition;
   newStringRouter->next = ((struct stringRouterData *) (((struct environmentData *) theEnv)->theData[48]))->ListOfStringRouters;
   ((struct stringRouterData *) (((struct environmentData *) theEnv)->theData[48]))->ListOfStringRouters = newStringRouter;
   return(1);
  }


CloseStringDestination

repo: jarcec/rbclips

decompiled_code:
__int64 __fastcall CloseStringDestination(__int64 a1, const char *a2)
{
return CloseStringSource(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, const char *a2)
{
return func9(a1, a2);
}

original_code:
int CloseStringDestination(
  void *theEnv,
  char *name)
  {
   return(CloseStringSource(theEnv,name));
  }

canonical_original_code:
int CloseStringDestination(void *theEnv, char *name)
  {
   return(CloseStringSource(theEnv,name));
  }

variable_types:
theEnv
void *

variable_types:
name
char *

return_type: int


ParseSlotOverrides

decompiled_code:
__int64 __fastcall ParseSlotOverrides(__int64 a1, __int64 a2, _DWORD *a3)
{
__int64 v4; // r15
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v9; // [rsp+8h] [rbp-40h]

if ( *(_WORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 272LL) == 170 )
{
v4 = 0LL;
v9 = 0LL;
while ( 1 )
{
*a3 = 0;
v5 = ArgumentParse(a1, a2, a3);
v6 = v5;
if ( *a3 == 1 )
{
ReturnExpression(a1, v9);
return 0LL;
}
if ( !v5 )
{
SyntaxErrorMessage(a1, "slot-override");
*a3 = 1;
ReturnExpression(a1, v9);
SetEvaluationError(a1, 1LL);
return v6;
}
v7 = GenConstant(a1, 2LL, **(_QWORD **)(*(_QWORD *)(a1 + 32) + 392LL));
*(_QWORD *)(v6 + 24) = v7;
if ( !CollectArguments(a1, v7, a2) )
break;
if ( v9 )
*(_QWORD *)(v4 + 24) = v6;
else
v9 = v6;
v4 = *(_QWORD *)(v6 + 24);
PPCRAndIndent(a1);
GetToken(a1, a2, *(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 272LL);
if ( *(_WORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 272LL) != 170 )
goto LABEL_14;
}
*a3 = 1;
ReturnExpression(a1, v9);
v9 = 0LL;
}
else
{
v9 = 0LL;
LABEL_14:
PPBackup(a1);
PPBackup(a1);
SavePPBuffer(a1, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 288LL));
}
return v9;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, _DWORD *a3)
{
__int64 v4; // r15
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v9; // [rsp+8h] [rbp-40h]

if ( *(_WORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 272LL) == 170 )
{
v4 = 0LL;
v9 = 0LL;
while ( 1 )
{
*a3 = 0;
v5 = ArgumentParse(a1, a2, a3);
v6 = v5;
if ( *a3 == 1 )
{
ReturnExpression(a1, v9);
return 0LL;
}
if ( !v5 )
{
SyntaxErrorMessage(a1, "slot-override");
*a3 = 1;
ReturnExpression(a1, v9);
SetEvaluationError(a1, 1LL);
return v6;
}
v7 = GenConstant(a1, 2LL, **(_QWORD **)(*(_QWORD *)(a1 + 32) + 392LL));
*(_QWORD *)(v6 + 24) = v7;
if ( !CollectArguments(a1, v7, a2) )
break;
if ( v9 )
*(_QWORD *)(v4 + 24) = v6;
else
v9 = v6;
v4 = *(_QWORD *)(v6 + 24);
PPCRAndIndent(a1);
GetToken(a1, a2, *(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 272LL);
if ( *(_WORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 272LL) != 170 )
goto LABEL_14;
}
*a3 = 1;
ReturnExpression(a1, v9);
v9 = 0LL;
}
else
{
v9 = 0LL;
LABEL_14:
PPBackup(a1);
PPBackup(a1);
SavePPBuffer(a1, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 168LL) + 288LL));
}
return v9;
}

original_code:
EXPRESSION *ParseSlotOverrides(
  void *theEnv,
  char *readSource,
  int *error)
  {
   EXPRESSION *top = ((void *)0),*bot = ((void *)0),*theExp;
   while (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) == 170)
     {
      *error = 0;
      theExp = ArgumentParse(theEnv,readSource,error);
      if (*error == 1)
        {
         ReturnExpression(theEnv,top);
         return(((void *)0));
        }
      else if (theExp == ((void *)0))
        {
         SyntaxErrorMessage(theEnv,"slot-override");
         *error = 1;
         ReturnExpression(theEnv,top);
         SetEvaluationError(theEnv,1);
         return(((void *)0));
        }
      theExp->nextArg = GenConstant(theEnv,2,((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN);
      if (CollectArguments(theEnv,theExp->nextArg,readSource) == ((void *)0))
        {
         *error = 1;
         ReturnExpression(theEnv,top);
         return(((void *)0));
        }
      if (top == ((void *)0))
        top = theExp;
      else
        bot->nextArg = theExp;
      bot = theExp->nextArg;
      PPCRAndIndent(theEnv);
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
     }
   PPBackup(theEnv);
   PPBackup(theEnv);
   SavePPBuffer(theEnv,((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.printForm);
   return(top);
  }

canonical_original_code:
struct expr *ParseSlotOverrides(void *theEnv, char *readSource, int *error)
  {
   struct expr *top = ((void *)0); struct expr *bot = ((void *)0); struct expr *theExp;
   while (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) == 170)
     {
      *error = 0;
      theExp = ArgumentParse(theEnv,readSource,error);
      if (*error == 1)
        {
         ReturnExpression(theEnv,top);
         return(((void *)0));
        }
      else if (theExp == ((void *)0))
        {
         SyntaxErrorMessage(theEnv,"slot-override");
         *error = 1;
         ReturnExpression(theEnv,top);
         SetEvaluationError(theEnv,1);
         return(((void *)0));
        }
      theExp->nextArg = GenConstant(theEnv,2,((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN);
      if (CollectArguments(theEnv,theExp->nextArg,readSource) == ((void *)0))
        {
         *error = 1;
         ReturnExpression(theEnv,top);
         return(((void *)0));
        }
      if (top == ((void *)0))
        top = theExp;
      else
        bot->nextArg = theExp;
      bot = theExp->nextArg;
      PPCRAndIndent(theEnv);
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
     }
   PPBackup(theEnv);
   PPBackup(theEnv);
   SavePPBuffer(theEnv,((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.printForm);
   return(top);
  }

variable_types:
readSource
char *

variable_types:
error
int *

variable_types: struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *

user_defined_types: struct defclassData { struct construct *DefclassConstruct; int DefclassModuleIndex; struct entityRecord DefclassEntityRecord; struct defclass *PrimitiveClassMap[9]; struct defclass **ClassIDMap; struct defclass **ClassTable; unsigned short MaxClassID; unsigned short AvailClassID; struct slotName **SlotNameTable; struct symbolHashNode *ISA_SYMBOL; struct symbolHashNode *NAME_SYMBOL; struct symbolHashNode *INITIAL_OBJECT_SYMBOL; unsigned int WatchInstances; unsigned int WatchSlots; unsigned short CTID; struct token ObjectParseToken; unsigned short ClassDefaultsMode; }

user_defined_types: struct environmentData { unsigned int initialized; unsigned long environmentIndex; void *context; void *routerContext; void **theData; void (**cleanupFunctions)(void *); struct environmentCleanupFunction *listOfCleanupEnvironmentFunctions; struct environmentData *next; }

user_defined_types: struct symbolData { void *TrueSymbolHN; void *FalseSymbolHN; void *PositiveInfinity; void *NegativeInfinity; void *Zero; struct symbolHashNode **SymbolTable; struct floatHashNode **FloatTable; struct integerHashNode **IntegerTable; struct bitMapHashNode **BitMapTable; struct ephemeron *EphemeralSymbolList; struct ephemeron *EphemeralFloatList; struct ephemeron *EphemeralIntegerList; struct ephemeron *EphemeralBitMapList; long NumberOfSymbols; long NumberOfFloats; long NumberOfIntegers; long NumberOfBitMaps; struct symbolHashNode **SymbolArray; struct floatHashNode **FloatArray; struct integerHashNode **IntegerArray; struct bitMapHashNode **BitMapArray; }

user_defined_types: struct entityRecord { char *name; unsigned int type; unsigned int copyToEvaluate; unsigned int bitMap; unsigned int addsToRuleComplexity; void (*shortPrintFunction)(void *, char *, void *); void (*longPrintFunction)(void *, char *, void *); int (*deleteFunction)(void *, void *); int (*evaluateFunction)(void *, void *, struct dataObject *); void *(*getNextFunction)(void *, void *); void (*decrementBusyCount)(void *, void *); void (*incrementBusyCount)(void *, void *); void (*propagateDepth)(void *, void *); void (*markNeeded)(void *, void *); void (*install)(void *, void *); void (*deinstall)(void *, void *); struct userData *usrData; }

user_defined_types: struct token { unsigned short type; void *value; char *printForm; }

user_defined_types: struct construct { char *constructName; char *pluralName; int (*parseFunction)(void *, char *); void *(*findFunction)(void *, char *); struct symbolHashNode *(*getConstructNameFunction)(struct constructHeader *); char *(*getPPFormFunction)(void *, struct constructHeader *); struct defmoduleItemHeader *(*getModuleItemFunction)(struct constructHeader *); void *(*getNextItemFunction)(void *, void *); void (*setNextItemFunction)(struct constructHeader *, struct constructHeader *); int (*isConstructDeletableFunction)(void *, void *); int (*deleteFunction)(void *, void *); void (*freeFunction)(void *, void *); struct construct *next; }

user_defined_types: struct environmentCleanupFunction { char *name; void (*func)(void *); int priority; struct environmentCleanupFunction *next; }

user_defined_types: struct ephemeron { struct genericHashNode *associatedValue; struct ephemeron *next; }

user_defined_types: struct defclass { struct constructHeader header; unsigned int installed; unsigned int system; unsigned int abstract; unsigned int reactive; unsigned int traceInstances; unsigned int traceSlots; unsigned short id; unsigned int busy; struct packedClassLinks directSuperclasses; struct slotDescriptor *slots; unsigned int *slotNameMap; unsigned int slotCount; struct instance *instanceList; struct messageHandler *handlers; unsigned int *handlerOrderMap; unsigned int handlerCount; struct defclass *nxtHash; struct bitMapHashNode *scopeMap; char traversalRecord[32]; }

user_defined_types: struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; }

user_defined_types: struct floatHashNode { struct floatHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededFloat; unsigned int bucket; double contents; }

user_defined_types: struct integerHashNode { struct integerHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededInteger; unsigned int bucket; long contents; }

user_defined_types: struct bitMapHashNode { struct bitMapHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededBitMap; unsigned int bucket; char *contents; unsigned short size; }

user_defined_types: struct packedClassLinks { unsigned short classCount; struct defclass **classArray; }

user_defined_types: struct genericHashNode { struct genericHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int needed; unsigned int bucket; }

user_defined_types: struct dataObject { void *supplementalInfo; unsigned short type; void *value; long begin; long end; struct dataObject *next; }

user_defined_types: struct slotDescriptor { unsigned int shared; unsigned int multiple; unsigned int composite; unsigned int noInherit; unsigned int noWrite; unsigned int initializeOnly; unsigned int dynamicDefault; unsigned int defaultSpecified; unsigned int noDefault; unsigned int reactive; unsigned int publicVisibility; unsigned int createReadAccessor; unsigned int createWriteAccessor; unsigned int overrideMessageSpecified; struct defclass *cls; struct slotName *slotName; struct symbolHashNode *overrideMessage; void *defaultValue; struct constraintRecord *constraint; unsigned int sharedCount; long bsaveIndex; struct instanceSlot sharedValue; }

user_defined_types: struct instance { struct patternEntity header; void *partialMatchList; struct instanceSlot *basisSlots; unsigned int installed; unsigned int garbage; unsigned int initSlotsCalled; unsigned int initializeInProgress; unsigned int reteSynchronized; struct symbolHashNode *name; int depth; unsigned int hashTableIndex; unsigned int busy; struct defclass *cls; struct instance *prvClass; struct instanceSlot **slotAddresses; }

user_defined_types: struct messageHandler { unsigned int system; unsigned int type; unsigned int mark; unsigned int trace; unsigned int busy; struct symbolHashNode *name; struct defclass *cls; int minParams; struct expr *actions; char *ppForm; struct userData *usrData; }

user_defined_types: struct constructHeader { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; }

user_defined_types: struct instanceSlot { struct slotDescriptor *desc; unsigned int valueRequired; unsigned int override; unsigned int type; void *value; }

user_defined_types: struct patternEntity { struct patternEntityRecord *theInfo; void *dependents; unsigned int busyCount; long timeTag; }

user_defined_types: struct slotName { unsigned int hashTableIndex; struct symbolHashNode *name; struct slotName *nxt; long bsaveIndex; }

user_defined_types: struct constraintRecord { unsigned int anyAllowed; unsigned int symbolsAllowed; unsigned int stringsAllowed; unsigned int floatsAllowed; unsigned int integersAllowed; unsigned int instanceNamesAllowed; unsigned int instanceAddressesAllowed; unsigned int externalAddressesAllowed; unsigned int factAddressesAllowed; unsigned int voidAllowed; unsigned int anyRestriction; unsigned int symbolRestriction; unsigned int stringRestriction; unsigned int floatRestriction; unsigned int integerRestriction; unsigned int classRestriction; unsigned int instanceNameRestriction; unsigned int multifieldsAllowed; unsigned int singlefieldsAllowed; unsigned short bsaveIndex; struct expr *classList; struct expr *restrictionList; struct expr *minValue; struct expr *maxValue; struct expr *minFields; struct expr *maxFields; struct constraintRecord *multifield; struct constraintRecord *next; int bucket; int count; }

user_defined_types: struct defmoduleItemHeader { struct defmodule *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; }

user_defined_types: struct patternEntityRecord { struct entityRecord base; void (*decrementBasisCount)(void *, void *); void (*incrementBasisCount)(void *, void *); void (*matchFunction)(void *, void *); int (*synchronized)(void *, void *); }

user_defined_types: struct defmodule { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader **itemsArray; struct portItem *importList; struct portItem *exportList; unsigned int visitedFlag; long bsaveID; struct userData *usrData; struct defmodule *next; }

user_defined_types: struct portItem { struct symbolHashNode *moduleName; struct symbolHashNode *constructType; struct symbolHashNode *constructName; struct portItem *next; }

user_defined_types: struct userData { unsigned char dataID; struct userData *next; }


ParseInitializeInstance

original_code:
EXPRESSION *ParseInitializeInstance(
  void *theEnv,
  EXPRESSION *top,
  char *readSource)
  {
   int error,fcalltype,readclass;
   if ((top->value == (void *) FindFunction(theEnv,"make-instance")) ||
       (top->value == (void *) FindFunction(theEnv,"active-make-instance")))
     fcalltype = 0;
   else if ((top->value == (void *) FindFunction(theEnv,"initialize-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"active-initialize-instance")))
     fcalltype = 1;
   else if ((top->value == (void *) FindFunction(theEnv,"modify-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"active-modify-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"message-modify-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"active-message-modify-instance")))
     fcalltype = 2;
   else
     fcalltype = 3;
   IncrementIndentDepth(theEnv,3);
   error = 0;
   if (top->type == 173)
     top->type = 30;
   else
     SavePPBuffer(theEnv," ");
   top->argList = ArgumentParse(theEnv,readSource,&error);
   if (error)
     goto ParseInitializeInstanceError;
   else if (top->argList == ((void *)0))
     {
      SyntaxErrorMessage(theEnv,"instance");
      goto ParseInitializeInstanceError;
     }
   SavePPBuffer(theEnv," ");
   if (fcalltype == 0)
     {
      if ((top->argList->type != 2) ? 0 :
          (strcmp((((struct symbolHashNode *) (top->argList->value))->contents),"of") == 0))
        {
         top->argList->nextArg = ArgumentParse(theEnv,readSource,&error);
         if (error == 1)
           goto ParseInitializeInstanceError;
         if (top->argList->nextArg == ((void *)0))
           {
            SyntaxErrorMessage(theEnv,"instance class");
            goto ParseInitializeInstanceError;
           }
         if ((top->argList->nextArg->type != 2) ? 1 :
             (strcmp((((struct symbolHashNode *) (top->argList->nextArg->value))->contents),"of") != 0))
           {
            top->argList->type = 30;
            top->argList->value = (void *) FindFunction(theEnv,"gensym*");
            readclass = 0;
           }
         else
           readclass = 1;
        }
      else
        {
         GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
         if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2) ? 1 :
             (strcmp("of",(((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents)) != 0))
           {
            SyntaxErrorMessage(theEnv,"make-instance");
            goto ParseInitializeInstanceError;
           }
         SavePPBuffer(theEnv," ");
         readclass = 1;
        }
      if (readclass)
        {
         top->argList->nextArg = ArgumentParse(theEnv,readSource,&error);
         if (error)
           goto ParseInitializeInstanceError;
         if (top->argList->nextArg == ((void *)0))
           {
            SyntaxErrorMessage(theEnv,"instance class");
            goto ParseInitializeInstanceError;
           }
        }
      if (ReplaceClassNameWithReference(theEnv,top->argList->nextArg) == 0)
        goto ParseInitializeInstanceError;
      PPCRAndIndent(theEnv);
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      top->argList->nextArg->nextArg =
                  ParseSlotOverrides(theEnv,readSource,&error);
     }
   else
     {
      PPCRAndIndent(theEnv);
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      if (fcalltype == 3)
        {
         if ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.type != 2) ? 0 :
             (strcmp((((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents),"to") == 0))
           {
            PPBackup(theEnv);
            PPBackup(theEnv);
            SavePPBuffer(theEnv,((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.printForm);
            SavePPBuffer(theEnv," ");
            top->argList->nextArg = ArgumentParse(theEnv,readSource,&error);
            if (error)
              goto ParseInitializeInstanceError;
            if (top->argList->nextArg == ((void *)0))
              {
               SyntaxErrorMessage(theEnv,"instance name");
               goto ParseInitializeInstanceError;
              }
            PPCRAndIndent(theEnv);
            GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
           }
         else
           top->argList->nextArg = GenConstant(theEnv,30,(void *) FindFunction(theEnv,"gensym*"));
         top->argList->nextArg->nextArg = ParseSlotOverrides(theEnv,readSource,&error);
        }
      else
        top->argList->nextArg = ParseSlotOverrides(theEnv,readSource,&error);
     }
   if (error)
      goto ParseInitializeInstanceError;
   if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
     {
      SyntaxErrorMessage(theEnv,"slot-override");
      goto ParseInitializeInstanceError;
     }
   DecrementIndentDepth(theEnv,3);
   return(top);
ParseInitializeInstanceError:
   SetEvaluationError(theEnv,1);
   ReturnExpression(theEnv,top);
   DecrementIndentDepth(theEnv,3);
   return(((void *)0));
  }

canonical_original_code:
struct expr *ParseInitializeInstance(void *theEnv, struct expr *top, char *readSource)
  {
   int error; int fcalltype; int readclass;
   if ((top->value == (void *) FindFunction(theEnv,"make-instance")) ||
       (top->value == (void *) FindFunction(theEnv,"active-make-instance")))
     fcalltype = 0;
   else if ((top->value == (void *) FindFunction(theEnv,"initialize-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"active-initialize-instance")))
     fcalltype = 1;
   else if ((top->value == (void *) FindFunction(theEnv,"modify-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"active-modify-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"message-modify-instance")) ||
            (top->value == (void *) FindFunction(theEnv,"active-message-modify-instance")))
     fcalltype = 2;
   else
     fcalltype = 3;
   IncrementIndentDepth(theEnv,3);
   error = 0;
   if (top->type == 173)
     top->type = 30;
   else
     SavePPBuffer(theEnv," ");
   top->argList = ArgumentParse(theEnv,readSource,&error);
   if (error)
     goto ParseInitializeInstanceError;
   else if (top->argList == ((void *)0))
     {
      SyntaxErrorMessage(theEnv,"instance");
      goto ParseInitializeInstanceError;
     }
   SavePPBuffer(theEnv," ");
   if (fcalltype == 0)
     {
      if ((top->argList->type != 2) ? 0 :
          (strcmp((((struct symbolHashNode *) (top->argList->value))->contents),"of") == 0))
        {
         top->argList->nextArg = ArgumentParse(theEnv,readSource,&error);
         if (error == 1)
           goto ParseInitializeInstanceError;
         if (top->argList->nextArg == ((void *)0))
           {
            SyntaxErrorMessage(theEnv,"instance class");
            goto ParseInitializeInstanceError;
           }
         if ((top->argList->nextArg->type != 2) ? 1 :
             (strcmp((((struct symbolHashNode *) (top->argList->nextArg->value))->contents),"of") != 0))
           {
            top->argList->type = 30;
            top->argList->value = (void *) FindFunction(theEnv,"gensym*");
            readclass = 0;
           }
         else
           readclass = 1;
        }
      else
        {
         GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
         if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2) ? 1 :
             (strcmp("of",(((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents)) != 0))
           {
            SyntaxErrorMessage(theEnv,"make-instance");
            goto ParseInitializeInstanceError;
           }
         SavePPBuffer(theEnv," ");
         readclass = 1;
        }
      if (readclass)
        {
         top->argList->nextArg = ArgumentParse(theEnv,readSource,&error);
         if (error)
           goto ParseInitializeInstanceError;
         if (top->argList->nextArg == ((void *)0))
           {
            SyntaxErrorMessage(theEnv,"instance class");
            goto ParseInitializeInstanceError;
           }
        }
      if (ReplaceClassNameWithReference(theEnv,top->argList->nextArg) == 0)
        goto ParseInitializeInstanceError;
      PPCRAndIndent(theEnv);
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      top->argList->nextArg->nextArg =
                  ParseSlotOverrides(theEnv,readSource,&error);
     }
   else
     {
      PPCRAndIndent(theEnv);
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      if (fcalltype == 3)
        {
         if ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.type != 2) ? 0 :
             (strcmp((((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents),"to") == 0))
           {
            PPBackup(theEnv);
            PPBackup(theEnv);
            SavePPBuffer(theEnv,((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.printForm);
            SavePPBuffer(theEnv," ");
            top->argList->nextArg = ArgumentParse(theEnv,readSource,&error);
            if (error)
              goto ParseInitializeInstanceError;
            if (top->argList->nextArg == ((void *)0))
              {
               SyntaxErrorMessage(theEnv,"instance name");
               goto ParseInitializeInstanceError;
              }
            PPCRAndIndent(theEnv);
            GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
           }
         else
           top->argList->nextArg = GenConstant(theEnv,30,(void *) FindFunction(theEnv,"gensym*"));
         top->argList->nextArg->nextArg = ParseSlotOverrides(theEnv,readSource,&error);
        }
      else
        top->argList->nextArg = ParseSlotOverrides(theEnv,readSource,&error);
     }
   if (error)
      goto ParseInitializeInstanceError;
   if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
     {
      SyntaxErrorMessage(theEnv,"slot-override");
      goto ParseInitializeInstanceError;
     }
   DecrementIndentDepth(theEnv,3);
   return(top);
ParseInitializeInstanceError:
   SetEvaluationError(theEnv,1);
   ReturnExpression(theEnv,top);
   DecrementIndentDepth(theEnv,3);
   return(((void *)0));
  }

variable_types:
top
struct expr *

variable_types: error int

variable_types: fcalltype int

variable_types: readclass int

return_type: struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *

user_defined_types: struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; }

user_defined_types: struct defclassData { struct construct *DefclassConstruct; int DefclassModuleIndex; struct entityRecord DefclassEntityRecord; struct defclass *PrimitiveClassMap[9]; struct defclass **ClassIDMap; struct defclass **ClassTable; unsigned short MaxClassID; unsigned short AvailClassID; struct slotName **SlotNameTable; struct symbolHashNode *ISA_SYMBOL; struct symbolHashNode *NAME_SYMBOL; struct symbolHashNode *INITIAL_OBJECT_SYMBOL; unsigned int WatchInstances; unsigned int WatchSlots; unsigned short CTID; struct token ObjectParseToken; unsigned short ClassDefaultsMode; }

user_defined_types: struct environmentData { unsigned int initialized; unsigned long environmentIndex; void *context; void *routerContext; void **theData; void (**cleanupFunctions)(void *); struct environmentCleanupFunction *listOfCleanupEnvironmentFunctions; struct environmentData *next; }

user_defined_types: struct entityRecord { char *name; unsigned int type; unsigned int copyToEvaluate; unsigned int bitMap; unsigned int addsToRuleComplexity; void (*shortPrintFunction)(void *, char *, void *); void (*longPrintFunction)(void *, char *, void *); int (*deleteFunction)(void *, void *); int (*evaluateFunction)(void *, void *, struct dataObject *); void *(*getNextFunction)(void *, void *); void (*decrementBusyCount)(void *, void *); void (*incrementBusyCount)(void *, void *); void (*propagateDepth)(void *, void *); void (*markNeeded)(void *, void *); void (*install)(void *, void *); void (*deinstall)(void *, void *); struct userData *usrData; }

user_defined_types: struct token { unsigned short type; void *value; char *printForm; }

user_defined_types: struct construct { char *constructName; char *pluralName; int (*parseFunction)(void *, char *); void *(*findFunction)(void *, char *); struct symbolHashNode *(*getConstructNameFunction)(struct constructHeader *); char *(*getPPFormFunction)(void *, struct constructHeader *); struct defmoduleItemHeader *(*getModuleItemFunction)(struct constructHeader *); void *(*getNextItemFunction)(void *, void *); void (*setNextItemFunction)(struct constructHeader *, struct constructHeader *); int (*isConstructDeletableFunction)(void *, void *); int (*deleteFunction)(void *, void *); void (*freeFunction)(void *, void *); struct construct *next; }

user_defined_types: struct environmentCleanupFunction { char *name; void (*func)(void *); int priority; struct environmentCleanupFunction *next; }

user_defined_types: struct defclass { struct constructHeader header; unsigned int installed; unsigned int system; unsigned int abstract; unsigned int reactive; unsigned int traceInstances; unsigned int traceSlots; unsigned short id; unsigned int busy; struct packedClassLinks directSuperclasses; struct slotDescriptor *slots; unsigned int *slotNameMap; unsigned int slotCount; struct instance *instanceList; struct messageHandler *handlers; unsigned int *handlerOrderMap; unsigned int handlerCount; struct defclass *nxtHash; struct bitMapHashNode *scopeMap; char traversalRecord[32]; }

user_defined_types: struct bitMapHashNode { struct bitMapHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededBitMap; unsigned int bucket; char *contents; unsigned short size; }


ParseSimpleInstance

original_code:
EXPRESSION *ParseSimpleInstance(
  void *theEnv,
  EXPRESSION *top,
  char *readSource)
  {
   EXPRESSION *theExp,*vals = ((void *)0),*vbot,*tval;
   unsigned short type;
   GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
   if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 8) &&
       (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2))
     goto MakeInstanceError;
   if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) == 2) &&
       (strcmp("of",(((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents)) == 0))
     {
      top->argList = GenConstant(theEnv,30,
                                 (void *) FindFunction(theEnv,"gensym*"));
     }
   else
     {
      top->argList = GenConstant(theEnv,8,
                                 (void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2) ? 1 :
          (strcmp("of",(((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents)) != 0))
        goto MakeInstanceError;
     }
   GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
   if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2)
     goto MakeInstanceError;
   top->argList->nextArg =
        GenConstant(theEnv,2,(void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
   theExp = top->argList->nextArg;
   if (ReplaceClassNameWithReference(theEnv,theExp) == 0)
     goto MakeInstanceError;
   GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
   while (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) == 170)
     {
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2)
        goto SlotOverrideError;
      theExp->nextArg = GenConstant(theEnv,2,(void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
      theExp->nextArg->nextArg = GenConstant(theEnv,2,((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN);
      theExp = theExp->nextArg->nextArg;
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      vbot = ((void *)0);
      while (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
        {
         type = ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type);
         if (type == 170)
           {
            GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
            if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2) ? 1 :
                (strcmp((((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents),"create$") != 0))
              goto SlotOverrideError;
            GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
            if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
              goto SlotOverrideError;
            tval = GenConstant(theEnv,30,(void *) FindFunction(theEnv,"create$"));
           }
         else
           {
            if ((type != 2) && (type != 3) &&
                (type != 0) && (type != 1) && (type != 8))
              goto SlotOverrideError;
            tval = GenConstant(theEnv,type,(void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
           }
         if (vals == ((void *)0))
           vals = tval;
         else
           vbot->nextArg = tval;
         vbot = tval;
         GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
        }
      theExp->argList = vals;
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      vals = ((void *)0);
     }
   if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
     goto SlotOverrideError;
   return(top);
MakeInstanceError:
   SyntaxErrorMessage(theEnv,"make-instance");
   SetEvaluationError(theEnv,1);
   ReturnExpression(theEnv,top);
   return(((void *)0));
SlotOverrideError:
   SyntaxErrorMessage(theEnv,"slot-override");
   SetEvaluationError(theEnv,1);
   ReturnExpression(theEnv,top);
   ReturnExpression(theEnv,vals);
   return(((void *)0));
  }

canonical_original_code:
struct expr *ParseSimpleInstance(void *theEnv, struct expr *top, char *readSource)
  {
   struct expr *theExp; struct expr *vals = ((void *)0); struct expr *vbot; struct expr *tval;
   unsigned short type;
   GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
   if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 8) &&
       (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2))
     goto MakeInstanceError;
   if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) == 2) &&
       (strcmp("of",(((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents)) == 0))
     {
      top->argList = GenConstant(theEnv,30,
                                 (void *) FindFunction(theEnv,"gensym*"));
     }
   else
     {
      top->argList = GenConstant(theEnv,8,
                                 (void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2) ? 1 :
          (strcmp("of",(((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents)) != 0))
        goto MakeInstanceError;
     }
   GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
   if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2)
     goto MakeInstanceError;
   top->argList->nextArg =
        GenConstant(theEnv,2,(void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
   theExp = top->argList->nextArg;
   if (ReplaceClassNameWithReference(theEnv,theExp) == 0)
     goto MakeInstanceError;
   GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
   while (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) == 170)
     {
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2)
        goto SlotOverrideError;
      theExp->nextArg = GenConstant(theEnv,2,(void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
      theExp->nextArg->nextArg = GenConstant(theEnv,2,((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN);
      theExp = theExp->nextArg->nextArg;
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      vbot = ((void *)0);
      while (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
        {
         type = ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type);
         if (type == 170)
           {
            GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
            if ((((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 2) ? 1 :
                (strcmp((((struct symbolHashNode *) (((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken.value))->contents),"create$") != 0))
              goto SlotOverrideError;
            GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
            if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
              goto SlotOverrideError;
            tval = GenConstant(theEnv,30,(void *) FindFunction(theEnv,"create$"));
           }
         else
           {
            if ((type != 2) && (type != 3) &&
                (type != 0) && (type != 1) && (type != 8))
              goto SlotOverrideError;
            tval = GenConstant(theEnv,type,(void *) ((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).value));
           }
         if (vals == ((void *)0))
           vals = tval;
         else
           vbot->nextArg = tval;
         vbot = tval;
         GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
        }
      theExp->argList = vals;
      GetToken(theEnv,readSource,&((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken);
      vals = ((void *)0);
     }
   if (((((struct defclassData *) (((struct environmentData *) theEnv)->theData[21]))->ObjectParseToken).type) != 171)
     goto SlotOverrideError;
   return(top);
MakeInstanceError:
   SyntaxErrorMessage(theEnv,"make-instance");
   SetEvaluationError(theEnv,1);
   ReturnExpression(theEnv,top);
   return(((void *)0));
SlotOverrideError:
   SyntaxErrorMessage(theEnv,"slot-override");
   SetEvaluationError(theEnv,1);
   ReturnExpression(theEnv,top);
   ReturnExpression(theEnv,vals);
   return(((void *)0));
  }

variable_types:
type
unsigned short

user_defined_types: struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; }

user_defined_types: struct symbolData { void *TrueSymbolHN; void *FalseSymbolHN; void *PositiveInfinity; void *NegativeInfinity; void *Zero; struct symbolHashNode **SymbolTable; struct floatHashNode **FloatTable; struct integerHashNode **IntegerTable; struct bitMapHashNode **BitMapTable; struct ephemeron *EphemeralSymbolList; struct ephemeron *EphemeralFloatList; struct ephemeron *EphemeralIntegerList; struct ephemeron *EphemeralBitMapList; long NumberOfSymbols; long NumberOfFloats; long NumberOfIntegers; long NumberOfBitMaps; struct symbolHashNode **SymbolArray; struct floatHashNode **FloatArray; struct integerHashNode **IntegerArray; struct bitMapHashNode **BitMapArray; }

user_defined_types: struct ephemeron { struct genericHashNode *associatedValue; struct ephemeron *next; }

user_defined_types: struct floatHashNode { struct floatHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededFloat; unsigned int bucket; double contents; }

user_defined_types: struct integerHashNode { struct integerHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededInteger; unsigned int bucket; long contents; }

user_defined_types: struct packedClassLinks { unsigned short classCount; struct defclass **classArray; }

user_defined_types: struct genericHashNode { struct genericHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int needed; unsigned int bucket; }

user_defined_types: struct dataObject { void *supplementalInfo; unsigned short type; void *value; long begin; long end; struct dataObject *next; }

user_defined_types: struct slotDescriptor { unsigned int shared; unsigned int multiple; unsigned int composite; unsigned int noInherit; unsigned int noWrite; unsigned int initializeOnly; unsigned int dynamicDefault; unsigned int defaultSpecified; unsigned int noDefault; unsigned int reactive; unsigned int publicVisibility; unsigned int createReadAccessor; unsigned int createWriteAccessor; unsigned int overrideMessageSpecified; struct defclass *cls; struct slotName *slotName; struct symbolHashNode *overrideMessage; void *defaultValue; struct constraintRecord *constraint; unsigned int sharedCount; long bsaveIndex; struct instanceSlot sharedValue; }

user_defined_types: struct instance { struct patternEntity header; void *partialMatchList; struct instanceSlot *basisSlots; unsigned int installed; unsigned int garbage; unsigned int initSlotsCalled; unsigned int initializeInProgress; unsigned int reteSynchronized; struct symbolHashNode *name; int depth; unsigned int hashTableIndex; unsigned int busy; struct defclass *cls; struct instance *prvClass; struct instanceSlot **slotAddresses; }

user_defined_types: struct messageHandler { unsigned int system; unsigned int type; unsigned int mark; unsigned int trace; unsigned int busy; struct symbolHashNode *name; struct defclass *cls; int minParams; struct expr *actions; char *ppForm; struct userData *usrData; }

user_defined_types: struct constructHeader { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; }

user_defined_types: struct instanceSlot { struct slotDescriptor *desc; unsigned int valueRequired; unsigned int override; unsigned int type; void *value; }

user_defined_types: struct patternEntity { struct patternEntityRecord *theInfo; void *dependents; unsigned int busyCount; long timeTag; }


ReplaceClassNameWithReference

decompiled_code:
__int64 __fastcall ReplaceClassNameWithReference(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // r13
__int64 v4; // rax
__int64 v5; // r12

result = 1LL;
if ( *(_WORD *)a2 == 2 )
{
v3 = *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL);
v4 = LookupDefclassInScope(a1, v3);
v5 = v4;
if ( v4 )
{
if ( (unsigned int)EnvClassAbstractP(a1, v4) )
{
PrintErrorID(a1, "INSMNGR", 3LL, 0LL);
EnvPrintRouter(a1, "werror", "Cannot create instances of abstract class ");
EnvPrintRouter(a1, "werror", v3);
EnvPrintRouter(a1, "werror", ".\n");
result = 0LL;
}
else
{
*(_WORD *)a2 = 82;
*(_QWORD *)(a2 + 8) = v5;
result = 1LL;
}
}
else
{
CantFindItemErrorMessage(a1, "class", v3);
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // r13
__int64 v4; // rax
__int64 v5; // r12

result = 1LL;
if ( *(_WORD *)a2 == 2 )
{
v3 = *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL);
v4 = LookupDefclassInScope(a1, v3);
v5 = v4;
if ( v4 )
{
if ( (unsigned int)EnvClassAbstractP(a1, v4) )
{
PrintErrorID(a1, "INSMNGR", 3LL, 0LL);
EnvPrintRouter(a1, "werror", "Cannot create instances of abstract class ");
EnvPrintRouter(a1, "werror", v3);
EnvPrintRouter(a1, "werror", ".\n");
result = 0LL;
}
else
{
*(_WORD *)a2 = 82;
*(_QWORD *)(a2 + 8) = v5;
result = 1LL;
}
}
else
{
CantFindItemErrorMessage(a1, "class", v3);
result = 0LL;
}
}
return result;
}

original_code:
static int ReplaceClassNameWithReference(
  void *theEnv,
  EXPRESSION *theExp)
  {
   char *theClassName;
   void *theDefclass;
   if (theExp->type == 2)
     {
      theClassName = (((struct symbolHashNode *) (theExp->value))->contents);
      theDefclass = (void *) LookupDefclassInScope(theEnv,theClassName);
      if (theDefclass == ((void *)0))
        {
         CantFindItemErrorMessage(theEnv,"class",theClassName);
         return(0);
        }
      if (EnvClassAbstractP(theEnv,theDefclass))
        {
         PrintErrorID(theEnv,"INSMNGR",3,0);
         EnvPrintRouter(theEnv,"werror","Cannot create instances of abstract class ");
         EnvPrintRouter(theEnv,"werror",theClassName);
         EnvPrintRouter(theEnv,"werror",".\n");
         return(0);
        }
      theExp->type = 82;
      theExp->value = theDefclass;
     }
   return(1);
  }

canonical_original_code:
static int ReplaceClassNameWithReference(void *theEnv, struct expr *theExp)
  {
   char *theClassName;
   void *theDefclass;
   if (theExp->type == 2)
     {
      theClassName = (((struct symbolHashNode *) (theExp->value))->contents);
      theDefclass = (void *) LookupDefclassInScope(theEnv,theClassName);
      if (theDefclass == ((void *)0))
        {
         CantFindItemErrorMessage(theEnv,"class",theClassName);
         return(0);
        }
      if (EnvClassAbstractP(theEnv,theDefclass))
        {
         PrintErrorID(theEnv,"INSMNGR",3,0);
         EnvPrintRouter(theEnv,"werror","Cannot create instances of abstract class ");
         EnvPrintRouter(theEnv,"werror",theClassName);
         EnvPrintRouter(theEnv,"werror",".\n");
         return(0);
        }
      theExp->type = 82;
      theExp->value = theDefclass;
     }
   return(1);
  }

variable_types:
theClassName
char *

variable_types:
theDefclass
void *

user_defined_types: struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; }


FindAssertSlotItem

decompiled_code:
__int64 __fastcall FindAssertSlotItem(_QWORD *a1, __int64 a2)
{
__int64 result; // rax

for ( result = a2; result; result = *(_QWORD *)(result + 24) )
{
if ( *(_QWORD *)(result + 8) == *a1 )
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1, __int64 a2)
{
__int64 result; // rax

for ( result = a2; result; result = *(_QWORD *)(result + 24) )
{
if ( *(_QWORD *)(result + 8) == *a1 )
break;
}
return result;
}

original_code:
static struct expr *FindAssertSlotItem(
  struct templateSlot *slotPtr,
  struct expr *listOfSlots)
  {
   while (listOfSlots != ((void *)0))
     {
      if (listOfSlots->value == (void *) slotPtr->slotName) return (listOfSlots);
      listOfSlots = listOfSlots->nextArg;
     }
   return(((void *)0));
  }

canonical_original_code:
static struct expr *FindAssertSlotItem(struct templateSlot *slotPtr, struct expr *listOfSlots)
  {
   while (listOfSlots != ((void *)0))
     {
      if (listOfSlots->value == (void *) slotPtr->slotName) return (listOfSlots);
      listOfSlots = listOfSlots->nextArg;
     }
   return(((void *)0));
  }

variable_types: struct templateSlot { struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; } *slotName; unsigned int multislot; unsigned int noDefault; unsigned int defaultPresent; unsigned int defaultDynamic; struct constraintRecord { unsigned int anyAllowed; unsigned int symbolsAllowed; unsigned int stringsAllowed; unsigned int floatsAllowed; unsigned int integersAllowed; unsigned int instanceNamesAllowed; unsigned int instanceAddressesAllowed; unsigned int externalAddressesAllowed; unsigned int factAddressesAllowed; unsigned int voidAllowed; unsigned int anyRestriction; unsigned int symbolRestriction; unsigned int stringRestriction; unsigned int floatRestriction; unsigned int integerRestriction; unsigned int classRestriction; unsigned int instanceNameRestriction; unsigned int multifieldsAllowed; unsigned int singlefieldsAllowed; unsigned short bsaveIndex; struct expr *classList; struct expr *restrictionList; struct expr *minValue; struct expr *maxValue; struct expr *minFields; struct expr *maxFields; struct constraintRecord *multifield; struct constraintRecord *next; int bucket; int count; } *constraints; struct expr *defaultList; struct templateSlot *next; } *

variable_types:
listOfSlots
struct expr *

user_defined_types: struct templateSlot { struct symbolHashNode *slotName; unsigned int multislot; unsigned int noDefault; unsigned int defaultPresent; unsigned int defaultDynamic; struct constraintRecord *constraints; struct expr *defaultList; struct templateSlot *next; }


ParseAssertSlotValues

decompiled_code:
__int64 __fastcall ParseAssertSlotValues(__int64 a1, __int64 a2, _WORD *a3, _BYTE *a4, _DWORD *a5, unsigned int a6)
{
__int64 result; // rax
__int64 v10; // r14
__int64 v11; // rax
unsigned int v12; // [rsp+Ch] [rbp-5Ch]
__int64 v13; // [rsp+10h] [rbp-58h]
int v15[15]; // [rsp+2Ch] [rbp-3Ch] BYREF

v12 = a6;
if ( (a4[8] & 1) == 0 )
{
SavePPBuffer(a1, &LC0);
v13 = GetAssertArgument(a1, a2, a3, a5, 171LL, a6, v15);
if ( !*a5 )
{
if ( !v13 )
{
*a5 = 1;
SingleFieldSlotCardinalityError(a1, *(_QWORD *)(*(_QWORD *)a4 + 24LL));
return 0LL;
}
if ( *(_WORD *)v13 == 30 )
{
if ( *(_BYTE *)(*(_QWORD *)(v13 + 8) + 16LL) != 109 )
goto LABEL_6;
}
else if ( *(_WORD *)v13 != 36 )
{
LABEL_6:
GetToken(a1, a2, a3);
goto LABEL_25;
}
*a5 = 1;
SingleFieldSlotCardinalityError(a1, *(_QWORD *)(*(_QWORD *)a4 + 24LL));
ReturnExpression(a1, v13);
return 0LL;
}
result = 0LL;
if ( !v15[0] )
return result;
LABEL_8:
SyntaxErrorMessage(a1, "deftemplate pattern");
return 0LL;
}
SavePPBuffer(a1, &LC0);
v13 = GetAssertArgument(a1, a2, a3, a5, 171LL, v12, v15);
if ( *a5 )
{
result = 0LL;
if ( !v15[0] )
return result;
goto LABEL_8;
}
v10 = v13;
if ( !v13 )
{
PPBackup(a1);
PPBackup(a1);
SavePPBuffer(a1, ")");
LABEL_25:
if ( *a3 == 171 )
{
result = GenConstant(a1, 2LL, *(_QWORD *)a4);
*(_QWORD *)(result + 16) = v13;
}
else
{
SingleFieldSlotCardinalityError(a1, *(_QWORD *)(*(_QWORD *)a4 + 24LL));
*a5 = 1;
ReturnExpression(a1, v13);
result = 0LL;
}
return result;
}
while ( 1 )
{
SavePPBuffer(a1, &LC0);
v11 = GetAssertArgument(a1, a2, a3, a5, 171LL, v12, v15);
if ( *a5 )
break;
if ( !v11 )
{
PPBackup(a1);
PPBackup(a1);
SavePPBuffer(a1, ")");
*(_QWORD *)(v10 + 24) = 0LL;
goto LABEL_25;
}
*(_QWORD *)(v10 + 24) = v11;
v10 = v11;
}
if ( v15[0] )
SyntaxErrorMessage(a1, "deftemplate pattern");
ReturnExpression(a1, v13);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, _WORD *a3, _BYTE *a4, _DWORD *a5, unsigned int a6)
{
__int64 result; // rax
__int64 v10; // r14
__int64 v11; // rax
unsigned int v12; // [rsp+Ch] [rbp-5Ch]
__int64 v13; // [rsp+10h] [rbp-58h]
int v15[15]; // [rsp+2Ch] [rbp-3Ch] BYREF

v12 = a6;
if ( (a4[8] & 1) == 0 )
{
SavePPBuffer(a1, &LC0);
v13 = GetAssertArgument(a1, a2, a3, a5, 171LL, a6, v15);
if ( !*a5 )
{
if ( !v13 )
{
*a5 = 1;
SingleFieldSlotCardinalityError(a1, *(_QWORD *)(*(_QWORD *)a4 + 24LL));
return 0LL;
}
if ( *(_WORD *)v13 == 30 )
{
if ( *(_BYTE *)(*(_QWORD *)(v13 + 8) + 16LL) != 109 )
goto LABEL_6;
}
else if ( *(_WORD *)v13 != 36 )
{
LABEL_6:
GetToken(a1, a2, a3);
goto LABEL_25;
}
*a5 = 1;
SingleFieldSlotCardinalityError(a1, *(_QWORD *)(*(_QWORD *)a4 + 24LL));
ReturnExpression(a1, v13);
return 0LL;
}
result = 0LL;
if ( !v15[0] )
return result;
LABEL_8:
SyntaxErrorMessage(a1, "deftemplate pattern");
return 0LL;
}
SavePPBuffer(a1, &LC0);
v13 = GetAssertArgument(a1, a2, a3, a5, 171LL, v12, v15);
if ( *a5 )
{
result = 0LL;
if ( !v15[0] )
return result;
goto LABEL_8;
}
v10 = v13;
if ( !v13 )
{
PPBackup(a1);
PPBackup(a1);
SavePPBuffer(a1, ")");
LABEL_25:
if ( *a3 == 171 )
{
result = GenConstant(a1, 2LL, *(_QWORD *)a4);
*(_QWORD *)(result + 16) = v13;
}
else
{
SingleFieldSlotCardinalityError(a1, *(_QWORD *)(*(_QWORD *)a4 + 24LL));
*a5 = 1;
ReturnExpression(a1, v13);
result = 0LL;
}
return result;
}
while ( 1 )
{
SavePPBuffer(a1, &LC0);
v11 = GetAssertArgument(a1, a2, a3, a5, 171LL, v12, v15);
if ( *a5 )
break;
if ( !v11 )
{
PPBackup(a1);
PPBackup(a1);
SavePPBuffer(a1, ")");
*(_QWORD *)(v10 + 24) = 0LL;
goto LABEL_25;
}
*(_QWORD *)(v10 + 24) = v11;
v10 = v11;
}
if ( v15[0] )
SyntaxErrorMessage(a1, "deftemplate pattern");
ReturnExpression(a1, v13);
return 0LL;
}

original_code:
static struct expr *ParseAssertSlotValues(
  void *theEnv,
  char *inputSource,
  struct token *tempToken,
  struct templateSlot *slotPtr,
  int *error,
  int constantsOnly)
  {
   struct expr *nextSlot;
   struct expr *newField, *valueList, *lastValue;
   int printError;
   if (slotPtr->multislot == 0)
     {
      SavePPBuffer(theEnv," ");
      newField = GetAssertArgument(theEnv,inputSource,tempToken,
                                   error,171,constantsOnly,&printError);
      if (*error)
        {
         if (printError) SyntaxErrorMessage(theEnv,"deftemplate pattern");
         return(((void *)0));
        }
      if (newField == ((void *)0))
       {
        *error = 1;
        SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents);
        return(((void *)0));
       }
      if ((newField->type == 30) ? ((((struct FunctionDefinition *) ((newField)->value))->returnValueType) == 'm') :
                                      (newField->type == 36))
       {
        *error = 1;
        SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents);
        ReturnExpression(theEnv,newField);
        return(((void *)0));
       }
      GetToken(theEnv,inputSource,tempToken);
     }
   else
     {
      SavePPBuffer(theEnv," ");
      valueList = GetAssertArgument(theEnv,inputSource,tempToken,
                                     error,171,constantsOnly,&printError);
      if (*error)
        {
         if (printError) SyntaxErrorMessage(theEnv,"deftemplate pattern");
         return(((void *)0));
        }
      if (valueList == ((void *)0))
        {
         PPBackup(theEnv);
         PPBackup(theEnv);
         SavePPBuffer(theEnv,")");
        }
      lastValue = valueList;
      while (lastValue != ((void *)0))
        {
         if (tempToken->type == 171)
           { SavePPBuffer(theEnv," "); }
         else
           {
            SavePPBuffer(theEnv," ");
           }
         newField = GetAssertArgument(theEnv,inputSource,tempToken,error,171,constantsOnly,&printError);
         if (*error)
           {
            if (printError) SyntaxErrorMessage(theEnv,"deftemplate pattern");
            ReturnExpression(theEnv,valueList);
            return(((void *)0));
           }
         if (newField == ((void *)0))
           {
            PPBackup(theEnv);
            PPBackup(theEnv);
            SavePPBuffer(theEnv,")");
           }
         lastValue->nextArg = newField;
         lastValue = newField;
        }
      newField = valueList;
     }
   if (tempToken->type != 171)
     {
      SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents);
      *error = 1;
      ReturnExpression(theEnv,newField);
      return(((void *)0));
     }
   nextSlot = GenConstant(theEnv,2,slotPtr->slotName);
   nextSlot->argList = newField;
   return(nextSlot);
  }

canonical_original_code:
static struct expr *ParseAssertSlotValues(void *theEnv, char *inputSource, struct token *tempToken, struct templateSlot *slotPtr, int *error, int constantsOnly)
  {
   struct expr *nextSlot;
   struct expr *newField; struct expr *valueList; struct expr *lastValue;
   int printError;
   if (slotPtr->multislot == 0)
     {
      SavePPBuffer(theEnv," ");
      newField = GetAssertArgument(theEnv,inputSource,tempToken,
                                   error,171,constantsOnly,&printError);
      if (*error)
        {
         if (printError) SyntaxErrorMessage(theEnv,"deftemplate pattern");
         return(((void *)0));
        }
      if (newField == ((void *)0))
       {
        *error = 1;
        SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents);
        return(((void *)0));
       }
      if ((newField->type == 30) ? ((((struct FunctionDefinition *) ((newField)->value))->returnValueType) == 'm') :
                                      (newField->type == 36))
       {
        *error = 1;
        SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents);
        ReturnExpression(theEnv,newField);
        return(((void *)0));
       }
      GetToken(theEnv,inputSource,tempToken);
     }
   else
     {
      SavePPBuffer(theEnv," ");
      valueList = GetAssertArgument(theEnv,inputSource,tempToken,
                                     error,171,constantsOnly,&printError);
      if (*error)
        {
         if (printError) SyntaxErrorMessage(theEnv,"deftemplate pattern");
         return(((void *)0));
        }
      if (valueList == ((void *)0))
        {
         PPBackup(theEnv);
         PPBackup(theEnv);
         SavePPBuffer(theEnv,")");
        }
      lastValue = valueList;
      while (lastValue != ((void *)0))
        {
         if (tempToken->type == 171)
           { SavePPBuffer(theEnv," "); }
         else
           {
            SavePPBuffer(theEnv," ");
           }
         newField = GetAssertArgument(theEnv,inputSource,tempToken,error,171,constantsOnly,&printError);
         if (*error)
           {
            if (printError) SyntaxErrorMessage(theEnv,"deftemplate pattern");
            ReturnExpression(theEnv,valueList);
            return(((void *)0));
           }
         if (newField == ((void *)0))
           {
            PPBackup(theEnv);
            PPBackup(theEnv);
            SavePPBuffer(theEnv,")");
           }
         lastValue->nextArg = newField;
         lastValue = newField;
        }
      newField = valueList;
     }
   if (tempToken->type != 171)
     {
      SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents);
      *error = 1;
      ReturnExpression(theEnv,newField);
      return(((void *)0));
     }
   nextSlot = GenConstant(theEnv,2,slotPtr->slotName);
   nextSlot->argList = newField;
   return(nextSlot);
  }

variable_types:
inputSource
char *

variable_types: struct token { unsigned short type; void *value; char *printForm; } *

variable_types: constantsOnly int

variable_types: printError int

user_defined_types: struct FunctionDefinition { struct symbolHashNode *callFunctionName; char *actualFunctionName; char returnValueType; int (*functionPointer)(); struct expr *(*parser)(void *, struct expr *, char *); char *restrictions; short overloadable; short sequenceuseok; short environmentAware; short bsaveIndex; struct FunctionDefinition *next; struct userData *usrData; }

user_defined_types: struct constraintRecord { unsigned int anyAllowed; unsigned int symbolsAllowed; unsigned int stringsAllowed; unsigned int floatsAllowed; unsigned int integersAllowed; unsigned int instanceNamesAllowed; unsigned int instanceAddressesAllowed; unsigned int externalAddressesAllowed; unsigned int factAddressesAllowed; unsigned int voidAllowed; unsigned int anyRestriction; unsigned int symbolRestriction; unsigned int stringRestriction; unsigned int floatRestriction; unsigned int integerRestriction; unsigned int classRestriction; unsigned int instanceNameRestriction; unsigned int multifieldsAllowed; unsigned int singlefieldsAllowed; unsigned short bsaveIndex; struct expr *classList; struct expr *restrictionList; struct expr *minValue; struct expr *maxValue; struct expr *minFields; struct expr *maxFields; struct constraintRecord *multifield; struct constraintRecord *next; int bucket; int count; }

user_defined_types: struct userData { unsigned char dataID; struct userData *next; }


ParseSlotLabel

decompiled_code:
__int64 __fastcall ParseSlotLabel(__int64 a1, __int64 a2, unsigned __int16 *a3, __int64 a4, _DWORD *a5, int a6)
{
__int64 v10; // r12
char v12[58]; // [rsp+Eh] [rbp-3Ah] BYREF

*a5 = 0;
GetToken(a1, a2, a3);
if ( *a3 == a6 )
return 0LL;
PPBackup(a1);
SavePPBuffer(a1, &LC0);
SavePPBuffer(a1, *((_QWORD *)a3 + 2));
if ( *a3 == 170 && (GetToken(a1, a2, a3), *a3 == 2) )
{
v10 = FindSlot(a4, *((_QWORD *)a3 + 1), v12);
if ( !v10 )
{
InvalidDeftemplateSlotMessage(a1, *(_QWORD *)(*((_QWORD *)a3 + 1) + 24LL), *(_QWORD *)(*(_QWORD *)a4 + 24LL), 1LL);
*a5 = 1;
}
}
else
{
SyntaxErrorMessage(a1, "deftemplate pattern");
*a5 = 1;
v10 = 0LL;
}
return v10;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, unsigned __int16 *a3, __int64 a4, _DWORD *a5, int a6)
{
__int64 v10; // r12
char v12[58]; // [rsp+Eh] [rbp-3Ah] BYREF

*a5 = 0;
GetToken(a1, a2, a3);
if ( *a3 == a6 )
return 0LL;
PPBackup(a1);
SavePPBuffer(a1, &LC0);
SavePPBuffer(a1, *((_QWORD *)a3 + 2));
if ( *a3 == 170 && (GetToken(a1, a2, a3), *a3 == 2) )
{
v10 = FindSlot(a4, *((_QWORD *)a3 + 1), v12);
if ( !v10 )
{
InvalidDeftemplateSlotMessage(a1, *(_QWORD *)(*((_QWORD *)a3 + 1) + 24LL), *(_QWORD *)(*(_QWORD *)a4 + 24LL), 1LL);
*a5 = 1;
}
}
else
{
SyntaxErrorMessage(a1, "deftemplate pattern");
*a5 = 1;
v10 = 0LL;
}
return v10;
}

original_code:
static struct templateSlot *ParseSlotLabel(
  void *theEnv,
  char *inputSource,
  struct token *tempToken,
  struct deftemplate *theDeftemplate,
  int *error,
  int endType)
  {
   struct templateSlot *slotPtr;
   short position;
   *error = 0;
   GetToken(theEnv,inputSource,tempToken);
   if (tempToken->type == endType)
     { return(((void *)0)); }
   PPBackup(theEnv);
   SavePPBuffer(theEnv," ");
   SavePPBuffer(theEnv,tempToken->printForm);
   if (tempToken->type != 170)
     {
      SyntaxErrorMessage(theEnv,"deftemplate pattern");
      *error = 1;
      return(((void *)0));
     }
   GetToken(theEnv,inputSource,tempToken);
   if (tempToken->type != 2)
     {
      SyntaxErrorMessage(theEnv,"deftemplate pattern");
      *error = 1;
      return(((void *)0));
     }
   if ((slotPtr = FindSlot(theDeftemplate,(SYMBOL_HN *) tempToken->value,&position)) == ((void *)0))
     {
      InvalidDeftemplateSlotMessage(theEnv,(((struct symbolHashNode *) (tempToken->value))->contents),
                                    (((struct symbolHashNode *) (theDeftemplate->header.name))->contents),1);
      *error = 1;
      return(((void *)0));
     }
   return(slotPtr);
  }

canonical_original_code:
static struct templateSlot *ParseSlotLabel(void *theEnv, char *inputSource, struct token *tempToken, struct deftemplate *theDeftemplate, int *error, int endType)
  {
   struct templateSlot *slotPtr;
   short position;
   *error = 0;
   GetToken(theEnv,inputSource,tempToken);
   if (tempToken->type == endType)
     { return(((void *)0)); }
   PPBackup(theEnv);
   SavePPBuffer(theEnv," ");
   SavePPBuffer(theEnv,tempToken->printForm);
   if (tempToken->type != 170)
     {
      SyntaxErrorMessage(theEnv,"deftemplate pattern");
      *error = 1;
      return(((void *)0));
     }
   GetToken(theEnv,inputSource,tempToken);
   if (tempToken->type != 2)
     {
      SyntaxErrorMessage(theEnv,"deftemplate pattern");
      *error = 1;
      return(((void *)0));
     }
   if ((slotPtr = FindSlot(theDeftemplate,(struct symbolHashNode *) tempToken->value,&position)) == ((void *)0))
     {
      InvalidDeftemplateSlotMessage(theEnv,(((struct symbolHashNode *) (tempToken->value))->contents),
                                    (((struct symbolHashNode *) (theDeftemplate->header.name))->contents),1);
      *error = 1;
      return(((void *)0));
     }
   return(slotPtr);
  }

variable_types:
theEnv
void *

variable_types: struct deftemplate { struct constructHeader { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader { struct defmodule { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader **itemsArray; struct portItem { struct symbolHashNode *moduleName; struct symbolHashNode *constructType; struct symbolHashNode *constructName; struct portItem *next; } *importList; struct portItem *exportList; unsigned int visitedFlag; long bsaveID; struct userData { unsigned char dataID; struct userData *next; } *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } header; struct templateSlot *slotList; unsigned int implied; unsigned int watch; unsigned int inScope; unsigned short numberOfSlots; long busyCount; struct factPatternNode { struct patternNodeHeader { struct partialMatch { unsigned int betaMemory; unsigned int busy; unsigned int activationf; unsigned int dependentsf; unsigned int notOriginf; unsigned int counterf; unsigned int bcount; struct partialMatch *next; struct genericMatch { union { void *theValue; struct alphaMatch { struct patternEntity { struct patternEntityRecord { struct entityRecord { char *name; unsigned int type; unsigned int copyToEvaluate; unsigned int bitMap; unsigned int addsToRuleComplexity; void (*shortPrintFunction)(void *, char *, void *); void (*longPrintFunction)(void *, char *, void *); int (*deleteFunction)(void *, void *); int (*evaluateFunction)(void *, void *, struct dataObject { void *supplementalInfo; unsigned short type; void *value; long begin; long end; struct dataObject *next; } *); void *(*getNextFunction)(void *, void *); void (*decrementBusyCount)(void *, void *); void (*incrementBusyCount)(void *, void *); void (*propagateDepth)(void *, void *); void (*markNeeded)(void *, void *); void (*install)(void *, void *); void (*deinstall)(void *, void *); struct userData *usrData; } base; void (*decrementBasisCount)(void *, void *); void (*incrementBasisCount)(void *, void *); void (*matchFunction)(void *, void *); int (*synchronized)(void *, void *); } *theInfo; void *dependents; unsigned int busyCount; long timeTag; } *matchingItem; struct multifieldMarker { int whichField; union { void *whichSlot; short whichSlotNumber; } where; long startPosition; long endPosition; struct multifieldMarker *next; } *markers; struct alphaMatch *next; } *theMatch; } gm; } binds[1]; } *alphaMemory; struct partialMatch *endOfQueue; struct joinNode { unsigned int firstJoin; unsigned int logicalJoin; unsigned int joinFromTheRight; unsigned int patternIsNegated; unsigned int initialize; unsigned int marked; unsigned int rhsType; unsigned int depth; long bsaveID; struct partialMatch *beta; struct expr *networkTest; void *rightSideEntryStructure; struct joinNode *nextLevel; struct joinNode *lastLevel; struct joinNode *rightDriveNode; struct joinNode *rightMatchNode; struct defrule { struct constructHeader header; int salience; int localVarCnt; unsigned int complexity; unsigned int afterBreakpoint; unsigned int watchActivation; unsigned int watchFiring; unsigned int autoFocus; unsigned int executing; struct expr *dynamicSalience; struct expr *actions; struct joinNode *logicalJoin; struct joinNode *lastJoin; struct defrule *disjunct; } *ruleToActivate; } *entryJoin; unsigned int singlefieldNode; unsigned int multifieldNode; unsigned int stopNode; unsigned int initialize; unsigned int marked; unsigned int beginSlot; unsigned int endSlot; } header; long bsaveID; unsigned short whichField; unsigned short whichSlot; unsigned short leaveFields; struct expr *networkTest; struct factPatternNode *nextLevel; struct factPatternNode *lastLevel; struct factPatternNode *leftNode; struct factPatternNode *rightNode; } *patternNetwork; struct fact { struct patternEntity factHeader; struct deftemplate *whichDeftemplate; void *list; long factIndex; unsigned int depth; unsigned int garbage; struct fact *previousFact; struct fact *nextFact; struct fact *previousTemplateFact; struct fact *nextTemplateFact; struct multifield { unsigned int busyCount; short depth; unsigned long multifieldLength; struct multifield *next; struct field { unsigned short type; void *value; } theFields[1]; } theProposition; } *factList; struct fact *lastFact; } *

variable_types: endType int

variable_types: struct templateSlot { struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; } *slotName; unsigned int multislot; unsigned int noDefault; unsigned int defaultPresent; unsigned int defaultDynamic; struct constraintRecord { unsigned int anyAllowed; unsigned int symbolsAllowed; unsigned int stringsAllowed; unsigned int floatsAllowed; unsigned int integersAllowed; unsigned int instanceNamesAllowed; unsigned int instanceAddressesAllowed; unsigned int externalAddressesAllowed; unsigned int factAddressesAllowed; unsigned int voidAllowed; unsigned int anyRestriction; unsigned int symbolRestriction; unsigned int stringRestriction; unsigned int floatRestriction; unsigned int integerRestriction; unsigned int classRestriction; unsigned int instanceNameRestriction; unsigned int multifieldsAllowed; unsigned int singlefieldsAllowed; unsigned short bsaveIndex; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *classList; struct expr *restrictionList; struct expr *minValue; struct expr *maxValue; struct expr *minFields; struct expr *maxFields; struct constraintRecord *multifield; struct constraintRecord *next; int bucket; int count; } *constraints; struct expr *defaultList; struct templateSlot *next; } *

variable_types: position short

user_defined_types: struct token { unsigned short type; void *value; char *printForm; }

user_defined_types: struct deftemplate { struct constructHeader header; struct templateSlot *slotList; unsigned int implied; unsigned int watch; unsigned int inScope; unsigned short numberOfSlots; long busyCount; struct factPatternNode *patternNetwork; struct fact *factList; struct fact *lastFact; }

user_defined_types: struct factPatternNode { struct patternNodeHeader header; long bsaveID; unsigned short whichField; unsigned short whichSlot; unsigned short leaveFields; struct expr *networkTest; struct factPatternNode *nextLevel; struct factPatternNode *lastLevel; struct factPatternNode *leftNode; struct factPatternNode *rightNode; }

user_defined_types: struct fact { struct patternEntity factHeader; struct deftemplate *whichDeftemplate; void *list; long factIndex; unsigned int depth; unsigned int garbage; struct fact *previousFact; struct fact *nextFact; struct fact *previousTemplateFact; struct fact *nextTemplateFact; struct multifield theProposition; }

user_defined_types: struct defmoduleItemHeader { struct defmodule *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; }

user_defined_types: struct patternNodeHeader { struct partialMatch *alphaMemory; struct partialMatch *endOfQueue; struct joinNode *entryJoin; unsigned int singlefieldNode; unsigned int multifieldNode; unsigned int stopNode; unsigned int initialize; unsigned int marked; unsigned int beginSlot; unsigned int endSlot; }

user_defined_types: struct multifield { unsigned int busyCount; short depth; unsigned long multifieldLength; struct multifield *next; struct field theFields[1]; }

user_defined_types: struct defmodule { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader **itemsArray; struct portItem *importList; struct portItem *exportList; unsigned int visitedFlag; long bsaveID; struct userData *usrData; struct defmodule *next; }

user_defined_types: struct partialMatch { unsigned int betaMemory; unsigned int busy; unsigned int activationf; unsigned int dependentsf; unsigned int notOriginf; unsigned int counterf; unsigned int bcount; struct partialMatch *next; struct genericMatch binds[1]; }

user_defined_types: struct joinNode { unsigned int firstJoin; unsigned int logicalJoin; unsigned int joinFromTheRight; unsigned int patternIsNegated; unsigned int initialize; unsigned int marked; unsigned int rhsType; unsigned int depth; long bsaveID; struct partialMatch *beta; struct expr *networkTest; void *rightSideEntryStructure; struct joinNode *nextLevel; struct joinNode *lastLevel; struct joinNode *rightDriveNode; struct joinNode *rightMatchNode; struct defrule *ruleToActivate; }

user_defined_types: struct genericMatch { union { void *theValue; struct alphaMatch *theMatch; } gm; }

user_defined_types: struct alphaMatch { struct patternEntity *matchingItem; struct multifieldMarker *markers; struct alphaMatch *next; }

user_defined_types: struct patternEntityRecord { struct entityRecord base; void (*decrementBasisCount)(void *, void *); void (*incrementBasisCount)(void *, void *); void (*matchFunction)(void *, void *); int (*synchronized)(void *, void *); }

user_defined_types: struct entityRecord { char *name; unsigned int type; unsigned int copyToEvaluate; unsigned int bitMap; unsigned int addsToRuleComplexity; void (*shortPrintFunction)(void *, char *, void *); void (*longPrintFunction)(void *, char *, void *); int (*deleteFunction)(void *, void *); int (*evaluateFunction)(void *, void *, struct dataObject *); void *(*getNextFunction)(void *, void *); void (*decrementBusyCount)(void *, void *); void (*incrementBusyCount)(void *, void *); void (*propagateDepth)(void *, void *); void (*markNeeded)(void *, void *); void (*install)(void *, void *); void (*deinstall)(void *, void *); struct userData *usrData; }


GetSlotAssertValues

decompiled_code:
__int64 __fastcall GetSlotAssertValues(__int64 a1, __int64 a2, __int64 a3, _DWORD *a4)
{
__int64 v5; // rax
__int64 v6; // r13
char v8; // al
__int64 v9; // rax
__int64 v10; // rax
_BYTE v11[88]; // [rsp+0h] [rbp-58h] BYREF

v5 = FindAssertSlotItem((_QWORD *)a2, a3);
if ( v5 )
{
v6 = *(_QWORD *)(v5 + 16);
*(_QWORD *)(v5 + 16) = 0LL;
}
else
{
v8 = *(_BYTE *)(a2 + 8);
if ( (v8 & 2) != 0 )
{
PrintErrorID(a1, "TMPLTRHS", 1LL, 1LL);
EnvPrintRouter(a1, "werror", "Slot ");
EnvPrintRouter(a1, "werror", *(_QWORD *)(*(_QWORD *)a2 + 24LL));
EnvPrintRouter(a1, "werror", " requires a value because of its (default ?NONE) attribute.\n");
*a4 = 1;
return 0LL;
}
if ( (v8 & 0xC) != 0 )
{
v6 = CopyExpression(a1, *(_QWORD *)(a2 + 24));
}
else
{
DeriveDefaultFromConstraints(a1, *(_QWORD *)(a2 + 16), v11, *(_BYTE *)(a2 + 8) & 1, 1LL);
v6 = ConvertValueToExpression(a1, v11);
}
}
if ( (*(_BYTE *)(a2 + 8) & 1) != 0 )
{
v9 = AddBitMap(a1, &unk_7E5, 1LL);
v10 = GenConstant(a1, 62LL, v9);
*(_QWORD *)(v10 + 16) = v6;
v6 = v10;
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3, _DWORD *a4)
{
__int64 v5; // rax
__int64 v6; // r13
char v8; // al
__int64 v9; // rax
__int64 v10; // rax
_BYTE v11[88]; // [rsp+0h] [rbp-58h] BYREF

v5 = func0((_QWORD *)a2, a3);
if ( v5 )
{
v6 = *(_QWORD *)(v5 + 16);
*(_QWORD *)(v5 + 16) = 0LL;
}
else
{
v8 = *(_BYTE *)(a2 + 8);
if ( (v8 & 2) != 0 )
{
PrintErrorID(a1, "TMPLTRHS", 1LL, 1LL);
EnvPrintRouter(a1, "werror", "Slot ");
EnvPrintRouter(a1, "werror", *(_QWORD *)(*(_QWORD *)a2 + 24LL));
EnvPrintRouter(a1, "werror", " requires a value because of its (default ?NONE) attribute.\n");
*a4 = 1;
return 0LL;
}
if ( (v8 & 0xC) != 0 )
{
v6 = CopyExpression(a1, *(_QWORD *)(a2 + 24));
}
else
{
DeriveDefaultFromConstraints(a1, *(_QWORD *)(a2 + 16), v11, *(_BYTE *)(a2 + 8) & 1, 1LL);
v6 = ConvertValueToExpression(a1, v11);
}
}
if ( (*(_BYTE *)(a2 + 8) & 1) != 0 )
{
v9 = AddBitMap(a1, &unk_7E5, 1LL);
v10 = GenConstant(a1, 62LL, v9);
*(_QWORD *)(v10 + 16) = v6;
v6 = v10;
}
return v6;
}

original_code:
static struct expr *GetSlotAssertValues(
  void *theEnv,
  struct templateSlot *slotPtr,
  struct expr *firstSlot,
  int *error)
  {
   struct expr *slotItem;
   struct expr *newArg, *tempArg;
   DATA_OBJECT theDefault;
   slotItem = FindAssertSlotItem(slotPtr,firstSlot);
   if (slotItem != ((void *)0))
     {
      newArg = slotItem->argList;
      slotItem->argList = ((void *)0);
     }
   else
     {
      if (slotPtr->noDefault)
        {
         PrintErrorID(theEnv,"TMPLTRHS",1,1);
         EnvPrintRouter(theEnv,"werror","Slot ");
         EnvPrintRouter(theEnv,"werror",slotPtr->slotName->contents);
         EnvPrintRouter(theEnv,"werror"," requires a value because of its (default ?NONE) attribute.\n");
         *error = 1;
         return(((void *)0));
        }
      else if ((slotPtr->defaultPresent == 0) &&
               (slotPtr->defaultDynamic == 0))
        {
         DeriveDefaultFromConstraints(theEnv,slotPtr->constraints,&theDefault,
                                      (int) slotPtr->multislot,1);
         newArg = ConvertValueToExpression(theEnv,&theDefault);
        }
      else
        { newArg = CopyExpression(theEnv,slotPtr->defaultList); }
     }
   if (slotPtr->multislot)
     {
      tempArg = GenConstant(theEnv,62,AddBitMap(theEnv,(void *) "\0",1));
      tempArg->argList = newArg;
      newArg = tempArg;
     }
   return(newArg);
  }

canonical_original_code:
static struct expr *GetSlotAssertValues(void *theEnv, struct templateSlot *slotPtr, struct expr *firstSlot, int *error)
  {
   struct expr *slotItem;
   struct expr *newArg; struct expr *tempArg;
   struct dataObject theDefault;
   slotItem = FindAssertSlotItem(slotPtr,firstSlot);
   if (slotItem != ((void *)0))
     {
      newArg = slotItem->argList;
      slotItem->argList = ((void *)0);
     }
   else
     {
      if (slotPtr->noDefault)
        {
         PrintErrorID(theEnv,"TMPLTRHS",1,1);
         EnvPrintRouter(theEnv,"werror","Slot ");
         EnvPrintRouter(theEnv,"werror",slotPtr->slotName->contents);
         EnvPrintRouter(theEnv,"werror"," requires a value because of its (default ?NONE) attribute.\n");
         *error = 1;
         return(((void *)0));
        }
      else if ((slotPtr->defaultPresent == 0) &&
               (slotPtr->defaultDynamic == 0))
        {
         DeriveDefaultFromConstraints(theEnv,slotPtr->constraints,&theDefault,
                                      (int) slotPtr->multislot,1);
         newArg = ConvertValueToExpression(theEnv,&theDefault);
        }
      else
        { newArg = CopyExpression(theEnv,slotPtr->defaultList); }
     }
   if (slotPtr->multislot)
     {
      tempArg = GenConstant(theEnv,62,AddBitMap(theEnv,(void *) "\0",1));
      tempArg->argList = newArg;
      newArg = tempArg;
     }
   return(newArg);
  }

variable_types:
firstSlot
struct expr *

variable_types:
error
int *

variable_types: struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *

variable_types: struct dataObject { void *supplementalInfo; unsigned short type; void *value; long begin; long end; struct dataObject *next; }

user_defined_types: struct templateSlot { struct symbolHashNode *slotName; unsigned int multislot; unsigned int noDefault; unsigned int defaultPresent; unsigned int defaultDynamic; struct constraintRecord *constraints; struct expr *defaultList; struct templateSlot *next; }

user_defined_types: struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; }


ReorderAssertSlotValues

decompiled_code:
__int64 __fastcall ReorderAssertSlotValues(__int64 a1, __int64 a2, __int64 a3, _DWORD *a4)
{
__int64 v4; // rbx
__int64 v7; // r12
__int64 v8; // r15
__int64 v10; // rax

v4 = a2;
if ( !a2 )
return 0LL;
v7 = 0LL;
v8 = 0LL;
while ( 1 )
{
v10 = GetSlotAssertValues(a1, v4, a3, a4);
if ( *a4 )
break;
if ( v10 )
{
if ( v7 )
{
*(_QWORD *)(v7 + 24) = v10;
v7 = v10;
}
else
{
v7 = v10;
v8 = v10;
}
}
v4 = *(_QWORD *)(v4 + 32);
if ( !v4 )
return v8;
}
ReturnExpression(a1, v8);
return 0LL;
}

original_code:
static struct expr *ReorderAssertSlotValues(
  void *theEnv,
  struct templateSlot *slotPtr,
  struct expr *firstSlot,
  int *error)
  {
   struct expr *firstArg = ((void *)0);
   struct expr *lastArg = ((void *)0), *newArg;
   for (;
        slotPtr != ((void *)0);
        slotPtr = slotPtr->next)
     {
      newArg = GetSlotAssertValues(theEnv,slotPtr,firstSlot,error);
      if (*error)
        {
         ReturnExpression(theEnv,firstArg);
         return(((void *)0));
        }
      if (newArg != ((void *)0))
        {
         if (lastArg == ((void *)0))
           { firstArg = newArg; }
         else
           { lastArg->nextArg = newArg; }
         lastArg = newArg;
        }
     }
   return(firstArg);
  }

canonical_original_code:
static struct expr *ReorderAssertSlotValues(void *theEnv, struct templateSlot *slotPtr, struct expr *firstSlot, int *error)
  {
   struct expr *firstArg = ((void *)0);
   struct expr *lastArg = ((void *)0); struct expr *newArg;
   for (;
        slotPtr != ((void *)0);
        slotPtr = slotPtr->next)
     {
      newArg = GetSlotAssertValues(theEnv,slotPtr,firstSlot,error);
      if (*error)
        {
         ReturnExpression(theEnv,firstArg);
         return(((void *)0));
        }
      if (newArg != ((void *)0))
        {
         if (lastArg == ((void *)0))
           { firstArg = newArg; }
         else
           { lastArg->nextArg = newArg; }
         lastArg = newArg;
        }
     }
   return(firstArg);
  }

user_defined_types: struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; }

user_defined_types: struct constraintRecord { unsigned int anyAllowed; unsigned int symbolsAllowed; unsigned int stringsAllowed; unsigned int floatsAllowed; unsigned int integersAllowed; unsigned int instanceNamesAllowed; unsigned int instanceAddressesAllowed; unsigned int externalAddressesAllowed; unsigned int factAddressesAllowed; unsigned int voidAllowed; unsigned int anyRestriction; unsigned int symbolRestriction; unsigned int stringRestriction; unsigned int floatRestriction; unsigned int integerRestriction; unsigned int classRestriction; unsigned int instanceNameRestriction; unsigned int multifieldsAllowed; unsigned int singlefieldsAllowed; unsigned short bsaveIndex; struct expr *classList; struct expr *restrictionList; struct expr *minValue; struct expr *maxValue; struct expr *minFields; struct expr *maxFields; struct constraintRecord *multifield; struct constraintRecord *next; int bucket; int count; }


EnvGetDefglobalWatch

decompiled_code:
__int64 __fastcall EnvGetDefglobalWatch(__int64 a1, __int64 a2)
{
return *(_BYTE *)(a2 + 48) & 1;
}

original_code:
unsigned EnvGetDefglobalWatch(
  void *theEnv,
  void *theGlobal)
  {
   return(((struct defglobal *) theGlobal)->watch);
  }

canonical_original_code:
unsigned int EnvGetDefglobalWatch(void *theEnv, void *theGlobal)
  {
   return(((struct defglobal *) theGlobal)->watch);
  }

variable_types:
theGlobal
void *

return_type: unsigned int

user_defined_types: struct defglobal { struct constructHeader header; unsigned int watch; unsigned int inScope; long busyCount; struct dataObject current; struct expr *initial; }

user_defined_types: struct constructHeader { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; }

user_defined_types: struct dataObject { void *supplementalInfo; unsigned short type; void *value; long begin; long end; struct dataObject *next; }

user_defined_types: struct portItem { struct symbolHashNode *moduleName; struct symbolHashNode *constructType; struct symbolHashNode *constructName; struct portItem *next; }

user_defined_types: struct userData { unsigned char dataID; struct userData *next; }


EnvSetDefglobalWatch

decompiled_code:
__int64 __fastcall EnvSetDefglobalWatch(__int64 a1, char a2, __int64 a3)
{
__int64 result; // rax

result = a2 & 1;
*(_BYTE *)(a3 + 48) = result | *(_BYTE *)(a3 + 48) & 0xFE;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, char a2, __int64 a3)
{
__int64 result; // rax

result = a2 & 1;
*(_BYTE *)(a3 + 48) = result | *(_BYTE *)(a3 + 48) & 0xFE;
return result;
}

original_code:
void EnvSetDefglobalWatch(
  void *theEnv,
  unsigned newState,
  void *theGlobal)
  {
   ((struct defglobal *) theGlobal)->watch = newState;
  }

canonical_original_code:
void EnvSetDefglobalWatch(void *theEnv, unsigned int newState, void *theGlobal)
  {
   ((struct defglobal *) theGlobal)->watch = newState;
  }

variable_types:
newState
unsigned int

return_type: void

user_defined_types: struct defmoduleItemHeader { struct defmodule *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; }


ResetDefglobalAction

decompiled_code:
__int64 __fastcall ResetDefglobalAction(__int64 a1, __int64 a2)
{
_WORD v3[8]; // [rsp+0h] [rbp-48h] BYREF
__int64 v4; // [rsp+10h] [rbp-38h]

if ( (unsigned int)EvaluateExpression(a1, *(_QWORD *)(a2 + 112), v3) )
{
v3[4] = 2;
v4 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 392LL) + 8LL);
}
return QSetDefglobalValue(a1, a2, v3, 0LL);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
_WORD v3[8]; // [rsp+0h] [rbp-48h] BYREF
__int64 v4; // [rsp+10h] [rbp-38h]

if ( (unsigned int)EvaluateExpression(a1, *(_QWORD *)(a2 + 112), v3) )
{
v3[4] = 2;
v4 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 392LL) + 8LL);
}
return QSetDefglobalValue(a1, a2, v3, 0LL);
}

original_code:
static void ResetDefglobalAction(
  void *theEnv,
  struct constructHeader *theConstruct,
  void *buffer)
  {
   struct defglobal *theDefglobal = (struct defglobal *) theConstruct;
   DATA_OBJECT assignValue;
   if (EvaluateExpression(theEnv,theDefglobal->initial,&assignValue))
     {
      assignValue.type = 2;
      assignValue.value = ((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN;
     }
   QSetDefglobalValue(theEnv,theDefglobal,&assignValue,0);
  }

canonical_original_code:
static void ResetDefglobalAction(void *theEnv, struct constructHeader *theConstruct, void *buffer)
  {
   struct defglobal *theDefglobal = (struct defglobal *) theConstruct;
   struct dataObject assignValue;
   if (EvaluateExpression(theEnv,theDefglobal->initial,&assignValue))
     {
      assignValue.type = 2;
      assignValue.value = ((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN;
     }
   QSetDefglobalValue(theEnv,theDefglobal,&assignValue,0);
  }

variable_types: struct constructHeader { struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; } *name; char *ppForm; struct defmoduleItemHeader { struct defmodule { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader **itemsArray; struct portItem { struct symbolHashNode *moduleName; struct symbolHashNode *constructType; struct symbolHashNode *constructName; struct portItem *next; } *importList; struct portItem *exportList; unsigned int visitedFlag; long bsaveID; struct userData { unsigned char dataID; struct userData *next; } *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } *

variable_types:
buffer
void *

variable_types: struct defglobal { struct constructHeader { struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; } *name; char *ppForm; struct defmoduleItemHeader { struct defmodule { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader **itemsArray; struct portItem { struct symbolHashNode *moduleName; struct symbolHashNode *constructType; struct symbolHashNode *constructName; struct portItem *next; } *importList; struct portItem *exportList; unsigned int visitedFlag; long bsaveID; struct userData { unsigned char dataID; struct userData *next; } *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } header; unsigned int watch; unsigned int inScope; long busyCount; struct dataObject { void *supplementalInfo; unsigned short type; void *value; long begin; long end; struct dataObject *next; } current; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *initial; } *

user_defined_types: struct symbolData { void *TrueSymbolHN; void *FalseSymbolHN; void *PositiveInfinity; void *NegativeInfinity; void *Zero; struct symbolHashNode **SymbolTable; struct floatHashNode **FloatTable; struct integerHashNode **IntegerTable; struct bitMapHashNode **BitMapTable; struct ephemeron *EphemeralSymbolList; struct ephemeron *EphemeralFloatList; struct ephemeron *EphemeralIntegerList; struct ephemeron *EphemeralBitMapList; long NumberOfSymbols; long NumberOfFloats; long NumberOfIntegers; long NumberOfBitMaps; struct symbolHashNode **SymbolArray; struct floatHashNode **FloatArray; struct integerHashNode **IntegerArray; struct bitMapHashNode **BitMapArray; }

user_defined_types: struct environmentData { unsigned int initialized; unsigned long environmentIndex; void *context; void *routerContext; void **theData; void (**cleanupFunctions)(void *); struct environmentCleanupFunction *listOfCleanupEnvironmentFunctions; struct environmentData *next; }

user_defined_types: struct ephemeron { struct genericHashNode *associatedValue; struct ephemeron *next; }

user_defined_types: struct environmentCleanupFunction { char *name; void (*func)(void *); int priority; struct environmentCleanupFunction *next; }

user_defined_types: struct floatHashNode { struct floatHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededFloat; unsigned int bucket; double contents; }

user_defined_types: struct integerHashNode { struct integerHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededInteger; unsigned int bucket; long contents; }

user_defined_types: struct bitMapHashNode { struct bitMapHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededBitMap; unsigned int bucket; char *contents; unsigned short size; }

user_defined_types: struct defmodule { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader **itemsArray; struct portItem *importList; struct portItem *exportList; unsigned int visitedFlag; long bsaveID; struct userData *usrData; struct defmodule *next; }

user_defined_types: struct genericHashNode { struct genericHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int needed; unsigned int bucket; }