FloatToString

decompiled_code:
__int64 __fastcall FloatToString(__int64 a1, double a2)
{
char *v2; // rdx
char v3; // al
__int64 result; // rax
char v5[72]; // [rsp+0h] [rbp-48h] BYREF

sprintf(v5, "%.15g", a2);
v3 = v5[0];
if ( v5[0] )
{
v2 = &v5[1];
while ( v3 != 46 && v3 != 101 )
{
v3 = *v2++;
if ( !v3 )
goto LABEL_6;
}
result = *(_QWORD *)(EnvAddSymbol(a1, v5, v2) + 24);
}
else
{
LABEL_6:
strcat(v5, ".0");
result = *(_QWORD *)(EnvAddSymbol(a1, v5, v2) + 24);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, double a2)
{
char *v2; // rdx
char v3; // al
__int64 result; // rax
char v5[72]; // [rsp+0h] [rbp-48h] BYREF

sprintf(v5, "%.15g", a2);
v3 = v5[0];
if ( v5[0] )
{
v2 = &v5[1];
while ( v3 != 46 && v3 != 101 )
{
v3 = *v2++;
if ( !v3 )
goto LABEL_6;
}
result = *(_QWORD *)(EnvAddSymbol(a1, v5, v2) + 24);
}
else
{
LABEL_6:
strcat(v5, ".0");
result = *(_QWORD *)(EnvAddSymbol(a1, v5, v2) + 24);
}
return result;
}

original_code:
char *FloatToString(
  void *theEnv,
  double number)
  {
   char floatString[40];
   int i;
   char x;
   void *thePtr;
   sprintf(floatString,"%.15g",number);
   for (i = 0; (x = floatString[i]) != '\0'; i++)
     {
      if ((x == '.') || (x == 'e'))
        {
         thePtr = EnvAddSymbol(theEnv,floatString);
         return((((struct symbolHashNode *) (thePtr))->contents));
        }
     }
   strcat(floatString,".0");
   thePtr = EnvAddSymbol(theEnv,floatString);
   return((((struct symbolHashNode *) (thePtr))->contents));
  }

canonical_original_code:
char *FloatToString(void *theEnv, double number)
  {
   char floatString[40];
   int i;
   char x;
   void *thePtr;
   sprintf(floatString,"%.15g",number);
   for (i = 0; (x = floatString[i]) != '\0'; i++)
     {
      if ((x == '.') || (x == 'e'))
        {
         thePtr = EnvAddSymbol(theEnv,floatString);
         return((((struct symbolHashNode *) (thePtr))->contents));
        }
     }
   strcat(floatString,".0");
   thePtr = EnvAddSymbol(theEnv,floatString);
   return((((struct symbolHashNode *) (thePtr))->contents));
  }

variable_types: number double

variable_types:
floatString
char [40]

variable_types: i int

variable_types: x char

variable_types:
thePtr
void *

return_type: char *


PrintFloat

repo: jarcec/rbclips

decompiled_code:
__int64 __fastcall PrintFloat(__int64 a1, __int64 a2, double a3)
{
__int64 v3; // rax

v3 = FloatToString(a1, a3);
return EnvPrintRouter(a1, a2, v3);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, __int64 a2, double a3)
{
__int64 v3; // rax

v3 = func14(a1, a3);
return EnvPrintRouter(a1, a2, v3);
}

original_code:
void PrintFloat(
  void *theEnv,
  char *fileid,
  double number)
  {
   char *theString;
   theString = FloatToString(theEnv,number);
   EnvPrintRouter(theEnv,fileid,theString);
  }

canonical_original_code:
void PrintFloat(void *theEnv, char *fileid, double number)
  {
   char *theString;
   theString = FloatToString(theEnv,number);
   EnvPrintRouter(theEnv,fileid,theString);
  }

variable_types:
theEnv
void *

variable_types:
fileid
char *

variable_types:
theString
char *

return_type: void


PrintAtom

decompiled_code:
void __fastcall PrintAtom(__int64 a1, __int64 a2, int a3, double *a4)
{
__int64 v5; // rax
__int64 v6; // rax
void (__fastcall *v7)(__int64, __int64, double *); // rax
char v8[72]; // [rsp+0h] [rbp-48h] BYREF

if ( a3 > 8 )
{
if ( a3 == 175 )
return;
goto LABEL_17;
}
if ( a3 < 0 )
{
LABEL_17:
v6 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 352LL) + 8LL * a3 + 24);
if ( v6 )
{
v7 = *(void (__fastcall **)(__int64, __int64, double *))(v6 + 24);
if ( v7 )
v7(a1, a2, a4);
else
EnvPrintRouter(a1, a2, "<unknown atom type>");
}
return;
}
switch ( a3 )
{
case 0:
PrintFloat(a1, a2, a4[3]);
break;
case 1:
PrintLongInteger(a1, a2, *((_QWORD *)a4 + 3));
break;
case 2:
EnvPrintRouter(a1, a2, *((_QWORD *)a4 + 3));
break;
case 3:
if ( **(_DWORD **)(*(_QWORD *)(a1 + 32) + 424LL) )
{
v5 = StringPrintForm(a1, *((_QWORD *)a4 + 3));
EnvPrintRouter(a1, a2, v5);
}
else
{
EnvPrintRouter(a1, a2, "\"");
EnvPrintRouter(a1, a2, *((_QWORD *)a4 + 3));
EnvPrintRouter(a1, a2, "\"");
}
break;
case 5:
if ( *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 424LL) + 4LL) )
EnvPrintRouter(a1, a2, "\"");
EnvPrintRouter(a1, a2, "<Pointer-");
sprintf(v8, "%p", a4);
EnvPrintRouter(a1, a2, v8);
EnvPrintRouter(a1, a2, ">");
if ( *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 424LL) + 4LL) )
EnvPrintRouter(a1, a2, "\"");
break;
case 8:
EnvPrintRouter(a1, a2, "[");
EnvPrintRouter(a1, a2, *((_QWORD *)a4 + 3));
EnvPrintRouter(a1, a2, "]");
break;
default:
goto LABEL_17;
}
}

canonical_decompiled_code:
void __fastcall func16(__int64 a1, __int64 a2, int a3, double *a4)
{
__int64 v5; // rax
__int64 v6; // rax
void (__fastcall *v7)(__int64, __int64, double *); // rax
char v8[72]; // [rsp+0h] [rbp-48h] BYREF

if ( a3 > 8 )
{
if ( a3 == 175 )
return;
goto LABEL_17;
}
if ( a3 < 0 )
{
LABEL_17:
v6 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 352LL) + 8LL * a3 + 24);
if ( v6 )
{
v7 = *(void (__fastcall **)(__int64, __int64, double *))(v6 + 24);
if ( v7 )
v7(a1, a2, a4);
else
EnvPrintRouter(a1, a2, "<unknown atom type>");
}
return;
}
switch ( a3 )
{
case 0:
func15(a1, a2, a4[3]);
break;
case 1:
func2(a1, a2, *((_QWORD *)a4 + 3));
break;
case 2:
EnvPrintRouter(a1, a2, *((_QWORD *)a4 + 3));
break;
case 3:
if ( **(_DWORD **)(*(_QWORD *)(a1 + 32) + 424LL) )
{
v5 = StringPrintForm(a1, *((_QWORD *)a4 + 3));
EnvPrintRouter(a1, a2, v5);
}
else
{
EnvPrintRouter(a1, a2, "\"");
EnvPrintRouter(a1, a2, *((_QWORD *)a4 + 3));
EnvPrintRouter(a1, a2, "\"");
}
break;
case 5:
if ( *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 424LL) + 4LL) )
EnvPrintRouter(a1, a2, "\"");
EnvPrintRouter(a1, a2, "<Pointer-");
sprintf(v8, "%p", a4);
EnvPrintRouter(a1, a2, v8);
EnvPrintRouter(a1, a2, ">");
if ( *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 424LL) + 4LL) )
EnvPrintRouter(a1, a2, "\"");
break;
case 8:
EnvPrintRouter(a1, a2, "[");
EnvPrintRouter(a1, a2, *((_QWORD *)a4 + 3));
EnvPrintRouter(a1, a2, "]");
break;
default:
goto LABEL_17;
}
}

