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

if ( a1 )
{
number_meta_rule(*a1);
number_meta_rules(a1[1]);
result = number_meta_rules(a1[2]);
}
return result;
}

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

if ( a1 )
{
func6(*a1);
func7(a1[1]);
result = func7(a1[2]);
}
return result;
}

original_code:
static void number_meta_rules (meta_tree root)
 { if (root == ((meta_tree) ((void *)0))) return;
   number_meta_rule (root -> node);
   number_meta_rules (root -> left);
   number_meta_rules (root -> right);
 }

canonical_original_code:
static void number_meta_rules(struct meta_tree_rec *root)
 { if (root == ((meta_tree) ((void *)0))) return;
   number_meta_rule (root -> node);
   number_meta_rules (root -> left);
   number_meta_rules (root -> right);
 }

variable_types: struct meta_tree_rec { struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec *lat_repr; int needs_rec; int needs_recbup; } *node; struct meta_tree_rec *left; struct meta_tree_rec *right; } *

user_defined_types: struct meta_tree_rec { struct meta_rule_rec *node; struct meta_tree_rec *left; struct meta_tree_rec *right; }

user_defined_types: struct element_rec { char *eltnm; struct element_def_rec *def; }


repo: tjordanchat/eag

decompiled_code:
__int64 __fastcall number_element(__int64 a1)
{
int v1; // eax
__int64 result; // rax

v1 = nr_of_elements;
*(_DWORD *)(a1 + 8) = nr_of_elements;
result = (unsigned int)(v1 + 1);
nr_of_elements = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
int v1; // eax
__int64 result; // rax

v1 = nr_of_elements;
*(_DWORD *)(a1 + 8) = nr_of_elements;
result = (unsigned int)(v1 + 1);
nr_of_elements = result;
return result;
}

original_code:
static void number_element (element_def node)
 { node -> number = nr_of_elements;
   nr_of_elements++;
 }

canonical_original_code:
static void number_element(struct element_def_rec *node)
 { node -> number = nr_of_elements;
   nr_of_elements++;
 }

variable_types: struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *

return_type: void

user_defined_types: struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec *set; }

user_defined_types: struct element_set_rec { int number; struct element_def_list_rec *defs; }


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

if ( a1 )
{
number_element(*a1);
number_elements(a1[1]);
result = number_elements(a1[2]);
}
return result;
}

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

if ( a1 )
{
func8(*a1);
func9(a1[1]);
result = func9(a1[2]);
}
return result;
}

original_code:
static void number_elements (element_tree root)
 { if (root == ((element_tree) ((void *)0))) return;
   number_element (root -> node);
   number_elements (root -> left);
   number_elements (root -> right);
 }

canonical_original_code:
static void number_elements(struct element_tree_rec *root)
 { if (root == ((element_tree) ((void *)0))) return;
   number_element (root -> node);
   number_elements (root -> left);
   number_elements (root -> right);
 }

variable_types: struct element_tree_rec { struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *node; struct element_tree_rec *left; struct element_tree_rec *right; } *

user_defined_types: struct element_tree_rec { struct element_def_rec *node; struct element_tree_rec *left; struct element_tree_rec *right; }


decompiled_code:
__int64 __fastcall put_member_in_row(__int64 a1)
{
__int64 result; // rax

result = all_members;
*(_QWORD *)(all_members + 8LL * *(int *)(a1 + 16)) = a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1)
{
__int64 result; // rax

result = all_members;
*(_QWORD *)(all_members + 8LL * *(int *)(a1 + 16)) = a1;
return result;
}

original_code:
static void put_member_in_row (member m)
 { all_members [m -> number] = m;
 }

canonical_original_code:
static void put_member_in_row(struct member_rec *m)
 { all_members [m -> number] = m;
 }

variable_types: struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct rule_rec { char *nonterminal; struct alt_list_rec { int size; int room; struct alt_rec { struct pos_list_rec *display; struct member_list_rec { int size; int room; struct member_rec **array; } *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } **array; } *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } *

user_defined_types: struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec call; char *terminal; struct semiterminal_rec semi; } u; }

user_defined_types: struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec *def; }

user_defined_types: struct pos_list_rec { int size; int room; struct pos_rec **array; }

user_defined_types: struct rule_rec { char *nonterminal; struct alt_list_rec *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec *rev_tree; }

user_defined_types: struct alt_list_rec { int size; int room; struct alt_rec **array; }

user_defined_types: struct lextree_rec { char *remainder; struct lexend_list_rec *prods; struct lextree_list_rec *tails; }

user_defined_types: struct pos_rec { int kind; struct expr_rec *ex; int type; struct element_def_rec *lat_repr; }

user_defined_types: struct lexend_list_rec { int size; int room; struct lexend_rec **array; }

user_defined_types: struct expr_rec { int tag; union { struct affix_rec *single; struct affix_list_rec *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; }

user_defined_types: struct alt_rec { struct pos_list_rec *display; struct member_list_rec *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; }

user_defined_types: struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec *val; int ref_count; int reachable; int tag; union { struct variable_rec var; char *str; int inum; double rnum; struct cset_rec *semi; struct element_rec elt; struct expr_rec *cexpr; } u; }

user_defined_types: struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec *tuple; int slat; struct int_list_rec *elat; struct value_rec *free; } u; }

user_defined_types: struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; }

user_defined_types: struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec *lat_repr; int needs_rec; int needs_recbup; }

user_defined_types: struct meta_alt_list_rec { int size; int room; struct meta_alt_rec **array; }


decompiled_code:
__int64 __fastcall put_alt_in_row(__int64 a1)
{
__int64 v1; // rbp
__int64 result; // rax
__int64 v3; // rbx

v1 = *(_QWORD *)(a1 + 8);
result = all_alts;
*(_QWORD *)(all_alts + 8LL * *(int *)(a1 + 16)) = a1;
if ( v1 && *(int *)v1 > 0 )
{
v3 = 0LL;
do
result = put_member_in_row(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v3++));
while ( *(_DWORD *)v1 > (int)v3 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1)
{
__int64 v1; // rbp
__int64 result; // rax
__int64 v3; // rbx

v1 = *(_QWORD *)(a1 + 8);
result = all_alts;
*(_QWORD *)(all_alts + 8LL * *(int *)(a1 + 16)) = a1;
if ( v1 && *(int *)v1 > 0 )
{
v3 = 0LL;
do
result = func10(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v3++));
while ( *(_DWORD *)v1 > (int)v3 );
}
return result;
}

original_code:
static void put_alt_in_row (alt a)
 { int ix;
   member_list mems = a -> members;
   all_alts [a -> number] = a;
   if (mems == ((member_list) ((void *)0))) return;
   for (ix = 0; ix < mems -> size; ix++)
      put_member_in_row (mems -> array[ix]);
 }

canonical_original_code:
static void put_alt_in_row(struct alt_rec *a)
 { int ix;
   struct member_list_rec *mems = a -> members;
   all_alts [a -> number] = a;
   if (mems == ((member_list) ((void *)0))) return;
   for (ix = 0; ix < mems -> size; ix++)
      put_member_in_row (mems -> array[ix]);
 }

variable_types: struct alt_rec { struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct member_list_rec { int size; int room; struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec { char *nonterminal; struct alt_list_rec { int size; int room; struct alt_rec **array; } *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } **array; } *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } *

variable_types: ix int

variable_types: struct member_list_rec { int size; int room; struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct rule_rec { char *nonterminal; struct alt_list_rec { int size; int room; struct alt_rec { struct pos_list_rec *display; struct member_list_rec *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } **array; } *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } **array; } *

user_defined_types: struct member_list_rec { int size; int room; struct member_rec **array; }

user_defined_types: struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec *set; }

user_defined_types: struct element_set_rec { int number; struct element_def_list_rec *defs; }


decompiled_code:
__int64 __fastcall put_rule_in_row(__int64 a1)
{
__int64 v1; // rbp
__int64 result; // rax
__int64 v3; // rbx

v1 = *(_QWORD *)(a1 + 8);
result = all_rules;
*(_QWORD *)(all_rules + 8LL * *(int *)(a1 + 32)) = a1;
if ( *(int *)v1 > 0 )
{
v3 = 0LL;
do
result = put_alt_in_row(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v3++));
while ( *(_DWORD *)v1 > (int)v3 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
__int64 v1; // rbp
__int64 result; // rax
__int64 v3; // rbx

v1 = *(_QWORD *)(a1 + 8);
result = all_rules;
*(_QWORD *)(all_rules + 8LL * *(int *)(a1 + 32)) = a1;
if ( *(int *)v1 > 0 )
{
v3 = 0LL;
do
result = func11(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v3++));
while ( *(_DWORD *)v1 > (int)v3 );
}
return result;
}

original_code:
static void put_rule_in_row (rule srule)
 { int ix;
   alt_list alts = srule -> alts;
   all_rules [srule -> number] = srule;
   for (ix = 0; ix < alts -> size; ix++)
      put_alt_in_row (alts -> array[ix]);
 }

canonical_original_code:
static void put_rule_in_row(struct rule_rec *srule)
 { int ix;
   struct alt_list_rec *alts = srule -> alts;
   all_rules [srule -> number] = srule;
   for (ix = 0; ix < alts -> size; ix++)
      put_alt_in_row (alts -> array[ix]);
 }

