decompiled_code:
__int64 __fastcall lookup_cur(__int64 a1, const char *a2)
{
int v2; // er12
unsigned __int64 v3; // r13
const char **v4; // rbx
int v5; // er15
__int64 i; // rbp

if ( a1 )
{
v2 = *(_DWORD *)(a1 + 12);
v3 = symtab + 24LL * *(int *)(a1 + 8);
v4 = (const char **)(symtab + 24LL * v2);
if ( v3 > (unsigned __int64)v4 )
{
v2 = 0;
}
else
{
v5 = arg_mark;
for ( i = symtab + 24LL * v2;
!v4 || !*v4 || strcmp(*v4, a2) || (!i || *(_DWORD *)(i + 12) == 2056) && v5 > v2;
i -= 24LL )
{
--v2;
v4 -= 3;
if ( v3 > (unsigned __int64)v4 )
return 0;
}
}
}
else
{
v2 = 0;
}
return (unsigned int)v2;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, const char *a2)
{
int v2; // er12
unsigned __int64 v3; // r13
const char **v4; // rbx
int v5; // er15
__int64 i; // rbp

if ( a1 )
{
v2 = *(_DWORD *)(a1 + 12);
v3 = symtab + 24LL * *(int *)(a1 + 8);
v4 = (const char **)(symtab + 24LL * v2);
if ( v3 > (unsigned __int64)v4 )
{
v2 = 0;
}
else
{
v5 = arg_mark;
for ( i = symtab + 24LL * v2;
!v4 || !*v4 || strcmp(*v4, a2) || (!i || *(_DWORD *)(i + 12) == 2056) && v5 > v2;
i -= 24LL )
{
--v2;
v4 -= 3;
if ( v3 > (unsigned __int64)v4 )
return 0;
}
}
}
else
{
v2 = 0;
}
return (unsigned int)v2;
}

original_code:
int lookup_cur(scope *sp, char *name) {
    symentry *p, *bp, *ep;
    int i;
    if (sp == 0) return 0;
    i = sp->end;
    bp = &symtab[sp->begin];
    ep = &symtab[sp->end];
    for( p = ep; p >= bp; --i,--p) {
       if (p && p->name && strcmp(p->name,name)==0) {
           symentry *ep = &symtab[i];
           if (ep && ep->prop != vARG) return i;
           if (arg_mark <= i) return i;
       }
    }
    return 0;
}

canonical_original_code:
int lookup_cur(struct scope *sp, char *name) {
    struct symentry *p; struct symentry *bp; struct symentry *ep;
    int i;
    if (sp == 0) return 0;
    i = sp->end;
    bp = &symtab[sp->begin];
    ep = &symtab[sp->end];
    for( p = ep; p >= bp; --i,--p) {
       if (p && p->name && strcmp(p->name,name)==0) {
           struct symentry *ep = &symtab[i];
           if (ep && ep->prop != vARG) return i;
           if (arg_mark <= i) return i;
       }
    }
    return 0;
}

variable_types: i int


decompiled_code:
__int64 __fastcall lookup_SYM_all(const char *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax

v1 = (_QWORD *)cur;
if ( !cur )
return 0LL;
do
{
result = lookup_cur((__int64)v1, a1);
if ( (_DWORD)result )
break;
v1 = (_QWORD *)*v1;
}
while ( v1 );
return result;
}

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

v1 = (_QWORD *)cur;
if ( !cur )
return 0LL;
do
{
result = func10((__int64)v1, a1);
if ( (_DWORD)result )
break;
v1 = (_QWORD *)*v1;
}
while ( v1 );
return result;
}

original_code:
int lookup_SYM_all(char *name) {
    scope *sp;
    int idx;
    for (sp = cur; sp; sp = sp->next) {
        if (idx = lookup_cur(sp,name))
            return idx;
    }
    return 0;
}

canonical_original_code:
int lookup_SYM_all(char *name) {
    struct scope *sp;
    int idx;
    for (sp = cur; sp; sp = sp->next) {
        if (idx = lookup_cur(sp,name))
            return idx;
    }
    return 0;
}

variable_types:
name
char *

variable_types: struct scope { struct scope *next; int begin; int end; } *

variable_types: idx int

return_type: int


decompiled_code:
__int64 __fastcall lookup_SYM(const char *a1)
{
return lookup_cur(cur, a1);
}

canonical_decompiled_code:
__int64 __fastcall func12(const char *a1)
{
return func10(cur, a1);
}

original_code:
int lookup_SYM(char *name) {
    int idx;
    if (idx = lookup_cur(cur,name)) return idx;
    return 0;
}


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

result = a1;
if ( a1 )
result = *(unsigned int *)(symtab + 24LL * (int)a1 + 16);
return result;
}

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

result = a1;
if ( a1 )
result = *(unsigned int *)(symtab + 24LL * (int)a1 + 16);
return result;
}

original_code:
int getval_SYM(int k) {
    symentry *ep = &symtab[k];
    return (k) ? ep->val : 0;
}

canonical_original_code:
int getval_SYM(int k) {
    struct symentry *ep = &symtab[k];
    return (k) ? ep->val : 0;
}

variable_types: k int

variable_types: struct symentry { char *name; int type; int prop; int val; int loc; } *


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

result = a1;
if ( a1 )
result = *(unsigned int *)(symtab + 24LL * (int)a1 + 20);
return result;
}

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

result = a1;
if ( a1 )
result = *(unsigned int *)(symtab + 24LL * (int)a1 + 20);
return result;
}

original_code:
int getloc_SYM(int k) {
    symentry *ep = &symtab[k];
    return (k) ? ep->loc : 0;
}

canonical_original_code:
int getloc_SYM(int k) {
    struct symentry *ep = &symtab[k];
    return (k) ? ep->loc : 0;
}

user_defined_types: struct symentry { char *name; int type; int prop; int val; int loc; }


decompiled_code:
__int64 __fastcall getdepth_SYM(__int64 a1)
{
if ( (_DWORD)a1 )
a1 = *(unsigned int *)(symtab + 24LL * (int)a1 + 20);
return getdepth_LOC(a1);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
if ( (_DWORD)a1 )
a1 = *(unsigned int *)(symtab + 24LL * (int)a1 + 20);
return getdepth_LOC(a1);
}

original_code:
int getdepth_SYM(int k) {
    symentry *ep = &symtab[k];
    int loc= (k) ? ep->loc : 0;
    return getdepth_LOC(loc);
}

canonical_original_code:
int getdepth_SYM(int k) {
    struct symentry *ep = &symtab[k];
    int loc = (k) ? ep->loc : 0;
    return getdepth_LOC(loc);
}

variable_types: loc int


decompiled_code:
__int64 __fastcall getoffset_SYM(__int64 a1)
{
if ( (_DWORD)a1 )
a1 = *(unsigned int *)(symtab + 24LL * (int)a1 + 20);
return getoffset_LOC(a1);
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1)
{
if ( (_DWORD)a1 )
a1 = *(unsigned int *)(symtab + 24LL * (int)a1 + 20);
return getoffset_LOC(a1);
}

original_code:
int getoffset_SYM(int k) {
    symentry *ep = &symtab[k];
    int loc= (k) ? ep->loc : 0;
    return getoffset_LOC(loc);
}

canonical_original_code:
int getoffset_SYM(int k) {
    struct symentry *ep = &symtab[k];
    int loc = (k) ? ep->loc : 0;
    return getoffset_LOC(loc);
}


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

if ( a1 )
{
result = symtab + 24LL * a1;
*(_DWORD *)(result + 16) = a2;
}
return result;
}

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

if ( a1 )
{
result = symtab + 24LL * a1;
*(_DWORD *)(result + 16) = a2;
}
return result;
}

original_code:
void setval_SYM(int k, int val) {
    symentry *ep = &symtab[k];
    if (k) ep->val = val;
}

canonical_original_code:
void setval_SYM(int k, int val) {
    struct symentry *ep = &symtab[k];
    if (k) ep->val = val;
}

variable_types: val int

return_type: void


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

if ( a1 )
{
result = symtab + 24LL * a1;
*(_DWORD *)(result + 12) = a2;
}
return result;
}

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

if ( a1 )
{
result = symtab + 24LL * a1;
*(_DWORD *)(result + 12) = a2;
}
return result;
}

original_code:
void setprop_SYM(int k, int prop) {
    symentry *ep = &symtab[k];
    if (k) ep->prop = prop;
}

canonical_original_code:
void setprop_SYM(int k, int prop) {
    struct symentry *ep = &symtab[k];
    if (k) ep->prop = prop;
}

variable_types: prop int


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

result = a1;
if ( a1 )
result = *(unsigned int *)(symtab + 24LL * (int)a1 + 8);
return result;
}

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

result = a1;
if ( a1 )
result = *(unsigned int *)(symtab + 24LL * (int)a1 + 8);
return result;
}

original_code:
int gettype_SYM(int k) {
    symentry *ep = &symtab[k];
    return (k)? ep->type : 0;
}

canonical_original_code:
int gettype_SYM(int k) {
    struct symentry *ep = &symtab[k];
    return (k)? ep->type : 0;
}


propval

decompiled_code:
__int64 __fastcall propval(char *s2)
{
__int64 v2; // rbx
const char *v3; // rdi

v2 = 0LL;
v3 = "vLOCAL";
while ( strcmp(v3, s2) )
{
v3 = namestr[++v2];
if ( !v3 )
return 0LL;
}
return (unsigned int)(v2 + 2048);
}

canonical_decompiled_code:
__int64 __fastcall func21(char *s2)
{
__int64 v2; // rbx
const char *v3; // rdi

v2 = 0LL;
v3 = "vLOCAL";
while ( strcmp(v3, s2) )
{
v3 = namestr[++v2];
if ( !v3 )
return 0LL;
}
return (unsigned int)(v2 + 2048);
}

original_code:
int propval(char *text) {
    int i;
    for (i=0;namestr[i];i++) {
        if (strcmp(namestr[i],text)==0) return i+vLOCAL;
    }
    return 0;
}

variable_types:
text
char *


typedecl

decompiled_code:
__int64 typedecl()
{
unsigned int v0; // eax

v0 = primtype();
return mod(v0);
}

canonical_decompiled_code:
__int64 func3()
{
unsigned int v0; // eax

v0 = func1();
return func2(v0);
}

original_code:
static AST typedecl() {
    Token *t = &tok;
    AST a=0;
    a = primtype();
    a = mod(a);
    return a;
}

canonical_original_code:
static int typedecl() {
    struct Token *t = &tok;
    int a = 0;
    a = primtype();
    a = mod(a);
    return a;
}

variable_types: struct Token { enum tokentype { ID=256, ILIT=257, CLIT=258, FLIT=259, SLIT=260, ARIOP=261, RELOP=262, LOGOP=263, ASNOP=264, CMT=265, tCLASS=266, tPRIVATE=267, tPUBLIC=268, tSTATIC=269, tCONST=270, tIF=271, tELSE=272, tSWITCH=273, tCASE=274, tDEFAULT=275, tBREAK=276, tCONTINUE=277, tWHILE=278, tDO=279, tFOR=280, tCALL=281, tRETURN=282, tFALSE=283, tTRUE=284, tEND=285, ERROR=-1 } sym; char text[-1]; int index; int ival; char *sval; } *

variable_types: a int

user_defined_types: struct Token { enum tokentype sym; char text[-1]; int index; int ival; char *sval; }


factor

decompiled_code:
__int64 factor()
{
unsigned int v0; // ebx

if ( tok[0] == 256 )
return (unsigned int)lval();
if ( tok[0] > 256 )
{
if ( (unsigned int)(tok[0] - 257) <= 3 )
return (unsigned int)con();
LABEL_11:
parse_error("expected ID or LIT");
skiptoken3(59LL, 41LL, 261LL);
return (unsigned int)zero;
}
if ( tok[0] != 40 )
goto LABEL_11;
gettoken();
v0 = expr();
if ( tok[0] == 41 )
gettoken();
else
parse_error("expected )");
return v0;
}

canonical_decompiled_code:
__int64 func9()
{
unsigned int v0; // ebx

if ( tok[0] == 256 )
return (unsigned int)func13();
if ( tok[0] > 256 )
{
if ( (unsigned int)(tok[0] - 257) <= 3 )
return (unsigned int)func8();
LABEL_11:
parse_error("expected ID or LIT");
skiptoken3(59LL, 41LL, 261LL);
return (unsigned int)zero;
}
if ( tok[0] != 40 )
goto LABEL_11;
gettoken();
v0 = func11();
if ( tok[0] == 41 )
gettoken();
else
parse_error("expected )");
return v0;
}

original_code:
static AST factor() {
    Token *t = &tok;
    AST a=0;
    switch (t->sym) {
      case ID :
        a = lval();
        break;
      case ILIT: case CLIT: case FLIT: case SLIT:
        a = con();
        break;
      case '(':
        gettoken();
        a = expr();
        if (t->sym == ')') gettoken();
        else parse_error("expected )");
        break;
      default:
        parse_error("expected ID or LIT");
        skiptoken3(';',')',ARIOP);
        a = zero;
        break;
    }
    return a;
}

canonical_original_code:
static int factor() {
    struct Token *t = &tok;
    int a = 0;
    switch (t->sym) {
      case ID :
        a = lval();
        break;
      case ILIT: case CLIT: case FLIT: case SLIT:
        a = con();
        break;
      case '(':
        gettoken();
        a = expr();
        if (t->sym == ')') gettoken();
        else parse_error("expected )");
        break;
      default:
        parse_error("expected ID or LIT");
        skiptoken3(';',')',ARIOP);
        a = zero;
        break;
    }
    return a;
}

user_defined_types: enum tokentype { ID=256, ILIT=257, CLIT=258, FLIT=259, SLIT=260, ARIOP=261, RELOP=262, LOGOP=263, ASNOP=264, CMT=265, tCLASS=266, tPRIVATE=267, tPUBLIC=268, tSTATIC=269, tCONST=270, tIF=271, tELSE=272, tSWITCH=273, tCASE=274, tDEFAULT=275, tBREAK=276, tCONTINUE=277, tWHILE=278, tDO=279, tFOR=280, tCALL=281, tRETURN=282, tFALSE=283, tTRUE=284, tEND=285, ERROR=-1 }


term

