usage

decompiled_code:
void __noreturn usage()
{
puts("usage: ltl2ba [-flag] -f formula");
puts(" or -F file");
puts(" -h\t\tthis help message");
puts(" -V\t\tprint version and exit");
puts(" -t type\toutput format; default is \"spin\"; can be one of the following:\n\t\tspin, dot, gexf");
printf(" -f \"formula\"\ttranslate LTL ");
puts("into never claim");
printf(" -F file\tlike -f, but with the LTL ");
puts("formula stored in a 1-line file");
puts(" -d\t\tdisplay automata (D)escription at each step");
puts(" -s\t\tcomputing time and automata sizes (S)tatistics");
puts(" -l\t\tdisable (L)ogic formula simplification");
puts(" -p\t\tdisable a-(P)osteriori simplification");
puts(" -o\t\tdisable (O)n-the-fly simplification");
puts(" -c\t\tdisable strongly (C)onnected components simplification");
puts(" -a\t\tdisable trick in (A)ccepting conditions");
alldone(1);
}

canonical_decompiled_code:
void __noreturn func5()
{
puts("usage: ltl2ba [-flag] -f formula");
puts(" or -F file");
puts(" -h\t\tthis help message");
puts(" -V\t\tprint version and exit");
puts(" -t type\toutput format; default is \"spin\"; can be one of the following:\n\t\tspin, dot, gexf");
printf(" -f \"formula\"\ttranslate LTL ");
puts("into never claim");
printf(" -F file\tlike -f, but with the LTL ");
puts("formula stored in a 1-line file");
puts(" -d\t\tdisplay automata (D)escription at each step");
puts(" -s\t\tcomputing time and automata sizes (S)tatistics");
puts(" -l\t\tdisable (L)ogic formula simplification");
puts(" -p\t\tdisable a-(P)osteriori simplification");
puts(" -o\t\tdisable (O)n-the-fly simplification");
puts(" -c\t\tdisable strongly (C)onnected components simplification");
puts(" -a\t\tdisable trick in (A)ccepting conditions");
func1(1);
}

original_code:
void
usage(void)
{
        printf("usage: ltl2ba [-flag] -f formula\n");
        printf("                   or -F file\n");
  printf(" -h\t\tthis help message\n");
  printf(" -V\t\tprint version and exit\n");
  printf(" -t type\toutput format; default is \"spin\"; can be one of the following:\n\t\tspin, dot, gexf\n");
        printf(" -f \"formula\"\ttranslate LTL ");
        printf("into never claim\n");
        printf(" -F file\tlike -f, but with the LTL ");
        printf("formula stored in a 1-line file\n");
        printf(" -d\t\tdisplay automata (D)escription at each step\n");
        printf(" -s\t\tcomputing time and automata sizes (S)tatistics\n");
        printf(" -l\t\tdisable (L)ogic formula simplification\n");
        printf(" -p\t\tdisable a-(P)osteriori simplification\n");
        printf(" -o\t\tdisable (O)n-the-fly simplification\n");
        printf(" -c\t\tdisable strongly (C)onnected components simplification\n");
        printf(" -a\t\tdisable trick in (A)ccepting conditions\n");
        alldone(1);
}

canonical_original_code:
void usage()
{
        printf("usage: ltl2ba [-flag] -f formula\n");
        printf("                   or -F file\n");
  printf(" -h\t\tthis help message\n");
  printf(" -V\t\tprint version and exit\n");
  printf(" -t type\toutput format; default is \"spin\"; can be one of the following:\n\t\tspin, dot, gexf\n");
        printf(" -f \"formula\"\ttranslate LTL ");
        printf("into never claim\n");
        printf(" -F file\tlike -f, but with the LTL ");
        printf("formula stored in a 1-line file\n");
        printf(" -d\t\tdisplay automata (D)escription at each step\n");
        printf(" -s\t\tcomputing time and automata sizes (S)tatistics\n");
        printf(" -l\t\tdisable (L)ogic formula simplification\n");
        printf(" -p\t\tdisable a-(P)osteriori simplification\n");
        printf(" -o\t\tdisable (O)n-the-fly simplification\n");
        printf(" -c\t\tdisable strongly (C)onnected components simplification\n");
        printf(" -a\t\tdisable trick in (A)ccepting conditions\n");
        alldone(1);
}


decompiled_code:
__int64 __fastcall tl_main(int a1, __int64 a2)
{
__int64 v2; // rbp
__int64 v3; // rbx
_BYTE *v4; // rax
const char *v5; // rsi
int v6; // edx
char *v7; // rcx
__int64 v8; // rax
int v9; // edx

if ( a1 > 1 )
{
v2 = a2;
v3 = a2 + 16LL * (((unsigned int)(a1 - 2) >> 1) + 1);
while ( 1 )
{
v4 = *(_BYTE **)(v2 + 8);
if ( *v4 != 45 )
break;
if ( v4[1] != 102 )
goto LABEL_17;
v5 = *(const char **)(v2 + 16);
LOBYTE(v6) = *v5;
v7 = (char *)v5;
if ( *v5 > 0 )
{
v8 = 0LL;
do
{
if ( (unsigned __int8)(v6 - 9) <= 1u || (_BYTE)v6 == 34 )
{
*v7 = 32;
v5 = *(const char **)(v2 + 16);
}
v7 = (char *)&v5[++v8];
v6 = v5[v8];
}
while ( v6 > (int)v8 );
}
v2 += 16LL;
strcpy(uform, v5);
hasuform = strlen(uform);
v9 = hasuform;
if ( v2 == v3 )
goto LABEL_12;
}
}
v9 = hasuform;
LABEL_12:
if ( !v9 )
LABEL_17:
usage();
tl_parse();
if ( tl_stats )
tl_endstats();
return (unsigned int)tl_errs;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, __int64 a2)
{
__int64 v2; // rbp
__int64 v3; // rbx
_BYTE *v4; // rax
const char *v5; // rsi
int v6; // edx
char *v7; // rcx
__int64 v8; // rax
int v9; // edx

if ( a1 > 1 )
{
v2 = a2;
v3 = a2 + 16LL * (((unsigned int)(a1 - 2) >> 1) + 1);
while ( 1 )
{
v4 = *(_BYTE **)(v2 + 8);
if ( *v4 != 45 )
break;
if ( v4[1] != 102 )
goto LABEL_17;
v5 = *(const char **)(v2 + 16);
LOBYTE(v6) = *v5;
v7 = (char *)v5;
if ( *v5 > 0 )
{
v8 = 0LL;
do
{
if ( (unsigned __int8)(v6 - 9) <= 1u || (_BYTE)v6 == 34 )
{
*v7 = 32;
v5 = *(const char **)(v2 + 16);
}
v7 = (char *)&v5[++v8];
v6 = v5[v8];
}
while ( v6 > (int)v8 );
}
v2 += 16LL;
strcpy(uform, v5);
hasuform = strlen(uform);
v9 = hasuform;
if ( v2 == v3 )
goto LABEL_12;
}
}
v9 = hasuform;
LABEL_12:
if ( !v9 )
LABEL_17:
func5();
tl_parse();
if ( tl_stats )
func0();
return (unsigned int)tl_errs;
}

original_code:
int
tl_main(int argc, char *argv[])
{ int i;
 while (argc > 1 && argv[1][0] == '-')
 { switch (argv[1][1]) {
  case 'f': argc--; argv++;
    for (i = 0; i < argv[1][i]; i++)
    { if (argv[1][i] == '\t'
     || argv[1][i] == '\"'
     || argv[1][i] == '\n')
      argv[1][i] = ' ';
    }
    strcpy(uform, argv[1]);
    hasuform = strlen(uform);
    break;
  default : usage();
  }
  argc--; argv++;
 }
 if (hasuform == 0) usage();
 tl_parse();
 if (tl_stats) tl_endstats();
 return tl_errs;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: i int

return_type: int


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

if ( a1 == 59 )
return printf("end of formula");
switch ( a1 )
{
case 257:
result = printf("[]");
break;
case 258:
result = printf("&&");
break;
case 259:
result = printf("<->");
break;
case 260:
result = printf("<>");
break;
case 261:
result = printf("false");
break;
case 262:
result = printf("->");
break;
case 263:
result = putchar(33);
break;
case 264:
result = printf("||");
break;
case 265:
result = printf("predicate");
break;
case 266:
result = printf("true");
break;
case 267:
result = putchar(85);
break;
case 268:
result = putchar(86);
break;
case 269:
result = putchar(88);
break;
default:
result = putchar(a1);
break;
}
return result;
}

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

if ( a1 == 59 )
return printf("end of formula");
switch ( a1 )
{
case 257:
result = printf("[]");
break;
case 258:
result = printf("&&");
break;
case 259:
result = printf("<->");
break;
case 260:
result = printf("<>");
break;
case 261:
result = printf("false");
break;
case 262:
result = printf("->");
break;
case 263:
result = putchar(33);
break;
case 264:
result = printf("||");
break;
case 265:
result = printf("predicate");
break;
case 266:
result = printf("true");
break;
case 267:
result = putchar(85);
break;
case 268:
result = putchar(86);
break;
case 269:
result = putchar(88);
break;
default:
result = putchar(a1);
break;
}
return result;
}

original_code:
void
tl_explain(int n)
{
 switch (n) {
 case ALWAYS: printf("[]"); break;
 case EVENTUALLY: printf("<>"); break;
 case IMPLIES: printf("->"); break;
 case EQUIV: printf("<->"); break;
 case PREDICATE: printf("predicate"); break;
 case OR: printf("||"); break;
 case AND: printf("&&"); break;
 case NOT: printf("!"); break;
 case U_OPER: printf("U"); break;
 case V_OPER: printf("V"); break;
 case NEXT: printf("X"); break;
 case TRUE: printf("true"); break;
 case FALSE: printf("false"); break;
 case ';': printf("end of formula"); break;
 default: printf("%c", n); break;
 }
}

variable_types: n int

return_type: void


dump

decompiled_code:
void __fastcall dump(__int16 *a1)
{
size_t v2; // rdx
FILE *v3; // rcx
const char *v4; // rdi
__int64 v5; // rdi
FILE *v6; // rsi
int v7; // edi

if ( a1 )
{
if ( *a1 == -1 )
{
fwrite(" D ", 1uLL, 3uLL, tl_out);
}
else
{
switch ( *a1 )
{
case 258:
fputc(40, tl_out);
dump(*((_QWORD *)a1 + 2));
v2 = 4LL;
v3 = tl_out;
v4 = " && ";
goto LABEL_6;
case 261:
fwrite("false", 1uLL, 5uLL, tl_out);
return;
case 263:
v6 = tl_out;
v7 = 33;
goto LABEL_10;
case 264:
fputc(40, tl_out);
dump(*((_QWORD *)a1 + 2));
v2 = 4LL;
v3 = tl_out;
v4 = " || ";
goto LABEL_6;
case 265:
fprintf(tl_out, "(%s)", **((const char ***)a1 + 1));
return;
case 266:
fwrite("true", 1uLL, 4uLL, tl_out);
return;
case 267:
fputc(40, tl_out);
dump(*((_QWORD *)a1 + 2));
v2 = 3LL;
v3 = tl_out;
v4 = " U ";
goto LABEL_6;
case 268:
fputc(40, tl_out);
dump(*((_QWORD *)a1 + 2));
v2 = 3LL;
v3 = tl_out;
v4 = " V ";
LABEL_6:
fwrite(v4, 1uLL, v2, v3);
v5 = *((_QWORD *)a1 + 3);
goto LABEL_7;
case 269:
v6 = tl_out;
v7 = 88;
LABEL_10:
fputc(v7, v6);
fwrite(" (", 1uLL, 2uLL, tl_out);
v5 = *((_QWORD *)a1 + 2);
LABEL_7:
dump(v5);
fputc(41, tl_out);
break;
default:
printf("Unknown token: ");
tl_explain(*a1);
break;
}
}
}
}

canonical_decompiled_code:
void __fastcall func9(__int16 *a1)
{
size_t v2; // rdx
FILE *v3; // rcx
const char *v4; // rdi
__int64 v5; // rdi
FILE *v6; // rsi
int v7; // edi

if ( a1 )
{
if ( *a1 == -1 )
{
fwrite(" D ", 1uLL, 3uLL, tl_out);
}
else
{
switch ( *a1 )
{
case 258:
fputc(40, tl_out);
func9(*((_QWORD *)a1 + 2));
v2 = 4LL;
v3 = tl_out;
v4 = " && ";
goto LABEL_6;
case 261:
fwrite("false", 1uLL, 5uLL, tl_out);
return;
case 263:
v6 = tl_out;
v7 = 33;
goto LABEL_10;
case 264:
fputc(40, tl_out);
func9(*((_QWORD *)a1 + 2));
v2 = 4LL;
v3 = tl_out;
v4 = " || ";
goto LABEL_6;
case 265:
fprintf(tl_out, "(%s)", **((const char ***)a1 + 1));
return;
case 266:
fwrite("true", 1uLL, 4uLL, tl_out);
return;
case 267:
fputc(40, tl_out);
func9(*((_QWORD *)a1 + 2));
v2 = 3LL;
v3 = tl_out;
v4 = " U ";
goto LABEL_6;
case 268:
fputc(40, tl_out);
func9(*((_QWORD *)a1 + 2));
v2 = 3LL;
v3 = tl_out;
v4 = " V ";
LABEL_6:
fwrite(v4, 1uLL, v2, v3);
v5 = *((_QWORD *)a1 + 3);
goto LABEL_7;
case 269:
v6 = tl_out;
v7 = 88;
LABEL_10:
fputc(v7, v6);
fwrite(" (", 1uLL, 2uLL, tl_out);
v5 = *((_QWORD *)a1 + 2);
LABEL_7:
func9(v5);
fputc(41, tl_out);
break;
default:
printf("Unknown token: ");
func8(*a1);
break;
}
}
}
}

original_code:
void
dump(Node *n)
{
 if (!n) return;
 switch(n->ntyp) {
 case OR: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " || "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case AND: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " && "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case U_OPER: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " U "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case V_OPER: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " V "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case NEXT:
  fprintf(tl_out, "X");
  fprintf(tl_out, " (");
  dump(n->lft);
  fprintf(tl_out, ")");
  break;
 case NOT:
  fprintf(tl_out, "!");
  fprintf(tl_out, " (");
  dump(n->lft);
  fprintf(tl_out, ")");
  break;
 case FALSE:
  fprintf(tl_out, "false");
  break;
 case TRUE:
  fprintf(tl_out, "true");
  break;
 case PREDICATE:
  fprintf(tl_out, "(%s)", n->sym->name);
  break;
 case -1:
  fprintf(tl_out, " D ");
  break;
 default:
  printf("Unknown token: ");
  tl_explain(n->ntyp);
  break;
 }
}

canonical_original_code:
void dump(struct Node *n)
{
 if (!n) return;
 switch(n->ntyp) {
 case OR: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " || "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case AND: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " && "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case U_OPER: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " U "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case V_OPER: fprintf(tl_out, "("); dump(n->lft); fprintf(tl_out, " V "); dump(n->rgt); fprintf(tl_out, ")"); break;
 case NEXT:
  fprintf(tl_out, "X");
  fprintf(tl_out, " (");
  dump(n->lft);
  fprintf(tl_out, ")");
  break;
 case NOT:
  fprintf(tl_out, "!");
  fprintf(tl_out, " (");
  dump(n->lft);
  fprintf(tl_out, ")");
  break;
 case FALSE:
  fprintf(tl_out, "false");
  break;
 case TRUE:
  fprintf(tl_out, "true");
  break;
 case PREDICATE:
  fprintf(tl_out, "(%s)", n->sym->name);
  break;
 case -1:
  fprintf(tl_out, " D ");
  break;
 default:
  printf("Unknown token: ");
  tl_explain(n->ntyp);
  break;
 }
}

variable_types: struct Node { short ntyp; struct Symbol { char *name; struct Symbol *next; } *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; } *

user_defined_types: struct Node { short ntyp; struct Symbol *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; }


