FieldVar

decompiled_code:
__int64 FieldVar()
{
ReadToken();
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
ReadToken();
return 0LL;
}

original_code:
TreeNode * FieldVar(){
  TreeNode * t = ((void *)0);
  ReadToken();
  if( t )
    FieldVarMore(t);
  return t;
}

canonical_original_code:
struct node *FieldVar(){
  struct node *t = ((void *)0);
  ReadToken();
  if( t )
    FieldVarMore(t);
  return t;
}

return_type: struct node { struct node *child[3]; struct node *Sibling; int Lineno; enum NodeKind { ProK=0, PheadK=1, TypeK=2, VarK=3, ProcDecK=4, StmLK=5, DecK=6, StmtK=7, ExpK=8 } nodeKind; char nodeKindStr[30]; union k { enum dec { ArrayK=0, CharK=1, IntegerK=2, RecordK=3, IdK=4 } d; enum stmt { IfK=0, WhileK=1, AssignK=2, ReadK=3, WriteK=4, CallK=5, ReturnK=6 } s; enum exp { OpK=0, ConstK=1, IdEK=2 } e; char name[30]; } kind; int idnum; char name[10][30]; char type_name[30]; union a { struct array { int low; int up; enum dec { ArrayK=0, CharK=1, IntegerK=2, RecordK=3, IdK=4 } childType; } a_attr; struct expAttr { char op; int val; enum varKind { IdV=0, ArrayMembV=1, FieldMembV=2 } varkind; enum ExpType { Void=0, Integer=1, Boolean=2 } type; } e_attr; struct proc { enum ProcAttrType { valparamtype=0, varparamtype=1 } paramt; } p_attr; } attr; } *


IntegerExpk

decompiled_code:
void *IntegerExpk()
{
void *v0; // rax
__int64 v1; // rdx
void *v2; // r12

v0 = malloc(0x1C8uLL);
v1 = i_tokenValueBuffer;
*((_DWORD *)v0 + 9) = 8;
v2 = v0;
sprintf((char *)v0 + 40, "ExpK %d", v1);
return v2;
}

canonical_decompiled_code:
void *func2()
{
void *v0; // rax
__int64 v1; // rdx
void *v2; // r12

v0 = malloc(0x1C8uLL);
v1 = i_tokenValueBuffer;
*((_DWORD *)v0 + 9) = 8;
v2 = v0;
sprintf((char *)v0 + 40, "ExpK %d", v1);
return v2;
}

original_code:
TreeNode * IntegerExpk(){
  TreeNode * t = (TreeNode *)malloc(sizeof(TreeNode));
  t->nodeKind = ExpK;
  sprintf(t->nodeKindStr, "ExpK %d", i_tokenValueBuffer);
  return t;
}

canonical_original_code:
struct node *IntegerExpk(){
  struct node *t = (TreeNode *)malloc(sizeof(TreeNode));
  t->nodeKind = ExpK;
  sprintf(t->nodeKindStr, "ExpK %d", i_tokenValueBuffer);
  return t;
}

variable_types: struct node { struct node *child[3]; struct node *Sibling; int Lineno; enum NodeKind { ProK=0, PheadK=1, TypeK=2, VarK=3, ProcDecK=4, StmLK=5, DecK=6, StmtK=7, ExpK=8 } nodeKind; char nodeKindStr[30]; union k { enum dec { ArrayK=0, CharK=1, IntegerK=2, RecordK=3, IdK=4 } d; enum stmt { IfK=0, WhileK=1, AssignK=2, ReadK=3, WriteK=4, CallK=5, ReturnK=6 } s; enum exp { OpK=0, ConstK=1, IdEK=2 } e; char name[30]; } kind; int idnum; char name[10][30]; char type_name[30]; union a { struct array { int low; int up; enum dec { ArrayK=0, CharK=1, IntegerK=2, RecordK=3, IdK=4 } childType; } a_attr; struct expAttr { char op; int val; enum varKind { IdV=0, ArrayMembV=1, FieldMembV=2 } varkind; enum ExpType { Void=0, Integer=1, Boolean=2 } type; } e_attr; struct proc { enum ProcAttrType { valparamtype=0, varparamtype=1 } paramt; } p_attr; } attr; } *

user_defined_types: struct node { struct node *child[3]; struct node *Sibling; int Lineno; enum NodeKind nodeKind; char nodeKindStr[30]; union k kind; int idnum; char name[10][30]; char type_name[30]; union a attr; }

user_defined_types: union k { enum dec d; enum stmt s; enum exp e; char name[30]; }

user_defined_types: union a { struct array a_attr; struct expAttr e_attr; struct proc p_attr; }

user_defined_types: struct array { int low; int up; enum dec childType; }

user_defined_types: struct expAttr { char op; int val; enum varKind varkind; enum ExpType type; }

user_defined_types: struct proc { enum ProcAttrType paramt; }


Exp

decompiled_code:
__int64 Exp()
{
__int64 v0; // r12
_QWORD *v1; // rax
_QWORD *v2; // rbx
char v3; // al

v0 = SimpleExp();
ReadToken();
if ( (unsigned int)is_not_symbol("<") && (unsigned int)is_not_symbol(":=") && (unsigned int)is_not_symbol(">") )
{
UnReadToken();
return v0;
}
v1 = malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*v1 = v0;
v3 = tokenValueBuffer;
*((_DWORD *)v2 + 9) = 8;
*((_BYTE *)v2 + 440) = v3;
sprintf((char *)v2 + 40, "ExpK Op %s", &tokenValueBuffer);
}
else
{
if ( !v0 )
return v0;
v2 = (_QWORD *)v0;
}
v0 = (__int64)v2;
v2[1] = SimpleExp();
return v0;
}

canonical_decompiled_code:
__int64 func3()
{
__int64 v0; // r12
_QWORD *v1; // rax
_QWORD *v2; // rbx
char v3; // al

v0 = func8();
ReadToken();
if ( (unsigned int)is_not_symbol("<") && (unsigned int)is_not_symbol(":=") && (unsigned int)is_not_symbol(">") )
{
UnReadToken();
return v0;
}
v1 = malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*v1 = v0;
v3 = tokenValueBuffer;
*((_DWORD *)v2 + 9) = 8;
*((_BYTE *)v2 + 440) = v3;
sprintf((char *)v2 + 40, "ExpK Op %s", &tokenValueBuffer);
}
else
{
if ( !v0 )
return v0;
v2 = (_QWORD *)v0;
}
v0 = (__int64)v2;
v2[1] = func8();
return v0;
}

original_code:
TreeNode * Exp(){
  TreeNode * t = SimpleExp();
  ReadToken();
  if( is_not_symbol("<") && is_not_symbol(":=") && is_not_symbol(">") ){
    UnReadToken();
    return t;
  }
  TreeNode * p = (TreeNode *)malloc(sizeof(TreeNode));
  if( p ){
    p->child[0] = t;
    p->attr.e_attr.op = tokenValueBuffer[0];
    p->nodeKind = ExpK;
    sprintf(p->nodeKindStr,"ExpK Op %s", tokenValueBuffer);
    t = p;
  }
  if( t )
    t->child[1] = SimpleExp();
  return t;
}

canonical_original_code:
struct node *Exp(){
  struct node *t = SimpleExp();
  ReadToken();
  if( is_not_symbol("<") && is_not_symbol(":=") && is_not_symbol(">") ){
    UnReadToken();
    return t;
  }
  struct node *p = (TreeNode *)malloc(sizeof(TreeNode));
  if( p ){
    p->child[0] = t;
    p->attr.e_attr.op = tokenValueBuffer[0];
    p->nodeKind = ExpK;
    sprintf(p->nodeKindStr,"ExpK Op %s", tokenValueBuffer);
    t = p;
  }
  if( t )
    t->child[1] = SimpleExp();
  return t;
}

user_defined_types: enum NodeKind { ProK=0, PheadK=1, TypeK=2, VarK=3, ProcDecK=4, StmLK=5, DecK=6, StmtK=7, ExpK=8 }

user_defined_types: enum dec { ArrayK=0, CharK=1, IntegerK=2, RecordK=3, IdK=4 }

user_defined_types: enum stmt { IfK=0, WhileK=1, AssignK=2, ReadK=3, WriteK=4, CallK=5, ReturnK=6 }

user_defined_types: enum varKind { IdV=0, ArrayMembV=1, FieldMembV=2 }

user_defined_types: enum ExpType { Void=0, Integer=1, Boolean=2 }

user_defined_types: enum ProcAttrType { valparamtype=0, varparamtype=1 }


variMore

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

ReadToken();
if ( !(unsigned int)is_symbol("[") )
goto LABEL_2;
*a1 = Exp();
ReadToken();
result = is_not_symbol("]");
if ( (_DWORD)result )
{
fwrite("VarMore ']' miss\n", 1uLL, 0x11uLL, stderr);
LABEL_2:
result = UnReadToken();
}
return result;
}

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

ReadToken();
if ( !(unsigned int)is_symbol("[") )
goto LABEL_2;
*a1 = func3();
ReadToken();
result = is_not_symbol("]");
if ( (_DWORD)result )
{
fwrite("VarMore ']' miss\n", 1uLL, 0x11uLL, stderr);
LABEL_2:
result = UnReadToken();
}
return result;
}

original_code:
void variMore(TreeNode * t){
  ReadToken();
  if( is_symbol("[") ){
    t->child[0] = Exp();
    ReadToken();
    if( is_not_symbol("]") ){
      fprintf(stderr, "VarMore ']' miss\n");
      UnReadToken();
    }
    return;
  }
  UnReadToken();
}

canonical_original_code:
void variMore(struct node *t){
  ReadToken();
  if( is_symbol("[") ){
    t->child[0] = Exp();
    ReadToken();
    if( is_not_symbol("]") ){
      fprintf(stderr, "VarMore ']' miss\n");
      UnReadToken();
    }
    return;
  }
  UnReadToken();
}

return_type: void


Variable

decompiled_code:
char *Variable()
{
char *v0; // r12
__int64 v2; // rax

v0 = (char *)malloc(0x1C8uLL);
ReadToken();
if ( !v0 || tokenType != 5 )
return v0;
v2 = *((int *)v0 + 26);
*((_DWORD *)v0 + 9) = 8;
strcpy(v0 + 40, "ExpK");
*((_DWORD *)v0 + 26) = v2 + 1;
strcpy(&v0[30 * v2 + 108], &tokenValueBuffer);
variMore(v0);
return v0;
}

canonical_decompiled_code:
char *func5()
{
char *v0; // r12
__int64 v2; // rax

v0 = (char *)malloc(0x1C8uLL);
ReadToken();
if ( !v0 || tokenType != 5 )
return v0;
v2 = *((int *)v0 + 26);
*((_DWORD *)v0 + 9) = 8;
strcpy(v0 + 40, "ExpK");
*((_DWORD *)v0 + 26) = v2 + 1;
strcpy(&v0[30 * v2 + 108], &tokenValueBuffer);
func4(v0);
return v0;
}

original_code:
TreeNode * Variable(){
  TreeNode * t = (TreeNode *)malloc(sizeof(TreeNode));
  ReadToken();
  if( t && ( tokenType == SNL_ID ) ){
    t->nodeKind = ExpK;
    sprintf(t->nodeKindStr, "ExpK");
    strcpy(t->name[t->idnum++], tokenValueBuffer);
    variMore(t);
  }
  return t;
}

canonical_original_code:
struct node *Variable(){
  struct node *t = (TreeNode *)malloc(sizeof(TreeNode));
  ReadToken();
  if( t && ( tokenType == SNL_ID ) ){
    t->nodeKind = ExpK;
    sprintf(t->nodeKindStr, "ExpK");
    strcpy(t->name[t->idnum++], tokenValueBuffer);
    variMore(t);
  }
  return t;
}


Factor

decompiled_code:
void *Factor()
{
__int64 v0; // r12
void *result; // rax

ReadToken();
if ( tokenType == 5 )
{
UnReadToken();
result = Variable();
}
else if ( tokenType )
{
v0 = 0LL;
if ( (unsigned int)is_symbol("(") && (v0 = Exp(), ReadToken(), (unsigned int)is_not_symbol(")")) )
{
fwrite("Factor miss ')'\n", 1uLL, 0x10uLL, stderr);
result = (void *)v0;
}
else
{
result = (void *)v0;
}
}
else
{
result = IntegerExpk();
}
return result;
}

canonical_decompiled_code:
void *func6()
{
__int64 v0; // r12
void *result; // rax

ReadToken();
if ( tokenType == 5 )
{
UnReadToken();
result = func5();
}
else if ( tokenType )
{
v0 = 0LL;
if ( (unsigned int)is_symbol("(") && (v0 = func3(), ReadToken(), (unsigned int)is_not_symbol(")")) )
{
fwrite("Factor miss ')'\n", 1uLL, 0x10uLL, stderr);
result = (void *)v0;
}
else
{
result = (void *)v0;
}
}
else
{
result = func2();
}
return result;
}

original_code:
TreeNode * Factor(){
  TreeNode * t = ((void *)0);
  ReadToken();
  if( ( tokenType == SNL_ID ) ){
    UnReadToken();
    return Variable();
  }
  if( ( tokenType == SNL_INTERGER ) ){
    return IntegerExpk();
  }
  if( is_symbol("(") ){
    t = Exp();
    ReadToken();
    if( is_not_symbol(")") )
      fprintf(stderr, "Factor miss ')'\n");
  }
  return t;
}

canonical_original_code:
struct node *Factor(){
  struct node *t = ((void *)0);
  ReadToken();
  if( ( tokenType == SNL_ID ) ){
    UnReadToken();
    return Variable();
  }
  if( ( tokenType == SNL_INTERGER ) ){
    return IntegerExpk();
  }
  if( is_symbol("(") ){
    t = Exp();
    ReadToken();
    if( is_not_symbol(")") )
      fprintf(stderr, "Factor miss ')'\n");
  }
  return t;
}


Term

decompiled_code:
_QWORD *Term()
{
_QWORD *i; // r12
_QWORD *v1; // rax
_QWORD *v2; // rbx
char v3; // al

for ( i = Factor(); ; i[1] = Factor() )
{
ReadToken();
if ( (unsigned int)is_not_symbol("/") )
{
if ( (unsigned int)is_not_symbol("*") )
break;
}
v1 = malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*v1 = i;
v3 = tokenValueBuffer;
i = v2;
*((_DWORD *)v2 + 9) = 8;
*((_BYTE *)v2 + 440) = v3;
sprintf((char *)v2 + 40, "ExpK Op %s", &tokenValueBuffer);
}
}
UnReadToken();
return i;
}

canonical_decompiled_code:
_QWORD *func7()
{
_QWORD *i; // r12
_QWORD *v1; // rax
_QWORD *v2; // rbx
char v3; // al

for ( i = func6(); ; i[1] = func6() )
{
ReadToken();
if ( (unsigned int)is_not_symbol("/") )
{
if ( (unsigned int)is_not_symbol("*") )
break;
}
v1 = malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*v1 = i;
v3 = tokenValueBuffer;
i = v2;
*((_DWORD *)v2 + 9) = 8;
*((_BYTE *)v2 + 440) = v3;
sprintf((char *)v2 + 40, "ExpK Op %s", &tokenValueBuffer);
}
}
UnReadToken();
return i;
}

