decompiled_code:
__int64 __fastcall sx_merge(__int64 a1, __int64 a2)
{
__int64 v2; // rcx
__int64 result; // rax
__int64 v4; // rax
_DWORD *v5; // rax
__int64 v6; // rax
__int64 v7; // rax

v2 = 0LL;
result = 13LL;
if ( (a1 & 1) == 0 )
{
do
{
if ( *(_DWORD *)a1 != 6 )
break;
v5 = *(_DWORD **)(a1 + 8);
if ( ((unsigned __int8)v5 & 1) == 0 && (*v5 == 4 || *v5 == 5) )
{
v2 = str_set_add(v2, v5 + 1);
if ( *(_DWORD *)a1 != 6 )
break;
}
a1 = *(_QWORD *)(a1 + 16);
}
while ( (a1 & 1) == 0 );
if ( v2 )
{
if ( (a2 & 1) != 0 )
goto LABEL_8;
if ( *(_DWORD *)a2 == 4 )
{
v6 = str_merge(v2, (unsigned int)*(char *)(a2 + 4));
return make_string(v6);
}
if ( *(_DWORD *)a2 != 5 )
{
LABEL_8:
v4 = str_merge(v2, a2 >> 3);
return make_string(v4);
}
v7 = str_merge(v2, (unsigned int)*(char *)(a2 + 4));
result = make_symbol(v7);
}
else
{
result = 13LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
__int64 v2; // rcx
__int64 result; // rax
__int64 v4; // rax
_DWORD *v5; // rax
__int64 v6; // rax
__int64 v7; // rax

v2 = 0LL;
result = 13LL;
if ( (a1 & 1) == 0 )
{
do
{
if ( *(_DWORD *)a1 != 6 )
break;
v5 = *(_DWORD **)(a1 + 8);
if ( ((unsigned __int8)v5 & 1) == 0 && (*v5 == 4 || *v5 == 5) )
{
v2 = str_set_add(v2, v5 + 1);
if ( *(_DWORD *)a1 != 6 )
break;
}
a1 = *(_QWORD *)(a1 + 16);
}
while ( (a1 & 1) == 0 );
if ( v2 )
{
if ( (a2 & 1) != 0 )
goto LABEL_8;
if ( *(_DWORD *)a2 == 4 )
{
v6 = str_merge(v2, (unsigned int)*(char *)(a2 + 4));
return make_string(v6);
}
if ( *(_DWORD *)a2 != 5 )
{
LABEL_8:
v4 = str_merge(v2, a2 >> 3);
return make_string(v4);
}
v7 = str_merge(v2, (unsigned int)*(char *)(a2 + 4));
result = make_symbol(v7);
}
else
{
result = 13LL;
}
}
return result;
}

original_code:
sexpr sx_merge (sexpr set, sexpr glue)
{
    sexpr t;
    const char *s;
    char **sset = (char **)0;
    while ((((((int_pointer)(set)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)set))->type == sxt_cons)))
    {
        t = ((((((int_pointer)(set)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)set))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)set))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
        if ((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_string)))
        {
            sset = str_set_add (sset, (const char *)((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)t))->character_data) : "#nonexistent"));
        }
        else if ((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_symbol)))
        {
            sset = str_set_add (sset, (const char *)((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)t))->character_data) : "#nonexistent"));
        }
        set = ((((((int_pointer)(set)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)set))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)set))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
    }
    if (sset == (char **)0)
    {
        return ((sexpr)((((int_pointer)(1)) << 3) | 0x5));
    }
    if ((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_string)))
    {
        s = (const char *)((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)glue))->character_data) : "#nonexistent");
        return make_string (str_merge (sset, (int)(s[0])));
    }
    else if ((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_symbol)))
    {
        s = (const char *)((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)glue))->character_data) : "#nonexistent");
        return make_symbol (str_merge (sset, (int)(s[0])));
    }
    return make_string (str_merge (sset, ((int_pointer_s)(glue & (~0x7)) >> 3)));
}

canonical_original_code:
unsigned long sx_merge(unsigned long set, unsigned long glue)
{
    unsigned long t;
    char *s;
    char **sset = (char **)0;
    while ((((((int_pointer)(set)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)set))->type == sxt_cons)))
    {
        t = ((((((int_pointer)(set)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)set))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)set))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
        if ((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_string)))
        {
            sset = str_set_add (sset, (char *)((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)t))->character_data) : "#nonexistent"));
        }
        else if ((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_symbol)))
        {
            sset = str_set_add (sset, (char *)((((((int_pointer)(t)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)t))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)t))->character_data) : "#nonexistent"));
        }
        set = ((((((int_pointer)(set)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)set))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)set))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
    }
    if (sset == (char **)0)
    {
        return ((sexpr)((((int_pointer)(1)) << 3) | 0x5));
    }
    if ((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_string)))
    {
        s = (char *)((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)glue))->character_data) : "#nonexistent");
        return make_string (str_merge (sset, (int)(s[0])));
    }
    else if ((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_symbol)))
    {
        s = (char *)((((((int_pointer)(glue)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)glue))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)glue))->character_data) : "#nonexistent");
        return make_symbol (str_merge (sset, (int)(s[0])));
    }
    return make_string (str_merge (sset, ((int_pointer_s)(glue & (~0x7)) >> 3)));
}

variable_types:
set
unsigned long

variable_types:
glue
unsigned long

variable_types:
t
unsigned long

variable_types:
sset
char **


repo: kyuba/curie

original_code:
static sexpr sx_join_work (sexpr a, sexpr b, sexpr c, char *g)
{
    const char *s;
    int i = 0, j = 0;
    s = (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (const char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent") : (const char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent");
    for (j = 0; s[j]; j++) {
        g[i] = s[j];
        i++;
    }
    if ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) || (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (const char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent") : (const char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) {
            g[i] = s[j];
            i++;
        }
    }
    if ((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) || (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (const char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent") : (const char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) {
            g[i] = s[j];
            i++;
        }
    }
    g[i] = 0;
    return (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? make_string (g) : make_symbol (g);
}

canonical_original_code:
static unsigned long sx_join_work(unsigned long a, unsigned long b, unsigned long c, char *g)
{
    char *s;
    int i = 0; int j = 0;
    s = (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent") : (char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent");
    for (j = 0; s[j]; j++) {
        g[i] = s[j];
        i++;
    }
    if ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) || (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent") : (char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) {
            g[i] = s[j];
            i++;
        }
    }
    if ((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) || (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent") : (char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) {
            g[i] = s[j];
            i++;
        }
    }
    g[i] = 0;
    return (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? make_string (g) : make_symbol (g);
}

variable_types:
a
unsigned long

variable_types:
b
unsigned long

variable_types:
c
unsigned long

variable_types:
g
char *

variable_types:
s
char *

variable_types: i int

variable_types: j int

return_type: unsigned long

user_defined_types: struct sexpr_string_or_symbol { enum sx_type type; char character_data[]; }

user_defined_types: enum sx_type { sxt_string=4, sxt_symbol=5, sxt_cons=6, sxt_rational=20 }


equalp

decompiled_code:
__int64 __fastcall equalp(__int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned int v5; // edi
__int64 v6; // rbp
__int64 v7; // rdx
__int64 v8; // rsi
__int64 v9; // rdi
__int64 v10; // rax
__int64 (__fastcall *v11)(__int64, __int64); // rdx
char v12[32]; // [rsp+0h] [rbp-20h] BYREF

if ( a1 == a2 )
return 29LL;
result = 21LL;
if ( (((unsigned __int8)a2 | (unsigned __int8)a1) & 1) == 0 )
{
v5 = *(_DWORD *)a1;
if ( v5 == 4 )
{
if ( *(_DWORD *)a2 != 4 )
return result;
}
else
{
if ( v5 != 5 )
{
if ( v5 == 6 )
{
result = 21LL;
if ( *(_DWORD *)a2 == 6 )
{
v7 = equalp(*(_QWORD *)(a1 + 8), *(_QWORD *)(a2 + 8));
result = 21LL;
if ( v7 == 29 )
{
v8 = 69LL;
if ( *(_DWORD *)a2 == 6 )
v8 = *(_QWORD *)(a2 + 16);
v9 = 69LL;
if ( *(_DWORD *)a1 == 6 )
v9 = *(_QWORD *)(a1 + 16);
result = equalp(v9, v8);
if ( result != 29 )
result = 21LL;
}
}
}
else if ( v5 <= 0x7F )
{
result = 21LL;
}
else if ( v5 == *(_DWORD *)a2 && *(_DWORD *)a2 > 0x7Fu )
{
v10 = sx_get_descriptor();
if ( v10 )
{
v11 = *(__int64 (__fastcall **)(__int64, __int64))(v10 + 48);
result = 21LL;
if ( v11 )
result = v11(a1, a2);
}
else
{
result = 21LL;
}
}
else
{
result = 21LL;
}
return result;
}
result = 21LL;
if ( *(_DWORD *)a2 != 5 )
return result;
}
v6 = str_hash(a1 + 4, v12);
result = 8LL * (v6 == str_hash(a2 + 4, v12)) + 21;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned int v5; // edi
__int64 v6; // rbp
__int64 v7; // rdx
__int64 v8; // rsi
__int64 v9; // rdi
__int64 v10; // rax
__int64 (__fastcall *v11)(__int64, __int64); // rdx
char v12[32]; // [rsp+0h] [rbp-20h] BYREF

if ( a1 == a2 )
return 29LL;
result = 21LL;
if ( (((unsigned __int8)a2 | (unsigned __int8)a1) & 1) == 0 )
{
v5 = *(_DWORD *)a1;
if ( v5 == 4 )
{
if ( *(_DWORD *)a2 != 4 )
return result;
}
else
{
if ( v5 != 5 )
{
if ( v5 == 6 )
{
result = 21LL;
if ( *(_DWORD *)a2 == 6 )
{
v7 = func1(*(_QWORD *)(a1 + 8), *(_QWORD *)(a2 + 8));
result = 21LL;
if ( v7 == 29 )
{
v8 = 69LL;
if ( *(_DWORD *)a2 == 6 )
v8 = *(_QWORD *)(a2 + 16);
v9 = 69LL;
if ( *(_DWORD *)a1 == 6 )
v9 = *(_QWORD *)(a1 + 16);
result = func1(v9, v8);
if ( result != 29 )
result = 21LL;
}
}
}
else if ( v5 <= 0x7F )
{
result = 21LL;
}
else if ( v5 == *(_DWORD *)a2 && *(_DWORD *)a2 > 0x7Fu )
{
v10 = sx_get_descriptor();
if ( v10 )
{
v11 = *(__int64 (__fastcall **)(__int64, __int64))(v10 + 48);
result = 21LL;
if ( v11 )
result = v11(a1, a2);
}
else
{
result = 21LL;
}
}
else
{
result = 21LL;
}
return result;
}
result = 21LL;
if ( *(_DWORD *)a2 != 5 )
return result;
}
v6 = str_hash(a1 + 4, v12);
result = 8LL * (v6 == str_hash(a2 + 4, v12)) + 21;
}
return result;
}

original_code:
sexpr equalp (sexpr a, sexpr b)
{
    if (a == b) return ((sexpr)((((int_pointer)(3)) << 3) | 0x5));
    if (!((((int_pointer)(a)) & 0x1) == 0x0) || !((((int_pointer)(b)) & 0x1) == 0x0)) return ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
    if (((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string))) || ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol))))
    {
        struct sexpr_string_or_symbol
                *sa = (struct sexpr_string_or_symbol *)((void *)a),
                *sb = (struct sexpr_string_or_symbol *)((void *)b);
        unsigned long i;
        return (str_hash(sa->character_data, &i) ==
                str_hash(sb->character_data, &i))
                ? ((sexpr)((((int_pointer)(3)) << 3) | 0x5)) : ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
    }
    else if ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)a))->type == sxt_cons)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)b))->type == sxt_cons)))
    {
        return ((((sexpr)(equalp(((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)a))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)a))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))), ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)b))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)b))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))))) == ((sexpr)((((int_pointer)(3)) << 3) | 0x5))) &&
                 ((sexpr)(equalp(((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)a))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)a))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))), ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)b))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)b))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))))) == ((sexpr)((((int_pointer)(3)) << 3) | 0x5))))) ?
                ((sexpr)((((int_pointer)(3)) << 3) | 0x5)) : ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
    }
    else if ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)a))->type > 127)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)b))->type > 127)))
    {
        int type = ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)a))->type > 127)) ? (((struct sexpr_partial *)((void *)a))->type) : 0);
        if (type == ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)b))->type > 127)) ? (((struct sexpr_partial *)((void *)b))->type) : 0))
        {
            struct sexpr_type_descriptor *d = sx_get_descriptor (type);
            if ((d != (struct sexpr_type_descriptor *)0) &&
                (d->equalp != (void *)0))
            {
                return d->equalp (a, b);
            }
        }
    }
    return ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
}