variable_types: struct rule_rec { char *nonterminal; struct alt_list_rec { int size; int room; struct alt_rec { struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct member_list_rec { int size; int room; struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } **array; } *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } **array; } *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *

variable_types: struct alt_list_rec { int size; int room; struct alt_rec { struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct member_list_rec { int size; int room; struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec { char *nonterminal; struct alt_list_rec *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } **array; } *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } **array; } *

user_defined_types: struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec call; char *terminal; struct semiterminal_rec semi; } u; }


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

if ( a1 )
{
put_rule_in_row(*a1);
put_rules_in_row(a1[1]);
result = put_rules_in_row(a1[2]);
}
return result;
}

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

if ( a1 )
{
func12(*a1);
func13(a1[1]);
result = func13(a1[2]);
}
return result;
}

original_code:
static void put_rules_in_row (rule_tree root)
 { if (root == ((rule_tree) ((void *)0))) return;
   put_rule_in_row (root -> node);
   put_rules_in_row (root -> left);
   put_rules_in_row (root -> right);
 }

canonical_original_code:
static void put_rules_in_row(struct rule_tree_rec *root)
 { if (root == ((rule_tree) ((void *)0))) return;
   put_rule_in_row (root -> node);
   put_rules_in_row (root -> left);
   put_rules_in_row (root -> right);
 }

variable_types: struct rule_tree_rec { struct rule_rec { char *nonterminal; struct alt_list_rec { int size; int room; struct alt_rec { struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct member_list_rec { int size; int room; struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } **array; } *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } **array; } *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *node; struct rule_tree_rec *left; struct rule_tree_rec *right; } *

user_defined_types: struct rule_tree_rec { struct rule_rec *node; struct rule_tree_rec *left; struct rule_tree_rec *right; }

user_defined_types: struct pos_list_rec { int size; int room; struct pos_rec **array; }


decompiled_code:
__int64 __fastcall put_meta_alt_in_row(__int64 a1)
{
__int64 result; // rax

result = all_meta_alts;
*(_QWORD *)(all_meta_alts + 8LL * *(int *)(a1 + 8)) = a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1)
{
__int64 result; // rax

result = all_meta_alts;
*(_QWORD *)(all_meta_alts + 8LL * *(int *)(a1 + 8)) = a1;
return result;
}

original_code:
static void put_meta_alt_in_row (meta_alt a)
 { all_meta_alts [a -> number] = a;
 }

canonical_original_code:
static void put_meta_alt_in_row(struct meta_alt_rec *a)
 { all_meta_alts [a -> number] = a;
 }

variable_types: struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } *

user_defined_types: struct meta_alt_rec { struct expr_rec *e; int number; }


decompiled_code:
__int64 __fastcall put_meta_rule_in_row(__int64 a1)
{
__int64 v1; // rbp
__int64 result; // rax
__int64 v3; // rbx

v1 = *(_QWORD *)(a1 + 8);
result = all_meta_rules;
*(_QWORD *)(all_meta_rules + 8LL * *(int *)(a1 + 32)) = a1;
if ( v1 && *(int *)v1 > 0 )
{
v3 = 0LL;
do
result = put_meta_alt_in_row(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v3++));
while ( *(_DWORD *)v1 > (int)v3 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
__int64 v1; // rbp
__int64 result; // rax
__int64 v3; // rbx

v1 = *(_QWORD *)(a1 + 8);
result = all_meta_rules;
*(_QWORD *)(all_meta_rules + 8LL * *(int *)(a1 + 32)) = a1;
if ( v1 && *(int *)v1 > 0 )
{
v3 = 0LL;
do
result = func14(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v3++));
while ( *(_DWORD *)v1 > (int)v3 );
}
return result;
}

original_code:
static void put_meta_rule_in_row (meta_rule rule)
 { int ix;
   meta_alt_list alts = rule -> alts;
   all_meta_rules [rule -> number] = rule;
   if (alts == ((meta_alt_list) ((void *)0))) return;
   for (ix = 0; ix < alts -> size; ix++)
      put_meta_alt_in_row (alts -> array[ix]);
 }

canonical_original_code:
static void put_meta_rule_in_row(struct meta_rule_rec *rule)
 { int ix;
   struct meta_alt_list_rec *alts = rule -> alts;
   all_meta_rules [rule -> number] = rule;
   if (alts == ((meta_alt_list) ((void *)0))) return;
   for (ix = 0; ix < alts -> size; ix++)
      put_meta_alt_in_row (alts -> array[ix]);
 }

variable_types: struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec *lat_repr; int needs_rec; int needs_recbup; } *

variable_types: struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } **array; } *


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

if ( a1 )
{
put_meta_rule_in_row(*a1);
put_meta_rules_in_row(a1[1]);
result = put_meta_rules_in_row(a1[2]);
}
return result;
}

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

if ( a1 )
{
func15(*a1);
func16(a1[1]);
result = func16(a1[2]);
}
return result;
}

original_code:
static void put_meta_rules_in_row (meta_tree root)
 { if (root == ((meta_tree) ((void *)0))) return;
   put_meta_rule_in_row (root -> node);
   put_meta_rules_in_row (root -> left);
   put_meta_rules_in_row (root -> right);
 }

canonical_original_code:
static void put_meta_rules_in_row(struct meta_tree_rec *root)
 { if (root == ((meta_tree) ((void *)0))) return;
   put_meta_rule_in_row (root -> node);
   put_meta_rules_in_row (root -> left);
   put_meta_rules_in_row (root -> right);
 }

user_defined_types: struct meta_tree_rec { struct meta_rule_rec *node; struct meta_tree_rec *left; struct meta_tree_rec *right; }

user_defined_types: struct affix_list_rec { int size; int room; struct affix_rec **array; }

user_defined_types: struct element_rec { char *eltnm; struct element_def_rec *def; }

user_defined_types: struct cset_rec { int kind; char *str; }

user_defined_types: struct value_list_rec { int size; int room; struct value_rec **array; }

user_defined_types: struct int_list_rec { int size; int room; int *array; }

user_defined_types: struct element_def_list_rec { int size; int room; struct element_def_rec **array; }


decompiled_code:
__int64 __fastcall put_element_in_row(__int64 a1)
{
__int64 result; // rax

result = all_elements;
*(_QWORD *)(all_elements + 8LL * *(int *)(a1 + 8)) = a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1)
{
__int64 result; // rax

result = all_elements;
*(_QWORD *)(all_elements + 8LL * *(int *)(a1 + 8)) = a1;
return result;
}

original_code:
static void put_element_in_row (element_def node)
 { all_elements [node -> number] = node;
 }

canonical_original_code:
static void put_element_in_row(struct element_def_rec *node)
 { all_elements [node -> number] = node;
 }


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

if ( a1 )
{
put_element_in_row(*a1);
put_elements_in_row(a1[1]);
result = put_elements_in_row(a1[2]);
}
return result;
}

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

if ( a1 )
{
func17(*a1);
func18(a1[1]);
result = func18(a1[2]);
}
return result;
}

original_code:
static void put_elements_in_row (element_tree root)
 { if (root == ((element_tree) ((void *)0))) return;
   put_element_in_row (root -> node);
   put_elements_in_row (root -> left);
   put_elements_in_row (root -> right);
 }

canonical_original_code:
static void put_elements_in_row(struct element_tree_rec *root)
 { if (root == ((element_tree) ((void *)0))) return;
   put_element_in_row (root -> node);
   put_elements_in_row (root -> left);
   put_elements_in_row (root -> right);
 }

user_defined_types: struct element_tree_rec { struct element_def_rec *node; struct element_tree_rec *left; struct element_tree_rec *right; }


decompiled_code:
__int64 allocate_rule_storage()
{
__int64 result; // rax

all_rules = ckcalloc((unsigned int)nr_of_rules, 8LL);
all_alts = ckcalloc((unsigned int)nr_of_alts, 8LL);
all_members = ckcalloc((unsigned int)nr_of_members, 8LL);
all_meta_rules = ckcalloc((unsigned int)nr_of_meta_rules, 8LL);
result = ckcalloc((unsigned int)nr_of_meta_alts, 8LL);
all_meta_alts = result;
return result;
}

canonical_decompiled_code:
__int64 func19()
{
__int64 result; // rax

all_rules = ckcalloc((unsigned int)nr_of_rules, 8LL);
all_alts = ckcalloc((unsigned int)nr_of_alts, 8LL);
all_members = ckcalloc((unsigned int)nr_of_members, 8LL);
all_meta_rules = ckcalloc((unsigned int)nr_of_meta_rules, 8LL);
result = ckcalloc((unsigned int)nr_of_meta_alts, 8LL);
all_meta_alts = result;
return result;
}

original_code:
static void allocate_rule_storage ()
 { all_rules = (rule *) ckcalloc (nr_of_rules, sizeof (rule));
   all_alts = (alt *) ckcalloc (nr_of_alts, sizeof (alt));
   all_members = (member *) ckcalloc (nr_of_members, sizeof (member));
   all_meta_rules = (meta_rule *) ckcalloc
    (nr_of_meta_rules, sizeof (meta_rule));
   all_meta_alts = (meta_alt *) ckcalloc
    (nr_of_meta_alts, sizeof (meta_alt));
 }