original_code:
TreeNode * Term(){
  TreeNode * t = Factor();
  TreeNode * p = ((void *)0);
  while(1){
    ReadToken();
    if( is_not_symbol("/") && is_not_symbol("*") ){
      UnReadToken();
      return t;
    }
    p = (TreeNode *)malloc(sizeof(TreeNode));
    if( p ){
      p->child[0] = t;
      p->attr.e_attr.op = tokenValueBuffer[0];
      p->nodeKind = ExpK;
      sprintf(p->nodeKindStr,"ExpK Op %s", tokenValueBuffer);
      t = p;
    }
    t->child[1] = Factor();
  }
  return t;
}

canonical_original_code:
struct node *Term(){
  struct node *t = Factor();
  struct node *p = ((void *)0);
  while(1){
    ReadToken();
    if( is_not_symbol("/") && is_not_symbol("*") ){
      UnReadToken();
      return t;
    }
    p = (struct node *)malloc(sizeof(TreeNode));
    if( p ){
      p->child[0] = t;
      p->attr.e_attr.op = tokenValueBuffer[0];
      p->nodeKind = ExpK;
      sprintf(p->nodeKindStr,"ExpK Op %s", tokenValueBuffer);
      t = p;
    }
    t->child[1] = Factor();
  }
  return t;
}


SimpleExp

decompiled_code:
_QWORD *SimpleExp()
{
_QWORD *i; // r12
_QWORD *v1; // rax
_QWORD *v2; // rbx
char v3; // al

for ( i = Term(); ; i[1] = Term() )
{
ReadToken();
if ( (unsigned int)is_not_symbol("+") )
{
if ( (unsigned int)is_not_symbol("-") )
break;
}
v1 = malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*v1 = i;
v3 = tokenValueBuffer;
i = v2;
*((_DWORD *)v2 + 9) = 8;
*((_BYTE *)v2 + 440) = v3;
sprintf((char *)v2 + 40, "ExpK Op %s", &tokenValueBuffer);
}
}
UnReadToken();
return i;
}

canonical_decompiled_code:
_QWORD *func8()
{
_QWORD *i; // r12
_QWORD *v1; // rax
_QWORD *v2; // rbx
char v3; // al

for ( i = func7(); ; i[1] = func7() )
{
ReadToken();
if ( (unsigned int)is_not_symbol("+") )
{
if ( (unsigned int)is_not_symbol("-") )
break;
}
v1 = malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*v1 = i;
v3 = tokenValueBuffer;
i = v2;
*((_DWORD *)v2 + 9) = 8;
*((_BYTE *)v2 + 440) = v3;
sprintf((char *)v2 + 40, "ExpK Op %s", &tokenValueBuffer);
}
}
UnReadToken();
return i;
}

original_code:
TreeNode * SimpleExp(){
  TreeNode * t = Term();
  TreeNode * p = ((void *)0);
  while(1){
    ReadToken();
    if( is_not_symbol("+") && is_not_symbol("-") ){
      UnReadToken();
      return t;
    }
    p = (TreeNode *)malloc(sizeof(TreeNode));
    if( p ){
      p->child[0] = t;
      p->attr.e_attr.op = tokenValueBuffer[0];
      p->nodeKind = ExpK;
      sprintf(p->nodeKindStr,"ExpK Op %s", tokenValueBuffer);
      t = p;
    }
    t->child[1] = Term();
  }
  return ((void *)0);
}

canonical_original_code:
struct node *SimpleExp(){
  struct node *t = Term();
  struct node *p = ((void *)0);
  while(1){
    ReadToken();
    if( is_not_symbol("+") && is_not_symbol("-") ){
      UnReadToken();
      return t;
    }
    p = (struct node *)malloc(sizeof(TreeNode));
    if( p ){
      p->child[0] = t;
      p->attr.e_attr.op = tokenValueBuffer[0];
      p->nodeKind = ExpK;
      sprintf(p->nodeKindStr,"ExpK Op %s", tokenValueBuffer);
      t = p;
    }
    t->child[1] = Term();
  }
  return ((void *)0);
}


ActParamList

decompiled_code:
__int64 ActParamList()
{
__int64 v0; // r12

v0 = 0LL;
if ( !(unsigned int)is_symbol(")") )
{
v0 = Exp();
if ( v0 )
*(_QWORD *)(v0 + 24) = ActParamMore();
}
return v0;
}

original_code:
TreeNode * ActParamList(){
  if( is_symbol(")") )
    return ((void *)0);
  TreeNode * t = Exp();
  if( t )
    t->Sibling = ActParamMore();
  return t;
}

canonical_original_code:
struct node *ActParamList(){
  if( is_symbol(")") )
    return ((void *)0);
  struct node *t = Exp();
  if( t )
    t->Sibling = ActParamMore();
  return t;
}


ActParamMore

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

ReadToken();
if ( !(unsigned int)is_symbol(")") && (unsigned int)is_symbol(",") )
result = ActParamList();
else
result = 0LL;
return result;
}

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

ReadToken();
if ( !(unsigned int)is_symbol(")") && (unsigned int)is_symbol(",") )
result = func9();
else
result = 0LL;
return result;
}

original_code:
TreeNode * ActParamMore(){
  ReadToken();
  if( is_symbol(")") )
    return ((void *)0);
  if( is_symbol(",") )
    return ActParamList();
  return ((void *)0);
}

canonical_original_code:
struct node *ActParamMore(){
  ReadToken();
  if( is_symbol(")") )
    return ((void *)0);
  if( is_symbol(",") )
    return ActParamList();
  return ((void *)0);
}


AssCall

decompiled_code:
void *AssCall()
{
void *v0; // r12
char *v1; // rax
char *v2; // rbx
__int64 v3; // rax
__int64 v5; // rax

v0 = malloc(0x1C8uLL);
v1 = (char *)malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*((_DWORD *)v1 + 9) = 8;
strcpy(v1 + 40, "ExpK");
v3 = *((int *)v1 + 26);
*((_DWORD *)v2 + 26) = v3 + 1;
strcpy(&v2[30 * v3 + 108], &tokenValueBuffer);
variMore(v2);
}
ReadToken();
if ( (unsigned int)is_symbol(":=") )
{
if ( v0 )
{
*(_QWORD *)v0 = v2;
*((_QWORD *)v0 + 1) = Exp();
*((_DWORD *)v0 + 9) = 8;
strcpy((char *)v0 + 40, "ExpK Op :=");
return v0;
}
is_symbol("(");
LABEL_12:
v0 = 0LL;
fwrite("AssCall error\n", 1uLL, 0xEuLL, stderr);
return v0;
}
if ( !(unsigned int)is_symbol("(") || !v0 )
goto LABEL_12;
*(_QWORD *)v0 = v2;
v5 = ActParamList();
*((_DWORD *)v0 + 9) = 8;
*((_QWORD *)v0 + 1) = v5;
strcpy((char *)v0 + 40, "ExpK Call");
if ( (unsigned int)is_not_symbol(")") )
fwrite("Call method miss ')'\n", 1uLL, 0x15uLL, stderr);
return v0;
}

canonical_decompiled_code:
void *func11()
{
void *v0; // r12
char *v1; // rax
char *v2; // rbx
__int64 v3; // rax
__int64 v5; // rax

v0 = malloc(0x1C8uLL);
v1 = (char *)malloc(0x1C8uLL);
v2 = v1;
if ( v1 )
{
*((_DWORD *)v1 + 9) = 8;
strcpy(v1 + 40, "ExpK");
v3 = *((int *)v1 + 26);
*((_DWORD *)v2 + 26) = v3 + 1;
strcpy(&v2[30 * v3 + 108], &tokenValueBuffer);
func4(v2);
}
ReadToken();
if ( (unsigned int)is_symbol(":=") )
{
if ( v0 )
{
*(_QWORD *)v0 = v2;
*((_QWORD *)v0 + 1) = func3();
*((_DWORD *)v0 + 9) = 8;
strcpy((char *)v0 + 40, "ExpK Op :=");
return v0;
}
is_symbol("(");
LABEL_12:
v0 = 0LL;
fwrite("AssCall error\n", 1uLL, 0xEuLL, stderr);
return v0;
}
if ( !(unsigned int)is_symbol("(") || !v0 )
goto LABEL_12;
*(_QWORD *)v0 = v2;
v5 = func9();
*((_DWORD *)v0 + 9) = 8;
*((_QWORD *)v0 + 1) = v5;
strcpy((char *)v0 + 40, "ExpK Call");
if ( (unsigned int)is_not_symbol(")") )
fwrite("Call method miss ')'\n", 1uLL, 0x15uLL, stderr);
return v0;
}

original_code:
TreeNode * AssCall(){
  TreeNode * t = (TreeNode * )malloc(sizeof(TreeNode));
  TreeNode * p = (TreeNode * )malloc(sizeof(TreeNode));
  if( p ){
    p->nodeKind = ExpK;
    strcpy(p->nodeKindStr, "ExpK");
    strcpy(p->name[p->idnum++], tokenValueBuffer);
    variMore(p);
  }
  ReadToken();
  if( is_symbol(":=") && t ){
    t->child[0] = p;
    t->child[1] = Exp();
    t->nodeKind = ExpK;
    strcpy(t->nodeKindStr,"ExpK Op :=");
    return t;
  }
  if( is_symbol("(") && t ){
    t->child[0] = p;
    t->child[1] = ActParamList();
    t->nodeKind = ExpK;
    strcpy(t->nodeKindStr,"ExpK Call");
    if( is_not_symbol(")") )
      fprintf(stderr, "Call method miss ')'\n");
    return t;
  }
  fprintf(stderr, "AssCall error\n");
  return ((void *)0);
}

canonical_original_code:
struct node *AssCall(){
  struct node *t = (TreeNode * )malloc(sizeof(TreeNode));
  struct node *p = (TreeNode * )malloc(sizeof(TreeNode));
  if( p ){
    p->nodeKind = ExpK;
    strcpy(p->nodeKindStr, "ExpK");
    strcpy(p->name[p->idnum++], tokenValueBuffer);
    variMore(p);
  }
  ReadToken();
  if( is_symbol(":=") && t ){
    t->child[0] = p;
    t->child[1] = Exp();
    t->nodeKind = ExpK;
    strcpy(t->nodeKindStr,"ExpK Op :=");
    return t;
  }
  if( is_symbol("(") && t ){
    t->child[0] = p;
    t->child[1] = ActParamList();
    t->nodeKind = ExpK;
    strcpy(t->nodeKindStr,"ExpK Call");
    if( is_not_symbol(")") )
      fprintf(stderr, "Call method miss ')'\n");
    return t;
  }
  fprintf(stderr, "AssCall error\n");
  return ((void *)0);
}


ReturnStm

decompiled_code:
__int64 ReturnStm()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func12()
{
return 0LL;
}

original_code:
TreeNode * ReturnStm(){
  return ((void *)0);
}

canonical_original_code:
struct node *ReturnStm(){
  return ((void *)0);
}


InputStm

decompiled_code:
void *InputStm()
{
void *v0; // r12

v0 = malloc(0x1C8uLL);
ReadToken();
if ( (unsigned int)is_not_symbol("(") )
fwrite("InputStm miss '('\n", 1uLL, 0x12uLL, stderr);
if ( v0 )
*(_QWORD *)v0 = Variable();
*((_DWORD *)v0 + 9) = 7;
strcpy((char *)v0 + 40, "StmtK Input");
ReadToken();
if ( (unsigned int)is_not_symbol(")") )
fwrite("InputStm miss ')'\n", 1uLL, 0x12uLL, stderr);
return v0;
}

canonical_decompiled_code:
void *func13()
{
void *v0; // r12

v0 = malloc(0x1C8uLL);
ReadToken();
if ( (unsigned int)is_not_symbol("(") )
fwrite("InputStm miss '('\n", 1uLL, 0x12uLL, stderr);
if ( v0 )
*(_QWORD *)v0 = func5();
*((_DWORD *)v0 + 9) = 7;
strcpy((char *)v0 + 40, "StmtK Input");
ReadToken();
if ( (unsigned int)is_not_symbol(")") )
fwrite("InputStm miss ')'\n", 1uLL, 0x12uLL, stderr);
return v0;
}

original_code:
TreeNode * InputStm(){
  TreeNode * t = (TreeNode * )malloc(sizeof(TreeNode));
  ReadToken();
  if( is_not_symbol("(") )
    fprintf(stderr, "InputStm miss '('\n");
  if( t )
    t->child[0] = Variable();
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK Input");
  ReadToken();
  if( is_not_symbol(")") )
    fprintf(stderr, "InputStm miss ')'\n");
  return t;
}

canonical_original_code:
struct node *InputStm(){
  struct node *t = (TreeNode * )malloc(sizeof(TreeNode));
  ReadToken();
  if( is_not_symbol("(") )
    fprintf(stderr, "InputStm miss '('\n");
  if( t )
    t->child[0] = Variable();
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK Input");
  ReadToken();
  if( is_not_symbol(")") )
    fprintf(stderr, "InputStm miss ')'\n");
  return t;
}


OutputStm

decompiled_code:
void *OutputStm()
{
void *v0; // r12

v0 = malloc(0x1C8uLL);
ReadToken();
if ( (unsigned int)is_not_symbol("(") )
fwrite("OutputStm miss '('\n", 1uLL, 0x13uLL, stderr);
if ( v0 )
*(_QWORD *)v0 = Exp();
*((_DWORD *)v0 + 9) = 7;
strcpy((char *)v0 + 40, "StmtK Write");
ReadToken();
if ( (unsigned int)is_not_symbol(")") )
fwrite("OutputStm miss ')'\n", 1uLL, 0x13uLL, stderr);
return v0;
}

canonical_decompiled_code:
void *func14()
{
void *v0; // r12

v0 = malloc(0x1C8uLL);
ReadToken();
if ( (unsigned int)is_not_symbol("(") )
fwrite("OutputStm miss '('\n", 1uLL, 0x13uLL, stderr);
if ( v0 )
*(_QWORD *)v0 = func3();
*((_DWORD *)v0 + 9) = 7;
strcpy((char *)v0 + 40, "StmtK Write");
ReadToken();
if ( (unsigned int)is_not_symbol(")") )
fwrite("OutputStm miss ')'\n", 1uLL, 0x13uLL, stderr);
return v0;
}

original_code:
TreeNode * OutputStm(){
  TreeNode * t = (TreeNode * )malloc(sizeof(TreeNode));
  ReadToken();
  if( is_not_symbol("(") )
    fprintf(stderr, "OutputStm miss '('\n");
  if( t )
    t->child[0] = Exp();
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK Write");
  ReadToken();
  if( is_not_symbol(")") )
    fprintf(stderr, "OutputStm miss ')'\n");
  return t;
}

canonical_original_code:
struct node *OutputStm(){
  struct node *t = (TreeNode * )malloc(sizeof(TreeNode));
  ReadToken();
  if( is_not_symbol("(") )
    fprintf(stderr, "OutputStm miss '('\n");
  if( t )
    t->child[0] = Exp();
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK Write");
  ReadToken();
  if( is_not_symbol(")") )
    fprintf(stderr, "OutputStm miss ')'\n");
  return t;
}


ConditionalStm

decompiled_code:
_QWORD *ConditionalStm()
{
void *v0; // rax
_QWORD *v1; // r12

v0 = malloc(0x1C8uLL);
*((_DWORD *)v0 + 9) = 7;
v1 = v0;
strcpy((char *)v0 + 40, "StmtK If");
*(_QWORD *)v0 = Exp();
ReadToken();
if ( (unsigned int)is_reversed_word("then") )
v1[1] = Exp();
else
fwrite("Conditional Stm miss 'then' \n", 1uLL, 0x1DuLL, stderr);
ReadToken();
if ( (unsigned int)is_reversed_word("else") )
v1[2] = Exp();
ReadToken();
if ( (unsigned int)is_not_reversed_word("fi") )
fwrite("Conditional Stm miss 'fi' \n", 1uLL, 0x1BuLL, stderr);
return v1;
}

