original_code:
track_info_ptr track_info_create(const char *filename, tags_ptr tags) {
  track_info_ptr this = ((track_info_ptr)cx_create(sizeof(struct track_info_t), track_info_class_name, track_info_dtor));
  this->id = 0;
  this->filename = cx_string_create(filename);
  this->flags = 0;
  this->duration = 0;
  this->sample_rate = 0;
  this->channels = 0;
  this->bitrate = 0;
  this->codec_name = ((void *)0);
  this->tags = cx_retain(tags);
  return this;
}

canonical_original_code:
struct track_info_t *track_info_create(char *filename, struct cx_array_t *tags) {
  struct track_info_t *this = ((track_info_ptr)cx_create(sizeof(struct track_info_t), track_info_class_name, track_info_dtor));
  this->id = 0;
  this->filename = cx_string_create(filename);
  this->flags = 0;
  this->duration = 0;
  this->sample_rate = 0;
  this->channels = 0;
  this->bitrate = 0;
  this->codec_name = ((void *)0);
  this->tags = cx_retain(tags);
  return this;
}

variable_types:
filename
char *

variable_types:
tags
struct cx_array_t *

variable_types: struct track_info_t { struct cx_obj_t { char *class_name; unsigned int refcount; void (*dtor)(void *); } O; unsigned int id; struct cx_string_t { struct cx_obj_t O; unsigned long length; char *string; } *filename; unsigned int flags; int duration; int sample_rate; int channels; int bitrate; struct cx_string_t *codec_name; struct cx_array_t { struct cx_obj_t O; struct cx_obj_t **objs; unsigned long count; unsigned long reserved; } *tags; } *


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

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

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

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

original_code:
void debug_util_print_binary(unsigned int 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_util_print_binary(input >> 1, (width) ? (width - 1) : 0);
        fprintf(stderr, "%hu", (unsigned short)digit);
    }
}

variable_types:
input
unsigned int

variable_types:
width
unsigned short

variable_types:
digit
unsigned short

variable_types:
i
unsigned short

return_type: void


decompiled_code:
int __fastcall debug_string_print_binary(char *format, unsigned int a2, unsigned __int16 a3)
{
fwrite("debug: ", 1uLL, 7uLL, stderr);
fprintf(stderr, format);
debug_util_print_binary(a2, a3);
return fprintf(stderr, " [%hu]\n", a3);
}

canonical_decompiled_code:
int __fastcall func8(char *format, unsigned int a2, unsigned __int16 a3)
{
fwrite("debug: ", 1uLL, 7uLL, stderr);
fprintf(stderr, format);
func7(a2, a3);
return fprintf(stderr, " [%hu]\n", a3);
}

original_code:
void debug_string_print_binary(
    const char* str, unsigned int input, unsigned short width
){
    fprintf(stderr, "debug: ");
    fprintf(stderr, str);
    debug_util_print_binary(input, width);
    fprintf(stderr, " [%hu]\n", width);
}

canonical_original_code:
void debug_string_print_binary(char *str, unsigned int input, unsigned short width){
    fprintf(stderr, "debug: ");
    fprintf(stderr, str);
    debug_util_print_binary(input, width);
    fprintf(stderr, " [%hu]\n", width);
}

variable_types:
str
char *


decompiled_code:
int __fastcall debug_print_binary_long(char *a1, unsigned int a2)
{
return debug_string_print_binary(a1, a2, 0x20u);
}

canonical_decompiled_code:
int __fastcall func9(char *a1, unsigned int a2)
{
return func8(a1, a2, 0x20u);
}

original_code:
void debug_print_binary_long(const char* str, unsigned int input){
    unsigned short width = sizeof(input) * 8;
    debug_string_print_binary(str, input, width);
}

canonical_original_code:
void debug_print_binary_long(char *str, unsigned int input){
    unsigned short width = sizeof(input) * 8;
    debug_string_print_binary(str, input, width);
}


decompiled_code:
int __fastcall debug_print_binary_byte(char *a1, unsigned __int16 a2)
{
return debug_string_print_binary(a1, a2, 8u);
}

canonical_decompiled_code:
int __fastcall func10(char *a1, unsigned __int16 a2)
{
return func8(a1, a2, 8u);
}

original_code:
void debug_print_binary_byte(const char* str, unsigned short input){
    unsigned short width = 8;
    debug_string_print_binary(str, input, width);
}

canonical_original_code:
void debug_print_binary_byte(char *str, unsigned short input){
    unsigned short width = 8;
    debug_string_print_binary(str, input, width);
}

variable_types:
input
unsigned short


decompiled_code:
__int64 __fastcall get_byte(unsigned int a1, char a2)
{
unsigned int v2; // ebx

debug_print_binary_long("input\t= ", a1);
v2 = a1 >> (8 * a2);
debug_print_binary_long("shifted\t= ", v2);
debug_print_binary_long("mask\t= ", 0xFFu);
debug_print_binary_long("byte\t= ", (unsigned __int8)v2);
debug_print_binary_byte("byte\t= ", (unsigned __int8)v2);
return (unsigned __int8)v2;
}

canonical_decompiled_code:
__int64 __fastcall func11(unsigned int a1, char a2)
{
unsigned int v2; // ebx

func9("input\t= ", a1);
v2 = a1 >> (8 * a2);
func9("shifted\t= ", v2);
func9("mask\t= ", 0xFFu);
func9("byte\t= ", (unsigned __int8)v2);
func10("byte\t= ", (unsigned __int8)v2);
return (unsigned __int8)v2;
}

original_code:
int get_byte(unsigned int input, unsigned short num){
    unsigned short numbit = num * 8;
    unsigned short mask = (1 << 8) - 1;
    unsigned int shifted = 0;
    unsigned short byte = 0;
    debug_print_binary_long("input\t= ", input);
    shifted = (input >> numbit);
    debug_print_binary_long("shifted\t= ", shifted);
    debug_print_binary_long("mask\t= ", mask);
    byte = shifted & mask;
    debug_print_binary_long("byte\t= ", byte);
    debug_print_binary_byte("byte\t= ", byte);
    return byte;
}

variable_types:
num
unsigned short

variable_types:
numbit
unsigned short

variable_types:
mask
unsigned short

variable_types:
shifted
unsigned int

variable_types:
byte
unsigned short

return_type: int


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
unsigned __int16 v5; // ax
unsigned __int16 v6; // [rsp+Ah] [rbp-Eh] BYREF
unsigned int v7[3]; // [rsp+Ch] [rbp-Ch] BYREF

v7[0] = 0;
v6 = 0;
if ( scanf("%u", v7) == 1 )
{
v3 = 1;
if ( scanf("%hu", &v6) == 1 )
{
v5 = get_byte(v7[0], v6);
printf("%hu\n", v5);
v3 = 0;
}
else
{
fprintf(stderr, "error: %hu is not number of byte.\n", v6);
}
}
else
{
fprintf(stderr, "error: %u is not integer number.\n", v7[0]);
v3 = 1;
}
return v3;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // ebx
unsigned __int16 v5; // ax
unsigned __int16 v6; // [rsp+Ah] [rbp-Eh] BYREF
unsigned int v7[3]; // [rsp+Ch] [rbp-Ch] BYREF

v7[0] = 0;
v6 = 0;
if ( scanf("%u", v7) == 1 )
{
v3 = 1;
if ( scanf("%hu", &v6) == 1 )
{
v5 = func11(v7[0], v6);
printf("%hu\n", v5);
v3 = 0;
}
else
{
fprintf(stderr, "error: %hu is not number of byte.\n", v6);
}
}
else
{
fprintf(stderr, "error: %u is not integer number.\n", v7[0]);
v3 = 1;
}
return v3;
}

original_code:
int main(){
    unsigned int input = 0;
    unsigned short num = 0;
    unsigned short byte = 0;
    if(scanf("%u", &input) != 1){
        fprintf(stderr, "error: %u is not integer number.\n", input);
        return 1;
    }
    if(scanf("%hu", &num) != 1){
        fprintf(stderr, "error: %hu is not number of byte.\n", num);
        return 1;
    }
    byte = get_byte(input, num);
    printf("%hu\n", byte);
    return 0;
}


decompiled_code:
int __fastcall my_getint(_DWORD *a1, _BYTE *a2)
{
int v2; // eax
bool v3; // bl
char v4; // r14
__int64 v5; // rax
int v6; // eax
unsigned __int64 v7; // rdx

v2 = getchar();
*a2 = 0;
v3 = v2 == -1 || v2 == 10;
if ( v3 )
{
LODWORD(v5) = puts("Error, incorrect input!");
}
else
{
v4 = 1;
if ( v2 != 45 )
{
*a1 = v2 - 48;
*a2 = 1;
v4 = 0;
v3 = 1;
}
while ( 1 )
{
v6 = getchar();
v7 = (unsigned int)(v6 + 1);
if ( (unsigned int)v7 <= 0x21 )
break;
if ( (unsigned int)(v6 - 48) > 9 )
goto LABEL_6;
if ( v3 )
{
*a1 = v6 + 10 * *a1 - 48;
*a2 = 1;
}
else
{
*a2 = 1;
*a1 = v6 - 48;
}
v3 = 1;
}
v5 = 0x200000801LL;
if ( !_bittest64(&v5, v7) )
{
LABEL_6:
LODWORD(v5) = puts("Error, WTF!!!");
*a2 = 0;
}
if ( v4 )
*a1 = -*a1;
}
return v5;
}

original_code:
void my_getint(int *Val, _Bool * flag) {
    int c;
    c = getchar();
    *flag = 0;
    _Bool bit = 0;
    _Bool point_minuse = 0;
    if (c == '\n' || c == (-1)) {
        printf("Error, incorrect input!\n");
        return;
    }
    if (c == '-') {
        point_minuse = 1;
    }
    else {
        *Val = c - '0';
        bit = 1;
        *flag = 1;
    }
    while ((c = getchar()) != (-1) && c != '\n' && c != ' ') {
        if (!('0' <= c && c <= '9')) {
            printf("Error, WTF!!!\n");
            *flag = 0;
            break;
        }
        if (bit == 0) {
            bit = 1;
            *flag = 1;
            *Val = c - '0';
        }
        else {
            *Val = (*Val) * 10 + c - '0';
            *flag = 1;
        }
    }
    if (point_minuse)
        (*Val) *= -1;
}

canonical_original_code:
void my_getint(int *Val, _Bool *flag) {
    int c;
    c = getchar();
    *flag = 0;
    _Bool bit = 0;
    _Bool point_minuse = 0;
    if (c == '\n' || c == (-1)) {
        printf("Error, incorrect input!\n");
        return;
    }
    if (c == '-') {
        point_minuse = 1;
    }
    else {
        *Val = c - '0';
        bit = 1;
        *flag = 1;
    }
    while ((c = getchar()) != (-1) && c != '\n' && c != ' ') {
        if (!('0' <= c && c <= '9')) {
            printf("Error, WTF!!!\n");
            *flag = 0;
            break;
        }
        if (bit == 0) {
            bit = 1;
            *flag = 1;
            *Val = c - '0';
        }
        else {
            *Val = (*Val) * 10 + c - '0';
            *flag = 1;
        }
    }
    if (point_minuse)
        (*Val) *= -1;
}

variable_types:
Val
int *

variable_types:
flag
_Bool *

variable_types: c int


First

decompiled_code:
__int64 __fastcall First(__int64 a1)
{
return *(_QWORD *)(*(_QWORD *)a1 + 8LL);
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
return *(_QWORD *)(*(_QWORD *)a1 + 8LL);
}

original_code:
Iterator First(const List * l) {
    Iterator res = { l->head->next };
    return res;
}

canonical_original_code:
struct Iterator First(struct List *l) {
    struct Iterator res = { l->head->next };
    return res;
}

variable_types: struct List { struct Item *head; int size; } *

variable_types: struct Iterator { struct Item { struct Item *prev; struct Item *next; int data; } *node; }


Last

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

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

original_code:
Iterator Last(const List * l) {
    Iterator res = { l->head };
    return res;
}

canonical_original_code:
struct Iterator Last(struct List *l) {
    struct Iterator res = { l->head };
    return res;
}

return_type: struct Iterator { struct Item { struct Item *prev; struct Item *next; int data; } *node; }

user_defined_types: struct List { struct Item *head; int size; }


decompiled_code:
bool __fastcall list_Create(_QWORD *a1)
{
return *a1 != 0LL;
}

canonical_decompiled_code:
bool __fastcall func10(_QWORD *a1)
{
return *a1 != 0LL;
}