decompiled_code:
__int64 term()
{
unsigned int v0; // ebx
int v1; // eax
unsigned __int64 v2; // rdx
__int64 v3; // rcx
unsigned int v4; // er12
unsigned int v5; // eax
char v6; // dl

v0 = factor();
v1 = tok[0];
v2 = (unsigned int)(tok[0] - 41);
if ( (unsigned int)v2 <= 0x34 )
{
v3 = 0x10000000040009LL;
if ( !_bittest64(&v3, v2) && tok[0] != 257 )
{
LABEL_8:
parse_error("expected op");
skiptoken2(59LL, 261LL);
}
return v0;
}
if ( tok[0] == 257 )
return v0;
while ( v1 == 261 )
{
v4 = tok[66];
if ( ((v4 - 43) & 0xFFFFFFFD) == 0 )
return v0;
if ( v4 != 42 && v4 != 47 )
{
parse_error("expected * or /");
skiptoken(59LL);
return v0;
}
gettoken();
LABEL_15:
v5 = factor();
v0 = make_AST_op2(v4, v0, v5);
v1 = tok[0];
v6 = 1;
if ( (unsigned int)(tok[0] - 41) <= 0x34 )
v6 = ((0x10000000040009uLL >> (LOBYTE(tok[0]) - 41)) ^ 1) & 1;
if ( tok[0] == 257 || !v6 )
return v0;
}
if ( v1 > 261 )
{
if ( (unsigned int)(v1 - 271) > 1 )
goto LABEL_8;
goto LABEL_23;
}
if ( v1 == 40 )
{
parse_error("purhaps missing * or /");
v4 = 42;
goto LABEL_15;
}
if ( v1 != 256 )
goto LABEL_8;
LABEL_23:
parse_error("purhaps missing ;");
return v0;
}

canonical_decompiled_code:
__int64 func10()
{
unsigned int v0; // ebx
int v1; // eax
unsigned __int64 v2; // rdx
__int64 v3; // rcx
unsigned int v4; // er12
unsigned int v5; // eax
char v6; // dl

v0 = func9();
v1 = tok[0];
v2 = (unsigned int)(tok[0] - 41);
if ( (unsigned int)v2 <= 0x34 )
{
v3 = 0x10000000040009LL;
if ( !_bittest64(&v3, v2) && tok[0] != 257 )
{
LABEL_8:
parse_error("expected op");
skiptoken2(59LL, 261LL);
}
return v0;
}
if ( tok[0] == 257 )
return v0;
while ( v1 == 261 )
{
v4 = tok[66];
if ( ((v4 - 43) & 0xFFFFFFFD) == 0 )
return v0;
if ( v4 != 42 && v4 != 47 )
{
parse_error("expected * or /");
skiptoken(59LL);
return v0;
}
gettoken();
LABEL_15:
v5 = func9();
v0 = make_AST_op2(v4, v0, v5);
v1 = tok[0];
v6 = 1;
if ( (unsigned int)(tok[0] - 41) <= 0x34 )
v6 = ((0x10000000040009uLL >> (LOBYTE(tok[0]) - 41)) ^ 1) & 1;
if ( tok[0] == 257 || !v6 )
return v0;
}
if ( v1 > 261 )
{
if ( (unsigned int)(v1 - 271) > 1 )
goto LABEL_8;
goto LABEL_23;
}
if ( v1 == 40 )
{
parse_error("purhaps missing * or /");
v4 = 42;
goto LABEL_15;
}
if ( v1 != 256 )
goto LABEL_8;
LABEL_23:
parse_error("purhaps missing ;");
return v0;
}

original_code:
static AST term() {
    Token *t = &tok;
    AST a =0;
    AST a1=0, a2=0;
    int op;
    a = factor();
    while (true) {
        if (t->sym == ';' || t->sym == ',' || t->sym == ')' || t->sym == ']')
            break;
        if (t->sym == ILIT)
            break;
        switch (t->sym) {
            case ARIOP:
              if (t->ival == '+' || t->ival == '-')
                  return a;
              if (t->ival != '*' && t->ival != '/') {
                  parse_error("expected * or /");
                  skiptoken(';');
                  return a;
              }
              op = t->ival;
              gettoken();
              break;
            case '(':
              parse_error("purhaps missing * or /");
              op = '*';
       break;
     case ID: case tIF: case tELSE:
       parse_error("purhaps missing ;");
       return a;
            default:
              parse_error("expected op");
       skiptoken2(';',ARIOP);
              return a;
        }
        a1 = a;
        a2 = factor();
        a = make_AST_op2(op, a1, a2);
    }
    return a;
}

canonical_original_code:
static int term() {
    struct Token *t = &tok;
    int a = 0;
    int a1 = 0; int a2 = 0;
    int op;
    a = factor();
    while (true) {
        if (t->sym == ';' || t->sym == ',' || t->sym == ')' || t->sym == ']')
            break;
        if (t->sym == ILIT)
            break;
        switch (t->sym) {
            case ARIOP:
              if (t->ival == '+' || t->ival == '-')
                  return a;
              if (t->ival != '*' && t->ival != '/') {
                  parse_error("expected * or /");
                  skiptoken(';');
                  return a;
              }
              op = t->ival;
              gettoken();
              break;
            case '(':
              parse_error("purhaps missing * or /");
              op = '*';
       break;
     case ID: case tIF: case tELSE:
       parse_error("purhaps missing ;");
       return a;
            default:
              parse_error("expected op");
       skiptoken2(';',ARIOP);
              return a;
        }
        a1 = a;
        a2 = factor();
        a = make_AST_op2(op, a1, a2);
    }
    return a;
}

variable_types: op int


breakstmt

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

if ( tok[0] == 276 )
{
gettoken();
result = make_AST_break();
}
else
{
parse_error("Expected break stmt");
skiptoken(59LL);
result = 0LL;
}
return result;
}

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

if ( tok[0] == 276 )
{
gettoken();
result = make_AST_break();
}
else
{
parse_error("Expected break stmt");
skiptoken(59LL);
result = 0LL;
}
return result;
}

original_code:
static AST breakstmt(){
    Token *t = &tok;
    AST a = 0;
    if (t->sym == tBREAK){
 gettoken();
 a = make_AST_break();
    } else {
 parse_error("Expected break stmt");
 skiptoken(';');
    }
    return a;
}

canonical_original_code:
static int breakstmt(){
    struct Token *t = &tok;
    int a = 0;
    if (t->sym == tBREAK){
 gettoken();
 a = make_AST_break();
    } else {
 parse_error("Expected break stmt");
 skiptoken(';');
    }
    return a;
}


continuestmt

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

if ( tok[0] == 277 )
{
gettoken();
result = make_AST_continue();
}
else
{
parse_error("Expected continue stmt");
skiptoken(59LL);
result = 0LL;
}
return result;
}

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

if ( tok[0] == 277 )
{
gettoken();
result = make_AST_continue();
}
else
{
parse_error("Expected continue stmt");
skiptoken(59LL);
result = 0LL;
}
return result;
}

original_code:
static AST continuestmt(){
    Token *t = &tok;
    AST a = 0;
    if (t->sym == tCONTINUE){
 gettoken();
 a = make_AST_continue();
    } else {
 parse_error("Expected continue stmt");
 skiptoken(';');
    }
    return a;
}

canonical_original_code:
static int continuestmt(){
    struct Token *t = &tok;
    int a = 0;
    if (t->sym == tCONTINUE){
 gettoken();
 a = make_AST_continue();
    } else {
 parse_error("Expected continue stmt");
 skiptoken(';');
    }
    return a;
}


whilestmt