original_code:
void PrintAtom(
  void *theEnv,
  char *logicalName,
  int type,
  void *value)
  {
   char buffer[20];
   switch (type)
     {
      case 0:
        PrintFloat(theEnv,logicalName,(((struct floatHashNode *) (value))->contents));
        break;
      case 1:
        PrintLongInteger(theEnv,logicalName,(((struct integerHashNode *) (value))->contents));
        break;
      case 2:
        EnvPrintRouter(theEnv,logicalName,(((struct symbolHashNode *) (value))->contents));
        break;
      case 3:
        if (((struct printUtilityData *) (((struct environmentData *) theEnv)->theData[53]))->PreserveEscapedCharacters)
          { EnvPrintRouter(theEnv,logicalName,StringPrintForm(theEnv,(((struct symbolHashNode *) (value))->contents))); }
        else
          {
           EnvPrintRouter(theEnv,logicalName,"\"");
           EnvPrintRouter(theEnv,logicalName,(((struct symbolHashNode *) (value))->contents));
           EnvPrintRouter(theEnv,logicalName,"\"");
          }
        break;
      case 5:
        if (((struct printUtilityData *) (((struct environmentData *) theEnv)->theData[53]))->AddressesToStrings) EnvPrintRouter(theEnv,logicalName,"\"");
        EnvPrintRouter(theEnv,logicalName,"<Pointer-");
        sprintf(buffer,"%p",value);
        EnvPrintRouter(theEnv,logicalName,buffer);
        EnvPrintRouter(theEnv,logicalName,">");
        if (((struct printUtilityData *) (((struct environmentData *) theEnv)->theData[53]))->AddressesToStrings) EnvPrintRouter(theEnv,logicalName,"\"");
        break;
      case 8:
        EnvPrintRouter(theEnv,logicalName,"[");
        EnvPrintRouter(theEnv,logicalName,(((struct symbolHashNode *) (value))->contents));
        EnvPrintRouter(theEnv,logicalName,"]");
        break;
      case 175:
        break;
      default:
        if (((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->PrimitivesArray[type] == ((void *)0)) break;
        if (((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->PrimitivesArray[type]->longPrintFunction == ((void *)0))
          {
           EnvPrintRouter(theEnv,logicalName,"<unknown atom type>");
           break;
          }
        (*((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->PrimitivesArray[type]->longPrintFunction)(theEnv,logicalName,value);
        break;
     }
  }

canonical_original_code:
void PrintAtom(void *theEnv, char *logicalName, int type, void *value)
  {
   char buffer[20];
   switch (type)
     {
      case 0:
        PrintFloat(theEnv,logicalName,(((struct floatHashNode *) (value))->contents));
        break;
      case 1:
        PrintLongInteger(theEnv,logicalName,(((struct integerHashNode *) (value))->contents));
        break;
      case 2:
        EnvPrintRouter(theEnv,logicalName,(((struct symbolHashNode *) (value))->contents));
        break;
      case 3:
        if (((struct printUtilityData *) (((struct environmentData *) theEnv)->theData[53]))->PreserveEscapedCharacters)
          { EnvPrintRouter(theEnv,logicalName,StringPrintForm(theEnv,(((struct symbolHashNode *) (value))->contents))); }
        else
          {
           EnvPrintRouter(theEnv,logicalName,"\"");
           EnvPrintRouter(theEnv,logicalName,(((struct symbolHashNode *) (value))->contents));
           EnvPrintRouter(theEnv,logicalName,"\"");
          }
        break;
      case 5:
        if (((struct printUtilityData *) (((struct environmentData *) theEnv)->theData[53]))->AddressesToStrings) EnvPrintRouter(theEnv,logicalName,"\"");
        EnvPrintRouter(theEnv,logicalName,"<Pointer-");
        sprintf(buffer,"%p",value);
        EnvPrintRouter(theEnv,logicalName,buffer);
        EnvPrintRouter(theEnv,logicalName,">");
        if (((struct printUtilityData *) (((struct environmentData *) theEnv)->theData[53]))->AddressesToStrings) EnvPrintRouter(theEnv,logicalName,"\"");
        break;
      case 8:
        EnvPrintRouter(theEnv,logicalName,"[");
        EnvPrintRouter(theEnv,logicalName,(((struct symbolHashNode *) (value))->contents));
        EnvPrintRouter(theEnv,logicalName,"]");
        break;
      case 175:
        break;
      default:
        if (((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->PrimitivesArray[type] == ((void *)0)) break;
        if (((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->PrimitivesArray[type]->longPrintFunction == ((void *)0))
          {
           EnvPrintRouter(theEnv,logicalName,"<unknown atom type>");
           break;
          }
        (*((struct evaluationData *) (((struct environmentData *) theEnv)->theData[44]))->PrimitivesArray[type]->longPrintFunction)(theEnv,logicalName,value);
        break;
     }
  }

variable_types:
logicalName
char *

variable_types: type int

variable_types:
value
void *

variable_types:
buffer
char [20]

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

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

user_defined_types: struct 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 printUtilityData { int PreserveEscapedCharacters; int AddressesToStrings; int InstanceAddressesToNames; }

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

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

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

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


LongIntegerToString

decompiled_code:
__int64 __fastcall LongIntegerToString(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
_BYTE savedregs[56]; // [rsp+0h] [rbp+0h] BYREF

sprintf(savedregs, "%ld", a2);
return *(_QWORD *)(EnvAddSymbol(a1, savedregs, v2) + 24);
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
_BYTE savedregs[56]; // [rsp+0h] [rbp+0h] BYREF

sprintf(savedregs, "%ld", a2);
return *(_QWORD *)(EnvAddSymbol(a1, savedregs, v2) + 24);
}

original_code:
char *LongIntegerToString(
  void *theEnv,
  long number)
  {
   char buffer[30];
   void *thePtr;
   sprintf(buffer,"%ld",number);
   thePtr = EnvAddSymbol(theEnv,buffer);
   return((((struct symbolHashNode *) (thePtr))->contents));
  }

canonical_original_code:
char *LongIntegerToString(void *theEnv, long number)
  {
   char buffer[30];
   void *thePtr;
   sprintf(buffer,"%ld",number);
   thePtr = EnvAddSymbol(theEnv,buffer);
   return((((struct symbolHashNode *) (thePtr))->contents));
  }

variable_types: number long

variable_types:
buffer
char [30]


SalienceInformationError

decompiled_code:
__int64 __fastcall SalienceInformationError(__int64 a1, __int64 a2, __int64 a3)
{
PrintErrorID(a1, (__int64)"PRNTUTIL", 8, 1);
EnvPrintRouter(a1, "werror", "This error occurred while evaluating the salience");
if ( a3 )
{
EnvPrintRouter(a1, "werror", " for ");
EnvPrintRouter(a1, "werror", a2);
EnvPrintRouter(a1, "werror", " ");
EnvPrintRouter(a1, "werror", a3);
}
return EnvPrintRouter(a1, "werror", ".\n");
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 a1, __int64 a2, __int64 a3)
{
func4(a1, (__int64)"PRNTUTIL", 8, 1);
EnvPrintRouter(a1, "werror", "This error occurred while evaluating the salience");
if ( a3 )
{
EnvPrintRouter(a1, "werror", " for ");
EnvPrintRouter(a1, "werror", a2);
EnvPrintRouter(a1, "werror", " ");
EnvPrintRouter(a1, "werror", a3);
}
return EnvPrintRouter(a1, "werror", ".\n");
}

original_code:
void SalienceInformationError(
  void *theEnv,
  char *constructType,
  char *constructName)
  {
   PrintErrorID(theEnv,"PRNTUTIL",8,1);
   EnvPrintRouter(theEnv,"werror","This error occurred while evaluating the salience");
   if (constructName != ((void *)0))
     {
      EnvPrintRouter(theEnv,"werror"," for ");
      EnvPrintRouter(theEnv,"werror",constructType);
      EnvPrintRouter(theEnv,"werror"," ");
      EnvPrintRouter(theEnv,"werror",constructName);
     }
   EnvPrintRouter(theEnv,"werror",".\n");
  }

canonical_original_code:
void SalienceInformationError(void *theEnv, char *constructType, char *constructName)
  {
   PrintErrorID(theEnv,"PRNTUTIL",8,1);
   EnvPrintRouter(theEnv,"werror","This error occurred while evaluating the salience");
   if (constructName != ((void *)0))
     {
      EnvPrintRouter(theEnv,"werror"," for ");
      EnvPrintRouter(theEnv,"werror",constructType);
      EnvPrintRouter(theEnv,"werror"," ");
      EnvPrintRouter(theEnv,"werror",constructName);
     }
   EnvPrintRouter(theEnv,"werror",".\n");
  }

variable_types:
constructType
char *

variable_types:
constructName
char *


SalienceRangeError

decompiled_code:
__int64 __fastcall SalienceRangeError(__int64 a1, int a2, int a3)
{
PrintErrorID(a1, (__int64)"PRNTUTIL", 9, 1);
EnvPrintRouter(a1, "werror", "Salience value out of range ");
PrintLongInteger(a1, (__int64)"werror", a2);
EnvPrintRouter(a1, "werror", " to ");
PrintLongInteger(a1, (__int64)"werror", a3);
return EnvPrintRouter(a1, "werror", ".\n");
}

canonical_decompiled_code:
__int64 __fastcall func20(__int64 a1, int a2, int a3)
{
func4(a1, (__int64)"PRNTUTIL", 9, 1);
EnvPrintRouter(a1, "werror", "Salience value out of range ");
func2(a1, (__int64)"werror", a2);
EnvPrintRouter(a1, "werror", " to ");
func2(a1, (__int64)"werror", a3);
return EnvPrintRouter(a1, "werror", ".\n");
}

original_code:
void SalienceRangeError(
  void *theEnv,
  int min,
  int max)
  {
   PrintErrorID(theEnv,"PRNTUTIL",9,1);
   EnvPrintRouter(theEnv,"werror","Salience value out of range ");
   PrintLongInteger(theEnv,"werror",(long int) min);
   EnvPrintRouter(theEnv,"werror"," to ");
   PrintLongInteger(theEnv,"werror",(long int) max);
   EnvPrintRouter(theEnv,"werror",".\n");
  }

canonical_original_code:
void SalienceRangeError(void *theEnv, int min, int max)
  {
   PrintErrorID(theEnv,"PRNTUTIL",9,1);
   EnvPrintRouter(theEnv,"werror","Salience value out of range ");
   PrintLongInteger(theEnv,"werror",(long) min);
   EnvPrintRouter(theEnv,"werror"," to ");
   PrintLongInteger(theEnv,"werror",(long) max);
   EnvPrintRouter(theEnv,"werror",".\n");
  }

variable_types: min int

variable_types: max int


SalienceNonIntegerError

decompiled_code:
__int64 __fastcall SalienceNonIntegerError(__int64 a1)
{
PrintErrorID(a1, (__int64)"PRNTUTIL", 10, 1);
return EnvPrintRouter(a1, "werror", "Salience value must be an integer value.\n");
}

canonical_decompiled_code:
__int64 __fastcall func21(__int64 a1)
{
func4(a1, (__int64)"PRNTUTIL", 10, 1);
return EnvPrintRouter(a1, "werror", "Salience value must be an integer value.\n");
}

original_code:
void SalienceNonIntegerError(
  void *theEnv)
  {
   PrintErrorID(theEnv,"PRNTUTIL",10,1);
   EnvPrintRouter(theEnv,"werror","Salience value must be an integer value.\n");
  }

canonical_original_code:
void SalienceNonIntegerError(void *theEnv)
  {
   PrintErrorID(theEnv,"PRNTUTIL",10,1);
   EnvPrintRouter(theEnv,"werror","Salience value must be an integer value.\n");
  }


SlotExistError

decompiled_code:
__int64 __fastcall SlotExistError(__int64 a1, __int64 a2, __int64 a3)
{
PrintErrorID(a1, (__int64)"INSFUN", 3, 0);
EnvPrintRouter(a1, "werror", "No such slot ");
EnvPrintRouter(a1, "werror", a2);
EnvPrintRouter(a1, "werror", " in function ");
EnvPrintRouter(a1, "werror", a3);
EnvPrintRouter(a1, "werror", ".\n");
return SetEvaluationError(a1, 1LL);
}

canonical_decompiled_code:
__int64 __fastcall func22(__int64 a1, __int64 a2, __int64 a3)
{
func4(a1, (__int64)"INSFUN", 3, 0);
EnvPrintRouter(a1, "werror", "No such slot ");
EnvPrintRouter(a1, "werror", a2);
EnvPrintRouter(a1, "werror", " in function ");
EnvPrintRouter(a1, "werror", a3);
EnvPrintRouter(a1, "werror", ".\n");
return SetEvaluationError(a1, 1LL);
}

original_code:
void SlotExistError(
  void *theEnv,
  char *sname,
  char *func)
  {
   PrintErrorID(theEnv,"INSFUN",3,0);
   EnvPrintRouter(theEnv,"werror","No such slot ");
   EnvPrintRouter(theEnv,"werror",sname);
   EnvPrintRouter(theEnv,"werror"," in function ");
   EnvPrintRouter(theEnv,"werror",func);
   EnvPrintRouter(theEnv,"werror",".\n");
   SetEvaluationError(theEnv,1);
  }

canonical_original_code:
void SlotExistError(void *theEnv, char *sname, char *func)
  {
   PrintErrorID(theEnv,"INSFUN",3,0);
   EnvPrintRouter(theEnv,"werror","No such slot ");
   EnvPrintRouter(theEnv,"werror",sname);
   EnvPrintRouter(theEnv,"werror"," in function ");
   EnvPrintRouter(theEnv,"werror",func);
   EnvPrintRouter(theEnv,"werror",".\n");
   SetEvaluationError(theEnv,1);
  }

variable_types:
sname
char *

variable_types:
func
char *


ListToPacked

original_code:
static long ListToPacked(
  struct expr *original,
  struct expr *destination,
  long count)
  {
   long i;
   if (original == ((void *)0)) { return(count); }
   while (original != ((void *)0))
     {
      i = count;
      count++;
      destination[i].type = original->type;
      destination[i].value = original->value;
      if (original->argList == ((void *)0))
        { destination[i].argList = ((void *)0); }
      else
        {
         destination[i].argList =
           (struct expr *) &destination[(long) count];
         count = ListToPacked(original->argList,destination,count);
        }
      if (original->nextArg == ((void *)0))
        { destination[i].nextArg = ((void *)0); }
      else
        {
         destination[i].nextArg =
           (struct expr *) &destination[(long) count];
        }
      original = original->nextArg;
     }
   return(count);
  }

canonical_original_code:
static long ListToPacked(struct expr *original, struct expr *destination, long count)
  {
   long i;
   if (original == ((void *)0)) { return(count); }
   while (original != ((void *)0))
     {
      i = count;
      count++;
      destination[i].type = original->type;
      destination[i].value = original->value;
      if (original->argList == ((void *)0))
        { destination[i].argList = ((void *)0); }
      else
        {
         destination[i].argList =
           (struct expr *) &destination[(long) count];
         count = ListToPacked(original->argList,destination,count);
        }
      if (original->nextArg == ((void *)0))
        { destination[i].nextArg = ((void *)0); }
      else
        {
         destination[i].nextArg =
           (struct expr *) &destination[(long) count];
        }
      original = original->nextArg;
     }
   return(count);
  }

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

variable_types:
destination
struct expr *

variable_types: count long

variable_types: i long

return_type: long


HashExpression

decompiled_code:
unsigned __int64 __fastcall HashExpression(unsigned __int16 *a1, __int64 a2, __int64 a3)
{
unsigned __int16 *v3; // rbx
__int64 v4; // rdi
unsigned __int64 v5; // rcx

v3 = a1;
v4 = *((_QWORD *)a1 + 2);
v5 = 269LL;
if ( v4 )
v5 = 257 * (unsigned int)HashExpression(v4, a2, a3, 269LL) + 269LL;
do
{
v5 += *((_QWORD *)v3 + 1) + 263LL * *v3;
v3 = (unsigned __int16 *)*((_QWORD *)v3 + 3);
}
while ( v3 );
return v5 % 0x1F7;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func1(unsigned __int16 *a1, __int64 a2, __int64 a3)
{
unsigned __int16 *v3; // rbx
__int64 v4; // rdi
unsigned __int64 v5; // rcx

v3 = a1;
v4 = *((_QWORD *)a1 + 2);
v5 = 269LL;
if ( v4 )
v5 = 257 * (unsigned int)func1(v4, a2, a3, 269LL) + 269LL;
do
{
v5 += *((_QWORD *)v3 + 1) + 263LL * *v3;
v3 = (unsigned __int16 *)*((_QWORD *)v3 + 3);
}
while ( v3 );
return v5 % 0x1F7;
}

original_code:
static unsigned HashExpression(
  EXPRESSION *theExp)
  {
   unsigned long tally = 269;
   if (theExp->argList != ((void *)0))
     tally += HashExpression(theExp->argList) * 257;
   while (theExp != ((void *)0))
     {
      tally += (unsigned long) (theExp->type * 263);
      tally += (unsigned long) theExp->value;
      theExp = theExp->nextArg;
     }
   return((unsigned) (tally % 503));
  }

canonical_original_code:
static unsigned int HashExpression(struct expr *theExp)
  {
   unsigned long tally = 269;
   if (theExp->argList != ((void *)0))
     tally += HashExpression(theExp->argList) * 257;
   while (theExp != ((void *)0))
     {
      tally += (unsigned long) (theExp->type * 263);
      tally += (unsigned long) theExp->value;
      theExp = theExp->nextArg;
     }
   return((unsigned int) (tally % 503));
  }

variable_types:
tally
unsigned long

return_type: unsigned int


FindHashedExpression

decompiled_code:
__int64 __fastcall FindHashedExpression(__int64 a1, unsigned __int16 *a2, _DWORD *a3, _QWORD *a4)
{
__int64 i; // rbx

if ( !a2 )
return 0LL;
*a3 = HashExpression(a2, (__int64)a2, (__int64)a3);
*a4 = 0LL;
for ( i = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 360LL) + 40LL) + 8LL * (unsigned int)*a3);
i;
i = *(_QWORD *)(i + 16) )
{
if ( (unsigned int)IdenticalExpression(*(_QWORD *)(i + 8), a2) )
break;
*a4 = i;
}
return i;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, unsigned __int16 *a2, _DWORD *a3, _QWORD *a4)
{
__int64 i; // rbx

if ( !a2 )
return 0LL;
*a3 = func1(a2, (__int64)a2, (__int64)a3);
*a4 = 0LL;
for ( i = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 360LL) + 40LL) + 8LL * (unsigned int)*a3);
i;
i = *(_QWORD *)(i + 16) )
{
if ( (unsigned int)IdenticalExpression(*(_QWORD *)(i + 8), a2) )
break;
*a4 = i;
}
return i;
}

original_code:
static EXPRESSION_HN *FindHashedExpression(
  void *theEnv,
  EXPRESSION *theExp,
  unsigned *hashval,
  EXPRESSION_HN **prv)
  {
   EXPRESSION_HN *exphash;
   if (theExp == ((void *)0))
     return(((void *)0));
   *hashval = HashExpression(theExp);
   *prv = ((void *)0);
   exphash = ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[*hashval];
   while (exphash != ((void *)0))
     {
      if (IdenticalExpression(exphash->exp,theExp))
        return(exphash);
      *prv = exphash;
      exphash = exphash->next;
     }
   return(((void *)0));
  }

canonical_original_code:
static struct exprHashNode *FindHashedExpression(void *theEnv, struct expr *theExp, unsigned int *hashval, struct exprHashNode **prv)
  {
   struct exprHashNode *exphash;
   if (theExp == ((void *)0))
     return(((void *)0));
   *hashval = HashExpression(theExp);
   *prv = ((void *)0);
   exphash = ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[*hashval];
   while (exphash != ((void *)0))
     {
      if (IdenticalExpression(exphash->exp,theExp))
        return(exphash);
      *prv = exphash;
      exphash = exphash->next;
     }
   return(((void *)0));
  }

variable_types:
theEnv
void *

variable_types:
theExp
struct expr *

variable_types:
hashval
unsigned int *

variable_types:
prv
struct exprHashNode **

variable_types: struct exprHashNode { unsigned int hashval; unsigned int count; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *exp; struct exprHashNode *next; long bsaveID; } *

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

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 saved_contexts { int rtn; int brk; struct saved_contexts *nxt; }


PackExpression

decompiled_code:
__int64 __fastcall PackExpression(__int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rbp

if ( !a2 )
return 0LL;
v2 = ExpressionSize(a2);
v3 = gm3(a1, 32 * v2);
ListToPacked(a2, v3, 0LL);
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rbp

if ( !a2 )
return 0LL;
v2 = ExpressionSize(a2);
v3 = gm3(a1, 32 * v2);
func0(a2, v3, 0LL);
return v3;
}

original_code:
struct expr *PackExpression(
  void *theEnv,
  struct expr *original)
  {
   struct expr *packPtr;
   if (original == ((void *)0)) return (((void *)0));
   packPtr = (struct expr *)
             gm3(theEnv,(long) sizeof (struct expr) *
                 (long) ExpressionSize(original));
   ListToPacked(original,packPtr,0L);
   return(packPtr);
  }

canonical_original_code:
struct expr *PackExpression(void *theEnv, struct expr *original)
  {
   struct expr *packPtr;
   if (original == ((void *)0)) return (((void *)0));
   packPtr = (struct expr *)
             gm3(theEnv,(long) sizeof (struct expr) *
                 (long) ExpressionSize(original));
   ListToPacked(original,packPtr,0L);
   return(packPtr);
  }

variable_types:
original
struct expr *

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


ReturnPackedExpression

decompiled_code:
void __fastcall ReturnPackedExpression(__int64 a1, __int64 a2)
{
__int64 v2; // rax

if ( a2 )
{
v2 = ExpressionSize(a2);
rm3(a1, a2, 32 * v2);
}
}

canonical_decompiled_code:
void __fastcall func7(__int64 a1, __int64 a2)
{
__int64 v2; // rax

if ( a2 )
{
v2 = ExpressionSize(a2);
rm3(a1, a2, 32 * v2);
}
}

original_code:
void ReturnPackedExpression(
  void *theEnv,
  struct expr *packPtr)
  {
   if (packPtr != ((void *)0))
     {
      rm3(theEnv,(void *) packPtr,(long) sizeof (struct expr) *
                           ExpressionSize(packPtr));
     }
  }

canonical_original_code:
void ReturnPackedExpression(void *theEnv, struct expr *packPtr)
  {
   if (packPtr != ((void *)0))
     {
      rm3(theEnv,(void *) packPtr,(long) sizeof (struct expr) *
                           ExpressionSize(packPtr));
     }
  }


DeallocateExpressionData

original_code:
static void DeallocateExpressionData(
  void *theEnv)
  {
   int i;
   EXPRESSION_HN *tmpPtr, *nextPtr;
   if (! Bloaded(theEnv))
     {
      for (i = 0; i < 503; i++)
        {
         tmpPtr = ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[i];
         while (tmpPtr != ((void *)0))
           {
            nextPtr = tmpPtr->next;
            ReturnPackedExpression(theEnv,tmpPtr->exp);
            (((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = (struct memoryPtr *) tmpPtr, ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)], ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr);
            tmpPtr = nextPtr;
           }
        }
     }
   rm(theEnv,((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable,
      (int) (sizeof(EXPRESSION_HN *) * 503));
   if ((((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->NumberOfExpressions != 0) && Bloaded(theEnv))
     {
      genlongfree(theEnv,(void *) ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionArray,
                  ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->NumberOfExpressions * sizeof(struct expr));
     }
  }

canonical_original_code:
static void DeallocateExpressionData(void *theEnv)
  {
   int i;
   struct exprHashNode *tmpPtr; struct exprHashNode *nextPtr;
   if (! Bloaded(theEnv))
     {
      for (i = 0; i < 503; i++)
        {
         tmpPtr = ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[i];
         while (tmpPtr != ((void *)0))
           {
            nextPtr = tmpPtr->next;
            ReturnPackedExpression(theEnv,tmpPtr->exp);
            (((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = (struct memoryPtr *) tmpPtr, ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)], ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr);
            tmpPtr = nextPtr;
           }
        }
     }
   rm(theEnv,((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable,
      (int) (sizeof(struct exprHashNode *) * 503));
   if ((((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->NumberOfExpressions != 0) && Bloaded(theEnv))
     {
      genlongfree(theEnv,(void *) ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionArray,
                  ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->NumberOfExpressions * sizeof(struct expr));
     }
  }

variable_types: i int

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


RemoveHashedExpression

decompiled_code:
__int64 __fastcall RemoveHashedExpression(__int64 a1, unsigned __int16 *a2)
{
__int64 result; // rax
__int64 v3; // rbx
__int64 v4; // rax
__int64 v5; // rdx
unsigned int v6; // [rsp+4h] [rbp-24h] BYREF
__int64 v7[4]; // [rsp+8h] [rbp-20h] BYREF

result = FindHashedExpression(a1, a2, &v6, v7);
if ( result )
{
v3 = result;
result = (unsigned int)(*(_DWORD *)(result + 4) - 1);
*(_DWORD *)(v3 + 4) = result;
if ( !(_DWORD)result )
{
if ( v7[0] )
*(_QWORD *)(v7[0] + 16) = *(_QWORD *)(v3 + 16);
else
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 360LL) + 40LL) + 8LL * v6) = *(_QWORD *)(v3 + 16);
ExpressionDeinstall_localalias(a1, *(_QWORD **)(v3 + 8));
ReturnPackedExpression(a1, *(_QWORD *)(v3 + 8));
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 472LL) + 32LL) = v3;
**(_QWORD **)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 472LL) + 32LL) = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 472LL)
+ 40LL)
+ 256LL);
v4 = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 472LL);
v5 = *(_QWORD *)(v4 + 40);
result = *(_QWORD *)(v4 + 32);
*(_QWORD *)(v5 + 256) = result;
}
}
return result;
}

original_code:
void RemoveHashedExpression(
  void *theEnv,
  EXPRESSION *theExp)
  {
   EXPRESSION_HN *exphash,*prv;
   unsigned hashval;
   exphash = FindHashedExpression(theEnv,theExp,&hashval,&prv);
   if (exphash == ((void *)0))
     return;
   if (--exphash->count != 0)
     return;
   if (prv == ((void *)0))
     ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[hashval] = exphash->next;
   else
     prv->next = exphash->next;
   ExpressionDeinstall(theEnv,exphash->exp);
   ReturnPackedExpression(theEnv,exphash->exp);
   (((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = (struct memoryPtr *) exphash, ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)], ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr);
  }

canonical_original_code:
void RemoveHashedExpression(void *theEnv, struct expr *theExp)
  {
   struct exprHashNode *exphash; struct exprHashNode *prv;
   unsigned int hashval;
   exphash = FindHashedExpression(theEnv,theExp,&hashval,&prv);
   if (exphash == ((void *)0))
     return;
   if (--exphash->count != 0)
     return;
   if (prv == ((void *)0))
     ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[hashval] = exphash->next;
   else
     prv->next = exphash->next;
   ExpressionDeinstall(theEnv,exphash->exp);
   ReturnPackedExpression(theEnv,exphash->exp);
   (((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = (struct memoryPtr *) exphash, ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)], ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr);
  }

variable_types:
hashval
unsigned int


AddHashedExpression

original_code:
EXPRESSION *AddHashedExpression(
  void *theEnv,
  EXPRESSION *theExp)
  {
   EXPRESSION_HN *prv,*exphash;
   unsigned hashval;
   if (theExp == ((void *)0)) return(((void *)0));
   exphash = FindHashedExpression(theEnv,theExp,&hashval,&prv);
   if (exphash != ((void *)0))
     {
      exphash->count++;
      return(exphash->exp);
     }
   exphash = ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] == ((void *)0)) ? ((struct exprHashNode *) genalloc(theEnv,(unsigned) sizeof(struct exprHashNode))) : ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)]), ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next, ((struct exprHashNode *) ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr)));
   exphash->hashval = hashval;
   exphash->count = 1;
   exphash->exp = PackExpression(theEnv,theExp);
   ExpressionInstall(theEnv,exphash->exp);
   exphash->next = ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[exphash->hashval];
   ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[exphash->hashval] = exphash;
   exphash->bsaveID = 0L;
   return(exphash->exp);
  }