canonical_original_code:
unsigned long equalp(unsigned long a, unsigned long b)
{
    if (a == b) return ((sexpr)((((int_pointer)(3)) << 3) | 0x5));
    if (!((((int_pointer)(a)) & 0x1) == 0x0) || !((((int_pointer)(b)) & 0x1) == 0x0)) return ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
    if (((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string))) || ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol))))
    {
        struct sexpr_string_or_symbol *sa = (struct sexpr_string_or_symbol *)((void *)a); struct sexpr_string_or_symbol *sb = (struct sexpr_string_or_symbol *)((void *)b);
        unsigned long i;
        return (str_hash(sa->character_data, &i) ==
                str_hash(sb->character_data, &i))
                ? ((sexpr)((((int_pointer)(3)) << 3) | 0x5)) : ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
    }
    else if ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)a))->type == sxt_cons)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)b))->type == sxt_cons)))
    {
        return ((((sexpr)(equalp(((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)a))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)a))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))), ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)b))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)b))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))))) == ((sexpr)((((int_pointer)(3)) << 3) | 0x5))) &&
                 ((sexpr)(equalp(((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)a))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)a))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))), ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)b))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)b))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5))))) == ((sexpr)((((int_pointer)(3)) << 3) | 0x5))))) ?
                ((sexpr)((((int_pointer)(3)) << 3) | 0x5)) : ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
    }
    else if ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)a))->type > 127)) && (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)b))->type > 127)))
    {
        int type = ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)a))->type > 127)) ? (((struct sexpr_partial *)((void *)a))->type) : 0);
        if (type == ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_partial *)((void *)b))->type > 127)) ? (((struct sexpr_partial *)((void *)b))->type) : 0))
        {
            struct sexpr_type_descriptor *d = sx_get_descriptor (type);
            if ((d != (struct sexpr_type_descriptor *)0) &&
                (d->equalp != (void *)0))
            {
                return d->equalp (a, b);
            }
        }
    }
    return ((sexpr)((((int_pointer)(2)) << 3) | 0x5));
}

variable_types: struct sexpr_string_or_symbol { enum sx_type { sxt_string=4, sxt_symbol=5, sxt_cons=6, sxt_rational=20 } type; char character_data[]; } *

variable_types:
i
unsigned long

variable_types: type int

variable_types: struct sexpr_type_descriptor { unsigned int type; unsigned long (*serialise)(unsigned long); unsigned long (*unserialise)(unsigned long); void (*tag)(unsigned long); void (*destroy)(unsigned long); void (*call)(); unsigned long (*equalp)(unsigned long, unsigned long); struct sexpr_type_descriptor *next; } *

user_defined_types: struct sexpr_cons { enum sx_type type; unsigned long car; unsigned long cdr; }

user_defined_types: struct sexpr_partial { unsigned int type; }


original_code:
sexpr sx_join (sexpr a, sexpr b, sexpr c)
{
    unsigned int j = 0, k = 0;
    const char *s;
    if (((((int_pointer)(a)) & 0x7) == 0x3))
    {
        a = sx_to_string (a);
    }
    if (((((int_pointer)(b)) & 0x7) == 0x3))
    {
        b = sx_to_string (b);
    }
    if (((((int_pointer)(c)) & 0x7) == 0x3))
    {
        c = sx_to_string (c);
    }
    if ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) || (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (const char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent") : (const char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) k++;
    }
    else
    {
        return ((sexpr)((((int_pointer)(1)) << 3) | 0x5));
    }
    if ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) || (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (const char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent") : (const char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) k++;
    }
    if ((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) || (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (const char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent") : (const char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) k++;
    }
    k++;
    if (k < 0x1000)
    {
        char buf[0x1000];
        return sx_join_work (a, b, c, buf);
    }
    else
    {
        char *g = get_mem (k);
        sexpr rv;
        rv = sx_join_work (a, b, c, g);
        free_mem (k, g);
        return rv;
    }
}

canonical_original_code:
unsigned long sx_join(unsigned long a, unsigned long b, unsigned long c)
{
    unsigned int j = 0; unsigned int k = 0;
    char *s;
    if (((((int_pointer)(a)) & 0x7) == 0x3))
    {
        a = sx_to_string (a);
    }
    if (((((int_pointer)(b)) & 0x7) == 0x3))
    {
        b = sx_to_string (b);
    }
    if (((((int_pointer)(c)) & 0x7) == 0x3))
    {
        c = sx_to_string (c);
    }
    if ((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) || (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent") : (char *)((((((int_pointer)(a)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)a))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)a))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) k++;
    }
    else
    {
        return ((sexpr)((((int_pointer)(1)) << 3) | 0x5));
    }
    if ((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) || (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent") : (char *)((((((int_pointer)(b)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)b))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)b))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) k++;
    }
    if ((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) || (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)))
    {
        s = (((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_string)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent") : (char *)((((((int_pointer)(c)) & 0x1) == 0x0) && (((struct sexpr_string_or_symbol *)((void *)c))->type == sxt_symbol)) ? (((struct sexpr_string_or_symbol *)((void *)c))->character_data) : "#nonexistent");
        for (j = 0; s[j]; j++) k++;
    }
    k++;
    if (k < 0x1000)
    {
        char buf[4096];
        return sx_join_work (a, b, c, buf);
    }
    else
    {
        char *g = get_mem (k);
        unsigned long rv;
        rv = sx_join_work (a, b, c, g);
        free_mem (k, g);
        return rv;
    }
}

variable_types:
j
unsigned int

variable_types:
k
unsigned int

variable_types:
buf
char [4096]

variable_types:
rv
unsigned long


original_code:
sexpr sx_reverse (sexpr sx)
{
    sexpr result = ((sexpr)((((int_pointer)(5)) << 3) | 0x5));
    sexpr reverse = sx;
    while ((((((int_pointer)(reverse)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)reverse))->type == sxt_cons))) {
        sexpr ncar = ((((((int_pointer)(reverse)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)reverse))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)reverse))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
        if (((sexpr)(ncar) == ((sexpr)((((int_pointer)(9)) << 3) | 0x5)))) {
            sexpr nresult = ((((((int_pointer)(result)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)result))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)result))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
            result = nresult;
        } else {
            result = cons(ncar, result);
        }
        reverse = ((((((int_pointer)(reverse)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)reverse))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)reverse))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
    }
    return result;
}

canonical_original_code:
unsigned long sx_reverse(unsigned long sx)
{
    unsigned long result = ((sexpr)((((int_pointer)(5)) << 3) | 0x5));
    unsigned long reverse = sx;
    while ((((((int_pointer)(reverse)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)reverse))->type == sxt_cons))) {
        unsigned long ncar = ((((((int_pointer)(reverse)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)reverse))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)reverse))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
        if (((sexpr)(ncar) == ((sexpr)((((int_pointer)(9)) << 3) | 0x5)))) {
            unsigned long nresult = ((((((int_pointer)(result)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)result))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)result))->car) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
            result = nresult;
        } else {
            result = cons(ncar, result);
        }
        reverse = ((((((int_pointer)(reverse)) & 0x1) == 0x0) && (((struct sexpr_cons *)((void *)reverse))->type == sxt_cons)) ? (((struct sexpr_cons *)((void *)reverse))->cdr) : ((sexpr)((((int_pointer)(8)) << 3) | 0x5)));
    }
    return result;
}

variable_types:
sx
unsigned long

variable_types:
result
unsigned long

variable_types:
reverse
unsigned long

variable_types:
ncar
unsigned long

variable_types:
nresult
unsigned long


getInput

repo: kzaklova/FIT

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

result = __isoc99_scanf();
if ( !(_DWORD)result )
{
result = __isoc99_scanf();
*a1 = 0x7FF8000000000000LL;
}
return result;
}

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

result = __isoc99_scanf();
if ( !(_DWORD)result )
{
result = __isoc99_scanf();
*a1 = 0x7FF8000000000000LL;
}
return result;
}

original_code:
double getInput (double *x)
{
 int getin;
 getin = scanf ("%lf", x);
 if (getin == 0)
 {
  scanf ("%*s");
  *x = (__builtin_nanf (""));
  return *x;
 }
 if (getin != (-1))
 {
  if(getin == 0)
  {
   scanf ("%*s");
   *x = (__builtin_nanf (""));
   return *x;
  }
 }
 else if(getin == (-1)) return getin;
 return 0;
}

canonical_original_code:
double getInput(double *x)
{
 int getin;
 getin = scanf ("%lf", x);
 if (getin == 0)
 {
  scanf ("%*s");
  *x = (__builtin_nanf (""));
  return *x;
 }
 if (getin != (-1))
 {
  if(getin == 0)
  {
   scanf ("%*s");
   *x = (__builtin_nanf (""));
   return *x;
  }
 }
 else if(getin == (-1)) return getin;
 return 0;
}

variable_types:
x
double *

variable_types: getin int

return_type: double


logar

original_code:
double logar (double x, double eps)
{
 double res = 0;
 if (x < 0)
 {
  res = (__builtin_nanf (""));
  return res;
 }
 if (x == 0)
 {
  res = -(__builtin_inff ());
  return res;
 }
 if (x == (__builtin_inff ()))
 {
  res = (__builtin_inff ());
  return res;
 }
 double hb = 1.5;
 double lb = 0.5;
 double av = 0;
 if (x > hb)
 {
  while (x > hb)
  {
   x /= hb;
   av += logar (hb, eps);
  }
 }
 if (x < lb)
 {
  while (x < lb)
  {
   x /= lb;
   av += logar (lb, eps);
  }
 }
 double k = 1;
 double item_ln = 1;
 double sum_ln = item_ln;
 double t = (x - 1) / (x + 1);
 double pw = t * t;
 while (fabs (item_ln) >= eps*fabs (sum_ln))
 {
  k += 2;
  item_ln = item_ln * (pw * (k - 2) / k);
  sum_ln += item_ln;
 }
 sum_ln = 2 * t * sum_ln;
 sum_ln = sum_ln + av;
 res = sum_ln;
 return res;
}

canonical_original_code:
double logar(double x, double eps)
{
 double res = 0;
 if (x < 0)
 {
  res = (__builtin_nanf (""));
  return res;
 }
 if (x == 0)
 {
  res = -(__builtin_inff ());
  return res;
 }
 if (x == (__builtin_inff ()))
 {
  res = (__builtin_inff ());
  return res;
 }
 double hb = 1.5;
 double lb = 0.5;
 double av = 0;
 if (x > hb)
 {
  while (x > hb)
  {
   x /= hb;
   av += logar (hb, eps);
  }
 }
 if (x < lb)
 {
  while (x < lb)
  {
   x /= lb;
   av += logar (lb, eps);
  }
 }
 double k = 1;
 double item_ln = 1;
 double sum_ln = item_ln;
 double t = (x - 1) / (x + 1);
 double pw = t * t;
 while (fabs (item_ln) >= eps*fabs (sum_ln))
 {
  k += 2;
  item_ln = item_ln * (pw * (k - 2) / k);
  sum_ln += item_ln;
 }
 sum_ln = 2 * t * sum_ln;
 sum_ln = sum_ln + av;
 res = sum_ln;
 return res;
}

variable_types: x double

variable_types: eps double

variable_types: res double

variable_types: hb double

variable_types: lb double

variable_types: av double

variable_types: k double

variable_types: t double

variable_types: pw double


arsin

original_code:
double arsin(double x, double eps)
{
 double res = 0;
 int sq = 0;
 int one = 0;
 int neg = 0;
 if (x < 0)
 {
  x = fabs(x);
  neg = 1;
 }
 if (x > 1)
 {
  res = (__builtin_nanf (""));
  return res;
 }
 x = x / sqrt((1 - x) * (1 + x));
 if (x > 1)
 {
  x = 1 / x;
  one = 1;
 }
 if(x > (2 - sqrt(3)) && x <= 1)
 {
  sq = 1;
  x = ((sqrt(3) * x - 1) / (sqrt(3) + x));
 }
 double i = 1;
 double item_as = x;
 double pw = x * x;
 double sum_as = item_as;
 double prev_as = 0;
 while (fabs (prev_as - sum_as) >= eps)
 {
  i += 2;
  item_as = (-item_as * pw * (i - 2)) / i;
  prev_as = sum_as;
  sum_as += item_as;
 }
 if (sq == 1) sum_as = IZP_PI_6 + sum_as;
 if (one == 1) sum_as = IZP_PI_2 - sum_as;
 res = sum_as;
 if (neg == 1) res = -(res);
 if (res == -0) res = 0;
 return res;
}

variable_types: sq int

variable_types: one int

variable_types: neg int

variable_types: i double


countLbe

