decompiled_code:
void __fastcall construct_lattices_in_meta_rules(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbx

if ( nr_of_meta_rules > 0 )
{
v3 = 0LL;
do
construct_lattices_in_meta_rule(*(_QWORD *)(all_meta_rules + 8 * v3++), a2, a3);
while ( nr_of_meta_rules > (int)v3 );
}
}

canonical_decompiled_code:
void __fastcall func8(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbx

if ( nr_of_meta_rules > 0 )
{
v3 = 0LL;
do
func7(*(_QWORD *)(all_meta_rules + 8 * v3++), a2, a3);
while ( nr_of_meta_rules > (int)v3 );
}
}

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

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


repo: tjordanchat/eag

decompiled_code:
__int64 __fastcall construct_lattices_in_display(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rbx
__int64 result; // rax
__int64 v6; // rdi

if ( *(int *)a2 > 0 )
{
v4 = 0LL;
do
{
result = *(_QWORD *)(a1 + 8);
v6 = *(_QWORD *)(result + 8 * v4);
if ( (*(_BYTE *)(v6 + 16) & 0x10) != 0 )
result = construct_lattices_in_position(v6, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 8 * v4), a3);
++v4;
}
while ( *(_DWORD *)a2 > (int)v4 );
}
return result;
}

original_code:
static void construct_lattices_in_display (pos_list protodpy, pos_list dpy)
 { int ix;
   for (ix = 0; ix < dpy -> size; ix++)
      { pos protopos = protodpy -> array[ix];
        if (protopos -> type & 16)
    construct_lattices_in_position (protopos, dpy -> array[ix]);
      };
 }

canonical_original_code:
static void construct_lattices_in_display(struct pos_list_rec *protodpy, struct pos_list_rec *dpy)
 { int ix;
   for (ix = 0; ix < dpy -> size; ix++)
      { struct pos_rec *protopos = protodpy -> array[ix];
        if (protopos -> type & 16)
    construct_lattices_in_position (protopos, dpy -> array[ix]);
      };
 }

variable_types: 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; } *

variable_types:
dpy
struct pos_list_rec *

variable_types: ix int

return_type: void

user_defined_types: struct pos_list_rec { int size; int room; struct pos_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 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; }

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


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

if ( !*(_DWORD *)(a1 + 24) )
result = construct_lattices_in_call(a1, a2, a3);
return result;
}

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

if ( !*(_DWORD *)(a1 + 24) )
result = func11(a1, a2, a3);
return result;
}

original_code:
static void construct_lattices_in_member (member m)
 { if (m -> tag != 0) return;
   construct_lattices_in_call (m);
 }

canonical_original_code:
static void construct_lattices_in_member(struct member_rec *m)
 { if (m -> tag != 0) return;
   construct_lattices_in_call (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 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 lexend_list_rec { int size; int room; struct lexend_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; }


decompiled_code:
__int64 __fastcall construct_lattices_in_members(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbx
__int64 result; // rax

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

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbx
__int64 result; // rax

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

original_code:
static void construct_lattices_in_members (member_list mems)
 { int ix;
   for (ix = 0; ix < mems -> size; ix++)
      construct_lattices_in_member (mems -> array[ix]);
 }

canonical_original_code:
static void construct_lattices_in_members(struct member_list_rec *mems)
 { int ix;
   for (ix = 0; ix < mems -> size; ix++)
      construct_lattices_in_member (mems -> array[ix]);
 }

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 pos_list_rec { int size; int room; struct pos_rec **array; }


original_code:
static void construct_lattices_in_rule (rule srule)
 { int ix;
   if (srule -> ext) return;
   for (ix = 0; ix < srule -> alts -> size; ix++)
      construct_lattices_in_alt (srule, srule -> alts -> array[ix]);
 }

canonical_original_code:
static void construct_lattices_in_rule(struct rule_rec *srule)
 { int ix;
   if (srule -> ext) return;
   for (ix = 0; ix < srule -> alts -> size; ix++)
      construct_lattices_in_alt (srule, srule -> 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; } *

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

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:
void __fastcall construct_lattices_in_rules(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbx

if ( nr_of_rules > 0 )
{
v3 = 0LL;
do
construct_lattices_in_rule(*(_QWORD *)(all_rules + 8 * v3++), a2, a3);
while ( nr_of_rules > (int)v3 );
}
}

canonical_decompiled_code:
void __fastcall func16(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rbx

if ( nr_of_rules > 0 )
{
v3 = 0LL;
do
func15(*(_QWORD *)(all_rules + 8 * v3++), a2, a3);
while ( nr_of_rules > (int)v3 );
}
}

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

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


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

all_element_sets = new_element_set_list();
if ( nr_of_elements > 0 )
{
v0 = 0LL;
do
assign_numbers_to_group(*(_QWORD *)(all_elements + 8 * v0++));
while ( nr_of_elements > (int)v0 );
}
}

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

all_element_sets = new_element_set_list();
if ( nr_of_elements > 0 )
{
v0 = 0LL;
do
func17(*(_QWORD *)(all_elements + 8 * v0++));
while ( nr_of_elements > (int)v0 );
}
}

original_code:
static void assign_element_numbers ()
 { int ix;
   all_element_sets = new_element_set_list ();
   for (ix = 0; ix < nr_of_elements; ix++)
      assign_numbers_to_group (all_elements[ix]);
 }

canonical_original_code:
static void assign_element_numbers()
 { int ix;
   all_element_sets = new_element_set_list ();
   for (ix = 0; ix < nr_of_elements; ix++)
      assign_numbers_to_group (all_elements[ix]);
 }


decompiled_code:
void dump_lattices()
{
__int64 v0; // rsi
const char *v1; // rcx
const char *v2; // rdx
__int64 v3; // rax
__int64 v4; // r14
__int64 v5; // rbp
signed int v6; // ebx
const char *v7; // rdx
const char *v8; // rsi
__int64 v9; // r12

if ( full_verbose )
{
v0 = *(unsigned int *)all_element_sets;
v1 = "s";
if ( (_DWORD)v0 != 1 )
v1 = "ve";
v2 = (const char *)&unk_82A;
if ( (_DWORD)v0 != 1 )
v2 = "s";
wlog("%d (super) lattice%s ha%s been found:", v0, v2, v1);
v3 = all_element_sets;
if ( *(int *)all_element_sets > 0 )
{
v4 = 0LL;
do
{
v9 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 8 * v4) + 8LL);
eprint_log("{ ");
if ( *(int *)v9 > 0 )
{
v7 = ***(const char ****)(v9 + 8);
v5 = 8LL;
v6 = 0;
v8 = (const char *)&unk_82A;
while ( 1 )
{
eprint_log("%s%s (%d)", v8, v7, (unsigned int)v6++);
if ( *(_DWORD *)v9 <= v6 )
break;
v7 = **(const char ***)(*(_QWORD *)(v9 + 8) + v5);
v8 = (const char *)&unk_82A;
if ( v6 )
{
v8 = ",\n ";
if ( v6 != 5 * (v6 / 5) )
v8 = ", ";
}
v5 += 8LL;
}
}
eprint_log(" }\n");
v3 = all_element_sets;
++v4;
}
while ( *(_DWORD *)all_element_sets > (int)v4 );
}
}
}

