decompiled_code:
_QWORD *type_init()
{
_QWORD *v0; // rax
_QWORD *v1; // rax
__int64 v2; // rbp
__int64 v3; // rbx
_QWORD *result; // rax

v0 = add_to_type_table(0LL, 5001);
chartype = (__int64)v0;
v0[2] = 0LL;
v0[3] = 255LL;
v1 = add_to_type_table(0LL, 5001);
inttype = (__int64)v1;
v1[2] = 0LL;
v1[3] = 0x10000LL;
v2 = add_to_id_table(0LL, "true", 4002LL);
v3 = add_to_id_table(0LL, "false", 4002LL);
booltype = (__int64)add_to_type_table(0LL, 5002);
add_to_list(booltype + 16, v2);
add_to_list(booltype + 16, v3);
realtype = (__int64)add_to_type_table(0LL, 5001);
texttype = (__int64)add_to_type_table(chartype, 5007);
stringtype = (__int64)add_to_type_table(0LL, 5000);
result = add_to_type_table(0LL, 5005);
ptrtype = (__int64)result;
return result;
}

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

v0 = add_to_type_table(0LL, 5001);
chartype = (__int64)v0;
v0[2] = 0LL;
v0[3] = 255LL;
v1 = add_to_type_table(0LL, 5001);
inttype = (__int64)v1;
v1[2] = 0LL;
v1[3] = 0x10000LL;
v2 = add_to_id_table(0LL, "true", 4002LL);
v3 = add_to_id_table(0LL, "false", 4002LL);
booltype = (__int64)add_to_type_table(0LL, 5002);
add_to_list(booltype + 16, v2);
add_to_list(booltype + 16, v3);
realtype = (__int64)add_to_type_table(0LL, 5001);
texttype = (__int64)add_to_type_table(chartype, 5007);
stringtype = (__int64)add_to_type_table(0LL, 5000);
result = add_to_type_table(0LL, 5005);
ptrtype = (__int64)result;
return result;
}

original_code:
void type_init(void)
{
    chartype = add_to_type_table(0, UT_LIMITED);
    chartype->min = 0;
    chartype->max = 255;
    inttype = add_to_type_table(0, UT_LIMITED);
    inttype->min = 0;
    inttype->max = 65536;
    id_table_elem *t, *f;
    t = add_to_id_table(0, "true", UC_CONST);
    f = add_to_id_table(0, "false", UC_CONST);
    booltype = add_to_type_table(0, UT_ENUM);
    add_to_list(&(booltype->constants), t);
    add_to_list(&(booltype->constants), f);
    realtype = add_to_type_table(0, UT_LIMITED);
    texttype = add_to_type_table(chartype, UT_FILE);
    stringtype = add_to_type_table(0, UT_SCALAR);
    ptrtype = add_to_type_table(0, UT_REFERENCE);
}

canonical_original_code:
void type_init()
{
    chartype = add_to_type_table(0, UT_LIMITED);
    chartype->min = 0;
    chartype->max = 255;
    inttype = add_to_type_table(0, UT_LIMITED);
    inttype->min = 0;
    inttype->max = 65536;
    struct _id_table_elem *t; struct _id_table_elem *f;
    t = add_to_id_table(0, "true", UC_CONST);
    f = add_to_id_table(0, "false", UC_CONST);
    booltype = add_to_type_table(0, UT_ENUM);
    add_to_list(&(booltype->constants), t);
    add_to_list(&(booltype->constants), f);
    realtype = add_to_type_table(0, UT_LIMITED);
    texttype = add_to_type_table(chartype, UT_FILE);
    stringtype = add_to_type_table(0, UT_SCALAR);
    ptrtype = add_to_type_table(0, UT_REFERENCE);
}


decompiled_code:
_BOOL8 __fastcall can_assign(__int64 a1, __int64 a2)
{
_BOOL8 result; // rax
__int64 v3; // rcx

result = 1LL;
if ( a1 != a2 )
{
if ( a1 && a2 )
{
if ( realtype != a1 || inttype != a2 )
{
if ( stringtype != a1 || (result = 1LL, chartype != a2) )
{
if ( *(_DWORD *)a1 != 5001 || (result = 1LL, *(_QWORD *)(a1 + 8) != a2) )
{
result = 0LL;
if ( *(_DWORD *)a2 == 5001 )
{
v3 = *(_QWORD *)(a2 + 8);
result = 1LL;
if ( v3 != a1 )
{
result = 0LL;
if ( *(_DWORD *)a1 == 5001 )
result = *(_QWORD *)(a1 + 8) == v3;
}
}
}
}
}
}
else
{
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(__int64 a1, __int64 a2)
{
_BOOL8 result; // rax
__int64 v3; // rcx

result = 1LL;
if ( a1 != a2 )
{
if ( a1 && a2 )
{
if ( realtype != a1 || inttype != a2 )
{
if ( stringtype != a1 || (result = 1LL, chartype != a2) )
{
if ( *(_DWORD *)a1 != 5001 || (result = 1LL, *(_QWORD *)(a1 + 8) != a2) )
{
result = 0LL;
if ( *(_DWORD *)a2 == 5001 )
{
v3 = *(_QWORD *)(a2 + 8);
result = 1LL;
if ( v3 != a1 )
{
result = 0LL;
if ( *(_DWORD *)a1 == 5001 )
result = *(_QWORD *)(a1 + 8) == v3;
}
}
}
}
}
}
else
{
result = 1LL;
}
}
return result;
}

original_code:
int can_assign(type_table_elem *tp1, type_table_elem *tp2)
{
    return
        (tp1 == tp2) ||
        ((tp1 == 0) || (tp2 == 0)) ||
        ((tp1 == realtype) && (tp2 == inttype)) ||
        ((tp1 == stringtype) && (tp2 == chartype)) ||
        ((tp1->utype == UT_LIMITED) && (tp1->base == tp2)) ||
        ((tp2->utype == UT_LIMITED) && (tp2->base == tp1)) ||
        ((tp1->utype == UT_LIMITED) && (tp2->utype == UT_LIMITED) && (tp2->base == tp1->base)) ||
        (0);
}

canonical_original_code:
int can_assign(struct _type_table_elem *tp1, struct _type_table_elem *tp2)
{
    return
        (tp1 == tp2) ||
        ((tp1 == 0) || (tp2 == 0)) ||
        ((tp1 == realtype) && (tp2 == inttype)) ||
        ((tp1 == stringtype) && (tp2 == chartype)) ||
        ((tp1->utype == UT_LIMITED) && (tp1->base == tp2)) ||
        ((tp2->utype == UT_LIMITED) && (tp2->base == tp1)) ||
        ((tp1->utype == UT_LIMITED) && (tp2->utype == UT_LIMITED) && (tp2->base == tp1->base)) ||
        (0);
}

variable_types: struct _type_table_elem { enum USE_TYPE { UT_SCALAR=5000, UT_LIMITED=5001, UT_ENUM=5002, UT_ARRAY=5003, UT_RECORD=5004, UT_REFERENCE=5005, UT_SET=5006, UT_FILE=5007 } utype; struct _type_table_elem *base; union { struct _list { void *value; struct _list *next; } *constants; struct _list *indexes; struct { unsigned long min; }; }; } *

return_type: int

user_defined_types: struct _type_table_elem { enum USE_TYPE utype; struct _type_table_elem *base; union { struct _list *constants; struct _list *indexes; struct { unsigned long min; }; }; }


decompiled_code:
_BOOL8 __fastcall can_iterate(_DWORD *a1)
{
_BOOL8 result; // rax

result = 1LL;
if ( a1 )
{
result = 1LL;
if ( (unsigned int)(*a1 - 5001) > 1 && (_DWORD *)inttype != a1 )
result = chartype == (_QWORD)a1;
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(_DWORD *a1)
{
_BOOL8 result; // rax

result = 1LL;
if ( a1 )
{
result = 1LL;
if ( (unsigned int)(*a1 - 5001) > 1 && (_DWORD *)inttype != a1 )
result = chartype == (_QWORD)a1;
}
return result;
}

original_code:
int can_iterate(type_table_elem *tp1)
{
    return
        (tp1 == 0) ||
        (tp1->utype == UT_ENUM) ||
        (tp1->utype == UT_LIMITED) ||
        (tp1 == inttype) ||
        (tp1 == chartype) ||
        (0);
}

canonical_original_code:
int can_iterate(struct _type_table_elem *tp1)
{
    return
        (tp1 == 0) ||
        (tp1->utype == UT_ENUM) ||
        (tp1->utype == UT_LIMITED) ||
        (tp1 == inttype) ||
        (tp1 == chartype) ||
        (0);
}

user_defined_types: enum USE_TYPE { UT_SCALAR=5000, UT_LIMITED=5001, UT_ENUM=5002, UT_ARRAY=5003, UT_RECORD=5004, UT_REFERENCE=5005, UT_SET=5006, UT_FILE=5007 }

user_defined_types: struct _list { void *value; struct _list *next; }


decompiled_code:
char *__fastcall get_type_name(int *a1)
{
int v1; // eax
char *v2; // rbp
__int64 v4; // rbx
char *v5; // rax
__int64 v6; // rbx
char *v7; // rax
__int64 v8; // rbx
char *v9; // rax

if ( !a1 )
return dcgettext(0LL, "unknown type", 5);
if ( (int *)inttype == a1 )
return dcgettext(0LL, "integer", 5);
if ( (int *)stringtype == a1 )
return dcgettext(0LL, "string", 5);
if ( (int *)realtype == a1 )
return dcgettext(0LL, "real", 5);
if ( (int *)booltype == a1 )
return dcgettext(0LL, "boolean", 5);
if ( (int *)ptrtype == a1 )
return dcgettext(0LL, "pointer", 5);
if ( (int *)chartype == a1 )
return dcgettext(0LL, "char", 5);
if ( (int *)texttype == a1 )
return dcgettext(0LL, "text", 5);
v1 = *a1;
if ( *a1 == 5003 )
{
v2 = (char *)malloc(0x400uLL);
v4 = get_type_name(*((_QWORD *)a1 + 1));
v5 = dcgettext(0LL, "array of %s", 5);
sprintf(v2, v5, v4);
}
else
{
switch ( v1 )
{
case 5005:
v2 = (char *)malloc(0x400uLL);
v6 = get_type_name(*((_QWORD *)a1 + 1));
v7 = dcgettext(0LL, "pointer of %s", 5);
sprintf(v2, v7, v6);
break;
case 5002:
v2 = dcgettext(0LL, "enumeration", 5);
break;
case 5001:
v2 = (char *)malloc(0x400uLL);
v8 = get_type_name(*((_QWORD *)a1 + 1));
v9 = dcgettext(0LL, "limited of %s", 5);
sprintf(v2, v9, v8);
break;
default:
v2 = dcgettext(0LL, "dummy", 5);
break;
}
}
return v2;
}

canonical_decompiled_code:
char *__fastcall func4(int *a1)
{
int v1; // eax
char *v2; // rbp
__int64 v4; // rbx
char *v5; // rax
__int64 v6; // rbx
char *v7; // rax
__int64 v8; // rbx
char *v9; // rax

if ( !a1 )
return dcgettext(0LL, "unknown type", 5);
if ( (int *)inttype == a1 )
return dcgettext(0LL, "integer", 5);
if ( (int *)stringtype == a1 )
return dcgettext(0LL, "string", 5);
if ( (int *)realtype == a1 )
return dcgettext(0LL, "real", 5);
if ( (int *)booltype == a1 )
return dcgettext(0LL, "boolean", 5);
if ( (int *)ptrtype == a1 )
return dcgettext(0LL, "pointer", 5);
if ( (int *)chartype == a1 )
return dcgettext(0LL, "char", 5);
if ( (int *)texttype == a1 )
return dcgettext(0LL, "text", 5);
v1 = *a1;
if ( *a1 == 5003 )
{
v2 = (char *)malloc(0x400uLL);
v4 = func4(*((_QWORD *)a1 + 1));
v5 = dcgettext(0LL, "array of %s", 5);
sprintf(v2, v5, v4);
}
else
{
switch ( v1 )
{
case 5005:
v2 = (char *)malloc(0x400uLL);
v6 = func4(*((_QWORD *)a1 + 1));
v7 = dcgettext(0LL, "pointer of %s", 5);
sprintf(v2, v7, v6);
break;
case 5002:
v2 = dcgettext(0LL, "enumeration", 5);
break;
case 5001:
v2 = (char *)malloc(0x400uLL);
v8 = func4(*((_QWORD *)a1 + 1));
v9 = dcgettext(0LL, "limited of %s", 5);
sprintf(v2, v9, v8);
break;
default:
v2 = dcgettext(0LL, "dummy", 5);
break;
}
}
return v2;
}

original_code:
char *get_type_name(type_table_elem *tp)
{
    if (tp == 0)
        return gettext("unknown type");
    if (tp == inttype)
        return gettext("integer");
    if (tp == stringtype)
        return gettext("string");
    if (tp == realtype)
        return gettext("real");
    if (tp == booltype)
        return gettext("boolean");
    if (tp == ptrtype)
        return gettext("pointer");
    if (tp == chartype)
        return gettext("char");
    if (tp == texttype)
        return gettext("text");
    if (tp->utype == UT_ARRAY)
    {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext("array of %s"), get_type_name(tp->base));
        return tmp;
    }
    if (tp->utype == UT_REFERENCE)
    {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext("pointer of %s"), get_type_name(tp->base));
        return tmp;
    }
    if (tp->utype == UT_ENUM)
    {
        return gettext("enumeration");
    }
    if (tp->utype == UT_LIMITED)
    {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext("limited of %s"), get_type_name(tp->base));
        return tmp;
    }
    return gettext("dummy");
}

canonical_original_code:
char *get_type_name(struct _type_table_elem *tp)
{
    if (tp == 0)
        return gettext("unknown type");
    if (tp == inttype)
        return gettext("integer");
    if (tp == stringtype)
        return gettext("string");
    if (tp == realtype)
        return gettext("real");
    if (tp == booltype)
        return gettext("boolean");
    if (tp == ptrtype)
        return gettext("pointer");
    if (tp == chartype)
        return gettext("char");
    if (tp == texttype)
        return gettext("text");
    if (tp->utype == UT_ARRAY)
    {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext("array of %s"), get_type_name(tp->base));
        return tmp;
    }
    if (tp->utype == UT_REFERENCE)
    {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext("pointer of %s"), get_type_name(tp->base));
        return tmp;
    }
    if (tp->utype == UT_ENUM)
    {
        return gettext("enumeration");
    }
    if (tp->utype == UT_LIMITED)
    {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext("limited of %s"), get_type_name(tp->base));
        return tmp;
    }
    return gettext("dummy");
}