canonical_original_code:
struct expr *AddHashedExpression(void *theEnv, struct expr *theExp)
  {
   struct exprHashNode *prv; struct exprHashNode *exphash;
   unsigned int hashval;
   if (theExp == ((void *)0)) return(((void *)0));
   exphash = FindHashedExpression(theEnv,theExp,&hashval,&prv);
   if (exphash != ((void *)0))
     {
      exphash->count++;
      return(exphash->exp);
     }
   exphash = ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] == ((void *)0)) ? ((struct exprHashNode *) genalloc(theEnv,(unsigned int) sizeof(struct exprHashNode))) : ((((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)]), ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->MemoryTable[sizeof(struct exprHashNode)] = ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr->next, ((struct exprHashNode *) ((struct memoryData *) (((struct environmentData *) theEnv)->theData[59]))->TempMemoryPtr)));
   exphash->hashval = hashval;
   exphash->count = 1;
   exphash->exp = PackExpression(theEnv,theExp);
   ExpressionInstall(theEnv,exphash->exp);
   exphash->next = ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[exphash->hashval];
   ((struct expressionData *) (((struct environmentData *) theEnv)->theData[45]))->ExpressionHashTable[exphash->hashval] = exphash;
   exphash->bsaveID = 0L;
   return(exphash->exp);
  }