canonical_original_code:
static void allocate_rule_storage()
 { all_rules = (struct rule_rec **) ckcalloc (nr_of_rules, sizeof (rule));
   all_alts = (struct alt_rec **) ckcalloc (nr_of_alts, sizeof (alt));
   all_members = (struct member_rec **) ckcalloc (nr_of_members, sizeof (member));
   all_meta_rules = (struct meta_rule_rec **) ckcalloc
    (nr_of_meta_rules, sizeof (meta_rule));
   all_meta_alts = (struct meta_alt_rec **) ckcalloc
    (nr_of_meta_alts, sizeof (meta_alt));
 }

user_defined_types: struct rule_rec { char *nonterminal; struct alt_list_rec *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec *rev_tree; }

user_defined_types: struct alt_rec { struct pos_list_rec *display; struct member_list_rec *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; }

user_defined_types: struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec *lat_repr; int needs_rec; int needs_recbup; }

user_defined_types: struct alt_list_rec { int size; int room; struct alt_rec **array; }

user_defined_types: struct lextree_rec { char *remainder; struct lexend_list_rec *prods; struct lextree_list_rec *tails; }

user_defined_types: struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec *def; }

user_defined_types: struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; }

user_defined_types: struct expr_rec { int tag; union { struct affix_rec *single; struct affix_list_rec *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; }

user_defined_types: struct lexend_list_rec { int size; int room; struct lexend_rec **array; }

user_defined_types: struct lextree_list_rec { int size; int room; struct lextree_rec **array; }

user_defined_types: struct pos_rec { int kind; struct expr_rec *ex; int type; struct element_def_rec *lat_repr; }

user_defined_types: struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec *val; int ref_count; int reachable; int tag; union { struct variable_rec var; char *str; int inum; double rnum; struct cset_rec *semi; struct element_rec elt; struct expr_rec *cexpr; } u; }

user_defined_types: struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; }

user_defined_types: struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec *tuple; int slat; struct int_list_rec *elat; struct value_rec *free; } u; }

user_defined_types: struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; }


decompiled_code:
__int64 allocate_element_storage()
{
__int64 result; // rax

result = ckcalloc((unsigned int)nr_of_elements, 8LL);
all_elements = result;
return result;
}

canonical_decompiled_code:
__int64 func20()
{
__int64 result; // rax

result = ckcalloc((unsigned int)nr_of_elements, 8LL);
all_elements = result;
return result;
}

original_code:
static void allocate_element_storage ()
 { all_elements = (element_def *) ckcalloc
    (nr_of_elements, sizeof (element_def));
 }

canonical_original_code:
static void allocate_element_storage()
 { all_elements = (struct element_def_rec **) ckcalloc
    (nr_of_elements, sizeof (element_def));
 }

user_defined_types: struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec *set; }

user_defined_types: struct element_set_rec { int number; struct element_def_list_rec *defs; }

user_defined_types: struct element_def_list_rec { int size; int room; struct element_def_rec **array; }


decompiled_code:
__int64 __fastcall do_numbering(int a1)
{
warning("numbering...");
init_numbering();
if ( a1 )
{
number_rules(rule_root);
number_meta_rules(meta_root);
allocate_rule_storage();
}
else
{
number_alt(-1, start_alt);
number_rules(rule_root);
number_meta_rules(meta_root);
allocate_rule_storage();
put_alt_in_row(start_alt);
}
put_rules_in_row(rule_root);
put_meta_rules_in_row(meta_root);
hint(
"found %d syntax rules, %d alternatives, %d members",
(unsigned int)nr_of_rules,
(unsigned int)nr_of_alts,
(unsigned int)nr_of_members);
return hint(
"found %d meta rules, %d meta alternatives",
(unsigned int)nr_of_meta_rules,
(unsigned int)nr_of_meta_alts);
}

canonical_decompiled_code:
__int64 __fastcall func21(int a1)
{
warning("numbering...");
func0();
if ( a1 )
{
func4(rule_root);
func7(meta_root);
func19();
}
else
{
func2(-1, start_alt);
func4(rule_root);
func7(meta_root);
func19();
func11(start_alt);
}
func13(rule_root);
func16(meta_root);
hint(
"found %d syntax rules, %d alternatives, %d members",
(unsigned int)nr_of_rules,
(unsigned int)nr_of_alts,
(unsigned int)nr_of_members);
return hint(
"found %d meta rules, %d meta alternatives",
(unsigned int)nr_of_meta_rules,
(unsigned int)nr_of_meta_alts);
}

original_code:
void do_numbering (int pred)
 { warning ("numbering...");
   init_numbering ();
   if (!pred) number_alt (-1, start_alt);
   number_rules (rule_root);
   number_meta_rules (meta_root);
   allocate_rule_storage ();
   if (!pred) put_alt_in_row (start_alt);
   put_rules_in_row (rule_root);
   put_meta_rules_in_row (meta_root);
   hint ("found %d syntax rules, %d alternatives, %d members",
   nr_of_rules, nr_of_alts, nr_of_members);
   hint ("found %d meta rules, %d meta alternatives",
   nr_of_meta_rules, nr_of_meta_alts);
 }

canonical_original_code:
void do_numbering(int pred)
 { warning ("numbering...");
   init_numbering ();
   if (!pred) number_alt (-1, start_alt);
   number_rules (rule_root);
   number_meta_rules (meta_root);
   allocate_rule_storage ();
   if (!pred) put_alt_in_row (start_alt);
   put_rules_in_row (rule_root);
   put_meta_rules_in_row (meta_root);
   hint ("found %d syntax rules, %d alternatives, %d members",
   nr_of_rules, nr_of_alts, nr_of_members);
   hint ("found %d meta rules, %d meta alternatives",
   nr_of_meta_rules, nr_of_meta_alts);
 }

variable_types: pred int


decompiled_code:
__int64 do_element_numbering()
{
warning("numbering elements...");
number_elements(element_root);
allocate_element_storage();
put_elements_in_row(element_root);
return hint("found %d elements", (unsigned int)nr_of_elements);
}

canonical_decompiled_code:
__int64 func22()
{
warning("numbering elements...");
func9(element_root);
func20();
func18(element_root);
return hint("found %d elements", (unsigned int)nr_of_elements);
}

original_code:
void do_element_numbering ()
 { warning ("numbering elements...");
   number_elements (element_root);
   allocate_element_storage ();
   put_elements_in_row (element_root);
   hint ("found %d elements", nr_of_elements);
 }

canonical_original_code:
void do_element_numbering()
 { warning ("numbering elements...");
   number_elements (element_root);
   allocate_element_storage ();
   put_elements_in_row (element_root);
   hint ("found %d elements", nr_of_elements);
 }


decompiled_code:
__int64 __fastcall new_leaf(char *src)
{
int v1; // eax
__int64 v2; // rbx

v1 = strlen(src);
v2 = ckmalloc((unsigned int)(v1 + 18));
*(_QWORD *)v2 = 0LL;
*(_QWORD *)(v2 + 8) = 0LL;
*(_BYTE *)(v2 + 16) = 0;
strcpy((char *)(v2 + 17), src);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *src)
{
int v1; // eax
__int64 v2; // rbx

v1 = strlen(src);
v2 = ckmalloc((unsigned int)(v1 + 18));
*(_QWORD *)v2 = 0LL;
*(_QWORD *)(v2 + 8) = 0LL;
*(_BYTE *)(v2 + 16) = 0;
strcpy((char *)(v2 + 17), src);
return v2;
}

original_code:
static text_tree new_leaf (char *t)
{ int len = strlen (t);
  int needed = 2 * sizeof (struct text_rec *) + sizeof (signed char) + len + 1;
  text_tree nt;
  nt = (text_tree) ckmalloc (needed);
  nt -> left = ((text_tree) ((void *)0));
  nt -> right = ((text_tree) ((void *)0));
  nt -> balfac = 0;
  strcpy (nt -> word, t);
  return (nt);
}

canonical_original_code:
static struct text_rec *new_leaf(char *t)
{ int len = strlen (t);
  int needed = 2 * sizeof (struct text_rec *) + sizeof (signed char) + len + 1;
  struct text_rec *nt;
  nt = (struct text_rec *) ckmalloc (needed);
  nt -> left = ((text_tree) ((void *)0));
  nt -> right = ((text_tree) ((void *)0));
  nt -> balfac = 0;
  strcpy (nt -> word, t);
  return (nt);
}

variable_types:
t
char *

variable_types: len int

variable_types: needed int

variable_types: struct text_rec { struct text_rec *left; struct text_rec *right; char balfac; char word[1]; } *


decompiled_code:
void __fastcall dump_tree(__int64 a1, int a2)
{
char v2; // al
char v3; // r14
int i; // ebx

if ( a1 )
{
v2 = *(_BYTE *)(a1 + 16);
v3 = 45;
if ( v2 >= 0 )
v3 = 5 * (v2 <= 0) + 43;
dump_tree(*(_QWORD *)a1, (unsigned int)(a2 + 1));
if ( a2 > 0 )
{
for ( i = 0; i != a2; ++i )
eprint_log(0LL, 0LL, &LC0);
}
wlog("%c %s", (unsigned int)v3, (const char *)(a1 + 17));
dump_tree(*(_QWORD *)(a1 + 8), (unsigned int)(a2 + 1));
}
}

