GetStartVertexIndex

decompiled_code:
__int64 __fastcall GetStartVertexIndex(__int64 a1, __int64 a2, __int64 a3)
{
__int64 *v3; // rax
__int64 *v5; // rdx
__int64 v6; // rax
__int64 result; // rax

v3 = **(__int64 ***)(a2 + 1752);
if ( !v3 )
{
puts("Error GetStartVertexIndex: increment list empty");
exit(1);
}
do
{
v5 = v3;
v3 = (__int64 *)v3[1];
}
while ( v3 );
v6 = *v5;
if ( a3 == 1 )
result = *(_QWORD *)(v6 + 48);
else
result = *(_QWORD *)(v6 + 64);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, __int64 a3)
{
__int64 *v3; // rax
__int64 *v5; // rdx
__int64 v6; // rax
__int64 result; // rax

v3 = **(__int64 ***)(a2 + 1752);
if ( !v3 )
{
puts("Error GetStartVertexIndex: increment list empty");
exit(1);
}
do
{
v5 = v3;
v3 = (__int64 *)v3[1];
}
while ( v3 );
v6 = *v5;
if ( a3 == 1 )
result = *(_QWORD *)(v6 + 48);
else
result = *(_QWORD *)(v6 + 64);
return result;
}

original_code:
ULONG GetStartVertexIndex(ULONG incrementNum, Parameters *parameters,
                          ULONG graphType)
{
   IncrementListNode *incNodePtr = parameters->incrementList->head;
   if (incNodePtr == ((void *)0))
   {
      printf("Error GetStartVertexIndex: increment list empty\n");
      exit(1);
   }
   while (incNodePtr->next != ((void *)0))
      incNodePtr = incNodePtr->next;
   if (graphType == 1)
      return incNodePtr->increment->startPosVertexIndex;
   else
      return incNodePtr->increment->startNegVertexIndex;
}

canonical_original_code:
unsigned long GetStartVertexIndex(unsigned long incrementNum, struct Parameters *parameters, unsigned long graphType)
{
   struct _increment_list_node *incNodePtr = parameters->incrementList->head;
   if (incNodePtr == ((void *)0))
   {
      printf("Error GetStartVertexIndex: increment list empty\n");
      exit(1);
   }
   while (incNodePtr->next != ((void *)0))
      incNodePtr = incNodePtr->next;
   if (graphType == 1)
      return incNodePtr->increment->startPosVertexIndex;
   else
      return incNodePtr->increment->startNegVertexIndex;
}

variable_types:
incrementNum
unsigned long

variable_types:
graphType
unsigned long

user_defined_types: struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }

user_defined_types: struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }

user_defined_types: struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }

user_defined_types: struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }

user_defined_types: struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }

user_defined_types: struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }


GetIncrementListNode

repo: gromgull/subdue

decompiled_code:
__int64 __fastcall GetIncrementListNode(__int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // r8

v2 = **(_QWORD **)(a2 + 1752);
if ( !v2 )
return 0LL;
do
{
v3 = v2;
v2 = *(_QWORD *)(v2 + 8);
}
while ( v2 );
return v3;
}

original_code:
IncrementListNode *GetIncrementListNode(ULONG incrementNum,
                                        Parameters *parameters)
{
   IncrementListNode *incNodePtr = parameters->incrementList->head;
   if (incNodePtr == ((void *)0))
      return ((void *)0);
   while (incNodePtr->next != ((void *)0))
      incNodePtr = incNodePtr->next;
   return incNodePtr;
}

canonical_original_code:
struct _increment_list_node *GetIncrementListNode(unsigned long incrementNum, struct Parameters *parameters)
{
   struct _increment_list_node *incNodePtr = parameters->incrementList->head;
   if (incNodePtr == ((void *)0))
      return ((void *)0);
   while (incNodePtr->next != ((void *)0))
      incNodePtr = incNodePtr->next;
   return incNodePtr;
}

variable_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *

variable_types: struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *

user_defined_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }

user_defined_types: struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }

user_defined_types: struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }

user_defined_types: struct InstanceVertexList { struct AvlTreeList *avlTreeList; }

user_defined_types: struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }

user_defined_types: struct AvlTreeList { struct _avltablenode *head; }

user_defined_types: struct SubList { struct _sub_list_node *head; }

user_defined_types: struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }

user_defined_types: struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }

user_defined_types: struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }

user_defined_types: struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }

user_defined_types: struct InstanceList { struct _instance_list_node *head; }

user_defined_types: struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }

user_defined_types: struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }


IncrementSize

decompiled_code:
__int64 __fastcall IncrementSize(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
__int64 v3; // rdx
__int64 v4; // rdx

v2 = GetIncrement(a2, a1);
if ( v3 == 1 )
v4 = v2[2] + v2[3];
else
v4 = v2[4] + v2[5];
return v4;
}

original_code:
ULONG IncrementSize(Parameters *parameters, ULONG incrementNum, ULONG graphType)
{
   Increment *increment = GetIncrement(incrementNum, parameters);
   if (graphType == 1)
      return(increment->numPosVertices + increment->numPosEdges);
   else
      return(increment->numNegVertices + increment->numNegEdges);
}

canonical_original_code:
unsigned long IncrementSize(struct Parameters *parameters, unsigned long incrementNum, unsigned long graphType)
{
   struct _increment *increment = GetIncrement(incrementNum, parameters);
   if (graphType == 1)
      return(increment->numPosVertices + increment->numPosEdges);
   else
      return(increment->numNegVertices + increment->numNegEdges);
}

variable_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *

variable_types: struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *

return_type: unsigned long

user_defined_types: struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }

user_defined_types: struct IncrementList { struct _increment_list_node *head; }


IncrementNumExamples

original_code:
ULONG IncrementNumExamples(Parameters *parameters, ULONG incrementNum,
                           ULONG graphType)
{
   Increment *increment = GetIncrement(incrementNum, parameters);
   if (graphType == 1)
      return((ULONG) increment->numPosEgs);
   else
      return((ULONG) increment->numNegEgs);
}

canonical_original_code:
unsigned long IncrementNumExamples(struct Parameters *parameters, unsigned long incrementNum, unsigned long graphType)
{
   struct _increment *increment = GetIncrement(incrementNum, parameters);
   if (graphType == 1)
      return((unsigned long) increment->numPosEgs);
   else
      return((unsigned long) increment->numNegEgs);
}

user_defined_types: struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }

user_defined_types: struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }

user_defined_types: struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }

user_defined_types: struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }

user_defined_types: struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }

user_defined_types: struct VertexMap { unsigned long v1; unsigned long v2; }


SetIncrementNumExamples

decompiled_code:
signed __int64 __fastcall SetIncrementNumExamples(__int64 a1)
{
signed __int64 result; // rax
_QWORD *v2; // r9
__int64 v3; // rdx
unsigned __int64 v4; // rcx
signed __int64 v5; // rdi
double v6; // xmm0_8
__int64 v7; // rdx
unsigned __int64 v8; // rcx

result = (signed __int64)GetCurrentIncrement(a1);
v3 = v2[196];
v4 = *(_QWORD *)(result + 48);
v5 = result;
if ( v3 )
{
result = 0LL;
while ( *(_QWORD *)(v2[198] + 8 * result) < v4 )
{
if ( v3 == ++result )
{
LODWORD(v3) = 0;
goto LABEL_6;
}
}
v3 -= result;
if ( v3 >= 0 )
goto LABEL_6;
result = v3 & 1 | ((unsigned __int64)v3 >> 1);
v6 = (double)(int)result + (double)(int)result;
}
else
{
LABEL_6:
v6 = (double)(int)v3;
}
v7 = v2[197];
v8 = *(_QWORD *)(v5 + 64);
*(double *)(v5 + 80) = v6;
if ( v7 )
{
result = 0LL;
while ( *(_QWORD *)(v2[199] + 8 * result) < v8 )
{
if ( v7 == ++result )
{
LODWORD(v7) = 0;
goto LABEL_12;
}
}
v7 -= result;
if ( v7 >= 0 )
goto LABEL_12;
result = v7 & 1 | ((unsigned __int64)v7 >> 1);
*(double *)(v5 + 88) = (double)(int)result + (double)(int)result;
}
else
{
LABEL_12:
*(double *)(v5 + 88) = (double)(int)v7;
}
return result;
}