original_code:
void countLbe (TPrev *prev, TNext *next, TRes *res, double err)
{
 double w, h, wmin, hmin, wmax, hmax, tmp1, tmp2;
 tmp1 = 0, tmp2 = 0;
 w = fabs(next->x - prev->x);
 h = fabs(next->y - prev->y);
 wmin = w - 2*err;
 hmin = h - 2*err;
 wmax = w + 2*err;
 hmax = h + 2*err;
 if (w == 0 && h == 0) tmp1 = 0;
 else if (w == 0 && h != 0) tmp1 = hmin;
 else if (w != 0 && h == 0) tmp1 = wmin;
 else tmp1 = sqrt((wmin*wmin) + (hmin*hmin));
 if (wmin < 0 && hmin < 0) tmp1 = 0;
 res->res1 = res->res1 + tmp1;
 if (w == 0 && h == 0) tmp2 = 0;
 else tmp2 = sqrt((wmax*wmax) + (hmax*hmax));
 res->res2 = res->res2 + tmp2;
 prev->x = next->x;
 prev->y = next->y;
}

canonical_original_code:
void countLbe(struct prev *prev, struct next *next, struct result *res, double err)
{
 double w; double h; double wmin; double hmin; double wmax; double hmax; double tmp1; double tmp2;
 tmp1 = 0, tmp2 = 0;
 w = fabs(next->x - prev->x);
 h = fabs(next->y - prev->y);
 wmin = w - 2*err;
 hmin = h - 2*err;
 wmax = w + 2*err;
 hmax = h + 2*err;
 if (w == 0 && h == 0) tmp1 = 0;
 else if (w == 0 && h != 0) tmp1 = hmin;
 else if (w != 0 && h == 0) tmp1 = wmin;
 else tmp1 = sqrt((wmin*wmin) + (hmin*hmin));
 if (wmin < 0 && hmin < 0) tmp1 = 0;
 res->res1 = res->res1 + tmp1;
 if (w == 0 && h == 0) tmp2 = 0;
 else tmp2 = sqrt((wmax*wmax) + (hmax*hmax));
 res->res2 = res->res2 + tmp2;
 prev->x = next->x;
 prev->y = next->y;
}

variable_types:
prev
struct prev { double x; } *

variable_types:
next
struct next { double x; } *

variable_types: struct result { double res1; double res2; } *

variable_types: err double

variable_types: w double

variable_types: h double

variable_types: wmin double

variable_types: hmin double

variable_types: wmax double

variable_types: hmax double

return_type: void


power

