sortHeap

decompiled_code:
__int64 __fastcall sortHeap(__int64 *a1)
{
__int64 result; // rax
int v2; // ebx

buildHeap(a1);
result = sizeDynArr((__int64)a1);
v2 = result - 1;
if ( (int)result - 1 > 0 )
{
do
{
swapDynArr(a1, 0, v2);
result = adjustHeap(a1, v2--, 0);
}
while ( v2 );
}
return result;
}

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

func23(a1);
result = func5((__int64)a1);
v2 = result - 1;
if ( (int)result - 1 > 0 )
{
do
{
func9(a1, 0, v2);
result = func21(a1, v2--, 0);
}
while ( v2 );
}
return result;
}

original_code:
void sortHeap(DynArr *heap)
{
 int i;
 _buildHeap(heap);
 for (i = sizeDynArr(heap) - 1; i > 0; i--) {
  swapDynArr(heap, 0, i);
  _adjustHeap(heap, i, 0);
 }
}

canonical_original_code:
void sortHeap(struct DynArr *heap)
{
 int i;
 _buildHeap(heap);
 for (i = sizeDynArr(heap) - 1; i > 0; i--) {
  swapDynArr(heap, 0, i);
  _adjustHeap(heap, i, 0);
 }
}


main

canonical_name: main

repo: Karlinha/CompiladoresI

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // r12
size_t v4; // rax
size_t v5; // rbp
FILE *v6; // rdi
FILE *v7; // rdi
const char *v9; // rbp
const char *v10; // rbp
double v11; // [rsp+0h] [rbp-128h] BYREF
double v12; // [rsp+8h] [rbp-120h] BYREF
int v13; // [rsp+14h] [rbp-114h] BYREF
int v14; // [rsp+18h] [rbp-110h] BYREF
unsigned int v15; // [rsp+1Ch] [rbp-10Ch] BYREF
__int64 v16; // [rsp+20h] [rbp-108h] BYREF
unsigned int v17; // [rsp+2Ch] [rbp-FCh] BYREF
char s[112]; // [rsp+30h] [rbp-F8h] BYREF
char dest[136]; // [rsp+A0h] [rbp-88h] BYREF

if ( argc != 2 )
{
v10 = argv[1];
strcpy(dest, v10);
strcpy(s, v10);
*((_BYTE *)&v17 + strlen(v10) + 3) = 105;
goto LABEL_13;
}
v3 = argv[1];
v4 = strlen(v3);
v5 = v4;
if ( v4 > 4 && !strcmp(".tlo", &v3[v4 - 4]) )
{
v9 = argv[1];
strcpy(dest, v9);
strcpy(s, v9);
*((_BYTE *)&v17 + strlen(v9) + 3) = 105;
}
else
{
if ( v5 + 5 > 0x63 )
{
fwrite("Filename too long.\n", 1uLL, 0x13uLL, stderr);
exit(1);
}
strcpy(dest, v3);
strcat(dest, ".tlo");
strcpy(s, v3);
strcat(s, ".tli");
}
v6 = fopen(dest, "r");
if ( !v6 )
{
LABEL_13:
fprintf(stderr, "Usage: %s filename[.tlo]\n", *argv);
exit(1);
}
readTree((__int64)v6, &v16, (__int64)&v12, (__int64)&v11, &v17);
shapeTree(v16, &v15, &v14, &v13, (unsigned int)(int)v12, (unsigned int)(int)v11);
v7 = fopen(s, "w");
if ( !v7 )
{
fprintf(stderr, "Unable to open %s for writing.\n", s);
exit(1);
}
printTree(v7, v16, v15, v14, v13, v17);
deleteTree(v16);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // r12
size_t v4; // rax
size_t v5; // rbp
FILE *v6; // rdi
FILE *v7; // rdi
const char *v9; // rbp
const char *v10; // rbp
double v11; // [rsp+0h] [rbp-128h] BYREF
double v12; // [rsp+8h] [rbp-120h] BYREF
int v13; // [rsp+14h] [rbp-114h] BYREF
int v14; // [rsp+18h] [rbp-110h] BYREF
unsigned int v15; // [rsp+1Ch] [rbp-10Ch] BYREF
__int64 v16; // [rsp+20h] [rbp-108h] BYREF
unsigned int v17; // [rsp+2Ch] [rbp-FCh] BYREF
char s[112]; // [rsp+30h] [rbp-F8h] BYREF
char dest[136]; // [rsp+A0h] [rbp-88h] BYREF

if ( argc != 2 )
{
v10 = argv[1];
strcpy(dest, v10);
strcpy(s, v10);
*((_BYTE *)&v17 + strlen(v10) + 3) = 105;
goto LABEL_13;
}
v3 = argv[1];
v4 = strlen(v3);
v5 = v4;
if ( v4 > 4 && !strcmp(".tlo", &v3[v4 - 4]) )
{
v9 = argv[1];
strcpy(dest, v9);
strcpy(s, v9);
*((_BYTE *)&v17 + strlen(v9) + 3) = 105;
}
else
{
if ( v5 + 5 > 0x63 )
{
fwrite("Filename too long.\n", 1uLL, 0x13uLL, stderr);
exit(1);
}
strcpy(dest, v3);
strcat(dest, ".tlo");
strcpy(s, v3);
strcat(s, ".tli");
}
v6 = fopen(dest, "r");
if ( !v6 )
{
LABEL_13:
fprintf(stderr, "Usage: %s filename[.tlo]\n", *argv);
exit(1);
}
func4((__int64)v6, &v16, (__int64)&v12, (__int64)&v11, &v17);
shapeTree(v16, &v15, &v14, &v13, (unsigned int)(int)v12, (unsigned int)(int)v11);
v7 = fopen(s, "w");
if ( !v7 )
{
fprintf(stderr, "Unable to open %s for writing.\n", s);
exit(1);
}
func3(v7, v16, v15, v14, v13, v17);
deleteTree(v16);
return 0;
}

original_code:
int main(int argc, char *argv[]){
    iniciar(argc, argv);
    analisador_sintatico();
    encerrar();
    return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

return_type: int


vazio

decompiled_code:
__int64 __fastcall vazio(__int64 *a1)
{
__int64 v1; // rbx
__int64 result; // rax

v1 = criar("vazio");
inserir(v1, a1);
result = *a1;
*(_QWORD *)(v1 + 8) = *a1;
return result;
}

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

v1 = criar("vazio");
inserir(v1, a1);
result = *a1;
*(_QWORD *)(v1 + 8) = *a1;
return result;
}

original_code:
void vazio(ArvoreGen *pai) {
    ArvoreGen *no = criar("vazio");
    inserir(no, pai);
    no->pai_nome = pai->info;
}

canonical_original_code:
void vazio(struct arvgen *pai) {
    struct arvgen *no = criar("vazio");
    inserir(no, pai);
    no->pai_nome = pai->info;
}

variable_types: struct arvgen { char *info; char *pai_nome; struct arvgen *prim; struct arvgen *prox; } *

return_type: void


decompiled_code:
__int64 __fastcall confirmar_tk(int a1, _QWORD *a2)
{
__int64 result; // rax
__int64 v3; // rbp
char *v4; // rax

result = 0LL;
if ( *(_DWORD *)(token + 8) == a1 )
{
if ( a1 == 257 )
{
v4 = strcat(str_id, *(const char **)token);
v3 = criar(v4);
}
else
{
v3 = criar(*(_QWORD *)token);
}
inserir(v3, a2);
*(_QWORD *)(v3 + 8) = *a2;
token = proximo_token();
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, _QWORD *a2)
{
__int64 result; // rax
__int64 v3; // rbp
char *v4; // rax

result = 0LL;
if ( *(_DWORD *)(token + 8) == a1 )
{
if ( a1 == 257 )
{
v4 = strcat(str_id, *(const char **)token);
v3 = criar(v4);
}
else
{
v3 = criar(*(_QWORD *)token);
}
inserir(v3, a2);
*(_QWORD *)(v3 + 8) = *a2;
token = proximo_token();
result = 1LL;
}
return result;
}

original_code:
int confirmar_tk(Categoria c, ArvoreGen *pai) {
 if(c == token->categoria) {
  ArvoreGen *no;
  if(c== tk_id)
   no = criar(strcat(str_id, token->valor));
  else
   no = criar(token->valor);
  inserir(no, pai);
        no->pai_nome = pai->info;
  token = proximo_token();
  return 1;
 }
 return 0;
}

canonical_original_code:
int confirmar_tk(enum categoria c, struct arvgen *pai) {
 if(c == token->categoria) {
  struct arvgen *no;
  if(c== tk_id)
   no = criar(strcat(str_id, token->valor));
  else
   no = criar(token->valor);
  inserir(no, pai);
        no->pai_nome = pai->info;
  token = proximo_token();
  return 1;
 }
 return 0;
}

variable_types: enum categoria { tk_rel_op=256, tk_id=257, tk_const_int=258, tk_const_float=259, tk_const_lit=260, tk_kw_int=261, tk_kw_float=262, tk_kw_char=263, tk_kw_if=264, tk_kw_else=265, tk_kw_for=266, tk_kw_while=267, tk_kw_break=268, tk_kw_not=269, tk_kw_and=270, tk_kw_or=271, tk_kw_main=272, tk_kw_func=273, tk_kw_return=274, tk_kw_strcmp=275, tk_kw_strcop=276, tk_kw_input=277, tk_kw_output=278, tk_op_add=279, tk_op_sub=280, tk_op_mul=281, tk_op_div=282, tk_op_atrib=283, tk_open_par=284, tk_close_par=285, tk_open_bra=286, tk_close_bra=287, tk_close_key=288, tk_open_key=289, tk_semicolon=290, tk_comma=291, erro=292 }

user_defined_types: struct arvgen { char *info; char *pai_nome; struct arvgen *prim; struct arvgen *prox; }


type

decompiled_code:
__int64 __fastcall type(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("type");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)confirmar_tk(261, v1) && !(unsigned int)confirmar_tk(262, v1) )
{
v2 = confirmar_tk(263, v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("type");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)func1(261, v1) && !(unsigned int)func1(262, v1) )
{
v2 = func1(263, v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

original_code:
int type(ArvoreGen *pai) {
 ArvoreGen *no = criar("type");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_int, no) || confirmar_tk(tk_kw_float, no) || confirmar_tk(tk_kw_char, no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}

canonical_original_code:
int type(struct arvgen *pai) {
 struct arvgen *no = criar("type");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_int, no) || confirmar_tk(tk_kw_float, no) || confirmar_tk(tk_kw_char, no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}


decompiled_code:
__int64 __fastcall list_param(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("list_param");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)type(v1) || !(unsigned int)confirmar_tk(257, v1) || (v3 = param(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

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

v1 = (_QWORD *)criar("list_param");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func2(v1) || !(unsigned int)func1(257, v1) || (v3 = func4(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int list_param(ArvoreGen *pai) {
 ArvoreGen *no = criar("list_param");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(type(no) && confirmar_tk(tk_id, no) && param(no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}

canonical_original_code:
int list_param(struct arvgen *pai) {
 struct arvgen *no = criar("list_param");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(type(no) && confirmar_tk(tk_id, no) && param(no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}


param

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

v1 = (__int64 *)criar("param");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(291, v1) || !(unsigned int)list_param(v1) )
vazio(v1);
return 1LL;
}

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

v1 = (__int64 *)criar("param");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(291, v1) || !(unsigned int)func3(v1) )
func0(v1);
return 1LL;
}

original_code:
int param(ArvoreGen *pai) {
 ArvoreGen *no = criar("param");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_comma, no) && list_param(no))
  return 1;
 vazio(no);
 return 1;
}

canonical_original_code:
int param(struct arvgen *pai) {
 struct arvgen *no = criar("param");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_comma, no) && list_param(no))
  return 1;
 vazio(no);
 return 1;
}


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

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

original_code:
int ch_func(ArvoreGen *pai) {
 return 0;
}

canonical_original_code:
int ch_func(struct arvgen *pai) {
 return 0;
}


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

v1 = (__int64 *)criar("termo\\_var\\_dec");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(286, v1)
|| !(unsigned int)confirmar_tk(258, v1)
|| !(unsigned int)confirmar_tk(287, v1) )
{
vazio(v1);
}
return 1LL;
}

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

v1 = (__int64 *)criar("termo\\_var\\_dec");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(286, v1)
|| !(unsigned int)func1(258, v1)
|| !(unsigned int)func1(287, v1) )
{
func0(v1);
}
return 1LL;
}

original_code:
int termo_var_dec(ArvoreGen *pai) {
 ArvoreGen *no = criar("termo\\_var\\_dec");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_open_bra, no) && confirmar_tk(tk_const_int, no) && confirmar_tk(tk_close_bra, no))
  return 1;
 vazio(no);
 return 1;
}

canonical_original_code:
int termo_var_dec(struct arvgen *pai) {
 struct arvgen *no = criar("termo\\_var\\_dec");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_open_bra, no) && confirmar_tk(tk_const_int, no) && confirmar_tk(tk_close_bra, no))
  return 1;
 vazio(no);
 return 1;
}