original_code:
_Bool list_Create(const List * l) {
    return (l->head);
}

canonical_original_code:
_Bool list_Create(struct List *l) {
    return (l->head);
}

variable_types: struct List { struct Item { struct Item *prev; struct Item *next; int data; } *head; int size; } *


helper

decompiled_code:
int helper()
{
return puts(
"\tc --- create list;\n"
" e --- check of empty;\n"
" i --- insert to list before some element, also if you wanting insert to tail of list then write --- i 0 <"
"value>;\n"
" p --- print list;\n"
" d --- delete element from list;\n"
" l --- length of list;\n"
" s --- swap two elemts;\n"
" 0 --- destroyed list;\n"
" x --- exit.");
}

canonical_decompiled_code:
int func11()
{
return puts(
"\tc --- create list;\n"
" e --- check of empty;\n"
" i --- insert to list before some element, also if you wanting insert to tail of list then write --- i 0 <"
"value>;\n"
" p --- print list;\n"
" d --- delete element from list;\n"
" l --- length of list;\n"
" s --- swap two elemts;\n"
" 0 --- destroyed list;\n"
" x --- exit.");
}

original_code:
void helper() {
    printf("\tc --- create list;\n    e --- check of empty;\n    i --- insert to list before some element, also if you wanting insert to tail of list then write --- i 0 <value>;\n    p --- print list;\n    d --- delete element from list;\n    l --- length of list;\n    s --- swap two elemts;\n    0 --- destroyed list;\n    x --- exit.\n");
}


Size

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

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

original_code:
int Size(const List * l) {
    return l->size;
}

canonical_original_code:
int Size(struct List *l) {
    return l->size;
}

user_defined_types: struct Item { struct Item *prev; struct Item *next; int data; }


Equal

decompiled_code:
bool __fastcall Equal(_QWORD *a1, _QWORD *a2)
{
return *a1 == *a2;
}

canonical_decompiled_code:
bool __fastcall func14(_QWORD *a1, _QWORD *a2)
{
return *a1 == *a2;
}

original_code:
_Bool Equal(const Iterator * lhs, const Iterator * rhs) {
    return lhs->node == rhs->node;
}

canonical_original_code:
_Bool Equal(struct Iterator *lhs, struct Iterator *rhs) {
    return lhs->node == rhs->node;
}

variable_types: struct Iterator { struct Item { struct Item *prev; struct Item *next; int data; } *node; } *

variable_types:
rhs
struct Iterator *


Empty

decompiled_code:
bool __fastcall Empty(__int64 a1)
{
__int64 v2; // [rsp+0h] [rbp-18h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

v3 = First(a1);
v2 = Last(a1);
return Equal(&v3, &v2);
}

canonical_decompiled_code:
bool __fastcall func15(__int64 a1)
{
__int64 v2; // [rsp+0h] [rbp-18h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

v3 = func8(a1);
v2 = func9(a1);
return func14(&v3, &v2);
}

original_code:
_Bool Empty(const List * l) {
    Iterator fst = First(l);
    Iterator lst = Last(l);
    return Equal(&fst, &lst);
}

canonical_original_code:
_Bool Empty(struct List *l) {
    struct Iterator fst = First(l);
    struct Iterator lst = Last(l);
    return Equal(&fst, &lst);
}


Delete

original_code:
void Delete(List * l, Iterator * i) {
    Iterator res = Last(l);
    if (Equal(i, &res))
        return;
    res.node = i->node->next;
    res.node->prev = i->node->prev;
    i->node->prev->next = res.node;
    l->size--;
    free(i->node);
    i->node = 0;
}

canonical_original_code:
void Delete(struct List *l, struct Iterator *i) {
    struct Iterator res = Last(l);
    if (Equal(i, &res))
        return;
    res.node = i->node->next;
    res.node->prev = i->node->prev;
    i->node->prev->next = res.node;
    l->size--;
    free(i->node);
    i->node = 0;
}

variable_types: struct Iterator { struct Item *node; } *