decompiled_code:
__int64 __fastcall power(double a1, double a2)
{
double v3; // xmm0_8
__int64 result; // rax

if ( a2 == 0.0 )
a1 = 1.0;
v3 = a1;
result = 2LL;
if ( a2 >= 2.0 )
{
do
{
v3 = v3 * a1;
result = (unsigned int)(result + 1);
}
while ( a2 >= (double)(int)result );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(double a1, double a2)
{
double v3; // xmm0_8
__int64 result; // rax

if ( a2 == 0.0 )
a1 = 1.0;
v3 = a1;
result = 2LL;
if ( a2 >= 2.0 )
{
do
{
v3 = v3 * a1;
result = (unsigned int)(result + 1);
}
while ( a2 >= (double)(int)result );
}
return result;
}

original_code:
double power (double x, double y)
{
 int i;
 double j;
 if (y == 0) x = 1;
 j = x;
 for (i = 2; i <= y; i++)
 {
  x = x*j;
 }
 return x;
}

canonical_original_code:
double power(double x, double y)
{
 int i;
 double j;
 if (y == 0) x = 1;
 j = x;
 for (i = 2; i <= y; i++)
 {
  x = x*j;
 }
 return x;
}

variable_types: x double

variable_types: y double

variable_types: i int

variable_types: j double


printECode

decompiled_code:
int __fastcall printECode(unsigned int a1)
{
if ( a1 >= 6 )
a1 = 6;
return fputs((&ECODEMSG)[a1], stderr);
}

canonical_decompiled_code:
int __fastcall func7(unsigned int a1)
{
if ( a1 >= 6 )
a1 = 6;
return fputs((&ECODEMSG)[a1], stderr);
}

original_code:
void printECode(int ecode)
{
 if (ecode < EOK || ecode > EER)
 { ecode = EUNKNOWN; }
 fprintf(stderr, "%s", ECODEMSG[ecode]);
}

variable_types: ecode int


getParams

original_code:
TParams getParams(int argc, char *argv[])
{
 TParams result =
 {
  .sigdig = 0,
  .a = 0,
  .err = 0,
  .ecode = EOK,
  .state = CLBL,
 };
 if (argc == 1) result.ecode = EHELP;
 if (argc == 2)
 {
  if (strcmp ("-h", argv[1]) == 0) result.state = CHELP;
  else if (strcmp ("--lbl", argv[1]) == 0) result.state = CLBL;
  else result.ecode = EHELP;
 }
 else if (argc == 3 && strcmp ("--lble", argv[1]) == 0 )
 {
  char *pAux;
  result.err = strtod((argv[2]), &pAux);
  if (*pAux != '\0' || (result.err < 0) || (result.err > ((double)1.79769313486231570814527423731704357e+308L))) result.ecode = EER;
  else result.state = CLBE;
 }
 else if ((argc == 3 && strcmp ("--lble", argv[1]) != 0)|| argc == 4)
 {
  char *pAux2;
  result.sigdig = strtol((argv[2]), &pAux2, 10);
  if (*pAux2 != '\0' || (result.sigdig < 1) || (result.sigdig > 15)) result.ecode = ESIG;
  else result.ecode = EOK;
  if (argc == 3 && strcmp ("--arcsin", argv [1]) == 0) result.state = CARS;
  else if (argc == 4 && strcmp ("--logax", argv [1]) == 0)
  {
   char *pAux3;
   result.a = strtod((argv[3]), &pAux3);
   if (*pAux2 != '\0' || result.a <= 0 || result.a == 1) result.ecode = ELOG;
   else result.state = CLOG;
   }
  else result.ecode = EHELP;
 }
 else result.ecode = ECLWRONG;
 return result;
}

canonical_original_code:
struct params getParams(int argc, char *argv[])
{
 struct params result = {
  .sigdig = 0,
  .a = 0,
  .err = 0,
  .ecode = EOK,
  .state = CLBL,
 };
 if (argc == 1) result.ecode = EHELP;
 if (argc == 2)
 {
  if (strcmp ("-h", argv[1]) == 0) result.state = CHELP;
  else if (strcmp ("--lbl", argv[1]) == 0) result.state = CLBL;
  else result.ecode = EHELP;
 }
 else if (argc == 3 && strcmp ("--lble", argv[1]) == 0 )
 {
  char *pAux;
  result.err = strtod((argv[2]), &pAux);
  if (*pAux != '\0' || (result.err < 0) || (result.err > ((double)1.79769313486231570814527423731704357e+308L))) result.ecode = EER;
  else result.state = CLBE;
 }
 else if ((argc == 3 && strcmp ("--lble", argv[1]) != 0)|| argc == 4)
 {
  char *pAux2;
  result.sigdig = strtol((argv[2]), &pAux2, 10);
  if (*pAux2 != '\0' || (result.sigdig < 1) || (result.sigdig > 15)) result.ecode = ESIG;
  else result.ecode = EOK;
  if (argc == 3 && strcmp ("--arcsin", argv [1]) == 0) result.state = CARS;
  else if (argc == 4 && strcmp ("--logax", argv [1]) == 0)
  {
   char *pAux3;
   result.a = strtod((argv[3]), &pAux3);
   if (*pAux2 != '\0' || result.a <= 0 || result.a == 1) result.ecode = ELOG;
   else result.state = CLOG;
   }
  else result.ecode = EHELP;
 }
 else result.ecode = ECLWRONG;
 return result;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: struct params { unsigned int sigdig; double a; double err; int ecode; int state; }

variable_types:
pAux
char *


main

canonical_name: main

original_code:
int main(int argc, char *argv[])
{
 TParams params = getParams(argc, argv);
 if (params.ecode != EOK)
 {
  printECode(params.ecode);
  return 1;
 }
 if (params.state == CHELP)
 {
  printf("%s", HELPMSG);
  return 0;
 }
 TPrev prev;
 prev.x = 0;
 prev.y = 0;
 TNext next;
 next.x = 0;
 next.y = 0;
 TRes res;
 res.res1 = 0;
 res.res2 = 0;
 int ecode = EOK;
 double eps = 0;
 double x = 0.1;
 double fakeerr = 0;
 double aux = 0;
 if(params.state == CLBL || params.state == CLBE)
 {
  getInput(&prev.x);
  getInput(&prev.y);
  if (__builtin_isnan (prev.x) || __builtin_isnan (prev.y)) printf ("%.10e\n", (__builtin_nanf ("")));
  else printf("%.10e\n", res.res1);
  if (params.state == CLBE)
  {
   if (__builtin_isnan (prev.x) || __builtin_isnan (prev.y)) printf ("%.10e\n", (__builtin_nanf ("")));
   else printf("%.10e\n", res.res1);
  }
  while (getInput(&next.x) != (-1))
  {
   aux = getInput(&next.y);
   if (aux == (-1)) next.y = (__builtin_nanf (""));
   if (params.state == CLBL)
   {
    countLbe(&prev, &next, &res, fakeerr);
    printf("%.10e\n", res.res1);
   }
   else if (params.state == CLBE)
   {
    countLbe(&prev, &next, &res, params.err);
    printf("%.10e\n", res.res1);
    printf("%.10e\n", res.res2);
   }
  }
 }
 else if(params.state == CARS || params.state == CLOG)
 {
  eps = power(x,(params.sigdig + 1));
  while(getInput(&prev.x) != (-1))
  {
   if(params.state == CLOG)
   {
    next.x = params.a;
    printf ("%.10e\n", (logar(prev.x, eps)/logar(next.x, eps)));
   }
   else if(params.state == CARS)
   {
    printf("%.10e\n", arsin(prev.x, eps));
   }
  }
 }
 if (ecode != EOK)
 {
  printECode(ecode);
  return 1;
 }
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 struct params params = getParams(argc, argv);
 if (params.ecode != EOK)
 {
  printECode(params.ecode);
  return 1;
 }
 if (params.state == CHELP)
 {
  printf("%s", HELPMSG);
  return 0;
 }
 struct prev prev;
 prev.x = 0;
 prev.y = 0;
 struct next next;
 next.x = 0;
 next.y = 0;
 struct result res;
 res.res1 = 0;
 res.res2 = 0;
 int ecode = EOK;
 double eps = 0;
 double x = 0.1;
 double fakeerr = 0;
 double aux = 0;
 if(params.state == CLBL || params.state == CLBE)
 {
  getInput(&prev.x);
  getInput(&prev.y);
  if (__builtin_isnan (prev.x) || __builtin_isnan (prev.y)) printf ("%.10e\n", (__builtin_nanf ("")));
  else printf("%.10e\n", res.res1);
  if (params.state == CLBE)
  {
   if (__builtin_isnan (prev.x) || __builtin_isnan (prev.y)) printf ("%.10e\n", (__builtin_nanf ("")));
   else printf("%.10e\n", res.res1);
  }
  while (getInput(&next.x) != (-1))
  {
   aux = getInput(&next.y);
   if (aux == (-1)) next.y = (__builtin_nanf (""));
   if (params.state == CLBL)
   {
    countLbe(&prev, &next, &res, fakeerr);
    printf("%.10e\n", res.res1);
   }
   else if (params.state == CLBE)
   {
    countLbe(&prev, &next, &res, params.err);
    printf("%.10e\n", res.res1);
    printf("%.10e\n", res.res2);
   }
  }
 }
 else if(params.state == CARS || params.state == CLOG)
 {
  eps = power(x,(params.sigdig + 1));
  while(getInput(&prev.x) != (-1))
  {
   if(params.state == CLOG)
   {
    next.x = params.a;
    printf ("%.10e\n", (logar(prev.x, eps)/logar(next.x, eps)));
   }
   else if(params.state == CARS)
   {
    printf("%.10e\n", arsin(prev.x, eps));
   }
  }
 }
 if (ecode != EOK)
 {
  printECode(ecode);
  return 1;
 }
 return 0;
}

variable_types:
prev
struct prev { double x; }

variable_types:
next
struct next { double x; }

variable_types: struct result { double res1; double res2; }

variable_types: eps double

variable_types: fakeerr double

variable_types: aux double

return_type: int

user_defined_types: struct params { unsigned int sigdig; double a; double err; int ecode; int state; }


MakeInst

decompiled_code:
__int64 __fastcall MakeInst(int a1, __int64 a2, __int64 a3, __int64 a4, int a5)
{
void *v8; // rax
__int64 v9; // rbx
unsigned int v10; // ebx
__int64 v11; // rbp
_QWORD *v12; // rbx
void *v13; // rax
int v14; // ebx
int v15; // ecx
__int64 v16; // rax
unsigned __int64 v17; // rcx
_QWORD *v18; // rdx
__int64 i; // rax
_QWORD *v20; // rdx
__int64 v22[8]; // [rsp+8h] [rbp-40h] BYREF

v8 = malloc(0x20uLL);
if ( !v8 )
goto LABEL_14;
v9 = (__int64)v8;
InstCreate((__int64)v8, a1, a2, a3, a4);
InsertLast(InstList, v9);
v10 = ErrorFlag;
if ( ErrorFlag )
return 1;
if ( a1 != 34 )
{
if ( a1 == 38 )
{
v22[0] = 0LL;
if ( (unsigned int)getVarTree(v22, STable, control[1]) == 9
|| (unsigned int)CopyTree(v22[0], (char *)funcArray + 24 * a5 - 16) == 9 )
{
AddError(0LL, 5LL);
v10 = 9;
}
}
return v10;
}
if ( !funcArray )
{
funcArray = malloc(0x1E0uLL);
if ( funcArray )
{
for ( i = 0LL; i != 480; i += 24LL )
{
v20 = (char *)funcArray + i;
v20[2] = 0LL;
*v20 = 0LL;
*(_QWORD *)((char *)funcArray + i + 8) = 0LL;
}
goto LABEL_11;
}
LABEL_14:
AddError(line, 5LL);
return 1;
}
if ( a5 == 20 * (a5 / 20) )
{
v14 = a5 / 20;
if ( realloc(funcArray, 960LL * (a5 / 20)) )
{
v15 = 20 * v14;
if ( 20 * v14 < 40 * v14 )
{
v16 = 24LL * v15;
v17 = 24 * (v15 + 1 + (unsigned __int64)(unsigned int)(40 * v14 - 1 - v15));
do
{
v18 = (char *)funcArray + v16;
v18[2] = 0LL;
*v18 = 0LL;
*(_QWORD *)((char *)funcArray + v16 + 8) = 0LL;
v16 += 24LL;
}
while ( v16 != v17 );
}
goto LABEL_11;
}
goto LABEL_14;
}
LABEL_11:
v11 = 24LL * a5;
v12 = (char *)funcArray + v11 - 24;
v12[2] = InstList[1];
v13 = malloc(0x10uLL);
*v12 = v13;
if ( !v13 )
goto LABEL_14;
v10 = strInit(*(_QWORD *)((char *)funcArray + v11 - 24));
if ( v10 == 1 )
{
AddError(line, 5LL);
return v10;
}
v10 = strCopyString(*(_QWORD *)((char *)funcArray + v11 - 24), a2);
if ( v10 )
goto LABEL_14;
return v10;
}

canonical_decompiled_code:
__int64 __fastcall func5(int a1, __int64 a2, __int64 a3, __int64 a4, int a5)
{
void *v8; // rax
__int64 v9; // rbx
unsigned int v10; // ebx
__int64 v11; // rbp
_QWORD *v12; // rbx
void *v13; // rax
int v14; // ebx
int v15; // ecx
__int64 v16; // rax
unsigned __int64 v17; // rcx
_QWORD *v18; // rdx
__int64 i; // rax
_QWORD *v20; // rdx
__int64 v22[8]; // [rsp+8h] [rbp-40h] BYREF

v8 = malloc(0x20uLL);
if ( !v8 )
goto LABEL_14;
v9 = (__int64)v8;
func0((__int64)v8, a1, a2, a3, a4);
func4(InstList, v9);
v10 = ErrorFlag;
if ( ErrorFlag )
return 1;
if ( a1 != 34 )
{
if ( a1 == 38 )
{
v22[0] = 0LL;
if ( (unsigned int)getVarTree(v22, STable, control[1]) == 9
|| (unsigned int)CopyTree(v22[0], (char *)funcArray + 24 * a5 - 16) == 9 )
{
AddError(0LL, 5LL);
v10 = 9;
}
}
return v10;
}
if ( !funcArray )
{
funcArray = malloc(0x1E0uLL);
if ( funcArray )
{
for ( i = 0LL; i != 480; i += 24LL )
{
v20 = (char *)funcArray + i;
v20[2] = 0LL;
*v20 = 0LL;
*(_QWORD *)((char *)funcArray + i + 8) = 0LL;
}
goto LABEL_11;
}
LABEL_14:
AddError(line, 5LL);
return 1;
}
if ( a5 == 20 * (a5 / 20) )
{
v14 = a5 / 20;
if ( realloc(funcArray, 960LL * (a5 / 20)) )
{
v15 = 20 * v14;
if ( 20 * v14 < 40 * v14 )
{
v16 = 24LL * v15;
v17 = 24 * (v15 + 1 + (unsigned __int64)(unsigned int)(40 * v14 - 1 - v15));
do
{
v18 = (char *)funcArray + v16;
v18[2] = 0LL;
*v18 = 0LL;
*(_QWORD *)((char *)funcArray + v16 + 8) = 0LL;
v16 += 24LL;
}
while ( v16 != v17 );
}
goto LABEL_11;
}
goto LABEL_14;
}
LABEL_11:
v11 = 24LL * a5;
v12 = (char *)funcArray + v11 - 24;
v12[2] = InstList[1];
v13 = malloc(0x10uLL);
*v12 = v13;
if ( !v13 )
goto LABEL_14;
v10 = strInit(*(_QWORD *)((char *)funcArray + v11 - 24));
if ( v10 == 1 )
{
AddError(line, 5LL);
return v10;
}
v10 = strCopyString(*(_QWORD *)((char *)funcArray + v11 - 24), a2);
if ( v10 )
goto LABEL_14;
return v10;
}

original_code:
int MakeInst(int type, void *addr1, void *addr2, void *addr3, int FuncCounter)
{
tInst *p_new_inst;
if((p_new_inst=malloc(sizeof(tInst))) == ((void *)0))
  {
  AddError(line, 5);
  return 1;
  }
*p_new_inst= InstCreate(type, addr1,addr2,addr3);
InsertLast(&InstList,p_new_inst);
if(ErrorFlag != 0) return 1;
if(type == 34)
  {
  if(funcArray != ((void *)0))
    {
    if((FuncCounter % 20) == 0)
      {
      tFunc *p_temp= ((void *)0);
      int pocet = FuncCounter / 20;
      if((p_temp=realloc(funcArray, (sizeof(tFunc) * 20 * (pocet*2)))) == ((void *)0))
        {
        AddError(line, 5);
        return 1;
        }
      for(int i = (pocet * 20);(i < (pocet * 2 * 20)); i++)
        {
        funcArray[i].function =((void *)0);
        funcArray[i].identif = ((void *)0);
        funcArray[i].VarTree = ((void *)0);
        }
      }
    }
  else
    {
    if((funcArray = malloc(sizeof(tFunc) * 20)) == ((void *)0))
      {
      AddError(line, 5);
      return 1;
      }
    for(int i=0;i<20;i++)
      {
      funcArray[i].function =((void *)0);
      funcArray[i].identif = ((void *)0);
      funcArray[i].VarTree = ((void *)0);
      }
    }
    funcArray[FuncCounter-1].function= InstList.Last;
    if((funcArray[FuncCounter-1].identif= malloc(sizeof(string))) == ((void *)0))
      {
      AddError(line, 5);
      return 1;
      }
    if(strInit(funcArray[FuncCounter-1].identif) == 1)
      {
      AddError(line, 5);
      return 1;
      }
    if(strCopyString(funcArray[FuncCounter-1].identif , (string *)addr1))
      {
      AddError(line, 5);
      return 1;
      }
  }
 if(type == 38)
  {
  tVarTreeItem **p_var_help = ((void *)0);
  if((getVarTree(&(p_var_help), &(*STable), control.function )) == 9)
    {
    AddError(0, 5);
    return 9;
    }
  if((CopyTree(p_var_help, &(funcArray[FuncCounter-1].VarTree)) == 9))
    {
    AddError(0, 5);
    return 9;
    }
  }
return 0;
}

canonical_original_code:
int MakeInst(int type, void *addr1, void *addr2, void *addr3, int FuncCounter)
{
struct tInst *p_new_inst;
if((p_new_inst=malloc(sizeof(tInst))) == ((void *)0))
  {
  AddError(line, 5);
  return 1;
  }
*p_new_inst= InstCreate(type, addr1,addr2,addr3);
InsertLast(&InstList,p_new_inst);
if(ErrorFlag != 0) return 1;
if(type == 34)
  {
  if(funcArray != ((void *)0))
    {
    if((FuncCounter % 20) == 0)
      {
      struct tFunc *p_temp = ((void *)0);
      int pocet = FuncCounter / 20;
      if((p_temp=realloc(funcArray, (sizeof(tFunc) * 20 * (pocet*2)))) == ((void *)0))
        {
        AddError(line, 5);
        return 1;
        }
      for(int i = (pocet * 20);(i < (pocet * 2 * 20)); i++)
        {
        funcArray[i].function =((void *)0);
        funcArray[i].identif = ((void *)0);
        funcArray[i].VarTree = ((void *)0);
        }
      }
    }
  else
    {
    if((funcArray = malloc(sizeof(tFunc) * 20)) == ((void *)0))
      {
      AddError(line, 5);
      return 1;
      }
    for(int i = 0;i<20;i++)
      {
      funcArray[i].function =((void *)0);
      funcArray[i].identif = ((void *)0);
      funcArray[i].VarTree = ((void *)0);
      }
    }
    funcArray[FuncCounter-1].function= InstList.Last;
    if((funcArray[FuncCounter-1].identif= malloc(sizeof(string))) == ((void *)0))
      {
      AddError(line, 5);
      return 1;
      }
    if(strInit(funcArray[FuncCounter-1].identif) == 1)
      {
      AddError(line, 5);
      return 1;
      }
    if(strCopyString(funcArray[FuncCounter-1].identif , (struct string *)addr1))
      {
      AddError(line, 5);
      return 1;
      }
  }
 if(type == 38)
  {
  struct VarTreeItem **p_var_help = ((void *)0);
  if((getVarTree(&(p_var_help), &(*STable), control.function )) == 9)
    {
    AddError(0, 5);
    return 9;
    }
  if((CopyTree(p_var_help, &(funcArray[FuncCounter-1].VarTree)) == 9))
    {
    AddError(0, 5);
    return 9;
    }
  }
return 0;
}

variable_types: type int

variable_types: FuncCounter int

variable_types: struct tFunc { struct string { char *str; int length; int allocSize; } *identif; struct VarTreeItem { struct string *key; struct varValue { int type; int integer; double real; struct string *stringVar; _Bool boolean; } *data; struct VarTreeItem *LeftRoot; struct VarTreeItem *RightRoot; } *VarTree; struct polozkaList { int line_number; struct tInst { int action; void *addr1; void *addr2; void *addr3; } *data; struct polozkaList *next; } *function; } *

variable_types: pocet int

variable_types: struct VarTreeItem { struct string { char *str; int length; int allocSize; } *key; struct varValue { int type; int integer; double real; struct string *stringVar; _Bool boolean; } *data; struct VarTreeItem *LeftRoot; struct VarTreeItem *RightRoot; } **

user_defined_types: struct tFunc { struct string *identif; struct VarTreeItem *VarTree; struct polozkaList *function; }

user_defined_types: struct VarTreeItem { struct string *key; struct varValue *data; struct VarTreeItem *LeftRoot; struct VarTreeItem *RightRoot; }

user_defined_types: struct polozkaList { int line_number; struct tInst *data; struct polozkaList *next; }


CopyFirst

original_code:
void CopyFirst (tInstList *L, tInst *new_instr)
{
  if(L->First != ((void *)0))
    {
    new_instr->action = L->First->data->action;
    new_instr->addr1 = L->First->data->addr1;
    new_instr->addr2 = L->First->data->addr2;
    new_instr->addr3 = L->First->data->addr3;
    }
  return;
}

canonical_original_code:
void CopyFirst(struct tInstList *L, struct tInst *new_instr)
{
  if(L->First != ((void *)0))
    {
    new_instr->action = L->First->data->action;
    new_instr->addr1 = L->First->data->addr1;
    new_instr->addr2 = L->First->data->addr2;
    new_instr->addr3 = L->First->data->addr3;
    }
  return;
}

variable_types: struct tInstList { struct polozkaList { int line_number; struct tInst { int action; void *addr1; void *addr2; void *addr3; } *data; struct polozkaList *next; } *First; struct polozkaList *Last; struct polozkaList *Active; } *

user_defined_types: struct tInstList { struct polozkaList *First; struct polozkaList *Last; struct polozkaList *Active; }


Copy

decompiled_code:
void Copy()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

original_code:
void Copy (tInstList *L, tInst *new_instr)
{
 if(L->Active == ((void *)0))
   {
   }
 else new_instr = L->Active->data;
 return;
}

canonical_original_code:
void Copy(struct tInstList *L, struct tInst *new_instr)
{
 if(L->Active == ((void *)0))
   {
   }
 else new_instr = L->Active->data;
 return;
}

user_defined_types: struct tInst { int action; void *addr1; void *addr2; void *addr3; }


Actualize

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

result = *(_QWORD *)(a1 + 16);
if ( result )
*(_QWORD *)(result + 8) = a2;
return result;
}

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

result = *(_QWORD *)(a1 + 16);
if ( result )
*(_QWORD *)(result + 8) = a2;
return result;
}

original_code:
void Actualize (tInstList *L, tInst *new_instr)
{
 if(L->Active != ((void *)0)) L->Active->data = new_instr;
 return;
 }

canonical_original_code:
void Actualize(struct tInstList *L, struct tInst *new_instr)
{
 if(L->Active != ((void *)0)) L->Active->data = new_instr;
 return;
 }


Succ

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

result = *(_QWORD *)(a1 + 16);
if ( result )
{
result = *(_QWORD *)(result + 16);
*(_QWORD *)(a1 + 16) = result;
}
return result;
}

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