canonical_decompiled_code:
void func19()
{
__int64 v0; // rsi
const char *v1; // rcx
const char *v2; // rdx
__int64 v3; // rax
__int64 v4; // r14
__int64 v5; // rbp
signed int v6; // ebx
const char *v7; // rdx
const char *v8; // rsi
__int64 v9; // r12

if ( full_verbose )
{
v0 = *(unsigned int *)all_element_sets;
v1 = "s";
if ( (_DWORD)v0 != 1 )
v1 = "ve";
v2 = (const char *)&unk_82A;
if ( (_DWORD)v0 != 1 )
v2 = "s";
wlog("%d (super) lattice%s ha%s been found:", v0, v2, v1);
v3 = all_element_sets;
if ( *(int *)all_element_sets > 0 )
{
v4 = 0LL;
do
{
v9 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 8 * v4) + 8LL);
eprint_log("{ ");
if ( *(int *)v9 > 0 )
{
v7 = ***(const char ****)(v9 + 8);
v5 = 8LL;
v6 = 0;
v8 = (const char *)&unk_82A;
while ( 1 )
{
eprint_log("%s%s (%d)", v8, v7, (unsigned int)v6++);
if ( *(_DWORD *)v9 <= v6 )
break;
v7 = **(const char ***)(*(_QWORD *)(v9 + 8) + v5);
v8 = (const char *)&unk_82A;
if ( v6 )
{
v8 = ",\n ";
if ( v6 != 5 * (v6 / 5) )
v8 = ", ";
}
v5 += 8LL;
}
}
eprint_log(" }\n");
v3 = all_element_sets;
++v4;
}
while ( *(_DWORD *)all_element_sets > (int)v4 );
}
}
}

original_code:
static void dump_lattices ()
 { int ix;
   if (!full_verbose) return;
   wlog ("%d (super) lattice%s ha%s been found:",
  all_element_sets -> size,
  (all_element_sets -> size == 1)?"":"s",
  (all_element_sets -> size == 1)?"s":"ve");
   for (ix = 0; ix < all_element_sets -> size; ix++)
      { element_def_list defs = all_element_sets -> array[ix] -> defs;
        int iy;
        eprint_log ("{ ");
        for (iy = 0; iy < defs -> size; iy++)
    eprint_log ("%s%s (%d)", ((!iy)?"":(!(iy % 5))?",\n  ":", "),
        defs -> array[iy] -> eltnm, iy);
        eprint_log (" }\n");
      };
 }

canonical_original_code:
static void dump_lattices()
 { int ix;
   if (!full_verbose) return;
   wlog ("%d (super) lattice%s ha%s been found:",
  all_element_sets -> size,
  (all_element_sets -> size == 1)?"":"s",
  (all_element_sets -> size == 1)?"s":"ve");
   for (ix = 0; ix < all_element_sets -> size; ix++)
      { struct element_def_list_rec *defs = all_element_sets -> array[ix] -> defs;
        int iy;
        eprint_log ("{ ");
        for (iy = 0; iy < defs -> size; iy++)
    eprint_log ("%s%s (%d)", ((!iy)?"":(!(iy % 5))?",\n  ":", "),
        defs -> array[iy] -> eltnm, iy);
        eprint_log (" }\n");
      };
 }

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