decompiled_code:
int __fastcall print_List(__int64 a1)
{
__int64 v2; // rbx
__int64 v3; // [rsp+0h] [rbp-18h] BYREF
__int64 v4; // [rsp+8h] [rbp-10h] BYREF

if ( Empty(a1) )
return printf("Error: List is empty!");
v4 = First(a1);
v3 = Last(a1);
while ( !Equal(&v4, &v3) )
{
v2 = v4;
printf("%d ", *(unsigned int *)(v4 + 16));
v4 = *(_QWORD *)(v2 + 8);
}
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func17(__int64 a1)
{
__int64 v2; // rbx
__int64 v3; // [rsp+0h] [rbp-18h] BYREF
__int64 v4; // [rsp+8h] [rbp-10h] BYREF

if ( func15(a1) )
return printf("Error: List is empty!");
v4 = func8(a1);
v3 = func9(a1);
while ( !func14(&v4, &v3) )
{
v2 = v4;
printf("%d ", *(unsigned int *)(v4 + 16));
v4 = *(_QWORD *)(v2 + 8);
}
return putchar(10);
}

original_code:
void print_List(List * l) {
    if (Empty(l)) {
        printf("Error: List is empty!");
        return;
    }
    Iterator res = { malloc(sizeof(_Item_)) };
    res = First(l);
    Iterator last = Last(l);
    while (!Equal(&res, &last)) {
        printf("%d ", res.node->data);
        res.node = res.node->next;
    }
    printf("\n");
}

canonical_original_code:
void print_List(struct List *l) {
    if (Empty(l)) {
        printf("Error: List is empty!");
        return;
    }
    struct Iterator res = { malloc(sizeof(_Item_)) };
    res = First(l);
    struct Iterator last = Last(l);
    while (!Equal(&res, &last)) {
        printf("%d ", res.node->data);
        res.node = res.node->next;
    }
    printf("\n");
}


decompiled_code:
__int64 __fastcall length_of_List(__int64 a1)
{
unsigned int v1; // ebx
__int64 v3; // [rsp+0h] [rbp-18h] BYREF
__int64 v4; // [rsp+8h] [rbp-10h] BYREF

if ( Empty(a1) )
{
puts("List is empty!");
v1 = -1;
}
else
{
v4 = First(a1);
v3 = Last(a1);
v1 = 0;
while ( !Equal(&v4, &v3) )
{
v4 = *(_QWORD *)(v4 + 8);
++v1;
}
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func18(__int64 a1)
{
unsigned int v1; // ebx
__int64 v3; // [rsp+0h] [rbp-18h] BYREF
__int64 v4; // [rsp+8h] [rbp-10h] BYREF

if ( func15(a1) )
{
puts("List is empty!");
v1 = -1;
}
else
{
v4 = func8(a1);
v3 = func9(a1);
v1 = 0;
while ( !func14(&v4, &v3) )
{
v4 = *(_QWORD *)(v4 + 8);
++v1;
}
}
return v1;
}

original_code:
int length_of_List(List * l) {
    if (Empty(l)) {
        printf("List is empty!\n");
        return -1;
    }
    int counter = 0;
    Iterator res = { malloc(sizeof(_Item_)) };
    res = First(l);
    Iterator last = Last(l);
    while (!Equal(&res, &last)) {
        res.node = res.node->next;
        counter++;
    }
    return counter;
}

canonical_original_code:
int length_of_List(struct List *l) {
    if (Empty(l)) {
        printf("List is empty!\n");
        return -1;
    }
    int counter = 0;
    struct Iterator res = { malloc(sizeof(_Item_)) };
    res = First(l);
    struct Iterator last = Last(l);
    while (!Equal(&res, &last)) {
        res.node = res.node->next;
        counter++;
    }
    return counter;
}

variable_types: counter int


decompiled_code:
__int64 __fastcall find_Items_Index(__int64 a1, __int64 *a2, int a3)
{
unsigned int v4; // eax
unsigned int v5; // er13
int v6; // ebp
__int64 v8[5]; // [rsp+8h] [rbp-28h] BYREF

if ( a3 )
{
LOBYTE(v4) = Empty(a1);
v5 = v4;
if ( (_BYTE)v4 )
{
v5 = 0;
}
else
{
v8[0] = Last(a1);
*a2 = First(a1);
v6 = 1;
while ( !Equal(a2, v8) )
{
if ( v6 == a3 )
return 1;
*a2 = *(_QWORD *)(*a2 + 8);
++v6;
}
}
}
else
{
*a2 = Last(a1);
v5 = 1;
}
return v5;
}

original_code:
_Bool find_Items_Index(List * l, Iterator * i, const int index) {
    int counter = 1;
    if (index == 0) {
        *i = Last(l);
        return 1;
    }
    if (Empty(l))
        return 0;
    Iterator last = Last(l);
    *i = First(l);
    while (!Equal(i, &last)) {
        if (counter == index)
            return 1;
        i->node = i->node->next;
        counter++;
    }
    return 0;
}

canonical_original_code:
_Bool find_Items_Index(struct List *l, struct Iterator *i, int index) {
    int counter = 1;
    if (index == 0) {
        *i = Last(l);
        return 1;
    }
    if (Empty(l))
        return 0;
    struct Iterator last = Last(l);
    *i = First(l);
    while (!Equal(i, &last)) {
        if (counter == index)
            return 1;
        i->node = i->node->next;
        counter++;
    }
    return 0;
}

variable_types: index int


decompiled_code:
__int64 __fastcall find_Items_Data(__int64 a1, __int64 *a2, int a3)
{
unsigned int v4; // eax
unsigned int v5; // er12
__int64 v7[5]; // [rsp+8h] [rbp-28h] BYREF

LOBYTE(v4) = Empty(a1);
v5 = 0;
if ( !(_BYTE)v4 )
{
v5 = v4;
v7[0] = Last(a1);
*a2 = First(a1);
while ( !Equal(a2, v7) )
{
if ( *(_DWORD *)(*a2 + 16) == a3 )
return 1;
*a2 = *(_QWORD *)(*a2 + 8);
}
}
return v5;
}

original_code:
_Bool find_Items_Data(List * l, Iterator * i, const int val) {
    int counter = 1;
    if (Empty(l))
        return 0;
    Iterator last = Last(l);
    *i = First(l);
    while (!Equal(i, &last)) {
        if (i->node->data == val)
            return 1;
        i->node = i->node->next;
        counter++;
    }
    return 0;
}

canonical_original_code:
_Bool find_Items_Data(struct List *l, struct Iterator *i, int val) {
    int counter = 1;
    if (Empty(l))
        return 0;
    struct Iterator last = Last(l);
    *i = First(l);
    while (!Equal(i, &last)) {
        if (i->node->data == val)
            return 1;
        i->node = i->node->next;
        counter++;
    }
    return 0;
}

variable_types: val int


original_code:
void my_swap(List * l, Iterator * i) {
    int tmp;
    if (length_of_List(l) == 1)
        return;
    if (l->head == i->node->prev) {
        tmp = i->node->prev->prev->data;
        i->node->prev->prev->data = i->node->next->data;
        i->node->next->data = tmp;
        return;
    }
    if (l->head == i->node->next) {
        tmp = i->node->next->next->data;
        i->node->next->next->data = i->node->prev->data;
        i->node->prev->data = tmp;
        return;
    }
    tmp = i->node->prev->data;
    i->node->prev->data = i->node->next->data;
    i->node->next->data = tmp;
}

canonical_original_code:
void my_swap(struct List *l, struct Iterator *i) {
    int tmp;
    if (length_of_List(l) == 1)
        return;
    if (l->head == i->node->prev) {
        tmp = i->node->prev->prev->data;
        i->node->prev->prev->data = i->node->next->data;
        i->node->next->data = tmp;
        return;
    }
    if (l->head == i->node->next) {
        tmp = i->node->next->next->data;
        i->node->next->next->data = i->node->prev->data;
        i->node->prev->data = tmp;
        return;
    }
    tmp = i->node->prev->data;
    i->node->prev->data = i->node->next->data;
    i->node->next->data = tmp;
}

variable_types: tmp int


Destroy

decompiled_code:
void __fastcall Destroy(_DWORD *a1)
{
_QWORD *v2; // rbx
void *v3; // rdi

v2 = *(_QWORD **)(*(_QWORD *)a1 + 8LL);
while ( *(_QWORD **)a1 != v2 )
{
v3 = v2;
v2 = (_QWORD *)v2[1];
free(v3);
}
free(v2);
*(_QWORD *)a1 = 0LL;
a1[2] = 0;
}

original_code:
void Destroy(List * l) {
    struct Item *i = l->head->next;
    while (i != l->head) {
        struct Item *pi = i;
        i = i->next;
        free(pi);
    }
    free(l->head);
    l->head = ((void *)0);
    l->size = 0;
}

canonical_original_code:
void Destroy(struct List *l) {
    struct Item *i = l->head->next;
    while (i != l->head) {
        struct Item *pi = i;
        i = i->next;
        free(pi);
    }
    free(l->head);
    l->head = ((void *)0);
    l->size = 0;
}

variable_types: struct Item { struct Item *prev; struct Item *next; int data; } *


decompiled_code:
__int64 __fastcall char_parse(unsigned int a1)
{
int v1; // er12
int v2; // eax
unsigned int v3; // ebx

v1 = 4 * a1;
fprintf(stderr, "# %d %*s %s[%d] start\n", a1, 4 * a1, " ", "char_parse", 248LL);
do
{
v2 = getchar();
v3 = v2;
}
while ( (_BYTE)v2 == 32 );
if ( (_BYTE)v2 == 10 )
{
fprintf(stderr, "# %d %*s %s[%d] end 1\n", a1, v1, " ", "char_parse", 258LL);
v3 = 0;
}
else if ( (_BYTE)v2 == 0xFF )
{
fprintf(stderr, "# %d %*s %s[%d] end 2\n", a1, v1, " ", "char_parse", 263LL);
v3 = 0;
}
else
{
fprintf(stderr, "# %d %*s %s[%d] end 3\n", a1, v1, " ", "char_parse", 266LL);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned int a1)
{
int v1; // er12
int v2; // eax
unsigned int v3; // ebx

v1 = 4 * a1;
fprintf(stderr, "# %d %*s %s[%d] start\n", a1, 4 * a1, " ", "char_parse", 248LL);
do
{
v2 = getchar();
v3 = v2;
}
while ( (_BYTE)v2 == 32 );
if ( (_BYTE)v2 == 10 )
{
fprintf(stderr, "# %d %*s %s[%d] end 1\n", a1, v1, " ", "char_parse", 258LL);
v3 = 0;
}
else if ( (_BYTE)v2 == 0xFF )
{
fprintf(stderr, "# %d %*s %s[%d] end 2\n", a1, v1, " ", "char_parse", 263LL);
v3 = 0;
}
else
{
fprintf(stderr, "# %d %*s %s[%d] end 3\n", a1, v1, " ", "char_parse", 266LL);
}
return v3;
}

original_code:
char char_parse(int depth){
    fprintf(stderr, "# %d %*s %s[%d] start\n", depth, depth * 4, " ", __FUNCTION__, 248);
    char c;
    while(1){
        c = getchar();
        if(' ' != c)
            break;
    }
    if('\n' == c){
        fprintf(stderr, "# %d %*s %s[%d] end 1\n", depth, depth * 4, " ", __FUNCTION__, 258);
        return 0;
    }
    else if((-1) == c){
        fprintf(stderr, "# %d %*s %s[%d] end 2\n", depth, depth * 4, " ", __FUNCTION__, 263);
        return 0;
    }
    fprintf(stderr, "# %d %*s %s[%d] end 3\n", depth, depth * 4, " ", __FUNCTION__, 266);
    return c;
}

variable_types: depth int

variable_types: c char

return_type: char


decompiled_code:
int __fastcall tree_del(void *ptr, unsigned int a2)
{
void **v2; // rbx
int v3; // er12
void **v4; // rdi

v2 = (void **)ptr;
v3 = 4 * a2;
fprintf(stderr, "# %d %*s %s[%d] start\n", a2, 4 * a2, " ", "tree_del", 320LL);
if ( ptr )
{
do
{
fprintf(stderr, "# %d %*s %s[%d]: c = '%c' \n", a2, v3, " ", "tree_del", 323LL, (unsigned int)*(char *)v2);
tree_del(v2[1]);
v4 = v2;
v2 = (void **)v2[2];
free(v4);
}
while ( v2 );
}
return fprintf(stderr, "# %d %*s %s[%d] end\n", a2, v3, " ", "tree_del", 329LL);
}

canonical_decompiled_code:
int __fastcall func10(void *ptr, unsigned int a2)
{
void **v2; // rbx
int v3; // er12
void **v4; // rdi

v2 = (void **)ptr;
v3 = 4 * a2;
fprintf(stderr, "# %d %*s %s[%d] start\n", a2, 4 * a2, " ", "tree_del", 320LL);
if ( ptr )
{
do
{
fprintf(stderr, "# %d %*s %s[%d]: c = '%c' \n", a2, v3, " ", "tree_del", 323LL, (unsigned int)*(char *)v2);
func10(v2[1]);
v4 = v2;
v2 = (void **)v2[2];
free(v4);
}
while ( v2 );
}
return fprintf(stderr, "# %d %*s %s[%d] end\n", a2, v3, " ", "tree_del", 329LL);
}

original_code:
void tree_del(tree_t tree, int depth) {
    fprintf(stderr, "# %d %*s %s[%d] start\n", depth, depth * 4, " ", __FUNCTION__, 320);
    tree_t p;
    while (tree != ((void *)0)) {
        fprintf(stderr, "# %d %*s %s[%d]: c    = '%c' \n", depth, depth * 4, " ", __FUNCTION__, 323, tree->data);
        tree_del(tree->left, depth + 1);
        p = tree;
        tree = tree->right;
        free(p);
    }
    fprintf(stderr, "# %d %*s %s[%d] end\n", depth, depth * 4, " ", __FUNCTION__, 329);
}

canonical_original_code:
void tree_del(struct _node_ *tree, int depth) {
    fprintf(stderr, "# %d %*s %s[%d] start\n", depth, depth * 4, " ", __FUNCTION__, 320);
    struct _node_ *p;
    while (tree != ((void *)0)) {
        fprintf(stderr, "# %d %*s %s[%d]: c    = '%c' \n", depth, depth * 4, " ", __FUNCTION__, 323, tree->data);
        tree_del(tree->left, depth + 1);
        p = tree;
        tree = tree->right;
        free(p);
    }
    fprintf(stderr, "# %d %*s %s[%d] end\n", depth, depth * 4, " ", __FUNCTION__, 329);
}

variable_types: struct _node_ { char data; struct _node_ *left; struct _node_ *right; } *


decompiled_code:
int __fastcall node_print(char *a1, int a2)
{
__int64 v3; // rdi
int result; // eax
__int64 v5; // rdi

v3 = *((_QWORD *)a1 + 2);
if ( v3 )
node_print(v3, (unsigned int)(a2 + 1));
result = printf("%*s %c\n", 4 * a2, " ", (unsigned int)*a1);
v5 = *((_QWORD *)a1 + 1);
if ( v5 )
result = node_print(v5, (unsigned int)(a2 + 1));
return result;
}

canonical_decompiled_code:
int __fastcall func8(char *a1, int a2)
{
__int64 v3; // rdi
int result; // eax
__int64 v5; // rdi

v3 = *((_QWORD *)a1 + 2);
if ( v3 )
func8(v3, (unsigned int)(a2 + 1));
result = printf("%*s %c\n", 4 * a2, " ", (unsigned int)*a1);
v5 = *((_QWORD *)a1 + 1);
if ( v5 )
result = func8(v5, (unsigned int)(a2 + 1));
return result;
}

original_code:
void node_print(tree_t tree, int tab) {
    if (tree->right){
        node_print(tree->right, tab + 1);
    }
    printf("%*s %c\n", tab * 4, " ", tree->data);
    if (tree->left){
        node_print(tree->left, tab + 1);
    }
}

canonical_original_code:
void node_print(struct _node_ *tree, int tab) {
    if (tree->right){
        node_print(tree->right, tab + 1);
    }
    printf("%*s %c\n", tab * 4, " ", tree->data);
    if (tree->left){
        node_print(tree->left, tab + 1);
    }
}

variable_types: tab int

user_defined_types: struct _node_ { char data; struct _node_ *left; struct _node_ *right; }


decompiled_code:
int __fastcall tree_print(char *a1, unsigned int a2)
{
fprintf(stderr, "# %d %*s %s[%d] start\n", a2, 4 * a2, " ", "tree_print", 290LL);
if ( a1 )
{
fputc(10, stderr);
node_print(a1, 0);
fputc(10, stderr);
}
return fprintf(stderr, "# %d %*s %s[%d] end\n", a2, 4 * a2, " ", "tree_print", 297LL);
}

canonical_decompiled_code:
int __fastcall func9(char *a1, unsigned int a2)
{
fprintf(stderr, "# %d %*s %s[%d] start\n", a2, 4 * a2, " ", "tree_print", 290LL);
if ( a1 )
{
fputc(10, stderr);
func8(a1, 0);
fputc(10, stderr);
}
return fprintf(stderr, "# %d %*s %s[%d] end\n", a2, 4 * a2, " ", "tree_print", 297LL);
}

original_code:
void tree_print(tree_t tree, int depth) {
    fprintf(stderr, "# %d %*s %s[%d] start\n", depth, depth * 4, " ", __FUNCTION__, 290);
    if (tree){
        fprintf(stderr, "\n");
        node_print(tree, 0);
        fprintf(stderr, "\n");
    }
    fprintf(stderr, "# %d %*s %s[%d] end\n", depth, depth * 4, " ", __FUNCTION__, 297);
}

canonical_original_code:
void tree_print(struct _node_ *tree, int depth) {
    fprintf(stderr, "# %d %*s %s[%d] start\n", depth, depth * 4, " ", __FUNCTION__, 290);
    if (tree){
        fprintf(stderr, "\n");
        node_print(tree, 0);
        fprintf(stderr, "\n");
    }
    fprintf(stderr, "# %d %*s %s[%d] end\n", depth, depth * 4, " ", __FUNCTION__, 297);
}


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v3; // rbx

v3 = (char *)tree_build(1u);
tree_print(v3, 1u);
tree_del(v3, 1u);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *v3; // rbx

v3 = (char *)tree_build(1u);
func9(v3, 1u);
func10(v3, 1u);
return 0;
}

original_code:
int main() {
    tree_t exptree = tree_build(1);
    tree_print(exptree, 1);
    tree_del(exptree, 1);
    return 0;
}

canonical_original_code:
int main() {
    struct _node_ *exptree = tree_build(1);
    tree_print(exptree, 1);
    tree_del(exptree, 1);
    return 0;
}


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

v1 = (*__ctype_tolower_loc())[a1] - 97;
result = 0LL;
if ( v1 <= 0x19u )
result = (unsigned int)(1 << v1);
return result;
}

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

v1 = (*__ctype_tolower_loc())[a1] - 97;
result = 0LL;
if ( v1 <= 0x19u )
result = (unsigned int)(1 << v1);
return result;
}

original_code:
set_t char2set(char c){
    char lc = tolower(c);
    if( ('a' <= lc) && (lc <= 'z') ){
        return 1u << (lc - 'a');
    }
    return 0;
}

canonical_original_code:
unsigned int char2set(char c){
    char lc = tolower(c);
    if( ('a' <= lc) && (lc <= 'z') ){
        return 1u << (lc - 'a');
    }
    return 0;
}

variable_types: lc char

return_type: unsigned int


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

for ( i = 0; ; i |= char2set(v4) )
{
v4 = getchar();
if ( v4 == -1 )
break;
}
if ( (i & 0x1104010) != 0 )
puts("Yes.");
else
puts("No.");
return 0;
}

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

for ( i = 0; ; i |= func7(v4) )
{
v4 = getchar();
if ( v4 == -1 )
break;
}
if ( (i & 0x1104010) != 0 )
puts("Yes.");
else
puts("No.");
return 0;
}

original_code:
int main (){
    char c = 0;
    set_t inputset = 0;
    while( (-1) != (c = getchar())){
        inputset = inputset | char2set(c);
    }
    if(inputset & ( (1u << ('e' - 'a')) |(1u << ('o' - 'a')) |(1u << ('u' - 'a')) |(1u << ('y' - 'a')) )){
        printf("Yes.\n");
    }
    else{
        printf("No.\n");
    }
    return 0;
}

canonical_original_code:
int main(){
    char c = 0;
    unsigned int inputset = 0;
    while( (-1) != (c = getchar())){
        inputset = inputset | char2set(c);
    }
    if(inputset & ( (1u << ('e' - 'a')) |(1u << ('o' - 'a')) |(1u << ('u' - 'a')) |(1u << ('y' - 'a')) )){
        printf("Yes.\n");
    }
    else{
        printf("No.\n");
    }
    return 0;
}

variable_types:
inputset
unsigned int


error

decompiled_code:
int __fastcall error(const char *a1)
{
return printf("Error: %s\n", a1);
}