canonical_decompiled_code:
signed __int64 __fastcall func12(__int64 a1)
{
signed __int64 result; // rax
_QWORD *v2; // r9
__int64 v3; // rdx
unsigned __int64 v4; // rcx
signed __int64 v5; // rdi
double v6; // xmm0_8
__int64 v7; // rdx
unsigned __int64 v8; // rcx

result = (signed __int64)GetCurrentIncrement(a1);
v3 = v2[196];
v4 = *(_QWORD *)(result + 48);
v5 = result;
if ( v3 )
{
result = 0LL;
while ( *(_QWORD *)(v2[198] + 8 * result) < v4 )
{
if ( v3 == ++result )
{
LODWORD(v3) = 0;
goto LABEL_6;
}
}
v3 -= result;
if ( v3 >= 0 )
goto LABEL_6;
result = v3 & 1 | ((unsigned __int64)v3 >> 1);
v6 = (double)(int)result + (double)(int)result;
}
else
{
LABEL_6:
v6 = (double)(int)v3;
}
v7 = v2[197];
v8 = *(_QWORD *)(v5 + 64);
*(double *)(v5 + 80) = v6;
if ( v7 )
{
result = 0LL;
while ( *(_QWORD *)(v2[199] + 8 * result) < v8 )
{
if ( v7 == ++result )
{
LODWORD(v7) = 0;
goto LABEL_12;
}
}
v7 -= result;
if ( v7 >= 0 )
goto LABEL_12;
result = v7 & 1 | ((unsigned __int64)v7 >> 1);
*(double *)(v5 + 88) = (double)(int)result + (double)(int)result;
}
else
{
LABEL_12:
*(double *)(v5 + 88) = (double)(int)v7;
}
return result;
}

original_code:
void SetIncrementNumExamples(Parameters *parameters)
{
   Increment *increment = GetCurrentIncrement(parameters);
   ULONG i;
   ULONG numEgs;
   ULONG start;
   start = increment->startPosVertexIndex;
   numEgs = parameters->numPosEgs;
   for (i=0; i<numEgs; i++)
      if (parameters->posEgsVertexIndices[i] >= start)
         break;
   increment->numPosEgs = (double) (numEgs - i);
   start = increment->startNegVertexIndex;
   numEgs = parameters->numNegEgs;
   for (i=0; i<numEgs; i++)
      if (parameters->negEgsVertexIndices[i] >= start)
         break;
   increment->numNegEgs = (double) (numEgs - i);
}

canonical_original_code:
void SetIncrementNumExamples(struct Parameters *parameters)
{
   struct _increment *increment = GetCurrentIncrement(parameters);
   unsigned long i;
   unsigned long numEgs;
   unsigned long start;
   start = increment->startPosVertexIndex;
   numEgs = parameters->numPosEgs;
   for (i=0; i<numEgs; i++)
      if (parameters->posEgsVertexIndices[i] >= start)
         break;
   increment->numPosEgs = (double) (numEgs - i);
   start = increment->startNegVertexIndex;
   numEgs = parameters->numNegEgs;
   for (i=0; i<numEgs; i++)
      if (parameters->negEgsVertexIndices[i] >= start)
         break;
   increment->numNegEgs = (double) (numEgs - i);
}

variable_types:
i
unsigned long

variable_types:
numEgs
unsigned long

variable_types:
start
unsigned long

return_type: void

user_defined_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }

user_defined_types: struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }

user_defined_types: struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }

user_defined_types: struct InstanceVertexList { struct AvlTreeList *avlTreeList; }

user_defined_types: struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }

user_defined_types: struct AvlTreeList { struct _avltablenode *head; }


PrintStoredSub

decompiled_code:
int __fastcall PrintStoredSub(double *a1, __int64 a2)
{
int result; // eax
double v4; // rdi

if ( a1 )
{
printf("Substructure: value = %.*g, ", 6, a1[7]);
result = printf("pos instances = %lu, neg instances = %lu\n", *((_QWORD *)a1 + 1), *((_QWORD *)a1 + 4));
v4 = *a1;
if ( *(_QWORD *)a1 )
result = PrintGraph(*(_QWORD *)&v4, *(_QWORD *)(a2 + 1600));
}
return result;
}

canonical_decompiled_code:
int __fastcall func13(double *a1, __int64 a2)
{
int result; // eax
double v4; // rdi

if ( a1 )
{
printf("Substructure: value = %.*g, ", 6, a1[7]);
result = printf("pos instances = %lu, neg instances = %lu\n", *((_QWORD *)a1 + 1), *((_QWORD *)a1 + 4));
v4 = *a1;
if ( *(_QWORD *)a1 )
result = PrintGraph(*(_QWORD *)&v4, *(_QWORD *)(a2 + 1600));
}
return result;
}

original_code:
void PrintStoredSub (Substructure *sub, Parameters *parameters)
{
   if (sub != ((void *)0))
   {
      printf("Substructure: value = %.*g, ", 6,
       sub->value);
      printf("pos instances = %lu, neg instances = %lu\n",
       sub->numInstances, sub->numNegInstances);
      if (sub->definition != ((void *)0))
         PrintGraph(sub->definition, parameters->labelList);
   }
}

canonical_original_code:
void PrintStoredSub(struct Substructure *sub, struct Parameters *parameters)
{
   if (sub != ((void *)0))
   {
      printf("Substructure: value = %.*g, ", 6,
       sub->value);
      printf("pos instances = %lu, neg instances = %lu\n",
       sub->numInstances, sub->numNegInstances);
      if (sub->definition != ((void *)0))
         PrintGraph(sub->definition, parameters->labelList);
   }
}

variable_types: struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *

variable_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *

user_defined_types: struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }

user_defined_types: struct InstanceList { struct _instance_list_node *head; }

user_defined_types: struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }

user_defined_types: struct SubList { struct _sub_list_node *head; }

user_defined_types: struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }


AllocateLabelList

decompiled_code:
_QWORD *AllocateLabelList()
{
_QWORD *result; // rax

result = malloc(0x18uLL);
if ( !result )
{
OutOfMemoryError("AllocateLabelList:labelList");
result = 0LL;
}
*result = 0LL;
result[1] = 0LL;
result[2] = 0LL;
return result;
}

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

result = malloc(0x18uLL);
if ( !result )
{
OutOfMemoryError("AllocateLabelList:labelList");
result = 0LL;
}
*result = 0LL;
result[1] = 0LL;
result[2] = 0LL;
return result;
}

original_code:
LabelList *AllocateLabelList(void)
{
   LabelList *labelList;
   labelList = (LabelList *) malloc(sizeof(LabelList));
   if (labelList == ((void *)0))
      OutOfMemoryError("AllocateLabelList:labelList");
   labelList->size = 0;
   labelList->numLabels = 0;
   labelList->labels = ((void *)0);
   return labelList;
}

canonical_original_code:
struct LabelList *AllocateLabelList()
{
   struct LabelList *labelList;
   labelList = (struct LabelList *) malloc(sizeof(LabelList));
   if (labelList == ((void *)0))
      OutOfMemoryError("AllocateLabelList:labelList");
   labelList->size = 0;
   labelList->numLabels = 0;
   labelList->labels = ((void *)0);
   return labelList;
}

variable_types: struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *


GetLabelIndex