decompiled_code:
__int64 __fastcall whilestmt(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
__int64 v4; // rdx
__int64 v5; // rsi
unsigned int v6; // ebx
__int64 v7; // rdx

if ( tok[0] == 278 )
{
gettoken(a1, a2, a3);
if ( tok[0] == 40 )
{
gettoken(a1, a2, v4);
v6 = expr();
if ( tok[0] == 41 )
gettoken(a1, a2, v7);
else
parse_error("expected )");
v5 = (unsigned int)stmt();
}
else
{
parse_error("expected (");
v5 = 0LL;
v6 = 0;
}
result = make_AST_while(v6, v5);
}
else
{
parse_error("expected while");
skiptoken(59LL);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func21(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
__int64 v4; // rdx
__int64 v5; // rsi
unsigned int v6; // ebx
__int64 v7; // rdx

if ( tok[0] == 278 )
{
gettoken(a1, a2, a3);
if ( tok[0] == 40 )
{
gettoken(a1, a2, v4);
v6 = func11();
if ( tok[0] == 41 )
gettoken(a1, a2, v7);
else
parse_error("expected )");
v5 = (unsigned int)func17();
}
else
{
parse_error("expected (");
v5 = 0LL;
v6 = 0;
}
result = make_AST_while(v6, v5);
}
else
{
parse_error("expected while");
skiptoken(59LL);
result = 0LL;
}
return result;
}

original_code:
static AST whilestmt() {
    Token *t = &tok;
    AST a=0;
    AST a1=0,a2=0;
    if (t->sym == tWHILE) {
 gettoken();
 if (t->sym == '(') {
     gettoken();
     a1 = expr();
     if (t->sym == ')') gettoken();
     else parse_error("expected )");
     a2 = stmt();
 } else {
     parse_error("expected (");
 }
 a = make_AST_while(a1,a2);
    } else {
 parse_error("expected while");
 skiptoken(';');
    }
    return a;
}

canonical_original_code:
static int whilestmt() {
    struct Token *t = &tok;
    int a = 0;
    int a1 = 0; int a2 = 0;
    if (t->sym == tWHILE) {
 gettoken();
 if (t->sym == '(') {
     gettoken();
     a1 = expr();
     if (t->sym == ')') gettoken();
     else parse_error("expected )");
     a2 = stmt();
 } else {
     parse_error("expected (");
 }
 a = make_AST_while(a1,a2);
    } else {
 parse_error("expected while");
 skiptoken(';');
    }
    return a;
}


decompiled_code:
__int64 new_code()
{
return (unsigned int)++code_cnt;
}

canonical_decompiled_code:
__int64 func0()
{
return (unsigned int)++code_cnt;
}

original_code: int new_code() { return ++code_cnt; }

canonical_original_code: int new_code() { return ++code_cnt; }


decompiled_code:
__int64 get_cur_code()
{
return (unsigned int)code_cnt;
}

canonical_decompiled_code:
__int64 func1()
{
return (unsigned int)code_cnt;
}

original_code: int get_cur_code() { return code_cnt; }

canonical_original_code: int get_cur_code() { return code_cnt; }


decompiled_code:
__int64 new_label()
{
return (unsigned int)++label_seq;
}

canonical_decompiled_code:
__int64 func2()
{
return (unsigned int)++label_seq;
}

original_code: int new_label() { return ++label_seq; }

canonical_original_code: int new_label() { return ++label_seq; }


decompiled_code:
void __fastcall set_code(int a1, char a2, char a3, __int16 a4)
{
if ( a1 )
{
LOBYTE(code[a1]) = a2;
BYTE1(code[a1]) = a3;
HIWORD(code[a1]) = a4;
}
}

canonical_decompiled_code:
void __fastcall func3(int a1, char a2, char a3, __int16 a4)
{
if ( a1 )
{
LOBYTE(code[a1]) = a2;
BYTE1(code[a1]) = a3;
HIWORD(code[a1]) = a4;
}
}

original_code:
void set_code(int c, int op, int lev, int val) {
    insn *cp;
    if (c==0) return;
    cp = &code[c];
    cp->op = op; cp->lev = lev; cp->val = val;
}

canonical_original_code:
void set_code(int c, int op, int lev, int val) {
    struct insn *cp;
    if (c==0) return;
    cp = &code[c];
    cp->op = op; cp->lev = lev; cp->val = val;
}

variable_types: c int

variable_types: lev int

variable_types: struct insn { int op; int lev; int val; } *


decompiled_code:
__int64 __fastcall gen_code(char a1, char a2, __int16 a3)
{
unsigned int v4; // ebx

v4 = new_code();
set_code(v4, a1, a2, a3);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func4(char a1, char a2, __int16 a3)
{
unsigned int v4; // ebx

v4 = func0();
func3(v4, a1, a2, a3);
return v4;
}

original_code:
int gen_code(int op, int lev, int val) {
    int c = new_code();
    set_code(c, op, lev, val);
    return c;
}


decompiled_code:
__int64 __fastcall gen_label(char a1)
{
return gen_code(0, a1, 0);
}

canonical_decompiled_code:
__int64 __fastcall func5(char a1)
{
return func4(0, a1, 0);
}

original_code:
int gen_label(int l) {
    return gen_code(OPR, l, 0);
}

variable_types: l int


decompiled_code:
__int64 fix_labels()
{
int v0; // ecx
__int64 v1; // rax
char v2; // r9
int v3; // er8
int v4; // edx
int v5; // edi
int v6; // ecx
int v7; // eax
char v8; // dl

labelcnt = 0;
v0 = code_cnt;
if ( code_cnt > 0 )
{
v1 = 1LL;
v2 = 0;
v3 = 0;
do
{
if ( (code[v1] & 0xFFFF00FF) == 0 )
{
v4 = SBYTE1(code[(int)v1]);
labeltbl[SBYTE1(code[(int)v1])] = v1;
if ( v4 > v3 )
{
v3 = v4;
v2 = 1;
}
}
++v1;
}
while ( v1 != v0 + 1 );
if ( v2 )
labelcnt = v3;
v5 = labelcnt;
v6 = v0 + 1;
v7 = 1;
do
{
if ( (unsigned __int8)(LOBYTE(code[v7]) - 10) <= 2u )
{
v8 = BYTE1(code[v7]);
if ( v8 > 0 && v8 <= v5 )
HIWORD(code[v7]) = labeltbl[v8];
}
++v7;
}
while ( v7 != v6 );
}
return (unsigned int)labelcnt;
}

canonical_decompiled_code:
__int64 func8()
{
int v0; // ecx
__int64 v1; // rax
char v2; // r9
int v3; // er8
int v4; // edx
int v5; // edi
int v6; // ecx
int v7; // eax
char v8; // dl

labelcnt = 0;
v0 = code_cnt;
if ( code_cnt > 0 )
{
v1 = 1LL;
v2 = 0;
v3 = 0;
do
{
if ( (code[v1] & 0xFFFF00FF) == 0 )
{
v4 = SBYTE1(code[(int)v1]);
labeltbl[SBYTE1(code[(int)v1])] = v1;
if ( v4 > v3 )
{
v3 = v4;
v2 = 1;
}
}
++v1;
}
while ( v1 != v0 + 1 );
if ( v2 )
labelcnt = v3;
v5 = labelcnt;
v6 = v0 + 1;
v7 = 1;
do
{
if ( (unsigned __int8)(LOBYTE(code[v7]) - 10) <= 2u )
{
v8 = BYTE1(code[v7]);
if ( v8 > 0 && v8 <= v5 )
HIWORD(code[v7]) = labeltbl[v8];
}
++v7;
}
while ( v7 != v6 );
}
return (unsigned int)labelcnt;
}

original_code:
int fix_labels() {
    int i;
    insn *p;
    labelcnt = 0;
    for (i=1;i<=code_cnt;i++) {
         p = &code[i];
         if (p->op == OPR && p->val == 0) {
              labeltbl[p->lev] = i;
              if (p->lev > labelcnt) labelcnt = p->lev;
         }
    }
    for (i=1;i<=code_cnt;i++) {
         p = &code[i];
         if (p->op == JMP || p->op == JMPF || p->op == CALL) {
              if (p->lev > 0 && p->lev <= labelcnt)
        p->val = labeltbl[p->lev];
         }
    }
    return labelcnt;
}

canonical_original_code:
int fix_labels() {
    int i;
    struct insn *p;
    labelcnt = 0;
    for (i=1;i<=code_cnt;i++) {
         p = &code[i];
         if (p->op == OPR && p->val == 0) {
              labeltbl[p->lev] = i;
              if (p->lev > labelcnt) labelcnt = p->lev;
         }
    }
    for (i=1;i<=code_cnt;i++) {
         p = &code[i];
         if (p->op == JMP || p->op == JMPF || p->op == CALL) {
              if (p->lev > 0 && p->lev <= labelcnt)
        p->val = labeltbl[p->lev];
         }
    }
    return labelcnt;
}

variable_types: i int

user_defined_types: struct insn { int op; int lev; int val; }


decompiled_code:
__int64 new_cblock()
{
return (unsigned int)++codeblock_cnt;
}

canonical_decompiled_code:
__int64 func9()
{
return (unsigned int)++codeblock_cnt;
}

original_code: int new_cblock() { return ++codeblock_cnt; }


decompiled_code:
void set_cblock()
{
;
}

canonical_decompiled_code:
void func10()
{
;
}

original_code:
void set_cblock(int c, int b, int e) {
    cblock *cp;
    if (c==0) return;
    cp = &codeblock[c];
    cp->begin = b;
    cp->end = e;
}

canonical_original_code:
void set_cblock(int c, int b, int e) {
    struct cblock *cp;
    if (c==0) return;
    cp = &codeblock[c];
    cp->begin = b;
    cp->end = e;
}

variable_types: b int

variable_types: e int

variable_types: struct cblock { struct cblock *next; int begin; int end; } *


decompiled_code:
int dump_reg()
{
unsigned int v0; // ebx

v0 = code[dword_C30];
printf(
"B=%2d T=%2d S=%2d D=%2d R=%2d V=%2d P=%2d cc=%d:insn=%08x ",
(unsigned int)reg,
(unsigned int)dword_C24,
(unsigned int)dword_C28,
(unsigned int)dword_C2C,
(unsigned int)dword_C34,
(unsigned int)dword_C38,
(unsigned int)dword_C30,
(unsigned __int8)byte_C3C,
v0);
return print_insn(v0, stdout);
}

canonical_decompiled_code:
int func11()
{
unsigned int v0; // ebx

v0 = code[dword_C30];
printf(
"B=%2d T=%2d S=%2d D=%2d R=%2d V=%2d P=%2d cc=%d:insn=%08x ",
(unsigned int)reg,
(unsigned int)dword_C24,
(unsigned int)dword_C28,
(unsigned int)dword_C2C,
(unsigned int)dword_C34,
(unsigned int)dword_C38,
(unsigned int)dword_C30,
(unsigned __int8)byte_C3C,
v0);
return func6(v0, stdout);
}

original_code:
void dump_reg() {
   insn x = code[reg.P];
   printf("B=%2d T=%2d S=%2d D=%2d R=%2d V=%2d P=%2d cc=%d:insn=%08x ",
 reg.B, reg.T, reg.S, reg.D, reg.R, reg.V, reg.P, reg.cc,
 (*(int*)(&(x))));
   print_insn(x,stdout);
}

canonical_original_code:
void dump_reg() {
   struct insn x = code[reg.P];
   printf("B=%2d T=%2d S=%2d D=%2d R=%2d V=%2d P=%2d cc=%d:insn=%08x ",
 reg.B, reg.T, reg.S, reg.D, reg.R, reg.V, reg.P, reg.cc,
 (*(int *)(&(x))));
   print_insn(x,stdout);
}

variable_types: struct insn { int op; int lev; int val; }


decompiled_code:
void init_reg()
{
dword_C24 = 20;
reg = 20;
dword_C2C = 10;
dword_C28 = 10;
dword_C38 = 0;
dword_C34 = 0;
dword_C30 = 1;
}

canonical_decompiled_code:
void func12()
{
dword_C24 = 20;
reg = 20;
dword_C2C = 10;
dword_C28 = 10;
dword_C38 = 0;
dword_C34 = 0;
dword_C30 = 1;
}

original_code:
void init_reg() {
   reg.B = reg.T = 20;
   reg.S = reg.D = 10;
   reg.R = reg.V = 0;
   reg.P = 1;
}


decompiled_code:
int dump_mem()
{
__int64 i; // rbx

for ( i = 0LL; i != 60; ++i )
{
if ( 10 * ((int)i / 10) == (_DWORD)i )
printf("\n%4d: ", (unsigned int)i);
printf("%4d ", (unsigned int)mem[i]);
}
return putchar(10);
}

canonical_decompiled_code:
int func13()
{
__int64 i; // rbx

for ( i = 0LL; i != 60; ++i )
{
if ( 10 * ((int)i / 10) == (_DWORD)i )
printf("\n%4d: ", (unsigned int)i);
printf("%4d ", (unsigned int)mem[i]);
}
return putchar(10);
}


decompiled_code:
int *init_mem()
{
int *result; // rax

result = mem;
do
*result++ = -1;
while ( result != (int *)&unk_DA0 );
return result;
}

canonical_decompiled_code:
int *func14()
{
int *result; // rax

result = mem;
do
*result++ = -1;
while ( result != (int *)&unk_DA0 );
return result;
}

original_code:
void init_mem() {
   int i;
   for (i= 0;i<80;i++) mem[i] = -1;
}


display

decompiled_code:
__int64 __fastcall display(int a1)
{
__int64 result; // rax
int v2; // edi

result = (unsigned int)reg;
if ( a1 )
{
result = (unsigned int)dword_C28;
if ( a1 != 1 )
{
v2 = a1 - 1;
if ( v2 > 0 )
{
do
{
result = (unsigned int)mem[(int)result - 1];
--v2;
}
while ( v2 );
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(int a1)
{
__int64 result; // rax
int v2; // edi

result = (unsigned int)reg;
if ( a1 )
{
result = (unsigned int)dword_C28;
if ( a1 != 1 )
{
v2 = a1 - 1;
if ( v2 > 0 )
{
do
{
result = (unsigned int)mem[(int)result - 1];
--v2;
}
while ( v2 );
}
}
}
return result;
}

original_code:
int display(int lev) {
    int tmp;
    switch(lev) {
        case 0: return reg.B;
        case 1: return reg.S;
        default:
          tmp = reg.S;
          while (--lev > 0) tmp = mem[tmp-1];
          return tmp;
    }
}

variable_types: tmp int


operator

decompiled_code:
int __fastcall operator(int a1)
{
int v1; // edi
int result; // eax
int v3; // ebx
unsigned int v4; // ebx
int v5; // ebp
int v6; // ebx
int v7; // ebx
unsigned int v8; // ebx
int v9; // ebx
__int64 v10; // rbx
int v11; // ebx
__int64 v12; // rbp
int v13; // ebx
int v14; // ebx
int v15; // ebx
int v16; // ebx
int v17; // ebx
int v18; // ebx
int v19; // ebx

v1 = a1 >> 16;
result = (unsigned __int16)(v1 + 1);
switch ( (__int16)v1 )
{
case -1:
dword_C30 = 0;
break;
case 0:
return result;
case 2:
v3 = pop();
v4 = pop() + v3;
result = push(v4);
if ( v4 )
byte_C3C = 1;
break;
case 3:
v5 = pop();
v6 = pop();
result = push((unsigned int)(v6 - v5));
if ( v5 != v6 )
byte_C3C = 1;
break;
case 4:
v7 = pop();
v8 = pop() * v7;
result = push(v8);
if ( v8 )
byte_C3C = 1;
break;
case 5:
v9 = pop();
v10 = (unsigned int)((int)pop() / v9);
result = push(v10);
if ( (_DWORD)v10 )
byte_C3C = 1;
break;
case 6:
v11 = pop();
v12 = (unsigned int)((int)pop() % v11);
result = push(v12);
if ( (_DWORD)v12 )
byte_C3C = 1;
break;
case 7:
v13 = pop();
result = push((unsigned int)-v13);
if ( v13 )
byte_C3C = 1;
break;
case 8:
v14 = pop();
result = pop();
if ( v14 == result )
byte_C3C = 1;
break;
case 9:
v15 = pop();
result = pop();
if ( v15 != result )
byte_C3C = 1;
break;
case 10:
v16 = pop();
result = pop();
if ( v16 <= result )
byte_C3C = 1;
break;
case 11:
v17 = pop();
result = pop();
if ( v17 >= result )
byte_C3C = 1;
break;
case 12:
v18 = pop();
result = pop();
if ( v18 < result )
byte_C3C = 1;
break;
case 13:
v19 = pop();
result = pop();
if ( v19 > result )
byte_C3C = 1;
break;
default:
result = printf("unsupported operator:%d\n", (unsigned int)(__int16)v1);
break;
}
return result;
}

canonical_decompiled_code:
int __fastcall func16(int a1)
{
int v1; // edi
int result; // eax
int v3; // ebx
unsigned int v4; // ebx
int v5; // ebp
int v6; // ebx
int v7; // ebx
unsigned int v8; // ebx
int v9; // ebx
__int64 v10; // rbx
int v11; // ebx
__int64 v12; // rbp
int v13; // ebx
int v14; // ebx
int v15; // ebx
int v16; // ebx
int v17; // ebx
int v18; // ebx
int v19; // ebx

v1 = a1 >> 16;
result = (unsigned __int16)(v1 + 1);
switch ( (__int16)v1 )
{
case -1:
dword_C30 = 0;
break;
case 0:
return result;
case 2:
v3 = pop();
v4 = pop() + v3;
result = push(v4);
if ( v4 )
byte_C3C = 1;
break;
case 3:
v5 = pop();
v6 = pop();
result = push((unsigned int)(v6 - v5));
if ( v5 != v6 )
byte_C3C = 1;
break;
case 4:
v7 = pop();
v8 = pop() * v7;
result = push(v8);
if ( v8 )
byte_C3C = 1;
break;
case 5:
v9 = pop();
v10 = (unsigned int)((int)pop() / v9);
result = push(v10);
if ( (_DWORD)v10 )
byte_C3C = 1;
break;
case 6:
v11 = pop();
v12 = (unsigned int)((int)pop() % v11);
result = push(v12);
if ( (_DWORD)v12 )
byte_C3C = 1;
break;
case 7:
v13 = pop();
result = push((unsigned int)-v13);
if ( v13 )
byte_C3C = 1;
break;
case 8:
v14 = pop();
result = pop();
if ( v14 == result )
byte_C3C = 1;
break;
case 9:
v15 = pop();
result = pop();
if ( v15 != result )
byte_C3C = 1;
break;
case 10:
v16 = pop();
result = pop();
if ( v16 <= result )
byte_C3C = 1;
break;
case 11:
v17 = pop();
result = pop();
if ( v17 >= result )
byte_C3C = 1;
break;
case 12:
v18 = pop();
result = pop();
if ( v18 < result )
byte_C3C = 1;
break;
case 13:
v19 = pop();
result = pop();
if ( v19 > result )
byte_C3C = 1;
break;
default:
result = printf("unsupported operator:%d\n", (unsigned int)(__int16)v1);
break;
}
return result;
}

original_code:
void operator(insn x) {
    int t1,t2;
    switch (x.val) {
      case -1:
        reg.P = 0;
        break;
      case 0:
 break;
      case 2:
        t2 = pop(); t1 = pop();
        push(t1+t2);
 if (t1 + t2) reg.cc = 1;
        break;
      case 3:
        t2 = pop(); t1 = pop();
        push(t1-t2);
 if (t1 - t2) reg.cc = 1;
        break;
      case 4:
        t2 = pop(); t1 = pop();
        push(t1*t2);
 if (t1 * t2) reg.cc = 1;
        break;
      case 5:
        t2 = pop(); t1 = pop();
        push(t1/t2);
 if (t1/t2) reg.cc = 1;
        break;
      case 6:
        t2 = pop(); t1 = pop();
        push(t1%t2);
 if (t1%t2) reg.cc = 1;
        break;
      case 7:
        t1 = pop();
        push(-t1);
 if (-t1) reg.cc = 1;
        break;
      case 8:
        t2 = pop(); t1 = pop();
 if (t1 == t2) reg.cc = 1;
        break;
      case 9:
        t2 = pop(); t1 = pop();
        if (t1!=t2) reg.cc = 1;
        break;
      case 10:
        t2 = pop(); t1 = pop();
        if (t1>=t2) reg.cc = 1;
        break;
      case 11:
        t2 = pop(); t1 = pop();
        if (t1<=t2) reg.cc = 1;
        break;
      case 12:
        t2 = pop(); t1 = pop();
        if (t1>t2) reg.cc = 1;
        break;
      case 13:
        t2 = pop(); t1 = pop();
        if (t1<t2) reg.cc = 1;
        break;
      default:
 printf("unsupported operator:%d\n", x.val);
        break;
    }
}

canonical_original_code:
void operator(struct insn x) {
    int t1; int t2;
    switch (x.val) {
      case -1:
        reg.P = 0;
        break;
      case 0:
 break;
      case 2:
        t2 = pop(); t1 = pop();
        push(t1+t2);
 if (t1 + t2) reg.cc = 1;
        break;
      case 3:
        t2 = pop(); t1 = pop();
        push(t1-t2);
 if (t1 - t2) reg.cc = 1;
        break;
      case 4:
        t2 = pop(); t1 = pop();
        push(t1*t2);
 if (t1 * t2) reg.cc = 1;
        break;
      case 5:
        t2 = pop(); t1 = pop();
        push(t1/t2);
 if (t1/t2) reg.cc = 1;
        break;
      case 6:
        t2 = pop(); t1 = pop();
        push(t1%t2);
 if (t1%t2) reg.cc = 1;
        break;
      case 7:
        t1 = pop();
        push(-t1);
 if (-t1) reg.cc = 1;
        break;
      case 8:
        t2 = pop(); t1 = pop();
 if (t1 == t2) reg.cc = 1;
        break;
      case 9:
        t2 = pop(); t1 = pop();
        if (t1!=t2) reg.cc = 1;
        break;
      case 10:
        t2 = pop(); t1 = pop();
        if (t1>=t2) reg.cc = 1;
        break;
      case 11:
        t2 = pop(); t1 = pop();
        if (t1<=t2) reg.cc = 1;
        break;
      case 12:
        t2 = pop(); t1 = pop();
        if (t1>t2) reg.cc = 1;
        break;
      case 13:
        t2 = pop(); t1 = pop();
        if (t1<t2) reg.cc = 1;
        break;
      default:
 printf("unsupported operator:%d\n", x.val);
        break;
    }
}


movestr

decompiled_code:
__int64 __fastcall movestr(int a1)
{
int v1; // er13
__int64 result; // rax
int v3; // ebx
int v4; // er12
int v5; // er13
int v6; // edx

v1 = a1 >> 16;
result = pop();
if ( SHIWORD(a1) > 0 )
{
v3 = result;
v4 = v1 + result;
v5 = v1 + 2 * result - 1;
do
{
if ( (_BYTE)a1 == 6 )
{
result = push((unsigned int)mem[v5 - v3]);
}
else
{
v6 = pop();
result = v3;
mem[v3] = v6;
}
++v3;
}
while ( v3 != v4 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(int a1)
{
int v1; // er13
__int64 result; // rax
int v3; // ebx
int v4; // er12
int v5; // er13
int v6; // edx

v1 = a1 >> 16;
result = pop();
if ( SHIWORD(a1) > 0 )
{
v3 = result;
v4 = v1 + result;
v5 = v1 + 2 * result - 1;
do
{
if ( (_BYTE)a1 == 6 )
{
result = push((unsigned int)mem[v5 - v3]);
}
else
{
v6 = pop();
result = v3;
mem[v3] = v6;
}
++v3;
}
while ( v3 != v4 );
}
return result;
}

original_code:
void movestr(insn x) {
    int t, i;
    t = pop();
    for (i=0;i<x.val;i++) {
        if (x.op==LDS) push(mem[t-i+x.val-1]);
        else mem[t+i] = pop();
    }
}

canonical_original_code:
void movestr(struct insn x) {
    int t; int i;
    t = pop();
    for (i=0;i<x.val;i++) {
        if (x.op==LDS) push(mem[t-i+x.val-1]);
        else mem[t+i] = pop();
    }
}

variable_types: t int


interp

decompiled_code:
int interp()
{
unsigned int i; // ebx
int v1; // eax
int v2; // eax
__int64 v3; // rdi
__int64 v4; // rdx
int v5; // ebp
int v6; // eax
__int64 v7; // rdx
int v8; // ebp
int v9; // eax
__int64 v10; // rdx
__int64 v11; // rsi
__int64 v12; // rdi
__int16 v13; // bp
int v14; // eax
int v15; // ecx
int v16; // eax

init_reg();
init_mem();
puts("Start");
if ( dword_C30 )
{
for ( i = 1; i != 10000; ++i )
{
dump_reg();
v9 = dword_C30;
if ( !dword_C30 )
break;
++dword_C30;
v10 = (unsigned int)code[v9];
v11 = LOBYTE(code[v9]);
v12 = BYTE1(code[v9]);
v13 = HIWORD(code[v9]);
switch ( (char)v11 )
{
case 0:
operator(v10);
break;
case 1:
v2 = display((char)v12);
push((unsigned int)mem[v13 + v2]);
if ( mem[(int)(display((char)v12) + v13)] )
byte_C3C = 1;
break;
case 2:
push((unsigned int)v13);
if ( v13 )
byte_C3C = 1;
break;
case 4:
v1 = display((char)v12);
push((unsigned int)(v13 + v1));
break;
case 5:
v6 = pop(v12, v11, v10);
push((unsigned int)mem[v6]);
break;
case 6:
case 9:
movestr(v10);
break;
case 7:
v3 = (unsigned int)(char)v12;
v5 = display(v3) + v13;
mem[v5] = pop(v3, v11, v4);
break;
case 8:
v8 = pop(v12, v11, v10);
mem[v8] = pop(v12, v11, v7);
break;
case 10:
goto LABEL_14;
case 11:
if ( !byte_C3C )
LABEL_14:
dword_C30 = v13;
break;
case 13:
dword_C30 = dword_C34;
break;
case 14:
dword_C24 += v13;
break;
case 15:
dword_C24 -= v13;
break;
case 16:
v14 = dword_C24;
dword_C24 += 4;
v15 = dword_C24;
mem[v14] = dword_C38;
mem[v14 + 1] = dword_C34;
mem[v14 + 2] = dword_C2C;
mem[v14 + 3] = dword_C28;
dword_C28 = reg;
dword_C2C = reg;
reg = v15;
break;
case 17:
v16 = reg;
reg = dword_C28;
dword_C24 = v16 - 4;
dword_C38 = mem[v16 - 4];
dword_C34 = mem[v16 - 3];
dword_C2C = mem[v16 - 2];
dword_C28 = mem[v16 - 1];
break;
default:
printf("unsupported opcode:%d\n", (unsigned int)(char)v11);
break;
}
dump_mem();
if ( !dword_C30 )
break;
}
}
else
{
i = 0;
}
return printf("\nEnd insn=%d\n", i);
}

canonical_decompiled_code:
int func18()
{
unsigned int i; // ebx
int v1; // eax
int v2; // eax
__int64 v3; // rdi
__int64 v4; // rdx
int v5; // ebp
int v6; // eax
__int64 v7; // rdx
int v8; // ebp
int v9; // eax
__int64 v10; // rdx
__int64 v11; // rsi
__int64 v12; // rdi
__int16 v13; // bp
int v14; // eax
int v15; // ecx
int v16; // eax

func12();
func14();
puts("Start");
if ( dword_C30 )
{
for ( i = 1; i != 10000; ++i )
{
func11();
v9 = dword_C30;
if ( !dword_C30 )
break;
++dword_C30;
v10 = (unsigned int)code[v9];
v11 = LOBYTE(code[v9]);
v12 = BYTE1(code[v9]);
v13 = HIWORD(code[v9]);
switch ( (char)v11 )
{
case 0:
func16(v10);
break;
case 1:
v2 = func15((char)v12);
push((unsigned int)mem[v13 + v2]);
if ( mem[(int)(func15((char)v12) + v13)] )
byte_C3C = 1;
break;
case 2:
push((unsigned int)v13);
if ( v13 )
byte_C3C = 1;
break;
case 4:
v1 = func15((char)v12);
push((unsigned int)(v13 + v1));
break;
case 5:
v6 = pop(v12, v11, v10);
push((unsigned int)mem[v6]);
break;
case 6:
case 9:
func17(v10);
break;
case 7:
v3 = (unsigned int)(char)v12;
v5 = func15(v3) + v13;
mem[v5] = pop(v3, v11, v4);
break;
case 8:
v8 = pop(v12, v11, v10);
mem[v8] = pop(v12, v11, v7);
break;
case 10:
goto LABEL_14;
case 11:
if ( !byte_C3C )
LABEL_14:
dword_C30 = v13;
break;
case 13:
dword_C30 = dword_C34;
break;
case 14:
dword_C24 += v13;
break;
case 15:
dword_C24 -= v13;
break;
case 16:
v14 = dword_C24;
dword_C24 += 4;
v15 = dword_C24;
mem[v14] = dword_C38;
mem[v14 + 1] = dword_C34;
mem[v14 + 2] = dword_C2C;
mem[v14 + 3] = dword_C28;
dword_C28 = reg;
dword_C2C = reg;
reg = v15;
break;
case 17:
v16 = reg;
reg = dword_C28;
dword_C24 = v16 - 4;
dword_C38 = mem[v16 - 4];
dword_C34 = mem[v16 - 3];
dword_C2C = mem[v16 - 2];
dword_C28 = mem[v16 - 1];
break;
default:
printf("unsupported opcode:%d\n", (unsigned int)(char)v11);
break;
}
func13();
if ( !dword_C30 )
break;
}
}
else
{
i = 0;
}
return printf("\nEnd insn=%d\n", i);
}

original_code:
void interp() {
   insn x;
   int insn_cnt = 0;
   init_reg();
   init_mem();
   printf("Start\n");
   while (reg.P > 0 && ++insn_cnt < 10000) {
       dump_reg();
       if (reg.P == 0) break;
       x = code[reg.P++];
       switch (x.op) {
         case OPR: operator(x);
           break;
         case LDA: push(display(x.lev)+x.val);
           break;
         case LDV:
    push(mem[display(x.lev)+x.val]);
    if (mem[display(x.lev)+x.val]) reg.cc = 1;
           break;
         case STV: mem[display(x.lev)+x.val] = pop();
           break;
         case LDI:
           push(x.val);
    if (x.val) reg.cc = 1;
           break;
         case LDX: { int t1;
           t1 = pop();
           push(mem[t1]);
           } break;
         case STX: { int t1,t2;
           t1 = pop(); t2 = pop();
           mem[t1] = t2;
           } break;
         case LDS: case STS:
           movestr(x);
           break;
         case JMPF:
    if (reg.cc) break;
         case JMP:
           reg.P = x.val;
           break;
         case INCT:
           reg.T += x.val;
           break;
         case DECT:
           reg.T -= x.val;
           break;
         case ENTER: { int tmp;
           tmp = reg.T; reg.T += 4;
           mem[tmp] = reg.V;
           mem[tmp+1] = reg.R;
           mem[tmp+2] = reg.D;
           mem[tmp+3] = reg.S;
           reg.D = reg.S = reg.B;
           reg.B = reg.T;
    }
           break;
         case LEAVE: { int tmp;
           reg.T = reg.B; reg.B = reg.S;
    reg.T -= 4; tmp = reg.T;
           reg.V = mem[tmp] ;
           reg.R = mem[tmp+1];
           reg.D = mem[tmp+2];
           reg.S = mem[tmp+3];
           }
           break;
         case RET:
    reg.P = reg.R;
           break;
         default:
           printf("unsupported opcode:%d\n",x.op);
           break;
       }
       dump_mem();
   }
   printf("\nEnd insn=%d\n", insn_cnt);
}

canonical_original_code:
void interp() {
   struct insn x;
   int insn_cnt = 0;
   init_reg();
   init_mem();
   printf("Start\n");
   while (reg.P > 0 && ++insn_cnt < 10000) {
       dump_reg();
       if (reg.P == 0) break;
       x = code[reg.P++];
       switch (x.op) {
         case OPR: operator(x);
           break;
         case LDA: push(display(x.lev)+x.val);
           break;
         case LDV:
    push(mem[display(x.lev)+x.val]);
    if (mem[display(x.lev)+x.val]) reg.cc = 1;
           break;
         case STV: mem[display(x.lev)+x.val] = pop();
           break;
         case LDI:
           push(x.val);
    if (x.val) reg.cc = 1;
           break;
         case LDX: { int t1;
           t1 = pop();
           push(mem[t1]);
           } break;
         case STX: { int t1; int t2;
           t1 = pop(); t2 = pop();
           mem[t1] = t2;
           } break;
         case LDS: case STS:
           movestr(x);
           break;
         case JMPF:
    if (reg.cc) break;
         case JMP:
           reg.P = x.val;
           break;
         case INCT:
           reg.T += x.val;
           break;
         case DECT:
           reg.T -= x.val;
           break;
         case ENTER: { int tmp;
           tmp = reg.T; reg.T += 4;
           mem[tmp] = reg.V;
           mem[tmp+1] = reg.R;
           mem[tmp+2] = reg.D;
           mem[tmp+3] = reg.S;
           reg.D = reg.S = reg.B;
           reg.B = reg.T;
    }
           break;
         case LEAVE: { int tmp;
           reg.T = reg.B; reg.B = reg.S;
    reg.T -= 4; tmp = reg.T;
           reg.V = mem[tmp] ;
           reg.R = mem[tmp+1];
           reg.D = mem[tmp+2];
           reg.S = mem[tmp+3];
           }
           break;
         case RET:
    reg.P = reg.R;
           break;
         default:
           printf("unsupported opcode:%d\n",x.op);
           break;
       }
       dump_mem();
   }
   printf("\nEnd insn=%d\n", insn_cnt);
}


decompiled_code:
void *init_LOC()
{
void *result; // rax

loctab = (__int64)malloc(0x2EE0uLL);
result = memset((void *)loctab, 0, 0x2EE0uLL);
loccnt = 0;
return result;
}

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

loctab = (__int64)malloc(0x2EE0uLL);
result = memset((void *)loctab, 0, 0x2EE0uLL);
loccnt = 0;
return result;
}

original_code:
void init_LOC() {
    int l;
    loctab = (locentry*)malloc(l = 1000 * sizeof(locentry));
    bzero(loctab, l);
    loccnt = 0;
}

canonical_original_code:
void init_LOC() {
    int l;
    loctab = (struct locentry *)malloc(l = 1000 * sizeof(locentry));
    bzero(loctab, l);
    loccnt = 0;
}

user_defined_types: struct locentry { int depth; int offset; int size; }


decompiled_code:
__int64 new_loc()
{
return (unsigned int)++loccnt;
}

canonical_decompiled_code:
__int64 func1()
{
return (unsigned int)++loccnt;
}

original_code:
int new_loc() {
    return ++loccnt;
}

canonical_original_code:
int new_loc() {
    return ++loccnt;
}


decompiled_code:
void __fastcall get_loc_entry(int a1, _DWORD *a2, _DWORD *a3, _DWORD *a4)
{
_DWORD *v4; // rax

if ( a1 )
{
v4 = (_DWORD *)(loctab + 12LL * a1);
if ( a2 )
*a2 = *v4;
if ( a3 )
*a3 = v4[1];
if ( a4 )
*a4 = v4[2];
}
}

canonical_decompiled_code:
void __fastcall func2(int a1, _DWORD *a2, _DWORD *a3, _DWORD *a4)
{
_DWORD *v4; // rax

if ( a1 )
{
v4 = (_DWORD *)(loctab + 12LL * a1);
if ( a2 )
*a2 = *v4;
if ( a3 )
*a3 = v4[1];
if ( a4 )
*a4 = v4[2];
}
}

original_code:
void get_loc_entry(int e, int *dep, int *off, int *size) {
    locentry *ep;
    if (e==0) return;
    ep = &loctab[e];
    if (dep) *dep = ep->depth;
    if (off) *off = ep->offset;
    if (size) *size = ep->size;
}

canonical_original_code:
void get_loc_entry(int e, int *dep, int *off, int *size) {
    struct locentry *ep;
    if (e==0) return;
    ep = &loctab[e];
    if (dep) *dep = ep->depth;
    if (off) *off = ep->offset;
    if (size) *size = ep->size;
}

variable_types:
dep
int *

variable_types:
off
int *

variable_types:
size
int *

variable_types: struct locentry { int depth; int offset; int size; } *


decompiled_code:
__int64 __fastcall lookup_loc_entry(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // r9
_DWORD *v4; // rax

v3 = (unsigned int)a3;
if ( loccnt <= 0 )
{
LABEL_8:
LODWORD(a3) = new_loc(a1, a2, a3, (unsigned int)loccnt, (unsigned int)a2, v3);
}
else
{
v4 = (_DWORD *)(loctab + 12);
LODWORD(a3) = 1;
while ( *v4 != (_DWORD)a1 || v4[1] != (_DWORD)a2 || v4[2] != (_DWORD)v3 )
{
a3 = (unsigned int)(a3 + 1);
v4 += 3;
if ( (int)a3 > loccnt )
goto LABEL_8;
}
}
return (unsigned int)a3;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // r9
_DWORD *v4; // rax

v3 = (unsigned int)a3;
if ( loccnt <= 0 )
{
LABEL_8:
LODWORD(a3) = func1(a1, a2, a3, (unsigned int)loccnt, (unsigned int)a2, v3);
}
else
{
v4 = (_DWORD *)(loctab + 12);
LODWORD(a3) = 1;
while ( *v4 != (_DWORD)a1 || v4[1] != (_DWORD)a2 || v4[2] != (_DWORD)v3 )
{
a3 = (unsigned int)(a3 + 1);
v4 += 3;
if ( (int)a3 > loccnt )
goto LABEL_8;
}
}
return (unsigned int)a3;
}

original_code:
int lookup_loc_entry(int dep, int off, int size) {
    int e;
    for (e=1;e<=loccnt;e++) {
        locentry *ep = &loctab[e];
        if (ep->depth == dep && ep->offset == off && ep->size == size)
            return e;
    }
    return new_loc();
}

canonical_original_code:
int lookup_loc_entry(int dep, int off, int size) {
    int e;
    for (e=1;e<=loccnt;e++) {
        struct locentry *ep = &loctab[e];
        if (ep->depth == dep && ep->offset == off && ep->size == size)
            return e;
    }
    return new_loc();
}

variable_types: dep int

variable_types: off int

variable_types: size int


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

result = a1;
if ( a1 )
result = *(unsigned int *)(loctab + 12LL * (int)a1);
return result;
}

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

result = a1;
if ( a1 )
result = *(unsigned int *)(loctab + 12LL * (int)a1);
return result;
}

original_code:
int getdepth_LOC(int e) {
    locentry *ep;
    if (e==0) return 0;
    ep = &loctab[e];
    return ep->depth;
}

canonical_original_code:
int getdepth_LOC(int e) {
    struct locentry *ep;
    if (e==0) return 0;
    ep = &loctab[e];
    return ep->depth;
}


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

result = a1;
if ( a1 )
result = *(unsigned int *)(loctab + 12LL * (int)a1 + 4);
return result;
}

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

result = a1;
if ( a1 )
result = *(unsigned int *)(loctab + 12LL * (int)a1 + 4);
return result;
}

original_code:
int getoffset_LOC(int e) {
    locentry *ep;
    if (e==0) return 0;
    ep = &loctab[e];
    return ep->offset;
}

canonical_original_code:
int getoffset_LOC(int e) {
    struct locentry *ep;
    if (e==0) return 0;
    ep = &loctab[e];
    return ep->offset;
}


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

result = a1;
if ( a1 )
result = *(unsigned int *)(loctab + 12LL * (int)a1 + 8);
return result;
}

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

result = a1;
if ( a1 )
result = *(unsigned int *)(loctab + 12LL * (int)a1 + 8);
return result;
}

original_code:
int getsize_LOC(int e) {
    locentry *ep;
    if (e==0) return 0;
    ep = &loctab[e];
    return ep->size;
}

canonical_original_code:
int getsize_LOC(int e) {
    struct locentry *ep;
    if (e==0) return 0;
    ep = &loctab[e];
    return ep->size;
}


getlineno

decompiled_code:
__int64 getlineno()
{
return *(unsigned int *)line;
}

canonical_decompiled_code:
__int64 func0()
{
return *(unsigned int *)line;
}

original_code: int getlineno() { return line.no; }

canonical_original_code: int getlineno() { return line.no; }


getlinepos

decompiled_code:
__int64 getlinepos()
{
return line[1];
}

canonical_decompiled_code:
__int64 func1()
{
return line[1];
}

original_code: int getlinepos() { return line.pos; }

canonical_original_code: int getlinepos() { return line.pos; }


decompiled_code:
void clear_lexeme()
{
*((_DWORD *)&tok + 65) = 0;
}

original_code: void clear_lexeme() { tok.index = 0; }

canonical_original_code: void clear_lexeme() { tok.index = 0; }


decompiled_code:
void delete_prev()
{
--*((_DWORD *)&tok + 65);
}

original_code: void delete_prev() { --tok.index; }

canonical_original_code: void delete_prev() { --tok.index; }


outch

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

LODWORD(result) = *(_DWORD *)&tok[260];
*(_DWORD *)&tok[260] = result + 1;
result = (int)result;
tok[(int)result + 4] = a1;
return result;
}

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

LODWORD(result) = *(_DWORD *)&tok[260];
*(_DWORD *)&tok[260] = result + 1;
result = (int)result;
tok[(int)result + 4] = a1;
return result;
}

original_code: void outch(int ch) { tok.text[tok.index++] = ch; }

variable_types: ch int


prevch

decompiled_code:
__int64 prevch()
{
int v0; // eax
unsigned int v1; // edx

v0 = *(_DWORD *)&tok[260];
v1 = 10;
if ( v0 > 0 )
v1 = tok[v0 + 3];
return v1;
}

canonical_decompiled_code:
__int64 func5()
{
int v0; // eax
unsigned int v1; // edx

v0 = *(_DWORD *)&tok[260];
v1 = 10;
if ( v0 > 0 )
v1 = tok[v0 + 3];
return v1;
}

original_code: int prevch() { return (tok.index>0) ? (tok.text[tok.index-1]) : '\n'; }


decompiled_code:
unsigned __int64 __fastcall insert_STR(const char *a1)
{
int v2; // eax
unsigned __int64 v3; // rcx
unsigned __int64 v4; // rdi
__int64 v5; // r8
__int64 i; // rax
int v7; // edx

v2 = strlen(a1);
v3 = s_ptr;
if ( v2 <= 0 )
{
v7 = 0;
}
else
{
v4 = s_limit;
v5 = (unsigned int)(v2 - 1);
for ( i = 0LL; ; ++i )
{
v7 = i;
if ( v4 <= v3 )
break;
*(_BYTE *)(v3 + i) = a1[i];
v7 = i + 1;
if ( i == v5 )
break;
}
}
*(_BYTE *)(v3 + v7) = 0;
s_ptr = v3 + v7 + 1;
return v3;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func6(const char *a1)
{
int v2; // eax
unsigned __int64 v3; // rcx
unsigned __int64 v4; // rdi
__int64 v5; // r8
__int64 i; // rax
int v7; // edx

v2 = strlen(a1);
v3 = s_ptr;
if ( v2 <= 0 )
{
v7 = 0;
}
else
{
v4 = s_limit;
v5 = (unsigned int)(v2 - 1);
for ( i = 0LL; ; ++i )
{
v7 = i;
if ( v4 <= v3 )
break;
*(_BYTE *)(v3 + i) = a1[i];
v7 = i + 1;
if ( i == v5 )
break;
}
}
*(_BYTE *)(v3 + v7) = 0;
s_ptr = v3 + v7 + 1;
return v3;
}

original_code:
char *insert_STR(char *s) {
    int i;
    int len = strlen(s);
    char *p;
    for (p=s_ptr, i=0; i<len && p<s_limit; i++)
        p[i] = *s++;
    p[i++] = 0;
    s_ptr += i;
    return p;
}

variable_types:
s
char *

variable_types: len int

variable_types:
p
char *

return_type: char *


initline

decompiled_code:
_BYTE *initline()
{
_BYTE *result; // rax

line[1] = 0;
line[0] = 0;
line[2] = 0;
LOBYTE(line[3]) = 10;
result = malloc(0x2710uLL);
s_buf = (__int64)result;
s_ptr = (__int64)result;
s_limit = (__int64)(result + 9999);
*result = 0;
return result;
}

canonical_decompiled_code:
_BYTE *func8()
{
_BYTE *result; // rax

line[1] = 0;
line[0] = 0;
line[2] = 0;
LOBYTE(line[3]) = 10;
result = malloc(0x2710uLL);
s_buf = (__int64)result;
s_ptr = (__int64)result;
s_limit = (__int64)(result + 9999);
*result = 0;
return result;
}

original_code:
void initline() {
    line.pos = 0;
    line.no = 0;
    line.backed = 0;
    line.buf[line.pos] = '\n';
    s_ptr = s_buf = malloc(10000);
    s_limit = s_buf + 10000 -1;
    *s_ptr = 0;
}


nextch

decompiled_code:
__int64 nextch()
{
unsigned int v0; // ebx
signed int v2; // eax

v0 = line[2];
if ( v0 )
{
line[2] = 0;
}
else
{
v2 = line[1];
line[1] = v2 + 1;
v0 = *((char *)&line[3] + v2);
if ( v0 == 10 )
{
line[1] = 0;
if ( fgets((char *)(unsigned int)((_DWORD)line + 12), 1000, stdin) )
{
++line[0];
}
else
{
LOBYTE(line[3]) = -1;
v0 = -1;
}
}
}
return v0;
}

canonical_decompiled_code:
__int64 func9()
{
unsigned int v0; // ebx
signed int v2; // eax

v0 = line[2];
if ( v0 )
{
line[2] = 0;
}
else
{
v2 = line[1];
line[1] = v2 + 1;
v0 = *((char *)&line[3] + v2);
if ( v0 == 10 )
{
line[1] = 0;
if ( fgets((char *)(unsigned int)((_DWORD)line + 12), 1000, stdin) )
{
++line[0];
}
else
{
LOBYTE(line[3]) = -1;
v0 = -1;
}
}
}
return v0;
}

original_code:
int nextch() {
    Line *p = &line;
    char *r;
    int ch;
    if ((ch = p->backed) != 0) {
            p->backed = 0;
    } else {
     ch = p->buf[p->pos++];
     if (ch == '\n') {
  p->pos = 0;
  r = fgets(p->buf,1000,stdin);
  if (r == 0) { p->buf[0] = (-1); return (-1); }
  ++p->no;
     }
    }
    return ch;
}

canonical_original_code:
int nextch() {
    struct Line *p = &line;
    char *r;
    int ch;
    if ((ch = p->backed) != 0) {
            p->backed = 0;
    } else {
     ch = p->buf[p->pos++];
     if (ch == '\n') {
  p->pos = 0;
  r = fgets(p->buf,1000,stdin);
  if (r == 0) { p->buf[0] = (-1); return (-1); }
  ++p->no;
     }
    }
    return ch;
}

variable_types: struct Line { int no; int pos; int backed; char buf[1000]; } *

variable_types:
r
char *


backch

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

result = line[1];
if ( (int)result <= 0 )
{
line[2] = a1;
}
else
{
LODWORD(result) = result - 1;
line[1] = result;
result = (int)result;
*((_BYTE *)&line[3] + (int)result) = a1;
line[2] = 0;
}
return result;
}

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

result = line[1];
if ( (int)result <= 0 )
{
line[2] = a1;
}
else
{
LODWORD(result) = result - 1;
line[1] = result;
result = (int)result;
*((_BYTE *)&line[3] + (int)result) = a1;
line[2] = 0;
}
return result;
}