HashedExpressionIndex

decompiled_code:
__int64 __fastcall HashedExpressionIndex(__int64 a1, unsigned __int16 *a2)
{
__int64 v2; // rax
__int64 result; // rax
int v4; // [rsp+0h] [rbp-14h] BYREF
__int64 v5; // [rsp+4h] [rbp-10h] BYREF

if ( !a2 )
return -1LL;
v2 = FindHashedExpression(a1, a2, &v4, &v5);
if ( v2 )
result = *(_QWORD *)(v2 + 24);
else
result = -1LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1, unsigned __int16 *a2)
{
__int64 v2; // rax
__int64 result; // rax
int v4; // [rsp+0h] [rbp-14h] BYREF
__int64 v5; // [rsp+4h] [rbp-10h] BYREF

if ( !a2 )
return -1LL;
v2 = func2(a1, a2, &v4, &v5);
if ( v2 )
result = *(_QWORD *)(v2 + 24);
else
result = -1LL;
return result;
}

original_code:
long HashedExpressionIndex(
  void *theEnv,
  EXPRESSION *theExp)
  {
   EXPRESSION_HN *exphash,*prv;
   unsigned hashval;
   if (theExp == ((void *)0))
     return(-1L);
   exphash = FindHashedExpression(theEnv,theExp,&hashval,&prv);
   return((exphash != ((void *)0)) ? exphash->bsaveID : -1L);
  }