canonical_decompiled_code:
_QWORD *func15()
{
void *v0; // rax
_QWORD *v1; // r12

v0 = malloc(0x1C8uLL);
*((_DWORD *)v0 + 9) = 7;
v1 = v0;
strcpy((char *)v0 + 40, "StmtK If");
*(_QWORD *)v0 = func3();
ReadToken();
if ( (unsigned int)is_reversed_word("then") )
v1[1] = func3();
else
fwrite("Conditional Stm miss 'then' \n", 1uLL, 0x1DuLL, stderr);
ReadToken();
if ( (unsigned int)is_reversed_word("else") )
v1[2] = func3();
ReadToken();
if ( (unsigned int)is_not_reversed_word("fi") )
fwrite("Conditional Stm miss 'fi' \n", 1uLL, 0x1BuLL, stderr);
return v1;
}

original_code:
TreeNode * ConditionalStm(){
  TreeNode * t = (TreeNode * )malloc(sizeof(TreeNode));
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK If");
  if( t )
    t->child[0] = Exp();
  ReadToken();
  if( is_reversed_word("then") && t)
    t->child[1] = Exp();
  else
    fprintf(stderr, "Conditional Stm miss 'then' \n");
  ReadToken();
  if( is_reversed_word("else") && t)
    t->child[2] = Exp();
  ReadToken();
  if( is_not_reversed_word("fi") )
    fprintf(stderr, "Conditional Stm miss 'fi' \n");
  return t;
}

canonical_original_code:
struct node *ConditionalStm(){
  struct node *t = (TreeNode * )malloc(sizeof(TreeNode));
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK If");
  if( t )
    t->child[0] = Exp();
  ReadToken();
  if( is_reversed_word("then") && t)
    t->child[1] = Exp();
  else
    fprintf(stderr, "Conditional Stm miss 'then' \n");
  ReadToken();
  if( is_reversed_word("else") && t)
    t->child[2] = Exp();
  ReadToken();
  if( is_not_reversed_word("fi") )
    fprintf(stderr, "Conditional Stm miss 'fi' \n");
  return t;
}


StmMore

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

ReadToken();
if ( (unsigned int)is_reversed_word("end") || (unsigned int)is_reversed_word("endwh") )
{
UnReadToken();
result = 0LL;
}
else if ( (unsigned int)is_symbol(";") )
{
result = StmList();
}
else
{
result = 0LL;
}
return result;
}

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

ReadToken();
if ( (unsigned int)is_reversed_word("end") || (unsigned int)is_reversed_word("endwh") )
{
UnReadToken();
result = 0LL;
}
else if ( (unsigned int)is_symbol(";") )
{
result = func16();
}
else
{
result = 0LL;
}
return result;
}

original_code:
TreeNode * StmMore(){
  TreeNode * t = ((void *)0);
  ReadToken();
  if( is_reversed_word("end") || is_reversed_word("endwh") ){
    UnReadToken();
    return ((void *)0);
  }
  if( is_symbol(";") )
    return StmList();
  return t;
}

canonical_original_code:
struct node *StmMore(){
  struct node *t = ((void *)0);
  ReadToken();
  if( is_reversed_word("end") || is_reversed_word("endwh") ){
    UnReadToken();
    return ((void *)0);
  }
  if( is_symbol(";") )
    return StmList();
  return t;
}


LoopStm

decompiled_code:
char *LoopStm()
{
char *v0; // rax
char *v1; // r12

v0 = (char *)malloc(0x1C8uLL);
v1 = v0;
if ( !v0 )
return v1;
*((_DWORD *)v0 + 9) = 7;
strcpy(v0 + 40, "StmtK While");
*(_QWORD *)v0 = Exp();
ReadToken();
if ( (unsigned int)is_not_reversed_word("do") )
fwrite("LoopStm miss 'do'\n", 1uLL, 0x12uLL, stderr);
*((_QWORD *)v1 + 1) = StmList();
ReadToken();
if ( !(unsigned int)is_not_reversed_word("endwh") )
return v1;
fwrite("LoopStm miss 'endwh'\n", 1uLL, 0x15uLL, stderr);
return v1;
}

canonical_decompiled_code:
char *func18()
{
char *v0; // rax
char *v1; // r12

v0 = (char *)malloc(0x1C8uLL);
v1 = v0;
if ( !v0 )
return v1;
*((_DWORD *)v0 + 9) = 7;
strcpy(v0 + 40, "StmtK While");
*(_QWORD *)v0 = func3();
ReadToken();
if ( (unsigned int)is_not_reversed_word("do") )
fwrite("LoopStm miss 'do'\n", 1uLL, 0x12uLL, stderr);
*((_QWORD *)v1 + 1) = func16();
ReadToken();
if ( !(unsigned int)is_not_reversed_word("endwh") )
return v1;
fwrite("LoopStm miss 'endwh'\n", 1uLL, 0x15uLL, stderr);
return v1;
}

original_code:
TreeNode * LoopStm(){
  TreeNode * t = (TreeNode * )malloc(sizeof(TreeNode));
  if( t == ((void *)0) )
    return t;
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK While");
  t->child[0] = Exp();
  ReadToken();
  if( is_not_reversed_word("do") )
    fprintf(stderr, "LoopStm miss 'do'\n");
  t->child[1] = StmList();
  ReadToken();
  if( is_not_reversed_word("endwh") )
    fprintf(stderr, "LoopStm miss 'endwh'\n");
  return t;
}

canonical_original_code:
struct node *LoopStm(){
  struct node *t = (TreeNode * )malloc(sizeof(TreeNode));
  if( t == ((void *)0) )
    return t;
  t->nodeKind = StmtK;
  strcpy(t->nodeKindStr, "StmtK While");
  t->child[0] = Exp();
  ReadToken();
  if( is_not_reversed_word("do") )
    fprintf(stderr, "LoopStm miss 'do'\n");
  t->child[1] = StmList();
  ReadToken();
  if( is_not_reversed_word("endwh") )
    fprintf(stderr, "LoopStm miss 'endwh'\n");
  return t;
}


Stm

decompiled_code:
char *Stm()
{
char *result; // rax

ReadToken();
if ( (unsigned int)is_reversed_word("if") )
return (char *)ConditionalStm();
if ( (unsigned int)is_reversed_word("while") )
return LoopStm();
if ( (unsigned int)is_reversed_word("return") )
return (char *)ReturnStm();
if ( (unsigned int)is_reversed_word("write") )
return (char *)OutputStm();
if ( (unsigned int)is_reversed_word("read") )
return (char *)InputStm();
if ( tokenType == 5 )
{
strcpy(temp_name, &tokenValueBuffer);
result = (char *)AssCall();
}
else
{
UnReadToken();
result = 0LL;
}
return result;
}

canonical_decompiled_code:
char *func19()
{
char *result; // rax

ReadToken();
if ( (unsigned int)is_reversed_word("if") )
return (char *)func15();
if ( (unsigned int)is_reversed_word("while") )
return func18();
if ( (unsigned int)is_reversed_word("return") )
return (char *)func12();
if ( (unsigned int)is_reversed_word("write") )
return (char *)func14();
if ( (unsigned int)is_reversed_word("read") )
return (char *)func13();
if ( tokenType == 5 )
{
strcpy(temp_name, &tokenValueBuffer);
result = (char *)func11();
}
else
{
UnReadToken();
result = 0LL;
}
return result;
}

original_code:
TreeNode * Stm(){
  ReadToken();
  if( is_reversed_word("if") )
    return ConditionalStm();
  if( is_reversed_word("while") )
    return LoopStm();
  if( is_reversed_word("return") )
    return ReturnStm();
  if( is_reversed_word("write") )
    return OutputStm();
  if( is_reversed_word("read") )
    return InputStm();
  if( ( tokenType == SNL_ID ) ) {
    strcpy(temp_name, tokenValueBuffer);
    return AssCall();
  }
  UnReadToken();
  return ((void *)0);
}

canonical_original_code:
struct node *Stm(){
  ReadToken();
  if( is_reversed_word("if") )
    return ConditionalStm();
  if( is_reversed_word("while") )
    return LoopStm();
  if( is_reversed_word("return") )
    return ReturnStm();
  if( is_reversed_word("write") )
    return OutputStm();
  if( is_reversed_word("read") )
    return InputStm();
  if( ( tokenType == SNL_ID ) ) {
    strcpy(temp_name, tokenValueBuffer);
    return AssCall();
  }
  UnReadToken();
  return ((void *)0);
}


ProgramBody

decompiled_code:
void *ProgramBody()
{
void *v0; // rax
void *v1; // r12
void *result; // rax

ReadToken();
if ( (unsigned int)is_not_reversed_word("begin") )
{
fwrite("Program body miss reversed word 'begin' \n", 1uLL, 0x29uLL, stderr);
UnReadToken();
result = 0LL;
}
else
{
v0 = malloc(0x1C8uLL);
*((_DWORD *)v0 + 9) = 5;
v1 = v0;
strcpy((char *)v0 + 40, "StmLK");
*(_QWORD *)v0 = StmList();
ReadToken();
if ( (unsigned int)is_not_reversed_word("end") )
{
v1 = 0LL;
fwrite("Program body miss reversed word 'end' \n", 1uLL, 0x27uLL, stderr);
UnReadToken();
}
result = v1;
}
return result;
}

canonical_decompiled_code:
void *func20()
{
void *v0; // rax
void *v1; // r12
void *result; // rax

ReadToken();
if ( (unsigned int)is_not_reversed_word("begin") )
{
fwrite("Program body miss reversed word 'begin' \n", 1uLL, 0x29uLL, stderr);
UnReadToken();
result = 0LL;
}
else
{
v0 = malloc(0x1C8uLL);
*((_DWORD *)v0 + 9) = 5;
v1 = v0;
strcpy((char *)v0 + 40, "StmLK");
*(_QWORD *)v0 = func16();
ReadToken();
if ( (unsigned int)is_not_reversed_word("end") )
{
v1 = 0LL;
fwrite("Program body miss reversed word 'end' \n", 1uLL, 0x27uLL, stderr);
UnReadToken();
}
result = v1;
}
return result;
}

original_code:
TreeNode * ProgramBody(){
  TreeNode * t = ((void *)0);
  ReadToken();
  if( is_not_reversed_word("begin") ){
    fprintf(stderr, "Program body miss reversed word 'begin' \n");
    UnReadToken();
    return ((void *)0);
  }
  t = (TreeNode * )malloc(sizeof(TreeNode));
  t->nodeKind = StmLK;
  strcpy(t->nodeKindStr, "StmLK");
  if(t)
    t->child[0] = StmList();
  ReadToken();
  if( is_not_reversed_word("end") ){
    fprintf(stderr, "Program body miss reversed word 'end' \n");
    UnReadToken();
    return ((void *)0);
  }
  return t;
}

canonical_original_code:
struct node *ProgramBody(){
  struct node *t = ((void *)0);
  ReadToken();
  if( is_not_reversed_word("begin") ){
    fprintf(stderr, "Program body miss reversed word 'begin' \n");
    UnReadToken();
    return ((void *)0);
  }
  t = (struct node * )malloc(sizeof(TreeNode));
  t->nodeKind = StmLK;
  strcpy(t->nodeKindStr, "StmLK");
  if(t)
    t->child[0] = StmList();
  ReadToken();
  if( is_not_reversed_word("end") ){
    fprintf(stderr, "Program body miss reversed word 'end' \n");
    UnReadToken();
    return ((void *)0);
  }
  return t;
}


VarIdList

decompiled_code:
__int64 __fastcall VarIdList(__int64 a1)
{
__int64 v2; // rax

ReadToken();
if ( tokenType == 5 )
{
v2 = *(int *)(a1 + 104);
*(_DWORD *)(a1 + 104) = v2 + 1;
strcpy((char *)(a1 + 30 * v2 + 108), &tokenValueBuffer);
}
return VarIdMore(a1);
}

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

ReadToken();
if ( tokenType == 5 )
{
v2 = *(int *)(a1 + 104);
*(_DWORD *)(a1 + 104) = v2 + 1;
strcpy((char *)(a1 + 30 * v2 + 108), &tokenValueBuffer);
}
return func1(a1);
}

original_code:
void VarIdList(TreeNode * t){
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  VarIdMore(t);
}

canonical_original_code:
void VarIdList(struct node *t){
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  VarIdMore(t);
}


VarIdMore

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

ReadToken();
result = is_symbol(&unk_1E6);
if ( !(_DWORD)result )
{
result = is_symbol(&unk_1E8);
if ( (_DWORD)result )
result = VarIdList(a1);
}
return result;
}

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

ReadToken();
result = is_symbol(&unk_1E6);
if ( !(_DWORD)result )
{
result = is_symbol(&unk_1E8);
if ( (_DWORD)result )
result = func0(a1);
}
return result;
}

original_code:
void VarIdMore(TreeNode * t){
  ReadToken();
  if( is_symbol(";") )
    return;
  else if( is_symbol(",") )
    VarIdList(t);
}

canonical_original_code:
void VarIdMore(struct node *t){
  ReadToken();
  if( is_symbol(";") )
    return;
  else if( is_symbol(",") )
    VarIdList(t);
}


VarDecList

decompiled_code:
__int64 VarDecList()
{
void *v0; // rax
__int64 v1; // r12

v0 = malloc(0x1C8uLL);
v1 = (__int64)v0;
if ( v0 )
{
TypeDef(v0);
VarIdList(v1);
*(_DWORD *)(v1 + 36) = 6;
strcpy((char *)(v1 + 40), "DecK");
*(_QWORD *)(v1 + 24) = VarDecMore();
}
return v1;
}

original_code:
TreeNode * VarDecList(){
  TreeNode * t = (TreeNode *)malloc(sizeof(TreeNode));
  if(t == ((void *)0))
    return t;
  TypeDef(t);
  VarIdList(t);
  t->nodeKind = DecK;
  strcpy(t->nodeKindStr, "DecK");
  t->Sibling = VarDecMore();
  return t;
}

canonical_original_code:
struct node *VarDecList(){
  struct node *t = (TreeNode *)malloc(sizeof(TreeNode));
  if(t == ((void *)0))
    return t;
  TypeDef(t);
  VarIdList(t);
  t->nodeKind = DecK;
  strcpy(t->nodeKindStr, "DecK");
  t->Sibling = VarDecMore();
  return t;
}


VarDecMore

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

ReadToken();
if ( (unsigned int)is_reversed_word("integer")
|| (unsigned int)is_reversed_word("char")
|| (unsigned int)is_reversed_word("array")
|| (unsigned int)is_reversed_word("record")
|| tokenType == 5 )
{
UnReadToken();
result = VarDecList();
}
else
{
UnReadToken();
result = 0LL;
}
return result;
}

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

ReadToken();
if ( (unsigned int)is_reversed_word("integer")
|| (unsigned int)is_reversed_word("char")
|| (unsigned int)is_reversed_word("array")
|| (unsigned int)is_reversed_word("record")
|| tokenType == 5 )
{
UnReadToken();
result = func2();
}
else
{
UnReadToken();
result = 0LL;
}
return result;
}

original_code:
TreeNode * VarDecMore(){
  TreeNode * t = ((void *)0);
  ReadToken();
  if(
      is_reversed_word("integer") ||
      is_reversed_word("char") ||
      is_reversed_word("array") ||
      is_reversed_word("record") ||
      ( tokenType == SNL_ID )
    )
  {
    UnReadToken();
    t = VarDecList();
  } else
    UnReadToken();
  return t;
}