original_code:
void backch(int ch) {
    Line *p = &line;
    if (p->pos > 0) {
       p->buf[--p->pos] = ch;
       p->backed = 0;
    } else {
       p->backed = ch;
    }
}

canonical_original_code:
void backch(int ch) {
    struct Line *p = &line;
    if (p->pos > 0) {
       p->buf[--p->pos] = ch;
       p->backed = 0;
    } else {
       p->backed = ch;
    }
}

user_defined_types: struct Line { int no; int pos; int backed; char buf[1000]; }


decompiled_code:
int __fastcall parse_error(const char *a1)
{
if ( line[0] != prev_error_line_no )
{
printf("\n%4d: %s", line[0], (const char *)(unsigned int)((_DWORD)line + 12));
prev_error_line_no = line[0];
}
return printf("ERROR: %s at col %d\n", a1, line[1]);
}

canonical_decompiled_code:
int __fastcall func11(const char *a1)
{
if ( line[0] != prev_error_line_no )
{
printf("\n%4d: %s", line[0], (const char *)(unsigned int)((_DWORD)line + 12));
prev_error_line_no = line[0];
}
return printf("ERROR: %s at col %d\n", a1, line[1]);
}

original_code:
void parse_error(const char *s) {
    if (line.no != prev_error_line_no) {
        printf("\n%4d: %s", line.no, line.buf);
        prev_error_line_no = line.no;
    }
    printf("ERROR: %s at col %d\n", s, line.pos );
}