result = *(_QWORD *)(a1 + 16);
if ( result )
{
result = *(_QWORD *)(result + 16);
*(_QWORD *)(a1 + 16) = result;
}
return result;
}

original_code:
void Succ (tInstList *L)
{
 if(L->Active != ((void *)0))
   {
   if(L->Active->next == ((void *)0)) L->Active = ((void *)0);
   else L->Active = L->Active->next;
   }
 return;
}

canonical_original_code:
void Succ(struct tInstList *L)
{
 if(L->Active != ((void *)0))
   {
   if(L->Active->next == ((void *)0)) L->Active = ((void *)0);
   else L->Active = L->Active->next;
   }
 return;
}


Active

decompiled_code:
_BOOL8 __fastcall Active(__int64 a1)
{
return *(_QWORD *)(a1 + 16) != 0LL;
}

canonical_decompiled_code:
_BOOL8 __fastcall func14(__int64 a1)
{
return *(_QWORD *)(a1 + 16) != 0LL;
}

original_code:
int Active (tInstList *L)
{
return (L->Active != ((void *)0));
}

canonical_original_code:
int Active(struct tInstList *L)
{
return (L->Active != ((void *)0));
}


ListJump

decompiled_code:
void __fastcall ListJump(__int64 a1, __int64 a2)
{
*(_QWORD *)(a1 + 16) = a2;
}

original_code:
void ListJump(tInstList *L, tPolozkaList *jump_instr)
{
L->Active=(tPolozkaList *)jump_instr;
}

canonical_original_code:
void ListJump(struct tInstList *L, struct polozkaList *jump_instr)
{
L->Active=(struct polozkaList *)jump_instr;
}


PrintErrItem

decompiled_code:
int __fastcall PrintErrItem(unsigned int *a1)
{
int v1; // eax

v1 = a1[1];
if ( (unsigned int)(v1 + 1) > 6 )
{
a1[1] = -1;
v1 = -1;
return fprintf(stderr, "Na riadku %d %s \n", *a1, (&ECODEMSG)[v1]);
}
if ( v1 != 5 )
return fprintf(stderr, "Na riadku %d %s \n", *a1, (&ECODEMSG)[v1]);
return fprintf(stderr, "\n%s", *(&ECODEMSG + 5));
}

canonical_decompiled_code:
int __fastcall func0(unsigned int *a1)
{
int v1; // eax

v1 = a1[1];
if ( (unsigned int)(v1 + 1) > 6 )
{
a1[1] = -1;
v1 = -1;
return fprintf(stderr, "Na riadku %d %s \n", *a1, (&ECODEMSG)[v1]);
}
if ( v1 != 5 )
return fprintf(stderr, "Na riadku %d %s \n", *a1, (&ECODEMSG)[v1]);
return fprintf(stderr, "\n%s", *(&ECODEMSG + 5));
}

original_code:
void PrintErrItem(TError *p_temp)
{
if((p_temp->ErrorType < -1) || (p_temp->ErrorType > 5))
  {
  p_temp->ErrorType = -1;
  }
if(p_temp->ErrorType == 5) fprintf(stderr, "\n%s",ECODEMSG[p_temp->ErrorType]);
else fprintf(stderr, "Na riadku %d %s \n", p_temp->LineNumber, ECODEMSG[(p_temp->ErrorType)]);
}

canonical_original_code:
void PrintErrItem(struct chyba *p_temp)
{
if((p_temp->ErrorType < -1) || (p_temp->ErrorType > 5))
  {
  p_temp->ErrorType = -1;
  }
if(p_temp->ErrorType == 5) fprintf(stderr, "\n%s",ECODEMSG[p_temp->ErrorType]);
else fprintf(stderr, "Na riadku %d %s \n", p_temp->LineNumber, ECODEMSG[(p_temp->ErrorType)]);
}

variable_types: struct chyba { int LineNumber; int ErrorType; } *


PrintError

decompiled_code:
int PrintError()
{
__int64 v0; // rbx
int result; // eax

if ( ErrorCounter > 0 )
{
v0 = 0LL;
do
result = PrintErrItem((unsigned int *)ErrorList + 2 * v0++);
while ( ErrorCounter > (int)v0 );
}
return result;
}

canonical_decompiled_code:
int func1()
{
__int64 v0; // rbx
int result; // eax

if ( ErrorCounter > 0 )
{
v0 = 0LL;
do
result = func0((unsigned int *)ErrorList + 2 * v0++);
while ( ErrorCounter > (int)v0 );
}
return result;
}

original_code:
void PrintError(void)
{
for(int i=0;i <ErrorCounter; i++)
   {
   PrintErrItem(&(ErrorList[i]));
   }
}

canonical_original_code:
void PrintError()
{
for(int i = 0;i <ErrorCounter; i++)
   {
   PrintErrItem(&(ErrorList[i]));
   }
}

variable_types: i int


FreeError

decompiled_code:
void FreeError()
{
free(ErrorList);
ErrorList = 0LL;
}

canonical_decompiled_code:
void func2()
{
free(ErrorList);
ErrorList = 0LL;
}

original_code:
void FreeError(void)
{
free(ErrorList);
ErrorList = ((void *)0);
}

canonical_original_code:
void FreeError()
{
free(ErrorList);
ErrorList = ((void *)0);
}


MakeErrList

decompiled_code:
__int64 MakeErrList()
{
__int64 i; // rax
__int64 result; // rax

ErrorList = malloc(0xF0uLL);
if ( ErrorList )
{
for ( i = 0LL; i != 240; i += 8LL )
{
*(_DWORD *)((char *)ErrorList + i) = 0;
*(_DWORD *)((char *)ErrorList + i + 4) = 0;
}
result = 0LL;
}
else
{
fprintf(stderr, "\n%s", *(&ECODEMSG + 5));
FreeError();
result = 5LL;
}
return result;
}

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

ErrorList = malloc(0xF0uLL);
if ( ErrorList )
{
for ( i = 0LL; i != 240; i += 8LL )
{
*(_DWORD *)((char *)ErrorList + i) = 0;
*(_DWORD *)((char *)ErrorList + i + 4) = 0;
}
result = 0LL;
}
else
{
fprintf(stderr, "\n%s", *(&ECODEMSG + 5));
func2();
result = 5LL;
}
return result;
}

original_code:
int MakeErrList(void)
{
if(((ErrorList) = malloc((sizeof(TError))*30)) == ((void *)0))
  {
  fprintf(stderr, "\n%s",ECODEMSG[5]);
  FreeError();
  return 5;
  }
for(int i=0; i< 30; i++)
  {
  ErrorList[i].LineNumber = 0;
  ErrorList[i].ErrorType = 0;
  }
return 0;
}

canonical_original_code:
int MakeErrList()
{
if(((ErrorList) = malloc((sizeof(TError))*30)) == ((void *)0))
  {
  fprintf(stderr, "\n%s",ECODEMSG[5]);
  FreeError();
  return 5;
  }
for(int i = 0; i< 30; i++)
  {
  ErrorList[i].LineNumber = 0;
  ErrorList[i].ErrorType = 0;
  }
return 0;
}


AddError