decompiled_code:
unsigned __int64 __fastcall GetLabelIndex(char *a1, __int64 a2)
{
unsigned __int64 v2; // r14
char v3; // r12
unsigned __int64 v4; // rbx
const char **i; // rbp
unsigned __int64 v6; // r13

v2 = *(_QWORD *)(a2 + 8);
if ( !v2 )
return 0LL;
v3 = *a1;
v4 = 1LL;
for ( i = (const char **)(*(_QWORD *)(a2 + 16) + 8LL); ; i += 3 )
{
v6 = v4 - 1;
if ( *((_BYTE *)i - 8) == v3 )
{
if ( v3 )
{
if ( v3 == 1 && *(double *)i == *((double *)a1 + 1) )
return v6;
}
else if ( !strcmp(*i, *((const char **)a1 + 1)) )
{
return v6;
}
}
if ( v2 <= v4 )
break;
++v4;
}
return v2;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func1(char *a1, __int64 a2)
{
unsigned __int64 v2; // r14
char v3; // r12
unsigned __int64 v4; // rbx
const char **i; // rbp
unsigned __int64 v6; // r13

v2 = *(_QWORD *)(a2 + 8);
if ( !v2 )
return 0LL;
v3 = *a1;
v4 = 1LL;
for ( i = (const char **)(*(_QWORD *)(a2 + 16) + 8LL); ; i += 3 )
{
v6 = v4 - 1;
if ( *((_BYTE *)i - 8) == v3 )
{
if ( v3 )
{
if ( v3 == 1 && *(double *)i == *((double *)a1 + 1) )
return v6;
}
else if ( !strcmp(*i, *((const char **)a1 + 1)) )
{
return v6;
}
}
if ( v2 <= v4 )
break;
++v4;
}
return v2;
}

original_code:
ULONG GetLabelIndex(Label *label, LabelList *labelList)
{
   ULONG i = 0;
   ULONG labelIndex = labelList->numLabels;
   BOOLEAN found = 0;
   while ((i < labelList->numLabels) && (! found))
   {
      if (labelList->labels[i].labelType == label->labelType)
      {
         switch(label->labelType)
         {
            case 0:
               if (strcmp(labelList->labels[i].labelValue.stringLabel,
                   label->labelValue.stringLabel) == 0)
               {
                  labelIndex = i;
                  found = 1;
               }
               break;
            case 1:
               if (labelList->labels[i].labelValue.numericLabel ==
                   label->labelValue.numericLabel)
               {
                  labelIndex = i;
                  found = 1;
               }
            default:
               break;
         }
      }
      i++;
   }
   return labelIndex;
}

canonical_original_code:
unsigned long GetLabelIndex(struct Label *label, struct LabelList *labelList)
{
   unsigned long i = 0;
   unsigned long labelIndex = labelList->numLabels;
   unsigned char found = 0;
   while ((i < labelList->numLabels) && (! found))
   {
      if (labelList->labels[i].labelType == label->labelType)
      {
         switch(label->labelType)
         {
            case 0:
               if (strcmp(labelList->labels[i].labelValue.stringLabel,
                   label->labelValue.stringLabel) == 0)
               {
                  labelIndex = i;
                  found = 1;
               }
               break;
            case 1:
               if (labelList->labels[i].labelValue.numericLabel ==
                   label->labelValue.numericLabel)
               {
                  labelIndex = i;
                  found = 1;
               }
            default:
               break;
         }
      }
      i++;
   }
   return labelIndex;
}

variable_types: struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *

variable_types: struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; } *

variable_types:
labelIndex
unsigned long

variable_types:
found
unsigned char


StoreLabel

original_code:
ULONG StoreLabel(Label *label, LabelList *labelList)
{
   ULONG labelIndex;
   Label *newLabelList;
   char *stringLabel;
   labelIndex = GetLabelIndex(label, labelList);
   if (labelIndex == labelList->numLabels)
   {
      if (labelList->size == labelList->numLabels)
      {
         labelList->size += 100;
         newLabelList = (Label *) realloc(labelList->labels,
                                          (sizeof(Label) * labelList->size));
         if (newLabelList == ((void *)0))
            OutOfMemoryError("StoreLabel:newLabelList");
         labelList->labels = newLabelList;
      }
      labelList->labels[labelList->numLabels].labelType = label->labelType;
      switch(label->labelType)
      {
         case 0:
            stringLabel = (char *) malloc
                          (sizeof(char) *
                           (strlen(label->labelValue.stringLabel)) + 1);
            if (stringLabel == ((void *)0))
               OutOfMemoryError("StoreLabel:stringLabel");
            strcpy(stringLabel, label->labelValue.stringLabel);
            labelList->labels[labelList->numLabels].labelValue.stringLabel =
               stringLabel;
            break;
         case 1:
            labelList->labels[labelList->numLabels].labelValue.numericLabel =
               label->labelValue.numericLabel;
            break;
         default:
            break;
      }
      labelList->labels[labelList->numLabels].used = 0;
      labelList->numLabels++;
   }
   return labelIndex;
}

canonical_original_code:
unsigned long StoreLabel(struct Label *label, struct LabelList *labelList)
{
   unsigned long labelIndex;
   struct Label *newLabelList;
   char *stringLabel;
   labelIndex = GetLabelIndex(label, labelList);
   if (labelIndex == labelList->numLabels)
   {
      if (labelList->size == labelList->numLabels)
      {
         labelList->size += 100;
         newLabelList = (struct Label *) realloc(labelList->labels,
                                          (sizeof(Label) * labelList->size));
         if (newLabelList == ((void *)0))
            OutOfMemoryError("StoreLabel:newLabelList");
         labelList->labels = newLabelList;
      }
      labelList->labels[labelList->numLabels].labelType = label->labelType;
      switch(label->labelType)
      {
         case 0:
            stringLabel = (char *) malloc
                          (sizeof(char) *
                           (strlen(label->labelValue.stringLabel)) + 1);
            if (stringLabel == ((void *)0))
               OutOfMemoryError("StoreLabel:stringLabel");
            strcpy(stringLabel, label->labelValue.stringLabel);
            labelList->labels[labelList->numLabels].labelValue.stringLabel =
               stringLabel;
            break;
         case 1:
            labelList->labels[labelList->numLabels].labelValue.numericLabel =
               label->labelValue.numericLabel;
            break;
         default:
            break;
      }
      labelList->labels[labelList->numLabels].used = 0;
      labelList->numLabels++;
   }
   return labelIndex;
}

variable_types:
stringLabel
char *


SubLabelNumber

original_code:
ULONG SubLabelNumber(ULONG index, LabelList *labelList)
{
   char *stringLabel;
   char prefix[256];
   char rest[256];
   BOOLEAN match;
   int i = 0;
   int labelLength;
   int prefixLength;
   ULONG subNumber;
   match = 1;
   subNumber = 0;
   if (labelList->labels[index].labelType == 0)
   {
      stringLabel = labelList->labels[index].labelValue.stringLabel;
      labelLength = strlen(stringLabel);
      strcpy(prefix, "SUB");
      prefixLength = strlen(prefix);
      if (labelLength > (prefixLength + 1))
         for (i = 0; ((i < prefixLength) && match); i++)
            if (stringLabel[i] != prefix[i])
               match = 0;
      if (match && (stringLabel[i] != '_'))
         match = 0;
      if (match &&
          (sscanf((& stringLabel[i + 1]), "%lu%s", &subNumber, rest) != 1))
         subNumber = 0;
   }
   return subNumber;
}

canonical_original_code:
unsigned long SubLabelNumber(unsigned long index, struct LabelList *labelList)
{
   char *stringLabel;
   char prefix[256];
   char rest[256];
   unsigned char match;
   int i = 0;
   int labelLength;
   int prefixLength;
   unsigned long subNumber;
   match = 1;
   subNumber = 0;
   if (labelList->labels[index].labelType == 0)
   {
      stringLabel = labelList->labels[index].labelValue.stringLabel;
      labelLength = strlen(stringLabel);
      strcpy(prefix, "SUB");
      prefixLength = strlen(prefix);
      if (labelLength > (prefixLength + 1))
         for (i = 0; ((i < prefixLength) && match); i++)
            if (stringLabel[i] != prefix[i])
               match = 0;
      if (match && (stringLabel[i] != '_'))
         match = 0;
      if (match &&
          (sscanf((& stringLabel[i + 1]), "%lu%s", &subNumber, rest) != 1))
         subNumber = 0;
   }
   return subNumber;
}

variable_types:
index
unsigned long

variable_types:
prefix
char [256]

variable_types:
rest
char [256]

variable_types:
match
unsigned char

variable_types: i int

variable_types: labelLength int

variable_types: prefixLength int