variable_types: iy int

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


decompiled_code:
void __fastcall construct_lattices(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
unsigned int v3; // ebp
unsigned int v4; // ebx
const char *v5; // rdx
__int64 v6; // rdx
const char *v7; // rdx

warning("coalescing lattices in meta rules...");
v3 = 0;
do
{
change = 0;
++v3;
construct_lattices_in_meta_rules((__int64)"coalescing lattices in meta rules...", a2, v2);
v4 = change;
}
while ( change );
v5 = (const char *)&unk_82A;
if ( v3 != 1 )
v5 = "es";
hint("needed %d pass%s for coalescing lattices in meta rules", v3, v5);
warning("coalescing lattices in rules...");
do
{
change = 0;
++v4;
construct_lattices_in_rules((__int64)"coalescing lattices in rules...", v3, v6);
}
while ( change );
v7 = (const char *)&unk_82A;
if ( v4 != 1 )
v7 = "es";
hint("needed %d pass%s for coalescing lattices in rules", v4, v7);
assign_element_numbers();
dump_lattices();
}

canonical_decompiled_code:
void __fastcall func20(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
unsigned int v3; // ebp
unsigned int v4; // ebx
const char *v5; // rdx
__int64 v6; // rdx
const char *v7; // rdx

warning("coalescing lattices in meta rules...");
v3 = 0;
do
{
change = 0;
++v3;
func8((__int64)"coalescing lattices in meta rules...", a2, v2);
v4 = change;
}
while ( change );
v5 = (const char *)&unk_82A;
if ( v3 != 1 )
v5 = "es";
hint("needed %d pass%s for coalescing lattices in meta rules", v3, v5);
warning("coalescing lattices in rules...");
do
{
change = 0;
++v4;
func16((__int64)"coalescing lattices in rules...", v3, v6);
}
while ( change );
v7 = (const char *)&unk_82A;
if ( v4 != 1 )
v7 = "es";
hint("needed %d pass%s for coalescing lattices in rules", v4, v7);
func18();
func19();
}

original_code:
void construct_lattices ()
 { int nr_passes = 0;
   warning ("coalescing lattices in meta rules...");
   do
      { change = 0;
        nr_passes++;
        construct_lattices_in_meta_rules ();
      }
   while (change);
   hint ("needed %d pass%s for coalescing lattices in meta rules",
  nr_passes, (nr_passes == 1)?"":"es");
   nr_passes = 0;
   warning ("coalescing lattices in rules...");
   do
      { change = 0;
        nr_passes++;
        construct_lattices_in_rules ();
      }
   while (change);
   hint ("needed %d pass%s for coalescing lattices in rules",
  nr_passes, (nr_passes == 1)?"":"es");
   assign_element_numbers ();
   dump_lattices ();
 }

canonical_original_code:
void construct_lattices()
 { int nr_passes = 0;
   warning ("coalescing lattices in meta rules...");
   do
      { change = 0;
        nr_passes++;
        construct_lattices_in_meta_rules ();
      }
   while (change);
   hint ("needed %d pass%s for coalescing lattices in meta rules",
  nr_passes, (nr_passes == 1)?"":"es");
   nr_passes = 0;
   warning ("coalescing lattices in rules...");
   do
      { change = 0;
        nr_passes++;
        construct_lattices_in_rules ();
      }
   while (change);
   hint ("needed %d pass%s for coalescing lattices in rules",
  nr_passes, (nr_passes == 1)?"":"es");
   assign_element_numbers ();
   dump_lattices ();
 }


decompiled_code:
void __fastcall mark_in_expression(__int64 a1)
{
int v1; // eax

if ( a1 )
{
v1 = *(_DWORD *)a1;
if ( *(_DWORD *)a1 == 3 )
goto LABEL_6;
if ( v1 > 3 )
{
if ( v1 == 4 )
goto LABEL_6;
}
else
{
if ( v1 == 1 )
{
mark_in_affix(*(_QWORD *)(a1 + 8));
return;
}
if ( v1 == 2 )
{
LABEL_6:
mark_in_affix_list(*(_QWORD *)(a1 + 8));
return;
}
}
bad_tag((unsigned int)v1, "mark_in_expression");
}
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1)
{
int v1; // eax

if ( a1 )
{
v1 = *(_DWORD *)a1;
if ( *(_DWORD *)a1 == 3 )
goto LABEL_6;
if ( v1 > 3 )
{
if ( v1 == 4 )
goto LABEL_6;
}
else
{
if ( v1 == 1 )
{
func7(*(_QWORD *)(a1 + 8));
return;
}
if ( v1 == 2 )
{
LABEL_6:
func8(*(_QWORD *)(a1 + 8));
return;
}
}
bad_tag((unsigned int)v1, "mark_in_expression");
}
}

original_code:
static void mark_in_expression (expr e)
 { if (e == ((expr) ((void *)0))) return;
   switch (e -> tag)
      { case 1: mark_in_affix (e -> u.single); break;
        case 3: mark_in_affix_list (e -> u.concat); break;
        case 2: mark_in_affix_list (e -> u.compos); break;
        case 4: mark_in_affix_list (e -> u.uni); break;
        default: bad_tag (e -> tag, "mark_in_expression");
      };
 }

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

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


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

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