canonical_original_code:
long HashedExpressionIndex(void *theEnv, struct expr *theExp)
  {
   struct exprHashNode *exphash; struct exprHashNode *prv;
   unsigned int hashval;
   if (theExp == ((void *)0))
     return(-1L);
   exphash = FindHashedExpression(theEnv,theExp,&hashval,&prv);
   return((exphash != ((void *)0)) ? exphash->bsaveID : -1L);
  }


FindErrorCapture

decompiled_code:
_BOOL8 __fastcall FindErrorCapture(__int64 a1, const char *a2)
{
_BOOL4 v2; // ecx

v2 = 1;
if ( strcmp(a2, "werror") )
v2 = strcmp(a2, "wwarning") == 0;
return v2;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(__int64 a1, const char *a2)
{
_BOOL4 v2; // ecx

v2 = 1;
if ( strcmp(a2, "werror") )
v2 = strcmp(a2, "wwarning") == 0;
return v2;
}

original_code:
static int FindErrorCapture(
  void *theEnv,
  char *logicalName)
  {
   if ((strcmp(logicalName,"werror") == 0) ||
       (strcmp(logicalName,"wwarning") == 0))
     { return(1); }
   return(0);
  }

canonical_original_code:
static int FindErrorCapture(void *theEnv, char *logicalName)
  {
   if ((strcmp(logicalName,"werror") == 0) ||
       (strcmp(logicalName,"wwarning") == 0))
     { return(1); }
   return(0);
  }

variable_types:
logicalName
char *

return_type: int


PrintErrorCapture

decompiled_code:
__int64 __fastcall PrintErrorCapture(__int64 a1, const char *a2, __int64 a3)
{
_QWORD *v4; // rbx
__int64 v5; // rbx

if ( !strcmp(a2, "werror") )
{
v4 = *(_QWORD **)(*(_QWORD *)(a1 + 32) + 88LL);
*v4 = AppendToString(a1, a3, *v4, v4 + 1, (char *)v4 + 12);
}
else if ( !strcmp(a2, "wwarning") )
{
v5 = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 88LL);
*(_QWORD *)(v5 + 16) = AppendToString(a1, a3, *(_QWORD *)(v5 + 16), v5 + 24, v5 + 28);
}
return 1LL;
}

original_code:
static int PrintErrorCapture(
  void *theEnv,
  char *logicalName,
  char *str)
  {
   if (strcmp(logicalName,"werror") == 0)
     {
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString = AppendToString(theEnv,str,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString,
                                   &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorCurrentPosition,
                                   &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorMaximumPosition);
     }
   else if (strcmp(logicalName,"wwarning") == 0)
     {
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString = AppendToString(theEnv,str,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString,
                                     &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningCurrentPosition,
                                     &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningMaximumPosition);
     }
   return(1);
  }

canonical_original_code:
static int PrintErrorCapture(void *theEnv, char *logicalName, char *str)
  {
   if (strcmp(logicalName,"werror") == 0)
     {
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString = AppendToString(theEnv,str,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString,
                                   &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorCurrentPosition,
                                   &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorMaximumPosition);
     }
   else if (strcmp(logicalName,"wwarning") == 0)
     {
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString = AppendToString(theEnv,str,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString,
                                     &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningCurrentPosition,
                                     &((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningMaximumPosition);
     }
   return(1);
  }

variable_types:
str
char *

user_defined_types: struct parseFunctionData { char *ErrorString; int ErrorCurrentPosition; unsigned int ErrorMaximumPosition; char *WarningString; int WarningCurrentPosition; unsigned int WarningMaximumPosition; }


SetErrorCaptureValues

original_code:
static void SetErrorCaptureValues(
  void *theEnv,
  DATA_OBJECT_PTR returnValue)
  {
   struct multifield *theMultifield;
   theMultifield = (struct multifield *) EnvCreateMultifield(theEnv,2L);
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString != ((void *)0))
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].type = (unsigned short) (3));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].value = (void *) (EnvAddSymbol(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString)));
     }
   else
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].type = (unsigned short) (2));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
     }
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString != ((void *)0))
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].type = (unsigned short) (3));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].value = (void *) (EnvAddSymbol(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString)));
     }
   else
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].type = (unsigned short) (2));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
     }
   ((returnValue)->type = (unsigned short) (4));
   ((returnValue)->begin = (long) ((1) - 1));
   ((returnValue)->end = (long) ((2) - 1));
   ((returnValue)->value = (void *) ((void *) theMultifield));
  }

canonical_original_code:
static void SetErrorCaptureValues(void *theEnv, struct dataObject *returnValue)
  {
   struct multifield *theMultifield;
   theMultifield = (struct multifield *) EnvCreateMultifield(theEnv,2L);
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString != ((void *)0))
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].type = (unsigned short) (3));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].value = (void *) (EnvAddSymbol(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString)));
     }
   else
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].type = (unsigned short) (2));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[1 -1].value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
     }
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString != ((void *)0))
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].type = (unsigned short) (3));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].value = (void *) (EnvAddSymbol(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString)));
     }
   else
     {
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].type = (unsigned short) (2));
      (((struct field *) ((struct multifield *) (theMultifield))->theFields)[2 -1].value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
     }
   ((returnValue)->type = (unsigned short) (4));
   ((returnValue)->begin = (long) ((1) - 1));
   ((returnValue)->end = (long) ((2) - 1));
   ((returnValue)->value = (void *) ((void *) theMultifield));
  }

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

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

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

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

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

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

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

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


DeactivateErrorCapture

original_code:
static void DeactivateErrorCapture(
  void *theEnv)
  {
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString != ((void *)0))
     {
      rm(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorMaximumPosition);
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString = ((void *)0);
     }
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString != ((void *)0))
     {
      rm(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningMaximumPosition);
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString = ((void *)0);
     }
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorCurrentPosition = 0;
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorMaximumPosition = 0;
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningCurrentPosition = 0;
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningMaximumPosition = 0;
   EnvDeleteRouter(theEnv,"error-capture");
  }