variable_types:
tmp
char *

return_type: char *


decompiled_code:
__int64 __fastcall mix_types(__int64 a1, __int64 a2, int a3)
{
__int64 result; // rax
char *v4; // r12
char *v5; // rbp
char *v6; // rbx
char *v7; // rax
char *v8; // rax
__int64 v9; // rdx

if ( !a1 )
return 0LL;
if ( !a2 )
return 0LL;
if ( a3 <= 62 )
{
if ( a3 > 41 )
{
switch ( a3 )
{
case '*':
case '-':
goto LABEL_26;
case '+':
result = stringtype;
if ( stringtype != a1 && chartype != a1 )
goto LABEL_26;
if ( stringtype == a2 )
return a2;
if ( chartype == a2 )
return result;
LABEL_26:
if ( a1 != a2 )
goto LABEL_27;
if ( inttype == a1 )
return a1;
if ( realtype == a1 )
return a1;
LABEL_27:
if ( *(_DWORD *)a1 != 5001 )
goto LABEL_28;
if ( *(_DWORD *)a2 == 5001 )
{
if ( *(_QWORD *)(a1 + 8) == inttype )
{
result = *(_QWORD *)(a2 + 8);
if ( inttype == result )
return result;
}
if ( a2 != inttype )
goto LABEL_46;
}
else if ( a2 != inttype )
{
LABEL_29:
result = realtype;
if ( realtype == a1 )
{
result = a1;
goto LABEL_54;
}
v9 = inttype;
if ( inttype == a1 )
goto LABEL_54;
goto LABEL_31;
}
if ( *(_QWORD *)(a1 + 8) == a2 )
return a2;
LABEL_28:
if ( *(_DWORD *)a2 != 5001 )
goto LABEL_29;
LABEL_46:
v9 = inttype;
if ( inttype == a1 )
{
result = realtype;
if ( *(_QWORD *)(a2 + 8) == a1 )
return a1;
goto LABEL_54;
}
result = realtype;
if ( a1 == realtype )
goto LABEL_54;
LABEL_31:
if ( *(_DWORD *)a1 != 5001 || *(_QWORD *)(a1 + 8) != v9 )
goto LABEL_14;
LABEL_54:
if ( a2 != result && inttype != a2 && (*(_DWORD *)a2 != 5001 || inttype != *(_QWORD *)(a2 + 8)) )
goto LABEL_14;
break;
case '/':
goto LABEL_29;
case '<':
case '=':
case '>':
goto LABEL_59;
default:
goto LABEL_14;
}
return result;
}
goto LABEL_14;
}
if ( a3 <= 503 )
{
if ( a3 > 501 )
goto LABEL_77;
if ( a3 <= 304 )
{
if ( a3 > 301 )
{
LABEL_59:
if ( (realtype == a1 || inttype == a1 || *(_DWORD *)a1 == 5001 && inttype == *(_QWORD *)(a1 + 8))
&& (realtype == a2 || inttype == a2 || *(_DWORD *)a2 == 5001 && inttype == *(_QWORD *)(a2 + 8))
|| a1 == a2 )
{
return booltype;
}
}
goto LABEL_14;
}
if ( a3 == 400 )
{
LABEL_77:
if ( a1 == a2 )
{
result = a1;
if ( booltype == a1 )
return result;
}
}
LABEL_14:
v4 = (char *)malloc(0x400uLL);
v5 = get_type_name((int *)a2);
v6 = get_type_name((int *)a1);
v7 = dcgettext(0LL, "'%s' and '%s'", 5);
sprintf(v4, v7, v6, v5);
LODWORD(v5) = sem_c;
LODWORD(v6) = sem_l;
v8 = dcgettext(0LL, "wrong types:", 5);
err_include(3LL, v8, v4, (unsigned int)v6, (unsigned int)v5);
return 0LL;
}
if ( (unsigned int)(a3 - 506) > 1 || inttype != a1 && (*(_DWORD *)a1 != 5001 || inttype != *(_QWORD *)(a1 + 8)) )
goto LABEL_14;
if ( inttype == a2 )
return a2;
if ( *(_DWORD *)a2 != 5001 )
goto LABEL_14;
result = *(_QWORD *)(a2 + 8);
if ( inttype != result )
goto LABEL_14;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, int a3)
{
__int64 result; // rax
char *v4; // r12
char *v5; // rbp
char *v6; // rbx
char *v7; // rax
char *v8; // rax
__int64 v9; // rdx

if ( !a1 )
return 0LL;
if ( !a2 )
return 0LL;
if ( a3 <= 62 )
{
if ( a3 > 41 )
{
switch ( a3 )
{
case '*':
case '-':
goto LABEL_26;
case '+':
result = stringtype;
if ( stringtype != a1 && chartype != a1 )
goto LABEL_26;
if ( stringtype == a2 )
return a2;
if ( chartype == a2 )
return result;
LABEL_26:
if ( a1 != a2 )
goto LABEL_27;
if ( inttype == a1 )
return a1;
if ( realtype == a1 )
return a1;
LABEL_27:
if ( *(_DWORD *)a1 != 5001 )
goto LABEL_28;
if ( *(_DWORD *)a2 == 5001 )
{
if ( *(_QWORD *)(a1 + 8) == inttype )
{
result = *(_QWORD *)(a2 + 8);
if ( inttype == result )
return result;
}
if ( a2 != inttype )
goto LABEL_46;
}
else if ( a2 != inttype )
{
LABEL_29:
result = realtype;
if ( realtype == a1 )
{
result = a1;
goto LABEL_54;
}
v9 = inttype;
if ( inttype == a1 )
goto LABEL_54;
goto LABEL_31;
}
if ( *(_QWORD *)(a1 + 8) == a2 )
return a2;
LABEL_28:
if ( *(_DWORD *)a2 != 5001 )
goto LABEL_29;
LABEL_46:
v9 = inttype;
if ( inttype == a1 )
{
result = realtype;
if ( *(_QWORD *)(a2 + 8) == a1 )
return a1;
goto LABEL_54;
}
result = realtype;
if ( a1 == realtype )
goto LABEL_54;
LABEL_31:
if ( *(_DWORD *)a1 != 5001 || *(_QWORD *)(a1 + 8) != v9 )
goto LABEL_14;
LABEL_54:
if ( a2 != result && inttype != a2 && (*(_DWORD *)a2 != 5001 || inttype != *(_QWORD *)(a2 + 8)) )
goto LABEL_14;
break;
case '/':
goto LABEL_29;
case '<':
case '=':
case '>':
goto LABEL_59;
default:
goto LABEL_14;
}
return result;
}
goto LABEL_14;
}
if ( a3 <= 503 )
{
if ( a3 > 501 )
goto LABEL_77;
if ( a3 <= 304 )
{
if ( a3 > 301 )
{
LABEL_59:
if ( (realtype == a1 || inttype == a1 || *(_DWORD *)a1 == 5001 && inttype == *(_QWORD *)(a1 + 8))
&& (realtype == a2 || inttype == a2 || *(_DWORD *)a2 == 5001 && inttype == *(_QWORD *)(a2 + 8))
|| a1 == a2 )
{
return booltype;
}
}
goto LABEL_14;
}
if ( a3 == 400 )
{
LABEL_77:
if ( a1 == a2 )
{
result = a1;
if ( booltype == a1 )
return result;
}
}
LABEL_14:
v4 = (char *)malloc(0x400uLL);
v5 = func4((int *)a2);
v6 = func4((int *)a1);
v7 = dcgettext(0LL, "'%s' and '%s'", 5);
sprintf(v4, v7, v6, v5);
LODWORD(v5) = sem_c;
LODWORD(v6) = sem_l;
v8 = dcgettext(0LL, "wrong types:", 5);
err_include(3LL, v8, v4, (unsigned int)v6, (unsigned int)v5);
return 0LL;
}
if ( (unsigned int)(a3 - 506) > 1 || inttype != a1 && (*(_DWORD *)a1 != 5001 || inttype != *(_QWORD *)(a1 + 8)) )
goto LABEL_14;
if ( inttype == a2 )
return a2;
if ( *(_DWORD *)a2 != 5001 )
goto LABEL_14;
result = *(_QWORD *)(a2 + 8);
if ( inttype != result )
goto LABEL_14;
return result;
}

original_code:
type_table_elem *mix_types(type_table_elem *tp1, type_table_elem *tp2, int code)
{
    if ((tp1 == 0) || (tp2 == 0))
        return 0;
    switch (code)
    {
        case L_PLUS:
            if (((tp1 == stringtype) || (tp1 == chartype)) &&
                ((tp2 == stringtype) || (tp2 == chartype)))
                return stringtype;
        case L_STAR:
        case L_MINUS:
            if ((tp1 == tp2) && ((tp1 == inttype)||(tp1 == realtype)))
                return tp1;
            else if ((tp1->utype == UT_LIMITED) && (tp2->utype == UT_LIMITED)
                    && (tp1->base == inttype) && (tp2->base == inttype))
                    return inttype;
            else if ((tp1->utype == UT_LIMITED) && (tp2 == inttype)
                    && (tp1->base == inttype))
                    return inttype;
            else if ((tp2->utype == UT_LIMITED) && (tp1 == inttype)
                    && (tp2->base == inttype))
                    return inttype;
        case L_SLASH:
            if (((tp1 == realtype) || (tp1 == inttype) || ((tp1->utype == UT_LIMITED) && (tp1->base == inttype))) &&
                ((tp2 == realtype) || (tp2 == inttype) || ((tp2->utype == UT_LIMITED) && (tp2->base == inttype))))
                return realtype;
            break;
        case L_DIV:
        case L_MOD:
            if (((tp1 == inttype) || ((tp1->utype == UT_LIMITED) && (tp1->base == inttype))) &&
                ((tp2 == inttype) || ((tp2->utype == UT_LIMITED) && (tp2->base == inttype))))
                return inttype;
            break;
        case L_XOR:
        case L_OR:
        case L_AND:
            if ((tp1 == tp2) && (tp1 == booltype))
                return booltype;
            break;
        case L_GREAT:
        case L_LESS:
        case L_EQUAL:
        case L_NEQUAL:
        case L_GEQUAL:
        case L_LEQUAL:
            if ((((tp1 == realtype) || (tp1 == inttype) || ((tp1->utype == UT_LIMITED) && (tp1->base == inttype))) &&
                ((tp2 == realtype) || (tp2 == inttype) || ((tp2->utype == UT_LIMITED) && (tp2->base == inttype)))) || (tp1 == tp2))
                return booltype;
        default:
            break;
    }
    char *err = malloc(1024);
    sprintf(err, gettext("'%s' and '%s'"), get_type_name(tp1), get_type_name(tp2));
    err_include(ERROR, gettext("wrong types:"), err, sem_l, sem_c);
    return 0;
}

canonical_original_code:
struct _type_table_elem *mix_types(struct _type_table_elem *tp1, struct _type_table_elem *tp2, int code)
{
    if ((tp1 == 0) || (tp2 == 0))
        return 0;
    switch (code)
    {
        case L_PLUS:
            if (((tp1 == stringtype) || (tp1 == chartype)) &&
                ((tp2 == stringtype) || (tp2 == chartype)))
                return stringtype;
        case L_STAR:
        case L_MINUS:
            if ((tp1 == tp2) && ((tp1 == inttype)||(tp1 == realtype)))
                return tp1;
            else if ((tp1->utype == UT_LIMITED) && (tp2->utype == UT_LIMITED)
                    && (tp1->base == inttype) && (tp2->base == inttype))
                    return inttype;
            else if ((tp1->utype == UT_LIMITED) && (tp2 == inttype)
                    && (tp1->base == inttype))
                    return inttype;
            else if ((tp2->utype == UT_LIMITED) && (tp1 == inttype)
                    && (tp2->base == inttype))
                    return inttype;
        case L_SLASH:
            if (((tp1 == realtype) || (tp1 == inttype) || ((tp1->utype == UT_LIMITED) && (tp1->base == inttype))) &&
                ((tp2 == realtype) || (tp2 == inttype) || ((tp2->utype == UT_LIMITED) && (tp2->base == inttype))))
                return realtype;
            break;
        case L_DIV:
        case L_MOD:
            if (((tp1 == inttype) || ((tp1->utype == UT_LIMITED) && (tp1->base == inttype))) &&
                ((tp2 == inttype) || ((tp2->utype == UT_LIMITED) && (tp2->base == inttype))))
                return inttype;
            break;
        case L_XOR:
        case L_OR:
        case L_AND:
            if ((tp1 == tp2) && (tp1 == booltype))
                return booltype;
            break;
        case L_GREAT:
        case L_LESS:
        case L_EQUAL:
        case L_NEQUAL:
        case L_GEQUAL:
        case L_LEQUAL:
            if ((((tp1 == realtype) || (tp1 == inttype) || ((tp1->utype == UT_LIMITED) && (tp1->base == inttype))) &&
                ((tp2 == realtype) || (tp2 == inttype) || ((tp2->utype == UT_LIMITED) && (tp2->base == inttype)))) || (tp1 == tp2))
                return booltype;
        default:
            break;
    }
    char *err = malloc(1024);
    sprintf(err, gettext("'%s' and '%s'"), get_type_name(tp1), get_type_name(tp2));
    err_include(ERROR, gettext("wrong types:"), err, sem_l, sem_c);
    return 0;
}

variable_types: code int

variable_types:
err
char *

return_type: struct _type_table_elem { enum USE_TYPE { UT_SCALAR=5000, UT_LIMITED=5001, UT_ENUM=5002, UT_ARRAY=5003, UT_RECORD=5004, UT_REFERENCE=5005, UT_SET=5006, UT_FILE=5007 } utype; struct _type_table_elem *base; union { struct _list { void *value; struct _list *next; } *constants; struct _list *indexes; struct { unsigned long min; }; }; } *


balloc

decompiled_code:
void *balloc()
{
void *v0; // rdx

v0 = malloc(0x88uLL);
memset(v0, 0, 0x88uLL);
return v0;
}

canonical_decompiled_code:
void *func0()
{
void *v0; // rdx

v0 = malloc(0x88uLL);
memset(v0, 0, 0x88uLL);
return v0;
}

return_type: unsigned long *


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

if ( a1 >= 0 && a2 )
result = (*(_QWORD *)(a2 + 8 * ((unsigned __int64)a1 >> 6)) >> a1) & 1LL;
else
result = 0LL;
return result;
}

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