canonical_original_code:
struct node *VarDecMore(){
  struct node *t = ((void *)0);
  ReadToken();
  if(
      is_reversed_word("integer") ||
      is_reversed_word("char") ||
      is_reversed_word("array") ||
      is_reversed_word("record") ||
      ( tokenType == SNL_ID )
    )
  {
    UnReadToken();
    t = VarDecList();
  } else
    UnReadToken();
  return t;
}


VarDeclaration

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

result = VarDecList();
if ( !result )
{
fwrite("Error var dec", 1uLL, 0xDuLL, stderr);
result = 0LL;
}
return result;
}

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

result = func2();
if ( !result )
{
fwrite("Error var dec", 1uLL, 0xDuLL, stderr);
result = 0LL;
}
return result;
}

original_code:
TreeNode * VarDeclaration(){
  TreeNode * t = VarDecList();
  if( t == ((void *)0) )
    fprintf(stderr, "Error var dec");
  return t;
}

canonical_original_code:
struct node *VarDeclaration(){
  struct node *t = VarDecList();
  if( t == ((void *)0) )
    fprintf(stderr, "Error var dec");
  return t;
}


VarDec

decompiled_code:
__int64 VarDec()
{
ReadToken();
if ( (unsigned int)is_reversed_word("var") )
return VarDeclaration();
UnReadToken();
return 0LL;
}

canonical_decompiled_code:
__int64 func5()
{
ReadToken();
if ( (unsigned int)is_reversed_word("var") )
return func4();
UnReadToken();
return 0LL;
}

original_code:
TreeNode * VarDec(){
  ReadToken();
  if( is_reversed_word("var") ){
    return VarDeclaration();
  }
  else {
    UnReadToken();
  }
  return ((void *)0);
}

canonical_original_code:
struct node *VarDec(){
  ReadToken();
  if( is_reversed_word("var") ){
    return VarDeclaration();
  }
  else {
    UnReadToken();
  }
  return ((void *)0);
}


ProcBody

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

result = ProgramBody();
if ( !result )
{
fwrite("no procedure body error\n", 1uLL, 0x18uLL, stderr);
result = 0LL;
}
return result;
}

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

result = ProgramBody();
if ( !result )
{
fwrite("no procedure body error\n", 1uLL, 0x18uLL, stderr);
result = 0LL;
}
return result;
}

original_code:
TreeNode * ProcBody(){
  TreeNode * t = ProgramBody();
  if( t == ((void *)0) )
    fprintf(stderr, "no procedure body error\n");
  return t;
}

canonical_original_code:
struct node *ProcBody(){
  struct node *t = ProgramBody();
  if( t == ((void *)0) )
    fprintf(stderr, "no procedure body error\n");
  return t;
}


ProcDecPart

decompiled_code:
__int64 ProcDecPart()
{
return DeclarePart();
}

canonical_decompiled_code:
__int64 func1()
{
return DeclarePart();
}

original_code:
TreeNode * ProcDecPart(){
  return DeclarePart();
}

canonical_original_code:
struct node *ProcDecPart(){
  return DeclarePart();
}


FormList

decompiled_code:
__int64 __fastcall FormList(__int64 a1)
{
__int64 v2; // rax

ReadToken();
if ( tokenType == 5 )
{
v2 = *(int *)(a1 + 104);
*(_DWORD *)(a1 + 104) = v2 + 1;
strcpy((char *)(a1 + 30 * v2 + 108), &tokenValueBuffer);
}
return FidMore(a1);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
__int64 v2; // rax

ReadToken();
if ( tokenType == 5 )
{
v2 = *(int *)(a1 + 104);
*(_DWORD *)(a1 + 104) = v2 + 1;
strcpy((char *)(a1 + 30 * v2 + 108), &tokenValueBuffer);
}
return func3(a1);
}

original_code:
void FormList(TreeNode * t){
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  FidMore(t);
}

canonical_original_code:
void FormList(struct node *t){
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  FidMore(t);
}


FidMore

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

ReadToken();
result = is_symbol(";");
if ( !(_DWORD)result )
{
result = is_symbol(")");
if ( !(_DWORD)result )
{
if ( (unsigned int)is_symbol(",") )
result = FormList(a1);
else
result = fwrite("FormList Error\n", 1uLL, 0xFuLL, stderr);
}
}
return result;
}

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

ReadToken();
result = is_symbol(";");
if ( !(_DWORD)result )
{
result = is_symbol(")");
if ( !(_DWORD)result )
{
if ( (unsigned int)is_symbol(",") )
result = func2(a1);
else
result = fwrite("FormList Error\n", 1uLL, 0xFuLL, stderr);
}
}
return result;
}

original_code:
void FidMore(TreeNode * t){
  ReadToken();
  if( is_symbol(";") || is_symbol(")") )
    return;
  if( is_symbol(",") ){
    FormList(t);
    return;
  }
  fprintf(stderr, "FormList Error\n");
}

canonical_original_code:
void FidMore(struct node *t){
  ReadToken();
  if( is_symbol(";") || is_symbol(")") )
    return;
  if( is_symbol(",") ){
    FormList(t);
    return;
  }
  fprintf(stderr, "FormList Error\n");
}


Param

decompiled_code:
_DWORD *Param()
{
_DWORD *v0; // r12

v0 = malloc(0x1C8uLL);
if ( v0 )
{
if ( (unsigned int)is_reversed_word("integer")
|| (unsigned int)is_reversed_word("char")
|| (unsigned int)is_reversed_word("record")
|| (unsigned int)is_reversed_word("array")
|| tokenType == 5 )
{
v0[110] = 1;
UnReadToken();
TypeDef(v0);
FormList((__int64)v0);
}
else if ( (unsigned int)is_reversed_word("var") )
{
v0[110] = 1;
TypeDef(v0);
FormList((__int64)v0);
}
}
return v0;
}

canonical_decompiled_code:
_DWORD *func4()
{
_DWORD *v0; // r12

v0 = malloc(0x1C8uLL);
if ( v0 )
{
if ( (unsigned int)is_reversed_word("integer")
|| (unsigned int)is_reversed_word("char")
|| (unsigned int)is_reversed_word("record")
|| (unsigned int)is_reversed_word("array")
|| tokenType == 5 )
{
v0[110] = 1;
UnReadToken();
TypeDef(v0);
func2((__int64)v0);
}
else if ( (unsigned int)is_reversed_word("var") )
{
v0[110] = 1;
TypeDef(v0);
func2((__int64)v0);
}
}
return v0;
}

original_code:
TreeNode * Param(){
  TreeNode * t = (TreeNode *)malloc(sizeof(TreeNode));
  if( t == ((void *)0) )
    return ((void *)0);
  if(
      is_reversed_word("integer") ||
      is_reversed_word("char") ||
      is_reversed_word("record") ||
      is_reversed_word("array") ||
      ( tokenType == SNL_ID )
    ){
    t->attr.p_attr.paramt = varparamtype;
    UnReadToken();
    TypeDef(t);
    FormList(t);
  } else if( is_reversed_word("var") ){
    t->attr.p_attr.paramt = varparamtype;
    TypeDef(t);
    FormList(t);
  }
  return t;
}

canonical_original_code:
struct node *Param(){
  struct node *t = (TreeNode *)malloc(sizeof(TreeNode));
  if( t == ((void *)0) )
    return ((void *)0);
  if(
      is_reversed_word("integer") ||
      is_reversed_word("char") ||
      is_reversed_word("record") ||
      is_reversed_word("array") ||
      ( tokenType == SNL_ID )
    ){
    t->attr.p_attr.paramt = varparamtype;
    UnReadToken();
    TypeDef(t);
    FormList(t);
  } else if( is_reversed_word("var") ){
    t->attr.p_attr.paramt = varparamtype;
    TypeDef(t);
    FormList(t);
  }
  return t;
}


ParamDecList

decompiled_code:
char *ParamDecList()
{
char *v0; // r12
__int64 v1; // rax

v0 = (char *)Param();
v1 = ParamMore();
*((_DWORD *)v0 + 9) = 6;
strcpy(v0 + 40, "DecK");
if ( v1 )
*((_QWORD *)v0 + 3) = v1;
return v0;
}

original_code:
TreeNode * ParamDecList(){
  TreeNode * t = Param();
  TreeNode * p = ParamMore();
  t->nodeKind = DecK;
  strcpy(t->nodeKindStr, "DecK");
  if(p)
    t->Sibling = p;
  return t;
}

canonical_original_code:
struct node *ParamDecList(){
  struct node *t = Param();
  struct node *p = ParamMore();
  t->nodeKind = DecK;
  strcpy(t->nodeKindStr, "DecK");
  if(p)
    t->Sibling = p;
  return t;
}


ParamMore

decompiled_code:
char *ParamMore()
{
char *result; // rax

if ( (unsigned int)is_symbol(")") )
{
UnReadToken();
result = 0LL;
}
else if ( !(unsigned int)is_symbol(";") || (ReadToken(), (result = ParamDecList()) == 0LL) )
{
fwrite("Param More Error\n", 1uLL, 0x11uLL, stderr);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
char *func6()
{
char *result; // rax

if ( (unsigned int)is_symbol(")") )
{
UnReadToken();
result = 0LL;
}
else if ( !(unsigned int)is_symbol(";") || (ReadToken(), (result = func5()) == 0LL) )
{
fwrite("Param More Error\n", 1uLL, 0x11uLL, stderr);
result = 0LL;
}
return result;
}

original_code:
TreeNode * ParamMore(){
  if( is_symbol(")") ){
    UnReadToken();
    return ((void *)0);
  }
  TreeNode * t = ((void *)0);
  if( is_symbol(";") ){
    ReadToken();
    t = ParamDecList();
  }
  if( t == ((void *)0) )
    fprintf(stderr,"Param More Error\n");
  return t;
}

canonical_original_code:
struct node *ParamMore(){
  if( is_symbol(")") ){
    UnReadToken();
    return ((void *)0);
  }
  struct node *t = ((void *)0);
  if( is_symbol(";") ){
    ReadToken();
    t = ParamDecList();
  }
  if( t == ((void *)0) )
    fprintf(stderr,"Param More Error\n");
  return t;
}


ParamList

decompiled_code:
char *__fastcall ParamList(char **a1)
{
char *result; // rax

ReadToken();
if ( !(unsigned int)is_reversed_word("integer")
&& !(unsigned int)is_reversed_word("char")
&& !(unsigned int)is_reversed_word("record")
&& !(unsigned int)is_reversed_word("array") )
{
is_reversed_word("var");
}
result = ParamDecList();
*a1 = result;
return result;
}

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

ReadToken();
if ( !(unsigned int)is_reversed_word("integer")
&& !(unsigned int)is_reversed_word("char")
&& !(unsigned int)is_reversed_word("record")
&& !(unsigned int)is_reversed_word("array") )
{
is_reversed_word("var");
}
result = func5();
*a1 = result;
return result;
}

original_code:
void ParamList(TreeNode * t){
  ReadToken();
  if(
      is_reversed_word("integer") ||
      is_reversed_word("char") ||
      is_reversed_word("record") ||
      is_reversed_word("array") ||
      is_reversed_word("var") ||
      ( tokenType == SNL_ID )
    );
    t->child[0] = ParamDecList();
}

canonical_original_code:
void ParamList(struct node *t){
  ReadToken();
  if(
      is_reversed_word("integer") ||
      is_reversed_word("char") ||
      is_reversed_word("record") ||
      is_reversed_word("array") ||
      is_reversed_word("var") ||
      ( tokenType == SNL_ID )
    );
    t->child[0] = ParamDecList();
}


ProcDecLaration

decompiled_code:
char *ProcDecLaration()
{
char *v0; // rax
char *v1; // r12
__int64 v3; // rax

v0 = (char *)malloc(0x1C8uLL);
v1 = v0;
if ( v0 )
{
*((_DWORD *)v0 + 9) = 4;
strcpy(v0 + 40, "ProcDecK");
ReadToken();
if ( tokenType == 5 )
{
v3 = *((int *)v1 + 26);
*((_DWORD *)v1 + 26) = v3 + 1;
strcpy(&v1[30 * v3 + 108], &tokenValueBuffer);
}
ReadToken();
if ( (unsigned int)is_not_symbol("(") )
fwrite("Procedure declare miss '('\n", 1uLL, 0x1BuLL, stderr);
ParamList((char **)v1);
ReadToken();
if ( (unsigned int)is_not_symbol(")") )
fwrite("Procedure declare miss ')'\n", 1uLL, 0x1BuLL, stderr);
ReadToken();
if ( (unsigned int)is_not_symbol(";") )
fwrite("Procedure declare miss ';'\n", 1uLL, 0x1BuLL, stderr);
*((_QWORD *)v1 + 1) = ProcDecPart();
*((_QWORD *)v1 + 2) = ProcBody();
}
return v1;
}

canonical_decompiled_code:
char *func8()
{
char *v0; // rax
char *v1; // r12
__int64 v3; // rax

v0 = (char *)malloc(0x1C8uLL);
v1 = v0;
if ( v0 )
{
*((_DWORD *)v0 + 9) = 4;
strcpy(v0 + 40, "ProcDecK");
ReadToken();
if ( tokenType == 5 )
{
v3 = *((int *)v1 + 26);
*((_DWORD *)v1 + 26) = v3 + 1;
strcpy(&v1[30 * v3 + 108], &tokenValueBuffer);
}
ReadToken();
if ( (unsigned int)is_not_symbol("(") )
fwrite("Procedure declare miss '('\n", 1uLL, 0x1BuLL, stderr);
func7((char **)v1);
ReadToken();
if ( (unsigned int)is_not_symbol(")") )
fwrite("Procedure declare miss ')'\n", 1uLL, 0x1BuLL, stderr);
ReadToken();
if ( (unsigned int)is_not_symbol(";") )
fwrite("Procedure declare miss ';'\n", 1uLL, 0x1BuLL, stderr);
*((_QWORD *)v1 + 1) = func1();
*((_QWORD *)v1 + 2) = func0();
}
return v1;
}

original_code:
TreeNode * ProcDecLaration(){
  TreeNode * t = ((void *)0);
  t = (TreeNode *)malloc(sizeof(TreeNode));
  if( t == ((void *)0) )
    return t;
  t->nodeKind = ProcDecK;
  strcpy(t->nodeKindStr, "ProcDecK");
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  ReadToken();
  if( is_not_symbol("(") )
    fprintf(stderr, "Procedure declare miss '('\n");
  ParamList(t);
  ReadToken();
  if( is_not_symbol(")") )
    fprintf(stderr, "Procedure declare miss ')'\n");
  ReadToken();
  if( is_not_symbol(";") )
    fprintf(stderr, "Procedure declare miss ';'\n");
  t->child[1] = ProcDecPart();
  t->child[2] = ProcBody();
  return t;
}

canonical_original_code:
struct node *ProcDecLaration(){
  struct node *t = ((void *)0);
  t = (struct node *)malloc(sizeof(TreeNode));
  if( t == ((void *)0) )
    return t;
  t->nodeKind = ProcDecK;
  strcpy(t->nodeKindStr, "ProcDecK");
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  ReadToken();
  if( is_not_symbol("(") )
    fprintf(stderr, "Procedure declare miss '('\n");
  ParamList(t);
  ReadToken();
  if( is_not_symbol(")") )
    fprintf(stderr, "Procedure declare miss ')'\n");
  ReadToken();
  if( is_not_symbol(";") )
    fprintf(stderr, "Procedure declare miss ';'\n");
  t->child[1] = ProcDecPart();
  t->child[2] = ProcBody();
  return t;
}


ProcDec

decompiled_code:
char *ProcDec()
{
ReadToken();
if ( !(unsigned int)is_not_reversed_word("procedure") )
return ProcDecLaration();
UnReadToken();
return 0LL;
}

canonical_decompiled_code:
char *func9()
{
ReadToken();
if ( !(unsigned int)is_not_reversed_word("procedure") )
return func8();
UnReadToken();
return 0LL;
}

original_code:
TreeNode * ProcDec(){
  ReadToken();
  if( is_not_reversed_word("procedure") ){
    UnReadToken();
    return ((void *)0);
  }
  return ProcDecLaration();
}

canonical_original_code:
struct node *ProcDec(){
  ReadToken();
  if( is_not_reversed_word("procedure") ){
    UnReadToken();
    return ((void *)0);
  }
  return ProcDecLaration();
}


BaseType

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

ReadToken();
if ( (unsigned int)is_reversed_word("integer") )
{
result = 0x4B72656765746E49LL;
strcpy((char *)(a1 + 72), "IntegerK");
}
else
{
result = is_reversed_word("char");
if ( (_DWORD)result )
{
result = 75LL;
strcpy((char *)(a1 + 72), "CharK");
}
}
return result;
}

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

