main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebp
__int64 *v4; // rbx
unsigned int v5; // eax
int v6; // eax
int v8; // [rsp+0h] [rbp-28h] BYREF
float v9; // [rsp+4h] [rbp-24h] BYREF
__int64 v10[4]; // [rsp+8h] [rbp-20h] BYREF

v4 = 0LL;
v10[0] = tree_create(argc, argv, envp);
while ( 2 )
{
puts(
"0 exit\t\t\t5 delete\n"
"1 top (create)\t\t6 print \n"
"2 youngest brother\t7 curent\n"
"3 eldest son\t\t8 count\n"
"4 add\t\t\t9 count leaves");
if ( scanf("%i", &v8) != 1 )
getchar();
switch ( v8 )
{
case 0:
goto LABEL_8;
case 1:
v3 = 0;
v4 = v10;
continue;
case 2:
if ( !v4 )
goto LABEL_27;
if ( !*v4 || !v3 )
goto LABEL_25;
v4 = (__int64 *)(*v4 + 16);
continue;
case 3:
if ( !v4 )
goto LABEL_27;
if ( !*v4 )
goto LABEL_25;
v4 = (__int64 *)(*v4 + 8);
v3 = 1;
continue;
case 4:
if ( !v4 )
goto LABEL_27;
scanf("%f", &v9);
tree_add(v4, v9);
v6 = v8;
goto LABEL_7;
case 5:
if ( v4 )
{
if ( *v4 )
{
tree_delete(v4);
v6 = v8;
}
else
{
LABEL_25:
puts("ERR ADDRES");
v6 = v8;
}
}
else
{
LABEL_27:
puts("ERR ADDRES!");
v6 = v8;
}
goto LABEL_7;
case 6:
tree_print(v10[0]);
v6 = v8;
goto LABEL_7;
case 7:
cur_data_print(v4);
v6 = v8;
goto LABEL_7;
case 8:
v5 = counter(v10[0]);
goto LABEL_6;
case 9:
v5 = leaves_counter(v10[0]);
LABEL_6:
printf("%d\n", v5);
v6 = v8;
goto LABEL_7;
default:
puts("COMMAND ERR");
v6 = v8;
LABEL_7:
if ( v6 )
continue;
LABEL_8:
tree_delete(v10);
return 1;
}
}
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebp
__int64 *v4; // rbx
unsigned int v5; // eax
int v6; // eax
int v8; // [rsp+0h] [rbp-28h] BYREF
float v9; // [rsp+4h] [rbp-24h] BYREF
__int64 v10[4]; // [rsp+8h] [rbp-20h] BYREF

v4 = 0LL;
v10[0] = func7(argc, argv, envp);
while ( 2 )
{
puts(
"0 exit\t\t\t5 delete\n"
"1 top (create)\t\t6 print \n"
"2 youngest brother\t7 curent\n"
"3 eldest son\t\t8 count\n"
"4 add\t\t\t9 count leaves");
if ( scanf("%i", &v8) != 1 )
getchar();
switch ( v8 )
{
case 0:
goto LABEL_8;
case 1:
v3 = 0;
v4 = v10;
continue;
case 2:
if ( !v4 )
goto LABEL_27;
if ( !*v4 || !v3 )
goto LABEL_25;
v4 = (__int64 *)(*v4 + 16);
continue;
case 3:
if ( !v4 )
goto LABEL_27;
if ( !*v4 )
goto LABEL_25;
v4 = (__int64 *)(*v4 + 8);
v3 = 1;
continue;
case 4:
if ( !v4 )
goto LABEL_27;
scanf("%f", &v9);
func9(v4, v9);
v6 = v8;
goto LABEL_7;
case 5:
if ( v4 )
{
if ( *v4 )
{
func17(v4);
v6 = v8;
}
else
{
LABEL_25:
puts("ERR ADDRES");
v6 = v8;
}
}
else
{
LABEL_27:
puts("ERR ADDRES!");
v6 = v8;
}
goto LABEL_7;
case 6:
func15(v10[0]);
v6 = v8;
goto LABEL_7;
case 7:
func16(v4);
v6 = v8;
goto LABEL_7;
case 8:
v5 = func13(v10[0]);
goto LABEL_6;
case 9:
v5 = func11(v10[0]);
LABEL_6:
printf("%d\n", v5);
v6 = v8;
goto LABEL_7;
default:
puts("COMMAND ERR");
v6 = v8;
LABEL_7:
if ( v6 )
continue;
LABEL_8:
func17(v10);
return 1;
}
}
}

original_code:
int main() {
    Tree tree = tree_create();
    Tree *cur = ((void *)0);
    int choice;
    enum { ROOT, ELSE } check;
    do {
        data_type data;
        printf("0 exit\t\t\t" "5 delete\n"
               "1 top (create)\t\t" "6 print \n"
               "2 youngest brother\t" "7 curent\n"
               "3 eldest son\t\t" "8 count\n"
               "4 add\t\t\t" "9 count leaves\n");
        if (scanf("%i", &choice) != 1)
            getchar();
        switch (choice) {
            case 0:
                break;
            case 1:
                cur = &tree;
                check = ROOT;
                break;
            case 2:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    if (*cur && check != ROOT)
                        cur = &((*cur)->brother);
                    else
                        printf("ERR ADDRES\n");
                }
                break;
            case 3:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    if (*cur) {
                        cur = &((*cur)->son);
                        check = ELSE;
                    }
                    else
                        printf("ERR ADDRES\n");
                }
                break;
            case 4:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    scanf("%f", &data);
                    tree_add(cur, data);
                }
                break;
            case 5:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    if (*cur)
                        tree_delete(cur);
                    else
                        printf("ERR ADDRES\n");
                }
                break;
            case 6:
                tree_print(tree);
                break;
            case 7:
                cur_data_print(cur);
                break;
            case 8:
                printf("%d\n", counter(tree));
                break;
            case 9:
                printf("%d\n", leaves_counter(tree));
                break;
            default:
                printf("COMMAND ERR\n");
                break;
        }
    } while (choice != 0);
    tree_delete(&tree);
    return 1;
}

canonical_original_code:
int main() {
    struct node *tree = tree_create();
    struct node **cur = ((void *)0);
    int choice;
    enum { ROOT=0, ELSE=1 } check;
    do {
        float data;
        printf("0 exit\t\t\t" "5 delete\n"
               "1 top (create)\t\t" "6 print \n"
               "2 youngest brother\t" "7 curent\n"
               "3 eldest son\t\t" "8 count\n"
               "4 add\t\t\t" "9 count leaves\n");
        if (scanf("%i", &choice) != 1)
            getchar();
        switch (choice) {
            case 0:
                break;
            case 1:
                cur = &tree;
                check = ROOT;
                break;
            case 2:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    if (*cur && check != ROOT)
                        cur = &((*cur)->brother);
                    else
                        printf("ERR ADDRES\n");
                }
                break;
            case 3:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    if (*cur) {
                        cur = &((*cur)->son);
                        check = ELSE;
                    }
                    else
                        printf("ERR ADDRES\n");
                }
                break;
            case 4:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    scanf("%f", &data);
                    tree_add(cur, data);
                }
                break;
            case 5:
                if (!cur)
                    printf("ERR ADDRES!\n");
                else {
                    if (*cur)
                        tree_delete(cur);
                    else
                        printf("ERR ADDRES\n");
                }
                break;
            case 6:
                tree_print(tree);
                break;
            case 7:
                cur_data_print(cur);
                break;
            case 8:
                printf("%d\n", counter(tree));
                break;
            case 9:
                printf("%d\n", leaves_counter(tree));
                break;
            default:
                printf("COMMAND ERR\n");
                break;
        }
    } while (choice != 0);
    tree_delete(&tree);
    return 1;
}

variable_types: choice int

variable_types:
check
enum { ROOT=0, ELSE=1 }

variable_types: data float


decompiled_code:
int __fastcall tree_print(__int64 a1)
{
puts("<<<TREE>>>\n");
if ( a1 )
subtree_print(a1, 0);
else
puts("NOTHING");
return puts("\n<<<TREE>>>");
}

canonical_decompiled_code:
int __fastcall func15(__int64 a1)
{
puts("<<<TREE>>>\n");
if ( a1 )
func14(a1, 0);
else
puts("NOTHING");
return puts("\n<<<TREE>>>");
}

original_code:
void tree_print(Tree tree) {
    printf("<<<TREE>>>\n\n");
    if (tree)
        subtree_print(tree, 0);
    else
        printf("NOTHING\n");
    printf("\n<<<TREE>>>\n");
}

canonical_original_code:
void tree_print(struct node *tree) {
    printf("<<<TREE>>>\n\n");
    if (tree)
        subtree_print(tree, 0);
    else
        printf("NOTHING\n");
    printf("\n<<<TREE>>>\n");
}

variable_types: struct node { float data; struct node *son; struct node *brother; } *

return_type: void


decompiled_code:
void __fastcall debug_print_binaryw(unsigned __int64 a1, __int16 a2)
{
int v2; // ebx
unsigned __int16 v3; // ax
bool v4; // zf
__int64 v5; // rsi

v2 = a1;
if ( a1 )
{
v3 = a2 - 1;
v4 = a2 == 0;
v5 = 0LL;
if ( !v4 )
v5 = v3;
debug_print_binaryw(a1 >> 1, v5);
fprintf(stderr, "%hu", a1 & 1);
}
else if ( a2 )
{
do
{
++v2;
fputc(48, stderr);
}
while ( a2 != (_WORD)v2 );
}
}

canonical_decompiled_code:
void __fastcall func7(unsigned __int64 a1, __int16 a2)
{
int v2; // ebx
unsigned __int16 v3; // ax
bool v4; // zf
__int64 v5; // rsi

v2 = a1;
if ( a1 )
{
v3 = a2 - 1;
v4 = a2 == 0;
v5 = 0LL;
if ( !v4 )
v5 = v3;
func7(a1 >> 1, v5);
fprintf(stderr, "%hu", a1 & 1);
}
else if ( a2 )
{
do
{
++v2;
fputc(48, stderr);
}
while ( a2 != (_WORD)v2 );
}
}

original_code:
void debug_print_binaryw(unsigned long input, unsigned short width){
    unsigned short digit = input % 2;
    if(!input){
        unsigned short i;
        for(i = 0; i < width; ++i)
            fprintf(stderr, "0");
    }
    else{
        debug_print_binaryw(input / 2, (width) ? (width - 1) : 0);
        fprintf(stderr, "%hu", digit);
    }
}

variable_types:
input
unsigned long

variable_types:
width
unsigned short

variable_types:
digit
unsigned short

variable_types:
i
unsigned short


decompiled_code:
int __fastcall debug_print_binary(unsigned __int64 a1)
{
debug_print_binaryw(a1, 64);
return fputc(10, stderr);
}

canonical_decompiled_code:
int __fastcall func8(unsigned __int64 a1)
{
func7(a1, 64);
return fputc(10, stderr);
}

original_code:
void debug_print_binary(unsigned long input){
    unsigned short width = sizeof(input) * 8;
    debug_print_binaryw(input, width);
    fprintf(stderr, "\n");
}


decompiled_code:
__int64 __fastcall get_bit(unsigned __int64 a1, char a2)
{
debug_print_binary(a1);
debug_print_binary(a1 >> a2);
return (a1 >> a2) & 1;
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned __int64 a1, char a2)
{
func8(a1);
func8(a1 >> a2);
return (a1 >> a2) & 1;
}

original_code:
int get_bit(unsigned long input_number, unsigned short numbit){
    unsigned long tmp = 0;
    debug_print_binary(input_number);
    tmp = (input_number >> numbit);
    debug_print_binary(tmp);
    if(1L == (tmp & 1L)){
        return 1;
    }
    return 0;
}

variable_types:
numbit
unsigned short

variable_types:
tmp
unsigned long

return_type: int


canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er12
unsigned __int16 v5; // ax
unsigned __int16 v6; // [rsp+6h] [rbp-12h] BYREF
__int64 v7; // [rsp+8h] [rbp-10h] BYREF

v6 = 0;
v7 = 0LL;
if ( scanf("%lu", &v7) == 1 )
{
v3 = 1;
if ( scanf("%hu", &v6) == 1 )
{
v3 = 0;
v5 = get_bit(v7, v6);
printf("%hu\n", v5);
}
else
{
fprintf(stderr, "error: %hu is not number of bit.", v6);
}
}
else
{
v3 = 1;
fprintf(stderr, "error: %lu is not integer number.", v7);
}
return v3;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er12
unsigned __int16 v5; // ax
unsigned __int16 v6; // [rsp+6h] [rbp-12h] BYREF
__int64 v7; // [rsp+8h] [rbp-10h] BYREF

v6 = 0;
v7 = 0LL;
if ( scanf("%lu", &v7) == 1 )
{
v3 = 1;
if ( scanf("%hu", &v6) == 1 )
{
v3 = 0;
v5 = func9(v7, v6);
printf("%hu\n", v5);
}
else
{
fprintf(stderr, "error: %hu is not number of bit.", v6);
}
}
else
{
v3 = 1;
fprintf(stderr, "error: %lu is not integer number.", v7);
}
return v3;
}

original_code:
int main(){
    unsigned long input_number = 0;
    unsigned short numbit = 0;
    unsigned short bit = 2;
    if(scanf("%lu", &input_number) != 1){
        fprintf(stderr, "error: %lu is not integer number.", input_number);
        return 1;
    }
    if(scanf("%hu", &numbit) != 1){
        fprintf(stderr, "error: %hu is not number of bit.", numbit);
        return 1;
    }
    bit = get_bit(input_number, numbit);
    printf("%hu\n", bit);
    return 0;
}

variable_types:
bit
unsigned short


decompiled_code:
void __fastcall target_1_xfx(double a1)
{
double v1; // xmm0_8

v1 = 1.0 - a1;
if ( v1 >= 0.0 )
atan(sqrt(v1));
}