canonical_original_code:
static void DeactivateErrorCapture(void *theEnv)
  {
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString != ((void *)0))
     {
      rm(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorMaximumPosition);
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorString = ((void *)0);
     }
   if (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString != ((void *)0))
     {
      rm(theEnv,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString,((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningMaximumPosition);
      ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString = ((void *)0);
     }
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorCurrentPosition = 0;
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->ErrorMaximumPosition = 0;
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningCurrentPosition = 0;
   ((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningMaximumPosition = 0;
   EnvDeleteRouter(theEnv,"error-capture");
  }

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


ParseFunctionDefinitions

decompiled_code:
__int64 __fastcall ParseFunctionDefinitions(__int64 a1)
{
AllocateEnvironmentData(a1, 11LL, 32LL, 0LL);
return EnvDefineFunction2(a1, "check-syntax", 117LL, CheckSyntaxFunction, "CheckSyntaxFunction", "11s");
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
AllocateEnvironmentData(a1, 11LL, 32LL, 0LL);
return EnvDefineFunction2(a1, "check-syntax", 117LL, CheckSyntaxFunction, "CheckSyntaxFunction", "11s");
}

original_code:
void ParseFunctionDefinitions(
  void *theEnv)
  {
   AllocateEnvironmentData(theEnv,11,sizeof(struct parseFunctionData),((void *)0));
   EnvDefineFunction2(theEnv,"check-syntax",'u',(int (*)(void *)) CheckSyntaxFunction,"CheckSyntaxFunction","11s");
  }

canonical_original_code:
void ParseFunctionDefinitions(void *theEnv)
  {
   AllocateEnvironmentData(theEnv,11,sizeof(struct parseFunctionData),((void *)0));
   EnvDefineFunction2(theEnv,"check-syntax",'u',(int (*)(void *)) CheckSyntaxFunction,"CheckSyntaxFunction","11s");
  }


CheckSyntax

decompiled_code:
__int64 __fastcall CheckSyntax(__int64 a1, __int64 a2, __int64 a3)
{
int v4; // edx
__int64 result; // rax
__int64 v6; // r12
__int16 v7; // r12
__int64 v8; // rax
__int64 v9; // r12
__int16 v10; // [rsp+0h] [rbp-38h] BYREF
__int64 v11; // [rsp+8h] [rbp-30h]

*(_WORD *)(a3 + 8) = 2;
*(_QWORD *)(a3 + 16) = **(_QWORD **)(*(_QWORD *)(a1 + 32) + 392LL);
v4 = OpenStringSource(a1, "check-syntax", a2, 0LL);
result = 1LL;
if ( v4 )
{
GetToken(a1, "check-syntax", &v10);
if ( v10 != 170 )
{
CloseStringSource(a1, "check-syntax");
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "MISSING-LEFT-PARENTHESIS");
return 1LL;
}
GetToken(a1, "check-syntax", &v10);
if ( v10 != 2 )
{
CloseStringSource(a1, "check-syntax");
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "EXPECTED-SYMBOL-AFTER-LEFT-PARENTHESIS");
return 1LL;
}
v6 = *(_QWORD *)(v11 + 24);
EnvAddRouter(a1, "error-capture", 40LL, FindErrorCapture, PrintErrorCapture, 0LL, 0LL, 0LL);
if ( FindConstruct(a1, v6) )
{
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 336LL) + 80LL) = 1;
v7 = ParseConstruct(a1, v6, "check-syntax");
GetToken(a1, "check-syntax", &v10);
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 336LL) + 80LL) = 0;
if ( v7 )
{
EnvPrintRouter(a1, "werror", "\nERROR:\n");
v8 = GetPPBuffer(a1);
PrintInChunks(a1, "werror", v8);
EnvPrintRouter(a1, "werror", "\n");
DestroyPPBuffer(a1);
CloseStringSource(a1, "check-syntax");
goto LABEL_9;
}
DestroyPPBuffer(a1);
CloseStringSource(a1, "check-syntax");
if ( *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 88LL) + 16LL) )
{
LABEL_9:
SetErrorCaptureValues(a1, a3);
DeactivateErrorCapture(a1);
return 1LL;
}
if ( v10 == 172 )
{
*(_WORD *)(a3 + 8) = 2;
*(_QWORD *)(a3 + 16) = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 392LL) + 8LL);
DeactivateErrorCapture(a1);
result = 0LL;
}
else
{
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS");
DeactivateErrorCapture(a1);
result = 1LL;
}
}
else
{
v9 = Function2Parse(a1, "check-syntax", v6);
GetToken(a1, "check-syntax", &v10);
ClearParsedBindNames(a1);
CloseStringSource(a1, "check-syntax");
if ( !v9 )
goto LABEL_9;
if ( v10 == 172 )
{
DeactivateErrorCapture(a1);
ReturnExpression(a1, v9);
*(_WORD *)(a3 + 8) = 2;
*(_QWORD *)(a3 + 16) = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 392LL) + 8LL);
result = 0LL;
}
else
{
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS");
DeactivateErrorCapture(a1);
ReturnExpression(a1, v9);
result = 1LL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, __int64 a3)
{
int v4; // edx
__int64 result; // rax
__int64 v6; // r12
__int16 v7; // r12
__int64 v8; // rax
__int64 v9; // r12
__int16 v10; // [rsp+0h] [rbp-38h] BYREF
__int64 v11; // [rsp+8h] [rbp-30h]

*(_WORD *)(a3 + 8) = 2;
*(_QWORD *)(a3 + 16) = **(_QWORD **)(*(_QWORD *)(a1 + 32) + 392LL);
v4 = OpenStringSource(a1, "check-syntax", a2, 0LL);
result = 1LL;
if ( v4 )
{
GetToken(a1, "check-syntax", &v10);
if ( v10 != 170 )
{
CloseStringSource(a1, "check-syntax");
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "MISSING-LEFT-PARENTHESIS");
return 1LL;
}
GetToken(a1, "check-syntax", &v10);
if ( v10 != 2 )
{
CloseStringSource(a1, "check-syntax");
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "EXPECTED-SYMBOL-AFTER-LEFT-PARENTHESIS");
return 1LL;
}
v6 = *(_QWORD *)(v11 + 24);
EnvAddRouter(a1, "error-capture", 40LL, FindErrorCapture, PrintErrorCapture, 0LL, 0LL, 0LL);
if ( FindConstruct(a1, v6) )
{
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 336LL) + 80LL) = 1;
v7 = ParseConstruct(a1, v6, "check-syntax");
GetToken(a1, "check-syntax", &v10);
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 336LL) + 80LL) = 0;
if ( v7 )
{
EnvPrintRouter(a1, "werror", "\nERROR:\n");
v8 = GetPPBuffer(a1);
PrintInChunks(a1, "werror", v8);
EnvPrintRouter(a1, "werror", "\n");
DestroyPPBuffer(a1);
CloseStringSource(a1, "check-syntax");
goto LABEL_9;
}
DestroyPPBuffer(a1);
CloseStringSource(a1, "check-syntax");
if ( *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 88LL) + 16LL) )
{
LABEL_9:
func2(a1, a3);
func3(a1);
return 1LL;
}
if ( v10 == 172 )
{
*(_WORD *)(a3 + 8) = 2;
*(_QWORD *)(a3 + 16) = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 392LL) + 8LL);
func3(a1);
result = 0LL;
}
else
{
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS");
func3(a1);
result = 1LL;
}
}
else
{
v9 = Function2Parse(a1, "check-syntax", v6);
GetToken(a1, "check-syntax", &v10);
ClearParsedBindNames(a1);
CloseStringSource(a1, "check-syntax");
if ( !v9 )
goto LABEL_9;
if ( v10 == 172 )
{
func3(a1);
ReturnExpression(a1, v9);
*(_WORD *)(a3 + 8) = 2;
*(_QWORD *)(a3 + 16) = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 392LL) + 8LL);
result = 0LL;
}
else
{
*(_QWORD *)(a3 + 16) = EnvAddSymbol(a1, "EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS");
func3(a1);
ReturnExpression(a1, v9);
result = 1LL;
}
}
}
return result;
}

original_code:
int CheckSyntax(
  void *theEnv,
  char *theString,
  DATA_OBJECT_PTR returnValue)
  {
   char *name;
   struct token theToken;
   struct expr *top;
   short rv;
   ((returnValue)->type = (unsigned short) (2));
   ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN));
   if (OpenStringSource(theEnv,"check-syntax",theString,0) == 0)
     { return(1); }
   GetToken(theEnv,"check-syntax",&theToken);
   if (theToken.type != 170)
     {
      CloseStringSource(theEnv,"check-syntax");
      ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"MISSING-LEFT-PARENTHESIS")));
      return(1);
     }
   GetToken(theEnv,"check-syntax",&theToken);
   if (theToken.type != 2)
     {
      CloseStringSource(theEnv,"check-syntax");
      ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"EXPECTED-SYMBOL-AFTER-LEFT-PARENTHESIS")));
      return(1);
     }
   name = (((struct symbolHashNode *) (theToken.value))->contents);
   EnvAddRouter(theEnv,"error-capture",40,
              FindErrorCapture, PrintErrorCapture,
              ((void *)0), ((void *)0), ((void *)0));
   if (FindConstruct(theEnv,name))
     {
      ((struct constructData *) (((struct environmentData *) theEnv)->theData[42]))->CheckSyntaxMode = 1;
      rv = (short) ParseConstruct(theEnv,name,"check-syntax");
      GetToken(theEnv,"check-syntax",&theToken);
      ((struct constructData *) (((struct environmentData *) theEnv)->theData[42]))->CheckSyntaxMode = 0;
      if (rv)
        {
         EnvPrintRouter(theEnv,"werror","\nERROR:\n");
         PrintInChunks(theEnv,"werror",GetPPBuffer(theEnv));
         EnvPrintRouter(theEnv,"werror","\n");
        }
      DestroyPPBuffer(theEnv);
      CloseStringSource(theEnv,"check-syntax");
      if ((rv != 0) || (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString != ((void *)0)))
        {
         SetErrorCaptureValues(theEnv,returnValue);
         DeactivateErrorCapture(theEnv);
         return(1);
        }
      if (theToken.type != 172)
        {
         ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS")));
         DeactivateErrorCapture(theEnv);
         return(1);
        }
      ((returnValue)->type = (unsigned short) (2));
      ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
      DeactivateErrorCapture(theEnv);
      return(0);
     }
   top = Function2Parse(theEnv,"check-syntax",name);
   GetToken(theEnv,"check-syntax",&theToken);
   ClearParsedBindNames(theEnv);
   CloseStringSource(theEnv,"check-syntax");
   if (top == ((void *)0))
     {
      SetErrorCaptureValues(theEnv,returnValue);
      DeactivateErrorCapture(theEnv);
      return(1);
     }
   if (theToken.type != 172)
     {
      ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS")));
      DeactivateErrorCapture(theEnv);
      ReturnExpression(theEnv,top);
      return(1);
     }
   DeactivateErrorCapture(theEnv);
   ReturnExpression(theEnv,top);
   ((returnValue)->type = (unsigned short) (2));
   ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
   return(0);
  }