ReadToken();
if ( (unsigned int)is_reversed_word("integer") )
{
result = 0x4B72656765746E49LL;
strcpy((char *)(a1 + 72), "IntegerK");
}
else
{
result = is_reversed_word("char");
if ( (_DWORD)result )
{
result = 75LL;
strcpy((char *)(a1 + 72), "CharK");
}
}
return result;
}

original_code:
void BaseType(TreeNode * t){
  ReadToken();
  if( is_reversed_word("integer") ){
    t->kind.d = IntegerK;
    strcpy(t->kind.name, "IntegerK");
    return;
  }
  if( is_reversed_word("char") ){
    t->kind.d = CharK;
    strcpy(t->kind.name, "CharK");
    return;
  }
}

canonical_original_code:
void BaseType(struct node *t){
  ReadToken();
  if( is_reversed_word("integer") ){
    t->kind.d = IntegerK;
    strcpy(t->kind.name, "IntegerK");
    return;
  }
  if( is_reversed_word("char") ){
    t->kind.d = CharK;
    strcpy(t->kind.name, "CharK");
    return;
  }
}


ArrayType

decompiled_code:
size_t __fastcall ArrayType(__int64 a1)
{
ReadToken();
if ( (unsigned int)is_not_symbol("[") )
return fwrite("array declaration '[' miss! \n", 1uLL, 0x1DuLL, stderr);
if ( (unsigned int)ReadToken() )
return fwrite("array declaration 'low' miss! \n", 1uLL, 0x1FuLL, stderr);
*(_DWORD *)(a1 + 440) = i_tokenValueBuffer;
ReadToken();
if ( (unsigned int)is_not_symbol("..") )
return fwrite("array declaration '..' miss! \n", 1uLL, 0x1EuLL, stderr);
if ( (unsigned int)ReadToken() )
return fwrite("array declaration 'up' miss! \n", 1uLL, 0x1EuLL, stderr);
*(_DWORD *)(a1 + 444) = i_tokenValueBuffer;
ReadToken();
if ( (unsigned int)is_not_symbol("]") )
return fwrite("array declaration ']' miss! \n", 1uLL, 0x1DuLL, stderr);
ReadToken();
if ( (unsigned int)is_not_reversed_word("of") )
return fwrite("array declaration 'of' miss! \n", 1uLL, 0x1EuLL, stderr);
BaseType(a1);
strcpy((char *)(a1 + 72), "ArrayK");
*(_DWORD *)(a1 + 448) = *(_DWORD *)(a1 + 72);
return 19321LL;
}

canonical_decompiled_code:
size_t __fastcall func1(__int64 a1)
{
ReadToken();
if ( (unsigned int)is_not_symbol("[") )
return fwrite("array declaration '[' miss! \n", 1uLL, 0x1DuLL, stderr);
if ( (unsigned int)ReadToken() )
return fwrite("array declaration 'low' miss! \n", 1uLL, 0x1FuLL, stderr);
*(_DWORD *)(a1 + 440) = i_tokenValueBuffer;
ReadToken();
if ( (unsigned int)is_not_symbol("..") )
return fwrite("array declaration '..' miss! \n", 1uLL, 0x1EuLL, stderr);
if ( (unsigned int)ReadToken() )
return fwrite("array declaration 'up' miss! \n", 1uLL, 0x1EuLL, stderr);
*(_DWORD *)(a1 + 444) = i_tokenValueBuffer;
ReadToken();
if ( (unsigned int)is_not_symbol("]") )
return fwrite("array declaration ']' miss! \n", 1uLL, 0x1DuLL, stderr);
ReadToken();
if ( (unsigned int)is_not_reversed_word("of") )
return fwrite("array declaration 'of' miss! \n", 1uLL, 0x1EuLL, stderr);
func0(a1);
strcpy((char *)(a1 + 72), "ArrayK");
*(_DWORD *)(a1 + 448) = *(_DWORD *)(a1 + 72);
return 19321LL;
}

original_code:
void ArrayType(TreeNode * t){
  ReadToken();
  if( is_not_symbol("[") ){
    fprintf(stderr, "array declaration '[' miss! \n");
    return;
  }
  if( ReadToken() != SNL_INTERGER){
    fprintf(stderr, "array declaration 'low' miss! \n");
    return;
  } else
    t->attr.a_attr.low = i_tokenValueBuffer;
  ReadToken();
  if( is_not_symbol("..") ){
    fprintf(stderr, "array declaration '..' miss! \n");
    return;
  }
  if( ReadToken() != SNL_INTERGER){
    fprintf(stderr, "array declaration 'up' miss! \n");
    return;
  } else
    t->attr.a_attr.up = i_tokenValueBuffer;
  ReadToken();
  if( is_not_symbol("]") ){
    fprintf(stderr, "array declaration ']' miss! \n");
    return;
  }
  ReadToken();
  if( is_not_reversed_word("of") ){
    fprintf(stderr, "array declaration 'of' miss! \n");
    return;
  }
  BaseType(t);
  t->attr.a_attr.childType = t->kind.d;
  t->kind.d = ArrayK;
  strcpy(t->kind.name, "ArrayK");
}

canonical_original_code:
void ArrayType(struct node *t){
  ReadToken();
  if( is_not_symbol("[") ){
    fprintf(stderr, "array declaration '[' miss! \n");
    return;
  }
  if( ReadToken() != SNL_INTERGER){
    fprintf(stderr, "array declaration 'low' miss! \n");
    return;
  } else
    t->attr.a_attr.low = i_tokenValueBuffer;
  ReadToken();
  if( is_not_symbol("..") ){
    fprintf(stderr, "array declaration '..' miss! \n");
    return;
  }
  if( ReadToken() != SNL_INTERGER){
    fprintf(stderr, "array declaration 'up' miss! \n");
    return;
  } else
    t->attr.a_attr.up = i_tokenValueBuffer;
  ReadToken();
  if( is_not_symbol("]") ){
    fprintf(stderr, "array declaration ']' miss! \n");
    return;
  }
  ReadToken();
  if( is_not_reversed_word("of") ){
    fprintf(stderr, "array declaration 'of' miss! \n");
    return;
  }
  BaseType(t);
  t->attr.a_attr.childType = t->kind.d;
  t->kind.d = ArrayK;
  strcpy(t->kind.name, "ArrayK");
}


RecType

decompiled_code:
void RecType()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void RecType(TreeNode * t){
}

canonical_original_code:
void RecType(struct node *t){
}


StrutureType

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

if ( (unsigned int)is_reversed_word("array") )
return ArrayType(a1);
result = is_reversed_word("record");
if ( (_DWORD)result )
{
result = 0x4B64726F636552LL;
*(_QWORD *)(a1 + 72) = 0x4B64726F636552LL;
}
return result;
}

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

if ( (unsigned int)is_reversed_word("array") )
return func1(a1);
result = is_reversed_word("record");
if ( (_DWORD)result )
{
result = 0x4B64726F636552LL;
*(_QWORD *)(a1 + 72) = 0x4B64726F636552LL;
}
return result;
}

original_code:
void StrutureType(TreeNode * t){
  if( is_reversed_word("array") ){
    ArrayType(t);
    return;
  }
  if( is_reversed_word("record") ){
    t->kind.d = RecordK;
    strcpy(t->kind.name, "RecordK");
    RecType(t);
    return;
  }
}

canonical_original_code:
void StrutureType(struct node *t){
  if( is_reversed_word("array") ){
    ArrayType(t);
    return;
  }
  if( is_reversed_word("record") ){
    t->kind.d = RecordK;
    strcpy(t->kind.name, "RecordK");
    RecType(t);
    return;
  }
}


TypeId

decompiled_code:
char *__fastcall TypeId(__int64 a1)
{
char *result; // rax
__int64 v2; // rax

ReadToken();
if ( tokenType == 5 )
{
v2 = *(int *)(a1 + 104);
*(_DWORD *)(a1 + 104) = v2 + 1;
result = strcpy((char *)(a1 + 30 * v2 + 108), &tokenValueBuffer);
}
else
{
fwrite("type declaration miss Id.\n", 1uLL, 0x1AuLL, stderr);
result = (char *)UnReadToken();
}
return result;
}

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

ReadToken();
if ( tokenType == 5 )
{
v2 = *(int *)(a1 + 104);
*(_DWORD *)(a1 + 104) = v2 + 1;
result = strcpy((char *)(a1 + 30 * v2 + 108), &tokenValueBuffer);
}
else
{
fwrite("type declaration miss Id.\n", 1uLL, 0x1AuLL, stderr);
result = (char *)UnReadToken();
}
return result;
}

original_code:
void TypeId(TreeNode * t){
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  else{
    fprintf(stderr, "type declaration miss Id.\n");
    UnReadToken();
  }
}

canonical_original_code:
void TypeId(struct node *t){
  ReadToken();
  if( ( tokenType == SNL_ID ) )
    strcpy(t->name[t->idnum++], tokenValueBuffer);
  else{
    fprintf(stderr, "type declaration miss Id.\n");
    UnReadToken();
  }
}


TypeDef

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

ReadToken();
if ( (unsigned int)is_reversed_word("integer") || (unsigned int)is_reversed_word("char") )
{
UnReadToken();
result = BaseType(a1);
}
else if ( (unsigned int)is_reversed_word("array") || (result = is_reversed_word("record"), (_DWORD)result) )
{
result = StrutureType(a1);
}
else if ( tokenType == 5 )
{
*(_DWORD *)(a1 + 72) = 4;
result = (__int64)strcpy((char *)(a1 + 408), &tokenValueBuffer);
}
return result;
}

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

ReadToken();
if ( (unsigned int)is_reversed_word("integer") || (unsigned int)is_reversed_word("char") )
{
UnReadToken();
result = func0(a1);
}
else if ( (unsigned int)is_reversed_word("array") || (result = is_reversed_word("record"), (_DWORD)result) )
{
result = func3(a1);
}
else if ( tokenType == 5 )
{
*(_DWORD *)(a1 + 72) = 4;
result = (__int64)strcpy((char *)(a1 + 408), &tokenValueBuffer);
}
return result;
}

original_code:
void TypeDef(TreeNode * t){
  ReadToken();
  if( is_reversed_word("integer") || is_reversed_word("char") ){
    UnReadToken();
    BaseType(t);
    return;
  }
  if( is_reversed_word("array") || is_reversed_word("record") ){
    StrutureType(t);
    return;
  }
  if( tokenType == SNL_ID ){
    t->kind.d = IdK;
    strcpy(t->type_name, tokenValueBuffer);
  }
}

canonical_original_code:
void TypeDef(struct node *t){
  ReadToken();
  if( is_reversed_word("integer") || is_reversed_word("char") ){
    UnReadToken();
    BaseType(t);
    return;
  }
  if( is_reversed_word("array") || is_reversed_word("record") ){
    StrutureType(t);
    return;
  }
  if( tokenType == SNL_ID ){
    t->kind.d = IdK;
    strcpy(t->type_name, tokenValueBuffer);
  }
}


TypeDecList

decompiled_code:
__int64 TypeDecList()
{
void *v0; // rax
__int64 v1; // r12
__int64 v2; // rax

v0 = malloc(0x1C8uLL);
v1 = (__int64)v0;
if ( v0 )
{
TypeId((__int64)v0);
ReadToken();
if ( (unsigned int)is_not_symbol("=") )
fwrite("type declaration '=' miss! \n", 1uLL, 0x1CuLL, stderr);
TypeDef(v1);
ReadToken();
if ( (unsigned int)is_not_symbol(";") )
fwrite("type declaration ';' miss! \n", 1uLL, 0x1CuLL, stderr);
*(_DWORD *)(v1 + 36) = 6;
strcpy((char *)(v1 + 40), "DecK");
v2 = TypeDecMore();
if ( v2 )
*(_QWORD *)(v1 + 24) = v2;
}
return v1;
}

canonical_decompiled_code:
__int64 func6()
{
void *v0; // rax
__int64 v1; // r12
__int64 v2; // rax

v0 = malloc(0x1C8uLL);
v1 = (__int64)v0;
if ( v0 )
{
func4((__int64)v0);
ReadToken();
if ( (unsigned int)is_not_symbol("=") )
fwrite("type declaration '=' miss! \n", 1uLL, 0x1CuLL, stderr);
func5(v1);
ReadToken();
if ( (unsigned int)is_not_symbol(";") )
fwrite("type declaration ';' miss! \n", 1uLL, 0x1CuLL, stderr);
*(_DWORD *)(v1 + 36) = 6;
strcpy((char *)(v1 + 40), "DecK");
v2 = func7();
if ( v2 )
*(_QWORD *)(v1 + 24) = v2;
}
return v1;
}

original_code:
TreeNode * TypeDecList(){
  TreeNode * t = (TreeNode *)malloc(sizeof(TreeNode));;
  if( t == ((void *)0) )
    return t;
  TypeId(t);
  ReadToken();
  if( is_not_symbol("=") )
    fprintf(stderr, "type declaration '=' miss! \n");
  TypeDef(t);
  ReadToken();
  if( is_not_symbol(";") )
    fprintf(stderr, "type declaration ';' miss! \n");
  t->nodeKind = DecK;
  strcpy(t->nodeKindStr, "DecK");
  TreeNode * p = ((void *)0);
  p = TypeDecMore();
  if( p )
    t->Sibling = p;
  return t;
}

canonical_original_code:
struct node *TypeDecList(){
  struct node *t = (TreeNode *)malloc(sizeof(TreeNode));;
  if( t == ((void *)0) )
    return t;
  TypeId(t);
  ReadToken();
  if( is_not_symbol("=") )
    fprintf(stderr, "type declaration '=' miss! \n");
  TypeDef(t);
  ReadToken();
  if( is_not_symbol(";") )
    fprintf(stderr, "type declaration ';' miss! \n");
  t->nodeKind = DecK;
  strcpy(t->nodeKindStr, "DecK");
  struct node *p = ((void *)0);
  p = TypeDecMore();
  if( p )
    t->Sibling = p;
  return t;
}


TypeDecMore

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

ReadToken();
if ( tokenType == 5 )
{
UnReadToken();
result = TypeDecList();
}
else
{
UnReadToken();
result = 0LL;
}
return result;
}

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

ReadToken();
if ( tokenType == 5 )
{
UnReadToken();
result = func6();
}
else
{
UnReadToken();
result = 0LL;
}
return result;
}