variable_types:
subNumber
unsigned long


LabelMatchFactor

decompiled_code:
double __fastcall LabelMatchFactor(__int64 a1, __int64 a2)
{
double result; // xmm0_8

result = *(double *)&LC4;
if ( a1 == a2 )
result = 0.0;
return result;
}

canonical_decompiled_code:
double __fastcall func4(__int64 a1, __int64 a2)
{
double result; // xmm0_8

result = *(double *)&LC4;
if ( a1 == a2 )
result = 0.0;
return result;
}

original_code:
double LabelMatchFactor(ULONG labelIndex1, ULONG labelIndex2,
          LabelList *labelList)
{
   if (labelIndex1 == labelIndex2)
      return 0.0;
   return 1.0;
}

canonical_original_code:
double LabelMatchFactor(unsigned long labelIndex1, unsigned long labelIndex2, struct LabelList *labelList)
{
   if (labelIndex1 == labelIndex2)
      return 0.0;
   return 1.0;
}

return_type: double


PrintLabel

decompiled_code:
int __fastcall PrintLabel(__int64 a1, __int64 a2)
{
const char **v2; // rdx
int result; // eax

v2 = (const char **)(*(_QWORD *)(a2 + 16) + 24 * a1);
result = *(unsigned __int8 *)v2;
if ( !(_BYTE)result )
return fputs(v2[1], stdout);
if ( (_BYTE)result == 1 )
result = fprintf(stdout, "%.*g", 6, *((double *)v2 + 1));
return result;
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1, __int64 a2)
{
const char **v2; // rdx
int result; // eax

v2 = (const char **)(*(_QWORD *)(a2 + 16) + 24 * a1);
result = *(unsigned __int8 *)v2;
if ( !(_BYTE)result )
return fputs(v2[1], stdout);
if ( (_BYTE)result == 1 )
result = fprintf(stdout, "%.*g", 6, *((double *)v2 + 1));
return result;
}

original_code:
void PrintLabel(ULONG index, LabelList *labelList)
{
   UCHAR labelType;
   labelType = labelList->labels[index].labelType;
   switch(labelType)
   {
      case 0:
         fprintf(stdout, "%s", labelList->labels[index].labelValue.stringLabel);
         break;
      case 1:
         fprintf(stdout, "%.*g", 6,
                 labelList->labels[index].labelValue.numericLabel);
         break;
      default:
         break;
   }
}

canonical_original_code:
void PrintLabel(unsigned long index, struct LabelList *labelList)
{
   unsigned char labelType;
   labelType = labelList->labels[index].labelType;
   switch(labelType)
   {
      case 0:
         fprintf(stdout, "%s", labelList->labels[index].labelValue.stringLabel);
         break;
      case 1:
         fprintf(stdout, "%.*g", 6,
                 labelList->labels[index].labelValue.numericLabel);
         break;
      default:
         break;
   }
}

variable_types:
labelType
unsigned char


PrintLabelList

decompiled_code:
int __fastcall PrintLabelList(__int64 a1)
{
int result; // eax
unsigned __int64 v3; // rbx
__int64 v4; // rdi

result = puts("Label list:");
if ( *(_QWORD *)(a1 + 8) )
{
v3 = 0LL;
do
{
printf(" labels[%lu] = ", v3);
v4 = v3++;
PrintLabel(v4, a1);
result = putchar(10);
}
while ( *(_QWORD *)(a1 + 8) > v3 );
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1)
{
int result; // eax
unsigned __int64 v3; // rbx
__int64 v4; // rdi

result = puts("Label list:");
if ( *(_QWORD *)(a1 + 8) )
{
v3 = 0LL;
do
{
printf(" labels[%lu] = ", v3);
v4 = v3++;
func5(v4, a1);
result = putchar(10);
}
while ( *(_QWORD *)(a1 + 8) > v3 );
}
return result;
}

original_code:
void PrintLabelList(LabelList *labelList)
{
   ULONG i;
   printf("Label list:\n");
   for (i = 0; i < labelList->numLabels; i++)
   {
      printf("  labels[%lu] = ", i);
      PrintLabel(i, labelList);
      printf("\n");
   }
}

canonical_original_code:
void PrintLabelList(struct LabelList *labelList)
{
   unsigned long i;
   printf("Label list:\n");
   for (i = 0; i < labelList->numLabels; i++)
   {
      printf("  labels[%lu] = ", i);
      PrintLabel(i, labelList);
      printf("\n");
   }
}

variable_types:
i
unsigned long


FreeLabelList

decompiled_code:
void __fastcall FreeLabelList(void *ptr)
{
free(*((void **)ptr + 2));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func7(void *ptr)
{
free(*((void **)ptr + 2));
free(ptr);
}

original_code:
void FreeLabelList(LabelList *labelList)
{
   free(labelList->labels);
   free(labelList);
}

canonical_original_code:
void FreeLabelList(struct LabelList *labelList)
{
   free(labelList->labels);
   free(labelList);
}


OutOfMemoryError

decompiled_code:
void __fastcall __noreturn OutOfMemoryError(const char *a1)
{
printf("ERROR: out of memory allocating %s.\n", a1);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func0(const char *a1)
{
printf("ERROR: out of memory allocating %s.\n", a1);
exit(1);
}

original_code:
void OutOfMemoryError(char *context)
{
   printf("ERROR: out of memory allocating %s.\n", context);
   exit(1);
}

variable_types:
context
char *


PrintBoolean

decompiled_code:
int __fastcall PrintBoolean(char a1)
{
int result; // eax

if ( a1 )
result = puts("true");
else
result = puts("false");
return result;
}

canonical_decompiled_code:
int __fastcall func1(char a1)
{
int result; // eax

if ( a1 )
result = puts("true");
else
result = puts("false");
return result;
}

original_code:
void PrintBoolean(BOOLEAN boolean)
{
   if (boolean)
      printf("true\n");
   else
      printf("false\n");
}

canonical_original_code:
void PrintBoolean(unsigned char boolean)
{
   if (boolean)
      printf("true\n");
   else
      printf("false\n");
}

variable_types:
boolean
unsigned char


GetInitialSubs

original_code:
SubList *GetInitialSubs(Parameters *parameters)
{
   SubList *initialSubs;
   ULONG i, j;
   ULONG vertexLabelIndex;
   ULONG numInitialSubs;
   Graph *g;
   Substructure *sub;
   Instance *instance;
   Graph *posGraph = parameters->posGraph;
   Graph *negGraph = parameters->negGraph;
   LabelList *labelList = parameters->labelList;
   ULONG outputLevel = parameters->outputLevel;
   ULONG currentIncrement = 0;
   ULONG startVertexIndex;
   if (parameters->incremental)
   {
      currentIncrement = GetCurrentIncrementNum(parameters);
      startVertexIndex = GetStartVertexIndex(currentIncrement, parameters, 1);
      if (parameters->outputLevel > 2)
         printf("Start vertex index = %lu\n", startVertexIndex);
   }
   else
      startVertexIndex = 0;
   for (i = 0; i < labelList->numLabels; i++)
      labelList->labels[i].used = 0;
   numInitialSubs = 0;
   initialSubs = AllocateSubList();
   for (i = startVertexIndex; i < posGraph->numVertices; i++)
   {
      vertexLabelIndex = posGraph->vertices[i].label;
      if (labelList->labels[vertexLabelIndex].used == 0)
      {
         labelList->labels[vertexLabelIndex].used = 1;
         g = AllocateGraph(1, 0);
         g->vertices[0].label = vertexLabelIndex;
         g->vertices[0].numEdges = 0;
         g->vertices[0].edges = ((void *)0);
         sub = AllocateSub();
         sub->definition = g;
         sub->instances = AllocateInstanceList();
         j = posGraph->numVertices;
         do
         {
            j--;
            if (posGraph->vertices[j].label == vertexLabelIndex)
            {
               instance = AllocateInstance(1, 0);
               instance->vertices[0] = j;
               instance->mapping[0].v1 = 0;
               instance->mapping[0].v2 = j;
               instance->minMatchCost = 0.0;
               InstanceListInsert(instance, sub->instances, 0);
               sub->numInstances++;
            }
         } while (j > i);
         if (sub->numInstances > 1)
         {
            if (negGraph != ((void *)0))
            {
               sub->negInstances = AllocateInstanceList();
               j = negGraph->numVertices;
               if (parameters->incremental)
                  startVertexIndex =
                     GetStartVertexIndex(currentIncrement, parameters, 1);
               else
                  startVertexIndex = 0;
               do
               {
                  j--;
                  if (negGraph->vertices[j].label == vertexLabelIndex)
                  {
                     instance = AllocateInstance(1, 0);
                     instance->vertices[0] = j;
                     instance->mapping[0].v1 = 0;
                     instance->mapping[0].v2 = j;
                     instance->minMatchCost = 0.0;
                     InstanceListInsert(instance, sub->negInstances, 0);
                     sub->numNegInstances++;
                  }
               } while (j > startVertexIndex);
            }
            EvaluateSub(sub, parameters);
            SubListInsert(sub, initialSubs, 0, 0, labelList);
            numInitialSubs++;
         }
         else
         {
            FreeSub(sub);
         }
      }
   }
   if (outputLevel > 1)
      printf("%lu initial substructures\n", numInitialSubs);
   return initialSubs;
}

canonical_original_code:
struct SubList *GetInitialSubs(struct Parameters *parameters)
{
   struct SubList *initialSubs;
   unsigned long i; unsigned long j;
   unsigned long vertexLabelIndex;
   unsigned long numInitialSubs;
   struct Graph *g;
   struct Substructure *sub;
   struct _instance *instance;
   struct Graph *posGraph = parameters->posGraph;
   struct Graph *negGraph = parameters->negGraph;
   struct LabelList *labelList = parameters->labelList;
   unsigned long outputLevel = parameters->outputLevel;
   unsigned long currentIncrement = 0;
   unsigned long startVertexIndex;
   if (parameters->incremental)
   {
      currentIncrement = GetCurrentIncrementNum(parameters);
      startVertexIndex = GetStartVertexIndex(currentIncrement, parameters, 1);
      if (parameters->outputLevel > 2)
         printf("Start vertex index = %lu\n", startVertexIndex);
   }
   else
      startVertexIndex = 0;
   for (i = 0; i < labelList->numLabels; i++)
      labelList->labels[i].used = 0;
   numInitialSubs = 0;
   initialSubs = AllocateSubList();
   for (i = startVertexIndex; i < posGraph->numVertices; i++)
   {
      vertexLabelIndex = posGraph->vertices[i].label;
      if (labelList->labels[vertexLabelIndex].used == 0)
      {
         labelList->labels[vertexLabelIndex].used = 1;
         g = AllocateGraph(1, 0);
         g->vertices[0].label = vertexLabelIndex;
         g->vertices[0].numEdges = 0;
         g->vertices[0].edges = ((void *)0);
         sub = AllocateSub();
         sub->definition = g;
         sub->instances = AllocateInstanceList();
         j = posGraph->numVertices;
         do
         {
            j--;
            if (posGraph->vertices[j].label == vertexLabelIndex)
            {
               instance = AllocateInstance(1, 0);
               instance->vertices[0] = j;
               instance->mapping[0].v1 = 0;
               instance->mapping[0].v2 = j;
               instance->minMatchCost = 0.0;
               InstanceListInsert(instance, sub->instances, 0);
               sub->numInstances++;
            }
         } while (j > i);
         if (sub->numInstances > 1)
         {
            if (negGraph != ((void *)0))
            {
               sub->negInstances = AllocateInstanceList();
               j = negGraph->numVertices;
               if (parameters->incremental)
                  startVertexIndex =
                     GetStartVertexIndex(currentIncrement, parameters, 1);
               else
                  startVertexIndex = 0;
               do
               {
                  j--;
                  if (negGraph->vertices[j].label == vertexLabelIndex)
                  {
                     instance = AllocateInstance(1, 0);
                     instance->vertices[0] = j;
                     instance->mapping[0].v1 = 0;
                     instance->mapping[0].v2 = j;
                     instance->minMatchCost = 0.0;
                     InstanceListInsert(instance, sub->negInstances, 0);
                     sub->numNegInstances++;
                  }
               } while (j > startVertexIndex);
            }
            EvaluateSub(sub, parameters);
            SubListInsert(sub, initialSubs, 0, 0, labelList);
            numInitialSubs++;
         }
         else
         {
            FreeSub(sub);
         }
      }
   }
   if (outputLevel > 1)
      printf("%lu initial substructures\n", numInitialSubs);
   return initialSubs;
}

variable_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *

variable_types: struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *

variable_types:
j
unsigned long

variable_types:
vertexLabelIndex
unsigned long

variable_types:
numInitialSubs
unsigned long

variable_types:
outputLevel
unsigned long

variable_types:
currentIncrement
unsigned long

variable_types:
startVertexIndex
unsigned long

user_defined_types: struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }

user_defined_types: struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }

user_defined_types: struct IncrementList { struct _increment_list_node *head; }

user_defined_types: struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }

user_defined_types: struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }


SinglePreviousSub

decompiled_code:
bool __fastcall SinglePreviousSub(__int64 a1, __int64 a2)
{
bool result; // al

if ( **(_QWORD **)a1 == 1LL )
result = SubLabelNumber(**(_QWORD **)(*(_QWORD *)a1 + 16LL), *(_QWORD *)(a2 + 1600)) != 0;
else
result = 0;
return result;
}

canonical_decompiled_code:
bool __fastcall func1(__int64 a1, __int64 a2)
{
bool result; // al

if ( **(_QWORD **)a1 == 1LL )
result = SubLabelNumber(**(_QWORD **)(*(_QWORD *)a1 + 16LL), *(_QWORD *)(a2 + 1600)) != 0;
else
result = 0;
return result;
}

original_code:
BOOLEAN SinglePreviousSub(Substructure *sub, Parameters *parameters)
{
   BOOLEAN match;
   LabelList *labelList = parameters->labelList;
   match = 0;
   if ((sub->definition->numVertices == 1) &&
       (SubLabelNumber (sub->definition->vertices[0].label, labelList) > 0))
      match = 1;
   return match;
}

canonical_original_code:
unsigned char SinglePreviousSub(struct Substructure *sub, struct Parameters *parameters)
{
   unsigned char match;
   struct LabelList *labelList = parameters->labelList;
   match = 0;
   if ((sub->definition->numVertices == 1) &&
       (SubLabelNumber (sub->definition->vertices[0].label, labelList) > 0))
      match = 1;
   return match;
}

variable_types: struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *

variable_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *

variable_types:
match
unsigned char

return_type: unsigned char


DiscoverSubs