if ( a1 >= 0 && a2 )
result = (*(_QWORD *)(a2 + 8 * ((unsigned __int64)a1 >> 6)) >> a1) & 1LL;
else
result = 0LL;
return result;
}

original_code:
int bits_belong(long element, unsigned long *set)
{
    if (set == 0)
        return 0;
    if (element < 0)
        return 0;
 if (set[(((unsigned long)element)>>6)]&(1UL<<((((unsigned long)element)&0x003F))))
        return 1;
 else
        return 0;
}

variable_types: element long

variable_types:
set
unsigned long *


decompiled_code:
void *__fastcall bits_from_array(unsigned __int64 *a1)
{
void *v2; // rbp
unsigned __int64 v3; // rdi
unsigned __int64 *v4; // rbx

v2 = balloc();
v3 = *a1;
if ( *a1 != 1024 )
{
v4 = a1 + 1;
do
{
bits_append(v3, (__int64)v2);
v3 = *v4++;
}
while ( v3 != 1024 );
}
return v2;
}

canonical_decompiled_code:
void *__fastcall func3(unsigned __int64 *a1)
{
void *v2; // rbp
unsigned __int64 v3; // rdi
unsigned __int64 *v4; // rbx

v2 = func0();
v3 = *a1;
if ( *a1 != 1024 )
{
v4 = a1 + 1;
do
{
func2(v3, (__int64)v2);
v3 = *v4++;
}
while ( v3 != 1024 );
}
return v2;
}

original_code:
unsigned long *bits_from_array(unsigned long *a)
{
 int i;
 unsigned long *result = balloc();
 for(i = 0; a[i] != L_INVALID; i++)
 {
  bits_append(a[i], result);
 }
 return result;
}

variable_types:
a
unsigned long *

variable_types: i int

variable_types:
result
unsigned long *


decompiled_code:
int __fastcall set_print(__int64 a1)
{
__int64 i; // rbx

printf("[ ");
for ( i = 0LL; i != 17; ++i )
{
if ( (unsigned int)bits_belong(i, a1) )
printf("%d,", (unsigned int)i);
}
return puts(" ]");
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1)
{
__int64 i; // rbx

printf("[ ");
for ( i = 0LL; i != 17; ++i )
{
if ( (unsigned int)func1(i, a1) )
printf("%d,", (unsigned int)i);
}
return puts(" ]");
}

original_code:
void set_print(unsigned long *res)
{
 int i;
 printf("[ ");
 for(i = 0; i < (((1024)>>6)+1); i++)
  if(bits_belong(i, res)) printf("%d,", i);
 printf(" ]\n");
}

variable_types:
res
unsigned long *

return_type: void


decompiled_code:
__int64 __fastcall bits_first(__int64 a1)
{
__int64 i; // rbx

if ( !a1 )
return 1024LL;
for ( i = 0LL; i != 1024; ++i )
{
if ( (unsigned int)bits_belong(i, a1) )
break;
}
return i;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
__int64 i; // rbx

if ( !a1 )
return 1024LL;
for ( i = 0LL; i != 1024; ++i )
{
if ( (unsigned int)func1(i, a1) )
break;
}
return i;
}

original_code:
unsigned long bits_first(unsigned long *res)
{
    unsigned long i;
    if (res == 0)
        return L_INVALID;
    for (i = 0; i < L_INVALID; i++)
        if (bits_belong(i, res))
            return i;
    return L_INVALID;
}

variable_types:
i
unsigned long

return_type: unsigned long


decompiled_code:
__int64 parser_ff()
{
unsigned int v0; // eax
const char *v1; // rbx
unsigned int v2; // eax
__int64 result; // rax

syn_line = lex_line;
syn_c = lex_c;
v0 = lex_get_s();
v1 = (const char *)sym_get_sym(v0);
v2 = lex_get_s();
io_printf("Fast forward: %d (%s)\n", v2, v1);
result = lex_next_s();
if ( syn_line != 1 || syn_c != 1 )
{
syn_line = lex_line;
result = lex_c;
syn_c = lex_c;
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
unsigned int v0; // eax
const char *v1; // rbx
unsigned int v2; // eax
__int64 result; // rax

syn_line = lex_line;
syn_c = lex_c;
v0 = lex_get_s();
v1 = (const char *)sym_get_sym(v0);
v2 = lex_get_s();
io_printf("Fast forward: %d (%s)\n", v2, v1);
result = lex_next_s();
if ( syn_line != 1 || syn_c != 1 )
{
syn_line = lex_line;
result = lex_c;
syn_c = lex_c;
}
return result;
}

original_code:
static void parser_ff(void)
{
    syn_line = lex_line;
    syn_c = lex_c;
    io_printf("Fast forward: %d (%s)\n", lex_get_s(), sym_get_sym(lex_get_s()));
    lex_next_s();
    if (syn_line != 1 || syn_c != 1)
    {
        syn_line = lex_line;
        syn_c = lex_c;
    }
}

canonical_original_code:
static void parser_ff()
{
    syn_line = lex_line;
    syn_c = lex_c;
    io_printf("Fast forward: %d (%s)\n", lex_get_s(), sym_get_sym(lex_get_s()));
    lex_next_s();
    if (syn_line != 1 || syn_c != 1)
    {
        syn_line = lex_line;
        syn_c = lex_c;
    }
}


decompiled_code:
__int64 __fastcall skip1(__int64 a1)
{
__int64 result; // rax
int v2; // eax

while ( 1 )
{
result = lex_get_s();
if ( (_DWORD)result == -1 )
break;
v2 = lex_get_s();
result = bits_belong(v2, a1);
if ( (_DWORD)result )
break;
parser_ff();
}
return result;
}

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

while ( 1 )
{
result = lex_get_s();
if ( (_DWORD)result == -1 )
break;
v2 = lex_get_s();
result = bits_belong(v2, a1);
if ( (_DWORD)result )
break;
func0();
}
return result;
}

original_code:
void skip1(unsigned long *folls)
{
    while ((lex_get_s() != (-1)) && (!bits_belong(lex_get_s(), folls)))
        parser_ff();
}

variable_types:
folls
unsigned long *