decompiled_code:
int __fastcall non_fatal(char *format, __int64 a2)
{
int v2; // ebx
int result; // eax

printf("ltl2ba: ");
if ( a2 )
printf(format, a2);
else
printf(format);
if ( (unsigned int)(tl_yychar + 1) > 1 )
{
printf(", saw '");
tl_explain(tl_yychar);
putchar(39);
}
printf("\nltl2ba: %s\n---------", uform);
if ( cnt > 0 )
{
v2 = 0;
do
{
++v2;
putchar(45);
}
while ( cnt > v2 );
}
puts("^");
result = fflush(stdout);
++tl_errs;
return result;
}

canonical_decompiled_code:
int __fastcall func10(char *format, __int64 a2)
{
int v2; // ebx
int result; // eax

printf("ltl2ba: ");
if ( a2 )
printf(format, a2);
else
printf(format);
if ( (unsigned int)(tl_yychar + 1) > 1 )
{
printf(", saw '");
func8(tl_yychar);
putchar(39);
}
printf("\nltl2ba: %s\n---------", uform);
if ( cnt > 0 )
{
v2 = 0;
do
{
++v2;
putchar(45);
}
while ( cnt > v2 );
}
puts("^");
result = fflush(stdout);
++tl_errs;
return result;
}

original_code:
static void
non_fatal(char *s1, char *s2)
{ extern int tl_yychar;
 int i;
 printf("ltl2ba: ");
 if (s2)
  printf(s1, s2);
 else
  printf(s1);
 if (tl_yychar != -1 && tl_yychar != 0)
 { printf(", saw '");
  tl_explain(tl_yychar);
  printf("'");
 }
 printf("\nltl2ba: %s\n---------", uform);
 for (i = 0; i < cnt; i++)
  printf("-");
 printf("^\n");
 fflush(stdout);
 tl_errs++;
}


Fatal

decompiled_code:
void __fastcall __noreturn Fatal(char *a1, __int64 a2)
{
non_fatal(a1, a2);
alldone(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func11(char *a1, __int64 a2)
{
func10(a1, a2);
func1(1);
}

original_code:
void
Fatal(char *s1, char *s2)
{
  non_fatal(s1, s2);
  alldone(1);
}


decompiled_code:
void __fastcall __noreturn tl_yyerror(char *a1)
{
Fatal(a1, 0LL);
}

canonical_decompiled_code:
void __fastcall __noreturn func12(char *a1)
{
func11(a1, 0LL);
}

original_code:
void
tl_yyerror(char *s1)
{
 Fatal(s1, (char *) 0);
}


emalloc

decompiled_code:
void *__fastcall emalloc(int a1)
{
void *result; // rax

result = calloc(a1, 1uLL);
if ( !result )
Fatal("not enough memory", 0LL);
return result;
}

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

result = calloc(a1, 1uLL);
if ( !result )
func11("not enough memory", 0LL);
return result;
}

original_code:
char *
emalloc(int n)
{ char *tmp;
        if (!(tmp = (char *) malloc(n)))
                fatal("not enough memory", (char *)0);
        memset(tmp, 0, n);
        return tmp;
}

canonical_original_code:
char *emalloc(int n)
{ char *tmp;
        if (!(tmp = (char *) malloc(n)))
                fatal("not enough memory", (char *)0);
        memset(tmp, 0, n);
        return tmp;
}

variable_types:
tmp
char *

return_type: char *


fatal

decompiled_code:
void __fastcall __noreturn fatal(char *a1, __int64 a2)
{
Fatal(a1, a2);
}

canonical_decompiled_code:
void __fastcall __noreturn func14(char *a1, __int64 a2)
{
func11(a1, a2);
}

original_code:
void
fatal(char *s1, char *s2)
{
        non_fatal(s1, s2);
        alldone(1);
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebp
const char *v5; // rdx
const char *v7; // r12
const char **v8; // rax
int v9; // eax
const char **v10; // rax
char v11[4136]; // [rsp+0h] [rbp-1028h] BYREF

v3 = argc;
tl_out = stdout;
if ( argc <= 1 )
{
LABEL_10:
v8 = (const char **)ltl_file;
if ( ltl_file )
{
add_ltl = ltl_file - 16;
*(_BYTE *)(*(_QWORD *)(ltl_file - 8) + 1LL) = 102;
tl_out = fopen(*v8, "r");
if ( !tl_out )
{
printf("ltl2ba: cannot open %s\n", *(const char **)ltl_file);
alldone(1);
}
fgets(v11, 4096, tl_out);
fclose(tl_out);
tl_out = stdout;
*(_QWORD *)ltl_file = v11;
}
else if ( !add_ltl )
{
goto LABEL_30;
}
if ( v3 > 1 )
{
strcpy(&out1, "_tmp1_");
strcpy(v11, "_tmp2_");
tl_out = cpyfile(argv[1], v11);
tl_main(2, add_ltl);
return fclose(tl_out);
}
if ( v3 == 1 )
{
v9 = tl_main(2, add_ltl);
exit(v9);
}
LABEL_30:
usage();
}
while ( 2 )
{
v5 = argv[1];
if ( *v5 != 45 )
goto LABEL_10;
switch ( v5[1] )
{
case 'F':
v10 = argv + 2;
--v3;
++argv;
ltl_file = (__int64)v10;
goto LABEL_9;
case 'V':
puts("ltl2gba version 1.2-scl");
return 0;
case 'a':
tl_fjtofj = 0;
goto LABEL_9;
case 'c':
tl_simp_scc = 0;
goto LABEL_9;
case 'd':
tl_verbose = 1;
goto LABEL_9;
case 'f':
add_ltl = (__int64)argv;
--v3;
++argv;
goto LABEL_9;
case 'h':
goto LABEL_30;
case 'l':
tl_simp_log = 0;
goto LABEL_9;
case 'o':
tl_simp_fly = 0;
goto LABEL_9;
case 'p':
tl_simp_diff = 0;
goto LABEL_9;
case 's':
tl_stats = 1;
goto LABEL_9;
case 't':
v7 = argv[2];
--v3;
if ( !strncmp(v7, "spin", 4uLL) )
{
output_format = 0;
++argv;
goto LABEL_9;
}
if ( !strncmp(v7, "dot", 3uLL) )
{
output_format = 1;
++argv;
LABEL_9:
--v3;
++argv;
if ( v3 <= 1 )
goto LABEL_10;
continue;
}
if ( !strncmp(v7, "gexf", 4uLL) )
{
output_format = 2;
++argv;
goto LABEL_9;
}
fwrite("Incorrect use of \"-t\" flag. Try \"-h\".\n", 1uLL, 0x27uLL, stderr);
return 1;
default:
fprintf(stderr, "Unrecognized option \"%s\". Try \"-h\".\n", v5);
return 1;
}
}
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebp
const char *v5; // rdx
const char *v7; // r12
const char **v8; // rax
int v9; // eax
const char **v10; // rax
char v11[4136]; // [rsp+0h] [rbp-1028h] BYREF

v3 = argc;
tl_out = stdout;
if ( argc <= 1 )
{
LABEL_10:
v8 = (const char **)ltl_file;
if ( ltl_file )
{
add_ltl = ltl_file - 16;
*(_BYTE *)(*(_QWORD *)(ltl_file - 8) + 1LL) = 102;
tl_out = fopen(*v8, "r");
if ( !tl_out )
{
printf("ltl2ba: cannot open %s\n", *(const char **)ltl_file);
func1(1);
}
fgets(v11, 4096, tl_out);
fclose(tl_out);
tl_out = stdout;
*(_QWORD *)ltl_file = v11;
}
else if ( !add_ltl )
{
goto LABEL_30;
}
if ( v3 > 1 )
{
strcpy(&out1, "_tmp1_");
strcpy(v11, "_tmp2_");
tl_out = cpyfile(argv[1], v11);
func6(2, add_ltl);
return fclose(tl_out);
}
if ( v3 == 1 )
{
v9 = func6(2, add_ltl);
exit(v9);
}
LABEL_30:
func5();
}
while ( 2 )
{
v5 = argv[1];
if ( *v5 != 45 )
goto LABEL_10;
switch ( v5[1] )
{
case 'F':
v10 = argv + 2;
--v3;
++argv;
ltl_file = (__int64)v10;
goto LABEL_9;
case 'V':
puts("ltl2gba version 1.2-scl");
return 0;
case 'a':
tl_fjtofj = 0;
goto LABEL_9;
case 'c':
tl_simp_scc = 0;
goto LABEL_9;
case 'd':
tl_verbose = 1;
goto LABEL_9;
case 'f':
add_ltl = (__int64)argv;
--v3;
++argv;
goto LABEL_9;
case 'h':
goto LABEL_30;
case 'l':
tl_simp_log = 0;
goto LABEL_9;
case 'o':
tl_simp_fly = 0;
goto LABEL_9;
case 'p':
tl_simp_diff = 0;
goto LABEL_9;
case 's':
tl_stats = 1;
goto LABEL_9;
case 't':
v7 = argv[2];
--v3;
if ( !strncmp(v7, "spin", 4uLL) )
{
output_format = 0;
++argv;
goto LABEL_9;
}
if ( !strncmp(v7, "dot", 3uLL) )
{
output_format = 1;
++argv;
LABEL_9:
--v3;
++argv;
if ( v3 <= 1 )
goto LABEL_10;
continue;
}
if ( !strncmp(v7, "gexf", 4uLL) )
{
output_format = 2;
++argv;
goto LABEL_9;
}
fwrite("Incorrect use of \"-t\" flag. Try \"-h\".\n", 1uLL, 0x27uLL, stderr);
return 1;
default:
fprintf(stderr, "Unrecognized option \"%s\". Try \"-h\".\n", v5);
return 1;
}
}
}

original_code:
int
main(int argc, char *argv[])
{ int i;
 tl_out = stdout;
 while (argc > 1 && argv[1][0] == '-')
        { switch (argv[1][1]) {
                case 'F': ltl_file = (char **) (argv+2);
                          argc--; argv++; break;
                case 'f': add_ltl = (char **) argv;
                          argc--; argv++; break;
                case 'a': tl_fjtofj = 0; break;
                case 'c': tl_simp_scc = 0; break;
                case 'o': tl_simp_fly = 0; break;
                case 'p': tl_simp_diff = 0; break;
                case 'l': tl_simp_log = 0; break;
                case 'd': tl_verbose = 1; break;
                case 's': tl_stats = 1; break;
                case 'h': usage(); break;
                case 'V':
     printf( "ltl2gba version 1.2-scl\n" );
     return 0;
                case 't':
     if (argc <= 1) {
      fprintf( stderr, "Incorrect use of \"-t\" flag.  Try \"-h\".\n" );
      return 1;
     }
     argc--;
     argv++;
     if (!strncmp( argv[1], "spin", 4 )) {
      output_format = 0;
     } else if (!strncmp( argv[1], "dot", 3 )) {
      output_format = 1;
     } else if (!strncmp( argv[1], "gexf", 4 )) {
      output_format = 2;
     } else {
      fprintf( stderr, "Incorrect use of \"-t\" flag.  Try \"-h\".\n" );
      return 1;
     }
     break;
                default :
     fprintf( stderr, "Unrecognized option \"%s\".  Try \"-h\".\n", argv[1] );
     return 1;
                }
                argc--, argv++;
        }
 if(!ltl_file && !add_ltl) usage();
        if (ltl_file)
        { char formula[4096];
                add_ltl = ltl_file-2; add_ltl[1][1] = 'f';
                if (!(tl_out = fopen(*ltl_file, "r")))
                { printf("ltl2ba: cannot open %s\n", *ltl_file);
                        alldone(1);
                }
                fgets(formula, 4096, tl_out);
                fclose(tl_out);
                tl_out = stdout;
                *ltl_file = (char *) formula;
        }
        if (argc > 1)
        { char cmd[128], out2[64];
                strcpy(out1, "_tmp1_");
                strcpy(out2, "_tmp2_");
                tl_out = cpyfile(argv[1], out2);
                tl_main(2, add_ltl);
                fclose(tl_out);
        } else
 {
                if (argc > 0)
                        exit(tl_main(2, add_ltl));
  usage();
 }
}

canonical_original_code:
int main(int argc, char *argv[])
{ int i;
 tl_out = stdout;
 while (argc > 1 && argv[1][0] == '-')
        { switch (argv[1][1]) {
                case 'F': ltl_file = (char **) (argv+2);
                          argc--; argv++; break;
                case 'f': add_ltl = (char **) argv;
                          argc--; argv++; break;
                case 'a': tl_fjtofj = 0; break;
                case 'c': tl_simp_scc = 0; break;
                case 'o': tl_simp_fly = 0; break;
                case 'p': tl_simp_diff = 0; break;
                case 'l': tl_simp_log = 0; break;
                case 'd': tl_verbose = 1; break;
                case 's': tl_stats = 1; break;
                case 'h': usage(); break;
                case 'V':
     printf( "ltl2gba version 1.2-scl\n" );
     return 0;
                case 't':
     if (argc <= 1) {
      fprintf( stderr, "Incorrect use of \"-t\" flag.  Try \"-h\".\n" );
      return 1;
     }
     argc--;
     argv++;
     if (!strncmp( argv[1], "spin", 4 )) {
      output_format = 0;
     } else if (!strncmp( argv[1], "dot", 3 )) {
      output_format = 1;
     } else if (!strncmp( argv[1], "gexf", 4 )) {
      output_format = 2;
     } else {
      fprintf( stderr, "Incorrect use of \"-t\" flag.  Try \"-h\".\n" );
      return 1;
     }
     break;
                default :
     fprintf( stderr, "Unrecognized option \"%s\".  Try \"-h\".\n", argv[1] );
     return 1;
                }
                argc--, argv++;
        }
 if(!ltl_file && !add_ltl) usage();
        if (ltl_file)
        { char formula[4096];
                add_ltl = ltl_file-2; add_ltl[1][1] = 'f';
                if (!(tl_out = fopen(*ltl_file, "r")))
                { printf("ltl2ba: cannot open %s\n", *ltl_file);
                        alldone(1);
                }
                fgets(formula, 4096, tl_out);
                fclose(tl_out);
                tl_out = stdout;
                *ltl_file = (char *) formula;
        }
        if (argc > 1)
        { char cmd[128]; char out2[64];
                strcpy(out1, "_tmp1_");
                strcpy(out2, "_tmp2_");
                tl_out = cpyfile(argv[1], out2);
                tl_main(2, add_ltl);
                fclose(tl_out);
        } else
 {
                if (argc > 0)
                        exit(tl_main(2, add_ltl));
  usage();
 }
}

variable_types:
formula
char [4096]

variable_types:
cmd
char [128]


decompiled_code:
__int64 __fastcall isalnum_(int a1)
{
return ((a1 == 95) | (unsigned __int8)((*_ctype_b_loc())[a1] >> 3)) & 1;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
return ((a1 == 95) | (unsigned __int8)((*_ctype_b_loc())[a1] >> 3)) & 1;
}

original_code:
int
isalnum_(int c)
{ return (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short int) _ISalnum) || c == '_');
}

canonical_original_code:
int isalnum_(int c)
{ return (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short) _ISalnum) || c == '_');
}

variable_types: c int


follow

