heapsort

decompiled_code:
__int64 __fastcall heapsort(__int64 a1, signed int a2)
{
signed int v2; // ebx
__int64 result; // rax
_DWORD *v4; // rbp

v2 = a2;
result = build_heap(a1, a2);
if ( a2 > 0 )
{
v4 = (_DWORD *)(a1 + 4LL * a2);
do
{
swap((_DWORD *)(a1 + 4), v4);
result = max_heapify(a1, --v2, 1u);
--v4;
}
while ( v2 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, signed int a2)
{
signed int v2; // ebx
__int64 result; // rax
_DWORD *v4; // rbp

v2 = a2;
result = func9(a1, a2);
if ( a2 > 0 )
{
v4 = (_DWORD *)(a1 + 4LL * a2);
do
{
func7((_DWORD *)(a1 + 4), v4);
result = func8(a1, --v2, 1u);
--v4;
}
while ( v2 );
}
return result;
}

original_code:
void heapsort(int *array,int array_len)
{
    int i,tmplen;
    build_heap(array,array_len);
    for(tmplen = array_len ; tmplen > 0; i++){
        swap(array+1, array + tmplen);
        tmplen--;
        max_heapify(array,tmplen,1);
    }
}

canonical_original_code:
void heapsort(int *array, int array_len)
{
    int i; int tmplen;
    build_heap(array,array_len);
    for(tmplen = array_len ; tmplen > 0; i++){
        swap(array+1, array + tmplen);
        tmplen--;
        max_heapify(array,tmplen,1);
    }
}

variable_types: tmplen int


swap

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

result = (unsigned int)*a1;
*a1 = *a2;
*a2 = result;
return result;
}

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

result = (unsigned int)*a1;
*a1 = *a2;
*a2 = result;
return result;
}

original_code:
void swap(int *a, int *b)
{
    int tmp ;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

canonical_original_code:
void swap(int *a, int *b)
{
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

variable_types:
a
int *

variable_types:
b
int *

variable_types: tmp int

return_type: void


decompiled_code:
_QWORD *init_bst_tree()
{
void *v0; // rbx
_QWORD *result; // rax

v0 = calloc(1uLL, 0x20uLL);
result = calloc(1uLL, 0x10uLL);
if ( !result || !v0 )
err_exit("calloc error\n");
*result = v0;
result[1] = v0;
return result;
}

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

v0 = calloc(1uLL, 0x20uLL);
result = calloc(1uLL, 0x10uLL);
if ( !result || !v0 )
func7("calloc error\n");
*result = v0;
result[1] = v0;
return result;
}

original_code:
bst_t *
init_bst_tree()
{
    bst_node_t *sentinel;
    bst_t * bst;
    sentinel = (bst_node_t *)calloc(1,sizeof(bst_node_t));
    bst = (bst_t*)calloc(1,sizeof(bst_t));
    if (bst == ((void *)0) || sentinel == ((void *)0)) {
        err_exit("calloc error\n");
    }
   bst->root = sentinel;
   bst->sentinel = sentinel;
   return bst;
}

canonical_original_code:
struct binary_search_tree_s *init_bst_tree()
{
    struct binary_search_tree_node_s *sentinel;
    struct binary_search_tree_s *bst;
    sentinel = (struct binary_search_tree_node_s *)calloc(1,sizeof(bst_node_t));
    bst = (struct binary_search_tree_s *)calloc(1,sizeof(bst_t));
    if (bst == ((void *)0) || sentinel == ((void *)0)) {
        err_exit("calloc error\n");
    }
   bst->root = sentinel;
   bst->sentinel = sentinel;
   return bst;
}

variable_types: struct binary_search_tree_s { struct binary_search_tree_node_s { struct binary_search_tree_node_s *parent; struct binary_search_tree_node_s *left; struct binary_search_tree_node_s *right; int key; } *root; struct binary_search_tree_node_s *sentinel; } *

user_defined_types: struct binary_search_tree_s { struct binary_search_tree_node_s *root; struct binary_search_tree_node_s *sentinel; }


original_code:
int
insert_value_bst_tree(bst_t *bst, int value)
{
    bst_node_t *bst_node,*tmp_node,*last_node;
    bst_node = create_node(bst, value);
    if (bst->root == bst->sentinel) {
        bst->root = bst_node;
        return 0;
    }
    tmp_node = bst->root;
    while (tmp_node != bst->sentinel) {
        last_node = tmp_node;
        if ( tmp_node->key > value) {
            tmp_node = tmp_node->left;
        } else {
            tmp_node = tmp_node->right;
        }
    }
    if (last_node->key < value) {
        last_node->right = bst_node;
    } else {
        last_node->left = bst_node;
    }
    bst_node->parent = last_node;
    return 0;
}

canonical_original_code:
int insert_value_bst_tree(struct binary_search_tree_s *bst, int value)
{
    struct binary_search_tree_node_s *bst_node; struct binary_search_tree_node_s *tmp_node; struct binary_search_tree_node_s *last_node;
    bst_node = create_node(bst, value);
    if (bst->root == bst->sentinel) {
        bst->root = bst_node;
        return 0;
    }
    tmp_node = bst->root;
    while (tmp_node != bst->sentinel) {
        last_node = tmp_node;
        if ( tmp_node->key > value) {
            tmp_node = tmp_node->left;
        } else {
            tmp_node = tmp_node->right;
        }
    }
    if (last_node->key < value) {
        last_node->right = bst_node;
    } else {
        last_node->left = bst_node;
    }
    bst_node->parent = last_node;
    return 0;
}

variable_types: value int

variable_types: struct binary_search_tree_node_s { struct binary_search_tree_node_s *parent; struct binary_search_tree_node_s *left; struct binary_search_tree_node_s *right; int key; } *

return_type: int


decompiled_code:
__int64 __fastcall inorder_traverse(__int64 a1, __int64 a2)
{
if ( *(_QWORD *)(a2 + 8) != a1 )
{
inorder_traverse(*(_QWORD *)(a1 + 8), a2);
printf("key:%d\n", *(unsigned int *)(a1 + 24));
inorder_traverse(*(_QWORD *)(a1 + 16), a2);
}
return 0LL;
}

original_code:
int
inorder_traverse(bst_node_t *bst_node,bst_t * bst)
{
    if(bst_node != bst->sentinel) {
        inorder_traverse(bst_node->left,bst);
        printf("key:%d\n",bst_node->key);
        inorder_traverse(bst_node->right,bst);
    }
    return 0;
}

canonical_original_code:
int inorder_traverse(struct binary_search_tree_node_s *bst_node, struct binary_search_tree_s *bst)
{
    if(bst_node != bst->sentinel) {
        inorder_traverse(bst_node->left,bst);
        printf("key:%d\n",bst_node->key);
        inorder_traverse(bst_node->right,bst);
    }
    return 0;
}

variable_types: struct binary_search_tree_s { struct binary_search_tree_node_s *root; struct binary_search_tree_node_s *sentinel; } *

user_defined_types: struct binary_search_tree_node_s { struct binary_search_tree_node_s *parent; struct binary_search_tree_node_s *left; struct binary_search_tree_node_s *right; int key; }


decompiled_code:
__int64 __fastcall search_node_bst_tree(__int64 *a1, int a2)
{
__int64 result; // rax
__int64 v3; // rcx
int v4; // edx

result = *a1;
v3 = a1[1];
if ( *a1 == v3 )
return 0LL;
while ( 1 )
{
v4 = *(_DWORD *)(result + 24);
if ( v4 == a2 )
break;
if ( v4 <= a2 )
result = *(_QWORD *)(result + 16);
else
result = *(_QWORD *)(result + 8);
if ( result == v3 )
return 0LL;
}
if ( v3 == result )
result = 0LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 *a1, int a2)
{
__int64 result; // rax
__int64 v3; // rcx
int v4; // edx

result = *a1;
v3 = a1[1];
if ( *a1 == v3 )
return 0LL;
while ( 1 )
{
v4 = *(_DWORD *)(result + 24);
if ( v4 == a2 )
break;
if ( v4 <= a2 )
result = *(_QWORD *)(result + 16);
else
result = *(_QWORD *)(result + 8);
if ( result == v3 )
return 0LL;
}
if ( v3 == result )
result = 0LL;
return result;
}

original_code:
bst_node_t *
search_node_bst_tree(bst_t *bst, int value)
{
    bst_node_t *tmp_node;
    tmp_node = bst->root;
    while(tmp_node != bst->sentinel) {
        if(tmp_node->key == value){
            break;
        }else if(tmp_node->key > value){
            tmp_node = tmp_node->left;
        }else {
            tmp_node = tmp_node->right;
        }
    }
    if(tmp_node == bst->sentinel) {
        tmp_node = ((void *)0);
    }
    return tmp_node;
}

canonical_original_code:
struct binary_search_tree_node_s *search_node_bst_tree(struct binary_search_tree_s *bst, int value)
{
    struct binary_search_tree_node_s *tmp_node;
    tmp_node = bst->root;
    while(tmp_node != bst->sentinel) {
        if(tmp_node->key == value){
            break;
        }else if(tmp_node->key > value){
            tmp_node = tmp_node->left;
        }else {
            tmp_node = tmp_node->right;
        }
    }
    if(tmp_node == bst->sentinel) {
        tmp_node = ((void *)0);
    }
    return tmp_node;
}

return_type: struct binary_search_tree_node_s { struct binary_search_tree_node_s *parent; struct binary_search_tree_node_s *left; struct binary_search_tree_node_s *right; int key; } *


minimum

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

do
{
result = a2;
a2 = *(_QWORD *)(a2 + 8);
}
while ( a2 != *(_QWORD *)(a1 + 8) );
return result;
}

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

do
{
result = a2;
a2 = *(_QWORD *)(a2 + 8);
}
while ( a2 != *(_QWORD *)(a1 + 8) );
return result;
}

original_code:
bst_node_t *
minimum(bst_t *bst, bst_node_t *node)
{
    while(node->left != bst->sentinel) {
        node = node->left ;
    }
    return node;
}

canonical_original_code:
struct binary_search_tree_node_s *minimum(struct binary_search_tree_s *bst, struct binary_search_tree_node_s *node)
{
    while(node->left != bst->sentinel) {
        node = node->left ;
    }
    return node;
}

variable_types:
node
struct binary_search_tree_node_s *


original_code:
int
delete_elem_bst_tree(bst_t *bst, int value)
{
    bst_node_t * del_node;
    bst_node_t * mid_node;
    if(bst->root == bst->sentinel) {
        printf("Empty Tree\n");
        return 0;
    }
    del_node = search_node_bst_tree(bst, value);
    if (del_node == ((void *)0)){
        printf("NO node %d\n",value);
        return 0;
    }
    if (del_node->left == bst->sentinel) {
        if(del_node->parent == bst->sentinel) {
            bst->root = del_node->right;
        }
        replace_a_with_b(del_node,del_node->right);
    } else if (del_node->right == bst->sentinel) {
        if(del_node->parent == bst->sentinel) {
            bst->root = del_node->left;
        }
        replace_a_with_b(del_node,del_node->left);
    } else {
        mid_node = minimum(bst, del_node->right);
        if(del_node->parent == bst->sentinel) {
            mid_node->left = bst->root->left;
            bst->root = mid_node;
            bst->root->left->parent = bst->root;
        }
        if (mid_node == del_node->right ) {
            replace_a_with_b(del_node, mid_node);
            return 0;
        }
        replace_a_with_b(mid_node, mid_node->right);
        replace_a_with_b(del_node,mid_node);
    }
    free(del_node);
    return 0;
}

canonical_original_code:
int delete_elem_bst_tree(struct binary_search_tree_s *bst, int value)
{
    struct binary_search_tree_node_s *del_node;
    struct binary_search_tree_node_s *mid_node;
    if(bst->root == bst->sentinel) {
        printf("Empty Tree\n");
        return 0;
    }
    del_node = search_node_bst_tree(bst, value);
    if (del_node == ((void *)0)){
        printf("NO node %d\n",value);
        return 0;
    }
    if (del_node->left == bst->sentinel) {
        if(del_node->parent == bst->sentinel) {
            bst->root = del_node->right;
        }
        replace_a_with_b(del_node,del_node->right);
    } else if (del_node->right == bst->sentinel) {
        if(del_node->parent == bst->sentinel) {
            bst->root = del_node->left;
        }
        replace_a_with_b(del_node,del_node->left);
    } else {
        mid_node = minimum(bst, del_node->right);
        if(del_node->parent == bst->sentinel) {
            mid_node->left = bst->root->left;
            bst->root = mid_node;
            bst->root->left->parent = bst->root;
        }
        if (mid_node == del_node->right ) {
            replace_a_with_b(del_node, mid_node);
            return 0;
        }
        replace_a_with_b(mid_node, mid_node->right);
        replace_a_with_b(del_node,mid_node);
    }
    free(del_node);
    return 0;
}


decompiled_code:
void __fastcall bst_free(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax

v2 = a1[1];
if ( *a1 == v2 )
{
free(a1);
}
else if ( v2 != a2 )
{
bst_free(a1, *(_QWORD *)(a2 + 8));
bst_free(a1, *(_QWORD *)(a2 + 16));
printf("free key:%d\n", *(unsigned int *)(a2 + 24));
free((void *)a2);
}
}

original_code:
void
bst_free(bst_t *bst, bst_node_t *node)
{
    if(bst->root == bst->sentinel) {
        free(bst);
        return ;
    }
    if (node == bst->sentinel) {
        return ;
    }
    bst_free(bst, node->left);
    bst_free(bst, node->right);
    printf("free key:%d\n",node->key);
    free(node);
    return ;
}

canonical_original_code:
void bst_free(struct binary_search_tree_s *bst, struct binary_search_tree_node_s *node)
{
    if(bst->root == bst->sentinel) {
        free(bst);
        return ;
    }
    if (node == bst->sentinel) {
        return ;
    }
    bst_free(bst, node->left);
    bst_free(bst, node->right);
    printf("free key:%d\n",node->key);
    free(node);
    return ;
}


decompiled_code:
void __noreturn err_exit(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
printf("%s:%d", "binary_search_tree.c", 20LL);
vprintf(format, arg);
exit(0);
}

canonical_decompiled_code:
void __noreturn func7(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
printf("%s:%d", "binary_search_tree.c", 20LL);
vprintf(format, arg);
exit(0);
}

original_code:
void
err_exit(char *fmt,...)
{
    va_list va;
    __builtin_va_start(va,fmt);
    printf("%s:%d","binary_search_tree.c",20);
    vprintf(fmt,va);
    __builtin_va_end(va);
    exit(0);
}