canonical_decompiled_code:
int __fastcall func7(const char *a1)
{
return printf("Error: %s\n", a1);
}

original_code:
void error(char *msg) {
    printf("Error: %s\n", msg);
}

variable_types:
msg
char *


calc

decompiled_code:
__int64 __fastcall calc(char a1, int a2, int a3)
{
__int64 result; // rax
int v5; // edx

if ( a1 == 47 )
{
if ( !a3 )
{
error("division by zero");
exit(1);
}
result = (unsigned int)(a2 / a3);
}
else if ( a1 > 47 )
{
if ( a1 == 94 )
{
v5 = 0;
result = 1LL;
if ( a3 )
{
do
{
result = (unsigned int)(a2 * result);
++v5;
}
while ( a3 != v5 );
}
}
else
{
if ( a1 != 120 )
goto LABEL_17;
result = (unsigned int)(a3 * a2);
}
}
else
{
if ( a1 != 43 )
{
if ( a1 == 45 )
return (unsigned int)(a2 - a3);
LABEL_17:
error("unknown operation");
exit(1);
}
result = (unsigned int)(a2 + a3);
}
return result;
}

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

if ( a1 == 47 )
{
if ( !a3 )
{
func7("division by zero");
exit(1);
}
result = (unsigned int)(a2 / a3);
}
else if ( a1 > 47 )
{
if ( a1 == 94 )
{
v5 = 0;
result = 1LL;
if ( a3 )
{
do
{
result = (unsigned int)(a2 * result);
++v5;
}
while ( a3 != v5 );
}
}
else
{
if ( a1 != 120 )
goto LABEL_17;
result = (unsigned int)(a3 * a2);
}
}
else
{
if ( a1 != 43 )
{
if ( a1 == 45 )
return (unsigned int)(a2 - a3);
LABEL_17:
func7("unknown operation");
exit(1);
}
result = (unsigned int)(a2 + a3);
}
return result;
}

original_code:
int calc(char op, int firstarg, int secondarg) {
    int result = 0;
    switch (op) {
        case '+':
            result = firstarg + secondarg;
            break;
        case '-':
            result = firstarg - secondarg;
            break;
        case '/':
            if (0 == secondarg) {
                error("division by zero");
                exit(1);
            }
            else
                result = firstarg / secondarg;
            break;
        case 'x':
            result = firstarg * secondarg;
            break;
        case '^':
        {
            int i;
            result = 1;
            for (i = 0; i != secondarg; ++i)
                result *= firstarg;
        }
            break;
        default:
            error("unknown operation");
            exit(1);
    };
    return result;
}

variable_types: op char

variable_types: firstarg int

variable_types: secondarg int

variable_types: result int

variable_types: i int


getnum

decompiled_code:
int __fastcall getnum(char *nptr)
{
int v1; // eax
int v2; // ebp
const unsigned __int16 *v3; // rcx
char *v4; // rax

v1 = strlen(nptr);
if ( v1 )
{
v2 = v1;
v3 = *__ctype_b_loc();
v4 = nptr;
do
{
if ( (v3[*v4] & 0x800) == 0 )
{
error("wrong usage: argvs is not numbers");
exit(1);
}
++v4;
}
while ( v4 != &nptr[v2 - 1 + 1] );
}
return atoi(nptr);
}

canonical_decompiled_code:
int __fastcall func9(char *nptr)
{
int v1; // eax
int v2; // ebp
const unsigned __int16 *v3; // rcx
char *v4; // rax

v1 = strlen(nptr);
if ( v1 )
{
v2 = v1;
v3 = *__ctype_b_loc();
v4 = nptr;
do
{
if ( (v3[*v4] & 0x800) == 0 )
{
func7("wrong usage: argvs is not numbers");
exit(1);
}
++v4;
}
while ( v4 != &nptr[v2 - 1 + 1] );
}
return atoi(nptr);
}

original_code:
int getnum(char *arg) {
    int i;
    int len;
    len = strlen(arg);
    for (i = 0; i != len; ++i) {
        if (!((*__ctype_b_loc ())[(int) ((arg[i]))] & (unsigned short int) _ISdigit)) {
            error("wrong usage: argvs is not numbers");
            exit(1);
        }
    }
    return atoi(arg);
}

canonical_original_code:
int getnum(char *arg) {
    int i;
    int len;
    len = strlen(arg);
    for (i = 0; i != len; ++i) {
        if (!((*__ctype_b_loc ())[(int) ((arg[i]))] & (unsigned short) _ISdigit)) {
            error("wrong usage: argvs is not numbers");
            exit(1);
        }
    }
    return atoi(arg);
}

variable_types:
arg
char *

variable_types: len int


preorder

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

if ( a1 )
{
printf(" %c ", (unsigned int)*a1);
preorder(*((_QWORD *)a1 + 1));
result = preorder(*((_QWORD *)a1 + 2));
}
return result;
}

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

if ( a1 )
{
printf(" %c ", (unsigned int)*a1);
func7(*((_QWORD *)a1 + 1));
result = func7(*((_QWORD *)a1 + 2));
}
return result;
}

original_code:
void preorder(tree_t tree) {
    if (tree) {
        printf(" %c ", tree->data);
        preorder(tree->left);
        preorder(tree->right);
    }
}

canonical_original_code:
void preorder(struct _node_ *tree) {
    if (tree) {
        printf(" %c ", tree->data);
        preorder(tree->left);
        preorder(tree->right);
    }
}


postorder

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

if ( a1 )
{
printf(" %c ", (unsigned int)*a1);
postorder(*((_QWORD *)a1 + 1));
result = postorder(*((_QWORD *)a1 + 2));
}
return result;
}

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

if ( a1 )
{
printf(" %c ", (unsigned int)*a1);
func8(*((_QWORD *)a1 + 1));
result = func8(*((_QWORD *)a1 + 2));
}
return result;
}

original_code:
void postorder(tree_t tree) {
    if (tree) {
        printf(" %c ", tree->data);
        postorder(tree->left);
        postorder(tree->right);
    }
}

canonical_original_code:
void postorder(struct _node_ *tree) {
    if (tree) {
        printf(" %c ", tree->data);
        postorder(tree->left);
        postorder(tree->right);
    }
}


decompiled_code:
int __fastcall inorder_depth(char *a1, int a2)
{
int result; // eax

if ( a1 )
{
if ( *((_QWORD *)a1 + 1) && *((_QWORD *)a1 + 2) && a2 )
putchar(40);
inorder_depth(*((_QWORD *)a1 + 1), 1LL);
printf(" %c ", (unsigned int)*a1);
result = inorder_depth(*((_QWORD *)a1 + 2), 1LL);
if ( *((_QWORD *)a1 + 1) && *((_QWORD *)a1 + 2) )
{
if ( a2 )
result = putchar(41);
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func9(char *a1, int a2)
{
int result; // eax

if ( a1 )
{
if ( *((_QWORD *)a1 + 1) && *((_QWORD *)a1 + 2) && a2 )
putchar(40);
func9(*((_QWORD *)a1 + 1), 1LL);
printf(" %c ", (unsigned int)*a1);
result = func9(*((_QWORD *)a1 + 2), 1LL);
if ( *((_QWORD *)a1 + 1) && *((_QWORD *)a1 + 2) )
{
if ( a2 )
result = putchar(41);
}
}
return result;
}

original_code:
void inorder_depth(tree_t tree, int flag) {
    if (tree) {
        if (tree->left && tree->right && flag){
            printf("(");
        }
        inorder_depth(tree->left, 1);
        printf(" %c ", tree->data);
        inorder_depth(tree->right, 1);
        if (tree->left && tree->right && flag){
            printf(")");
        }
    }
}

canonical_original_code:
void inorder_depth(struct _node_ *tree, int flag) {
    if (tree) {
        if (tree->left && tree->right && flag){
            printf("(");
        }
        inorder_depth(tree->left, 1);
        printf(" %c ", tree->data);
        inorder_depth(tree->right, 1);
        if (tree->left && tree->right && flag){
            printf(")");
        }
    }
}

variable_types: flag int


inorder

decompiled_code:
int __fastcall inorder(char *a1)
{
return inorder_depth(a1, 0);
}

canonical_decompiled_code:
int __fastcall func10(char *a1)
{
return func9(a1, 0);
}

original_code:
void inorder(tree_t tree) {
    inorder_depth(tree, 0);
}

canonical_original_code:
void inorder(struct _node_ *tree) {
    inorder_depth(tree, 0);
}


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

result = 0LL;
if ( (a1 & 0xFD) != 45 && (unsigned __int8)(a1 - 42) > 1u )
{
result = 1LL;
if ( (unsigned __int8)(a1 - 48) > 9u )
result = (unsigned __int8)((a1 & 0xDF) - 65) < 0x1Au ? 1 : -1;
}
return result;
}

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

result = 0LL;
if ( (a1 & 0xFD) != 45 && (unsigned __int8)(a1 - 42) > 1u )
{
result = 1LL;
if ( (unsigned __int8)(a1 - 48) > 9u )
result = (unsigned __int8)((a1 & 0xDF) - 65) < 0x1Au ? 1 : -1;
}
return result;
}

return_type: enum symbol_t { IS_OP=0, IS_ALNUM=1, IS_ERR=-1 }


decompiled_code:
_QWORD *stack_new()
{
_QWORD *v0; // rbx

v0 = malloc(0x10uLL);
*(_DWORD *)v0 = -1;
v0[1] = malloc(8uLL);
return v0;
}

canonical_decompiled_code:
_QWORD *func14()
{
_QWORD *v0; // rbx

v0 = malloc(0x10uLL);
*(_DWORD *)v0 = -1;
v0[1] = malloc(8uLL);
return v0;
}

original_code:
stack_t *stack_new() {
    stack_t *self = malloc(sizeof(stack_t));
    self->top = -1;
    self->data = malloc(sizeof(tree_t));
    return self;
}

canonical_original_code:
struct _stack_ *stack_new() {
    struct _stack_ *self = malloc(sizeof(stack_t));
    self->top = -1;
    self->data = malloc(sizeof(tree_t));
    return self;
}

variable_types: struct _stack_ { int top; struct _node_ { char data; struct _node_ *left; struct _node_ *right; } **data; } *

user_defined_types: struct _stack_ { int top; struct _node_ **data; }


decompiled_code:
__int64 __fastcall stack_base(__int64 a1)
{
return **(_QWORD **)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
return **(_QWORD **)(a1 + 8);
}

original_code:
tree_t stack_base(stack_t * self) {
    return self->data[0];
}

canonical_original_code:
struct _node_ *stack_base(struct _stack_ *self) {
    return self->data[0];
}

variable_types: struct _stack_ { int top; struct _node_ **data; } *

return_type: struct _node_ { char data; struct _node_ *left; struct _node_ *right; } *


original_code:
tree_t stack_pop(stack_t * self) {
    self->top = self->top - 1;
    if (self->top > -2) {
        tree_t tree = self->data[self->top + 1];
        return tree;
    }
    return ((void *)0);
}

canonical_original_code:
struct _node_ *stack_pop(struct _stack_ *self) {
    self->top = self->top - 1;
    if (self->top > -2) {
        struct _node_ *tree = self->data[self->top + 1];
        return tree;
    }
    return ((void *)0);
}


decompiled_code:
int __fastcall node_print(char *a1, int a2)
{
__int64 v3; // rdi
int result; // eax
__int64 v5; // rdi

v3 = *((_QWORD *)a1 + 2);
if ( v3 )
node_print(v3, (unsigned int)(a2 + 1));
result = printf("%*s [%c]\n", 4 * a2, " ", (unsigned int)*a1);
v5 = *((_QWORD *)a1 + 1);
if ( v5 )
result = node_print(v5, (unsigned int)(a2 + 1));
return result;
}

canonical_decompiled_code:
int __fastcall func11(char *a1, int a2)
{
__int64 v3; // rdi
int result; // eax
__int64 v5; // rdi

v3 = *((_QWORD *)a1 + 2);
if ( v3 )
func11(v3, (unsigned int)(a2 + 1));
result = printf("%*s [%c]\n", 4 * a2, " ", (unsigned int)*a1);
v5 = *((_QWORD *)a1 + 1);
if ( v5 )
result = func11(v5, (unsigned int)(a2 + 1));
return result;
}

original_code:
void node_print(tree_t tree, int tab) {
    if (tree->right) {
        node_print(tree->right, tab + 1);
    }
    printf("%*s [%c]\n", tab * 4, " ", tree->data);
    if (tree->left) {
        node_print(tree->left, tab + 1);
    }
}

canonical_original_code:
void node_print(struct _node_ *tree, int tab) {
    if (tree->right) {
        node_print(tree->right, tab + 1);
    }
    printf("%*s [%c]\n", tab * 4, " ", tree->data);
    if (tree->left) {
        node_print(tree->left, tab + 1);
    }
}


decompiled_code:
int __fastcall tree_print(char *a1)
{
int result; // eax

if ( a1 )
result = node_print(a1, 0);
return result;
}

canonical_decompiled_code:
int __fastcall func12(char *a1)
{
int result; // eax

if ( a1 )
result = func11(a1, 0);
return result;
}

original_code:
void tree_print(tree_t tree) {
    if (tree) {
        node_print(tree, 0);
    }
}

canonical_original_code:
void tree_print(struct _node_ *tree) {
    if (tree) {
        node_print(tree, 0);
    }
}


decompiled_code:
__int64 __fastcall tree_build(char *a1)
{
void **v1; // r12
char v2; // bp
char *v3; // rbx
_QWORD *v4; // rax
int v5; // eax
__int64 v6; // r13
__int64 v7; // r14
_QWORD *v8; // rax

v1 = (void **)stack_new();
v2 = *a1;
if ( *a1 )
{
v3 = a1 + 1;
do
{
v5 = symbol_check(v2);
if ( v5 == 1 )
{
v4 = malloc(0x18uLL);
*(_BYTE *)v4 = v2;
v4[1] = 0LL;
v4[2] = 0LL;
stack_push(v1, (__int64)v4);
}
else if ( !v5 )
{
v6 = stack_pop((int *)v1);
v7 = stack_pop((int *)v1);
v8 = malloc(0x18uLL);
*(_BYTE *)v8 = v2;
v8[1] = v7;
v8[2] = v6;
stack_push(v1, (__int64)v8);
}
v2 = *v3++;
}
while ( v2 );
}
return stack_base((__int64)v1);
}

original_code:
tree_t tree_build(char *buffer) {
    tree_t new_tree;
    tree_t tree_lhs;
    tree_t tree_rhs;
    symbol_t flag;
    stack_t *stack = stack_new();
    char symbol = buffer[0];
    for (int i = 1; symbol != 0; ++i) {
        flag = symbol_check(symbol);
        if (IS_ALNUM == flag) {
            new_tree = malloc(sizeof(node_t));
            new_tree->data = symbol;
            new_tree->left = ((void *)0);
            new_tree->right = ((void *)0);
            stack_push(stack, new_tree);
        }
        else if (IS_OP == flag) {
            tree_rhs = stack_pop(stack);
            tree_lhs = stack_pop(stack);
            new_tree = malloc(sizeof(node_t));
            new_tree->data = symbol;
            new_tree->left = tree_lhs;
            new_tree->right = tree_rhs;
            stack_push(stack, new_tree);
        }
        symbol = buffer[i];
    }
    return stack_base(stack);
}

canonical_original_code:
struct _node_ *tree_build(char *buffer) {
    struct _node_ *new_tree;
    struct _node_ *tree_lhs;
    struct _node_ *tree_rhs;
    enum symbol_t flag;
    struct _stack_ *stack = stack_new();
    char symbol = buffer[0];
    for (int i = 1; symbol != 0; ++i) {
        flag = symbol_check(symbol);
        if (IS_ALNUM == flag) {
            new_tree = malloc(sizeof(node_t));
            new_tree->data = symbol;
            new_tree->left = ((void *)0);
            new_tree->right = ((void *)0);
            stack_push(stack, new_tree);
        }
        else if (IS_OP == flag) {
            tree_rhs = stack_pop(stack);
            tree_lhs = stack_pop(stack);
            new_tree = malloc(sizeof(node_t));
            new_tree->data = symbol;
            new_tree->left = tree_lhs;
            new_tree->right = tree_rhs;
            stack_push(stack, new_tree);
        }
        symbol = buffer[i];
    }
    return stack_base(stack);
}

variable_types:
buffer
char *

variable_types: enum symbol_t { IS_OP=0, IS_ALNUM=1, IS_ERR=-1 }

variable_types: symbol char


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
void *v3; // rbx
char *v4; // rbx

v3 = malloc(0x1000uLL);
memset(v3, 0, 0x200uLL);
printf("Enter Postfix Expression : ");
fgets((char *)v3, 512, stdin);
v4 = (char *)tree_build((char *)v3);
tree_print(v4);
puts("\nPre-Order Traversal : ");
preorder(v4);
putchar(10);
puts("\nIn-Order Traversal : ");
inorder(v4);
putchar(10);
puts("\nPost-Order Traversal : ");
postorder(v4);
putchar(10);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
void *v3; // rbx
char *v4; // rbx

v3 = malloc(0x1000uLL);
memset(v3, 0, 0x200uLL);
printf("Enter Postfix Expression : ");
fgets((char *)v3, 512, stdin);
v4 = (char *)func17((char *)v3);
func12(v4);
puts("\nPre-Order Traversal : ");
func7(v4);
putchar(10);
puts("\nIn-Order Traversal : ");
func10(v4);
putchar(10);
puts("\nPost-Order Traversal : ");
func8(v4);
putchar(10);
return 0;
}