original_code:
static void dump_tree (text_tree ptr, int depth)
{ if (ptr != ((text_tree) ((void *)0)))
    { char bc = (ptr -> balfac < 0)?'-':(ptr -> balfac > 0)?'+':'0';
      int ix;
      dump_tree (ptr -> left, depth + 1);
      for (ix = 0; ix < depth; ix++) eprint_log (0, 0, " ");
      wlog ("%c %s", bc, ptr -> word);
      dump_tree (ptr -> right, depth + 1);
    };
}

canonical_original_code:
static void dump_tree(struct text_rec *ptr, int depth)
{ if (ptr != ((text_tree) ((void *)0)))
    { char bc = (ptr -> balfac < 0)?'-':(ptr -> balfac > 0)?'+':'0';
      int ix;
      dump_tree (ptr -> left, depth + 1);
      for (ix = 0; ix < depth; ix++) eprint_log (0, 0, " ");
      wlog ("%c %s", bc, ptr -> word);
      dump_tree (ptr -> right, depth + 1);
    };
}

variable_types: depth int

variable_types: bc char

user_defined_types: struct text_rec { struct text_rec *left; struct text_rec *right; char balfac; char word[1]; }


original_code:
string addto_names (char *t)
{ text_tree *fixation;
  text_tree *insert_ptr;
  text_tree last_unbal;
  text_tree below_unbal;
  text_tree twobelow_unbal;
  text_tree ptr, nt;
  if (root == ((text_tree) ((void *)0)))
    { root = new_leaf (t);
      return (root -> word);
    };
  insert_ptr = &root;
  fixation = &root;
  last_unbal = root;
  while ((*insert_ptr) != ((text_tree) ((void *)0)))
    { int cond;
      if ((*insert_ptr) -> balfac)
   { fixation = insert_ptr;
     last_unbal = *insert_ptr;
   };
      cond = strcmp (t, (*insert_ptr) -> word);
      if (cond < 0) insert_ptr = &((*insert_ptr) -> left);
      else if (cond > 0) insert_ptr = &((*insert_ptr) -> right);
      else return ((*insert_ptr) -> word);
    };
  nt = new_leaf (t);
  *insert_ptr = nt;
  if ((strcmp(t,last_unbal -> word) < 0))
    { below_unbal = last_unbal -> left;
      last_unbal -> balfac--;
    }
  else
    { below_unbal = last_unbal -> right;
      last_unbal -> balfac++;
    };
  ptr = below_unbal;
  while (ptr != nt)
    if ((strcmp(t,ptr -> word) < 0))
      { ptr -> balfac--;
 ptr = ptr -> left;
      }
    else
      { ptr -> balfac++;
 ptr = ptr -> right;
      };
  if ((-1 <= last_unbal -> balfac) && (last_unbal -> balfac <= 1))
    return (nt -> word);
  if (((last_unbal -> balfac > 0) && (below_unbal -> balfac > 0)) ||
      ((last_unbal -> balfac < 0) && (below_unbal -> balfac < 0)))
    { if (last_unbal -> balfac > 0)
 { last_unbal -> right = below_unbal -> left;
   below_unbal -> left = last_unbal;
 }
      else
 { last_unbal -> left = below_unbal -> right;
   below_unbal -> right = last_unbal;
 };
      last_unbal -> balfac = 0;
      below_unbal -> balfac = 0;
      *fixation = below_unbal;
      return (nt -> word);
    };
  if (last_unbal -> balfac > 0)
    { twobelow_unbal = below_unbal -> left;
      last_unbal -> right = twobelow_unbal -> left;
      below_unbal -> left = twobelow_unbal -> right;
      twobelow_unbal -> left = last_unbal;
      twobelow_unbal -> right = below_unbal;
      last_unbal -> balfac = (twobelow_unbal -> balfac == 1)?-1:0;
      below_unbal -> balfac = (twobelow_unbal -> balfac == -1)?1:0;
    }
  else
    { twobelow_unbal = below_unbal -> right;
      last_unbal -> left = twobelow_unbal -> right;
      below_unbal -> right = twobelow_unbal -> left;
      twobelow_unbal -> right = last_unbal;
      twobelow_unbal -> left = below_unbal;
      last_unbal -> balfac = (twobelow_unbal -> balfac == -1)?1:0;
      below_unbal -> balfac = (twobelow_unbal -> balfac == 1)?-1:0;
    };
  twobelow_unbal -> balfac = 0;
  *fixation = twobelow_unbal;
  return (nt -> word);
}

canonical_original_code:
char *addto_names(char *t)
{ struct text_rec **fixation;
  struct text_rec **insert_ptr;
  struct text_rec *last_unbal;
  struct text_rec *below_unbal;
  struct text_rec *twobelow_unbal;
  struct text_rec *ptr; struct text_rec *nt;
  if (root == ((text_tree) ((void *)0)))
    { root = new_leaf (t);
      return (root -> word);
    };
  insert_ptr = &root;
  fixation = &root;
  last_unbal = root;
  while ((*insert_ptr) != ((text_tree) ((void *)0)))
    { int cond;
      if ((*insert_ptr) -> balfac)
   { fixation = insert_ptr;
     last_unbal = *insert_ptr;
   };
      cond = strcmp (t, (*insert_ptr) -> word);
      if (cond < 0) insert_ptr = &((*insert_ptr) -> left);
      else if (cond > 0) insert_ptr = &((*insert_ptr) -> right);
      else return ((*insert_ptr) -> word);
    };
  nt = new_leaf (t);
  *insert_ptr = nt;
  if ((strcmp(t,last_unbal -> word) < 0))
    { below_unbal = last_unbal -> left;
      last_unbal -> balfac--;
    }
  else
    { below_unbal = last_unbal -> right;
      last_unbal -> balfac++;
    };
  ptr = below_unbal;
  while (ptr != nt)
    if ((strcmp(t,ptr -> word) < 0))
      { ptr -> balfac--;
 ptr = ptr -> left;
      }
    else
      { ptr -> balfac++;
 ptr = ptr -> right;
      };
  if ((-1 <= last_unbal -> balfac) && (last_unbal -> balfac <= 1))
    return (nt -> word);
  if (((last_unbal -> balfac > 0) && (below_unbal -> balfac > 0)) ||
      ((last_unbal -> balfac < 0) && (below_unbal -> balfac < 0)))
    { if (last_unbal -> balfac > 0)
 { last_unbal -> right = below_unbal -> left;
   below_unbal -> left = last_unbal;
 }
      else
 { last_unbal -> left = below_unbal -> right;
   below_unbal -> right = last_unbal;
 };
      last_unbal -> balfac = 0;
      below_unbal -> balfac = 0;
      *fixation = below_unbal;
      return (nt -> word);
    };
  if (last_unbal -> balfac > 0)
    { twobelow_unbal = below_unbal -> left;
      last_unbal -> right = twobelow_unbal -> left;
      below_unbal -> left = twobelow_unbal -> right;
      twobelow_unbal -> left = last_unbal;
      twobelow_unbal -> right = below_unbal;
      last_unbal -> balfac = (twobelow_unbal -> balfac == 1)?-1:0;
      below_unbal -> balfac = (twobelow_unbal -> balfac == -1)?1:0;
    }
  else
    { twobelow_unbal = below_unbal -> right;
      last_unbal -> left = twobelow_unbal -> right;
      below_unbal -> right = twobelow_unbal -> left;
      twobelow_unbal -> right = last_unbal;
      twobelow_unbal -> left = below_unbal;
      last_unbal -> balfac = (twobelow_unbal -> balfac == -1)?1:0;
      below_unbal -> balfac = (twobelow_unbal -> balfac == 1)?-1:0;
    };
  twobelow_unbal -> balfac = 0;
  *fixation = twobelow_unbal;
  return (nt -> word);
}

variable_types: struct text_rec { struct text_rec *left; struct text_rec *right; char balfac; char word[1]; } **

variable_types: cond int

return_type: char *


decompiled_code:
__int64 __fastcall lookup_name(char *s1)
{
__int64 v1; // rbx
int v2; // eax

v1 = root;
if ( !root )
{
LABEL_2:
panic("text %s not found in text storage\n", s1);
exit(4);
}
while ( 1 )
{
v2 = strcmp(s1, (const char *)(v1 + 17));
if ( v2 >= 0 )
break;
v1 = *(_QWORD *)v1;
LABEL_4:
if ( !v1 )
goto LABEL_2;
}
if ( v2 > 0 )
{
v1 = *(_QWORD *)(v1 + 8);
goto LABEL_4;
}
return v1 + 17;
}

canonical_decompiled_code:
__int64 __fastcall func3(char *s1)
{
__int64 v1; // rbx
int v2; // eax

v1 = root;
if ( !root )
{
LABEL_2:
panic("text %s not found in text storage\n", s1);
exit(4);
}
while ( 1 )
{
v2 = strcmp(s1, (const char *)(v1 + 17));
if ( v2 >= 0 )
break;
v1 = *(_QWORD *)v1;
LABEL_4:
if ( !v1 )
goto LABEL_2;
}
if ( v2 > 0 )
{
v1 = *(_QWORD *)(v1 + 8);
goto LABEL_4;
}
return v1 + 17;
}

original_code:
string lookup_name (char *t)
{ text_tree ptr = root;
  while (1)
    { int cond;
      if (ptr == ((text_tree) ((void *)0)))
         { panic ("text %s not found in text storage\n", t);
    exit (4);
  };
      cond = strcmp (t, ptr -> word);
      if (cond < 0) ptr = ptr -> left;
      else if (cond > 0) ptr = ptr -> right;
      else return (ptr -> word);
    };
}