decompiled_code:
__int64 __fastcall follow(unsigned int a1, unsigned int a2, unsigned int a3)
{
int v4; // ebp
__int64 result; // rax
char v6[72]; // [rsp+0h] [rbp-48h] BYREF

v4 = tl_Getchar();
result = a2;
if ( v4 != a1 )
{
tl_UnGetchar();
tl_yychar = v4;
sprintf(v6, "expected '%c'", a1);
tl_yyerror(v6);
result = a3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1, unsigned int a2, unsigned int a3)
{
int v4; // ebp
__int64 result; // rax
char v6[72]; // [rsp+0h] [rbp-48h] BYREF

v4 = tl_Getchar();
result = a2;
if ( v4 != a1 )
{
tl_UnGetchar();
tl_yychar = v4;
sprintf(v6, "expected '%c'", a1);
tl_yyerror(v6);
result = a3;
}
return result;
}

original_code:
static int
follow(int tok, int ifyes, int ifno)
{ int c;
 char buf[32];
 extern int tl_yychar;
 if ((c = tl_Getchar()) == tok)
  return ifyes;
 tl_UnGetchar();
 tl_yychar = c;
 sprintf(buf, "expected '%c'", tok);
 tl_yyerror(buf);
 return ifno;
}

variable_types: tok int

variable_types: ifyes int

variable_types: ifno int

variable_types:
buf
char [32]


hash

decompiled_code:
__int64 __fastcall hash(_BYTE *a1)
{
int v1; // edx
__int64 result; // rax

v1 = (char)*a1;
result = 0LL;
if ( *a1 )
{
do
{
++a1;
LODWORD(result) = 2 * (v1 + result);
if ( (result & 0x100) != 0 )
LODWORD(result) = result | 1;
v1 = (char)*a1;
}
while ( *a1 );
result = (unsigned __int8)result;
}
return result;
}

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

v1 = (char)*a1;
result = 0LL;
if ( *a1 )
{
do
{
++a1;
LODWORD(result) = 2 * (v1 + result);
if ( (result & 0x100) != 0 )
LODWORD(result) = result | 1;
v1 = (char)*a1;
}
while ( *a1 );
result = (unsigned __int8)result;
}
return result;
}

variable_types:
s
char *

variable_types: h int


decompiled_code:
char **__fastcall tl_lookup(char *src)
{
__int64 v1; // rbx
__int64 v2; // r12
char **result; // rax
char **v4; // r12
int v5; // eax
char *v6; // rax
__int64 v7; // rax

v1 = (int)hash(src);
v2 = symtab[v1];
if ( v2 )
{
while ( strcmp(*(const char **)v2, src) )
{
v2 = *(_QWORD *)(v2 + 8);
if ( !v2 )
goto LABEL_6;
}
result = (char **)v2;
}
else
{
LABEL_6:
v4 = (char **)tl_emalloc(16LL);
v5 = strlen(src);
v6 = (char *)tl_emalloc((unsigned int)(v5 + 1));
*v4 = v6;
strcpy(v6, src);
v7 = symtab[v1];
symtab[v1] = (__int64)v4;
v4[1] = (char *)v7;
result = v4;
}
return result;
}

canonical_decompiled_code:
char **__fastcall func4(char *src)
{
__int64 v1; // rbx
__int64 v2; // r12
char **result; // rax
char **v4; // r12
int v5; // eax
char *v6; // rax
__int64 v7; // rax

v1 = (int)func3(src);
v2 = symtab[v1];
if ( v2 )
{
while ( strcmp(*(const char **)v2, src) )
{
v2 = *(_QWORD *)(v2 + 8);
if ( !v2 )
goto LABEL_6;
}
result = (char **)v2;
}
else
{
LABEL_6:
v4 = (char **)tl_emalloc(16LL);
v5 = strlen(src);
v6 = (char *)tl_emalloc((unsigned int)(v5 + 1));
*v4 = v6;
strcpy(v6, src);
v7 = symtab[v1];
symtab[v1] = (__int64)v4;
v4[1] = (char *)v7;
result = v4;
}
return result;
}

original_code:
Symbol *
tl_lookup(char *s)
{ Symbol *sp;
 int h = hash(s);
 for (sp = symtab[h]; sp; sp = sp->next)
  if (strcmp(sp->name, s) == 0)
   return sp;
 sp = (Symbol *) tl_emalloc(sizeof(Symbol));
 sp->name = (char *) tl_emalloc(strlen(s) + 1);
 strcpy(sp->name, s);
 sp->next = symtab[h];
 symtab[h] = sp;
 return sp;
}

canonical_original_code:
struct Symbol *tl_lookup(char *s)
{ struct Symbol *sp;
 int h = hash(s);
 for (sp = symtab[h]; sp; sp = sp->next)
  if (strcmp(sp->name, s) == 0)
   return sp;
 sp = (struct Symbol *) tl_emalloc(sizeof(Symbol));
 sp->name = (char *) tl_emalloc(strlen(s) + 1);
 strcpy(sp->name, s);
 sp->next = symtab[h];
 symtab[h] = sp;
 return sp;
}

variable_types: struct Symbol { char *name; struct Symbol *next; } *


decompiled_code:
__int64 tl_lex()
{
int v0; // er12
int v1; // eax
unsigned int v2; // er12
int v4; // eax

do
{
v1 = tl_Getchar();
yytext[1] = 0;
yytext[0] = v1;
if ( v1 <= 0 )
{
v2 = 59;
tl_yylval = tl_nn(59LL, 0LL, 0LL);
return v2;
}
v0 = v1;
}
while ( v1 == 32 );
if ( ((*_ctype_b_loc())[v1] & 0x200) != 0 )
{
getword_constprop_0(v0);
if ( *(_DWORD *)yytext != 1702195828 || yytext[4] )
{
if ( *(_DWORD *)yytext != 1936482662 || *(_WORD *)&yytext[4] != 101 )
{
tl_yylval = tl_nn(265LL, 0LL, 0LL);
*(_QWORD *)(tl_yylval + 8LL) = tl_lookup(yytext);
return 265LL;
}
v2 = 261;
tl_yylval = tl_nn(261LL, 0LL, 0LL);
}
else
{
v2 = 266;
tl_yylval = tl_nn(266LL, 0LL, 0LL);
}
return v2;
}
if ( v0 != 60 )
goto LABEL_8;
v4 = tl_Getchar();
if ( v4 == 62 )
{
v2 = 260;
tl_yylval = tl_nn(260LL, 0LL, 0LL);
return v2;
}
if ( v4 != 45 )
{
tl_UnGetchar();
tl_yyerror("expected '<>' or '<->'");
}
v0 = tl_Getchar();
if ( v0 == 62 )
{
v2 = 259;
tl_yylval = tl_nn(259LL, 0LL, 0LL);
return v2;
}
tl_UnGetchar();
tl_yyerror("expected '<->'");
LABEL_8:
if ( v0 > 92 )
{
if ( v0 == 124 )
v0 = follow(0x7Cu, 0x108u, 0x7Cu);
}
else if ( v0 > 32 )
{
switch ( v0 )
{
case '!':
v0 = 263;
break;
case '&':
v0 = follow(0x26u, 0x102u, 0x26u);
break;
case '-':
v0 = follow(0x3Eu, 0x106u, 0x2Du);
break;
case '/':
v0 = follow(0x5Cu, 0x102u, 0x2Fu);
break;
case 'U':
v0 = 267;
break;
case 'V':
v0 = 268;
break;
case 'X':
v0 = 269;
break;
case '[':
v0 = follow(0x5Du, 0x101u, 0x5Bu);
break;
case '\\':
v0 = follow(0x2Fu, 0x108u, 0x5Cu);
break;
default:
break;
}
}
tl_yylval = tl_nn((unsigned int)v0, 0LL, 0LL);
return (unsigned int)v0;
}

canonical_decompiled_code:
__int64 func5()
{
int v0; // er12
int v1; // eax
unsigned int v2; // er12
int v4; // eax

do
{
v1 = tl_Getchar();
yytext[1] = 0;
yytext[0] = v1;
if ( v1 <= 0 )
{
v2 = 59;
tl_yylval = tl_nn(59LL, 0LL, 0LL);
return v2;
}
v0 = v1;
}
while ( v1 == 32 );
if ( ((*_ctype_b_loc())[v1] & 0x200) != 0 )
{
func2(v0);
if ( *(_DWORD *)yytext != 1702195828 || yytext[4] )
{
if ( *(_DWORD *)yytext != 1936482662 || *(_WORD *)&yytext[4] != 101 )
{
tl_yylval = tl_nn(265LL, 0LL, 0LL);
*(_QWORD *)(tl_yylval + 8LL) = func4(yytext);
return 265LL;
}
v2 = 261;
tl_yylval = tl_nn(261LL, 0LL, 0LL);
}
else
{
v2 = 266;
tl_yylval = tl_nn(266LL, 0LL, 0LL);
}
return v2;
}
if ( v0 != 60 )
goto LABEL_8;
v4 = tl_Getchar();
if ( v4 == 62 )
{
v2 = 260;
tl_yylval = tl_nn(260LL, 0LL, 0LL);
return v2;
}
if ( v4 != 45 )
{
tl_UnGetchar();
tl_yyerror("expected '<>' or '<->'");
}
v0 = tl_Getchar();
if ( v0 == 62 )
{
v2 = 259;
tl_yylval = tl_nn(259LL, 0LL, 0LL);
return v2;
}
tl_UnGetchar();
tl_yyerror("expected '<->'");
LABEL_8:
if ( v0 > 92 )
{
if ( v0 == 124 )
v0 = func1(0x7Cu, 0x108u, 0x7Cu);
}
else if ( v0 > 32 )
{
switch ( v0 )
{
case '!':
v0 = 263;
break;
case '&':
v0 = func1(0x26u, 0x102u, 0x26u);
break;
case '-':
v0 = func1(0x3Eu, 0x106u, 0x2Du);
break;
case '/':
v0 = func1(0x5Cu, 0x102u, 0x2Fu);
break;
case 'U':
v0 = 267;
break;
case 'V':
v0 = 268;
break;
case 'X':
v0 = 269;
break;
case '[':
v0 = func1(0x5Du, 0x101u, 0x5Bu);
break;
case '\\':
v0 = func1(0x2Fu, 0x108u, 0x5Cu);
break;
default:
break;
}
}
tl_yylval = tl_nn((unsigned int)v0, 0LL, 0LL);
return (unsigned int)v0;
}

original_code:
static int
tl_lex(void)
{ int c;
 do {
  c = tl_Getchar();
  yytext[0] = (char ) c;
  yytext[1] = '\0';
  if (c <= 0)
  { tl_yylval = tl_nn(';',(Node *)0,(Node *)0); return ';';
  }
 } while (c == ' ');
 if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short int) _ISlower))
 { getword(c, isalnum_);
  if (strcmp("true", yytext) == 0)
  { tl_yylval = tl_nn(TRUE,(Node *)0,(Node *)0); return TRUE;
  }
  if (strcmp("false", yytext) == 0)
  { tl_yylval = tl_nn(FALSE,(Node *)0,(Node *)0); return FALSE;
  }
  tl_yylval = tl_nn(PREDICATE,(Node *)0,(Node *)0);
  tl_yylval->sym = tl_lookup(yytext);
  return PREDICATE;
 }
 if (c == '<')
 { c = tl_Getchar();
  if (c == '>')
  { tl_yylval = tl_nn(EVENTUALLY,(Node *)0,(Node *)0); return EVENTUALLY;
  }
  if (c != '-')
  { tl_UnGetchar();
   tl_yyerror("expected '<>' or '<->'");
  }
  c = tl_Getchar();
  if (c == '>')
  { tl_yylval = tl_nn(EQUIV,(Node *)0,(Node *)0); return EQUIV;
  }
  tl_UnGetchar();
  tl_yyerror("expected '<->'");
 }
 switch (c) {
 case '/' : c = follow('\\', AND, '/'); break;
 case '\\': c = follow('/', OR, '\\'); break;
 case '&' : c = follow('&', AND, '&'); break;
 case '|' : c = follow('|', OR, '|'); break;
 case '[' : c = follow(']', ALWAYS, '['); break;
 case '-' : c = follow('>', IMPLIES, '-'); break;
 case '!' : c = NOT; break;
 case 'U' : c = U_OPER; break;
 case 'V' : c = V_OPER; break;
 case 'X' : c = NEXT; break;
 default : break;
 }
 tl_yylval = tl_nn(c,(Node *)0,(Node *)0); return c;
}

canonical_original_code:
static int tl_lex()
{ int c;
 do {
  c = tl_Getchar();
  yytext[0] = (char ) c;
  yytext[1] = '\0';
  if (c <= 0)
  { tl_yylval = tl_nn(';',(struct Node *)0,(struct Node *)0); return ';';
  }
 } while (c == ' ');
 if (((*__ctype_b_loc ())[(int) ((c))] & (unsigned short) _ISlower))
 { getword(c, isalnum_);
  if (strcmp("true", yytext) == 0)
  { tl_yylval = tl_nn(TRUE,(struct Node *)0,(struct Node *)0); return TRUE;
  }
  if (strcmp("false", yytext) == 0)
  { tl_yylval = tl_nn(FALSE,(struct Node *)0,(struct Node *)0); return FALSE;
  }
  tl_yylval = tl_nn(PREDICATE,(struct Node *)0,(struct Node *)0);
  tl_yylval->sym = tl_lookup(yytext);
  return PREDICATE;
 }
 if (c == '<')
 { c = tl_Getchar();
  if (c == '>')
  { tl_yylval = tl_nn(EVENTUALLY,(struct Node *)0,(struct Node *)0); return EVENTUALLY;
  }
  if (c != '-')
  { tl_UnGetchar();
   tl_yyerror("expected '<>' or '<->'");
  }
  c = tl_Getchar();
  if (c == '>')
  { tl_yylval = tl_nn(EQUIV,(struct Node *)0,(struct Node *)0); return EQUIV;
  }
  tl_UnGetchar();
  tl_yyerror("expected '<->'");
 }
 switch (c) {
 case '/' : c = follow('\\', AND, '/'); break;
 case '\\': c = follow('/', OR, '\\'); break;
 case '&' : c = follow('&', AND, '&'); break;
 case '|' : c = follow('|', OR, '|'); break;
 case '[' : c = follow(']', ALWAYS, '['); break;
 case '-' : c = follow('>', IMPLIES, '-'); break;
 case '!' : c = NOT; break;
 case 'U' : c = U_OPER; break;
 case 'V' : c = V_OPER; break;
 case 'X' : c = NEXT; break;
 default : break;
 }
 tl_yylval = tl_nn(c,(struct Node *)0,(struct Node *)0); return c;
}

user_defined_types: struct Symbol { char *name; struct Symbol *next; }


decompiled_code:
// attributes: thunk
__int64 tl_yylex()
{
return tl_lex();
}

canonical_decompiled_code:
__int64 func6()
{
return func5();
}

original_code:
int
tl_yylex(void)
{ int c = tl_lex();
 return c;
}

canonical_original_code:
int tl_yylex()
{ int c = tl_lex();
 return c;
}


addcan

original_code:
static void
addcan(int tok, Node *n)
{ Node *m, *prev = (Node *)0;
 Node **ptr;
 Node *N;
 Symbol *s, *t; int cmp;
 if (!n) return;
 if (n->ntyp == tok)
 { addcan(tok, n->rgt);
  addcan(tok, n->lft);
  return;
 }
 N = dupnode(n);
 if (!can)
 { can = N;
  return;
 }
 s = DoDump(N);
 if (can->ntyp != tok)
 { ptr = &can;
  goto insert;
 }
 prev = (Node *)0;
 for (m = can; m->ntyp == tok && m->rgt; prev = m, m = m->rgt)
 { t = DoDump(m->lft);
  cmp = strcmp(s->name, t->name);
  if (cmp == 0)
   return;
  if (cmp < 0)
  { if (!prev)
   { can = tl_nn(tok, N, can);
    return;
   } else
   { ptr = &(prev->rgt);
    goto insert;
 } } }
 ptr = &(prev->rgt);
insert:
 t = DoDump(*ptr);
 cmp = strcmp(s->name, t->name);
 if (cmp == 0)
  return;
 if (cmp < 0)
  *ptr = tl_nn(tok, N, *ptr);
 else
  *ptr = tl_nn(tok, *ptr, N);
}

canonical_original_code:
static void addcan(int tok, struct Node *n)
{ struct Node *m; struct Node *prev = (Node *)0;
 struct Node **ptr;
 struct Node *N;
 struct Symbol *s; struct Symbol *t; int cmp;
 if (!n) return;
 if (n->ntyp == tok)
 { addcan(tok, n->rgt);
  addcan(tok, n->lft);
  return;
 }
 N = dupnode(n);
 if (!can)
 { can = N;
  return;
 }
 s = DoDump(N);
 if (can->ntyp != tok)
 { ptr = &can;
  goto insert;
 }
 prev = (struct Node *)0;
 for (m = can; m->ntyp == tok && m->rgt; prev = m, m = m->rgt)
 { t = DoDump(m->lft);
  cmp = strcmp(s->name, t->name);
  if (cmp == 0)
   return;
  if (cmp < 0)
  { if (!prev)
   { can = tl_nn(tok, N, can);
    return;
   } else
   { ptr = &(prev->rgt);
    goto insert;
 } } }
 ptr = &(prev->rgt);
insert:
 t = DoDump(*ptr);
 cmp = strcmp(s->name, t->name);
 if (cmp == 0)
  return;
 if (cmp < 0)
  *ptr = tl_nn(tok, N, *ptr);
 else
  *ptr = tl_nn(tok, *ptr, N);
}