original_code:
int main() {
    char *buffer = malloc(sizeof(buffer) * BUFFER_SIZE);
    memset(buffer, 0, BUFFER_SIZE);
    printf("Enter Postfix Expression : ");
    fgets(buffer, BUFFER_SIZE, stdin);
    tree_t tree = tree_build(buffer);
    tree_print(tree);
    printf("\nPre-Order Traversal :  \n");
    preorder(tree);
    printf("\n");
    printf("\nIn-Order Traversal :  \n");
    inorder(tree);
    printf("\n");
    printf("\nPost-Order Traversal :  \n");
    postorder(tree);
    printf("\n");
    return 0;
}

canonical_original_code:
int main() {
    char *buffer = malloc(sizeof(buffer) * BUFFER_SIZE);
    memset(buffer, 0, BUFFER_SIZE);
    printf("Enter Postfix Expression : ");
    fgets(buffer, BUFFER_SIZE, stdin);
    struct _node_ *tree = tree_build(buffer);
    tree_print(tree);
    printf("\nPre-Order Traversal :  \n");
    preorder(tree);
    printf("\n");
    printf("\nIn-Order Traversal :  \n");
    inorder(tree);
    printf("\n");
    printf("\nPost-Order Traversal :  \n");
    postorder(tree);
    printf("\n");
    return 0;
}

variable_types: struct _node_ { char data; struct _node_ *left; struct _node_ *right; } *


Resize

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

*(_QWORD *)a1 = realloc(*(void **)a1, 4LL * a2);
result = _Fill((__int64 *)a1, *(_QWORD *)(a1 + 8), a2);
*(_QWORD *)(a1 + 8) = a2;
return result;
}

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

*(_QWORD *)a1 = realloc(*(void **)a1, 4LL * a2);
result = func7((__int64 *)a1, *(_QWORD *)(a1 + 8), a2);
*(_QWORD *)(a1 + 8) = a2;
return result;
}

original_code:
void Resize(Vector* this, int sz) {
    this->data = realloc(this->data, sizeof(T) * sz);
    __Fill(this, this->size, sz);
    this->size = sz;
}

canonical_original_code:
void Resize(struct Vector *this, int sz) {
    this->data = realloc(this->data, sizeof(T) * sz);
    __Fill(this, this->size, sz);
    this->size = sz;
}

variable_types: struct Vector { int *data; unsigned long size; unsigned long capacity; } *

variable_types: sz int


LazyResize

decompiled_code:
__int64 __fastcall LazyResize(__int64 a1, unsigned __int64 a2)
{
unsigned __int64 v3; // rsi
__int64 result; // rax

v3 = *(_QWORD *)(a1 + 16);
if ( v3 <= a2 )
{
*(_QWORD *)(a1 + 16) = 2 * v3;
*(_QWORD *)a1 = realloc(*(void **)a1, 8 * v3);
}
result = _Fill((__int64 *)a1, *(_QWORD *)(a1 + 8), a2);
*(_QWORD *)(a1 + 8) = a2;
return result;
}

original_code:
void LazyResize(Vector* this, size_t sz) {
    if(this->capacity > sz) {
    }
    else {
        this->capacity = CAPACITY_COEF * this->capacity;
        this->data = realloc(this->data, sizeof(T) * this->capacity);
    }
    __Fill(this, this->size, sz);
    this->size = sz;
}

canonical_original_code:
void LazyResize(struct Vector *this, unsigned long sz) {
    if(this->capacity > sz) {
    }
    else {
        this->capacity = CAPACITY_COEF * this->capacity;
        this->data = realloc(this->data, sizeof(T) * this->capacity);
    }
    __Fill(this, this->size, sz);
    this->size = sz;
}

variable_types:
sz
unsigned long

user_defined_types: struct Vector { int *data; unsigned long size; unsigned long capacity; }


Load

decompiled_code:
__int64 __fastcall Load(_QWORD *a1, unsigned __int64 a2)
{
if ( a1[1] <= a2 )
{
fwrite("Out of range! Aborting...\n", 1uLL, 0x1AuLL, stderr);
exit(1);
}
return *(unsigned int *)(*a1 + 4 * a2);
}

canonical_decompiled_code:
__int64 __fastcall func11(_QWORD *a1, unsigned __int64 a2)
{
if ( a1[1] <= a2 )
{
fwrite("Out of range! Aborting...\n", 1uLL, 0x1AuLL, stderr);
exit(1);
}
return *(unsigned int *)(*a1 + 4 * a2);
}

original_code:
T Load(Vector* this, size_t i) {
    if ((i >= 0) && (i < this->size))
        return this->data[i];
    fprintf(stderr, "Out of range! Aborting...\n");
    exit(1);
}

canonical_original_code:
int Load(struct Vector *this, unsigned long i) {
    if ((i >= 0) && (i < this->size))
        return this->data[i];
    fprintf(stderr, "Out of range! Aborting...\n");
    exit(1);
}

variable_types:
i
unsigned long


Save

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

if ( a1[1] > a2 )
{
result = *a1;
*(_DWORD *)(*a1 + 4 * a2) = a3;
}
return result;
}

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

if ( a1[1] > a2 )
{
result = *a1;
*(_DWORD *)(*a1 + 4 * a2) = a3;
}
return result;
}

original_code:
void Save(Vector* this, size_t i, T t) {
    if ((i >= 0) && (i < this->size))
        this->data[i] = t;
}

canonical_original_code:
void Save(struct Vector *this, unsigned long i, int t) {
    if ((i >= 0) && (i < this->size))
        this->data[i] = t;
}

variable_types: t int


IsEmpty

decompiled_code:
bool __fastcall IsEmpty(__int64 a1)
{
return *(_QWORD *)(a1 + 8) == 0LL;
}

canonical_decompiled_code:
bool __fastcall func13(__int64 a1)
{
return *(_QWORD *)(a1 + 8) == 0LL;
}

original_code:
_Bool IsEmpty(Vector* this) {
    return this->size == 0;
}

canonical_original_code:
_Bool IsEmpty(struct Vector *this) {
    return this->size == 0;
}


GetSize

decompiled_code:
__int64 __fastcall GetSize(__int64 a1)
{
return *(_QWORD *)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1)
{
return *(_QWORD *)(a1 + 8);
}

original_code:
size_t GetSize(Vector* this) {
    return this->size;
}

canonical_original_code:
unsigned long GetSize(struct Vector *this) {
    return this->size;
}

return_type: unsigned long


GetCapacity