canonical_decompiled_code:
void __fastcall func8(double a1)
{
double v1; // xmm0_8

v1 = 1.0 - a1;
if ( v1 >= 0.0 )
atan(sqrt(v1));
}

original_code:
real_t target_1_xfx(real_t x) {
    if ((1 - x) >= 0)
        return atan(sqrt(1 - x));
    return (__builtin_nanf (""));
}

canonical_original_code:
double target_1_xfx(double x) {
    if ((1 - x) >= 0)
        return atan(sqrt(1 - x));
    return (__builtin_nanf (""));
}

variable_types: x double

return_type: double


decompiled_code:
double __fastcall target_2(double a1)
{
double v1; // xmm0_8

v1 = pow(a1, 0.52);
return cos(v1 + 2.0) + a1;
}

canonical_decompiled_code:
double __fastcall func9(double a1)
{
double v1; // xmm0_8

v1 = pow(a1, 0.52);
return cos(v1 + 2.0) + a1;
}

original_code:
real_t target_2(real_t x) {
    return x + cos(pow(x, 0.52) + 2);
}

canonical_original_code:
double target_2(double x) {
    return x + cos(pow(x, 0.52) + 2);
}


original_code:
real_t target_2_xfx(real_t x) {
    return -cos(pow(x, 0.52) + 2);
}

canonical_original_code:
double target_2_xfx(double x) {
    return -cos(pow(x, 0.52) + 2);
}


iterations

original_code:
real_t iterations(fun_t fun, real_t a_0, real_t b_0) {
    real_t a = a_0;
    real_t b = b_0;
    real_t x_0 = (a + b) / 2;
    real_t x = fun(x_0);
    while (fabs(x - x_0) >= REAL_EPSILON) {
        x_0 = x;
        x = fun(x_0);
    }
    return x;
}

canonical_original_code:
double iterations(double (*fun)(double), double a_0, double b_0) {
    double a = a_0;
    double b = b_0;
    double x_0 = (a + b) / 2;
    double x = fun(x_0);
    while (fabs(x - x_0) >= REAL_EPSILON) {
        x_0 = x;
        x = fun(x_0);
    }
    return x;
}

variable_types:
fun
double (*)(double)

variable_types: a double

variable_types: b double


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
double v3; // xmm0_8
double v4; // xmm0_8
double v5; // xmm0_8
__int64 v6; // rdx
double v7; // xmm0_8
double v8; // xmm0_8
double v9; // xmm0_8

v3 = dichotomy(target_1, argv, envp, 0.0, 1.0);
printf(format, 16LL, v3, 0.0, 1.0);
v4 = iterations(target_1_xfx, 0.0, 1.0);
printf(aTarget10XFIter, 16LL, v4, 0.0, 1.0);
v5 = newton(target_1, target_1_derivative, 0.0, 1.0);
printf(aTarget10XFNewt, 16LL, v5, 0.0, 1.0);
v7 = dichotomy(target_2, 16LL, v6, 0.5, 1.0);
printf(aTarget20XFDich, 16LL, v7, 0.5, 1.0);
v8 = iterations(target_2_xfx, 0.5, 1.0);
printf(aTarget20XFIter, 16LL, v8, 0.5, 1.0);
v9 = newton(target_2, target_2_derivative, 0.5, 1.0);
printf(aTarget20XFNewt, 16LL, v9, 0.5, 1.0);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
double v3; // xmm0_8
double v4; // xmm0_8
double v5; // xmm0_8
__int64 v6; // rdx
double v7; // xmm0_8
double v8; // xmm0_8
double v9; // xmm0_8

v3 = dichotomy(target_1, argv, envp, 0.0, 1.0);
printf(format, 16LL, v3, 0.0, 1.0);
v4 = func11(target_1_xfx, 0.0, 1.0);
printf(aTarget10XFIter, 16LL, v4, 0.0, 1.0);
v5 = newton(target_1, target_1_derivative, 0.0, 1.0);
printf(aTarget10XFNewt, 16LL, v5, 0.0, 1.0);
v7 = dichotomy(target_2, 16LL, v6, 0.5, 1.0);
printf(aTarget20XFDich, 16LL, v7, 0.5, 1.0);
v8 = func11(target_2_xfx, 0.5, 1.0);
printf(aTarget20XFIter, 16LL, v8, 0.5, 1.0);
v9 = newton(target_2, target_2_derivative, 0.5, 1.0);
printf(aTarget20XFNewt, 16LL, v9, 0.5, 1.0);
return 0;
}

original_code:
int main() {
    int epswidth = ceil(-log10(REAL_EPSILON));
    printf(
        "target_1 = 0, x = %.*f; dichotomy,  x ∈ [%f, %f]\n",
        epswidth,
        dichotomy(target_1, TARGET_1_A, TARGET_1_B),
        TARGET_1_A, TARGET_1_B
    );
    printf(
        "target_1 = 0, x = %.*f; iterations, x ∈ [%f, %f]\n",
        epswidth,
        iterations(target_1_xfx, TARGET_1_A, TARGET_1_B),
        TARGET_1_A, TARGET_1_B
    );
    printf(
        "target_1 = 0, x = %.*f; newton,     x ∈ [%f, %f]\n",
        epswidth,
        newton(target_1, target_1_derivative, TARGET_1_A, TARGET_1_B),
        TARGET_1_A, TARGET_1_B
    );
    printf(
        "target_2 = 0, x = %.*f; dichotomy,  x ∈ [%f, %f]\n",
        epswidth,
        dichotomy(target_2, TARGET_2_A, TARGET_2_B),
        TARGET_2_A, TARGET_2_B
    );
    printf(
        "target_2 = 0, x = %.*f; iterations, x ∈ [%f, %f]\n",
        epswidth,
        iterations(target_2_xfx, TARGET_2_A, TARGET_2_B),
        TARGET_2_A, TARGET_2_B
    );
    printf(
        "target_2 = 0, x = %.*f; newton,     x ∈ [%f, %f]\n",
        epswidth,
        newton(target_2, target_2_derivative, TARGET_2_A, TARGET_2_B),
        TARGET_2_A, TARGET_2_B
    );
    return (0);
}

variable_types: epswidth int


decompiled_code:
__int64 __fastcall student_scanf(__int64 a1)
{
return student_fscanf((FILE *)stdin, a1);
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1)
{
return func12((FILE *)stdin, a1);
}

original_code:
int student_scanf(student_t* student_pointer){
    return student_fscanf(stdin, student_pointer);
}

canonical_original_code:
int student_scanf(struct __student__ *student_pointer){
    return student_fscanf(stdin, student_pointer);
}

variable_types: struct __student__ { unsigned long number; enum gender_t { MALE=expr, FEMALE=expr } gender; char group[8]; char name[32]; enum passed_t { NOT_PASSED=0, PASSED=1 } physical_culture; enum passed_t { NOT_PASSED=0, PASSED=1 } english; enum mark_t { BAD=2, SATISFACTORY=3, GOOD=4, EXCELLENT=5 } mathematical_analysis; enum mark_t { BAD=2, SATISFACTORY=3, GOOD=4, EXCELLENT=5 } discrete_mathematics; enum mark_t { BAD=2, SATISFACTORY=3, GOOD=4, EXCELLENT=5 } linear_algebra; enum mark_t { BAD=2, SATISFACTORY=3, GOOD=4, EXCELLENT=5 } informatics; enum mark_t { BAD=2, SATISFACTORY=3, GOOD=4, EXCELLENT=5 } history; } *

user_defined_types: struct __student__ { unsigned long number; enum gender_t gender; char group[8]; char name[32]; enum passed_t physical_culture; enum passed_t english; enum mark_t mathematical_analysis; enum mark_t discrete_mathematics; enum mark_t linear_algebra; enum mark_t informatics; enum mark_t history; }


decompiled_code:
__int64 __fastcall student_printf(__int64 a1)
{
return student_fprintf(stdout, a1);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
return func14(stdout, a1);
}

original_code:
int student_printf(student_t* student_pointer){
    return student_fprintf(stdout, student_pointer);
}

canonical_original_code:
int student_printf(struct __student__ *student_pointer){
    return student_fprintf(stdout, student_pointer);
}

user_defined_types: enum gender_t { MALE=expr, FEMALE=expr }

user_defined_types: enum passed_t { NOT_PASSED=0, PASSED=1 }

user_defined_types: enum mark_t { BAD=2, SATISFACTORY=3, GOOD=4, EXCELLENT=5 }


decompiled_code:
_BOOL8 __fastcall is_upper(__int16 a1)
{
return (unsigned __int16)(a1 - 65) <= 0x19u;
}

canonical_decompiled_code:
_BOOL8 __fastcall func8(__int16 a1)
{
return (unsigned __int16)(a1 - 65) <= 0x19u;
}

canonical_original_code:
enum bool_t is_upper(short symbol){
    if (('A' <= symbol) && (symbol <= 'Z'))
        return TRUE;
    return FALSE;
}

variable_types: symbol short

return_type: enum bool_t { FALSE=0, TRUE=1 }


decompiled_code:
_BOOL8 __fastcall is_lower(__int16 a1)
{
return (unsigned __int16)(a1 - 97) <= 0x19u;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(__int16 a1)
{
return (unsigned __int16)(a1 - 97) <= 0x19u;
}

canonical_original_code:
enum bool_t is_lower(short symbol){
    if (('a' <= symbol) && (symbol <= 'z'))
        return TRUE;
    return FALSE;
}


cycle

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

result = a1;
if ( (__int16)a1 < (__int16)a2 )
{
do
result = (unsigned int)(a3 + result + 1 - a2);
while ( (__int16)result < (__int16)a2 );
}
for ( ; (__int16)a3 < (__int16)result; result = (unsigned int)(a2 + result - 1 - a3) )
;
return result;
}

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

result = a1;
if ( (__int16)a1 < (__int16)a2 )
{
do
result = (unsigned int)(a3 + result + 1 - a2);
while ( (__int16)result < (__int16)a2 );
}
for ( ; (__int16)a3 < (__int16)result; result = (unsigned int)(a2 + result - 1 - a3) )
;
return result;
}

original_code:
short cycle(short symbol, short start, short stop){
    while (symbol < start){
        symbol = symbol + (stop - start + 1);
    }
    while (stop < symbol){
        symbol = symbol - (stop - start + 1);
    }
    return symbol;
}

variable_types: start short

variable_types: stop short

return_type: short


offset

decompiled_code:
__int64 __fastcall offset(__int16 a1, __int16 a2)
{
__int16 v2; // si
__int16 v3; // r8
__int16 v4; // r8
unsigned int v5; // edx

v2 = a1 + a2;
if ( is_digit(a1) )
return cycle(v2, 48, 57);
if ( is_lower(v3) )
return cycle(v2, 97, 122);
if ( is_upper(v4) )
return cycle(v2, 65, 90);
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int16 a1, __int16 a2)
{
__int16 v2; // si
__int16 v3; // r8
__int16 v4; // r8
unsigned int v5; // edx

v2 = a1 + a2;
if ( func7(a1) )
return func10(v2, 48, 57);
if ( func9(v3) )
return func10(v2, 97, 122);
if ( func8(v4) )
return func10(v2, 65, 90);
return v5;
}

original_code:
short offset(short symbol, int counter){
    short new_symbol = symbol + counter;
    if (is_digit(symbol)){
        return cycle(new_symbol, '0', '9');
    }
    if (is_lower(symbol)){
        return cycle(new_symbol, 'a', 'z');
    }
    if (is_upper(symbol)){
        return cycle(new_symbol, 'A', 'Z');
    }
    return symbol;
}

variable_types: counter int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // ebp
__int16 v4; // bx
__int16 v5; // ax

LOWORD(v3) = 0;
while ( 1 )
{
v4 = getchar();
if ( v4 == -1 )
break;
while ( 1 )
{
v5 = offset((unsigned int)v4, (unsigned int)(__int16)v3);
putchar(v5);
if ( v4 != 32 )
break;
v3 = (__int16)(v3 + 1) % 0x1Au;
v4 = getchar();
if ( v4 == -1 )
goto LABEL_5;
}
}
LABEL_5:
putchar(10);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // ebp
__int16 v4; // bx
__int16 v5; // ax

LOWORD(v3) = 0;
while ( 1 )
{
v4 = getchar();
if ( v4 == -1 )
break;
while ( 1 )
{
v5 = func11((unsigned int)v4, (unsigned int)(__int16)v3);
putchar(v5);
if ( v4 != 32 )
break;
v3 = (__int16)(v3 + 1) % 0x1Au;
v4 = getchar();
if ( v4 == -1 )
goto LABEL_5;
}
}
LABEL_5:
putchar(10);
return 0;
}

original_code:
int main() {
    short symbol = 0;
    short counter = 0;
    while ((-1) != (symbol = getchar())) {
        short new_symbol = offset(symbol, counter);
        putchar(new_symbol);
        if(' ' == symbol) {
            counter = (counter + 1) % 26;
        }
    }
    putchar('\n');
    return 0;
}

variable_types: counter short


decompiled_code:
_BOOL8 __fastcall is_digit(__int16 a1)
{
return (unsigned __int16)(a1 - 48) <= 9u;
}

canonical_decompiled_code:
_BOOL8 __fastcall func7(__int16 a1)
{
return (unsigned __int16)(a1 - 48) <= 9u;
}

canonical_original_code:
enum bool_t is_digit(short symbol){
    if (('0' <= symbol) && (symbol <= '9'))
        return TRUE;
    return FALSE;
}