variable_types: struct Node { short ntyp; struct Symbol { char *name; struct Symbol *next; } *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; } **

variable_types: cmp int


canonical

decompiled_code:
__int64 __fastcall canonical(__int64 a1)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rdi

if ( !a1 )
return 0LL;
result = in_cache();
if ( !result )
{
v3 = canonical(*(_QWORD *)(a1 + 24));
v4 = *(_QWORD *)(a1 + 16);
*(_QWORD *)(a1 + 24) = v3;
*(_QWORD *)(a1 + 16) = canonical(v4);
result = cached(a1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rdi

if ( !a1 )
return 0LL;
result = in_cache();
if ( !result )
{
v3 = func2(*(_QWORD *)(a1 + 24));
v4 = *(_QWORD *)(a1 + 16);
*(_QWORD *)(a1 + 24) = v3;
*(_QWORD *)(a1 + 16) = func2(v4);
result = cached(a1);
}
return result;
}

original_code:
Node *
canonical(Node *n)
{ Node *m;
 if (!n) return n;
 if (m = in_cache(n))
  return m;
 n->rgt = canonical(n->rgt);
 n->lft = canonical(n->lft);
 return cached(n);
}

canonical_original_code:
struct Node *canonical(struct Node *n)
{ struct Node *m;
 if (!n) return n;
 if (m = in_cache(n))
  return m;
 n->rgt = canonical(n->rgt);
 n->lft = canonical(n->lft);
 return cached(n);
}

variable_types:
n
struct Node *

return_type: struct Node { short ntyp; struct Symbol { char *name; struct Symbol *next; } *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; } *


decompiled_code:
__int64 __fastcall push_negation(__int64 a1)
{
__int64 v1; // rbp
__int64 v2; // rsi
__int64 v3; // r8
__int64 v4; // rax
__int64 v5; // rax
_WORD *v6; // rdi
__int16 *v7; // rax
__int64 v9; // rbx

v1 = a1;
if ( *(_WORD *)a1 != 263 )
{
tl_explain();
Fatal(": assertion failed\n", 0LL);
}
v2 = *(_QWORD *)(a1 + 16);
switch ( *(_WORD *)v2 )
{
case 0x102:
*(_WORD *)a1 = 264;
goto LABEL_5;
case 0x105:
releasenode(0LL, v2);
*(_QWORD *)(a1 + 16) = 0LL;
*(_WORD *)a1 = 266;
break;
case 0x107:
v9 = *(_QWORD *)(v2 + 16);
releasenode(0LL, v2);
*(_QWORD *)(a1 + 16) = 0LL;
v1 = v9;
releasenode(0LL, a1);
break;
case 0x108:
*(_WORD *)a1 = 258;
goto LABEL_5;
case 0x10A:
releasenode(0LL, v2);
*(_QWORD *)(a1 + 16) = 0LL;
*(_WORD *)a1 = 261;
break;
case 0x10B:
*(_WORD *)a1 = 268;
goto LABEL_5;
case 0x10C:
*(_WORD *)a1 = 267;
LABEL_5:
v3 = *(_QWORD *)(v2 + 24);
*(_QWORD *)(v2 + 24) = 0LL;
v4 = tl_nn(263LL, v3, 0LL);
v5 = push_negation(v4);
v6 = *(_WORD **)(a1 + 16);
*(_QWORD *)(v1 + 24) = v5;
*v6 = 263;
*(_QWORD *)(v1 + 16) = push_negation(v6);
break;
case 0x10D:
*(_WORD *)a1 = 269;
*(_WORD *)v2 = 263;
*(_QWORD *)(a1 + 16) = push_negation(v2);
break;
default:
break;
}
v7 = right_linked((__int16 *)v1);
return canonical((__int64)v7);
}

original_code:
Node *
push_negation(Node *n)
{ Node *m;
 { if (!(n->ntyp == NOT)) { tl_explain(n->ntyp); Fatal(": assertion failed\n",(char *)0); } };
 switch (n->lft->ntyp) {
 case TRUE:
  releasenode(0, n->lft);
  n->lft = (Node *)0;
  n->ntyp = FALSE;
  break;
 case FALSE:
  releasenode(0, n->lft);
  n->lft = (Node *)0;
  n->ntyp = TRUE;
  break;
 case NOT:
  m = n->lft->lft;
  releasenode(0, n->lft);
  n->lft = (Node *)0;
  releasenode(0, n);
  n = m;
  break;
 case V_OPER:
  n->ntyp = U_OPER;
  goto same;
 case U_OPER:
  n->ntyp = V_OPER;
  goto same;
 case NEXT:
  n->ntyp = NEXT;
  n->lft->ntyp = NOT;
  n->lft = push_negation(n->lft);
  break;
 case AND:
  n->ntyp = OR;
  goto same;
 case OR:
  n->ntyp = AND;
same: m = n->lft->rgt;
  n->lft->rgt = (Node *)0;
  n->rgt = push_negation(tl_nn(NOT, m, (Node *)0));
  n->lft->ntyp = NOT;
  m = n->lft;
  n->lft = push_negation(m);
  break;
 }
 return canonical(right_linked(n));
}

canonical_original_code:
struct Node *push_negation(struct Node *n)
{ struct Node *m;
 { if (!(n->ntyp == NOT)) { tl_explain(n->ntyp); Fatal(": assertion failed\n",(char *)0); } };
 switch (n->lft->ntyp) {
 case TRUE:
  releasenode(0, n->lft);
  n->lft = (struct Node *)0;
  n->ntyp = FALSE;
  break;
 case FALSE:
  releasenode(0, n->lft);
  n->lft = (struct Node *)0;
  n->ntyp = TRUE;
  break;
 case NOT:
  m = n->lft->lft;
  releasenode(0, n->lft);
  n->lft = (struct Node *)0;
  releasenode(0, n);
  n = m;
  break;
 case V_OPER:
  n->ntyp = U_OPER;
  goto same;
 case U_OPER:
  n->ntyp = V_OPER;
  goto same;
 case NEXT:
  n->ntyp = NEXT;
  n->lft->ntyp = NOT;
  n->lft = push_negation(n->lft);
  break;
 case AND:
  n->ntyp = OR;
  goto same;
 case OR:
  n->ntyp = AND;
same: m = n->lft->rgt;
  n->lft->rgt = (struct Node *)0;
  n->rgt = push_negation(tl_nn(NOT, m, (struct Node *)0));
  n->lft->ntyp = NOT;
  m = n->lft;
  n->lft = push_negation(m);
  break;
 }
 return canonical(right_linked(n));
}


Canonical

original_code:
Node *
Canonical(Node *n)
{ Node *m, *p, *k1, *k2, *prev, *dflt = (Node *)0;
 int tok;
 if (!n) return n;
 tok = n->ntyp;
 if (tok != AND && tok != OR)
  return n;
 can = (Node *)0;
 addcan(tok, n);
 { if (0) printf("\nA0: "); }; { if (0) dump(can); };
 { if (0) printf("\nA1: "); }; { if (0) dump(n); }; { if (0) printf("\n"); };
 releasenode(1, n);
 if (tok == AND)
 { for (m = can; m; m = (m->ntyp == AND) ? m->rgt : (Node *)0)
  { k1 = (m->ntyp == AND) ? m->lft : m;
   if (k1->ntyp == TRUE)
   { marknode(AND, m);
    dflt = tl_nn(TRUE, (Node *)0, (Node *)0);
    continue;
   }
   if (k1->ntyp == FALSE)
   { releasenode(1, can);
    can = tl_nn(FALSE, (Node *)0, (Node *)0);
    goto out;
  } }
  for (m = can; m; m = (m->ntyp == AND) ? m->rgt : (Node *)0)
  for (p = can; p; p = (p->ntyp == AND) ? p->rgt : (Node *)0)
  { if (p == m
   || p->ntyp == -1
   || m->ntyp == -1)
    continue;
   k1 = (m->ntyp == AND) ? m->lft : m;
   k2 = (p->ntyp == AND) ? p->lft : p;
   if (isequal(k1, k2))
   { marknode(AND, p);
    continue;
   }
   if (anywhere(OR, k1, k2))
   { marknode(AND, p);
    continue;
   }
   if (k2->ntyp == U_OPER
   && anywhere(AND, k2->rgt, can))
   { marknode(AND, p);
    continue;
   }
 } }
 if (tok == OR)
 { for (m = can; m; m = (m->ntyp == OR) ? m->rgt : (Node *)0)
  { k1 = (m->ntyp == OR) ? m->lft : m;
   if (k1->ntyp == FALSE)
   { marknode(OR, m);
    dflt = tl_nn(FALSE, (Node *)0, (Node *)0);
    continue;
   }
   if (k1->ntyp == TRUE)
   { releasenode(1, can);
    can = tl_nn(TRUE, (Node *)0, (Node *)0);
    goto out;
  } }
  for (m = can; m; m = (m->ntyp == OR) ? m->rgt : (Node *)0)
  for (p = can; p; p = (p->ntyp == OR) ? p->rgt : (Node *)0)
  { if (p == m
   || p->ntyp == -1
   || m->ntyp == -1)
    continue;
   k1 = (m->ntyp == OR) ? m->lft : m;
   k2 = (p->ntyp == OR) ? p->lft : p;
   if (isequal(k1, k2))
   { marknode(OR, p);
    continue;
   }
   if (anywhere(AND, k1, k2))
   { marknode(OR, p);
    continue;
   }
   if (k2->ntyp == V_OPER
   && k2->lft->ntyp == FALSE
   && anywhere(AND, k2->rgt, can))
   { marknode(OR, p);
    continue;
   }
 } }
 for (m = can, prev = (Node *)0; m; )
 { if (m->ntyp == -1)
  { k2 = m->rgt;
   releasenode(0, m);
   if (!prev)
   { m = can = can->rgt;
   } else
   { m = prev->rgt = k2;
    if (!prev->rgt && prev->lft
    && (prev->ntyp == AND || prev->ntyp == OR))
    { k1 = prev->lft;
     prev->ntyp = prev->lft->ntyp;
     prev->sym = prev->lft->sym;
     prev->rgt = prev->lft->rgt;
     prev->lft = prev->lft->lft;
     releasenode(0, k1);
    }
   }
   continue;
  }
  prev = m;
  m = m->rgt;
 }
out:
 { if (0) printf("A2: "); }; { if (0) dump(can); }; { if (0) printf("\n"); };
 if (!can)
 { if (!dflt)
   fatal("cannot happen, Canonical", (char *) 0);
  return dflt;
 }
 return can;
}

canonical_original_code:
struct Node *Canonical(struct Node *n)
{ struct Node *m; struct Node *p; struct Node *k1; struct Node *k2; struct Node *prev; struct Node *dflt = (Node *)0;
 int tok;
 if (!n) return n;
 tok = n->ntyp;
 if (tok != AND && tok != OR)
  return n;
 can = (struct Node *)0;
 addcan(tok, n);
 { if (0) printf("\nA0: "); }; { if (0) dump(can); };
 { if (0) printf("\nA1: "); }; { if (0) dump(n); }; { if (0) printf("\n"); };
 releasenode(1, n);
 if (tok == AND)
 { for (m = can; m; m = (m->ntyp == AND) ? m->rgt : (struct Node *)0)
  { k1 = (m->ntyp == AND) ? m->lft : m;
   if (k1->ntyp == TRUE)
   { marknode(AND, m);
    dflt = tl_nn(TRUE, (struct Node *)0, (struct Node *)0);
    continue;
   }
   if (k1->ntyp == FALSE)
   { releasenode(1, can);
    can = tl_nn(FALSE, (struct Node *)0, (struct Node *)0);
    goto out;
  } }
  for (m = can; m; m = (m->ntyp == AND) ? m->rgt : (struct Node *)0)
  for (p = can; p; p = (p->ntyp == AND) ? p->rgt : (struct Node *)0)
  { if (p == m
   || p->ntyp == -1
   || m->ntyp == -1)
    continue;
   k1 = (m->ntyp == AND) ? m->lft : m;
   k2 = (p->ntyp == AND) ? p->lft : p;
   if (isequal(k1, k2))
   { marknode(AND, p);
    continue;
   }
   if (anywhere(OR, k1, k2))
   { marknode(AND, p);
    continue;
   }
   if (k2->ntyp == U_OPER
   && anywhere(AND, k2->rgt, can))
   { marknode(AND, p);
    continue;
   }
 } }
 if (tok == OR)
 { for (m = can; m; m = (m->ntyp == OR) ? m->rgt : (struct Node *)0)
  { k1 = (m->ntyp == OR) ? m->lft : m;
   if (k1->ntyp == FALSE)
   { marknode(OR, m);
    dflt = tl_nn(FALSE, (struct Node *)0, (struct Node *)0);
    continue;
   }
   if (k1->ntyp == TRUE)
   { releasenode(1, can);
    can = tl_nn(TRUE, (struct Node *)0, (struct Node *)0);
    goto out;
  } }
  for (m = can; m; m = (m->ntyp == OR) ? m->rgt : (struct Node *)0)
  for (p = can; p; p = (p->ntyp == OR) ? p->rgt : (struct Node *)0)
  { if (p == m
   || p->ntyp == -1
   || m->ntyp == -1)
    continue;
   k1 = (m->ntyp == OR) ? m->lft : m;
   k2 = (p->ntyp == OR) ? p->lft : p;
   if (isequal(k1, k2))
   { marknode(OR, p);
    continue;
   }
   if (anywhere(AND, k1, k2))
   { marknode(OR, p);
    continue;
   }
   if (k2->ntyp == V_OPER
   && k2->lft->ntyp == FALSE
   && anywhere(AND, k2->rgt, can))
   { marknode(OR, p);
    continue;
   }
 } }
 for (m = can, prev = (struct Node *)0; m; )
 { if (m->ntyp == -1)
  { k2 = m->rgt;
   releasenode(0, m);
   if (!prev)
   { m = can = can->rgt;
   } else
   { m = prev->rgt = k2;
    if (!prev->rgt && prev->lft
    && (prev->ntyp == AND || prev->ntyp == OR))
    { k1 = prev->lft;
     prev->ntyp = prev->lft->ntyp;
     prev->sym = prev->lft->sym;
     prev->rgt = prev->lft->rgt;
     prev->lft = prev->lft->lft;
     releasenode(0, k1);
    }
   }
   continue;
  }
  prev = m;
  m = m->rgt;
 }
out:
 { if (0) printf("A2: "); }; { if (0) dump(can); }; { if (0) printf("\n"); };
 if (!can)
 { if (!dflt)
   fatal("cannot happen, Canonical", (char *) 0);
  return dflt;
 }
 return can;
}


sdump

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

while ( 1 )
{
switch ( *(_WORD *)a1 )
{
case 0x102:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 38;
goto LABEL_6;
case 0x105:
result = strlen(dumpbuf);
*(_WORD *)&dumpbuf[result] = 70;
return result;
case 0x107:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 33;
break;
case 0x108:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 124;
goto LABEL_6;
case 0x109:
return (size_t)strcat(dumpbuf, **(const char ***)(a1 + 8));
case 0x10A:
result = strlen(dumpbuf);
*(_WORD *)&dumpbuf[result] = 84;
return result;
case 0x10B:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 85;
goto LABEL_6;
case 0x10C:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 86;
LABEL_6:
sdump(*(_QWORD *)(a1 + 24));
break;
case 0x10D:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 88;
break;
default:
result = strlen(dumpbuf);
*(_WORD *)&dumpbuf[result] = 63;
return result;
}
a1 = *(_QWORD *)(a1 + 16);
}
}

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