canonical_original_code:
char *lookup_name(char *t)
{ struct text_rec *ptr = root;
  while (1)
    { int cond;
      if (ptr == ((text_tree) ((void *)0)))
         { panic ("text %s not found in text storage\n", t);
    exit (4);
  };
      cond = strcmp (t, ptr -> word);
      if (cond < 0) ptr = ptr -> left;
      else if (cond > 0) ptr = ptr -> right;
      else return (ptr -> word);
    };
}


decompiled_code:
__int64 new_unique_name()
{
char v1[24]; // [rsp+0h] [rbp-18h] BYREF

sprintf(v1, "_uniq%d", (unsigned int)unique);
++unique;
return addto_names(v1);
}

canonical_decompiled_code:
__int64 func4()
{
char v1[24]; // [rsp+0h] [rbp-18h] BYREF

sprintf(v1, "_uniq%d", (unsigned int)unique);
++unique;
return func2(v1);
}

original_code:
string new_unique_name ()
{ char buf[16];
  sprintf (buf, "_uniq%d", unique);
  unique++;
  return (addto_names (buf));
}

canonical_original_code:
char *new_unique_name()
{ char buf[16];
  sprintf (buf, "_uniq%d", unique);
  unique++;
  return (addto_names (buf));
}

variable_types:
buf
char [16]


decompiled_code:
__int64 __fastcall init_textstorage(__int64 a1)
{
__int64 result; // rax

result = ckmalloc(a1);
strstore = result;
root = 0LL;
unique = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
__int64 result; // rax

result = ckmalloc(a1);
strstore = result;
root = 0LL;
unique = 0;
return result;
}

original_code:
void init_textstorage (int strstore_size)
{ strstore = (char *) ckmalloc (strstore_size);
  root = ((text_tree) ((void *)0));
  unique = 0;
}

canonical_original_code:
void init_textstorage(int strstore_size)
{ strstore = (char *) ckmalloc (strstore_size);
  root = ((text_tree) ((void *)0));
  unique = 0;
}


decompiled_code:
void dump_textstorage()
{
wlog("Dump of textstorage:\n");
dump_tree(root, 0);
}

canonical_decompiled_code:
void func6()
{
wlog("Dump of textstorage:\n");
func1(root, 0);
}

original_code:
void dump_textstorage ()
{ wlog ("Dump of textstorage:\n");
  dump_tree (root, 0);
}

canonical_original_code:
void dump_textstorage()
{ wlog ("Dump of textstorage:\n");
  dump_tree (root, 0);
}


decompiled_code:
void init_prepare()
{
max_nodenr = 2;
}

canonical_decompiled_code:
void func0()
{
max_nodenr = 2;
}

original_code:
static void init_prepare ()
 { max_nodenr = 2;
 }

canonical_original_code:
static void init_prepare()
 { max_nodenr = 2;
 }


decompiled_code:
__int64 __fastcall assign_node_nr(__int64 a1)
{
int v1; // eax
__int64 result; // rax

v1 = max_nodenr;
*(_DWORD *)(a1 + 20) = max_nodenr;
result = (unsigned int)(v1 + 1);
max_nodenr = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
int v1; // eax
__int64 result; // rax

v1 = max_nodenr;
*(_DWORD *)(a1 + 20) = max_nodenr;
result = (unsigned int)(v1 + 1);
max_nodenr = result;
return result;
}

original_code:
static void assign_node_nr (alt a)
 { a -> nodenr = max_nodenr;
   max_nodenr++;
 }

canonical_original_code:
static void assign_node_nr(struct alt_rec *a)
 { a -> nodenr = max_nodenr;
   max_nodenr++;
 }

variable_types: struct alt_rec { struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct member_list_rec { int size; int room; struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec { char *nonterminal; struct alt_list_rec { int size; int room; struct alt_rec **array; } *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } **array; } *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } *

user_defined_types: struct alt_rec { struct pos_list_rec *display; struct member_list_rec *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; }

user_defined_types: struct pos_list_rec { int size; int room; struct pos_rec **array; }

user_defined_types: struct member_list_rec { int size; int room; struct member_rec **array; }

user_defined_types: struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec call; char *terminal; struct semiterminal_rec semi; } u; }

user_defined_types: struct rule_rec { char *nonterminal; struct alt_list_rec *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec *rev_tree; }

user_defined_types: struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec *lat_repr; int needs_rec; int needs_recbup; }

user_defined_types: struct meta_alt_list_rec { int size; int room; struct meta_alt_rec **array; }


decompiled_code:
__int64 __fastcall prepare_alt(__int64 a1, __int64 a2)
{
__int64 result; // rax

result = prepare_members(a2, *(_QWORD *)(a2 + 8), (_DWORD *)(a2 + 24));
if ( !layoutflag || layout_rule != a1 )
result = assign_node_nr(a2);
return result;
}

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

result = func2(a2, *(_QWORD *)(a2 + 8), (_DWORD *)(a2 + 24));
if ( !layoutflag || layout_rule != a1 )
result = func3(a2);
return result;
}

original_code:
static void prepare_alt (rule srule, alt a)
 { prepare_members (a, a -> members, &a -> nrsons);
   if (layoutflag && (srule == layout_rule)) return;
   assign_node_nr (a);
 }

canonical_original_code:
static void prepare_alt(struct rule_rec *srule, struct alt_rec *a)
 { prepare_members (a, a -> members, &a -> nrsons);
   if (layoutflag && (srule == layout_rule)) return;
   assign_node_nr (a);
 }

variable_types: struct rule_rec { char *nonterminal; struct alt_list_rec { int size; int room; struct alt_rec { struct pos_list_rec { int size; int room; struct pos_rec { int kind; struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *ex; int type; struct element_def_rec *lat_repr; } **array; } *display; struct member_list_rec { int size; int room; struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec *def; } call; char *terminal; struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; } semi; } u; } **array; } *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; } **array; } *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; } **array; } *prods; struct lextree_list_rec { int size; int room; struct lextree_rec **array; } *tails; } *rev_tree; } *

variable_types:
a
struct alt_rec *

user_defined_types: struct alt_list_rec { int size; int room; struct alt_rec **array; }

user_defined_types: struct lextree_rec { char *remainder; struct lexend_list_rec *prods; struct lextree_list_rec *tails; }

user_defined_types: struct lexend_list_rec { int size; int room; struct lexend_rec **array; }

user_defined_types: struct expr_rec { int tag; union { struct affix_rec *single; struct affix_list_rec *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; }


decompiled_code:
__int64 __fastcall prepare_alts(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 result; // rax

if ( *(int *)a2 > 0 )
{
v2 = 0LL;
do
result = prepare_alt(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 8 * v2++));
while ( *(_DWORD *)a2 > (int)v2 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 result; // rax

if ( *(int *)a2 > 0 )
{
v2 = 0LL;
do
result = func4(a1, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 8 * v2++));
while ( *(_DWORD *)a2 > (int)v2 );
}
return result;
}

original_code:
static void prepare_alts (rule srule, alt_list alts)
 { int ix;
   for (ix = 0; ix < alts -> size; ix++)
      prepare_alt (srule, alts -> array[ix]);
 }

canonical_original_code:
static void prepare_alts(struct rule_rec *srule, struct alt_list_rec *alts)
 { int ix;
   for (ix = 0; ix < alts -> size; ix++)
      prepare_alt (srule, alts -> array[ix]);
 }

variable_types:
alts
struct alt_list_rec *

variable_types: ix int

user_defined_types: struct lextree_list_rec { int size; int room; struct lextree_rec **array; }

user_defined_types: struct lexend_rec { int nodenr; struct int_list_rec *valuenrs; }

user_defined_types: struct pos_rec { int kind; struct expr_rec *ex; int type; struct element_def_rec *lat_repr; }

user_defined_types: struct call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec *def; }

user_defined_types: struct semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; }

user_defined_types: struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec *val; int ref_count; int reachable; int tag; union { struct variable_rec var; char *str; int inum; double rnum; struct cset_rec *semi; struct element_rec elt; struct expr_rec *cexpr; } u; }

user_defined_types: struct affix_list_rec { int size; int room; struct affix_rec **array; }

user_defined_types: struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec *tuple; int slat; struct int_list_rec *elat; struct value_rec *free; } u; }

user_defined_types: struct element_rec { char *eltnm; struct element_def_rec *def; }

user_defined_types: struct cset_rec { int kind; char *str; }

user_defined_types: struct value_list_rec { int size; int room; struct value_rec **array; }

user_defined_types: struct int_list_rec { int size; int room; int *array; }

user_defined_types: struct meta_alt_rec { struct expr_rec *e; int number; }