decompiled_code:
__int64 __fastcall op_preced(char a1)
{
unsigned __int8 v1; // di
__int64 result; // rax

v1 = a1 - 33;
result = 0LL;
if ( v1 <= 0x1Cu )
result = (unsigned int)CSWTCH_11[v1];
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(char a1)
{
unsigned __int8 v1; // di
__int64 result; // rax

v1 = a1 - 33;
result = 0LL;
if ( v1 <= 0x1Cu )
result = (unsigned int)CSWTCH_11[v1];
return result;
}

original_code:
int op_preced(const char c) {
    switch (c) {
        case '!':
            return 4;
        case '*':
        case '/':
        case '%':
            return 3;
        case '+':
        case '-':
            return 2;
        case '=':
            return 1;
    }
    return 0;
}

canonical_original_code:
int op_preced(char c) {
    switch (c) {
        case '!':
            return 4;
        case '*':
        case '/':
        case '%':
            return 3;
        case '+':
        case '-':
            return 2;
        case '=':
            return 1;
    }
    return 0;
}

variable_types: c char


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

switch ( a1 )
{
case '%':
case '*':
case '+':
case '-':
case '/':
case '=':
result = 1LL;
break;
default:
result = 0LL;
break;
}
return result;
}

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

switch ( a1 )
{
case '%':
case '*':
case '+':
case '-':
case '/':
case '=':
result = 1LL;
break;
default:
result = 0LL;
break;
}
return result;
}

original_code:
_Bool op_left_assoc(const char c) {
    switch (c) {
        case '*':
        case '/':
        case '%':
        case '+':
        case '-':
        case '=':
            return 1;
        case '!':
            return 0;
    }
    return 0;
}

canonical_original_code:
_Bool op_left_assoc(char c) {
    switch (c) {
        case '*':
        case '/':
        case '%':
        case '+':
        case '-':
        case '=':
            return 1;
        case '!':
            return 0;
    }
    return 0;
}


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

switch ( a1 )
{
case '!':
result = 1LL;
break;
case '%':
case '*':
case '+':
case '-':
case '/':
case '=':
result = 2LL;
break;
default:
result = (unsigned int)(a1 - 65);
break;
}
return result;
}

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

switch ( a1 )
{
case '!':
result = 1LL;
break;
case '%':
case '*':
case '+':
case '-':
case '/':
case '=':
result = 2LL;
break;
default:
result = (unsigned int)(a1 - 65);
break;
}
return result;
}

original_code:
unsigned int op_arg_count(const char c) {
    switch (c) {
        case '*':
        case '/':
        case '%':
        case '+':
        case '-':
        case '=':
            return 2;
        case '!':
            return 1;
        default:
            return c - 'A';
    }
    return 0;
}

canonical_original_code:
unsigned int op_arg_count(char c) {
    switch (c) {
        case '*':
        case '/':
        case '%':
        case '+':
        case '-':
        case '=':
            return 2;
        case '!':
            return 1;
        default:
            return c - 'A';
    }
    return 0;
}

return_type: unsigned int


decompiled_code:
__int64 __fastcall shunting_yard(const char *a1, char *a2)
{
char *v2; // rbp
size_t v4; // rax
char *v5; // r14
__int64 v6; // r15
unsigned int v7; // er10
unsigned __int64 v8; // r9
__int64 v9; // rax
char *i; // rax
char v13; // r12
char *v14; // r11
unsigned __int64 v15; // rsi
__int64 v16; // r13
int v17; // eax
int v18; // edx
int v19; // ecx
__int64 v20; // r11
char v21; // r8
__int64 v22; // rax
char *v23; // rcx
unsigned int v24; // eax
__int64 v25; // rdx
char *v26; // rax
unsigned int v27; // esi
__int64 v28; // rsi
char v29; // al
unsigned __int8 v30; // [rsp+Fh] [rbp-59h]
char v31[88]; // [rsp+10h] [rbp-58h] BYREF

v2 = (char *)a1;
v4 = strlen(a1);
v5 = (char *)&a1[v4];
if ( a1 >= &a1[v4] )
{
LABEL_48:
*a2 = 0;
return 1;
}
v6 = 0x2000AC2200000000LL;
v7 = 0;
while ( 1 )
{
while ( 1 )
{
v8 = (unsigned __int8)*v2;
if ( (_BYTE)v8 == 32 )
goto LABEL_4;
if ( (unsigned __int8)(v8 - 97) <= 0x19u || (unsigned __int8)(v8 - 48) <= 9u )
{
*a2++ = v8;
goto LABEL_4;
}
if ( (unsigned __int8)(v8 - 65) > 0x19u )
break;
v9 = v7;
++v2;
++v7;
v31[v9] = v8;
if ( v5 == v2 )
{
LABEL_9:
if ( !v7 )
goto LABEL_48;
for ( i = &v31[v7 - 1]; (unsigned __int8)(*i - 40) > 1u; --i )
{
*a2++ = *i;
if ( v31 == i )
goto LABEL_48;
}
LABEL_14:
puts("Error: parentheses mismatched");
return 0;
}
}
if ( (_BYTE)v8 == 44 )
break;
if ( (unsigned __int8)v8 > 0x3Du )
goto LABEL_18;
if ( _bittest64(&v6, v8) )
{
if ( v7 )
{
v13 = *v2;
v14 = &v31[v7 - 1];
while ( 1 )
{
v15 = (unsigned __int8)*v14;
v16 = v7;
if ( (unsigned __int8)v15 > 0x3Du || !_bittest64(&v6, v15) )
break;
op_left_assoc(v13);
op_preced(v13);
v17 = op_preced(v15);
if ( v21 )
{
if ( v19 > v17 )
break;
}
else if ( v19 >= v17 )
{
break;
}
*a2 = v15;
v14 = (char *)(v20 - 1);
++a2;
if ( !v18 )
goto LABEL_33;
}
v7 = v16 + 1;
}
else
{
LABEL_33:
v16 = 0LL;
v7 = 1;
}
v31[v16] = v8;
}
else if ( (_BYTE)v8 == 40 )
{
v22 = v7++;
v31[v22] = 40;
}
else
{
if ( (_BYTE)v8 != 41 )
{
LABEL_18:
v30 = 0;
printf("Unknown token %c\n", (unsigned int)(char)v8);
return v30;
}
if ( !v7 )
goto LABEL_14;
v25 = v7 - 1;
v26 = &v31[v25];
while ( 1 )
{
v27 = v7;
v7 = v25;
if ( *v26 == 40 )
break;
*a2++ = *v26--;
if ( !(_DWORD)v25 )
goto LABEL_14;
LODWORD(v25) = v25 - 1;
}
if ( (_DWORD)v25 )
{
v28 = v27 - 2;
v29 = v31[v28];
if ( (unsigned __int8)(v29 - 65) <= 0x19u )
{
*a2 = v29;
v7 = v28;
++a2;
}
}
}
LABEL_4:
if ( v5 == ++v2 )
goto LABEL_9;
}
if ( v7 )
{
v23 = &v31[v7 - 1];
v24 = v7;
do
{
v7 = v24--;
if ( *v23 == 40 )
goto LABEL_4;
*a2++ = *v23--;
}
while ( v24 );
}
v30 = 0;
puts("Error: separator or parentheses mismatched");
return v30;
}

canonical_decompiled_code:
__int64 __fastcall func10(const char *a1, char *a2)
{
char *v2; // rbp
size_t v4; // rax
char *v5; // r14
__int64 v6; // r15
unsigned int v7; // er10
unsigned __int64 v8; // r9
__int64 v9; // rax
char *i; // rax
char v13; // r12
char *v14; // r11
unsigned __int64 v15; // rsi
__int64 v16; // r13
int v17; // eax
int v18; // edx
int v19; // ecx
__int64 v20; // r11
char v21; // r8
__int64 v22; // rax
char *v23; // rcx
unsigned int v24; // eax
__int64 v25; // rdx
char *v26; // rax
unsigned int v27; // esi
__int64 v28; // rsi
char v29; // al
unsigned __int8 v30; // [rsp+Fh] [rbp-59h]
char v31[88]; // [rsp+10h] [rbp-58h] BYREF

v2 = (char *)a1;
v4 = strlen(a1);
v5 = (char *)&a1[v4];
if ( a1 >= &a1[v4] )
{
LABEL_48:
*a2 = 0;
return 1;
}
v6 = 0x2000AC2200000000LL;
v7 = 0;
while ( 1 )
{
while ( 1 )
{
v8 = (unsigned __int8)*v2;
if ( (_BYTE)v8 == 32 )
goto LABEL_4;
if ( (unsigned __int8)(v8 - 97) <= 0x19u || (unsigned __int8)(v8 - 48) <= 9u )
{
*a2++ = v8;
goto LABEL_4;
}
if ( (unsigned __int8)(v8 - 65) > 0x19u )
break;
v9 = v7;
++v2;
++v7;
v31[v9] = v8;
if ( v5 == v2 )
{
LABEL_9:
if ( !v7 )
goto LABEL_48;
for ( i = &v31[v7 - 1]; (unsigned __int8)(*i - 40) > 1u; --i )
{
*a2++ = *i;
if ( v31 == i )
goto LABEL_48;
}
LABEL_14:
puts("Error: parentheses mismatched");
return 0;
}
}
if ( (_BYTE)v8 == 44 )
break;
if ( (unsigned __int8)v8 > 0x3Du )
goto LABEL_18;
if ( _bittest64(&v6, v8) )
{
if ( v7 )
{
v13 = *v2;
v14 = &v31[v7 - 1];
while ( 1 )
{
v15 = (unsigned __int8)*v14;
v16 = v7;
if ( (unsigned __int8)v15 > 0x3Du || !_bittest64(&v6, v15) )
break;
func8(v13);
func7(v13);
v17 = func7(v15);
if ( v21 )
{
if ( v19 > v17 )
break;
}
else if ( v19 >= v17 )
{
break;
}
*a2 = v15;
v14 = (char *)(v20 - 1);
++a2;
if ( !v18 )
goto LABEL_33;
}
v7 = v16 + 1;
}
else
{
LABEL_33:
v16 = 0LL;
v7 = 1;
}
v31[v16] = v8;
}
else if ( (_BYTE)v8 == 40 )
{
v22 = v7++;
v31[v22] = 40;
}
else
{
if ( (_BYTE)v8 != 41 )
{
LABEL_18:
v30 = 0;
printf("Unknown token %c\n", (unsigned int)(char)v8);
return v30;
}
if ( !v7 )
goto LABEL_14;
v25 = v7 - 1;
v26 = &v31[v25];
while ( 1 )
{
v27 = v7;
v7 = v25;
if ( *v26 == 40 )
break;
*a2++ = *v26--;
if ( !(_DWORD)v25 )
goto LABEL_14;
LODWORD(v25) = v25 - 1;
}
if ( (_DWORD)v25 )
{
v28 = v27 - 2;
v29 = v31[v28];
if ( (unsigned __int8)(v29 - 65) <= 0x19u )
{
*a2 = v29;
v7 = v28;
++a2;
}
}
}
LABEL_4:
if ( v5 == ++v2 )
goto LABEL_9;
}
if ( v7 )
{
v23 = &v31[v7 - 1];
v24 = v7;
do
{
v7 = v24--;
if ( *v23 == 40 )
goto LABEL_4;
*a2++ = *v23--;
}
while ( v24 );
}
v30 = 0;
puts("Error: separator or parentheses mismatched");
return v30;
}