decompiled_code:
__int64 __fastcall skip2(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v4; // rdi
__int64 v5; // rdi

while ( 1 )
{
result = lex_get_s();
if ( (_DWORD)result == -1 )
break;
v4 = (int)lex_get_s();
result = bits_belong(v4, a1);
if ( (_DWORD)result )
break;
v5 = (int)lex_get_s();
result = bits_belong(v5, a2);
if ( (_DWORD)result )
break;
parser_ff();
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v4; // rdi
__int64 v5; // rdi

while ( 1 )
{
result = lex_get_s();
if ( (_DWORD)result == -1 )
break;
v4 = (int)lex_get_s();
result = bits_belong(v4, a1);
if ( (_DWORD)result )
break;
v5 = (int)lex_get_s();
result = bits_belong(v5, a2);
if ( (_DWORD)result )
break;
func0();
}
return result;
}

original_code:
void skip2(unsigned long *start, unsigned long *folls)
{
    while ((lex_get_s() != (-1)) && (!bits_belong(lex_get_s(), start)) && (!bits_belong(lex_get_s(), folls)))
        parser_ff();
}

variable_types:
start
unsigned long *


decompiled_code:
__int64 init_parser()
{
init_parser_program();
init_parser_typedecl();
init_parser_typedefn();
init_parser_vardecl();
init_parser_varpack();
init_parser_varuse();
init_parser_expr();
init_parser_block();
init_parser_constant();
return init_parser_g_operator();
}

canonical_decompiled_code:
__int64 func3()
{
init_parser_program();
init_parser_typedecl();
init_parser_typedefn();
init_parser_vardecl();
init_parser_varpack();
init_parser_varuse();
init_parser_expr();
init_parser_block();
init_parser_constant();
return init_parser_g_operator();
}

original_code:
void init_parser(void)
{
    init_parser_program();
    init_parser_typedecl();
    init_parser_typedefn();
    init_parser_vardecl();
    init_parser_varpack();
    init_parser_varuse();
    init_parser_expr();
    init_parser_block();
    init_parser_constant();
    init_parser_g_operator();
}

canonical_original_code:
void init_parser()
{
    init_parser_program();
    init_parser_typedecl();
    init_parser_typedefn();
    init_parser_vardecl();
    init_parser_varpack();
    init_parser_varuse();
    init_parser_expr();
    init_parser_block();
    init_parser_constant();
    init_parser_g_operator();
}


decompiled_code:
__int64 fini_parser()
{
fini_parser_program();
fini_parser_typedecl();
fini_parser_typedefn();
fini_parser_vardecl();
fini_parser_varpack();
fini_parser_varuse();
fini_parser_expr();
fini_parser_block();
fini_parser_constant();
return fini_parser_g_operator();
}

canonical_decompiled_code:
__int64 func4()
{
fini_parser_program();
fini_parser_typedecl();
fini_parser_typedefn();
fini_parser_vardecl();
fini_parser_varpack();
fini_parser_varuse();
fini_parser_expr();
fini_parser_block();
fini_parser_constant();
return fini_parser_g_operator();
}

original_code:
void fini_parser(void)
{
    fini_parser_program();
    fini_parser_typedecl();
    fini_parser_typedefn();
    fini_parser_vardecl();
    fini_parser_varpack();
    fini_parser_varuse();
    fini_parser_expr();
    fini_parser_block();
    fini_parser_constant();
    fini_parser_g_operator();
}

canonical_original_code:
void fini_parser()
{
    fini_parser_program();
    fini_parser_typedecl();
    fini_parser_typedefn();
    fini_parser_vardecl();
    fini_parser_varpack();
    fini_parser_varuse();
    fini_parser_expr();
    fini_parser_block();
    fini_parser_constant();
    fini_parser_g_operator();
}


decompiled_code:
__int64 __fastcall parser_unexpected(__int64 a1)
{
unsigned int v1; // er12
unsigned int v2; // ebp
char *v3; // rax

v1 = syn_c;
v2 = syn_line;
v3 = dcgettext(0LL, syn_err, 5);
return err_include(3LL, v3, a1, v2, v1);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
unsigned int v1; // er12
unsigned int v2; // ebp
char *v3; // rax

v1 = syn_c;
v2 = syn_line;
v3 = dcgettext(0LL, syn_err, 5);
return err_include(3LL, v3, a1, v2, v1);
}

original_code:
void parser_unexpected(const char *extmsg)
{
    err_include(ERROR, gettext(syn_err), extmsg, syn_line, syn_c);
}

canonical_original_code:
void parser_unexpected(char *extmsg)
{
    err_include(ERROR, gettext(syn_err), extmsg, syn_line, syn_c);
}

variable_types:
extmsg
char *


decompiled_code:
__int64 __fastcall parser_exec(__int64 a1, __int64 a2, __int64 a3, __int64 (__fastcall *a4)(__int64, __int64), __int64 a5)
{
__int64 v5; // rbx
__int64 v9; // rdi
int v10; // eax
int v11; // eax
int v12; // eax
unsigned int v14; // er13
unsigned int v15; // er12
char *v16; // rbp
char *v17; // rax
char *v18; // r15
unsigned int v19; // eax
char *v20; // rax
__int64 v21; // rdi
unsigned int v22; // eax
char *v23; // r13
unsigned int v24; // eax
__int64 v25; // rdi
__int64 v26; // r14
unsigned int v27; // eax
__int64 v28; // r12
char *v29; // rax
__int64 v30; // [rsp+8h] [rbp-40h]

v5 = a1;
if ( a1 )
{
v9 = (int)lex_get_s();
if ( !(unsigned int)bits_belong(v9, v5) )
{
v18 = (char *)malloc(0x400uLL);
if ( a5 )
{
v19 = lex_get_s();
v30 = sym_get_sym(v19);
v20 = dcgettext(0LL, ": got '%s' but %s expected", 5);
}
else
{
v21 = bits_first(v5);
a5 = sym_get_sym(v21);
v22 = lex_get_s();
v30 = sym_get_sym(v22);
v20 = dcgettext(0LL, ": got '%s' but should be '%s' or so", 5);
}
sprintf(v18, v20, v30, a5);
parser_unexpected((__int64)v18);
skip2(v5, a2);
}
v10 = lex_get_s();
v11 = bits_belong(v10, v5);
v5 = 0LL;
if ( v11 )
{
v5 = a4(a2, a3);
if ( a2 )
{
v12 = lex_get_s();
if ( !(unsigned int)bits_belong(v12, a2) )
{
v23 = (char *)malloc(0x400uLL);
v24 = bits_first(a3);
v25 = v24;
if ( v24 == 1024 )
v25 = (unsigned int)bits_first(a2);
v26 = sym_get_sym(v25);
v27 = lex_get_s();
v28 = sym_get_sym(v27);
v29 = dcgettext(0LL, ": got '%s' but should be '%s' or so", 5);
sprintf(v23, v29, v28, v26);
parser_unexpected((__int64)v23);
skip1(a2);
}
}
}
}
else
{
v14 = syn_c;
v15 = syn_line;
v16 = dcgettext(0LL, "Empty list of starting tokens", 5);
v17 = dcgettext(0LL, parser_int_error, 5);
err_include(4LL, v17, v16, v15, v14);
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2, __int64 a3, __int64 (__fastcall *a4)(__int64, __int64), __int64 a5)
{
__int64 v5; // rbx
__int64 v9; // rdi
int v10; // eax
int v11; // eax
int v12; // eax
unsigned int v14; // er13
unsigned int v15; // er12
char *v16; // rbp
char *v17; // rax
char *v18; // r15
unsigned int v19; // eax
char *v20; // rax
__int64 v21; // rdi
unsigned int v22; // eax
char *v23; // r13
unsigned int v24; // eax
__int64 v25; // rdi
__int64 v26; // r14
unsigned int v27; // eax
__int64 v28; // r12
char *v29; // rax
__int64 v30; // [rsp+8h] [rbp-40h]

v5 = a1;
if ( a1 )
{
v9 = (int)lex_get_s();
if ( !(unsigned int)bits_belong(v9, v5) )
{
v18 = (char *)malloc(0x400uLL);
if ( a5 )
{
v19 = lex_get_s();
v30 = sym_get_sym(v19);
v20 = dcgettext(0LL, ": got '%s' but %s expected", 5);
}
else
{
v21 = bits_first(v5);
a5 = sym_get_sym(v21);
v22 = lex_get_s();
v30 = sym_get_sym(v22);
v20 = dcgettext(0LL, ": got '%s' but should be '%s' or so", 5);
}
sprintf(v18, v20, v30, a5);
func5((__int64)v18);
func2(v5, a2);
}
v10 = lex_get_s();
v11 = bits_belong(v10, v5);
v5 = 0LL;
if ( v11 )
{
v5 = a4(a2, a3);
if ( a2 )
{
v12 = lex_get_s();
if ( !(unsigned int)bits_belong(v12, a2) )
{
v23 = (char *)malloc(0x400uLL);
v24 = bits_first(a3);
v25 = v24;
if ( v24 == 1024 )
v25 = (unsigned int)bits_first(a2);
v26 = sym_get_sym(v25);
v27 = lex_get_s();
v28 = sym_get_sym(v27);
v29 = dcgettext(0LL, ": got '%s' but should be '%s' or so", 5);
sprintf(v23, v29, v28, v26);
func5((__int64)v23);
func1(a2);
}
}
}
}
else
{
v14 = syn_c;
v15 = syn_line;
v16 = dcgettext(0LL, "Empty list of starting tokens", 5);
v17 = dcgettext(0LL, parser_int_error, 5);
err_include(4LL, v17, v16, v15, v14);
}
return v5;
}

original_code:
void *parser_exec(unsigned long *start, unsigned long *folls, unsigned long *ex, parser_func pf, const char *name)
{
    char *tmp;
    int t;
    void *ret = 0;
    if (start == 0)
    {
        err_include(EFATAL, gettext(parser_int_error), gettext("Empty list of starting tokens"), syn_line, syn_c);
        return 0;
    } else if(!bits_belong(lex_get_s(), start)) {
        tmp = malloc(1024);
        if (name != ((void *)0))
        {
            sprintf(tmp, gettext(": got '%s' but %s expected"), sym_get_sym(lex_get_s()), name);
        } else {
            t = bits_first(start);
            sprintf(tmp, gettext(": got '%s' but should be '%s' or so"), sym_get_sym(lex_get_s()), sym_get_sym(t));
        }
        parser_unexpected(tmp);
        skip2(start, folls);
    }
    if(bits_belong(lex_get_s(), start))
    {
        ret = pf(folls, ex);
        if((folls != 0) && !bits_belong(lex_get_s(), folls))
        {
            tmp = malloc(1024);
            t = bits_first(ex);
            if (t == L_INVALID)
                t = bits_first(folls);
            sprintf(tmp, gettext(": got '%s' but should be '%s' or so"), sym_get_sym(lex_get_s()), sym_get_sym(t));
            parser_unexpected(tmp);
            skip1(folls);
        }
    }
    return ret;
}

canonical_original_code:
void *parser_exec(unsigned long *start, unsigned long *folls, unsigned long *ex, void *(*pf)(unsigned long *, unsigned long *), char *name)
{
    char *tmp;
    int t;
    void *ret = 0;
    if (start == 0)
    {
        err_include(EFATAL, gettext(parser_int_error), gettext("Empty list of starting tokens"), syn_line, syn_c);
        return 0;
    } else if(!bits_belong(lex_get_s(), start)) {
        tmp = malloc(1024);
        if (name != ((void *)0))
        {
            sprintf(tmp, gettext(": got '%s' but %s expected"), sym_get_sym(lex_get_s()), name);
        } else {
            t = bits_first(start);
            sprintf(tmp, gettext(": got '%s' but should be '%s' or so"), sym_get_sym(lex_get_s()), sym_get_sym(t));
        }
        parser_unexpected(tmp);
        skip2(start, folls);
    }
    if(bits_belong(lex_get_s(), start))
    {
        ret = pf(folls, ex);
        if((folls != 0) && !bits_belong(lex_get_s(), folls))
        {
            tmp = malloc(1024);
            t = bits_first(ex);
            if (t == L_INVALID)
                t = bits_first(folls);
            sprintf(tmp, gettext(": got '%s' but should be '%s' or so"), sym_get_sym(lex_get_s()), sym_get_sym(t));
            parser_unexpected(tmp);
            skip1(folls);
        }
    }
    return ret;
}

variable_types:
ex
unsigned long *

variable_types: void *(*)(unsigned long *, unsigned long *)

variable_types:
name
char *

variable_types: t int

variable_types:
ret
void *

return_type: void *


accept

decompiled_code:
__int64 __fastcall accept(unsigned int a1)
{
const char *v2; // r13
__int64 v3; // rdi
const char *v4; // r12
unsigned int v5; // ebp
const char *v6; // rax
char *v7; // rbp
__int64 v8; // r12
unsigned int v9; // eax
__int64 v10; // rbx
char *v11; // rax

v2 = "MATCH";
if ( (unsigned int)lex_get_s() != a1 )
v2 = "MISS";
v3 = (unsigned int)lex_get_s();
v4 = (const char *)sym_get_sym(v3);
v5 = lex_get_s();
v6 = (const char *)sym_get_sym(a1);
io_printf("Req %d (%s), got %d (%s) - %s\n", a1, v6, v5, v4, v2);
if ( (unsigned int)lex_get_s() == a1 )
return parser_ff();
v7 = (char *)malloc(0x400uLL);
v8 = sym_get_sym(a1);
v9 = lex_get_s();
v10 = sym_get_sym(v9);
v11 = dcgettext(0LL, ": got '%s' but expected '%s'", 5);
sprintf(v7, v11, v10, v8);
return parser_unexpected((__int64)v7);
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned int a1)
{
const char *v2; // r13
__int64 v3; // rdi
const char *v4; // r12
unsigned int v5; // ebp
const char *v6; // rax
char *v7; // rbp
__int64 v8; // r12
unsigned int v9; // eax
__int64 v10; // rbx
char *v11; // rax

v2 = "MATCH";
if ( (unsigned int)lex_get_s() != a1 )
v2 = "MISS";
v3 = (unsigned int)lex_get_s();
v4 = (const char *)sym_get_sym(v3);
v5 = lex_get_s();
v6 = (const char *)sym_get_sym(a1);
io_printf("Req %d (%s), got %d (%s) - %s\n", a1, v6, v5, v4, v2);
if ( (unsigned int)lex_get_s() == a1 )
return func0();
v7 = (char *)malloc(0x400uLL);
v8 = sym_get_sym(a1);
v9 = lex_get_s();
v10 = sym_get_sym(v9);
v11 = dcgettext(0LL, ": got '%s' but expected '%s'", 5);
sprintf(v7, v11, v10, v8);
return func5((__int64)v7);
}

original_code:
void accept(TOKEN_TYPE t)
{
    io_printf("Req %d (%s), got %d (%s) - %s\n",
        t, sym_get_sym(t),
        lex_get_s(), sym_get_sym(lex_get_s()),
        (t == lex_get_s())?"MATCH":"MISS" );
    if(lex_get_s() == t)
    {
        parser_ff();
    } else {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext(": got '%s' but expected '%s'"), sym_get_sym(lex_get_s()), sym_get_sym(t));
        parser_unexpected(tmp);
    }
}

canonical_original_code:
void accept(enum TOKEN_TYPE t)
{
    io_printf("Req %d (%s), got %d (%s) - %s\n",
        t, sym_get_sym(t),
        lex_get_s(), sym_get_sym(lex_get_s()),
        (t == lex_get_s())?"MATCH":"MISS" );
    if(lex_get_s() == t)
    {
        parser_ff();
    } else {
        char *tmp = malloc(1024);
        sprintf(tmp, gettext(": got '%s' but expected '%s'"), sym_get_sym(lex_get_s()), sym_get_sym(t));
        parser_unexpected(tmp);
    }
}

variable_types: enum TOKEN_TYPE { L_EOF=-1, L_PLUS=expr, L_MINUS=expr, L_STAR=expr, L_SLASH=expr, L_POINT=expr, L_COMMA=expr, L_SEMICOLON=expr, L_COLON=expr, L_ARROW=expr, L_LBRACKET=expr, L_RBRACKET=expr, L_LBRACE=expr, L_RBRACE=expr, L_LPANTH=expr, L_RPANTH=expr, L_EQUAL=expr, L_QUOTE=expr, L_LESS=expr, L_GREAT=expr, L_NEWLINE=expr, L_LCOMMENT=300, L_RCOMMENT=301, L_LEQUAL=302, L_GEQUAL=303, L_NEQUAL=304, L_ASSIGN=305, L_TWOPOINTS=306, L_OR=400, L_TO=401, L_OF=402, L_IN=403, L_DO=404, L_IF=405, L_END=500, L_VAR=501, L_AND=502, L_XOR=503, L_NOT=504, L_FOR=505, L_DIV=506, L_MOD=507, L_NIL=508, L_SSET=509, L_TYPE=600, L_GOTO=601, L_WITH=602, L_CASE=603, L_TRUE=604, L_THEN=605, L_ELSE=606, L_REAL=607, L_WORD=608, L_BYTE=609, L_FILE=610, L_TEXT=611, L_BEGIN=700, L_WHILE=701, L_BREAK=702, L_UNTIL=703, L_ARRAY=704, L_CONST=705, L_FALSE=706, L_SHORT=707, L_LABEL=708, L_REPEAT=800, L_DOWNTO=801, L_RECORD=802, L_STRING=803, L_INTEGER=900, L_PROGRAM=901, L_FUNCTION=902, L_PROCEDURE=903, L_IDENT=1000, L_NUMERIC=1001, L_FLOAT=1002, L_SCONST=1003, L_CHARCONST=1004, L_LINECOMMENT=1005, L_INVALID=1024 }

variable_types:
tmp
char *


decompiled_code:
__int64 __fastcall int_parse_typedecl(__int64 a1)
{
void *v1; // rbp
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
const char *v4; // rax
char *v5; // rsi
__int64 v6; // rbx
socklen_t *v7; // rdx
socklen_t *v8; // rdx
__int64 v9; // rax
socklen_t *v10; // rdx
socklen_t *v11; // rdx
socklen_t *v12; // rdx

v1 = (void *)balloc();
v2 = (struct sockaddr *)parser_typedecl_aux;
bits_disjunct(a1, parser_typedecl_aux, v1);
accept(600, v2, v3);
do
{
if ( (unsigned int)lex_get_s() == 1000 )
{
v4 = (const char *)lex_get_v();
v5 = strdup(v4);
v6 = add_to_id_table(0LL, v5, 4001LL);
accept(1000, (struct sockaddr *)v5, v7);
accept(61, (struct sockaddr *)v5, v8);
v2 = 0LL;
v9 = parse_typedefn(v1, 0LL);
if ( v6 )
*(_QWORD *)(v6 + 24) = v9;
}
else
{
accept(1000, v2, v11);
accept(61, v2, v12);
v2 = 0LL;
parse_typedefn(v1, 0LL);
}
accept(59, 0LL, v10);
}
while ( (unsigned int)lex_get_s() == 1000 );
free(v1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
void *v1; // rbp
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
const char *v4; // rax
char *v5; // rsi
__int64 v6; // rbx
socklen_t *v7; // rdx
socklen_t *v8; // rdx
__int64 v9; // rax
socklen_t *v10; // rdx
socklen_t *v11; // rdx
socklen_t *v12; // rdx

v1 = (void *)balloc();
v2 = (struct sockaddr *)parser_typedecl_aux;
bits_disjunct(a1, parser_typedecl_aux, v1);
accept(600, v2, v3);
do
{
if ( (unsigned int)lex_get_s() == 1000 )
{
v4 = (const char *)lex_get_v();
v5 = strdup(v4);
v6 = add_to_id_table(0LL, v5, 4001LL);
accept(1000, (struct sockaddr *)v5, v7);
accept(61, (struct sockaddr *)v5, v8);
v2 = 0LL;
v9 = parse_typedefn(v1, 0LL);
if ( v6 )
*(_QWORD *)(v6 + 24) = v9;
}
else
{
accept(1000, v2, v11);
accept(61, v2, v12);
v2 = 0LL;
parse_typedefn(v1, 0LL);
}
accept(59, 0LL, v10);
}
while ( (unsigned int)lex_get_s() == 1000 );
free(v1);
return 0LL;
}

original_code:
void *int_parse_typedecl (unsigned long *folls, unsigned long *ex)
{
    type_table_elem *ret = 0;
    id_table_elem *id = 0;
    lex_val lv;
    char *name;
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_typedecl_aux, tmp);
    accept(L_TYPE);
    do
    {
        id = 0;
        ret = 0;
        if (lex_get_s() == L_IDENT)
        {
            lv = lex_get_v();
            name = strdup(lv.string);
            id = add_to_id_table(0, name, UC_TYPE);
        }
        accept(L_IDENT);
        accept(L_EQUAL);
        ret = parse_typedefn(tmp, 0);
        if (id != 0)
            id->type = ret;
        accept(L_SEMICOLON);
    } while (lex_get_s() == L_IDENT);
    free(tmp);
}

canonical_original_code:
void *int_parse_typedecl(unsigned long *folls, unsigned long *ex)
{
    struct _type_table_elem *ret = 0;
    struct _id_table_elem *id = 0;
    union lex_val lv;
    char *name;
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_typedecl_aux, tmp);
    accept(L_TYPE);
    do
    {
        id = 0;
        ret = 0;
        if (lex_get_s() == L_IDENT)
        {
            lv = lex_get_v();
            name = strdup(lv.string);
            id = add_to_id_table(0, name, UC_TYPE);
        }
        accept(L_IDENT);
        accept(L_EQUAL);
        ret = parse_typedefn(tmp, 0);
        if (id != 0)
            id->type = ret;
        accept(L_SEMICOLON);
    } while (lex_get_s() == L_IDENT);
    free(tmp);
}

variable_types: struct _id_table_elem { unsigned long hash; char *name; enum USE_CLASS { UC_PROG=4000, UC_TYPE=4001, UC_CONST=4002, UC_VAR=4003, UC_PROC=4004, UC_FUNC=4005, UC_UNK=4006 } uclass; struct _type_table_elem { enum USE_TYPE { UT_SCALAR=5000, UT_LIMITED=5001, UT_ENUM=5002, UT_ARRAY=5003, UT_RECORD=5004, UT_REFERENCE=5005, UT_SET=5006, UT_FILE=5007 } utype; struct _type_table_elem *base; union { struct _list { void *value; struct _list *next; } *constants; struct _list *indexes; struct { unsigned long min; }; }; } *type; int value; } *

variable_types: union lex_val { long inumber; double fnumber; char *string; char character; }

variable_types:
tmp
unsigned long *

user_defined_types: struct _id_table_elem { unsigned long hash; char *name; enum USE_CLASS uclass; struct _type_table_elem *type; int value; }


decompiled_code:
__int64 __fastcall parse_typedecl(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_typedecl, a1, a2, int_parse_typedecl, "typedecl");
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_typedecl, a1, a2, int_parse_typedecl, "typedecl");
}