original_code:
TreeNode * TypeDecMore(){
  TreeNode * t = ((void *)0);
  ReadToken();
  if( ( tokenType == SNL_ID ) ){
    UnReadToken();
    t = TypeDecList();
  } else
    UnReadToken();
  return t;
}

canonical_original_code:
struct node *TypeDecMore(){
  struct node *t = ((void *)0);
  ReadToken();
  if( ( tokenType == SNL_ID ) ){
    UnReadToken();
    t = TypeDecList();
  } else
    UnReadToken();
  return t;
}


typeDeclaration

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

result = TypeDecList();
if ( !result )
{
fwrite("type declaration error!\n", 1uLL, 0x18uLL, stderr);
result = 0LL;
}
return result;
}

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

result = func6();
if ( !result )
{
fwrite("type declaration error!\n", 1uLL, 0x18uLL, stderr);
result = 0LL;
}
return result;
}

original_code:
TreeNode * typeDeclaration(){
  TreeNode * t = TypeDecList();
  if( t == ((void *)0) )
    fprintf(stderr, "type declaration error!\n");
  return t;
}

canonical_original_code:
struct node *typeDeclaration(){
  struct node *t = TypeDecList();
  if( t == ((void *)0) )
    fprintf(stderr, "type declaration error!\n");
  return t;
}


TypeDec

decompiled_code:
__int64 TypeDec()
{
ReadToken();
if ( (unsigned int)is_reversed_word("type") )
return typeDeclaration();
UnReadToken();
return 0LL;
}

canonical_decompiled_code:
__int64 func9()
{
ReadToken();
if ( (unsigned int)is_reversed_word("type") )
return func8();
UnReadToken();
return 0LL;
}

original_code:
TreeNode * TypeDec(){
  TreeNode * t = ((void *)0);
  ReadToken();
  if( is_reversed_word("type") ){
    t = typeDeclaration();
  } else
    UnReadToken();
  return t;
}

canonical_original_code:
struct node *TypeDec(){
  struct node *t = ((void *)0);
  ReadToken();
  if( is_reversed_word("type") ){
    t = typeDeclaration();
  } else
    UnReadToken();
  return t;
}


decompiled_code:
int __fastcall print_sym(char a1)
{
return fprintf(out, "%d: %c\n", (unsigned int)lineno, (unsigned int)a1);
}

canonical_decompiled_code:
int __fastcall func2(char a1)
{
return fprintf(out, "%d: %c\n", (unsigned int)lineno, (unsigned int)a1);
}

original_code:
void print_sym(char ch){
  fprintf(out, "%d: %c\n", lineno, ch);
}

variable_types: ch char


UnReadToken

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

strcpy(unReadTokenBuffer, tokenValueBuffer);
result = (unsigned int)tokenType;
hasUnReadToken = 1;
unReadTokenType = tokenType;
return result;
}

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

strcpy(unReadTokenBuffer, tokenValueBuffer);
result = (unsigned int)tokenType;
hasUnReadToken = 1;
unReadTokenType = tokenType;
return result;
}

original_code:
void UnReadToken(){
  strcpy(unReadTokenBuffer, tokenValueBuffer);
  unReadTokenType = tokenType;
  hasUnReadToken = 1;
}


ReadToken

decompiled_code:
__int64 ReadToken()
{
__int64 result; // rax
char v1; // [rsp+Ch] [rbp-4Ch] BYREF
char v2[8]; // [rsp+10h] [rbp-48h] BYREF
char v3; // [rsp+18h] [rbp-40h]
char src[4]; // [rsp+30h] [rbp-28h] BYREF

if ( hasUnReadToken )
{
strcpy(tokenValueBuffer, unReadTokenBuffer);
result = (unsigned int)unReadTokenType;
hasUnReadToken = 0;
tokenType = unReadTokenType;
}
else
{
_isoc99_fscanf(fp, "%d: %s", &v1, v2);
if ( *(_QWORD *)v2 != 0x6465767265736572LL || v3 )
{
if ( *(_DWORD *)v2 == 2901065 )
{
_isoc99_fscanf(fp, " name = %s", src);
tokenType = 5;
strcpy(tokenValueBuffer, src);
result = 5LL;
}
else if ( *(_QWORD *)v2 != 0x2C52454745544E49LL || v3 )
{
result = (unsigned int)tokenType;
if ( v2[0] )
{
tokenType = 6;
strcpy(tokenValueBuffer, v2);
result = 6LL;
}
}
else
{
_isoc99_fscanf(fp, " var = %d", src);
tokenType = 0;
i_tokenValueBuffer = *(_DWORD *)src;
result = 0LL;
}
}
else
{
_isoc99_fscanf(fp, " word: %s", src);
tokenType = 4;
strcpy(tokenValueBuffer, src);
result = 4LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax
char v1; // [rsp+Ch] [rbp-4Ch] BYREF
char v2[8]; // [rsp+10h] [rbp-48h] BYREF
char v3; // [rsp+18h] [rbp-40h]
char src[4]; // [rsp+30h] [rbp-28h] BYREF

if ( hasUnReadToken )
{
strcpy(tokenValueBuffer, unReadTokenBuffer);
result = (unsigned int)unReadTokenType;
hasUnReadToken = 0;
tokenType = unReadTokenType;
}
else
{
_isoc99_fscanf(fp, "%d: %s", &v1, v2);
if ( *(_QWORD *)v2 != 0x6465767265736572LL || v3 )
{
if ( *(_DWORD *)v2 == 2901065 )
{
_isoc99_fscanf(fp, " name = %s", src);
tokenType = 5;
strcpy(tokenValueBuffer, src);
result = 5LL;
}
else if ( *(_QWORD *)v2 != 0x2C52454745544E49LL || v3 )
{
result = (unsigned int)tokenType;
if ( v2[0] )
{
tokenType = 6;
strcpy(tokenValueBuffer, v2);
result = 6LL;
}
}
else
{
_isoc99_fscanf(fp, " var = %d", src);
tokenType = 0;
i_tokenValueBuffer = *(_DWORD *)src;
result = 0LL;
}
}
else
{
_isoc99_fscanf(fp, " word: %s", src);
tokenType = 4;
strcpy(tokenValueBuffer, src);
result = 4LL;
}
}
return result;
}

original_code:
SNL_TYPE ReadToken(){
  if(hasUnReadToken){
    strcpy(tokenValueBuffer, unReadTokenBuffer);
    tokenType = unReadTokenType;
    hasUnReadToken = 0;
    return tokenType;
  }
  int lineno, i;
  char type[30], chs[30];
  fscanf(fp, "%d: %s", &lineno, type);
  if( strcmp(type, "reserved") == 0 ){
    fscanf(fp, " word: %s", chs);
    tokenType = SNL_REVERSE_WORD;
    strcpy(tokenValueBuffer, chs);
  } else if ( strcmp(type, "ID,") == 0 ){
    fscanf(fp, " name = %s", chs);
    tokenType = SNL_ID;
    strcpy(tokenValueBuffer, chs);
  } else if ( strcmp(type, "INTEGER,") == 0 ){
    fscanf(fp, " var = %d", &i);
    tokenType = SNL_INTERGER;
    i_tokenValueBuffer = i;
  } else if (type[0] == '\0'){
    ;
  } else {
    tokenType = SNL_SYMBOL;
    strcpy(tokenValueBuffer, type);
  }
  type[0] = '\0';
  return tokenType;
}

canonical_original_code:
enum SNL_TYPE ReadToken(){
  if(hasUnReadToken){
    strcpy(tokenValueBuffer, unReadTokenBuffer);
    tokenType = unReadTokenType;
    hasUnReadToken = 0;
    return tokenType;
  }
  int lineno; int i;
  char type[30]; char chs[30];
  fscanf(fp, "%d: %s", &lineno, type);
  if( strcmp(type, "reserved") == 0 ){
    fscanf(fp, " word: %s", chs);
    tokenType = SNL_REVERSE_WORD;
    strcpy(tokenValueBuffer, chs);
  } else if ( strcmp(type, "ID,") == 0 ){
    fscanf(fp, " name = %s", chs);
    tokenType = SNL_ID;
    strcpy(tokenValueBuffer, chs);
  } else if ( strcmp(type, "INTEGER,") == 0 ){
    fscanf(fp, " var = %d", &i);
    tokenType = SNL_INTERGER;
    i_tokenValueBuffer = i;
  } else if (type[0] == '\0'){
    ;
  } else {
    tokenType = SNL_SYMBOL;
    strcpy(tokenValueBuffer, type);
  }
  type[0] = '\0';
  return tokenType;
}

variable_types: lineno int

variable_types: i int

variable_types:
type
char [30]

variable_types:
chs
char [30]

return_type: enum SNL_TYPE { SNL_INTERGER=0, SNL_CHAR=1, SNL_ARRAY=2, SNL_RECORD=3, SNL_REVERSE_WORD=4, SNL_ID=5, SNL_SYMBOL=6 }


decompiled_code:
_BOOL8 __fastcall is_reversed_word(const char *a1)
{
_BOOL8 result; // rax

if ( tokenType == 4 )
result = strcmp(a1, &tokenValueBuffer) == 0;
else
result = 0LL;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(const char *a1)
{
_BOOL8 result; // rax

if ( tokenType == 4 )
result = strcmp(a1, &tokenValueBuffer) == 0;
else
result = 0LL;
return result;
}

original_code:
int is_reversed_word(const char * chs){
  return (tokenType == SNL_REVERSE_WORD && strcmp(chs, tokenValueBuffer) == 0) ? 1 : 0;
}

canonical_original_code:
int is_reversed_word(char *chs){
  return (tokenType == SNL_REVERSE_WORD && strcmp(chs, tokenValueBuffer) == 0) ? 1 : 0;
}

variable_types:
chs
char *

return_type: int


decompiled_code:
_BOOL8 __fastcall is_not_reversed_word(const char *a1)
{
return !is_reversed_word(a1);
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(const char *a1)
{
return !func0(a1);
}

original_code:
int is_not_reversed_word(const char * chs){
  return is_reversed_word(chs) ? 0 : 1;
}

canonical_original_code:
int is_not_reversed_word(char *chs){
  return is_reversed_word(chs) ? 0 : 1;
}


decompiled_code:
_BOOL8 __fastcall is_symbol(const char *a1)
{
_BOOL8 result; // rax

if ( tokenType == 6 )
result = strcmp(a1, &tokenValueBuffer) == 0;
else
result = 0LL;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(const char *a1)
{
_BOOL8 result; // rax

if ( tokenType == 6 )
result = strcmp(a1, &tokenValueBuffer) == 0;
else
result = 0LL;
return result;
}

original_code:
int is_symbol(const char * chs){
  return (tokenType == SNL_SYMBOL && strcmp(chs, tokenValueBuffer) == 0) ? 1 : 0;
}

canonical_original_code:
int is_symbol(char *chs){
  return (tokenType == SNL_SYMBOL && strcmp(chs, tokenValueBuffer) == 0) ? 1 : 0;
}


decompiled_code:
_BOOL8 __fastcall is_not_symbol(const char *a1)
{
return !is_symbol(a1);
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(const char *a1)
{
return !func2(a1);
}

original_code:
int is_not_symbol(const char * chs){
  return is_symbol(chs) ? 0 : 1;
}

canonical_original_code:
int is_not_symbol(char *chs){
  return is_symbol(chs) ? 0 : 1;
}


decompiled_code:
int __fastcall printf_syntax_tree(__int64 a1, int a2)
{
int v2; // er13
int v4; // ebx
const char *v5; // rbp
int v6; // ebx
_QWORD *v7; // rbx
int result; // eax

v2 = 4 * a2;
do
{
if ( v2 > 0 )
{
v4 = 0;
do
{
++v4;
putchar(32);
}
while ( v4 != v2 );
}
printf("%s", (const char *)(a1 + 40));
printf(" %s", (const char *)(a1 + 72));
if ( *(int *)(a1 + 104) > 0 )
{
v5 = (const char *)(a1 + 108);
v6 = 0;
do
{
++v6;
printf(" %s", v5);
v5 += 30;
}
while ( *(_DWORD *)(a1 + 104) > v6 );
}
v7 = (_QWORD *)a1;
result = putchar(10);
do
{
if ( *v7 )
result = printf_syntax_tree(*v7, (unsigned int)(a2 + 1));
++v7;
}
while ( v7 != (_QWORD *)(a1 + 24) );
a1 = *(_QWORD *)(a1 + 24);
}
while ( a1 );
return result;
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, int a2)
{
int v2; // er13
int v4; // ebx
const char *v5; // rbp
int v6; // ebx
_QWORD *v7; // rbx
int result; // eax

v2 = 4 * a2;
do
{
if ( v2 > 0 )
{
v4 = 0;
do
{
++v4;
putchar(32);
}
while ( v4 != v2 );
}
printf("%s", (const char *)(a1 + 40));
printf(" %s", (const char *)(a1 + 72));
if ( *(int *)(a1 + 104) > 0 )
{
v5 = (const char *)(a1 + 108);
v6 = 0;
do
{
++v6;
printf(" %s", v5);
v5 += 30;
}
while ( *(_DWORD *)(a1 + 104) > v6 );
}
v7 = (_QWORD *)a1;
result = putchar(10);
do
{
if ( *v7 )
result = func4(*v7, (unsigned int)(a2 + 1));
++v7;
}
while ( v7 != (_QWORD *)(a1 + 24) );
a1 = *(_QWORD *)(a1 + 24);
}
while ( a1 );
return result;
}

original_code:
void printf_syntax_tree(TreeNode * root, int dep){
  int i;
  for(i = 0; i < dep * 4; ++i)putchar(' ');
  printf("%s", root->nodeKindStr);
  printf(" %s", root->kind.name);
  for(i = 0; i < root->idnum; ++i)
    printf(" %s", root->name[i]);
  printf("\n");
  for(i = 0; i < 3; ++i){
    if( root->child[i] ){
      printf_syntax_tree(root->child[i], dep + 1);
    }
  }
  if( root->Sibling ){
    printf_syntax_tree(root->Sibling, dep);
  }
}

canonical_original_code:
void printf_syntax_tree(struct node *root, int dep){
  int i;
  for(i = 0; i < dep * 4; ++i)putchar(' ');
  printf("%s", root->nodeKindStr);
  printf(" %s", root->kind.name);
  for(i = 0; i < root->idnum; ++i)
    printf(" %s", root->name[i]);
  printf("\n");
  for(i = 0; i < 3; ++i){
    if( root->child[i] ){
      printf_syntax_tree(root->child[i], dep + 1);
    }
  }
  if( root->Sibling ){
    printf_syntax_tree(root->Sibling, dep);
  }
}

variable_types: dep int


ProgramHead

decompiled_code:
int *ProgramHead()
{
int *v0; // r12
__int64 v1; // rax

ReadToken();
if ( (unsigned int)is_not_reversed_word("program") )
fwrite("Bad Begin(No reserved word program)\n", 1uLL, 0x24uLL, stderr);
if ( (unsigned int)ReadToken() != 5 )
fwrite("Bad program name\n", 1uLL, 0x11uLL, stderr);
v0 = (int *)malloc(0x1C8uLL);
v0[10] = 1634035792;
v0[9] = 1;
*((_WORD *)v0 + 22) = 19300;
v1 = v0[26];
*((_BYTE *)v0 + 46) = 0;
v0[26] = v1 + 1;
strcpy((char *)v0 + 30 * v1 + 108, &tokenValueBuffer);
return v0;
}

canonical_decompiled_code:
int *func0()
{
int *v0; // r12
__int64 v1; // rax

ReadToken();
if ( (unsigned int)is_not_reversed_word("program") )
fwrite("Bad Begin(No reserved word program)\n", 1uLL, 0x24uLL, stderr);
if ( (unsigned int)ReadToken() != 5 )
fwrite("Bad program name\n", 1uLL, 0x11uLL, stderr);
v0 = (int *)malloc(0x1C8uLL);
v0[10] = 1634035792;
v0[9] = 1;
*((_WORD *)v0 + 22) = 19300;
v1 = v0[26];
*((_BYTE *)v0 + 46) = 0;
v0[26] = v1 + 1;
strcpy((char *)v0 + 30 * v1 + 108, &tokenValueBuffer);
return v0;
}

original_code:
TreeNode * ProgramHead(){
  ReadToken();
  if( is_not_reversed_word("program") ){
    fprintf(stderr, "Bad Begin(No reserved word program)\n");
  }
  if( ReadToken() != SNL_ID ){
    fprintf(stderr, "Bad program name\n");
  }
  TreeNode * t = (TreeNode *)malloc(sizeof(TreeNode));
  t->nodeKind = PheadK;
  strcpy(t->nodeKindStr, "PheadK");
  strcpy(t->name[t->idnum++], tokenValueBuffer);
  return t;
}

canonical_original_code:
struct node *ProgramHead(){
  ReadToken();
  if( is_not_reversed_word("program") ){
    fprintf(stderr, "Bad Begin(No reserved word program)\n");
  }
  if( ReadToken() != SNL_ID ){
    fprintf(stderr, "Bad program name\n");
  }
  struct node *t = (TreeNode *)malloc(sizeof(TreeNode));
  t->nodeKind = PheadK;
  strcpy(t->nodeKindStr, "PheadK");
  strcpy(t->name[t->idnum++], tokenValueBuffer);
  return t;
}


Program

decompiled_code:
_QWORD *Program()
{
int *v0; // rbp
__int64 v1; // r13
__int64 v2; // rbx
void *v3; // rax
_QWORD *v4; // r12

v0 = ProgramHead();
v1 = DeclarePart();
v2 = ProgramBody();
v3 = malloc(0x1C8uLL);
*((_DWORD *)v3 + 9) = 0;
v4 = v3;
strcpy((char *)v3 + 40, "ProK");
if ( v0 )
*(_QWORD *)v3 = v0;
else
fwrite("No Program Head\n", 1uLL, 0x10uLL, stderr);
v4[1] = v1;
if ( v2 )
v4[2] = v2;
else
fwrite("No Program Body\n", 1uLL, 0x10uLL, stderr);
ReadToken();
if ( (unsigned int)is_not_symbol(".") )
fwrite("No Program End Symbol(Dot) \n", 1uLL, 0x1CuLL, stderr);
return v4;
}

canonical_decompiled_code:
_QWORD *func1()
{
int *v0; // rbp
__int64 v1; // r13
__int64 v2; // rbx
void *v3; // rax
_QWORD *v4; // r12

v0 = func0();
v1 = DeclarePart();
v2 = ProgramBody();
v3 = malloc(0x1C8uLL);
*((_DWORD *)v3 + 9) = 0;
v4 = v3;
strcpy((char *)v3 + 40, "ProK");
if ( v0 )
*(_QWORD *)v3 = v0;
else
fwrite("No Program Head\n", 1uLL, 0x10uLL, stderr);
v4[1] = v1;
if ( v2 )
v4[2] = v2;
else
fwrite("No Program Body\n", 1uLL, 0x10uLL, stderr);
ReadToken();
if ( (unsigned int)is_not_symbol(".") )
fwrite("No Program End Symbol(Dot) \n", 1uLL, 0x1CuLL, stderr);
return v4;
}

original_code:
TreeNode * Program(){
  TreeNode *t = ((void *)0), *q = ((void *)0), *s = ((void *)0), *root = ((void *)0);
  t = ProgramHead();
  q = DeclarePart();
  s = ProgramBody();
  root = (TreeNode *)malloc(sizeof(TreeNode));
  root->nodeKind = ProK;
  strcpy(root->nodeKindStr, "ProK");
  if( root == ((void *)0))
    return ((void *)0);
  if(t == ((void *)0)){
    fprintf(stderr, "No Program Head\n");
  }
  else
    root->child[0] = t;
  if(q != ((void *)0))
    root->child[1] = q;
  else
    root->child[1] = ((void *)0);
  if(s == ((void *)0)){
    fprintf(stderr, "No Program Body\n");
  }
  else
    root->child[2] = s;
  ReadToken();
  if( is_not_symbol(".") )
    fprintf(stderr, "No Program End Symbol(Dot) \n");;
  return root;
}

canonical_original_code:
struct node *Program(){
  struct node *t = ((void *)0); struct node *q = ((void *)0); struct node *s = ((void *)0); struct node *root = ((void *)0);
  t = ProgramHead();
  q = DeclarePart();
  s = ProgramBody();
  root = (struct node *)malloc(sizeof(TreeNode));
  root->nodeKind = ProK;
  strcpy(root->nodeKindStr, "ProK");
  if( root == ((void *)0))
    return ((void *)0);
  if(t == ((void *)0)){
    fprintf(stderr, "No Program Head\n");
  }
  else
    root->child[0] = t;
  if(q != ((void *)0))
    root->child[1] = q;
  else
    root->child[1] = ((void *)0);
  if(s == ((void *)0)){
    fprintf(stderr, "No Program Body\n");
  }
  else
    root->child[2] = s;
  ReadToken();
  if( is_not_symbol(".") )
    fprintf(stderr, "No Program End Symbol(Dot) \n");;
  return root;
}


parse

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

v0 = Program();
ReadToken();
if ( *(_DWORD *)&tokenValueBuffer != 4607813 )
{
v0 = 0LL;
fwrite("Bad END\n", 1uLL, 8uLL, stderr);
}
return v0;
}

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

v0 = func1();
ReadToken();
if ( *(_DWORD *)&tokenValueBuffer != 4607813 )
{
v0 = 0LL;
fwrite("Bad END\n", 1uLL, 8uLL, stderr);
}
return v0;
}

original_code:
TreeNode * parse(){
  int i = 0;
  TreeNode * t = Program();
  ReadToken();
  if( !( strcmp("EOF", tokenValueBuffer) == 0 ) ){
    fprintf(stderr, "Bad END\n");
    return ((void *)0);
  }
  return t;
}

canonical_original_code:
struct node *parse(){
  int i = 0;
  struct node *t = Program();
  ReadToken();
  if( !( strcmp("EOF", tokenValueBuffer) == 0 ) ){
    fprintf(stderr, "Bad END\n");
    return ((void *)0);
  }
  return t;
}


RTreeInitBranch

repo: davidreynolds/rtree

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

result = RTreeInitRect();
*(_QWORD *)(a1 + 32) = 0LL;
return result;
}

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

result = RTreeInitRect();
*(_QWORD *)(a1 + 32) = 0LL;
return result;
}

original_code:
static void RTreeInitBranch(struct Branch *b)
{
    RTreeInitRect(&(b->rect));
    b->child = ((void *)0);
}

variable_types: struct Branch { struct Rect { double boundary[-1]; } rect; struct Node { int count; int level; struct Branch branch[-1]; } *child; } *

user_defined_types: struct Branch { struct Rect rect; struct Node *child; }


RTreeInitNode

decompiled_code:
__int64 __fastcall RTreeInitNode(_QWORD *a1)
{
_QWORD *v1; // rbp
_QWORD *v2; // rbx
__int64 v3; // rdi
__int64 result; // rax

v1 = a1 + 511;
v2 = a1 + 1;
*a1 = 0xFFFFFFFF00000000LL;
do
{
v3 = (__int64)v2;
v2 += 5;
result = RTreeInitBranch(v3);
}
while ( v2 != v1 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1)
{
_QWORD *v1; // rbp
_QWORD *v2; // rbx
__int64 v3; // rdi
__int64 result; // rax

v1 = a1 + 511;
v2 = a1 + 1;
*a1 = 0xFFFFFFFF00000000LL;
do
{
v3 = (__int64)v2;
v2 += 5;
result = func0(v3);
}
while ( v2 != v1 );
return result;
}

original_code:
void RTreeInitNode(struct Node *N)
{
    register struct Node *n = N;
    register int i;
    n->count = 0;
    n->level = -1;
    for (i = 0; i < (int)((4096 -(2*sizeof(int))) / sizeof(struct Branch)); i++)
        RTreeInitBranch(&(n->branch[i]));
}

variable_types: struct Node { int count; int level; struct Branch { struct Rect { double boundary[-1]; } rect; struct Node *child; } branch[-1]; } *

user_defined_types: struct Node { int count; int level; struct Branch branch[-1]; }


RTreeNewNode

decompiled_code:
_QWORD *RTreeNewNode()
{
_QWORD *v0; // rax
_QWORD *v1; // r12

v0 = malloc(0xFF8uLL);
if ( !v0 )
_assert_fail("n", "src/node.c", 0x29u, "RTreeNewNode");
v1 = v0;
RTreeInitNode(v0);
return v1;
}

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

v0 = malloc(0xFF8uLL);
if ( !v0 )
_assert_fail("n", "src/node.c", 0x29u, "RTreeNewNode");
v1 = v0;
func1(v0);
return v1;
}

original_code:
struct Node * RTreeNewNode()
{
    register struct Node *n;
    n = (struct Node*) malloc(sizeof(struct Node));
    ((void) sizeof ((n) ? 1 : 0), __extension__ ({ if (n) ; else __assert_fail ("n", "src/node.c", 41, __extension__ __PRETTY_FUNCTION__); }));
    RTreeInitNode(n);
    return n;
}

canonical_original_code:
struct Node *RTreeNewNode()
{
    register struct Node *n;
    n = (struct Node *) malloc(sizeof(struct Node));
    ((void) sizeof ((n) ? 1 : 0), __extension__ ({ if (n) ; else __assert_fail ("n", "src/node.c", 41, __extension__ __PRETTY_FUNCTION__); }));
    RTreeInitNode(n);
    return n;
}

return_type: struct Node { int count; int level; struct Branch { struct Rect { double boundary[-1]; } rect; struct Node *child; } branch[-1]; } *


RTreeFreeNode

decompiled_code:
void __fastcall RTreeFreeNode(void *a1)
{
if ( !a1 )
_assert_fail("p", "src/node.c", 0x31u, "RTreeFreeNode");
free(a1);
}

canonical_decompiled_code:
void __fastcall func3(void *a1)
{
if ( !a1 )
_assert_fail("p", "src/node.c", 0x31u, "RTreeFreeNode");
free(a1);
}

original_code:
void RTreeFreeNode(struct Node *p)
{
    ((void) sizeof ((p) ? 1 : 0), __extension__ ({ if (p) ; else __assert_fail ("p", "src/node.c", 49, __extension__ __PRETTY_FUNCTION__); }));
    free(p);
}


RTreeTabIn

decompiled_code:
int __fastcall RTreeTabIn(int a1)
{
int i; // ebx
int result; // eax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
result = putchar(9);
}
return result;
}

canonical_decompiled_code:
int __fastcall func4(int a1)
{
int i; // ebx
int result; // eax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
result = putchar(9);
}
return result;
}