original_code:
static void mark_in_display (pos_list dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   for (ix = 0; ix < dpy -> size; ix++)
      mark_in_position (dpy -> array[ix]);
 }

canonical_original_code:
static void mark_in_display(struct pos_list_rec *dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   for (ix = 0; ix < dpy -> size; ix++)
      mark_in_position (dpy -> array[ix]);
 }

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 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 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_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 meta_alt_rec { struct expr_rec *e; int number; }


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

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

original_code:
static void mark_in_meta_alts (meta_alt_list al)
 { int ix;
   if (al == ((meta_alt_list) ((void *)0))) return;
   for (ix = 0; ix < al -> size; ix++)
      mark_in_expression (al -> array[ix] -> e);
 }

canonical_original_code:
static void mark_in_meta_alts(struct meta_alt_list_rec *al)
 { int ix;
   if (al == ((meta_alt_list) ((void *)0))) return;
   for (ix = 0; ix < al -> size; ix++)
      mark_in_expression (al -> array[ix] -> e);
 }

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

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


original_code:
static void mark_in_meta_rule (meta_rule mrule)
 { if (mrule -> reachable) return;
   mrule -> reachable = 1;
   if (mrule -> ext) return;
   mark_in_meta_alts (mrule -> alts);
 }

canonical_original_code:
static void mark_in_meta_rule(struct meta_rule_rec *mrule)
 { if (mrule -> reachable) return;
   mrule -> reachable = 1;
   if (mrule -> ext) return;
   mark_in_meta_alts (mrule -> alts);
 }

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


decompiled_code:
void __fastcall mark_in_affix(__int64 a1)
{
if ( !*(_DWORD *)(a1 + 40) )
mark_in_affix_variable(a1);
*(_DWORD *)(a1 + 36) = 1;
}

original_code:
static void mark_in_affix (affix a)
 { if (a -> tag == 0)
      mark_in_affix_variable (a);
   a -> reachable = 1;
 }