original_code: void *parse_typedecl (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_typedecl, folls, ex, int_parse_typedecl, parser_name_typedecl); }

canonical_original_code: void *parse_typedecl(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_typedecl, folls, ex, int_parse_typedecl, parser_name_typedecl); }


decompiled_code:
void init_parser_typedecl()
{
if ( !parser_start_typedecl )
parser_start_typedecl = (void *)bits_from_array(&int_start_typedecl);
if ( !parser_folls_typedecl )
parser_folls_typedecl = (void *)bits_from_array(&int_folls_typedecl);
if ( !parser_typedecl_aux )
parser_typedecl_aux = (void *)bits_from_array(&int_typedecl_aux);
}

canonical_decompiled_code:
void func2()
{
if ( !parser_start_typedecl )
parser_start_typedecl = (void *)bits_from_array(&int_start_typedecl);
if ( !parser_folls_typedecl )
parser_folls_typedecl = (void *)bits_from_array(&int_folls_typedecl);
if ( !parser_typedecl_aux )
parser_typedecl_aux = (void *)bits_from_array(&int_typedecl_aux);
}

original_code:
void init_parser_typedecl(void)
{
    { { if (parser_start_typedecl == 0) parser_start_typedecl = bits_from_array(int_start_typedecl); }; { if (parser_folls_typedecl == 0) parser_folls_typedecl = bits_from_array(int_folls_typedecl); }; };
    { if (parser_typedecl_aux == 0) parser_typedecl_aux = bits_from_array(int_typedecl_aux); };
}

canonical_original_code:
void init_parser_typedecl()
{
    { { if (parser_start_typedecl == 0) parser_start_typedecl = bits_from_array(int_start_typedecl); }; { if (parser_folls_typedecl == 0) parser_folls_typedecl = bits_from_array(int_folls_typedecl); }; };
    { if (parser_typedecl_aux == 0) parser_typedecl_aux = bits_from_array(int_typedecl_aux); };
}


decompiled_code:
void fini_parser_typedecl()
{
if ( parser_start_typedecl )
free(parser_start_typedecl);
if ( parser_folls_typedecl )
free(parser_folls_typedecl);
if ( parser_typedecl_aux )
free(parser_typedecl_aux);
}

canonical_decompiled_code:
void func3()
{
if ( parser_start_typedecl )
free(parser_start_typedecl);
if ( parser_folls_typedecl )
free(parser_folls_typedecl);
if ( parser_typedecl_aux )
free(parser_typedecl_aux);
}

original_code:
void fini_parser_typedecl(void)
{
    { { if (parser_start_typedecl != 0) free(parser_start_typedecl); }; { if (parser_folls_typedecl != 0) free(parser_folls_typedecl); }; };
    { if (parser_typedecl_aux != 0) free(parser_typedecl_aux); };
}

canonical_original_code:
void fini_parser_typedecl()
{
    { { if (parser_start_typedecl != 0) free(parser_start_typedecl); }; { if (parser_folls_typedecl != 0) free(parser_folls_typedecl); }; };
    { if (parser_typedecl_aux != 0) free(parser_typedecl_aux); };
}


decompiled_code:
__int64 __fastcall int_parse_constant(__int64 a1, char *a2)
{
int v2; // eax
socklen_t *v3; // rdx
int v4; // eax
__int64 v5; // rbx
int v6; // eax
socklen_t *v7; // rdx
int v9; // eax
socklen_t *v10; // rdx
int v11; // eax
unsigned int v12; // er12
unsigned int v13; // er13
const char *v14; // rax
char *v15; // rbp
__int64 v16; // rax
int v17; // eax
const char *v18; // rax
__int64 v19; // rax
__int64 v20[6]; // [rsp+8h] [rbp-30h] BYREF

if ( (unsigned int)lex_get_s() != 43 && (unsigned int)lex_get_s() != 45 )
{
if ( (unsigned int)lex_get_s() != 1001
&& (unsigned int)lex_get_s() != 1002
&& (unsigned int)lex_get_s() != 1000
&& (unsigned int)lex_get_s() != 1003
&& (unsigned int)lex_get_s() != 1004 )
{
goto LABEL_9;
}
v17 = lex_get_s();
v5 = inttype;
if ( v17 != 1003 )
{
v5 = 0LL;
if ( (unsigned int)lex_get_s() == 1004 )
v5 = realtype;
}
if ( (unsigned int)lex_get_s() == 1001 )
{
v5 = inttype;
goto LABEL_6;
}
if ( (unsigned int)lex_get_s() == 1002 )
{
v5 = realtype;
goto LABEL_6;
}
if ( (unsigned int)lex_get_s() != 1000 )
goto LABEL_6;
v12 = syn_line;
v13 = syn_c;
v18 = (const char *)lex_get_v();
v15 = strdup(v18);
v20[0] = 4002LL;
a2 = v15;
v19 = search_id_table(0LL, v15, v20);
if ( v19 )
{
v5 = *(_QWORD *)(v19 + 24);
goto LABEL_6;
}
goto LABEL_14;
}
v2 = lex_get_s();
accept(v2, (struct sockaddr *)a2, v3);
if ( (unsigned int)lex_get_s() != 1001 && (unsigned int)lex_get_s() != 1002 && (unsigned int)lex_get_s() != 1000 )
{
LABEL_9:
parser_unexpected(0LL);
v9 = lex_get_s();
accept(v9, (struct sockaddr *)a2, v10);
return 0LL;
}
v4 = lex_get_s();
v5 = inttype;
if ( v4 != 1001 )
{
v11 = lex_get_s();
v5 = realtype;
if ( v11 != 1002 )
{
v5 = 0LL;
if ( (unsigned int)lex_get_s() == 1000 )
{
v12 = syn_line;
v13 = syn_c;
v14 = (const char *)lex_get_v();
v15 = strdup(v14);
v20[0] = 4002LL;
a2 = v15;
v16 = search_id_table(0LL, v15, v20);
v5 = v16;
if ( v16 )
{
v5 = *(_QWORD *)(v16 + 24);
goto LABEL_6;
}
LABEL_14:
a2 = dcgettext(0LL, "wrong identifier:", 5);
err_include(3LL, a2, v15, v12, v13);
goto LABEL_6;
}
}
}
LABEL_6:
v6 = lex_get_s();
accept(v6, (struct sockaddr *)a2, v7);
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, char *a2)
{
int v2; // eax
socklen_t *v3; // rdx
int v4; // eax
__int64 v5; // rbx
int v6; // eax
socklen_t *v7; // rdx
int v9; // eax
socklen_t *v10; // rdx
int v11; // eax
unsigned int v12; // er12
unsigned int v13; // er13
const char *v14; // rax
char *v15; // rbp
__int64 v16; // rax
int v17; // eax
const char *v18; // rax
__int64 v19; // rax
__int64 v20[6]; // [rsp+8h] [rbp-30h] BYREF

if ( (unsigned int)lex_get_s() != 43 && (unsigned int)lex_get_s() != 45 )
{
if ( (unsigned int)lex_get_s() != 1001
&& (unsigned int)lex_get_s() != 1002
&& (unsigned int)lex_get_s() != 1000
&& (unsigned int)lex_get_s() != 1003
&& (unsigned int)lex_get_s() != 1004 )
{
goto LABEL_9;
}
v17 = lex_get_s();
v5 = inttype;
if ( v17 != 1003 )
{
v5 = 0LL;
if ( (unsigned int)lex_get_s() == 1004 )
v5 = realtype;
}
if ( (unsigned int)lex_get_s() == 1001 )
{
v5 = inttype;
goto LABEL_6;
}
if ( (unsigned int)lex_get_s() == 1002 )
{
v5 = realtype;
goto LABEL_6;
}
if ( (unsigned int)lex_get_s() != 1000 )
goto LABEL_6;
v12 = syn_line;
v13 = syn_c;
v18 = (const char *)lex_get_v();
v15 = strdup(v18);
v20[0] = 4002LL;
a2 = v15;
v19 = search_id_table(0LL, v15, v20);
if ( v19 )
{
v5 = *(_QWORD *)(v19 + 24);
goto LABEL_6;
}
goto LABEL_14;
}
v2 = lex_get_s();
accept(v2, (struct sockaddr *)a2, v3);
if ( (unsigned int)lex_get_s() != 1001 && (unsigned int)lex_get_s() != 1002 && (unsigned int)lex_get_s() != 1000 )
{
LABEL_9:
parser_unexpected(0LL);
v9 = lex_get_s();
accept(v9, (struct sockaddr *)a2, v10);
return 0LL;
}
v4 = lex_get_s();
v5 = inttype;
if ( v4 != 1001 )
{
v11 = lex_get_s();
v5 = realtype;
if ( v11 != 1002 )
{
v5 = 0LL;
if ( (unsigned int)lex_get_s() == 1000 )
{
v12 = syn_line;
v13 = syn_c;
v14 = (const char *)lex_get_v();
v15 = strdup(v14);
v20[0] = 4002LL;
a2 = v15;
v16 = search_id_table(0LL, v15, v20);
v5 = v16;
if ( v16 )
{
v5 = *(_QWORD *)(v16 + 24);
goto LABEL_6;
}
LABEL_14:
a2 = dcgettext(0LL, "wrong identifier:", 5);
err_include(3LL, a2, v15, v12, v13);
goto LABEL_6;
}
}
}
LABEL_6:
v6 = lex_get_s();
accept(v6, (struct sockaddr *)a2, v7);
return v5;
}

original_code:
void *int_parse_constant (unsigned long *folls, unsigned long *ex)
{
    type_table_elem *ret = 0;
    if ((lex_get_s() == L_PLUS) || (lex_get_s() == L_MINUS))
    {
        accept(lex_get_s());
        if ((lex_get_s() == L_NUMERIC) || (lex_get_s() == L_FLOAT) || (lex_get_s() == L_IDENT))
        {
            if (lex_get_s() == L_NUMERIC)
                ret = inttype;
            else if (lex_get_s() == L_FLOAT)
                ret = realtype;
            else if (lex_get_s() == L_IDENT)
            {
                int sl = syn_line, sc = syn_c;
                lex_val lv = lex_get_v();
                char *name = strdup(lv.string);
                unsigned long *uclass = UC_CONST;
                id_table_elem *id = search_id_table(0, name, &uclass);
                if (id == 0)
                    err_include (ERROR, gettext("wrong identifier:"), name, sl, sc);
                else
                    ret = id->type;
            }
            accept(lex_get_s());
        } else {
            parser_unexpected(0);
            accept(lex_get_s());
        }
    } else {
        if ((lex_get_s() == L_NUMERIC) || (lex_get_s() == L_FLOAT)
            || (lex_get_s() == L_IDENT) || (lex_get_s() == L_SCONST) || (lex_get_s() == L_CHARCONST))
        {
            if (lex_get_s() == L_SCONST)
                ret = inttype;
            else if (lex_get_s() == L_CHARCONST)
                ret = realtype;
            if (lex_get_s() == L_NUMERIC)
                ret = inttype;
            else if (lex_get_s() == L_FLOAT)
                ret = realtype;
            else if (lex_get_s() == L_IDENT)
            {
                int sl = syn_line, sc = syn_c;
                lex_val lv = lex_get_v();
                char *name = strdup(lv.string);
                unsigned long *uclass = UC_CONST;
                id_table_elem *id = search_id_table(0, name, &uclass);
                if (id == 0)
                    err_include (ERROR, gettext("wrong identifier:"), name, sl, sc);
                else
                    ret = id->type;
            }
            accept(lex_get_s());
        } else {
            parser_unexpected(0);
            accept(lex_get_s());
        }
    }
    return ret;
}

canonical_original_code:
void *int_parse_constant(unsigned long *folls, unsigned long *ex)
{
    struct _type_table_elem *ret = 0;
    if ((lex_get_s() == L_PLUS) || (lex_get_s() == L_MINUS))
    {
        accept(lex_get_s());
        if ((lex_get_s() == L_NUMERIC) || (lex_get_s() == L_FLOAT) || (lex_get_s() == L_IDENT))
        {
            if (lex_get_s() == L_NUMERIC)
                ret = inttype;
            else if (lex_get_s() == L_FLOAT)
                ret = realtype;
            else if (lex_get_s() == L_IDENT)
            {
                int sl = syn_line; int sc = syn_c;
                union lex_val lv = lex_get_v();
                char *name = strdup(lv.string);
                unsigned long *uclass = UC_CONST;
                struct _id_table_elem *id = search_id_table(0, name, &uclass);
                if (id == 0)
                    err_include (ERROR, gettext("wrong identifier:"), name, sl, sc);
                else
                    ret = id->type;
            }
            accept(lex_get_s());
        } else {
            parser_unexpected(0);
            accept(lex_get_s());
        }
    } else {
        if ((lex_get_s() == L_NUMERIC) || (lex_get_s() == L_FLOAT)
            || (lex_get_s() == L_IDENT) || (lex_get_s() == L_SCONST) || (lex_get_s() == L_CHARCONST))
        {
            if (lex_get_s() == L_SCONST)
                ret = inttype;
            else if (lex_get_s() == L_CHARCONST)
                ret = realtype;
            if (lex_get_s() == L_NUMERIC)
                ret = inttype;
            else if (lex_get_s() == L_FLOAT)
                ret = realtype;
            else if (lex_get_s() == L_IDENT)
            {
                int sl = syn_line; int sc = syn_c;
                union lex_val lv = lex_get_v();
                char *name = strdup(lv.string);
                unsigned long *uclass = UC_CONST;
                struct _id_table_elem *id = search_id_table(0, name, &uclass);
                if (id == 0)
                    err_include (ERROR, gettext("wrong identifier:"), name, sl, sc);
                else
                    ret = id->type;
            }
            accept(lex_get_s());
        } else {
            parser_unexpected(0);
            accept(lex_get_s());
        }
    }
    return ret;
}

variable_types: struct _type_table_elem { enum USE_TYPE { UT_SCALAR=5000, UT_LIMITED=5001, UT_ENUM=5002, UT_ARRAY=5003, UT_RECORD=5004, UT_REFERENCE=5005, UT_SET=5006, UT_FILE=5007 } utype; struct _type_table_elem *base; union { struct _list { void *value; struct _list *next; } *constants; struct _list *indexes; struct { unsigned long min; }; }; } *

variable_types: sl int

variable_types: sc int

variable_types:
uclass
unsigned long *

user_defined_types: union lex_val { long inumber; double fnumber; char *string; char character; }

user_defined_types: enum USE_CLASS { UC_PROG=4000, UC_TYPE=4001, UC_CONST=4002, UC_VAR=4003, UC_PROC=4004, UC_FUNC=4005, UC_UNK=4006 }