canonical_original_code:
void parse_error(char *s) {
    if (line.no != prev_error_line_no) {
        printf("\n%4d: %s", line.no, line.buf);
        prev_error_line_no = line.no;
    }
    printf("ERROR: %s at col %d\n", s, line.pos );
}


codeof

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

result = a1;
if ( a1 - 32 <= 0x5F )
result = (unsigned int)scancode[a1 - 32];
return result;
}

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

result = a1;
if ( a1 - 32 <= 0x5F )
result = (unsigned int)scancode[a1 - 32];
return result;
}

original_code:
int codeof(int ch) {
    if (ch < 0x20 || ch > 0x7f) return ch;
    return scancode[ch - 0x20];
}


kwlookup

decompiled_code:
char *__fastcall kwlookup(char *s2)
{
const char *v2; // rdi
const char **v3; // rbx

v2 = kwtable;
if ( !kwtable )
return kwtable;
v3 = (const char **)&kwtable;
while ( strcmp(v2, s2) )
{
v3 += 2;
v2 = *v3;
if ( !*v3 )
return 0LL;
}
return (char *)v3;
}

canonical_decompiled_code:
char *__fastcall func13(char *s2)
{
const char *v2; // rdi
const char **v3; // rbx

v2 = kwtable;
if ( !kwtable )
return kwtable;
v3 = (const char **)&kwtable;
while ( strcmp(v2, s2) )
{
v3 += 2;
v2 = *v3;
if ( !*v3 )
return 0LL;
}
return (char *)v3;
}

original_code:
kwentry *kwlookup(const char *t) {
    kwentry *e;
    for (e=kwtable;e->text;e++)
       if (strcmp(e->text,t)==0) return e;
    return 0;
}

canonical_original_code:
struct kwentry *kwlookup(char *t) {
    struct kwentry *e;
    for (e=kwtable;e->text;e++)
       if (strcmp(e->text,t)==0) return e;
    return 0;
}

variable_types:
t
char *

variable_types: struct kwentry { char *text; int sym; } *


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