decompiled_code:
__int64 __fastcall AddError(int a1, int a2)
{
int v2; // eax
__int64 result; // rax
void *v4; // r12

ErrorFlag = a2;
if ( 30 * (ReallocCounter + 1) - 1 <= ErrorCounter )
{
++ReallocCounter;
v4 = realloc(ErrorList, 0xF8uLL);
if ( !v4 )
{
fprintf(stderr, "\n%s", *(&ECODEMSG + 5));
FreeError();
}
ErrorList = v4;
}
*((_DWORD *)ErrorList + 2 * ErrorCounter) = a1;
v2 = ErrorCounter;
*((_DWORD *)ErrorList + 2 * ErrorCounter + 1) = a2;
result = (unsigned int)(v2 + 1);
ErrorCounter = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(int a1, int a2)
{
int v2; // eax
__int64 result; // rax
void *v4; // r12

ErrorFlag = a2;
if ( 30 * (ReallocCounter + 1) - 1 <= ErrorCounter )
{
++ReallocCounter;
v4 = realloc(ErrorList, 0xF8uLL);
if ( !v4 )
{
fprintf(stderr, "\n%s", *(&ECODEMSG + 5));
func2();
}
ErrorList = v4;
}
*((_DWORD *)ErrorList + 2 * ErrorCounter) = a1;
v2 = ErrorCounter;
*((_DWORD *)ErrorList + 2 * ErrorCounter + 1) = a2;
result = (unsigned int)(v2 + 1);
ErrorCounter = result;
return result;
}

original_code:
void AddError(int CisloRadku, int TypChyby)
{
TError *p_temp;
ErrorFlag = TypChyby;
if(ErrorCounter >= (30 + 30 * ReallocCounter -1))
   {
   ReallocCounter++;
   if((p_temp =realloc((ErrorList),sizeof(TError)*(30 +1))) == ((void *)0))
      {
      fprintf(stderr, "\n%s",ECODEMSG[5]);
      FreeError();
      }
   ErrorList = p_temp;
   }
ErrorList[ErrorCounter].LineNumber = CisloRadku;
ErrorList[ErrorCounter].ErrorType = TypChyby;
ErrorCounter++;
}

canonical_original_code:
void AddError(int CisloRadku, int TypChyby)
{
struct chyba *p_temp;
ErrorFlag = TypChyby;
if(ErrorCounter >= (30 + 30 * ReallocCounter -1))
   {
   ReallocCounter++;
   if((p_temp =realloc((ErrorList),sizeof(TError)*(30 +1))) == ((void *)0))
      {
      fprintf(stderr, "\n%s",ECODEMSG[5]);
      FreeError();
      }
   ErrorList = p_temp;
   }
ErrorList[ErrorCounter].LineNumber = CisloRadku;
ErrorList[ErrorCounter].ErrorType = TypChyby;
ErrorCounter++;
}

variable_types: CisloRadku int

variable_types: TypChyby int

user_defined_types: struct chyba { int LineNumber; int ErrorType; }


InitList

original_code:
void InitList (tList *L)
{
 L->Act = ((void *)0);
 L->First = ((void *)0);
 L->Last = ((void *)0);
 L->length = 0;
}

canonical_original_code:
void InitList(struct tList *L)
{
 L->Act = ((void *)0);
 L->First = ((void *)0);
 L->Last = ((void *)0);
 L->length = 0;
}

variable_types: struct tList { struct tElem { struct tElem *lptr; struct tElem *rptr; int *data; } *Act; struct tElem *First; struct tElem *Last; int length; } *

user_defined_types: struct tList { struct tElem *Act; struct tElem *First; struct tElem *Last; int length; }


InsertFirst

original_code:
int InsertFirst (tList *L, wchar_t *arr)
{
 tElemPtr new = ((void *)0);
 if ((new = malloc(sizeof(struct tElem))) == ((void *)0)) return EALLOC;
 else
 {
  L->length++;
  new->data = arr;
  new->lptr = ((void *)0);
  new->rptr = L->First;
  if (L->First == ((void *)0)) L->Last = new;
  else L->First->lptr = new;
  L->First = new;
 }
 return EOK;
}

canonical_original_code:
int InsertFirst(struct tList *L, int *arr)
{
 struct tElem *new = ((void *)0);
 if ((new = malloc(sizeof(struct tElem))) == ((void *)0)) return EALLOC;
 else
 {
  L->length++;
  new->data = arr;
  new->lptr = ((void *)0);
  new->rptr = L->First;
  if (L->First == ((void *)0)) L->Last = new;
  else L->First->lptr = new;
  L->First = new;
 }
 return EOK;
}

variable_types:
arr
int *

variable_types: struct tElem { struct tElem *lptr; struct tElem *rptr; int *data; } *


stringCompare

decompiled_code:
__int64 __fastcall stringCompare(const wchar_t *a1, const wchar_t *a2)
{
unsigned int v4; // er12
wchar_t v5; // er14
FILE **v6; // r9
unsigned int v7; // eax
unsigned int v8; // edx
wchar_t v9; // esi
wchar_t v10; // edi
wchar_t v11; // ecx
wchar_t v12; // er8
unsigned int v13; // er8
unsigned int v14; // edi
__int64 result; // rax
unsigned int v16; // [rsp+8h] [rbp-40h]

v4 = wcslen(a1);
v16 = wcslen(a2);
v5 = *a1;
v6 = (FILE **)&TAB;
do
{
v7 = 0;
v8 = 0;
if ( v5 )
{
while ( a2[v7] )
{
while ( 1 )
{
v9 = a1[v8];
if ( v9 != 32 && v9 != 9 )
break;
v10 = a1[v8 + 1];
if ( v10 != 32 && v10 != 9 )
break;
++v8;
}
while ( 1 )
{
v11 = a2[v7];
if ( v11 != 32 && v11 != 9 )
break;
v12 = a2[v7 + 1];
if ( v12 != 32 && v12 != 9 )
break;
++v7;
}
v13 = *(&(*v6)->_flags + v9);
v14 = *(&(*v6)->_flags + v11);
if ( (v9 & 0xFFFFFFDF) == 67 && (a1[v8 + 1] & 0xFFFFFFDF) == 72 && v4 - 1 > v8 )
{
++v8;
v13 = 15;
}
if ( (v11 & 0xFFFFFFDF) == 67 && (a2[v7 + 1] & 0xFFFFFFDF) == 72 && v16 - 1 > v7 )
{
++v7;
v14 = 15;
}
if ( v13 < v14 )
return 0xFFFFFFFFLL;
if ( v13 > v14 )
return 1LL;
++v8;
++v7;
if ( !a1[v8] )
break;
}
}
++v6;
}
while ( v6 != &_bss_start );
result = 0xFFFFFFFFLL;
if ( v4 >= v16 )
result = v4 > v16;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(const wchar_t *a1, const wchar_t *a2)
{
unsigned int v4; // er12
wchar_t v5; // er14
FILE **v6; // r9
unsigned int v7; // eax
unsigned int v8; // edx
wchar_t v9; // esi
wchar_t v10; // edi
wchar_t v11; // ecx
wchar_t v12; // er8
unsigned int v13; // er8
unsigned int v14; // edi
__int64 result; // rax
unsigned int v16; // [rsp+8h] [rbp-40h]

v4 = wcslen(a1);
v16 = wcslen(a2);
v5 = *a1;
v6 = (FILE **)&TAB;
do
{
v7 = 0;
v8 = 0;
if ( v5 )
{
while ( a2[v7] )
{
while ( 1 )
{
v9 = a1[v8];
if ( v9 != 32 && v9 != 9 )
break;
v10 = a1[v8 + 1];
if ( v10 != 32 && v10 != 9 )
break;
++v8;
}
while ( 1 )
{
v11 = a2[v7];
if ( v11 != 32 && v11 != 9 )
break;
v12 = a2[v7 + 1];
if ( v12 != 32 && v12 != 9 )
break;
++v7;
}
v13 = *(&(*v6)->_flags + v9);
v14 = *(&(*v6)->_flags + v11);
if ( (v9 & 0xFFFFFFDF) == 67 && (a1[v8 + 1] & 0xFFFFFFDF) == 72 && v4 - 1 > v8 )
{
++v8;
v13 = 15;
}
if ( (v11 & 0xFFFFFFDF) == 67 && (a2[v7 + 1] & 0xFFFFFFDF) == 72 && v16 - 1 > v7 )
{
++v7;
v14 = 15;
}
if ( v13 < v14 )
return 0xFFFFFFFFLL;
if ( v13 > v14 )
return 1LL;
++v8;
++v7;
if ( !a1[v8] )
break;
}
}
++v6;
}
while ( v6 != &_bss_start );
result = 0xFFFFFFFFLL;
if ( v4 >= v16 )
result = v4 > v16;
return result;
}

original_code:
int stringCompare(wchar_t *first, wchar_t *second)
{
 wint_t value_f, value_s;
 wint_t slen_f, slen_s;
 wint_t i = 0, j = 0;
 slen_f = wcslen(first);
 slen_s = wcslen(second);
for (int tab = 0; tab <= 1; tab++)
{
 i=0, j=0;
 while (first[i] != L'\0' && second[j] != L'\0')
 {
  while((first[i] == L' ' || first[i] == L'\t') && (first[i+1] == L' ' || first[i+1] == L'\t')) i++;
  while((second[j] == L' ' || second[j] == L'\t') && (second[j+1] == L' ' || second[j+1] == L'\t')) j++;
  value_f = TAB[tab][(wchar_t) first[i]];
  value_s = TAB[tab][(wchar_t) second[j]];
  if ((first[i] == (L'c') || first[i] == (L'C')) && (first[i+1] == (L'h') || first[i+1] == (L'H')) && i < slen_f-1)
  {
   value_f = 15;
   i++;
  }
  if ((second[j] == (L'c') || second[j] == (L'C')) && (second[j+1] == (L'h') || second[j+1] == (L'H')) && j < slen_s-1)
  {
   value_s = 15;
   j++;
  }
  if(value_f < value_s) return -1;
  else if (value_f > value_s) return 1;
  else
  {
   i++;
   j++;
  }
 }
}
 if (slen_f < slen_s) return -1;
 else if (slen_f > slen_s) return 1;
 else
 {
  return 0;
 }
}

canonical_original_code:
int stringCompare(int *first, int *second)
{
 unsigned int value_f; unsigned int value_s;
 unsigned int slen_f; unsigned int slen_s;
 unsigned int i = 0; unsigned int j = 0;
 slen_f = wcslen(first);
 slen_s = wcslen(second);
for (int tab = 0; tab <= 1; tab++)
{
 i=0, j=0;
 while (first[i] != L'\0' && second[j] != L'\0')
 {
  while((first[i] == L' ' || first[i] == L'\t') && (first[i+1] == L' ' || first[i+1] == L'\t')) i++;
  while((second[j] == L' ' || second[j] == L'\t') && (second[j+1] == L' ' || second[j+1] == L'\t')) j++;
  value_f = TAB[tab][(int) first[i]];
  value_s = TAB[tab][(int) second[j]];
  if ((first[i] == (L'c') || first[i] == (L'C')) && (first[i+1] == (L'h') || first[i+1] == (L'H')) && i < slen_f-1)
  {
   value_f = 15;
   i++;
  }
  if ((second[j] == (L'c') || second[j] == (L'C')) && (second[j+1] == (L'h') || second[j+1] == (L'H')) && j < slen_s-1)
  {
   value_s = 15;
   j++;
  }
  if(value_f < value_s) return -1;
  else if (value_f > value_s) return 1;
  else
  {
   i++;
   j++;
  }
 }
}
 if (slen_f < slen_s) return -1;
 else if (slen_f > slen_s) return 1;
 else
 {
  return 0;
 }
}

variable_types:
first
int *

variable_types:
second
int *

variable_types:
i
unsigned int

variable_types:
j
unsigned int

variable_types: tab int


sortList

decompiled_code:
__int64 __fastcall sortList(__int64 *a1)
{
__int64 result; // rax
int v2; // er12
__int64 v3; // rbp
const wchar_t *v4; // r14
const wchar_t *v5; // r13
int v6; // [rsp+8h] [rbp-40h]
int v7; // [rsp+Ch] [rbp-3Ch]

v7 = *((_DWORD *)a1 + 6);
result = a1[1];
*a1 = result;
if ( a1[2] != result || result )
{
v6 = 0;
result = (unsigned int)v7;
if ( v7 > 0 )
{
do
{
v2 = 0;
if ( v7 > 1 )
{
do
{
v3 = *a1;
v4 = *(const wchar_t **)(*(_QWORD *)(*a1 + 8) + 16LL);
v5 = *(const wchar_t **)(*a1 + 16);
if ( (unsigned int)stringCompare(v5, v4) == -1 )
{
*(_QWORD *)(v3 + 16) = v4;
*(_QWORD *)(*(_QWORD *)(*a1 + 8) + 16LL) = v5;
}
*a1 = *(_QWORD *)(*a1 + 8);
++v2;
}
while ( v2 != v7 - 1 );
}
*a1 = a1[1];
result = (unsigned int)++v6;
}
while ( v7 != v6 );
}
}
return result;
}

original_code:
void sortList(tList * L)
{
 int count = L->length;
 wchar_t *dataHelper;
 L->Act = L->First;
 if (L->First != L->Last || L->First != ((void *)0))
 {
  for (int i=0; i < count; i++)
  {
   for (int j = 0; j < count - 1; j++)
   {
    if (stringCompare(L->Act->data, L->Act->rptr->data) == -1)
    {
     dataHelper = L->Act->data;
     L->Act->data = L->Act->rptr->data;
     L->Act->rptr->data = dataHelper;
    }
    L->Act = L->Act->rptr;
   }
  L->Act = L->First;
  }
 }
}

canonical_original_code:
void sortList(struct tList *L)
{
 int count = L->length;
 int *dataHelper;
 L->Act = L->First;
 if (L->First != L->Last || L->First != ((void *)0))
 {
  for (int i = 0; i < count; i++)
  {
   for (int j = 0; j < count - 1; j++)
   {
    if (stringCompare(L->Act->data, L->Act->rptr->data) == -1)
    {
     dataHelper = L->Act->data;
     L->Act->data = L->Act->rptr->data;
     L->Act->rptr->data = dataHelper;
    }
    L->Act = L->Act->rptr;
   }
  L->Act = L->First;
  }
 }
}

variable_types: count int

variable_types:
dataHelper
int *

variable_types: j int

user_defined_types: struct tElem { struct tElem *lptr; struct tElem *rptr; int *data; }


locale

decompiled_code:
__int64 __fastcall locale(char *a1)
{
if ( a1 )
return setlocale(6, a1) == 0LL ? 6 : 0;
setlocale(6, byte_402090);
return setlocale(6, 0LL) == 0LL ? 6 : 0;
}

canonical_decompiled_code:
__int64 __fastcall func16(char *a1)
{
if ( a1 )
return setlocale(6, a1) == 0LL ? 6 : 0;
setlocale(6, byte_402090);
return setlocale(6, 0LL) == 0LL ? 6 : 0;
}

original_code:
int locale (char* loc)
{
 if (loc == ((void *)0))
 {
  setlocale(6,"");
  if(setlocale(6, loc) == ((void *)0)) return ELOC;
 }
 else
 {
  if(setlocale(6, loc) == ((void *)0)) return ELOC;
 }
 return EOK;
}

canonical_original_code:
int locale(char *loc)
{
 if (loc == ((void *)0))
 {
  setlocale(6,"");
  if(setlocale(6, loc) == ((void *)0)) return ELOC;
 }
 else
 {
  if(setlocale(6, loc) == ((void *)0)) return ELOC;
 }
 return EOK;
}

variable_types:
loc
char *


printECode

decompiled_code:
int __fastcall printECode(unsigned int a1)
{
if ( a1 >= 8 )
a1 = 8;
return fputs((&ECODEMSG)[a1], _bss_start);
}

canonical_decompiled_code:
int __fastcall func7(unsigned int a1)
{
if ( a1 >= 8 )
a1 = 8;
return fputs((&ECODEMSG)[a1], _bss_start);
}

original_code:
void printECode(int ecode)
{
 if (ecode < EOK || ecode > EALLOC)
 { ecode = EUNKNOWN; }
 fprintf(stderr, "%s", ECODEMSG[ecode]);
}

variable_types: ecode int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
unsigned int v5; // ebp
const char *v6[3]; // [rsp+0h] [rbp-58h] BYREF
unsigned int v7; // [rsp+18h] [rbp-40h]
int v8; // [rsp+1Ch] [rbp-3Ch]
__int64 v9[7]; // [rsp+20h] [rbp-38h] BYREF

getParams((__int64)v6, argc, (__int64)argv);
if ( v7 )
{
printECode(v7);
v3 = 1;
}
else
{
v3 = v8;
if ( v8 )
{
if ( v8 == 1 )
{
v5 = locale((char *)v6[2]);
if ( v5 || (InitList((__int64)v9), (v5 = loadFile((__int64)v9, v6[0])) != 0) )
{
printECode(v5);
}
else
{
sortList(v9);
saveFile((__int64)v9, v6[1]);
DisposeList(v9);
v3 = 0;
}
}
else
{
v3 = 0;
}
}
else
{
printf("%s", HELPMSG);
}
}
return v3;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
unsigned int v5; // ebp
const char *v6[3]; // [rsp+0h] [rbp-58h] BYREF
unsigned int v7; // [rsp+18h] [rbp-40h]
int v8; // [rsp+1Ch] [rbp-3Ch]
__int64 v9[7]; // [rsp+20h] [rbp-38h] BYREF

func8((__int64)v6, argc, (__int64)argv);
if ( v7 )
{
func7(v7);
v3 = 1;
}
else
{
v3 = v8;
if ( v8 )
{
if ( v8 == 1 )
{
v5 = func16((char *)v6[2]);
if ( v5 || (func9((__int64)v9), (v5 = func12((__int64)v9, v6[0])) != 0) )
{
func7(v5);
}
else
{
func15(v9);
func13((__int64)v9, v6[1]);
func11(v9);
v3 = 0;
}
}
else
{
v3 = 0;
}
}
else
{
printf("%s", HELPMSG);
}
}
return v3;
}

original_code:
int main(int argc, char *argv[])
{
 tList L;
 TParams params = getParams(argc, argv);
 if (params.ecode != EOK)
 {
  printECode(params.ecode);
  return 1;
 }
 int ecode = EOK;
 if (params.state == CHELP) printf("%s", HELPMSG);
 else if(params.state == CSORT)
 {
  if((ecode = locale(params.loc)) == EOK)
  {
   InitList(&L);
   if((ecode = loadFile(&L, params.filename1)) == EOK)
   {
    sortList(&L);
    saveFile(&L, params.filename2);
    DisposeList(&L);
   }
  }
 }
 if (ecode != EOK)
 {
  printECode(ecode);
  return 1;
 }
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 struct tList L;
 struct params params = getParams(argc, argv);
 if (params.ecode != EOK)
 {
  printECode(params.ecode);
  return 1;
 }
 int ecode = EOK;
 if (params.state == CHELP) printf("%s", HELPMSG);
 else if(params.state == CSORT)
 {
  if((ecode = locale(params.loc)) == EOK)
  {
   InitList(&L);
   if((ecode = loadFile(&L, params.filename1)) == EOK)
   {
    sortList(&L);
    saveFile(&L, params.filename2);
    DisposeList(&L);
   }
  }
 }
 if (ecode != EOK)
 {
  printECode(ecode);
  return 1;
 }
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: struct tList { struct tElem { struct tElem *lptr; struct tElem *rptr; int *data; } *Act; struct tElem *First; struct tElem *Last; int length; }

variable_types: struct params { char *filename1; char *filename2; char *loc; int ecode; int state; }


strInit

decompiled_code:
__int64 __fastcall strInit(__int64 a1)
{
_BYTE *v1; // rax

v1 = malloc(8uLL);
*(_QWORD *)a1 = v1;
if ( !v1 )
return 1LL;
*v1 = 0;
*(_DWORD *)(a1 + 8) = 0;
*(_DWORD *)(a1 + 12) = 8;
return 0LL;
}

original_code:
int strInit(string *s)
{
   if ((s->str = (char*) malloc(8)) == ((void *)0))
      return 1;
   s->str[0] = '\0';
   s->length = 0;
   s->allocSize = 8;
   return 0;
}

canonical_original_code:
int strInit(struct string *s)
{
   if ((s->str = (char *) malloc(8)) == ((void *)0))
      return 1;
   s->str[0] = '\0';
   s->length = 0;
   s->allocSize = 8;
   return 0;
}

variable_types: struct string { char *str; int length; int allocSize; } *


strFree

decompiled_code:
void __fastcall strFree(void **a1)
{
free(*a1);
}

canonical_decompiled_code:
void __fastcall func1(void **a1)
{
free(*a1);
}

original_code:
void strFree(string *s)
{
   free(s->str);
}

canonical_original_code:
void strFree(struct string *s)
{
   free(s->str);
}

user_defined_types: struct string { char *str; int length; int allocSize; }


strAddChar

original_code:
int strAddChar(string *s1, char c)
{
   if (s1->length + 1 >= s1->allocSize)
   {
      if ((s1->str = (char*) realloc(s1->str, s1->length + 8)) == ((void *)0))
         return 1;
      s1->allocSize = s1->length + 8;
   }
   s1->str[s1->length] = c;
   s1->length++;
   s1->str[s1->length] = '\0';
   return 0;
}

canonical_original_code:
int strAddChar(struct string *s1, char c)
{
   if (s1->length + 1 >= s1->allocSize)
   {
      if ((s1->str = (char *) realloc(s1->str, s1->length + 8)) == ((void *)0))
         return 1;
      s1->allocSize = s1->length + 8;
   }
   s1->str[s1->length] = c;
   s1->length++;
   s1->str[s1->length] = '\0';
   return 0;
}

variable_types: c char


strCopyString

decompiled_code:
__int64 __fastcall strCopyString(__int64 a1, __int64 a2)
{
int v2; // er12
void *v3; // rax

v2 = *(_DWORD *)(a2 + 8);
if ( *(_DWORD *)(a1 + 12) > v2 )
goto LABEL_4;
v3 = realloc(*(void **)a1, v2 + 1);
*(_QWORD *)a1 = v3;
if ( v3 )
{
*(_DWORD *)(a1 + 12) = v2 + 1;
LABEL_4:
strcpy(*(char **)a1, *(const char **)a2);
*(_DWORD *)(a1 + 8) = v2;
return 0LL;
}
return 1LL;
}

original_code:
int strCopyString(string *s1, string *s2)
{
   int newLength = s2->length;
   if (newLength >= s1->allocSize)
   {
      if ((s1->str = (char*) realloc(s1->str, newLength + 1)) == ((void *)0))
         return 1;
      s1->allocSize = newLength + 1;
   }
   strcpy(s1->str, s2->str);
   s1->length = newLength;
   return 0;
}

canonical_original_code:
int strCopyString(struct string *s1, struct string *s2)
{
   int newLength = s2->length;
   if (newLength >= s1->allocSize)
   {
      if ((s1->str = (char *) realloc(s1->str, newLength + 1)) == ((void *)0))
         return 1;
      s1->allocSize = newLength + 1;
   }
   strcpy(s1->str, s2->str);
   s1->length = newLength;
   return 0;
}

variable_types: newLength int


strCmpString

decompiled_code:
int __fastcall strCmpString(const char **a1, const char **a2)
{
return strcmp(*a1, *a2);
}

canonical_decompiled_code:
int __fastcall func4(const char **a1, const char **a2)
{
return strcmp(*a1, *a2);
}

original_code:
int strCmpString(string *s1, string *s2)
{
   return strcmp(s1->str, s2->str);
}

canonical_original_code:
int strCmpString(struct string *s1, struct string *s2)
{
   return strcmp(s1->str, s2->str);
}


strCmpConstStr

decompiled_code:
int __fastcall strCmpConstStr(const char **a1, const char *a2)
{
return strcmp(*a1, a2);
}

canonical_decompiled_code:
int __fastcall func5(const char **a1, const char *a2)
{
return strcmp(*a1, a2);
}

original_code:
int strCmpConstStr(string *s1, char* s2)
{
   return strcmp(s1->str, s2);
}

canonical_original_code:
int strCmpConstStr(struct string *s1, char *s2)
{
   return strcmp(s1->str, s2);
}


strGetStr

decompiled_code:
__int64 __fastcall strGetStr(__int64 a1)
{
return *(_QWORD *)a1;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
return *(_QWORD *)a1;
}

original_code:
char *strGetStr(string *s)
{
   return s->str;
}

canonical_original_code:
char *strGetStr(struct string *s)
{
   return s->str;
}

return_type: char *


strGetLength

decompiled_code:
__int64 __fastcall strGetLength(__int64 a1)
{
return *(unsigned int *)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
return *(unsigned int *)(a1 + 8);
}

original_code:
int strGetLength(string *s)
{
   return s->length;
}

canonical_original_code:
int strGetLength(struct string *s)
{
   return s->length;
}


strprint

decompiled_code:
int __fastcall strprint(const char **a1)
{
return printf("%s", *a1);
}

canonical_decompiled_code:
int __fastcall func8(const char **a1)
{
return printf("%s", *a1);
}

original_code:
void strprint(string *s)
{
printf ("%s",s->str);
}

canonical_original_code:
void strprint(struct string *s)
{
printf ("%s",s->str);
}


prepareToken

decompiled_code:
_BOOL8 __fastcall prepareToken(_QWORD *a1)
{
void *v1; // rax
_BOOL8 result; // rax

v1 = malloc(0x10uLL);
*a1 = v1;
if ( v1 )
result = (unsigned int)strInit(v1) != 0;
else
result = 1LL;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(_QWORD *a1)
{
void *v1; // rax
_BOOL8 result; // rax

v1 = malloc(0x10uLL);
*a1 = v1;
if ( v1 )
result = (unsigned int)strInit(v1) != 0;
else
result = 1LL;
return result;
}

original_code:
int prepareToken(string **token) {
 if ((*token = malloc(sizeof(string))) != ((void *)0)) {
  if (!strInit(*token))
   return 0;
 }
 return 1;
}

canonical_original_code:
int prepareToken(struct string **token) {
 if ((*token = malloc(sizeof(string))) != ((void *)0)) {
  if (!strInit(*token))
   return 0;
 }
 return 1;
}

variable_types: struct string { char *str; int length; int allocSize; } **


InitStream

decompiled_code:
struct _IO_FILE *InitStream()
{
struct _IO_FILE *result; // rax

if ( !stream )
{
result = stdout;
stream = stdout;
}
return result;
}

canonical_decompiled_code:
struct _IO_FILE *func0()
{
struct _IO_FILE *result; // rax

if ( !stream )
{
result = stdout;
stream = stdout;
}
return result;
}

original_code:
static void InitStream()
{
  if (stream == ((void *)0))
    stream = stdout;
}


decompiled_code:
size_t __fastcall print_indent(__int64 a1)
{
int v1; // ebx

InitStream();
fprintf(stream, "%2d", *(unsigned int *)(a1 + 560));
v1 = *(_DWORD *)(a1 + 560);
if ( v1 > 49 )
{
fwrite(" *** too deep ***", 1uLL, 0x11uLL, stream);
}
else if ( v1 > 0 )
{
do
{
fwrite("--", 1uLL, 2uLL, stream);
--v1;
}
while ( v1 );
}
return fwrite("> ", 1uLL, 2uLL, stream);
}

canonical_decompiled_code:
size_t __fastcall func1(__int64 a1)
{
int v1; // ebx

func0();
fprintf(stream, "%2d", *(unsigned int *)(a1 + 560));
v1 = *(_DWORD *)(a1 + 560);
if ( v1 > 49 )
{
fwrite(" *** too deep ***", 1uLL, 0x11uLL, stream);
}
else if ( v1 > 0 )
{
do
{
fwrite("--", 1uLL, 2uLL, stream);
--v1;
}
while ( v1 );
}
return fwrite("> ", 1uLL, 2uLL, stream);
}

original_code:
static void print_indent(lprec *lp)
{
  int i;
  InitStream();
  fprintf(stream, "%2d", lp->Level);
  if(lp->Level < 50)
    for(i = lp->Level; i > 0; i--)
      fprintf(stream, "--");
  else
    fprintf(stream, " *** too deep ***");
  fprintf(stream, "> ");
}

canonical_original_code:
static void print_indent(struct _lprec *lp)
{
  int i;
  InitStream();
  fprintf(stream, "%2d", lp->Level);
  if(lp->Level < 50)
    for(i = lp->Level; i > 0; i--)
      fprintf(stream, "--");
  else
    fprintf(stream, " *** too deep ***");
  fprintf(stream, "> ");
}

variable_types: struct _lprec { char *lp_name; short verbose; unsigned char print_duals; unsigned char print_sol; unsigned char debug; short print_at_invert; unsigned char trace; unsigned char anti_degen; unsigned char do_presolve; int rows; int rows_alloc; int columns; int columns_alloc; int sum; int sum_alloc; unsigned char names_used; char **row_name; char **col_name; int non_zeros; int mat_alloc; struct _matrec { int row_nr; double value; } *mat; int *col_end; int *col_no; unsigned char row_end_valid; int *row_end; double *orig_rh; double *rh; long double *rhs; unsigned char *must_be_int; double *orig_upbo; double *orig_lowbo; double *upbo; double *lowbo; unsigned char basis_valid; int *bas; unsigned char *basis; unsigned char *lower; unsigned char eta_valid; int eta_alloc; int eta_size; int num_inv; int max_num_inv; double *eta_value; int *eta_row_nr; int *eta_col_end; unsigned char bb_rule; double obj_bound; int iter; int total_iter; int max_level; int total_nodes; double *solution; double *best_solution; double *duals; unsigned char maximise; unsigned char floor_first; unsigned char *ch_sign; unsigned char scaling_used; unsigned char columns_scaled; double *scale; int nr_lagrange; double **lag_row; double *lag_rhs; double *lambda; unsigned char *lag_con_type; double lag_bound; unsigned char valid; double infinite; double epsilon; double epsb; double epsd; double epsel; struct _hashstruct { struct _hashelem { char *name; struct _hashelem *next; struct _column { int row; double value; struct _column *next; } *col; struct _bound { double upbo; double lowbo; } *bnd; int must_be_int; int index; } **table; int size; } *rowname_hashtab; struct _hashstruct *colname_hashtab; double *dualsfrom; double *dualstill; double *objfrom; double *objtill; int orig_rows; int orig_columns; short spx_status; short lag_status; int solutioncount; int solutionlimit; int num_refact; unsigned char scalemode; unsigned char improve; unsigned char lag_trace; unsigned char piv_rule; unsigned char break_at_first; short bb_floorfirst; double break_at_value; int int_count; int *var_is_free; double Extrad; unsigned char doIterate; unsigned char doInvert; unsigned char justInverted; unsigned char wasprocessed; unsigned char Break_bb; int Level; double lag_accept; double negrange; double epsperturb; double epspivot; long sectimeout; double timestart; double timeend; double time_refactstart; int (*abort)(void *lp, void *userhandle); void *aborthandle; void (*writelog)(void *lp, void *userhandle, char *buf); void *loghandle; void (*debuginfo)(void *lp, void *userhandle, char *buf); void *(*usermessage)(void *lp, void *userhandle, int message); int msgmask; void *msghandle; int sc_count; int sos_alloc; int sos_count; int sos_ints; double *var_is_sc; struct _SOSrec { int tagorder; char *name; short type; int size; int priority; int *members; double *weights; int *membersSorted; int *membersMapped; } **sos_list; int sos_vars; int *sos_priority; } *

variable_types: i int

user_defined_types: struct _lprec { char *lp_name; short verbose; unsigned char print_duals; unsigned char print_sol; unsigned char debug; short print_at_invert; unsigned char trace; unsigned char anti_degen; unsigned char do_presolve; int rows; int rows_alloc; int columns; int columns_alloc; int sum; int sum_alloc; unsigned char names_used; char **row_name; char **col_name; int non_zeros; int mat_alloc; struct _matrec *mat; int *col_end; int *col_no; unsigned char row_end_valid; int *row_end; double *orig_rh; double *rh; long double *rhs; unsigned char *must_be_int; double *orig_upbo; double *orig_lowbo; double *upbo; double *lowbo; unsigned char basis_valid; int *bas; unsigned char *basis; unsigned char *lower; unsigned char eta_valid; int eta_alloc; int eta_size; int num_inv; int max_num_inv; double *eta_value; int *eta_row_nr; int *eta_col_end; unsigned char bb_rule; double obj_bound; int iter; int total_iter; int max_level; int total_nodes; double *solution; double *best_solution; double *duals; unsigned char maximise; unsigned char floor_first; unsigned char *ch_sign; unsigned char scaling_used; unsigned char columns_scaled; double *scale; int nr_lagrange; double **lag_row; double *lag_rhs; double *lambda; unsigned char *lag_con_type; double lag_bound; unsigned char valid; double infinite; double epsilon; double epsb; double epsd; double epsel; struct _hashstruct *rowname_hashtab; struct _hashstruct *colname_hashtab; double *dualsfrom; double *dualstill; double *objfrom; double *objtill; int orig_rows; int orig_columns; short spx_status; short lag_status; int solutioncount; int solutionlimit; int num_refact; unsigned char scalemode; unsigned char improve; unsigned char lag_trace; unsigned char piv_rule; unsigned char break_at_first; short bb_floorfirst; double break_at_value; int int_count; int *var_is_free; double Extrad; unsigned char doIterate; unsigned char doInvert; unsigned char justInverted; unsigned char wasprocessed; unsigned char Break_bb; int Level; double lag_accept; double negrange; double epsperturb; double epspivot; long sectimeout; double timestart; double timeend; double time_refactstart; int (*abort)(void *lp, void *userhandle); void *aborthandle; void (*writelog)(void *lp, void *userhandle, char *buf); void *loghandle; void (*debuginfo)(void *lp, void *userhandle, char *buf); void *(*usermessage)(void *lp, void *userhandle, int message); int msgmask; void *msghandle; int sc_count; int sos_alloc; int sos_count; int sos_ints; double *var_is_sc; struct _SOSrec **sos_list; int sos_vars; int *sos_priority; }

user_defined_types: struct _hashstruct { struct _hashelem **table; int size; }

user_defined_types: struct _hashelem { char *name; struct _hashelem *next; struct _column *col; struct _bound *bnd; int must_be_int; int index; }


report

decompiled_code:
__int64 report(__int64 a1, __int16 a2, const char *a3, ...)
{
char v4[264]; // [rsp+0h] [rbp-1E8h] BYREF
gcc_va_list arg; // [rsp+108h] [rbp-E0h] BYREF

va_start(arg, a3);
if ( a1 )
{
if ( *(_QWORD *)(a1 + 648) )
{
if ( *(__int16 *)(a1 + 8) >= a2 )
{
vsprintf(v4, a3, arg);
(*(void (__fastcall **)(__int64, _QWORD, char *))(a1 + 648))(a1, *(_QWORD *)(a1 + 656), v4);
}
return 0LL;
}
if ( *(__int16 *)(a1 + 8) < a2 )
return 0LL;
}
vfprintf(stderr, a3, arg);
fputc(10, stderr);
if ( !a2 )
raise(6);
return 0LL;
}

canonical_decompiled_code:
__int64 func2(__int64 a1, __int16 a2, const char *a3, ...)
{
char v4[264]; // [rsp+0h] [rbp-1E8h] BYREF
gcc_va_list arg; // [rsp+108h] [rbp-E0h] BYREF

va_start(arg, a3);
if ( a1 )
{
if ( *(_QWORD *)(a1 + 648) )
{
if ( *(__int16 *)(a1 + 8) >= a2 )
{
vsprintf(v4, a3, arg);
(*(void (__fastcall **)(__int64, _QWORD, char *))(a1 + 648))(a1, *(_QWORD *)(a1 + 656), v4);
}
return 0LL;
}
if ( *(__int16 *)(a1 + 8) < a2 )
return 0LL;
}
vfprintf(stderr, a3, arg);
fputc(10, stderr);
if ( !a2 )
raise(6);
return 0LL;
}

original_code:
int report(lprec *lp, short level, char *format, ...)
{
  va_list ap;
  __builtin_va_start(ap,format);
  if ((lp == ((void *)0)) || (lp->writelog == ((void *)0)))
  {
    if((lp == ((void *)0)) || (lp->verbose >= level))
    {
      vfprintf(stderr, format, ap);
      fputc('\n', stderr);
      if(level == 0)
        raise(6);
    }
  }
  else if(lp->writelog != ((void *)0))
  {
    if(lp->verbose >= level)
    {
      char buff[255];
      vsprintf(buff, format, ap);
      lp->writelog(lp, lp->loghandle, buff);
    }
  }
  __builtin_va_end(ap);
  return(0);
}

canonical_original_code:
int report(struct _lprec *lp, short level, char *format, ...)
{
  __builtin_va_list ap;
  __builtin_va_start(ap,format);
  if ((lp == ((void *)0)) || (lp->writelog == ((void *)0)))
  {
    if((lp == ((void *)0)) || (lp->verbose >= level))
    {
      vfprintf(stderr, format, ap);
      fputc('\n', stderr);
      if(level == 0)
        raise(6);
    }
  }
  else if(lp->writelog != ((void *)0))
  {
    if(lp->verbose >= level)
    {
      char buff[255];
      vsprintf(buff, format, ap);
      lp->writelog(lp, lp->loghandle, buff);
    }
  }
  __builtin_va_end(ap);
  return(0);
}

variable_types: level short

variable_types:
format
char *

variable_types:
buff
char [255]

user_defined_types: struct _matrec { int row_nr; double value; }

user_defined_types: struct _SOSrec { int tagorder; char *name; short type; int size; int priority; int *members; double *weights; int *membersSorted; int *membersMapped; }

user_defined_types: struct _column { int row; double value; struct _column *next; }

user_defined_types: struct _bound { double upbo; double lowbo; }


decompiled_code:
void __fastcall debug_print_solution(__int64 a1)
{
int v1; // ebp
__int64 v2; // r12
double v3; // r13
const char *v4; // rax

if ( *(_BYTE *)(a1 + 12) )
{
InitStream();
v1 = *(_DWORD *)(a1 + 20) + 1;
if ( v1 <= *(_DWORD *)(a1 + 36) )
{
v2 = 8LL * v1;
do
{
print_indent(a1);
v3 = *(double *)(*(_QWORD *)(a1 + 288) + v2);
v4 = (const char *)get_col_name(a1, (unsigned int)(v1 - *(_DWORD *)(a1 + 20)));
fprintf(stream, "%-20s %g\n", v4, v3);
++v1;
v2 += 8LL;
}
while ( *(_DWORD *)(a1 + 36) >= v1 );
}
}
}

original_code:
void debug_print_solution(lprec *lp)
{
  int i;
  if(lp->debug){
    InitStream();
    for (i = lp->rows + 1; i <= lp->sum; i++) {
      print_indent(lp);
      fprintf(stream, "%-20s %g\n", get_col_name(lp, i - lp->rows),
       (double)lp->solution[i]);
    }
  }
}

canonical_original_code:
void debug_print_solution(struct _lprec *lp)
{
  int i;
  if(lp->debug){
    InitStream();
    for (i = lp->rows + 1; i <= lp->sum; i++) {
      print_indent(lp);
      fprintf(stream, "%-20s %g\n", get_col_name(lp, i - lp->rows),
       (double)lp->solution[i]);
    }
  }
}


original_code:
void debug_print_bounds(lprec *lp, double *upbo, double *lowbo)
{
  int i;
  if(lp->debug){
    InitStream();
    for(i = lp->rows + 1; i <= lp->sum; i++) {
      if(lowbo[i] == upbo[i]) {
 print_indent(lp);
 fprintf(stream, "%s = %g\n", get_col_name(lp, i - lp->rows),
  (double)lowbo[i] * ((lp->scaling_used) ? lp->scale[i] : 1.0));
      }
      else {
 if(lowbo[i] != 0) {
   print_indent(lp);
   fprintf(stream, "%s > %g\n", get_col_name(lp, i - lp->rows),
    (double)lowbo[i] * ((lp->scaling_used) ? lp->scale[i] : 1.0));
 }
 if(upbo[i] != lp->infinite) {
   print_indent(lp);
   fprintf(stream, "%s < %g\n", get_col_name(lp, i - lp->rows),
    (double)upbo[i] * ((lp->scaling_used) ? lp->scale[i] : 1.0));
 }
      }
    }
  }
}

canonical_original_code:
void debug_print_bounds(struct _lprec *lp, double *upbo, double *lowbo)
{
  int i;
  if(lp->debug){
    InitStream();
    for(i = lp->rows + 1; i <= lp->sum; i++) {
      if(lowbo[i] == upbo[i]) {
 print_indent(lp);
 fprintf(stream, "%s = %g\n", get_col_name(lp, i - lp->rows),
  (double)lowbo[i] * ((lp->scaling_used) ? lp->scale[i] : 1.0));
      }
      else {
 if(lowbo[i] != 0) {
   print_indent(lp);
   fprintf(stream, "%s > %g\n", get_col_name(lp, i - lp->rows),
    (double)lowbo[i] * ((lp->scaling_used) ? lp->scale[i] : 1.0));
 }
 if(upbo[i] != lp->infinite) {
   print_indent(lp);
   fprintf(stream, "%s < %g\n", get_col_name(lp, i - lp->rows),
    (double)upbo[i] * ((lp->scaling_used) ? lp->scale[i] : 1.0));
 }
      }
    }
  }
}

variable_types:
upbo
double *

variable_types:
lowbo
double *


decompiled_code:
int debug_print(__int64 a1, const char *a2, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-E0h] BYREF

if ( *(_BYTE *)(a1 + 12) )
{
InitStream();
print_indent(a1);
va_start(arg, a2);
vfprintf(stream, a2, arg);
result = fputc(10, stream);
}
return result;
}

canonical_decompiled_code:
int func5(__int64 a1, const char *a2, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-E0h] BYREF

if ( *(_BYTE *)(a1 + 12) )
{
func0();
func1(a1);
va_start(arg, a2);
vfprintf(stream, a2, arg);
result = fputc(10, stream);
}
return result;
}

original_code:
void debug_print(lprec *lp, char *format, ...)
{
  va_list ap;
  if(lp->debug) {
    InitStream();
    print_indent(lp);
    __builtin_va_start(ap,format);
    vfprintf(stream, format, ap);
    fputc('\n', stream);
    __builtin_va_end(ap);
  }
}

canonical_original_code:
void debug_print(struct _lprec *lp, char *format, ...)
{
  __builtin_va_list ap;
  if(lp->debug) {
    InitStream();
    print_indent(lp);
    __builtin_va_start(ap,format);
    vfprintf(stream, format, ap);
    fputc('\n', stream);
    __builtin_va_end(ap);
  }
}


decompiled_code:
int __fastcall print_str(char *s)
{
InitStream();
return fputs(s, stream);
}

canonical_decompiled_code:
int __fastcall func6(char *s)
{
func0();
return fputs(s, stream);
}

original_code:
void print_str(char *str)
{
  InitStream();
  fputs(str, stream);
}

variable_types:
str
char *