canonical_original_code:
static void mark_in_affix(struct affix_rec *a)
 { if (a -> tag == 0)
      mark_in_affix_variable (a);
   a -> reachable = 1;
 }

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_in_affix_list(__int64 a1)
{
__int64 v1; // rbx

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

original_code:
static void mark_in_affix_list (affix_list al)
 { int ix;
   for (ix = 0; ix < al -> size; ix++)
      mark_in_affix (al -> array[ix]);
 }

canonical_original_code:
static void mark_in_affix_list(struct affix_list_rec *al)
 { int ix;
   for (ix = 0; ix < al -> size; ix++)
      mark_in_affix (al -> 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; } *


decompiled_code:
void __fastcall mark_in_member(__int64 a1, __int64 a2)
{
__int64 v3; // rdi

v3 = *(unsigned int *)(a2 + 24);
if ( (_DWORD)v3 == 2 )
{
mark_in_semiterminal(a1, a2);
return;
}
if ( (int)v3 > 2 )
{
if ( (_DWORD)v3 == 3 )
return;
LABEL_7:
bad_tag(v3, "mark_in_member");
return;
}
if ( !(_DWORD)v3 )
{
mark_in_call(a1);
return;
}
if ( (_DWORD)v3 != 1 )
goto LABEL_7;
}

canonical_decompiled_code:
void __fastcall func9(__int64 a1, __int64 a2)
{
__int64 v3; // rdi

v3 = *(unsigned int *)(a2 + 24);
if ( (_DWORD)v3 == 2 )
{
func3(a1, a2);
return;
}
if ( (int)v3 > 2 )
{
if ( (_DWORD)v3 == 3 )
return;
LABEL_7:
bad_tag(v3, "mark_in_member");
return;
}
if ( !(_DWORD)v3 )
{
func14(a1);
return;
}
if ( (_DWORD)v3 != 1 )
goto LABEL_7;
}

original_code:
static void mark_in_member (rule srule, member m)
 { switch (m -> tag)
      { case 0: mark_in_call (srule, m);
        case 1: break;
        case 2: mark_in_semiterminal (srule, m);
        case 3: break;
        default: bad_tag (m -> tag, "mark_in_member");
      };
 }

canonical_original_code:
static void mark_in_member(struct rule_rec *srule, struct member_rec *m)
 { switch (m -> tag)
      { case 0: mark_in_call (srule, m);
        case 1: break;
        case 2: mark_in_semiterminal (srule, m);
        case 3: break;
        default: bad_tag (m -> tag, "mark_in_member");
      };
 }

variable_types:
m
struct member_rec *

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 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 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 lexend_rec { int nodenr; struct int_list_rec *valuenrs; }

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 semiterminal_rec { struct cset_rec *set; struct pos_list_rec *display; }


decompiled_code:
void __fastcall mark_in_members(__int64 a1, __int64 a2)
{
__int64 v2; // rbx

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

original_code:
static void mark_in_members (rule srule, member_list mems)
 { int ix;
   if (mems == ((member_list) ((void *)0))) return;
   for (ix = 0; ix < mems -> size; ix++)
      mark_in_member (srule, mems -> array[ix]);
 }

canonical_original_code:
static void mark_in_members(struct rule_rec *srule, struct member_list_rec *mems)
 { int ix;
   if (mems == ((member_list) ((void *)0))) return;
   for (ix = 0; ix < mems -> size; ix++)
      mark_in_member (srule, mems -> array[ix]);
 }

variable_types:
mems
struct member_list_rec *

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

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 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 variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; }

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 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 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:
void __fastcall mark_in_alt(__int64 a1, __int64 *a2)
{
mark_in_display(*a2);
mark_in_members(a1, a2[1]);
}

original_code:
static void mark_in_alt (rule srule, alt a)
 { mark_in_display (a -> display);
   mark_in_members (srule, a -> members);
 }

canonical_original_code:
static void mark_in_alt(struct rule_rec *srule, struct alt_rec *a)
 { mark_in_display (a -> display);
   mark_in_members (srule, a -> members);
 }

variable_types:
a
struct alt_rec *

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 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 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 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 meta_alt_rec { struct expr_rec *e; int number; }


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

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

variable_types:
alts
struct alt_list_rec *

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 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 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 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 variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; }

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

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


original_code:
static void mark_in_rule (rule srule)
 { if (srule -> reachable) return;
   srule -> reachable = 1;
   if (srule -> ext) return;
   mark_in_alts (srule, srule -> alts);
 }

canonical_original_code:
static void mark_in_rule(struct rule_rec *srule)
 { if (srule -> reachable) return;
   srule -> reachable = 1;
   if (srule -> ext) return;
   mark_in_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 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 lextree_list_rec { int size; int room; struct lextree_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 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 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:
void __fastcall mark_in_call(__int64 a1, __int64 a2)
{
mark_in_rule(*(_QWORD *)(a2 + 48));
mark_in_display(*(_QWORD *)(a2 + 40));
*(_DWORD *)(a1 + 76) = 1;
}

original_code:
static void mark_in_call (rule srule, member m)
 { mark_in_rule (m -> u.call.def);
   mark_in_display (m -> u.call.display);
   srule -> has_sons = 1;
 }

canonical_original_code:
static void mark_in_call(struct rule_rec *srule, struct member_rec *m)
 { mark_in_rule (m -> u.call.def);
   mark_in_display (m -> u.call.display);
   srule -> has_sons = 1;
 }

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 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 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 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 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 meta_alt_rec { struct expr_rec *e; int number; }


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

if ( full_verbose )
{
if ( nr_of_rules > 0 )
{
v0 = 0LL;
do
result = report_on_rule(*(_QWORD *)(all_rules + 8 * v0++));
while ( nr_of_rules > (int)v0 );
}
if ( nr_of_meta_rules > 0 )
{
v2 = 0LL;
do
result = report_on_meta_rule(*(_QWORD *)(all_meta_rules + 8 * v2++));
while ( nr_of_meta_rules > (int)v2 );
}
}
return result;
}

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

if ( full_verbose )
{
if ( nr_of_rules > 0 )
{
v0 = 0LL;
do
result = func15(*(_QWORD *)(all_rules + 8 * v0++));
while ( nr_of_rules > (int)v0 );
}
if ( nr_of_meta_rules > 0 )
{
v2 = 0LL;
do
result = func16(*(_QWORD *)(all_meta_rules + 8 * v2++));
while ( nr_of_meta_rules > (int)v2 );
}
}
return result;
}

original_code:
static void try_report_on_grammar_reduction ()
 { int ix;
   if (!full_verbose) return;
   for (ix = 0; ix < nr_of_rules; ix++)
      report_on_rule (all_rules[ix]);
   for (ix = 0; ix < nr_of_meta_rules; ix++)
      report_on_meta_rule (all_meta_rules[ix]);
 }

canonical_original_code:
static void try_report_on_grammar_reduction()
 { int ix;
   if (!full_verbose) return;
   for (ix = 0; ix < nr_of_rules; ix++)
      report_on_rule (all_rules[ix]);
   for (ix = 0; ix < nr_of_meta_rules; ix++)
      report_on_meta_rule (all_meta_rules[ix]);
 }


decompiled_code:
__int64 reduce_grammar()
{
warning("reducing grammar...");
mark_in_rule(*(_QWORD *)(start_rule + 48LL));
mark_in_display(*(_QWORD *)(start_rule + 40LL));
return try_report_on_grammar_reduction();
}

canonical_decompiled_code:
__int64 func18()
{
warning("reducing grammar...");
func13(*(_QWORD *)(start_rule + 48LL));
func2(*(_QWORD *)(start_rule + 40LL));
return func17();
}

original_code:
void reduce_grammar ()
 { warning ("reducing grammar...");
   mark_in_rule (start_rule -> u.call.def);
   mark_in_display (start_rule -> u.call.display);
   try_report_on_grammar_reduction ();
 }

canonical_original_code:
void reduce_grammar()
 { warning ("reducing grammar...");
   mark_in_rule (start_rule -> u.call.def);
   mark_in_display (start_rule -> u.call.display);
   try_report_on_grammar_reduction ();
 }


decompiled_code:
void init_flow()
{
flow_errors = 0;
}

canonical_decompiled_code:
void func0()
{
flow_errors = 0;
}

original_code:
static void init_flow ()
 { flow_errors = 0;
 }

canonical_original_code:
static void init_flow()
 { flow_errors = 0;
 }


decompiled_code:
__int64 __fastcall no_inherited_positions(__int64 a1)
{
_DWORD **v1; // rax
__int64 v2; // rcx

if ( *(int *)a1 <= 0 )
return 1LL;
v1 = *(_DWORD ***)(a1 + 8);
v2 = (__int64)&v1[(unsigned int)(*(_DWORD *)a1 - 1) + 1];
while ( **v1 != 1 )
{
if ( ++v1 == (_DWORD **)v2 )
return 1LL;
}
return 0LL;
}

original_code:
static int no_inherited_positions (pos_list proto)
 { int ix;
   for (ix = 0; ix < proto -> size; ix++)
      if (proto -> array[ix] -> kind == 1)
  return (0);
   return (1);
 }

canonical_original_code:
static int no_inherited_positions(struct pos_list_rec *proto)
 { int ix;
   for (ix = 0; ix < proto -> size; ix++)
      if (proto -> array[ix] -> kind == 1)
  return (0);
   return (1);
 }

variable_types: 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; } *