original_code:
_Bool shunting_yard(const char *input, char *output) {
    const char *strpos = input, *strend = input + strlen(input);
    char c, stack[32], sc, *outpos = output;
    unsigned int sl = 0;
    while (strpos < strend) {
        c = *strpos;
        if (c != ' ') {
            if (((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z'))) {
                *outpos = c;
                ++outpos;
            }
            else if ((c >= 'A' && c <= 'Z')) {
                stack[sl] = c;
                ++sl;
            }
            else if (c == ',') {
                _Bool pe = 0;
                while (sl > 0) {
                    sc = stack[sl - 1];
                    if (sc == '(') {
                        pe = 1;
                        break;
                    }
                    else {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                }
                if (!pe) {
                    printf("Error: separator or parentheses mismatched\n");
                    return 0;
                }
            }
            else if ((c == '+' || c == '-' || c == '/' || c == '*' || c == '!' || c == '%' || c == '=')) {
                while (sl > 0) {
                    sc = stack[sl - 1];
                    if ((sc == '+' || sc == '-' || sc == '/' || sc == '*' || sc == '!' || sc == '%' || sc == '=') &&
                        ((op_left_assoc(c) && (op_preced(c) <= op_preced(sc)))
                         || (!op_left_assoc(c)
                             && (op_preced(c) < op_preced(sc))))) {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                    else {
                        break;
                    }
                }
                stack[sl] = c;
                ++sl;
            }
            else if (c == '(') {
                stack[sl] = c;
                ++sl;
            }
            else if (c == ')') {
                _Bool pe = 0;
                while (sl > 0) {
                    sc = stack[sl - 1];
                    if (sc == '(') {
                        pe = 1;
                        break;
                    }
                    else {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                }
                if (!pe) {
                    printf("Error: parentheses mismatched\n");
                    return 0;
                }
                sl--;
                if (sl > 0) {
                    sc = stack[sl - 1];
                    if ((sc >= 'A' && sc <= 'Z')) {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                }
            }
            else {
                printf("Unknown token %c\n", c);
                return 0;
            }
        }
        ++strpos;
    }
    while (sl > 0) {
        sc = stack[sl - 1];
        if (sc == '(' || sc == ')') {
            printf("Error: parentheses mismatched\n");
            return 0;
        }
        *outpos = sc;
        ++outpos;
        --sl;
    }
    *outpos = 0;
    return 1;
}

canonical_original_code:
_Bool shunting_yard(char *input, char *output) {
    char *strpos = input; char *strend = input + strlen(input);
    char c; char stack[32]; char sc; char *outpos = output;
    unsigned int sl = 0;
    while (strpos < strend) {
        c = *strpos;
        if (c != ' ') {
            if (((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z'))) {
                *outpos = c;
                ++outpos;
            }
            else if ((c >= 'A' && c <= 'Z')) {
                stack[sl] = c;
                ++sl;
            }
            else if (c == ',') {
                _Bool pe = 0;
                while (sl > 0) {
                    sc = stack[sl - 1];
                    if (sc == '(') {
                        pe = 1;
                        break;
                    }
                    else {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                }
                if (!pe) {
                    printf("Error: separator or parentheses mismatched\n");
                    return 0;
                }
            }
            else if ((c == '+' || c == '-' || c == '/' || c == '*' || c == '!' || c == '%' || c == '=')) {
                while (sl > 0) {
                    sc = stack[sl - 1];
                    if ((sc == '+' || sc == '-' || sc == '/' || sc == '*' || sc == '!' || sc == '%' || sc == '=') &&
                        ((op_left_assoc(c) && (op_preced(c) <= op_preced(sc)))
                         || (!op_left_assoc(c)
                             && (op_preced(c) < op_preced(sc))))) {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                    else {
                        break;
                    }
                }
                stack[sl] = c;
                ++sl;
            }
            else if (c == '(') {
                stack[sl] = c;
                ++sl;
            }
            else if (c == ')') {
                _Bool pe = 0;
                while (sl > 0) {
                    sc = stack[sl - 1];
                    if (sc == '(') {
                        pe = 1;
                        break;
                    }
                    else {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                }
                if (!pe) {
                    printf("Error: parentheses mismatched\n");
                    return 0;
                }
                sl--;
                if (sl > 0) {
                    sc = stack[sl - 1];
                    if ((sc >= 'A' && sc <= 'Z')) {
                        *outpos = sc;
                        ++outpos;
                        sl--;
                    }
                }
            }
            else {
                printf("Unknown token %c\n", c);
                return 0;
            }
        }
        ++strpos;
    }
    while (sl > 0) {
        sc = stack[sl - 1];
        if (sc == '(' || sc == ')') {
            printf("Error: parentheses mismatched\n");
            return 0;
        }
        *outpos = sc;
        ++outpos;
        --sl;
    }
    *outpos = 0;
    return 1;
}

variable_types:
input
char *

variable_types:
output
char *

variable_types:
strpos
char *

variable_types:
strend
char *

variable_types:
stack
char [32]

variable_types: sc char

variable_types:
outpos
char *

variable_types:
sl
unsigned int


decompiled_code:
__int64 __fastcall execution_order(char *s)
{
unsigned int v1; // er15
char *v2; // r14
unsigned int v3; // ebp
size_t v4; // rax
unsigned __int64 v5; // rbx
__int64 v6; // rsi
unsigned int v7; // ebx
unsigned int v8; // er13
__int64 v9; // rax
__int64 v10; // rax
unsigned int v12; // ecx
__int64 v13; // r13
__int64 v14; // rax
unsigned int v15; // eax
unsigned int v16; // er8
unsigned int v17; // ebx
char *v18; // [rsp+8h] [rbp-D0h]
int v19; // [rsp+18h] [rbp-C0h] BYREF
char sa[4]; // [rsp+1Ch] [rbp-BCh] BYREF
int v21[46]; // [rsp+20h] [rbp-B8h]

v1 = 0;
v2 = s;
v3 = 0;
puts("order: (arguments in reverse order)");
v4 = strlen(s);
v18 = &s[v4];
if ( v2 >= &v2[v4] )
return 0LL;
do
{
while ( 1 )
{
v5 = (unsigned int)*v2;
if ( (unsigned __int8)(*v2 - 48) <= 9u || (unsigned __int8)(*v2 - 97) <= 0x19u )
{
v10 = v1++;
v21[v10] = v5;
goto LABEL_12;
}
if ( (unsigned __int8)*v2 <= 0x3Du )
break;
if ( (unsigned __int8)(*v2 - 65) <= 0x19u )
{
sprintf(sa, "_%02d", v3++);
printf("%s = ", sa);
v6 = (unsigned int)(char)v5;
v7 = op_arg_count(v5);
if ( v1 < v7 )
return 0LL;
printf("%c(", v6);
if ( v7 )
{
v8 = v1 - v7;
while ( 1 )
{
v9 = v8++;
v19 = v21[v9];
if ( v1 == v8 )
break;
printf("%s, ", (const char *)&v19);
}
printf("%s)\n", (const char *)&v19);
}
v12 = v1 - v7;
v1 = v1 - v7 + 1;
v13 = v12;
goto LABEL_17;
}
LABEL_12:
if ( v18 == ++v2 )
goto LABEL_13;
}
v14 = 0x2000AC2200000000LL;
if ( !_bittest64(&v14, v5) )
goto LABEL_12;
sprintf(sa, "_%02d", v3++);
printf("%s = ", sa);
v15 = op_arg_count(v5);
if ( v15 > v1 )
return 0LL;
v17 = v1 - 1;
if ( v15 == 1 )
{
v13 = v17;
v19 = v21[v17];
printf("%c %s;\n", v16, (const char *)&v19);
}
else
{
v13 = v1 - 2;
--v1;
v19 = v21[v13];
printf("%s %c ", (const char *)&v19, v16);
v19 = v21[v17];
printf("%s;\n", (const char *)&v19);
}
LABEL_17:
++v2;
v21[v13] = *(_DWORD *)sa;
}
while ( v18 != v2 );
LABEL_13:
if ( v1 != 1 )
return 0LL;
v19 = v21[0];
printf("%s is a result\n", (const char *)&v19);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(char *s)
{
unsigned int v1; // er15
char *v2; // r14
unsigned int v3; // ebp
size_t v4; // rax
unsigned __int64 v5; // rbx
__int64 v6; // rsi
unsigned int v7; // ebx
unsigned int v8; // er13
__int64 v9; // rax
__int64 v10; // rax
unsigned int v12; // ecx
__int64 v13; // r13
__int64 v14; // rax
unsigned int v15; // eax
unsigned int v16; // er8
unsigned int v17; // ebx
char *v18; // [rsp+8h] [rbp-D0h]
int v19; // [rsp+18h] [rbp-C0h] BYREF
char sa[4]; // [rsp+1Ch] [rbp-BCh] BYREF
int v21[46]; // [rsp+20h] [rbp-B8h]

v1 = 0;
v2 = s;
v3 = 0;
puts("order: (arguments in reverse order)");
v4 = strlen(s);
v18 = &s[v4];
if ( v2 >= &v2[v4] )
return 0LL;
do
{
while ( 1 )
{
v5 = (unsigned int)*v2;
if ( (unsigned __int8)(*v2 - 48) <= 9u || (unsigned __int8)(*v2 - 97) <= 0x19u )
{
v10 = v1++;
v21[v10] = v5;
goto LABEL_12;
}
if ( (unsigned __int8)*v2 <= 0x3Du )
break;
if ( (unsigned __int8)(*v2 - 65) <= 0x19u )
{
sprintf(sa, "_%02d", v3++);
printf("%s = ", sa);
v6 = (unsigned int)(char)v5;
v7 = func9(v5);
if ( v1 < v7 )
return 0LL;
printf("%c(", v6);
if ( v7 )
{
v8 = v1 - v7;
while ( 1 )
{
v9 = v8++;
v19 = v21[v9];
if ( v1 == v8 )
break;
printf("%s, ", (const char *)&v19);
}
printf("%s)\n", (const char *)&v19);
}
v12 = v1 - v7;
v1 = v1 - v7 + 1;
v13 = v12;
goto LABEL_17;
}
LABEL_12:
if ( v18 == ++v2 )
goto LABEL_13;
}
v14 = 0x2000AC2200000000LL;
if ( !_bittest64(&v14, v5) )
goto LABEL_12;
sprintf(sa, "_%02d", v3++);
printf("%s = ", sa);
v15 = func9(v5);
if ( v15 > v1 )
return 0LL;
v17 = v1 - 1;
if ( v15 == 1 )
{
v13 = v17;
v19 = v21[v17];
printf("%c %s;\n", v16, (const char *)&v19);
}
else
{
v13 = v1 - 2;
--v1;
v19 = v21[v13];
printf("%s %c ", (const char *)&v19, v16);
v19 = v21[v17];
printf("%s;\n", (const char *)&v19);
}
LABEL_17:
++v2;
v21[v13] = *(_DWORD *)sa;
}
while ( v18 != v2 );
LABEL_13:
if ( v1 != 1 )
return 0LL;
v19 = v21[0];
printf("%s is a result\n", (const char *)&v19);
return 1LL;
}

original_code:
_Bool execution_order(const char *input) {
    printf("order: (arguments in reverse order)\n");
    const char *strpos = input, *strend = input + strlen(input);
    char c, res[4];
    unsigned int sl = 0, sc, stack[32], rn = 0;
    while (strpos < strend) {
        c = *strpos;
        if (((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z'))) {
            stack[sl] = c;
            ++sl;
        }
        else if ((c == '+' || c == '-' || c == '/' || c == '*' || c == '!' || c == '%' || c == '=') || (c >= 'A' && c <= 'Z')) {
            sprintf(res, "_%02d", rn);
            printf("%s = ", res);
            ++rn;
            unsigned int nargs = op_arg_count(c);
            unsigned int Tnargs = nargs;
            if (sl < nargs) {
                return 0;
            }
            if ((c >= 'A' && c <= 'Z')) {
                printf("%c(", c);
                while (nargs > 0) {
                    sc = stack[sl - nargs];
                    if (nargs > 1) {
                        printf("%s, ", (char *) &sc);
                    }
                    else {
                        printf("%s)\n", (char *) &sc);
                    }
                    --nargs;
                }
                sl -= Tnargs;
            }
            else {
                if (nargs == 1) {
                    sc = stack[sl - 1];
                    sl--;
                    printf("%c %s;\n", c, (char *) &sc);
                }
                else {
                    sc = stack[sl - 2];
                    printf("%s %c ", (char *) &sc, c);
                    sc = stack[sl - 1];
                    printf("%s;\n", (char *) &sc);
                    sl -= 2;
                }
            }
            stack[sl] = *(unsigned int *) res;
            ++sl;
        }
        ++strpos;
    }
    if (sl == 1) {
        sc = stack[sl - 1];
        sl--;
        printf("%s is a result\n", (char *) &sc);
        return 1;
    }
    return 0;
}

canonical_original_code:
_Bool execution_order(char *input) {
    printf("order: (arguments in reverse order)\n");
    char *strpos = input; char *strend = input + strlen(input);
    char c; char res[4];
    unsigned int sl = 0; unsigned int sc; unsigned int stack[32]; unsigned int rn = 0;
    while (strpos < strend) {
        c = *strpos;
        if (((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z'))) {
            stack[sl] = c;
            ++sl;
        }
        else if ((c == '+' || c == '-' || c == '/' || c == '*' || c == '!' || c == '%' || c == '=') || (c >= 'A' && c <= 'Z')) {
            sprintf(res, "_%02d", rn);
            printf("%s = ", res);
            ++rn;
            unsigned int nargs = op_arg_count(c);
            unsigned int Tnargs = nargs;
            if (sl < nargs) {
                return 0;
            }
            if ((c >= 'A' && c <= 'Z')) {
                printf("%c(", c);
                while (nargs > 0) {
                    sc = stack[sl - nargs];
                    if (nargs > 1) {
                        printf("%s, ", (char *) &sc);
                    }
                    else {
                        printf("%s)\n", (char *) &sc);
                    }
                    --nargs;
                }
                sl -= Tnargs;
            }
            else {
                if (nargs == 1) {
                    sc = stack[sl - 1];
                    sl--;
                    printf("%c %s;\n", c, (char *) &sc);
                }
                else {
                    sc = stack[sl - 2];
                    printf("%s %c ", (char *) &sc, c);
                    sc = stack[sl - 1];
                    printf("%s;\n", (char *) &sc);
                    sl -= 2;
                }
            }
            stack[sl] = *(unsigned int *) res;
            ++sl;
        }
        ++strpos;
    }
    if (sl == 1) {
        sc = stack[sl - 1];
        sl--;
        printf("%s is a result\n", (char *) &sc);
        return 1;
    }
    return 0;
}

variable_types:
res
char [4]

variable_types:
sc
unsigned int

variable_types:
stack
unsigned int [32]

variable_types:
rn
unsigned int

variable_types:
nargs
unsigned int

variable_types:
Tnargs
unsigned int


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v4[136]; // [rsp+0h] [rbp-88h] BYREF

printf("input: %s\n", "a = D(f - b * c + d, !e, g)");
if ( (unsigned __int8)shunting_yard("a = D(f - b * c + d, !e, g)", v4) )
{
printf("output: %s\n", v4);
execution_order(v4);
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v4[136]; // [rsp+0h] [rbp-88h] BYREF

printf("input: %s\n", "a = D(f - b * c + d, !e, g)");
if ( (unsigned __int8)func10("a = D(f - b * c + d, !e, g)", v4) )
{
printf("output: %s\n", v4);
func11(v4);
}
return 0;
}

original_code:
int main() {
    const char *input = "a = D(f - b * c + d, !e, g)";
    char output[128];
    printf("input: %s\n", input);
    if (shunting_yard(input, output)) {
        printf("output: %s\n", output);
        execution_order(output);
    }
    return 0;
}

canonical_original_code:
int main() {
    char *input = "a = D(f - b * c + d, !e, g)";
    char output[128];
    printf("input: %s\n", input);
    if (shunting_yard(input, output)) {
        printf("output: %s\n", output);
        execution_order(output);
    }
    return 0;
}

variable_types:
output
char [128]


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

if ( a1 <= 1 )
{
fwrite(
"Error: wrong usage: at least one argument required --- the base of number system. \n",
1uLL,
0x53uLL,
stderr);
exit(1);
}
result = abs32(atoi(*(const char **)(a2 + 8)));
if ( (unsigned int)(result - 2) > 0x5D )
{
fwrite("Error: wrong usage: the base of number system should be from 2 to 95. \n", 1uLL, 0x47uLL, stderr);
exit(1);
}
return result;
}

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

if ( a1 <= 1 )
{
fwrite(
"Error: wrong usage: at least one argument required --- the base of number system. \n",
1uLL,
0x53uLL,
stderr);
exit(1);
}
result = abs32(atoi(*(const char **)(a2 + 8)));
if ( (unsigned int)(result - 2) > 0x5D )
{
fwrite("Error: wrong usage: the base of number system should be from 2 to 95. \n", 1uLL, 0x47uLL, stderr);
exit(1);
}
return result;
}

original_code:
number_t get_base (int argc, char* argv[]) {
    int res = 2;
    if(argc < 2){
        fprintf(stderr, "Error: wrong usage: "
                        "at least one argument required --- "
                        "the base of number system. \n");
        exit(1);
    }
    res = abs(atoi(argv[1]));
    if ((2 > res) || (res > 95)){
        fprintf(stderr, "Error: wrong usage: "
                        "the base of number system "
                        "should be from 2 to 95. \n");
        exit(1);
    }
    return res;
}

canonical_original_code:
int get_base(int argc, char *argv[]) {
    int res = 2;
    if(argc < 2){
        fprintf(stderr, "Error: wrong usage: "
                        "at least one argument required --- "
                        "the base of number system. \n");
        exit(1);
    }
    res = abs(atoi(argv[1]));
    if ((2 > res) || (res > 95)){
        fprintf(stderr, "Error: wrong usage: "
                        "the base of number system "
                        "should be from 2 to 95. \n");
        exit(1);
    }
    return res;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: res int


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

if ( a1 <= 2 )
result = 0LL;
else
result = *(_QWORD *)(a2 + 16);
return result;
}

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

if ( a1 <= 2 )
result = 0LL;
else
result = *(_QWORD *)(a2 + 16);
return result;
}

original_code:
const char* get_sep(int argc, char* argv[]) {
    if(argc < 3){
        return (char *)((void *)0);
    }
    return argv[2];
}

canonical_original_code:
char *get_sep(int argc, char *argv[]) {
    if(argc < 3){
        return (char *)((void *)0);
    }
    return argv[2];
}

return_type: char *


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

for ( result = 0LL; a1; a1 >>= 1 )
result = (unsigned int)(result + 1);
return result;
}

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

for ( result = 0LL; a1; a1 >>= 1 )
result = (unsigned int)(result + 1);
return result;
}

original_code:
number_t mylog2 (number_t val) {
    number_t ret = 0;
    while (val != 0) {
        val >>= 1;
        ret++;
    }
    return ret;
}

canonical_original_code:
int mylog2(int val) {
    int ret = 0;
    while (val != 0) {
        val >>= 1;
        ret++;
    }
    return ret;
}

variable_types: val int

variable_types: ret int


mylog

decompiled_code:
__int64 __fastcall mylog(__int64 a1, int a2)
{
int v2; // er8
int v3; // eax
int v4; // edx

mylog2(a2);
v3 = mylog2(v2);
return (unsigned int)(v4 / v3);
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, int a2)
{
int v2; // er8
int v3; // eax
int v4; // edx

func9(a2);
v3 = func9(v2);
return (unsigned int)(v4 / v3);
}

original_code:
number_t mylog (number_t base, number_t val) {
    return mylog2 (val) / mylog2 (base);
}

canonical_original_code:
int mylog(int base, int val) {
    return mylog2 (val) / mylog2 (base);
}

variable_types: base int


decompiled_code:
__int64 __fastcall print_base(__int64 a1, int a2, int a3)
{
unsigned int v4; // er13
int v5; // er12
int v7; // ebx

if ( a2 )
{
v4 = a2 % (int)a1;
v5 = print_base(a1, (unsigned int)(a2 / (int)a1), (unsigned int)(a3 == 0) + a3 - 1);
if ( a2 % (int)a1 <= 9 )
{
printf("%d", v4);
}
else if ( v4 - 10 <= 0x19 )
{
putchar(v4 + 55);
goto LABEL_5;
}
if ( v4 - 36 <= 0x19 )
{
putchar(v4 + 61);
LABEL_12:
if ( v4 - 85 <= 5 )
{
putchar(v4 + 6);
if ( (int)a1 > 9 )
return v4 + 100 * v5;
return v4 + 10 * v5;
}
goto LABEL_20;
}
if ( v4 - 62 <= 0xF )
{
putchar(v4 - 30);
LABEL_20:
if ( v4 - 91 <= 3 )
putchar(v4 + 32);
LABEL_7:
if ( (int)a1 > 9 )
return v4 + 100 * v5;
return v4 + 10 * v5;
}
LABEL_5:
if ( v4 - 78 <= 6 )
{
putchar(v4 - 20);
goto LABEL_7;
}
goto LABEL_12;
}
v7 = 0;
if ( a3 > 0 )
{
do
{
++v7;
putchar(48);
}
while ( a3 != v7 );
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, int a2, int a3)
{
unsigned int v4; // er13
int v5; // er12
int v7; // ebx

if ( a2 )
{
v4 = a2 % (int)a1;
v5 = func11(a1, (unsigned int)(a2 / (int)a1), (unsigned int)(a3 == 0) + a3 - 1);
if ( a2 % (int)a1 <= 9 )
{
printf("%d", v4);
}
else if ( v4 - 10 <= 0x19 )
{
putchar(v4 + 55);
goto LABEL_5;
}
if ( v4 - 36 <= 0x19 )
{
putchar(v4 + 61);
LABEL_12:
if ( v4 - 85 <= 5 )
{
putchar(v4 + 6);
if ( (int)a1 > 9 )
return v4 + 100 * v5;
return v4 + 10 * v5;
}
goto LABEL_20;
}
if ( v4 - 62 <= 0xF )
{
putchar(v4 - 30);
LABEL_20:
if ( v4 - 91 <= 3 )
putchar(v4 + 32);
LABEL_7:
if ( (int)a1 > 9 )
return v4 + 100 * v5;
return v4 + 10 * v5;
}
LABEL_5:
if ( v4 - 78 <= 6 )
{
putchar(v4 - 20);
goto LABEL_7;
}
goto LABEL_12;
}
v7 = 0;
if ( a3 > 0 )
{
do
{
++v7;
putchar(48);
}
while ( a3 != v7 );
}
return 0LL;
}

original_code:
number_t print_base(number_t base, number_t input, number_t width){
    number_t digit = input % base;
    number_t prevdigits = 0;
    if(!input){
        number_t i;
        for(i = 0; i < width; ++i)
            printf("0");
        return 0;
    }
    prevdigits = print_base(base, input / base, (width) ? (width - 1) : 0);
    if(digit < 10)
        printf("%d", digit);
    if((10 <= digit) && (digit < 36))
        printf("%c", digit + 'A' - 10);
    if((36 <= digit) && (digit < 62))
        printf("%c", digit + 'a' - 36);
    if((62 <= digit) && (digit < 78))
        printf("%c", digit + ' ' - 62);
    if((78 <= digit) && (digit < 85))
        printf("%c", digit + ':' - 78);
    if((85 <= digit) && (digit < 91))
        printf("%c", digit + '[' - 85);
    if((91 <= digit) && (digit < 95))
        printf("%c", digit + '{' - 91);
    if(base < 10)
        return prevdigits * 10 + digit;
    return prevdigits * 100 + digit;
}

canonical_original_code:
int print_base(int base, int input, int width){
    int digit = input % base;
    int prevdigits = 0;
    if(!input){
        int i;
        for(i = 0; i < width; ++i)
            printf("0");
        return 0;
    }
    prevdigits = print_base(base, input / base, (width) ? (width - 1) : 0);
    if(digit < 10)
        printf("%d", digit);
    if((10 <= digit) && (digit < 36))
        printf("%c", digit + 'A' - 10);
    if((36 <= digit) && (digit < 62))
        printf("%c", digit + 'a' - 36);
    if((62 <= digit) && (digit < 78))
        printf("%c", digit + ' ' - 62);
    if((78 <= digit) && (digit < 85))
        printf("%c", digit + ':' - 78);
    if((85 <= digit) && (digit < 91))
        printf("%c", digit + '[' - 85);
    if((91 <= digit) && (digit < 95))
        printf("%c", digit + '{' - 91);
    if(base < 10)
        return prevdigits * 10 + digit;
    return prevdigits * 100 + digit;
}

variable_types: input int

variable_types: width int

variable_types: digit int

variable_types: prevdigits int

variable_types: i int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er14
unsigned int v4; // er12
const char *v5; // rbp
unsigned int i; // er13
unsigned __int8 v7; // bl

v3 = 1;
v4 = get_base(argc, argv, envp);
v5 = (const char *)get_sep((unsigned int)argc, argv);
for ( i = mylog(v4, 255LL) + 1; ; print_base(v4, v7, i) )
{
v7 = getchar();
if ( v7 == 0xFF )
break;
if ( v5 && !v3 )
printf("%s", v5);
v3 = 0;
}
putchar(10);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er14
unsigned int v4; // er12
const char *v5; // rbp
unsigned int i; // er13
unsigned __int8 v7; // bl

v3 = 1;
v4 = func7(argc, argv, envp);
v5 = (const char *)func8((unsigned int)argc, argv);
for ( i = func10(v4, 255LL) + 1; ; func11(v4, v7, i) )
{
v7 = getchar();
if ( v7 == 0xFF )
break;
if ( v5 && !v3 )
printf("%s", v5);
v3 = 0;
}
putchar(10);
return 0;
}

original_code:
int main(int argc, char* argv[]){
    number_t base = get_base(argc, argv);
    const char* sep = get_sep(argc, argv);
    number_t numberwidth = mylog(base, 255)+1;
    byte_t chr = 0;
    bool_t isfirst = TRUE;
    while((chr = getchar()) != (byte_t)(-1)){
        if((sep) && (FALSE == isfirst)){
            printf("%s", sep);
        }
        if (isfirst)
            isfirst = FALSE;
        print_base(base, (number_t)chr, numberwidth);
    }
    printf("\n");
    return 0;
}

canonical_original_code:
int main(int argc, char *argv[]){
    int base = get_base(argc, argv);
    char *sep = get_sep(argc, argv);
    int numberwidth = mylog(base, 255)+1;
    unsigned char chr = 0;
    enum bool_t isfirst = TRUE;
    while((chr = getchar()) != (byte_t)(-1)){
        if((sep) && (FALSE == isfirst)){
            printf("%s", sep);
        }
        if (isfirst)
            isfirst = FALSE;
        print_base(base, (int)chr, numberwidth);
    }
    printf("\n");
    return 0;
}

variable_types:
sep
char *

variable_types: numberwidth int

variable_types:
chr
unsigned char

variable_types:
isfirst
enum bool_t { FALSE=0, TRUE=1 }


decompiled_code:
_BOOL8 __fastcall is_letter(char a1)
{
return (unsigned __int8)((a1 & 0xDF) - 65) <= 0x19u;
}

canonical_decompiled_code:
_BOOL8 __fastcall func7(char a1)
{
return (unsigned __int8)((a1 & 0xDF) - 65) <= 0x19u;
}

canonical_original_code:
enum bool_t is_letter(char chr){
    if ((('A' <= chr) && (chr <= 'Z')) || (('a' <= chr) && (chr <= 'z')))
        return TRUE;
    return FALSE;
}

variable_types: chr char


decompiled_code:
_BOOL8 __fastcall is_identifier_start(char a1)
{
_BOOL4 v1; // eax
char v2; // dl

v1 = is_letter(a1);
return v1 || v2 == 95;
}

canonical_decompiled_code:
_BOOL8 __fastcall func8(char a1)
{
_BOOL4 v1; // eax
char v2; // dl

v1 = func7(a1);
return v1 || v2 == 95;
}

canonical_original_code:
enum bool_t is_identifier_start(char chr){
    if (is_letter(chr) || ('_' == chr))
        return TRUE;
    return FALSE;
}


decompiled_code:
_BOOL8 __fastcall is_identifier_body(char a1)
{
_BOOL4 v1; // eax
char v2; // r8
char v3; // dl
_BOOL8 result; // rax

v1 = is_letter(a1);
if ( v3 == 95 || v1 )
result = 1LL;
else
result = is_digit(v2);
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func10(char a1)
{
_BOOL4 v1; // eax
char v2; // r8
char v3; // dl
_BOOL8 result; // rax

v1 = func7(a1);
if ( v3 == 95 || v1 )
result = 1LL;
else
result = func9(v2);
return result;
}

canonical_original_code:
enum bool_t is_identifier_body(char chr){
    if (is_letter(chr) || ('_' == chr) || is_digit(chr))
        return TRUE;
    return FALSE;
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12
int v4; // ebp
int v5; // ebx
char v6; // al
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // r8
__int64 v10; // r9
unsigned int v11; // er10
char v12; // al
__int64 v13; // rdx
__int64 v14; // r8
__int64 v15; // r9
char v16; // al
int v18; // eax
int v19; // ecx
char v20; // al
__int64 v21; // rdx
__int64 v22; // rcx
__int64 v23; // r8
unsigned int v24; // er9
int v25; // ecx
char v26; // al

v3 = 0LL;
v4 = 0;
v5 = 0;
LABEL_2:
v6 = getchar();
v10 = (unsigned int)v6;
if ( v6 == -1 )
goto LABEL_8;
v11 = v6;
if ( !v5 )
goto LABEL_10;
while ( 1 )
{
v5 = is_identifier_body((unsigned int)v10, argv);
if ( !v5 )
break;
v5 = 1;
LABEL_10:
is_identifier_start(v11, argv, v7, v8, v9, v10);
if ( !v4 )
goto LABEL_6;
do
{
v18 = is_identifier_body((unsigned int)v15, argv);
if ( v19 )
{
LABEL_15:
if ( v18 )
goto LABEL_2;
}
else
{
while ( v18 )
{
v20 = getchar();
if ( v20 == -1 )
goto LABEL_8;
v5 = 0;
v4 = 1;
is_identifier_start((unsigned int)v20, argv, v21, v22, v23, (unsigned int)v20);
v18 = is_identifier_body(v24, argv);
if ( v25 )
goto LABEL_15;
}
}
v26 = getchar();
v5 = 0;
v15 = (unsigned int)v26;
if ( v26 == -1 )
goto LABEL_8;
LABEL_6:
v4 = is_identifier_start((unsigned int)v15, argv, v13, 0LL, v14, v15);
}
while ( !v4 );
v16 = getchar();
v4 = 0;
LODWORD(v10) = v16;
if ( v16 == -1 )
goto LABEL_8;
}
v12 = getchar();
++v3;
v15 = (unsigned int)v12;
if ( v12 != -1 )
goto LABEL_6;
LABEL_8:
printf("%ld\n", v3);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12
int v4; // ebp
int v5; // ebx
char v6; // al
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // r8
__int64 v10; // r9
unsigned int v11; // er10
char v12; // al
__int64 v13; // rdx
__int64 v14; // r8
__int64 v15; // r9
char v16; // al
int v18; // eax
int v19; // ecx
char v20; // al
__int64 v21; // rdx
__int64 v22; // rcx
__int64 v23; // r8
unsigned int v24; // er9
int v25; // ecx
char v26; // al

v3 = 0LL;
v4 = 0;
v5 = 0;
LABEL_2:
v6 = getchar();
v10 = (unsigned int)v6;
if ( v6 == -1 )
goto LABEL_8;
v11 = v6;
if ( !v5 )
goto LABEL_10;
while ( 1 )
{
v5 = func10((unsigned int)v10, argv);
if ( !v5 )
break;
v5 = 1;
LABEL_10:
func8(v11, argv, v7, v8, v9, v10);
if ( !v4 )
goto LABEL_6;
do
{
v18 = func10((unsigned int)v15, argv);
if ( v19 )
{
LABEL_15:
if ( v18 )
goto LABEL_2;
}
else
{
while ( v18 )
{
v20 = getchar();
if ( v20 == -1 )
goto LABEL_8;
v5 = 0;
v4 = 1;
func8((unsigned int)v20, argv, v21, v22, v23, (unsigned int)v20);
v18 = func10(v24, argv);
if ( v25 )
goto LABEL_15;
}
}
v26 = getchar();
v5 = 0;
v15 = (unsigned int)v26;
if ( v26 == -1 )
goto LABEL_8;
LABEL_6:
v4 = func8((unsigned int)v15, argv, v13, 0LL, v14, v15);
}
while ( !v4 );
v16 = getchar();
v4 = 0;
LODWORD(v10) = v16;
if ( v16 == -1 )
goto LABEL_8;
}
v12 = getchar();
++v3;
v15 = (unsigned int)v12;
if ( v12 != -1 )
goto LABEL_6;
LABEL_8:
printf("%ld\n", v3);
return 0;
}

original_code:
int main(){
    char chr = 0;
    long identifier_counter = 0;
    bool_t is_inside = FALSE;
    bool_t is_fake = FALSE;
    while ((-1) != (chr = getchar())) {
        if (is_inside && !is_identifier_body(chr)) {
            is_inside = FALSE;
            is_fake = FALSE;
            ++identifier_counter;
        } else if (!is_fake && is_identifier_start(chr)) {
            is_inside = TRUE;
            is_fake = FALSE;
        } else if (!is_identifier_start(chr) && is_identifier_body(chr)) {
            is_inside = FALSE;
            is_fake = TRUE;
        } else if (!is_identifier_body(chr)) {
            is_inside = FALSE;
            is_fake = FALSE;
        }
    }
    printf("%ld\n", identifier_counter);
    return 0;
}

canonical_original_code:
int main(){
    char chr = 0;
    long identifier_counter = 0;
    enum bool_t is_inside = FALSE;
    enum bool_t is_fake = FALSE;
    while ((-1) != (chr = getchar())) {
        if (is_inside && !is_identifier_body(chr)) {
            is_inside = FALSE;
            is_fake = FALSE;
            ++identifier_counter;
        } else if (!is_fake && is_identifier_start(chr)) {
            is_inside = TRUE;
            is_fake = FALSE;
        } else if (!is_identifier_start(chr) && is_identifier_body(chr)) {
            is_inside = FALSE;
            is_fake = TRUE;
        } else if (!is_identifier_body(chr)) {
            is_inside = FALSE;
            is_fake = FALSE;
        }
    }
    printf("%ld\n", identifier_counter);
    return 0;
}


decompiled_code:
_BOOL8 __fastcall is_digit(char a1)
{
return (unsigned __int8)(a1 - 48) <= 9u;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(char a1)
{
return (unsigned __int8)(a1 - 48) <= 9u;
}

canonical_original_code:
enum bool_t is_digit(char chr){
    if (('0' <= chr) && (chr <= '9'))
        return TRUE;
    return FALSE;
}


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

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

original_code:
stree_t* stree_create() {
    return ((void *)0);
}

canonical_original_code:
struct stree *stree_create() {
    return ((void *)0);
}

return_type: struct stree { struct stree *left; struct stree *right; struct wword_t { unsigned long size; _Bool eoln; int *string; } *value; unsigned long freq; unsigned long counter; unsigned long position; } *

user_defined_types: struct stree { struct stree *left; struct stree *right; struct wword_t *value; unsigned long freq; unsigned long counter; unsigned long position; }


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

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

original_code:
void stree_destroy(stree_t * stree) {
    if (stree) {
        stree_destroy(stree->left);
        stree_destroy(stree->right);
        free(stree);
    }
}

canonical_original_code:
void stree_destroy(struct stree *stree) {
    if (stree) {
        stree_destroy(stree->left);
        stree_destroy(stree->right);
        free(stree);
    }
}

variable_types: struct stree { struct stree *left; struct stree *right; struct wword_t { unsigned long size; _Bool eoln; int *string; } *value; unsigned long freq; unsigned long counter; unsigned long position; } *


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

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

original_code:
xresult_t xresult_create(){
    xresult_t res;
    res.isok = 0;
    return res;
}

canonical_original_code:
struct xresult_t xresult_create(){
    struct xresult_t res;
    res.isok = 0;
    return res;
}

variable_types: struct xresult_t { _Bool isok; void *value; }


decompiled_code:
int __fastcall wword_cmp(__int64 a1, __int64 a2)
{
return memcmp(*(const void **)(a1 + 16), *(const void **)(a2 + 16), 0x400uLL);
}

canonical_decompiled_code:
int __fastcall func13(__int64 a1, __int64 a2)
{
return memcmp(*(const void **)(a1 + 16), *(const void **)(a2 + 16), 0x400uLL);
}

original_code:
int wword_cmp(wword_t* this, wword_t* other) {
    return memcmp (this->string, other->string, 1024);
}

canonical_original_code:
int wword_cmp(struct wword_t *this, struct wword_t *other) {
    return memcmp (this->string, other->string, 1024);
}

variable_types: struct wword_t { unsigned long size; _Bool eoln; int *string; } *

variable_types:
other
struct wword_t *


fact

decompiled_code:
double __fastcall fact(double a1)
{
double result; // xmm0_8

result = 1.0;
if ( a1 > 1.0 )
result = fact(a1 - 1.0) * a1;
return result;
}

canonical_decompiled_code:
double __fastcall func10(double a1)
{
double result; // xmm0_8

result = 1.0;
if ( a1 > 1.0 )
result = func10(a1 - 1.0) * a1;
return result;
}

original_code:
double fact(double n) {
    if (n <= 1)
        return 1;
    else
        return fact(n - 1) * n;
}

variable_types: n double


main

canonical_original_code:
int main() {
    double a = 0.0; double b = 1.0; double x = 0.0; double sumT = 0.0;
    int k = 1; int n = 0; int parts;
    double func; double keps; double termT; double termM; double step; double max = 0.0;
    printf("Input number of evaluations: ");
    scanf("\n%d", &parts);
    step = (b - a) / parts;
    keps = k * epsylone();
    printf("                     Machine epsylone is %.16f\n", epsylone());
    printf("        Table Taylor's series of values and standard functions for\n");
    printf("                       f(x)= 1/(4-x*x*x*x)\n");
    printf(" ---------------------------------------------------------------------\n");
    printf(" | value of x |      sum of series     |      value of f     | iters |\n");
    for (a = 0.0; x <= (keps + b); x += step) {
        for (n = 0; n < 100; n++) {
            termT = taylor(n, x);
            if (keps >= fabs(termT))
                break;
            sumT = sumT + termT;
        }
        func = 1 / (4 - x * x * x * x);
        termM = fabs(func - sumT);
        if (termM >= max)
            max = termM;
        printf(" |------------|------------------------|---------------------|-------|\n");
        printf(" |    %.2f    |   %.17f  | %.17f |   %d   |\n", x, sumT, func, n);
        sumT = 0;
        n = 0;
    }
    printf(" ---------------------------------------------------------------------\n");
    printf("                     Maximal error = %.17f\n", max);
    return 0;
}

variable_types: a double

variable_types: b double

variable_types: x double

variable_types: sumT double

variable_types: k int

variable_types: n int

variable_types: parts int

variable_types: func double

variable_types: keps double

variable_types: termT double

variable_types: termM double

variable_types: step double

variable_types: max double


findent

decompiled_code:
void findent()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code:
double findent(double x) {
    return x;
}

canonical_original_code:
double findent(double x) {
    return x;
}


epsylone

decompiled_code:
double __fastcall epsylone(const char *a1)
{
double v1; // xmm4_8
double v2; // xmm1_8
double v3; // xmm3_8

v1 = 0.5;
v2 = 1.0;
do
{
v3 = v2;
v2 = v2 * v1;
findent();
}
while ( v2 + 1.0 > 1.0 );
return v3;
}

canonical_decompiled_code:
double __fastcall func8(const char *a1)
{
double v1; // xmm4_8
double v2; // xmm1_8
double v3; // xmm3_8

v1 = 0.5;
v2 = 1.0;
do
{
v3 = v2;
v2 = v2 * v1;
func7();
}
while ( v2 + 1.0 > 1.0 );
return v3;
}

original_code:
double epsylone() {
    double eps = 1.0;
    while (findent(eps / 2 + 1) > 1)
        eps = eps / 2;
    return eps;
}

variable_types: eps double


power

decompiled_code:
void __fastcall power(int a1, double a2)
{
double v3; // xmm0_8
int i; // eax

v3 = 1.0;
if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
v3 = v3 * a2;
}
}

canonical_decompiled_code:
void __fastcall func9(int a1, double a2)
{
double v3; // xmm0_8
int i; // eax

v3 = 1.0;
if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
v3 = v3 * a2;
}
}

original_code:
double power(double x, int n) {
    int i;
    double p = 1;
    for (i = 0; i < n; i++)
        p = p * x;
    return p;
}

variable_types: i int

variable_types: p double


decompiled_code:
__int64 queue_create()
{
void *v0; // rax

v0 = malloc(0x18uLL);
return queue_init((__int64)v0);
}

canonical_decompiled_code:
__int64 func8()
{
void *v0; // rax

v0 = malloc(0x18uLL);
return func7((__int64)v0);
}

original_code:
queue_t *queue_create() {
    queue_t* queue = malloc(sizeof(queue_t));
    queue = queue_init(queue);
    return queue;
}

canonical_original_code:
struct queue_t *queue_create() {
    struct queue_t *queue = malloc(sizeof(queue_t));
    queue = queue_init(queue);
    return queue;
}

variable_types: struct queue_t { struct __queueInner__ { int val; struct __queueInner__ *previous; } *mainQueue; struct __queueInner__ *first; int size; } *

user_defined_types: struct queue_t { struct __queueInner__ *mainQueue; struct __queueInner__ *first; int size; }


decompiled_code:
__int64 __fastcall queue_del(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rdx
__int64 v3; // rax

if ( **(_DWORD **)a1 )
{
printf("%d\n", **(unsigned int **)(a1 + 8));
v2 = *(_QWORD *)(a1 + 8);
v3 = *(_QWORD *)(v2 + 8);
if ( v3 )
*(_QWORD *)(a1 + 8) = v3;
else
*(_DWORD *)v2 = 0;
result = a1;
--*(_DWORD *)(a1 + 16);
}
else
{
puts("Empty");
result = a1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rdx
__int64 v3; // rax

if ( **(_DWORD **)a1 )
{
printf("%d\n", **(unsigned int **)(a1 + 8));
v2 = *(_QWORD *)(a1 + 8);
v3 = *(_QWORD *)(v2 + 8);
if ( v3 )
*(_QWORD *)(a1 + 8) = v3;
else
*(_DWORD *)v2 = 0;
result = a1;
--*(_DWORD *)(a1 + 16);
}
else
{
puts("Empty");
result = a1;
}
return result;
}

original_code:
queue_t *queue_del(queue_t *queue) {
    if (queue->mainQueue->val == 0) {
        printf("Empty\n");
    }
    else {
        printf("%d\n", queue->first->val);
        if (queue->first->previous == ((void *)0))
            queue->first->val = 0;
        else {
            queue->first = queue->first->previous;
        }
        queue->size--;
    }
    return queue;
}

canonical_original_code:
struct queue_t *queue_del(struct queue_t *queue) {
    if (queue->mainQueue->val == 0) {
        printf("Empty\n");
    }
    else {
        printf("%d\n", queue->first->val);
        if (queue->first->previous == ((void *)0))
            queue->first->val = 0;
        else {
            queue->first = queue->first->previous;
        }
        queue->size--;
    }
    return queue;
}

variable_types:
queue
struct queue_t *

return_type: struct queue_t { struct __queueInner__ { int val; struct __queueInner__ *previous; } *mainQueue; struct __queueInner__ *first; int size; } *


decompiled_code:
int __fastcall queue_print(__int64 a1)
{
int result; // eax
unsigned int *v2; // rbx
int v3; // ebp

result = *(_DWORD *)(a1 + 16);
v2 = *(unsigned int **)(a1 + 8);
if ( result > 0 )
{
v3 = 0;
do
{
result = printf("%d\n", *v2);
v2 = (unsigned int *)*((_QWORD *)v2 + 1);
if ( !v2 )
break;
++v3;
}
while ( *(_DWORD *)(a1 + 16) > v3 );
}
return result;
}

canonical_decompiled_code:
int __fastcall func11(__int64 a1)
{
int result; // eax
unsigned int *v2; // rbx
int v3; // ebp

result = *(_DWORD *)(a1 + 16);
v2 = *(unsigned int **)(a1 + 8);
if ( result > 0 )
{
v3 = 0;
do
{
result = printf("%d\n", *v2);
v2 = (unsigned int *)*((_QWORD *)v2 + 1);
if ( !v2 )
break;
++v3;
}
while ( *(_DWORD *)(a1 + 16) > v3 );
}
return result;
}

original_code:
void queue_print(queue_t *mainQueue) {
    int i;
    queueInner_t *go = mainQueue->first;
    for (i = 0; i < mainQueue->size; ++i) {
        printf("%d\n", go->val);
        go = go->previous;
        if (go == ((void *)0)) {
            break;
        }
    }
}

canonical_original_code:
void queue_print(struct queue_t *mainQueue) {
    int i;
    struct __queueInner__ *go = mainQueue->first;
    for (i = 0; i < mainQueue->size; ++i) {
        printf("%d\n", go->val);
        go = go->previous;
        if (go == ((void *)0)) {
            break;
        }
    }
}

variable_types: struct __queueInner__ { int val; struct __queueInner__ *previous; } *


sort

original_code:
queueInner_t *sort(queueInner_t *queue, queueInner_t *last, int n) {
    if (n > 1) {
        int i, half = n / 2;
        int* mass = ((void *)0);
        queueInner_t *x, *y;
        queueInner_t *temp = last;
        int xSize = n - half;
        int ySize = half;
        for (i = 1; i < half; ++i) {
            temp = temp->previous;
        }
        queue = sort(queue, temp->previous, n - half);
        queue = sort(temp, last, half);
        mass = malloc(sizeof(int)*n);
        x = temp->previous;
        y = last;
        for (i = 0; i < n; ++i) {
            if ((xSize == 0 && ySize != 0) || (ySize > 0 && x->val > y->val)) {
                mass[i] = y->val;
                y = y->previous;
                ySize--;
                if (xSize == 0 && ySize == 0)
                    break;
            }
            else if ((ySize == 0 && xSize != 0) || (xSize > 0 && x->val <= y->val)) {
                mass[i] = x->val;
                x = x->previous;
                xSize--;
                if (xSize == 0 && ySize == 0)
                    break;
            }
        }
        x = last;
        for (i = 0; i < n; ++i) {
            x->val = mass[i];
            x = x->previous;
        }
        free(mass);
        return queue;
    }
    else
        return queue;
}

canonical_original_code:
struct __queueInner__ *sort(struct __queueInner__ *queue, struct __queueInner__ *last, int n) {
    if (n > 1) {
        int i; int half = n / 2;
        int *mass = ((void *)0);
        struct __queueInner__ *x; struct __queueInner__ *y;
        struct __queueInner__ *temp = last;
        int xSize = n - half;
        int ySize = half;
        for (i = 1; i < half; ++i) {
            temp = temp->previous;
        }
        queue = sort(queue, temp->previous, n - half);
        queue = sort(temp, last, half);
        mass = malloc(sizeof(int)*n);
        x = temp->previous;
        y = last;
        for (i = 0; i < n; ++i) {
            if ((xSize == 0 && ySize != 0) || (ySize > 0 && x->val > y->val)) {
                mass[i] = y->val;
                y = y->previous;
                ySize--;
                if (xSize == 0 && ySize == 0)
                    break;
            }
            else if ((ySize == 0 && xSize != 0) || (xSize > 0 && x->val <= y->val)) {
                mass[i] = x->val;
                x = x->previous;
                xSize--;
                if (xSize == 0 && ySize == 0)
                    break;
            }
        }
        x = last;
        for (i = 0; i < n; ++i) {
            x->val = mass[i];
            x = x->previous;
        }
        free(mass);
        return queue;
    }
    else
        return queue;
}

variable_types:
queue
struct __queueInner__ *

variable_types:
last
struct __queueInner__ *

variable_types: half int

variable_types:
mass
int *

variable_types: xSize int

variable_types: ySize int

return_type: struct __queueInner__ { int val; struct __queueInner__ *previous; } *


lenght

decompiled_code:
__int64 __fastcall lenght(int a1)
{
unsigned int v1; // er8

v1 = 1;
if ( a1 )
{
v1 = 0;
do
{
++v1;
a1 /= 10;
}
while ( a1 );
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1)
{
unsigned int v1; // er8

v1 = 1;
if ( a1 )
{
v1 = 0;
do
{
++v1;
a1 /= 10;
}
while ( a1 );
}
return v1;
}

original_code:
int lenght(int a) {
    int l = 0;
    if (0 == a)
        return 1;
    while (0 != a) {
        a = a / 10;
        ++l;
    }
    return l;
}

variable_types: a int

variable_types: l int


ipow

decompiled_code:
__int64 __fastcall ipow(int a1, int a2)
{
unsigned int v2; // er8
int i; // eax

v2 = 1;
if ( a2 )
{
for ( i = 0; i != a2; ++i )
v2 *= a1;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, int a2)
{
unsigned int v2; // er8
int i; // eax

v2 = 1;
if ( a2 )
{
for ( i = 0; i != a2; ++i )
v2 *= a1;
}
return v2;
}

original_code:
int ipow(int a, int n) {
    int i;
    int r = 1;
    for (i = 0; i != n; ++i)
        r *= a;
    return r;
}

variable_types: n int

variable_types: r int


sorted

canonical_original_code:
enum bool_t sorted(int a) {
    int curr;
    int prev;
    int l = lenght(a);
    int p = ipow(10, l - 1);
    int i = 0;
    for (i = 0; l >= 2; ++i) {
        prev = (a / p) % 10;
        curr = ((a - prev * p) / (p / 10)) % 10;
        if (curr < prev)
            return FALSE;
        a = a - ((a / p) % 10) * p;
        p = p / 10;
        --l;
    }
    return TRUE;
}

variable_types: curr int

variable_types: prev int

variable_types: p int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
unsigned int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

scanf("%d", v5);
v3 = "true";
if ( !(unsigned int)sorted(v5[0]) )
v3 = "false";
puts(v3);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
unsigned int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

scanf("%d", v5);
v3 = "true";
if ( !(unsigned int)func9(v5[0]) )
v3 = "false";
puts(v3);
return 0;
}

original_code:
int main() {
    int a;
    scanf("%d", &a);
    printf("%s\n", sorted(a) ? "true" : "false");
    return 0;
}


absolute

decompiled_code:
__m128d __fastcall absolute(__m128d result)
{
if ( result.m128d_f64[0] < 0.0 )
result = _mm_xor_pd(result, (__m128d)xmmword_4020F0);
return result;
}

canonical_decompiled_code:
__m128d __fastcall func10(__m128d result)
{
if ( result.m128d_f64[0] < 0.0 )
result = _mm_xor_pd(result, (__m128d)xmmword_4020F0);
return result;
}

original_code:
myfloat_t absolute(myfloat_t x) {
    if (x < 0)
        return -x;
    return x;
}

canonical_original_code:
double absolute(double x) {
    if (x < 0)
        return -x;
    return x;
}

variable_types: x double


decompiled_code:
double __fastcall target_function(double a1)
{
return (a1 * a1 + 1.0) * 0.5 * atan(a1) - a1 * 0.5;
}

canonical_decompiled_code:
double __fastcall func11(double a1)
{
return (a1 * a1 + 1.0) * 0.5 * atan(a1) - a1 * 0.5;
}

original_code:
myfloat_t target_function(myfloat_t x) {
    return (1 + x * x) / 2 * atan(x) - x / 2;
}

canonical_original_code:
double target_function(double x) {
    return (1 + x * x) / 2 * atan(x) - x / 2;
}


decompiled_code:
double __fastcall taylor_function(int a1, double a2)
{
double v3; // [rsp+0h] [rbp-18h]

v3 = pow(-1.0, (double)(a1 + 1));
return pow(a2, (double)(2 * a1 + 1)) * v3 / (double)(4 * a1 * a1 - 1);
}

canonical_decompiled_code:
double __fastcall func12(int a1, double a2)
{
double v3; // [rsp+0h] [rbp-18h]

v3 = pow(-1.0, (double)(a1 + 1));
return pow(a2, (double)(2 * a1 + 1)) * v3 / (double)(4 * a1 * a1 - 1);
}

original_code:
myfloat_t taylor_function(myfloat_t x, int n) {
    return pow(-1, n + 1) * pow(x, 2 * n + 1) / (4 * n * n - 1);
}

canonical_original_code:
double taylor_function(double x, int n) {
    return pow(-1, n + 1) * pow(x, 2 * n + 1) / (4 * n * n - 1);
}


main

original_code:
int main() {
    int step = 0;
    int steps = 0;
    myfloat_t delta;
    myfloat_t eps = epsilon();
    myfloat_t x = A;
    int width = ceil(-log10(eps));
    int swidth = width + 2;
    scanf("%d", &steps);
    delta = (B - A) / steps;
    printf("eps = %.*f \n", width, eps);
    printf("width = %d \n", width);
    printf("delta = %f \n", delta);
    printf("\n");
    printf(
        "%3s | %*s | %*s | %*s | %5s |  %*s \n\n",
        "#",
        swidth, "x",
        swidth, "target",
        swidth, "taylor", "iter",
        swidth, "target - taylor"
    );
    for (step = 0; step != (steps + 1); ++step) {
        myfloat_t target = target_function(x);
        int iter = 1;
        myfloat_t taylor = taylor_function(x, iter);
        while ((absolute(taylor - target) >= eps * COEF)
               && (iter < ITER_MAX)) {
            iter = iter + 1;
            taylor += taylor_function(x, iter);
        }
        printf(
            "%3d | %.*f | %.*f | %.*f | %5d | %*.*f\n",
            step,
            width,
            x,
            width, target,
            width, taylor,
            iter,
            width + 3, width, target - taylor
        );
        x = x + delta;
    }
    printf("\n");
    return 0;
}

canonical_original_code:
int main() {
    int step = 0;
    int steps = 0;
    double delta;
    double eps = epsilon();
    double x = A;
    int width = ceil(-log10(eps));
    int swidth = width + 2;
    scanf("%d", &steps);
    delta = (B - A) / steps;
    printf("eps = %.*f \n", width, eps);
    printf("width = %d \n", width);
    printf("delta = %f \n", delta);
    printf("\n");
    printf(
        "%3s | %*s | %*s | %*s | %5s |  %*s \n\n",
        "#",
        swidth, "x",
        swidth, "target",
        swidth, "taylor", "iter",
        swidth, "target - taylor"
    );
    for (step = 0; step != (steps + 1); ++step) {
        double target = target_function(x);
        int iter = 1;
        double taylor = taylor_function(x, iter);
        while ((absolute(taylor - target) >= eps * COEF)
               && (iter < ITER_MAX)) {
            iter = iter + 1;
            taylor += taylor_function(x, iter);
        }
        printf(
            "%3d | %.*f | %.*f | %.*f | %5d | %*.*f\n",
            step,
            width,
            x,
            width, target,
            width, taylor,
            iter,
            width + 3, width, target - taylor
        );
        x = x + delta;
    }
    printf("\n");
    return 0;
}

variable_types: step int

variable_types: steps int

variable_types: delta double

variable_types: eps double

variable_types: width int

variable_types: swidth int

variable_types: target double

variable_types: iter int

variable_types: taylor double


findent

original_code:
myfloat_t findent(myfloat_t x) {
    return x;
}


power

original_code:
myfloat_t power(myfloat_t x, int n) {
    int i;
    myfloat_t p = 1;
    for (i = 0; i < n; i++)
        p = p * x;
    return p;
}

canonical_original_code:
double power(double x, int n) {
    int i;
    double p = 1;
    for (i = 0; i < n; i++)
        p = p * x;
    return p;
}

variable_types: i int

variable_types: p double


steplen

original_code:
int steplen(step_t step){
    return ceil(log10(step) + 1);
}

canonical_original_code:
int steplen(long step){
    return ceil(log10(step) + 1);
}

variable_types: step long


iterlen

decompiled_code:
// attributes: thunk
__int64 __fastcall iterlen(int a1)
{
return steplen(a1);
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1)
{
return func7(a1);
}

original_code:
int iterlen(iter_t iter){
    return ceil(log10(iter) + 1);
}

canonical_original_code:
int iterlen(long iter){
    return ceil(log10(iter) + 1);
}

variable_types: iter long


epslen

original_code:
int epslen(real_t eps){
    return ceil(-log10(eps));
}

canonical_original_code:
int epslen(double eps){
    return ceil(-log10(eps));
}


decompiled_code:
double __fastcall target_fuction(double a1)
{
return (a1 + a1 - 3.0) / ((a1 - 1.0) * (a1 - 1.0));
}

original_code:
real_t target_fuction(real_t x) {
    return (2 * x - 3) / ((x - 1) * (x - 1));
}

canonical_original_code:
float target_fuction(float x) {
    return (2 * x - 3) / ((x - 1) * (x - 1));
}

variable_types: x float

return_type: float


rabs

decompiled_code:
__m128d __fastcall rabs(__m128d result)
{
if ( result.m128d_f64[0] < 0.0 )
result = _mm_xor_pd(result, (__m128d)xmmword_402030);
return result;
}

canonical_decompiled_code:
__m128d __fastcall func11(__m128d result)
{
if ( result.m128d_f64[0] < 0.0 )
result = _mm_xor_pd(result, (__m128d)xmmword_402030);
return result;
}

original_code:
real_t rabs(real_t x) {
    if (x < 0)
        return -x;
    return x;
}

canonical_original_code:
float rabs(float x) {
    if (x < 0)
        return -x;
    return x;
}


rpow

decompiled_code:
void __fastcall rpow(__int64 a1, double a2)
{
double v3; // xmm0_8
__int64 i; // rax

v3 = 1.0;
if ( a1 )
{
for ( i = 0LL; i != a1; ++i )
v3 = v3 * a2;
}
}

canonical_decompiled_code:
void __fastcall func12(__int64 a1, double a2)
{
double v3; // xmm0_8
__int64 i; // rax

v3 = 1.0;
if ( a1 )
{
for ( i = 0LL; i != a1; ++i )
v3 = v3 * a2;
}
}

original_code:
real_t rpow(real_t x, iter_t n) {
    iter_t i;
    real_t res = 1;
    for (i = 0; i != n; ++i) {
        res *= x;
    }
    return res;
}

canonical_original_code:
float rpow(float x, long n) {
    long i;
    float res = 1;
    for (i = 0; i != n; ++i) {
        res *= x;
    }
    return res;
}

variable_types: n long

variable_types: i long

variable_types: res float


decompiled_code:
double __fastcall taylor_fuction(__int64 a1, double a2)
{
rpow(a1, a2);
return (double)(-3 - (int)a1) * a2;
}

canonical_decompiled_code:
double __fastcall func13(__int64 a1, double a2)
{
func12(a1, a2);
return (double)(-3 - (int)a1) * a2;
}

original_code:
real_t taylor_fuction(real_t x, iter_t n) {
    return -(n + 3) * rpow(x, n);
}

canonical_original_code:
float taylor_fuction(float x, long n) {
    return -(n + 3) * rpow(x, n);
}


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // er13
unsigned int v4; // ebp
__int64 v5; // r12
__int64 v6; // rbx
double v7; // r15
__int64 v8; // r14
double v10; // [rsp+0h] [rbp-68h]
double v11; // [rsp+8h] [rbp-60h]
double v12; // [rsp+10h] [rbp-58h]
double v13; // [rsp+18h] [rbp-50h]
__int64 v14[8]; // [rsp+28h] [rbp-40h] BYREF

v12 = epsylone(argc, argv, envp);
scanf("%ld", v14);
v13 = 0.5 / (double)SLODWORD(v14[0]);
v3 = epslen(v12);
v4 = steplen(v14[0]);
v5 = (unsigned int)iterlen(100LL);
format_print_table_line(v4, v5, v3);
format_print_table_head(v4, (unsigned int)v5, v3);
format_print_table_line(v4, (unsigned int)v5, v3);
if ( v14[0] != -1 )
{
v6 = 0LL;
v7 = 0.1;
while ( 1 )
{
v8 = 0LL;
v10 = taylor_fuction(0LL, v7);
v11 = target_fuction(v7);
while ( rabs(v11 - v10) >= 100.0 * v12 && v8 != 100 )
v10 = taylor_fuction(++v8, v7) + v10;
format_print_table_row(v4, (unsigned int)v5, v3, v6, v8, v7, v11, v10);
v7 = v7 + v13;
if ( v14[0] == v6 )
break;
++v6;
}
}
format_print_table_line(v4, (unsigned int)v5, v3);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // er13
unsigned int v4; // ebp
__int64 v5; // r12
__int64 v6; // rbx
double v7; // r15
__int64 v8; // r14
double v10; // [rsp+0h] [rbp-68h]
double v11; // [rsp+8h] [rbp-60h]
double v12; // [rsp+10h] [rbp-58h]
double v13; // [rsp+18h] [rbp-50h]
__int64 v14[8]; // [rsp+28h] [rbp-40h] BYREF

v12 = epsylone(argc, argv, envp);
scanf("%ld", v14);
v13 = 0.5 / (double)SLODWORD(v14[0]);
v3 = func9(v12);
v4 = func7(v14[0]);
v5 = (unsigned int)func8(100LL);
func16(v4, v5, v3);
func17(v4, (unsigned int)v5, v3);
func16(v4, (unsigned int)v5, v3);
if ( v14[0] != -1 )
{
v6 = 0LL;
v7 = 0.1;
while ( 1 )
{
v8 = 0LL;
v10 = func13(0LL, v7);
v11 = func10(v7);
while ( func11(v11 - v10) >= 100.0 * v12 && v8 != 100 )
v10 = func13(++v8, v7) + v10;
func18(v4, (unsigned int)v5, v3, v6, v8, v7, v11, v10);
v7 = v7 + v13;
if ( v14[0] == v6 )
break;
++v6;
}
}
func16(v4, (unsigned int)v5, v3);
return 0;
}

original_code:
int main() {
    real_t eps = epsylone();
    real_t x;
    real_t delta_x;
    step_t nsteps;
    step_t step;
    int epswidth;
    int stepwidth;
    int iterwidth;
    scanf("%" "ld", &nsteps);
    delta_x = (STOP_X - START_X) / nsteps;
    epswidth = ceil(-log10(eps));
    stepwidth = ceil(log10(nsteps) + 1);
    iterwidth = ceil(log10(ITER_LIMIT) + 1);
    printf("steps    = %ld\n", nsteps);
    printf("Δx       = %.*" "f" "\n", epswidth, delta_x);
    printf("ε        = %.*" "f" "\n", epswidth, eps);
    printf("ε width  = %d\n", epswidth);
    format_print_table_line(stepwidth, iterwidth, epswidth);
    format_print_table_head(stepwidth, iterwidth, epswidth);
    format_print_table_line(stepwidth, iterwidth, epswidth);
    x = START_X;
    for (step = 0; step != (nsteps + 1); ++step) {
        iter_t iter = 0;
        real_t taylor = taylor_fuction(x, iter);
        real_t target = target_fuction(x);
        while ((rabs(target - taylor) >= (eps * COEF)) && iter < ITER_LIMIT) {
            ++iter;
            taylor += taylor_fuction(x, iter);
        }
        format_print_table_row(stepwidth, iterwidth, epswidth,
                               step, x, target, taylor, iter);
        x += delta_x;
    }
    format_print_table_line(stepwidth, iterwidth, epswidth);
    return 0;
}

canonical_original_code:
int main() {
    float eps = epsylone();
    float x;
    float delta_x;
    long nsteps;
    long step;
    int epswidth;
    int stepwidth;
    int iterwidth;
    scanf("%" "ld", &nsteps);
    delta_x = (STOP_X - START_X) / nsteps;
    epswidth = ceil(-log10(eps));
    stepwidth = ceil(log10(nsteps) + 1);
    iterwidth = ceil(log10(ITER_LIMIT) + 1);
    printf("steps    = %ld\n", nsteps);
    printf("Δx       = %.*" "f" "\n", epswidth, delta_x);
    printf("ε        = %.*" "f" "\n", epswidth, eps);
    printf("ε width  = %d\n", epswidth);
    format_print_table_line(stepwidth, iterwidth, epswidth);
    format_print_table_head(stepwidth, iterwidth, epswidth);
    format_print_table_line(stepwidth, iterwidth, epswidth);
    x = START_X;
    for (step = 0; step != (nsteps + 1); ++step) {
        long iter = 0;
        float taylor = taylor_fuction(x, iter);
        float target = target_fuction(x);
        while ((rabs(target - taylor) >= (eps * COEF)) && iter < ITER_LIMIT) {
            ++iter;
            taylor += taylor_fuction(x, iter);
        }
        format_print_table_row(stepwidth, iterwidth, epswidth,
                               step, x, target, taylor, iter);
        x += delta_x;
    }
    format_print_table_line(stepwidth, iterwidth, epswidth);
    return 0;
}

variable_types: eps float

variable_types: nsteps long

variable_types: epswidth int

variable_types: stepwidth int

variable_types: iterwidth int

variable_types: taylor float

variable_types: target float


decompiled_code:
int __fastcall format_print_table_line(int a1, int a2, int a3)
{
int v3; // eax
int v4; // ebp
int v5; // ebx

v3 = a1 + 3 * a3 + 15;
v4 = v3 + a2 + 15;
if ( v3 + a2 != -15 )
{
v5 = 0;
do
{
++v5;
putchar(45);
}
while ( v4 != v5 );
}
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func16(int a1, int a2, int a3)
{
int v3; // eax
int v4; // ebp
int v5; // ebx

v3 = a1 + 3 * a3 + 15;
v4 = v3 + a2 + 15;
if ( v3 + a2 != -15 )
{
v5 = 0;
do
{
++v5;
putchar(45);
}
while ( v4 != v5 );
}
return putchar(10);
}

original_code:
void format_print_table_line(int stepwidth, int iterwidth, int epswidth) {
    int epslength = epswidth + FORMAT_REAL_LENGTH;
    int size = stepwidth + 3 * epslength + iterwidth + FORMAT_LINE_OFFSET;
    int i;
    for (i = 0; i != size; ++i) {
        printf("-");
    }
    printf("\n");
}

variable_types: epslength int

variable_types: size int


decompiled_code:
int __fastcall format_print_table_head(int a1, int a2, int a3)
{
int v3; // ebp

v3 = a3 + 5;
printf("|%*s |", a1, "#");
printf(" %*s |", v3, "x");
printf(" %*s |", v3, "target");
printf(" %*s |", v3, "taylor");
return printf(" %*s |\n", a2, "n");
}

canonical_decompiled_code:
int __fastcall func17(int a1, int a2, int a3)
{
int v3; // ebp

v3 = a3 + 5;
printf("|%*s |", a1, "#");
printf(" %*s |", v3, "x");
printf(" %*s |", v3, "target");
printf(" %*s |", v3, "taylor");
return printf(" %*s |\n", a2, "n");
}

original_code:
void format_print_table_head(int stepwidth, int iterwidth, int epswidth) {
    int epslength = epswidth + FORMAT_REAL_LENGTH;
    printf("|%*s |", stepwidth, "#");
    printf(" %*s |", epslength, "x");
    printf(" %*s |", epslength, "target");
    printf(" %*s |", epslength, "taylor");
    printf(" %*s |\n", iterwidth, "n");
}


decompiled_code:
int __fastcall format_print_table_row(int a1, int a2, int a3, __int64 a4, __int64 a5, double a6, double a7, double a8)
{
int v10; // er14

v10 = a3 + 5;
printf("|%*ld |", a1, a4);
printf(" %*.*f |", v10, a3, a6);
printf(" %*.*f |", v10, a3, a7);
printf(" %*.*f |", v10, a3, a8);
return printf(" %*ld |\n", a2, a5);
}

original_code:
void format_print_table_row(
    int stepwidth,
    int iterwidth,
    int epswidth,
    step_t step,
    real_t x,
    real_t target,
    real_t taylor,
    iter_t iter
) {
    int epslength = epswidth + FORMAT_REAL_LENGTH;
    printf("|%*" "ld" " |", stepwidth, step);
    printf(" %*.*" "f" " |", epslength, epswidth, x);
    printf(" %*.*" "f" " |", epslength, epswidth, target);
    printf(" %*.*" "f" " |", epslength, epswidth, taylor);
    printf(" %*" "ld" " |\n", iterwidth, iter);
}

canonical_original_code:
void format_print_table_row(int stepwidth, int iterwidth, int epswidth, long step, float x, float target, float taylor, long iter) {
    int epslength = epswidth + FORMAT_REAL_LENGTH;
    printf("|%*" "ld" " |", stepwidth, step);
    printf(" %*.*" "f" " |", epslength, epswidth, x);
    printf(" %*.*" "f" " |", epslength, epswidth, target);
    printf(" %*.*" "f" " |", epslength, epswidth, taylor);
    printf(" %*" "ld" " |\n", iterwidth, iter);
}


decompiled_code:
void naive_delay()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

original_code:
void naive_delay(int time) {
    int i;
    for (i = 0; i != time; ++i) ;
}

variable_types: time int

variable_types: i int


decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
int i; // ebx
int v4; // esi

while ( 1 )
{
for ( i = 0; i != 320; ++i )
{
v4 = i;
fmindicator(_bss_start, v4, 45, 92, 124, 47, 45, 45);
}
putchar(10);
}
}

canonical_decompiled_code:
int __cdecl __noreturn main(int argc, const char **argv, const char **envp)
{
int i; // ebx
int v4; // esi

while ( 1 )
{
for ( i = 0; i != 320; ++i )
{
v4 = i;
func10(_bss_start, v4, 45, 92, 124, 47, 45, 45);
}
putchar(10);
}
}


function

decompiled_code:
void function()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code:
point_t function(point_t x) {
    return x;
}

canonical_original_code:
double function(double x) {
    return x;
}

variable_types: x double


main

original_code:
int main() {
    point_t eps = epsilon();
    point_t x;
    point_t func;
    point_t tailor;
    point_t step;
    int n;
    int iter;
    int width = ceil(-log10(eps));
    scanf("%d", &n);
    step = (B - A) / n;
    printf(
        "         x                   "
        "сумма ряда              "
        "значение ф-ии   "
        "число итераций\n"
    );
    x = A;
    while (x <= B) {
        func = (3.0 * x - 5.0) / (pow(x, 2) - 4.0 * x + 3.0);
        tailor = 0.0;
        iter = 0;
        while (fabs(func - tailor) >= eps * K) {
            tailor += (-((1.0 + 2.0 / (pow(3.0, iter + 1))) * (pow(x, iter))));
            ++iter;
        }
        printf(
            "%.*" "f"
            "\t%.*" "f"
            "\t%.*" "f"
            "\t%3d\n",
            width, x,
            width, tailor,
            width, func,
            iter
        );
        x += step;
    }
    return 0;
}

canonical_original_code:
int main() {
    double eps = epsilon();
    double x;
    double func;
    double tailor;
    double step;
    int n;
    int iter;
    int width = ceil(-log10(eps));
    scanf("%d", &n);
    step = (B - A) / n;
    printf(
        "         x                   "
        "сумма ряда              "
        "значение ф-ии   "
        "число итераций\n"
    );
    x = A;
    while (x <= B) {
        func = (3.0 * x - 5.0) / (pow(x, 2) - 4.0 * x + 3.0);
        tailor = 0.0;
        iter = 0;
        while (fabs(func - tailor) >= eps * K) {
            tailor += (-((1.0 + 2.0 / (pow(3.0, iter + 1))) * (pow(x, iter))));
            ++iter;
        }
        printf(
            "%.*" "f"
            "\t%.*" "f"
            "\t%.*" "f"
            "\t%3d\n",
            width, x,
            width, tailor,
            width, func,
            iter
        );
        x += step;
    }
    return 0;
}

variable_types: eps double

variable_types: func double

variable_types: tailor double

variable_types: step double

variable_types: n int

variable_types: iter int

variable_types: width int