NetworkAssert

original_code:
void NetworkAssert(
  void *theEnv,
  struct partialMatch *binds,
  struct joinNode *join,
  int enterDirection)
  {
   struct partialMatch *lhsBinds = ((void *)0), *rhsBinds = ((void *)0);
   struct partialMatch *comparePMs = ((void *)0), *newBinds;
   int exprResult;
   if (((struct engineData *) (((struct environmentData *) theEnv)->theData[18]))->IncrementalResetInProgress && (join->initialize == 0)) return;
   if ((enterDirection == 0) &&
       ((join->patternIsNegated) || (join->joinFromTheRight)))
     {
      newBinds = AddSingleMatch(theEnv,binds,((void *)0),
                                (join->ruleToActivate == ((void *)0)) ? 0 : 1,
                                (int) join->logicalJoin);
      newBinds->notOriginf = 1;
      newBinds->counterf = 1;
      binds = newBinds;
      binds->next = join->beta;
      join->beta = binds;
     }
   if (join->firstJoin)
     {
      EmptyDrive(theEnv,join,binds);
      return;
     }
   if (enterDirection == 0)
     {
      if (join->joinFromTheRight)
        { comparePMs = ((struct joinNode *) join->rightSideEntryStructure)->beta;}
      else
        { comparePMs = ((struct patternNodeHeader *) join->rightSideEntryStructure)->alphaMemory; }
      lhsBinds = binds;
     }
   else if (enterDirection == 1)
     {
      if (join->patternIsNegated || join->joinFromTheRight)
        { comparePMs = join->beta; }
      else
        { comparePMs = join->lastLevel->beta; }
      rhsBinds = binds;
     }
   else
     {
      SystemError(theEnv,"DRIVE",1);
      EnvExitRouter(theEnv,1);
     }
   while (comparePMs != ((void *)0))
     {
      if (enterDirection == 1)
        {
         lhsBinds = comparePMs;
         if (lhsBinds->counterf &&
             (join->patternIsNegated == 0) &&
             (join->joinFromTheRight == 0))
           {
            comparePMs = comparePMs->next;
            continue;
           }
        if ((join->patternIsNegated || join->joinFromTheRight) &&
            (lhsBinds->counterf))
          {
           comparePMs = comparePMs->next;
           continue;
          }
        }
      else
        { rhsBinds = comparePMs; }
      if (join->networkTest == ((void *)0))
        {
         exprResult = 1;
         if (join->joinFromTheRight)
           {
            int i;
            for (i = 0; i < (int) (lhsBinds->bcount - 1); i++)
              {
               if (lhsBinds->binds[i].gm.theMatch != rhsBinds->binds[i].gm.theMatch)
                 {
                  exprResult = 0;
                  break;
                 }
              }
           }
        }
      else
        {
         exprResult = EvaluateJoinExpression(theEnv,join->networkTest,lhsBinds,rhsBinds,join);
         if (((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->EvaluationError)
           {
            if (join->patternIsNegated) exprResult = 1;
            SetEvaluationError(theEnv,0);
           }
        }
      if (exprResult != 0)
        {
         if ((join->patternIsNegated == 0) &&
             (join->joinFromTheRight == 0))
           { PPDrive(theEnv,lhsBinds,rhsBinds,join); }
         else if (enterDirection == 1)
           { PNRDrive(theEnv,join,comparePMs,rhsBinds); }
         else if (enterDirection == 0)
           {
            binds->binds[binds->bcount - 1].gm.theValue = (void *) rhsBinds;
            comparePMs = ((void *)0);
            continue;
           }
        }
      comparePMs = comparePMs->next;
     }
   if ((join->patternIsNegated || join->joinFromTheRight) &&
       (enterDirection == 0) &&
       (binds->binds[binds->bcount - 1].gm.theValue == ((void *)0)))
     { PNLDrive(theEnv,join,binds); }
   return;
  }

canonical_original_code:
void NetworkAssert(void *theEnv, struct partialMatch *binds, struct joinNode *join, int enterDirection)
  {
   struct partialMatch *lhsBinds = ((void *)0); struct partialMatch *rhsBinds = ((void *)0);
   struct partialMatch *comparePMs = ((void *)0); struct partialMatch *newBinds;
   int exprResult;
   if (((struct engineData *) (((struct environmentData *) theEnv)->theData[18]))->IncrementalResetInProgress && (join->initialize == 0)) return;
   if ((enterDirection == 0) &&
       ((join->patternIsNegated) || (join->joinFromTheRight)))
     {
      newBinds = AddSingleMatch(theEnv,binds,((void *)0),
                                (join->ruleToActivate == ((void *)0)) ? 0 : 1,
                                (int) join->logicalJoin);
      newBinds->notOriginf = 1;
      newBinds->counterf = 1;
      binds = newBinds;
      binds->next = join->beta;
      join->beta = binds;
     }
   if (join->firstJoin)
     {
      EmptyDrive(theEnv,join,binds);
      return;
     }
   if (enterDirection == 0)
     {
      if (join->joinFromTheRight)
        { comparePMs = ((struct joinNode *) join->rightSideEntryStructure)->beta;}
      else
        { comparePMs = ((struct patternNodeHeader *) join->rightSideEntryStructure)->alphaMemory; }
      lhsBinds = binds;
     }
   else if (enterDirection == 1)
     {
      if (join->patternIsNegated || join->joinFromTheRight)
        { comparePMs = join->beta; }
      else
        { comparePMs = join->lastLevel->beta; }
      rhsBinds = binds;
     }
   else
     {
      SystemError(theEnv,"DRIVE",1);
      EnvExitRouter(theEnv,1);
     }
   while (comparePMs != ((void *)0))
     {
      if (enterDirection == 1)
        {
         lhsBinds = comparePMs;
         if (lhsBinds->counterf &&
             (join->patternIsNegated == 0) &&
             (join->joinFromTheRight == 0))
           {
            comparePMs = comparePMs->next;
            continue;
           }
        if ((join->patternIsNegated || join->joinFromTheRight) &&
            (lhsBinds->counterf))
          {
           comparePMs = comparePMs->next;
           continue;
          }
        }
      else
        { rhsBinds = comparePMs; }
      if (join->networkTest == ((void *)0))
        {
         exprResult = 1;
         if (join->joinFromTheRight)
           {
            int i;
            for (i = 0; i < (int) (lhsBinds->bcount - 1); i++)
              {
               if (lhsBinds->binds[i].gm.theMatch != rhsBinds->binds[i].gm.theMatch)
                 {
                  exprResult = 0;
                  break;
                 }
              }
           }
        }
      else
        {
         exprResult = EvaluateJoinExpression(theEnv,join->networkTest,lhsBinds,rhsBinds,join);
         if (((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->EvaluationError)
           {
            if (join->patternIsNegated) exprResult = 1;
            SetEvaluationError(theEnv,0);
           }
        }
      if (exprResult != 0)
        {
         if ((join->patternIsNegated == 0) &&
             (join->joinFromTheRight == 0))
           { PPDrive(theEnv,lhsBinds,rhsBinds,join); }
         else if (enterDirection == 1)
           { PNRDrive(theEnv,join,comparePMs,rhsBinds); }
         else if (enterDirection == 0)
           {
            binds->binds[binds->bcount - 1].gm.theValue = (void *) rhsBinds;
            comparePMs = ((void *)0);
            continue;
           }
        }
      comparePMs = comparePMs->next;
     }
   if ((join->patternIsNegated || join->joinFromTheRight) &&
       (enterDirection == 0) &&
       (binds->binds[binds->bcount - 1].gm.theValue == ((void *)0)))
     { PNLDrive(theEnv,join,binds); }
   return;
  }

variable_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 { 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 { unsigned char dataID; struct userData *next; } *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]; } *

variable_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 { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *networkTest; void *rightSideEntryStructure; struct joinNode *nextLevel; struct joinNode *lastLevel; struct joinNode *rightDriveNode; struct joinNode *rightMatchNode; struct defrule { 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 *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } 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; } *

variable_types: enterDirection int

variable_types: exprResult int

variable_types: i int

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 engineData { struct defrule *ExecutingRule; int HaltRules; struct joinNode *TheLogicalJoin; struct dependency *UnsupportedDataEntities; int alreadyEntered; struct callFunctionItem *ListOfRunFunctions; struct focus *CurrentFocus; int FocusChanged; unsigned int WatchStatistics; unsigned int WatchFocus; int IncrementalResetInProgress; int IncrementalResetFlag; int JoinOperationInProgress; struct partialMatch *GlobalLHSBinds; struct partialMatch *GlobalRHSBinds; struct joinNode *GlobalJoin; struct rdriveinfo *DriveRetractionList; struct partialMatch *GarbagePartialMatches; struct alphaMatch *GarbageAlphaMatches; int AlreadyRunning; }

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 evaluationData { struct expr *CurrentExpression; int EvaluationError; int HaltExecution; int CurrentEvaluationDepth; struct entityRecord *PrimitivesArray[150]; }

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

user_defined_types: struct dependency { void *dPtr; struct dependency *next; }

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

user_defined_types: struct focus { struct defmodule *theModule; struct defruleModule *theDefruleModule; struct focus *next; }

user_defined_types: struct rdriveinfo { struct partialMatch *link; struct joinNode *jlist; struct rdriveinfo *next; }

user_defined_types: struct defruleModule { struct defmoduleItemHeader header; struct activation *agenda; }

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

user_defined_types: struct activation { struct defrule *theRule; struct partialMatch *basis; int salience; unsigned long timetag; struct partialMatch *sortedBasis; int randomID; struct activation *prev; struct activation *next; }

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; }


EmptyDrive

repo: jarcec/rbclips

decompiled_code:
__int64 __fastcall EmptyDrive(__int64 a1, char *a2, __int64 a3)
{
unsigned __int16 *v5; // rsi
__int64 result; // rax
char v7; // cl
__int64 v8; // rax
__int64 v9; // rsi
__int64 v10; // r12
__int64 i; // rbx

v5 = (unsigned __int16 *)*((_QWORD *)a2 + 3);
if ( !v5
|| (result = EvaluateJoinExpression_localalias(a1, v5, 0LL, a3, a2),
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 352LL) + 8LL) = 0,
(_DWORD)result) )
{
v7 = *a2;
if ( (*a2 & 8) != 0 )
{
SystemError(a1, "DRIVE", 2LL);
EnvExitRouter(a1, 1LL);
v7 = *a2;
}
v8 = CopyPartialMatch(a1, a3, *((_QWORD *)a2 + 9) != 0LL, (v7 & 2) != 0);
v9 = *((_QWORD *)a2 + 9);
v10 = v8;
result = *((_QWORD *)a2 + 2);
*(_QWORD *)(v10 + 8) = result;
*((_QWORD *)a2 + 2) = v10;
if ( v9 )
result = AddActivation(a1, v9, v10);
for ( i = *((_QWORD *)a2 + 5); i; i = *(_QWORD *)(i + 56) )
result = NetworkAssert(a1, (_WORD *)v10, i, 0);
}
return result;
}