decompiled_code:
__int64 __fastcall parse_constdefn(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_constdefn, a1, a2, int_parse_constdefn, "constdefn");
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_constdefn, a1, a2, int_parse_constdefn, "constdefn");
}

original_code: void *parse_constdefn (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_constdefn, folls, ex, int_parse_constdefn, parser_name_constdefn); }

canonical_original_code: void *parse_constdefn(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_constdefn, folls, ex, int_parse_constdefn, parser_name_constdefn); }

variable_types:
folls
unsigned long *


decompiled_code:
void __fastcall int_parse_constdecl(__int64 a1)
{
void *v1; // rbx
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
socklen_t *v4; // rdx

v1 = (void *)balloc();
v2 = (struct sockaddr *)parser_constdecl_aux;
bits_disjunct(a1, parser_constdecl_aux, v1);
accept(705, v2, v3);
do
{
parse_constdefn((__int64)v1, 0LL);
accept(59, 0LL, v4);
}
while ( (unsigned int)lex_get_s() == 1000 );
free(v1);
}

canonical_decompiled_code:
void __fastcall func2(__int64 a1)
{
void *v1; // rbx
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
socklen_t *v4; // rdx

v1 = (void *)balloc();
v2 = (struct sockaddr *)parser_constdecl_aux;
bits_disjunct(a1, parser_constdecl_aux, v1);
accept(705, v2, v3);
do
{
func1((__int64)v1, 0LL);
accept(59, 0LL, v4);
}
while ( (unsigned int)lex_get_s() == 1000 );
free(v1);
}

original_code:
void *int_parse_constdecl (unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_constdecl_aux, tmp);
    accept(L_CONST);
    do
    {
        parse_constdefn(tmp, 0);
        accept(L_SEMICOLON);
    } while (lex_get_s() == L_IDENT);
    free(tmp);
}

canonical_original_code:
void *int_parse_constdecl(unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_constdecl_aux, tmp);
    accept(L_CONST);
    do
    {
        parse_constdefn(tmp, 0);
        accept(L_SEMICOLON);
    } while (lex_get_s() == L_IDENT);
    free(tmp);
}


decompiled_code:
__int64 __fastcall parse_constdecl(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_constdecl, a1, a2, int_parse_constdecl, "constdecl");
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_constdecl, a1, a2, int_parse_constdecl, "constdecl");
}

original_code: void *parse_constdecl (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_constdecl, folls, ex, int_parse_constdecl, parser_name_constdecl); }

canonical_original_code: void *parse_constdecl(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_constdecl, folls, ex, int_parse_constdecl, parser_name_constdecl); }


decompiled_code:
__int64 __fastcall parse_constant(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_constant, a1, a2, int_parse_constant, "constant");
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_constant, a1, a2, int_parse_constant, "constant");
}

original_code: void *parse_constant (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_constant, folls, ex, int_parse_constant, parser_name_constant); }

canonical_original_code: void *parse_constant(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_constant, folls, ex, int_parse_constant, parser_name_constant); }


decompiled_code:
__int64 __fastcall int_parse_constdefn(__int64 a1, struct sockaddr *a2)
{
socklen_t *v2; // rdx
socklen_t *v3; // rdx
const char *v4; // rax
char *v5; // rsi
__int64 v6; // rbp
socklen_t *v7; // rdx
socklen_t *v8; // rdx
__int64 v9; // rax

if ( (unsigned int)lex_get_s() == 1000 )
{
v4 = (const char *)lex_get_v();
v5 = strdup(v4);
v6 = add_to_id_table(0LL, v5, 4002LL);
accept(1000, (struct sockaddr *)v5, v7);
accept(61, (struct sockaddr *)v5, v8);
v9 = parse_constant(a1, 0LL);
if ( v6 )
*(_QWORD *)(v6 + 24) = v9;
}
else
{
accept(1000, a2, v2);
accept(61, a2, v3);
parse_constant(a1, 0LL);
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, struct sockaddr *a2)
{
socklen_t *v2; // rdx
socklen_t *v3; // rdx
const char *v4; // rax
char *v5; // rsi
__int64 v6; // rbp
socklen_t *v7; // rdx
socklen_t *v8; // rdx
__int64 v9; // rax

if ( (unsigned int)lex_get_s() == 1000 )
{
v4 = (const char *)lex_get_v();
v5 = strdup(v4);
v6 = add_to_id_table(0LL, v5, 4002LL);
accept(1000, (struct sockaddr *)v5, v7);
accept(61, (struct sockaddr *)v5, v8);
v9 = func4(a1, 0LL);
if ( v6 )
*(_QWORD *)(v6 + 24) = v9;
}
else
{
accept(1000, a2, v2);
accept(61, a2, v3);
func4(a1, 0LL);
}
return 0LL;
}

original_code:
void *int_parse_constdefn (unsigned long *folls, unsigned long *ex)
{
    id_table_elem *id = 0;
    type_table_elem *tp = 0;
    if (lex_get_s() == L_IDENT)
    {
        lex_val lv = lex_get_v();
        char *name = strdup(lv.string);
        id = add_to_id_table(0, name, UC_CONST);
    }
    accept(L_IDENT);
    accept(L_EQUAL);
    tp = parse_constant(folls, 0);
    if (id != 0)
        id->type = tp;
}

canonical_original_code:
void *int_parse_constdefn(unsigned long *folls, unsigned long *ex)
{
    struct _id_table_elem *id = 0;
    struct _type_table_elem *tp = 0;
    if (lex_get_s() == L_IDENT)
    {
        union lex_val lv = lex_get_v();
        char *name = strdup(lv.string);
        id = add_to_id_table(0, name, UC_CONST);
    }
    accept(L_IDENT);
    accept(L_EQUAL);
    tp = parse_constant(folls, 0);
    if (id != 0)
        id->type = tp;
}


decompiled_code:
void init_parser_constant()
{
if ( !parser_start_constant )
parser_start_constant = (void *)bits_from_array(&int_start_constant);
if ( !parser_folls_constant )
parser_folls_constant = (void *)bits_from_array(&int_folls_constant);
if ( !parser_start_constdecl )
parser_start_constdecl = (void *)bits_from_array(&int_start_constdecl);
if ( !parser_folls_constdecl )
parser_folls_constdecl = (void *)bits_from_array(&int_folls_constdecl);
if ( !parser_start_constdefn )
parser_start_constdefn = (void *)bits_from_array(&int_start_constdefn);
if ( !parser_folls_constdefn )
parser_folls_constdefn = (void *)bits_from_array(&int_folls_constdefn);
if ( !parser_constdecl_aux )
parser_constdecl_aux = (void *)bits_from_array(&int_constdecl_aux);
}

canonical_decompiled_code:
void func6()
{
if ( !parser_start_constant )
parser_start_constant = (void *)bits_from_array(&int_start_constant);
if ( !parser_folls_constant )
parser_folls_constant = (void *)bits_from_array(&int_folls_constant);
if ( !parser_start_constdecl )
parser_start_constdecl = (void *)bits_from_array(&int_start_constdecl);
if ( !parser_folls_constdecl )
parser_folls_constdecl = (void *)bits_from_array(&int_folls_constdecl);
if ( !parser_start_constdefn )
parser_start_constdefn = (void *)bits_from_array(&int_start_constdefn);
if ( !parser_folls_constdefn )
parser_folls_constdefn = (void *)bits_from_array(&int_folls_constdefn);
if ( !parser_constdecl_aux )
parser_constdecl_aux = (void *)bits_from_array(&int_constdecl_aux);
}

original_code:
void init_parser_constant(void)
{
    { { if (parser_start_constant == 0) parser_start_constant = bits_from_array(int_start_constant); }; { if (parser_folls_constant == 0) parser_folls_constant = bits_from_array(int_folls_constant); }; };
    { { if (parser_start_constdecl == 0) parser_start_constdecl = bits_from_array(int_start_constdecl); }; { if (parser_folls_constdecl == 0) parser_folls_constdecl = bits_from_array(int_folls_constdecl); }; };
    { { if (parser_start_constdefn == 0) parser_start_constdefn = bits_from_array(int_start_constdefn); }; { if (parser_folls_constdefn == 0) parser_folls_constdefn = bits_from_array(int_folls_constdefn); }; };
    { if (parser_constdecl_aux == 0) parser_constdecl_aux = bits_from_array(int_constdecl_aux); };
}

canonical_original_code:
void init_parser_constant()
{
    { { if (parser_start_constant == 0) parser_start_constant = bits_from_array(int_start_constant); }; { if (parser_folls_constant == 0) parser_folls_constant = bits_from_array(int_folls_constant); }; };
    { { if (parser_start_constdecl == 0) parser_start_constdecl = bits_from_array(int_start_constdecl); }; { if (parser_folls_constdecl == 0) parser_folls_constdecl = bits_from_array(int_folls_constdecl); }; };
    { { if (parser_start_constdefn == 0) parser_start_constdefn = bits_from_array(int_start_constdefn); }; { if (parser_folls_constdefn == 0) parser_folls_constdefn = bits_from_array(int_folls_constdefn); }; };
    { if (parser_constdecl_aux == 0) parser_constdecl_aux = bits_from_array(int_constdecl_aux); };
}


decompiled_code:
void fini_parser_constant()
{
if ( parser_start_constant )
free(parser_start_constant);
if ( parser_folls_constant )
free(parser_folls_constant);
if ( parser_start_constdecl )
free(parser_start_constdecl);
if ( parser_folls_constdecl )
free(parser_folls_constdecl);
if ( parser_start_constdefn )
free(parser_start_constdefn);
if ( parser_folls_constdefn )
free(parser_folls_constdefn);
if ( parser_constdecl_aux )
free(parser_constdecl_aux);
}

canonical_decompiled_code:
void func7()
{
if ( parser_start_constant )
free(parser_start_constant);
if ( parser_folls_constant )
free(parser_folls_constant);
if ( parser_start_constdecl )
free(parser_start_constdecl);
if ( parser_folls_constdecl )
free(parser_folls_constdecl);
if ( parser_start_constdefn )
free(parser_start_constdefn);
if ( parser_folls_constdefn )
free(parser_folls_constdefn);
if ( parser_constdecl_aux )
free(parser_constdecl_aux);
}

original_code:
void fini_parser_constant(void)
{
    { { if (parser_start_constant != 0) free(parser_start_constant); }; { if (parser_folls_constant != 0) free(parser_folls_constant); }; };
    { { if (parser_start_constdecl != 0) free(parser_start_constdecl); }; { if (parser_folls_constdecl != 0) free(parser_folls_constdecl); }; };
    { { if (parser_start_constdefn != 0) free(parser_start_constdefn); }; { if (parser_folls_constdefn != 0) free(parser_folls_constdefn); }; };
    { if (parser_constdecl_aux != 0) free(parser_constdecl_aux); };
}

canonical_original_code:
void fini_parser_constant()
{
    { { if (parser_start_constant != 0) free(parser_start_constant); }; { if (parser_folls_constant != 0) free(parser_folls_constant); }; };
    { { if (parser_start_constdecl != 0) free(parser_start_constdecl); }; { if (parser_folls_constdecl != 0) free(parser_folls_constdecl); }; };
    { { if (parser_start_constdefn != 0) free(parser_start_constdefn); }; { if (parser_folls_constdefn != 0) free(parser_folls_constdefn); }; };
    { if (parser_constdecl_aux != 0) free(parser_constdecl_aux); };
}


decompiled_code:
__int64 __fastcall int_parse_assign_operator(__int64 a1, __int64 a2)
{
void *v3; // rbx
struct sockaddr *v4; // rsi
__int64 v5; // rbp
unsigned int v6; // er14
unsigned int v7; // er15
socklen_t *v8; // rdx
__int64 v9; // rbx
char *v11; // r12
const char *v12; // rbx
const char *v13; // rax
char *v14; // rax

v3 = (void *)balloc();
bits_disjunct(a1, parser_assign_operator_aux, v3);
bits_disjunct(v3, parser_start_expr, v3);
v4 = (struct sockaddr *)parser_assign_operator_aux;
v5 = parse_varuse(v3, parser_assign_operator_aux);
free(v3);
v6 = syn_line;
v7 = syn_c;
accept(305, v4, v8);
v9 = parse_expr(a1, a2);
if ( !(unsigned int)can_assign(v5, v9) )
{
v11 = (char *)malloc(0x400uLL);
v12 = (const char *)get_type_name(v9);
v13 = (const char *)get_type_name(v5);
sprintf(v11, "expected '%s' but got '%s'", v13, v12);
v14 = dcgettext(0LL, "type mismatch:", 5);
err_include(3LL, v14, v11, v6, v7);
v5 = 0LL;
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
void *v3; // rbx
struct sockaddr *v4; // rsi
__int64 v5; // rbp
unsigned int v6; // er14
unsigned int v7; // er15
socklen_t *v8; // rdx
__int64 v9; // rbx
char *v11; // r12
const char *v12; // rbx
const char *v13; // rax
char *v14; // rax

v3 = (void *)balloc();
bits_disjunct(a1, parser_assign_operator_aux, v3);
bits_disjunct(v3, parser_start_expr, v3);
v4 = (struct sockaddr *)parser_assign_operator_aux;
v5 = parse_varuse(v3, parser_assign_operator_aux);
free(v3);
v6 = syn_line;
v7 = syn_c;
accept(305, v4, v8);
v9 = parse_expr(a1, a2);
if ( !(unsigned int)can_assign(v5, v9) )
{
v11 = (char *)malloc(0x400uLL);
v12 = (const char *)get_type_name(v9);
v13 = (const char *)get_type_name(v5);
sprintf(v11, "expected '%s' but got '%s'", v13, v12);
v14 = dcgettext(0LL, "type mismatch:", 5);
err_include(3LL, v14, v11, v6, v7);
v5 = 0LL;
}
return v5;
}

original_code:
void *int_parse_assign_operator (unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_assign_operator_aux, tmp);
    bits_disjunct(tmp, parser_start_expr, tmp);
    type_table_elem *tp1, *tp2, *ret;
    tp1 = parse_varuse(tmp, parser_assign_operator_aux);
    free(tmp);
    int sl, sc;
    ret = 0;
    sl = syn_line;
    sc = syn_c;
    accept(L_ASSIGN);
    tp2 = parse_expr(folls, ex);
    if (!can_assign(tp1, tp2))
    {
        char *st = malloc(1024);
        sprintf(st, "expected '%s' but got '%s'", get_type_name(tp1), get_type_name(tp2));
        err_include(ERROR, gettext("type mismatch:"), st, sl, sc);
    } else {
        ret = tp1;
    }
    return ret;
}

canonical_original_code:
void *int_parse_assign_operator(unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_assign_operator_aux, tmp);
    bits_disjunct(tmp, parser_start_expr, tmp);
    struct _type_table_elem *tp1; struct _type_table_elem *tp2; struct _type_table_elem *ret;
    tp1 = parse_varuse(tmp, parser_assign_operator_aux);
    free(tmp);
    int sl; int sc;
    ret = 0;
    sl = syn_line;
    sc = syn_c;
    accept(L_ASSIGN);
    tp2 = parse_expr(folls, ex);
    if (!can_assign(tp1, tp2))
    {
        char *st = malloc(1024);
        sprintf(st, "expected '%s' but got '%s'", get_type_name(tp1), get_type_name(tp2));
        err_include(ERROR, gettext("type mismatch:"), st, sl, sc);
    } else {
        ret = tp1;
    }
    return ret;
}