decompiled_code:
__int64 __fastcall prepare_rule(__int64 a1)
{
__int64 result; // rax

if ( !*(_DWORD *)(a1 + 28) && *(_DWORD *)(a1 + 72) )
{
if ( (*(_BYTE *)(a1 + 16) & 2) != 0 )
{
++max_nodenr;
}
else if ( placeholderflag )
{
if ( *(_DWORD *)(a1 + 36) )
max_nodenr += 2;
}
result = prepare_alts(a1, *(_QWORD *)(a1 + 8));
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
__int64 result; // rax

if ( !*(_DWORD *)(a1 + 28) && *(_DWORD *)(a1 + 72) )
{
if ( (*(_BYTE *)(a1 + 16) & 2) != 0 )
{
++max_nodenr;
}
else if ( placeholderflag )
{
if ( *(_DWORD *)(a1 + 36) )
max_nodenr += 2;
}
result = func5(a1, *(_QWORD *)(a1 + 8));
}
return result;
}

original_code:
static void prepare_rule (rule srule)
 { if (srule -> ext) return;
   if (!srule -> reachable) return;
   if (srule -> kind & 2) max_nodenr++;
   else if (placeholderflag && (srule -> placeholder)) max_nodenr += 2;
   prepare_alts (srule, srule -> alts);
 }

canonical_original_code:
static void prepare_rule(struct rule_rec *srule)
 { if (srule -> ext) return;
   if (!srule -> reachable) return;
   if (srule -> kind & 2) max_nodenr++;
   else if (placeholderflag && (srule -> placeholder)) max_nodenr += 2;
   prepare_alts (srule, srule -> alts);
 }

user_defined_types: struct rule_rec { char *nonterminal; struct alt_list_rec *alts; int kind; int empty; int lex; int ext; int number; int placeholder; int startswithlayout; int endsinlayout; char *first; char *follow; struct pos_list_rec *proto_display; int reachable; int has_sons; int goal; struct lextree_rec *rev_tree; }

user_defined_types: struct alt_list_rec { int size; int room; struct alt_rec **array; }

user_defined_types: struct alt_rec { struct pos_list_rec *display; struct member_list_rec *members; int number; int nodenr; int nrsons; struct affix_rec *locals; int empty; char *first; char *director; int rule_nr; }

user_defined_types: struct pos_list_rec { int size; int room; struct pos_rec **array; }

user_defined_types: struct member_list_rec { int size; int room; struct member_rec **array; }

user_defined_types: struct member_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec call; char *terminal; struct semiterminal_rec semi; } u; }

user_defined_types: struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; }

user_defined_types: struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec *lat_repr; int needs_rec; int needs_recbup; }

user_defined_types: struct meta_alt_list_rec { int size; int room; struct meta_alt_rec **array; }

user_defined_types: struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec *set; }

user_defined_types: struct element_set_rec { int number; struct element_def_list_rec *defs; }

user_defined_types: struct element_def_list_rec { int size; int room; struct element_def_rec **array; }


decompiled_code:
__int64 prepare_rules()
{
__int64 v0; // rbx
__int64 result; // rax

if ( nr_of_rules > 0 )
{
v0 = 0LL;
do
result = prepare_rule(*(_QWORD *)(all_rules + 8 * v0++));
while ( nr_of_rules > (int)v0 );
}
return result;
}

canonical_decompiled_code:
__int64 func7()
{
__int64 v0; // rbx
__int64 result; // rax

if ( nr_of_rules > 0 )
{
v0 = 0LL;
do
result = func6(*(_QWORD *)(all_rules + 8 * v0++));
while ( nr_of_rules > (int)v0 );
}
return result;
}

original_code:
static void prepare_rules ()
 { int ix;
   for (ix = 0; ix < nr_of_rules; ix++)
      prepare_rule (all_rules[ix]);
 }

canonical_original_code:
static void prepare_rules()
 { int ix;
   for (ix = 0; ix < nr_of_rules; ix++)
      prepare_rule (all_rules[ix]);
 }


decompiled_code:
void __fastcall mark_recbup_in_expr(int *a1)
{
int v1; // eax

if ( a1 )
{
v1 = *a1;
if ( *a1 == 3 )
{
mark_recbup_in_affix_list(*((_QWORD *)a1 + 1));
}
else
{
if ( v1 > 3 )
{
if ( v1 != 4 )
goto LABEL_8;
goto LABEL_6;
}
if ( v1 != 1 )
{
if ( v1 != 2 )
{
LABEL_8:
bad_tag((unsigned int)*a1, "mark_rec_in_expr");
return;
}
LABEL_6:
internal_error("mark_rec_in_expr");
goto LABEL_8;
}
mark_recbup_in_affix(*((_QWORD *)a1 + 1));
}
}
}

canonical_decompiled_code:
void __fastcall func8(int *a1)
{
int v1; // eax

if ( a1 )
{
v1 = *a1;
if ( *a1 == 3 )
{
func11(*((_QWORD *)a1 + 1));
}
else
{
if ( v1 > 3 )
{
if ( v1 != 4 )
goto LABEL_8;
goto LABEL_6;
}
if ( v1 != 1 )
{
if ( v1 != 2 )
{
LABEL_8:
bad_tag((unsigned int)*a1, "mark_rec_in_expr");
return;
}
LABEL_6:
internal_error("mark_rec_in_expr");
goto LABEL_8;
}
func10(*((_QWORD *)a1 + 1));
}
}
}

original_code:
static void mark_recbup_in_expr (expr e)
 { if (e == ((expr) ((void *)0))) return;
   switch (e -> tag)
      { case 1: mark_recbup_in_affix (e -> u.single); break;
        case 3:
    mark_recbup_in_affix_list (e -> u.concat); break;
        case 2:
        case 4: internal_error ("mark_rec_in_expr");
        default: bad_tag (e -> tag, "mark_rec_in_expr");
      };
 }

canonical_original_code:
static void mark_recbup_in_expr(struct expr_rec *e)
 { if (e == ((expr) ((void *)0))) return;
   switch (e -> tag)
      { case 1: mark_recbup_in_affix (e -> u.single); break;
        case 3:
    mark_recbup_in_affix_list (e -> u.concat); break;
        case 2:
        case 4: internal_error ("mark_rec_in_expr");
        default: bad_tag (e -> tag, "mark_rec_in_expr");
      };
 }

variable_types: struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *

user_defined_types: struct expr_rec { int tag; union { struct affix_rec *single; struct affix_list_rec *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; }

user_defined_types: struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec *val; int ref_count; int reachable; int tag; union { struct variable_rec var; char *str; int inum; double rnum; struct cset_rec *semi; struct element_rec elt; struct expr_rec *cexpr; } u; }

user_defined_types: struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec *tuple; int slat; struct int_list_rec *elat; struct value_rec *free; } u; }


original_code:
static void mark_recbup_in_meta_rule (meta_rule mrule)
 { int ix;
   meta_alt_list alts = mrule -> alts;
   if (mrule -> ext) return;
   if (!mrule -> reachable) return;
   if (mrule -> needs_recbup) return;
   mrule -> needs_recbup = 1;
   for (ix = 0; ix < alts -> size; ix++)
      mark_recbup_in_expr (alts -> array[ix] -> e);
 }

canonical_original_code:
static void mark_recbup_in_meta_rule(struct meta_rule_rec *mrule)
 { int ix;
   struct meta_alt_list_rec *alts = mrule -> alts;
   if (mrule -> ext) return;
   if (!mrule -> reachable) return;
   if (mrule -> needs_recbup) return;
   mrule -> needs_recbup = 1;
   for (ix = 0; ix < alts -> size; ix++)
      mark_recbup_in_expr (alts -> array[ix] -> e);
 }

variable_types: struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec *lat_repr; int needs_rec; int needs_recbup; } *

variable_types: struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } **array; } *


decompiled_code:
void __fastcall mark_recbup_in_affix(__int64 a1)
{
if ( !*(_DWORD *)(a1 + 40) )
mark_recbup_in_meta_rule(*(_QWORD *)(a1 + 64));
}

original_code:
static void mark_recbup_in_affix (affix a)
 { if (a -> tag == 0)
      { meta_rule def = a -> u.var.def;
        mark_recbup_in_meta_rule (def);
      };
 }

canonical_original_code:
static void mark_recbup_in_affix(struct affix_rec *a)
 { if (a -> tag == 0)
      { struct meta_rule_rec *def = a -> u.var.def;
        mark_recbup_in_meta_rule (def);
      };
 }

variable_types: struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec *single; struct affix_list_rec { int size; int room; struct affix_rec **array; } *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } *


decompiled_code:
void __fastcall mark_recbup_in_affix_list(__int64 a1)
{
__int64 v1; // rbx

if ( *(int *)a1 > 0 )
{
v1 = 0LL;
do
mark_recbup_in_affix(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v1++));
while ( *(_DWORD *)a1 > (int)v1 );
}
}

original_code:
static void mark_recbup_in_affix_list (affix_list affl)
 { int ix;
   for (ix = 0; ix < affl -> size; ix++)
      mark_recbup_in_affix (affl -> array[ix]);
 }

canonical_original_code:
static void mark_recbup_in_affix_list(struct affix_list_rec *affl)
 { int ix;
   for (ix = 0; ix < affl -> size; ix++)
      mark_recbup_in_affix (affl -> array[ix]);
 }