if ( a1 > 62 )
{
result = 8LL;
if ( a1 != 157 )
{
if ( a1 <= 157 )
{
result = 9LL;
if ( a1 != 129 )
{
result = 0LL;
if ( a1 == 156 )
result = 11LL;
}
}
else
{
result = 0LL;
if ( a1 == 158 )
result = 10LL;
}
}
}
else
{
result = 0LL;
if ( a1 > 36 )
{
switch ( a1 )
{
case '%':
result = 6LL;
break;
case '*':
result = 4LL;
break;
case '+':
result = 2LL;
break;
case '-':
result = 3LL;
break;
case '/':
result = 5LL;
break;
case '<':
result = 13LL;
break;
case '>':
result = 12LL;
break;
default:
result = 0LL;
break;
}
}
}
return result;
}

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

if ( a1 > 62 )
{
result = 8LL;
if ( a1 != 157 )
{
if ( a1 <= 157 )
{
result = 9LL;
if ( a1 != 129 )
{
result = 0LL;
if ( a1 == 156 )
result = 11LL;
}
}
else
{
result = 0LL;
if ( a1 == 158 )
result = 10LL;
}
}
}
else
{
result = 0LL;
if ( a1 > 36 )
{
switch ( a1 )
{
case '%':
result = 6LL;
break;
case '*':
result = 4LL;
break;
case '+':
result = 2LL;
break;
case '-':
result = 3LL;
break;
case '/':
result = 5LL;
break;
case '<':
result = 13LL;
break;
case '>':
result = 12LL;
break;
default:
result = 0LL;
break;
}
}
}
return result;
}

original_code:
static int get_op_code_val(int tokenval){
    int optype = 0;
    switch(tokenval){
 case '+':
     optype = 2;
     break;
 case '-':
     optype = 3;
     break;
 case '*':
     optype = 4;
     break;
 case '/':
     optype = 5;
     break;
 case '%':
     optype = 6;
     break;
 case (('=')+0x60):
     optype = 8;
     break;
 case (('!')+0x60):
     optype = 9;
     break;
 case (('>')+0x60):
     optype = 10;
     break;
 case (('<')+0x60):
     optype = 11;
     break;
 case ('>'):
     optype = 12;
     break;
 case ('<'):
     optype = 13;
     break;
    }
    return optype;
}

variable_types: tokenval int

variable_types: optype int


decompiled_code:
__int64 __fastcall sizeof_local(__int64 a1)
{
unsigned int v2; // [rsp+8h] [rbp-10h] BYREF
char v3[12]; // [rsp+Ch] [rbp-Ch] BYREF

get_sons(a1, v3, &v2, 0LL, 0LL);
return get_sizeoftype(v2);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
unsigned int v2; // [rsp+8h] [rbp-10h] BYREF
char v3[12]; // [rsp+Ch] [rbp-Ch] BYREF

get_sons(a1, v3, &v2, 0LL, 0LL);
return get_sizeoftype(v2);
}

original_code:
static int sizeof_local(AST a) {
    int sz;
    AST a1,a2;
    get_sons(a, &a1, &a2, 0, 0);
    sz = get_sizeoftype(a2);
    return sz;
}

canonical_original_code:
static int sizeof_local(int a) {
    int sz;
    int a1; int a2;
    get_sons(a, &a1, &a2, 0, 0);
    sz = get_sizeoftype(a2);
    return sz;
}

variable_types: a int

variable_types: sz int


decompiled_code:
__int64 __fastcall sizeof_locals(unsigned int a1)
{
unsigned int v2; // ebp
int v3; // eax
unsigned int v5; // [rsp+8h] [rbp-20h] BYREF
unsigned int v6[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = 0;
while ( !(unsigned int)isleaf(a1) )
{
get_sons(a1, v6, &v5, 0LL, 0LL);
v3 = nodetype(v6[0]);
if ( v3 == 1027 )
{
v2 += sizeof_locals(v6[0]);
}
else if ( v3 == 1028 )
{
v2 += sizeof_local(v6[0]);
}
else
{
++v2;
}
a1 = v5;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int a1)
{
unsigned int v2; // ebp
int v3; // eax
unsigned int v5; // [rsp+8h] [rbp-20h] BYREF
unsigned int v6[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = 0;
while ( !(unsigned int)isleaf(a1) )
{
get_sons(a1, v6, &v5, 0LL, 0LL);
v3 = nodetype(v6[0]);
if ( v3 == 1027 )
{
v2 += func2(v6[0]);
}
else if ( v3 == 1028 )
{
v2 += func1(v6[0]);
}
else
{
++v2;
}
a1 = v5;
}
return v2;
}

original_code:
static int sizeof_locals(AST a) {
    int sz = 0;
    AST a1,a2;
    while (!isleaf(a)) {
 get_sons(a, &a1, &a2, 0, 0);
 switch (nodetype(a1)) {
     case nVARDECL : sz += sizeof_local(a1); break;
     case nVARDECLS: sz += sizeof_locals(a1); break;
     default: sz += 1; break;
 }
 a = a2;
    }
    return sz;
}

canonical_original_code:
static int sizeof_locals(int a) {
    int sz = 0;
    int a1; int a2;
    while (!isleaf(a)) {
 get_sons(a, &a1, &a2, 0, 0);
 switch (nodetype(a1)) {
     case nVARDECL : sz += sizeof_local(a1); break;
     case nVARDECLS: sz += sizeof_locals(a1); break;
     default: sz += 1; break;
 }
 a = a2;
    }
    return sz;
}


decompiled_code:
__int64 get_op_type()
{
return typeof_AST();
}

canonical_decompiled_code:
__int64 func3()
{
return typeof_AST();
}

original_code:
int get_op_type(AST a){
    return typeof_AST(a);
}

canonical_original_code:
int get_op_type(int a){
    return typeof_AST(a);
}


hexval

decompiled_code:
__int64 __fastcall hexval(int a1)
{
__int64 result; // rax
unsigned int v2; // eax
unsigned int v3; // edi
bool v4; // cf

result = (unsigned int)(a1 - 48);
if ( (unsigned int)result > 9 )
{
if ( (unsigned int)(a1 - 65) <= 5 )
{
result = (unsigned int)(a1 - 55);
}
else
{
v2 = a1 - 97;
v3 = a1 - 87;
v4 = v2 < 6;
result = 0xFFFFFFFFLL;
if ( v4 )
result = v3;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
__int64 result; // rax
unsigned int v2; // eax
unsigned int v3; // edi
bool v4; // cf

result = (unsigned int)(a1 - 48);
if ( (unsigned int)result > 9 )
{
if ( (unsigned int)(a1 - 65) <= 5 )
{
result = (unsigned int)(a1 - 55);
}
else
{
v2 = a1 - 97;
v3 = a1 - 87;
v4 = v2 < 6;
result = 0xFFFFFFFFLL;
if ( v4 )
result = v3;
}
}
return result;
}

original_code:
static int hexval(int ch) {
    if (ch >= '0' && ch <= '9') return ch - '0';
    if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10;
    if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10;
    return ERROR;
}


decompiled_code:
_DWORD *gettoken0()
{
unsigned int v0; // eax
unsigned int v1; // ebx
_DWORD *result; // rax

tok[65] = 0;
v0 = nextch();
if ( v0 == -1 )
return 0LL;
v1 = v0;
switch ( (unsigned int)codeof(v0) )
{
case '!':
case '%':
case '&':
case '*':
case '+':
case '-':
case '/':
case '<':
case '=':
case '>':
case '|':
result = op(v1);
break;
case '"':
result = slit();
break;
case '\'':
result = clit();
break;
case '0':
case '9':
result = lit(v1);
break;
case '@':
tok[0] = 32;
result = tok;
break;
case 'Z':
result = id(v1);
break;
default:
tok[0] = v1;
result = tok;
break;
}
return result;
}

canonical_decompiled_code:
_DWORD *func4()
{
unsigned int v0; // eax
unsigned int v1; // ebx
_DWORD *result; // rax

tok[65] = 0;
v0 = nextch();
if ( v0 == -1 )
return 0LL;
v1 = v0;
switch ( (unsigned int)codeof(v0) )
{
case '!':
case '%':
case '&':
case '*':
case '+':
case '-':
case '/':
case '<':
case '=':
case '>':
case '|':
result = op(v1);
break;
case '"':
result = func3();
break;
case '\'':
result = func2();
break;
case '0':
case '9':
result = lit(v1);
break;
case '@':
tok[0] = 32;
result = tok;
break;
case 'Z':
result = id(v1);
break;
default:
tok[0] = v1;
result = tok;
break;
}
return result;
}

original_code:
static Token *gettoken0() {
    int ch;
    Token *t = &tok;
    t->index = 0;
    ch = nextch();
    if (ch == (-1)) { return (Token*)0; }
    switch (codeof(ch)) {
        case '+': case '-': case '*': case'/': case '%':
        case '<': case '>': case '=': case '!': case '&' : case '|':
            t = op(ch); break;
        case '\'':
            t = clit(ch); break;
        case '\"':
            t = slit(ch); break;
        case 'Z':
            t = id(ch); break;
        case '0': case '9':
            t = lit(ch); break;
        case '@':
            t->sym = ' '; break;
        default:
            t->sym = ch; break;
    }
    return t;
}

canonical_original_code:
static struct Token *gettoken0() {
    int ch;
    struct Token *t = &tok;
    t->index = 0;
    ch = nextch();
    if (ch == (-1)) { return (struct Token *)0; }
    switch (codeof(ch)) {
        case '+': case '-': case '*': case'/': case '%':
        case '<': case '>': case '=': case '!': case '&' : case '|':
            t = op(ch); break;
        case '\'':
            t = clit(ch); break;
        case '\"':
            t = slit(ch); break;
        case 'Z':
            t = id(ch); break;
        case '0': case '9':
            t = lit(ch); break;
        case '@':
            t->sym = ' '; break;
        default:
            t->sym = ch; break;
    }
    return t;
}

variable_types: struct Token { enum tokentype { ID=256, ILIT=257, CLIT=258, FLIT=259, SLIT=260, ARIOP=261, RELOP=262, LOGOP=263, ASNOP=264, CMT=265, tCLASS=266, tPRIVATE=267, tPUBLIC=268, tSTATIC=269, tCONST=270, tIF=271, tELSE=272, tSWITCH=273, tCASE=274, tDEFAULT=275, tBREAK=276, tCONTINUE=277, tWHILE=278, tDO=279, tFOR=280, tCALL=281, tRETURN=282, tFALSE=283, tTRUE=284, tEND=285, ERROR=-1 } sym; char text[-1]; int index; int ival; char *sval; } *


isspace

decompiled_code:
__int64 __fastcall isspace(unsigned int a1)
{
char v1; // al

v1 = 1;
if ( a1 <= 0x20 )
v1 = ((0x100002600uLL >> a1) ^ 1) & 1;
return (unsigned __int8)v1 ^ 1u;
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int a1)
{
char v1; // al

v1 = 1;
if ( a1 <= 0x20 )
v1 = ((0x100002600uLL >> a1) ^ 1) & 1;
return (unsigned __int8)v1 ^ 1u;
}

original_code:
inline int isspace(int ch) {
   return (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n');
}


gettoken

decompiled_code:
unsigned int *gettoken()
{
unsigned int *v0; // rax
unsigned int *v1; // rbx
unsigned int v2; // ebp
int v3; // eax
__int64 v5; // rax

while ( 1 )
{
v0 = gettoken0();
v1 = v0;
if ( !v0 )
break;
v2 = *v0;
v3 = isspace(*v0);
if ( v2 != 265 && !v3 )
{
if ( v2 == 256 )
{
v5 = kwlookup(v1 + 1);
if ( v5 )
*v1 = *(_DWORD *)(v5 + 8);
}
return v1;
}
}
return v1;
}

canonical_decompiled_code:
unsigned int *func6()
{
unsigned int *v0; // rax
unsigned int *v1; // rbx
unsigned int v2; // ebp
int v3; // eax
__int64 v5; // rax

while ( 1 )
{
v0 = func4();
v1 = v0;
if ( !v0 )
break;
v2 = *v0;
v3 = func5(*v0);
if ( v2 != 265 && !v3 )
{
if ( v2 == 256 )
{
v5 = kwlookup(v1 + 1);
if ( v5 )
*v1 = *(_DWORD *)(v5 + 8);
}
return v1;
}
}
return v1;
}

original_code:
Token *gettoken() {
    Token *t;
    do {
      t = gettoken0();
    } while (t && (isspace(t->sym) || t->sym == CMT));
    if (t && t->sym == ID) {
        kwentry *e = kwlookup(t->text);
        if (e) t->sym = e->sym;
    }
    return t;
}

canonical_original_code:
struct Token *gettoken() {
    struct Token *t;
    do {
      t = gettoken0();
    } while (t && (isspace(t->sym) || t->sym == CMT));
    if (t && t->sym == ID) {
        struct kwentry *e = kwlookup(t->text);
        if (e) t->sym = e->sym;
    }
    return t;
}

return_type: struct Token { enum tokentype { ID=256, ILIT=257, CLIT=258, FLIT=259, SLIT=260, ARIOP=261, RELOP=262, LOGOP=263, ASNOP=264, CMT=265, tCLASS=266, tPRIVATE=267, tPUBLIC=268, tSTATIC=269, tCONST=270, tIF=271, tELSE=272, tSWITCH=273, tCASE=274, tDEFAULT=275, tBREAK=276, tCONTINUE=277, tWHILE=278, tDO=279, tFOR=280, tCALL=281, tRETURN=282, tFALSE=283, tTRUE=284, tEND=285, ERROR=-1 } sym; char text[-1]; int index; int ival; char *sval; } *


skiptoken

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

result = (unsigned __int64)tok;
do
{
result = *(unsigned int *)result;
if ( (_DWORD)result == a1 )
break;
if ( (_DWORD)result == 10 )
break;
result = (unsigned __int64)gettoken0();
}
while ( result );
return result;
}

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

result = (unsigned __int64)tok;
do
{
result = *(unsigned int *)result;
if ( (_DWORD)result == a1 )
break;
if ( (_DWORD)result == 10 )
break;
result = (unsigned __int64)func4();
}
while ( result );
return result;
}

original_code:
void skiptoken(int sym) {
    Token *t=&tok;
    while (t && t->sym != '\n') {
       if (t->sym == sym) break;
       t = gettoken0();
    }
}

canonical_original_code:
void skiptoken(int sym) {
    struct Token *t = &tok;
    while (t && t->sym != '\n') {
       if (t->sym == sym) break;
       t = gettoken0();
    }
}

variable_types: sym int


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

result = (unsigned __int64)tok;
do
{
result = *(unsigned int *)result;
if ( (_DWORD)result == a2 || (_DWORD)result == 10 )
break;
if ( (_DWORD)result == a1 )
break;
result = (unsigned __int64)gettoken0();
}
while ( result );
return result;
}

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

result = (unsigned __int64)tok;
do
{
result = *(unsigned int *)result;
if ( (_DWORD)result == a2 || (_DWORD)result == 10 )
break;
if ( (_DWORD)result == a1 )
break;
result = (unsigned __int64)func4();
}
while ( result );
return result;
}

original_code:
void skiptoken2(int sym1,int sym2) {
    Token *t=&tok;
    while (t && t->sym != '\n') {
       if (t->sym == sym1) break;
       if (t->sym == sym2) break;
       t = gettoken0();
    }
}

canonical_original_code:
void skiptoken2(int sym1, int sym2) {
    struct Token *t = &tok;
    while (t && t->sym != '\n') {
       if (t->sym == sym1) break;
       if (t->sym == sym2) break;
       t = gettoken0();
    }
}


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

result = (unsigned __int64)tok;
do
{
result = *(unsigned int *)result;
if ( (_DWORD)result == a2 || (_DWORD)result == a3 || (_DWORD)result == 10 )
break;
if ( (_DWORD)result == a1 )
break;
result = (unsigned __int64)gettoken0();
}
while ( result );
return result;
}

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

result = (unsigned __int64)tok;
do
{
result = *(unsigned int *)result;
if ( (_DWORD)result == a2 || (_DWORD)result == a3 || (_DWORD)result == 10 )
break;
if ( (_DWORD)result == a1 )
break;
result = (unsigned __int64)func4();
}
while ( result );
return result;
}