original_code:
SubList *DiscoverSubs(Parameters *parameters)
{
   SubList *parentSubList;
   SubList *childSubList;
   SubList *extendedSubList;
   SubList *discoveredSubList;
   SubListNode *parentSubListNode;
   SubListNode *extendedSubListNode;
   Substructure *parentSub;
   Substructure *extendedSub;
   Substructure *recursiveSub = ((void *)0);
   ULONG limit = parameters->limit;
   ULONG numBestSubs = parameters->numBestSubs;
   ULONG beamWidth = parameters->beamWidth;
   BOOLEAN valueBased = parameters->valueBased;
   LabelList *labelList = parameters->labelList;
   BOOLEAN prune = parameters->prune;
   ULONG maxVertices = parameters->maxVertices;
   ULONG minVertices = parameters->minVertices;
   ULONG outputLevel = parameters->outputLevel;
   BOOLEAN recursion = parameters->recursion;
   ULONG evalMethod = parameters->evalMethod;
   parentSubList = GetInitialSubs(parameters);
   discoveredSubList = AllocateSubList();
   while ((limit > 0) && (parentSubList->head != ((void *)0)))
   {
      parentSubListNode = parentSubList->head;
      childSubList = AllocateSubList();
      while (parentSubListNode != ((void *)0))
      {
         parentSub = parentSubListNode->sub;
         parentSubListNode->sub = ((void *)0);
         if (outputLevel > 4)
         {
            parameters->outputLevel = 1;
            printf("\nConsidering ");
            PrintSub(parentSub, parameters);
            printf("\n");
            parameters->outputLevel = outputLevel;
         }
         if ((((parentSub->numInstances > 1) && (evalMethod != 3)) ||
              (parentSub->numNegInstances > 0)) &&
             (limit > 0))
         {
            limit--;
            if (outputLevel > 3)
               printf("%lu substructures left to be considered\n", limit);
            fflush(stdout);
            extendedSubList = ExtendSub(parentSub, parameters);
            extendedSubListNode = extendedSubList->head;
            while (extendedSubListNode != ((void *)0))
            {
               extendedSub = extendedSubListNode->sub;
               extendedSubListNode->sub = ((void *)0);
               if (extendedSub->definition->numVertices <= maxVertices)
               {
                  EvaluateSub(extendedSub, parameters);
                  if (prune && (extendedSub->value < parentSub->value))
                  {
                     FreeSub(extendedSub);
                  }
                  else
                  {
                     SubListInsert(extendedSub, childSubList, beamWidth,
                                   valueBased, labelList);
                  }
               }
               else
               {
                  FreeSub(extendedSub);
               }
               extendedSubListNode = extendedSubListNode->next;
            }
            FreeSubList(extendedSubList);
         }
         if (parentSub->definition->numVertices >= minVertices)
         {
            if (! SinglePreviousSub(parentSub, parameters))
            {
               if (recursion)
                  recursiveSub = RecursifySub(parentSub, parameters);
               if (outputLevel > 3)
                  PrintNewBestSub(parentSub, discoveredSubList, parameters);
               SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,
                             labelList);
               if (recursion && (recursiveSub != ((void *)0)))
               {
                  if (outputLevel > 4)
                  {
                     parameters->outputLevel = 1;
                     printf("\nConsidering Recursive ");
                     PrintSub(recursiveSub, parameters);
                     printf ("\n");
                     parameters->outputLevel = outputLevel;
                  }
                  if (outputLevel > 3)
                     PrintNewBestSub(recursiveSub, discoveredSubList, parameters);
                  SubListInsert(recursiveSub, discoveredSubList, numBestSubs,
                                0, labelList);
               }
            }
         }
         else
         {
            FreeSub (parentSub);
         }
         parentSubListNode = parentSubListNode->next;
      }
      FreeSubList(parentSubList);
      parentSubList = childSubList;
   }
   if ((limit > 0) && (outputLevel > 2))
      printf ("\nSubstructure queue empty.\n");
   parentSubListNode = parentSubList->head;
   while (parentSubListNode != ((void *)0))
   {
      parentSub = parentSubListNode->sub;
      parentSubListNode->sub = ((void *)0);
      if (parentSub->definition->numVertices >= minVertices)
      {
         if (! SinglePreviousSub(parentSub, parameters))
         {
            if (outputLevel > 3)
               PrintNewBestSub(parentSub, discoveredSubList, parameters);
            SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,
                          labelList);
         }
      }
      else
      {
         FreeSub(parentSub);
      }
      parentSubListNode = parentSubListNode->next;
   }
   FreeSubList(parentSubList);
   return discoveredSubList;
}

canonical_original_code:
struct SubList *DiscoverSubs(struct Parameters *parameters)
{
   struct SubList *parentSubList;
   struct SubList *childSubList;
   struct SubList *extendedSubList;
   struct SubList *discoveredSubList;
   struct _sub_list_node *parentSubListNode;
   struct _sub_list_node *extendedSubListNode;
   struct Substructure *parentSub;
   struct Substructure *extendedSub;
   struct Substructure *recursiveSub = ((void *)0);
   unsigned long limit = parameters->limit;
   unsigned long numBestSubs = parameters->numBestSubs;
   unsigned long beamWidth = parameters->beamWidth;
   unsigned char valueBased = parameters->valueBased;
   struct LabelList *labelList = parameters->labelList;
   unsigned char prune = parameters->prune;
   unsigned long maxVertices = parameters->maxVertices;
   unsigned long minVertices = parameters->minVertices;
   unsigned long outputLevel = parameters->outputLevel;
   unsigned char recursion = parameters->recursion;
   unsigned long evalMethod = parameters->evalMethod;
   parentSubList = GetInitialSubs(parameters);
   discoveredSubList = AllocateSubList();
   while ((limit > 0) && (parentSubList->head != ((void *)0)))
   {
      parentSubListNode = parentSubList->head;
      childSubList = AllocateSubList();
      while (parentSubListNode != ((void *)0))
      {
         parentSub = parentSubListNode->sub;
         parentSubListNode->sub = ((void *)0);
         if (outputLevel > 4)
         {
            parameters->outputLevel = 1;
            printf("\nConsidering ");
            PrintSub(parentSub, parameters);
            printf("\n");
            parameters->outputLevel = outputLevel;
         }
         if ((((parentSub->numInstances > 1) && (evalMethod != 3)) ||
              (parentSub->numNegInstances > 0)) &&
             (limit > 0))
         {
            limit--;
            if (outputLevel > 3)
               printf("%lu substructures left to be considered\n", limit);
            fflush(stdout);
            extendedSubList = ExtendSub(parentSub, parameters);
            extendedSubListNode = extendedSubList->head;
            while (extendedSubListNode != ((void *)0))
            {
               extendedSub = extendedSubListNode->sub;
               extendedSubListNode->sub = ((void *)0);
               if (extendedSub->definition->numVertices <= maxVertices)
               {
                  EvaluateSub(extendedSub, parameters);
                  if (prune && (extendedSub->value < parentSub->value))
                  {
                     FreeSub(extendedSub);
                  }
                  else
                  {
                     SubListInsert(extendedSub, childSubList, beamWidth,
                                   valueBased, labelList);
                  }
               }
               else
               {
                  FreeSub(extendedSub);
               }
               extendedSubListNode = extendedSubListNode->next;
            }
            FreeSubList(extendedSubList);
         }
         if (parentSub->definition->numVertices >= minVertices)
         {
            if (! SinglePreviousSub(parentSub, parameters))
            {
               if (recursion)
                  recursiveSub = RecursifySub(parentSub, parameters);
               if (outputLevel > 3)
                  PrintNewBestSub(parentSub, discoveredSubList, parameters);
               SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,
                             labelList);
               if (recursion && (recursiveSub != ((void *)0)))
               {
                  if (outputLevel > 4)
                  {
                     parameters->outputLevel = 1;
                     printf("\nConsidering Recursive ");
                     PrintSub(recursiveSub, parameters);
                     printf ("\n");
                     parameters->outputLevel = outputLevel;
                  }
                  if (outputLevel > 3)
                     PrintNewBestSub(recursiveSub, discoveredSubList, parameters);
                  SubListInsert(recursiveSub, discoveredSubList, numBestSubs,
                                0, labelList);
               }
            }
         }
         else
         {
            FreeSub (parentSub);
         }
         parentSubListNode = parentSubListNode->next;
      }
      FreeSubList(parentSubList);
      parentSubList = childSubList;
   }
   if ((limit > 0) && (outputLevel > 2))
      printf ("\nSubstructure queue empty.\n");
   parentSubListNode = parentSubList->head;
   while (parentSubListNode != ((void *)0))
   {
      parentSub = parentSubListNode->sub;
      parentSubListNode->sub = ((void *)0);
      if (parentSub->definition->numVertices >= minVertices)
      {
         if (! SinglePreviousSub(parentSub, parameters))
         {
            if (outputLevel > 3)
               PrintNewBestSub(parentSub, discoveredSubList, parameters);
            SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,
                          labelList);
         }
      }
      else
      {
         FreeSub(parentSub);
      }
      parentSubListNode = parentSubListNode->next;
   }
   FreeSubList(parentSubList);
   return discoveredSubList;
}

variable_types:
limit
unsigned long

variable_types:
numBestSubs
unsigned long

variable_types:
beamWidth
unsigned long

variable_types:
valueBased
unsigned char

variable_types: struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *

variable_types:
prune
unsigned char

variable_types:
maxVertices
unsigned long

variable_types:
minVertices
unsigned long