canonical_original_code:
int CheckSyntax(void *theEnv, char *theString, struct dataObject *returnValue)
  {
   char *name;
   struct token theToken;
   struct expr *top;
   short rv;
   ((returnValue)->type = (unsigned short) (2));
   ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN));
   if (OpenStringSource(theEnv,"check-syntax",theString,0) == 0)
     { return(1); }
   GetToken(theEnv,"check-syntax",&theToken);
   if (theToken.type != 170)
     {
      CloseStringSource(theEnv,"check-syntax");
      ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"MISSING-LEFT-PARENTHESIS")));
      return(1);
     }
   GetToken(theEnv,"check-syntax",&theToken);
   if (theToken.type != 2)
     {
      CloseStringSource(theEnv,"check-syntax");
      ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"EXPECTED-SYMBOL-AFTER-LEFT-PARENTHESIS")));
      return(1);
     }
   name = (((struct symbolHashNode *) (theToken.value))->contents);
   EnvAddRouter(theEnv,"error-capture",40,
              FindErrorCapture, PrintErrorCapture,
              ((void *)0), ((void *)0), ((void *)0));
   if (FindConstruct(theEnv,name))
     {
      ((struct constructData *) (((struct environmentData *) theEnv)->theData[42]))->CheckSyntaxMode = 1;
      rv = (short) ParseConstruct(theEnv,name,"check-syntax");
      GetToken(theEnv,"check-syntax",&theToken);
      ((struct constructData *) (((struct environmentData *) theEnv)->theData[42]))->CheckSyntaxMode = 0;
      if (rv)
        {
         EnvPrintRouter(theEnv,"werror","\nERROR:\n");
         PrintInChunks(theEnv,"werror",GetPPBuffer(theEnv));
         EnvPrintRouter(theEnv,"werror","\n");
        }
      DestroyPPBuffer(theEnv);
      CloseStringSource(theEnv,"check-syntax");
      if ((rv != 0) || (((struct parseFunctionData *) (((struct environmentData *) theEnv)->theData[11]))->WarningString != ((void *)0)))
        {
         SetErrorCaptureValues(theEnv,returnValue);
         DeactivateErrorCapture(theEnv);
         return(1);
        }
      if (theToken.type != 172)
        {
         ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS")));
         DeactivateErrorCapture(theEnv);
         return(1);
        }
      ((returnValue)->type = (unsigned short) (2));
      ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
      DeactivateErrorCapture(theEnv);
      return(0);
     }
   top = Function2Parse(theEnv,"check-syntax",name);
   GetToken(theEnv,"check-syntax",&theToken);
   ClearParsedBindNames(theEnv);
   CloseStringSource(theEnv,"check-syntax");
   if (top == ((void *)0))
     {
      SetErrorCaptureValues(theEnv,returnValue);
      DeactivateErrorCapture(theEnv);
      return(1);
     }
   if (theToken.type != 172)
     {
      ((returnValue)->value = (void *) (EnvAddSymbol(theEnv,"EXTRANEOUS-INPUT-AFTER-LAST-PARENTHESIS")));
      DeactivateErrorCapture(theEnv);
      ReturnExpression(theEnv,top);
      return(1);
     }
   DeactivateErrorCapture(theEnv);
   ReturnExpression(theEnv,top);
   ((returnValue)->type = (unsigned short) (2));
   ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->FalseSymbolHN));
   return(0);
  }

variable_types:
theString
char *

variable_types:
name
char *

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

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

variable_types: rv short

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 constructData { int ClearReadyInProgress; int ClearInProgress; int ResetReadyInProgress; int ResetInProgress; struct callFunctionItem *ListOfSaveFunctions; int PrintWhileLoading; unsigned int WatchCompilations; struct construct *ListOfConstructs; struct callFunctionItem *ListOfResetFunctions; struct callFunctionItem *ListOfClearFunctions; struct callFunctionItem *ListOfClearReadyFunctions; int Executing; int (*BeforeResetFunction)(void *); int CheckSyntaxMode; }

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

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

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

user_defined_types: struct constructHeader { struct symbolHashNode *name; char *ppForm; struct defmoduleItemHeader *whichModule; long bsaveID; struct constructHeader *next; 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; }

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


CheckSyntaxFunction

decompiled_code:
__int64 __fastcall CheckSyntaxFunction(__int64 a1, __int64 a2)
{
__int64 result; // rax
_QWORD v3[9]; // [rsp+0h] [rbp-48h] BYREF

*(_WORD *)(a2 + 8) = 2;
*(_QWORD *)(a2 + 16) = **(_QWORD **)(*(_QWORD *)(a1 + 32) + 392LL);
result = EnvArgCountCheck(a1, "check-syntax", 0LL, 1LL);
if ( (_DWORD)result != -1 )
{
result = EnvArgTypeCheck(a1, "check-syntax", 1LL, 3LL, v3);
if ( (_DWORD)result )
result = CheckSyntax(a1, *(_QWORD *)(v3[2] + 24LL), a2);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
__int64 result; // rax
_QWORD v3[9]; // [rsp+0h] [rbp-48h] BYREF

*(_WORD *)(a2 + 8) = 2;
*(_QWORD *)(a2 + 16) = **(_QWORD **)(*(_QWORD *)(a1 + 32) + 392LL);
result = EnvArgCountCheck(a1, "check-syntax", 0LL, 1LL);
if ( (_DWORD)result != -1 )
{
result = EnvArgTypeCheck(a1, "check-syntax", 1LL, 3LL, v3);
if ( (_DWORD)result )
result = func5(a1, *(_QWORD *)(v3[2] + 24LL), a2);
}
return result;
}

original_code:
void CheckSyntaxFunction(
  void *theEnv,
  DATA_OBJECT *returnValue)
  {
   DATA_OBJECT theArg;
   ((returnValue)->type = (unsigned short) (2));
   ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN));
   if (EnvArgCountCheck(theEnv,"check-syntax",0,1) == -1) return;
   if (EnvArgTypeCheck(theEnv,"check-syntax",1,3,&theArg) == 0)
     { return; }
   CheckSyntax(theEnv,(((struct symbolHashNode *) (theArg.value))->contents),returnValue);
  }

canonical_original_code:
void CheckSyntaxFunction(void *theEnv, struct dataObject *returnValue)
  {
   struct dataObject theArg;
   ((returnValue)->type = (unsigned short) (2));
   ((returnValue)->value = (void *) (((struct symbolData *) (((struct environmentData *) theEnv)->theData[49]))->TrueSymbolHN));
   if (EnvArgCountCheck(theEnv,"check-syntax",0,1) == -1) return;
   if (EnvArgTypeCheck(theEnv,"check-syntax",1,3,&theArg) == 0)
     { return; }
   CheckSyntax(theEnv,(((struct symbolHashNode *) (theArg.value))->contents),returnValue);
  }

variable_types:
theEnv
void *

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


BeforeDefrulesCode

decompiled_code:
__int64 __fastcall BeforeDefrulesCode(__int64 a1)
{
char v2[8]; // [rsp+8h] [rbp-20h] BYREF
char v3[8]; // [rsp+10h] [rbp-18h] BYREF
char v4[16]; // [rsp+18h] [rbp-10h] BYREF

return TagRuleNetwork(a1, v4, v3, v2);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
char v2[8]; // [rsp+8h] [rbp-20h] BYREF
char v3[8]; // [rsp+10h] [rbp-18h] BYREF
char v4[16]; // [rsp+18h] [rbp-10h] BYREF

return TagRuleNetwork(a1, v4, v3, v2);
}

original_code:
static void BeforeDefrulesCode(
  void *theEnv)
  {
   long int moduleCount, ruleCount, joinCount;
   TagRuleNetwork(theEnv,&moduleCount,&ruleCount,&joinCount);
  }

canonical_original_code:
static void BeforeDefrulesCode(void *theEnv)
  {
   long moduleCount; long ruleCount; long joinCount;
   TagRuleNetwork(theEnv,&moduleCount,&ruleCount,&joinCount);
  }

variable_types: moduleCount long

variable_types: ruleCount long

variable_types: joinCount long


PlaceComplexityActivation

original_code:
static ACTIVATION *PlaceComplexityActivation(
  ACTIVATION *actPtr,
  ACTIVATION *newActivation)
  {
   int salience, complexity;
   unsigned long timetag;
   ACTIVATION *lastAct;
   timetag = newActivation->timetag;
   salience = newActivation->salience;
   complexity = newActivation->theRule->complexity;
   lastAct = ((void *)0);
   while (actPtr != ((void *)0))
     {
      if (actPtr->salience > salience)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (actPtr->salience < salience)
        { return(lastAct); }
      else if (complexity < (int) actPtr->theRule->complexity)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (complexity > (int) actPtr->theRule->complexity)
        { return(lastAct); }
      else if (timetag > actPtr->timetag)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else
        { return(lastAct); }
     }
   return(lastAct);
  }

canonical_original_code:
static struct activation *PlaceComplexityActivation(struct activation *actPtr, struct activation *newActivation)
  {
   int salience; int complexity;
   unsigned long timetag;
   struct activation *lastAct;
   timetag = newActivation->timetag;
   salience = newActivation->salience;
   complexity = newActivation->theRule->complexity;
   lastAct = ((void *)0);
   while (actPtr != ((void *)0))
     {
      if (actPtr->salience > salience)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (actPtr->salience < salience)
        { return(lastAct); }
      else if (complexity < (int) actPtr->theRule->complexity)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (complexity > (int) actPtr->theRule->complexity)
        { return(lastAct); }
      else if (timetag > actPtr->timetag)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else
        { return(lastAct); }
     }
   return(lastAct);
  }

variable_types:
actPtr
struct activation *

variable_types:
newActivation
struct activation *

variable_types: salience int

variable_types: complexity int

variable_types:
timetag
unsigned long

variable_types: struct activation { 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 { 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; int salience; int localVarCnt; unsigned int complexity; unsigned int afterBreakpoint; unsigned int watchActivation; unsigned int watchFiring; unsigned int autoFocus; unsigned int executing; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *dynamicSalience; struct expr *actions; 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 *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 *networkTest; void *rightSideEntryStructure; struct joinNode *nextLevel; struct joinNode *lastLevel; struct joinNode *rightDriveNode; struct joinNode *rightMatchNode; struct defrule *ruleToActivate; } *logicalJoin; struct joinNode *lastJoin; struct defrule *disjunct; } *theRule; struct partialMatch *basis; int salience; unsigned long timetag; struct partialMatch *sortedBasis; int randomID; struct activation *prev; struct activation *next; } *

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


PlaceSimplicityActivation

