decompiled_code:
__int64 __fastcall unparse_affix_variable(__int64 a1)
{
eprint_log("%s", *(const char **)(a1 + 48));
return eprint_log("%s", *(const char **)(a1 + 56));
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
eprint_log("%s", *(const char **)(a1 + 48));
return eprint_log("%s", *(const char **)(a1 + 56));
}

original_code:
static void unparse_affix_variable (affix a)
 { eprint_log ("%s", a -> u.var.nonterminal);
   eprint_log ("%s", a -> u.var.suffix);
 }

canonical_original_code:
static void unparse_affix_variable(struct affix_rec *a)
 { eprint_log ("%s", a -> u.var.nonterminal);
   eprint_log ("%s", a -> u.var.suffix);
 }

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

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


repo: tjordanchat/eag

decompiled_code:
__int64 __fastcall unparse_integer(unsigned int a1)
{
return eprint_log("%d", a1);
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int a1)
{
return eprint_log("%d", a1);
}

original_code:
static void unparse_integer (int n)
 { eprint_log ("%d", n);
 }

canonical_original_code:
static void unparse_integer(int n)
 { eprint_log ("%d", n);
 }

variable_types: n int

return_type: void


decompiled_code:
__int64 __fastcall unparse_real(double a1)
{
return eprint_log("%g", a1);
}

canonical_decompiled_code:
__int64 __fastcall func3(double a1)
{
return eprint_log("%g", a1);
}

original_code:
static void unparse_real (real n)
 { eprint_log ("%g", n);
 }

canonical_original_code:
static void unparse_real(double n)
 { eprint_log ("%g", n);
 }

variable_types: n double