return_type: int

user_defined_types: struct pos_list_rec { int size; int room; struct pos_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 variable_rec { char *nonterminal; char *suffix; struct meta_rule_rec *def; }


decompiled_code:
void __fastcall check_if_semipredicate(__int64 a1)
{
int v1; // ebp

if ( !*(_DWORD *)(a1 + 28) )
{
v1 = *(_DWORD *)(a1 + 16);
if ( (v1 & 2) != 0 )
{
if ( (unsigned int)no_inherited_positions(*(_QWORD *)(a1 + 64)) )
*(_DWORD *)(a1 + 16) = v1 & 0xFFFFFFFD | 4;
}
}
}

original_code:
static void check_if_semipredicate (rule srule)
 { if (srule -> ext) return;
   if (!(srule -> kind & 2)) return;
   if (no_inherited_positions (srule -> proto_display))
      { srule -> kind &= ~2;
        srule -> kind |= 4;
      };
 }

canonical_original_code:
static void check_if_semipredicate(struct rule_rec *srule)
 { if (srule -> ext) return;
   if (!(srule -> kind & 2)) return;
   if (no_inherited_positions (srule -> proto_display))
      { srule -> kind &= ~2;
        srule -> kind |= 4;
      };
 }

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 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 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 member_list_rec { int size; int room; struct member_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 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 value_list_rec { int size; int room; struct value_rec **array; }

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


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

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

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

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

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

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


decompiled_code:
void __fastcall merge_flow_in_displays(const char **a1, unsigned int a2, __int64 a3, __int64 a4)
{
__int64 v6; // rbx

if ( a4 && *(int *)a3 > 0 )
{
v6 = 0LL;
do
{
merge_flow_in_position(
a1,
a2,
*(_DWORD **)(*(_QWORD *)(a3 + 8) + 8 * v6),
*(_DWORD **)(*(_QWORD *)(a4 + 8) + 8 * v6));
++v6;
}
while ( *(_DWORD *)a3 > (int)v6 );
}
}

original_code:
static void merge_flow_in_displays (rule srule, int altnr, pos_list proto,
         pos_list dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   for (ix = 0; ix < proto -> size; ix++)
      merge_flow_in_position (srule, altnr,
         proto -> array[ix], dpy -> array[ix]);
 }

canonical_original_code:
static void merge_flow_in_displays(struct rule_rec *srule, int altnr, struct pos_list_rec *proto, struct pos_list_rec *dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   for (ix = 0; ix < proto -> size; ix++)
      merge_flow_in_position (srule, altnr,
         proto -> array[ix], dpy -> array[ix]);
 }

variable_types: altnr int

variable_types:
proto
struct pos_list_rec *

variable_types:
dpy
struct pos_list_rec *

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 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 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 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 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:
void __fastcall deduce_initial_flow_in_alts(__int64 a1, __int64 a2)
{
__int64 v2; // rbx

if ( *(int *)a2 > 0 )
{
v2 = 0LL;
do
{
deduce_initial_flow_in_alt(a1, v2 + 1, *(__int64 **)(*(_QWORD *)(a2 + 8) + 8 * v2));
++v2;
}
while ( *(_DWORD *)a2 > (int)v2 );
}
}

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

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

variable_types: ix int

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 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 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 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 element_rec { char *eltnm; struct element_def_rec *def; }

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


decompiled_code:
void __fastcall deduce_initial_flow_in_rule(__int64 a1)
{
deduce_initial_flow_in_alts(a1, *(_QWORD *)(a1 + 8));
}

canonical_decompiled_code:
void __fastcall func9(__int64 a1)
{
func8(a1, *(_QWORD *)(a1 + 8));
}

original_code:
static void deduce_initial_flow_in_rule (rule srule)
 { deduce_initial_flow_in_alts (srule, srule -> alts);
 }

canonical_original_code:
static void deduce_initial_flow_in_rule(struct rule_rec *srule)
 { deduce_initial_flow_in_alts (srule, srule -> alts);
 }

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

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

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


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

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

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

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

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

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


decompiled_code:
void flow_check()
{
const char *v0; // rcx
const char *v1; // rdx

warning("checking flow...");
init_flow();
deduce_initial_flow_in_rules();
if ( flow_errors )
{
v0 = "as";
if ( flow_errors != 1 )
v0 = "ere";
v1 = (const char *)&unk_30E;
if ( flow_errors != 1 )
v1 = "s";
panic("%d flow error%s w%s found", (unsigned int)flow_errors, v1, v0);
}
hint("determing semipredicates...");
check_for_semipredicates();
}

canonical_decompiled_code:
void func11()
{
const char *v0; // rcx
const char *v1; // rdx

warning("checking flow...");
func0();
func10();
if ( flow_errors )
{
v0 = "as";
if ( flow_errors != 1 )
v0 = "ere";
v1 = (const char *)&unk_30E;
if ( flow_errors != 1 )
v1 = "s";
panic("%d flow error%s w%s found", (unsigned int)flow_errors, v1, v0);
}
hint("determing semipredicates...");
func3();
}

original_code:
void flow_check ()
 { warning ("checking flow...");
   init_flow ();
   deduce_initial_flow_in_rules ();
   if (flow_errors)
      panic ("%d flow error%s w%s found", flow_errors,
      (flow_errors == 1)?"":"s", (flow_errors == 1)?"as":"ere");
   hint ("determing semipredicates...");
   check_for_semipredicates ();
 }

canonical_original_code:
void flow_check()
 { warning ("checking flow...");
   init_flow ();
   deduce_initial_flow_in_rules ();
   if (flow_errors)
      panic ("%d flow error%s w%s found", flow_errors,
      (flow_errors == 1)?"":"s", (flow_errors == 1)?"as":"ere");
   hint ("determing semipredicates...");
   check_for_semipredicates ();
 }


canonical_decompiled_code:
void func0()
{
nr_of_rules = 0;
nr_of_alts = 0;
nr_of_members = 0;
max_members_per_alt = 0;
nr_of_meta_rules = 0;
nr_of_meta_alts = 0;
nr_of_elements = 0;
}

original_code:
static void init_numbering ()
 { nr_of_rules = 0;
   nr_of_alts = 0;
   nr_of_members = 0;
   max_members_per_alt = 0;
   nr_of_meta_rules = 0;
   nr_of_meta_alts = 0;
   nr_of_elements = 0;
 }

canonical_original_code:
static void init_numbering()
 { nr_of_rules = 0;
   nr_of_alts = 0;
   nr_of_members = 0;
   max_members_per_alt = 0;
   nr_of_meta_rules = 0;
   nr_of_meta_alts = 0;
   nr_of_elements = 0;
 }


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

v1 = nr_of_members;
*(_DWORD *)(a1 + 16) = nr_of_members;
result = (unsigned int)(v1 + 1);
nr_of_members = result;
return result;
}

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

v1 = nr_of_members;
*(_DWORD *)(a1 + 16) = nr_of_members;
result = (unsigned int)(v1 + 1);
nr_of_members = result;
return result;
}