decompiled_code:
__int64 __fastcall GetCapacity(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

original_code:
size_t GetCapacity(Vector* this) {
    return this->capacity;
}

canonical_original_code:
unsigned long GetCapacity(struct Vector *this) {
    return this->capacity;
}


IsEqual

original_code:
_Bool IsEqual(Vector* l, Vector* r) {
    if (l->size != r->size)
        return 0;
    for (size_t i = 0; i < l->size; ++i)
        if (l->data[i] != r->data[i])
            return 0;
    return 1;
}

canonical_original_code:
_Bool IsEqual(struct Vector *l, struct Vector *r) {
    if (l->size != r->size)
        return 0;
    for (unsigned long i = 0; i < l->size; ++i)
        if (l->data[i] != r->data[i])
            return 0;
    return 1;
}

variable_types:
r
struct Vector *


IsEqualFast

decompiled_code:
bool __fastcall IsEqualFast(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
bool result; // al

v2 = *(_QWORD *)(a1 + 8);
result = 0;
if ( v2 == *(_QWORD *)(a2 + 8) )
result = memcmp(*(const void **)a1, *(const void **)a2, 4 * v2) == 0;
return result;
}

canonical_decompiled_code:
bool __fastcall func17(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
bool result; // al

v2 = *(_QWORD *)(a1 + 8);
result = 0;
if ( v2 == *(_QWORD *)(a2 + 8) )
result = memcmp(*(const void **)a1, *(const void **)a2, 4 * v2) == 0;
return result;
}

original_code:
_Bool IsEqualFast(Vector* l, Vector* r) {
    if (l->size != r->size)
        return 0;
    if(memcmp(l->data, r->data, l->size * sizeof(T)))
        return 0;
    return 1;
}

canonical_original_code:
_Bool IsEqualFast(struct Vector *l, struct Vector *r) {
    if (l->size != r->size)
        return 0;
    if(memcmp(l->data, r->data, l->size * sizeof(T)))
        return 0;
    return 1;
}


Destroy

decompiled_code:
void __fastcall Destroy(__int64 a1)
{
*(_QWORD *)(a1 + 8) = 0LL;
free(*(void **)a1);
*(_QWORD *)a1 = 0LL;
}

canonical_decompiled_code:
void __fastcall func18(__int64 a1)
{
*(_QWORD *)(a1 + 8) = 0LL;
free(*(void **)a1);
*(_QWORD *)a1 = 0LL;
}

original_code:
void Destroy(Vector* this) {
    this->size = 0;
    free(this->data);
    this->data = ((void *)0);
}

canonical_original_code:
void Destroy(struct Vector *this) {
    this->size = 0;
    free(this->data);
    this->data = ((void *)0);
}


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 *v3; // rbx
__int64 v4; // rax
__int64 v5; // rax
unsigned __int64 i; // rbp
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
unsigned __int64 j; // rbp
unsigned int v12; // eax
int v14; // [rsp+4h] [rbp-24h]
__int64 v15; // [rsp+8h] [rbp-20h]

printf("Input size of vector, please: ");
__isoc99_scanf();
v3 = Create(v15);
v4 = GetSize((__int64)v3);
printf("1) Size :%lu\n", v4);
v5 = GetCapacity((__int64)v3);
printf(" Capacity :%lu\n", v5);
puts("If you are weary enter values, then enter: 100500");
puts("So, start!!!");
for ( i = 0LL; ; ++i )
{
__isoc99_scanf();
if ( v14 == 100500 )
break;
v9 = GetSize((__int64)v3);
printf("2) Size :%lu\n", v9);
v10 = GetCapacity((__int64)v3);
printf(" Capacity :%lu\n", v10);
printf(" i :%lu\n", i);
if ( GetSize((__int64)v3) == i )
{
LazyResize((__int64)v3, i + 1);
puts("!!! Resize ");
}
v7 = GetSize((__int64)v3);
printf("3) Size :%lu\n", v7);
v8 = GetCapacity((__int64)v3);
printf(" Capacity :%lu\n", v8);
printf(" i :%lu\n", i);
Save(v3, i, v14);
getchar();
}
for ( j = 0LL; GetSize((__int64)v3) > j; ++j )
{
v12 = Load(v3, j);
printf("%d ", v12);
}
putchar(10);
Destroy((__int64)v3);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 *v3; // rbx
__int64 v4; // rax
__int64 v5; // rax
unsigned __int64 i; // rbp
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
unsigned __int64 j; // rbp
unsigned int v12; // eax
int v14; // [rsp+4h] [rbp-24h]
__int64 v15; // [rsp+8h] [rbp-20h]

printf("Input size of vector, please: ");
__isoc99_scanf();
v3 = Create(v15);
v4 = func14((__int64)v3);
printf("1) Size :%lu\n", v4);
v5 = func15((__int64)v3);
printf(" Capacity :%lu\n", v5);
puts("If you are weary enter values, then enter: 100500");
puts("So, start!!!");
for ( i = 0LL; ; ++i )
{
__isoc99_scanf();
if ( v14 == 100500 )
break;
v9 = func14((__int64)v3);
printf("2) Size :%lu\n", v9);
v10 = func15((__int64)v3);
printf(" Capacity :%lu\n", v10);
printf(" i :%lu\n", i);
if ( func14((__int64)v3) == i )
{
func10((__int64)v3, i + 1);
puts("!!! Resize ");
}
v7 = func14((__int64)v3);
printf("3) Size :%lu\n", v7);
v8 = func15((__int64)v3);
printf(" Capacity :%lu\n", v8);
printf(" i :%lu\n", i);
func12(v3, i, v14);
getchar();
}
for ( j = 0LL; func14((__int64)v3) > j; ++j )
{
v12 = func11(v3, j);
printf("%d ", v12);
}
putchar(10);
func18((__int64)v3);
return 0;
}

original_code:
int main() {
    size_t size_v;
    printf("Input size of vector, please: ");
    scanf("%lu", &size_v);
    Vector *my_vector = Create(size_v);
    printf("1)  Size     :%lu\n", GetSize(my_vector));
    printf("    Capacity :%lu\n", GetCapacity(my_vector));
    printf("If you are weary enter values, then enter: 100500\n");
    printf("So, start!!!\n");
    size_t i = 0;
    for (;;) {
        int value;
        scanf("%d", &value);
        if (value == 100500)
            break;
        printf("2)  Size     :%lu\n", GetSize(my_vector));
        printf("    Capacity :%lu\n", GetCapacity(my_vector));
        printf("    i        :%lu\n", i);
        if (GetSize(my_vector) == i) {
            LazyResize(my_vector, i+1);
            printf("!!! Resize \n");
        }
        printf("3)  Size     :%lu\n", GetSize(my_vector));
        printf("    Capacity :%lu\n", GetCapacity(my_vector));
        printf("    i        :%lu\n", i);
        Save(my_vector, i, value);
        ++i;
        getchar();
    }
    for (size_t i = 0; i < GetSize(my_vector); ++i)
        printf("%d ", Load(my_vector, i));
    printf("\n");
    Destroy(my_vector);
}

canonical_original_code:
int main() {
    unsigned long size_v;
    printf("Input size of vector, please: ");
    scanf("%lu", &size_v);
    struct Vector *my_vector = Create(size_v);
    printf("1)  Size     :%lu\n", GetSize(my_vector));
    printf("    Capacity :%lu\n", GetCapacity(my_vector));
    printf("If you are weary enter values, then enter: 100500\n");
    printf("So, start!!!\n");
    unsigned long i = 0;
    for (;;) {
        int value;
        scanf("%d", &value);
        if (value == 100500)
            break;
        printf("2)  Size     :%lu\n", GetSize(my_vector));
        printf("    Capacity :%lu\n", GetCapacity(my_vector));
        printf("    i        :%lu\n", i);
        if (GetSize(my_vector) == i) {
            LazyResize(my_vector, i+1);
            printf("!!! Resize \n");
        }
        printf("3)  Size     :%lu\n", GetSize(my_vector));
        printf("    Capacity :%lu\n", GetCapacity(my_vector));
        printf("    i        :%lu\n", i);
        Save(my_vector, i, value);
        ++i;
        getchar();
    }
    for (unsigned long i = 0; i < GetSize(my_vector); ++i)
        printf("%d ", Load(my_vector, i));
    printf("\n");
    Destroy(my_vector);
}

variable_types: value int


original_code:
htab_t *htab_create() {
    htab_t *this;
    this = malloc(sizeof(htab_t));
    this->_cap = 16561;
    this->data = malloc(sizeof(node_t *) * this->_cap);
    this->_used = malloc(sizeof(_Bool) * this->_cap);
    memset(this->data, 0, sizeof(node_t *) * this->_cap);
    memset(this->_used, 0, sizeof(_Bool) * this->_cap);
    this->_idx = 0;
    this->size = 0;
    return this;
}

canonical_original_code:
struct htab_t *htab_create() {
    struct htab_t *this;
    this = malloc(sizeof(htab_t));
    this->_cap = 16561;
    this->data = malloc(sizeof(struct node_t *) * this->_cap);
    this->_used = malloc(sizeof(_Bool) * this->_cap);
    memset(this->data, 0, sizeof(struct node_t *) * this->_cap);
    memset(this->_used, 0, sizeof(_Bool) * this->_cap);
    this->_idx = 0;
    this->size = 0;
    return this;
}

variable_types: struct htab_t { unsigned long size; struct node_t { char *key; char *value; char *_buffer; } **data; _Bool *_used; unsigned long _idx; unsigned long _cap; } *

user_defined_types: struct htab_t { unsigned long size; struct node_t **data; _Bool *_used; unsigned long _idx; unsigned long _cap; }


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

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

original_code:
size_t htab_get_size(htab_t * const this) {
    return this->size;
}

canonical_original_code:
unsigned long htab_get_size(struct htab_t *this) {
    return this->size;
}

user_defined_types: struct node_t { char *key; char *value; char *_buffer; }


decompiled_code:
__int64 __fastcall htab_get_cap(__int64 a1)
{
return *(_QWORD *)(a1 + 32);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
return *(_QWORD *)(a1 + 32);
}

original_code:
size_t htab_get_cap(htab_t * const this) {
    return this->_cap;
}

canonical_original_code:
unsigned long htab_get_cap(struct htab_t *this) {
    return this->_cap;
}