original_code:
void skiptoken3(int sym1,int sym2,int sym3) {
    Token *t=&tok;
    while (t && t->sym != '\n') {
       if (t->sym == sym1) break;
       if (t->sym == sym2) break;
       if (t->sym == sym3) break;
       t = gettoken0();
    }
}

canonical_original_code:
void skiptoken3(int sym1, int sym2, int sym3) {
    struct Token *t = &tok;
    while (t && t->sym != '\n') {
       if (t->sym == sym1) break;
       if (t->sym == sym2) break;
       if (t->sym == sym3) break;
       t = gettoken0();
    }
}


canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
unsigned int v2; // [rsp+8h] [rbp-10h] BYREF
char v3[12]; // [rsp+Ch] [rbp-Ch] BYREF

get_sons(a1, v3, &v2, 0LL, 0LL);
return get_sizeoftype(v2);
}


canonical_decompiled_code:
__int64 __fastcall func3(unsigned int a1)
{
unsigned int v2; // ebp
int v3; // eax
unsigned int v5; // [rsp+8h] [rbp-20h] BYREF
unsigned int v6[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = 0;
while ( !(unsigned int)isleaf(a1) )
{
get_sons(a1, v6, &v5, 0LL, 0LL);
v3 = nodetype(v6[0]);
if ( v3 == 1027 )
{
v2 += func3(v6[0]);
}
else if ( v3 == 1028 )
{
v2 += func2(v6[0]);
}
else
{
++v2;
}
a1 = v5;
}
return v2;
}


decompiled_code:
__int64 __fastcall cgen_funcdecl(__int64 a1)
{
unsigned int v1; // ebp
unsigned int v2; // ebx
unsigned int v3; // eax
unsigned int v4; // ebp
unsigned int v6; // [rsp+0h] [rbp-28h] BYREF
char v7[4]; // [rsp+4h] [rbp-24h] BYREF
char v8[4]; // [rsp+8h] [rbp-20h] BYREF
unsigned int v9[7]; // [rsp+Ch] [rbp-1Ch] BYREF

get_sons(a1, v9, v8, v7, &v6);
v1 = new_label();
v2 = new_label();
v3 = get_ival(v9[0]);
setval_SYM(v3, v1);
gen_label(v1);
incr_depth();
v4 = cgen_block(v6, v2);
decr_depth();
gen_code(0LL, v2, 0LL);
gen_code(13LL, 0LL, 0LL);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1)
{
unsigned int v1; // ebp
unsigned int v2; // ebx
unsigned int v3; // eax
unsigned int v4; // ebp
unsigned int v6; // [rsp+0h] [rbp-28h] BYREF
char v7[4]; // [rsp+4h] [rbp-24h] BYREF
char v8[4]; // [rsp+8h] [rbp-20h] BYREF
unsigned int v9[7]; // [rsp+Ch] [rbp-1Ch] BYREF

get_sons(a1, v9, v8, v7, &v6);
v1 = new_label();
v2 = new_label();
v3 = get_ival(v9[0]);
setval_SYM(v3, v1);
gen_label(v1);
incr_depth();
v4 = func10(v6, v2);
decr_depth();
gen_code(0LL, v2, 0LL);
gen_code(13LL, 0LL, 0LL);
return v4;
}

original_code:
static int cgen_funcdecl(AST a) {
    AST a1, a2, a3, a4;
    int c=0;
    int lbl1, lbl2;
    get_sons(a, &a1, &a2, &a3, &a4);
    lbl1 = new_label();
    lbl2 = new_label();
    setval_SYM(get_ival(a1), lbl1);
    gen_label(lbl1);
    incr_depth();
    c = cgen_block(a4, lbl2);
    decr_depth();
    gen_code(OPR, lbl2, 0);
    gen_code(RET, 0, 0);
    return c;
}

canonical_original_code:
static int cgen_funcdecl(int a) {
    int a1; int a2; int a3; int a4;
    int c = 0;
    int lbl1; int lbl2;
    get_sons(a, &a1, &a2, &a3, &a4);
    lbl1 = new_label();
    lbl2 = new_label();
    setval_SYM(get_ival(a1), lbl1);
    gen_label(lbl1);
    incr_depth();
    c = cgen_block(a4, lbl2);
    decr_depth();
    gen_code(OPR, lbl2, 0);
    gen_code(RET, 0, 0);
    return c;
}

variable_types: c int


decompiled_code:
__int64 __fastcall cgen_funcdecls(unsigned int a1)
{
unsigned int v2; // ebp
unsigned int v4; // [rsp+8h] [rbp-20h] BYREF
unsigned int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = 0;
while ( !(unsigned int)isleaf(a1) )
{
get_sons(a1, v5, &v4, 0LL, 0LL);
v2 = cgen_funcdecl(v5[0]);
a1 = v4;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func12(unsigned int a1)
{
unsigned int v2; // ebp
unsigned int v4; // [rsp+8h] [rbp-20h] BYREF
unsigned int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = 0;
while ( !(unsigned int)isleaf(a1) )
{
get_sons(a1, v5, &v4, 0LL, 0LL);
v2 = func11(v5[0]);
a1 = v4;
}
return v2;
}

original_code:
static int cgen_funcdecls(AST a) {
    AST a1, a2;
    int c=0;
    while (!isleaf(a)) {
 get_sons(a, &a1, &a2, 0, 0);
 c = cgen_funcdecl(a1);
 a = a2;
    }
    return c;
}

canonical_original_code:
static int cgen_funcdecls(int a) {
    int a1; int a2;
    int c = 0;
    while (!isleaf(a)) {
 get_sons(a, &a1, &a2, 0, 0);
 c = cgen_funcdecl(a1);
 a = a2;
    }
    return c;
}


decompiled_code:
__int64 __fastcall cgen_classdecl(__int64 a1)
{
unsigned int v1; // ebx
unsigned int v3; // [rsp+4h] [rbp-14h] BYREF
unsigned int v4; // [rsp+8h] [rbp-10h] BYREF
char v5[12]; // [rsp+Ch] [rbp-Ch] BYREF

get_sons(a1, v5, &v4, &v3, 0LL);
incr_depth();
cgen_vardecls(v4);
v1 = cgen_funcdecls(v3);
decr_depth();
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1)
{
unsigned int v1; // ebx
unsigned int v3; // [rsp+4h] [rbp-14h] BYREF
unsigned int v4; // [rsp+8h] [rbp-10h] BYREF
char v5[12]; // [rsp+Ch] [rbp-Ch] BYREF

get_sons(a1, v5, &v4, &v3, 0LL);
incr_depth();
func1(v4);
v1 = func12(v3);
decr_depth();
return v1;
}

original_code:
static int cgen_classdecl(AST a) {
    AST a1, a2, a3;
    int c=0;
    get_sons(a, &a1, &a2, &a3, 0);
    incr_depth();
    c = cgen_vardecls(a2);
    c = cgen_funcdecls(a3);
    decr_depth();
    return c;
}

canonical_original_code:
static int cgen_classdecl(int a) {
    int a1; int a2; int a3;
    int c = 0;
    get_sons(a, &a1, &a2, &a3, 0);
    incr_depth();
    c = cgen_vardecls(a2);
    c = cgen_funcdecls(a3);
    decr_depth();
    return c;
}


decompiled_code:
__int64 __fastcall cgen_classdecls(unsigned int a1)
{
unsigned int v2; // ebp
unsigned int v4; // [rsp+8h] [rbp-20h] BYREF
unsigned int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = 0;
while ( !(unsigned int)isleaf(a1) )
{
get_sons(a1, v5, &v4, 0LL, 0LL);
v2 = cgen_classdecl(v5[0]);
a1 = v4;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func14(unsigned int a1)
{
unsigned int v2; // ebp
unsigned int v4; // [rsp+8h] [rbp-20h] BYREF
unsigned int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = 0;
while ( !(unsigned int)isleaf(a1) )
{
get_sons(a1, v5, &v4, 0LL, 0LL);
v2 = func13(v5[0]);
a1 = v4;
}
return v2;
}

original_code:
static int cgen_classdecls(AST a) {
    AST a1, a2;
    int c=0;
    while (!isleaf(a)) {
 get_sons(a, &a1, &a2, 0, 0);
 c = cgen_classdecl(a1);
 a = a2;
    }
    return c;
}

canonical_original_code:
static int cgen_classdecls(int a) {
    int a1; int a2;
    int c = 0;
    while (!isleaf(a)) {
 get_sons(a, &a1, &a2, 0, 0);
 c = cgen_classdecl(a1);
 a = a2;
    }
    return c;
}


decompiled_code:
__int64 __fastcall make_type(__int64 a1)
{
int v1; // eax
unsigned int v2; // ebx

v1 = make_AST_name();
v2 = v1;
if ( v1 > 4 )
set_node((unsigned int)v1, 516LL, a1, 0LL);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
int v1; // eax
unsigned int v2; // ebx

v1 = make_AST_name();
v2 = v1;
if ( v1 > 4 )
set_node((unsigned int)v1, 516LL, a1, 0LL);
return v2;
}

original_code:
AST make_type(char *name) {
    AST a = make_AST_name(name);
    if (a<=4) return a;
    set_node(a, tPRIM, name, 0);
    return a;
}

canonical_original_code:
int make_type(char *name) {
    int a = make_AST_name(name);
    if (a<=4) return a;
    set_node(a, tPRIM, name, 0);
    return a;
}

variable_types:
name
char *


decompiled_code:
__int64 __fastcall pointer_type(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx

v2 = (unsigned int)new_AST();
set_node(v2, 518LL, a1, 0LL);
set_typeofnode((unsigned int)v2, a2);
return (unsigned int)v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx

v2 = (unsigned int)new_AST();
set_node(v2, 518LL, a1, 0LL);
set_typeofnode((unsigned int)v2, a2);
return (unsigned int)v2;
}

original_code:
AST pointer_type(char *name, AST e) {
    AST a = new_AST();
    set_node(a, tPOINTER, name, 0);
    set_typeofnode(a, e);
    return a;
}

canonical_original_code:
int pointer_type(char *name, int e) {
    int a = new_AST();
    set_node(a, tPOINTER, name, 0);
    set_typeofnode(a, e);
    return a;
}

variable_types: e int


decompiled_code:
__int64 __fastcall func_type(__int64 a1, unsigned int a2)
{
unsigned int v2; // ebx

v2 = new_AST();
set_node(v2, 520LL, a1, 0LL);
set_typeofnode(v2, a2);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, unsigned int a2)
{
unsigned int v2; // ebx

v2 = new_AST();
set_node(v2, 520LL, a1, 0LL);
set_typeofnode(v2, a2);
return v2;
}

original_code:
AST func_type(char *name, AST e) {
    AST a = new_AST();
    set_node(a, tFUNC, name, 0);
    set_typeofnode(a, e);
    return a;
}

canonical_original_code:
int func_type(char *name, int e) {
    int a = new_AST();
    set_node(a, tFUNC, name, 0);
    set_typeofnode(a, e);
    return a;
}


decompiled_code:
__int64 __fastcall array_type(__int64 a1, unsigned int a2, unsigned int a3)
{
unsigned int v4; // ebx

v4 = new_AST();
set_node(v4, 517LL, a1, a3);
set_typeofnode(v4, a2);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, unsigned int a2, unsigned int a3)
{
unsigned int v4; // ebx

v4 = new_AST();
set_node(v4, 517LL, a1, a3);
set_typeofnode(v4, a2);
return v4;
}

original_code:
AST array_type(char *name, AST e, int sz) {
    AST a = new_AST();
    set_node(a, tARRAY, name, sz);
    set_typeofnode(a, e);
    return a;
}

canonical_original_code:
int array_type(char *name, int e, int sz) {
    int a = new_AST();
    set_node(a, tARRAY, name, sz);
    set_typeofnode(a, e);
    return a;
}


decompiled_code:
int __fastcall print_type(__int64 a1)
{
int result; // eax
unsigned int v2; // eax
const char *v3; // rax
unsigned int v4[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = nodetype(a1);
if ( result == 518 )
{
printf("pointer<");
}
else if ( result > 518 )
{
if ( result != 520 )
return result;
printf("function<");
}
else
{
if ( result == 516 )
{
v3 = (const char *)get_text((unsigned int)a1);
return printf("prim<%s>", v3);
}
if ( result != 517 )
return result;
v2 = get_ival((unsigned int)a1);
printf("array(%d)<", v2);
}
get_sons((unsigned int)a1, v4, 0LL, 0LL, 0LL);
print_type(v4[0]);
return printf("> ");
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1)
{
int result; // eax
unsigned int v2; // eax
const char *v3; // rax
unsigned int v4[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = nodetype(a1);
if ( result == 518 )
{
printf("pointer<");
}
else if ( result > 518 )
{
if ( result != 520 )
return result;
printf("function<");
}
else
{
if ( result == 516 )
{
v3 = (const char *)get_text((unsigned int)a1);
return printf("prim<%s>", v3);
}
if ( result != 517 )
return result;
v2 = get_ival((unsigned int)a1);
printf("array(%d)<", v2);
}
get_sons((unsigned int)a1, v4, 0LL, 0LL, 0LL);
func5(v4[0]);
return printf("> ");
}

original_code:
void print_type(AST a) {
    int ty = nodetype(a);
    int e;
    switch (ty) {
 case tPRIM:
     printf("prim<%s>", get_text(a));
     break;
 case tPOINTER:
     printf("pointer<");
     goto out_elem;
 case tFUNC:
     printf("function<");
     goto out_elem;
 case tARRAY:
     printf("array(%d)<", get_ival(a));
out_elem:
     get_sons(a, &e, 0, 0, 0);
     print_type(e);
     printf("> ");
     break;
 default:
     break;
    }
}

canonical_original_code:
void print_type(int a) {
    int ty = nodetype(a);
    int e;
    switch (ty) {
 case tPRIM:
     printf("prim<%s>", get_text(a));
     break;
 case tPOINTER:
     printf("pointer<");
     goto out_elem;
 case tFUNC:
     printf("function<");
     goto out_elem;
 case tARRAY:
     printf("array(%d)<", get_ival(a));
out_elem:
     get_sons(a, &e, 0, 0, 0);
     print_type(e);
     printf("> ");
     break;
 default:
     break;
    }
}

variable_types: ty int


decompiled_code:
__int64 __fastcall typeof_AST(__int64 a1)
{
__int64 v1; // rax
unsigned int v2; // eax
__int64 result; // rax
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax
__int64 v7; // rbx
unsigned int v8; // eax

switch ( (unsigned int)nodetype(a1) )
{
case 0x413u:
v4 = get_ival((unsigned int)a1);
result = gettype_SYM(v4);
break;
case 0x416u:
v5 = get_typeofnode((unsigned int)a1);
result = typeof_AST(v5);
break;
case 0x417u:
v6 = get_typeofnode((unsigned int)a1);
v7 = (unsigned int)typeof_AST(v6);
if ( (unsigned int)nodetype(v7) != 518 )
parse_error("expected pointer type");
goto LABEL_8;
case 0x418u:
v8 = get_typeofnode((unsigned int)a1);
v7 = (unsigned int)typeof_AST(v8);
if ( (unsigned int)nodetype(v7) != 517 )
parse_error("expected array type");
LABEL_8:
result = get_typeofnode((unsigned int)v7);
break;
case 0x41Fu:
result = get_typeofnode((unsigned int)a1);
break;
case 0x421u:
v1 = get_text((unsigned int)a1);
v2 = lookup_SYM_all(v1);
result = gettype_SYM(v2);
break;
default:
result = 0LL;
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
__int64 v1; // rax
unsigned int v2; // eax
__int64 result; // rax
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax
__int64 v7; // rbx
unsigned int v8; // eax

switch ( (unsigned int)nodetype(a1) )
{
case 0x413u:
v4 = get_ival((unsigned int)a1);
result = gettype_SYM(v4);
break;
case 0x416u:
v5 = get_typeofnode((unsigned int)a1);
result = func6(v5);
break;
case 0x417u:
v6 = get_typeofnode((unsigned int)a1);
v7 = (unsigned int)func6(v6);
if ( (unsigned int)nodetype(v7) != 518 )
parse_error("expected pointer type");
goto LABEL_8;
case 0x418u:
v8 = get_typeofnode((unsigned int)a1);
v7 = (unsigned int)func6(v8);
if ( (unsigned int)nodetype(v7) != 517 )
parse_error("expected array type");
LABEL_8:
result = get_typeofnode((unsigned int)v7);
break;
case 0x41Fu:
result = get_typeofnode((unsigned int)a1);
break;
case 0x421u:
v1 = get_text((unsigned int)a1);
v2 = lookup_SYM_all(v1);
result = gettype_SYM(v2);
break;
default:
result = 0LL;
break;
}
return result;
}

original_code:
AST typeof_AST(AST t) {
    int idx;
    int ty=0;
    switch (nodetype(t)) {
 case nNAME:
     idx = lookup_SYM_all(get_text(t));
     ty = gettype_SYM(idx);
     break;
 case nVREF:
     idx = get_ival(t);
     ty = gettype_SYM(idx);
     break;
 case nCON:
     ty = get_typeofnode(t);
     break;
 case nOP2:
     ty = typeof_AST(get_typeofnode(t));
     break;
 case nDEREF:
     ty = typeof_AST(get_typeofnode(t));
     if (nodetype(ty) != tPOINTER) {
  parse_error("expected pointer type");
     }
     ty = get_typeofnode(ty);
     break;
 case nLVAL:
     ty = typeof_AST(get_typeofnode(t));
     if (nodetype(ty) != tARRAY) {
  parse_error("expected array type");
     }
     ty = get_typeofnode(ty);
     break;
    }
    return ty;
}

canonical_original_code:
int typeof_AST(int t) {
    int idx;
    int ty = 0;
    switch (nodetype(t)) {
 case nNAME:
     idx = lookup_SYM_all(get_text(t));
     ty = gettype_SYM(idx);
     break;
 case nVREF:
     idx = get_ival(t);
     ty = gettype_SYM(idx);
     break;
 case nCON:
     ty = get_typeofnode(t);
     break;
 case nOP2:
     ty = typeof_AST(get_typeofnode(t));
     break;
 case nDEREF:
     ty = typeof_AST(get_typeofnode(t));
     if (nodetype(ty) != tPOINTER) {
  parse_error("expected pointer type");
     }
     ty = get_typeofnode(ty);
     break;
 case nLVAL:
     ty = typeof_AST(get_typeofnode(t));
     if (nodetype(ty) != tARRAY) {
  parse_error("expected array type");
     }
     ty = get_typeofnode(ty);
     break;
    }
    return ty;
}

variable_types: t int

variable_types: idx int


equaltype

decompiled_code:
__int64 __fastcall equaltype(__int64 a1, unsigned int a2)
{
unsigned int v2; // ebx
unsigned int v3; // eax

v2 = typeof_AST(a1);
v3 = typeof_AST(a2);
return equal(v2, v3);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, unsigned int a2)
{
unsigned int v2; // ebx
unsigned int v3; // eax

v2 = func6(a1);
v3 = func6(a2);
return func0(v2, v3);
}

original_code:
void equaltype(AST a1, AST a2) {
    int x1 = typeof_AST(a1);
    int x2 = typeof_AST(a2);
    equal(x1,x2);
}

canonical_original_code:
void equaltype(int a1, int a2) {
    int x1 = typeof_AST(a1);
    int x2 = typeof_AST(a2);
    equal(x1,x2);
}


decompiled_code:
__int64 __fastcall get_sizeoftype(__int64 a1)
{
int v1; // eax
int v3; // ebp
unsigned int v4; // eax

v1 = nodetype(a1);
if ( v1 != 517 )
return v1 != 520;
v3 = get_ival((unsigned int)a1);
v4 = elem((unsigned int)a1);
return v3 * (unsigned int)get_sizeoftype(v4);
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
int v1; // eax
int v3; // ebp
unsigned int v4; // eax

v1 = nodetype(a1);
if ( v1 != 517 )
return v1 != 520;
v3 = get_ival((unsigned int)a1);
v4 = elem((unsigned int)a1);
return v3 * (unsigned int)func8(v4);
}

original_code:
int get_sizeoftype(AST ty) {
    switch (nodetype(ty)) {
 case tFUNC: return 0;
 case tARRAY:
      return get_ival(ty) * get_sizeoftype(elem(ty));
 default:
      return 1;
    }
}

canonical_original_code:
int get_sizeoftype(int ty) {
    switch (nodetype(ty)) {
 case tFUNC: return 0;
 case tARRAY:
      return get_ival(ty) * get_sizeoftype(elem(ty));
 default:
      return 1;
    }
}


newNode

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

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

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

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

original_code:
dict newNode(char *key, char *content){
    dict result = GC_malloc(sizeof(struct node));
    result->key = key;
    result->content = content;
    result->height = 0;
    return result;
}

canonical_original_code:
struct node *newNode(char *key, char *content){
    struct node *result = GC_malloc(sizeof(struct node));
    result->key = key;
    result->content = content;
    result->height = 0;
    return result;
}

variable_types:
key
char *

variable_types:
content
char *

variable_types: struct node { char *key; char *content; int height; struct node *left; struct node *right; } *


find

decompiled_code:
__int64 __fastcall find(__int64 *a1, const char *a2)
{
__int64 v2; // rbx
int v3; // eax

v2 = *a1;
if ( *a1 )
{
v3 = strcmp(a2, *(const char **)v2);
if ( v3 )
{
if ( v3 <= 0 )
v2 = find(v2 + 24, a2);
else
v2 = find(v2 + 32, a2);
}
else
{
v2 = *(_QWORD *)(v2 + 8);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 *a1, const char *a2)
{
__int64 v2; // rbx
int v3; // eax

v2 = *a1;
if ( *a1 )
{
v3 = strcmp(a2, *(const char **)v2);
if ( v3 )
{
if ( v3 <= 0 )
v2 = func1(v2 + 24, a2);
else
v2 = func1(v2 + 32, a2);
}
else
{
v2 = *(_QWORD *)(v2 + 8);
}
}
return v2;
}

original_code:
char *find(dict *d, char *key){
    dict root = *d;
    if (root == ((void *)0)) return ((void *)0);
    int compare = strcmp(key, root->key);
    if (compare == 0) return root->content;
    else if (compare > 0){
 return find(&root->right, key);
    } else {
 return find(&root->left, key);
    }
}

canonical_original_code:
char *find(struct node **d, char *key){
    struct node *root = *d;
    if (root == ((void *)0)) return ((void *)0);
    int compare = strcmp(key, root->key);
    if (compare == 0) return root->content;
    else if (compare > 0){
 return find(&root->right, key);
    } else {
 return find(&root->left, key);
    }
}

variable_types: struct node { char *key; char *content; int height; struct node *left; struct node *right; } **

variable_types: compare int


getHeight

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

result = 0LL;
if ( *(_QWORD *)a1 )
result = *(unsigned int *)(*(_QWORD *)a1 + 16LL);
return result;
}

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

result = 0LL;
if ( *(_QWORD *)a1 )
result = *(unsigned int *)(*(_QWORD *)a1 + 16LL);
return result;
}

original_code:
int getHeight(dict *d){
    if (*d == ((void *)0)) return 0;
    else return ((*d)->height);
}

canonical_original_code:
int getHeight(struct node **d){
    if (*d == ((void *)0)) return 0;
    else return ((*d)->height);
}

user_defined_types: struct node { char *key; char *content; int height; struct node *left; struct node *right; }


balance

original_code:
void balance(dict *d){
    dict root = *d;
    if (root == ((void *)0)) return;
    int diff = getHeight(&root->left) - getHeight(&root->right);
    if (diff > 1){
 dict left = root->left;
 if (getHeight(&left->right) > getHeight(&left->left)) rotateLeft(&root->left);
 rotateRight(d);
    }else if (diff < -1){
 dict right = root->right;
 if (getHeight(&right->left) > getHeight(&right->right)) rotateRight(&root->right);
 rotateLeft(d);
    }
}

canonical_original_code:
void balance(struct node **d){
    struct node *root = *d;
    if (root == ((void *)0)) return;
    int diff = getHeight(&root->left) - getHeight(&root->right);
    if (diff > 1){
 struct node *left = root->left;
 if (getHeight(&left->right) > getHeight(&left->left)) rotateLeft(&root->left);
 rotateRight(d);
    }else if (diff < -1){
 struct node *right = root->right;
 if (getHeight(&right->left) > getHeight(&right->right)) rotateRight(&root->right);
 rotateLeft(d);
    }
}

variable_types: diff int


updateHeight

decompiled_code:
void __fastcall updateHeight(__int64 *a1)
{
__int64 v1; // rbp
int v2; // ebx
int v3; // eax

v1 = *a1;
if ( *a1 )
{
v2 = getHeight(v1 + 24);
v3 = getHeight(v1 + 32);
if ( v2 < v3 )
v2 = v3;
*(_DWORD *)(v1 + 16) = v2 + 1;
}
}

original_code:
void updateHeight(dict *d){
    dict temp = *d;
    if (temp == ((void *)0)) return;
    int height = getHeight(&temp->left);
    int rightHeight = getHeight(&temp->right);
    if (height < rightHeight) height = rightHeight;
    temp->height = ++height;
}

canonical_original_code:
void updateHeight(struct node **d){
    struct node *temp = *d;
    if (temp == ((void *)0)) return;
    int height = getHeight(&temp->left);
    int rightHeight = getHeight(&temp->right);
    if (height < rightHeight) height = rightHeight;
    temp->height = ++height;
}

variable_types: height int

variable_types: rightHeight int


add

decompiled_code:
void __fastcall add(__int64 *a1, const char *a2, __int64 a3)
{
__int64 v4; // r13
__int64 v5; // rax
int v6; // eax

v4 = *a1;
v5 = newNode((__int64)a2, a3);
if ( v4 )
{
v6 = strcmp(a2, *(const char **)v4);
if ( v6 )
{
if ( v6 <= 0 )
add(v4 + 24, a2, a3);
else
add(v4 + 32, a2, a3);
}
else
{
*(_QWORD *)(v4 + 8) = a3;
}
}
else
{
*a1 = v5;
}
updateHeight(a1);
balance(a1);
}

original_code:
void add(dict *d, char *key, char *content){
    dict root = *d;
    dict new_node = newNode(key, content);
    if (root == ((void *)0)) *d = new_node;
    else {
 int compare = strcmp(key, root->key);
 if (compare == 0) root->content = content;
 else if (compare > 0){
     add(&root->right, key, content);
 } else {
     add(&root->left, key, content);
 }
    }
    updateHeight(d);
    balance(d);
}

canonical_original_code:
void add(struct node **d, char *key, char *content){
    struct node *root = *d;
    struct node *new_node = newNode(key, content);
    if (root == ((void *)0)) *d = new_node;
    else {
 int compare = strcmp(key, root->key);
 if (compare == 0) root->content = content;
 else if (compare > 0){
     add(&root->right, key, content);
 } else {
     add(&root->left, key, content);
 }
    }
    updateHeight(d);
    balance(d);
}


print

decompiled_code:
int __fastcall print(__int64 *a1)
{
__int64 v1; // rbx

v1 = *a1;
if ( !*a1 )
return putchar(76);
putchar(40);
print(v1 + 24);
printf(", %s:%d, ", *(const char **)v1, *(unsigned int *)(v1 + 16));
print(v1 + 32);
return putchar(41);
}

canonical_decompiled_code:
int __fastcall func8(__int64 *a1)
{
__int64 v1; // rbx

v1 = *a1;
if ( !*a1 )
return putchar(76);
putchar(40);
func8(v1 + 24);
printf(", %s:%d, ", *(const char **)v1, *(unsigned int *)(v1 + 16));
func8(v1 + 32);
return putchar(41);
}

original_code:
void print(dict *d){
    dict temp = *d;
    if (temp == ((void *)0)){
 printf("L");
    } else {
 printf("(");
 print(&temp->left);
 printf(", %s:%d, ", temp->key, temp->height);
 print(&temp->right);
 printf(")");
    }
}

canonical_original_code:
void print(struct node **d){
    struct node *temp = *d;
    if (temp == ((void *)0)){
 printf("L");
    } else {
 printf("(");
 print(&temp->left);
 printf(", %s:%d, ", temp->key, temp->height);
 print(&temp->right);
 printf(")");
    }
}