while ( 1 )
{
switch ( *(_WORD *)a1 )
{
case 0x102:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 38;
goto LABEL_6;
case 0x105:
result = strlen(dumpbuf);
*(_WORD *)&dumpbuf[result] = 70;
return result;
case 0x107:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 33;
break;
case 0x108:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 124;
goto LABEL_6;
case 0x109:
return (size_t)strcat(dumpbuf, **(const char ***)(a1 + 8));
case 0x10A:
result = strlen(dumpbuf);
*(_WORD *)&dumpbuf[result] = 84;
return result;
case 0x10B:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 85;
goto LABEL_6;
case 0x10C:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 86;
LABEL_6:
func0(*(_QWORD *)(a1 + 24));
break;
case 0x10D:
*(_WORD *)&dumpbuf[strlen(dumpbuf)] = 88;
break;
default:
result = strlen(dumpbuf);
*(_WORD *)&dumpbuf[result] = 63;
return result;
}
a1 = *(_QWORD *)(a1 + 16);
}
}

original_code:
static void
sdump(Node *n)
{
 switch (n->ntyp) {
 case PREDICATE: strcat(dumpbuf, n->sym->name);
   break;
 case U_OPER: strcat(dumpbuf, "U");
   goto common2;
 case V_OPER: strcat(dumpbuf, "V");
   goto common2;
 case OR: strcat(dumpbuf, "|");
   goto common2;
 case AND: strcat(dumpbuf, "&");
common2: sdump(n->rgt);
common1: sdump(n->lft);
   break;
 case NEXT: strcat(dumpbuf, "X");
   goto common1;
 case NOT: strcat(dumpbuf, "!");
   goto common1;
 case TRUE: strcat(dumpbuf, "T");
   break;
 case FALSE: strcat(dumpbuf, "F");
   break;
 default: strcat(dumpbuf, "?");
   break;
 }
}

canonical_original_code:
static void sdump(struct Node *n)
{
 switch (n->ntyp) {
 case PREDICATE: strcat(dumpbuf, n->sym->name);
   break;
 case U_OPER: strcat(dumpbuf, "U");
   goto common2;
 case V_OPER: strcat(dumpbuf, "V");
   goto common2;
 case OR: strcat(dumpbuf, "|");
   goto common2;
 case AND: strcat(dumpbuf, "&");
common2: sdump(n->rgt);
common1: sdump(n->lft);
   break;
 case NEXT: strcat(dumpbuf, "X");
   goto common1;
 case NOT: strcat(dumpbuf, "!");
   goto common1;
 case TRUE: strcat(dumpbuf, "T");
   break;
 case FALSE: strcat(dumpbuf, "F");
   break;
 default: strcat(dumpbuf, "?");
   break;
 }
}


decompiled_code:
__int64 __fastcall only_nxt(__int16 *a1)
{
__int16 v1; // dx
__int64 result; // rax

v1 = *a1;
if ( *a1 == 264 || (result = 1LL, v1 != 269) && (result = 0LL, v1 == 258) )
{
result = only_nxt(*((_QWORD *)a1 + 3));
if ( (_DWORD)result )
result = (unsigned int)only_nxt(*((_QWORD *)a1 + 2)) != 0;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int16 *a1)
{
__int16 v1; // dx
__int64 result; // rax

v1 = *a1;
if ( *a1 == 264 || (result = 1LL, v1 != 269) && (result = 0LL, v1 == 258) )
{
result = func1(*((_QWORD *)a1 + 3));
if ( (_DWORD)result )
result = (unsigned int)func1(*((_QWORD *)a1 + 2)) != 0;
}
return result;
}

original_code:
int
only_nxt(Node *n)
{
        switch (n->ntyp) {
        case NEXT:
                return 1;
        case OR:
        case AND:
                return only_nxt(n->rgt) && only_nxt(n->lft);
        default:
                return 0;
        }
}

canonical_original_code:
int only_nxt(struct Node *n)
{
        switch (n->ntyp) {
        case NEXT:
                return 1;
        case OR:
        case AND:
                return only_nxt(n->rgt) && only_nxt(n->lft);
        default:
                return 0;
        }
}


decompiled_code:
__int64 __fastcall dump_cond(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rbp
__int16 v7; // ax

if ( !a1 )
return a3;
while ( 1 )
{
v4 = dupnode();
v5 = right_linked(v4);
v6 = canonical(v5);
v7 = *(_WORD *)v6;
if ( (*(_WORD *)v6 & 0xFFFD) == 261 || v7 == 265 )
{
if ( !a3 )
fwrite(" && ", 1uLL, 4uLL, tl_out);
dump(v6);
return 0LL;
}
if ( v7 == 264 )
break;
if ( v7 == 268 )
{
if ( !(unsigned int)anywhere(258LL, *(_QWORD *)(v6 + 24), a2) )
goto LABEL_5;
if ( *(_WORD *)v6 != 258 )
return a3;
}
else if ( v7 != 258 )
{
return a3;
}
a3 = dump_cond(*(_QWORD *)(v6 + 16), a2, a3);
LABEL_5:
if ( !*(_QWORD *)(v6 + 24) )
return a3;
}
if ( !a3 )
fwrite(" && ", 1uLL, 4uLL, tl_out);
fwrite("((", 1uLL, 2uLL, tl_out);
if ( (unsigned int)dump_cond(*(_QWORD *)(v6 + 16), a2, 1LL) )
{
if ( (unsigned int)only_nxt(*(__int16 **)(v6 + 16)) )
{
fwrite("1))", 1uLL, 3uLL, tl_out);
return 0LL;
}
}
else
{
fwrite(") || (", 1uLL, 6uLL, tl_out);
}
if ( (unsigned int)dump_cond(*(_QWORD *)(v6 + 24), a2, 1LL) )
{
if ( (unsigned int)only_nxt(*(__int16 **)(v6 + 24)) )
fputc(49, tl_out);
else
fputc(48, tl_out);
}
fwrite("))", 1uLL, 2uLL, tl_out);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rbp
__int16 v7; // ax

if ( !a1 )
return a3;
while ( 1 )
{
v4 = dupnode();
v5 = right_linked(v4);
v6 = canonical(v5);
v7 = *(_WORD *)v6;
if ( (*(_WORD *)v6 & 0xFFFD) == 261 || v7 == 265 )
{
if ( !a3 )
fwrite(" && ", 1uLL, 4uLL, tl_out);
dump(v6);
return 0LL;
}
if ( v7 == 264 )
break;
if ( v7 == 268 )
{
if ( !(unsigned int)anywhere(258LL, *(_QWORD *)(v6 + 24), a2) )
goto LABEL_5;
if ( *(_WORD *)v6 != 258 )
return a3;
}
else if ( v7 != 258 )
{
return a3;
}
a3 = func2(*(_QWORD *)(v6 + 16), a2, a3);
LABEL_5:
if ( !*(_QWORD *)(v6 + 24) )
return a3;
}
if ( !a3 )
fwrite(" && ", 1uLL, 4uLL, tl_out);
fwrite("((", 1uLL, 2uLL, tl_out);
if ( (unsigned int)func2(*(_QWORD *)(v6 + 16), a2, 1LL) )
{
if ( (unsigned int)func1(*(__int16 **)(v6 + 16)) )
{
fwrite("1))", 1uLL, 3uLL, tl_out);
return 0LL;
}
}
else
{
fwrite(") || (", 1uLL, 6uLL, tl_out);
}
if ( (unsigned int)func2(*(_QWORD *)(v6 + 24), a2, 1LL) )
{
if ( (unsigned int)func1(*(__int16 **)(v6 + 24)) )
fputc(49, tl_out);
else
fputc(48, tl_out);
}
fwrite("))", 1uLL, 2uLL, tl_out);
return 0LL;
}

original_code:
int
dump_cond(Node *pp, Node *r, int first)
{ Node *q;
        int frst = first;
        if (!pp) return frst;
        q = dupnode(pp);
        q = canonical(right_linked(q));
        if (q->ntyp == PREDICATE
        || q->ntyp == NOT
        || q->ntyp == FALSE)
        { if (!frst) fprintf(tl_out, " && ");
                dump(q);
                frst = 0;
        } else if (q->ntyp == OR)
        { if (!frst) fprintf(tl_out, " && ");
                fprintf(tl_out, "((");
                frst = dump_cond(q->lft, r, 1);
                if (!frst)
                        fprintf(tl_out, ") || (");
                else
                { if (only_nxt(q->lft))
                        { fprintf(tl_out, "1))");
                                return 0;
                        }
                }
                frst = dump_cond(q->rgt, r, 1);
                if (frst)
                { if (only_nxt(q->rgt))
                                fprintf(tl_out, "1");
                        else
                                fprintf(tl_out, "0");
                        frst = 0;
                }
                fprintf(tl_out, "))");
        } else if (q->ntyp == V_OPER
                && !anywhere(AND, q->rgt, r))
        { frst = dump_cond(q->rgt, r, frst);
        } else if (q->ntyp == AND)
        {
                frst = dump_cond(q->lft, r, frst);
                frst = dump_cond(q->rgt, r, frst);
        }
        return frst;
}

canonical_original_code:
int dump_cond(struct Node *pp, struct Node *r, int first)
{ struct Node *q;
        int frst = first;
        if (!pp) return frst;
        q = dupnode(pp);
        q = canonical(right_linked(q));
        if (q->ntyp == PREDICATE
        || q->ntyp == NOT
        || q->ntyp == FALSE)
        { if (!frst) fprintf(tl_out, " && ");
                dump(q);
                frst = 0;
        } else if (q->ntyp == OR)
        { if (!frst) fprintf(tl_out, " && ");
                fprintf(tl_out, "((");
                frst = dump_cond(q->lft, r, 1);
                if (!frst)
                        fprintf(tl_out, ") || (");
                else
                { if (only_nxt(q->lft))
                        { fprintf(tl_out, "1))");
                                return 0;
                        }
                }
                frst = dump_cond(q->rgt, r, 1);
                if (frst)
                { if (only_nxt(q->rgt))
                                fprintf(tl_out, "1");
                        else
                                fprintf(tl_out, "0");
                        frst = 0;
                }
                fprintf(tl_out, "))");
        } else if (q->ntyp == V_OPER
                && !anywhere(AND, q->rgt, r))
        { frst = dump_cond(q->rgt, r, frst);
        } else if (q->ntyp == AND)
        {
                frst = dump_cond(q->lft, r, frst);
                frst = dump_cond(q->rgt, r, frst);
        }
        return frst;
}

variable_types:
r
struct Node *

variable_types: first int

variable_types: frst int


DoDump

decompiled_code:
__int64 __fastcall DoDump(__int64 a1)
{
if ( !a1 )
return 0LL;
if ( *(_WORD *)a1 == 265 )
return *(_QWORD *)(a1 + 8);
dumpbuf[0] = 0;
sdump(a1);
return tl_lookup(dumpbuf);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
if ( !a1 )
return 0LL;
if ( *(_WORD *)a1 == 265 )
return *(_QWORD *)(a1 + 8);
dumpbuf[0] = 0;
func0(a1);
return tl_lookup(dumpbuf);
}

original_code:
Symbol *
DoDump(Node *n)
{
 if (!n) return (Symbol *)0;
 if (n->ntyp == PREDICATE)
  return n->sym;
 dumpbuf[0] = '\0';
 sdump(n);
 return tl_lookup(dumpbuf);
}

canonical_original_code:
struct Symbol *DoDump(struct Node *n)
{
 if (!n) return (struct Symbol *)0;
 if (n->ntyp == PREDICATE)
  return n->sym;
 dumpbuf[0] = '\0';
 sdump(n);
 return tl_lookup(dumpbuf);
}

variable_types: struct Node { short ntyp; struct Symbol *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; } *

return_type: struct Symbol { char *name; struct Symbol *next; } *


trans

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

if ( a1 )
{
if ( !tl_errs )
{
if ( !(tl_terse | tl_verbose)
|| (fwrite("\t/* Normlzd: ", 1uLL, 0xDuLL, tl_out),
dump(a1),
fwrite(" */\n", 1uLL, 4uLL, tl_out),
result = tl_terse,
!tl_terse) )
{
mk_alternating(a1);
mk_generalized();
result = mk_buchi();
}
}
}
return result;
}

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

if ( a1 )
{
if ( !tl_errs )
{
if ( !(tl_terse | tl_verbose)
|| (fwrite("\t/* Normlzd: ", 1uLL, 0xDuLL, tl_out),
dump(a1),
fwrite(" */\n", 1uLL, 4uLL, tl_out),
result = tl_terse,
!tl_terse) )
{
mk_alternating(a1);
mk_generalized();
result = mk_buchi();
}
}
}
return result;
}

original_code:
void trans(Node *p)
{
  if (!p || tl_errs) return;
  if (tl_verbose || tl_terse) {
    fprintf(tl_out, "\t/* Normlzd: ");
    dump(p);
    fprintf(tl_out, " */\n");
  }
  if (tl_terse)
    return;
  mk_alternating(p);
  mk_generalized();
  mk_buchi();
}

canonical_original_code:
void trans(struct Node *p)
{
  if (!p || tl_errs) return;
  if (tl_verbose || tl_terse) {
    fprintf(tl_out, "\t/* Normlzd: ");
    dump(p);
    fprintf(tl_out, " */\n");
  }
  if (tl_terse)
    return;
  mk_alternating(p);
  mk_generalized();
  mk_buchi();
}

variable_types: struct Node { short ntyp; struct Symbol { char *name; struct Symbol *next; } *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; } *


tfree

decompiled_code:
__int64 __fastcall tfree(__int64 a1)
{
__int64 v1; // rax
__int64 result; // rax
__int64 v3; // rdx

v1 = *(_QWORD *)(a1 - 8);
if ( (v1 & 0xFF000000) != 1426063360 )
{
Fatal("releasing a free block", 0LL);
v1 = *(_QWORD *)(a1 - 8);
}
result = v1 & 0xFFFFFF;
*(_QWORD *)(a1 - 8) = result;
if ( result <= 79 )
{
v3 = freelist[result];
++qword_B20[result];
*(_QWORD *)(a1 - 8) = v3;
freelist[result] = a1 - 8;
}
else
{
++qword_B20[0];
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
__int64 v1; // rax
__int64 result; // rax
__int64 v3; // rdx

v1 = *(_QWORD *)(a1 - 8);
if ( (v1 & 0xFF000000) != 1426063360 )
{
Fatal("releasing a free block", 0LL);
v1 = *(_QWORD *)(a1 - 8);
}
result = v1 & 0xFFFFFF;
*(_QWORD *)(a1 - 8) = result;
if ( result <= 79 )
{
v3 = freelist[result];
++qword_B20[result];
*(_QWORD *)(a1 - 8) = v3;
freelist[result] = a1 - 8;
}
else
{
++qword_B20[0];
}
return result;
}

original_code:
void
tfree(void *v)
{ union M *m = (union M *) v;
 long u;
 --m;
 if ((m->size&0xFF000000) != 0x55000000)
  Fatal("releasing a free block", (char *)0);
 u = (m->size &= 0xFFFFFF);
 if (u >= 80)
 { event[2][(int) 0] += (long) 1;;
 } else
 { event[2][(int) u] += (long) 1;;
  m->link = freelist[u];
  freelist[u] = m;
 }
}

variable_types:
v
void *

variable_types:
m
union M { long size; union M *link; } *

variable_types: u long


decompiled_code:
_QWORD *emalloc_atrans()
{
__int64 v0; // r12
__int64 v1; // rax
_QWORD *result; // rax
_QWORD *v3; // r12

v0 = atrans_list;
if ( atrans_list )
{
v1 = *(_QWORD *)(atrans_list + 24);
++aallocs;
*(_QWORD *)(atrans_list + 24) = 0LL;
atrans_list = v1;
result = (_QWORD *)v0;
}
else
{
v3 = tl_emalloc(40);
v3[1] = new_set(1LL);
v3[2] = new_set(1LL);
*v3 = new_set(0LL);
result = v3;
++apool;
++aallocs;
}
return result;
}

canonical_decompiled_code:
_QWORD *func2()
{
__int64 v0; // r12
__int64 v1; // rax
_QWORD *result; // rax
_QWORD *v3; // r12

v0 = atrans_list;
if ( atrans_list )
{
v1 = *(_QWORD *)(atrans_list + 24);
++aallocs;
*(_QWORD *)(atrans_list + 24) = 0LL;
atrans_list = v1;
result = (_QWORD *)v0;
}
else
{
v3 = func0(40);
v3[1] = new_set(1LL);
v3[2] = new_set(1LL);
*v3 = new_set(0LL);
result = v3;
++apool;
++aallocs;
}
return result;
}

original_code:
ATrans* emalloc_atrans() {
  ATrans *result;
  if(!atrans_list) {
    result = (ATrans *)tl_emalloc(sizeof(GTrans));
    result->pos = new_set(1);
    result->neg = new_set(1);
    result->to = new_set(0);
    apool++;
  }
  else {
    result = atrans_list;
    atrans_list = atrans_list->nxt;
    result->nxt = (ATrans *)0;
  }
  aallocs++;
  return result;
}

canonical_original_code:
struct ATrans *emalloc_atrans() {
  struct ATrans *result;
  if(!atrans_list) {
    result = (struct ATrans *)tl_emalloc(sizeof(GTrans));
    result->pos = new_set(1);
    result->neg = new_set(1);
    result->to = new_set(0);
    apool++;
  }
  else {
    result = atrans_list;
    atrans_list = atrans_list->nxt;
    result->nxt = (struct ATrans *)0;
  }
  aallocs++;
  return result;
}

variable_types: struct ATrans { int *to; int *pos; int *neg; struct ATrans *nxt; } *


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

if ( a1 )
{
if ( a2 )
free_atrans(*(_QWORD *)(a1 + 24));
result = atrans_list;
++afrees;
atrans_list = a1;
*(_QWORD *)(a1 + 24) = result;
}
return result;
}

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