original_code:
static void number_member (member m)
 { m -> number = nr_of_members;
   nr_of_members++;
 }

canonical_original_code:
static void number_member(struct member_rec *m)
 { m -> number = nr_of_members;
   nr_of_members++;
 }

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 call_rec { char *nonterminal; struct pos_list_rec *display; struct rule_rec *def; }

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


decompiled_code:
__int64 __fastcall number_alt(int a1, __int64 a2)
{
unsigned int *v2; // rbp
int v3; // eax
__int64 result; // rax
__int64 v5; // rbx

v2 = *(unsigned int **)(a2 + 8);
v3 = nr_of_alts;
*(_DWORD *)(a2 + 16) = nr_of_alts;
result = (unsigned int)(v3 + 1);
nr_of_alts = result;
*(_DWORD *)(a2 + 64) = a1;
if ( v2 )
{
result = *v2;
if ( (int)result > max_members_per_alt )
max_members_per_alt = *v2;
if ( (int)*v2 > 0 )
{
v5 = 0LL;
do
result = number_member(*(_QWORD *)(*((_QWORD *)v2 + 1) + 8 * v5++));
while ( (int)*v2 > (int)v5 );
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, __int64 a2)
{
unsigned int *v2; // rbp
int v3; // eax
__int64 result; // rax
__int64 v5; // rbx

v2 = *(unsigned int **)(a2 + 8);
v3 = nr_of_alts;
*(_DWORD *)(a2 + 16) = nr_of_alts;
result = (unsigned int)(v3 + 1);
nr_of_alts = result;
*(_DWORD *)(a2 + 64) = a1;
if ( v2 )
{
result = *v2;
if ( (int)result > max_members_per_alt )
max_members_per_alt = *v2;
if ( (int)*v2 > 0 )
{
v5 = 0LL;
do
result = func1(*(_QWORD *)(*((_QWORD *)v2 + 1) + 8 * v5++));
while ( (int)*v2 > (int)v5 );
}
}
return result;
}

original_code:
static void number_alt (int rule_nr, alt a)
 { member_list mems = a -> members;
   int ix;
   a -> number = nr_of_alts;
   nr_of_alts++;
   a -> rule_nr = rule_nr;
   if (mems == ((member_list) ((void *)0))) return;
   if (mems -> size > max_members_per_alt)
      max_members_per_alt = mems -> size;
   for (ix = 0; ix < mems -> size; ix++)
      number_member (mems -> array[ix]);
 }

canonical_original_code:
static void number_alt(int rule_nr, struct alt_rec *a)
 { struct member_list_rec *mems = a -> members;
   int ix;
   a -> number = nr_of_alts;
   nr_of_alts++;
   a -> rule_nr = rule_nr;
   if (mems == ((member_list) ((void *)0))) return;
   if (mems -> size > max_members_per_alt)
      max_members_per_alt = mems -> size;
   for (ix = 0; ix < mems -> size; ix++)
      number_member (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: 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 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; }


decompiled_code:
__int64 __fastcall number_rule(__int64 a1)
{
__int64 v1; // rbp
int v2; // eax
__int64 result; // rax
__int64 v4; // rbx

v1 = *(_QWORD *)(a1 + 8);
v2 = nr_of_rules;
*(_DWORD *)(a1 + 32) = nr_of_rules;
result = (unsigned int)(v2 + 1);
nr_of_rules = result;
if ( *(int *)v1 > 0 )
{
v4 = 0LL;
do
result = number_alt(*(_DWORD *)(a1 + 32), *(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v4++));
while ( *(_DWORD *)v1 > (int)v4 );
}
return result;
}

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

v1 = *(_QWORD *)(a1 + 8);
v2 = nr_of_rules;
*(_DWORD *)(a1 + 32) = nr_of_rules;
result = (unsigned int)(v2 + 1);
nr_of_rules = result;
if ( *(int *)v1 > 0 )
{
v4 = 0LL;
do
result = func2(*(_DWORD *)(a1 + 32), *(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v4++));
while ( *(_DWORD *)v1 > (int)v4 );
}
return result;
}

original_code:
static void number_rule (rule rule)
 { alt_list alts = rule -> alts;
   int ix;
   rule -> number = nr_of_rules;
   nr_of_rules++;
   for (ix = 0; ix < alts -> size; ix++)
      number_alt (rule -> number, alts -> array[ix]);
 }

canonical_original_code:
static void number_rule(struct rule_rec *rule)
 { struct alt_list_rec *alts = rule -> alts;
   int ix;
   rule -> number = nr_of_rules;
   nr_of_rules++;
   for (ix = 0; ix < alts -> size; ix++)
      number_alt (rule -> number, alts -> array[ix]);
 }

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


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

if ( a1 )
{
number_rule(*a1);
number_rules(a1[1]);
result = number_rules(a1[2]);
}
return result;
}

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

if ( a1 )
{
func3(*a1);
func4(a1[1]);
result = func4(a1[2]);
}
return result;
}

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