variable_types:
recursion
unsigned char

variable_types:
evalMethod
unsigned long

return_type: struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *

user_defined_types: struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }

user_defined_types: struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }


PrintMapping

decompiled_code:
void __fastcall PrintMapping(__int64 *a1, __int64 a2)
{
_QWORD *v3; // rbp
__int64 *v4; // rcx
__int64 v5; // rax
__int64 v6; // rdx
__int64 v7; // rbx
__int64 v8; // rsi

v3 = malloc(8 * a2);
if ( !v3 )
OutOfMemoryError("sortedMapping");
if ( a2 )
{
v4 = &a1[2 * a2];
do
{
v5 = *a1;
v6 = a1[1];
a1 += 2;
v3[v5] = v6;
}
while ( v4 != a1 );
v7 = 0LL;
puts("Mapping (vertices of larger graph to smaller):");
while ( 1 )
{
printf(" %lu -> ", ++v7);
v8 = v3[v7 - 1];
if ( v8 == -2 )
break;
if ( v8 == -1 )
{
puts("unmapped");
if ( v7 == a2 )
{
LABEL_12:
free(v3);
return;
}
}
else
{
printf("%lu\n", v8 + 1);
LABEL_8:
if ( v7 == a2 )
goto LABEL_12;
}
}
puts("deleted");
goto LABEL_8;
}
puts("Mapping (vertices of larger graph to smaller):");
free(v3);
}

canonical_decompiled_code:
void __fastcall func0(__int64 *a1, __int64 a2)
{
_QWORD *v3; // rbp
__int64 *v4; // rcx
__int64 v5; // rax
__int64 v6; // rdx
__int64 v7; // rbx
__int64 v8; // rsi

v3 = malloc(8 * a2);
if ( !v3 )
OutOfMemoryError("sortedMapping");
if ( a2 )
{
v4 = &a1[2 * a2];
do
{
v5 = *a1;
v6 = a1[1];
a1 += 2;
v3[v5] = v6;
}
while ( v4 != a1 );
v7 = 0LL;
puts("Mapping (vertices of larger graph to smaller):");
while ( 1 )
{
printf(" %lu -> ", ++v7);
v8 = v3[v7 - 1];
if ( v8 == -2 )
break;
if ( v8 == -1 )
{
puts("unmapped");
if ( v7 == a2 )
{
LABEL_12:
free(v3);
return;
}
}
else
{
printf("%lu\n", v8 + 1);
LABEL_8:
if ( v7 == a2 )
goto LABEL_12;
}
}
puts("deleted");
goto LABEL_8;
}
puts("Mapping (vertices of larger graph to smaller):");
free(v3);
}

original_code:
void PrintMapping(VertexMap *mapping, ULONG numVertices)
{
   ULONG *sortedMapping;
   ULONG i;
   sortedMapping = (ULONG *) malloc(sizeof(ULONG) * numVertices);
   if (sortedMapping == ((void *)0))
      OutOfMemoryError("sortedMapping");
   for (i = 0; i < numVertices; i++)
      sortedMapping[mapping[i].v1] = mapping[i].v2;
   printf("Mapping (vertices of larger graph to smaller):\n");
   for (i = 0; i < numVertices; i++)
   {
      printf("  %lu -> ", i+1);
      if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL) - 1)
         printf("deleted\n");
      else if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL))
         printf("unmapped\n");
      else
         printf("%lu\n", sortedMapping[i] + 1);
   }
   free(sortedMapping);
}

canonical_original_code:
void PrintMapping(struct VertexMap *mapping, unsigned long numVertices)
{
   unsigned long *sortedMapping;
   unsigned long i;
   sortedMapping = (unsigned long *) malloc(sizeof(ULONG) * numVertices);
   if (sortedMapping == ((void *)0))
      OutOfMemoryError("sortedMapping");
   for (i = 0; i < numVertices; i++)
      sortedMapping[mapping[i].v1] = mapping[i].v2;
   printf("Mapping (vertices of larger graph to smaller):\n");
   for (i = 0; i < numVertices; i++)
   {
      printf("  %lu -> ", i+1);
      if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL) - 1)
         printf("deleted\n");
      else if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL))
         printf("unmapped\n");
      else
         printf("%lu\n", sortedMapping[i] + 1);
   }
   free(sortedMapping);
}

variable_types: struct VertexMap { unsigned long v1; unsigned long v2; } *

variable_types:
numVertices
unsigned long

variable_types:
sortedMapping
unsigned long *

variable_types:
i
unsigned long


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12
__int64 *v4; // r13
__int64 *v5; // rax
__int64 v6; // r15
__int64 *v7; // r14
double v8; // xmm0_8
__int64 *v9; // rbp

if ( argc != 3 )
{
fprintf(stderr, "usage: %s <graph file> <graph file>\n", *argv);
exit(1);
}
v3 = AllocateLabelList(argc, argv, envp);
v4 = (__int64 *)ReadGraph(argv[1], v3, 1LL);
v5 = (__int64 *)ReadGraph(argv[2], v3, 1LL);
v6 = *v5;
v7 = v5;
if ( *v4 < (unsigned __int64)*v5 )
{
v8 = *(double *)&LC7;
v9 = (__int64 *)malloc(16 * v6);
InexactGraphMatch(v7, v4, v3, v9, 1.797693134862316e308);
}
else
{
v6 = *v4;
v8 = *(double *)&LC7;
v9 = (__int64 *)malloc(16 * *v4);
InexactGraphMatch(v4, v7, v3, v9, 1.797693134862316e308);
}
printf("Match Cost = %f\n", v8);
PrintMapping(v9, v6);
free(v9);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12
__int64 *v4; // r13
__int64 *v5; // rax
__int64 v6; // r15
__int64 *v7; // r14
double v8; // xmm0_8
__int64 *v9; // rbp

if ( argc != 3 )
{
fprintf(stderr, "usage: %s <graph file> <graph file>\n", *argv);
exit(1);
}
v3 = AllocateLabelList(argc, argv, envp);
v4 = (__int64 *)ReadGraph(argv[1], v3, 1LL);
v5 = (__int64 *)ReadGraph(argv[2], v3, 1LL);
v6 = *v5;
v7 = v5;
if ( *v4 < (unsigned __int64)*v5 )
{
v8 = *(double *)&LC7;
v9 = (__int64 *)malloc(16 * v6);
InexactGraphMatch(v7, v4, v3, v9, 1.797693134862316e308);
}
else
{
v6 = *v4;
v8 = *(double *)&LC7;
v9 = (__int64 *)malloc(16 * *v4);
InexactGraphMatch(v4, v7, v3, v9, 1.797693134862316e308);
}
printf("Match Cost = %f\n", v8);
func0(v9, v6);
free(v9);
return 0;
}

original_code:
int main(int argc, char **argv)
{
   Graph *g1, *g2;
   LabelList *labelList = ((void *)0);
   BOOLEAN directed = 1;
   ULONG maxVertices;
   VertexMap *mapping;
   double matchCost;
   if (argc != 3)
   {
      fprintf(stderr, "usage: %s <graph file> <graph file>\n", argv[0]);
      exit(1);
   }
   labelList = AllocateLabelList();
   g1 = ReadGraph(argv[1], labelList, directed);
   g2 = ReadGraph(argv[2], labelList, directed);
   if (g1->numVertices < g2->numVertices)
   {
      maxVertices = g2->numVertices;
      mapping = (VertexMap *) malloc(sizeof(VertexMap) * maxVertices);
      matchCost = InexactGraphMatch(g2, g1, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);
   }
   else
   {
      maxVertices = g1->numVertices;
      mapping = (VertexMap *) malloc(sizeof(VertexMap) * maxVertices);
      matchCost = InexactGraphMatch(g1, g2, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);
   }
   printf("Match Cost = %f\n", matchCost);
   PrintMapping(mapping, maxVertices);
   free(mapping);
   return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
   struct Graph *g1; struct Graph *g2;
   struct LabelList *labelList = ((void *)0);
   unsigned char directed = 1;
   unsigned long maxVertices;
   struct VertexMap *mapping;
   double matchCost;
   if (argc != 3)
   {
      fprintf(stderr, "usage: %s <graph file> <graph file>\n", argv[0]);
      exit(1);
   }
   labelList = AllocateLabelList();
   g1 = ReadGraph(argv[1], labelList, directed);
   g2 = ReadGraph(argv[2], labelList, directed);
   if (g1->numVertices < g2->numVertices)
   {
      maxVertices = g2->numVertices;
      mapping = (struct VertexMap *) malloc(sizeof(VertexMap) * maxVertices);
      matchCost = InexactGraphMatch(g2, g1, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);
   }
   else
   {
      maxVertices = g1->numVertices;
      mapping = (struct VertexMap *) malloc(sizeof(VertexMap) * maxVertices);
      matchCost = InexactGraphMatch(g1, g2, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);
   }
   printf("Match Cost = %f\n", matchCost);
   PrintMapping(mapping, maxVertices);
   free(mapping);
   return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *

variable_types:
directed
unsigned char

variable_types: matchCost double

return_type: int

user_defined_types: struct VertexMap { unsigned long v1; unsigned long v2; }

user_defined_types: struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }


AdjustMetrics

decompiled_code:
__int64 __fastcall AdjustMetrics(__int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
double v5; // r14
__int64 result; // rax
double v7; // xmm0_8
bool v8; // zf
__int64 v9; // rax
__int64 v10; // rax
double v11; // xmm3_8
double v12; // xmm2_8
double v13; // xmm0_8
unsigned __int64 v14; // rdx
unsigned __int64 v15; // rdx
double v16; // [rsp+0h] [rbp-28h]

GetCurrentIncrement(a2);
v2 = GraphSize(*(_QWORD *)a1);
if ( v2 < 0 )
v16 = (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1)) + (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1));
else
v16 = (double)(int)v2;
v3 = GetCurrentIncrementNum(a2);
v4 = IncrementSize(a2, v3, 1LL);
if ( v4 < 0 )
v5 = (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1)) + (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1));
else
v5 = (double)(int)v4;
result = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1536), *(_QWORD *)(a1 + 24), a2, 1LL);
if ( result < 0 )
{
v14 = result;
result &= 1u;
v7 = (double)(int)(result | (v14 >> 1)) + (double)(int)(result | (v14 >> 1));
}
else
{
v7 = (double)(int)result;
}
*(double *)(a1 + 80) = v7;
v8 = *(_QWORD *)(a2 + 1544) == 0LL;
*(double *)(a1 + 56) = v5 / (v7 + v16);
if ( !v8 )
{
v9 = GetCurrentIncrementNum(a2);
v10 = IncrementSize(a2, v9, 0LL);
if ( v10 < 0 )
{
v13 = (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1));
v11 = v13 + v13;
}
else
{
v11 = (double)(int)v10;
}
result = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1544), *(_QWORD *)(a1 + 24), a2, 0LL);
if ( result < 0 )
{
v15 = result;
result &= 1u;
v12 = (double)(int)(result | (v15 >> 1)) + (double)(int)(result | (v15 >> 1));
}
else
{
v12 = (double)(int)result;
}
*(double *)(a1 + 88) = v12;
*(double *)(a1 + 56) = (v5 + v11) / (v16 + v12 + v11 - v12);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
double v5; // r14
__int64 result; // rax
double v7; // xmm0_8
bool v8; // zf
__int64 v9; // rax
__int64 v10; // rax
double v11; // xmm3_8
double v12; // xmm2_8
double v13; // xmm0_8
unsigned __int64 v14; // rdx
unsigned __int64 v15; // rdx
double v16; // [rsp+0h] [rbp-28h]

GetCurrentIncrement(a2);
v2 = GraphSize(*(_QWORD *)a1);
if ( v2 < 0 )
v16 = (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1)) + (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1));
else
v16 = (double)(int)v2;
v3 = GetCurrentIncrementNum(a2);
v4 = IncrementSize(a2, v3, 1LL);
if ( v4 < 0 )
v5 = (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1)) + (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1));
else
v5 = (double)(int)v4;
result = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1536), *(_QWORD *)(a1 + 24), a2, 1LL);
if ( result < 0 )
{
v14 = result;
result &= 1u;
v7 = (double)(int)(result | (v14 >> 1)) + (double)(int)(result | (v14 >> 1));
}
else
{
v7 = (double)(int)result;
}
*(double *)(a1 + 80) = v7;
v8 = *(_QWORD *)(a2 + 1544) == 0LL;
*(double *)(a1 + 56) = v5 / (v7 + v16);
if ( !v8 )
{
v9 = GetCurrentIncrementNum(a2);
v10 = IncrementSize(a2, v9, 0LL);
if ( v10 < 0 )
{
v13 = (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1));
v11 = v13 + v13;
}
else
{
v11 = (double)(int)v10;
}
result = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1544), *(_QWORD *)(a1 + 24), a2, 0LL);
if ( result < 0 )
{
v15 = result;
result &= 1u;
v12 = (double)(int)(result | (v15 >> 1)) + (double)(int)(result | (v15 >> 1));
}
else
{
v12 = (double)(int)result;
}
*(double *)(a1 + 88) = v12;
*(double *)(a1 + 56) = (v5 + v11) / (v16 + v12 + v11 - v12);
}
return result;
}

original_code:
void AdjustMetrics(Substructure *sub, Parameters *parameters)
{
   double sizeOfPosIncrement = 0.0;
   double sizeOfNegIncrement = 0.0;
   double sizeOfSub = 0.0;
   Increment *increment;
   increment = GetCurrentIncrement(parameters);
   sizeOfSub = (double) GraphSize(sub->definition);
   sizeOfPosIncrement = (double) IncrementSize(parameters,
                                       GetCurrentIncrementNum(parameters), 1);
   sub->posIncrementValue = (double) SizeOfCompressedGraph(parameters->posGraph,
                                               sub->instances, parameters, 1);
   sub->value = sizeOfPosIncrement / (sizeOfSub + sub->posIncrementValue);
   if (parameters->negGraph != ((void *)0))
   {
      sizeOfNegIncrement = (double) IncrementSize(parameters,
                                       GetCurrentIncrementNum(parameters), 0);
      sub->negIncrementValue =
                      (double) SizeOfCompressedGraph(parameters->negGraph,
                                  sub->instances, parameters, 0);
      sub->value = (sizeOfPosIncrement + sizeOfNegIncrement) /
                   (sizeOfSub + sub->negIncrementValue +
                    sizeOfNegIncrement - sub->negIncrementValue);
   }
}

canonical_original_code:
void AdjustMetrics(struct Substructure *sub, struct Parameters *parameters)
{
   double sizeOfPosIncrement = 0.0;
   double sizeOfNegIncrement = 0.0;
   double sizeOfSub = 0.0;
   struct _increment *increment;
   increment = GetCurrentIncrement(parameters);
   sizeOfSub = (double) GraphSize(sub->definition);
   sizeOfPosIncrement = (double) IncrementSize(parameters,
                                       GetCurrentIncrementNum(parameters), 1);
   sub->posIncrementValue = (double) SizeOfCompressedGraph(parameters->posGraph,
                                               sub->instances, parameters, 1);
   sub->value = sizeOfPosIncrement / (sizeOfSub + sub->posIncrementValue);
   if (parameters->negGraph != ((void *)0))
   {
      sizeOfNegIncrement = (double) IncrementSize(parameters,
                                       GetCurrentIncrementNum(parameters), 0);
      sub->negIncrementValue =
                      (double) SizeOfCompressedGraph(parameters->negGraph,
                                  sub->instances, parameters, 0);
      sub->value = (sizeOfPosIncrement + sizeOfNegIncrement) /
                   (sizeOfSub + sub->negIncrementValue +
                    sizeOfNegIncrement - sub->negIncrementValue);
   }
}

variable_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *

variable_types: sizeOfPosIncrement double

variable_types: sizeOfNegIncrement double

variable_types: sizeOfSub double

variable_types: struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *

user_defined_types: struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }

user_defined_types: struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }

user_defined_types: struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }

user_defined_types: struct InstanceVertexList { struct AvlTreeList *avlTreeList; }