original_code:
extern void RTreeTabIn(int depth)
{
    int i;
    for(i=0; i<depth; i++)
        putchar('\t');
}

variable_types: depth int


RTreeDeleteIndex

decompiled_code:
void __fastcall RTreeDeleteIndex(int *a1)
{
__int64 v1; // rbx
__int64 v2; // rax

if ( a1 )
{
if ( a1[1] > 0 && *a1 > 0 )
{
v1 = 0LL;
do
{
v2 = 5 * v1++;
RTreeDeleteIndex(*(_QWORD *)&a1[2 * v2 + 10]);
}
while ( *a1 > (int)v1 );
}
RTreeFreeNode(a1);
}
else
{
fwrite("NULL node\n", 1uLL, 0xAuLL, stderr);
}
}

canonical_decompiled_code:
void __fastcall func5(int *a1)
{
__int64 v1; // rbx
__int64 v2; // rax

if ( a1 )
{
if ( a1[1] > 0 && *a1 > 0 )
{
v1 = 0LL;
do
{
v2 = 5 * v1++;
func5(*(_QWORD *)&a1[2 * v2 + 10]);
}
while ( *a1 > (int)v1 );
}
func3(a1);
}
else
{
fwrite("NULL node\n", 1uLL, 0xAuLL, stderr);
}
}

original_code:
void RTreeDeleteIndex(struct Node *n)
{
    int i;
    if (n == ((void *)0)) {
        fprintf(stderr, "NULL node\n");
        return;
    }
    if (n->level > 0) {
 for (i=0; i<n->count; i++) {
     RTreeDeleteIndex(n->branch[i].child);
 }
    }
    RTreeFreeNode(n);
}


RTreePrintNode