canonical_original_code:
void err_exit(char *fmt, ...)
{
    __builtin_va_list va;
    __builtin_va_start(va,fmt);
    printf("%s:%d","binary_search_tree.c",20);
    vprintf(fmt,va);
    __builtin_va_end(va);
    exit(0);
}

variable_types:
fmt
char *


decompiled_code:
__int64 __fastcall dfs_visit(int a1)
{
int v1; // edx
__int64 v2; // rax
__int64 v3; // rbx
__int64 result; // rax
__int64 v5; // rbp

v1 = ++time;
v2 = 4LL * a1;
g_dfs[v2] = 1;
g_dfs[v2 + 2] = v1;
if ( g_total_node > 0 )
{
v3 = 1LL;
do
{
if ( g_graph[100 * a1 + v3] && !g_dfs[4 * v3] )
{
dfs_visit((unsigned int)v3);
g_dfs[4 * v3 + 1] = a1;
}
++v3;
}
while ( g_total_node >= (int)v3 );
}
result = (unsigned int)++time;
v5 = 4LL * a1;
g_dfs[v5] = 2;
g_dfs[v5 + 3] = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
int v1; // edx
__int64 v2; // rax
__int64 v3; // rbx
__int64 result; // rax
__int64 v5; // rbp

v1 = ++time;
v2 = 4LL * a1;
g_dfs[v2] = 1;
g_dfs[v2 + 2] = v1;
if ( g_total_node > 0 )
{
v3 = 1LL;
do
{
if ( g_graph[100 * a1 + v3] && !g_dfs[4 * v3] )
{
func0((unsigned int)v3);
g_dfs[4 * v3 + 1] = a1;
}
++v3;
}
while ( g_total_node >= (int)v3 );
}
result = (unsigned int)++time;
v5 = 4LL * a1;
g_dfs[v5] = 2;
g_dfs[v5 + 3] = result;
return result;
}

original_code:
void dfs_visit(int node)
{
    int i;
    time = time + 1;
    g_dfs[node].color = grey;
    g_dfs[node].d = time;
    for (i = 1; i <= g_total_node; i++) {
        if(g_graph[node][i] && g_dfs[i].color == white) {
            dfs_visit(i);
            g_dfs[i].parent = node;
        }
    }
    time = time + 1;
    g_dfs[node].color = black;
    g_dfs[node].f = time;
}

variable_types: node int

variable_types: i int


dfs

original_code:
int dfs(int start)
{
    int i;
    for(i = 0; i <=g_total_node; i++){
        g_dfs[i].color = white;
        g_dfs[i].parent = 0;
        g_dfs[i].d = 0;
        g_dfs[i].f = 0;
    }
    time = 0;
    for(i = start; i <= g_total_node; i++){
        if(g_dfs[i].color == white){
            dfs_visit(i);
        }
    }
    for(i = start-1; i >= 1; i--){
        if(g_dfs[i].color == white){
            dfs_visit(i);
        }
    }
    return 0;
}

variable_types: start int


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

if ( a1 > 1001 )
{
puts("Please modify the number of MAX");
exit(0);
}
result = 0LL;
memset(&array, 0, 0x1F50uLL);
if ( a1 >= 0 )
{
do
{
dword_404084[2 * result] = result;
++result;
}
while ( result != a1 + 1 );
}
return result;
}

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

if ( a1 > 1001 )
{
puts("Please modify the number of MAX");
exit(0);
}
result = 0LL;
memset(&array, 0, 0x1F50uLL);
if ( a1 >= 0 )
{
do
{
dword_404084[2 * result] = result;
++result;
}
while ( result != a1 + 1 );
}
return result;
}

original_code:
void make_set(int n)
{
    int i;
    if(n>=1002){
        printf("Please modify the number of MAX\n");
        exit(0);
    }
    memset(array,0,sizeof(array));
    for(i=0;i<=n;i++){
        array[i].parent = i;
    }
}

variable_types: n int


decompiled_code:
__int64 __fastcall recursive_find(int a1)
{
if ( dword_404084[2 * a1] != a1 )
dword_404084[2 * a1] = recursive_find();
return (unsigned int)dword_404084[2 * a1];
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1)
{
if ( dword_404084[2 * a1] != a1 )
dword_404084[2 * a1] = func8();
return (unsigned int)dword_404084[2 * a1];
}

original_code:
int recursive_find(int x)
{
    if(x != array[x].parent){
        array[x].parent = recursive_find(array[x].parent);
    }
    return array[x].parent;
}

variable_types: x int


decompiled_code:
__int64 __fastcall non_recursive_find(int a1)
{
int v1; // eax
unsigned int v2; // edx
int v3; // eax

v1 = a1;
do
{
v2 = v1;
v1 = dword_404084[2 * v1];
}
while ( v1 != v2 );
for ( ; v2 != a1; dword_404084[2 * v3] = v2 )
{
v3 = a1;
a1 = dword_404084[2 * a1];
}
return v2;
}

original_code:
int non_recursive_find(int x)
{
    int root,tmp;
    root = x;
    while(root != array[root].parent){
        root = array[root].parent;
    }
    while(x != root) {
        tmp = array[x].parent;
        array[x].parent = root;
        x = tmp;
    }
    return root;
}

canonical_original_code:
int non_recursive_find(int x)
{
    int root; int tmp;
    root = x;
    while(root != array[root].parent){
        root = array[root].parent;
    }
    while(x != root) {
        tmp = array[x].parent;
        array[x].parent = root;
        x = tmp;
    }
    return root;
}

variable_types: root int


unionx