original_code:
static ACTIVATION *PlaceSimplicityActivation(
  ACTIVATION *actPtr,
  ACTIVATION *newActivation)
  {
   int salience, complexity;
   unsigned long timetag;
   ACTIVATION *lastAct;
   timetag = newActivation->timetag;
   salience = newActivation->salience;
   complexity = newActivation->theRule->complexity;
   lastAct = ((void *)0);
   while (actPtr != ((void *)0))
     {
      if (actPtr->salience > salience)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (actPtr->salience < salience)
        { return(lastAct); }
      else if (complexity > (int) actPtr->theRule->complexity)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (complexity < (int) actPtr->theRule->complexity)
        { return(lastAct); }
      else if (timetag > actPtr->timetag)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else
       { return(lastAct); }
     }
   return(lastAct);
  }

canonical_original_code:
static struct activation *PlaceSimplicityActivation(struct activation *actPtr, struct activation *newActivation)
  {
   int salience; int complexity;
   unsigned long timetag;
   struct activation *lastAct;
   timetag = newActivation->timetag;
   salience = newActivation->salience;
   complexity = newActivation->theRule->complexity;
   lastAct = ((void *)0);
   while (actPtr != ((void *)0))
     {
      if (actPtr->salience > salience)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (actPtr->salience < salience)
        { return(lastAct); }
      else if (complexity > (int) actPtr->theRule->complexity)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else if (complexity < (int) actPtr->theRule->complexity)
        { return(lastAct); }
      else if (timetag > actPtr->timetag)
        {
         lastAct = actPtr;
         actPtr = actPtr->next;
        }
      else
       { return(lastAct); }
     }
   return(lastAct);
  }

return_type: struct activation { 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 { 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; int salience; int localVarCnt; unsigned int complexity; unsigned int afterBreakpoint; unsigned int watchActivation; unsigned int watchFiring; unsigned int autoFocus; unsigned int executing; struct expr { unsigned short type; void *value; struct expr *argList; struct expr *nextArg; } *dynamicSalience; struct expr *actions; 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 *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 *networkTest; void *rightSideEntryStructure; struct joinNode *nextLevel; struct joinNode *lastLevel; struct joinNode *rightDriveNode; struct joinNode *rightMatchNode; struct defrule *ruleToActivate; } *logicalJoin; struct joinNode *lastJoin; struct defrule *disjunct; } *theRule; struct partialMatch *basis; int salience; unsigned long timetag; struct partialMatch *sortedBasis; int randomID; struct activation *prev; struct activation *next; } *


GetStrategyName

decompiled_code:
const char *__fastcall GetStrategyName(int a1)
{
const char *result; // rax

switch ( a1 )
{
case 0:
result = "depth";
break;
case 1:
result = "breadth";
break;
case 2:
result = "lex";
break;
case 3:
result = "mea";
break;
case 4:
result = "complexity";
break;
case 5:
result = "simplicity";
break;
case 6:
result = "random";
break;
default:
result = "unknown";
break;
}
return result;
}

canonical_decompiled_code:
const char *__fastcall func5(int a1)
{
const char *result; // rax

switch ( a1 )
{
case 0:
result = "depth";
break;
case 1:
result = "breadth";
break;
case 2:
result = "lex";
break;
case 3:
result = "mea";
break;
case 4:
result = "complexity";
break;
case 5:
result = "simplicity";
break;
case 6:
result = "random";
break;
default:
result = "unknown";
break;
}
return result;
}

original_code:
static char *GetStrategyName(
  int strategy)
  {
   char *sname;
   switch (strategy)
     {
      case 0:
        sname = "depth";
        break;
      case 1:
        sname = "breadth";
        break;
      case 2:
        sname = "lex";
        break;
      case 3:
        sname = "mea";
        break;
      case 4:
        sname = "complexity";
        break;
      case 5:
        sname = "simplicity";
        break;
      case 6:
        sname = "random";
        break;
      default:
        sname = "unknown";
        break;
     }
   return(sname);
  }

canonical_original_code:
static char *GetStrategyName(int strategy)
  {
   char *sname;
   switch (strategy)
     {
      case 0:
        sname = "depth";
        break;
      case 1:
        sname = "breadth";
        break;
      case 2:
        sname = "lex";
        break;
      case 3:
        sname = "mea";
        break;
      case 4:
        sname = "complexity";
        break;
      case 5:
        sname = "simplicity";
        break;
      case 6:
        sname = "random";
        break;
      default:
        sname = "unknown";
        break;
     }
   return(sname);
  }

variable_types: strategy int

variable_types:
sname
char *


SortPartialMatch

original_code:
static struct partialMatch *SortPartialMatch(
  void *theEnv,
  struct partialMatch *binds)
  {
   struct partialMatch *nbinds;
   struct alphaMatch *temp;
   int flag, j, k;
   nbinds = CopyPartialMatch(theEnv,binds,0,0);
   for (flag = 1, k = binds->bcount - 1;
        flag == 1;
        k--)
     {
      flag = 0;
      for (j = 0 ; j < k ; j++)
        {
         if ((nbinds->binds[j].gm.theMatch->matchingItem != ((void *)0)) &&
             (nbinds->binds[j + 1].gm.theMatch->matchingItem != ((void *)0)))
           {
            if (nbinds->binds[j].gm.theMatch->matchingItem->timeTag <
                nbinds->binds[j + 1].gm.theMatch->matchingItem->timeTag)
              {
               temp = nbinds->binds[j].gm.theMatch;
               nbinds->binds[j].gm.theMatch = nbinds->binds[j+1].gm.theMatch;
               nbinds->binds[j+1].gm.theMatch = temp;
               flag = 1;
              }
           }
        }
     }
   return(nbinds);
  }

canonical_original_code:
static struct partialMatch *SortPartialMatch(void *theEnv, struct partialMatch *binds)
  {
   struct partialMatch *nbinds;
   struct alphaMatch *temp;
   int flag; int j; int k;
   nbinds = CopyPartialMatch(theEnv,binds,0,0);
   for (flag = 1, k = binds->bcount - 1;
        flag == 1;
        k--)
     {
      flag = 0;
      for (j = 0 ; j < k ; j++)
        {
         if ((nbinds->binds[j].gm.theMatch->matchingItem != ((void *)0)) &&
             (nbinds->binds[j + 1].gm.theMatch->matchingItem != ((void *)0)))
           {
            if (nbinds->binds[j].gm.theMatch->matchingItem->timeTag <
                nbinds->binds[j + 1].gm.theMatch->matchingItem->timeTag)
              {
               temp = nbinds->binds[j].gm.theMatch;
               nbinds->binds[j].gm.theMatch = nbinds->binds[j+1].gm.theMatch;
               nbinds->binds[j+1].gm.theMatch = temp;
               flag = 1;
              }
           }
        }
     }
   return(nbinds);
  }

variable_types:
binds
struct partialMatch *

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: flag int

variable_types: j int

variable_types: k int


ComparePartialMatches

original_code:
static int ComparePartialMatches(
  void *theEnv,
  ACTIVATION *actPtr,
  ACTIVATION *newActivation)
  {
   int cCount, oCount, mCount, i;
   if (actPtr->sortedBasis == ((void *)0))
     { actPtr->sortedBasis = SortPartialMatch(theEnv,actPtr->basis); }
   cCount = newActivation->sortedBasis->bcount;
   oCount = actPtr->sortedBasis->bcount;
   if (oCount > cCount) mCount = cCount;
   else mCount = oCount;
   for (i = 0 ; i < mCount ; i++)
     {
      if ((actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0)) &&
          (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0)))
        {
         if (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag <
             actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag)
           { return(0); }
         else if (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag >
                  actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag)
           { return(1); }
        }
      else if (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0))
        { return(1); }
      else if (actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0))
        { return(0); }
     }
   if (cCount < oCount) return(0);
   else if (cCount > oCount) return(1);
   if (newActivation->theRule->complexity < actPtr->theRule->complexity)
     { return(0); }
   else if (newActivation->theRule->complexity > actPtr->theRule->complexity)
     { return(1); }
   return(2);
  }

canonical_original_code:
static int ComparePartialMatches(void *theEnv, struct activation *actPtr, struct activation *newActivation)
  {
   int cCount; int oCount; int mCount; int i;
   if (actPtr->sortedBasis == ((void *)0))
     { actPtr->sortedBasis = SortPartialMatch(theEnv,actPtr->basis); }
   cCount = newActivation->sortedBasis->bcount;
   oCount = actPtr->sortedBasis->bcount;
   if (oCount > cCount) mCount = cCount;
   else mCount = oCount;
   for (i = 0 ; i < mCount ; i++)
     {
      if ((actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0)) &&
          (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0)))
        {
         if (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag <
             actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag)
           { return(0); }
         else if (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag >
                  actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem->timeTag)
           { return(1); }
        }
      else if (newActivation->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0))
        { return(1); }
      else if (actPtr->sortedBasis->binds[i].gm.theMatch->matchingItem != ((void *)0))
        { return(0); }
     }
   if (cCount < oCount) return(0);
   else if (cCount > oCount) return(1);
   if (newActivation->theRule->complexity < actPtr->theRule->complexity)
     { return(0); }
   else if (newActivation->theRule->complexity > actPtr->theRule->complexity)
     { return(1); }
   return(2);
  }

variable_types:
theEnv
void *

variable_types: cCount int

variable_types: oCount int

variable_types: mCount int

variable_types: i int

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

user_defined_types: struct multifieldMarker { int whichField; union { void *whichSlot; short whichSlotNumber; } where; long startPosition; long endPosition; struct multifieldMarker *next; }

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