decompiled_code:
void __fastcall htab_destroy(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi
void *v4; // rdi

if ( ptr )
{
if ( *((_QWORD *)ptr + 4) )
{
v2 = 0LL;
do
node_destroy(*(void **)(*((_QWORD *)ptr + 1) + 8 * v2++));
while ( *((_QWORD *)ptr + 4) != v2 );
}
v3 = (void *)*((_QWORD *)ptr + 1);
if ( v3 )
free(v3);
v4 = (void *)*((_QWORD *)ptr + 2);
if ( v4 )
free(v4);
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func10(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi
void *v4; // rdi

if ( ptr )
{
if ( *((_QWORD *)ptr + 4) )
{
v2 = 0LL;
do
func25(*(void **)(*((_QWORD *)ptr + 1) + 8 * v2++));
while ( *((_QWORD *)ptr + 4) != v2 );
}
v3 = (void *)*((_QWORD *)ptr + 1);
if ( v3 )
free(v3);
v4 = (void *)*((_QWORD *)ptr + 2);
if ( v4 )
free(v4);
free(ptr);
}
}

original_code:
void htab_destroy(htab_t * this) {
    size_t i;
    if (!this)
        return;
    for (i = 0; i != this->_cap; ++i) {
        node_destroy(this->data[i]);
    }
    if (this->data) {
        free(this->data);
        this->data = ((void *)0);
    }
    if (this->_used) {
        free(this->_used);
        this->data = ((void *)0);
    }
    free(this);
    this = ((void *)0);
}

canonical_original_code:
void htab_destroy(struct htab_t *this) {
    unsigned long i;
    if (!this)
        return;
    for (i = 0; i != this->_cap; ++i) {
        node_destroy(this->data[i]);
    }
    if (this->data) {
        free(this->data);
        this->data = ((void *)0);
    }
    if (this->_used) {
        free(this->_used);
        this->data = ((void *)0);
    }
    free(this);
    this = ((void *)0);
}


rehash

decompiled_code:
unsigned __int64 __fastcall rehash(__int64 a1, __int64 a2, unsigned __int64 a3)
{
return (a2 * a2 + a1) % a3;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func13(__int64 a1, __int64 a2, unsigned __int64 a3)
{
return (a2 * a2 + a1) % a3;
}

original_code:
hash_t rehash(hash_t hash, size_t idx, size_t table_size) {
    return (hash + idx * idx) % table_size;
}

canonical_original_code:
unsigned long rehash(unsigned long hash, unsigned long idx, unsigned long table_size) {
    return (hash + idx * idx) % table_size;
}

variable_types:
hash
unsigned long

variable_types:
idx
unsigned long


original_code:
int htab_addnode(htab_t * this, node_t * const node) {
    hash_t hash;
    hash = node_hashing(node, this->_cap);
    while (this->_used[hash]) {
        if (!strcmp(node_get_key(this->data[hash]), node_get_key(node))) {
            return -1;
        }
        else {
            hash = rehash(hash, this->_idx, this->_cap);
            ++(this->_idx);
        }
    }
    this->data[hash] = node;
    this->_used[hash] = 1;
    ++(this->size);
    if (this->size + 1 == this->_cap) {
        size_t newcap = this->_cap * 2;
        this->data = realloc(this->data, sizeof(node_t *) * newcap);
        this->_used = realloc(this->_used, sizeof(_Bool) * newcap);
        memset(this->data + this->_cap, 0, sizeof(node_t *) * this->_cap);
        memset(this->_used + this->_cap, 0, sizeof(_Bool) * this->_cap);
        this->_cap = newcap;
    }
    return 0;
}

canonical_original_code:
int htab_addnode(struct htab_t *this, struct node_t *node) {
    unsigned long hash;
    hash = node_hashing(node, this->_cap);
    while (this->_used[hash]) {
        if (!strcmp(node_get_key(this->data[hash]), node_get_key(node))) {
            return -1;
        }
        else {
            hash = rehash(hash, this->_idx, this->_cap);
            ++(this->_idx);
        }
    }
    this->data[hash] = node;
    this->_used[hash] = 1;
    ++(this->size);
    if (this->size + 1 == this->_cap) {
        unsigned long newcap = this->_cap * 2;
        this->data = realloc(this->data, sizeof(struct node_t *) * newcap);
        this->_used = realloc(this->_used, sizeof(_Bool) * newcap);
        memset(this->data + this->_cap, 0, sizeof(struct node_t *) * this->_cap);
        memset(this->_used + this->_cap, 0, sizeof(_Bool) * this->_cap);
        this->_cap = newcap;
    }
    return 0;
}

variable_types:
node
struct node_t *

variable_types:
newcap
unsigned long


decompiled_code:
__int64 __fastcall htab_findhash(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
unsigned __int64 i; // r12
const char *v4; // rbp
const char *v5; // rax
unsigned __int64 v6; // rdx

v2 = node_hashing(a2, *(_QWORD *)(a1 + 32));
for ( i = 1LL; ; ++i )
{
v4 = (const char *)node_get_key(a2);
v5 = (const char *)node_get_key(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v2));
if ( !strcmp(v5, v4) )
break;
v6 = *(_QWORD *)(a1 + 32);
if ( v6 <= i )
break;
v2 = rehash(v2, i, v6);
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
unsigned __int64 i; // r12
const char *v4; // rbp
const char *v5; // rax
unsigned __int64 v6; // rdx

v2 = func24(a2, *(_QWORD *)(a1 + 32));
for ( i = 1LL; ; ++i )
{
v4 = (const char *)func18(a2);
v5 = (const char *)func18(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v2));
if ( !strcmp(v5, v4) )
break;
v6 = *(_QWORD *)(a1 + 32);
if ( v6 <= i )
break;
v2 = func13(v2, i, v6);
}
return v2;
}

original_code:
hash_t htab_findhash(htab_t * this, node_t * node) {
    hash_t hash;
    size_t f_id = 1;
    hash = node_hashing(node, this->_cap);
    while (strcmp(node_get_key(this->data[hash]), node_get_key(node)) != 0
           && f_id < this->_cap) {
        hash = rehash(hash, f_id, this->_cap);
        ++f_id;
    }
    return hash;
}

canonical_original_code:
unsigned long htab_findhash(struct htab_t *this, struct node_t *node) {
    unsigned long hash;
    unsigned long f_id = 1;
    hash = node_hashing(node, this->_cap);
    while (strcmp(node_get_key(this->data[hash]), node_get_key(node)) != 0
           && f_id < this->_cap) {
        hash = rehash(hash, f_id, this->_cap);
        ++f_id;
    }
    return hash;
}


decompiled_code:
__int64 __fastcall htab_findnode(__int64 a1, __int64 a2)
{
__int64 v2; // rax

v2 = htab_findhash(a1, a2);
if ( !*(_BYTE *)(*(_QWORD *)(a1 + 16) + v2) )
return 0xFFFFFFFFLL;
*(_QWORD *)(a2 + 8) = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v2) + 8LL);
return 0LL;
}

original_code:
int htab_findnode(htab_t * this, node_t * node) {
    hash_t hash = htab_findhash(this, node);
    if (!this->_used[hash])
        return -1;
    node->value = this->data[hash]->value;
    return 0;
}

canonical_original_code:
int htab_findnode(struct htab_t *this, struct node_t *node) {
    unsigned long hash = htab_findhash(this, node);
    if (!this->_used[hash])
        return -1;
    node->value = this->data[hash]->value;
    return 0;
}


decompiled_code:
__int64 __fastcall htab_delnode(_QWORD *a1, __int64 a2)
{
__int64 v2; // rbp
_BYTE *v3; // rax

v2 = htab_findhash((__int64)a1, a2);
v3 = (_BYTE *)(a1[2] + v2);
if ( !*v3 )
return 0xFFFFFFFFLL;
*v3 = 0;
node_destroy(*(void **)(a1[1] + 8 * v2));
*(_QWORD *)(a1[1] + 8 * v2) = 0LL;
--*a1;
return 0LL;
}

original_code:
int htab_delnode(htab_t * this, node_t * node) {
    hash_t hash = htab_findhash(this, node);
    if (!this->_used[hash])
        return -1;
    this->_used[hash] = 0;
    node_destroy(this->data[hash]);
    this->data[hash] = ((void *)0);
    --(this->size);
    return 0;
}

canonical_original_code:
int htab_delnode(struct htab_t *this, struct node_t *node) {
    unsigned long hash = htab_findhash(this, node);
    if (!this->_used[hash])
        return -1;
    this->_used[hash] = 0;
    node_destroy(this->data[hash]);
    this->data[hash] = ((void *)0);
    --(this->size);
    return 0;
}


decompiled_code:
__int64 __fastcall queue_push(_QWORD *a1, unsigned __int8 a2)
{
unsigned __int64 v2; // rcx
__int64 result; // rax

v2 = a1[1];
result = 0LL;
if ( v2 <= 0x3D )
{
*a1 |= (unsigned __int64)a2 << v2;
a1[1] = v2 + 3;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(_QWORD *a1, unsigned __int8 a2)
{
unsigned __int64 v2; // rcx
__int64 result; // rax

v2 = a1[1];
result = 0LL;
if ( v2 <= 0x3D )
{
*a1 |= (unsigned __int64)a2 << v2;
a1[1] = v2 + 3;
result = 1LL;
}
return result;
}

original_code:
_Bool queue_push(queue_t * qq, queue_data_t x) {
    queue_bits_t t = x;
    if (qq->cur > 64 - 3)
        return 0;
    t <<= qq->cur;
    qq->bit_Q |= t;
    qq->cur += 3;
    return 1;
}

canonical_original_code:
_Bool queue_push(struct queue_t *qq, unsigned char x) {
    unsigned long t = x;
    if (qq->cur > 64 - 3)
        return 0;
    t <<= qq->cur;
    qq->bit_Q |= t;
    qq->cur += 3;
    return 1;
}

variable_types: struct queue_t { unsigned long bit_Q; unsigned long cur; } *

variable_types:
x
unsigned char

variable_types:
t
unsigned long


decompiled_code:
__int64 __fastcall queue_pop(_QWORD *a1)
{
__int64 v1; // rax
unsigned int v2; // edx

v1 = a1[1];
v2 = 0;
if ( v1 )
{
*a1 >>= 3;
a1[1] = v1 - 3;
v2 = 1;
}
return v2;
}

original_code:
_Bool queue_pop(queue_t * qq) {
    if (!(qq->cur))
        return 0;
    qq->bit_Q >>= 3;
    qq->cur -= 3;
    return 1;
}

canonical_original_code:
_Bool queue_pop(struct queue_t *qq) {
    if (!(qq->cur))
        return 0;
    qq->bit_Q >>= 3;
    qq->cur -= 3;
    return 1;
}

user_defined_types: struct queue_t { unsigned long bit_Q; unsigned long cur; }


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

result = 0xFFFFFFFFLL;
if ( a1[1] )
result = *a1 & 7LL;
return result;
}

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

result = 0xFFFFFFFFLL;
if ( a1[1] )
result = *a1 & 7LL;
return result;
}

original_code:
queue_data_t queue_top(const queue_t * qq) {
    if (qq->cur)
        return qq->bit_Q & 7;
    return -1;
}

canonical_original_code:
unsigned char queue_top(struct queue_t *qq) {
    if (qq->cur)
        return qq->bit_Q & 7;
    return -1;
}

return_type: unsigned char


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 i; // rbx
__int64 v4; // r12
char *v5; // rax
unsigned __int8 v6; // bp
__int64 v7; // r12
char *v8; // rax
unsigned __int64 v10; // [rsp+0h] [rbp-28h] BYREF
__int64 v11; // [rsp+8h] [rbp-20h]

queue_init(&v10);
for ( i = 0LL; i != 21; ++i )
{
queue_push(&v10, i & 7);
v4 = v11;
v5 = bits2bin(v10);
fprintf(stderr, "+ %d -> %s [%lu]\n", i & 7, v5, v4);
}
do
{
v6 = queue_top(&v10);
if ( (unsigned __int8)queue_pop(&v10) )
{
v7 = v11;
v8 = bits2bin(v10);
fprintf(stderr, "- %d -> %s [%lu]\n", v6, v8, v7);
}
--i;
}
while ( i );
queue_destroy(&v10);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 i; // rbx
__int64 v4; // r12
char *v5; // rax
unsigned __int8 v6; // bp
__int64 v7; // r12
char *v8; // rax
unsigned __int64 v10; // [rsp+0h] [rbp-28h] BYREF
__int64 v11; // [rsp+8h] [rbp-20h]

func7(&v10);
for ( i = 0LL; i != 21; ++i )
{
func8(&v10, i & 7);
v4 = v11;
v5 = func12(v10);
fprintf(stderr, "+ %d -> %s [%lu]\n", i & 7, v5, v4);
}
do
{
v6 = func10(&v10);
if ( (unsigned __int8)func9(&v10) )
{
v7 = v11;
v8 = func12(v10);
fprintf(stderr, "- %d -> %s [%lu]\n", v6, v8, v7);
}
--i;
}
while ( i );
func11(&v10);
return 0;
}

original_code:
int main() {
    queue_t qq;
    size_t i;
    queue_init(&qq);
    for(i = 0; i != 21; ++i){
        queue_data_t a = i % 8;
        queue_push(&qq, a);
        fprintf(stderr, "+ %d -> %s [%lu]\n", a, bits2bin(qq.bit_Q), qq.cur);
    }
    for(i = 0; i != 21; ++i){
        queue_data_t a = queue_top(&qq);
        if(queue_pop(&qq)){
            fprintf(stderr, "- %d -> %s [%lu]\n", a, bits2bin(qq.bit_Q), qq.cur);
        }
    }
    queue_destroy(&qq);
    return 0;
}

canonical_original_code:
int main() {
    struct queue_t qq;
    unsigned long i;
    queue_init(&qq);
    for(i = 0; i != 21; ++i){
        unsigned char a = i % 8;
        queue_push(&qq, a);
        fprintf(stderr, "+ %d -> %s [%lu]\n", a, bits2bin(qq.bit_Q), qq.cur);
    }
    for(i = 0; i != 21; ++i){
        unsigned char a = queue_top(&qq);
        if(queue_pop(&qq)){
            fprintf(stderr, "- %d -> %s [%lu]\n", a, bits2bin(qq.bit_Q), qq.cur);
        }
    }
    queue_destroy(&qq);
    return 0;
}

variable_types: struct queue_t { unsigned long bit_Q; unsigned long cur; }

variable_types:
a
unsigned char


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

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

original_code:
Tree tree_create() {
    return ((void *)0);
}

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

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