variable_types:
st
char *


decompiled_code:
__int64 __fastcall parse_assign_operator(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_assign_operator, a1, a2, int_parse_assign_operator, "assign_operator");
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_assign_operator, a1, a2, int_parse_assign_operator, "assign_operator");
}

original_code: void *parse_assign_operator (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_assign_operator, folls, ex, int_parse_assign_operator, parser_name_assign_operator); }

canonical_original_code: void *parse_assign_operator(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_assign_operator, folls, ex, int_parse_assign_operator, parser_name_assign_operator); }


decompiled_code:
__int64 __fastcall parse_for_operator(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_for_operator, a1, a2, int_parse_for_operator, "for_operator");
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_for_operator, a1, a2, int_parse_for_operator, "for_operator");
}

original_code: void *parse_for_operator (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_for_operator, folls, ex, int_parse_for_operator, parser_name_for_operator); }

canonical_original_code: void *parse_for_operator(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_for_operator, folls, ex, int_parse_for_operator, parser_name_for_operator); }


decompiled_code:
__int64 __fastcall parse_g_operator(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_g_operator, a1, a2, int_parse_g_operator, "g_operator");
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_g_operator, a1, a2, int_parse_g_operator, "g_operator");
}

original_code: void *parse_g_operator (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_g_operator, folls, ex, int_parse_g_operator, parser_name_g_operator); }

canonical_original_code: void *parse_g_operator(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_g_operator, folls, ex, int_parse_g_operator, parser_name_g_operator); }


decompiled_code:
__int64 __fastcall int_parse_for_operator(__int64 a1)
{
void *v1; // rbx
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
unsigned int v4; // er12
unsigned int v5; // er14
char *v6; // rsi
__int64 v7; // r13
socklen_t *v8; // rdx
__int64 v9; // r12
int v10; // eax
unsigned int v11; // er12
unsigned int v12; // er15
__int64 v13; // r14
char *v14; // rsi
socklen_t *v15; // rdx
char *v17; // rax
__int64 v18; // r14
__int64 v19; // r13
char *v20; // rax
char *s; // [rsp+8h] [rbp-40h]

v1 = (void *)balloc();
bits_disjunct(a1, parser_for_operator_aux1, v1);
v2 = (struct sockaddr *)parser_for_operator_aux2;
bits_disjunct(v1, parser_for_operator_aux2, v1);
accept(505, v2, v3);
v4 = syn_line;
v5 = syn_c;
v6 = (char *)parser_for_operator_aux1;
v7 = parse_assign_operator((__int64)v1, (__int64)parser_for_operator_aux1);
if ( !(unsigned int)can_iterate(v7) )
{
v6 = dcgettext(0LL, "invalid loop initialization", 5);
err_include(3LL, v6, 0LL, v4, v5);
v7 = 0LL;
}
if ( (unsigned int)lex_get_s() == 401 )
accept(401, (struct sockaddr *)v6, v8);
else
accept(801, (struct sockaddr *)v6, v8);
bits_disjunct(a1, parser_for_operator_aux2, v1);
v9 = parser_start_expr;
v10 = lex_get_s();
v11 = bits_belong(v10, v9);
v12 = v11;
v13 = 0LL;
if ( v11 )
{
v11 = syn_line;
v12 = syn_c;
v13 = parse_expr(v1, 0LL);
if ( !(unsigned int)can_iterate(v13) )
{
v17 = dcgettext(0LL, "invalid loop finalization", 5);
err_include(3LL, v17, 0LL, v11, v12);
v13 = 0LL;
}
}
v14 = (char *)v13;
if ( !(unsigned int)can_assign(v7, v13) )
{
s = (char *)malloc(0x800uLL);
v18 = get_type_name(v13);
v19 = get_type_name(v7);
v20 = dcgettext(0LL, "expected '%s' but got '%s'", 5);
sprintf(s, v20, v19, v18);
v14 = dcgettext(0LL, "type mismatch:", 5);
err_include(3LL, v14, s, v11, v12);
}
free(v1);
accept(404, (struct sockaddr *)v14, v15);
return parse_g_operator(a1, 0LL);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
void *v1; // rbx
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
unsigned int v4; // er12
unsigned int v5; // er14
char *v6; // rsi
__int64 v7; // r13
socklen_t *v8; // rdx
__int64 v9; // r12
int v10; // eax
unsigned int v11; // er12
unsigned int v12; // er15
__int64 v13; // r14
char *v14; // rsi
socklen_t *v15; // rdx
char *v17; // rax
__int64 v18; // r14
__int64 v19; // r13
char *v20; // rax
char *s; // [rsp+8h] [rbp-40h]

v1 = (void *)balloc();
bits_disjunct(a1, parser_for_operator_aux1, v1);
v2 = (struct sockaddr *)parser_for_operator_aux2;
bits_disjunct(v1, parser_for_operator_aux2, v1);
accept(505, v2, v3);
v4 = syn_line;
v5 = syn_c;
v6 = (char *)parser_for_operator_aux1;
v7 = func1((__int64)v1, (__int64)parser_for_operator_aux1);
if ( !(unsigned int)can_iterate(v7) )
{
v6 = dcgettext(0LL, "invalid loop initialization", 5);
err_include(3LL, v6, 0LL, v4, v5);
v7 = 0LL;
}
if ( (unsigned int)lex_get_s() == 401 )
accept(401, (struct sockaddr *)v6, v8);
else
accept(801, (struct sockaddr *)v6, v8);
bits_disjunct(a1, parser_for_operator_aux2, v1);
v9 = parser_start_expr;
v10 = lex_get_s();
v11 = bits_belong(v10, v9);
v12 = v11;
v13 = 0LL;
if ( v11 )
{
v11 = syn_line;
v12 = syn_c;
v13 = parse_expr(v1, 0LL);
if ( !(unsigned int)can_iterate(v13) )
{
v17 = dcgettext(0LL, "invalid loop finalization", 5);
err_include(3LL, v17, 0LL, v11, v12);
v13 = 0LL;
}
}
v14 = (char *)v13;
if ( !(unsigned int)can_assign(v7, v13) )
{
s = (char *)malloc(0x800uLL);
v18 = get_type_name(v13);
v19 = get_type_name(v7);
v20 = dcgettext(0LL, "expected '%s' but got '%s'", 5);
sprintf(s, v20, v19, v18);
v14 = dcgettext(0LL, "type mismatch:", 5);
err_include(3LL, v14, s, v11, v12);
}
free(v1);
accept(404, (struct sockaddr *)v14, v15);
return func3(a1, 0LL);
}

original_code:
void *int_parse_for_operator (unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp;
    tmp = balloc();
    bits_disjunct(folls, parser_for_operator_aux1, tmp);
    bits_disjunct(tmp, parser_for_operator_aux2, tmp);
    type_table_elem *tp1 = 0, *tp2 = 0;
    int sl1 = 0, sc1 = 0;
    accept(L_FOR);
    int sl = syn_line, sc = syn_c;
    tp1 = parse_assign_operator(tmp, parser_for_operator_aux1);
    if (!can_iterate(tp1))
    {
        err_include(ERROR, gettext("invalid loop initialization"), 0, sl, sc);
        tp1 = 0;
    }
    if (lex_get_s() == L_TO)
        accept(L_TO);
    else
        accept(L_DOWNTO);
    bits_disjunct(folls, parser_for_operator_aux2, tmp);
    if (bits_belong(lex_get_s(), parser_start_expr))
    {
        sl1 = syn_line, sc1 = syn_c;
        tp2 = parse_expr(tmp, 0);
        if (!can_iterate(tp2))
        {
            err_include(ERROR, gettext("invalid loop finalization"), 0, sl1, sc1);
            tp2 = 0;
        }
    } else {
    }
    if (!can_assign(tp1, tp2))
    {
        char *st = malloc(1024*2);
        sprintf(st, gettext("expected '%s' but got '%s'"), get_type_name(tp1), get_type_name(tp2));
        err_include(ERROR, gettext("type mismatch:"), st, sl1, sc1);
    }
    free(tmp);
    accept(L_DO);
    parse_g_operator(folls, 0);
}

canonical_original_code:
void *int_parse_for_operator(unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp;
    tmp = balloc();
    bits_disjunct(folls, parser_for_operator_aux1, tmp);
    bits_disjunct(tmp, parser_for_operator_aux2, tmp);
    struct _type_table_elem *tp1 = 0; struct _type_table_elem *tp2 = 0;
    int sl1 = 0; int sc1 = 0;
    accept(L_FOR);
    int sl = syn_line; int sc = syn_c;
    tp1 = parse_assign_operator(tmp, parser_for_operator_aux1);
    if (!can_iterate(tp1))
    {
        err_include(ERROR, gettext("invalid loop initialization"), 0, sl, sc);
        tp1 = 0;
    }
    if (lex_get_s() == L_TO)
        accept(L_TO);
    else
        accept(L_DOWNTO);
    bits_disjunct(folls, parser_for_operator_aux2, tmp);
    if (bits_belong(lex_get_s(), parser_start_expr))
    {
        sl1 = syn_line, sc1 = syn_c;
        tp2 = parse_expr(tmp, 0);
        if (!can_iterate(tp2))
        {
            err_include(ERROR, gettext("invalid loop finalization"), 0, sl1, sc1);
            tp2 = 0;
        }
    } else {
    }
    if (!can_assign(tp1, tp2))
    {
        char *st = malloc(1024*2);
        sprintf(st, gettext("expected '%s' but got '%s'"), get_type_name(tp1), get_type_name(tp2));
        err_include(ERROR, gettext("type mismatch:"), st, sl1, sc1);
    }
    free(tmp);
    accept(L_DO);
    parse_g_operator(folls, 0);
}


decompiled_code:
void __fastcall int_parse_complex_operator(__int64 a1)
{
void *v1; // rbp
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
struct sockaddr *v4; // rbx
__int64 v5; // rdi
struct sockaddr *v6; // rsi
socklen_t *v7; // rdx
struct sockaddr *v8; // rbx
__int64 v9; // rdi

v1 = (void *)balloc();
v2 = (struct sockaddr *)parser_complex_operator_aux;
bits_disjunct(a1, parser_complex_operator_aux, v1);
accept(700, v2, v3);
v4 = (struct sockaddr *)parser_start_g_operator;
v5 = (int)lex_get_s();
v6 = v4;
if ( (unsigned int)bits_belong(v5, v4) )
{
LABEL_2:
v6 = 0LL;
parse_g_operator((__int64)v1, 0LL);
}
while ( (unsigned int)lex_get_s() == 59 )
{
accept(59, v6, v7);
v8 = (struct sockaddr *)parser_start_g_operator;
v9 = (int)lex_get_s();
v6 = v8;
if ( (unsigned int)bits_belong(v9, v8) )
goto LABEL_2;
}
accept(500, v6, v7);
free(v1);
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1)
{
void *v1; // rbp
struct sockaddr *v2; // rsi
socklen_t *v3; // rdx
struct sockaddr *v4; // rbx
__int64 v5; // rdi
struct sockaddr *v6; // rsi
socklen_t *v7; // rdx
struct sockaddr *v8; // rbx
__int64 v9; // rdi

v1 = (void *)balloc();
v2 = (struct sockaddr *)parser_complex_operator_aux;
bits_disjunct(a1, parser_complex_operator_aux, v1);
accept(700, v2, v3);
v4 = (struct sockaddr *)parser_start_g_operator;
v5 = (int)lex_get_s();
v6 = v4;
if ( (unsigned int)bits_belong(v5, v4) )
{
LABEL_2:
v6 = 0LL;
func3((__int64)v1, 0LL);
}
while ( (unsigned int)lex_get_s() == 59 )
{
accept(59, v6, v7);
v8 = (struct sockaddr *)parser_start_g_operator;
v9 = (int)lex_get_s();
v6 = v8;
if ( (unsigned int)bits_belong(v9, v8) )
goto LABEL_2;
}
accept(500, v6, v7);
free(v1);
}

original_code:
void *int_parse_complex_operator (unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_complex_operator_aux, tmp);
    accept(L_BEGIN);
    if (bits_belong(lex_get_s(), parser_start_g_operator))
    {
        parse_g_operator(tmp, 0);
    }
    while (lex_get_s() == L_SEMICOLON)
    {
        accept(L_SEMICOLON);
        if (bits_belong(lex_get_s(), parser_start_g_operator))
            parse_g_operator(tmp, 0);
    }
    accept(L_END);
    free(tmp);
}

canonical_original_code:
void *int_parse_complex_operator(unsigned long *folls, unsigned long *ex)
{
    unsigned long *tmp = balloc();
    bits_disjunct(folls, parser_complex_operator_aux, tmp);
    accept(L_BEGIN);
    if (bits_belong(lex_get_s(), parser_start_g_operator))
    {
        parse_g_operator(tmp, 0);
    }
    while (lex_get_s() == L_SEMICOLON)
    {
        accept(L_SEMICOLON);
        if (bits_belong(lex_get_s(), parser_start_g_operator))
            parse_g_operator(tmp, 0);
    }
    accept(L_END);
    free(tmp);
}


decompiled_code:
__int64 __fastcall parse_complex_operator(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_complex_operator, a1, a2, int_parse_complex_operator, "complex_operator");
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
return parser_exec(parser_start_complex_operator, a1, a2, int_parse_complex_operator, "complex_operator");
}

original_code: void *parse_complex_operator (unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_complex_operator, folls, ex, int_parse_complex_operator, parser_name_complex_operator); }

canonical_original_code: void *parse_complex_operator(unsigned long *folls, unsigned long *ex) { return parser_exec(parser_start_complex_operator, folls, ex, int_parse_complex_operator, parser_name_complex_operator); }