variable_types: struct affix_list_rec { int size; int room; struct affix_rec { char *name; int type; struct affix_rec *next; struct value_rec { int admin_nr; int ref_count; void *dptr; int tag; union { char *str; int inum; double rnum; struct value_list_rec { int size; int room; struct value_rec **array; } *tuple; int slat; struct int_list_rec { int size; int room; int *array; } *elat; struct value_rec *free; } u; } *val; int ref_count; int reachable; int tag; union { struct variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec { char *nonterminal; struct meta_alt_list_rec { int size; int room; struct meta_alt_rec { struct expr_rec { int tag; union { struct affix_rec *single; struct affix_list_rec *compos; struct affix_list_rec *concat; struct affix_list_rec *uni; } u; } *e; int number; } **array; } *alts; int ext; int type; int kind; int empty; int number; struct value_rec *mvalue; int reachable; struct element_def_rec { char *eltnm; int number; int eltnr; struct element_set_rec { int number; struct element_def_list_rec { int size; int room; struct element_def_rec **array; } *defs; } *set; } *lat_repr; int needs_rec; int needs_recbup; } *def; } var; char *str; int inum; double rnum; struct cset_rec { int kind; char *str; } *semi; struct element_rec { char *eltnm; struct element_def_rec *def; } elt; struct expr_rec *cexpr; } u; } **array; } *

user_defined_types: struct affix_list_rec { int size; int room; struct affix_rec **array; }


decompiled_code:
void __fastcall mark_rec_in_expr(unsigned int *a1)
{
int v1; // eax

if ( a1 )
{
v1 = *a1;
if ( *a1 == 3 )
{
mark_recbup_in_affix_list(*((_QWORD *)a1 + 1));
}
else
{
if ( v1 > 3 )
{
if ( v1 == 4 )
internal_error("mark_rec_in_expr");
LABEL_9:
bad_tag(*a1, "mark_rec_in_expr");
return;
}
if ( v1 != 1 )
{
if ( v1 == 2 )
{
mark_rec_in_affix_list(*((_QWORD *)a1 + 1));
return;
}
goto LABEL_9;
}
mark_rec_in_affix(*((_QWORD *)a1 + 1));
}
}
}

canonical_decompiled_code:
void __fastcall func12(unsigned int *a1)
{
int v1; // eax

if ( a1 )
{
v1 = *a1;
if ( *a1 == 3 )
{
func11(*((_QWORD *)a1 + 1));
}
else
{
if ( v1 > 3 )
{
if ( v1 == 4 )
internal_error("mark_rec_in_expr");
LABEL_9:
bad_tag(*a1, "mark_rec_in_expr");
return;
}
if ( v1 != 1 )
{
if ( v1 == 2 )
{
func17(*((_QWORD *)a1 + 1));
return;
}
goto LABEL_9;
}
func16(*((_QWORD *)a1 + 1));
}
}
}

original_code:
static void mark_rec_in_expr (expr e)
 { if (e == ((expr) ((void *)0))) return;
   switch (e -> tag)
      { case 1: mark_rec_in_affix (e -> u.single); break;
        case 2: mark_rec_in_affix_list (e -> u.compos); break;
        case 3:
    mark_recbup_in_affix_list (e -> u.concat); break;
        case 4: internal_error ("mark_rec_in_expr");
        default: bad_tag (e -> tag, "mark_rec_in_expr");
      };
 }

canonical_original_code:
static void mark_rec_in_expr(struct expr_rec *e)
 { if (e == ((expr) ((void *)0))) return;
   switch (e -> tag)
      { case 1: mark_rec_in_affix (e -> u.single); break;
        case 2: mark_rec_in_affix_list (e -> u.compos); break;
        case 3:
    mark_recbup_in_affix_list (e -> u.concat); break;
        case 4: internal_error ("mark_rec_in_expr");
        default: bad_tag (e -> tag, "mark_rec_in_expr");
      };
 }

user_defined_types: struct element_rec { char *eltnm; struct element_def_rec *def; }

user_defined_types: struct cset_rec { int kind; char *str; }

user_defined_types: struct value_list_rec { int size; int room; struct value_rec **array; }

user_defined_types: struct int_list_rec { int size; int room; int *array; }

user_defined_types: struct meta_alt_rec { struct expr_rec *e; int number; }


original_code:
static void mark_rec_in_meta_rule (meta_rule mrule)
 { int ix;
   meta_alt_list alts = mrule -> alts;
   if (mrule -> ext) return;
   if (!mrule -> reachable) return;
   if (mrule -> needs_rec) return;
   mrule -> needs_rec = 1;
   for (ix = 0; ix < alts -> size; ix++)
      mark_rec_in_expr (alts -> array[ix] -> e);
 }

canonical_original_code:
static void mark_rec_in_meta_rule(struct meta_rule_rec *mrule)
 { int ix;
   struct meta_alt_list_rec *alts = mrule -> alts;
   if (mrule -> ext) return;
   if (!mrule -> reachable) return;
   if (mrule -> needs_rec) return;
   mrule -> needs_rec = 1;
   for (ix = 0; ix < alts -> size; ix++)
      mark_rec_in_expr (alts -> array[ix] -> e);
 }


decompiled_code:
void __fastcall prepare_meta_rule(__int64 a1)
{
if ( !*(_DWORD *)(a1 + 16) && *(_DWORD *)(a1 + 48) && !*(_QWORD *)(a1 + 40) )
mark_rec_in_meta_rule(a1);
}

original_code:
static void prepare_meta_rule (meta_rule mrule)
 { if (mrule -> ext) return;
   if (!mrule -> reachable) return;
   if (mrule -> mvalue == ((value) ((void *)0)))
      mark_rec_in_meta_rule (mrule);
 }

canonical_original_code:
static void prepare_meta_rule(struct meta_rule_rec *mrule)
 { if (mrule -> ext) return;
   if (!mrule -> reachable) return;
   if (mrule -> mvalue == ((value) ((void *)0)))
      mark_rec_in_meta_rule (mrule);
 }


decompiled_code:
void prepare_meta_rules()
{
__int64 v0; // rbx

if ( nr_of_meta_rules > 0 )
{
v0 = 0LL;
do
prepare_meta_rule(*(_QWORD *)(all_meta_rules + 8 * v0++));
while ( nr_of_meta_rules > (int)v0 );
}
}

canonical_decompiled_code:
void func15()
{
__int64 v0; // rbx

if ( nr_of_meta_rules > 0 )
{
v0 = 0LL;
do
func14(*(_QWORD *)(all_meta_rules + 8 * v0++));
while ( nr_of_meta_rules > (int)v0 );
}
}

original_code:
static void prepare_meta_rules ()
 { int ix;
   for (ix = 0; ix < nr_of_meta_rules; ix++)
      prepare_meta_rule (all_meta_rules[ix]);
 }

canonical_original_code:
static void prepare_meta_rules()
 { int ix;
   for (ix = 0; ix < nr_of_meta_rules; ix++)
      prepare_meta_rule (all_meta_rules[ix]);
 }


decompiled_code:
void __fastcall mark_rec_in_affix(__int64 a1)
{
if ( !*(_DWORD *)(a1 + 40) )
mark_rec_in_meta_rule(*(_QWORD *)(a1 + 64));
}

original_code:
static void mark_rec_in_affix (affix a)
 { if (a -> tag == 0)
      { meta_rule def = a -> u.var.def;
        mark_rec_in_meta_rule (def);
      };
 }

canonical_original_code:
static void mark_rec_in_affix(struct affix_rec *a)
 { if (a -> tag == 0)
      { struct meta_rule_rec *def = a -> u.var.def;
        mark_rec_in_meta_rule (def);
      };
 }


decompiled_code:
void __fastcall mark_rec_in_affix_list(__int64 a1)
{
__int64 v1; // rbx

if ( *(int *)a1 > 0 )
{
v1 = 0LL;
do
mark_rec_in_affix(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v1++));
while ( *(_DWORD *)a1 > (int)v1 );
}
}

original_code:
static void mark_rec_in_affix_list (affix_list affl)
 { int ix;
   for (ix = 0; ix < affl -> size; ix++)
      mark_rec_in_affix (affl -> array[ix]);
 }

canonical_original_code:
static void mark_rec_in_affix_list(struct affix_list_rec *affl)
 { int ix;
   for (ix = 0; ix < affl -> size; ix++)
      mark_rec_in_affix (affl -> array[ix]);
 }


decompiled_code:
void prepare_grammar()
{
warning("preparing rules for codegeneration...");
init_prepare();
prepare_rules();
warning("preparing meta rules for codegeneration...");
prepare_meta_rules();
}

canonical_decompiled_code:
void func18()
{
warning("preparing rules for codegeneration...");
func0();
func7();
warning("preparing meta rules for codegeneration...");
func15();
}

original_code:
void prepare_grammar ()
 { warning ("preparing rules for codegeneration...");
   init_prepare ();
   prepare_rules ();
   warning ("preparing meta rules for codegeneration...");
   prepare_meta_rules ();
 }

canonical_original_code:
void prepare_grammar()
 { warning ("preparing rules for codegeneration...");
   init_prepare ();
   prepare_rules ();
   warning ("preparing meta rules for codegeneration...");
   prepare_meta_rules ();
 }


decompiled_code:
__int64 init_command_line_parsing()
{
init_error();
init_options();
inputs = new_string_list();
predefs = new_string_list();
return app_string_list(predefs, "eag_stddefs");
}

canonical_decompiled_code:
__int64 func1()
{
init_error();
func0();
inputs = new_string_list();
predefs = new_string_list();
return app_string_list(predefs, "eag_stddefs");
}

original_code:
static void init_command_line_parsing ()
 { init_error ();
   init_options ();
   inputs = new_string_list ();
   predefs = new_string_list ();
   app_string_list (predefs, "eag_stddefs");
 }

canonical_original_code:
static void init_command_line_parsing()
 { init_error ();
   init_options ();
   inputs = new_string_list ();
   predefs = new_string_list ();
   app_string_list (predefs, "eag_stddefs");
 }