decompiled_code:
__int64 __fastcall unparse_string_or_set(_BYTE *a1)
{
__int64 v1; // rsi
_BYTE *v2; // rbx
__int64 result; // rax

v1 = (unsigned int)(char)*a1;
if ( *a1 )
{
v2 = a1;
do
{
while ( (_BYTE)v1 == 10 )
{
++v2;
result = eprint_log("\\n");
v1 = (unsigned int)(char)*v2;
if ( !*v2 )
return result;
}
switch ( (_BYTE)v1 )
{
case 9:
result = eprint_log("\\t");
break;
case 0x22:
result = eprint_log("\\\"");
break;
case 0x5D:
result = eprint_log("\\]");
break;
case 0x5C:
result = eprint_log("\\\\");
break;
default:
result = eprint_log("%c", v1);
break;
}
v1 = (unsigned int)(char)*++v2;
}
while ( (_BYTE)v1 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(_BYTE *a1)
{
__int64 v1; // rsi
_BYTE *v2; // rbx
__int64 result; // rax

v1 = (unsigned int)(char)*a1;
if ( *a1 )
{
v2 = a1;
do
{
while ( (_BYTE)v1 == 10 )
{
++v2;
result = eprint_log("\\n");
v1 = (unsigned int)(char)*v2;
if ( !*v2 )
return result;
}
switch ( (_BYTE)v1 )
{
case 9:
result = eprint_log("\\t");
break;
case 0x22:
result = eprint_log("\\\"");
break;
case 0x5D:
result = eprint_log("\\]");
break;
case 0x5C:
result = eprint_log("\\\\");
break;
default:
result = eprint_log("%c", v1);
break;
}
v1 = (unsigned int)(char)*++v2;
}
while ( (_BYTE)v1 );
}
return result;
}

original_code:
static void unparse_string_or_set (string str)
 { char *ptr;
   for (ptr = str; *ptr; ptr++)
      { char c = *ptr;
        if (c == '\n') eprint_log ("\\n");
        else if (c == '\t') eprint_log ("\\t");
        else if (c == '"') eprint_log ("\\\"");
        else if (c == ']') eprint_log ("\\]");
        else if (c == '\\') eprint_log ("\\\\");
        else eprint_log ("%c", c);
      };
 }

canonical_original_code:
static void unparse_string_or_set(char *str)
 { char *ptr;
   for (ptr = str; *ptr; ptr++)
      { char c = *ptr;
        if (c == '\n') eprint_log ("\\n");
        else if (c == '\t') eprint_log ("\\t");
        else if (c == '"') eprint_log ("\\\"");
        else if (c == ']') eprint_log ("\\]");
        else if (c == '\\') eprint_log ("\\\\");
        else eprint_log ("%c", c);
      };
 }

variable_types:
str
char *

variable_types:
ptr
char *

variable_types: c char


decompiled_code:
__int64 __fastcall unparse_set(unsigned int *a1)
{
__int64 result; // rax

if ( (*(_BYTE *)a1 & 8) != 0 )
eprint_log("^");
eprint_log((const char *)asc_9E0);
unparse_string_or_set(*((_BYTE **)a1 + 1));
eprint_log((const char *)&asc_9E0[1]);
result = *a1;
if ( (result & 4) != 0 )
{
eprint_log((const char *)&asc_9E0[2]);
result = *a1;
}
if ( (result & 2) != 0 )
{
eprint_log((const char *)&asc_9E0[3]);
result = *a1;
}
if ( (result & 1) != 0 )
result = eprint_log((const char *)&asc_9E0[4]);
return result;
}

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

if ( (*(_BYTE *)a1 & 8) != 0 )
eprint_log("^");
eprint_log((const char *)asc_9E0);
func4(*((_BYTE **)a1 + 1));
eprint_log((const char *)&asc_9E0[1]);
result = *a1;
if ( (result & 4) != 0 )
{
eprint_log((const char *)&asc_9E0[2]);
result = *a1;
}
if ( (result & 2) != 0 )
{
eprint_log((const char *)&asc_9E0[3]);
result = *a1;
}
if ( (result & 1) != 0 )
result = eprint_log((const char *)&asc_9E0[4]);
return result;
}

original_code:
static void unparse_set (cset set)
 { if (set -> kind & 8) eprint_log ("^");
   eprint_log ("{");
   unparse_string_or_set (set -> str);
   eprint_log ("}");
   if (set -> kind & 4) eprint_log ("*");
   if (set -> kind & 2) eprint_log ("+");
   if (set -> kind & 1) eprint_log ("!");
 }

canonical_original_code:
static void unparse_set(struct cset_rec *set)
 { if (set -> kind & 8) eprint_log ("^");
   eprint_log ("{");
   unparse_string_or_set (set -> str);
   eprint_log ("}");
   if (set -> kind & 4) eprint_log ("*");
   if (set -> kind & 2) eprint_log ("+");
   if (set -> kind & 1) eprint_log ("!");
 }

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


decompiled_code:
__int64 __fastcall unparse_string(_BYTE *a1)
{
eprint_log("%c", 34LL);
unparse_string_or_set(a1);
return eprint_log("%c", 34LL);
}

canonical_decompiled_code:
__int64 __fastcall func6(_BYTE *a1)
{
eprint_log("%c", 34LL);
func4(a1);
return eprint_log("%c", 34LL);
}

original_code:
static void unparse_string (string str)
 { eprint_log ("%c", '"');
   unparse_string_or_set (str);
   eprint_log ("%c", '"');
 }

canonical_original_code:
static void unparse_string(char *str)
 { eprint_log ("%c", '"');
   unparse_string_or_set (str);
   eprint_log ("%c", '"');
 }


decompiled_code:
const char *__fastcall string_from_meta_kind(__int64 a1)
{
const char *result; // rax

result = "single";
if ( (_DWORD)a1 != 1 )
{
result = "recognizer";
if ( (_DWORD)a1 != 2 )
{
bad_tag(a1, "string_from_meta_kind");
result = "unknown";
}
}
return result;
}

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

result = "single";
if ( (_DWORD)a1 != 1 )
{
result = "recognizer";
if ( (_DWORD)a1 != 2 )
{
bad_tag(a1, "string_from_meta_kind");
result = "unknown";
}
}
return result;
}

original_code:
static string string_from_meta_kind (int k)
 { switch (k)
      { case 1: return ("single");
        case 2: return ("recognizer");
        default: bad_tag (k, "string_from_meta_kind");
      };
   return ("unknown");
 }

canonical_original_code:
static char *string_from_meta_kind(int k)
 { switch (k)
      { case 1: return ("single");
        case 2: return ("recognizer");
        default: bad_tag (k, "string_from_meta_kind");
      };
   return ("unknown");
 }

variable_types: k int

return_type: char *


decompiled_code:
__int64 __fastcall unparse_proto_position(_DWORD *a1)
{
const char *v1; // rax
__int64 result; // rax

if ( *a1 == 1 )
eprint_log(">");
v1 = (const char *)string_from_type((unsigned int)a1[4]);
result = eprint_log("%s", v1);
if ( *a1 == 2 )
result = eprint_log(">");
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(_DWORD *a1)
{
const char *v1; // rax
__int64 result; // rax

if ( *a1 == 1 )
eprint_log(">");
v1 = (const char *)string_from_type((unsigned int)a1[4]);
result = eprint_log("%s", v1);
if ( *a1 == 2 )
result = eprint_log(">");
return result;
}

original_code:
static void unparse_proto_position (pos p)
 { if (p -> kind == 1) eprint_log (">");
   eprint_log ("%s", string_from_type (p -> type));
   if (p -> kind == 2) eprint_log (">");
 }

canonical_original_code:
static void unparse_proto_position(struct pos_rec *p)
 { if (p -> kind == 1) eprint_log (">");
   eprint_log ("%s", string_from_type (p -> type));
   if (p -> kind == 2) eprint_log (">");
 }

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

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

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


decompiled_code:
__int64 __fastcall unparse_proto_display(__int64 a1)
{
__int64 v2; // rbx
_DWORD *v3; // rdi
__int64 result; // rax

if ( a1 && *(_DWORD *)a1 )
{
v2 = 0LL;
eprint_log(" (");
if ( *(int *)a1 > 0 )
{
while ( 1 )
{
v3 = *(_DWORD **)(*(_QWORD *)(a1 + 8) + 8 * v2++);
unparse_proto_position(v3);
if ( *(_DWORD *)a1 <= (int)v2 )
break;
eprint_log(", ");
}
}
result = eprint_log(")");
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
__int64 v2; // rbx
_DWORD *v3; // rdi
__int64 result; // rax

if ( a1 && *(_DWORD *)a1 )
{
v2 = 0LL;
eprint_log(" (");
if ( *(int *)a1 > 0 )
{
while ( 1 )
{
v3 = *(_DWORD **)(*(_QWORD *)(a1 + 8) + 8 * v2++);
func8(v3);
if ( *(_DWORD *)a1 <= (int)v2 )
break;
eprint_log(", ");
}
}
result = eprint_log(")");
}
return result;
}

original_code:
static void unparse_proto_display (pos_list dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   if (!dpy -> size) return;
   eprint_log (" (");
   for (ix = 0; ix < dpy -> size; ix++)
      { if (ix) eprint_log (", ");
        unparse_proto_position (dpy -> array[ix]);
      };
   eprint_log (")");
 }

canonical_original_code:
static void unparse_proto_display(struct pos_list_rec *dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   if (!dpy -> size) return;
   eprint_log (" (");
   for (ix = 0; ix < dpy -> size; ix++)
      { if (ix) eprint_log (", ");
        unparse_proto_position (dpy -> array[ix]);
      };
   eprint_log (")");
 }

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

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


decompiled_code:
__int64 __fastcall unparse_affix(__int64 a1)
{
__int64 v2; // rdi
__int64 result; // rax

v2 = *(unsigned int *)(a1 + 40);
switch ( (int)v2 )
{
case 0:
result = unparse_affix_variable(a1);
break;
case 1:
result = unparse_string(*(_BYTE **)(a1 + 48));
break;
case 2:
result = unparse_integer(*(_DWORD *)(a1 + 48));
break;
case 3:
result = unparse_real(*(double *)(a1 + 48));
break;
case 4:
result = unparse_set(*(unsigned int **)(a1 + 48));
break;
case 5:
result = unparse_affix_element_isra_0(*(const char **)(a1 + 48));
break;
case 6:
result = unparse_expr(*(_QWORD *)(a1 + 48));
break;
default:
result = bad_tag(v2, "unparse_affix");
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1)
{
__int64 v2; // rdi
__int64 result; // rax

v2 = *(unsigned int *)(a1 + 40);
switch ( (int)v2 )
{
case 0:
result = func1(a1);
break;
case 1:
result = func6(*(_BYTE **)(a1 + 48));
break;
case 2:
result = func2(*(_DWORD *)(a1 + 48));
break;
case 3:
result = func3(*(double *)(a1 + 48));
break;
case 4:
result = func5(*(unsigned int **)(a1 + 48));
break;
case 5:
result = func10(*(const char **)(a1 + 48));
break;
case 6:
result = func13(*(_QWORD *)(a1 + 48));
break;
default:
result = bad_tag(v2, "unparse_affix");
break;
}
return result;
}

original_code:
static void unparse_affix (affix a)
 { switch (a -> tag)
      { case 0: unparse_affix_variable (a); break;
        case 1: unparse_string (a -> u.str); break;
        case 2: unparse_integer (a -> u.inum); break;
        case 3: unparse_real (a -> u.rnum); break;
        case 4: unparse_set (a -> u.semi); break;
        case 5: unparse_affix_element (a); break;
        case 6: unparse_expr (a -> u.cexpr); break;
        default: bad_tag (a -> tag, "unparse_affix");
      };
 }

canonical_original_code:
static void unparse_affix(struct affix_rec *a)
 { switch (a -> tag)
      { case 0: unparse_affix_variable (a); break;
        case 1: unparse_string (a -> u.str); break;
        case 2: unparse_integer (a -> u.inum); break;
        case 3: unparse_real (a -> u.rnum); break;
        case 4: unparse_set (a -> u.semi); break;
        case 5: unparse_affix_element (a); break;
        case 6: unparse_expr (a -> u.cexpr); break;
        default: bad_tag (a -> tag, "unparse_affix");
      };
 }

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

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

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

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

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

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

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


decompiled_code:
__int64 __fastcall unparse_affix_list(unsigned int *a1, char a2)
{
__int64 result; // rax
__int64 v4; // rbx
__int64 v5; // rdi

result = *a1;
if ( (int)result > 0 )
{
v4 = 0LL;
while ( 1 )
{
v5 = *(_QWORD *)(*((_QWORD *)a1 + 1) + 8 * v4++);
result = unparse_affix(v5);
if ( (int)*a1 <= (int)v4 )
break;
eprint_log(" %c ", (unsigned int)a2);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(unsigned int *a1, char a2)
{
__int64 result; // rax
__int64 v4; // rbx
__int64 v5; // rdi

result = *a1;
if ( (int)result > 0 )
{
v4 = 0LL;
while ( 1 )
{
v5 = *(_QWORD *)(*((_QWORD *)a1 + 1) + 8 * v4++);
result = func11(v5);
if ( (int)*a1 <= (int)v4 )
break;
eprint_log(" %c ", (unsigned int)a2);
}
}
return result;
}

original_code:
static void unparse_affix_list (affix_list affl, char sep)
 { int ix;
   for (ix = 0; ix < affl -> size; ix++)
      { if (ix) eprint_log (" %c ", sep);
        unparse_affix (affl -> array[ix]);
      };
 }

canonical_original_code:
static void unparse_affix_list(struct affix_list_rec *affl, char sep)
 { int ix;
   for (ix = 0; ix < affl -> size; ix++)
      { if (ix) eprint_log (" %c ", sep);
        unparse_affix (affl -> array[ix]);
      };
 }

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

variable_types: sep char

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


decompiled_code:
__int64 __fastcall unparse_expr(__int64 a1)
{
int v1; // er8
__int64 result; // rax

if ( a1 )
{
v1 = *(_DWORD *)a1;
if ( *(_DWORD *)a1 == 3 )
{
result = unparse_affix_list(*(unsigned int **)(a1 + 8), 43);
}
else
{
if ( v1 > 3 )
{
if ( v1 == 4 )
return unparse_affix_list(*(unsigned int **)(a1 + 8), 124);
}
else
{
if ( v1 == 1 )
return unparse_affix(*(_QWORD *)(a1 + 8));
if ( v1 == 2 )
return unparse_affix_list(*(unsigned int **)(a1 + 8), 42);
}
result = bad_tag((unsigned int)v1, "unparse_expr");
}
}
return result;
}

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

if ( a1 )
{
v1 = *(_DWORD *)a1;
if ( *(_DWORD *)a1 == 3 )
{
result = func12(*(unsigned int **)(a1 + 8), 43);
}
else
{
if ( v1 > 3 )
{
if ( v1 == 4 )
return func12(*(unsigned int **)(a1 + 8), 124);
}
else
{
if ( v1 == 1 )
return func11(*(_QWORD *)(a1 + 8));
if ( v1 == 2 )
return func12(*(unsigned int **)(a1 + 8), 42);
}
result = bad_tag((unsigned int)v1, "unparse_expr");
}
}
return result;
}

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

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

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

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


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

if ( *(_DWORD *)a1 != 1 )
{
result = unparse_expr(*(_QWORD *)(a1 + 8));
if ( *(_DWORD *)a1 != 2 )
return result;
return eprint_log(">");
}
eprint_log(">");
result = unparse_expr(*(_QWORD *)(a1 + 8));
if ( *(_DWORD *)a1 == 2 )
return eprint_log(">");
return result;
}

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

if ( *(_DWORD *)a1 != 1 )
{
result = func13(*(_QWORD *)(a1 + 8));
if ( *(_DWORD *)a1 != 2 )
return result;
return eprint_log(">");
}
eprint_log(">");
result = func13(*(_QWORD *)(a1 + 8));
if ( *(_DWORD *)a1 == 2 )
return eprint_log(">");
return result;
}

original_code:
static void unparse_position (pos p)
 { if (p -> kind == 1) eprint_log (">");
   unparse_expr (p -> ex);
   if (p -> kind == 2) eprint_log (">");
 }

canonical_original_code:
static void unparse_position(struct pos_rec *p)
 { if (p -> kind == 1) eprint_log (">");
   unparse_expr (p -> ex);
   if (p -> kind == 2) eprint_log (">");
 }

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


decompiled_code:
__int64 __fastcall unparse_display(__int64 a1)
{
__int64 v2; // rbx
__int64 v3; // rdi
__int64 result; // rax

if ( a1 && *(_DWORD *)a1 )
{
v2 = 0LL;
eprint_log(" (");
if ( *(int *)a1 > 0 )
{
while ( 1 )
{
v3 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v2++);
unparse_position(v3);
if ( *(_DWORD *)a1 <= (int)v2 )
break;
eprint_log(", ");
}
}
result = eprint_log(")");
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
__int64 v2; // rbx
__int64 v3; // rdi
__int64 result; // rax

if ( a1 && *(_DWORD *)a1 )
{
v2 = 0LL;
eprint_log(" (");
if ( *(int *)a1 > 0 )
{
while ( 1 )
{
v3 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v2++);
func14(v3);
if ( *(_DWORD *)a1 <= (int)v2 )
break;
eprint_log(", ");
}
}
result = eprint_log(")");
}
return result;
}

original_code:
static void unparse_display (pos_list dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   if (!dpy -> size) return;
   eprint_log (" (");
   for (ix = 0; ix < dpy -> size; ix++)
      { if (ix) eprint_log (", ");
        unparse_position (dpy -> array[ix]);
      };
   eprint_log (")");
 }

canonical_original_code:
static void unparse_display(struct pos_list_rec *dpy)
 { int ix;
   if (dpy == ((pos_list) ((void *)0))) return;
   if (!dpy -> size) return;
   eprint_log (" (");
   for (ix = 0; ix < dpy -> size; ix++)
      { if (ix) eprint_log (", ");
        unparse_position (dpy -> array[ix]);
      };
   eprint_log (")");
 }

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


decompiled_code:
__int64 __fastcall unparse_call(__int64 a1)
{
eprint_log(*(const char **)(a1 + 32));
return unparse_display(*(_QWORD *)(a1 + 40));
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1)
{
eprint_log(*(const char **)(a1 + 32));
return func15(*(_QWORD *)(a1 + 40));
}

original_code:
static void unparse_call (member m)
 { eprint_log (m -> u.call.nonterminal);
   unparse_display (m -> u.call.display);
 }

canonical_original_code:
static void unparse_call(struct member_rec *m)
 { eprint_log (m -> u.call.nonterminal);
   unparse_display (m -> u.call.display);
 }

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

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


decompiled_code:
__int64 unparse_start_rule()
{
eprint_log("\n# start rule\n");
unparse_call(start_rule);
return eprint_log(".\n");
}

canonical_decompiled_code:
__int64 func17()
{
eprint_log("\n# start rule\n");
func16(start_rule);
return eprint_log(".\n");
}

original_code:
static void unparse_start_rule ()
 { eprint_log ("\n# start rule\n");
   unparse_call (start_rule);
   eprint_log (".\n");
 }

canonical_original_code:
static void unparse_start_rule()
 { eprint_log ("\n# start rule\n");
   unparse_call (start_rule);
   eprint_log (".\n");
 }


decompiled_code:
__int64 __fastcall unparse_semiterminal(__int64 a1)
{
unparse_set(*(unsigned int **)(a1 + 32));
return unparse_display(*(_QWORD *)(a1 + 40));
}

canonical_decompiled_code:
__int64 __fastcall func18(__int64 a1)
{
func5(*(unsigned int **)(a1 + 32));
return func15(*(_QWORD *)(a1 + 40));
}

original_code:
static void unparse_semiterminal (member m)
 { unparse_set (m -> u.semi.set);
   unparse_display (m -> u.semi.display);
 }

canonical_original_code:
static void unparse_semiterminal(struct member_rec *m)
 { unparse_set (m -> u.semi.set);
   unparse_display (m -> u.semi.display);
 }

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

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

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

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


decompiled_code:
__int64 __fastcall unparse_external_rule(__int64 a1)
{
const char *v1; // rax

eprint_log("$ %s", *(const char **)a1);
unparse_display(***(_QWORD ***)(*(_QWORD *)(a1 + 8) + 8LL));
eprint_log(": ");
v1 = string_from_rule_kind(*(_DWORD *)(a1 + 16));
return eprint_log("%s.\n", v1);
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 a1)
{
const char *v1; // rax

eprint_log("$ %s", *(const char **)a1);
func15(***(_QWORD ***)(*(_QWORD *)(a1 + 8) + 8LL));
eprint_log(": ");
v1 = func0(*(_DWORD *)(a1 + 16));
return eprint_log("%s.\n", v1);
}

original_code:
static void unparse_external_rule (rule srule)
 { eprint_log ("$ %s", srule -> nonterminal);
   unparse_display (srule -> alts -> array[0] -> display);
   eprint_log (": ");
   eprint_log ("%s.\n", string_from_rule_kind (srule -> kind));
 }

canonical_original_code:
static void unparse_external_rule(struct rule_rec *srule)
 { eprint_log ("$ %s", srule -> nonterminal);
   unparse_display (srule -> alts -> array[0] -> display);
   eprint_log (": ");
   eprint_log ("%s.\n", string_from_rule_kind (srule -> kind));
 }

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


decompiled_code:
__int64 __fastcall unparse_meta_alts(unsigned int *a1)
{
__int64 result; // rax
__int64 v2; // rbx
const char *v3; // rsi
__int64 *v4; // rax

if ( a1 )
{
result = *a1;
if ( (int)result > 0 )
{
v2 = 0LL;
v3 = (const char *)&unk_A63;
do
{
eprint_log("%s\n ", v3);
v4 = *(__int64 **)(*((_QWORD *)a1 + 1) + 8 * v2++);
result = unparse_expr(*v4);
v3 = ";";
}
while ( (int)*a1 > (int)v2 );
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func20(unsigned int *a1)
{
__int64 result; // rax
__int64 v2; // rbx
const char *v3; // rsi
__int64 *v4; // rax

if ( a1 )
{
result = *a1;
if ( (int)result > 0 )
{
v2 = 0LL;
v3 = (const char *)&unk_A63;
do
{
eprint_log("%s\n ", v3);
v4 = *(__int64 **)(*((_QWORD *)a1 + 1) + 8 * v2++);
result = func13(*v4);
v3 = ";";
}
while ( (int)*a1 > (int)v2 );
}
}
return result;
}

original_code:
static void unparse_meta_alts (meta_alt_list al)
 { int ix;
   if (al == ((meta_alt_list) ((void *)0))) return;
   for (ix = 0; ix < al -> size; ix++)
      { eprint_log ("%s\n   ", (ix)?";":"");
        unparse_expr (al -> array[ix] -> e);
      };
 }

canonical_original_code:
static void unparse_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++)
      { eprint_log ("%s\n   ", (ix)?";":"");
        unparse_expr (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 meta_alt_rec { struct expr_rec *e; int number; }

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


decompiled_code:
__int64 __fastcall unparse_meta_rule(__int64 a1)
{
const char *v1; // rbp
const char *v2; // rax
const char *v3; // r12
const char *v4; // rax
__int64 result; // rax

v1 = string_from_meta_kind(*(unsigned int *)(a1 + 24));
v2 = (const char *)string_from_type(*(unsigned int *)(a1 + 20));
eprint_log("\n# mrule %d: %s :: %s, %s\n", *(unsigned int *)(a1 + 32), *(const char **)a1, v2, v1);
if ( *(_DWORD *)(a1 + 16) )
eprint_log("$ ");
eprint_log("%s :: ", *(const char **)a1);
if ( *(_DWORD *)(a1 + 16) )
{
v3 = string_from_meta_kind(*(unsigned int *)(a1 + 24));
v4 = (const char *)string_from_type(*(unsigned int *)(a1 + 20));
result = eprint_log("%s, %s.\n", v4, v3);
}
else
{
unparse_meta_alts(*(unsigned int **)(a1 + 8));
result = eprint_log(".\n");
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func21(__int64 a1)
{
const char *v1; // rbp
const char *v2; // rax
const char *v3; // r12
const char *v4; // rax
__int64 result; // rax

v1 = func7(*(unsigned int *)(a1 + 24));
v2 = (const char *)string_from_type(*(unsigned int *)(a1 + 20));
eprint_log("\n# mrule %d: %s :: %s, %s\n", *(unsigned int *)(a1 + 32), *(const char **)a1, v2, v1);
if ( *(_DWORD *)(a1 + 16) )
eprint_log("$ ");
eprint_log("%s :: ", *(const char **)a1);
if ( *(_DWORD *)(a1 + 16) )
{
v3 = func7(*(unsigned int *)(a1 + 24));
v4 = (const char *)string_from_type(*(unsigned int *)(a1 + 20));
result = eprint_log("%s, %s.\n", v4, v3);
}
else
{
func20(*(unsigned int **)(a1 + 8));
result = eprint_log(".\n");
}
return result;
}

original_code:
static void unparse_meta_rule (meta_rule mrule)
 { eprint_log ("\n# mrule %d: %s :: %s, %s\n", mrule -> number,
        mrule -> nonterminal,
        string_from_type (mrule -> type),
        string_from_meta_kind (mrule -> kind));
   if (mrule -> ext) eprint_log ("$ ");
   eprint_log ("%s :: ", mrule -> nonterminal);
   if (mrule -> ext)
        eprint_log ("%s, %s.\n", string_from_type (mrule -> type),
   string_from_meta_kind (mrule -> kind));
   else
      { unparse_meta_alts (mrule -> alts);
        eprint_log (".\n");
      };
 }

canonical_original_code:
static void unparse_meta_rule(struct meta_rule_rec *mrule)
 { eprint_log ("\n# mrule %d: %s :: %s, %s\n", mrule -> number,
        mrule -> nonterminal,
        string_from_type (mrule -> type),
        string_from_meta_kind (mrule -> kind));
   if (mrule -> ext) eprint_log ("$ ");
   eprint_log ("%s :: ", mrule -> nonterminal);
   if (mrule -> ext)
        eprint_log ("%s, %s.\n", string_from_type (mrule -> type),
   string_from_meta_kind (mrule -> kind));
   else
      { unparse_meta_alts (mrule -> alts);
        eprint_log (".\n");
      };
 }

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

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 unparse_meta_rules()
{
__int64 result; // rax
__int64 v1; // rbx
__int64 v2; // rdi

result = nr_of_meta_rules;
if ( nr_of_meta_rules > 0 )
{
v1 = 0LL;
do
{
v2 = *(_QWORD *)(all_meta_rules + 8 * v1++);
result = unparse_meta_rule(v2);
}
while ( nr_of_meta_rules > (int)v1 );
}
return result;
}

canonical_decompiled_code:
__int64 func22()
{
__int64 result; // rax
__int64 v1; // rbx
__int64 v2; // rdi

result = nr_of_meta_rules;
if ( nr_of_meta_rules > 0 )
{
v1 = 0LL;
do
{
v2 = *(_QWORD *)(all_meta_rules + 8 * v1++);
result = func21(v2);
}
while ( nr_of_meta_rules > (int)v1 );
}
return result;
}

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

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


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

result = *(unsigned int *)(a1 + 24);
if ( (_DWORD)result == 2 )
return unparse_semiterminal(a1);
if ( (int)result > 2 )
{
if ( (_DWORD)result == 3 )
result = eprint_log("->");
}
else if ( (_DWORD)result )
{
if ( (_DWORD)result == 1 )
result = unparse_string(*(_BYTE **)(a1 + 32));
}
else
{
result = unparse_call(a1);
}
return result;
}

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

result = *(unsigned int *)(a1 + 24);
if ( (_DWORD)result == 2 )
return func18(a1);
if ( (int)result > 2 )
{
if ( (_DWORD)result == 3 )
result = eprint_log("->");
}
else if ( (_DWORD)result )
{
if ( (_DWORD)result == 1 )
result = func6(*(_BYTE **)(a1 + 32));
}
else
{
result = func16(a1);
}
return result;
}

original_code:
void unparse_member (member m)
 { switch (m -> tag)
      { case 0: unparse_call (m); break;
        case 1: unparse_string (m -> u.terminal); break;
        case 2: unparse_semiterminal (m); break;
        case 3: eprint_log ("->");
        default: break;
      };
 }

canonical_original_code:
void unparse_member(struct member_rec *m)
 { switch (m -> tag)
      { case 0: unparse_call (m); break;
        case 1: unparse_string (m -> u.terminal); break;
        case 2: unparse_semiterminal (m); break;
        case 3: eprint_log ("->");
        default: break;
      };
 }

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

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

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

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

user_defined_types: struct 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 affix_list_rec { int size; int room; struct affix_rec **array; }

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

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


decompiled_code:
__int64 __fastcall unparse_member_list(unsigned int *a1)
{
__int64 result; // rax
__int64 v2; // rbx

result = eprint_log(" ");
if ( a1 )
{
result = *a1;
if ( (int)result > 0 )
{
v2 = 0LL;
do
{
unparse_member(*(_QWORD *)(*((_QWORD *)a1 + 1) + 8 * v2));
result = *a1;
if ( (_DWORD)result - 1 != (_DWORD)v2 )
{
eprint_log(", ");
if ( (unsigned int)(-1431655765 * v2 - 1431655766) <= 0x55555554 )
eprint_log("\n ");
result = *a1;
}
++v2;
}
while ( (int)result > (int)v2 );
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func24(unsigned int *a1)
{
__int64 result; // rax
__int64 v2; // rbx

result = eprint_log(" ");
if ( a1 )
{
result = *a1;
if ( (int)result > 0 )
{
v2 = 0LL;
do
{
func23(*(_QWORD *)(*((_QWORD *)a1 + 1) + 8 * v2));
result = *a1;
if ( (_DWORD)result - 1 != (_DWORD)v2 )
{
eprint_log(", ");
if ( (unsigned int)(-1431655765 * v2 - 1431655766) <= 0x55555554 )
eprint_log("\n ");
result = *a1;
}
++v2;
}
while ( (int)result > (int)v2 );
}
}
return result;
}

original_code:
static void unparse_member_list (member_list ml)
 { int ix;
   eprint_log ("   ");
   if (ml == ((member_list) ((void *)0))) return;
   for (ix = 0; ix < ml -> size; ix++)
      { unparse_member (ml -> array[ix]);
        if (ix != ml -> size - 1)
    { eprint_log (", ");
      if (ix%3 == 2) eprint_log ("\n      ");
    };
      };
 }

canonical_original_code:
static void unparse_member_list(struct member_list_rec *ml)
 { int ix;
   eprint_log ("   ");
   if (ml == ((member_list) ((void *)0))) return;
   for (ix = 0; ix < ml -> size; ix++)
      { unparse_member (ml -> array[ix]);
        if (ix != ml -> size - 1)
    { eprint_log (", ");
      if (ix%3 == 2) eprint_log ("\n      ");
    };
      };
 }

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_rec { int empty; int followlayout; char *first; int number; int sonnr; int tag; union { struct call_rec call; char *terminal; struct semiterminal_rec semi; } u; }

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

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

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

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

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

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

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


decompiled_code:
__int64 __fastcall unparse_alts(const char **a1, __int64 a2)
{
__int64 v3; // rbx
__int64 v4; // rsi

if ( *(int *)a2 > 0 )
{
v3 = 0LL;
while ( 1 )
{
v4 = *(_QWORD *)(*(_QWORD *)(a2 + 8) + 8 * v3++);
unparse_alt_isra_0(*a1, v4);
if ( *(_DWORD *)a2 <= (int)v3 )
break;
eprint_log(";\n");
}
}
return eprint_log(".\n");
}

original_code:
static void unparse_alts (rule srule, alt_list alts)
 { int ix;
   for (ix = 0; ix < alts -> size; ix++)
      { if (ix) eprint_log (";\n");
        unparse_alt (srule, alts -> array[ix]);
      };
   eprint_log (".\n");
 }

canonical_original_code:
static void unparse_alts(struct rule_rec *srule, struct alt_list_rec *alts)
 { int ix;
   for (ix = 0; ix < alts -> size; ix++)
      { if (ix) eprint_log (";\n");
        unparse_alt (srule, alts -> array[ix]);
      };
   eprint_log (".\n");
 }

variable_types:
alts
struct alt_list_rec *

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

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

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

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

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

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

user_defined_types: struct 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 __fastcall unparse_rule(__int64 a1)
{
const char *v1; // rax
__int64 result; // rax

v1 = string_from_rule_kind(*(_DWORD *)(a1 + 16));
eprint_log("\n# syntax rule %d: %s %s", *(unsigned int *)(a1 + 32), v1, *(const char **)a1);
unparse_proto_display(*(_QWORD *)(a1 + 64));
eprint_log("\n");
if ( *(_DWORD *)(a1 + 28) )
result = unparse_external_rule(a1);
else
result = unparse_alts((const char **)a1, *(_QWORD *)(a1 + 8));
return result;
}

canonical_decompiled_code:
__int64 __fastcall func27(__int64 a1)
{
const char *v1; // rax
__int64 result; // rax

v1 = func0(*(_DWORD *)(a1 + 16));
eprint_log("\n# syntax rule %d: %s %s", *(unsigned int *)(a1 + 32), v1, *(const char **)a1);
func9(*(_QWORD *)(a1 + 64));
eprint_log("\n");
if ( *(_DWORD *)(a1 + 28) )
result = func19(a1);
else
result = func26((const char **)a1, *(_QWORD *)(a1 + 8));
return result;
}

original_code:
static void unparse_rule (rule srule)
 { eprint_log ("\n# syntax rule %d: %s %s", srule -> number,
        string_from_rule_kind (srule -> kind),
        srule -> nonterminal);
   unparse_proto_display (srule -> proto_display);
   eprint_log ("\n");
   if (srule -> ext) unparse_external_rule (srule);
   else unparse_alts (srule, srule -> alts);
 }

canonical_original_code:
static void unparse_rule(struct rule_rec *srule)
 { eprint_log ("\n# syntax rule %d: %s %s", srule -> number,
        string_from_rule_kind (srule -> kind),
        srule -> nonterminal);
   unparse_proto_display (srule -> proto_display);
   eprint_log ("\n");
   if (srule -> ext) unparse_external_rule (srule);
   else unparse_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 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 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 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 int_list_rec { int size; int room; int *array; }

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


decompiled_code:
__int64 unparse_rules()
{
__int64 result; // rax
__int64 v1; // rbx
__int64 v2; // rdi

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

canonical_decompiled_code:
__int64 func28()
{
__int64 result; // rax
__int64 v1; // rbx
__int64 v2; // rdi

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

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

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


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

result = full_verbose;
if ( full_verbose )
{
warning("unparsing eag...");
unparse_start_rule();
unparse_rules();
result = unparse_meta_rules();
}
return result;
}

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

result = full_verbose;
if ( full_verbose )
{
warning("unparsing eag...");
func17();
func28();
result = func22();
}
return result;
}

original_code:
void unparse_eag ()
 { if (!full_verbose) return;
   warning ("unparsing eag...");
   unparse_start_rule ();
   unparse_rules ();
   unparse_meta_rules ();
 }

canonical_original_code:
void unparse_eag()
 { if (!full_verbose) return;
   warning ("unparsing eag...");
   unparse_start_rule ();
   unparse_rules ();
   unparse_meta_rules ();
 }


ckmalloc

decompiled_code:
void *__fastcall ckmalloc(size_t size)
{
void *v1; // r12

v1 = malloc((unsigned int)size);
if ( !v1 )
panic("could not malloc %d bytes", (unsigned int)size);
return v1;
}

canonical_decompiled_code:
void *__fastcall func0(size_t size)
{
void *v1; // r12

v1 = malloc((unsigned int)size);
if ( !v1 )
panic("could not malloc %d bytes", (unsigned int)size);
return v1;
}

original_code:
void *ckmalloc (int size)
{ void *nsp = (void *) malloc ((unsigned) size);
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not malloc %d bytes", size);
  return ((void *) ((void *)0));
}

canonical_original_code:
void *ckmalloc(int size)
{ void *nsp = (void *) malloc ((unsigned) size);
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not malloc %d bytes", size);
  return ((void *) ((void *)0));
}

variable_types: size int

variable_types:
nsp
void *

return_type: void *


ckcalloc

decompiled_code:
void *__fastcall ckcalloc(size_t nmemb, size_t size)
{
void *v2; // r12

v2 = 0LL;
if ( (_DWORD)nmemb )
{
v2 = calloc((unsigned int)nmemb, (unsigned int)size);
if ( !v2 )
panic("could not calloc %d chunks of %d bytes", (unsigned int)nmemb, (unsigned int)size);
}
return v2;
}

canonical_decompiled_code:
void *__fastcall func1(size_t nmemb, size_t size)
{
void *v2; // r12

v2 = 0LL;
if ( (_DWORD)nmemb )
{
v2 = calloc((unsigned int)nmemb, (unsigned int)size);
if ( !v2 )
panic("could not calloc %d chunks of %d bytes", (unsigned int)nmemb, (unsigned int)size);
}
return v2;
}

original_code:
void *ckcalloc (int nr, int size)
{ void *nsp;
  if (nr == 0) return ((void *) ((void *)0));
  nsp = (void *) calloc ((unsigned) nr, (unsigned) size);
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not calloc %d chunks of %d bytes", nr, size);
  return ((void *) ((void *)0));
}

canonical_original_code:
void *ckcalloc(int nr, int size)
{ void *nsp;
  if (nr == 0) return ((void *) ((void *)0));
  nsp = (void *) calloc ((unsigned int) nr, (unsigned int) size);
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not calloc %d chunks of %d bytes", nr, size);
  return ((void *) ((void *)0));
}

variable_types: nr int


ckrealloc

decompiled_code:
void *__fastcall ckrealloc(void *a1, unsigned int a2)
{
void *v2; // r12

v2 = realloc(a1, a2);
if ( !v2 )
panic("could not realloc %d bytes", a2);
return v2;
}

canonical_decompiled_code:
void *__fastcall func2(void *a1, unsigned int a2)
{
void *v2; // r12

v2 = realloc(a1, a2);
if ( !v2 )
panic("could not realloc %d bytes", a2);
return v2;
}

original_code:
void *ckrealloc (void *ptr, int size)
{ void *nsp = (void *) realloc ((char *) ptr, (unsigned) size);
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not realloc %d bytes", size);
  return ((void *) ((void *)0));
}

canonical_original_code:
void *ckrealloc(void *ptr, int size)
{ void *nsp = (void *) realloc ((char *) ptr, (unsigned) size);
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not realloc %d bytes", size);
  return ((void *) ((void *)0));
}

variable_types:
ptr
void *


ckrecalloc

decompiled_code:
void *__fastcall ckrecalloc(void *a1, unsigned int a2, unsigned int a3)
{
void *v4; // r12

v4 = realloc(a1, a3 * a2);
if ( !v4 )
panic("could not realloc %d chunks of %d bytes", a2, a3);
return v4;
}

canonical_decompiled_code:
void *__fastcall func3(void *a1, unsigned int a2, unsigned int a3)
{
void *v4; // r12

v4 = realloc(a1, a3 * a2);
if ( !v4 )
panic("could not realloc %d chunks of %d bytes", a2, a3);
return v4;
}

original_code:
void *ckrecalloc (void *ptr, int nr, int size)
{ void *nsp = (void *) realloc ((char *) ptr, (unsigned) (nr * size));
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not realloc %d chunks of %d bytes", nr, size);
  return ((void *) ((void *)0));
}

canonical_original_code:
void *ckrecalloc(void *ptr, int nr, int size)
{ void *nsp = (void *) realloc ((char *) ptr, (unsigned) (nr * size));
  if (nsp != ((void *)0)) return (nsp);
  panic ("could not realloc %d chunks of %d bytes", nr, size);
  return ((void *) ((void *)0));
}


newstring

decompiled_code:
char *__fastcall newstring(char *src)
{
int v1; // eax
char *v2; // rax

v1 = strlen(src);
v2 = (char *)ckmalloc((unsigned int)(v1 + 1));
return strcpy(v2, src);
}

canonical_decompiled_code:
char *__fastcall func4(char *src)
{
int v1; // eax
char *v2; // rax

v1 = strlen(src);
v2 = (char *)func0((unsigned int)(v1 + 1));
return strcpy(v2, src);
}

original_code:
char *newstring (char *src)
{ char *nsp = (char *) ckmalloc (strlen (src) + 1);
  strcpy (nsp, src);
  return (nsp);
}

canonical_original_code:
char *newstring(char *src)
{ char *nsp = (char *) ckmalloc (strlen (src) + 1);
  strcpy (nsp, src);
  return (nsp);
}

variable_types:
src
char *

variable_types:
nsp
char *


nextch

decompiled_code:
int nextch()
{
int result; // eax

if ( thischar == 10 )
{
++lexline;
lexcolumn = 1;
}
else
{
++lexcolumn;
}
result = nextchar;
thischar = nextchar;
if ( nextchar != -1 )
{
result = fgetc(in);
nextchar = result;
}
return result;
}

canonical_decompiled_code:
int func0()
{
int result; // eax

if ( thischar == 10 )
{
++lexline;
lexcolumn = 1;
}
else
{
++lexcolumn;
}
result = nextchar;
thischar = nextchar;
if ( nextchar != -1 )
{
result = fgetc(in);
nextchar = result;
}
return result;
}

original_code:
static void nextch ()
 { if (thischar == '\n') { lexline++; lexcolumn = 1; }
   else lexcolumn++;
   thischar = nextchar;
   if (nextchar != (-1)) nextchar = fgetc (in);
 }

canonical_original_code:
static void nextch()
 { if (thischar == '\n') { lexline++; lexcolumn = 1; }
   else lexcolumn++;
   thischar = nextchar;
   if (nextchar != (-1)) nextchar = fgetc (in);
 }


decompiled_code:
unsigned __int64 may_skip_layout()
{
unsigned __int64 result; // rax
__int64 v1; // rbx

result = (unsigned int)thischar;
if ( (unsigned int)thischar <= 0x23 )
{
v1 = 0x900000600LL;
do
{
if ( !_bittest64(&v1, result) )
break;
if ( (_DWORD)result == 35 )
{
do
{
nextch();
if ( thischar == 10 )
break;
nextch();
}
while ( thischar != 10 );
}
nextch();
result = (unsigned int)thischar;
}
while ( (unsigned int)thischar <= 0x23 );
}
return result;
}

canonical_decompiled_code:
unsigned __int64 func1()
{
unsigned __int64 result; // rax
__int64 v1; // rbx

result = (unsigned int)thischar;
if ( (unsigned int)thischar <= 0x23 )
{
v1 = 0x900000600LL;
do
{
if ( !_bittest64(&v1, result) )
break;
if ( (_DWORD)result == 35 )
{
do
{
func0();
if ( thischar == 10 )
break;
func0();
}
while ( thischar != 10 );
}
func0();
result = (unsigned int)thischar;
}
while ( (unsigned int)thischar <= 0x23 );
}
return result;
}

original_code:
static void may_skip_layout()
 { while ((thischar == ' ') || (thischar == '\t') ||
   (thischar == '\n') || (thischar == '#'))
      if (thischar == '#')
         do { nextch(); } while (thischar != '\n');
      else nextch ();
 }


decompiled_code:
__int64 __fastcall is_letter(_BYTE *a1)
{
if ( (unsigned int)(thischar - 97) > 0x19 && (unsigned int)(thischar - 65) > 0x19 )
return 0LL;
*a1 = thischar;
nextch();
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(_BYTE *a1)
{
if ( (unsigned int)(thischar - 97) > 0x19 && (unsigned int)(thischar - 65) > 0x19 )
return 0LL;
*a1 = thischar;
func0();
return 1LL;
}

original_code:
static int is_letter (char *value)
 { if (('a' <= thischar) && (thischar <= 'z'))
      { *value = thischar;
        nextch ();
        return (1);
      };
   if (('A' <= thischar) && (thischar <= 'Z'))
      { *value = thischar;
        nextch ();
        return (1);
      };
   return (0);
 }

canonical_original_code:
static int is_letter(char *value)
 { if (('a' <= thischar) && (thischar <= 'z'))
      { *value = thischar;
        nextch ();
        return (1);
      };
   if (('A' <= thischar) && (thischar <= 'Z'))
      { *value = thischar;
        nextch ();
        return (1);
      };
   return (0);
 }

variable_types:
value
char *

return_type: int


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

result = is_letter(a1);
if ( (_DWORD)result )
return 1LL;
if ( (unsigned int)(thischar - 48) <= 9 )
{
*a1 = thischar;
nextch();
result = 1LL;
}
return result;
}

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

result = func2(a1);
if ( (_DWORD)result )
return 1LL;
if ( (unsigned int)(thischar - 48) <= 9 )
{
*a1 = thischar;
func0();
result = 1LL;
}
return result;
}

original_code:
static int is_letgit (char *value)
 { if (is_letter (value)) return (1);
   if (('0' <= thischar) && (thischar <= '9'))
      { *value = thischar;
        nextch ();
        return (1);
      };
   return (0);
 }

canonical_original_code:
static int is_letgit(char *value)
 { if (is_letter (value)) return (1);
   if (('0' <= thischar) && (thischar <= '9'))
      { *value = thischar;
        nextch ();
        return (1);
      };
   return (0);
 }


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

result = 0LL;
if ( (unsigned int)(thischar - 48) <= 9 )
{
*a1 = thischar;
nextch();
result = 1LL;
}
return result;
}

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

result = 0LL;
if ( (unsigned int)(thischar - 48) <= 9 )
{
*a1 = thischar;
func0();
result = 1LL;
}
return result;
}

original_code:
static int is_digit (char *dig)
{ if (('0' <= thischar) && (thischar <= '9'))
    { *dig = thischar;
      nextch ();
      return (1);
    };
  return (0);
}

canonical_original_code:
static int is_digit(char *dig)
{ if (('0' <= thischar) && (thischar <= '9'))
    { *dig = thischar;
      nextch ();
      return (1);
    };
  return (0);
}

variable_types:
dig
char *


scancolons

decompiled_code:
int scancolons()
{
int result; // eax

result = nextch();
if ( thischar == 58 )
{
result = nextch();
nexttoken = 8;
}
else
{
nexttoken = 7;
}
return result;
}

canonical_decompiled_code:
int func5()
{
int result; // eax

result = func0();
if ( thischar == 58 )
{
result = func0();
nexttoken = 8;
}
else
{
nexttoken = 7;
}
return result;
}

original_code:
static void scancolons ()
 { nextch ();
   if (thischar == ':')
      { nextch ();
        nexttoken = DOUBLECOLON;
      }
   else nexttoken = COLON;
 }

canonical_original_code:
static void scancolons()
 { nextch ();
   if (thischar == ':')
      { nextch ();
        nexttoken = DOUBLECOLON;
      }
   else nexttoken = COLON;
 }


yieldsymbol

decompiled_code:
int __fastcall yieldsymbol(int a1)
{
nexttoken = a1;
return nextch();
}

canonical_decompiled_code:
int __fastcall func6(int a1)
{
nexttoken = a1;
return func0();
}

original_code:
static void yieldsymbol (int sy)
 { nexttoken = sy;
   nextch ();
 }

canonical_original_code:
static void yieldsymbol(int sy)
 { nexttoken = sy;
   nextch ();
 }

variable_types: sy int


scanidentifier

decompiled_code:
__int64 __fastcall scanidentifier(char a1)
{
int v1; // er12
_BYTE *v2; // rbx
_BYTE *v3; // rbp
__int64 v4; // rbx
const char *i; // rsi
__int64 v6; // r12
__int64 result; // rax

string_store = a1;
v1 = 0;
v2 = &unk_BC1;
do
{
while ( 1 )
{
while ( !(unsigned int)is_letgit(v2) )
{
if ( thischar != 32 && thischar != 9 )
{
*v2 = 0;
nexttoken = 1;
result = addto_names(&string_store);
nextsval = result;
return result;
}
v1 = 1;
nextch();
*v2 = 0;
}
v2[1] = 0;
v3 = v2 + 1;
if ( !v1 )
break;
LABEL_13:
v2 = v3;
}
++v2;
}
while ( v1_compatibility );
v4 = 0LL;
for ( i = "GRAMMAR"; strcmp(&string_store, i); i = (&reserved_words_table)[2 * v4] )
{
if ( ++v4 == 4 )
{
v1 = 0;
goto LABEL_13;
}
}
v6 = 4LL * (int)v4;
result = (unsigned int)dword_2308[v6];
nexttoken = dword_2308[v6];
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(char a1)
{
int v1; // er12
_BYTE *v2; // rbx
_BYTE *v3; // rbp
__int64 v4; // rbx
const char *i; // rsi
__int64 v6; // r12
__int64 result; // rax

string_store = a1;
v1 = 0;
v2 = &unk_BC1;
do
{
while ( 1 )
{
while ( !(unsigned int)func3(v2) )
{
if ( thischar != 32 && thischar != 9 )
{
*v2 = 0;
nexttoken = 1;
result = addto_names(&string_store);
nextsval = result;
return result;
}
v1 = 1;
func0();
*v2 = 0;
}
v2[1] = 0;
v3 = v2 + 1;
if ( !v1 )
break;
LABEL_13:
v2 = v3;
}
++v2;
}
while ( v1_compatibility );
v4 = 0LL;
for ( i = "GRAMMAR"; strcmp(&string_store, i); i = (&reserved_words_table)[2 * v4] )
{
if ( ++v4 == 4 )
{
v1 = 0;
goto LABEL_13;
}
}
v6 = 4LL * (int)v4;
result = (unsigned int)dword_2308[v6];
nexttoken = dword_2308[v6];
return result;
}

original_code:
static void scanidentifier (char firstchar)
 { char *ptr = string_store + 1;
   int had_space = 0;
   int ix;
   string_store[0] = firstchar;
   while (1)
      { if (is_letgit (ptr)) ptr++;
        else if ((thischar == ' ') || (thischar == '\t'))
    { nextch();
      had_space = 1;
    }
        else break;
        *ptr = '\0';
        if (had_space || v1_compatibility) continue;
        for (ix = 0; ix < 4; ix++)
           if ((!strcmp(string_store,reserved_words_table[ix].word)))
       { nexttoken = reserved_words_table[ix].coding;
         return;
       };
      };
   *ptr = '\0';
   nexttoken = IDENTIFIER;
   nextsval = addto_names (string_store);
 }

canonical_original_code:
static void scanidentifier(char firstchar)
 { char *ptr = string_store + 1;
   int had_space = 0;
   int ix;
   string_store[0] = firstchar;
   while (1)
      { if (is_letgit (ptr)) ptr++;
        else if ((thischar == ' ') || (thischar == '\t'))
    { nextch();
      had_space = 1;
    }
        else break;
        *ptr = '\0';
        if (had_space || v1_compatibility) continue;
        for (ix = 0; ix < 4; ix++)
           if ((!strcmp(string_store,reserved_words_table[ix].word)))
       { nexttoken = reserved_words_table[ix].coding;
         return;
       };
      };
   *ptr = '\0';
   nexttoken = IDENTIFIER;
   nextsval = addto_names (string_store);
 }

variable_types: firstchar char

variable_types:
ptr
char *

variable_types: ix int


decompiled_code:
void lexical_error(char *format, unsigned int a2, const char *a3, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-10E0h] BYREF
char s[4096]; // [rsp+20h] [rbp-10C8h] BYREF

va_start(arg, a3);
vsprintf(s, a3, arg);
++lex_errors;
error((int)"lexical error in file %s, line %d, col %d: %s", current_fname, (const char *)(unsigned int)format, a2, s);
}

canonical_decompiled_code:
void func8(char *format, unsigned int a2, const char *a3, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-10E0h] BYREF
char s[4096]; // [rsp+20h] [rbp-10C8h] BYREF

va_start(arg, a3);
vsprintf(s, a3, arg);
++lex_errors;
error((int)"lexical error in file %s, line %d, col %d: %s", current_fname, (const char *)(unsigned int)format, a2, s);
}

original_code:
static void lexical_error (int lin, int col, char *format, ...)
 { char buf[4096];
   va_list arg_ptr;
   __builtin_va_start(arg_ptr,format);
   vsprintf (buf, format, arg_ptr);
   __builtin_va_end(arg_ptr);
   lex_errors++;
   error ("lexical error in file %s, line %d, col %d: %s", current_fname, lin, col, buf);
 }

canonical_original_code:
static void lexical_error(int lin, int col, char *format, ...)
 { char buf[4096];
   __builtin_va_list arg_ptr;
   __builtin_va_start(arg_ptr,format);
   vsprintf (buf, format, arg_ptr);
   __builtin_va_end(arg_ptr);
   lex_errors++;
   error ("lexical error in file %s, line %d, col %d: %s", current_fname, lin, col, buf);
 }

variable_types: lin int

variable_types: col int

variable_types:
format
char *

variable_types:
buf
char [4096]


yieldundefined

decompiled_code:
int yieldundefined()
{
int result; // eax

lexical_error((char *)(unsigned int)nextline, nextcolumn, "Illegal character: '%c'", (unsigned int)thischar);
result = nextch();
nexttoken = 0;
return result;
}

canonical_decompiled_code:
int func10()
{
int result; // eax

func8((char *)(unsigned int)nextline, nextcolumn, "Illegal character: '%c'", (unsigned int)thischar);
result = func0();
nexttoken = 0;
return result;
}

original_code:
static void yieldundefined ()
 { lexical_error (nextline, nextcolumn, "Illegal character: '%c'", thischar);
   nextch ();
   nexttoken = UNDEFINED;
 }

canonical_original_code:
static void yieldundefined()
 { lexical_error (nextline, nextcolumn, "Illegal character: '%c'", thischar);
   nextch ();
   nexttoken = UNDEFINED;
 }


scancut

decompiled_code:
int scancut()
{
int result; // eax

if ( nextchar != 62 )
return yieldundefined();
nextch();
result = nextch();
nexttoken = 24;
return result;
}

canonical_decompiled_code:
int func11()
{
int result; // eax

if ( nextchar != 62 )
return func10();
func0();
result = func0();
nexttoken = 24;
return result;
}

original_code:
static void scancut ()
 { if (nextchar == '>')
      { nextch ();
        nextch ();
        nexttoken = CUT;
      }
   else yieldundefined ();
 }

canonical_original_code:
static void scancut()
 { if (nextchar == '>')
      { nextch ();
        nextch ();
        nexttoken = CUT;
      }
   else yieldundefined ();
 }


decompiled_code:
__int64 __fastcall is_a_special(_BYTE *a1)
{
__int64 result; // rax
unsigned int v2; // er12
unsigned int v3; // ebp

result = 0LL;
if ( thischar == 92 )
{
v2 = lexcolumn;
v3 = lexline;
nextch();
if ( thischar > 125 )
goto LABEL_9;
if ( thischar > 68 )
{
switch ( thischar )
{
case 'E':
*a1 = 27;
break;
case '[':
*a1 = 91;
break;
case '\\':
*a1 = 92;
break;
case ']':
*a1 = 93;
break;
case 'n':
*a1 = 10;
break;
case 't':
*a1 = 9;
break;
case '{':
*a1 = 123;
break;
case '}':
*a1 = 125;
break;
default:
goto LABEL_9;
}
goto LABEL_8;
}
if ( thischar == 34 )
{
*a1 = 34;
goto LABEL_8;
}
if ( thischar == 45 )
{
*a1 = 45;
}
else
{
LABEL_9:
lexical_warning_constprop_0(v3, v2, (__int64)"No need for special char \\%c", (unsigned int)thischar);
*a1 = thischar;
}
LABEL_8:
nextch();
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(_BYTE *a1)
{
__int64 result; // rax
unsigned int v2; // er12
unsigned int v3; // ebp

result = 0LL;
if ( thischar == 92 )
{
v2 = lexcolumn;
v3 = lexline;
func0();
if ( thischar > 125 )
goto LABEL_9;
if ( thischar > 68 )
{
switch ( thischar )
{
case 'E':
*a1 = 27;
break;
case '[':
*a1 = 91;
break;
case '\\':
*a1 = 92;
break;
case ']':
*a1 = 93;
break;
case 'n':
*a1 = 10;
break;
case 't':
*a1 = 9;
break;
case '{':
*a1 = 123;
break;
case '}':
*a1 = 125;
break;
default:
goto LABEL_9;
}
goto LABEL_8;
}
if ( thischar == 34 )
{
*a1 = 34;
goto LABEL_8;
}
if ( thischar == 45 )
{
*a1 = 45;
}
else
{
LABEL_9:
func12(v3, v2, (__int64)"No need for special char \\%c", (unsigned int)thischar);
*a1 = thischar;
}
LABEL_8:
func0();
result = 1LL;
}
return result;
}

original_code:
static int is_a_special (char *ptr)
 { int lin = lexline;
   int col = lexcolumn;
   if (thischar != '\\') return (0);
   nextch ();
   switch (thischar)
      { case 'E': *ptr = 0x1B; break;
        case 'n': *ptr = '\n'; break;
        case 't': *ptr = '\t'; break;
        case '\\': *ptr = '\\'; break;
        case '"': *ptr = '"'; break;
        case '-': *ptr = '-'; break;
        case '[': *ptr = '['; break;
        case ']': *ptr = ']'; break;
        case '{': *ptr = '{'; break;
        case '}': *ptr = '}'; break;
        default:
    lexical_warning (lin, col, "No need for special char \\%c",
       thischar);
    *ptr = thischar;
      };
   nextch ();
   return (1);
 }

canonical_original_code:
static int is_a_special(char *ptr)
 { int lin = lexline;
   int col = lexcolumn;
   if (thischar != '\\') return (0);
   nextch ();
   switch (thischar)
      { case 'E': *ptr = 0x1B; break;
        case 'n': *ptr = '\n'; break;
        case 't': *ptr = '\t'; break;
        case '\\': *ptr = '\\'; break;
        case '"': *ptr = '"'; break;
        case '-': *ptr = '-'; break;
        case '[': *ptr = '['; break;
        case ']': *ptr = ']'; break;
        case '{': *ptr = '{'; break;
        case '}': *ptr = '}'; break;
        default:
    lexical_warning (lin, col, "No need for special char \\%c",
       thischar);
    *ptr = thischar;
      };
   nextch ();
   return (1);
 }


scanstring

decompiled_code:
__int64 scanstring()
{
char *v0; // rbx
__int64 result; // rax

nextch();
if ( thischar != 10 )
{
v0 = (char *)&unk_BC1;
if ( thischar != -1 )
{
do
{
if ( !(unsigned int)is_a_special(v0 - 1) )
{
if ( thischar == 34 )
{
nextch();
*(v0 - 1) = 0;
result = addto_names(&string_store);
nexttoken = 4;
nextsval = result;
return result;
}
*(v0 - 1) = thischar;
nextch();
}
++v0;
}
while ( thischar != 10 && thischar != -1 );
}
}
lexical_error((char *)(unsigned int)nextline, nextcolumn, "string contains newline or eof");
result = addto_names("<ERROR>");
nextsval = result;
return result;
}

canonical_decompiled_code:
__int64 func14()
{
char *v0; // rbx
__int64 result; // rax

func0();
if ( thischar != 10 )
{
v0 = (char *)&unk_BC1;
if ( thischar != -1 )
{
do
{
if ( !(unsigned int)func13(v0 - 1) )
{
if ( thischar == 34 )
{
func0();
*(v0 - 1) = 0;
result = addto_names(&string_store);
nexttoken = 4;
nextsval = result;
return result;
}
*(v0 - 1) = thischar;
func0();
}
++v0;
}
while ( thischar != 10 && thischar != -1 );
}
}
func8((char *)(unsigned int)nextline, nextcolumn, "string contains newline or eof");
result = addto_names("<ERROR>");
nextsval = result;
return result;
}

original_code:
static void scanstring ()
 { char *ptr = string_store;
   nextch ();
   while (1)
      { if ((thischar == '\n') || (thischar == (-1)))
    { lexical_error (nextline, nextcolumn, "string contains newline or eof");
      nextsval = addto_names ("<ERROR>");
      return;
    }
        else if (is_a_special (ptr)) ptr++;
        else if (thischar == '"') break;
        else
    { *ptr = thischar;
      ptr++;
      nextch ();
    };
      };
   nextch ();
   *ptr = '\0';
   nextsval = addto_names (string_store);
   nexttoken = STRING;
 }

canonical_original_code:
static void scanstring()
 { char *ptr = string_store;
   nextch ();
   while (1)
      { if ((thischar == '\n') || (thischar == (-1)))
    { lexical_error (nextline, nextcolumn, "string contains newline or eof");
      nextsval = addto_names ("<ERROR>");
      return;
    }
        else if (is_a_special (ptr)) ptr++;
        else if (thischar == '"') break;
        else
    { *ptr = thischar;
      ptr++;
      nextch ();
    };
      };
   nextch ();
   *ptr = '\0';
   nextsval = addto_names (string_store);
   nexttoken = STRING;
 }


insymbol

decompiled_code:
void insymbol()
{
char v0[9]; // [rsp+Fh] [rbp-9h] BYREF

line = (int)nextline;
this_rval = nextrval;
column = nextcolumn;
thistoken = nexttoken;
this_ival = nextival;
this_sval = nextsval;
may_skip_layout();
nextcolumn = lexcolumn;
LODWORD(nextline) = lexline;
if ( (unsigned int)is_letter(v0) )
{
scanidentifier(v0[0]);
}
else if ( (unsigned int)is_digit(v0) )
{
scan_number(v0[0]);
}
else
{
switch ( thischar )
{
case -1:
yieldsymbol(29);
break;
case 33:
yieldsymbol(22);
break;
case 34:
scanstring();
break;
case 36:
yieldsymbol(6);
break;
case 40:
yieldsymbol(14);
break;
case 41:
yieldsymbol(15);
break;
case 42:
yieldsymbol(20);
break;
case 43:
yieldsymbol(21);
break;
case 44:
yieldsymbol(11);
break;
case 45:
scancut();
break;
case 46:
yieldsymbol(9);
break;
case 58:
scancolons();
break;
case 59:
yieldsymbol(10);
break;
case 62:
yieldsymbol(18);
break;
case 91:
yieldsymbol(16);
break;
case 93:
yieldsymbol(17);
break;
case 94:
yieldsymbol(19);
break;
case 123:
scanset_constprop_0();
break;
case 124:
yieldsymbol(23);
break;
default:
yieldundefined();
break;
}
}
}

canonical_decompiled_code:
void func16()
{
char v0[9]; // [rsp+Fh] [rbp-9h] BYREF

line = (int)nextline;
this_rval = nextrval;
column = nextcolumn;
thistoken = nexttoken;
this_ival = nextival;
this_sval = nextsval;
func1();
nextcolumn = lexcolumn;
LODWORD(nextline) = lexline;
if ( (unsigned int)func2(v0) )
{
func7(v0[0]);
}
else if ( (unsigned int)func4(v0) )
{
func9(v0[0]);
}
else
{
switch ( thischar )
{
case -1:
func6(29);
break;
case 33:
func6(22);
break;
case 34:
func14();
break;
case 36:
func6(6);
break;
case 40:
func6(14);
break;
case 41:
func6(15);
break;
case 42:
func6(20);
break;
case 43:
func6(21);
break;
case 44:
func6(11);
break;
case 45:
func11();
break;
case 46:
func6(9);
break;
case 58:
func5();
break;
case 59:
func6(10);
break;
case 62:
func6(18);
break;
case 91:
func6(16);
break;
case 93:
func6(17);
break;
case 94:
func6(19);
break;
case 123:
func15();
break;
case 124:
func6(23);
break;
default:
func10();
break;
}
}
}

original_code:
void insymbol ()
 { char firstchar;
   line = nextline;
   column = nextcolumn;
   thistoken = nexttoken;
   this_ival = nextival;
   this_rval = nextrval;
   this_sval = nextsval;
   may_skip_layout ();
   nextcolumn = lexcolumn;
   nextline = lexline;
   if (is_letter (&firstchar)) scanidentifier (firstchar);
   else if (is_digit (&firstchar)) scan_number (firstchar);
   else
      switch (thischar)
  { case '!': yieldsymbol (EXCLAMATIONMARK); break;
    case '"': scanstring (); break;
    case '$': yieldsymbol (DOLLAR); break;
    case '(': yieldsymbol (LEFTPARENTHESIS); break;
    case ')': yieldsymbol (RIGHTPARENTHESIS); break;
    case '*': yieldsymbol (STAR); break;
    case '+': yieldsymbol (PLUS); break;
    case ',': yieldsymbol (COMMA); break;
    case '-': scancut (); break;
    case '.': yieldsymbol (POINT); break;
    case ':': scancolons (); break;
    case ';': yieldsymbol (SEMICOLON); break;
    case '>': yieldsymbol (FLOW); break;
    case '[': yieldsymbol (SUB); break;
    case ']': yieldsymbol (BUS); break;
    case '^': yieldsymbol (UP); break;
    case '{': scanset ('}'); break;
    case '|': yieldsymbol (PIPE); break;
    case (-1): yieldsymbol (EOFSYMBOL); break;
    default: yieldundefined ();
  };
 }

canonical_original_code:
void insymbol()
 { char firstchar;
   line = nextline;
   column = nextcolumn;
   thistoken = nexttoken;
   this_ival = nextival;
   this_rval = nextrval;
   this_sval = nextsval;
   may_skip_layout ();
   nextcolumn = lexcolumn;
   nextline = lexline;
   if (is_letter (&firstchar)) scanidentifier (firstchar);
   else if (is_digit (&firstchar)) scan_number (firstchar);
   else
      switch (thischar)
  { case '!': yieldsymbol (EXCLAMATIONMARK); break;
    case '"': scanstring (); break;
    case '$': yieldsymbol (DOLLAR); break;
    case '(': yieldsymbol (LEFTPARENTHESIS); break;
    case ')': yieldsymbol (RIGHTPARENTHESIS); break;
    case '*': yieldsymbol (STAR); break;
    case '+': yieldsymbol (PLUS); break;
    case ',': yieldsymbol (COMMA); break;
    case '-': scancut (); break;
    case '.': yieldsymbol (POINT); break;
    case ':': scancolons (); break;
    case ';': yieldsymbol (SEMICOLON); break;
    case '>': yieldsymbol (FLOW); break;
    case '[': yieldsymbol (SUB); break;
    case ']': yieldsymbol (BUS); break;
    case '^': yieldsymbol (UP); break;
    case '{': scanset ('}'); break;
    case '|': yieldsymbol (PIPE); break;
    case (-1): yieldsymbol (EOFSYMBOL); break;
    default: yieldundefined ();
  };
 }


decompiled_code:
void init_lex()
{
lex_errors = 0;
}

canonical_decompiled_code:
void func17()
{
lex_errors = 0;
}

original_code:
void init_lex ()
 { lex_errors = 0;
 }

canonical_original_code:
void init_lex()
 { lex_errors = 0;
 }


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

result = ckmalloc(16LL);
*(_DWORD *)result = a1;
*(_QWORD *)(result + 8) = a2;
return result;
}

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

result = ckmalloc(16LL);
*(_DWORD *)result = a1;
*(_QWORD *)(result + 8) = a2;
return result;
}

original_code:
lexend new_lexend (int nodenr, int_list valuenrs)
{ lexend nl = (lexend) ckmalloc (sizeof (struct lexend_rec));
  nl -> nodenr = nodenr;
  nl -> valuenrs = valuenrs;
  return (nl);
}

canonical_original_code:
struct lexend_rec *new_lexend(int nodenr, struct int_list_rec *valuenrs)
{ struct lexend_rec *nl = (lexend) ckmalloc (sizeof (struct lexend_rec));
  nl -> nodenr = nodenr;
  nl -> valuenrs = valuenrs;
  return (nl);
}

variable_types: nodenr int

variable_types:
valuenrs
struct int_list_rec *

variable_types: struct lexend_rec { int nodenr; struct int_list_rec { int size; int room; int *array; } *valuenrs; } *

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


decompiled_code:
__int64 __fastcall rdup_lexend(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rdi
__int64 v4; // r12

v2 = ckmalloc(16LL);
v3 = *(_QWORD *)(a1 + 8);
v4 = v2;
*(_DWORD *)v2 = *(_DWORD *)a1;
*(_QWORD *)(v2 + 8) = rdup_int_list(v3);
return v4;
}

original_code:
lexend rdup_lexend (lexend old)
{ lexend nl = (lexend) ckmalloc (sizeof (struct lexend_rec));
  nl -> nodenr = old -> nodenr;
  nl -> valuenrs = rdup_int_list (old -> valuenrs);
  return (nl);
}

canonical_original_code:
struct lexend_rec *rdup_lexend(struct lexend_rec *old)
{ struct lexend_rec *nl = (lexend) ckmalloc (sizeof (struct lexend_rec));
  nl -> nodenr = old -> nodenr;
  nl -> valuenrs = rdup_int_list (old -> valuenrs);
  return (nl);
}

variable_types:
old
struct lexend_rec *

return_type: struct lexend_rec { int nodenr; struct int_list_rec { int size; int room; int *array; } *valuenrs; } *


decompiled_code:
void __fastcall rfre_lexend(void *ptr)
{
rfre_int_list(*((_QWORD *)ptr + 1));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
rfre_int_list(*((_QWORD *)ptr + 1));
free(ptr);
}

original_code:
void rfre_lexend (lexend old)
{ rfre_int_list (old -> valuenrs);
  free (old);
}

canonical_original_code:
void rfre_lexend(struct lexend_rec *old)
{ rfre_int_list (old -> valuenrs);
  free (old);
}


decompiled_code:
_QWORD *new_lexend_list()
{
_QWORD *v0; // r12

v0 = (_QWORD *)ckmalloc(16LL);
*v0 = 0x200000000LL;
v0[1] = ckcalloc(2LL, 8LL);
return v0;
}

canonical_decompiled_code:
_QWORD *func6()
{
_QWORD *v0; // r12

v0 = (_QWORD *)ckmalloc(16LL);
*v0 = 0x200000000LL;
v0[1] = ckcalloc(2LL, 8LL);
return v0;
}

original_code:
lexend_list new_lexend_list ()
{ lexend_list nl = (lexend_list) ckmalloc (sizeof (struct lexend_list_rec));
  nl -> size = 0;
  nl -> room = 2;
  nl -> array = (lexend *) ckcalloc (2, sizeof (lexend));
  return (nl);
}

canonical_original_code:
struct lexend_list_rec *new_lexend_list()
{ struct lexend_list_rec *nl = (lexend_list) ckmalloc (sizeof (struct lexend_list_rec));
  nl -> size = 0;
  nl -> room = 2;
  nl -> array = (struct lexend_rec **) ckcalloc (2, sizeof (lexend));
  return (nl);
}

variable_types: struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec { int size; int room; int *array; } *valuenrs; } **array; } *


original_code:
void room_lexend_list (lexend_list ll, int room)
{ if (room <= ll -> room) return;
  ll -> array = (lexend *) ckrecalloc (ll -> array, room, sizeof (lexend));
  ll -> room = room;
}

canonical_original_code:
void room_lexend_list(struct lexend_list_rec *ll, int room)
{ if (room <= ll -> room) return;
  ll -> array = (struct lexend_rec **) ckrecalloc (ll -> array, room, sizeof (lexend));
  ll -> room = room;
}

variable_types: room int


decompiled_code:
__int64 __fastcall app_lexend_list(__int64 a1, __int64 a2)
{
int v3; // esi
__int64 result; // rax

v3 = *(_DWORD *)a1;
if ( *(_DWORD *)a1 == *(_DWORD *)(a1 + 4) )
{
room_lexend_list(a1, (unsigned int)(2 * v3));
v3 = *(_DWORD *)a1;
}
result = *(_QWORD *)(a1 + 8);
*(_QWORD *)(result + 8LL * v3) = a2;
*(_DWORD *)a1 = v3 + 1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2)
{
int v3; // esi
__int64 result; // rax

v3 = *(_DWORD *)a1;
if ( *(_DWORD *)a1 == *(_DWORD *)(a1 + 4) )
{
func7(a1, (unsigned int)(2 * v3));
v3 = *(_DWORD *)a1;
}
result = *(_QWORD *)(a1 + 8);
*(_QWORD *)(result + 8LL * v3) = a2;
*(_DWORD *)a1 = v3 + 1;
return result;
}

original_code:
void app_lexend_list (lexend_list ll, lexend l)
{ if (ll -> size == ll -> room) room_lexend_list (ll, ll -> size << 1);
  ll -> array [ll -> size] = l;
  ll -> size++;
}

canonical_original_code:
void app_lexend_list(struct lexend_list_rec *ll, struct lexend_rec *l)
{ if (ll -> size == ll -> room) room_lexend_list (ll, ll -> size << 1);
  ll -> array [ll -> size] = l;
  ll -> size++;
}

variable_types:
l
struct lexend_rec *


decompiled_code:
void __fastcall rfre_lexend_list(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi

if ( ptr )
{
if ( *(int *)ptr > 0 )
{
v2 = 0LL;
do
{
v3 = *(void **)(*((_QWORD *)ptr + 1) + 8 * v2++);
rfre_lexend(v3);
}
while ( *(_DWORD *)ptr > (int)v2 );
}
free(*((void **)ptr + 1));
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func9(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi

if ( ptr )
{
if ( *(int *)ptr > 0 )
{
v2 = 0LL;
do
{
v3 = *(void **)(*((_QWORD *)ptr + 1) + 8 * v2++);
func3(v3);
}
while ( *(_DWORD *)ptr > (int)v2 );
}
free(*((void **)ptr + 1));
free(ptr);
}
}

original_code:
void rfre_lexend_list (lexend_list old)
{ int ix;
  if (old == ((lexend_list) ((void *)0))) return;
  for (ix = 0; ix < old -> size; ix++)
    rfre_lexend (old -> array[ix]);
  free (old -> array);
  free (old);
}

canonical_original_code:
void rfre_lexend_list(struct lexend_list_rec *old)
{ int ix;
  if (old == ((lexend_list) ((void *)0))) return;
  for (ix = 0; ix < old -> size; ix++)
    rfre_lexend (old -> array[ix]);
  free (old -> array);
  free (old);
}


decompiled_code:
__int64 __fastcall new_lextree_list(int a1)
{
__int64 v2; // rax
__int64 v3; // rdi
__int64 v4; // r12

v2 = ckmalloc(16LL);
v3 = 1LL;
if ( a1 > 0 )
v3 = (unsigned int)a1;
*(_DWORD *)v2 = 0;
v4 = v2;
*(_DWORD *)(v2 + 4) = v3;
*(_QWORD *)(v2 + 8) = ckcalloc(v3, 8LL);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func12(int a1)
{
__int64 v2; // rax
__int64 v3; // rdi
__int64 v4; // r12

v2 = ckmalloc(16LL);
v3 = 1LL;
if ( a1 > 0 )
v3 = (unsigned int)a1;
*(_DWORD *)v2 = 0;
v4 = v2;
*(_DWORD *)(v2 + 4) = v3;
*(_QWORD *)(v2 + 8) = ckcalloc(v3, 8LL);
return v4;
}

original_code:
lextree_list new_lextree_list (int room)
{ lextree_list nll = (lextree_list) ckmalloc (sizeof (struct lextree_list_rec));
  int mroom = (room <= 0)?1:room;
  nll -> size = 0;
  nll -> room = mroom;
  nll -> array = (lextree *) ckcalloc (mroom, sizeof (lextree));
  return (nll);
}

canonical_original_code:
struct lextree_list_rec *new_lextree_list(int room)
{ struct lextree_list_rec *nll = (lextree_list) ckmalloc (sizeof (struct lextree_list_rec));
  int mroom = (room <= 0)?1:room;
  nll -> size = 0;
  nll -> room = mroom;
  nll -> array = (struct lextree_rec **) ckcalloc (mroom, sizeof (lextree));
  return (nll);
}

variable_types: struct lextree_list_rec { int size; int room; struct lextree_rec { char *remainder; struct lexend_list_rec { int size; int room; struct lexend_rec { int nodenr; struct int_list_rec { int size; int room; int *array; } *valuenrs; } **array; } *prods; struct lextree_list_rec *tails; } **array; } *

variable_types: mroom int

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


original_code:
void room_lextree_list (lextree_list ll, int room)
{ if (room <= ll -> room) return;
  ll -> array = (lextree *) ckrecalloc (ll -> array, room, sizeof (lextree));
  ll -> room = room;
}

canonical_original_code:
void room_lextree_list(struct lextree_list_rec *ll, int room)
{ if (room <= ll -> room) return;
  ll -> array = (struct lextree_rec **) ckrecalloc (ll -> array, room, sizeof (lextree));
  ll -> room = room;
}