decompiled_code:
__int64 __fastcall int_parse_g_operator(__int64 a1)
{
void *v2; // rbx
__int64 v3; // rdi
__int64 result; // rax
unsigned int v5; // er12
unsigned int v6; // ebx
unsigned int v7; // eax
__int64 v8; // rax

while ( 1 )
{
v2 = parser_start_g_operator;
v3 = (int)lex_get_s();
result = bits_belong(v3, v2);
if ( !(_DWORD)result )
break;
if ( (unsigned int)lex_get_s() == 700 )
{
parse_complex_operator(a1, 0LL);
}
else if ( (unsigned int)lex_get_s() == 505 )
{
parse_for_operator(a1, 0LL);
}
else if ( (unsigned int)lex_get_s() == 1000 )
{
parse_assign_operator(a1, 0LL);
}
else
{
v5 = syn_c;
v6 = syn_line;
v7 = lex_get_s();
v8 = sym_get_sym(v7);
err_include(4LL, "unsupported operator:", v8, v6, v5);
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
void *v2; // rbx
__int64 v3; // rdi
__int64 result; // rax
unsigned int v5; // er12
unsigned int v6; // ebx
unsigned int v7; // eax
__int64 v8; // rax

while ( 1 )
{
v2 = parser_start_g_operator;
v3 = (int)lex_get_s();
result = bits_belong(v3, v2);
if ( !(_DWORD)result )
break;
if ( (unsigned int)lex_get_s() == 700 )
{
func6(a1, 0LL);
}
else if ( (unsigned int)lex_get_s() == 505 )
{
func2(a1, 0LL);
}
else if ( (unsigned int)lex_get_s() == 1000 )
{
func1(a1, 0LL);
}
else
{
v5 = syn_c;
v6 = syn_line;
v7 = lex_get_s();
v8 = sym_get_sym(v7);
err_include(4LL, "unsupported operator:", v8, v6, v5);
}
}
return result;
}

original_code:
void *int_parse_g_operator (unsigned long *folls, unsigned long *ex)
{
    while (bits_belong(lex_get_s(), parser_start_g_operator))
    {
        if (lex_get_s() == L_BEGIN) {
            parse_complex_operator(folls, 0);
        } else if (lex_get_s() == L_FOR) {
            parse_for_operator(folls, 0);
        } else if (lex_get_s() == L_IDENT) {
            parse_assign_operator(folls, 0);
        } else {
            err_include(EFATAL, "unsupported operator:", sym_get_sym(lex_get_s()), syn_line, syn_c);
        }
    }
}

canonical_original_code:
void *int_parse_g_operator(unsigned long *folls, unsigned long *ex)
{
    while (bits_belong(lex_get_s(), parser_start_g_operator))
    {
        if (lex_get_s() == L_BEGIN) {
            parse_complex_operator(folls, 0);
        } else if (lex_get_s() == L_FOR) {
            parse_for_operator(folls, 0);
        } else if (lex_get_s() == L_IDENT) {
            parse_assign_operator(folls, 0);
        } else {
            err_include(EFATAL, "unsupported operator:", sym_get_sym(lex_get_s()), syn_line, syn_c);
        }
    }
}


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

if ( !parser_start_complex_operator )
parser_start_complex_operator = (void *)bits_from_array(&int_start_complex_operator);
if ( !parser_folls_complex_operator )
parser_folls_complex_operator = (void *)bits_from_array(&int_folls_complex_operator);
if ( !parser_start_g_operator )
parser_start_g_operator = (void *)bits_from_array(&int_start_g_operator);
if ( !parser_folls_g_operator )
parser_folls_g_operator = (void *)bits_from_array(&int_folls_g_operator);
if ( !parser_start_for_operator )
parser_start_for_operator = (void *)bits_from_array(&int_start_for_operator);
if ( !parser_folls_for_operator )
parser_folls_for_operator = (void *)bits_from_array(&int_folls_for_operator);
if ( !parser_start_assign_operator )
parser_start_assign_operator = (void *)bits_from_array(&int_start_assign_operator);
if ( !parser_folls_assign_operator )
parser_folls_assign_operator = (void *)bits_from_array(&int_folls_assign_operator);
bits_disjunct(parser_start_g_operator, parser_start_complex_operator, parser_start_g_operator);
bits_disjunct(parser_start_g_operator, parser_start_for_operator, parser_start_g_operator);
result = (void *)bits_disjunct(parser_start_g_operator, parser_start_assign_operator, parser_start_g_operator);
if ( !parser_complex_operator_aux )
{
result = (void *)bits_from_array(&int_complex_operator_aux);
parser_complex_operator_aux = result;
}
if ( !parser_assign_operator_aux )
{
result = (void *)bits_from_array(&int_assign_operator_aux);
parser_assign_operator_aux = result;
}
if ( !parser_for_operator_aux1 )
{
result = (void *)bits_from_array(&int_for_operator_aux1);
parser_for_operator_aux1 = result;
}
if ( !parser_for_operator_aux2 )
{
result = (void *)bits_from_array(&int_for_operator_aux2);
parser_for_operator_aux2 = result;
}
return result;
}

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

if ( !parser_start_complex_operator )
parser_start_complex_operator = (void *)bits_from_array(&int_start_complex_operator);
if ( !parser_folls_complex_operator )
parser_folls_complex_operator = (void *)bits_from_array(&int_folls_complex_operator);
if ( !parser_start_g_operator )
parser_start_g_operator = (void *)bits_from_array(&int_start_g_operator);
if ( !parser_folls_g_operator )
parser_folls_g_operator = (void *)bits_from_array(&int_folls_g_operator);
if ( !parser_start_for_operator )
parser_start_for_operator = (void *)bits_from_array(&int_start_for_operator);
if ( !parser_folls_for_operator )
parser_folls_for_operator = (void *)bits_from_array(&int_folls_for_operator);
if ( !parser_start_assign_operator )
parser_start_assign_operator = (void *)bits_from_array(&int_start_assign_operator);
if ( !parser_folls_assign_operator )
parser_folls_assign_operator = (void *)bits_from_array(&int_folls_assign_operator);
bits_disjunct(parser_start_g_operator, parser_start_complex_operator, parser_start_g_operator);
bits_disjunct(parser_start_g_operator, parser_start_for_operator, parser_start_g_operator);
result = (void *)bits_disjunct(parser_start_g_operator, parser_start_assign_operator, parser_start_g_operator);
if ( !parser_complex_operator_aux )
{
result = (void *)bits_from_array(&int_complex_operator_aux);
parser_complex_operator_aux = result;
}
if ( !parser_assign_operator_aux )
{
result = (void *)bits_from_array(&int_assign_operator_aux);
parser_assign_operator_aux = result;
}
if ( !parser_for_operator_aux1 )
{
result = (void *)bits_from_array(&int_for_operator_aux1);
parser_for_operator_aux1 = result;
}
if ( !parser_for_operator_aux2 )
{
result = (void *)bits_from_array(&int_for_operator_aux2);
parser_for_operator_aux2 = result;
}
return result;
}

original_code:
void init_parser_g_operator(void)
{
    { { if (parser_start_complex_operator == 0) parser_start_complex_operator = bits_from_array(int_start_complex_operator); }; { if (parser_folls_complex_operator == 0) parser_folls_complex_operator = bits_from_array(int_folls_complex_operator); }; };
    { { if (parser_start_g_operator == 0) parser_start_g_operator = bits_from_array(int_start_g_operator); }; { if (parser_folls_g_operator == 0) parser_folls_g_operator = bits_from_array(int_folls_g_operator); }; };
    { { if (parser_start_for_operator == 0) parser_start_for_operator = bits_from_array(int_start_for_operator); }; { if (parser_folls_for_operator == 0) parser_folls_for_operator = bits_from_array(int_folls_for_operator); }; };
    { { if (parser_start_assign_operator == 0) parser_start_assign_operator = bits_from_array(int_start_assign_operator); }; { if (parser_folls_assign_operator == 0) parser_folls_assign_operator = bits_from_array(int_folls_assign_operator); }; };
    { bits_disjunct(parser_start_g_operator, parser_start_complex_operator, parser_start_g_operator); };
    { bits_disjunct(parser_start_g_operator, parser_start_for_operator, parser_start_g_operator); };
    { bits_disjunct(parser_start_g_operator, parser_start_assign_operator, parser_start_g_operator); };
    { if (parser_complex_operator_aux == 0) parser_complex_operator_aux = bits_from_array(int_complex_operator_aux); };
    { if (parser_assign_operator_aux == 0) parser_assign_operator_aux = bits_from_array(int_assign_operator_aux); };
    { if (parser_for_operator_aux1 == 0) parser_for_operator_aux1 = bits_from_array(int_for_operator_aux1); };
    { if (parser_for_operator_aux2 == 0) parser_for_operator_aux2 = bits_from_array(int_for_operator_aux2); };
}

canonical_original_code:
void init_parser_g_operator()
{
    { { if (parser_start_complex_operator == 0) parser_start_complex_operator = bits_from_array(int_start_complex_operator); }; { if (parser_folls_complex_operator == 0) parser_folls_complex_operator = bits_from_array(int_folls_complex_operator); }; };
    { { if (parser_start_g_operator == 0) parser_start_g_operator = bits_from_array(int_start_g_operator); }; { if (parser_folls_g_operator == 0) parser_folls_g_operator = bits_from_array(int_folls_g_operator); }; };
    { { if (parser_start_for_operator == 0) parser_start_for_operator = bits_from_array(int_start_for_operator); }; { if (parser_folls_for_operator == 0) parser_folls_for_operator = bits_from_array(int_folls_for_operator); }; };
    { { if (parser_start_assign_operator == 0) parser_start_assign_operator = bits_from_array(int_start_assign_operator); }; { if (parser_folls_assign_operator == 0) parser_folls_assign_operator = bits_from_array(int_folls_assign_operator); }; };
    { bits_disjunct(parser_start_g_operator, parser_start_complex_operator, parser_start_g_operator); };
    { bits_disjunct(parser_start_g_operator, parser_start_for_operator, parser_start_g_operator); };
    { bits_disjunct(parser_start_g_operator, parser_start_assign_operator, parser_start_g_operator); };
    { if (parser_complex_operator_aux == 0) parser_complex_operator_aux = bits_from_array(int_complex_operator_aux); };
    { if (parser_assign_operator_aux == 0) parser_assign_operator_aux = bits_from_array(int_assign_operator_aux); };
    { if (parser_for_operator_aux1 == 0) parser_for_operator_aux1 = bits_from_array(int_for_operator_aux1); };
    { if (parser_for_operator_aux2 == 0) parser_for_operator_aux2 = bits_from_array(int_for_operator_aux2); };
}


decompiled_code:
void fini_parser_g_operator()
{
if ( parser_start_g_operator )
free(parser_start_g_operator);
if ( parser_folls_g_operator )
free(parser_folls_g_operator);
if ( parser_start_complex_operator )
free(parser_start_complex_operator);
if ( parser_folls_complex_operator )
free(parser_folls_complex_operator);
if ( parser_start_for_operator )
free(parser_start_for_operator);
if ( parser_folls_for_operator )
free(parser_folls_for_operator);
if ( parser_start_assign_operator )
free(parser_start_assign_operator);
if ( parser_folls_assign_operator )
free(parser_folls_assign_operator);
if ( parser_complex_operator_aux )
free(parser_complex_operator_aux);
if ( parser_assign_operator_aux )
free(parser_assign_operator_aux);
if ( parser_for_operator_aux1 )
free(parser_for_operator_aux1);
if ( parser_for_operator_aux2 )
free(parser_for_operator_aux2);
}

canonical_decompiled_code:
void func9()
{
if ( parser_start_g_operator )
free(parser_start_g_operator);
if ( parser_folls_g_operator )
free(parser_folls_g_operator);
if ( parser_start_complex_operator )
free(parser_start_complex_operator);
if ( parser_folls_complex_operator )
free(parser_folls_complex_operator);
if ( parser_start_for_operator )
free(parser_start_for_operator);
if ( parser_folls_for_operator )
free(parser_folls_for_operator);
if ( parser_start_assign_operator )
free(parser_start_assign_operator);
if ( parser_folls_assign_operator )
free(parser_folls_assign_operator);
if ( parser_complex_operator_aux )
free(parser_complex_operator_aux);
if ( parser_assign_operator_aux )
free(parser_assign_operator_aux);
if ( parser_for_operator_aux1 )
free(parser_for_operator_aux1);
if ( parser_for_operator_aux2 )
free(parser_for_operator_aux2);
}

original_code:
void fini_parser_g_operator(void)
{
    { { if (parser_start_g_operator != 0) free(parser_start_g_operator); }; { if (parser_folls_g_operator != 0) free(parser_folls_g_operator); }; };
    { { if (parser_start_complex_operator != 0) free(parser_start_complex_operator); }; { if (parser_folls_complex_operator != 0) free(parser_folls_complex_operator); }; };
    { { if (parser_start_for_operator != 0) free(parser_start_for_operator); }; { if (parser_folls_for_operator != 0) free(parser_folls_for_operator); }; };
    { { if (parser_start_assign_operator != 0) free(parser_start_assign_operator); }; { if (parser_folls_assign_operator != 0) free(parser_folls_assign_operator); }; };
    { if (parser_complex_operator_aux != 0) free(parser_complex_operator_aux); };
    { if (parser_assign_operator_aux != 0) free(parser_assign_operator_aux); };
    { if (parser_for_operator_aux1 != 0) free(parser_for_operator_aux1); };
    { if (parser_for_operator_aux2 != 0) free(parser_for_operator_aux2); };
}

canonical_original_code:
void fini_parser_g_operator()
{
    { { if (parser_start_g_operator != 0) free(parser_start_g_operator); }; { if (parser_folls_g_operator != 0) free(parser_folls_g_operator); }; };
    { { if (parser_start_complex_operator != 0) free(parser_start_complex_operator); }; { if (parser_folls_complex_operator != 0) free(parser_folls_complex_operator); }; };
    { { if (parser_start_for_operator != 0) free(parser_start_for_operator); }; { if (parser_folls_for_operator != 0) free(parser_folls_for_operator); }; };
    { { if (parser_start_assign_operator != 0) free(parser_start_assign_operator); }; { if (parser_folls_assign_operator != 0) free(parser_folls_assign_operator); }; };
    { if (parser_complex_operator_aux != 0) free(parser_complex_operator_aux); };
    { if (parser_assign_operator_aux != 0) free(parser_assign_operator_aux); };
    { if (parser_for_operator_aux1 != 0) free(parser_for_operator_aux1); };
    { if (parser_for_operator_aux2 != 0) free(parser_for_operator_aux2); };
}