if ( a1 )
{
if ( a2 )
func3(*(_QWORD *)(a1 + 24));
result = atrans_list;
++afrees;
atrans_list = a1;
*(_QWORD *)(a1 + 24) = result;
}
return result;
}

original_code:
void free_atrans(ATrans *t, int rec) {
  if(!t) return;
  if(rec) free_atrans(t->nxt, rec);
  t->nxt = atrans_list;
  atrans_list = t;
  afrees++;
}

canonical_original_code:
void free_atrans(struct ATrans *t, int rec) {
  if(!t) return;
  if(rec) free_atrans(t->nxt, rec);
  t->nxt = atrans_list;
  atrans_list = t;
  afrees++;
}

variable_types: rec int

user_defined_types: struct ATrans { int *to; int *pos; int *neg; struct ATrans *nxt; }


decompiled_code:
__int64 free_all_atrans()
{
__int64 *i; // rbp
__int64 v1; // rdi
__int64 result; // rax

for ( i = (__int64 *)atrans_list; atrans_list; i = (__int64 *)atrans_list )
{
v1 = *i;
atrans_list = i[3];
tfree(v1);
tfree(i[1]);
tfree(i[2]);
result = tfree((__int64)i);
}
return result;
}

canonical_decompiled_code:
__int64 func4()
{
__int64 *i; // rbp
__int64 v1; // rdi
__int64 result; // rax

for ( i = (__int64 *)atrans_list; atrans_list; i = (__int64 *)atrans_list )
{
v1 = *i;
atrans_list = i[3];
func1(v1);
func1(i[1]);
func1(i[2]);
result = func1((__int64)i);
}
return result;
}

original_code:
void free_all_atrans() {
  ATrans *t;
  while(atrans_list) {
    t = atrans_list;
    atrans_list = t->nxt;
    tfree(t->to);
    tfree(t->pos);
    tfree(t->neg);
    tfree(t);
  }
}

canonical_original_code:
void free_all_atrans() {
  struct ATrans *t;
  while(atrans_list) {
    t = atrans_list;
    atrans_list = t->nxt;
    tfree(t->to);
    tfree(t->pos);
    tfree(t->neg);
    tfree(t);
  }
}


decompiled_code:
_QWORD *emalloc_gtrans()
{
__int64 v0; // r12
__int64 v1; // rax
_QWORD *result; // rax
_QWORD *v3; // r12
__int64 v4; // rax

v0 = gtrans_list;
if ( gtrans_list )
{
v1 = *(_QWORD *)(gtrans_list + 32);
++gallocs;
gtrans_list = v1;
result = (_QWORD *)v0;
}
else
{
v3 = tl_emalloc(40);
*v3 = new_set(1LL);
v3[1] = new_set(1LL);
v4 = new_set(0LL);
++gpool;
v3[3] = v4;
result = v3;
++gallocs;
}
return result;
}

canonical_decompiled_code:
_QWORD *func5()
{
__int64 v0; // r12
__int64 v1; // rax
_QWORD *result; // rax
_QWORD *v3; // r12
__int64 v4; // rax

v0 = gtrans_list;
if ( gtrans_list )
{
v1 = *(_QWORD *)(gtrans_list + 32);
++gallocs;
gtrans_list = v1;
result = (_QWORD *)v0;
}
else
{
v3 = func0(40);
*v3 = new_set(1LL);
v3[1] = new_set(1LL);
v4 = new_set(0LL);
++gpool;
v3[3] = v4;
result = v3;
++gallocs;
}
return result;
}

original_code:
GTrans* emalloc_gtrans() {
  GTrans *result;
  if(!gtrans_list) {
    result = (GTrans *)tl_emalloc(sizeof(GTrans));
    result->pos = new_set(1);
    result->neg = new_set(1);
    result->final = new_set(0);
    gpool++;
  }
  else {
    result = gtrans_list;
    gtrans_list = gtrans_list->nxt;
  }
  gallocs++;
  return result;
}

canonical_original_code:
struct GTrans *emalloc_gtrans() {
  struct GTrans *result;
  if(!gtrans_list) {
    result = (struct GTrans *)tl_emalloc(sizeof(GTrans));
    result->pos = new_set(1);
    result->neg = new_set(1);
    result->final = new_set(0);
    gpool++;
  }
  else {
    result = gtrans_list;
    gtrans_list = gtrans_list->nxt;
  }
  gallocs++;
  return result;
}

variable_types: struct GTrans { int *pos; int *neg; struct GState { int id; int incoming; int *nodes_set; struct GTrans *trans; struct GState *nxt; struct GState *prv; } *to; int *final; struct GTrans *nxt; } *

user_defined_types: struct GTrans { int *pos; int *neg; struct GState *to; int *final; struct GTrans *nxt; }


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

++gfrees;
if ( a2 )
{
if ( a2 != a1 )
{
free_gtrans(*(_QWORD *)(a1 + 32));
if ( a3 )
--*(_DWORD *)(*(_QWORD *)(a1 + 16) + 4LL);
}
}
result = gtrans_list;
gtrans_list = a1;
*(_QWORD *)(a1 + 32) = result;
return result;
}

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

++gfrees;
if ( a2 )
{
if ( a2 != a1 )
{
func6(*(_QWORD *)(a1 + 32));
if ( a3 )
--*(_DWORD *)(*(_QWORD *)(a1 + 16) + 4LL);
}
}
result = gtrans_list;
gtrans_list = a1;
*(_QWORD *)(a1 + 32) = result;
return result;
}

original_code:
void free_gtrans(GTrans *t, GTrans *sentinel, int fly) {
  gfrees++;
  if(sentinel && (t != sentinel)) {
    free_gtrans(t->nxt, sentinel, fly);
    if(fly) t->to->incoming--;
  }
  t->nxt = gtrans_list;
  gtrans_list = t;
}

canonical_original_code:
void free_gtrans(struct GTrans *t, struct GTrans *sentinel, int fly) {
  gfrees++;
  if(sentinel && (t != sentinel)) {
    free_gtrans(t->nxt, sentinel, fly);
    if(fly) t->to->incoming--;
  }
  t->nxt = gtrans_list;
  gtrans_list = t;
}

variable_types:
sentinel
struct GTrans *

variable_types: fly int

user_defined_types: struct GState { int id; int incoming; int *nodes_set; struct GTrans *trans; struct GState *nxt; struct GState *prv; }


decompiled_code:
_QWORD *emalloc_btrans()
{
__int64 v0; // r12
__int64 v1; // rax
_QWORD *result; // rax
_QWORD *v3; // r12
__int64 v4; // rax

v0 = btrans_list;
if ( btrans_list )
{
v1 = *(_QWORD *)(btrans_list + 24);
++ballocs;
btrans_list = v1;
result = (_QWORD *)v0;
}
else
{
v3 = tl_emalloc(32);
v3[1] = new_set(1LL);
v4 = new_set(1LL);
++bpool;
v3[2] = v4;
result = v3;
++ballocs;
}
return result;
}

canonical_decompiled_code:
_QWORD *func7()
{
__int64 v0; // r12
__int64 v1; // rax
_QWORD *result; // rax
_QWORD *v3; // r12
__int64 v4; // rax

v0 = btrans_list;
if ( btrans_list )
{
v1 = *(_QWORD *)(btrans_list + 24);
++ballocs;
btrans_list = v1;
result = (_QWORD *)v0;
}
else
{
v3 = func0(32);
v3[1] = new_set(1LL);
v4 = new_set(1LL);
++bpool;
v3[2] = v4;
result = v3;
++ballocs;
}
return result;
}

original_code:
BTrans* emalloc_btrans() {
  BTrans *result;
  if(!btrans_list) {
    result = (BTrans *)tl_emalloc(sizeof(BTrans));
    result->pos = new_set(1);
    result->neg = new_set(1);
    bpool++;
  }
  else {
    result = btrans_list;
    btrans_list = btrans_list->nxt;
  }
  ballocs++;
  return result;
}

canonical_original_code:
struct BTrans *emalloc_btrans() {
  struct BTrans *result;
  if(!btrans_list) {
    result = (struct BTrans *)tl_emalloc(sizeof(BTrans));
    result->pos = new_set(1);
    result->neg = new_set(1);
    bpool++;
  }
  else {
    result = btrans_list;
    btrans_list = btrans_list->nxt;
  }
  ballocs++;
  return result;
}

variable_types: struct BTrans { struct BState { struct GState { int id; int incoming; int *nodes_set; struct GTrans { int *pos; int *neg; struct GState *to; int *final; struct GTrans *nxt; } *trans; struct GState *nxt; struct GState *prv; } *gstate; int id; int incoming; int final; struct BTrans *trans; struct BState *nxt; struct BState *prv; } *to; int *pos; int *neg; struct BTrans *nxt; } *

user_defined_types: struct BTrans { struct BState *to; int *pos; int *neg; struct BTrans *nxt; }

user_defined_types: struct BState { struct GState *gstate; int id; int incoming; int final; struct BTrans *trans; struct BState *nxt; struct BState *prv; }


decompiled_code:
int a_stats()
{
__int64 v0; // rbx
__int64 v1; // rdx
__int64 v2; // rcx
__int64 v3; // r8
__int64 v4; // rsi

v0 = 0LL;
puts(" size\t pool\tallocs\t frees");
do
{
while ( 1 )
{
v1 = event[v0];
v2 = qword_8A0[v0];
v3 = qword_B20[v0];
if ( v3 | v2 | v1 )
break;
if ( ++v0 == 80 )
goto LABEL_5;
}
v4 = (unsigned int)v0++;
printf("%5d\t%6ld\t%6ld\t%6ld\n", v4, v1, v2, v3);
}
while ( v0 != 80 );
LABEL_5:
printf("atrans\t%6d\t%6d\t%6d\n", (unsigned int)apool, (unsigned int)aallocs, (unsigned int)afrees);
printf("gtrans\t%6d\t%6d\t%6d\n", (unsigned int)gpool, (unsigned int)gallocs, (unsigned int)gfrees);
return printf("btrans\t%6d\t%6d\t%6d\n", (unsigned int)bpool, (unsigned int)ballocs, (unsigned int)bfrees);
}

canonical_decompiled_code:
int func9()
{
__int64 v0; // rbx
__int64 v1; // rdx
__int64 v2; // rcx
__int64 v3; // r8
__int64 v4; // rsi

v0 = 0LL;
puts(" size\t pool\tallocs\t frees");
do
{
while ( 1 )
{
v1 = event[v0];
v2 = qword_8A0[v0];
v3 = qword_B20[v0];
if ( v3 | v2 | v1 )
break;
if ( ++v0 == 80 )
goto LABEL_5;
}
v4 = (unsigned int)v0++;
printf("%5d\t%6ld\t%6ld\t%6ld\n", v4, v1, v2, v3);
}
while ( v0 != 80 );
LABEL_5:
printf("atrans\t%6d\t%6d\t%6d\n", (unsigned int)apool, (unsigned int)aallocs, (unsigned int)afrees);
printf("gtrans\t%6d\t%6d\t%6d\n", (unsigned int)gpool, (unsigned int)gallocs, (unsigned int)gfrees);
return printf("btrans\t%6d\t%6d\t%6d\n", (unsigned int)bpool, (unsigned int)ballocs, (unsigned int)bfrees);
}

original_code:
void
a_stats(void)
{ long p, a, f;
 int i;
 printf(" size\t  pool\tallocs\t frees\n");
 for (i = 0; i < 80; i++)
 { p = event[0][i];
  a = event[1][i];
  f = event[2][i];
  if(p|a|f)
  printf("%5d\t%6ld\t%6ld\t%6ld\n",
   i, p, a, f);
 }
 printf("atrans\t%6d\t%6d\t%6d\n",
        apool, aallocs, afrees);
 printf("gtrans\t%6d\t%6d\t%6d\n",
        gpool, gallocs, gfrees);
 printf("btrans\t%6d\t%6d\t%6d\n",
        bpool, ballocs, bfrees);
}

canonical_original_code:
void a_stats()
{ long p; long a; long f;
 int i;
 printf(" size\t  pool\tallocs\t frees\n");
 for (i = 0; i < 80; i++)
 { p = event[0][i];
  a = event[1][i];
  f = event[2][i];
  if(p|a|f)
  printf("%5d\t%6ld\t%6ld\t%6ld\n",
   i, p, a, f);
 }
 printf("atrans\t%6d\t%6d\t%6d\n",
        apool, aallocs, afrees);
 printf("gtrans\t%6d\t%6d\t%6d\n",
        gpool, gallocs, gfrees);
 printf("btrans\t%6d\t%6d\t%6d\n",
        bpool, ballocs, bfrees);
}

variable_types: p long

variable_types: a long

variable_types: f long

variable_types: i int


original_code:
int calculate_node_size(Node *p)
{
  switch(p->ntyp) {
  case AND:
  case OR:
  case U_OPER:
  case V_OPER:
    return(calculate_node_size(p->lft) + calculate_node_size(p->rgt) + 1);
  case NEXT:
    return(calculate_node_size(p->lft) + 1);
  default:
    return 1;
    break;
  }
}

canonical_original_code:
int calculate_node_size(struct Node *p)
{
  switch(p->ntyp) {
  case AND:
  case OR:
  case U_OPER:
  case V_OPER:
    return(calculate_node_size(p->lft) + calculate_node_size(p->rgt) + 1);
  case NEXT:
    return(calculate_node_size(p->lft) + 1);
  default:
    return 1;
    break;
  }
}


decompiled_code:
__int64 __fastcall calculate_sym_size(__int64 a1)
{
unsigned int v1; // er12
int v4; // eax

v1 = 0;
while ( 2 )
{
switch ( *(_WORD *)a1 )
{
case 0x102:
case 0x108:
case 0x10B:
case 0x10C:
v4 = calculate_sym_size(*(_QWORD *)(a1 + 16));
a1 = *(_QWORD *)(a1 + 24);
v1 += v4;
continue;
case 0x107:
case 0x109:
++v1;
break;
case 0x10D:
a1 = *(_QWORD *)(a1 + 16);
continue;
default:
return v1;
}
return v1;
}
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
unsigned int v1; // er12
int v4; // eax

v1 = 0;
while ( 2 )
{
switch ( *(_WORD *)a1 )
{
case 0x102:
case 0x108:
case 0x10B:
case 0x10C:
v4 = func1(*(_QWORD *)(a1 + 16));
a1 = *(_QWORD *)(a1 + 24);
v1 += v4;
continue;
case 0x107:
case 0x109:
++v1;
break;
case 0x10D:
a1 = *(_QWORD *)(a1 + 16);
continue;
default:
return v1;
}
return v1;
}
}