decompiled_code:
int __fastcall RTreePrintNode(unsigned int *a1, int a2)
{
int v2; // ecx
int result; // eax
unsigned int *v4; // r12
signed int v5; // ebx

RTreeTabIn(a2);
if ( !a1 )
return puts("NULL node");
printf("node");
v2 = a1[1];
if ( v2 )
{
if ( v2 <= 0 )
printf(" TYPE=?");
else
printf(" NONLEAF");
}
else
{
printf(" LEAF");
}
result = printf(" level=%d count=%d address=%p\n", a1[1], *a1, a1);
if ( (int)*a1 > 0 )
{
v4 = a1 + 2;
v5 = 0;
do
{
while ( 1 )
{
result = a1[1];
if ( result )
break;
++v5;
v4 += 10;
if ( (int)*a1 <= v5 )
return result;
}
RTreeTabIn(a2);
printf("branch %d\n", (unsigned int)v5++);
result = RTreePrintBranch(v4, (unsigned int)(a2 + 1));
v4 += 10;
}
while ( (int)*a1 > v5 );
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(unsigned int *a1, int a2)
{
int v2; // ecx
int result; // eax
unsigned int *v4; // r12
signed int v5; // ebx

func4(a2);
if ( !a1 )
return puts("NULL node");
printf("node");
v2 = a1[1];
if ( v2 )
{
if ( v2 <= 0 )
printf(" TYPE=?");
else
printf(" NONLEAF");
}
else
{
printf(" LEAF");
}
result = printf(" level=%d count=%d address=%p\n", a1[1], *a1, a1);
if ( (int)*a1 > 0 )
{
v4 = a1 + 2;
v5 = 0;
do
{
while ( 1 )
{
result = a1[1];
if ( result )
break;
++v5;
v4 += 10;
if ( (int)*a1 <= v5 )
return result;
}
func4(a2);
printf("branch %d\n", (unsigned int)v5++);
result = func7(v4, (unsigned int)(a2 + 1));
v4 += 10;
}
while ( (int)*a1 > v5 );
}
return result;
}

original_code:
void RTreePrintNode(struct Node *n, int depth)
{
    int i;
    RTreeTabIn(depth);
    if (n == ((void *)0)) {
        printf("NULL node\n");
        return;
    }
    printf("node");
    if (n->level == 0)
        printf(" LEAF");
    else if (n->level > 0)
        printf(" NONLEAF");
    else
        printf(" TYPE=?");
    printf("  level=%d  count=%d  address=%p\n", n->level, n->count, (void *)n);
    for (i=0; i<n->count; i++)
    {
        if(n->level == 0) {
        }
        else {
            RTreeTabIn(depth);
            printf("branch %d\n", i);
            RTreePrintBranch(&n->branch[i], depth+1);
        }
    }
}


RTreePrintBranch

decompiled_code:
int __fastcall RTreePrintBranch(__int64 a1, int a2)
{
RTreePrintRect();
return RTreePrintNode(*(unsigned int **)(a1 + 32), a2);
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1, int a2)
{
RTreePrintRect();
return func6(*(unsigned int **)(a1 + 32), a2);
}

original_code:
static void RTreePrintBranch(struct Branch *b, int depth)
{
    RTreePrintRect(&(b->rect), depth);
    RTreePrintNode(b->child, depth);
}


RTreePickBranch

original_code:
int RTreePickBranch(struct Rect *R, struct Node *N)
{
    register struct Rect *r = R;
    register struct Node *n = N;
    register struct Rect *rr;
    register int i, first_time=1;
    RectReal increase, bestIncr=(RectReal)-1, area, bestArea;
    int best;
    struct Rect tmp_rect;
    ((void) sizeof ((r && n) ? 1 : 0), __extension__ ({ if (r && n) ; else __assert_fail ("r && n", "src/node.c", 172, __extension__ __PRETTY_FUNCTION__); }));
    for (i=0; i<((n)->level > 0 ? NODECARD : LEAFCARD); i++)
    {
        if (n->branch[i].child)
        {
            rr = &n->branch[i].rect;
            area = RTreeRectSphericalVolume(rr);
            tmp_rect = RTreeCombineRect(r, rr);
            increase = RTreeRectSphericalVolume(&tmp_rect) - area;
            if (increase < bestIncr || first_time)
            {
                best = i;
                bestArea = area;
                bestIncr = increase;
                first_time = 0;
            }
            else if (increase == bestIncr && area < bestArea)
            {
                best = i;
                bestArea = area;
                bestIncr = increase;
            }
        }
    }
    return best;
}

canonical_original_code:
int RTreePickBranch(struct Rect *R, struct Node *N)
{
    register struct Rect *r = R;
    register struct Node *n = N;
    register struct Rect *rr;
    register int i; register int first_time = 1;
    double increase; double bestIncr = (RectReal)-1; double area; double bestArea;
    int best;
    struct Rect tmp_rect;
    ((void) sizeof ((r && n) ? 1 : 0), __extension__ ({ if (r && n) ; else __assert_fail ("r && n", "src/node.c", 172, __extension__ __PRETTY_FUNCTION__); }));
    for (i=0; i<((n)->level > 0 ? NODECARD : LEAFCARD); i++)
    {
        if (n->branch[i].child)
        {
            rr = &n->branch[i].rect;
            area = RTreeRectSphericalVolume(rr);
            tmp_rect = RTreeCombineRect(r, rr);
            increase = RTreeRectSphericalVolume(&tmp_rect) - area;
            if (increase < bestIncr || first_time)
            {
                best = i;
                bestArea = area;
                bestIncr = increase;
                first_time = 0;
            }
            else if (increase == bestIncr && area < bestArea)
            {
                best = i;
                bestArea = area;
                bestIncr = increase;
            }
        }
    }
    return best;
}

variable_types:
R
struct Rect { double boundary[-1]; } *

variable_types: struct Node { int count; int level; struct Branch { struct Rect rect; struct Node *child; } branch[-1]; } *

variable_types:
rr
struct Rect { double boundary[-1]; } *

variable_types: increase double

variable_types: bestIncr double

variable_types: area double

variable_types: bestArea double

variable_types: best int


RTreeAddBranch

decompiled_code:
__int64 __fastcall RTreeAddBranch(const __m128i *a1, int *a2, __int64 a3)
{
int v5; // eax
int v6; // esi
int v7; // ecx
_QWORD *v8; // rdx
int v9; // eax
int *v10; // rax
__int64 result; // rax

if ( !a1 )
_assert_fail("b", "src/node.c", 0xDAu, "RTreeAddBranch");
if ( !a2 )
_assert_fail("n", "src/node.c", 0xDBu, "RTreeAddBranch");
v5 = a2[1];
v6 = *a2;
v7 = LEAFCARD;
if ( v5 > 0 )
v7 = NODECARD;
if ( v6 >= v7 )
{
if ( !a3 )
_assert_fail("new_node", "src/node.c", 0xF3u, "RTreeAddBranch");
RTreeSplitNode(a2, a1);
result = 1LL;
}
else
{
if ( v7 <= 0 )
goto LABEL_14;
v8 = a2 + 10;
v9 = 0;
while ( *v8 )
{
++v9;
v8 += 5;
if ( v7 == v9 )
goto LABEL_14;
}
++v6;
v10 = &a2[10 * v9];
*(__m128i *)(v10 + 2) = _mm_loadu_si128(a1);
*(__m128i *)(v10 + 6) = _mm_loadu_si128(a1 + 1);
*((_QWORD *)v10 + 5) = a1[2].m128i_i64[0];
*a2 = v6;
if ( v6 < v7 )
{
LABEL_14:
if ( *(_QWORD *)&a2[10 * v6 + 10] )
_assert_fail(
"(n->count < MAXKIDS(n)) ? (n->branch[n->count].child == NULL) : 1",
"src/node.c",
0xECu,
"RTreeAddBranch");
}
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(const __m128i *a1, int *a2, __int64 a3)
{
int v5; // eax
int v6; // esi
int v7; // ecx
_QWORD *v8; // rdx
int v9; // eax
int *v10; // rax
__int64 result; // rax

if ( !a1 )
_assert_fail("b", "src/node.c", 0xDAu, "RTreeAddBranch");
if ( !a2 )
_assert_fail("n", "src/node.c", 0xDBu, "RTreeAddBranch");
v5 = a2[1];
v6 = *a2;
v7 = LEAFCARD;
if ( v5 > 0 )
v7 = NODECARD;
if ( v6 >= v7 )
{
if ( !a3 )
_assert_fail("new_node", "src/node.c", 0xF3u, "RTreeAddBranch");
RTreeSplitNode(a2, a1);
result = 1LL;
}
else
{
if ( v7 <= 0 )
goto LABEL_14;
v8 = a2 + 10;
v9 = 0;
while ( *v8 )
{
++v9;
v8 += 5;
if ( v7 == v9 )
goto LABEL_14;
}
++v6;
v10 = &a2[10 * v9];
*(__m128i *)(v10 + 2) = _mm_loadu_si128(a1);
*(__m128i *)(v10 + 6) = _mm_loadu_si128(a1 + 1);
*((_QWORD *)v10 + 5) = a1[2].m128i_i64[0];
*a2 = v6;
if ( v6 < v7 )
{
LABEL_14:
if ( *(_QWORD *)&a2[10 * v6 + 10] )
_assert_fail(
"(n->count < MAXKIDS(n)) ? (n->branch[n->count].child == NULL) : 1",
"src/node.c",
0xECu,
"RTreeAddBranch");
}
result = 0LL;
}
return result;
}

original_code:
int RTreeAddBranch(
        struct Branch *B,
        struct Node *N,
        struct Node **New_node
    )
{
    register struct Branch *b = B;
    register struct Node *n = N;
    register struct Node **new_node = New_node;
    register int i;
    ((void) sizeof ((b) ? 1 : 0), __extension__ ({ if (b) ; else __assert_fail ("b", "src/node.c", 218, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((n) ? 1 : 0), __extension__ ({ if (n) ; else __assert_fail ("n", "src/node.c", 219, __extension__ __PRETTY_FUNCTION__); }));
    if (n->count < ((n)->level > 0 ? NODECARD : LEAFCARD))
    {
        for (i = 0; i < ((n)->level > 0 ? NODECARD : LEAFCARD); i++)
        {
            if (n->branch[i].child == ((void *)0))
            {
                n->branch[i] = *b;
                n->count++;
                break;
            }
        }
        ((void) sizeof (((n->count < ((n)->level > 0 ? NODECARD : LEAFCARD)) ? (n->branch[n->count].child == ((void *)0)) : 1) ? 1 : 0), __extension__ ({ if ((n->count < ((n)->level > 0 ? NODECARD : LEAFCARD)) ? (n->branch[n->count].child == ((void *)0)) : 1) ; else __assert_fail ("(n->count < MAXKIDS(n)) ? (n->branch[n->count].child == NULL) : 1", "src/node.c", 236, __extension__ __PRETTY_FUNCTION__); }));
        return 0;
    }
    else
    {
        ((void) sizeof ((new_node) ? 1 : 0), __extension__ ({ if (new_node) ; else __assert_fail ("new_node", "src/node.c", 243, __extension__ __PRETTY_FUNCTION__); }));
        RTreeSplitNode(n, b, new_node);
        return 1;
    }
}

canonical_original_code:
int RTreeAddBranch(struct Branch *B, struct Node *N, struct Node **New_node)
{
    register struct Branch *b = B;
    register struct Node *n = N;
    register struct Node **new_node = New_node;
    register int i;
    ((void) sizeof ((b) ? 1 : 0), __extension__ ({ if (b) ; else __assert_fail ("b", "src/node.c", 218, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((n) ? 1 : 0), __extension__ ({ if (n) ; else __assert_fail ("n", "src/node.c", 219, __extension__ __PRETTY_FUNCTION__); }));
    if (n->count < ((n)->level > 0 ? NODECARD : LEAFCARD))
    {
        for (i = 0; i < ((n)->level > 0 ? NODECARD : LEAFCARD); i++)
        {
            if (n->branch[i].child == ((void *)0))
            {
                n->branch[i] = *b;
                n->count++;
                break;
            }
        }
        ((void) sizeof (((n->count < ((n)->level > 0 ? NODECARD : LEAFCARD)) ? (n->branch[n->count].child == ((void *)0)) : 1) ? 1 : 0), __extension__ ({ if ((n->count < ((n)->level > 0 ? NODECARD : LEAFCARD)) ? (n->branch[n->count].child == ((void *)0)) : 1) ; else __assert_fail ("(n->count < MAXKIDS(n)) ? (n->branch[n->count].child == NULL) : 1", "src/node.c", 236, __extension__ __PRETTY_FUNCTION__); }));
        return 0;
    }
    else
    {
        ((void) sizeof ((new_node) ? 1 : 0), __extension__ ({ if (new_node) ; else __assert_fail ("new_node", "src/node.c", 243, __extension__ __PRETTY_FUNCTION__); }));
        RTreeSplitNode(n, b, new_node);
        return 1;
    }
}

variable_types:
N
struct Node *

variable_types: struct Node { int count; int level; struct Branch { struct Rect { double boundary[-1]; } rect; struct Node *child; } branch[-1]; } **


decompiled_code:
__int64 __fastcall nn_heap_parent(unsigned int a1)
{
return a1 >> 1;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1)
{
return a1 >> 1;
}

original_code:
static unsigned
nn_heap_parent(unsigned u)
{
    return u / 2;
}

canonical_original_code:
static unsigned int nn_heap_parent(unsigned int u)
{
    return u / 2;
}

variable_types:
u
unsigned int

return_type: unsigned int


decompiled_code:
_BOOL8 __fastcall nn_heap_cmp(_QWORD *a1, unsigned int a2, unsigned int a3)
{
if ( !a1 )
_assert_fail("h != NULL", "src/nn_heap.c", 0x67u, "nn_heap_cmp");
return *(double *)(*(_QWORD *)(*a1 + 8LL * a3) + 16LL) > *(double *)(*(_QWORD *)(*a1 + 8LL * a2) + 16LL);
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(_QWORD *a1, unsigned int a2, unsigned int a3)
{
if ( !a1 )
_assert_fail("h != NULL", "src/nn_heap.c", 0x67u, "nn_heap_cmp");
return *(double *)(*(_QWORD *)(*a1 + 8LL * a3) + 16LL) > *(double *)(*(_QWORD *)(*a1 + 8LL * a2) + 16LL);
}

original_code:
static int
nn_heap_cmp(struct nn_heap *h, unsigned u, unsigned v)
{
    ((void) sizeof ((h != ((void *)0)) ? 1 : 0), __extension__ ({ if (h != ((void *)0)) ; else __assert_fail ("h != NULL", "src/nn_heap.c", 103, __extension__ __PRETTY_FUNCTION__); }));
    return h->entries[u]->minDist < h->entries[v]->minDist;
}

canonical_original_code:
static int nn_heap_cmp(struct nn_heap *h, unsigned int u, unsigned int v)
{
    ((void) sizeof ((h != ((void *)0)) ? 1 : 0), __extension__ ({ if (h != ((void *)0)) ; else __assert_fail ("h != NULL", "src/nn_heap.c", 103, __extension__ __PRETTY_FUNCTION__); }));
    return h->entries[u]->minDist < h->entries[v]->minDist;
}

variable_types: struct nn_heap { struct nn_entry { struct Node { int count; int level; struct Branch { struct Rect { double boundary[-1]; } rect; struct Node *child; } branch[-1]; } *node; int hasData; double minDist; } **entries; unsigned int next; unsigned int length; } *

variable_types:
v
unsigned int

user_defined_types: struct nn_heap { struct nn_entry **entries; unsigned int next; unsigned int length; }

user_defined_types: struct nn_entry { struct Node *node; int hasData; double minDist; }


decompiled_code:
void __fastcall bubble_up(_QWORD *a1, unsigned int a2)
{
unsigned int i; // ebx
unsigned int v3; // ebp
unsigned int v4; // esi

if ( a2 > 1 )
{
for ( i = a2; i > 1; nn_heap_swap(a1, v3, i) )
{
v3 = i;
v4 = i;
i = nn_heap_parent(i);
if ( !nn_heap_cmp(a1, v4, i) )
break;
}
}
}

canonical_decompiled_code:
void __fastcall func3(_QWORD *a1, unsigned int a2)
{
unsigned int i; // ebx
unsigned int v3; // ebp
unsigned int v4; // esi

if ( a2 > 1 )
{
for ( i = a2; i > 1; nn_heap_swap(a1, v3, i) )
{
v3 = i;
v4 = i;
i = func0(i);
if ( !func2(a1, v4, i) )
break;
}
}
}

original_code:
static void
bubble_up(struct nn_heap *h, unsigned u)
{
    unsigned v;
    while (u > 1) {
        v = nn_heap_parent(u);
        if (!nn_heap_cmp(h, u, v))
            break;
        nn_heap_swap(h, u, v);
        u = v;
    }
}

canonical_original_code:
static void bubble_up(struct nn_heap *h, unsigned int u)
{
    unsigned int v;
    while (u > 1) {
        v = nn_heap_parent(u);
        if (!nn_heap_cmp(h, u, v))
            break;
        nn_heap_swap(h, u, v);
        u = v;
    }
}


decompiled_code:
void __fastcall nn_heap_free(void *ptr)
{
unsigned int v1; // ebx
__int64 v2; // rdx

if ( *((_DWORD *)ptr + 2) > 1u )
{
v1 = 1;
do
{
v2 = v1++;
free(*(void **)(*(_QWORD *)ptr + 8 * v2));
}
while ( *((_DWORD *)ptr + 2) > v1 );
}
free(*(void **)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func5(void *ptr)
{
unsigned int v1; // ebx
__int64 v2; // rdx

if ( *((_DWORD *)ptr + 2) > 1u )
{
v1 = 1;
do
{
v2 = v1++;
free(*(void **)(*(_QWORD *)ptr + 8 * v2));
}
while ( *((_DWORD *)ptr + 2) > v1 );
}
free(*(void **)ptr);
free(ptr);
}

original_code:
void
nn_heap_free(struct nn_heap *h)
{
    unsigned u;
    for (u = 1; u < h->next; u++) {
        free(h->entries[u]);
    }
    free(h->entries);
    free(h);
}

canonical_original_code:
void nn_heap_free(struct nn_heap *h)
{
    unsigned int u;
    for (u = 1; u < h->next; u++) {
        free(h->entries[u]);
    }
    free(h->entries);
    free(h);
}