decompiled_code:
int __fastcall tree_add(_QWORD *a1, __m128i a2)
{
_QWORD *v2; // rax

if ( *a1 )
{
LODWORD(v2) = puts("\nDENIAL");
}
else
{
v2 = node_maker(0LL, 0LL, a2);
*a1 = v2;
}
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func8(_QWORD *a1, __m128i a2)
{
_QWORD *v2; // rax

if ( *a1 )
{
LODWORD(v2) = puts("\nDENIAL");
}
else
{
v2 = node_maker(0LL, 0LL, a2);
*a1 = v2;
}
return (int)v2;
}

original_code:
void tree_add(Tree * tree, data_type x) {
    if (*tree == ((void *)0))
        *tree = node_maker(((void *)0), ((void *)0), x);
    else
        printf("\nDENIAL\n");
}

canonical_original_code:
void tree_add(struct node **tree, float x) {
    if (*tree == ((void *)0))
        *tree = node_maker(((void *)0), ((void *)0), x);
    else
        printf("\nDENIAL\n");
}

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

variable_types: x float


decompiled_code:
__int64 __fastcall leaves_subtree_counter(__int64 a1, _DWORD *a2)
{
__int64 result; // rax
__int64 v3; // rdi

if ( *(_QWORD *)(a1 + 16) )
result = ((__int64 (*)(void))leaves_subtree_counter)();
v3 = *(_QWORD *)(a1 + 8);
if ( v3 )
return leaves_subtree_counter(v3, a2);
++*a2;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, _DWORD *a2)
{
__int64 result; // rax
__int64 v3; // rdi

if ( *(_QWORD *)(a1 + 16) )
result = ((__int64 (*)(void))leaves_subtree_counter)();
v3 = *(_QWORD *)(a1 + 8);
if ( v3 )
return func9(v3, a2);
++*a2;
return result;
}

original_code:
void leaves_subtree_counter(Tree p, int *count) {
    if (p->brother)
        leaves_subtree_counter(p->brother, count);
    if (p->son)
        leaves_subtree_counter(p->son, count);
    else
        (*count)++;
}

canonical_original_code:
void leaves_subtree_counter(struct node *p, int *count) {
    if (p->brother)
        leaves_subtree_counter(p->brother, count);
    if (p->son)
        leaves_subtree_counter(p->son, count);
    else
        (*count)++;
}

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

variable_types:
count
int *


decompiled_code:
__int64 __fastcall leaves_counter(__int64 a1)
{
unsigned int v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2[0] = 0;
if ( a1 )
leaves_subtree_counter(a1, v2);
else
puts("ERR COUNT");
return v2[0];
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1)
{
unsigned int v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2[0] = 0;
if ( a1 )
func9(a1, v2);
else
puts("ERR COUNT");
return v2[0];
}

original_code:
int leaves_counter(Tree tree) {
    int a = 0;
    int *count = &a;
    if (tree)
        leaves_subtree_counter(tree, count);
    else
        printf("ERR COUNT\n");
    return *count;
}

canonical_original_code:
int leaves_counter(struct node *tree) {
    int a = 0;
    int *count = &a;
    if (tree)
        leaves_subtree_counter(tree, count);
    else
        printf("ERR COUNT\n");
    return *count;
}

variable_types: a int

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


counter

decompiled_code:
__int64 __fastcall counter(__int64 a1)
{
unsigned int v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2[0] = 0;
if ( a1 )
subtree_counter(a1, v2);
else
puts("ERR COUNT");
return v2[0];
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
unsigned int v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

v2[0] = 0;
if ( a1 )
func11(a1, v2);
else
puts("ERR COUNT");
return v2[0];
}

original_code:
int counter(Tree tree) {
    int a = 0;
    int *count = &a;
    if (tree)
        subtree_counter(tree, count);
    else
        printf("ERR COUNT\n");
    return *count;
}

canonical_original_code:
int counter(struct node *tree) {
    int a = 0;
    int *count = &a;
    if (tree)
        subtree_counter(tree, count);
    else
        printf("ERR COUNT\n");
    return *count;
}


decompiled_code:
int __fastcall subtree_print(__int64 a1, int a2)
{
__int64 v2; // rbp
__int64 i; // rbx
int result; // eax

v2 = *(_QWORD *)(a1 + 8);
if ( a2 )
{
for ( i = 0LL; i != a2; ++i )
putchar(32);
}
for ( result = printf("%f\n", *(float *)a1); v2; v2 = *(_QWORD *)(v2 + 16) )
result = subtree_print(v2, (unsigned int)(a2 + 1));
return result;
}

canonical_decompiled_code:
int __fastcall func13(__int64 a1, int a2)
{
__int64 v2; // rbp
__int64 i; // rbx
int result; // eax

v2 = *(_QWORD *)(a1 + 8);
if ( a2 )
{
for ( i = 0LL; i != a2; ++i )
putchar(32);
}
for ( result = printf("%f\n", *(float *)a1); v2; v2 = *(_QWORD *)(v2 + 16) )
result = func13(v2, (unsigned int)(a2 + 1));
return result;
}

original_code:
void subtree_print(Tree p, int depth) {
    int i;
    Tree son = p->son;
    for (i = 0; i != depth; ++i)
        printf(" ");
    printf("%f\n", p->data);
    while (son) {
        subtree_print(son, 1 + depth);
        son = son->brother;
    }
}

canonical_original_code:
void subtree_print(struct node *p, int depth) {
    int i;
    struct node *son = p->son;
    for (i = 0; i != depth; ++i)
        printf(" ");
    printf("%f\n", p->data);
    while (son) {
        subtree_print(son, 1 + depth);
        son = son->brother;
    }
}

variable_types: depth int

variable_types: i int


decompiled_code:
int __fastcall cur_data_print(float **a1)
{
float v1; // xmm0_4
int result; // eax

if ( a1 && *a1 && (v1 = **a1, v1 != 0.0) )
result = printf("\n%f\n\n", v1);
else
result = puts("<IS EMPTY>");
return result;
}

canonical_decompiled_code:
int __fastcall func15(float **a1)
{
float v1; // xmm0_4
int result; // eax

if ( a1 && *a1 && (v1 = **a1, v1 != 0.0) )
result = printf("\n%f\n\n", v1);
else
result = puts("<IS EMPTY>");
return result;
}

original_code:
void cur_data_print(Tree * p) {
    if (p && (*p) && (*p)->data)
        printf("\n%f\n\n", (*p)->data);
    else
        printf("<IS EMPTY>\n");
}

canonical_original_code:
void cur_data_print(struct node **p) {
    if (p && (*p) && (*p)->data)
        printf("\n%f\n\n", (*p)->data);
    else
        printf("<IS EMPTY>\n");
}


original_code:
void tree_delete(Tree * tree) {
    if (*tree) {
        Tree *it = &(*tree)->son;
        while (*it) {
            Tree *tmp = &(*tree)->brother;
            tree_delete(it);
            it = tmp;
        }
        free(*tree);
        *tree = ((void *)0);
    }
}

canonical_original_code:
void tree_delete(struct node **tree) {
    if (*tree) {
        struct node **it = &(*tree)->son;
        while (*it) {
            struct node **tmp = &(*tree)->brother;
            tree_delete(it);
            it = tmp;
        }
        free(*tree);
        *tree = ((void *)0);
    }
}


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 func14(__int64 a1)
{
puts("<<<TREE>>>\n");
if ( a1 )
func13(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");
}


main

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

v11[0] = (void *)tree_create(argc, argv, envp);
v4 = 0LL;
do
{
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", &v10) != 1 )
getchar();
switch ( v10 )
{
case 0:
break;
case 1:
v3 = 0;
v4 = v11;
break;
case 2:
if ( !v4 )
goto LABEL_24;
v5 = (char *)*v4;
if ( !v3 || !v5 )
goto LABEL_25;
v4 = (void **)(v5 + 16);
break;
case 3:
if ( !v4 )
goto LABEL_24;
if ( !*v4 )
goto LABEL_25;
v4 = (void **)((char *)*v4 + 8);
v3 = 1;
break;
case 4:
if ( !v4 )
goto LABEL_24;
scanf("%f", &v9);
tree_add(v4, (__m128i)v9);
break;
case 5:
if ( v4 )
{
if ( *v4 )
tree_delete(v4);
else
LABEL_25:
puts("ERR ADDRES");
}
else
{
LABEL_24:
puts("ERR ADDRES!");
}
break;
case 6:
tree_print((__int64)v11[0]);
break;
case 7:
cur_data_print((float **)v4);
break;
case 8:
v6 = counter((__int64)v11[0]);
printf("%d\n", v6);
break;
case 9:
v7 = leaves_counter((__int64)v11[0]);
printf("%d\n", v7);
break;
default:
puts("COMMAND ERR");
break;
}
}
while ( v10 );
tree_delete(v11);
return 1;
}

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

v11[0] = (void *)func7(argc, argv, envp);
v4 = 0LL;
do
{
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", &v10) != 1 )
getchar();
switch ( v10 )
{
case 0:
break;
case 1:
v3 = 0;
v4 = v11;
break;
case 2:
if ( !v4 )
goto LABEL_24;
v5 = (char *)*v4;
if ( !v3 || !v5 )
goto LABEL_25;
v4 = (void **)(v5 + 16);
break;
case 3:
if ( !v4 )
goto LABEL_24;
if ( !*v4 )
goto LABEL_25;
v4 = (void **)((char *)*v4 + 8);
v3 = 1;
break;
case 4:
if ( !v4 )
goto LABEL_24;
scanf("%f", &v9);
func8(v4, (__m128i)v9);
break;
case 5:
if ( v4 )
{
if ( *v4 )
func16(v4);
else
LABEL_25:
puts("ERR ADDRES");
}
else
{
LABEL_24:
puts("ERR ADDRES!");
}
break;
case 6:
func14((__int64)v11[0]);
break;
case 7:
func15((float **)v4);
break;
case 8:
v6 = func12((__int64)v11[0]);
printf("%d\n", v6);
break;
case 9:
v7 = func10((__int64)v11[0]);
printf("%d\n", v7);
break;
default:
puts("COMMAND ERR");
break;
}
}
while ( v10 );
func16(v11);
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:
void __fastcall debug_print_binaryw(unsigned __int64 a1, __int16 a2)
{
int v2; // ebx
unsigned int v3; // eax
bool v4; // zf
__int64 v5; // rsi

v2 = a1;
if ( a1 )
{
v3 = (unsigned __int16)(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
{
fputc(48, stderr);
++v2;
}
while ( a2 != (_WORD)v2 );
}
}

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

v2 = a1;
if ( a1 )
{
v3 = (unsigned __int16)(a2 - 1);
v4 = a2 == 0;
v5 = 0LL;
if ( !v4 )
v5 = v3;
func7(a1 >> 1, v5);
fprintf(stderr, "%hu", a1 & 1);
}
else if ( a2 )
{
do
{
fputc(48, stderr);
++v2;
}
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


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

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

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

v7 = 0LL;
v6 = 0;
if ( scanf("%lu", &v7) == 1 )
{
v3 = 1;
if ( scanf("%hu", &v6) == 1 )
{
v5 = func9(v7, v6);
printf("%hu\n", v5);
v3 = 0;
}
else
{
fprintf(stderr, "error: %hu is not number of bit.", v6);
}
}
else
{
fprintf(stderr, "error: %lu is not integer number.", v7);
v3 = 1;
}
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:
double __fastcall target_1_xfx(double a1)
{
double result; // xmm0_8

if ( 1.0 - a1 >= 0.0 )
result = atan(sqrt(1.0 - a1));
else
result = NAN;
return result;
}

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

if ( 1.0 - a1 >= 0.0 )
result = atan(sqrt(1.0 - a1));
else
result = NAN;
return result;
}

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 v2; // xmm0_8

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

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

v2 = pow(a1, 0.52);
return cos(v2 + 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
double v6; // xmm0_8

v3 = dichotomy(target_1, 0.0, 1.0);
printf(format, 16LL, v3, 0.0, 1.0);
iterations((double (*)(void))target_1_xfx, 0.0, 1.0);
printf(aTarget10XFIter, 16LL, 0.0, 0.0, 1.0);
v4 = newton((double (*)(void))target_1, target_1_derivative, 0.0, 1.0);
printf(aTarget10XFNewt, 16LL, v4, 0.0, 1.0);
v5 = dichotomy(target_2, 0.5, 1.0);
printf(aTarget20XFDich, 16LL, v5, 0.5, 1.0);
iterations((double (*)(void))target_2_xfx, 0.5, 1.0);
printf(aTarget20XFIter, 16LL, 0.5, 0.5, 1.0);
v6 = newton((double (*)(void))target_2, (double (__fastcall *)(double))target_2_derivative, 0.5, 1.0);
printf(aTarget20XFNewt, 16LL, v6, 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
double v6; // xmm0_8

v3 = func13(target_1, 0.0, 1.0);
printf(format, 16LL, v3, 0.0, 1.0);
func14((double (*)(void))target_1_xfx, 0.0, 1.0);
printf(aTarget10XFIter, 16LL, 0.0, 0.0, 1.0);
v4 = func15((double (*)(void))target_1, target_1_derivative, 0.0, 1.0);
printf(aTarget10XFNewt, 16LL, v4, 0.0, 1.0);
v5 = func13(target_2, 0.5, 1.0);
printf(aTarget20XFDich, 16LL, v5, 0.5, 1.0);
func14((double (*)(void))target_2_xfx, 0.5, 1.0);
printf(aTarget20XFIter, 16LL, 0.5, 0.5, 1.0);
v6 = func15((double (*)(void))target_2, (double (__fastcall *)(double))target_2_derivative, 0.5, 1.0);
printf(aTarget20XFNewt, 16LL, v6, 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