canonical_original_code:
static void number_rules(struct rule_tree_rec *root)
 { if (root == ((rule_tree) ((void *)0))) return;
   number_rule (root -> node);
   number_rules (root -> left);
   number_rules (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 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 __fastcall number_meta_alt(__int64 a1)
{
int v1; // eax
__int64 result; // rax

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

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

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

original_code:
static void number_meta_alt (meta_alt a)
 { a -> number = nr_of_meta_alts;
   nr_of_meta_alts++;
 }

canonical_original_code:
static void number_meta_alt(struct meta_alt_rec *a)
 { a -> number = nr_of_meta_alts;
   nr_of_meta_alts++;
 }

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

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 number_meta_rule(__int64 a1)
{
__int64 v1; // rbp
int v2; // eax
__int64 result; // rax
__int64 v4; // rbx

v1 = *(_QWORD *)(a1 + 8);
v2 = nr_of_meta_rules;
*(_DWORD *)(a1 + 32) = nr_of_meta_rules;
result = (unsigned int)(v2 + 1);
nr_of_meta_rules = result;
if ( v1 && *(int *)v1 > 0 )
{
v4 = 0LL;
do
result = number_meta_alt(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v4++));
while ( *(_DWORD *)v1 > (int)v4 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
__int64 v1; // rbp
int v2; // eax
__int64 result; // rax
__int64 v4; // rbx

v1 = *(_QWORD *)(a1 + 8);
v2 = nr_of_meta_rules;
*(_DWORD *)(a1 + 32) = nr_of_meta_rules;
result = (unsigned int)(v2 + 1);
nr_of_meta_rules = result;
if ( v1 && *(int *)v1 > 0 )
{
v4 = 0LL;
do
result = func5(*(_QWORD *)(*(_QWORD *)(v1 + 8) + 8 * v4++));
while ( *(_DWORD *)v1 > (int)v4 );
}
return result;
}

original_code:
static void number_meta_rule (meta_rule mrule)
 { int ix;
   meta_alt_list alts = mrule -> alts;
   mrule -> number = nr_of_meta_rules;
   nr_of_meta_rules++;
   if (alts == ((meta_alt_list) ((void *)0))) return;
   for (ix = 0; ix < alts -> size; ix++)
      number_meta_alt (alts -> array[ix]);
 }

canonical_original_code:
static void number_meta_rule(struct meta_rule_rec *mrule)
 { int ix;
   struct meta_alt_list_rec *alts = mrule -> alts;
   mrule -> number = nr_of_meta_rules;
   nr_of_meta_rules++;
   if (alts == ((meta_alt_list) ((void *)0))) return;
   for (ix = 0; ix < alts -> size; ix++)
      number_meta_alt (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; } *

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