original_code:
int calculate_sym_size(Node *p)
{
  switch(p->ntyp) {
  case AND:
  case OR:
  case U_OPER:
  case V_OPER:
    return(calculate_sym_size(p->lft) + calculate_sym_size(p->rgt));
  case NEXT:
    return(calculate_sym_size(p->lft));
  case NOT:
  case PREDICATE:
    return 1;
  default:
    return 0;
  }
}

canonical_original_code:
int calculate_sym_size(struct Node *p)
{
  switch(p->ntyp) {
  case AND:
  case OR:
  case U_OPER:
  case V_OPER:
    return(calculate_sym_size(p->lft) + calculate_sym_size(p->rgt));
  case NEXT:
    return(calculate_sym_size(p->lft));
  case NOT:
  case PREDICATE:
    return 1;
  default:
    return 0;
  }
}


decompiled_code:
__int64 __fastcall do_merge_trans(__int64 *a1, _QWORD *a2, _QWORD *a3)
{
_QWORD *v4; // rdi
__int64 result; // rax
__int64 v7; // rax

v4 = (_QWORD *)*a1;
if ( a2 && a3 )
{
if ( !v4 )
{
v7 = emalloc_atrans();
*a1 = v7;
v4 = (_QWORD *)v7;
}
do_merge_sets(*v4, *a2, *a3, 0LL);
do_merge_sets(*(_QWORD *)(*a1 + 8), a2[1], a3[1], 1LL);
do_merge_sets(*(_QWORD *)(*a1 + 16), a2[2], a3[2], 1LL);
result = empty_intersect_sets(*(_QWORD *)(*a1 + 8), *(_QWORD *)(*a1 + 16), 1LL);
if ( !(_DWORD)result )
{
result = free_atrans(*a1, 0LL);
*a1 = 0LL;
}
}
else
{
result = free_atrans(v4, 0LL);
*a1 = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 *a1, _QWORD *a2, _QWORD *a3)
{
_QWORD *v4; // rdi
__int64 result; // rax
__int64 v7; // rax

v4 = (_QWORD *)*a1;
if ( a2 && a3 )
{
if ( !v4 )
{
v7 = emalloc_atrans();
*a1 = v7;
v4 = (_QWORD *)v7;
}
do_merge_sets(*v4, *a2, *a3, 0LL);
do_merge_sets(*(_QWORD *)(*a1 + 8), a2[1], a3[1], 1LL);
do_merge_sets(*(_QWORD *)(*a1 + 16), a2[2], a3[2], 1LL);
result = empty_intersect_sets(*(_QWORD *)(*a1 + 8), *(_QWORD *)(*a1 + 16), 1LL);
if ( !(_DWORD)result )
{
result = free_atrans(*a1, 0LL);
*a1 = 0LL;
}
}
else
{
result = free_atrans(v4, 0LL);
*a1 = 0LL;
}
return result;
}

original_code:
void do_merge_trans(ATrans **result, ATrans *trans1, ATrans *trans2)
{
  if(!trans1 || !trans2) {
    free_atrans(*result, 0);
    *result = (ATrans *)0;
    return;
  }
  if(!*result)
    *result = emalloc_atrans();
  do_merge_sets((*result)->to, trans1->to, trans2->to, 0);
  do_merge_sets((*result)->pos, trans1->pos, trans2->pos, 1);
  do_merge_sets((*result)->neg, trans1->neg, trans2->neg, 1);
  if(!empty_intersect_sets((*result)->pos, (*result)->neg, 1)) {
    free_atrans(*result, 0);
    *result = (ATrans *)0;
  }
}

canonical_original_code:
void do_merge_trans(struct ATrans **result, struct ATrans *trans1, struct ATrans *trans2)
{
  if(!trans1 || !trans2) {
    free_atrans(*result, 0);
    *result = (struct ATrans *)0;
    return;
  }
  if(!*result)
    *result = emalloc_atrans();
  do_merge_sets((*result)->to, trans1->to, trans2->to, 0);
  do_merge_sets((*result)->pos, trans1->pos, trans2->pos, 1);
  do_merge_sets((*result)->neg, trans1->neg, trans2->neg, 1);
  if(!empty_intersect_sets((*result)->pos, (*result)->neg, 1)) {
    free_atrans(*result, 0);
    *result = (struct ATrans *)0;
  }
}

variable_types: struct ATrans { int *to; int *pos; int *neg; struct ATrans *nxt; } **


decompiled_code:
__int64 __fastcall merge_trans(_QWORD *a1, _QWORD *a2)
{
__int64 v3[4]; // [rsp+8h] [rbp-20h] BYREF

v3[0] = emalloc_atrans();
do_merge_trans(v3, a1, a2);
return v3[0];
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1, _QWORD *a2)
{
__int64 v3[4]; // [rsp+8h] [rbp-20h] BYREF

v3[0] = emalloc_atrans();
func2(v3, a1, a2);
return v3[0];
}

original_code:
ATrans *merge_trans(ATrans *trans1, ATrans *trans2)
{
  ATrans *result = emalloc_atrans();
  do_merge_trans(&result, trans1, trans2);
  return result;
}

canonical_original_code:
struct ATrans *merge_trans(struct ATrans *trans1, struct ATrans *trans2)
{
  struct ATrans *result = emalloc_atrans();
  do_merge_trans(&result, trans1, trans2);
  return result;
}

return_type: struct ATrans { int *to; int *pos; int *neg; struct ATrans *nxt; } *


decompiled_code:
__int64 __fastcall already_done(__int64 a1)
{
__int64 v1; // rbx
int v2; // er12

if ( node_id <= 1 )
return 0xFFFFFFFFLL;
v1 = 8LL;
v2 = 1;
while ( !(unsigned int)isequal(a1, *(_QWORD *)(label + v1)) )
{
++v2;
v1 += 8LL;
if ( node_id <= v2 )
return 0xFFFFFFFFLL;
}
return (unsigned int)v2;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
__int64 v1; // rbx
int v2; // er12

if ( node_id <= 1 )
return 0xFFFFFFFFLL;
v1 = 8LL;
v2 = 1;
while ( !(unsigned int)isequal(a1, *(_QWORD *)(label + v1)) )
{
++v2;
v1 += 8LL;
if ( node_id <= v2 )
return 0xFFFFFFFFLL;
}
return (unsigned int)v2;
}

original_code:
int already_done(Node *p)
{
  int i;
  for(i = 1; i<node_id; i++)
    if (isequal(p, label[i]))
      return i;
  return -1;
}

canonical_original_code:
int already_done(struct Node *p)
{
  int i;
  for(i = 1; i<node_id; i++)
    if (isequal(p, label[i]))
      return i;
  return -1;
}


decompiled_code:
__int64 __fastcall get_sym_id(char *s1)
{
__int64 v1; // rbx
int v2; // er14
__int64 v3; // r15
__int64 v4; // r13
unsigned int v5; // er12

v1 = 0LL;
v2 = sym_id;
v3 = sym_table;
v4 = sym_id;
if ( sym_id > 0 )
{
while ( 1 )
{
v5 = v1;
if ( !strcmp(s1, *(const char **)(v3 + 8 * v1)) )
break;
if ( ++v1 == v4 )
goto LABEL_6;
}
}
else
{
LABEL_6:
*(_QWORD *)(v3 + 8 * v4) = s1;
v5 = v2;
sym_id = v2 + 1;
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *s1)
{
__int64 v1; // rbx
int v2; // er14
__int64 v3; // r15
__int64 v4; // r13
unsigned int v5; // er12

v1 = 0LL;
v2 = sym_id;
v3 = sym_table;
v4 = sym_id;
if ( sym_id > 0 )
{
while ( 1 )
{
v5 = v1;
if ( !strcmp(s1, *(const char **)(v3 + 8 * v1)) )
break;
if ( ++v1 == v4 )
goto LABEL_6;
}
}
else
{
LABEL_6:
*(_QWORD *)(v3 + 8 * v4) = s1;
v5 = v2;
sym_id = v2 + 1;
}
return v5;
}

original_code:
int get_sym_id(char *s)
{
  int i;
  for(i=0; i<sym_id; i++)
    if (!strcmp(s, sym_table[i]))
      return i;
  sym_table[sym_id] = s;
  return sym_id++;
}

variable_types:
s
char *


decompiled_code:
__int64 simplify_astates()
{
__int64 v0; // rbp
_QWORD *v1; // rbx
unsigned int v2; // er13
__int64 v3; // r12
_QWORD *v4; // rbx

v0 = make_set(0xFFFFFFFFLL, 0LL);
v1 = *(_QWORD **)transition;
if ( *(_QWORD *)transition )
{
do
{
merge_sets(v0, *v1, 0LL);
v1 = (_QWORD *)v1[3];
}
while ( v1 );
}
v2 = node_id - 1;
v3 = 8LL * (node_id - 1);
if ( node_id - 1 > 0 )
{
do
{
while ( !(unsigned int)in_set(v0, v2) )
{
*(_QWORD *)(label + v3) = 0LL;
free_atrans(*(_QWORD *)(transition + v3), 1LL);
*(_QWORD *)(transition + v3) = 0LL;
LABEL_6:
v3 -= 8LL;
if ( !--v2 )
return tfree(v0);
}
++astate_count;
simplify_atrans((_QWORD *)(v3 + transition));
v4 = *(_QWORD **)(transition + v3);
if ( !v4 )
goto LABEL_6;
do
{
merge_sets(v0, *v4, 0LL);
v4 = (_QWORD *)v4[3];
}
while ( v4 );
v3 -= 8LL;
--v2;
}
while ( v2 );
}
return tfree(v0);
}

canonical_decompiled_code:
__int64 func7()
{
__int64 v0; // rbp
_QWORD *v1; // rbx
unsigned int v2; // er13
__int64 v3; // r12
_QWORD *v4; // rbx

v0 = make_set(0xFFFFFFFFLL, 0LL);
v1 = *(_QWORD **)transition;
if ( *(_QWORD *)transition )
{
do
{
merge_sets(v0, *v1, 0LL);
v1 = (_QWORD *)v1[3];
}
while ( v1 );
}
v2 = node_id - 1;
v3 = 8LL * (node_id - 1);
if ( node_id - 1 > 0 )
{
do
{
while ( !(unsigned int)in_set(v0, v2) )
{
*(_QWORD *)(label + v3) = 0LL;
free_atrans(*(_QWORD *)(transition + v3), 1LL);
*(_QWORD *)(transition + v3) = 0LL;
LABEL_6:
v3 -= 8LL;
if ( !--v2 )
return tfree(v0);
}
++astate_count;
func6((_QWORD *)(v3 + transition));
v4 = *(_QWORD **)(transition + v3);
if ( !v4 )
goto LABEL_6;
do
{
merge_sets(v0, *v4, 0LL);
v4 = (_QWORD *)v4[3];
}
while ( v4 );
v3 -= 8LL;
--v2;
}
while ( v2 );
}
return tfree(v0);
}

original_code:
void simplify_astates()
{
  ATrans *t;
  int i, *acc = make_set(-1, 0);
  for(t = transition[0]; t; t = t->nxt, i = 0)
    merge_sets(acc, t->to, 0);
  for(i = node_id - 1; i > 0; i--) {
    if (!in_set(acc, i)) {
      label[i] = (Node *)0;
      free_atrans(transition[i], 1);
      transition[i] = (ATrans *)0;
      continue;
    }
    astate_count++;
    simplify_atrans(&transition[i]);
    for(t = transition[i]; t; t = t->nxt)
      merge_sets(acc, t->to, 0);
  }
  tfree(acc);
}

canonical_original_code:
void simplify_astates()
{
  struct ATrans *t;
  int i; int *acc = make_set(-1, 0);
  for(t = transition[0]; t; t = t->nxt, i = 0)
    merge_sets(acc, t->to, 0);
  for(i = node_id - 1; i > 0; i--) {
    if (!in_set(acc, i)) {
      label[i] = (struct Node *)0;
      free_atrans(transition[i], 1);
      transition[i] = (struct ATrans *)0;
      continue;
    }
    astate_count++;
    simplify_atrans(&transition[i]);
    for(t = transition[i]; t; t = t->nxt)
      merge_sets(acc, t->to, 0);
  }
  tfree(acc);
}

variable_types:
acc
int *


decompiled_code:
int print_alternating()
{
_QWORD *v0; // rbx
int result; // eax
int v2; // er12
__int64 v3; // rbp
_QWORD *i; // rbx

fwrite("init :\n", 1uLL, 7uLL, tl_out);
v0 = *(_QWORD **)transition;
if ( *(_QWORD *)transition )
{
do
{
print_set(*v0, 0LL);
fputc(10, tl_out);
v0 = (_QWORD *)v0[3];
}
while ( v0 );
}
result = node_id;
v2 = node_id - 1;
if ( node_id - 1 > 0 )
{
v3 = 8LL * v2;
do
{
result = label;
if ( *(_QWORD *)(label + v3) )
{
fprintf(tl_out, "state %i : ", (unsigned int)v2);
dump(*(_QWORD *)(label + v3));
fputc(10, tl_out);
result = transition;
for ( i = *(_QWORD **)(transition + v3); i; i = (_QWORD *)i[3] )
{
if ( (unsigned int)empty_set(i[1], 1LL) && (unsigned int)empty_set(i[2], 1LL) )
fputc(49, tl_out);
print_set(i[1], 1LL);
if ( !(unsigned int)empty_set(i[1], 1LL) && !(unsigned int)empty_set(i[2], 1LL) )
fwrite(" & ", 1uLL, 3uLL, tl_out);
print_set(i[2], 2LL);
fwrite(" -> ", 1uLL, 4uLL, tl_out);
print_set(*i, 0LL);
result = fputc(10, tl_out);
}
}
v3 -= 8LL;
--v2;
}
while ( v2 );
}
return result;
}

canonical_decompiled_code:
int func8()
{
_QWORD *v0; // rbx
int result; // eax
int v2; // er12
__int64 v3; // rbp
_QWORD *i; // rbx

fwrite("init :\n", 1uLL, 7uLL, tl_out);
v0 = *(_QWORD **)transition;
if ( *(_QWORD *)transition )
{
do
{
print_set(*v0, 0LL);
fputc(10, tl_out);
v0 = (_QWORD *)v0[3];
}
while ( v0 );
}
result = node_id;
v2 = node_id - 1;
if ( node_id - 1 > 0 )
{
v3 = 8LL * v2;
do
{
result = label;
if ( *(_QWORD *)(label + v3) )
{
fprintf(tl_out, "state %i : ", (unsigned int)v2);
dump(*(_QWORD *)(label + v3));
fputc(10, tl_out);
result = transition;
for ( i = *(_QWORD **)(transition + v3); i; i = (_QWORD *)i[3] )
{
if ( (unsigned int)empty_set(i[1], 1LL) && (unsigned int)empty_set(i[2], 1LL) )
fputc(49, tl_out);
print_set(i[1], 1LL);
if ( !(unsigned int)empty_set(i[1], 1LL) && !(unsigned int)empty_set(i[2], 1LL) )
fwrite(" & ", 1uLL, 3uLL, tl_out);
print_set(i[2], 2LL);
fwrite(" -> ", 1uLL, 4uLL, tl_out);
print_set(*i, 0LL);
result = fputc(10, tl_out);
}
}
v3 -= 8LL;
--v2;
}
while ( v2 );
}
return result;
}

original_code:
void print_alternating()
{
  int i;
  ATrans *t;
  fprintf(tl_out, "init :\n");
  for(t = transition[0]; t; t = t->nxt) {
    print_set(t->to, 0);
    fprintf(tl_out, "\n");
  }
  for(i = node_id - 1; i > 0; i--) {
    if(!label[i])
      continue;
    fprintf(tl_out, "state %i : ", i);
    dump(label[i]);
    fprintf(tl_out, "\n");
    for(t = transition[i]; t; t = t->nxt) {
      if (empty_set(t->pos, 1) && empty_set(t->neg, 1))
 fprintf(tl_out, "1");
      print_set(t->pos, 1);
      if (!empty_set(t->pos,1) && !empty_set(t->neg,1)) fprintf(tl_out, " & ");
      print_set(t->neg, 2);
      fprintf(tl_out, " -> ");
      print_set(t->to, 0);
      fprintf(tl_out, "\n");
    }
  }
}

canonical_original_code:
void print_alternating()
{
  int i;
  struct ATrans *t;
  fprintf(tl_out, "init :\n");
  for(t = transition[0]; t; t = t->nxt) {
    print_set(t->to, 0);
    fprintf(tl_out, "\n");
  }
  for(i = node_id - 1; i > 0; i--) {
    if(!label[i])
      continue;
    fprintf(tl_out, "state %i : ", i);
    dump(label[i]);
    fprintf(tl_out, "\n");
    for(t = transition[i]; t; t = t->nxt) {
      if (empty_set(t->pos, 1) && empty_set(t->neg, 1))
 fprintf(tl_out, "1");
      print_set(t->pos, 1);
      if (!empty_set(t->pos,1) && !empty_set(t->neg,1)) fprintf(tl_out, " & ");
      print_set(t->neg, 2);
      fprintf(tl_out, " -> ");
      print_set(t->to, 0);
      fprintf(tl_out, "\n");
    }
  }
}


decompiled_code:
__int64 __fastcall mk_alternating(__int64 a1)
{
int v1; // eax
__int64 v2; // rax
_QWORD *v3; // rbx
_QWORD *v4; // rax
int v5; // esi

if ( tl_stats )
getrusage(RUSAGE_SELF, &tr_debut);
node_size = calculate_node_size(a1) + 1;
label = tl_emalloc((unsigned int)(8 * node_size));
transition = tl_emalloc((unsigned int)(8 * node_size));
node_size = ((unsigned __int64)node_size >> 5) + 1;
v1 = calculate_sym_size(a1);
sym_size = v1;
if ( v1 )
{
sym_table = tl_emalloc((unsigned int)(8 * v1));
v1 = sym_size;
}
sym_size = ((unsigned __int64)v1 >> 5) + 1;
v2 = make_set(0xFFFFFFFFLL, 0LL);
v3 = (_QWORD *)transition;
final_set = v2;
v4 = boolean(a1);
v5 = tl_verbose;
*v3 = v4;
if ( v5 )
{
fwrite("\nAlternating automaton before simplification\n", 1uLL, 0x2DuLL, tl_out);
print_alternating();
}
if ( tl_simp_diff )
{
simplify_astates();
if ( tl_verbose )
{
fwrite("\nAlternating automaton after simplification\n", 1uLL, 0x2CuLL, tl_out);
print_alternating();
}
}
if ( tl_stats )
{
getrusage(RUSAGE_SELF, &tr_fin);
timeval_subtract(&t_diff, &tr_fin, &tr_debut);
fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %i.%06is", t_diff, *(&t_diff + 1));
fprintf(tl_out, "\n%i states, %i transitions\n", (unsigned int)astate_count, (unsigned int)atrans_count);
}
releasenode(1LL, a1);
return tfree(label);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
int v1; // eax
__int64 v2; // rax
_QWORD *v3; // rbx
_QWORD *v4; // rax
int v5; // esi

if ( tl_stats )
getrusage(RUSAGE_SELF, &tr_debut);
node_size = func0(a1) + 1;
label = tl_emalloc((unsigned int)(8 * node_size));
transition = tl_emalloc((unsigned int)(8 * node_size));
node_size = ((unsigned __int64)node_size >> 5) + 1;
v1 = func1(a1);
sym_size = v1;
if ( v1 )
{
sym_table = tl_emalloc((unsigned int)(8 * v1));
v1 = sym_size;
}
sym_size = ((unsigned __int64)v1 >> 5) + 1;
v2 = make_set(0xFFFFFFFFLL, 0LL);
v3 = (_QWORD *)transition;
final_set = v2;
v4 = boolean(a1);
v5 = tl_verbose;
*v3 = v4;
if ( v5 )
{
fwrite("\nAlternating automaton before simplification\n", 1uLL, 0x2DuLL, tl_out);
func8();
}
if ( tl_simp_diff )
{
func7();
if ( tl_verbose )
{
fwrite("\nAlternating automaton after simplification\n", 1uLL, 0x2CuLL, tl_out);
func8();
}
}
if ( tl_stats )
{
getrusage(RUSAGE_SELF, &tr_fin);
timeval_subtract(&t_diff, &tr_fin, &tr_debut);
fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %i.%06is", t_diff, *(&t_diff + 1));
fprintf(tl_out, "\n%i states, %i transitions\n", (unsigned int)astate_count, (unsigned int)atrans_count);
}
releasenode(1LL, a1);
return tfree(label);
}

original_code:
void mk_alternating(Node *p)
{
  if(tl_stats) getrusage(RUSAGE_SELF, &tr_debut);
  node_size = calculate_node_size(p) + 1;
  label = (Node **) tl_emalloc(node_size * sizeof(Node *));
  transition = (ATrans **) tl_emalloc(node_size * sizeof(ATrans *));
  node_size = node_size / (8 * sizeof(int)) + 1;
  sym_size = calculate_sym_size(p);
  if(sym_size) sym_table = (char **) tl_emalloc(sym_size * sizeof(char *));
  sym_size = sym_size / (8 * sizeof(int)) + 1;
  final_set = make_set(-1, 0);
  transition[0] = boolean(p);
  if(tl_verbose) {
    fprintf(tl_out, "\nAlternating automaton before simplification\n");
    print_alternating();
  }
  if(tl_simp_diff) {
    simplify_astates();
    if(tl_verbose) {
      fprintf(tl_out, "\nAlternating automaton after simplification\n");
      print_alternating();
    }
  }
  if(tl_stats) {
    getrusage(RUSAGE_SELF, &tr_fin);
    timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime);
    fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %i.%06is",
  t_diff.tv_sec, t_diff.tv_usec);
    fprintf(tl_out, "\n%i states, %i transitions\n", astate_count, atrans_count);
  }
  releasenode(1, p);
  tfree(label);
}