decompiled_code:
__int64 __fastcall unionx(int a1, int a2)
{
int v2; // ebx
__int64 result; // rax
int v4; // edx
int v5; // ecx

v2 = recursive_find(a1);
result = recursive_find(a2);
if ( v2 != (_DWORD)result )
{
v4 = array[2 * v2];
v5 = array[2 * (int)result];
if ( v4 <= v5 )
{
if ( v4 >= v5 )
{
result = (int)result;
dword_404084[2 * (int)result] = v2;
array[2 * v2] = v4 + 1;
}
else
{
dword_404084[2 * v2] = result;
}
}
else
{
result = (int)result;
dword_404084[2 * (int)result] = v2;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, int a2)
{
int v2; // ebx
__int64 result; // rax
int v4; // edx
int v5; // ecx

v2 = func8(a1);
result = func8(a2);
if ( v2 != (_DWORD)result )
{
v4 = array[2 * v2];
v5 = array[2 * (int)result];
if ( v4 <= v5 )
{
if ( v4 >= v5 )
{
result = (int)result;
dword_404084[2 * (int)result] = v2;
array[2 * v2] = v4 + 1;
}
else
{
dword_404084[2 * v2] = result;
}
}
else
{
result = (int)result;
dword_404084[2 * (int)result] = v2;
}
}
return result;
}

original_code:
void unionx(int x,int y)
{
    int xroot, yroot;
    xroot = recursive_find(x);
    yroot = recursive_find(y);
    if(xroot == yroot)
        return ;
    if(array[xroot].weight > array[yroot].weight){
        array[yroot].parent = xroot;
    } else if (array[xroot].weight < array[yroot].weight){
        array[xroot].parent = yroot;
    } else {
        array[yroot].parent = xroot;
        array[xroot].weight += 1;
    }
}

canonical_original_code:
void unionx(int x, int y)
{
    int xroot; int yroot;
    xroot = recursive_find(x);
    yroot = recursive_find(y);
    if(xroot == yroot)
        return ;
    if(array[xroot].weight > array[yroot].weight){
        array[yroot].parent = xroot;
    } else if (array[xroot].weight < array[yroot].weight){
        array[xroot].parent = yroot;
    } else {
        array[yroot].parent = xroot;
        array[xroot].weight += 1;
    }
}

variable_types: y int

variable_types: xroot int

variable_types: yroot int


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rax
__int64 v4; // rsi
int i; // ebx
int v7; // [rsp+0h] [rbp-18h]
int v8; // [rsp+4h] [rbp-14h]
int v9; // [rsp+8h] [rbp-10h]
int v10; // [rsp+Ch] [rbp-Ch]

freopen("input.txt", "r", stdin);
while ( (unsigned int)__isoc99_scanf() && v10 )
{
make_set(v10);
__isoc99_scanf();
for ( i = v9; i; --i )
{
__isoc99_scanf();
unionx(v8, v7);
}
if ( v10 <= 0 )
{
v4 = 0xFFFFFFFFLL;
}
else
{
v3 = 1LL;
v4 = 0xFFFFFFFFLL;
do
{
if ( dword_404084[2 * v3] == (_DWORD)v3 )
v4 = (unsigned int)(v4 + 1);
++v3;
}
while ( v3 != v10 + 1 );
}
printf("%d\n", v4);
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rax
__int64 v4; // rsi
int i; // ebx
int v7; // [rsp+0h] [rbp-18h]
int v8; // [rsp+4h] [rbp-14h]
int v9; // [rsp+8h] [rbp-10h]
int v10; // [rsp+Ch] [rbp-Ch]

freopen("input.txt", "r", stdin);
while ( (unsigned int)__isoc99_scanf() && v10 )
{
func7(v10);
__isoc99_scanf();
for ( i = v9; i; --i )
{
__isoc99_scanf();
func10(v8, v7);
}
if ( v10 <= 0 )
{
v4 = 0xFFFFFFFFLL;
}
else
{
v3 = 1LL;
v4 = 0xFFFFFFFFLL;
do
{
if ( dword_404084[2 * v3] == (_DWORD)v3 )
v4 = (unsigned int)(v4 + 1);
++v3;
}
while ( v3 != v10 + 1 );
}
printf("%d\n", v4);
}
return 0;
}

original_code:
int main()
{
    int tmp,total_village,total_road,x,y;
    int sum;
    freopen("input.txt","r",stdin);
    while(scanf("%d",&total_village) && total_village){
        make_set(total_village);
        scanf("%d",&total_road);
        tmp = total_road;
        for(;tmp;tmp--){
            scanf("%d %d",&x,&y);
            unionx(x,y);
        }
        for(tmp = 1,sum =-1; tmp <=total_village;tmp++){
            if (array[tmp].parent == tmp){
                sum++;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

canonical_original_code:
int main()
{
    int tmp; int total_village; int total_road; int x; int y;
    int sum;
    freopen("input.txt","r",stdin);
    while(scanf("%d",&total_village) && total_village){
        make_set(total_village);
        scanf("%d",&total_road);
        tmp = total_road;
        for(;tmp;tmp--){
            scanf("%d %d",&x,&y);
            unionx(x,y);
        }
        for(tmp = 1,sum =-1; tmp <=total_village;tmp++){
            if (array[tmp].parent == tmp){
                sum++;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

variable_types: sum int


original_code:
int insert_node_queue(queue_t * queue, queue_node_t *node)
{
    queue_node_t * tmp;
    tmp = queue->head;
    if(tmp == ((void *)0)){
        queue->head = node;
        return 1;
    }
    while(tmp->next){
        tmp = tmp->next;
    }
    tmp->next = node;
    return 1;
}

canonical_original_code:
int insert_node_queue(struct queue_s *queue, struct queue_node_s *node)
{
    struct queue_node_s *tmp;
    tmp = queue->head;
    if(tmp == ((void *)0)){
        queue->head = node;
        return 1;
    }
    while(tmp->next){
        tmp = tmp->next;
    }
    tmp->next = node;
    return 1;
}

variable_types: struct queue_s { struct queue_node_s { int key; struct queue_node_s *next; } *head; } *

variable_types:
node
struct queue_node_s *

user_defined_types: struct queue_s { struct queue_node_s *head; }


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

v2 = create_node(a2);
insert_node_queue(a1, (__int64)v2);
return 1LL;
}

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

v2 = create_node(a2);
func2(a1, (__int64)v2);
return 1LL;
}

original_code:
int insert_value_queue(queue_t *queue, int key)
{
    queue_node_t *node;
    node = create_node(key);
    insert_node_queue(queue,node);
    return 1;
}

canonical_original_code:
int insert_value_queue(struct queue_s *queue, int key)
{
    struct queue_node_s *node;
    node = create_node(key);
    insert_node_queue(queue,node);
    return 1;
}

variable_types: key int

variable_types: struct queue_node_s { int key; struct queue_node_s *next; } *


decompiled_code:
void __fastcall free_queue(void *ptr)
{
_QWORD *v2; // rbx
void *v3; // rdi

v2 = *(_QWORD **)ptr;
if ( *(_QWORD *)ptr )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
free(v3);
}
while ( v2 );
}
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
_QWORD *v2; // rbx
void *v3; // rdi

v2 = *(_QWORD **)ptr;
if ( *(_QWORD *)ptr )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
free(v3);
}
while ( v2 );
}
free(ptr);
}

original_code:
void free_queue(queue_t * queue)
{
    queue_node_t *tmp,*tmptmp;
    tmp = queue->head;
    while(tmp){
        tmptmp = tmp->next;
        free(tmp);
        tmp = tmptmp;
    }
    free(queue);
}

canonical_original_code:
void free_queue(struct queue_s *queue)
{
    struct queue_node_s *tmp; struct queue_node_s *tmptmp;
    tmp = queue->head;
    while(tmp){
        tmptmp = tmp->next;
        free(tmp);
        tmp = tmptmp;
    }
    free(queue);
}

user_defined_types: struct queue_node_s { int key; struct queue_node_s *next; }


decompiled_code:
_QWORD *queue_init()
{
_QWORD *v0; // rax
_QWORD *v1; // rbx

v0 = malloc(8uLL);
v1 = v0;
if ( v0 )
*v0 = 0LL;
else
printf("%s file %d line malloc error ", "queue.c", 8LL);
return v1;
}

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *v0; // rax
_QWORD *v1; // rbx

v0 = malloc(8uLL);
v1 = v0;
if ( v0 )
*v0 = 0LL;
else
printf("%s file %d line malloc error ", "queue.c", 8LL);
return v1;
}

original_code:
queue_t *queue_init()
{
    queue_t * queue;
    if((queue = (queue_t*)malloc(sizeof(queue_t)))==((void *)0)){
        printf("%s file %d line malloc error ","queue.c",8);
        return 0;
    }
    memset(queue,0,sizeof(queue_t));
    return queue;
}

canonical_original_code:
struct queue_s *queue_init()
{
    struct queue_s *queue;
    if((queue = (struct queue_s *)malloc(sizeof(queue_t)))==((void *)0)){
        printf("%s file %d line malloc error ","queue.c",8);
        return 0;
    }
    memset(queue,0,sizeof(queue_t));
    return queue;
}

return_type: struct queue_s { struct queue_node_s { int key; struct queue_node_s *next; } *head; } *


decompiled_code:
_BOOL8 __fastcall queue_is_empty(_QWORD *a1)
{
return *a1 == 0LL;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(_QWORD *a1)
{
return *a1 == 0LL;
}

original_code:
int queue_is_empty(queue_t *queue)
{
    return (queue->head == ((void *)0))?1:0;
}

canonical_original_code:
int queue_is_empty(struct queue_s *queue)
{
    return (queue->head == ((void *)0))?1:0;
}


dequeue

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

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

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

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

original_code:
queue_node_t * dequeue(queue_t * queue)
{
     queue_node_t * first_node;
     first_node = queue->head;
     queue->head = first_node->next;
     return first_node;
}

canonical_original_code:
struct queue_node_s *dequeue(struct queue_s *queue)
{
     struct queue_node_s *first_node;
     first_node = queue->head;
     queue->head = first_node->next;
     return first_node;
}

variable_types: struct queue_s { struct queue_node_s *head; } *

return_type: struct queue_node_s { int key; struct queue_node_s *next; } *


decompiled_code:
__int64 __fastcall yk_simple_hash(unsigned __int8 *a1, int a2)
{
unsigned __int8 v3; // al
int v4; // esi
int v5; // ecx

v3 = *a1;
if ( a2 > 0 && v3 )
{
v4 = 0;
v5 = 0;
do
{
v5 = v3 + 31 * v5;
++a1;
++v4;
v3 = *a1;
}
while ( a2 > v4 && v3 );
}
else
{
v5 = 0;
}
return v5 & 0x7FFFFFFF;
}

canonical_decompiled_code:
__int64 __fastcall func12(unsigned __int8 *a1, int a2)
{
unsigned __int8 v3; // al
int v4; // esi
int v5; // ecx

v3 = *a1;
if ( a2 > 0 && v3 )
{
v4 = 0;
v5 = 0;
do
{
v5 = v3 + 31 * v5;
++a1;
++v4;
v3 = *a1;
}
while ( a2 > v4 && v3 );
}
else
{
v5 = 0;
}
return v5 & 0x7FFFFFFF;
}

original_code:
unsigned int yk_simple_hash(char *str,int str_len)
{
 register unsigned int hash;
 register unsigned char *p;
 int i;
 for(hash = 0, i = 0, p = (unsigned char *)str; *p && i < str_len; p++,i++)
  hash = 31 * hash + *p;
 return (hash & 0x7FFFFFFF);
}

canonical_original_code:
unsigned int yk_simple_hash(char *str, int str_len)
{
 register unsigned int hash;
 register unsigned char *p;
 int i;
 for(hash = 0, i = 0, p = (unsigned char *)str; *p && i < str_len; p++,i++)
  hash = 31 * hash + *p;
 return (hash & 0x7FFFFFFF);
}

variable_types:
str
char *

variable_types:
hash
unsigned int

variable_types:
p
unsigned char *

return_type: unsigned int


decompiled_code:
__int64 __fastcall simple_hash(unsigned __int8 *a1)
{
unsigned __int8 v1; // al
int v2; // ecx

v1 = *a1;
if ( *a1 )
{
v2 = 0;
do
{
v2 = v1 + 31 * v2;
v1 = *++a1;
}
while ( *a1 );
}
else
{
v2 = 0;
}
return v2 & 0x7FFFFFFF;
}

canonical_decompiled_code:
__int64 __fastcall func13(unsigned __int8 *a1)
{
unsigned __int8 v1; // al
int v2; // ecx

v1 = *a1;
if ( *a1 )
{
v2 = 0;
do
{
v2 = v1 + 31 * v2;
v1 = *++a1;
}
while ( *a1 );
}
else
{
v2 = 0;
}
return v2 & 0x7FFFFFFF;
}

original_code:
unsigned int simple_hash(char *str)
{
 register unsigned int hash;
 register unsigned char *p;
 for(hash = 0, p = (unsigned char *)str; *p ; p++)
  hash = 31 * hash + *p;
 return (hash & 0x7FFFFFFF);
}


original_code:
unsigned int RS_hash(char *str)
{
         unsigned int b = 378551;
         unsigned int a = 63689;
         unsigned int hash = 0;
         while (*str)
         {
                 hash = hash * a + (*str++);
                 a *= b;
         }
         return (hash & 0x7FFFFFFF);
}

variable_types:
b
unsigned int

variable_types:
a
unsigned int


original_code:
unsigned int JS_hash(char *str)
{
         unsigned int hash = 1315423911;
         while (*str)
         {
                 hash ^= ((hash << 5) + (*str++) + (hash >> 2));
         }
         return (hash & 0x7FFFFFFF);
}


original_code:
unsigned int PJW_hash(char *str)
{
         unsigned int BitsInUnignedInt = (unsigned int)(sizeof(unsigned int) * 8);
         unsigned int ThreeQuarters = (unsigned int)((BitsInUnignedInt * 3) / 4);
         unsigned int OneEighth = (unsigned int)(BitsInUnignedInt / 8);
         unsigned int HighBits = (unsigned int)(0xFFFFFFFF) << (BitsInUnignedInt - OneEighth);
         unsigned int hash = 0;
         unsigned int test = 0;
         while (*str)
         {
                 hash = (hash << OneEighth) + (*str++);
                 if ((test = hash & HighBits) != 0)
                 {
                         hash = ((hash ^ (test >> ThreeQuarters)) & (~HighBits));
                 }
         }
         return (hash & 0x7FFFFFFF);
}

variable_types:
BitsInUnignedInt
unsigned int

variable_types:
ThreeQuarters
unsigned int

variable_types:
OneEighth
unsigned int

variable_types:
HighBits
unsigned int

variable_types:
test
unsigned int


original_code:
unsigned int ELF_hash(char *str)
{
         unsigned int hash = 0;
         unsigned int x = 0;
         while (*str)
         {
                 hash = (hash << 4) + (*str++);
                 if ((x = hash & 0xF0000000L) != 0)
                 {
                         hash ^= (x >> 24);
                         hash &= ~x;
                 }
         }
         return (hash & 0x7FFFFFFF);
}

variable_types:
x
unsigned int


decompiled_code:
__int64 __fastcall BKDR_hash(char *a1)
{
char v1; // al
int v2; // edx

v1 = *a1;
if ( *a1 )
{
v2 = 0;
do
{
++a1;
v2 = v1 + 131 * v2;
v1 = *a1;
}
while ( *a1 );
}
else
{
v2 = 0;
}
return v2 & 0x7FFFFFFF;
}

canonical_decompiled_code:
__int64 __fastcall func18(char *a1)
{
char v1; // al
int v2; // edx

v1 = *a1;
if ( *a1 )
{
v2 = 0;
do
{
++a1;
v2 = v1 + 131 * v2;
v1 = *a1;
}
while ( *a1 );
}
else
{
v2 = 0;
}
return v2 & 0x7FFFFFFF;
}

original_code:
unsigned int BKDR_hash(char *str)
{
         unsigned int seed = 131;
         unsigned int hash = 0;
         while (*str)
         {
                 hash = hash * seed + (*str++);
         }
         return (hash & 0x7FFFFFFF);
}

variable_types:
seed
unsigned int


decompiled_code:
__int64 __fastcall SDBM_hash(char *a1)
{
char v1; // al
int v2; // edx

v1 = *a1;
if ( *a1 )
{
v2 = 0;
do
{
++a1;
v2 = v1 + 65599 * v2;
v1 = *a1;
}
while ( *a1 );
}
else
{
v2 = 0;
}
return v2 & 0x7FFFFFFF;
}

original_code:
unsigned int SDBM_hash(char *str)
{
         unsigned int hash = 0;
         while (*str)
         {
                 hash = (*str++) + (hash << 6) + (hash << 16) - hash;
         }
         return (hash & 0x7FFFFFFF);
}


original_code:
unsigned int DJB_hash(char *str)
{
         unsigned int hash = 5381;
         while (*str)
         {
                 hash += (hash << 5) + (*str++);
         }
         return (hash & 0x7FFFFFFF);
}


original_code:
unsigned int AP_hash(char *str)
{
         unsigned int hash = 0;
         int i;
         for (i=0; *str; i++)
         {
                 if ((i & 1) == 0)
                 {
                         hash ^= ((hash << 7) ^ (*str++) ^ (hash >> 3));
                 }
                 else
                 {
                         hash ^= (~((hash << 11) ^ (*str++) ^ (hash >> 5)));
                 }
         }
         return (hash & 0x7FFFFFFF);
}

variable_types: i int


decompiled_code:
__int64 __fastcall CRC_hash(const char *a1)
{
const char *v1; // rbx
unsigned int v2; // eax
unsigned int v3; // esi
unsigned int v4; // edi
const char *v5; // rcx
unsigned __int64 v6; // rax
unsigned int v7; // edx
unsigned __int16 v9; // [rsp+Eh] [rbp-Ah]

v1 = a1;
v2 = strlen(a1);
HIBYTE(v9) = 0;
if ( v2 <= 1 )
{
v7 = v2;
v5 = a1;
v6 = 0LL;
}
else
{
v3 = v2 - 2;
v4 = (v2 - 2) >> 1;
v5 = &v1[2 * v4 + 2];
v6 = 0LL;
do
{
v1 += 2;
v6 += *((unsigned __int16 *)v1 - 1);
}
while ( v1 != v5 );
v7 = v3 - 2 * v4;
}
if ( v7 == 1 )
{
LOBYTE(v9) = *v5;
v6 += v9;
}
return (unsigned __int16)~(v6 + WORD1(v6) + (((unsigned __int16)v6 + (unsigned int)(v6 >> 16)) >> 16));
}

canonical_decompiled_code:
__int64 __fastcall func22(const char *a1)
{
const char *v1; // rbx
unsigned int v2; // eax
unsigned int v3; // esi
unsigned int v4; // edi
const char *v5; // rcx
unsigned __int64 v6; // rax
unsigned int v7; // edx
unsigned __int16 v9; // [rsp+Eh] [rbp-Ah]

v1 = a1;
v2 = strlen(a1);
HIBYTE(v9) = 0;
if ( v2 <= 1 )
{
v7 = v2;
v5 = a1;
v6 = 0LL;
}
else
{
v3 = v2 - 2;
v4 = (v2 - 2) >> 1;
v5 = &v1[2 * v4 + 2];
v6 = 0LL;
do
{
v1 += 2;
v6 += *((unsigned __int16 *)v1 - 1);
}
while ( v1 != v5 );
v7 = v3 - 2 * v4;
}
if ( v7 == 1 )
{
LOBYTE(v9) = *v5;
v6 += v9;
}
return (unsigned __int16)~(v6 + WORD1(v6) + (((unsigned __int16)v6 + (unsigned int)(v6 >> 16)) >> 16));
}

original_code:
unsigned int CRC_hash(char *str)
{
    unsigned int nleft = strlen(str);
    unsigned long long sum = 0;
    unsigned short int *w = (unsigned short int *)str;
    unsigned short int answer = 0;
    while ( nleft > 1 ) {
        sum += *w++;
        nleft -= 2;
    }
    if ( 1 == nleft ) {
        *( unsigned char * )( &answer ) = *( unsigned char * )w ;
        sum += answer;
    }
    sum = ( sum >> 16 ) + ( sum & 0xFFFF );
    sum += ( sum >> 16 );
    answer = ~sum;
    return (answer & 0xFFFFFFFF);
}

canonical_original_code:
unsigned int CRC_hash(char *str)
{
    unsigned int nleft = strlen(str);
    unsigned long long sum = 0;
    unsigned short *w = (unsigned short int *)str;
    unsigned short answer = 0;
    while ( nleft > 1 ) {
        sum += *w++;
        nleft -= 2;
    }
    if ( 1 == nleft ) {
        *( unsigned char * )( &answer ) = *( unsigned char * )w ;
        sum += answer;
    }
    sum = ( sum >> 16 ) + ( sum & 0xFFFF );
    sum += ( sum >> 16 );
    answer = ~sum;
    return (answer & 0xFFFFFFFF);
}

variable_types:
nleft
unsigned int

variable_types:
sum
unsigned long long

variable_types:
w
unsigned short *

variable_types:
answer
unsigned short


decompiled_code:
__int64 __fastcall yk_simple_hash_string(__int64 a1, int a2)
{
__int64 v2; // rdx
int v3; // eax

if ( a2 > 0 && a1 )
{
v2 = 0LL;
v3 = 0;
do
v3 = 31 * v3 + *(unsigned __int8 *)(a1 + v2++);
while ( a2 > (int)v2 );
}
else
{
v3 = 0;
}
return v3 & 0x7FFFFFFF;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, int a2)
{
__int64 v2; // rdx
int v3; // eax

if ( a2 > 0 && a1 )
{
v2 = 0LL;
v3 = 0;
do
v3 = 31 * v3 + *(unsigned __int8 *)(a1 + v2++);
while ( a2 > (int)v2 );
}
else
{
v3 = 0;
}
return v3 & 0x7FFFFFFF;
}

original_code:
unsigned int
yk_simple_hash_string(char * str,int str_len)
{
 unsigned int hash;
 unsigned char * p;
 int i;
 for(i = 0, hash = 0,p = (unsigned char *)str; i < str_len && p; i++,p++)
  hash = 31 * hash + *p;
 return (hash & 0x7FFFFFFF);
}

canonical_original_code:
unsigned int yk_simple_hash_string(char *str, int str_len)
{
 unsigned int hash;
 unsigned char *p;
 int i;
 for(i = 0, hash = 0,p = (unsigned char *)str; i < str_len && p; i++,p++)
  hash = 31 * hash + *p;
 return (hash & 0x7FFFFFFF);
}

variable_types:
str
char *


decompiled_code:
void *yk_hash_table_init()
{
void *v0; // rbx

v0 = malloc(0x2F0uLL);
if ( v0 )
memset(v0, 0, 0x2F0uLL);
else
puts("create HASH TABLE error");
return v0;
}

canonical_decompiled_code:
void *func8()
{
void *v0; // rbx

v0 = malloc(0x2F0uLL);
if ( v0 )
memset(v0, 0, 0x2F0uLL);
else
puts("create HASH TABLE error");
return v0;
}

original_code:
HASH_TABLE*
yk_hash_table_init()
{
 HASH_TABLE* hashTB = ((void *)0);
 hashTB = (HASH_TABLE *)malloc(sizeof(HASH_TABLE)*47);
 if(((void *)0) == hashTB){
  printf("create HASH TABLE error\n");
  return ((void *)0);
 }
 memset(hashTB,0,sizeof(HASH_TABLE)*47);
 return hashTB;
}

canonical_original_code:
struct _HASH_TABLE *yk_hash_table_init()
{
 struct _HASH_TABLE *hashTB = ((void *)0);
 hashTB = (struct _HASH_TABLE *)malloc(sizeof(HASH_TABLE)*47);
 if(((void *)0) == hashTB){
  printf("create HASH TABLE error\n");
  return ((void *)0);
 }
 memset(hashTB,0,sizeof(HASH_TABLE)*47);
 return hashTB;
}

variable_types: struct _HASH_TABLE { unsigned int hit_count; struct _NODE { char *key; int key_len; unsigned int occur_count; struct _NODE *next; } *keys_chain; } *

user_defined_types: struct _HASH_TABLE { unsigned int hit_count; struct _NODE *keys_chain; }


original_code:
void
yk_cpy_str(char *dst,char *src,int str_len)
{
 int i;
 for(i = 0; i < str_len; i++){
  *(dst + i) = *( src + i);
 }
}

canonical_original_code:
void yk_cpy_str(char *dst, char *src, int str_len)
{
 int i;
 for(i = 0; i < str_len; i++){
  *(dst + i) = *( src + i);
 }
}

variable_types:
dst
char *

variable_types:
src
char *


decompiled_code:
int __fastcall yk_print_str(char *a1, int a2)
{
char *v2; // rbx

if ( a2 > 0 )
{
v2 = a1;
do
putchar(*v2++);
while ( v2 != &a1[a2 - 1 + 1] );
}
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func10(char *a1, int a2)
{
char *v2; // rbx

if ( a2 > 0 )
{
v2 = a1;
do
putchar(*v2++);
while ( v2 != &a1[a2 - 1 + 1] );
}
return putchar(10);
}

original_code:
void
yk_print_str(char * str,int str_len)
{
 int i = 0;
 for(;i < str_len;i++)
  printf("%c",*(str+i));
 printf("\n");
}

canonical_original_code:
void yk_print_str(char *str, int str_len)
{
 int i = 0;
 for(;i < str_len;i++)
  printf("%c",*(str+i));
 printf("\n");
}


decompiled_code:
int __fastcall yk_output_result(unsigned int *a1)
{
unsigned int i; // ebp
int result; // eax
__int64 j; // rbx

for ( i = 0; i != 47; ++i )
{
result = printf("\nBUCKET:@@@ %d @@@ \nhit_count is %d\n", i, *a1);
for ( j = *((_QWORD *)a1 + 1); j; j = *(_QWORD *)(j + 16) )
{
printf("\tBUCKET:%d key_occur time is %d\n", i, *(unsigned int *)(j + 12));
printf("\tBUCKET:%d key is \n", i);
result = yk_print_str(*(char **)j, *(_DWORD *)(j + 8));
}
a1 += 4;
}
return result;
}

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

for ( i = 0; i != 47; ++i )
{
result = printf("\nBUCKET:@@@ %d @@@ \nhit_count is %d\n", i, *a1);
for ( j = *((_QWORD *)a1 + 1); j; j = *(_QWORD *)(j + 16) )
{
printf("\tBUCKET:%d key_occur time is %d\n", i, *(unsigned int *)(j + 12));
printf("\tBUCKET:%d key is \n", i);
result = func10(*(char **)j, *(_DWORD *)(j + 8));
}
a1 += 4;
}
return result;
}

original_code:
void
yk_output_result(HASH_TABLE * hashTb)
{
 int i;
 NODE * pNode;
 for(i = 0; i < 47;i++){
  printf("\nBUCKET:@@@ %d @@@ \nhit_count is %d\n",i,hashTb[i].hit_count);
  for(pNode = hashTb[i].keys_chain;pNode;pNode = pNode->next){
   printf("\tBUCKET:%d key_occur time is %d\n",i,pNode->occur_count);
   printf("\tBUCKET:%d key is \n",i);
   yk_print_str(pNode->key,pNode->key_len);
  }
 }
}

canonical_original_code:
void yk_output_result(struct _HASH_TABLE *hashTb)
{
 int i;
 struct _NODE *pNode;
 for(i = 0; i < 47;i++){
  printf("\nBUCKET:@@@ %d @@@ \nhit_count is %d\n",i,hashTb[i].hit_count);
  for(pNode = hashTb[i].keys_chain;pNode;pNode = pNode->next){
   printf("\tBUCKET:%d key_occur time is %d\n",i,pNode->occur_count);
   printf("\tBUCKET:%d key is \n",i);
   yk_print_str(pNode->key,pNode->key_len);
  }
 }
}

variable_types: struct _NODE { char *key; int key_len; unsigned int occur_count; struct _NODE *next; } *


decompiled_code:
__int64 __fastcall yk_strcmp(__int64 a1, __int64 a2, int a3, int a4)
{
int v4; // eax
__int64 v5; // r8
__int64 v6; // rax
char v7; // r10
char v8; // r9
__int64 result; // rax

v4 = a3;
if ( a4 <= a3 )
v4 = a4;
if ( v4 <= 0 )
{
LABEL_10:
result = 0xFFFFFFFFLL;
if ( a4 <= a3 )
result = a4 != a3;
}
else
{
v5 = (unsigned int)v4;
v6 = 0LL;
while ( 1 )
{
v7 = *(_BYTE *)(a1 + v6);
v8 = *(_BYTE *)(a2 + v6);
if ( v7 > v8 )
break;
if ( v7 != v8 )
return 0xFFFFFFFFLL;
if ( ++v6 == v5 )
goto LABEL_10;
}
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1, __int64 a2, int a3, int a4)
{
int v4; // eax
__int64 v5; // r8
__int64 v6; // rax
char v7; // r10
char v8; // r9
__int64 result; // rax

v4 = a3;
if ( a4 <= a3 )
v4 = a4;
if ( v4 <= 0 )
{
LABEL_10:
result = 0xFFFFFFFFLL;
if ( a4 <= a3 )
result = a4 != a3;
}
else
{
v5 = (unsigned int)v4;
v6 = 0LL;
while ( 1 )
{
v7 = *(_BYTE *)(a1 + v6);
v8 = *(_BYTE *)(a2 + v6);
if ( v7 > v8 )
break;
if ( v7 != v8 )
return 0xFFFFFFFFLL;
if ( ++v6 == v5 )
goto LABEL_10;
}
result = 1LL;
}
return result;
}

original_code:
int
yk_strcmp(char * str1,char *str2,int len1,int len2)
{
 int i = 0;
 for(i = 0; i < ((len1<len2)?len1:len2); i++){
  if(*(str1 + i) > *(str2 + i))
   return 1;
  else if(*(str1 + i) == *(str2 + i))
   continue;
  else
   return -1;
 }
 if(len1 < len2)
  return -1;
 else if(len1 == len2)
  return 0;
 else
  return 1;
}

canonical_original_code:
int yk_strcmp(char *str1, char *str2, int len1, int len2)
{
 int i = 0;
 for(i = 0; i < ((len1<len2)?len1:len2); i++){
  if(*(str1 + i) > *(str2 + i))
   return 1;
  else if(*(str1 + i) == *(str2 + i))
   continue;
  else
   return -1;
 }
 if(len1 < len2)
  return -1;
 else if(len1 == len2)
  return 0;
 else
  return 1;
}


decompiled_code:
__int64 __fastcall yk_find_data_from_hash_table(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // rbx
unsigned int v5; // eax

v3 = a1;
v5 = (unsigned int)yk_simple_hash_string(a2, a3) % 0x2F;
if ( a1 )
{
v3 = *(_QWORD *)(a1 + 16LL * v5 + 8);
if ( v3 )
{
while ( (unsigned int)yk_strcmp(a2, *(_QWORD *)v3, a3, *(_DWORD *)(v3 + 8)) )
{
v3 = *(_QWORD *)(v3 + 16);
if ( !v3 )
return v3;
}
++*(_DWORD *)(v3 + 12);
}
}
else
{
puts("NO CHAIN when find data");
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // rbx
unsigned int v5; // eax

v3 = a1;
v5 = (unsigned int)func7(a2, a3) % 0x2F;
if ( a1 )
{
v3 = *(_QWORD *)(a1 + 16LL * v5 + 8);
if ( v3 )
{
while ( (unsigned int)func12(a2, *(_QWORD *)v3, a3, *(_DWORD *)(v3 + 8)) )
{
v3 = *(_QWORD *)(v3 + 16);
if ( !v3 )
return v3;
}
++*(_DWORD *)(v3 + 12);
}
}
else
{
puts("NO CHAIN when find data");
}
return v3;
}

original_code:
NODE *
yk_find_data_from_hash_table(HASH_TABLE * hashTb,type key,int key_len)
{
 unsigned int hash_value;
 NODE * pNode;
 hash_value = yk_simple_hash_string(key,key_len)%47;
 if(((void *)0) == hashTb ){
  printf("NO CHAIN when find data\n");
  return ((void *)0);
 }
 pNode = hashTb[hash_value].keys_chain;
 for(;pNode;){
  if(yk_strcmp(key,pNode->key,key_len,pNode->key_len) == 0){
   pNode->occur_count++;
   return pNode;
  }
  pNode = pNode->next;
 }
 return ((void *)0);
}

canonical_original_code:
struct _NODE *yk_find_data_from_hash_table(struct _HASH_TABLE *hashTb, char *key, int key_len)
{
 unsigned int hash_value;
 struct _NODE *pNode;
 hash_value = yk_simple_hash_string(key,key_len)%47;
 if(((void *)0) == hashTb ){
  printf("NO CHAIN when find data\n");
  return ((void *)0);
 }
 pNode = hashTb[hash_value].keys_chain;
 for(;pNode;){
  if(yk_strcmp(key,pNode->key,key_len,pNode->key_len) == 0){
   pNode->occur_count++;
   return pNode;
  }
  pNode = pNode->next;
 }
 return ((void *)0);
}

variable_types: struct _HASH_TABLE { unsigned int hit_count; struct _NODE *keys_chain; } *

variable_types:
key
char *

return_type: struct _NODE { char *key; int key_len; unsigned int occur_count; struct _NODE *next; } *


decompiled_code:
__int64 __fastcall yk_insert_data_into_hash_table(__int64 a1, char *a2, int a3)
{
unsigned int v4; // ebx
__int64 v5; // rbx
__int64 v6; // r14
__int64 v7; // rdx
__int64 result; // rax
_DWORD *v9; // r13
void *v10; // rdi
__int64 v11; // rbx
_DWORD *v12; // r13
void *v13; // rdi

if ( !a1 )
{
puts("NO CHAIN when find data");
return 0LL;
}
v4 = (unsigned int)yk_simple_hash_string((__int64)a2, a3) % 0x2F;
printf("hash value is %d\t key is ", v4);
yk_print_str(a2, a3);
v5 = a1 + 16LL * v4;
++*(_DWORD *)v5;
v6 = *(_QWORD *)(v5 + 8);
if ( !v6 )
{
v9 = malloc(0x18uLL);
if ( v9 )
{
v10 = malloc(a3);
*(_QWORD *)v9 = v10;
if ( v10 )
{
yk_cpy_str((__int64)v10, (__int64)a2, a3);
v9[2] = a3;
*((_QWORD *)v9 + 2) = 0LL;
v9[3] = 1;
*(_QWORD *)(v5 + 8) = v9;
return 1LL;
}
LABEL_16:
printf("allocate key");
return 0LL;
}
LABEL_9:
printf("allocate NODE error");
return 0LL;
}
v7 = yk_find_data_from_hash_table(a1, (__int64)a2, a3);
result = 0LL;
if ( !v7 )
{
do
{
v11 = v6;
v6 = *(_QWORD *)(v6 + 16);
}
while ( v6 );
v12 = malloc(0x18uLL);
if ( v12 )
{
v13 = malloc(a3);
*(_QWORD *)v12 = v13;
if ( v13 )
{
yk_cpy_str((__int64)v13, (__int64)a2, a3);
v12[2] = a3;
*((_QWORD *)v12 + 2) = 0LL;
v12[3] = 1;
*(_QWORD *)(v11 + 16) = v12;
return 1LL;
}
goto LABEL_16;
}
goto LABEL_9;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, char *a2, int a3)
{
unsigned int v4; // ebx
__int64 v5; // rbx
__int64 v6; // r14
__int64 v7; // rdx
__int64 result; // rax
_DWORD *v9; // r13
void *v10; // rdi
__int64 v11; // rbx
_DWORD *v12; // r13
void *v13; // rdi

if ( !a1 )
{
puts("NO CHAIN when find data");
return 0LL;
}
v4 = (unsigned int)func7((__int64)a2, a3) % 0x2F;
printf("hash value is %d\t key is ", v4);
func10(a2, a3);
v5 = a1 + 16LL * v4;
++*(_DWORD *)v5;
v6 = *(_QWORD *)(v5 + 8);
if ( !v6 )
{
v9 = malloc(0x18uLL);
if ( v9 )
{
v10 = malloc(a3);
*(_QWORD *)v9 = v10;
if ( v10 )
{
func9((__int64)v10, (__int64)a2, a3);
v9[2] = a3;
*((_QWORD *)v9 + 2) = 0LL;
v9[3] = 1;
*(_QWORD *)(v5 + 8) = v9;
return 1LL;
}
LABEL_16:
printf("allocate key");
return 0LL;
}
LABEL_9:
printf("allocate NODE error");
return 0LL;
}
v7 = func13(a1, (__int64)a2, a3);
result = 0LL;
if ( !v7 )
{
do
{
v11 = v6;
v6 = *(_QWORD *)(v6 + 16);
}
while ( v6 );
v12 = malloc(0x18uLL);
if ( v12 )
{
v13 = malloc(a3);
*(_QWORD *)v12 = v13;
if ( v13 )
{
func9((__int64)v13, (__int64)a2, a3);
v12[2] = a3;
*((_QWORD *)v12 + 2) = 0LL;
v12[3] = 1;
*(_QWORD *)(v11 + 16) = v12;
return 1LL;
}
goto LABEL_16;
}
goto LABEL_9;
}
return result;
}

original_code:
STATUS
yk_insert_data_into_hash_table(HASH_TABLE * hashTb,type key,int key_len)
{
 if(((void *)0) == hashTb ){
  printf("NO CHAIN when find data\n");
  return FALSE;
 }
 unsigned int hash_value;
 NODE * pNode,*pNewNode;
 hash_value = yk_simple_hash_string(key,key_len) % 47;
 printf("hash value is %d\t key is ",hash_value);
 yk_print_str(key,key_len);
 hashTb[hash_value].hit_count++;
 pNode = hashTb[hash_value].keys_chain;
 if(((void *)0) == pNode){
  if( ((void *)0) == (pNewNode = (NODE*)malloc(sizeof(NODE))) ){
   printf("allocate NODE error");
   return FALSE;
  }
  if(((void *)0) == (pNewNode->key = (char*)malloc(key_len * sizeof(char)))){
   printf("allocate key");
   return FALSE;
  }
  yk_cpy_str(pNewNode->key,key,key_len);
  pNewNode->key_len = key_len;
  pNewNode->next = ((void *)0);
  pNewNode->occur_count = 1;
  hashTb[hash_value].keys_chain = pNewNode;
     return TRUE;
 }
 if( ((void *)0) != (yk_find_data_from_hash_table(hashTb, key,key_len)) )
  return FALSE;
 for(;pNode->next;)
  pNode = pNode->next;
 if( ((void *)0) == (pNewNode = (NODE*)malloc(sizeof(NODE))) ){
    printf("allocate NODE error");
    return FALSE;
 }
 if(((void *)0) == (pNewNode->key = (char*)malloc(key_len * sizeof(char)))){
   printf("allocate key");
   return FALSE;
 }
 yk_cpy_str(pNewNode->key,key,key_len);
 pNewNode->key_len = key_len;
 pNewNode->next = ((void *)0);
 pNewNode->occur_count = 1;
 pNode->next = pNewNode;
 return TRUE;
}

canonical_original_code:
enum STATUS yk_insert_data_into_hash_table(struct _HASH_TABLE *hashTb, char *key, int key_len)
{
 if(((void *)0) == hashTb ){
  printf("NO CHAIN when find data\n");
  return FALSE;
 }
 unsigned int hash_value;
 struct _NODE *pNode; struct _NODE *pNewNode;
 hash_value = yk_simple_hash_string(key,key_len) % 47;
 printf("hash value is %d\t key is ",hash_value);
 yk_print_str(key,key_len);
 hashTb[hash_value].hit_count++;
 pNode = hashTb[hash_value].keys_chain;
 if(((void *)0) == pNode){
  if( ((void *)0) == (pNewNode = (struct _NODE *)malloc(sizeof(NODE))) ){
   printf("allocate NODE error");
   return FALSE;
  }
  if(((void *)0) == (pNewNode->key = (char *)malloc(key_len * sizeof(char)))){
   printf("allocate key");
   return FALSE;
  }
  yk_cpy_str(pNewNode->key,key,key_len);
  pNewNode->key_len = key_len;
  pNewNode->next = ((void *)0);
  pNewNode->occur_count = 1;
  hashTb[hash_value].keys_chain = pNewNode;
     return TRUE;
 }
 if( ((void *)0) != (yk_find_data_from_hash_table(hashTb, key,key_len)) )
  return FALSE;
 for(;pNode->next;)
  pNode = pNode->next;
 if( ((void *)0) == (pNewNode = (struct _NODE *)malloc(sizeof(NODE))) ){
    printf("allocate NODE error");
    return FALSE;
 }
 if(((void *)0) == (pNewNode->key = (char *)malloc(key_len * sizeof(char)))){
   printf("allocate key");
   return FALSE;
 }
 yk_cpy_str(pNewNode->key,key,key_len);
 pNewNode->key_len = key_len;
 pNewNode->next = ((void *)0);
 pNewNode->occur_count = 1;
 pNode->next = pNewNode;
 return TRUE;
}

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

user_defined_types: struct _NODE { char *key; int key_len; unsigned int occur_count; struct _NODE *next; }


decompiled_code:
__int64 __fastcall queue_free(void *ptr)
{
__int64 v1; // rbx
unsigned int *v2; // rbp

v1 = *(_QWORD *)ptr;
while ( v1 )
{
v2 = (unsigned int *)v1;
v1 = *(_QWORD *)(v1 + 8);
printf("tmp:%d\n", v2[4]);
free(v2);
}
free(ptr);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(void *ptr)
{
__int64 v1; // rbx
unsigned int *v2; // rbp

v1 = *(_QWORD *)ptr;
while ( v1 )
{
v2 = (unsigned int *)v1;
v1 = *(_QWORD *)(v1 + 8);
printf("tmp:%d\n", v2[4]);
free(v2);
}
free(ptr);
return 0LL;
}

original_code:
int
queue_free(queue_t *queue)
{
    queue_node_t *tmp,*tmp2;
    tmp = queue->head;
    while(tmp){
        tmp2 = tmp->next;
        printf("tmp:%d\n",tmp->key.key);
        free(tmp);
        tmp = tmp2;
    }
    free(queue);
    return 0;
}

canonical_original_code:
int queue_free(struct queue_s *queue)
{
    struct queue_node_s *tmp; struct queue_node_s *tmp2;
    tmp = queue->head;
    while(tmp){
        tmp2 = tmp->next;
        printf("tmp:%d\n",tmp->key.key);
        free(tmp);
        tmp = tmp2;
    }
    free(queue);
    return 0;
}

variable_types: struct queue_s { struct queue_node_s { struct queue_node_s *prev; struct queue_node_s *next; struct queue_key_s { int key; } key; } *head; struct queue_node_s *last; } *

user_defined_types: struct queue_s { struct queue_node_s *head; struct queue_node_s *last; }

user_defined_types: struct queue_node_s { struct queue_node_s *prev; struct queue_node_s *next; struct queue_key_s key; }


enqueue

original_code:
int
enqueue(queue_t *queue, int key)
{
    queue_node_t *node;
    node = create_node(key);
    if(queue->head == ((void *)0)) {
        queue->head = node;
        queue->last = node;
        return 0;
    }
    node->next = queue->last->next;
    node->prev = queue->last;
    queue->last->next = node;
    queue->last = node;
    return 0;
}

canonical_original_code:
int enqueue(struct queue_s *queue, int key)
{
    struct queue_node_s *node;
    node = create_node(key);
    if(queue->head == ((void *)0)) {
        queue->head = node;
        queue->last = node;
        return 0;
    }
    node->next = queue->last->next;
    node->prev = queue->last;
    queue->last->next = node;
    queue->last = node;
    return 0;
}

variable_types: key int

variable_types: struct queue_node_s { struct queue_node_s *prev; struct queue_node_s *next; struct queue_key_s { int key; } key; } *


decompiled_code:
void __noreturn err_exit(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
printf("%s:%d", "queue.c", 19LL);
vprintf(format, arg);
exit(0);
}

canonical_decompiled_code:
void __noreturn func7(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
printf("%s:%d", "queue.c", 19LL);
vprintf(format, arg);
exit(0);
}

original_code:
void
err_exit(char *fmt,...)
{
    va_list va;
    __builtin_va_start(va,fmt);
    printf("%s:%d","queue.c",19);
    vprintf(fmt,va);
    __builtin_va_end(va);
    exit(0);
}

canonical_original_code:
void err_exit(char *fmt, ...)
{
    __builtin_va_list va;
    __builtin_va_start(va,fmt);
    printf("%s:%d","queue.c",19);
    vprintf(fmt,va);
    __builtin_va_end(va);
    exit(0);
}

variable_types:
fmt
char *


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

result = calloc(1uLL, 0x10uLL);
if ( !result )
err_exit("calloc error\n");
return result;
}

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

result = calloc(1uLL, 0x10uLL);
if ( !result )
func7("calloc error\n");
return result;
}

original_code:
queue_t*
queue_init()
{
    queue_t * queue;
    queue = (queue_t *)calloc(1,sizeof(queue_t));
    if( queue == ((void *)0)) {
        err_exit("calloc error\n");
    }
    queue->head = ((void *)0);
    queue->last = ((void *)0);
    return queue;
}

canonical_original_code:
struct queue_s *queue_init()
{
    struct queue_s *queue;
    queue = (struct queue_s *)calloc(1,sizeof(queue_t));
    if( queue == ((void *)0)) {
        err_exit("calloc error\n");
    }
    queue->head = ((void *)0);
    queue->last = ((void *)0);
    return queue;
}

return_type: struct queue_s { struct queue_node_s { struct queue_node_s *prev; struct queue_node_s *next; struct queue_key_s { int key; } key; } *head; struct queue_node_s *last; } *


dequeue

original_code:
int
dequeue(queue_t *queue, queue_node_t *node)
{
    if(queue->head == ((void *)0)) {
        printf("queue is EMPTY ,cannot dequeu\n");
        return 0;
    }
    *node = *queue->head;
    queue->head = queue->head->next;
    free(queue->head->prev);
    queue->head->prev = ((void *)0);
    return 0;
}

canonical_original_code:
int dequeue(struct queue_s *queue, struct queue_node_s *node)
{
    if(queue->head == ((void *)0)) {
        printf("queue is EMPTY ,cannot dequeu\n");
        return 0;
    }
    *node = *queue->head;
    queue->head = queue->head->next;
    free(queue->head->prev);
    queue->head->prev = ((void *)0);
    return 0;
}

variable_types:
node
struct queue_node_s *


decompiled_code:
_BOOL8 __fastcall queue_is_empty(_QWORD *a1)
{
return *a1 == 0LL;
}

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

original_code:
int
queue_is_empty(queue_t *queue)
{
    return queue->head == ((void *)0);
}

canonical_original_code:
int queue_is_empty(struct queue_s *queue)
{
    return queue->head == ((void *)0);
}


traverse

decompiled_code:
int __fastcall traverse(__int64 *a1)
{
__int64 i; // rbx
int result; // eax

for ( i = *a1; i; i = *(_QWORD *)(i + 8) )
result = printf("tmp->key.key:%d\n", *(unsigned int *)(i + 16));
return result;
}

canonical_decompiled_code:
int __fastcall func13(__int64 *a1)
{
__int64 i; // rbx
int result; // eax

for ( i = *a1; i; i = *(_QWORD *)(i + 8) )
result = printf("tmp->key.key:%d\n", *(unsigned int *)(i + 16));
return result;
}

original_code:
void
traverse(queue_t *queue)
{
    queue_node_t *tmp;
    tmp = queue->head;
    while(tmp != ((void *)0)) {
        printf("tmp->key.key:%d\n",tmp->key.key);
        tmp = tmp->next;
    }
}

canonical_original_code:
void traverse(struct queue_s *queue)
{
    struct queue_node_s *tmp;
    tmp = queue->head;
    while(tmp != ((void *)0)) {
        printf("tmp->key.key:%d\n",tmp->key.key);
        tmp = tmp->next;
    }
}


HashInt

decompiled_code:
__int64 __fastcall HashInt(_DWORD *a1, int a2)
{
return a2 % *a1;
}

canonical_decompiled_code:
__int64 __fastcall func8(_DWORD *a1, int a2)
{
return a2 % *a1;
}

original_code:
unsigned long
HashInt(hash_table_t *ht, int data)
{
 return data % ht->hash_slot_number;
}

canonical_original_code:
unsigned long HashInt(struct hash_table_s *ht, int data)
{
 return data % ht->hash_slot_number;
}

variable_types: struct hash_table_s { int hash_slot_number; struct hash_elem_s { struct hash_key_s { int key; } key; struct hash_elem_s *next; } **hash_tb; } *

variable_types: data int

return_type: unsigned long

user_defined_types: struct hash_table_s { int hash_slot_number; struct hash_elem_s **hash_tb; }

user_defined_types: struct hash_elem_s { struct hash_key_s key; struct hash_elem_s *next; }


decompiled_code:
__int64 __fastcall insert_data_into_hash(__int64 a1, unsigned int a2)
{
__int64 *v2; // r13
__int64 v3; // rbx
__int64 v4; // rbp
_QWORD *v5; // rax
__int64 result; // rax
_QWORD *v7; // rax

if ( !a1 )
err_exit("hash_table_t is NULL\n");
v2 = (__int64 *)(*(_QWORD *)(a1 + 8) + 8 * HashInt((_DWORD *)a1, a2));
v3 = *v2;
if ( *v2 )
{
if ( find_data_from_hash(a1, a2) )
{
printf("data %d exits in hash table\n", a2);
result = 0LL;
}
else
{
do
{
v4 = v3;
v3 = *(_QWORD *)(v3 + 8);
}
while ( v3 );
v5 = calloc(1uLL, 0x10uLL);
if ( !v5 )
err_exit("calloc error\n");
*(_DWORD *)v5 = a2;
v5[1] = 0LL;
*(_QWORD *)(v4 + 8) = v5;
puts("Insert Success");
result = 1LL;
}
}
else
{
v7 = calloc(1uLL, 0x10uLL);
if ( !v7 )
err_exit("malloc error\n");
*(_DWORD *)v7 = a2;
v7[1] = 0LL;
*v2 = (__int64)v7;
puts("insert succeed ");
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, unsigned int a2)
{
__int64 *v2; // r13
__int64 v3; // rbx
__int64 v4; // rbp
_QWORD *v5; // rax
__int64 result; // rax
_QWORD *v7; // rax

if ( !a1 )
func7("hash_table_t is NULL\n");
v2 = (__int64 *)(*(_QWORD *)(a1 + 8) + 8 * func8((_DWORD *)a1, a2));
v3 = *v2;
if ( *v2 )
{
if ( func9(a1, a2) )
{
printf("data %d exits in hash table\n", a2);
result = 0LL;
}
else
{
do
{
v4 = v3;
v3 = *(_QWORD *)(v3 + 8);
}
while ( v3 );
v5 = calloc(1uLL, 0x10uLL);
if ( !v5 )
func7("calloc error\n");
*(_DWORD *)v5 = a2;
v5[1] = 0LL;
*(_QWORD *)(v4 + 8) = v5;
puts("Insert Success");
result = 1LL;
}
}
else
{
v7 = calloc(1uLL, 0x10uLL);
if ( !v7 )
func7("malloc error\n");
*(_DWORD *)v7 = a2;
v7[1] = 0LL;
*v2 = (__int64)v7;
puts("insert succeed ");
result = 1LL;
}
return result;
}

original_code:
STATUS
insert_data_into_hash(hash_table_t * hash_table, int data)
{
    unsigned long key;
    hash_elem_t * pNode,*pNewNode;
    if(hash_table == ((void *)0)){
        err_exit("hash_table_t is NULL\n");
    }
    key = HashInt(hash_table,data);
    if((pNode = hash_table->hash_tb[key]) == ((void *)0)){
        if((pNewNode = (hash_elem_t*)calloc(1,sizeof(hash_elem_t))) == ((void *)0)){
            err_exit("malloc error\n");
        }
        pNewNode->key.key = data;
        pNewNode->next = ((void *)0);
 hash_table->hash_tb[key] = pNewNode;
        printf("insert succeed \n");
        return TRUE;
    }
    if( (find_data_from_hash(hash_table,data)) ){
        printf("data %d exits in hash table\n",data);
        return FALSE;
    }
    for(; pNode->next; ) {
        pNode = pNode->next;
    }
    if( ( pNewNode = (hash_elem_t*)calloc(1,sizeof(hash_elem_t))) == ((void *)0)){
        err_exit("calloc error\n");
    }
    pNewNode->key.key = data;
    pNewNode->next = ((void *)0);
    pNode->next = pNewNode;
    printf("Insert Success\n");
    return TRUE;
}

canonical_original_code:
enum STATUS insert_data_into_hash(struct hash_table_s *hash_table, int data)
{
    unsigned long key;
    struct hash_elem_s *pNode; struct hash_elem_s *pNewNode;
    if(hash_table == ((void *)0)){
        err_exit("hash_table_t is NULL\n");
    }
    key = HashInt(hash_table,data);
    if((pNode = hash_table->hash_tb[key]) == ((void *)0)){
        if((pNewNode = (struct hash_elem_s *)calloc(1,sizeof(hash_elem_t))) == ((void *)0)){
            err_exit("malloc error\n");
        }
        pNewNode->key.key = data;
        pNewNode->next = ((void *)0);
 hash_table->hash_tb[key] = pNewNode;
        printf("insert succeed \n");
        return TRUE;
    }
    if( (find_data_from_hash(hash_table,data)) ){
        printf("data %d exits in hash table\n",data);
        return FALSE;
    }
    for(; pNode->next; ) {
        pNode = pNode->next;
    }
    if( ( pNewNode = (struct hash_elem_s *)calloc(1,sizeof(hash_elem_t))) == ((void *)0)){
        err_exit("calloc error\n");
    }
    pNewNode->key.key = data;
    pNewNode->next = ((void *)0);
    pNode->next = pNewNode;
    printf("Insert Success\n");
    return TRUE;
}

variable_types:
key
unsigned long

variable_types: struct hash_elem_s { struct hash_key_s { int key; } key; struct hash_elem_s *next; } *


decompiled_code:
__int64 __fastcall delete_data_from_hash(__int64 a1, unsigned int a2)
{
_QWORD *v2; // rbx
_QWORD *v3; // rax
_QWORD *v4; // rdi
_QWORD *v5; // rax
__int64 result; // rax

if ( a1 )
{
v2 = *(_QWORD **)(*(_QWORD *)(a1 + 8) + 8 * HashInt((_DWORD *)a1, a2));
if ( v2 && (v3 = (_QWORD *)find_data_from_hash(a1, a2), (v4 = v3) != 0LL) )
{
if ( v2 == v3 )
{
free(v3);
result = 1LL;
}
else
{
do
{
v5 = v2;
v2 = (_QWORD *)v2[1];
}
while ( v2 != v4 );
v5[1] = v4[1];
free(v4);
result = 1LL;
}
}
else
{
printf("when delete,NO Data:%d\n", a2);
result = 0LL;
}
}
else
{
puts("hashtb is NULL");
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, unsigned int a2)
{
_QWORD *v2; // rbx
_QWORD *v3; // rax
_QWORD *v4; // rdi
_QWORD *v5; // rax
__int64 result; // rax

if ( a1 )
{
v2 = *(_QWORD **)(*(_QWORD *)(a1 + 8) + 8 * func8((_DWORD *)a1, a2));
if ( v2 && (v3 = (_QWORD *)func9(a1, a2), (v4 = v3) != 0LL) )
{
if ( v2 == v3 )
{
free(v3);
result = 1LL;
}
else
{
do
{
v5 = v2;
v2 = (_QWORD *)v2[1];
}
while ( v2 != v4 );
v5[1] = v4[1];
free(v4);
result = 1LL;
}
}
else
{
printf("when delete,NO Data:%d\n", a2);
result = 0LL;
}
}
else
{
puts("hashtb is NULL");
result = 0LL;
}
return result;
}

original_code:
STATUS
delete_data_from_hash(hash_table_t * hash_table, int data)
{
    unsigned long key;
    hash_elem_t *pNode,*pLocNode;
    if(hash_table == ((void *)0)){
        printf("hashtb is NULL\n");
        return FALSE;
    }
    key = HashInt(hash_table,data);
    if((pNode = hash_table->hash_tb[key]) == ((void *)0)){
        printf("when delete,NO Data:%d\n",data);
        return FALSE;
    }
    if( (pLocNode = find_data_from_hash(hash_table,data)) ==FALSE){
        printf("when delete,NO Data:%d\n",data);
        return FALSE;
    }
    if(pLocNode == pNode){
        pNode->next = ((void *)0);
        free(pLocNode);
        return TRUE;
    }
    while(pNode->next != pLocNode){
        pNode = pNode->next;
    }
    pNode->next = pLocNode->next;
    free(pLocNode);
    return TRUE;
}

canonical_original_code:
enum STATUS delete_data_from_hash(struct hash_table_s *hash_table, int data)
{
    unsigned long key;
    struct hash_elem_s *pNode; struct hash_elem_s *pLocNode;
    if(hash_table == ((void *)0)){
        printf("hashtb is NULL\n");
        return FALSE;
    }
    key = HashInt(hash_table,data);
    if((pNode = hash_table->hash_tb[key]) == ((void *)0)){
        printf("when delete,NO Data:%d\n",data);
        return FALSE;
    }
    if( (pLocNode = find_data_from_hash(hash_table,data)) ==FALSE){
        printf("when delete,NO Data:%d\n",data);
        return FALSE;
    }
    if(pLocNode == pNode){
        pNode->next = ((void *)0);
        free(pLocNode);
        return TRUE;
    }
    while(pNode->next != pLocNode){
        pNode = pNode->next;
    }
    pNode->next = pLocNode->next;
    free(pLocNode);
    return TRUE;
}


decompiled_code:
__int64 __fastcall output_data_in_hash(__int64 a1)
{
int v1; // er14
__int64 v2; // rbp
unsigned int *i; // rbx

v1 = *(_DWORD *)a1;
if ( *(int *)a1 > 0 )
{
v2 = 0LL;
do
{
for ( i = *(unsigned int **)(*(_QWORD *)(a1 + 8) + 8 * v2); i; i = (unsigned int *)*((_QWORD *)i + 1) )
printf("data in hash_table[%d] : %d\n", (unsigned int)v2, *i);
++v2;
}
while ( v1 != v2 );
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
int v1; // er14
__int64 v2; // rbp
unsigned int *i; // rbx

v1 = *(_DWORD *)a1;
if ( *(int *)a1 > 0 )
{
v2 = 0LL;
do
{
for ( i = *(unsigned int **)(*(_QWORD *)(a1 + 8) + 8 * v2); i; i = (unsigned int *)*((_QWORD *)i + 1) )
printf("data in hash_table[%d] : %d\n", (unsigned int)v2, *i);
++v2;
}
while ( v1 != v2 );
}
return 1LL;
}

original_code:
STATUS
output_data_in_hash(hash_table_t * hash_table){
    int i,len;
    hash_elem_t *pNode;
    len = hash_table->hash_slot_number;
    for(i = 0;i < len;i++){
        if(hash_table->hash_tb[i] != ((void *)0))
            for(pNode = hash_table->hash_tb[i];pNode;pNode = pNode->next)
                printf("data in hash_table[%d] : %d\n",i,pNode->key.key);
    }
    return TRUE;
}

canonical_original_code:
enum STATUS output_data_in_hash(struct hash_table_s *hash_table){
    int i; int len;
    struct hash_elem_s *pNode;
    len = hash_table->hash_slot_number;
    for(i = 0;i < len;i++){
        if(hash_table->hash_tb[i] != ((void *)0))
            for(pNode = hash_table->hash_tb[i];pNode;pNode = pNode->next)
                printf("data in hash_table[%d] : %d\n",i,pNode->key.key);
    }
    return TRUE;
}

variable_types: i int

variable_types: len int


decompiled_code:
void __fastcall hash_table_free(void *ptr)
{
__int64 v2; // r12
__int64 v3; // rbp
_QWORD *v4; // rbx
void *v5; // rdi

if ( *(int *)ptr > 0 )
{
v2 = 8LL * *(unsigned int *)ptr;
v3 = 0LL;
do
{
v4 = *(_QWORD **)(*((_QWORD *)ptr + 1) + v3);
while ( v4 )
{
v5 = v4;
v4 = (_QWORD *)v4[1];
free(v5);
}
v3 += 8LL;
}
while ( v2 != v3 );
}
free(ptr);
}

canonical_decompiled_code:
void __fastcall func13(void *ptr)
{
__int64 v2; // r12
__int64 v3; // rbp
_QWORD *v4; // rbx
void *v5; // rdi

if ( *(int *)ptr > 0 )
{
v2 = 8LL * *(unsigned int *)ptr;
v3 = 0LL;
do
{
v4 = *(_QWORD **)(*((_QWORD *)ptr + 1) + v3);
while ( v4 )
{
v5 = v4;
v4 = (_QWORD *)v4[1];
free(v5);
}
v3 += 8LL;
}
while ( v2 != v3 );
}
free(ptr);
}

original_code:
void
hash_table_free(hash_table_t *hash_tb)
{
    int i,len;
    hash_elem_t *pNode, *tmp;
    len = hash_tb->hash_slot_number;
    for (i = 0; i < len; i++) {
        if(hash_tb->hash_tb[i] != ((void *)0)) {
            pNode = hash_tb->hash_tb[i];
            while(pNode) {
                ;
                tmp = pNode->next;
                free(pNode);
                pNode = tmp;
            }
        }
    }
    free(hash_tb);
}

canonical_original_code:
void hash_table_free(struct hash_table_s *hash_tb)
{
    int i; int len;
    struct hash_elem_s *pNode; struct hash_elem_s *tmp;
    len = hash_tb->hash_slot_number;
    for (i = 0; i < len; i++) {
        if(hash_tb->hash_tb[i] != ((void *)0)) {
            pNode = hash_tb->hash_tb[i];
            while(pNode) {
                ;
                tmp = pNode->next;
                free(pNode);
                pNode = tmp;
            }
        }
    }
    free(hash_tb);
}


decompiled_code:
void __noreturn err_exit(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
printf("%s:%d", "hash.c", 16LL);
vprintf(format, arg);
exit(0);
}

canonical_decompiled_code:
void __noreturn func7(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
printf("%s:%d", "hash.c", 16LL);
vprintf(format, arg);
exit(0);
}

original_code:
void
err_exit(char *fmt,...)
{
    va_list va;
    __builtin_va_start(va,fmt);
    printf("%s:%d","hash.c",16);
    vprintf(fmt,va);
    __builtin_va_end(va);
    exit(0);
}

canonical_original_code:
void err_exit(char *fmt, ...)
{
    __builtin_va_list va;
    __builtin_va_start(va,fmt);
    printf("%s:%d","hash.c",16);
    vprintf(fmt,va);
    __builtin_va_end(va);
    exit(0);
}


decompiled_code:
__int64 __fastcall find_data_from_hash(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx

v2 = *(_QWORD *)(a1 + 8);
if ( v2 )
{
v2 = *(_QWORD *)(v2 + 8 * HashInt((_DWORD *)a1, a2));
if ( v2 )
{
while ( *(_DWORD *)v2 != a2 )
{
v2 = *(_QWORD *)(v2 + 8);
if ( !v2 )
{
printf("NO Data :%d\n", a2);
return v2;
}
}
}
else
{
puts("NO CHAIN");
}
}
else
{
puts("EMPTY hash table");
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx

v2 = *(_QWORD *)(a1 + 8);
if ( v2 )
{
v2 = *(_QWORD *)(v2 + 8 * func8((_DWORD *)a1, a2));
if ( v2 )
{
while ( *(_DWORD *)v2 != a2 )
{
v2 = *(_QWORD *)(v2 + 8);
if ( !v2 )
{
printf("NO Data :%d\n", a2);
return v2;
}
}
}
else
{
puts("NO CHAIN");
}
}
else
{
puts("EMPTY hash table");
}
return v2;
}

original_code:
hash_elem_t*
find_data_from_hash(hash_table_t * hash_table,int data)
{
    unsigned long key;
    hash_elem_t *pNode;
    if(hash_table->hash_tb == ((void *)0)){
       printf("EMPTY hash table\n");
       return ((void *)0);
    }
    key = HashInt(hash_table,data);
    if((pNode = hash_table->hash_tb[key]) == ((void *)0)){
        printf("NO CHAIN\n");
        return ((void *)0);
    }
    for(; pNode; pNode = pNode->next){
        if(data == pNode->key.key){
            return pNode;
        }
    }
    printf("NO Data :%d\n",data);
    return ((void *)0);
}

canonical_original_code:
struct hash_elem_s *find_data_from_hash(struct hash_table_s *hash_table, int data)
{
    unsigned long key;
    struct hash_elem_s *pNode;
    if(hash_table->hash_tb == ((void *)0)){
       printf("EMPTY hash table\n");
       return ((void *)0);
    }
    key = HashInt(hash_table,data);
    if((pNode = hash_table->hash_tb[key]) == ((void *)0)){
        printf("NO CHAIN\n");
        return ((void *)0);
    }
    for(; pNode; pNode = pNode->next){
        if(data == pNode->key.key){
            return pNode;
        }
    }
    printf("NO Data :%d\n",data);
    return ((void *)0);
}

variable_types: struct hash_table_s { int hash_slot_number; struct hash_elem_s **hash_tb; } *

return_type: struct hash_elem_s { struct hash_key_s { int key; } key; struct hash_elem_s *next; } *


decompiled_code:
__int64 __fastcall printf_array(__int64 a1, int a2)
{
__int64 i; // rbx

if ( a2 <= 0 )
return 0LL;
for ( i = 0LL; i != a2; ++i )
printf("%dth:%d\n", (unsigned int)i, *(unsigned int *)(a1 + 4 * i));
return 0LL;
}

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

if ( a2 <= 0 )
return 0LL;
for ( i = 0LL; i != a2; ++i )
printf("%dth:%d\n", (unsigned int)i, *(unsigned int *)(a1 + 4 * i));
return 0LL;
}

original_code:
int printf_array(int *A, int len)
{
    int i;
    for(i = 0; i < len; i++) {
        printf("%dth:%d\n", i, A[i]);
    }
    return 0;
}

variable_types:
A
int *


quicksort

decompiled_code:
__int64 __fastcall quicksort(__int64 a1, int a2, int a3)
{
int v5; // ebp

if ( a2 < a3 )
{
v5 = partition(a1, a2, a3);
quicksort(a1, (unsigned int)a2, (unsigned int)(v5 - 1));
quicksort(a1, (unsigned int)(v5 + 1), (unsigned int)a3);
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, int a2, int a3)
{
int v5; // ebp

if ( a2 < a3 )
{
v5 = func9(a1, a2, a3);
func10(a1, (unsigned int)a2, (unsigned int)(v5 - 1));
func10(a1, (unsigned int)(v5 + 1), (unsigned int)a3);
}
return 0LL;
}

original_code:
int quicksort(int * A, int begin, int end)
{
    int p;
    if(begin < end) {
        p = partition(A, begin, end);
        quicksort(A, begin, p - 1);
        quicksort(A, p + 1, end);
    }
    return 0;
}

canonical_original_code:
int quicksort(int *A, int begin, int end)
{
    int p;
    if(begin < end) {
        p = partition(A, begin, end);
        quicksort(A, begin, p - 1);
        quicksort(A, p + 1, end);
    }
    return 0;
}

variable_types: begin int

variable_types: end int

variable_types: p int


swap

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

result = (unsigned int)*a1;
*a1 = *a2;
*a2 = result;
return result;
}

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

result = (unsigned int)*a1;
*a1 = *a2;
*a2 = result;
return result;
}

original_code:
void swap(int *a, int *b)
{
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

variable_types:
a
int *

variable_types:
b
int *

variable_types: tmp int


partition

original_code:
int partition(int * A, int begin, int end)
{
    int i,j;
    int x;
    i = begin - 1;
    x = A[end];
    for(j = begin; j < end; j++) {
        if(A[j] < x){
            i = i + 1;
            swap(A + i, A + j);
        }
    }
    swap(A + i + 1, A + end);
    return (i+1);
}

canonical_original_code:
int partition(int *A, int begin, int end)
{
    int i; int j;
    int x;
    i = begin - 1;
    x = A[end];
    for(j = begin; j < end; j++) {
        if(A[j] < x){
            i = i + 1;
            swap(A + i, A + j);
        }
    }
    swap(A + i + 1, A + end);
    return (i+1);
}

variable_types: j int

variable_types: x int


canonical_original_code:
int printf_array(int *A, int len)
{
    int i;
    for(i = 0; i < len; i++) {
        printf("%dth:%d\n", i, A[i]);
    }
    return 0;
}


original_code:
int bubble_sort(int *array,int len)
{
    int i,j;
    for(i = 0; i < len; i++) {
        for(j = 0; j < len - i -1; j++) {
            if (array[j] > array[j+1]) {
                swap(array+j+1,array+j);
            }
        }
    }
    return 0;
}

canonical_original_code:
int bubble_sort(int *array, int len)
{
    int i; int j;
    for(i = 0; i < len; i++) {
        for(j = 0; j < len - i -1; j++) {
            if (array[j] > array[j+1]) {
                swap(array+j+1,array+j);
            }
        }
    }
    return 0;
}

variable_types:
array
int *


swap

original_code:
void swap(int *a, int *b)
{
    int tmp ;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

canonical_original_code:
void swap(int *a, int *b)
{
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}


original_code:
int insertion_sort(int *A, int len)
{
    int i, j;
    int tmp;
    for (i = 1; i < len; i++) {
        tmp = A[i];
        for(j = i; j > 0; j--){
            if(tmp < A[j-1]){
                A[j] = A[j-1];
            }else{
                break;
            }
        }
        A[j] = tmp;
    }
    return 0;
}

canonical_original_code:
int insertion_sort(int *A, int len)
{
    int i; int j;
    int tmp;
    for (i = 1; i < len; i++) {
        tmp = A[i];
        for(j = i; j > 0; j--){
            if(tmp < A[j-1]){
                A[j] = A[j-1];
            }else{
                break;
            }
        }
        A[j] = tmp;
    }
    return 0;
}


repo: yanshuyuan/siteanalyzer

decompiled_code:
__int64 __fastcall sax_hash(unsigned __int8 *a1, __int64 a2)
{
unsigned __int8 *v2; // rsi
unsigned int v3; // edx

if ( !a2 )
return 0;
v2 = &a1[a2];
v3 = 0;
do
v3 ^= *a1++ + (v3 >> 2) + 32 * v3;
while ( v2 != a1 );
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int8 *a1, __int64 a2)
{
unsigned __int8 *v2; // rsi
unsigned int v3; // edx

if ( !a2 )
return 0;
v2 = &a1[a2];
v3 = 0;
do
v3 ^= *a1++ + (v3 >> 2) + 32 * v3;
while ( v2 != a1 );
return v3;
}

original_code:
unsigned int sax_hash(const char *key, size_t bytes)
{
    unsigned int h=0;
    while(bytes--) {
 h ^= (h<<5)+(h>>2)+(unsigned char)*key++;
    }
    return h;
}

canonical_original_code:
unsigned int sax_hash(char *key, unsigned long bytes)
{
    unsigned int h = 0;
    while(bytes--) {
 h ^= (h<<5)+(h>>2)+(unsigned char)*key++;
    }
    return h;
}

variable_types:
key
char *

variable_types:
bytes
unsigned long

variable_types:
h
unsigned int


decompiled_code:
__int64 __fastcall sdbm_hash(unsigned __int8 *a1, __int64 a2)
{
unsigned __int8 *v2; // rsi
__int64 result; // rax

if ( !a2 )
return 0LL;
v2 = &a1[a2];
LODWORD(result) = 0;
do
result = (unsigned int)*a1++ + 65599 * (_DWORD)result;
while ( v2 != a1 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int8 *a1, __int64 a2)
{
unsigned __int8 *v2; // rsi
__int64 result; // rax

if ( !a2 )
return 0LL;
v2 = &a1[a2];
LODWORD(result) = 0;
do
result = (unsigned int)*a1++ + 65599 * (_DWORD)result;
while ( v2 != a1 );
return result;
}

original_code:
unsigned int sdbm_hash(const char *key, size_t bytes)
{
    unsigned int h=0;
    while(bytes--) {
  h=(unsigned char)*key++ + (h<<6) + (h<<16) - h;
    }
    return h;
}

canonical_original_code:
unsigned int sdbm_hash(char *key, unsigned long bytes)
{
    unsigned int h = 0;
    while(bytes--) {
  h=(unsigned char)*key++ + (h<<6) + (h<<16) - h;
    }
    return h;
}


decompiled_code:
__int64 __fastcall elf_hash(char *a1, __int64 a2)
{
char *v2; // rsi
__int64 result; // rax

if ( !a2 )
return 0LL;
v2 = &a1[a2];
LODWORD(result) = 0;
do
{
result = (unsigned int)(*a1++ + 16 * result);
if ( (result & 0xF0000000) != 0 )
result = ~(result & 0xF0000000) & ((((unsigned int)result & 0xF0000000) >> 24) ^ (unsigned int)result);
}
while ( v2 != a1 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(char *a1, __int64 a2)
{
char *v2; // rsi
__int64 result; // rax

if ( !a2 )
return 0LL;
v2 = &a1[a2];
LODWORD(result) = 0;
do
{
result = (unsigned int)(*a1++ + 16 * result);
if ( (result & 0xF0000000) != 0 )
result = ~(result & 0xF0000000) & ((((unsigned int)result & 0xF0000000) >> 24) ^ (unsigned int)result);
}
while ( v2 != a1 );
return result;
}

original_code:
unsigned int elf_hash(const char *str, size_t bytes)
{
    unsigned int hash = 0;
    unsigned int x = 0;
    while (bytes--) {
        hash = (hash << 4) + (*str++);
        if((x = hash & 0xF0000000L) != 0) {
            hash ^= (x >> 24);
            hash &= ~x;
        }
    }
    return hash;
}

canonical_original_code:
unsigned int elf_hash(char *str, unsigned long bytes)
{
    unsigned int hash = 0;
    unsigned int x = 0;
    while (bytes--) {
        hash = (hash << 4) + (*str++);
        if((x = hash & 0xF0000000L) != 0) {
            hash ^= (x >> 24);
            hash &= ~x;
        }
    }
    return hash;
}

variable_types:
str
char *

variable_types:
hash
unsigned int

variable_types:
x
unsigned int


decompiled_code:
__int64 __fastcall djb_hash(char *a1, __int64 a2)
{
char *v2; // rsi
unsigned int v3; // edx

if ( !a2 )
return 5381;
v2 = &a1[a2];
v3 = 5381;
do
v3 += *a1++ + 32 * v3;
while ( v2 != a1 );
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func3(char *a1, __int64 a2)
{
char *v2; // rsi
unsigned int v3; // edx

if ( !a2 )
return 5381;
v2 = &a1[a2];
v3 = 5381;
do
v3 += *a1++ + 32 * v3;
while ( v2 != a1 );
return v3;
}

original_code:
unsigned int djb_hash(const char * str, size_t bytes)
{
    unsigned int hash = 5381 ;
    while(bytes--) {
        hash += (hash << 5) + (*str++ );
    }
    return hash;
}

canonical_original_code:
unsigned int djb_hash(char *str, unsigned long bytes)
{
    unsigned int hash = 5381;
    while(bytes--) {
        hash += (hash << 5) + (*str++ );
    }
    return hash;
}


decompiled_code:
__int64 __fastcall bkdr_hash(char *a1, __int64 a2)
{
char *v2; // rsi
__int64 result; // rax

if ( !a2 )
return 0LL;
v2 = &a1[a2];
LODWORD(result) = 0;
do
result = (unsigned int)(*a1++ + 131 * result);
while ( v2 != a1 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(char *a1, __int64 a2)
{
char *v2; // rsi
__int64 result; // rax

if ( !a2 )
return 0LL;
v2 = &a1[a2];
LODWORD(result) = 0;
do
result = (unsigned int)(*a1++ + 131 * result);
while ( v2 != a1 );
return result;
}

original_code:
unsigned int bkdr_hash(const char * str, size_t bytes)
{
    unsigned int seed = 131 ;
    unsigned int hash = 0 ;
    while(bytes--) {
        hash = hash * seed + (*str++);
    }
    return hash;
}

canonical_original_code:
unsigned int bkdr_hash(char *str, unsigned long bytes)
{
    unsigned int seed = 131;
    unsigned int hash = 0;
    while(bytes--) {
        hash = hash * seed + (*str++);
    }
    return hash;
}

variable_types:
seed
unsigned int


original_code:
unsigned int js_hash(const char *str, size_t bytes)
{
    unsigned int hash = 1315423911;
    while(bytes--) {
        hash^=((hash << 5) + (*str++) + (hash >> 2));
    }
    return hash;
}

canonical_original_code:
unsigned int js_hash(char *str, unsigned long bytes)
{
    unsigned int hash = 1315423911;
    while(bytes--) {
        hash^=((hash << 5) + (*str++) + (hash >> 2));
    }
    return hash;
}


decompiled_code:
int __fastcall thread_init(__int64 a1)
{
*(_QWORD *)a1 = 0LL;
*(_DWORD *)(a1 + 96) = -1;
*(_DWORD *)(a1 + 100) = 0;
thread_counter_init(a1 + 48);
return pthread_mutex_init((pthread_mutex_t *)(a1 + 8), 0LL);
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1)
{
*(_QWORD *)a1 = 0LL;
*(_DWORD *)(a1 + 96) = -1;
*(_DWORD *)(a1 + 100) = 0;
thread_counter_init(a1 + 48);
return pthread_mutex_init((pthread_mutex_t *)(a1 + 8), 0LL);
}

original_code:
void thread_init(thread_t *thread_item)
{
    thread_item->threadinfo = 0;
    thread_item->id = -1;
    thread_item->idle = 0;
    thread_counter_init(&thread_item->job_done);
    pthread_mutex_init(&thread_item->waitlock, ((void *)0));
}

canonical_original_code:
void thread_init(struct _thread *thread_item)
{
    thread_item->threadinfo = 0;
    thread_item->id = -1;
    thread_item->idle = 0;
    thread_counter_init(&thread_item->job_done);
    pthread_mutex_init(&thread_item->waitlock, ((void *)0));
}

variable_types: struct _thread { unsigned long threadinfo; union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } waitlock; struct _thread_count { int count; union pthread_mutex_t lock; } job_done; int id; int idle; } *

user_defined_types: struct _thread { unsigned long threadinfo; union pthread_mutex_t waitlock; struct _thread_count job_done; int id; int idle; }

user_defined_types: union pthread_mutex_t { struct __pthread_mutex_s __data; char __size[40]; long __align; }

user_defined_types: struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list __list; }


decompiled_code:
int __fastcall thread_destroy(__int64 a1)
{
thread_counter_destroy(a1 + 48);
return pthread_mutex_destroy((pthread_mutex_t *)(a1 + 8));
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1)
{
thread_counter_destroy(a1 + 48);
return pthread_mutex_destroy((pthread_mutex_t *)(a1 + 8));
}

original_code:
void thread_destroy(thread_t *thread_item)
{
    thread_counter_destroy(&thread_item->job_done);
    pthread_mutex_destroy(&thread_item->waitlock);
}

canonical_original_code:
void thread_destroy(struct _thread *thread_item)
{
    thread_counter_destroy(&thread_item->job_done);
    pthread_mutex_destroy(&thread_item->waitlock);
}

user_defined_types: struct _thread_count { int count; union pthread_mutex_t lock; }

user_defined_types: struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; }


decompiled_code:
int __fastcall thread_set_idle(__int64 a1, int a2)
{
pthread_mutex_lock((pthread_mutex_t *)(a1 + 8));
*(_DWORD *)(a1 + 100) = a2;
return pthread_mutex_unlock((pthread_mutex_t *)(a1 + 8));
}

canonical_decompiled_code:
int __fastcall func2(__int64 a1, int a2)
{
pthread_mutex_lock((pthread_mutex_t *)(a1 + 8));
*(_DWORD *)(a1 + 100) = a2;
return pthread_mutex_unlock((pthread_mutex_t *)(a1 + 8));
}

original_code:
void thread_set_idle(thread_t *thread_item, int idle)
{
    pthread_mutex_lock(&thread_item->waitlock);
    thread_item->idle = idle;
    pthread_mutex_unlock(&thread_item->waitlock);
}

canonical_original_code:
void thread_set_idle(struct _thread *thread_item, int idle)
{
    pthread_mutex_lock(&thread_item->waitlock);
    thread_item->idle = idle;
    pthread_mutex_unlock(&thread_item->waitlock);
}

variable_types: idle int


decompiled_code:
__int64 __fastcall thread_get_idle(__int64 a1)
{
unsigned int v1; // ebx

pthread_mutex_lock((pthread_mutex_t *)(a1 + 8));
v1 = *(_DWORD *)(a1 + 100);
pthread_mutex_unlock((pthread_mutex_t *)(a1 + 8));
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
unsigned int v1; // ebx

pthread_mutex_lock((pthread_mutex_t *)(a1 + 8));
v1 = *(_DWORD *)(a1 + 100);
pthread_mutex_unlock((pthread_mutex_t *)(a1 + 8));
return v1;
}

original_code:
int thread_get_idle(thread_t *thread_item)
{
    int idle;
    pthread_mutex_lock(&thread_item->waitlock);
    idle = thread_item->idle;
    pthread_mutex_unlock(&thread_item->waitlock);
    return idle;
}

canonical_original_code:
int thread_get_idle(struct _thread *thread_item)
{
    int idle;
    pthread_mutex_lock(&thread_item->waitlock);
    idle = thread_item->idle;
    pthread_mutex_unlock(&thread_item->waitlock);
    return idle;
}


decompiled_code:
int __fastcall thread_join(pthread_t *a1)
{
return pthread_join(*a1, 0LL);
}

canonical_decompiled_code:
int __fastcall func4(pthread_t *a1)
{
return pthread_join(*a1, 0LL);
}

original_code:
void thread_join(thread_t *thread_item)
{
    pthread_join(thread_item->threadinfo, ((void *)0));
}

canonical_original_code:
void thread_join(struct _thread *thread_item)
{
    pthread_join(thread_item->threadinfo, ((void *)0));
}


decompiled_code:
int __fastcall thread_create(pthread_t *a1, const pthread_attr_t *a2, void *(*a3)(void *), void *a4)
{
return pthread_create(a1, a2, a3, a4);
}

canonical_decompiled_code:
int __fastcall func5(pthread_t *a1, const pthread_attr_t *a2, void *(*a3)(void *), void *a4)
{
return pthread_create(a1, a2, a3, a4);
}

original_code:
int thread_create(thread_t *thread_item, const thread_attr_t *attr, void *(*start_routine) (void *), void *arg)
{
    return pthread_create(&thread_item->threadinfo, attr, start_routine, arg);
}

canonical_original_code:
int thread_create(struct _thread *thread_item, union pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
{
    return pthread_create(&thread_item->threadinfo, attr, start_routine, arg);
}

variable_types: union pthread_attr_t { char __size[56]; long __align; } *

variable_types:
arg
void *


original_code:
void queue_init(queue_t *q)
{
   q->meta.len = 0;
   q->meta.next = ((void *)0);
   q->head = &q->meta;
   q->tail = q->head;
}

canonical_original_code:
void queue_init(struct _queue *q)
{
   q->meta.len = 0;
   q->meta.next = ((void *)0);
   q->head = &q->meta;
   q->tail = q->head;
}

variable_types: struct _queue { struct _elem { struct _elem *next; int len; char buffer[]; } meta; struct _elem *head; struct _elem *tail; } *

user_defined_types: struct _queue { struct _elem meta; struct _elem *head; struct _elem *tail; }


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

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

original_code:
int queue_size(queue_t *q)
{
    return q->meta.len;
}

canonical_original_code:
int queue_size(struct _queue *q)
{
    return q->meta.len;
}

user_defined_types: struct _elem { struct _elem *next; int len; char buffer[]; }


decompiled_code:
__int64 __fastcall queue_front(__int64 a1)
{
return **(_QWORD **)(a1 + 16) + 12LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
return **(_QWORD **)(a1 + 16) + 12LL;
}

original_code:
const void *queue_front(queue_t *q)
{
    return q->head->next->buffer;
}

canonical_original_code:
void *queue_front(struct _queue *q)
{
    return q->head->next->buffer;
}

return_type: void *


decompiled_code:
__int64 __fastcall queue_pop(__int64 a1)
{
_QWORD **v2; // rax
_QWORD *v3; // rdi
__int64 result; // rax

v2 = *(_QWORD ***)(a1 + 16);
v3 = *v2;
*v2 = (_QWORD *)**v2;
free(v3);
result = (unsigned int)(*(_DWORD *)(a1 + 8) - 1);
*(_DWORD *)(a1 + 8) = result;
if ( !(_DWORD)result )
*(_QWORD *)(a1 + 24) = a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
_QWORD **v2; // rax
_QWORD *v3; // rdi
__int64 result; // rax

v2 = *(_QWORD ***)(a1 + 16);
v3 = *v2;
*v2 = (_QWORD *)**v2;
free(v3);
result = (unsigned int)(*(_DWORD *)(a1 + 8) - 1);
*(_DWORD *)(a1 + 8) = result;
if ( !(_DWORD)result )
*(_QWORD *)(a1 + 24) = a1;
return result;
}

original_code:
void queue_pop(queue_t *q)
{
    elem_t *_p_elem = q->head->next;
    q->head->next = _p_elem->next;
    free(_p_elem);
    q->meta.len--;
    if(q->meta.len == 0) { q->tail = &q->meta; }
}

canonical_original_code:
void queue_pop(struct _queue *q)
{
    struct _elem *_p_elem = q->head->next;
    q->head->next = _p_elem->next;
    free(_p_elem);
    q->meta.len--;
    if(q->meta.len == 0) { q->tail = &q->meta; }
}

variable_types: struct _elem { struct _elem *next; int len; char buffer[]; } *


decompiled_code:
__int64 __fastcall queue_top(__int64 a1, void *a2)
{
memcpy(a2, (const void *)(**(_QWORD **)(a1 + 16) + 12LL), *(int *)(**(_QWORD **)(a1 + 16) + 8LL));
return queue_pop(a1);
}

original_code:
void queue_top(queue_t *q, void *element)
{
    elem_t *_p_elem = q->head->next;
    memcpy(element, _p_elem->buffer, _p_elem->len);
    queue_pop(q);
}

canonical_original_code:
void queue_top(struct _queue *q, void *element)
{
    struct _elem *_p_elem = q->head->next;
    memcpy(element, _p_elem->buffer, _p_elem->len);
    queue_pop(q);
}

variable_types:
element
void *


decompiled_code:
__int64 __fastcall ts_queue_init(pthread_mutex_t *a1)
{
pthread_mutex_init(a1, 0LL);
return queue_init(&a1[1]);
}

canonical_decompiled_code:
__int64 __fastcall func0(pthread_mutex_t *a1)
{
pthread_mutex_init(a1, 0LL);
return queue_init(&a1[1]);
}

original_code:
void ts_queue_init(ts_queue_t *ts_queue)
{
    pthread_mutex_init(&ts_queue->mutex_lock, ((void *)0));
    queue_init(&ts_queue->queue);
}

canonical_original_code:
void ts_queue_init(struct _thread_safe_queue *ts_queue)
{
    pthread_mutex_init(&ts_queue->mutex_lock, ((void *)0));
    queue_init(&ts_queue->queue);
}

variable_types: struct _thread_safe_queue { union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } mutex_lock; struct _queue { struct _elem { struct _elem *next; int len; char buffer[]; } meta; struct _elem *head; struct _elem *tail; } queue; } *

user_defined_types: struct _thread_safe_queue { union pthread_mutex_t mutex_lock; struct _queue queue; }


decompiled_code:
__int64 __fastcall ts_queue_destroy(pthread_mutex_t *a1)
{
pthread_mutex_destroy(a1);
return queue_destroy(&a1[1]);
}

canonical_decompiled_code:
__int64 __fastcall func1(pthread_mutex_t *a1)
{
pthread_mutex_destroy(a1);
return queue_destroy(&a1[1]);
}

original_code:
void ts_queue_destroy(ts_queue_t *ts_queue)
{
    pthread_mutex_destroy(&ts_queue->mutex_lock);
    queue_destroy(&ts_queue->queue);
}

canonical_original_code:
void ts_queue_destroy(struct _thread_safe_queue *ts_queue)
{
    pthread_mutex_destroy(&ts_queue->mutex_lock);
    queue_destroy(&ts_queue->queue);
}


decompiled_code:
int __fastcall ts_queue_push(pthread_mutex_t *a1, __int64 a2, __int64 a3)
{
queue_lock(a1);
queue_push(&a1[1], a2, a3);
return queue_unlock(a1);
}

canonical_decompiled_code:
int __fastcall func4(pthread_mutex_t *a1, __int64 a2, __int64 a3)
{
func2(a1);
queue_push(&a1[1], a2, a3);
return func3(a1);
}

original_code:
void ts_queue_push(ts_queue_t *ts_queue, void *element, size_t bytes)
{
    _queue_lock(ts_queue);
    queue_push(&ts_queue->queue, element, bytes);
    _queue_unlock(ts_queue);
}

canonical_original_code:
void ts_queue_push(struct _thread_safe_queue *ts_queue, void *element, unsigned long bytes)
{
    _queue_lock(ts_queue);
    queue_push(&ts_queue->queue, element, bytes);
    _queue_unlock(ts_queue);
}


decompiled_code:
int __fastcall ts_queue_pop(pthread_mutex_t *a1)
{
queue_lock(a1);
queue_pop(&a1[1]);
return queue_unlock(a1);
}

canonical_decompiled_code:
int __fastcall func5(pthread_mutex_t *a1)
{
func2(a1);
queue_pop(&a1[1]);
return func3(a1);
}

original_code:
void ts_queue_pop(ts_queue_t *ts_queue)
{
    _queue_lock(ts_queue);
    queue_pop(&ts_queue->queue);
    _queue_unlock(ts_queue);
}

canonical_original_code:
void ts_queue_pop(struct _thread_safe_queue *ts_queue)
{
    _queue_lock(ts_queue);
    queue_pop(&ts_queue->queue);
    _queue_unlock(ts_queue);
}


decompiled_code:
__int64 __fastcall ts_queue_front(pthread_mutex_t *a1)
{
__int64 v1; // rbp

queue_lock(a1);
v1 = queue_front(&a1[1]);
queue_unlock(a1);
return v1;
}

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

func2(a1);
v1 = queue_front(&a1[1]);
func3(a1);
return v1;
}

original_code:
const void *ts_queue_front(ts_queue_t *ts_queue)
{
    const void *elem = ((void *)0);
    _queue_lock(ts_queue);
    elem = queue_front(&ts_queue->queue);
    _queue_unlock(ts_queue);
    return elem;
}

canonical_original_code:
void *ts_queue_front(struct _thread_safe_queue *ts_queue)
{
    void *elem = ((void *)0);
    _queue_lock(ts_queue);
    elem = queue_front(&ts_queue->queue);
    _queue_unlock(ts_queue);
    return elem;
}

variable_types:
elem
void *


decompiled_code:
int __fastcall ts_queue_top(pthread_mutex_t *a1, __int64 a2)
{
queue_lock(a1);
queue_top(&a1[1], a2);
return queue_unlock(a1);
}

canonical_decompiled_code:
int __fastcall func7(pthread_mutex_t *a1, __int64 a2)
{
func2(a1);
queue_top(&a1[1], a2);
return func3(a1);
}

original_code:
void ts_queue_top(ts_queue_t *ts_queue, void *element)
{
    _queue_lock(ts_queue);
    queue_top(&ts_queue->queue, element);
    _queue_unlock(ts_queue);
}

canonical_original_code:
void ts_queue_top(struct _thread_safe_queue *ts_queue, void *element)
{
    _queue_lock(ts_queue);
    queue_top(&ts_queue->queue, element);
    _queue_unlock(ts_queue);
}


decompiled_code:
int __fastcall ts_queue_clear(pthread_mutex_t *a1)
{
queue_lock(a1);
queue_clear(&a1[1]);
return queue_unlock(a1);
}

canonical_decompiled_code:
int __fastcall func8(pthread_mutex_t *a1)
{
func2(a1);
queue_clear(&a1[1]);
return func3(a1);
}

original_code:
void ts_queue_clear(ts_queue_t *ts_queue)
{
    _queue_lock(ts_queue);
    queue_clear(&ts_queue->queue);
    _queue_unlock(ts_queue);
}

canonical_original_code:
void ts_queue_clear(struct _thread_safe_queue *ts_queue)
{
    _queue_lock(ts_queue);
    queue_clear(&ts_queue->queue);
    _queue_unlock(ts_queue);
}


decompiled_code:
__int64 __fastcall ts_queue_size(pthread_mutex_t *a1)
{
unsigned int v1; // ebp

queue_lock(a1);
v1 = queue_size(&a1[1]);
queue_unlock(a1);
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func9(pthread_mutex_t *a1)
{
unsigned int v1; // ebp

func2(a1);
v1 = queue_size(&a1[1]);
func3(a1);
return v1;
}

original_code:
int ts_queue_size(ts_queue_t *ts_queue)
{
    int size;
    _queue_lock(ts_queue);
    size = queue_size(&ts_queue->queue);
    _queue_unlock(ts_queue);
    return size;
}

canonical_original_code:
int ts_queue_size(struct _thread_safe_queue *ts_queue)
{
    int size;
    _queue_lock(ts_queue);
    size = queue_size(&ts_queue->queue);
    _queue_unlock(ts_queue);
    return size;
}

variable_types: size int


decompiled_code:
__int64 __fastcall http_connect(__int64 a1, const char *a2, unsigned int a3)
{
http_request_init(a1 + 41232);
http_response_init(a1 + 46136);
strcpy((char *)(a1 + 45608), a2);
return open_tcp(a1, a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, const char *a2, unsigned int a3)
{
http_request_init(a1 + 41232);
http_response_init(a1 + 46136);
strcpy((char *)(a1 + 45608), a2);
return open_tcp(a1, a2, a3);
}

original_code:
int http_connect(http_client_t *http_client, char *hostname, int port)
{
    http_request_init(&http_client->request);
    http_response_init(&http_client->response);
    sprintf(http_client->request.req_header.host, "%s", hostname);
    return open_tcp(&http_client->connection, hostname, port);
}

canonical_original_code:
int http_connect(struct _http_client *http_client, char *hostname, int port)
{
    http_request_init(&http_client->request);
    http_response_init(&http_client->response);
    sprintf(http_client->request.req_header.host, "%s", hostname);
    return open_tcp(&http_client->connection, hostname, port);
}

variable_types: struct _http_client { struct _network { int socketfd; char host[256]; int port; int len; char buffer[-1]; } connection; struct _http_request { struct _http_request_line { char method[8]; char request_uri[4096]; char http_version[16]; } req_line; struct _http_general_header { char date[128]; } gen_header; struct _http_request_header { char user_agent[128]; char host[128]; char accept[128]; } req_header; struct _http_entity_header { char content_length[128]; char content_type[128]; } enti_header; struct _http_entity_body { int used; int len; char *buffer; } enti_body; } request; struct _http_response { struct _http_response_line { char http_version[16]; char status_code[8]; char reason_phrase[64]; } res_line; struct _http_general_header gen_header; struct _http_response_header { char server[128]; } res_header; struct _http_entity_header enti_header; struct _http_entity_body enti_body; } response; } *

variable_types:
hostname
char *

variable_types: port int

user_defined_types: struct _http_client { struct _network connection; struct _http_request request; struct _http_response response; }

user_defined_types: struct _http_request { struct _http_request_line req_line; struct _http_general_header gen_header; struct _http_request_header req_header; struct _http_entity_header enti_header; struct _http_entity_body enti_body; }

user_defined_types: struct _http_response { struct _http_response_line res_line; struct _http_general_header gen_header; struct _http_response_header res_header; struct _http_entity_header enti_header; struct _http_entity_body enti_body; }