original_code:
static void EmptyDrive(
  void *theEnv,
  struct joinNode *join,
  struct partialMatch *rhsBinds)
  {
   struct partialMatch *linker;
   struct joinNode *listOfJoins;
   int joinExpr;
   if (join->networkTest != ((void *)0))
     {
      joinExpr = EvaluateJoinExpression(theEnv,join->networkTest,((void *)0),rhsBinds,join);
      ((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->EvaluationError = 0;
      if (joinExpr == 0) return;
     }
   if (join->patternIsNegated == 1)
     {
      SystemError(theEnv,"DRIVE",2);
      EnvExitRouter(theEnv,1);
     }
   linker = CopyPartialMatch(theEnv,rhsBinds,
                             (join->ruleToActivate == ((void *)0)) ? 0 : 1,
                             (int) join->logicalJoin);
   linker->next = join->beta;
   join->beta = linker;
   if (join->ruleToActivate != ((void *)0)) AddActivation(theEnv,join->ruleToActivate,linker);
   listOfJoins = join->nextLevel;
   while (listOfJoins != ((void *)0))
     {
      NetworkAssert(theEnv,linker,listOfJoins,0);
      listOfJoins = listOfJoins->rightDriveNode;
     }
  }

canonical_original_code:
static void EmptyDrive(void *theEnv, struct joinNode *join, struct partialMatch *rhsBinds)
  {
   struct partialMatch *linker;
   struct joinNode *listOfJoins;
   int joinExpr;
   if (join->networkTest != ((void *)0))
     {
      joinExpr = EvaluateJoinExpression(theEnv,join->networkTest,((void *)0),rhsBinds,join);
      ((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->EvaluationError = 0;
      if (joinExpr == 0) return;
     }
   if (join->patternIsNegated == 1)
     {
      SystemError(theEnv,"DRIVE",2);
      EnvExitRouter(theEnv,1);
     }
   linker = CopyPartialMatch(theEnv,rhsBinds,
                             (join->ruleToActivate == ((void *)0)) ? 0 : 1,
                             (int) join->logicalJoin);
   linker->next = join->beta;
   join->beta = linker;
   if (join->ruleToActivate != ((void *)0)) AddActivation(theEnv,join->ruleToActivate,linker);
   listOfJoins = join->nextLevel;
   while (listOfJoins != ((void *)0))
     {
      NetworkAssert(theEnv,linker,listOfJoins,0);
      listOfJoins = listOfJoins->rightDriveNode;
     }
  }

variable_types:
theEnv
void *

variable_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 { 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 { unsigned char dataID; struct userData *next; } *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]; } *beta; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *networkTest; void *rightSideEntryStructure; struct joinNode *nextLevel; struct joinNode *lastLevel; struct joinNode *rightDriveNode; struct joinNode *rightMatchNode; struct defrule { 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 *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } 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; } *

variable_types:
rhsBinds
struct partialMatch *

variable_types: joinExpr int

return_type: void

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 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 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; }

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

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 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 alphaMatch { struct patternEntity *matchingItem; struct multifieldMarker *markers; struct alphaMatch *next; }

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

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


PPDrive

original_code:
static void PPDrive(
  void *theEnv,
  struct partialMatch *lhsBinds,
  struct partialMatch *rhsBinds,
  struct joinNode *join)
  {
   struct partialMatch *linker;
   struct joinNode *listOfJoins;
   linker = MergePartialMatches(theEnv,lhsBinds,rhsBinds,
                                (join->ruleToActivate == ((void *)0)) ? 0 : 1,
                                (int) join->logicalJoin);
   linker->next = join->beta;
   join->beta = linker;
   if (join->ruleToActivate != ((void *)0)) AddActivation(theEnv,join->ruleToActivate,linker);
   listOfJoins = join->nextLevel;
   if (listOfJoins != ((void *)0))
     {
      if (((struct joinNode *) (listOfJoins->rightSideEntryStructure)) == join)
        { NetworkAssert(theEnv,linker,listOfJoins,1); }
      else while (listOfJoins != ((void *)0))
        {
         NetworkAssert(theEnv,linker,listOfJoins,0);
         listOfJoins = listOfJoins->rightDriveNode;
        }
     }
   return;
  }

canonical_original_code:
static void PPDrive(void *theEnv, struct partialMatch *lhsBinds, struct partialMatch *rhsBinds, struct joinNode *join)
  {
   struct partialMatch *linker;
   struct joinNode *listOfJoins;
   linker = MergePartialMatches(theEnv,lhsBinds,rhsBinds,
                                (join->ruleToActivate == ((void *)0)) ? 0 : 1,
                                (int) join->logicalJoin);
   linker->next = join->beta;
   join->beta = linker;
   if (join->ruleToActivate != ((void *)0)) AddActivation(theEnv,join->ruleToActivate,linker);
   listOfJoins = join->nextLevel;
   if (listOfJoins != ((void *)0))
     {
      if (((struct joinNode *) (listOfJoins->rightSideEntryStructure)) == join)
        { NetworkAssert(theEnv,linker,listOfJoins,1); }
      else while (listOfJoins != ((void *)0))
        {
         NetworkAssert(theEnv,linker,listOfJoins,0);
         listOfJoins = listOfJoins->rightDriveNode;
        }
     }
   return;
  }

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 genericMatch { union { void *theValue; struct alphaMatch *theMatch; } gm; }

user_defined_types: 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 multifieldMarker { int whichField; union { void *whichSlot; short whichSlotNumber; } where; long startPosition; long endPosition; struct multifieldMarker *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; }

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


BloadDefinstances

decompiled_code:
__int64 __fastcall BloadDefinstances(__int64 a1)
{
char v2[16]; // [rsp+8h] [rbp-10h] BYREF

GenReadBinary(a1, v2, 8LL);
BloadandRefresh(a1, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 16LL), 24LL, UpdateDefinstancesModule);
return BloadandRefresh(a1, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 8LL), 32LL, UpdateDefinstances);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
char v2[16]; // [rsp+8h] [rbp-10h] BYREF