canonical_original_code:
void mk_alternating(struct Node *p)
{
  if(tl_stats) getrusage(RUSAGE_SELF, &tr_debut);
  node_size = calculate_node_size(p) + 1;
  label = (struct Node **) tl_emalloc(node_size * sizeof(struct Node *));
  transition = (struct ATrans **) tl_emalloc(node_size * sizeof(struct ATrans *));
  node_size = node_size / (8 * sizeof(int)) + 1;
  sym_size = calculate_sym_size(p);
  if(sym_size) sym_table = (char **) tl_emalloc(sym_size * sizeof(char *));
  sym_size = sym_size / (8 * sizeof(int)) + 1;
  final_set = make_set(-1, 0);
  transition[0] = boolean(p);
  if(tl_verbose) {
    fprintf(tl_out, "\nAlternating automaton before simplification\n");
    print_alternating();
  }
  if(tl_simp_diff) {
    simplify_astates();
    if(tl_verbose) {
      fprintf(tl_out, "\nAlternating automaton after simplification\n");
      print_alternating();
    }
  }
  if(tl_stats) {
    getrusage(RUSAGE_SELF, &tr_fin);
    timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime);
    fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %i.%06is",
  t_diff.tv_sec, t_diff.tv_usec);
    fprintf(tl_out, "\n%i states, %i transitions\n", astate_count, atrans_count);
  }
  releasenode(1, p);
  tfree(label);
}

variable_types: struct Node { short ntyp; struct Symbol { char *name; struct Symbol *next; } *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; } *


ismatch

original_code:
static int
ismatch(Node *a, Node *b)
{
 if (!a && !b) return 1;
 if (!a || !b) return 0;
 if (a->ntyp != b->ntyp) return 0;
 if (a->sym
 && b->sym
 && strcmp(a->sym->name, b->sym->name) != 0)
  return 0;
 if (ismatch(a->lft, b->lft)
 && ismatch(a->rgt, b->rgt))
  return 1;
 return 0;
}

canonical_original_code:
static int ismatch(struct Node *a, struct Node *b)
{
 if (!a && !b) return 1;
 if (!a || !b) return 0;
 if (a->ntyp != b->ntyp) return 0;
 if (a->sym
 && b->sym
 && strcmp(a->sym->name, b->sym->name) != 0)
  return 0;
 if (ismatch(a->lft, b->lft)
 && ismatch(a->rgt, b->rgt))
  return 1;
 return 0;
}

variable_types:
b
struct Node *


decompiled_code:
int cache_dump()
{
__int64 v0; // rbx
unsigned int v1; // ebp

puts("\nCACHE DUMP:");
v0 = stored;
if ( stored )
{
v1 = 0;
do
{
if ( !*(_DWORD *)(v0 + 16) )
{
printf("B%3d: ", v1);
dump(*(_QWORD *)v0);
putchar(10);
printf("A%3d: ", v1);
dump(*(_QWORD *)(v0 + 8));
putchar(10);
}
v0 = *(_QWORD *)(v0 + 24);
++v1;
}
while ( v0 );
}
return puts("============");
}

canonical_decompiled_code:
int func1()
{
__int64 v0; // rbx
unsigned int v1; // ebp

puts("\nCACHE DUMP:");
v0 = stored;
if ( stored )
{
v1 = 0;
do
{
if ( !*(_DWORD *)(v0 + 16) )
{
printf("B%3d: ", v1);
dump(*(_QWORD *)v0);
putchar(10);
printf("A%3d: ", v1);
dump(*(_QWORD *)(v0 + 8));
putchar(10);
}
v0 = *(_QWORD *)(v0 + 24);
++v1;
}
while ( v0 );
}
return puts("============");
}

original_code:
void
cache_dump(void)
{ Cache *d; int nr=0;
 printf("\nCACHE DUMP:\n");
 for (d = stored; d; d = d->nxt, nr++)
 { if (d->same) continue;
  printf("B%3d: ", nr); dump(d->before); printf("\n");
  printf("A%3d: ", nr); dump(d->after); printf("\n");
 }
 printf("============\n");
}

canonical_original_code:
void cache_dump()
{ struct Cache *d; int nr = 0;
 printf("\nCACHE DUMP:\n");
 for (d = stored; d; d = d->nxt, nr++)
 { if (d->same) continue;
  printf("B%3d: ", nr); dump(d->before); printf("\n");
  printf("A%3d: ", nr); dump(d->after); printf("\n");
 }
 printf("============\n");
}

variable_types: struct Cache { struct Node { short ntyp; struct Symbol { char *name; struct Symbol *next; } *sym; struct Node *lft; struct Node *rgt; struct Node *nxt; } *before; struct Node *after; int same; struct Cache *nxt; } *

variable_types: nr int

user_defined_types: struct Cache { struct Node *before; struct Node *after; int same; struct Cache *nxt; }


decompiled_code:
int cache_stats()
{
printf("cache stores : %9ld\n", Caches);
return printf("cache hits : %9ld\n", CacheHits);
}

canonical_decompiled_code:
int func2()
{
printf("cache stores : %9ld\n", Caches);
return printf("cache hits : %9ld\n", CacheHits);
}

original_code:
void
cache_stats(void)
{
 printf("cache stores     : %9ld\n", Caches);
 printf("cache hits       : %9ld\n", CacheHits);
}

canonical_original_code:
void cache_stats()
{
 printf("cache stores     : %9ld\n", Caches);
 printf("cache hits       : %9ld\n", CacheHits);
}


releasenode

decompiled_code:
__int64 __fastcall releasenode(int a1, __int64 a2)
{
__int64 result; // rax
__int64 v4; // rsi

if ( a2 )
{
if ( a1 )
{
releasenode(1LL, *(_QWORD *)(a2 + 16));
v4 = *(_QWORD *)(a2 + 24);
*(_QWORD *)(a2 + 16) = 0LL;
releasenode(1LL, v4);
*(_QWORD *)(a2 + 24) = 0LL;
result = tfree(a2);
}
else
{
result = tfree(a2);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1, __int64 a2)
{
__int64 result; // rax
__int64 v4; // rsi

if ( a2 )
{
if ( a1 )
{
func3(1LL, *(_QWORD *)(a2 + 16));
v4 = *(_QWORD *)(a2 + 24);
*(_QWORD *)(a2 + 16) = 0LL;
func3(1LL, v4);
*(_QWORD *)(a2 + 24) = 0LL;
result = tfree(a2);
}
else
{
result = tfree(a2);
}
}
return result;
}

original_code:
void
releasenode(int all_levels, Node *n)
{
 if (!n) return;
 if (all_levels)
 { releasenode(1, n->lft);
  n->lft = (Node *)0;
  releasenode(1, n->rgt);
  n->rgt = (Node *)0;
 }
 tfree((void *) n);
}

canonical_original_code:
void releasenode(int all_levels, struct Node *n)
{
 if (!n) return;
 if (all_levels)
 { releasenode(1, n->lft);
  n->lft = (struct Node *)0;
  releasenode(1, n->rgt);
  n->rgt = (struct Node *)0;
 }
 tfree((void *) n);
}


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

result = tl_emalloc(40LL);
*(_WORD *)result = a1;
*(_QWORD *)(result + 16) = a2;
*(_QWORD *)(result + 24) = a3;
return result;
}

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

result = tl_emalloc(40LL);
*(_WORD *)result = a1;
*(_QWORD *)(result + 16) = a2;
*(_QWORD *)(result + 24) = a3;
return result;
}

original_code:
Node *
tl_nn(int t, Node *ll, Node *rl)
{ Node *n = (Node *) tl_emalloc(sizeof(Node));
 n->ntyp = (short) t;
 n->lft = ll;
 n->rgt = rl;
 return n;
}

canonical_original_code:
struct Node *tl_nn(int t, struct Node *ll, struct Node *rl)
{ struct Node *n = (Node *) tl_emalloc(sizeof(Node));
 n->ntyp = (short) t;
 n->lft = ll;
 n->rgt = rl;
 return n;
}

variable_types: t int

variable_types:
ll
struct Node *

variable_types:
rl
struct Node *


getnode

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

if ( !a1 )
return 0LL;
result = tl_emalloc(40LL);
*(_WORD *)result = *(_WORD *)a1;
*(_QWORD *)(result + 8) = *(_QWORD *)(a1 + 8);
*(_QWORD *)(result + 16) = *(_QWORD *)(a1 + 16);
*(_QWORD *)(result + 24) = *(_QWORD *)(a1 + 24);
return result;
}

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

if ( !a1 )
return 0LL;
result = tl_emalloc(40LL);
*(_WORD *)result = *(_WORD *)a1;
*(_QWORD *)(result + 8) = *(_QWORD *)(a1 + 8);
*(_QWORD *)(result + 16) = *(_QWORD *)(a1 + 16);
*(_QWORD *)(result + 24) = *(_QWORD *)(a1 + 24);
return result;
}

original_code:
Node *
getnode(Node *p)
{ Node *n;
 if (!p) return p;
 n = (Node *) tl_emalloc(sizeof(Node));
 n->ntyp = p->ntyp;
 n->sym = p->sym;
 n->lft = p->lft;
 n->rgt = p->rgt;
 return n;
}

canonical_original_code:
struct Node *getnode(struct Node *p)
{ struct Node *n;
 if (!p) return p;
 n = (struct Node *) tl_emalloc(sizeof(Node));
 n->ntyp = p->ntyp;
 n->sym = p->sym;
 n->lft = p->lft;
 n->rgt = p->rgt;
 return n;
}

variable_types:
p
struct Node *


dupnode

original_code:
Node *
dupnode(Node *n)
{ Node *d;
 if (!n) return n;
 d = getnode(n);
 d->lft = dupnode(n->lft);
 d->rgt = dupnode(n->rgt);
 return d;
}

canonical_original_code:
struct Node *dupnode(struct Node *n)
{ struct Node *d;
 if (!n) return n;
 d = getnode(n);
 d->lft = dupnode(n->lft);
 d->rgt = dupnode(n->rgt);
 return d;
}

variable_types:
n
struct Node *