decompiled_code:
__int64 report_version()
{
__int64 result; // rax

if ( showversion )
result = wlog("This is EAG, C Version %s, (C) University of Nijmegen", "2.6");
return result;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 result; // rax

if ( showversion )
result = wlog("This is EAG, C Version %s, (C) University of Nijmegen", "2.6");
return result;
}

original_code:
static void report_version ()
 { if (!showversion) return;
   wlog ("This is EAG, C Version %s, (C) University of Nijmegen", "2.6");
 }

canonical_original_code:
static void report_version()
 { if (!showversion) return;
   wlog ("This is EAG, C Version %s, (C) University of Nijmegen", "2.6");
 }


decompiled_code:
__int64 __fastcall new_prelude(int *a1, __int64 a2, const char *a3)
{
int v3; // eax

v3 = *a1 + 1;
*a1 = v3;
if ( v3 == (_DWORD)a2 )
syntax_error((int)"missing prelude name", a2, a3);
return app_string_list(predefs, *(_QWORD *)&a3[8 * v3]);
}

canonical_decompiled_code:
__int64 __fastcall func5(int *a1, __int64 a2, const char *a3)
{
int v3; // eax

v3 = *a1 + 1;
*a1 = v3;
if ( v3 == (_DWORD)a2 )
func4((int)"missing prelude name", a2, a3);
return app_string_list(predefs, *(_QWORD *)&a3[8 * v3]);
}

original_code:
static void new_prelude (int *i, int argc, char **argv)
 { *i += 1;
   if (*i == argc) syntax_error ("missing prelude name");
   app_string_list (predefs, argv[*i]);
 }

canonical_original_code:
static void new_prelude(int *i, int argc, char **argv)
 { *i += 1;
   if (*i == argc) syntax_error ("missing prelude name");
   app_string_list (predefs, argv[*i]);
 }

variable_types:
i
int *

variable_types: argc int

variable_types:
argv
char **


decompiled_code:
__int64 __fastcall new_strstore_size(int *a1, __int64 a2, const char *a3)
{
int v3; // eax
__int64 result; // rax

v3 = *a1 + 1;
*a1 = v3;
if ( v3 == (_DWORD)a2 )
syntax_error((int)"missing size", a2, a3);
result = strtol(*(const char **)&a3[8 * v3], 0LL, 0);
strstore_size = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(int *a1, __int64 a2, const char *a3)
{
int v3; // eax
__int64 result; // rax

v3 = *a1 + 1;
*a1 = v3;
if ( v3 == (_DWORD)a2 )
func4((int)"missing size", a2, a3);
result = strtol(*(const char **)&a3[8 * v3], 0LL, 0);
strstore_size = result;
return result;
}

original_code:
static void new_strstore_size (int *i, int argc, char **argv)
 { *i += 1;
   if (*i == argc) syntax_error ("missing size");
   strstore_size = strtol (argv[*i], (char **)((void *)0), 0);
 }

canonical_original_code:
static void new_strstore_size(int *i, int argc, char **argv)
 { *i += 1;
   if (*i == argc) syntax_error ("missing size");
   strstore_size = strtol (argv[*i], (char **)((void *)0), 0);
 }


decompiled_code:
__int64 init_compiler()
{
init_textstorage((unsigned int)strstore_size);
return init_tree();
}

canonical_decompiled_code:
__int64 func8()
{
init_textstorage((unsigned int)strstore_size);
return init_tree();
}

original_code:
static void init_compiler ()
 { init_textstorage (strstore_size);
   init_tree ();
 }

canonical_original_code:
static void init_compiler()
 { init_textstorage (strstore_size);
   init_tree ();
 }


original_code:
static string basename_from_name (char *name)
 { char basename[1024];
   char *sptr, *dptr;
   for (sptr = name, dptr = basename;
        (*sptr != '\0') && (*sptr != '.');
        sptr++, dptr++)
      *dptr = *sptr;
   *dptr = '\0';
   return (addto_names (basename));
 }

canonical_original_code:
static char *basename_from_name(char *name)
 { char basename[1024];
   char *sptr; char *dptr;
   for (sptr = name, dptr = basename;
        (*sptr != '\0') && (*sptr != '.');
        sptr++, dptr++)
      *dptr = *sptr;
   *dptr = '\0';
   return (addto_names (basename));
 }

variable_types:
name
char *

variable_types:
basename
char [1024]

variable_types:
sptr
char *

variable_types:
dptr
char *


decompiled_code:
__int64 context_sensitive_analysis()
{
do_numbering(0LL);
identification();
do_element_numbering();
infer_typing();
construct_lattices();
do_empty_classification();
flow_check();
return dump_grammar_typing();
}

canonical_decompiled_code:
__int64 func11()
{
do_numbering(0LL);
identification();
do_element_numbering();
infer_typing();
construct_lattices();
do_empty_classification();
flow_check();
return dump_grammar_typing();
}

original_code:
static void context_sensitive_analysis ()
 { do_numbering (0);
   identification ();
   do_element_numbering ();
   infer_typing ();
   construct_lattices ();
   do_empty_classification ();
   flow_check ();
   dump_grammar_typing ();
 }

canonical_original_code:
static void context_sensitive_analysis()
 { do_numbering (0);
   identification ();
   do_element_numbering ();
   infer_typing ();
   construct_lattices ();
   do_empty_classification ();
   flow_check ();
   dump_grammar_typing ();
 }


decompiled_code:
__int64 __fastcall prepare_parser_generation(__int64 a1)
{
__int64 result; // rax

propagate_constants();
check_lexicon();
reduce_grammar();
check_recursion();
if ( placeholderflag )
decide_placeholders();
if ( lookahead )
determine_lookahead_sets();
prepare_grammar();
result = prepare_lexicon(a1);
if ( editor )
{
result = analyze_layout();
if ( editor )
result = generate_unparsing_rules(a1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
__int64 result; // rax

propagate_constants();
check_lexicon();
reduce_grammar();
check_recursion();
if ( placeholderflag )
decide_placeholders();
if ( lookahead )
determine_lookahead_sets();
prepare_grammar();
result = prepare_lexicon(a1);
if ( editor )
{
result = analyze_layout();
if ( editor )
result = generate_unparsing_rules(a1);
}
return result;
}

original_code:
static void prepare_parser_generation (string basename)
 { propagate_constants ();
   check_lexicon ();
   reduce_grammar ();
   check_recursion ();
   if (placeholderflag) decide_placeholders ();
   if (lookahead) determine_lookahead_sets ();
   prepare_grammar ();
   prepare_lexicon (basename);
   if (editor) analyze_layout ();
   if (editor) generate_unparsing_rules (basename);
 }

canonical_original_code:
static void prepare_parser_generation(char *basename)
 { propagate_constants ();
   check_lexicon ();
   reduce_grammar ();
   check_recursion ();
   if (placeholderflag) decide_placeholders ();
   if (lookahead) determine_lookahead_sets ();
   prepare_grammar ();
   prepare_lexicon (basename);
   if (editor) analyze_layout ();
   if (editor) generate_unparsing_rules (basename);
 }

variable_types:
basename
char *


decompiled_code:
__int64 __fastcall generate_code(__int64 a1)
{
__int64 result; // rax

if ( topdown )
result = generate_topdown_parser(a1, predefs);
if ( leftcorner )
result = generate_leftcorner_parser(a1, predefs);
if ( lr )
result = generate_lr_parser(a1, predefs);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1)
{
__int64 result; // rax

if ( topdown )
result = generate_topdown_parser(a1, predefs);
if ( leftcorner )
result = generate_leftcorner_parser(a1, predefs);
if ( lr )
result = generate_lr_parser(a1, predefs);
return result;
}

original_code:
static void generate_code (string basename)
 { if (topdown) generate_topdown_parser (basename, predefs);
   if (leftcorner) generate_leftcorner_parser (basename, predefs);
   if (lr) generate_lr_parser (basename, predefs);
 }

canonical_original_code:
static void generate_code(char *basename)
 { if (topdown) generate_topdown_parser (basename, predefs);
   if (leftcorner) generate_leftcorner_parser (basename, predefs);
   if (lr) generate_lr_parser (basename, predefs);
 }


decompiled_code:
void __fastcall parse_command_line(signed int a1, const char *a2)
{
int i; // eax
char *v4; // rdi
int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v5[0] = 1;
if ( a1 > 1 )
{
for ( i = 1; i < a1; v5[0] = i )
{
v4 = *(char **)&a2[8 * i];
if ( *v4 == 45 )
scan_option(v4 + 1, v5, a1, a2);
else
add_grammar_to_inputs(v4);
i = v5[0] + 1;
}
}
}

original_code:
static void parse_command_line (int argc, char **argv)
 { int ix;
   for (ix = 1; ix < argc; ix++)
      { char *arg = argv[ix];
        if (arg[0] == '-') scan_option (arg+1, &ix, argc, argv);
        else add_grammar_to_inputs (arg);
      };
 }

canonical_original_code:
static void parse_command_line(int argc, char **argv)
 { int ix;
   for (ix = 1; ix < argc; ix++)
      { char *arg = argv[ix];
        if (arg[0] == '-') scan_option (arg+1, &ix, argc, argv);
        else add_grammar_to_inputs (arg);
      };
 }

variable_types:
arg
char *