decompiled_code:
__int64 __fastcall var_dec(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("var\\_dec");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)type(v1)
|| !(unsigned int)confirmar_tk(257, v1)
|| !(unsigned int)termo_var_dec(v1)
|| (v3 = confirmar_tk(290, v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("var\\_dec");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func2(v1)
|| !(unsigned int)func1(257, v1)
|| !(unsigned int)func6(v1)
|| (v3 = func1(290, v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int var_dec(ArvoreGen *pai) {
 ArvoreGen *no = criar("var\\_dec");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(type(no) && confirmar_tk(tk_id, no) && termo_var_dec(no) && confirmar_tk(tk_semicolon, no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}

canonical_original_code:
int var_dec(struct arvgen *pai) {
 struct arvgen *no = criar("var\\_dec");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(type(no) && confirmar_tk(tk_id, no) && termo_var_dec(no) && confirmar_tk(tk_semicolon, no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}


decompiled_code:
__int64 __fastcall fator_arit(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("fator\\_arit");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)confirmar_tk(258, v1) && !(unsigned int)confirmar_tk(259, v1) )
{
v2 = confirmar_tk(257, v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func8(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("fator\\_arit");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)func1(258, v1) && !(unsigned int)func1(259, v1) )
{
v2 = func1(257, v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

original_code:
int fator_arit(ArvoreGen *pai) {
    ArvoreGen *no = criar("fator\\_arit");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_const_int, no) || confirmar_tk(tk_const_float, no) || confirmar_tk(tk_id, no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int fator_arit(struct arvgen *pai) {
    struct arvgen *no = criar("fator\\_arit");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_const_int, no) || confirmar_tk(tk_const_float, no) || confirmar_tk(tk_id, no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


E

decompiled_code:
__int64 __fastcall E(__int64 *a1)
{
__int64 *v1; // rbx
__int64 result; // rax

v1 = (__int64 *)criar("E");
inserir(v1, a1);
v1[1] = *a1;
if ( (unsigned int)confirmar_tk(281, v1) || (unsigned int)confirmar_tk(282, v1) )
{
result = fator_arit(v1);
if ( (_DWORD)result )
result = (unsigned int)E(v1) != 0;
}
else
{
vazio(v1);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 *a1)
{
__int64 *v1; // rbx
__int64 result; // rax

v1 = (__int64 *)criar("E");
inserir(v1, a1);
v1[1] = *a1;
if ( (unsigned int)func1(281, v1) || (unsigned int)func1(282, v1) )
{
result = func8(v1);
if ( (_DWORD)result )
result = (unsigned int)func9(v1) != 0;
}
else
{
func0(v1);
result = 1LL;
}
return result;
}

original_code:
int E(ArvoreGen *pai) {
    ArvoreGen *no = criar("E");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_op_mul, no) || confirmar_tk(tk_op_div, no)){
        if(fator_arit(no) && E(no))
            return 1;
        return 0;
 }
    vazio(no);
    return 1;
}

canonical_original_code:
int E(struct arvgen *pai) {
    struct arvgen *no = criar("E");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_op_mul, no) || confirmar_tk(tk_op_div, no)){
        if(fator_arit(no) && E(no))
            return 1;
        return 0;
 }
    vazio(no);
    return 1;
}


decompiled_code:
__int64 __fastcall termo_arit(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("termo\\_arit");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)fator_arit(v1) || (v2 = E(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("termo\\_arit");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func8(v1) || (v2 = func9(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int termo_arit(ArvoreGen *pai) {
    ArvoreGen *no = criar("termo\\_arit");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(fator_arit(no) && E(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int termo_arit(struct arvgen *pai) {
    struct arvgen *no = criar("termo\\_arit");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(fator_arit(no) && E(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


D

decompiled_code:
__int64 __fastcall D(__int64 *a1)
{
__int64 *v1; // rbx
__int64 result; // rax

v1 = (__int64 *)criar("D");
inserir(v1, a1);
v1[1] = *a1;
if ( (unsigned int)confirmar_tk(279, v1) || (unsigned int)confirmar_tk(280, v1) )
{
result = termo_arit(v1);
if ( (_DWORD)result )
result = (unsigned int)D(v1) != 0;
}
else
{
vazio(v1);
result = 1LL;
}
return result;
}

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

v1 = (__int64 *)criar("D");
inserir(v1, a1);
v1[1] = *a1;
if ( (unsigned int)func1(279, v1) || (unsigned int)func1(280, v1) )
{
result = func10(v1);
if ( (_DWORD)result )
result = (unsigned int)func11(v1) != 0;
}
else
{
func0(v1);
result = 1LL;
}
return result;
}

original_code:
int D(ArvoreGen *pai) {
    ArvoreGen *no = criar("D");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_op_add, no) || confirmar_tk(tk_op_sub, no)){
        if(termo_arit(no) && D(no))
            return 1;
        return 0;
 }
    vazio(no);
    return 1;
}

canonical_original_code:
int D(struct arvgen *pai) {
    struct arvgen *no = criar("D");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_op_add, no) || confirmar_tk(tk_op_sub, no)){
        if(termo_arit(no) && D(no))
            return 1;
        return 0;
 }
    vazio(no);
    return 1;
}


decompiled_code:
__int64 __fastcall exp_arit(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("exp\\_arit");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)termo_arit(v1) || (v2 = D(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("exp\\_arit");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func10(v1) || (v2 = func11(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int exp_arit(ArvoreGen *pai) {
    ArvoreGen *no = criar("exp\\_arit");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(termo_arit(no) && D(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int exp_arit(struct arvgen *pai) {
    struct arvgen *no = criar("exp\\_arit");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(termo_arit(no) && D(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


atrib

decompiled_code:
__int64 __fastcall atrib(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("atrib");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(257, v1)
|| !(unsigned int)confirmar_tk(283, v1)
|| (v3 = exp_arit(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("atrib");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(257, v1)
|| !(unsigned int)func1(283, v1)
|| (v3 = func12(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int atrib(ArvoreGen *pai) {
    ArvoreGen *no = criar("atrib");
 inserir(no, pai);
 no->pai_nome = pai->info;
    if(confirmar_tk(tk_id, no) && confirmar_tk(tk_op_atrib, no) && exp_arit(no)) {
        return 1;
    }
    pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int atrib(struct arvgen *pai) {
    struct arvgen *no = criar("atrib");
 inserir(no, pai);
 no->pai_nome = pai->info;
    if(confirmar_tk(tk_id, no) && confirmar_tk(tk_op_atrib, no) && exp_arit(no)) {
        return 1;
    }
    pai->prim = ((void *)0);
    free(no);
    return 0;
}


C

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

v1 = (__int64 *)criar("C");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(256, v1) || !(unsigned int)exp_arit(v1) )
vazio(v1);
return 1LL;
}

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

v1 = (__int64 *)criar("C");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(256, v1) || !(unsigned int)func12(v1) )
func0(v1);
return 1LL;
}

original_code:
int C(ArvoreGen *pai) {
    ArvoreGen *no = criar("C");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_rel_op, no) && exp_arit(no))
        return 1;
    vazio(no);
    return 1;
}

canonical_original_code:
int C(struct arvgen *pai) {
    struct arvgen *no = criar("C");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_rel_op, no) && exp_arit(no))
        return 1;
    vazio(no);
    return 1;
}


decompiled_code:
__int64 __fastcall exp_rel(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("exp\\_rel");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)exp_arit(v1) || (v2 = C(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("exp\\_rel");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func12(v1) || (v2 = func14(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int exp_rel(ArvoreGen *pai) {
    ArvoreGen *no = criar("exp\\_rel");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(exp_arit(no) && C(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int exp_rel(struct arvgen *pai) {
    struct arvgen *no = criar("exp\\_rel");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(exp_arit(no) && C(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


decompiled_code:
__int64 __fastcall fator_bool(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("fator\\_bool");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(269, v1) || (v2 = 1, !(unsigned int)fator_bool(v1)) )
{
v2 = exp_rel(v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func16(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("fator\\_bool");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(269, v1) || (v2 = 1, !(unsigned int)func16(v1)) )
{
v2 = func15(v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

original_code:
int fator_bool(ArvoreGen *pai) {
    ArvoreGen *no = criar("fator\\_bool");
 inserir(no, pai);
 no->pai_nome = pai->info;
    if((confirmar_tk(tk_kw_not, no) && fator_bool(no)) || exp_rel(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int fator_bool(struct arvgen *pai) {
    struct arvgen *no = criar("fator\\_bool");
 inserir(no, pai);
 no->pai_nome = pai->info;
    if((confirmar_tk(tk_kw_not, no) && fator_bool(no)) || exp_rel(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


B

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

v1 = (__int64 *)criar("B");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(270, v1) || !(unsigned int)fator_bool(v1) || !(unsigned int)B(v1) )
vazio(v1);
return 1LL;
}

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

v1 = (__int64 *)criar("B");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(270, v1) || !(unsigned int)func16(v1) || !(unsigned int)func17(v1) )
func0(v1);
return 1LL;
}

original_code:
int B(ArvoreGen *pai) {
    ArvoreGen *no = criar("B");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_and, no) && fator_bool(no) && B(no))
        return 1;
    vazio(no);
    return 1;
}

canonical_original_code:
int B(struct arvgen *pai) {
    struct arvgen *no = criar("B");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_and, no) && fator_bool(no) && B(no))
        return 1;
    vazio(no);
    return 1;
}


decompiled_code:
__int64 __fastcall termo_bool(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("termo\\_bool");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)fator_bool(v1) || (v2 = B(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func18(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("termo\\_bool");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func16(v1) || (v2 = func17(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int termo_bool(ArvoreGen *pai) {
    ArvoreGen *no = criar("termo\\_bool");
 inserir(no, pai);
 no->pai_nome = pai->info;
    if(fator_bool(no) && B(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int termo_bool(struct arvgen *pai) {
    struct arvgen *no = criar("termo\\_bool");
 inserir(no, pai);
 no->pai_nome = pai->info;
    if(fator_bool(no) && B(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


A

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

v1 = (__int64 *)criar("A");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(271, v1) || !(unsigned int)termo_bool(v1) || !(unsigned int)A(v1) )
vazio(v1);
return 1LL;
}

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

v1 = (__int64 *)criar("A");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(271, v1) || !(unsigned int)func18(v1) || !(unsigned int)func19(v1) )
func0(v1);
return 1LL;
}

original_code:
int A(ArvoreGen *pai) {
    ArvoreGen *no = criar("A");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_or, no) && termo_bool(no) && A(no))
        return 1;
    vazio(no);
    return 1;
}

canonical_original_code:
int A(struct arvgen *pai) {
    struct arvgen *no = criar("A");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_or, no) && termo_bool(no) && A(no))
        return 1;
    vazio(no);
    return 1;
}


decompiled_code:
__int64 __fastcall exp_bool(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("exp\\_bool");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)termo_bool(v1) || (v2 = A(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func20(_QWORD *a1)
{
_QWORD *v1; // rbx
int v2; // edx
__int64 result; // rax

v1 = (_QWORD *)criar("exp\\_bool");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func18(v1) || (v2 = func19(v1), result = 1LL, !v2) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int exp_bool(ArvoreGen *pai) {
    ArvoreGen *no = criar("exp\\_bool");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(termo_bool(no) && A(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int exp_bool(struct arvgen *pai) {
    struct arvgen *no = criar("exp\\_bool");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(termo_bool(no) && A(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


retorno

decompiled_code:
__int64 __fastcall retorno(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("retorno");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)exp_bool(v1) )
{
v2 = confirmar_tk(260, v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func21(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("retorno");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)func20(v1) )
{
v2 = func1(260, v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

original_code:
int retorno(ArvoreGen *pai) {
 ArvoreGen *no = criar("retorno");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(exp_bool(no) || confirmar_tk(tk_const_lit, no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}

canonical_original_code:
int retorno(struct arvgen *pai) {
 struct arvgen *no = criar("retorno");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(exp_bool(no) || confirmar_tk(tk_const_lit, no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}


iter

decompiled_code:
__int64 __fastcall iter(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("iter");
inserir(v1, a1);
v1[1] = *a1;
if ( (unsigned int)confirmar_tk(266, v1)
&& (unsigned int)confirmar_tk(284, v1)
&& (unsigned int)atrib(v1)
&& (unsigned int)confirmar_tk(290, v1)
&& (unsigned int)exp_bool(v1)
&& (unsigned int)confirmar_tk(290, v1)
&& (unsigned int)atrib(v1)
&& (unsigned int)confirmar_tk(285, v1)
&& (unsigned int)corpo(v1) )
{
return 1LL;
}
if ( !(unsigned int)confirmar_tk(267, v1)
|| !(unsigned int)confirmar_tk(284, v1)
|| !(unsigned int)exp_bool(v1)
|| !(unsigned int)confirmar_tk(285, v1)
|| (v3 = corpo(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func22(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("iter");
inserir(v1, a1);
v1[1] = *a1;
if ( (unsigned int)func1(266, v1)
&& (unsigned int)func1(284, v1)
&& (unsigned int)func13(v1)
&& (unsigned int)func1(290, v1)
&& (unsigned int)func20(v1)
&& (unsigned int)func1(290, v1)
&& (unsigned int)func13(v1)
&& (unsigned int)func1(285, v1)
&& (unsigned int)func24(v1) )
{
return 1LL;
}
if ( !(unsigned int)func1(267, v1)
|| !(unsigned int)func1(284, v1)
|| !(unsigned int)func20(v1)
|| !(unsigned int)func1(285, v1)
|| (v3 = func24(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int iter (ArvoreGen *pai) {
    ArvoreGen *no = criar("iter");
    inserir(no, pai);
    no->pai_nome = pai->info;
    if(confirmar_tk(tk_kw_for, no) && confirmar_tk(tk_open_par, no) && atrib(no) && confirmar_tk(tk_semicolon, no) && exp_bool(no) && confirmar_tk(tk_semicolon, no) && atrib(no) && confirmar_tk(tk_close_par, no) && corpo(no))
        return 1;
    else if(confirmar_tk(tk_kw_while, no) && confirmar_tk(tk_open_par, no) && exp_bool(no) && confirmar_tk(tk_close_par, no) && corpo(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}

canonical_original_code:
int iter(struct arvgen *pai) {
    struct arvgen *no = criar("iter");
    inserir(no, pai);
    no->pai_nome = pai->info;
    if(confirmar_tk(tk_kw_for, no) && confirmar_tk(tk_open_par, no) && atrib(no) && confirmar_tk(tk_semicolon, no) && exp_bool(no) && confirmar_tk(tk_semicolon, no) && atrib(no) && confirmar_tk(tk_close_par, no) && corpo(no))
        return 1;
    else if(confirmar_tk(tk_kw_while, no) && confirmar_tk(tk_open_par, no) && exp_bool(no) && confirmar_tk(tk_close_par, no) && corpo(no))
        return 1;
 pai->prim = ((void *)0);
    free(no);
    return 0;
}


cmd

decompiled_code:
__int64 __fastcall cmd(_QWORD *a1)
{
__int64 v1; // rbx

v1 = criar("cmd");
sprintf(buffer, "%d", (unsigned int)SBYTE6(nao_terminais));
strcat(*(char **)v1, buffer);
inserir(v1, a1);
*(_QWORD *)(v1 + 8) = *a1;
if ( (!(unsigned int)var_dec((_QWORD *)v1) || !(unsigned int)cmd(v1))
&& (!(unsigned int)cond(v1) || !(unsigned int)cmd(v1))
&& (!(unsigned int)iter((_QWORD *)v1) || !(unsigned int)cmd(v1))
&& (!(unsigned int)atrib((_QWORD *)v1) || !(unsigned int)cmd(v1))
&& (!(unsigned int)ch_func(v1) || !(unsigned int)cmd(v1)) )
{
vazio((__int64 *)v1);
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func23(_QWORD *a1)
{
__int64 v1; // rbx

v1 = criar("cmd");
sprintf(buffer, "%d", (unsigned int)SBYTE6(nao_terminais));
strcat(*(char **)v1, buffer);
inserir(v1, a1);
*(_QWORD *)(v1 + 8) = *a1;
if ( (!(unsigned int)func7((_QWORD *)v1) || !(unsigned int)func23(v1))
&& (!(unsigned int)func27(v1) || !(unsigned int)func23(v1))
&& (!(unsigned int)func22((_QWORD *)v1) || !(unsigned int)func23(v1))
&& (!(unsigned int)func13((_QWORD *)v1) || !(unsigned int)func23(v1))
&& (!(unsigned int)func5(v1) || !(unsigned int)func23(v1)) )
{
func0((__int64 *)v1);
}
return 1LL;
}

original_code:
int cmd(ArvoreGen *pai) {
 ArvoreGen *no = criar("cmd");
    sprintf(buffer,"%d",nao_terminais[6]);
    strcat(no->info, buffer);
 inserir(no, pai);
 no->pai_nome = pai->info;
 if((var_dec(no) && cmd(no)) || (cond(no) && cmd(no)) || (iter(no) && cmd(no)) || (atrib(no) && cmd(no)) || (ch_func(no) && cmd(no)) )
  return 1;
 vazio(no);
 return 1;
}

canonical_original_code:
int cmd(struct arvgen *pai) {
 struct arvgen *no = criar("cmd");
    sprintf(buffer,"%d",nao_terminais[6]);
    strcat(no->info, buffer);
 inserir(no, pai);
 no->pai_nome = pai->info;
 if((var_dec(no) && cmd(no)) || (cond(no) && cmd(no)) || (iter(no) && cmd(no)) || (atrib(no) && cmd(no)) || (ch_func(no) && cmd(no)) )
  return 1;
 vazio(no);
 return 1;
}


corpo

decompiled_code:
__int64 __fastcall corpo(_QWORD *a1)
{
__int64 v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = criar("corpo");
sprintf(buffer, "%d", (unsigned int)(char)nao_terminais);
strcat(*(char **)v1, buffer);
inserir(v1, a1);
*(_QWORD *)(v1 + 8) = *a1;
if ( !(unsigned int)confirmar_tk(289, (_QWORD *)v1)
|| !(unsigned int)cmd((_QWORD *)v1)
|| (v3 = confirmar_tk(288, (_QWORD *)v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free((void *)v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func24(_QWORD *a1)
{
__int64 v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = criar("corpo");
sprintf(buffer, "%d", (unsigned int)(char)nao_terminais);
strcat(*(char **)v1, buffer);
inserir(v1, a1);
*(_QWORD *)(v1 + 8) = *a1;
if ( !(unsigned int)func1(289, (_QWORD *)v1)
|| !(unsigned int)func23((_QWORD *)v1)
|| (v3 = func1(288, (_QWORD *)v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free((void *)v1);
result = 0LL;
}
return result;
}

original_code:
int corpo(ArvoreGen *pai) {
 ArvoreGen *no = criar("corpo");
    sprintf(buffer,"%d",nao_terminais[0]);
    strcat(no->info, buffer);
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_open_key, no) && cmd(no) && confirmar_tk(tk_close_key, no))
  return 1;
    pai->prim = ((void *)0);
    free(no);
 return 0;
}

canonical_original_code:
int corpo(struct arvgen *pai) {
 struct arvgen *no = criar("corpo");
    sprintf(buffer,"%d",nao_terminais[0]);
    strcat(no->info, buffer);
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_open_key, no) && cmd(no) && confirmar_tk(tk_close_key, no))
  return 1;
    pai->prim = ((void *)0);
    free(no);
 return 0;
}


decompiled_code:
__int64 __fastcall fator_cond(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("fator\\_cond");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)corpo(v1) )
{
v2 = cond(v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func25(_QWORD *a1)
{
_QWORD *v1; // rbx
unsigned int v2; // er12

v1 = (_QWORD *)criar("fator\\_cond");
inserir(v1, a1);
v1[1] = *a1;
v2 = 1;
if ( !(unsigned int)func24(v1) )
{
v2 = func27(v1);
if ( v2 )
{
v2 = 1;
}
else
{
a1[2] = 0LL;
free(v1);
}
}
return v2;
}

original_code:
int fator_cond(ArvoreGen *pai) {
 ArvoreGen *no = criar("fator\\_cond");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(corpo(no) || cond(no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}

canonical_original_code:
int fator_cond(struct arvgen *pai) {
 struct arvgen *no = criar("fator\\_cond");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(corpo(no) || cond(no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}


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

v1 = (__int64 *)criar("termo\\_cond");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(265, v1) || !(unsigned int)fator_cond(v1) )
vazio(v1);
return 1LL;
}

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

v1 = (__int64 *)criar("termo\\_cond");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(265, v1) || !(unsigned int)func25(v1) )
func0(v1);
return 1LL;
}

original_code:
int termo_cond(ArvoreGen *pai) {
 ArvoreGen *no = criar("termo\\_cond");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_else, no) && fator_cond(no))
  return 1;
 vazio(no);
 return 1;
}

canonical_original_code:
int termo_cond(struct arvgen *pai) {
 struct arvgen *no = criar("termo\\_cond");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_else, no) && fator_cond(no))
  return 1;
 vazio(no);
 return 1;
}


cond

decompiled_code:
__int64 __fastcall cond(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("cond");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(264, v1)
|| !(unsigned int)confirmar_tk(284, v1)
|| !(unsigned int)exp_bool(v1)
|| !(unsigned int)confirmar_tk(285, v1)
|| !(unsigned int)corpo(v1)
|| (v3 = termo_cond(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func27(_QWORD *a1)
{
_QWORD *v1; // rbx
__int64 result; // rax
int v3; // edx

v1 = (_QWORD *)criar("cond");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(264, v1)
|| !(unsigned int)func1(284, v1)
|| !(unsigned int)func20(v1)
|| !(unsigned int)func1(285, v1)
|| !(unsigned int)func24(v1)
|| (v3 = func26(v1), result = 1LL, !v3) )
{
a1[2] = 0LL;
free(v1);
result = 0LL;
}
return result;
}

original_code:
int cond(ArvoreGen *pai) {
 ArvoreGen *no = criar("cond");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_if, no) && confirmar_tk(tk_open_par, no) && exp_bool(no) && confirmar_tk(tk_close_par, no) && corpo(no) && termo_cond(no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}

canonical_original_code:
int cond(struct arvgen *pai) {
 struct arvgen *no = criar("cond");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_if, no) && confirmar_tk(tk_open_par, no) && exp_bool(no) && confirmar_tk(tk_close_par, no) && corpo(no) && termo_cond(no))
  return 1;
 pai->prim = ((void *)0);
    free(no);
 return 0;
}


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

v1 = (__int64 *)criar("termo\\_programa");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)confirmar_tk(273, v1)
|| !(unsigned int)confirmar_tk(257, v1)
|| !(unsigned int)confirmar_tk(284, v1)
|| !(unsigned int)list_param(v1)
|| !(unsigned int)confirmar_tk(289, v1)
|| !(unsigned int)cmd(v1)
|| !(unsigned int)confirmar_tk(274, v1)
|| !(unsigned int)retorno(v1)
|| !(unsigned int)exp_bool(v1)
|| !(unsigned int)confirmar_tk(290, v1)
|| !(unsigned int)confirmar_tk(288, v1)
|| !(unsigned int)termo_program(v1) )
{
vazio(v1);
}
return 1LL;
}

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

v1 = (__int64 *)criar("termo\\_programa");
inserir(v1, a1);
v1[1] = *a1;
if ( !(unsigned int)func1(273, v1)
|| !(unsigned int)func1(257, v1)
|| !(unsigned int)func1(284, v1)
|| !(unsigned int)func3(v1)
|| !(unsigned int)func1(289, v1)
|| !(unsigned int)func23(v1)
|| !(unsigned int)func1(274, v1)
|| !(unsigned int)func21(v1)
|| !(unsigned int)func20(v1)
|| !(unsigned int)func1(290, v1)
|| !(unsigned int)func1(288, v1)
|| !(unsigned int)func28(v1) )
{
func0(v1);
}
return 1LL;
}

original_code:
int termo_program(ArvoreGen *pai) {
 ArvoreGen *no = criar("termo\\_programa");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_func, no) && confirmar_tk(tk_id, no) && confirmar_tk(tk_open_par, no) && list_param(no) && confirmar_tk(tk_open_key, no) && cmd(no) && confirmar_tk(tk_kw_return, no) && retorno(no) && exp_bool(no) && confirmar_tk(tk_semicolon, no) && confirmar_tk(tk_close_key, no) && termo_program(no))
        return 1;
 vazio(no);
 return 1;
}

canonical_original_code:
int termo_program(struct arvgen *pai) {
 struct arvgen *no = criar("termo\\_programa");
 inserir(no, pai);
 no->pai_nome = pai->info;
 if(confirmar_tk(tk_kw_func, no) && confirmar_tk(tk_id, no) && confirmar_tk(tk_open_par, no) && list_param(no) && confirmar_tk(tk_open_key, no) && cmd(no) && confirmar_tk(tk_kw_return, no) && retorno(no) && exp_bool(no) && confirmar_tk(tk_semicolon, no) && confirmar_tk(tk_close_key, no) && termo_program(no))
        return 1;
 vazio(no);
 return 1;
}


programa

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

inicial = criar("root");
result = termo_program((__int64 *)inicial);
if ( (_DWORD)result )
{
result = confirmar_tk(272, (_QWORD *)inicial);
if ( (_DWORD)result )
result = (unsigned int)corpo((_QWORD *)inicial) != 0;
}
return result;
}

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

inicial = criar("root");
result = func28((__int64 *)inicial);
if ( (_DWORD)result )
{
result = func1(272, (_QWORD *)inicial);
if ( (_DWORD)result )
result = (unsigned int)func24((_QWORD *)inicial) != 0;
}
return result;
}

original_code:
int programa() {
 inicial = criar("root");
 if(termo_program(inicial) && confirmar_tk(tk_kw_main, inicial) && corpo(inicial))
  return 1;
 return 0;
}


decompiled_code:
int analisador_sintatico()
{
arq = fopen("../tree_tex/arvore.tex", "w");
if ( !arq )
puts("Falha ao abrir arvore.tex");
token = (__int64)malloc(0x18uLL);
token = proximo_token();
nao_terminais = 0LL;
*(&nao_terminais + 1) = 0LL;
*(&nao_terminais + 2) = 0LL;
*(&nao_terminais + 3) = 0LL;
*((_WORD *)&nao_terminais + 16) = 0;
*((_BYTE *)&nao_terminais + 34) = 0;
memset(terminais, 0, 0x88uLL);
terminais[34] = 0;
programa();
imprime(inicial);
return fclose(arq);
}

canonical_decompiled_code:
int func30()
{
arq = fopen("../tree_tex/arvore.tex", "w");
if ( !arq )
puts("Falha ao abrir arvore.tex");
token = (__int64)malloc(0x18uLL);
token = proximo_token();
nao_terminais = 0LL;
*(&nao_terminais + 1) = 0LL;
*(&nao_terminais + 2) = 0LL;
*(&nao_terminais + 3) = 0LL;
*((_WORD *)&nao_terminais + 16) = 0;
*((_BYTE *)&nao_terminais + 34) = 0;
memset(terminais, 0, 0x88uLL);
terminais[34] = 0;
func29();
imprime(inicial);
return fclose(arq);
}

original_code:
void analisador_sintatico() {
    arq = fopen("../tree_tex/arvore.tex", "w");
    if(arq == ((void *)0)) {
        puts("Falha ao abrir arvore.tex");
    }
    token = (Token*) malloc(sizeof(Token));
    token = proximo_token();
    memset(nao_terminais, 0, sizeof(nao_terminais));
    memset(terminais, 0, sizeof(terminais));
    programa();
    imprime(inicial);
    fclose(arq);
}

canonical_original_code:
void analisador_sintatico() {
    arq = fopen("../tree_tex/arvore.tex", "w");
    if(arq == ((void *)0)) {
        puts("Falha ao abrir arvore.tex");
    }
    token = (struct token *) malloc(sizeof(Token));
    token = proximo_token();
    memset(nao_terminais, 0, sizeof(nao_terminais));
    memset(terminais, 0, sizeof(terminais));
    programa();
    imprime(inicial);
    fclose(arq);
}

user_defined_types: struct token { char *valor; enum categoria categoria; int linha; int coluna; }

user_defined_types: enum categoria { tk_rel_op=256, tk_id=257, tk_const_int=258, tk_const_float=259, tk_const_lit=260, tk_kw_int=261, tk_kw_float=262, tk_kw_char=263, tk_kw_if=264, tk_kw_else=265, tk_kw_for=266, tk_kw_while=267, tk_kw_break=268, tk_kw_not=269, tk_kw_and=270, tk_kw_or=271, tk_kw_main=272, tk_kw_func=273, tk_kw_return=274, tk_kw_strcmp=275, tk_kw_strcop=276, tk_kw_input=277, tk_kw_output=278, tk_op_add=279, tk_op_sub=280, tk_op_mul=281, tk_op_div=282, tk_op_atrib=283, tk_open_par=284, tk_close_par=285, tk_open_bra=286, tk_close_bra=287, tk_close_key=288, tk_open_key=289, tk_semicolon=290, tk_comma=291, erro=292 }


delimitador

original_code:
Token* delimitador(){
    Token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char*)malloc(3*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    switch(linha_do_arquivo[i]){
        case '(':
            token->categoria = tk_open_par;
            strcpy(token->valor,"(");
            break;
        case ')':
            token->categoria = tk_close_par;
            strcpy(token->valor,")");
            break;
        case '{':
            token->categoria = tk_open_key;
            strcpy(token->valor,"{");
            break;
        case '}':
            token->categoria = tk_close_key;
            strcpy(token->valor,"}");
            break;
          case '[':
            token->categoria = tk_open_bra;
            strcpy(token->valor,"[");
            break;
        case ']':
            token->categoria = tk_close_bra;
            strcpy(token->valor,"]");
            break;
        case ';':
            token->categoria = tk_semicolon;
            strcpy(token->valor,";");
            break;
        case ',':
            token->categoria = tk_comma;
            strcpy(token->valor,",");
            break;
   }
   return token;
}

canonical_original_code:
struct token *delimitador(){
    struct token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char *)malloc(3*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    switch(linha_do_arquivo[i]){
        case '(':
            token->categoria = tk_open_par;
            strcpy(token->valor,"(");
            break;
        case ')':
            token->categoria = tk_close_par;
            strcpy(token->valor,")");
            break;
        case '{':
            token->categoria = tk_open_key;
            strcpy(token->valor,"{");
            break;
        case '}':
            token->categoria = tk_close_key;
            strcpy(token->valor,"}");
            break;
          case '[':
            token->categoria = tk_open_bra;
            strcpy(token->valor,"[");
            break;
        case ']':
            token->categoria = tk_close_bra;
            strcpy(token->valor,"]");
            break;
        case ';':
            token->categoria = tk_semicolon;
            strcpy(token->valor,";");
            break;
        case ',':
            token->categoria = tk_comma;
            strcpy(token->valor,",");
            break;
   }
   return token;
}

variable_types: struct token { char *valor; enum categoria { tk_rel_op=256, tk_id=257, tk_const_int=258, tk_const_float=259, tk_const_lit=260, tk_kw_int=261, tk_kw_float=262, tk_kw_char=263, tk_kw_if=264, tk_kw_else=265, tk_kw_for=266, tk_kw_while=267, tk_kw_break=268, tk_kw_not=269, tk_kw_and=270, tk_kw_or=271, tk_kw_main=272, tk_kw_func=273, tk_kw_return=274, tk_kw_strcmp=275, tk_kw_strcop=276, tk_kw_input=277, tk_kw_output=278, tk_op_add=279, tk_op_sub=280, tk_op_mul=281, tk_op_div=282, tk_op_atrib=283, tk_open_par=284, tk_close_par=285, tk_open_bra=286, tk_close_bra=287, tk_close_key=288, tk_open_key=289, tk_semicolon=290, tk_comma=291, erro=292 } categoria; int linha; int coluna; } *


original_code:
Token* operador_relacional(){
    Token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char*)malloc(3*sizeof(char));
    token->categoria = tk_rel_op;
    token->linha = linha1;
    token->coluna = coluna1;
    switch(linha_do_arquivo[i]){
        case '<':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,"<=");
            }else{
              i--;
              strcpy(token->valor,"<");
            }
            break;
         case '>':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,">=");
            }else{
              i--;
              strcpy(token->valor,">");
            }
            break;
        case '!':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,"!=");
            }else{
              i--;
              puts("Palavra não permitida pela linguagem");
            }
            break;
        case '=':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,"==");
            }else{
              i--;
              token->categoria = tk_op_atrib;
              strcpy(token->valor,"=");
            }
            break;
    }
    return token;
}

canonical_original_code:
struct token *operador_relacional(){
    struct token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char *)malloc(3*sizeof(char));
    token->categoria = tk_rel_op;
    token->linha = linha1;
    token->coluna = coluna1;
    switch(linha_do_arquivo[i]){
        case '<':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,"<=");
            }else{
              i--;
              strcpy(token->valor,"<");
            }
            break;
         case '>':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,">=");
            }else{
              i--;
              strcpy(token->valor,">");
            }
            break;
        case '!':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,"!=");
            }else{
              i--;
              puts("Palavra não permitida pela linguagem");
            }
            break;
        case '=':
            i++;
            if(linha_do_arquivo[i] == '='){
                strcpy(token->valor,"==");
            }else{
              i--;
              token->categoria = tk_op_atrib;
              strcpy(token->valor,"=");
            }
            break;
    }
    return token;
}

return_type: struct token { char *valor; enum categoria { tk_rel_op=256, tk_id=257, tk_const_int=258, tk_const_float=259, tk_const_lit=260, tk_kw_int=261, tk_kw_float=262, tk_kw_char=263, tk_kw_if=264, tk_kw_else=265, tk_kw_for=266, tk_kw_while=267, tk_kw_break=268, tk_kw_not=269, tk_kw_and=270, tk_kw_or=271, tk_kw_main=272, tk_kw_func=273, tk_kw_return=274, tk_kw_strcmp=275, tk_kw_strcop=276, tk_kw_input=277, tk_kw_output=278, tk_op_add=279, tk_op_sub=280, tk_op_mul=281, tk_op_div=282, tk_op_atrib=283, tk_open_par=284, tk_close_par=285, tk_open_bra=286, tk_close_bra=287, tk_close_key=288, tk_open_key=289, tk_semicolon=290, tk_comma=291, erro=292 } categoria; int linha; int coluna; } *


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

if ( bytes_lidos - 1 != i && primeiro )
{
if ( !feof(arquivo) )
{
++i;
++coluna1;
return func[linha_do_arquivo[i]]();
}
puts("Fim do arquivo");
result = 0LL;
}
else
{
i = 0;
coluna1 = 0;
bytes_lidos = getline(&linha_do_arquivo, &numero_bytes, arquivo);
if ( bytes_lidos != -1 )
{
++linha1;
++coluna1;
primeiro = 1;
return func[linha_do_arquivo[i]]();
}
result = 0LL;
}
return result;
}

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

if ( bytes_lidos - 1 != i && primeiro )
{
if ( !feof(arquivo) )
{
++i;
++coluna1;
return func[linha_do_arquivo[i]]();
}
puts("Fim do arquivo");
result = 0LL;
}
else
{
i = 0;
coluna1 = 0;
bytes_lidos = getline(&linha_do_arquivo, &numero_bytes, arquivo);
if ( bytes_lidos != -1 )
{
++linha1;
++coluna1;
primeiro = 1;
return func[linha_do_arquivo[i]]();
}
result = 0LL;
}
return result;
}

original_code:
Token* proximo_token(){
    if(i == (bytes_lidos-1) || primeiro == 0 ){
        i=0, coluna1 = 0;
        bytes_lidos = getline(&linha_do_arquivo, &numero_bytes, arquivo);
        if(bytes_lidos == -1){
            return ((void *)0);
        }
        linha1++, coluna1++, primeiro = 1;
    }else if(feof(arquivo)){
        puts("Fim do arquivo");
        return ((void *)0);
    }else{
        i++;
        coluna1++;
    }
    return func[(int)linha_do_arquivo[i]]();
}

canonical_original_code:
struct token *proximo_token(){
    if(i == (bytes_lidos-1) || primeiro == 0 ){
        i=0, coluna1 = 0;
        bytes_lidos = getline(&linha_do_arquivo, &numero_bytes, arquivo);
        if(bytes_lidos == -1){
            return ((void *)0);
        }
        linha1++, coluna1++, primeiro = 1;
    }else if(feof(arquivo)){
        puts("Fim do arquivo");
        return ((void *)0);
    }else{
        i++;
        coluna1++;
    }
    return func[(int)linha_do_arquivo[i]]();
}


indefinidos

decompiled_code:
__int64 indefinidos()
{
printf(format, (unsigned int)linha1, (unsigned int)coluna1, (unsigned int)linha_do_arquivo[i]);
return proximo_token();
}

canonical_decompiled_code:
__int64 func3()
{
printf(format, (unsigned int)linha1, (unsigned int)coluna1, (unsigned int)linha_do_arquivo[i]);
return func2();
}

original_code:
Token* indefinidos(){
    printf("Erro Linha:%d Coluna:%d \nCaractere %c não permitido na linguagem\n",
 linha1, coluna1, linha_do_arquivo[i]);
    return proximo_token();
}

canonical_original_code:
struct token *indefinidos(){
    printf("Erro Linha:%d Coluna:%d \nCaractere %c não permitido na linguagem\n",
 linha1, coluna1, linha_do_arquivo[i]);
    return proximo_token();
}


decompiled_code:
__int64 constante_numerica()
{
const char *v0; // rbx
_DWORD *v1; // rbp
char *v2; // r12
unsigned int v3; // er13
unsigned int v4; // er14
const unsigned __int16 **v5; // rdi
char *v6; // r9
__int64 v7; // rsi
int v8; // er10
int v9; // eax
char v10; // cl
__int16 v11; // dx

v0 = (const char *)malloc(0x32uLL);
v1 = malloc(0x18uLL);
v2 = (char *)malloc(3uLL);
*(_QWORD *)v1 = v2;
v3 = linha1;
v1[3] = linha1;
v4 = coluna1;
v1[4] = coluna1;
v5 = _ctype_b_loc();
v6 = linha_do_arquivo;
v7 = 0LL;
v8 = 0;
while ( 1 )
{
v9 = i;
v10 = v6[i];
v11 = (*v5)[v10] & 0x800;
if ( v10 != 46 && !v11 )
break;
if ( v11 )
{
v0[v7] = v10;
i = v9 + 1;
}
else
{
if ( v8 )
{
printf("Erro na Linha: %d e Colunha: %d\n", v3, v4);
puts(s);
return proximo_token();
}
v0[v7] = v10;
i = v9 + 1;
v8 = 1;
}
++v7;
}
v0[(int)v7] = 0;
i = v9 - 1;
if ( v8 )
v1[2] = 259;
else
v1[2] = 258;
strcpy(v2, v0);
return (__int64)v1;
}

canonical_decompiled_code:
__int64 func4()
{
const char *v0; // rbx
_DWORD *v1; // rbp
char *v2; // r12
unsigned int v3; // er13
unsigned int v4; // er14
const unsigned __int16 **v5; // rdi
char *v6; // r9
__int64 v7; // rsi
int v8; // er10
int v9; // eax
char v10; // cl
__int16 v11; // dx

v0 = (const char *)malloc(0x32uLL);
v1 = malloc(0x18uLL);
v2 = (char *)malloc(3uLL);
*(_QWORD *)v1 = v2;
v3 = linha1;
v1[3] = linha1;
v4 = coluna1;
v1[4] = coluna1;
v5 = _ctype_b_loc();
v6 = linha_do_arquivo;
v7 = 0LL;
v8 = 0;
while ( 1 )
{
v9 = i;
v10 = v6[i];
v11 = (*v5)[v10] & 0x800;
if ( v10 != 46 && !v11 )
break;
if ( v11 )
{
v0[v7] = v10;
i = v9 + 1;
}
else
{
if ( v8 )
{
printf("Erro na Linha: %d e Colunha: %d\n", v3, v4);
puts(s);
return func2();
}
v0[v7] = v10;
i = v9 + 1;
v8 = 1;
}
++v7;
}
v0[(int)v7] = 0;
i = v9 - 1;
if ( v8 )
v1[2] = 259;
else
v1[2] = 258;
strcpy(v2, v0);
return (__int64)v1;
}

original_code:
Token* constante_numerica(){
    int ponto_flutuante = 0, k = 0, erro = 0;
    char *constante = (char *)malloc(50*sizeof(char));
    Token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char*)malloc(3*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    while(((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short int) _ISdigit) || linha_do_arquivo[i] == '.'){
        if(((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short int) _ISdigit)){
            constante[k] = linha_do_arquivo[i];
            i++, k++, erro = 0;
        }
        else if(linha_do_arquivo[i] == '.' && ponto_flutuante == 0){
            constante[k] = linha_do_arquivo[i];
            ponto_flutuante = 1, i++, k++, erro = 0;
        }else{
            printf("Erro na Linha: %d e Colunha: %d\n", linha1, coluna1);
            puts("Palavra não permitida pela linguagem");
            erro = 1;
            return proximo_token();
        }
    }
    if(erro == 0)
    {
        constante[k] = '\0';
        i--, erro = 1;
        if(ponto_flutuante){
            token->categoria = tk_const_float;
            strcpy(token->valor, constante);
        }else{
            token->categoria = tk_const_int;
            strcpy(token->valor, constante);
        }
    }
    return token;
}

canonical_original_code:
struct token *constante_numerica(){
    int ponto_flutuante = 0; int k = 0; int erro = 0;
    char *constante = (char *)malloc(50*sizeof(char));
    struct token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char *)malloc(3*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    while(((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short) _ISdigit) || linha_do_arquivo[i] == '.'){
        if(((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short) _ISdigit)){
            constante[k] = linha_do_arquivo[i];
            i++, k++, erro = 0;
        }
        else if(linha_do_arquivo[i] == '.' && ponto_flutuante == 0){
            constante[k] = linha_do_arquivo[i];
            ponto_flutuante = 1, i++, k++, erro = 0;
        }else{
            printf("Erro na Linha: %d e Colunha: %d\n", linha1, coluna1);
            puts("Palavra não permitida pela linguagem");
            erro = 1;
            return proximo_token();
        }
    }
    if(erro == 0)
    {
        constante[k] = '\0';
        i--, erro = 1;
        if(ponto_flutuante){
            token->categoria = tk_const_float;
            strcpy(token->valor, constante);
        }else{
            token->categoria = tk_const_int;
            strcpy(token->valor, constante);
        }
    }
    return token;
}

variable_types: k int

variable_types: erro int

variable_types:
constante
char *


decompiled_code:
__int64 constante_literal()
{
_BYTE *v0; // r13
_DWORD *v1; // r14
int v2; // er15
int v3; // eax
int v4; // ebp
char *v5; // r12
int v6; // ebx
int v7; // ebp
size_t v9; // rax
char *v10; // rax

v0 = malloc(0x32uLL);
v1 = malloc(0x18uLL);
v1[3] = linha1;
v2 = coluna1 + 1;
coluna1 = v2;
v1[4] = v2;
v1[2] = 260;
++i;
do
{
v5 = linha_do_arquivo;
v6 = i;
v7 = j;
v0[j] = linha_do_arquivo[i];
if ( v7 > 40 )
v0 = realloc(v0, 0x64uLL);
if ( v6 == bytes_lidos - 1 )
{
printf("Faltando caracter terminador %c\n", 34LL);
return proximo_token();
}
i = v6 + 1;
v3 = v7 + 1;
j = v7 + 1;
v4 = ++coluna2;
}
while ( v5[v6 + 1] != 34 );
v0[v3] = 0;
v9 = strlen(v0);
v10 = (char *)malloc(v9 + 1);
*(_QWORD *)v1 = v10;
strcpy(v10, v0);
coluna1 = v2 + v4;
j = 0;
free(v0);
return (__int64)v1;
}

canonical_decompiled_code:
__int64 func5()
{
_BYTE *v0; // r13
_DWORD *v1; // r14
int v2; // er15
int v3; // eax
int v4; // ebp
char *v5; // r12
int v6; // ebx
int v7; // ebp
size_t v9; // rax
char *v10; // rax

v0 = malloc(0x32uLL);
v1 = malloc(0x18uLL);
v1[3] = linha1;
v2 = coluna1 + 1;
coluna1 = v2;
v1[4] = v2;
v1[2] = 260;
++i;
do
{
v5 = linha_do_arquivo;
v6 = i;
v7 = j;
v0[j] = linha_do_arquivo[i];
if ( v7 > 40 )
v0 = realloc(v0, 0x64uLL);
if ( v6 == bytes_lidos - 1 )
{
printf("Faltando caracter terminador %c\n", 34LL);
return func2();
}
i = v6 + 1;
v3 = v7 + 1;
j = v7 + 1;
v4 = ++coluna2;
}
while ( v5[v6 + 1] != 34 );
v0[v3] = 0;
v9 = strlen(v0);
v10 = (char *)malloc(v9 + 1);
*(_QWORD *)v1 = v10;
strcpy(v10, v0);
coluna1 = v2 + v4;
j = 0;
free(v0);
return (__int64)v1;
}

original_code:
Token* constante_literal(){
    char *buffer = (char *)malloc(50*sizeof(char));
    Token *token = (Token *)malloc(sizeof(Token));
    token->linha = linha1;
    token->coluna = ++coluna1;
    token->categoria = tk_const_lit;
    i++;
    while(1){
        buffer[j] = linha_do_arquivo[i];
        if(j > 50 -10){
            buffer= (char*)realloc(buffer, (50 +50)*sizeof(char));
        }
        if(i == bytes_lidos-1){
            printf("Faltando caracter terminador %c\n",34);
            return proximo_token();
        }
        i++, j++, coluna2++;
        if(linha_do_arquivo[i] == '"'){
            break;
        }
   }
    buffer[j] = '\0';
    token->valor=(char*)malloc((strlen(buffer)+1)*sizeof(char));
    strcpy(token->valor, buffer);
    coluna1 += coluna2, j = 0;
    free(buffer);
    return token;
}

canonical_original_code:
struct token *constante_literal(){
    char *buffer = (char *)malloc(50*sizeof(char));
    struct token *token = (Token *)malloc(sizeof(Token));
    token->linha = linha1;
    token->coluna = ++coluna1;
    token->categoria = tk_const_lit;
    i++;
    while(1){
        buffer[j] = linha_do_arquivo[i];
        if(j > 50 -10){
            buffer= (char *)realloc(buffer, (50 +50)*sizeof(char));
        }
        if(i == bytes_lidos-1){
            printf("Faltando caracter terminador %c\n",34);
            return proximo_token();
        }
        i++, j++, coluna2++;
        if(linha_do_arquivo[i] == '"'){
            break;
        }
   }
    buffer[j] = '\0';
    token->valor=(char *)malloc((strlen(buffer)+1)*sizeof(char));
    strcpy(token->valor, buffer);
    coluna1 += coluna2, j = 0;
    free(buffer);
    return token;
}

variable_types:
buffer
char *


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

if ( a1 )
result = printf(
"[Categoria: %d Valor: %s Linha: %d Coluna: %d]\n",
*(unsigned int *)(a1 + 8),
*(const char **)a1,
*(unsigned int *)(a1 + 12),
*(unsigned int *)(a1 + 16));
return result;
}

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

if ( a1 )
result = printf(
"[Categoria: %d Valor: %s Linha: %d Coluna: %d]\n",
*(unsigned int *)(a1 + 8),
*(const char **)a1,
*(unsigned int *)(a1 + 12),
*(unsigned int *)(a1 + 16));
return result;
}

original_code:
void imprimir_token(Token *token){
 if(token != ((void *)0))
    printf("[Categoria: %d Valor: %s Linha: %d Coluna: %d]\n", token->categoria, token->valor, token->linha, token->coluna);
}

canonical_original_code:
void imprimir_token(struct token *token){
 if(token != ((void *)0))
    printf("[Categoria: %d Valor: %s Linha: %d Coluna: %d]\n", token->categoria, token->valor, token->linha, token->coluna);
}


decompiled_code:
__int64 __fastcall achar_categoria(char *s1)
{
unsigned int v1; // ecx
__int64 result; // rax

v1 = 261;
if ( !strcmp(s1, "int") )
goto LABEL_19;
v1 = 262;
if ( !strcmp(s1, "float") )
goto LABEL_19;
v1 = 263;
if ( !strcmp(s1, "char") )
goto LABEL_19;
v1 = 264;
if ( !strcmp(s1, "if") )
goto LABEL_19;
v1 = 265;
if ( !strcmp(s1, "else") )
goto LABEL_19;
v1 = 266;
if ( !strcmp(s1, "for") )
goto LABEL_19;
v1 = 267;
if ( !strcmp(s1, "while") )
goto LABEL_19;
v1 = 268;
if ( !strcmp(s1, "break") )
goto LABEL_19;
v1 = 269;
if ( !strcmp(s1, "not") )
goto LABEL_19;
v1 = 270;
if ( !strcmp(s1, "and")
|| (v1 = 271, !strcmp(s1, "or"))
|| (v1 = 272, !strcmp(s1, "main"))
|| (v1 = 273, !strcmp(s1, "function"))
|| (v1 = 274, !strcmp(s1, "return"))
|| (v1 = 275, !strcmp(s1, "strcmp"))
|| (v1 = 276, !strcmp(s1, "strcop"))
|| (v1 = 277, !strcmp(s1, "input")) )
{
LABEL_19:
result = v1;
}
else
{
result = strcmp(s1, "output") == 0 ? 278 : 292;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *s1)
{
unsigned int v1; // ecx
__int64 result; // rax

v1 = 261;
if ( !strcmp(s1, "int") )
goto LABEL_19;
v1 = 262;
if ( !strcmp(s1, "float") )
goto LABEL_19;
v1 = 263;
if ( !strcmp(s1, "char") )
goto LABEL_19;
v1 = 264;
if ( !strcmp(s1, "if") )
goto LABEL_19;
v1 = 265;
if ( !strcmp(s1, "else") )
goto LABEL_19;
v1 = 266;
if ( !strcmp(s1, "for") )
goto LABEL_19;
v1 = 267;
if ( !strcmp(s1, "while") )
goto LABEL_19;
v1 = 268;
if ( !strcmp(s1, "break") )
goto LABEL_19;
v1 = 269;
if ( !strcmp(s1, "not") )
goto LABEL_19;
v1 = 270;
if ( !strcmp(s1, "and")
|| (v1 = 271, !strcmp(s1, "or"))
|| (v1 = 272, !strcmp(s1, "main"))
|| (v1 = 273, !strcmp(s1, "function"))
|| (v1 = 274, !strcmp(s1, "return"))
|| (v1 = 275, !strcmp(s1, "strcmp"))
|| (v1 = 276, !strcmp(s1, "strcop"))
|| (v1 = 277, !strcmp(s1, "input")) )
{
LABEL_19:
result = v1;
}
else
{
result = strcmp(s1, "output") == 0 ? 278 : 292;
}
return result;
}

original_code:
Categoria achar_categoria(char *buffer){
    if(!strcmp(buffer, "int"))
        return tk_kw_int;
    if((!strcmp(buffer, "float")))
        return tk_kw_float;
    if((!strcmp(buffer, "char")))
        return tk_kw_char;
    if((!strcmp(buffer, "if")))
        return tk_kw_if;
    if((!strcmp(buffer, "else")))
        return tk_kw_else;
    if((!strcmp(buffer, "for")))
        return tk_kw_for;
    if((!strcmp(buffer, "while")))
        return tk_kw_while;
    if((!strcmp(buffer, "break")))
        return tk_kw_break;
    if((!strcmp(buffer, "not")))
        return tk_kw_not;
    if((!strcmp(buffer, "and")))
        return tk_kw_and;
    if((!strcmp(buffer, "or")))
        return tk_kw_or;
    if((!strcmp(buffer, "main")))
        return tk_kw_main;
    if((!strcmp(buffer, "function")))
        return tk_kw_func;
    if((!strcmp(buffer, "return")))
        return tk_kw_return;
    if((!strcmp(buffer, "strcmp")))
        return tk_kw_strcmp;
    if((!strcmp(buffer, "strcop")))
        return tk_kw_strcop;
    if((!strcmp(buffer, "input")))
        return tk_kw_input;
    if((!strcmp(buffer, "output")))
        return tk_kw_output;
    return erro;
}

canonical_original_code:
enum categoria achar_categoria(char *buffer){
    if(!strcmp(buffer, "int"))
        return tk_kw_int;
    if((!strcmp(buffer, "float")))
        return tk_kw_float;
    if((!strcmp(buffer, "char")))
        return tk_kw_char;
    if((!strcmp(buffer, "if")))
        return tk_kw_if;
    if((!strcmp(buffer, "else")))
        return tk_kw_else;
    if((!strcmp(buffer, "for")))
        return tk_kw_for;
    if((!strcmp(buffer, "while")))
        return tk_kw_while;
    if((!strcmp(buffer, "break")))
        return tk_kw_break;
    if((!strcmp(buffer, "not")))
        return tk_kw_not;
    if((!strcmp(buffer, "and")))
        return tk_kw_and;
    if((!strcmp(buffer, "or")))
        return tk_kw_or;
    if((!strcmp(buffer, "main")))
        return tk_kw_main;
    if((!strcmp(buffer, "function")))
        return tk_kw_func;
    if((!strcmp(buffer, "return")))
        return tk_kw_return;
    if((!strcmp(buffer, "strcmp")))
        return tk_kw_strcmp;
    if((!strcmp(buffer, "strcop")))
        return tk_kw_strcop;
    if((!strcmp(buffer, "input")))
        return tk_kw_input;
    if((!strcmp(buffer, "output")))
        return tk_kw_output;
    return erro;
}

return_type: enum categoria { tk_rel_op=256, tk_id=257, tk_const_int=258, tk_const_float=259, tk_const_lit=260, tk_kw_int=261, tk_kw_float=262, tk_kw_char=263, tk_kw_if=264, tk_kw_else=265, tk_kw_for=266, tk_kw_while=267, tk_kw_break=268, tk_kw_not=269, tk_kw_and=270, tk_kw_or=271, tk_kw_main=272, tk_kw_func=273, tk_kw_return=274, tk_kw_strcmp=275, tk_kw_strcop=276, tk_kw_input=277, tk_kw_output=278, tk_op_add=279, tk_op_sub=280, tk_op_mul=281, tk_op_div=282, tk_op_atrib=283, tk_open_par=284, tk_close_par=285, tk_open_bra=286, tk_close_bra=287, tk_close_key=288, tk_open_key=289, tk_semicolon=290, tk_comma=291, erro=292 }


palavra

decompiled_code:
_DWORD *palavra()
{
_DWORD *v0; // r15
void *v1; // r13
const unsigned __int16 **v2; // r14
int v3; // ebx
int v4; // ebp
char *v5; // r12
int v6; // ebx
int v8; // [rsp+4h] [rbp-44h]
char *dest; // [rsp+8h] [rbp-40h]

v0 = malloc(0x18uLL);
dest = (char *)malloc(3uLL);
*(_QWORD *)v0 = dest;
v1 = malloc(0x32uLL);
v0[3] = linha1;
v8 = coluna1;
v0[4] = coluna1;
v2 = _ctype_b_loc();
while ( 1 )
{
v4 = i;
v5 = &linha_do_arquivo[i];
if ( ((*v2)[*v5] & 0xC00) == 0 && *v5 != 95 )
break;
v3 = j;
if ( j > 40 )
v1 = realloc(v1, 0x64uLL);
*((_BYTE *)v1 + v3) = (*_ctype_tolower_loc())[*v5];
j = v3 + 1;
i = v4 + 1;
++coluna2;
}
*((_BYTE *)v1 + j) = 0;
i = v4 - 1;
v6 = --coluna2;
if ( (unsigned int)achar_categoria((char *)v1) == 292 )
{
v0[2] = 257;
strcpy(dest, (const char *)v1);
}
else
{
strcpy(dest, (const char *)v1);
v0[2] = achar_categoria((char *)v1);
}
coluna1 = v6 + v8;
coluna2 = 0;
j = 0;
return v0;
}

canonical_decompiled_code:
_DWORD *func8()
{
_DWORD *v0; // r15
void *v1; // r13
const unsigned __int16 **v2; // r14
int v3; // ebx
int v4; // ebp
char *v5; // r12
int v6; // ebx
int v8; // [rsp+4h] [rbp-44h]
char *dest; // [rsp+8h] [rbp-40h]

v0 = malloc(0x18uLL);
dest = (char *)malloc(3uLL);
*(_QWORD *)v0 = dest;
v1 = malloc(0x32uLL);
v0[3] = linha1;
v8 = coluna1;
v0[4] = coluna1;
v2 = _ctype_b_loc();
while ( 1 )
{
v4 = i;
v5 = &linha_do_arquivo[i];
if ( ((*v2)[*v5] & 0xC00) == 0 && *v5 != 95 )
break;
v3 = j;
if ( j > 40 )
v1 = realloc(v1, 0x64uLL);
*((_BYTE *)v1 + v3) = (*_ctype_tolower_loc())[*v5];
j = v3 + 1;
i = v4 + 1;
++coluna2;
}
*((_BYTE *)v1 + j) = 0;
i = v4 - 1;
v6 = --coluna2;
if ( (unsigned int)func7((char *)v1) == 292 )
{
v0[2] = 257;
strcpy(dest, (const char *)v1);
}
else
{
strcpy(dest, (const char *)v1);
v0[2] = func7((char *)v1);
}
coluna1 = v6 + v8;
coluna2 = 0;
j = 0;
return v0;
}

original_code:
Token* palavra(){
    Token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char*)malloc(3*sizeof(char));
    char *palavra = (char *)malloc(50*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    while(((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short int) _ISalpha) || ((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short int) _ISdigit) ||
            linha_do_arquivo[i]== '_'){
        if(j > 50 -10){
            palavra = (char*)realloc(palavra, (50 +50)*sizeof(char));
        }
        palavra[j] = tolower(linha_do_arquivo[i]);
        j++, i++, coluna2++;
    }
    palavra[j] = '\0';
    i--;
    coluna2--;
    if(achar_categoria(palavra) != erro)
    {
        strcpy(token->valor, palavra);
        token->categoria = achar_categoria(palavra);
    }
    else{
        token->categoria = tk_id;
        strcpy(token->valor, palavra);
    }
    coluna1 += coluna2;
    coluna2 = 0, j = 0;
 return token;
}

canonical_original_code:
struct token *palavra(){
    struct token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char *)malloc(3*sizeof(char));
    char *palavra = (char *)malloc(50*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    while(((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short) _ISalpha) || ((*__ctype_b_loc ())[(int) ((linha_do_arquivo[i]))] & (unsigned short) _ISdigit) ||
            linha_do_arquivo[i]== '_'){
        if(j > 50 -10){
            palavra = (char *)realloc(palavra, (50 +50)*sizeof(char));
        }
        palavra[j] = tolower(linha_do_arquivo[i]);
        j++, i++, coluna2++;
    }
    palavra[j] = '\0';
    i--;
    coluna2--;
    if(achar_categoria(palavra) != erro)
    {
        strcpy(token->valor, palavra);
        token->categoria = achar_categoria(palavra);
    }
    else{
        token->categoria = tk_id;
        strcpy(token->valor, palavra);
    }
    coluna1 += coluna2;
    coluna2 = 0, j = 0;
 return token;
}

variable_types:
palavra
char *


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

comentario = 1;
while ( bytes_lidos != -1 )
{
if ( bytes_lidos - 1 == i )
{
i = 0;
coluna1 = 0;
bytes_lidos = getline(&linha_do_arquivo, &numero_bytes, arquivo);
++linha1;
}
else
{
++i;
}
++coluna1;
result = i;
if ( linha_do_arquivo[i] == 42 && i != bytes_lidos - 1 && linha_do_arquivo[i + 1] == 47 )
{
result = ++i;
comentario = 0;
return result;
}
if ( comentario != 1 )
return result;
}
printf("Erro na Linha: %d e Colunha: %d\n", (unsigned int)linha1, (unsigned int)coluna1);
return puts(" */ esperado");
}

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

comentario = 1;
while ( bytes_lidos != -1 )
{
if ( bytes_lidos - 1 == i )
{
i = 0;
coluna1 = 0;
bytes_lidos = getline(&linha_do_arquivo, &numero_bytes, arquivo);
++linha1;
}
else
{
++i;
}
++coluna1;
result = i;
if ( linha_do_arquivo[i] == 42 && i != bytes_lidos - 1 && linha_do_arquivo[i + 1] == 47 )
{
result = ++i;
comentario = 0;
return result;
}
if ( comentario != 1 )
return result;
}
printf("Erro na Linha: %d e Colunha: %d\n", (unsigned int)linha1, (unsigned int)coluna1);
return puts(" */ esperado");
}

original_code:
void eliminar_comentario(){
    comentario = 1;
 while( comentario == 1 && bytes_lidos != -1)
 {
        if(i == (bytes_lidos-1) ){
            i=0, coluna1 = 0;
            bytes_lidos = getline(&linha_do_arquivo, &numero_bytes, arquivo);
            linha1++, coluna1++;
        }else{
            i++, coluna1++;
        }
        if(linha_do_arquivo[i] == '*' && (i != bytes_lidos-1)) {
            if(linha_do_arquivo[i + 1] == '/'){
                i++, comentario = 0;
            }
        }
    }
    if(comentario == 1){
         printf("Erro na Linha: %d e Colunha: %d\n", linha1, coluna1);
        puts(" */ esperado");
    }
}


decompiled_code:
_DWORD *operador_aritmetico()
{
_DWORD *v0; // rbx
_WORD *v1; // rdx
unsigned int v2; // edi
unsigned int v3; // er8
int v4; // ecx
char v5; // al

v0 = malloc(0x18uLL);
v1 = malloc(3uLL);
*(_QWORD *)v0 = v1;
v2 = linha1;
v0[3] = linha1;
v3 = coluna1;
v0[4] = coluna1;
v4 = i;
v5 = linha_do_arquivo[i];
if ( v5 == 45 )
{
v0[2] = 280;
*v1 = 45;
}
else if ( v5 > 45 )
{
if ( v5 == 47 )
{
++i;
if ( linha_do_arquivo[v4 + 1] == 42 )
{
eliminar_comentario();
v0 = (_DWORD *)proximo_token();
}
else
{
i = v4;
v0[2] = 282;
*v1 = 47;
}
}
}
else if ( v5 == 42 )
{
++i;
if ( linha_do_arquivo[v4 + 1] == 47 )
{
printf("Erro na Linha: %d e Colunha: %d\n", v2, v3);
puts("/* esperado");
v0 = (_DWORD *)proximo_token();
}
else
{
i = v4;
v0[2] = 281;
*v1 = 42;
}
}
else if ( v5 == 43 )
{
v0[2] = 279;
*v1 = 43;
}
return v0;
}

canonical_decompiled_code:
_DWORD *func10()
{
_DWORD *v0; // rbx
_WORD *v1; // rdx
unsigned int v2; // edi
unsigned int v3; // er8
int v4; // ecx
char v5; // al

v0 = malloc(0x18uLL);
v1 = malloc(3uLL);
*(_QWORD *)v0 = v1;
v2 = linha1;
v0[3] = linha1;
v3 = coluna1;
v0[4] = coluna1;
v4 = i;
v5 = linha_do_arquivo[i];
if ( v5 == 45 )
{
v0[2] = 280;
*v1 = 45;
}
else if ( v5 > 45 )
{
if ( v5 == 47 )
{
++i;
if ( linha_do_arquivo[v4 + 1] == 42 )
{
func9();
v0 = (_DWORD *)func2();
}
else
{
i = v4;
v0[2] = 282;
*v1 = 47;
}
}
}
else if ( v5 == 42 )
{
++i;
if ( linha_do_arquivo[v4 + 1] == 47 )
{
printf("Erro na Linha: %d e Colunha: %d\n", v2, v3);
puts("/* esperado");
v0 = (_DWORD *)func2();
}
else
{
i = v4;
v0[2] = 281;
*v1 = 42;
}
}
else if ( v5 == 43 )
{
v0[2] = 279;
*v1 = 43;
}
return v0;
}

original_code:
Token* operador_aritmetico(){
    Token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char*)malloc(3*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    switch(linha_do_arquivo[i]){
        case '+':
            token->categoria = tk_op_add;
            strcpy(token->valor,"+");
            break;
        case '-':
            token->categoria = tk_op_sub;
            strcpy(token->valor,"-");
            break;
        case '*':
            i++;
            if(linha_do_arquivo[i] == '/'){
                printf("Erro na Linha: %d e Colunha: %d\n", linha1, coluna1);
                puts("/* esperado");
                return proximo_token();
            }
            else{
                i--;
                token->categoria = tk_op_mul;
                strcpy(token->valor,"*");
            }
            break;
        case '/':
            i++;
            if(linha_do_arquivo[i] == '*'){
               eliminar_comentario();
               return proximo_token();
            }else{
                i--;
                token->categoria = tk_op_div;
                strcpy(token->valor,"/");
            }
            break;
    }
    return token;
}

canonical_original_code:
struct token *operador_aritmetico(){
    struct token *token = (Token*) malloc(sizeof(Token));
    token->valor=(char *)malloc(3*sizeof(char));
    token->linha = linha1;
    token->coluna = coluna1;
    switch(linha_do_arquivo[i]){
        case '+':
            token->categoria = tk_op_add;
            strcpy(token->valor,"+");
            break;
        case '-':
            token->categoria = tk_op_sub;
            strcpy(token->valor,"-");
            break;
        case '*':
            i++;
            if(linha_do_arquivo[i] == '/'){
                printf("Erro na Linha: %d e Colunha: %d\n", linha1, coluna1);
                puts("/* esperado");
                return proximo_token();
            }
            else{
                i--;
                token->categoria = tk_op_mul;
                strcpy(token->valor,"*");
            }
            break;
        case '/':
            i++;
            if(linha_do_arquivo[i] == '*'){
               eliminar_comentario();
               return proximo_token();
            }else{
                i--;
                token->categoria = tk_op_div;
                strcpy(token->valor,"/");
            }
            break;
    }
    return token;
}


iniciar

decompiled_code:
int __fastcall iniciar(__int64 a1, __int64 a2)
{
FILE *v2; // rax

linha_do_arquivo = (char *)malloc(numero_bytes);
v2 = fopen(*(const char **)(a2 + 8), "r");
arquivo = v2;
if ( !v2 )
LODWORD(v2) = puts("Erro ao abrir o arquivo");
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func11(__int64 a1, __int64 a2)
{
FILE *v2; // rax

linha_do_arquivo = (char *)malloc(numero_bytes);
v2 = fopen(*(const char **)(a2 + 8), "r");
arquivo = v2;
if ( !v2 )
LODWORD(v2) = puts("Erro ao abrir o arquivo");
return (int)v2;
}

original_code:
void iniciar(int argc, char *argv[]){
    linha_do_arquivo = (char*) malloc (numero_bytes);
    arquivo = fopen(argv[1], "r");
    if(arquivo == ((void *)0)){
        puts("Erro ao abrir o arquivo");
    }
}

canonical_original_code:
void iniciar(int argc, char *argv[]){
    linha_do_arquivo = (char *) malloc (numero_bytes);
    arquivo = fopen(argv[1], "r");
    if(arquivo == ((void *)0)){
        puts("Erro ao abrir o arquivo");
    }
}


encerrar

decompiled_code:
int encerrar()
{
return fclose(arquivo);
}

canonical_decompiled_code:
int func12()
{
return fclose(arquivo);
}

original_code:
void encerrar(){
    fclose(arquivo);
}

canonical_original_code:
void encerrar(){
    fclose(arquivo);
}


intMax

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

result = a2;
if ( (int)a1 >= (int)a2 )
result = a1;
return result;
}

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

result = a2;
if ( (int)a1 >= (int)a2 )
result = a1;
return result;
}

original_code:
static
int intMax(int x,
           int y)
{
  if (x > y)
    return x;
  else
    return y;
}

variable_types: x int

variable_types: y int


intMin

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

result = a2;
if ( (int)a1 <= (int)a2 )
result = a1;
return result;
}

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

result = a2;
if ( (int)a1 <= (int)a2 )
result = a1;
return result;
}

original_code:
static
int intMin(int x,
           int y)
{
  if (x < y)
    return x;
  else
    return y;
}


unsignedMax

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

result = a2;
if ( a1 >= a2 )
result = a1;
return result;
}

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

result = a2;
if ( a1 >= a2 )
result = a1;
return result;
}

original_code:
static
unsigned unsignedMax(unsigned x,
                     unsigned y)
{
  if (x > y)
    return x;
  else
    return y;
}

canonical_original_code:
static unsigned int unsignedMax(unsigned int x, unsigned int y)
{
  if (x > y)
    return x;
  else
    return y;
}

variable_types:
x
unsigned int

variable_types:
y
unsigned int

return_type: unsigned int


treeHeight

decompiled_code:
__int64 __fastcall treeHeight(__int64 a1, unsigned int a2)
{
__int64 result; // rax
unsigned int v3; // ebx
_QWORD *v4; // rbp
__int64 v5; // r14
unsigned int v6; // eax

result = 0LL;
if ( a1 )
{
v3 = *(_DWORD *)(a1 + 36);
if ( v3 )
{
v4 = *(_QWORD **)(a1 + 40);
v5 = (__int64)&v4[v3];
v3 = 0;
do
{
v6 = treeHeight(*v4, a2);
if ( v3 < v6 )
v3 = v6;
++v4;
}
while ( v4 != (_QWORD *)v5 );
}
result = *(_DWORD *)(a1 + 16) + a2 + v3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, unsigned int a2)
{
__int64 result; // rax
unsigned int v3; // ebx
_QWORD *v4; // rbp
__int64 v5; // r14
unsigned int v6; // eax

result = 0LL;
if ( a1 )
{
v3 = *(_DWORD *)(a1 + 36);
if ( v3 )
{
v4 = *(_QWORD **)(a1 + 40);
v5 = (__int64)&v4[v3];
v3 = 0;
do
{
v6 = func3(*v4, a2);
if ( v3 < v6 )
v3 = v6;
++v4;
}
while ( v4 != (_QWORD *)v5 );
}
result = *(_DWORD *)(a1 + 16) + a2 + v3;
}
return result;
}

original_code:
static
int treeHeight(Tree tree,
               unsigned ySeparation)
{
  unsigned height = 0;
  unsigned i;
  unsigned newHeight;
  if (tree != (Tree)((void *)0)) {
    for (i = 0; i < tree->nrBranches; i++) {
      newHeight = treeHeight(tree->branches[i], ySeparation);
      if (newHeight > height)
        height = newHeight;
    }
    height += ySeparation+tree->height;
  }
  return height;
}

canonical_original_code:
static int treeHeight(struct TreeNode *tree, unsigned int ySeparation)
{
  unsigned int height = 0;
  unsigned int i;
  unsigned int newHeight;
  if (tree != (Tree)((void *)0)) {
    for (i = 0; i < tree->nrBranches; i++) {
      newHeight = treeHeight(tree->branches[i], ySeparation);
      if (newHeight > height)
        height = newHeight;
    }
    height += ySeparation+tree->height;
  }
  return height;
}

variable_types: struct TreeNode { char *name; char *parent; unsigned int height; unsigned int width; unsigned int depth; int x; int y; unsigned int nrBranches; struct TreeNode **branches; } *

variable_types:
ySeparation
unsigned int

variable_types:
height
unsigned int

variable_types:
i
unsigned int

variable_types:
newHeight
unsigned int


deleteNode

decompiled_code:
void __fastcall deleteNode(void *ptr)
{
if ( ptr )
{
free(*(void **)ptr);
free(*((void **)ptr + 1));
free(*((void **)ptr + 5));
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
if ( ptr )
{
free(*(void **)ptr);
free(*((void **)ptr + 1));
free(*((void **)ptr + 5));
free(ptr);
}
}

original_code:
void deleteNode(TreeNode *node)
{
  if ((Tree)((void *)0) != node) {
    (void)free((char *)node->name);
    (void)free((char *)node->parent);
    (void)free((char *)node->branches);
    (void)free((char *)node);
  }
}

canonical_original_code:
void deleteNode(struct TreeNode *node)
{
  if ((Tree)((void *)0) != node) {
    (void)free((char *)node->name);
    (void)free((char *)node->parent);
    (void)free((char *)node->branches);
    (void)free((char *)node);
  }
}

user_defined_types: struct TreeNode { char *name; char *parent; unsigned int height; unsigned int width; unsigned int depth; int x; int y; unsigned int nrBranches; struct TreeNode **branches; }


doShapeTree

decompiled_code:
__int64 __fastcall doShapeTree(__int64 a1, unsigned int a2, unsigned int a3, unsigned int **a4, unsigned int **a5, int a6, int a7)
{
_DWORD *v7; // r12
unsigned int v10; // eax
unsigned int k; // edx
__int64 result; // rax
size_t v14; // rbx
unsigned int v15; // ebx
unsigned int **v16; // rbp
unsigned int v17; // edi
unsigned int v18; // ebx
unsigned int v19; // eax
unsigned int *v20; // rdx
unsigned int i; // esi
unsigned int *v22; // rbx
unsigned int **v23; // r8
unsigned int *v24; // rdx
unsigned int v25; // esi
unsigned int j; // eax
unsigned int *v27; // rbx
unsigned int v28; // edx
unsigned int *v29; // r15
unsigned int *v30; // r13
unsigned int v31; // er12
int v32; // ecx
unsigned int v33; // eax
__int64 v34; // rdx
unsigned int *v35; // rax
unsigned int v36; // edx
unsigned int *v37; // rax
unsigned int v38; // edx
unsigned int v39; // ebx
unsigned int v40; // [rsp+8h] [rbp-80h]
unsigned int **v41; // [rsp+10h] [rbp-78h]
_DWORD *v42; // [rsp+18h] [rbp-70h]
unsigned int v43; // [rsp+24h] [rbp-64h]
unsigned int **v44; // [rsp+38h] [rbp-50h]
int v46; // [rsp+44h] [rbp-44h]
unsigned int **v47; // [rsp+48h] [rbp-40h]

v7 = (_DWORD *)a1;
v43 = a3;
v10 = *(_DWORD *)(a1 + 36);
if ( v10 )
{
v14 = 8LL * v10;
v44 = (unsigned int **)malloc(v14);
v47 = (unsigned int **)malloc(v14);
v15 = 0;
v46 = a7 + v43;
do
{
doShapeTree(
*(_QWORD *)(*(_QWORD *)(a1 + 40) + 8LL * v15),
a2,
*(_DWORD *)(a1 + 16) + v46,
8 * v15 + (_DWORD)v44,
(_DWORD)v47 + 8 * v15,
a6,
a7);
++v15;
}
while ( *(_DWORD *)(a1 + 36) > v15 );
*a4 = *v44;
*a5 = *v47;
*(_DWORD *)(**(_QWORD **)(a1 + 40) + 28LL) = 0;
if ( *(_DWORD *)(a1 + 36) != 1 )
{
v40 = 0;
v16 = a5;
do
{
v18 = v7[4] + v46;
v29 = *v16;
v41 = &v44[++v40];
v17 = 0;
v30 = *v41;
v42 = v7;
v31 = intMin(**v41, **v16);
while ( v31 >= v18 )
{
v17 = intMax(v17, v30[v18 + 1] + v29[v18 + 1]);
++v18;
}
v7 = v42;
*(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v40) + 28LL) = a6 + v17;
v19 = **a4 + 1;
v20 = *v41;
for ( i = **v41; i >= v19; i = **v41 )
{
(*a4)[v19 + 1] = v20[v19 + 1] - *(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v40) + 28LL);
++v19;
v20 = *v41;
}
v22 = *a4;
*v22 = unsignedMax(**a4, i);
v23 = &v47[v40];
v24 = *v23;
v25 = **v23;
for ( j = v43; v25 >= j; v25 = **v23 )
{
(*v16)[j + 1] = *(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v40) + 28LL) + v24[j + 1];
++j;
v24 = *v23;
}
v27 = *v16;
*v27 = unsignedMax(**v16, v25);
v28 = v42[9];
}
while ( v40 < v28 - 1 );
a5 = v16;
if ( v28 > 1 )
{
v32 = *(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * (v28 - 1)) + 28LL) / 2;
v33 = 0;
do
{
v34 = *(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v33);
*(_DWORD *)(v34 + 28) -= v32;
++v33;
}
while ( v42[9] > v33 );
v35 = *a4;
if ( v43 <= **a4 )
{
v36 = v43;
do
{
v35[++v36] += v32;
v35 = *a4;
}
while ( **a4 >= v36 );
}
v37 = *v16;
if ( v43 <= **v16 )
{
v38 = v43;
do
{
v37[++v38] -= v32;
v37 = *v16;
}
while ( **v16 >= v38 );
}
if ( v42[9] > 1u )
{
v39 = 1;
do
{
free(v44[v39]);
free(v47[v39++]);
}
while ( v42[9] > v39 );
}
}
}
}
else
{
*a4 = newEdge(a2);
*a5 = newEdge(a2);
**a4 = *(_DWORD *)(a1 + 16) + a3 - 1;
**a5 = *(_DWORD *)(a1 + 16) + a3 - 1;
}
for ( k = v43 - a7; v7[4] + v43 > k; ++k )
{
(*a4)[k + 1] = v7[5] >> 1;
(*a5)[k + 1] = (unsigned int)(v7[5] + 1) >> 1;
}
result = v43;
v7[8] = v43;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, unsigned int a2, unsigned int a3, unsigned int **a4, unsigned int **a5, int a6, int a7)
{
_DWORD *v7; // r12
unsigned int v10; // eax
unsigned int k; // edx
__int64 result; // rax
size_t v14; // rbx
unsigned int v15; // ebx
unsigned int **v16; // rbp
unsigned int v17; // edi
unsigned int v18; // ebx
unsigned int v19; // eax
unsigned int *v20; // rdx
unsigned int i; // esi
unsigned int *v22; // rbx
unsigned int **v23; // r8
unsigned int *v24; // rdx
unsigned int v25; // esi
unsigned int j; // eax
unsigned int *v27; // rbx
unsigned int v28; // edx
unsigned int *v29; // r15
unsigned int *v30; // r13
unsigned int v31; // er12
int v32; // ecx
unsigned int v33; // eax
__int64 v34; // rdx
unsigned int *v35; // rax
unsigned int v36; // edx
unsigned int *v37; // rax
unsigned int v38; // edx
unsigned int v39; // ebx
unsigned int v40; // [rsp+8h] [rbp-80h]
unsigned int **v41; // [rsp+10h] [rbp-78h]
_DWORD *v42; // [rsp+18h] [rbp-70h]
unsigned int v43; // [rsp+24h] [rbp-64h]
unsigned int **v44; // [rsp+38h] [rbp-50h]
int v46; // [rsp+44h] [rbp-44h]
unsigned int **v47; // [rsp+48h] [rbp-40h]

v7 = (_DWORD *)a1;
v43 = a3;
v10 = *(_DWORD *)(a1 + 36);
if ( v10 )
{
v14 = 8LL * v10;
v44 = (unsigned int **)malloc(v14);
v47 = (unsigned int **)malloc(v14);
v15 = 0;
v46 = a7 + v43;
do
{
func5(
*(_QWORD *)(*(_QWORD *)(a1 + 40) + 8LL * v15),
a2,
*(_DWORD *)(a1 + 16) + v46,
8 * v15 + (_DWORD)v44,
(_DWORD)v47 + 8 * v15,
a6,
a7);
++v15;
}
while ( *(_DWORD *)(a1 + 36) > v15 );
*a4 = *v44;
*a5 = *v47;
*(_DWORD *)(**(_QWORD **)(a1 + 40) + 28LL) = 0;
if ( *(_DWORD *)(a1 + 36) != 1 )
{
v40 = 0;
v16 = a5;
do
{
v18 = v7[4] + v46;
v29 = *v16;
v41 = &v44[++v40];
v17 = 0;
v30 = *v41;
v42 = v7;
v31 = func1(**v41, **v16);
while ( v31 >= v18 )
{
v17 = func0(v17, v30[v18 + 1] + v29[v18 + 1]);
++v18;
}
v7 = v42;
*(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v40) + 28LL) = a6 + v17;
v19 = **a4 + 1;
v20 = *v41;
for ( i = **v41; i >= v19; i = **v41 )
{
(*a4)[v19 + 1] = v20[v19 + 1] - *(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v40) + 28LL);
++v19;
v20 = *v41;
}
v22 = *a4;
*v22 = func2(**a4, i);
v23 = &v47[v40];
v24 = *v23;
v25 = **v23;
for ( j = v43; v25 >= j; v25 = **v23 )
{
(*v16)[j + 1] = *(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v40) + 28LL) + v24[j + 1];
++j;
v24 = *v23;
}
v27 = *v16;
*v27 = func2(**v16, v25);
v28 = v42[9];
}
while ( v40 < v28 - 1 );
a5 = v16;
if ( v28 > 1 )
{
v32 = *(_DWORD *)(*(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * (v28 - 1)) + 28LL) / 2;
v33 = 0;
do
{
v34 = *(_QWORD *)(*((_QWORD *)v42 + 5) + 8LL * v33);
*(_DWORD *)(v34 + 28) -= v32;
++v33;
}
while ( v42[9] > v33 );
v35 = *a4;
if ( v43 <= **a4 )
{
v36 = v43;
do
{
v35[++v36] += v32;
v35 = *a4;
}
while ( **a4 >= v36 );
}
v37 = *v16;
if ( v43 <= **v16 )
{
v38 = v43;
do
{
v37[++v38] -= v32;
v37 = *v16;
}
while ( **v16 >= v38 );
}
if ( v42[9] > 1u )
{
v39 = 1;
do
{
free(v44[v39]);
free(v47[v39++]);
}
while ( v42[9] > v39 );
}
}
}
}
else
{
*a4 = newEdge(a2);
*a5 = newEdge(a2);
**a4 = *(_DWORD *)(a1 + 16) + a3 - 1;
**a5 = *(_DWORD *)(a1 + 16) + a3 - 1;
}
for ( k = v43 - a7; v7[4] + v43 > k; ++k )
{
(*a4)[k + 1] = v7[5] >> 1;
(*a5)[k + 1] = (unsigned int)(v7[5] + 1) >> 1;
}
result = v43;
v7[8] = v43;
return result;
}

original_code:
static
void doShapeTree(
  Tree tree,
  unsigned height,
  unsigned yPosition,
  edge **left,
  edge **right,
  unsigned xSeparation,
  unsigned ySeparation)
{
  int centre;
  unsigned i;
  unsigned j;
  edge **leftOutline;
  int overlap;
  edge **rightOutline;
  if (tree->nrBranches == 0) {
    *left = newEdge(height);
    *right = newEdge(height);
    (*left)->yPosition = yPosition+tree->height-1;
    (*right)->yPosition = yPosition+tree->height-1; }
  else {
    leftOutline = (edge **)malloc((size_t)(tree->nrBranches*sizeof(edge *)));
    rightOutline = (edge **)malloc((size_t)(tree->nrBranches*sizeof(edge *)));
    for (i = 0; i < tree->nrBranches; i++)
      doShapeTree(tree->branches[i], height,
                  (int)(yPosition+tree->height+ySeparation),
                  &leftOutline[i], &rightOutline[i],
                  xSeparation, ySeparation);
    *left = leftOutline[0];
    *right = rightOutline[0];
    tree->branches[0]->x = 0;
    for (i = 0; i < tree->nrBranches - 1; i++) {
      overlap = 0;
      for (j = yPosition+tree->height+ySeparation;
           j <= intMin(leftOutline[i+1]->yPosition, (*right)->yPosition);
           j++)
        overlap = intMax(overlap, leftOutline[i+1]->offset[j] +
                                  (*right)->offset[j]);
      tree->branches[i+1]->x = overlap+xSeparation;
      for (j = (*left)->yPosition+1; j <= leftOutline[i+1]->yPosition; j++)
        (*left)->offset[j] = leftOutline[i+1]->offset[j] -
                                tree->branches[i+1]->x;
      (*left)->yPosition = unsignedMax((*left)->yPosition,
                                       leftOutline[i+1]->yPosition);
      for (j = yPosition; j <= rightOutline[i+1]->yPosition; j++)
        (*right)->offset[j] = rightOutline[i+1]->offset[j] +
                                tree->branches[i+1]->x;
      (*right)->yPosition = unsignedMax((*right)->yPosition,
                                        rightOutline[i+1]->yPosition);
    }
    if (tree->nrBranches > 1) {
      centre = tree->branches[tree->nrBranches-1]->x/2;
      for (i = 0; i < tree->nrBranches; i++)
        tree->branches[i]->x -= centre;
      for (i = yPosition; i <= (*left)->yPosition; i++)
        (*left)->offset[i] += centre;
      for (i = yPosition; i <= (*right)->yPosition; i++)
        (*right)->offset[i] -= centre;
     }
    for (i = 1; i < tree->nrBranches; i++) {
      (void)free((char *)leftOutline[i]);
      (void)free((char *)rightOutline[i]);
    }
  }
  for (i = yPosition - ySeparation; i < yPosition+tree->height; i++) {
    (*left)->offset[i] = tree->width/2;
    (*right)->offset[i] = (tree->width+1)/2;
  }
  tree->y = yPosition;
}

canonical_original_code:
static void doShapeTree(struct TreeNode *tree, unsigned int height, unsigned int yPosition, struct edge **left, struct edge **right, unsigned int xSeparation, unsigned int ySeparation)
{
  int centre;
  unsigned int i;
  unsigned int j;
  struct edge **leftOutline;
  int overlap;
  struct edge **rightOutline;
  if (tree->nrBranches == 0) {
    *left = newEdge(height);
    *right = newEdge(height);
    (*left)->yPosition = yPosition+tree->height-1;
    (*right)->yPosition = yPosition+tree->height-1; }
  else {
    leftOutline = (struct edge **)malloc((unsigned long)(tree->nrBranches*sizeof(struct edge *)));
    rightOutline = (struct edge **)malloc((unsigned long)(tree->nrBranches*sizeof(struct edge *)));
    for (i = 0; i < tree->nrBranches; i++)
      doShapeTree(tree->branches[i], height,
                  (int)(yPosition+tree->height+ySeparation),
                  &leftOutline[i], &rightOutline[i],
                  xSeparation, ySeparation);
    *left = leftOutline[0];
    *right = rightOutline[0];
    tree->branches[0]->x = 0;
    for (i = 0; i < tree->nrBranches - 1; i++) {
      overlap = 0;
      for (j = yPosition+tree->height+ySeparation;
           j <= intMin(leftOutline[i+1]->yPosition, (*right)->yPosition);
           j++)
        overlap = intMax(overlap, leftOutline[i+1]->offset[j] +
                                  (*right)->offset[j]);
      tree->branches[i+1]->x = overlap+xSeparation;
      for (j = (*left)->yPosition+1; j <= leftOutline[i+1]->yPosition; j++)
        (*left)->offset[j] = leftOutline[i+1]->offset[j] -
                                tree->branches[i+1]->x;
      (*left)->yPosition = unsignedMax((*left)->yPosition,
                                       leftOutline[i+1]->yPosition);
      for (j = yPosition; j <= rightOutline[i+1]->yPosition; j++)
        (*right)->offset[j] = rightOutline[i+1]->offset[j] +
                                tree->branches[i+1]->x;
      (*right)->yPosition = unsignedMax((*right)->yPosition,
                                        rightOutline[i+1]->yPosition);
    }
    if (tree->nrBranches > 1) {
      centre = tree->branches[tree->nrBranches-1]->x/2;
      for (i = 0; i < tree->nrBranches; i++)
        tree->branches[i]->x -= centre;
      for (i = yPosition; i <= (*left)->yPosition; i++)
        (*left)->offset[i] += centre;
      for (i = yPosition; i <= (*right)->yPosition; i++)
        (*right)->offset[i] -= centre;
     }
    for (i = 1; i < tree->nrBranches; i++) {
      (void)free((char *)leftOutline[i]);
      (void)free((char *)rightOutline[i]);
    }
  }
  for (i = yPosition - ySeparation; i < yPosition+tree->height; i++) {
    (*left)->offset[i] = tree->width/2;
    (*right)->offset[i] = (tree->width+1)/2;
  }
  tree->y = yPosition;
}

variable_types:
yPosition
unsigned int

variable_types: struct edge { unsigned int yPosition; int offset[1]; } **

variable_types:
right
struct edge **

variable_types:
xSeparation
unsigned int

variable_types: centre int

variable_types:
j
unsigned int

variable_types: overlap int


addBranch

original_code:
int addBranch(Tree branch,
              TreeNode *node)
{
  TreeNode **newBranch;
  node->nrBranches++;
  if ((Tree *)((void *)0) == node->branches)
    node->branches = (TreeNode **)malloc(
                       (size_t)(node->nrBranches*sizeof(TreeNode *)));
  else {
    newBranch = (TreeNode **)realloc(node->branches,
                  (size_t)(node->nrBranches*sizeof(TreeNode *)));
    if (newBranch != node->branches)
      (void)free(node->branches);
    else
      node->branches = newBranch;
  }
  if ((Tree *)((void *)0) != node->branches)
    node->branches[node->nrBranches-1] = branch;
  return (Tree *)((void *)0) != node->branches;
}

canonical_original_code:
int addBranch(struct TreeNode *branch, struct TreeNode *node)
{
  struct TreeNode **newBranch;
  node->nrBranches++;
  if ((struct TreeNode **)((void *)0) == node->branches)
    node->branches = (struct TreeNode **)malloc(
                       (unsigned long)(node->nrBranches*sizeof(struct TreeNode *)));
  else {
    newBranch = (struct TreeNode **)realloc(node->branches,
                  (unsigned long)(node->nrBranches*sizeof(struct TreeNode *)));
    if (newBranch != node->branches)
      (void)free(node->branches);
    else
      node->branches = newBranch;
  }
  if ((struct TreeNode **)((void *)0) != node->branches)
    node->branches[node->nrBranches-1] = branch;
  return (struct TreeNode **)((void *)0) != node->branches;
}

variable_types:
node
struct TreeNode *

variable_types: struct TreeNode { char *name; char *parent; unsigned int height; unsigned int width; unsigned int depth; int x; int y; unsigned int nrBranches; struct TreeNode **branches; } **


postorderTraverse

decompiled_code:
__int64 __fastcall postorderTraverse(__int64 a1, __int64 (__fastcall *a2)(__int64))
{
unsigned int v2; // ebx
__int64 result; // rax

if ( a1 )
{
if ( *(_DWORD *)(a1 + 36) )
{
v2 = 0;
do
postorderTraverse(*(_QWORD *)(*(_QWORD *)(a1 + 40) + 8LL * v2++), a2);
while ( *(_DWORD *)(a1 + 36) > v2 );
}
result = a2(a1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, __int64 (__fastcall *a2)(__int64))
{
unsigned int v2; // ebx
__int64 result; // rax

if ( a1 )
{
if ( *(_DWORD *)(a1 + 36) )
{
v2 = 0;
do
func7(*(_QWORD *)(*(_QWORD *)(a1 + 40) + 8LL * v2++), a2);
while ( *(_DWORD *)(a1 + 36) > v2 );
}
result = a2(a1);
}
return result;
}

original_code:
void postorderTraverse(Tree tree,
                       NodeFunction *nodeFunction)
{
  unsigned i;
  if (tree != ((void *)0)) {
    for(i = 0; i < tree->nrBranches; i++)
      postorderTraverse(tree->branches[i], nodeFunction);
    nodeFunction(tree);
  }
}

canonical_original_code:
void postorderTraverse(struct TreeNode *tree, void (*nodeFunction)(struct TreeNode *node))
{
  unsigned int i;
  if (tree != ((void *)0)) {
    for(i = 0; i < tree->nrBranches; i++)
      postorderTraverse(tree->branches[i], nodeFunction);
    nodeFunction(tree);
  }
}

variable_types:
nodeFunction
void (*)(struct TreeNode *node)