GenReadBinary(a1, v2, 8LL);
BloadandRefresh(a1, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 16LL), 24LL, UpdateDefinstancesModule);
return BloadandRefresh(a1, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 8LL), 32LL, UpdateDefinstances);
}

original_code:
static void BloadDefinstances(
  void *theEnv)
  {
   unsigned long space;
   GenReadBinary(theEnv,(void *) &space,(unsigned long) sizeof(unsigned long));
   BloadandRefresh(theEnv,((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleCount,sizeof(BSAVE_DEFINSTANCES_MODULE),UpdateDefinstancesModule);
   BloadandRefresh(theEnv,((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesCount,sizeof(BSAVE_DEFINSTANCES),UpdateDefinstances);
  }

canonical_original_code:
static void BloadDefinstances(void *theEnv)
  {
   unsigned long space;
   GenReadBinary(theEnv,(void *) &space,(unsigned long) sizeof(unsigned long));
   BloadandRefresh(theEnv,((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleCount,sizeof(BSAVE_DEFINSTANCES_MODULE),UpdateDefinstancesModule);
   BloadandRefresh(theEnv,((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesCount,sizeof(BSAVE_DEFINSTANCES),UpdateDefinstances);
  }

variable_types:
space
unsigned long

user_defined_types: struct definstancesBinaryData { struct definstances *DefinstancesArray; long DefinstancesCount; long ModuleCount; struct definstancesModule *ModuleArray; }

user_defined_types: struct definstances { struct constructHeader header; unsigned int busy; struct expr *mkinstance; }

user_defined_types: struct definstancesModule { struct defmoduleItemHeader header; }

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

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; }


UpdateDefinstances

original_code:
static void UpdateDefinstances(
  void *theEnv,
  void *buf,
  long obji)
  {
   BSAVE_DEFINSTANCES *bdptr;
   DEFINSTANCES *dfiptr;
   bdptr = (BSAVE_DEFINSTANCES *) buf;
   dfiptr = (DEFINSTANCES *) &((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesArray[obji];
   UpdateConstructHeader(theEnv,&bdptr->header,&dfiptr->header,
                         (int) sizeof(DEFINSTANCES_MODULE),(void *) ((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleArray,
                         (int) sizeof(DEFINSTANCES),(void *) ((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesArray);
   dfiptr->mkinstance = ((struct expr *) (((bdptr->mkinstance) == -1L) ? ((void *)0) : &((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionArray[bdptr->mkinstance]));
   dfiptr->busy = 0;
  }

canonical_original_code:
static void UpdateDefinstances(void *theEnv, void *buf, long obji)
  {
   struct bsaveDefinstances *bdptr;
   struct definstances *dfiptr;
   bdptr = (struct bsaveDefinstances *) buf;
   dfiptr = (struct definstances *) &((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesArray[obji];
   UpdateConstructHeader(theEnv,&bdptr->header,&dfiptr->header,
                         (int) sizeof(DEFINSTANCES_MODULE),(void *) ((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleArray,
                         (int) sizeof(DEFINSTANCES),(void *) ((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesArray);
   dfiptr->mkinstance = ((struct expr *) (((bdptr->mkinstance) == -1L) ? ((void *)0) : &((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionArray[bdptr->mkinstance]));
   dfiptr->busy = 0;
  }

variable_types:
buf
void *

variable_types: obji long

variable_types: struct bsaveDefinstances { struct bsaveConstructHeader { long name; long whichModule; long next; } header; long mkinstance; } *

variable_types: struct definstances { 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 busy; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *mkinstance; } *

user_defined_types: struct bsaveDefinstances { struct bsaveConstructHeader header; long mkinstance; }

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 expressionData { void *PTR_AND; void *PTR_OR; void *PTR_EQ; void *PTR_NEQ; void *PTR_NOT; struct exprHashNode **ExpressionHashTable; long NumberOfExpressions; struct expr *ExpressionArray; long ExpressionCount; struct saved_contexts *svContexts; int ReturnContext; int BreakContext; int SequenceOpMode; }

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 environmentCleanupFunction { char *name; void (*func)(void *); int priority; struct environmentCleanupFunction *next; }

user_defined_types: struct saved_contexts { int rtn; int brk; struct saved_contexts *nxt; }

user_defined_types: struct exprHashNode { unsigned int hashval; unsigned int count; struct expr *exp; struct exprHashNode *next; long bsaveID; }


UpdateDefinstancesModule

decompiled_code:
__int64 __fastcall UpdateDefinstancesModule(__int64 a1, __int64 a2, __int64 a3)
{
return UpdateDefmoduleItemHeader(
a1,
a2,
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 24LL) + 24 * a3,
64LL,
**(_QWORD **)(*(_QWORD *)(a1 + 32) + 200LL));
}

original_code:
static void UpdateDefinstancesModule(
  void *theEnv,
  void *buf,
  long obji)
  {
   BSAVE_DEFINSTANCES_MODULE *bdptr;
   bdptr = (BSAVE_DEFINSTANCES_MODULE *) buf;
   UpdateDefmoduleItemHeader(theEnv,&bdptr->header,&((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleArray[obji].header,
                             (int) sizeof(DEFINSTANCES),(void *) ((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesArray);
  }

canonical_original_code:
static void UpdateDefinstancesModule(void *theEnv, void *buf, long obji)
  {
   struct bsaveDefinstancesModule *bdptr;
   bdptr = (struct bsaveDefinstancesModule *) buf;
   UpdateDefmoduleItemHeader(theEnv,&bdptr->header,&((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleArray[obji].header,
                             (int) sizeof(DEFINSTANCES),(void *) ((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesArray);
  }

variable_types: struct bsaveDefinstancesModule { struct bsaveDefmoduleItemHeader { long theModule; long firstItem; long lastItem; } header; } *

user_defined_types: struct bsaveDefinstancesModule { struct bsaveDefmoduleItemHeader header; }

user_defined_types: 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; }


MarkDefinstancesItems

decompiled_code:
__int64 __fastcall MarkDefinstancesItems(__int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rsi

++*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 8LL);
MarkConstructHeaderNeededItems(a2);
v2 = ExpressionSize(*(_QWORD *)(a2 + 56));
v3 = *(_QWORD *)(a2 + 56);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 360LL) + 64LL) += v2;
return MarkNeededItems(a1, v3);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rsi

++*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 8LL);
MarkConstructHeaderNeededItems(a2);
v2 = ExpressionSize(*(_QWORD *)(a2 + 56));
v3 = *(_QWORD *)(a2 + 56);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 360LL) + 64LL) += v2;
return MarkNeededItems(a1, v3);
}

original_code:
static void MarkDefinstancesItems(
  void *theEnv,
  struct constructHeader *theDefinstances,
  void *userBuffer)
  {
   MarkConstructHeaderNeededItems(theDefinstances,((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesCount++);
   ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionCount += ExpressionSize(((DEFINSTANCES *) theDefinstances)->mkinstance);
   MarkNeededItems(theEnv,((DEFINSTANCES *) theDefinstances)->mkinstance);
  }

canonical_original_code:
static void MarkDefinstancesItems(void *theEnv, struct constructHeader *theDefinstances, void *userBuffer)
  {
   MarkConstructHeaderNeededItems(theDefinstances,((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->DefinstancesCount++);
   ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionCount += ExpressionSize(((struct definstances *) theDefinstances)->mkinstance);
   MarkNeededItems(theEnv,((struct definstances *) theDefinstances)->mkinstance);
  }

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:
userBuffer
void *


SetupDefinstancesBload

decompiled_code:
__int64 __fastcall SetupDefinstancesBload(__int64 a1)
{
AllocateEnvironmentData(a1, 25LL, 32LL, DeallocateDefinstancesBinaryData);
return AddBinaryItem(
a1,
"definstances",
0LL,
BsaveDefinstancesFind,
BsaveDefinstancesExpressions,
BsaveStorageDefinstances,
BsaveDefinstancesDriver,
BloadStorageDefinstances,
BloadDefinstances,
ClearDefinstancesBload);
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1)
{
AllocateEnvironmentData(a1, 25LL, 32LL, DeallocateDefinstancesBinaryData);
return AddBinaryItem(
a1,
"definstances",
0LL,
BsaveDefinstancesFind,
BsaveDefinstancesExpressions,
BsaveStorageDefinstances,
BsaveDefinstancesDriver,
BloadStorageDefinstances,
BloadDefinstances,
ClearDefinstancesBload);
}

original_code:
void SetupDefinstancesBload(
  void *theEnv)
  {
   AllocateEnvironmentData(theEnv,25,sizeof(struct definstancesBinaryData),DeallocateDefinstancesBinaryData);
   AddBinaryItem(theEnv,"definstances",0,BsaveDefinstancesFind,BsaveDefinstancesExpressions,
                             BsaveStorageDefinstances,BsaveDefinstancesDriver,
                             BloadStorageDefinstances,BloadDefinstances,
                             ClearDefinstancesBload);
  }

canonical_original_code:
void SetupDefinstancesBload(void *theEnv)
  {
   AllocateEnvironmentData(theEnv,25,sizeof(struct definstancesBinaryData),DeallocateDefinstancesBinaryData);
   AddBinaryItem(theEnv,"definstances",0,BsaveDefinstancesFind,BsaveDefinstancesExpressions,
                             BsaveStorageDefinstances,BsaveDefinstancesDriver,
                             BloadStorageDefinstances,BloadDefinstances,
                             ClearDefinstancesBload);
  }

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; }


BloadDefinstancesModuleRef

decompiled_code:
__int64 __fastcall BloadDefinstancesModuleRef(__int64 a1, int a2)
{
return *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 200LL) + 24LL) + 24LL * a2;
}

original_code:
void *BloadDefinstancesModuleRef(
  void *theEnv,
  int theIndex)
  {
   return ((void *) &((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleArray[theIndex]);
  }

canonical_original_code:
void *BloadDefinstancesModuleRef(void *theEnv, int theIndex)
  {
   return ((void *) &((struct definstancesBinaryData *) (((struct environmentData *) theEnv)->theData[25]))->ModuleArray[theIndex]);
  }

variable_types: theIndex int

return_type: void *

user_defined_types: struct definstancesBinaryData { struct definstances *DefinstancesArray; long DefinstancesCount; long ModuleCount; struct definstancesModule *ModuleArray; }


ParseRestrictionType

original_code:
static RESTRICTION *ParseRestrictionType(
  void *theEnv,
  int code)
  {
   RESTRICTION *rptr;
   CONSTRAINT_RECORD *rv;
   EXPRESSION *types = ((void *)0);
   rptr = ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct restriction)] == ((void *)0)) ? ((struct restriction *) genalloc(theEnv,(unsigned) sizeof(struct restriction))) : ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct restriction)]), ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct restriction)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next, ((struct restriction *) ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr)));
   rptr->query = ((void *)0);
   rv = ArgumentTypeToConstraintRecord(theEnv,code);
   if (rv->anyAllowed == 0)
     {
      if (rv->symbolsAllowed && rv->stringsAllowed)
        types = GenTypeExpression(theEnv,types,12,-1,"LEXEME");
      else if (rv->symbolsAllowed)
        types = GenTypeExpression(theEnv,types,2,2,((void *)0));
      else if (rv->stringsAllowed)
        types = GenTypeExpression(theEnv,types,3,3,((void *)0));
      if (rv->floatsAllowed && rv->integersAllowed)
        types = GenTypeExpression(theEnv,types,11,-1,"NUMBER");
      else if (rv->integersAllowed)
        types = GenTypeExpression(theEnv,types,1,1,((void *)0));
      else if (rv->floatsAllowed)
        types = GenTypeExpression(theEnv,types,0,0,((void *)0));
      if (rv->instanceNamesAllowed && rv->instanceAddressesAllowed)
        types = GenTypeExpression(theEnv,types,14,-1,"INSTANCE");
      else if (rv->instanceNamesAllowed)
        types = GenTypeExpression(theEnv,types,8,8,((void *)0));
      else if (rv->instanceAddressesAllowed)
        types = GenTypeExpression(theEnv,types,7,7,((void *)0));
      if (rv->externalAddressesAllowed && rv->instanceAddressesAllowed &&
          rv->factAddressesAllowed)
        types = GenTypeExpression(theEnv,types,13,-1,"ADDRESS");
      else
        {
         if (rv->externalAddressesAllowed)
           types = GenTypeExpression(theEnv,types,5,5,((void *)0));
         if (rv->instanceAddressesAllowed && (rv->instanceNamesAllowed == 0))
           types = GenTypeExpression(theEnv,types,7,7,((void *)0));
         if (rv->factAddressesAllowed)
           types = GenTypeExpression(theEnv,types,6,6,((void *)0));
        }
      if (rv->multifieldsAllowed)
        types = GenTypeExpression(theEnv,types,4,4,((void *)0));
     }
   RemoveConstraint(theEnv,rv);
   PackRestrictionTypes(theEnv,rptr,types);
   return(rptr);
  }

canonical_original_code:
static struct restriction *ParseRestrictionType(void *theEnv, int code)
  {
   struct restriction *rptr;
   struct constraintRecord *rv;
   struct expr *types = ((void *)0);
   rptr = ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct restriction)] == ((void *)0)) ? ((struct restriction *) genalloc(theEnv,(unsigned int) sizeof(struct restriction))) : ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct restriction)]), ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct restriction)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next, ((struct restriction *) ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr)));
   rptr->query = ((void *)0);
   rv = ArgumentTypeToConstraintRecord(theEnv,code);
   if (rv->anyAllowed == 0)
     {
      if (rv->symbolsAllowed && rv->stringsAllowed)
        types = GenTypeExpression(theEnv,types,12,-1,"LEXEME");
      else if (rv->symbolsAllowed)
        types = GenTypeExpression(theEnv,types,2,2,((void *)0));
      else if (rv->stringsAllowed)
        types = GenTypeExpression(theEnv,types,3,3,((void *)0));
      if (rv->floatsAllowed && rv->integersAllowed)
        types = GenTypeExpression(theEnv,types,11,-1,"NUMBER");
      else if (rv->integersAllowed)
        types = GenTypeExpression(theEnv,types,1,1,((void *)0));
      else if (rv->floatsAllowed)
        types = GenTypeExpression(theEnv,types,0,0,((void *)0));
      if (rv->instanceNamesAllowed && rv->instanceAddressesAllowed)
        types = GenTypeExpression(theEnv,types,14,-1,"INSTANCE");
      else if (rv->instanceNamesAllowed)
        types = GenTypeExpression(theEnv,types,8,8,((void *)0));
      else if (rv->instanceAddressesAllowed)
        types = GenTypeExpression(theEnv,types,7,7,((void *)0));
      if (rv->externalAddressesAllowed && rv->instanceAddressesAllowed &&
          rv->factAddressesAllowed)
        types = GenTypeExpression(theEnv,types,13,-1,"ADDRESS");
      else
        {
         if (rv->externalAddressesAllowed)
           types = GenTypeExpression(theEnv,types,5,5,((void *)0));
         if (rv->instanceAddressesAllowed && (rv->instanceNamesAllowed == 0))
           types = GenTypeExpression(theEnv,types,7,7,((void *)0));
         if (rv->factAddressesAllowed)
           types = GenTypeExpression(theEnv,types,6,6,((void *)0));
        }
      if (rv->multifieldsAllowed)
        types = GenTypeExpression(theEnv,types,4,4,((void *)0));
     }
   RemoveConstraint(theEnv,rv);
   PackRestrictionTypes(theEnv,rptr,types);
   return(rptr);
  }

variable_types: code int

variable_types: struct restriction { void **types; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *query; unsigned int tcnt; } *

variable_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 { 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; } *

user_defined_types: struct restriction { void **types; struct expr *query; unsigned int tcnt; }

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 memoryData { long MemoryAmount; long MemoryCalls; int ConserveMemory; int (*OutOfMemoryFunction)(void *, unsigned long); struct memoryPtr *TempMemoryPtr; struct memoryPtr **MemoryTable; unsigned int TempSize; unsigned long TempSize2; }

user_defined_types: struct memoryPtr { struct memoryPtr *next; }


AddImplicitMethods

decompiled_code:
__int64 __fastcall AddImplicitMethods(__int64 a1, __int64 a2)
{
__int64 result; // rax
char *v3; // rdx
__int16 v4; // [rsp+0h] [rbp-38h] BYREF
__int64 v5; // [rsp+8h] [rbp-30h]
__int64 v6; // [rsp+10h] [rbp-28h]
__int64 v7; // [rsp+18h] [rbp-20h]

result = FindFunction(a1, *(_QWORD *)(*(_QWORD *)a2 + 24LL));
if ( result )
{
v4 = 30;
v3 = *(char **)(result + 40);
v5 = result;
v7 = 0LL;
v6 = 0LL;
result = FormMethodsFromRestrictions_constprop_0(a1, a2, v3, (__int64)&v4);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
__int64 result; // rax
char *v3; // rdx
__int16 v4; // [rsp+0h] [rbp-38h] BYREF
__int64 v5; // [rsp+8h] [rbp-30h]
__int64 v6; // [rsp+10h] [rbp-28h]
__int64 v7; // [rsp+18h] [rbp-20h]

result = FindFunction(a1, *(_QWORD *)(*(_QWORD *)a2 + 24LL));
if ( result )
{
v4 = 30;
v3 = *(char **)(result + 40);
v5 = result;
v7 = 0LL;
v6 = 0LL;
result = func2(a1, a2, v3, (__int64)&v4);
}
return result;
}

original_code:
void AddImplicitMethods(
  void *theEnv,
  DEFGENERIC *gfunc)
  {
   struct FunctionDefinition *sysfunc;
   EXPRESSION action;
   sysfunc = FindFunction(theEnv,(((struct symbolHashNode *) (gfunc->header.name))->contents));
   if (sysfunc == ((void *)0))
     return;
   action.type = 30;
   action.value = (void *) sysfunc;
   action.nextArg = ((void *)0);
   action.argList = ((void *)0);
   FormMethodsFromRestrictions(theEnv,gfunc,sysfunc->restrictions,&action);
  }

canonical_original_code:
void AddImplicitMethods(void *theEnv, struct defgeneric *gfunc)
  {
   struct FunctionDefinition *sysfunc;
   struct expr action;
   sysfunc = FindFunction(theEnv,(((struct symbolHashNode *) (gfunc->header.name))->contents));
   if (sysfunc == ((void *)0))
     return;
   action.type = 30;
   action.value = (void *) sysfunc;
   action.nextArg = ((void *)0);
   action.argList = ((void *)0);
   FormMethodsFromRestrictions(theEnv,gfunc,sysfunc->restrictions,&action);
  }

variable_types: struct defgeneric { 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 busy; struct method { unsigned int index; int restrictionCount; unsigned int system; unsigned int trace; struct restriction { void **types; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *query; unsigned int tcnt; } *restrictions; struct expr *actions; char *ppForm; struct userData *usrData; } *methods; unsigned int mcnt; } *

variable_types: struct FunctionDefinition { struct symbolHashNode { struct symbolHashNode *next; long count; int depth; unsigned int permanent; unsigned int markedEphemeral; unsigned int neededSymbol; unsigned int bucket; char *contents; } *callFunctionName; char *actualFunctionName; char returnValueType; int (*functionPointer)(); struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *(*parser)(void *, struct expr *, char *); char *restrictions; short overloadable; short sequenceuseok; short environmentAware; short bsaveIndex; struct FunctionDefinition *next; struct userData { unsigned char dataID; struct userData *next; } *usrData; } *

user_defined_types: struct defgeneric { struct constructHeader header; unsigned int busy; struct method *methods; unsigned int mcnt; }

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 method { unsigned int index; int restrictionCount; unsigned int system; unsigned int trace; struct restriction *restrictions; struct expr *actions; char *ppForm; struct userData *usrData; }

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

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; }


UserFunctions

decompiled_code:
void UserFunctions()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void UserFunctions()
  {
  }

canonical_original_code:
void UserFunctions()
  {
  }


EnvUserFunctions

decompiled_code:
void EnvUserFunctions()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

original_code:
void EnvUserFunctions(
  void *theEnv)
  {
  }

canonical_original_code:
void EnvUserFunctions(void *theEnv)
  {
  }

variable_types:
theEnv
void *


GetNextObjectPatternNode

decompiled_code:
__int64 __fastcall GetNextObjectPatternNode(_QWORD *a1)
{
__int64 result; // rax

result = a1[4];
if ( !result )
{
do
{
result = a1[7];
if ( result )
break;
a1 = (_QWORD *)a1[5];
}
while ( a1 );
}
return result;
}

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

result = a1[4];
if ( !result )
{
do
{
result = a1[7];
if ( result )
break;
a1 = (_QWORD *)a1[5];
}
while ( a1 );
}
return result;
}

original_code:
static OBJECT_PATTERN_NODE *GetNextObjectPatternNode(
  OBJECT_PATTERN_NODE *thePattern)
  {
   if (thePattern->nextLevel != ((void *)0))
     return(thePattern->nextLevel);
   while (thePattern->rightNode == ((void *)0))
     {
      thePattern = thePattern->lastLevel;
      if (thePattern == ((void *)0))
        return(((void *)0));
     }
   return(thePattern->rightNode);
  }

canonical_original_code:
static struct objectPatternNode *GetNextObjectPatternNode(struct objectPatternNode *thePattern)
  {
   if (thePattern->nextLevel != ((void *)0))
     return(thePattern->nextLevel);
   while (thePattern->rightNode == ((void *)0))
     {
      thePattern = thePattern->lastLevel;
      if (thePattern == ((void *)0))
        return(((void *)0));
     }
   return(thePattern->rightNode);
  }

variable_types:
thePattern
struct objectPatternNode *

return_type: struct objectPatternNode { unsigned int blocked; unsigned int multifieldNode; unsigned int endSlot; unsigned int whichField; unsigned int leaveFields; unsigned long matchTimeTag; unsigned int slotNameID; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *networkTest; struct objectPatternNode *nextLevel; struct objectPatternNode *lastLevel; struct objectPatternNode *leftNode; struct objectPatternNode *rightNode; struct objectAlphaNode { 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 { unsigned char dataID; struct userData *next; } *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 { 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 *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } 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; unsigned long matchTimeTag; 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; } *classbmp; struct objectPatternNode *patternNode; struct objectAlphaNode *nxtInGroup; long bsaveID; } *alphaNode; long bsaveID; } *

user_defined_types: struct objectPatternNode { unsigned int blocked; unsigned int multifieldNode; unsigned int endSlot; unsigned int whichField; unsigned int leaveFields; unsigned long matchTimeTag; unsigned int slotNameID; struct expr *networkTest; struct objectPatternNode *nextLevel; struct objectPatternNode *lastLevel; struct objectPatternNode *leftNode; struct objectPatternNode *rightNode; struct objectAlphaNode *alphaNode; long bsaveID; }

user_defined_types: struct objectAlphaNode { struct patternNodeHeader header; unsigned long matchTimeTag; struct bitMapHashNode *classbmp; struct objectPatternNode *patternNode; struct objectAlphaNode *nxtInGroup; long bsaveID; }

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 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 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; }

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 alphaMatch { struct patternEntity *matchingItem; struct multifieldMarker *markers; struct alphaMatch *next; }

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

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; }


BeforeObjectPatternsToCode

decompiled_code:
__int64 __fastcall BeforeObjectPatternsToCode(__int64 a1)
{
__int64 v2; // rax
_QWORD *v3; // rdi
__int64 v4; // rdx
__int64 result; // rax
__int64 v6; // rdx
__int64 v7; // rcx

v2 = ObjectNetworkPointer(a1);
if ( v2 )
{
v3 = (_QWORD *)v2;
v4 = 0LL;
do
{
v3[9] = v4;
v3 = (_QWORD *)GetNextObjectPatternNode(v3);
}
while ( v3 );
}
result = ObjectNetworkTerminalPointer(a1);
if ( result )
{
v6 = 0LL;
do
{
v7 = v6++;
*(_QWORD *)(result + 80) = v7;
result = *(_QWORD *)(result + 72);
}
while ( result );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
__int64 v2; // rax
_QWORD *v3; // rdi
__int64 v4; // rdx
__int64 result; // rax
__int64 v6; // rdx
__int64 v7; // rcx

v2 = ObjectNetworkPointer(a1);
if ( v2 )
{
v3 = (_QWORD *)v2;
v4 = 0LL;
do
{
v3[9] = v4;
v3 = (_QWORD *)func0(v3);
}
while ( v3 );
}
result = ObjectNetworkTerminalPointer(a1);
if ( result )
{
v6 = 0LL;
do
{
v7 = v6++;
*(_QWORD *)(result + 80) = v7;
result = *(_QWORD *)(result + 72);
}
while ( result );
}
return result;
}

original_code:
static void BeforeObjectPatternsToCode(
  void *theEnv)
  {
   long whichPattern;
   OBJECT_PATTERN_NODE *intermediateNode;
   OBJECT_ALPHA_NODE *alphaNode;
   whichPattern = 0L;
   intermediateNode = ObjectNetworkPointer(theEnv);
   while (intermediateNode != ((void *)0))
     {
      intermediateNode->bsaveID = whichPattern++;
      intermediateNode = GetNextObjectPatternNode(intermediateNode);
     }
   whichPattern = 0L;
   alphaNode = ObjectNetworkTerminalPointer(theEnv);
   while (alphaNode != ((void *)0))
     {
      alphaNode->bsaveID = whichPattern++;
      alphaNode = alphaNode->nxtTerminal;
     }
  }

canonical_original_code:
static void BeforeObjectPatternsToCode(void *theEnv)
  {
   long whichPattern;
   struct objectPatternNode *intermediateNode;
   struct objectAlphaNode *alphaNode;
   whichPattern = 0L;
   intermediateNode = ObjectNetworkPointer(theEnv);
   while (intermediateNode != ((void *)0))
     {
      intermediateNode->bsaveID = whichPattern++;
      intermediateNode = GetNextObjectPatternNode(intermediateNode);
     }
   whichPattern = 0L;
   alphaNode = ObjectNetworkTerminalPointer(theEnv);
   while (alphaNode != ((void *)0))
     {
      alphaNode->bsaveID = whichPattern++;
      alphaNode = alphaNode->nxtTerminal;
     }
  }

variable_types: whichPattern long

variable_types: struct objectPatternNode { unsigned int blocked; unsigned int multifieldNode; unsigned int endSlot; unsigned int whichField; unsigned int leaveFields; unsigned long matchTimeTag; unsigned int slotNameID; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *networkTest; struct objectPatternNode *nextLevel; struct objectPatternNode *lastLevel; struct objectPatternNode *leftNode; struct objectPatternNode *rightNode; struct objectAlphaNode { 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 { unsigned char dataID; struct userData *next; } *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 { 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 *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } 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; unsigned long matchTimeTag; 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; } *classbmp; struct objectPatternNode *patternNode; struct objectAlphaNode *nxtInGroup; long bsaveID; } *alphaNode; long bsaveID; } *

variable_types: struct objectAlphaNode { 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 { unsigned char dataID; struct userData *next; } *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 { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *networkTest; void *rightSideEntryStructure; struct joinNode *nextLevel; struct joinNode *lastLevel; struct joinNode *rightDriveNode; struct joinNode *rightMatchNode; struct defrule { 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 *usrData; struct defmodule *next; } *theModule; struct constructHeader *firstItem; struct constructHeader *lastItem; } *whichModule; long bsaveID; struct constructHeader *next; struct userData *usrData; } 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; unsigned long matchTimeTag; 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; } *classbmp; struct objectPatternNode { unsigned int blocked; unsigned int multifieldNode; unsigned int endSlot; unsigned int whichField; unsigned int leaveFields; unsigned long matchTimeTag; unsigned int slotNameID; struct expr *networkTest; struct objectPatternNode *nextLevel; struct objectPatternNode *lastLevel; struct objectPatternNode *leftNode; struct objectPatternNode *rightNode; struct objectAlphaNode *alphaNode; long bsaveID; } *patternNode; struct objectAlphaNode *nxtInGroup; long bsaveID; } *


ValidDeffunctionName

decompiled_code:
__int64 __fastcall ValidDeffunctionName(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // r13
__int64 v5; // r12
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // r12
__int64 v9; // rax

if ( FindConstruct() )
{
PrintErrorID(a1, "DFFNXPSR", 1LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunctions are not allowed to replace constructs.\n");
result = 0LL;
}
else if ( FindFunction(a1, a2) )
{
PrintErrorID(a1, "DFFNXPSR", 2LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunctions are not allowed to replace external functions.\n");
result = 0LL;
}
else
{
v3 = LookupDefgenericInScope(a1, a2);
v4 = v3;
if ( v3 )
{
v5 = *(_QWORD *)GetConstructModuleItem(v3);
if ( v5 == EnvGetCurrentModule(a1) )
{
PrintErrorID(a1, "DFFNXPSR", 3LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunctions are not allowed to replace generic functions.\n");
}
else
{
PrintErrorID(a1, "DFFNXPSR", 5LL, 0LL);
EnvPrintRouter(a1, "werror", "Defgeneric ");
v6 = GetConstructNameString(v4);
EnvPrintRouter(a1, "werror", v6);
EnvPrintRouter(a1, "werror", " imported from module ");
v7 = EnvGetDefmoduleName(a1, v5);
EnvPrintRouter(a1, "werror", v7);
EnvPrintRouter(a1, "werror", " conflicts with this deffunction.\n");
}
result = 0LL;
}
else
{
v8 = EnvFindDeffunction(a1, a2);
result = 1LL;
if ( v8 && *(_DWORD *)(v8 + 52) )
{
PrintErrorID(a1, "DFNXPSR", 4LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunction ");
v9 = GetConstructNameString(v8);
EnvPrintRouter(a1, "werror", v9);
EnvPrintRouter(a1, "werror", " may not be redefined while it is executing.\n");
result = 0LL;
}
}
}
return result;
}

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

if ( FindConstruct() )
{
PrintErrorID(a1, "DFFNXPSR", 1LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunctions are not allowed to replace constructs.\n");
result = 0LL;
}
else if ( FindFunction(a1, a2) )
{
PrintErrorID(a1, "DFFNXPSR", 2LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunctions are not allowed to replace external functions.\n");
result = 0LL;
}
else
{
v3 = LookupDefgenericInScope(a1, a2);
v4 = v3;
if ( v3 )
{
v5 = *(_QWORD *)GetConstructModuleItem(v3);
if ( v5 == EnvGetCurrentModule(a1) )
{
PrintErrorID(a1, "DFFNXPSR", 3LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunctions are not allowed to replace generic functions.\n");
}
else
{
PrintErrorID(a1, "DFFNXPSR", 5LL, 0LL);
EnvPrintRouter(a1, "werror", "Defgeneric ");
v6 = GetConstructNameString(v4);
EnvPrintRouter(a1, "werror", v6);
EnvPrintRouter(a1, "werror", " imported from module ");
v7 = EnvGetDefmoduleName(a1, v5);
EnvPrintRouter(a1, "werror", v7);
EnvPrintRouter(a1, "werror", " conflicts with this deffunction.\n");
}
result = 0LL;
}
else
{
v8 = EnvFindDeffunction(a1, a2);
result = 1LL;
if ( v8 && *(_DWORD *)(v8 + 52) )
{
PrintErrorID(a1, "DFNXPSR", 4LL, 0LL);
EnvPrintRouter(a1, "werror", "Deffunction ");
v9 = GetConstructNameString(v8);
EnvPrintRouter(a1, "werror", v9);
EnvPrintRouter(a1, "werror", " may not be redefined while it is executing.\n");
result = 0LL;
}
}
}
return result;
}

original_code:
static int ValidDeffunctionName(
  void *theEnv,
  char *theDeffunctionName)
  {
   struct constructHeader *theDeffunction;
   struct defmodule *theModule;
   struct constructHeader *theDefgeneric;
   if (FindConstruct(theEnv,theDeffunctionName) != ((void *)0))
     {
      PrintErrorID(theEnv,"DFFNXPSR",1,0);
      EnvPrintRouter(theEnv,"werror","Deffunctions are not allowed to replace constructs.\n");
      return(0);
     }
   if (FindFunction(theEnv,theDeffunctionName) != ((void *)0))
     {
      PrintErrorID(theEnv,"DFFNXPSR",2,0);
      EnvPrintRouter(theEnv,"werror","Deffunctions are not allowed to replace external functions.\n");
      return(0);
     }
   theDefgeneric =
     (struct constructHeader *) LookupDefgenericInScope(theEnv,theDeffunctionName);
   if (theDefgeneric != ((void *)0))
     {
      theModule = GetConstructModuleItem(theDefgeneric)->theModule;
      if (theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv)))
        {
         PrintErrorID(theEnv,"DFFNXPSR",5,0);
         EnvPrintRouter(theEnv,"werror","Defgeneric ");
         EnvPrintRouter(theEnv,"werror",GetConstructNameString((struct constructHeader *) (void *) theDefgeneric));
         EnvPrintRouter(theEnv,"werror"," imported from module ");
         EnvPrintRouter(theEnv,"werror",EnvGetDefmoduleName(theEnv,(void *) theModule));
         EnvPrintRouter(theEnv,"werror"," conflicts with this deffunction.\n");
         return(0);
        }
      else
        {
         PrintErrorID(theEnv,"DFFNXPSR",3,0);
         EnvPrintRouter(theEnv,"werror","Deffunctions are not allowed to replace generic functions.\n");
        }
      return(0);
     }
   theDeffunction = (struct constructHeader *) EnvFindDeffunction(theEnv,theDeffunctionName);
   if (theDeffunction != ((void *)0))
     {
      if (((DEFFUNCTION *) theDeffunction)->executing)
        {
         PrintErrorID(theEnv,"DFNXPSR",4,0);
         EnvPrintRouter(theEnv,"werror","Deffunction ");
         EnvPrintRouter(theEnv,"werror",GetConstructNameString((struct constructHeader *) (void *) theDeffunction));
         EnvPrintRouter(theEnv,"werror"," may not be redefined while it is executing.\n");
         return(0);
        }
     }
   return(1);
  }

canonical_original_code:
static int ValidDeffunctionName(void *theEnv, char *theDeffunctionName)
  {
   struct constructHeader *theDeffunction;
   struct defmodule *theModule;
   struct constructHeader *theDefgeneric;
   if (FindConstruct(theEnv,theDeffunctionName) != ((void *)0))
     {
      PrintErrorID(theEnv,"DFFNXPSR",1,0);
      EnvPrintRouter(theEnv,"werror","Deffunctions are not allowed to replace constructs.\n");
      return(0);
     }
   if (FindFunction(theEnv,theDeffunctionName) != ((void *)0))
     {
      PrintErrorID(theEnv,"DFFNXPSR",2,0);
      EnvPrintRouter(theEnv,"werror","Deffunctions are not allowed to replace external functions.\n");
      return(0);
     }
   theDefgeneric =
     (struct constructHeader *) LookupDefgenericInScope(theEnv,theDeffunctionName);
   if (theDefgeneric != ((void *)0))
     {
      theModule = GetConstructModuleItem(theDefgeneric)->theModule;
      if (theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv)))
        {
         PrintErrorID(theEnv,"DFFNXPSR",5,0);
         EnvPrintRouter(theEnv,"werror","Defgeneric ");
         EnvPrintRouter(theEnv,"werror",GetConstructNameString((struct constructHeader *) (void *) theDefgeneric));
         EnvPrintRouter(theEnv,"werror"," imported from module ");
         EnvPrintRouter(theEnv,"werror",EnvGetDefmoduleName(theEnv,(void *) theModule));
         EnvPrintRouter(theEnv,"werror"," conflicts with this deffunction.\n");
         return(0);
        }
      else
        {
         PrintErrorID(theEnv,"DFFNXPSR",3,0);
         EnvPrintRouter(theEnv,"werror","Deffunctions are not allowed to replace generic functions.\n");
        }
      return(0);
     }
   theDeffunction = (struct constructHeader *) EnvFindDeffunction(theEnv,theDeffunctionName);
   if (theDeffunction != ((void *)0))
     {
      if (((struct deffunctionStruct *) theDeffunction)->executing)
        {
         PrintErrorID(theEnv,"DFNXPSR",4,0);
         EnvPrintRouter(theEnv,"werror","Deffunction ");
         EnvPrintRouter(theEnv,"werror",GetConstructNameString((struct constructHeader *) (void *) theDeffunction));
         EnvPrintRouter(theEnv,"werror"," may not be redefined while it is executing.\n");
         return(0);
        }
     }
   return(1);
  }

variable_types:
theDeffunctionName
char *

variable_types: struct defmodule { 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 *theModule; struct constructHeader { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader *whichModule; long bsaveID; struct constructHeader *next; struct userData { unsigned char dataID; struct userData *next; } *usrData; } *firstItem; struct constructHeader *lastItem; } **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 *usrData; struct defmodule *next; } *

return_type: int

user_defined_types: struct deffunctionStruct { struct constructHeader header; unsigned int busy; unsigned short trace; struct expr *code; int minNumberOfParameters; }

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


UnmarkConstructHeader

decompiled_code:
__int64 __fastcall UnmarkConstructHeader(__int64 a1, _QWORD *a2)
{
return DecrementSymbolCount(a1, *a2);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, _QWORD *a2)
{
return DecrementSymbolCount(a1, *a2);
}

original_code:
void UnmarkConstructHeader(
  void *theEnv,
  struct constructHeader *theConstruct)
  {
   DecrementSymbolCount(theEnv,theConstruct->name);
  }

canonical_original_code:
void UnmarkConstructHeader(void *theEnv, struct constructHeader *theConstruct)
  {
   DecrementSymbolCount(theEnv,theConstruct->name);
  }

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 portItem { struct symbolHashNode *moduleName; struct symbolHashNode *constructType; struct symbolHashNode *constructName; struct portItem *next; }

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


getcRouter

decompiled_code:
__int64 getcRouter()
{
return 97LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 97LL;
}

original_code:
int getcRouter(char *name)
{
  return 'a';
}

variable_types:
name
char *


ungetcRouter

decompiled_code:
__int64 __fastcall ungetcRouter(unsigned int a1)
{
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1)
{
return a1;
}

original_code:
int ungetcRouter(int ch, char *name)
{
  return ch;
}

variable_types: ch int


exitRouter

decompiled_code:
__int64 __fastcall exitRouter(unsigned int a1)
{
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int a1)
{
return a1;
}

original_code:
int exitRouter(int code)
{
  return code;
}


queryRouter

decompiled_code:
_BOOL8 __fastcall queryRouter(const char *a1)
{
_BOOL4 v1; // er8

v1 = 1;
if ( strcmp(a1, "stdout")
&& strcmp(a1, "wprompt")
&& strcmp(a1, "wdialog")
&& strcmp(a1, "wdisplay")
&& strcmp(a1, "werror")
&& strcmp(a1, "wwarning")
&& strcmp(a1, "wtrace") )
{
v1 = strcmp(a1, "wclips") == 0;
}
return v1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(const char *a1)
{
_BOOL4 v1; // er8

v1 = 1;
if ( strcmp(a1, "stdout")
&& strcmp(a1, "wprompt")
&& strcmp(a1, "wdialog")
&& strcmp(a1, "wdisplay")
&& strcmp(a1, "werror")
&& strcmp(a1, "wwarning")
&& strcmp(a1, "wtrace") )
{
v1 = strcmp(a1, "wclips") == 0;
}
return v1;
}

original_code:
int queryRouter(char *name)
{
  if(strcmp(name, "stdout") == 0) return 1;
  if(strcmp(name, "wprompt") == 0) return 1;
  if(strcmp(name, "wdialog") == 0) return 1;
  if(strcmp(name, "wdisplay") == 0) return 1;
  if(strcmp(name, "werror") == 0) return 1;
  if(strcmp(name, "wwarning") == 0) return 1;
  if(strcmp(name, "wtrace") == 0) return 1;
  if(strcmp(name, "wclips") == 0) return 1;
  return 0;
}


printRouter

decompiled_code:
__int64 __fastcall printRouter(const char *a1, const char *a2)
{
printf("%s: '%s'\n", a1, a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(const char *a1, const char *a2)
{
printf("%s: '%s'\n", a1, a2);
return 1LL;
}

original_code:
int printRouter(char *name, char*str)
{
  printf("%s: '%s'\n", name, str);
  return 1;
}

canonical_original_code:
int printRouter(char *name, char *str)
{
  printf("%s: '%s'\n", name, str);
  return 1;
}

variable_types:
str
char *


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbp
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax

v3 = CreateEnvironment(argc, argv, envp);
AddRouter("stdout", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wprompt", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wdialog", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wdisplay", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("werror", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wwarning", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wtrace", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wclips", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("command", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
FlushCommandString(v3);
AppendCommandString(v3, "(assert (ahoj ahoj ahoj))\n");
v4 = ExecuteIfCommandComplete_jarcec(v3);
printf("exec: %d\n", v4);
AppendCommandString(v3, "(assert (ahoj ahoj ahoj nazdar\n");
v5 = ExecuteIfCommandComplete_jarcec(v3);
printf("exec: %d\n", v5);
AppendCommandString(v3, "(fdacts)\n");
v6 = ExecuteIfCommandComplete_jarcec(v3);
printf("exec: %d\n", v6);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbp
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax

v3 = CreateEnvironment(argc, argv, envp);
AddRouter("stdout", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wprompt", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wdialog", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wdisplay", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("werror", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wwarning", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wtrace", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("wclips", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
AddRouter("command", 20LL, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
FlushCommandString(v3);
AppendCommandString(v3, "(assert (ahoj ahoj ahoj))\n");
v4 = func5(v3);
printf("exec: %d\n", v4);
AppendCommandString(v3, "(assert (ahoj ahoj ahoj nazdar\n");
v5 = func5(v3);
printf("exec: %d\n", v5);
AppendCommandString(v3, "(fdacts)\n");
v6 = func5(v3);
printf("exec: %d\n", v6);
return 0;
}

original_code:
int main(int argc, char **argv)
{
  void *env = CreateEnvironment();
  int ret;
  AddRouter("stdout", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("wprompt", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("wdialog", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("wdisplay", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("werror", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("wwarning", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("wtrace", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("wclips", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  AddRouter("command", 20, queryRouter, printRouter, getcRouter, ungetcRouter, exitRouter);
  FlushCommandString(env);
  AppendCommandString(env, "(assert (ahoj ahoj ahoj))\n");
  ret = ExecuteIfCommandComplete_jarcec(env);
  printf("exec: %d\n", ret);
  AppendCommandString(env, "(assert (ahoj ahoj ahoj nazdar\n");
  ret = ExecuteIfCommandComplete_jarcec(env);
  printf("exec: %d\n", ret);
  AppendCommandString(env, "(fdacts)\n");
  ret = ExecuteIfCommandComplete_jarcec(env);
  printf("exec: %d\n", ret);
}

variable_types: argc int

variable_types:
argv
char **

variable_types:
env
void *

variable_types: ret int