Dataset Viewer
Auto-converted to Parquet
binary_hash
stringlengths
64
64
repo
stringlengths
6
62
call_graph
sequencelengths
0
76
unmatched_functions
sequencelengths
0
58
matched_functions
listlengths
0
71
b4ca878814688fbbed613b25e0ec3149400ebd527ca5d4985600b3e79a658462
norlanliu/data-structure
[ [ "enqueue", "->" ], [ "percolate_down", "->", "dequeue" ], [ "dequeue", "->", "percolate_down" ], [ "free_queue", "->" ] ]
[]
[ { "name": "percolate_down", "canonical_name": "func1", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall percolate_down(__int64 a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+0h] [rbp-1Ch]\nint v4; // [rsp+10h] [rbp-Ch]\nunsigned int v5; // [rsp+14h] [rbp-8h]\nint v6; // [rsp+18h] [rbp-4h]\n\nv3 = a2;\nv5 = *(_DWORD *)(*(_QWORD *)a1 + 4LL * a2);\nv4 = *(_DWORD *)(a1 + 8) / 2;\nwhile ( v3 <= v4 )\n{\nv6 = 2 * v3;\nif ( *(_DWORD *)(*(_QWORD *)a1 + 8LL * v3) > *(_DWORD *)(*(_QWORD *)a1 + 4 * (2 * v3 + 1LL)) )\n++v6;\nif ( (signed int)v5 <= *(_DWORD *)(*(_QWORD *)a1 + 4LL * v6) )\nbreak;\n*(_DWORD *)(4LL * v3 + *(_QWORD *)a1) = *(_DWORD *)(*(_QWORD *)a1 + 4LL * v6);\nv3 = v6;\n}\nresult = v5;\n*(_DWORD *)(4LL * v3 + *(_QWORD *)a1) = v5;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+0h] [rbp-1Ch]\nint v4; // [rsp+10h] [rbp-Ch]\nunsigned int v5; // [rsp+14h] [rbp-8h]\nint v6; // [rsp+18h] [rbp-4h]\n\nv3 = a2;\nv5 = *(_DWORD *)(*(_QWORD *)a1 + 4LL * a2);\nv4 = *(_DWORD *)(a1 + 8) / 2;\nwhile ( v3 <= v4 )\n{\nv6 = 2 * v3;\nif ( *(_DWORD *)(*(_QWORD *)a1 + 8LL * v3) > *(_DWORD *)(*(_QWORD *)a1 + 4 * (2 * v3 + 1LL)) )\n++v6;\nif ( (signed int)v5 <= *(_DWORD *)(*(_QWORD *)a1 + 4LL * v6) )\nbreak;\n*(_DWORD *)(4LL * v3 + *(_QWORD *)a1) = *(_DWORD *)(*(_QWORD *)a1 + 4LL * v6);\nv3 = v6;\n}\nresult = v5;\n*(_DWORD *)(4LL * v3 + *(_QWORD *)a1) = v5;\nreturn result;\n}", "original_code": "static void percolate_down(priority_queue *queue, int hole)\n{\n item_type temp = queue->item[hole];\n int child;\n int length = queue->length / 2;\n for(; hole <= length; hole = child)\n {\n child = 2 * hole;\n if(queue->item[child] > queue->item[child+1])\n child++;\n if(queue->item[child] < temp)\n queue->item[hole] = queue->item[child];\n else\n break;\n }\n queue->item[hole] = temp;\n}", "canonical_original_code": "static void percolate_down(struct priority_queue *queue, int hole)\n{\n int temp = queue->item[hole];\n int child;\n int length = queue->length / 2;\n for(; hole <= length; hole = child)\n {\n child = 2 * hole;\n if(queue->item[child] > queue->item[child+1])\n child++;\n if(queue->item[child] < temp)\n queue->item[hole] = queue->item[child];\n else\n break;\n }\n queue->item[hole] = temp;\n}", "variable_types": [ [ "queue", "struct priority_queue { int *item; int length; int capability; } *" ], [ "hole", "int" ], [ "temp", "int" ], [ "child", "int" ], [ "length", "int" ] ], "return_type": "void", "user_defined_types": [ "struct priority_queue { int *item; int length; int capability; }" ], "binary_hash": "b4ca878814688fbbed613b25e0ec3149400ebd527ca5d4985600b3e79a658462" }, { "name": "free_queue", "canonical_name": "func3", "repo": "norlanliu/data-structure", "decompiled_code": "void __fastcall free_queue(void **a1)\n{\nfree(*a1);\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func3(void **a1)\n{\nfree(*a1);\nfree(a1);\n}", "original_code": "void free_queue(priority_queue *queue)\n{\n free(queue->item);\n free(queue);\n queue = ((void *)0);\n}", "canonical_original_code": "void free_queue(struct priority_queue *queue)\n{\n free(queue->item);\n free(queue);\n queue = ((void *)0);\n}", "variable_types": [ [ "queue", "struct priority_queue { int *item; int length; int capability; } *" ] ], "return_type": "void", "user_defined_types": [ "struct priority_queue { int *item; int length; int capability; }" ], "binary_hash": "b4ca878814688fbbed613b25e0ec3149400ebd527ca5d4985600b3e79a658462" }, { "name": "enqueue", "canonical_name": "func0", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall enqueue(__int64 a1, unsigned int a2)\n{\n__int64 result; // rax\nvoid *ptr; // [rsp+18h] [rbp-18h]\n_DWORD *v4; // [rsp+20h] [rbp-10h]\nint j; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nif ( (float)(*(float *)&threshold * (float)*(int *)(a1 + 12)) > (float)*(int *)(a1 + 8) )\n{\n*(_DWORD *)(a1 + 12) *= 2;\nv4 = malloc(4LL * *(int *)(a1 + 12));\nfor ( i = 1; i <= *(_DWORD *)(a1 + 8); ++i )\nv4[i] = *(_DWORD *)(*(_QWORD *)a1 + 4LL * i);\nptr = *(void **)a1;\n*(_QWORD *)a1 = v4;\nfree(ptr);\n}\nfor ( j = ++*(_DWORD *)(a1 + 8); j > 1 && (signed int)a2 < *(_DWORD *)(*(_QWORD *)a1 + 4LL * (j / 2)); j /= 2 )\n*(_DWORD *)(4LL * j + *(_QWORD *)a1) = *(_DWORD *)(*(_QWORD *)a1 + 4LL * (j / 2));\nresult = a2;\n*(_DWORD *)(4LL * j + *(_QWORD *)a1) = a2;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, unsigned int a2)\n{\n__int64 result; // rax\nvoid *ptr; // [rsp+18h] [rbp-18h]\n_DWORD *v4; // [rsp+20h] [rbp-10h]\nint j; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nif ( (float)(*(float *)&threshold * (float)*(int *)(a1 + 12)) > (float)*(int *)(a1 + 8) )\n{\n*(_DWORD *)(a1 + 12) *= 2;\nv4 = malloc(4LL * *(int *)(a1 + 12));\nfor ( i = 1; i <= *(_DWORD *)(a1 + 8); ++i )\nv4[i] = *(_DWORD *)(*(_QWORD *)a1 + 4LL * i);\nptr = *(void **)a1;\n*(_QWORD *)a1 = v4;\nfree(ptr);\n}\nfor ( j = ++*(_DWORD *)(a1 + 8); j > 1 && (signed int)a2 < *(_DWORD *)(*(_QWORD *)a1 + 4LL * (j / 2)); j /= 2 )\n*(_DWORD *)(4LL * j + *(_QWORD *)a1) = *(_DWORD *)(*(_QWORD *)a1 + 4LL * (j / 2));\nresult = a2;\n*(_DWORD *)(4LL * j + *(_QWORD *)a1) = a2;\nreturn result;\n}", "original_code": "void enqueue(priority_queue *queue, item_type item)\n{\n if(queue->length < (queue->capability * threshold) )\n {\n queue->capability *= 2;\n item_type *new_item = (item_type *)malloc(queue->capability * sizeof(item_type));\n int i;\n for(i = 1; i <= queue->length; i++)\n new_item[i] = queue->item[i];\n item_type *temp = queue->item;\n queue->item = new_item;\n free(temp);\n temp = ((void *)0);\n new_item = ((void *)0);\n }\n queue->length += 1;\n int i = queue->length;\n for(; i > 1 && queue->item[i/2] > item; i = i/2)\n queue->item[i] = queue->item[i/2];\n queue->item[i] = item;\n}", "canonical_original_code": "void enqueue(struct priority_queue *queue, int item)\n{\n if(queue->length < (queue->capability * threshold) )\n {\n queue->capability *= 2;\n int *new_item = (item_type *)malloc(queue->capability * sizeof(item_type));\n int i;\n for(i = 1; i <= queue->length; i++)\n new_item[i] = queue->item[i];\n int *temp = queue->item;\n queue->item = new_item;\n free(temp);\n temp = ((void *)0);\n new_item = ((void *)0);\n }\n queue->length += 1;\n int i = queue->length;\n for(; i > 1 && queue->item[i/2] > item; i = i/2)\n queue->item[i] = queue->item[i/2];\n queue->item[i] = item;\n}", "variable_types": [ [ "queue", "struct priority_queue { int *item; int length; int capability; } *" ], [ "item", "int" ], [ "new_item", "int *" ], [ "i", "int" ], [ "temp", "int *" ] ], "return_type": "void", "user_defined_types": [ "struct priority_queue { int *item; int length; int capability; }" ], "binary_hash": "b4ca878814688fbbed613b25e0ec3149400ebd527ca5d4985600b3e79a658462" }, { "name": "dequeue", "canonical_name": "func2", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall dequeue(_DWORD *a1)\n{\n__int64 v2; // rsi\nint v3; // eax\nunsigned int v4; // [rsp+14h] [rbp-4h]\n\nif ( !a1[2] )\nreturn 0xFFFFFFFFLL;\nv4 = *(_DWORD *)(*(_QWORD *)a1 + 4LL);\nv2 = *(_QWORD *)a1;\nv3 = a1[2];\na1[2] = v3 - 1;\n*(_DWORD *)(*(_QWORD *)a1 + 4LL) = *(_DWORD *)(v2 + 4LL * v3);\npercolate_down((__int64)a1, 1);\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(_DWORD *a1)\n{\n__int64 v2; // rsi\nint v3; // eax\nunsigned int v4; // [rsp+14h] [rbp-4h]\n\nif ( !a1[2] )\nreturn 0xFFFFFFFFLL;\nv4 = *(_DWORD *)(*(_QWORD *)a1 + 4LL);\nv2 = *(_QWORD *)a1;\nv3 = a1[2];\na1[2] = v3 - 1;\n*(_DWORD *)(*(_QWORD *)a1 + 4LL) = *(_DWORD *)(v2 + 4LL * v3);\nfunc1((__int64)a1, 1);\nreturn v4;\n}", "original_code": "item_type dequeue(priority_queue *queue)\n{\n if(queue->length == 0)\n return -1;\n int answer = queue->item[1];\n queue->item[1] = queue->item[queue->length--];\n percolate_down(queue, 1);\n return answer;\n}", "canonical_original_code": "int dequeue(struct priority_queue *queue)\n{\n if(queue->length == 0)\n return -1;\n int answer = queue->item[1];\n queue->item[1] = queue->item[queue->length--];\n percolate_down(queue, 1);\n return answer;\n}", "variable_types": [ [ "queue", "struct priority_queue { int *item; int length; int capability; } *" ], [ "answer", "int" ] ], "return_type": "int", "user_defined_types": [ "struct priority_queue { int *item; int length; int capability; }" ], "binary_hash": "b4ca878814688fbbed613b25e0ec3149400ebd527ca5d4985600b3e79a658462" } ]
ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a
norlanliu/data-structure
[ [ "counterSorting", "->" ], [ "bucketSorting", "->" ], [ "radixSorting", "->" ], [ "bitSorting", "->" ], [ "PerDown", "->", "BuildHeap", "HeapSorting" ], [ "BuildHeap", "->", "PerDown", "HeapSorting" ], [ "HeapSorting", "->", "BuildHeap", "PerDown" ] ]
[]
[ { "name": "counterSorting", "canonical_name": "func0", "repo": "norlanliu/data-structure", "decompiled_code": "void __fastcall counterSorting(__int64 a1, __int64 a2, int a3, int a4)\n{\nchar *v4; // rax\nchar *s; // [rsp+20h] [rbp-10h]\nint i; // [rsp+28h] [rbp-8h]\nint j; // [rsp+28h] [rbp-8h]\nint l; // [rsp+28h] [rbp-8h]\nint k; // [rsp+28h] [rbp-8h]\nint m; // [rsp+28h] [rbp-8h]\nunsigned int v13; // [rsp+2Ch] [rbp-4h]\nint v14; // [rsp+2Ch] [rbp-4h]\n\nif ( a1 && a3 )\n{\nv13 = 0;\nfor ( i = 0; i < a3; ++i )\n{\nif ( *(_DWORD *)(4LL * i + a1) > v13 )\nv13 = *(_DWORD *)(4LL * i + a1);\n}\nv14 = v13 + 1;\ns = (char *)malloc(4LL * v14);\nmemset(s, 0, 4LL * v14);\nfor ( j = 0; j < a3; ++j )\n{\nv4 = &s[4 * *(unsigned int *)(4LL * j + a1)];\n++*(_DWORD *)v4;\n}\nif ( a4 )\n{\nfor ( k = v14 - 2; k >= 0; --k )\n*(_DWORD *)&s[4 * k] += *(_DWORD *)&s[4 * k + 4];\n}\nelse\n{\nfor ( l = 1; l < v14; ++l )\n*(_DWORD *)&s[4 * l] += *(_DWORD *)&s[4 * l - 4];\n}\nfor ( m = a3 - 1; m >= 0; --m )\n*(_DWORD *)(4LL * (int)(*(_DWORD *)&s[4 * *(unsigned int *)(4LL * m + a1)])-- - 4 + a2) = *(_DWORD *)(4LL * m + a1);\n}\n}\n", "canonical_decompiled_code": "void __fastcall func0(__int64 a1, __int64 a2, int a3, int a4)\n{\nchar *v4; // rax\nchar *s; // [rsp+20h] [rbp-10h]\nint i; // [rsp+28h] [rbp-8h]\nint j; // [rsp+28h] [rbp-8h]\nint l; // [rsp+28h] [rbp-8h]\nint k; // [rsp+28h] [rbp-8h]\nint m; // [rsp+28h] [rbp-8h]\nunsigned int v13; // [rsp+2Ch] [rbp-4h]\nint v14; // [rsp+2Ch] [rbp-4h]\n\nif ( a1 && a3 )\n{\nv13 = 0;\nfor ( i = 0; i < a3; ++i )\n{\nif ( *(_DWORD *)(4LL * i + a1) > v13 )\nv13 = *(_DWORD *)(4LL * i + a1);\n}\nv14 = v13 + 1;\ns = (char *)malloc(4LL * v14);\nmemset(s, 0, 4LL * v14);\nfor ( j = 0; j < a3; ++j )\n{\nv4 = &s[4 * *(unsigned int *)(4LL * j + a1)];\n++*(_DWORD *)v4;\n}\nif ( a4 )\n{\nfor ( k = v14 - 2; k >= 0; --k )\n*(_DWORD *)&s[4 * k] += *(_DWORD *)&s[4 * k + 4];\n}\nelse\n{\nfor ( l = 1; l < v14; ++l )\n*(_DWORD *)&s[4 * l] += *(_DWORD *)&s[4 * l - 4];\n}\nfor ( m = a3 - 1; m >= 0; --m )\n*(_DWORD *)(4LL * (int)(*(_DWORD *)&s[4 * *(unsigned int *)(4LL * m + a1)])-- - 4 + a2) = *(_DWORD *)(4LL * m + a1);\n}\n}", "original_code": "void counterSorting(unsigned *org, unsigned *des, int count, int order)\n{\n if(org == ((void *)0) || count == 0)\n return;\n int max = 0;\n int i;\n for(i = 0; i < count; i++)\n if(org[i] > max)\n max = org[i];\n max += 1;\n int *bucket = (int *)malloc(max * sizeof(int));\n memset(bucket, 0, sizeof(int)*max);\n for(i = 0; i < count; i++)\n bucket[org[i]]++;\n if(order == 0)\n for(i = 1; i < max; i++)\n bucket[i] += bucket[i-1];\n else\n for(i = max-2; i >= 0; i--)\n bucket[i] += bucket[i+1];\n for(i = count-1; i >= 0; i--)\n {\n des[bucket[org[i]]-1] = org[i];\n bucket[org[i]] -= 1;\n }\n}", "canonical_original_code": "void counterSorting(unsigned int *org, unsigned int *des, int count, int order)\n{\n if(org == ((void *)0) || count == 0)\n return;\n int max = 0;\n int i;\n for(i = 0; i < count; i++)\n if(org[i] > max)\n max = org[i];\n max += 1;\n int *bucket = (int *)malloc(max * sizeof(int));\n memset(bucket, 0, sizeof(int)*max);\n for(i = 0; i < count; i++)\n bucket[org[i]]++;\n if(order == 0)\n for(i = 1; i < max; i++)\n bucket[i] += bucket[i-1];\n else\n for(i = max-2; i >= 0; i--)\n bucket[i] += bucket[i+1];\n for(i = count-1; i >= 0; i--)\n {\n des[bucket[org[i]]-1] = org[i];\n bucket[org[i]] -= 1;\n }\n}", "variable_types": [ [ "org", "unsigned int *" ], [ "des", "unsigned int *" ], [ "count", "int" ], [ "order", "int" ], [ "max", "int" ], [ "i", "int" ], [ "bucket", "int *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a" }, { "name": "bucketSorting", "canonical_name": "func1", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall bucketSorting(__int64 a1, __int64 a2, signed int a3)\n{\n__int64 result; // rax\nint v4; // eax\nvoid *ptr; // [rsp+20h] [rbp-30h]\nvoid *s; // [rsp+28h] [rbp-28h]\nsigned int v8; // [rsp+34h] [rbp-1Ch]\n_QWORD *v9; // [rsp+38h] [rbp-18h]\n_QWORD *v10; // [rsp+38h] [rbp-18h]\nint v11; // [rsp+44h] [rbp-Ch]\nunsigned int i; // [rsp+48h] [rbp-8h]\nint j; // [rsp+48h] [rbp-8h]\nint k; // [rsp+48h] [rbp-8h]\nint v15; // [rsp+4Ch] [rbp-4h]\n\nv15 = 0;\nfor ( i = 0; ; ++i )\n{\nresult = i;\nif ( (int)i >= a3 )\nbreak;\nif ( *(_DWORD *)(4LL * (int)i + a1) > (unsigned int)v15 )\nv15 = *(_DWORD *)(4LL * (int)i + a1);\n}\nif ( v15 > 0 )\n{\ns = malloc(0x400uLL);\nmemset(s, 0, 0x400uLL);\nfor ( j = 0; j < a3; ++j )\n{\nv8 = *(_DWORD *)(4LL * j + a1) / (unsigned int)((v15 >> 7) + 1);\nv9 = malloc(0x10uLL);\n*(_DWORD *)v9 = *(_DWORD *)(4LL * j + a1);\nv9[1] = *((_QWORD *)s + v8);\n*((_QWORD *)s + v8) = v9;\n}\nv11 = 0;\nfor ( k = 0; k <= 127; ++k )\n{\nv10 = (_QWORD *)*((_QWORD *)s + k);\nwhile ( v10 )\n{\nv4 = v11++;\n*(_DWORD *)(4LL * v4 + a2) = *(_DWORD *)v10;\nptr = v10;\nv10 = (_QWORD *)v10[1];\nfree(ptr);\n}\n}\nfree(s);\nresult = insertSorting(a2, 0LL, (unsigned int)a3);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, __int64 a2, signed int a3)\n{\n__int64 result; // rax\nint v4; // eax\nvoid *ptr; // [rsp+20h] [rbp-30h]\nvoid *s; // [rsp+28h] [rbp-28h]\nsigned int v8; // [rsp+34h] [rbp-1Ch]\n_QWORD *v9; // [rsp+38h] [rbp-18h]\n_QWORD *v10; // [rsp+38h] [rbp-18h]\nint v11; // [rsp+44h] [rbp-Ch]\nunsigned int i; // [rsp+48h] [rbp-8h]\nint j; // [rsp+48h] [rbp-8h]\nint k; // [rsp+48h] [rbp-8h]\nint v15; // [rsp+4Ch] [rbp-4h]\n\nv15 = 0;\nfor ( i = 0; ; ++i )\n{\nresult = i;\nif ( (int)i >= a3 )\nbreak;\nif ( *(_DWORD *)(4LL * (int)i + a1) > (unsigned int)v15 )\nv15 = *(_DWORD *)(4LL * (int)i + a1);\n}\nif ( v15 > 0 )\n{\ns = malloc(0x400uLL);\nmemset(s, 0, 0x400uLL);\nfor ( j = 0; j < a3; ++j )\n{\nv8 = *(_DWORD *)(4LL * j + a1) / (unsigned int)((v15 >> 7) + 1);\nv9 = malloc(0x10uLL);\n*(_DWORD *)v9 = *(_DWORD *)(4LL * j + a1);\nv9[1] = *((_QWORD *)s + v8);\n*((_QWORD *)s + v8) = v9;\n}\nv11 = 0;\nfor ( k = 0; k <= 127; ++k )\n{\nv10 = (_QWORD *)*((_QWORD *)s + k);\nwhile ( v10 )\n{\nv4 = v11++;\n*(_DWORD *)(4LL * v4 + a2) = *(_DWORD *)v10;\nptr = v10;\nv10 = (_QWORD *)v10[1];\nfree(ptr);\n}\n}\nfree(s);\nresult = insertSorting(a2, 0LL, (unsigned int)a3);\n}\nreturn result;\n}", "original_code": "void bucketSorting(unsigned *org, unsigned *des, int length)\n{\n int max = 0;\n int i,j, k = 0;\n for(i = 0; i<length; i++)\n if(org[i] > max)\n max = org[i];\n if(max <= 0)\n return;\n unsigned m = max / 128 + 1;\n list_t **buckets = (list_t **)malloc(128 * sizeof(list_t *));\n memset(buckets, 0, 128*sizeof(list_t*));\n list_t *temp, *temp2;\n for(i = 0; i < length; i++)\n {\n k = org[i] / m;\n temp = (list_t *)malloc(sizeof(list_t));\n temp->item = org[i];\n temp->next = buckets[k];\n buckets[k] = temp;\n }\n for(i=j=0; i<128; i++)\n {\n temp = buckets[i];\n while(temp != ((void *)0))\n {\n des[j++] = temp->item;\n temp2 = temp;\n temp = temp->next;\n free(temp2);\n }\n }\n free(buckets);\n insertSorting(des, 0, length);\n}", "canonical_original_code": "void bucketSorting(unsigned int *org, unsigned int *des, int length)\n{\n int max = 0;\n int i; int j; int k = 0;\n for(i = 0; i<length; i++)\n if(org[i] > max)\n max = org[i];\n if(max <= 0)\n return;\n unsigned int m = max / 128 + 1;\n struct _list **buckets = (list_t **)malloc(128 * sizeof(list_t *));\n memset(buckets, 0, 128*sizeof(struct _list *));\n struct _list *temp; struct _list *temp2;\n for(i = 0; i < length; i++)\n {\n k = org[i] / m;\n temp = (struct _list *)malloc(sizeof(list_t));\n temp->item = org[i];\n temp->next = buckets[k];\n buckets[k] = temp;\n }\n for(i=j=0; i<128; i++)\n {\n temp = buckets[i];\n while(temp != ((void *)0))\n {\n des[j++] = temp->item;\n temp2 = temp;\n temp = temp->next;\n free(temp2);\n }\n }\n free(buckets);\n insertSorting(des, 0, length);\n}", "variable_types": [ [ "org", "unsigned int *" ], [ "des", "unsigned int *" ], [ "length", "int" ], [ "max", "int" ], [ "i", "int" ], [ "j", "int" ], [ "k", "int" ], [ "m", "unsigned int" ], [ "buckets", "struct _list { int item; struct _list *next; } **" ], [ "temp", "struct _list { int item; struct _list *next; } *" ], [ "temp2", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a" }, { "name": "radixSorting", "canonical_name": "func2", "repo": "norlanliu/data-structure", "decompiled_code": "void __fastcall radixSorting(__int64 a1, int a2)\n{\nvoid *ptr; // [rsp+18h] [rbp-38h]\nvoid *s; // [rsp+20h] [rbp-30h]\n_QWORD *v4; // [rsp+30h] [rbp-20h]\n__int64 v5; // [rsp+30h] [rbp-20h]\n_QWORD *v6; // [rsp+30h] [rbp-20h]\nint v7; // [rsp+3Ch] [rbp-14h]\nsigned int v8; // [rsp+40h] [rbp-10h]\nint v9; // [rsp+40h] [rbp-10h]\nint v10; // [rsp+44h] [rbp-Ch]\nint i; // [rsp+48h] [rbp-8h]\nint j; // [rsp+48h] [rbp-8h]\nint k; // [rsp+48h] [rbp-8h]\nint v14; // [rsp+4Ch] [rbp-4h]\n\nv14 = 0;\nv7 = 1;\nfor ( i = 0; i < a2; ++i )\n{\nif ( *(_DWORD *)(4LL * i + a1) > (unsigned int)v14 )\nv14 = *(_DWORD *)(4LL * i + a1);\n}\nif ( v14 > 0 )\n{\ns = malloc(0x50uLL);\nmemset(s, 0, 0x50uLL);\nwhile ( v14 / v7 )\n{\nfor ( j = 0; j < a2; ++j )\n{\nv8 = *(_DWORD *)(4LL * j + a1) / (unsigned int)v7 % 0xA;\nv4 = malloc(0x10uLL);\n*(_DWORD *)v4 = *(_DWORD *)(4LL * j + a1);\nv4[1] = *((_QWORD *)s + v8);\n*((_QWORD *)s + v8) = v4;\n}\nv10 = 0;\nfor ( k = 0; k < 10; ++k )\n{\nv5 = *((_QWORD *)s + k);\nwhile ( v5 )\n{\nv5 = *(_QWORD *)(v5 + 8);\n++v10;\n}\nv9 = 0;\nv6 = (_QWORD *)*((_QWORD *)s + k);\nwhile ( v6 )\n{\n*(_DWORD *)(4LL * (v10 - v9) - 4 + a1) = *(_DWORD *)v6;\nptr = v6;\nv6 = (_QWORD *)v6[1];\nfree(ptr);\n++v9;\n}\n*((_QWORD *)s + k) = 0LL;\n}\nv7 *= 10;\n}\nfree(s);\n}\n}\n", "canonical_decompiled_code": "void __fastcall func2(__int64 a1, int a2)\n{\nvoid *ptr; // [rsp+18h] [rbp-38h]\nvoid *s; // [rsp+20h] [rbp-30h]\n_QWORD *v4; // [rsp+30h] [rbp-20h]\n__int64 v5; // [rsp+30h] [rbp-20h]\n_QWORD *v6; // [rsp+30h] [rbp-20h]\nint v7; // [rsp+3Ch] [rbp-14h]\nsigned int v8; // [rsp+40h] [rbp-10h]\nint v9; // [rsp+40h] [rbp-10h]\nint v10; // [rsp+44h] [rbp-Ch]\nint i; // [rsp+48h] [rbp-8h]\nint j; // [rsp+48h] [rbp-8h]\nint k; // [rsp+48h] [rbp-8h]\nint v14; // [rsp+4Ch] [rbp-4h]\n\nv14 = 0;\nv7 = 1;\nfor ( i = 0; i < a2; ++i )\n{\nif ( *(_DWORD *)(4LL * i + a1) > (unsigned int)v14 )\nv14 = *(_DWORD *)(4LL * i + a1);\n}\nif ( v14 > 0 )\n{\ns = malloc(0x50uLL);\nmemset(s, 0, 0x50uLL);\nwhile ( v14 / v7 )\n{\nfor ( j = 0; j < a2; ++j )\n{\nv8 = *(_DWORD *)(4LL * j + a1) / (unsigned int)v7 % 0xA;\nv4 = malloc(0x10uLL);\n*(_DWORD *)v4 = *(_DWORD *)(4LL * j + a1);\nv4[1] = *((_QWORD *)s + v8);\n*((_QWORD *)s + v8) = v4;\n}\nv10 = 0;\nfor ( k = 0; k < 10; ++k )\n{\nv5 = *((_QWORD *)s + k);\nwhile ( v5 )\n{\nv5 = *(_QWORD *)(v5 + 8);\n++v10;\n}\nv9 = 0;\nv6 = (_QWORD *)*((_QWORD *)s + k);\nwhile ( v6 )\n{\n*(_DWORD *)(4LL * (v10 - v9) - 4 + a1) = *(_DWORD *)v6;\nptr = v6;\nv6 = (_QWORD *)v6[1];\nfree(ptr);\n++v9;\n}\n*((_QWORD *)s + k) = 0LL;\n}\nv7 *= 10;\n}\nfree(s);\n}\n}", "original_code": "void radixSorting(unsigned *org, int length)\n{\n int max = 0;\n int i,j, k = 0, bucket_size = 10,exp = 1;\n for(i = 0; i<length; i++)\n if(org[i] > max)\n max = org[i];\n if(max <= 0)\n return;\n list_t **buckets = (list_t **)malloc(bucket_size * sizeof(list_t *));\n memset(buckets, 0, bucket_size* sizeof(list_t*));\n list_t *temp, *temp2;\n while(max / exp != 0)\n {\n for(i = 0; i < length; i++)\n {\n k = (org[i] / exp) % bucket_size;\n temp = (list_t *)malloc(sizeof(list_t));\n temp->item = org[i];\n temp->next = buckets[k];\n buckets[k] = temp;\n }\n for(i=j=0; i<bucket_size; i++)\n {\n temp = buckets[i];\n while(temp != ((void *)0))\n {\n temp = temp->next;\n j++;\n }\n k = 0;\n temp = buckets[i];\n while(temp != ((void *)0))\n {\n org[j-k-1] = temp->item;\n temp2 = temp;\n temp = temp->next;\n free(temp2);\n k++;\n }\n buckets[i] = ((void *)0);\n }\n exp *= 10;\n }\n free(buckets);\n}", "canonical_original_code": "void radixSorting(unsigned int *org, int length)\n{\n int max = 0;\n int i; int j; int k = 0; int bucket_size = 10; int exp = 1;\n for(i = 0; i<length; i++)\n if(org[i] > max)\n max = org[i];\n if(max <= 0)\n return;\n struct _list **buckets = (list_t **)malloc(bucket_size * sizeof(list_t *));\n memset(buckets, 0, bucket_size* sizeof(struct _list *));\n struct _list *temp; struct _list *temp2;\n while(max / exp != 0)\n {\n for(i = 0; i < length; i++)\n {\n k = (org[i] / exp) % bucket_size;\n temp = (struct _list *)malloc(sizeof(list_t));\n temp->item = org[i];\n temp->next = buckets[k];\n buckets[k] = temp;\n }\n for(i=j=0; i<bucket_size; i++)\n {\n temp = buckets[i];\n while(temp != ((void *)0))\n {\n temp = temp->next;\n j++;\n }\n k = 0;\n temp = buckets[i];\n while(temp != ((void *)0))\n {\n org[j-k-1] = temp->item;\n temp2 = temp;\n temp = temp->next;\n free(temp2);\n k++;\n }\n buckets[i] = ((void *)0);\n }\n exp *= 10;\n }\n free(buckets);\n}", "variable_types": [ [ "org", "unsigned int *" ], [ "length", "int" ], [ "max", "int" ], [ "i", "int" ], [ "j", "int" ], [ "k", "int" ], [ "bucket_size", "int" ], [ "exp", "int" ], [ "buckets", "struct _list { int item; struct _list *next; } **" ], [ "temp", "struct _list { int item; struct _list *next; } *" ], [ "temp2", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a" }, { "name": "bitSorting", "canonical_name": "func3", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall bitSorting(_DWORD *a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+14h] [rbp-28h]\nint v4; // [rsp+20h] [rbp-1Ch]\nint v5; // [rsp+28h] [rbp-14h]\nint v6; // [rsp+2Ch] [rbp-10h]\nint v7; // [rsp+30h] [rbp-Ch]\nint j; // [rsp+34h] [rbp-8h]\nint i; // [rsp+38h] [rbp-4h]\n\nfor ( i = 31; i > 0; --i )\n{\nv7 = *a1 >> i;\nv6 = 0;\nv5 = -1;\nfor ( j = 0; ; ++j )\n{\nresult = (unsigned int)j;\nif ( j >= a2 )\nbreak;\nif ( a1[j] >> i == v7 )\n{\nv4 = 1 << (i - 1);\nif ( v5 >= v6 )\n{\nif ( (a1[j] & v4) == 0 )\n{\nv3 = a1[j];\na1[j] = a1[v5];\na1[v5++] = v3;\n}\n}\nelse if ( (a1[j] & v4) != 0 )\n{\nv5 = j;\n}\n}\nelse\n{\nv6 = j;\nv5 = j - 1;\nv7 = a1[j--] >> i;\n}\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(_DWORD *a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+14h] [rbp-28h]\nint v4; // [rsp+20h] [rbp-1Ch]\nint v5; // [rsp+28h] [rbp-14h]\nint v6; // [rsp+2Ch] [rbp-10h]\nint v7; // [rsp+30h] [rbp-Ch]\nint j; // [rsp+34h] [rbp-8h]\nint i; // [rsp+38h] [rbp-4h]\n\nfor ( i = 31; i > 0; --i )\n{\nv7 = *a1 >> i;\nv6 = 0;\nv5 = -1;\nfor ( j = 0; ; ++j )\n{\nresult = (unsigned int)j;\nif ( j >= a2 )\nbreak;\nif ( a1[j] >> i == v7 )\n{\nv4 = 1 << (i - 1);\nif ( v5 >= v6 )\n{\nif ( (a1[j] & v4) == 0 )\n{\nv3 = a1[j];\na1[j] = a1[v5];\na1[v5++] = v3;\n}\n}\nelse if ( (a1[j] & v4) != 0 )\n{\nv5 = j;\n}\n}\nelse\n{\nv6 = j;\nv5 = j - 1;\nv7 = a1[j--] >> i;\n}\n}\n}\nreturn result;\n}", "original_code": "void bitSorting(unsigned *org, int length)\n{\n int i,j;\n for(i = 31; i >= 1; i--)\n {\n int preCB = org[0] >> i;\n int theS = 0;\n int theI = theS - 1;\n int theBase = 1 << (i-1);\n int theAxBit = 0;\n for(j = 0; j < length; j++)\n {\n int temPreCB = org[j]>>i;\n if(temPreCB != preCB)\n {\n theS = j;\n theI = theS - 1;\n theAxBit = 0;\n preCB = temPreCB;\n j--;\n continue;\n }\n int theAJ = (org[j] & theBase) > 0 ? 1:0;\n if(theI < theS)\n {\n if(theAJ == 0)\n continue;\n theI = j;\n continue;\n }\n if(theAJ <= theAxBit)\n {\n int temp = org[j];\n org[j] = org[theI];\n org[theI]=temp;\n theI++;\n }\n }\n }\n}", "canonical_original_code": "void bitSorting(unsigned int *org, int length)\n{\n int i; int j;\n for(i = 31; i >= 1; i--)\n {\n int preCB = org[0] >> i;\n int theS = 0;\n int theI = theS - 1;\n int theBase = 1 << (i-1);\n int theAxBit = 0;\n for(j = 0; j < length; j++)\n {\n int temPreCB = org[j]>>i;\n if(temPreCB != preCB)\n {\n theS = j;\n theI = theS - 1;\n theAxBit = 0;\n preCB = temPreCB;\n j--;\n continue;\n }\n int theAJ = (org[j] & theBase) > 0 ? 1:0;\n if(theI < theS)\n {\n if(theAJ == 0)\n continue;\n theI = j;\n continue;\n }\n if(theAJ <= theAxBit)\n {\n int temp = org[j];\n org[j] = org[theI];\n org[theI]=temp;\n theI++;\n }\n }\n }\n}", "variable_types": [ [ "org", "unsigned int *" ], [ "length", "int" ], [ "i", "int" ], [ "j", "int" ], [ "preCB", "int" ], [ "theS", "int" ], [ "theI", "int" ], [ "theBase", "int" ], [ "theAxBit", "int" ], [ "temPreCB", "int" ], [ "theAJ", "int" ], [ "temp", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a" }, { "name": "PerDown", "canonical_name": "func4", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall PerDown(__int64 a1, int a2, int a3)\n{\n__int64 result; // rax\nint v4; // [rsp+0h] [rbp-20h]\nunsigned int v5; // [rsp+18h] [rbp-8h]\nint v6; // [rsp+1Ch] [rbp-4h]\n\nv4 = a3;\nv5 = *(_DWORD *)(4LL * a3 + a1);\nwhile ( a2 > 2 * v4 + 1 )\n{\nv6 = 2 * v4 + 1;\nif ( v6 != a2 - 1 && *(_DWORD *)(4LL * v6 + a1) < *(_DWORD *)(4 * (v6 + 1LL) + a1) )\nv6 = 2 * v4 + 2;\nif ( (signed int)v5 > *(_DWORD *)(4LL * v6 + a1) )\nbreak;\n*(_DWORD *)(4LL * v4 + a1) = *(_DWORD *)(4LL * v6 + a1);\nv4 = v6;\n}\nresult = v5;\n*(_DWORD *)(a1 + 4LL * v4) = v5;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, int a2, int a3)\n{\n__int64 result; // rax\nint v4; // [rsp+0h] [rbp-20h]\nunsigned int v5; // [rsp+18h] [rbp-8h]\nint v6; // [rsp+1Ch] [rbp-4h]\n\nv4 = a3;\nv5 = *(_DWORD *)(4LL * a3 + a1);\nwhile ( a2 > 2 * v4 + 1 )\n{\nv6 = 2 * v4 + 1;\nif ( v6 != a2 - 1 && *(_DWORD *)(4LL * v6 + a1) < *(_DWORD *)(4 * (v6 + 1LL) + a1) )\nv6 = 2 * v4 + 2;\nif ( (signed int)v5 > *(_DWORD *)(4LL * v6 + a1) )\nbreak;\n*(_DWORD *)(4LL * v4 + a1) = *(_DWORD *)(4LL * v6 + a1);\nv4 = v6;\n}\nresult = v5;\n*(_DWORD *)(a1 + 4LL * v4) = v5;\nreturn result;\n}", "original_code": "static void PerDown(int *array, int size, int hole)\n{\n int temp = array[hole];\n int child;\n for(; (2 * hole + 1) < size; hole = child)\n {\n child = 2 * hole + 1;\n if(child != size-1 && array[child] < array[child+1])\n ++child;\n if(array[child] < temp)\n break;\n else\n array[hole] = array[child];\n }\n array[hole] = temp;\n}", "canonical_original_code": "static void PerDown(int *array, int size, int hole)\n{\n int temp = array[hole];\n int child;\n for(; (2 * hole + 1) < size; hole = child)\n {\n child = 2 * hole + 1;\n if(child != size-1 && array[child] < array[child+1])\n ++child;\n if(array[child] < temp)\n break;\n else\n array[hole] = array[child];\n }\n array[hole] = temp;\n}", "variable_types": [ [ "array", "int *" ], [ "size", "int" ], [ "hole", "int" ], [ "temp", "int" ], [ "child", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a" }, { "name": "BuildHeap", "canonical_name": "func5", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall BuildHeap(__int64 a1, int a2)\n{\n__int64 result; // rax\nint i; // [rsp+1Ch] [rbp-4h]\n\nresult = (unsigned int)((a2 - 2) / 2);\nfor ( i = (a2 - 2) / 2; i >= 0; --i )\nresult = PerDown(a1, a2, i);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1, int a2)\n{\n__int64 result; // rax\nint i; // [rsp+1Ch] [rbp-4h]\n\nresult = (unsigned int)((a2 - 2) / 2);\nfor ( i = (a2 - 2) / 2; i >= 0; --i )\nresult = func4(a1, a2, i);\nreturn result;\n}", "original_code": "static void BuildHeap(int *array, int size)\n{\n int i = (size-2) / 2;\n for(; i >= 0; --i)\n PerDown(array, size, i);\n}", "canonical_original_code": "static void BuildHeap(int *array, int size)\n{\n int i = (size-2) / 2;\n for(; i >= 0; --i)\n PerDown(array, size, i);\n}", "variable_types": [ [ "array", "int *" ], [ "size", "int" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a" }, { "name": "HeapSorting", "canonical_name": "func6", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall HeapSorting(__int64 a1, int a2)\n{\n__int64 result; // rax\nint i; // [rsp+1Ch] [rbp-4h]\n\nBuildHeap(a1, a2);\nresult = (unsigned int)(a2 - 1);\nfor ( i = a2 - 1; i > 0; --i )\n{\nSwap(a1, a1 + 4LL * i);\nresult = PerDown(a1, i, 0);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1, int a2)\n{\n__int64 result; // rax\nint i; // [rsp+1Ch] [rbp-4h]\n\nfunc5(a1, a2);\nresult = (unsigned int)(a2 - 1);\nfor ( i = a2 - 1; i > 0; --i )\n{\nSwap(a1, a1 + 4LL * i);\nresult = func4(a1, i, 0);\n}\nreturn result;\n}", "original_code": "void HeapSorting(int *org, int length)\n{\n BuildHeap(org, length);\n int i;\n for(i = length-1; i > 0; --i)\n {\n Swap(&org[0], &org[i]);\n PerDown(org, i, 0);\n }\n}", "canonical_original_code": "void HeapSorting(int *org, int length)\n{\n BuildHeap(org, length);\n int i;\n for(i = length-1; i > 0; --i)\n {\n Swap(&org[0], &org[i]);\n PerDown(org, i, 0);\n }\n}", "variable_types": [ [ "org", "int *" ], [ "length", "int" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ccfd915e00f9fcde7e9c458386ae44125352fa942832a00b50f36a4994da774a" } ]
dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89
norlanliu/data-structure
[ [ "sub_1020", "->" ], [ "_cxa_finalize", "->", "_do_global_dtors_aux" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "_cxa_finalize", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "getHashBase", "->", "hashmap_initialize", "hashmap_initialize_default" ], [ "hash", "->", "hashmap_put", "hashmap_contains", "hashmap_remove", "hashmap_get" ], [ "indexForTable", "->", "resize", "hashmap_put", "hashmap_contains", "hashmap_remove", "hashmap_get" ], [ "resize", "->", "indexForTable", "hashmap_put" ], [ "hashmap_initialize", "->", "getHashBase" ], [ "hashmap_initialize_default", "->", "getHashBase" ], [ "hashmap_put", "->", "resize", "hash", "indexForTable" ], [ "hashmap_contains", "->", "hash", "indexForTable" ], [ "hashmap_remove", "->", "hash", "indexForTable" ], [ "hashmap_get", "->", "hash", "indexForTable" ], [ "hashmap_free", "->" ] ]
[ [ "sub_1020", "void func0()\n{\nJUMPOUT(0LL);\n}" ], [ "_cxa_finalize", "int __fastcall func1(void *a1)\n{\nreturn __cxa_finalize(a1);\n}" ], [ "deregister_tm_clones", "char *func2()\n{\nreturn &completed_0;\n}" ], [ "register_tm_clones", "__int64 func3()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func4()\n{\nchar *result; // rax\n\nif ( !completed_0 )\n{\nif ( &__cxa_finalize )\nfunc1(_dso_handle);\nresult = func2();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func5()\n{\nreturn func3();\n}" ] ]
[ { "name": "getHashBase", "canonical_name": "func6", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 getHashBase()\n{\nint v1[2]; // [rsp+Ch] [rbp-14h]\nint v2; // [rsp+14h] [rbp-Ch]\nint i; // [rsp+18h] [rbp-8h]\nint v4; // [rsp+1Ch] [rbp-4h]\n\nv2 = 17;\nv4 = 0;\nv1[0] = time(0LL);\nv1[1] = rand() >> 16;\nfor ( i = 0; i <= 1; ++i )\n{\nv1[i] *= -862048943;\nv1[i] = (v1[i] << v2) | (v1[i] >> 15);\nv1[i] *= 461845907;\nv4 ^= v1[i];\nv4 = (v4 >> 15) | (v4 << v2);\nv4 = 5 * v4 - 430675100;\n}\nreturn ((-1028477387 * (((-2048144789 * ((v4 >> 16) ^ v4)) >> 13) ^ (-2048144789 * ((v4 >> 16) ^ v4)))) >> 16) ^ (-1028477387 * (((-2048144789 * ((v4 >> 16) ^ v4)) >> 13) ^ (-2048144789 * ((v4 >> 16) ^ (unsigned int)v4))));\n}\n", "canonical_decompiled_code": "__int64 func6()\n{\nint v1[2]; // [rsp+Ch] [rbp-14h]\nint v2; // [rsp+14h] [rbp-Ch]\nint i; // [rsp+18h] [rbp-8h]\nint v4; // [rsp+1Ch] [rbp-4h]\n\nv2 = 17;\nv4 = 0;\nv1[0] = time(0LL);\nv1[1] = rand() >> 16;\nfor ( i = 0; i <= 1; ++i )\n{\nv1[i] *= -862048943;\nv1[i] = (v1[i] << v2) | (v1[i] >> 15);\nv1[i] *= 461845907;\nv4 ^= v1[i];\nv4 = (v4 >> 15) | (v4 << v2);\nv4 = 5 * v4 - 430675100;\n}\nreturn ((-1028477387 * (((-2048144789 * ((v4 >> 16) ^ v4)) >> 13) ^ (-2048144789 * ((v4 >> 16) ^ v4)))) >> 16) ^ (-1028477387 * (((-2048144789 * ((v4 >> 16) ^ v4)) >> 13) ^ (-2048144789 * ((v4 >> 16) ^ (unsigned int)v4))));\n}", "original_code": "static int getHashBase()\n{\n int distance = sizeof(int)*8-15;\n int hash_base = 0;\n int data[2] = {time(((void *)0)), rand() >> 16};\n int i;\n for(i = 0; i < 2; i++)\n {\n data[i] *= 0xcc9e2d51;\n data[i] = (data[i]>>15) | (data[i]<<distance);\n data[i] *= 0x1b873593;\n hash_base ^= data[i];\n hash_base = (hash_base >> 15) | (hash_base << distance);\n hash_base = hash_base * 5 + 0xe6546b64;\n }\n hash_base ^= hash_base >> 16;\n hash_base *= 0x85ebca6b;\n hash_base ^= hash_base >> 13;\n hash_base *= 0xc2b2ae35;\n hash_base ^= hash_base >> 16;\n return hash_base;\n}", "canonical_original_code": "static int getHashBase()\n{\n int distance = sizeof(int)*8-15;\n int hash_base = 0;\n int data[2] = {time(((void *)0)), rand() >> 16};\n int i;\n for(i = 0; i < 2; i++)\n {\n data[i] *= 0xcc9e2d51;\n data[i] = (data[i]>>15) | (data[i]<<distance);\n data[i] *= 0x1b873593;\n hash_base ^= data[i];\n hash_base = (hash_base >> 15) | (hash_base << distance);\n hash_base = hash_base * 5 + 0xe6546b64;\n }\n hash_base ^= hash_base >> 16;\n hash_base *= 0x85ebca6b;\n hash_base ^= hash_base >> 13;\n hash_base *= 0xc2b2ae35;\n hash_base ^= hash_base >> 16;\n return hash_base;\n}", "variable_types": [ [ "distance", "int" ], [ "hash_base", "int" ], [ "data", "int [2]" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hash", "canonical_name": "func7", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall hash(int a1, unsigned int a2)\n{\nreturn ((int)(((int)(a1 ^ a2) >> 20) ^ ((int)(a1 ^ a2) >> 12) ^ a1 ^ a2) >> 7) ^ ((int)(((int)(a1 ^ a2) >> 20) ^ ((int)(a1 ^ a2) >> 12) ^ a1 ^ a2) >> 4) ^ ((int)(a1 ^ a2) >> 20) ^ ((int)(a1 ^ a2) >> 12) ^ a1 ^ a2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(int a1, unsigned int a2)\n{\nreturn ((int)(((int)(a1 ^ a2) >> 20) ^ ((int)(a1 ^ a2) >> 12) ^ a1 ^ a2) >> 7) ^ ((int)(((int)(a1 ^ a2) >> 20) ^ ((int)(a1 ^ a2) >> 12) ^ a1 ^ a2) >> 4) ^ ((int)(a1 ^ a2) >> 20) ^ ((int)(a1 ^ a2) >> 12) ^ a1 ^ a2;\n}", "original_code": "static int hash(int hash_code, int hash_base)\n{\n int answer = hash_base;\n answer ^= hash_code;\n answer ^= (answer >> 20) ^ (answer >> 12);\n answer ^= (answer >> 7) ^ (answer >> 4);\n return answer;\n}", "canonical_original_code": "static int hash(int hash_code, int hash_base)\n{\n int answer = hash_base;\n answer ^= hash_code;\n answer ^= (answer >> 20) ^ (answer >> 12);\n answer ^= (answer >> 7) ^ (answer >> 4);\n return answer;\n}", "variable_types": [ [ "hash_code", "int" ], [ "hash_base", "int" ], [ "answer", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "indexForTable", "canonical_name": "func8", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall indexForTable(int a1, int a2)\n{\nreturn a1 & (unsigned int)(a2 - 1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(int a1, int a2)\n{\nreturn a1 & (unsigned int)(a2 - 1);\n}", "original_code": "static int indexForTable(int hash, int capability)\n{\n return hash & (capability-1);\n}", "canonical_original_code": "static int indexForTable(int hash, int capability)\n{\n return hash & (capability-1);\n}", "variable_types": [ [ "hash", "int" ], [ "capability", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "resize", "canonical_name": "func9", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall resize(__int64 a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+1Ch] [rbp-24h]\nvoid *s; // [rsp+20h] [rbp-20h]\n__int64 j; // [rsp+28h] [rbp-18h]\n__int64 v6; // [rsp+30h] [rbp-10h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nif ( *(int *)(a1 + 12) >= 0x40000000 )\n*(_DWORD *)(a1 + 4) = *(_DWORD *)(a1 + 12);\ns = malloc(8LL * a2);\nmemset(s, 0, 8LL * a2);\nfor ( i = 0; i < *(_DWORD *)(a1 + 12); ++i )\n{\nv6 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * i);\nfor ( j = v6; j; v6 = j )\n{\nv3 = indexForTable(*(_DWORD *)v6, a2);\nj = *(_QWORD *)(v6 + 16);\n*(_QWORD *)(v6 + 16) = *((_QWORD *)s + v3);\n*((_QWORD *)s + v3) = v6;\n}\n}\nfree(*(void **)(a1 + 24));\n*(_QWORD *)(a1 + 24) = s;\n*(_DWORD *)(a1 + 12) = a2;\nresult = a1;\n*(_DWORD *)(a1 + 4) = (int)(float)(0.75 * (float)a2);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(__int64 a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+1Ch] [rbp-24h]\nvoid *s; // [rsp+20h] [rbp-20h]\n__int64 j; // [rsp+28h] [rbp-18h]\n__int64 v6; // [rsp+30h] [rbp-10h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nif ( *(int *)(a1 + 12) >= 0x40000000 )\n*(_DWORD *)(a1 + 4) = *(_DWORD *)(a1 + 12);\ns = malloc(8LL * a2);\nmemset(s, 0, 8LL * a2);\nfor ( i = 0; i < *(_DWORD *)(a1 + 12); ++i )\n{\nv6 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * i);\nfor ( j = v6; j; v6 = j )\n{\nv3 = func8(*(_DWORD *)v6, a2);\nj = *(_QWORD *)(v6 + 16);\n*(_QWORD *)(v6 + 16) = *((_QWORD *)s + v3);\n*((_QWORD *)s + v3) = v6;\n}\n}\nfree(*(void **)(a1 + 24));\n*(_QWORD *)(a1 + 24) = s;\n*(_DWORD *)(a1 + 12) = a2;\nresult = a1;\n*(_DWORD *)(a1 + 4) = (int)(float)(0.75 * (float)a2);\nreturn result;\n}", "original_code": "static void resize(hashmap_t *map, int new_capability)\n{\n if(map->table_capability >= MAX_CAPABILITY)\n {\n map->threshold = map->table_capability;\n }\n hashmap_list_t **new_table = (hashmap_list_t **)malloc(sizeof(hashmap_list_t *) * new_capability);\n memset(new_table, 0, sizeof(hashmap_list_t *)*new_capability);\n int i, index;\n hashmap_list_t *temp, *temp_while;\n for(i = 0; i < map->table_capability; i++)\n {\n temp = map->table[i];\n temp_while = map->table[i];\n while(temp_while != ((void *)0))\n {\n index = indexForTable(temp->hash, new_capability);\n temp_while = temp->next;\n temp->next = new_table[index];\n new_table[index] = temp;\n temp = temp_while;\n }\n }\n temp = temp_while = ((void *)0);\n free(map->table);\n map->table = new_table;\n map->table_capability = new_capability;\n map->threshold = new_capability * DEFAULT_LOAD_FACTOR;\n}", "canonical_original_code": "static void resize(struct _hashmap *map, int new_capability)\n{\n if(map->table_capability >= MAX_CAPABILITY)\n {\n map->threshold = map->table_capability;\n }\n struct _linked_list **new_table = (hashmap_list_t **)malloc(sizeof(hashmap_list_t *) * new_capability);\n memset(new_table, 0, sizeof(struct _linked_list *)*new_capability);\n int i; int index;\n struct _linked_list *temp; struct _linked_list *temp_while;\n for(i = 0; i < map->table_capability; i++)\n {\n temp = map->table[i];\n temp_while = map->table[i];\n while(temp_while != ((void *)0))\n {\n index = indexForTable(temp->hash, new_capability);\n temp_while = temp->next;\n temp->next = new_table[index];\n new_table[index] = temp;\n temp = temp_while;\n }\n }\n temp = temp_while = ((void *)0);\n free(map->table);\n map->table = new_table;\n map->table_capability = new_capability;\n map->threshold = new_capability * DEFAULT_LOAD_FACTOR;\n}", "variable_types": [ [ "map", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ], [ "new_capability", "int" ], [ "new_table", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **" ], [ "i", "int" ], [ "index", "int" ], [ "temp", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ], [ "temp_while", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hashmap_initialize", "canonical_name": "func10", "repo": "norlanliu/data-structure", "decompiled_code": "void *__fastcall hashmap_initialize(int a1, __int64 a2)\n{\nvoid *v3; // [rsp+10h] [rbp-10h]\nint v4; // [rsp+1Ch] [rbp-4h]\n\nv4 = 1;\nif ( a1 < 0 )\nreturn 0LL;\nif ( a1 <= 0x40000000 )\n{\nwhile ( v4 < a1 )\nv4 *= 2;\n}\nelse\n{\nv4 = 0x40000000;\n}\nv3 = malloc(0x20uLL);\n*((_DWORD *)v3 + 2) = getHashBase();\n*((_QWORD *)v3 + 3) = malloc(8LL * v4);\nmemset(*((void **)v3 + 3), 0, 8LL * v4);\n*((_QWORD *)v3 + 2) = a2;\n*((_DWORD *)v3 + 3) = v4;\n*((_DWORD *)v3 + 1) = (int)(float)(0.75 * (float)v4);\n*(_DWORD *)v3 = 0;\nreturn v3;\n}\n", "canonical_decompiled_code": "void *__fastcall func10(int a1, __int64 a2)\n{\nvoid *v3; // [rsp+10h] [rbp-10h]\nint v4; // [rsp+1Ch] [rbp-4h]\n\nv4 = 1;\nif ( a1 < 0 )\nreturn 0LL;\nif ( a1 <= 0x40000000 )\n{\nwhile ( v4 < a1 )\nv4 *= 2;\n}\nelse\n{\nv4 = 0x40000000;\n}\nv3 = malloc(0x20uLL);\n*((_DWORD *)v3 + 2) = func6();\n*((_QWORD *)v3 + 3) = malloc(8LL * v4);\nmemset(*((void **)v3 + 3), 0, 8LL * v4);\n*((_QWORD *)v3 + 2) = a2;\n*((_DWORD *)v3 + 3) = v4;\n*((_DWORD *)v3 + 1) = (int)(float)(0.75 * (float)v4);\n*(_DWORD *)v3 = 0;\nreturn v3;\n}", "original_code": "hashmap_t *hashmap_initialize(int org_capability, int (*hashCode)(int))\n{\n int capability = 1;\n if(org_capability < 0)\n return ((void *)0);\n else if( org_capability > MAX_CAPABILITY)\n capability = MAX_CAPABILITY;\n else\n while(capability < org_capability )\n capability <<= 1;\n hashmap_t *answer = (hashmap_t *)malloc(sizeof(hashmap_t));\n answer->hash_base = getHashBase();\n answer->table = (hashmap_list_t **)malloc(sizeof(hashmap_list_t *) * capability);\n memset(answer->table, 0, sizeof(hashmap_list_t *) * capability);\n answer->hash_code = hashCode;\n answer->table_capability = capability;\n answer->threshold = (int)(capability * DEFAULT_LOAD_FACTOR);\n answer->size = 0;\n return answer;\n}", "canonical_original_code": "struct _hashmap *hashmap_initialize(int org_capability, int (*hashCode)(int))\n{\n int capability = 1;\n if(org_capability < 0)\n return ((void *)0);\n else if( org_capability > MAX_CAPABILITY)\n capability = MAX_CAPABILITY;\n else\n while(capability < org_capability )\n capability <<= 1;\n struct _hashmap *answer = (hashmap_t *)malloc(sizeof(hashmap_t));\n answer->hash_base = getHashBase();\n answer->table = (struct _linked_list **)malloc(sizeof(struct _linked_list *) * capability);\n memset(answer->table, 0, sizeof(struct _linked_list *) * capability);\n answer->hash_code = hashCode;\n answer->table_capability = capability;\n answer->threshold = (int)(capability * DEFAULT_LOAD_FACTOR);\n answer->size = 0;\n return answer;\n}", "variable_types": [ [ "org_capability", "int" ], [ "hashCode", "int (*)(int)" ], [ "capability", "int" ], [ "answer", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ] ], "return_type": "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hashmap_initialize_default", "canonical_name": "func11", "repo": "norlanliu/data-structure", "decompiled_code": "void *__fastcall hashmap_initialize_default(__int64 a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(0x20uLL);\n*((_DWORD *)v2 + 2) = getHashBase();\n*((_QWORD *)v2 + 2) = a1;\n*((_DWORD *)v2 + 3) = 16;\n*((_DWORD *)v2 + 1) = (int)(float)(0.75 * (float)16);\n*((_QWORD *)v2 + 3) = malloc(0x80uLL);\nmemset(*((void **)v2 + 3), 0, 0x80uLL);\n*(_DWORD *)v2 = 0;\nreturn v2;\n}\n", "canonical_decompiled_code": "void *__fastcall func11(__int64 a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(0x20uLL);\n*((_DWORD *)v2 + 2) = func6();\n*((_QWORD *)v2 + 2) = a1;\n*((_DWORD *)v2 + 3) = 16;\n*((_DWORD *)v2 + 1) = (int)(float)(0.75 * (float)16);\n*((_QWORD *)v2 + 3) = malloc(0x80uLL);\nmemset(*((void **)v2 + 3), 0, 0x80uLL);\n*(_DWORD *)v2 = 0;\nreturn v2;\n}", "original_code": "hashmap_t *hashmap_initialize_default(int (*hashCode)(int))\n{\n hashmap_t *answer = (hashmap_t *)malloc(sizeof(hashmap_t));\n answer->hash_base = getHashBase();\n answer->hash_code = hashCode;\n answer->table_capability = DEFAULT_TABLE_CAPABILITY;\n answer->threshold = (int)(DEFAULT_LOAD_FACTOR * DEFAULT_TABLE_CAPABILITY);\n answer->table = (hashmap_list_t **)malloc(sizeof(hashmap_list_t *) * DEFAULT_TABLE_CAPABILITY);\n memset(answer->table, 0, sizeof(hashmap_list_t *) * DEFAULT_TABLE_CAPABILITY);\n answer->size = 0;\n return answer;\n}", "canonical_original_code": "struct _hashmap *hashmap_initialize_default(int (*hashCode)(int))\n{\n struct _hashmap *answer = (hashmap_t *)malloc(sizeof(hashmap_t));\n answer->hash_base = getHashBase();\n answer->hash_code = hashCode;\n answer->table_capability = DEFAULT_TABLE_CAPABILITY;\n answer->threshold = (int)(DEFAULT_LOAD_FACTOR * DEFAULT_TABLE_CAPABILITY);\n answer->table = (struct _linked_list **)malloc(sizeof(struct _linked_list *) * DEFAULT_TABLE_CAPABILITY);\n memset(answer->table, 0, sizeof(struct _linked_list *) * DEFAULT_TABLE_CAPABILITY);\n answer->size = 0;\n return answer;\n}", "variable_types": [ [ "hashCode", "int (*)(int)" ], [ "answer", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ] ], "return_type": "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hashmap_put", "canonical_name": "func12", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall hashmap_put(__int64 a1, unsigned int a2, int a3)\n{\nunsigned int v4; // ebx\nint v5; // eax\n_DWORD *v6; // rax\nunsigned int v8; // [rsp+20h] [rbp-20h]\nint v9; // [rsp+24h] [rbp-1Ch]\n__int64 i; // [rsp+28h] [rbp-18h]\n\nif ( !a1 || !*(_QWORD *)(a1 + 24) )\nreturn 4294967294LL;\nif ( *(_DWORD *)a1 >= *(_DWORD *)(a1 + 4) - 1 )\nresize(a1, 2 * *(_DWORD *)(a1 + 12));\nv4 = *(_DWORD *)(a1 + 8);\nv5 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv9 = hash(v5, v4);\nv8 = indexForTable(v9, *(_DWORD *)(a1 + 12));\nprintf(\"key : %d, index : %d\\n\", a2, v8);\nif ( *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)v8) )\n{\nfor ( i = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)v8); i; i = *(_QWORD *)(i + 16) )\n{\nif ( v9 == *(_DWORD *)i && a2 == *(_DWORD *)(i + 4) )\n{\n*(_DWORD *)(i + 8) = a3;\nreturn 0xFFFFFFFFLL;\n}\n}\n}\nv6 = malloc(0x18uLL);\n*v6 = v9;\nv6[1] = a2;\nv6[2] = a3;\n*((_QWORD *)v6 + 2) = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)v8);\n*(_QWORD *)(8LL * (int)v8 + *(_QWORD *)(a1 + 24)) = v6;\n++*(_DWORD *)a1;\nreturn v8;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func12(__int64 a1, unsigned int a2, int a3)\n{\nunsigned int v4; // ebx\nint v5; // eax\n_DWORD *v6; // rax\nunsigned int v8; // [rsp+20h] [rbp-20h]\nint v9; // [rsp+24h] [rbp-1Ch]\n__int64 i; // [rsp+28h] [rbp-18h]\n\nif ( !a1 || !*(_QWORD *)(a1 + 24) )\nreturn 4294967294LL;\nif ( *(_DWORD *)a1 >= *(_DWORD *)(a1 + 4) - 1 )\nfunc9(a1, 2 * *(_DWORD *)(a1 + 12));\nv4 = *(_DWORD *)(a1 + 8);\nv5 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv9 = func7(v5, v4);\nv8 = func8(v9, *(_DWORD *)(a1 + 12));\nprintf(\"key : %d, index : %d\\n\", a2, v8);\nif ( *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)v8) )\n{\nfor ( i = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)v8); i; i = *(_QWORD *)(i + 16) )\n{\nif ( v9 == *(_DWORD *)i && a2 == *(_DWORD *)(i + 4) )\n{\n*(_DWORD *)(i + 8) = a3;\nreturn 0xFFFFFFFFLL;\n}\n}\n}\nv6 = malloc(0x18uLL);\n*v6 = v9;\nv6[1] = a2;\nv6[2] = a3;\n*((_QWORD *)v6 + 2) = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)v8);\n*(_QWORD *)(8LL * (int)v8 + *(_QWORD *)(a1 + 24)) = v6;\n++*(_DWORD *)a1;\nreturn v8;\n}", "original_code": "int hashmap_put(hashmap_t *map, int key, int value)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return -2;\n if(map->size >= (map->threshold-1))\n resize(map, 2*map->table_capability);\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n printf(\"key : %d, index : %d\\n\", key, index);\n if(map->table[index] != ((void *)0))\n {\n hashmap_list_t *temp;\n for(temp = map->table[index]; temp != ((void *)0); temp = temp->next)\n {\n if(temp->hash == hash_num && temp->key == key)\n {\n temp->value = value;\n return -1;\n }\n }\n }\n hashmap_list_t * newNode = (hashmap_list_t *)malloc(sizeof(hashmap_list_t));\n newNode->hash = hash_num;\n newNode->key = key;\n newNode->value = value;\n newNode->next = map->table[index];\n map->table[index] = newNode;\n map->size++;\n return index;\n}", "canonical_original_code": "int hashmap_put(struct _hashmap *map, int key, int value)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return -2;\n if(map->size >= (map->threshold-1))\n resize(map, 2*map->table_capability);\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n printf(\"key : %d, index : %d\\n\", key, index);\n if(map->table[index] != ((void *)0))\n {\n struct _linked_list *temp;\n for(temp = map->table[index]; temp != ((void *)0); temp = temp->next)\n {\n if(temp->hash == hash_num && temp->key == key)\n {\n temp->value = value;\n return -1;\n }\n }\n }\n struct _linked_list *newNode = (hashmap_list_t *)malloc(sizeof(hashmap_list_t));\n newNode->hash = hash_num;\n newNode->key = key;\n newNode->value = value;\n newNode->next = map->table[index];\n map->table[index] = newNode;\n map->size++;\n return index;\n}", "variable_types": [ [ "map", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ], [ "key", "int" ], [ "value", "int" ], [ "hash_num", "int" ], [ "index", "int" ], [ "temp", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ], [ "newNode", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ] ], "return_type": "int", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hashmap_contains", "canonical_name": "func13", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall hashmap_contains(__int64 a1, unsigned int a2, int a3)\n{\nunsigned int v4; // ebx\nint v5; // eax\nint v7; // [rsp+14h] [rbp-1Ch]\n__int64 i; // [rsp+18h] [rbp-18h]\n\nif ( !a1 || !*(_QWORD *)(a1 + 24) )\nreturn 0xFFFFFFFFLL;\nv4 = *(_DWORD *)(a1 + 8);\nv5 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv7 = hash(v5, v4);\nfor ( i = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)indexForTable(v7, *(_DWORD *)(a1 + 12)));\ni;\ni = *(_QWORD *)(i + 16) )\n{\nif ( v7 == *(_DWORD *)i && a2 == *(_DWORD *)(i + 4) && a3 == *(_DWORD *)(i + 8) )\nreturn 0LL;\n}\nreturn 1LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func13(__int64 a1, unsigned int a2, int a3)\n{\nunsigned int v4; // ebx\nint v5; // eax\nint v7; // [rsp+14h] [rbp-1Ch]\n__int64 i; // [rsp+18h] [rbp-18h]\n\nif ( !a1 || !*(_QWORD *)(a1 + 24) )\nreturn 0xFFFFFFFFLL;\nv4 = *(_DWORD *)(a1 + 8);\nv5 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv7 = func7(v5, v4);\nfor ( i = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * (int)func8(v7, *(_DWORD *)(a1 + 12)));\ni;\ni = *(_QWORD *)(i + 16) )\n{\nif ( v7 == *(_DWORD *)i && a2 == *(_DWORD *)(i + 4) && a3 == *(_DWORD *)(i + 8) )\nreturn 0LL;\n}\nreturn 1LL;\n}", "original_code": "int hashmap_contains(hashmap_t *map, int key, int value)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return -1;\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n hashmap_list_t *temp;\n for(temp = map->table[index]; temp != ((void *)0); temp = temp->next)\n if(temp->hash == hash_num && temp->key == key && temp->value == value)\n return 0;\n return 1;\n}", "canonical_original_code": "int hashmap_contains(struct _hashmap *map, int key, int value)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return -1;\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n struct _linked_list *temp;\n for(temp = map->table[index]; temp != ((void *)0); temp = temp->next)\n if(temp->hash == hash_num && temp->key == key && temp->value == value)\n return 0;\n return 1;\n}", "variable_types": [ [ "map", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ], [ "key", "int" ], [ "value", "int" ], [ "hash_num", "int" ], [ "index", "int" ], [ "temp", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ] ], "return_type": "int", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hashmap_remove", "canonical_name": "func14", "repo": "norlanliu/data-structure", "decompiled_code": "void __fastcall hashmap_remove(__int64 a1, unsigned int a2)\n{\nunsigned int v2; // ebx\nint v3; // eax\nint v4; // [rsp+18h] [rbp-28h]\nint v5; // [rsp+1Ch] [rbp-24h]\n_DWORD *v6; // [rsp+20h] [rbp-20h]\n_DWORD *ptr; // [rsp+28h] [rbp-18h]\n_DWORD *ptra; // [rsp+28h] [rbp-18h]\n\nif ( a1 && *(_QWORD *)(a1 + 24) )\n{\nv2 = *(_DWORD *)(a1 + 8);\nv3 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv5 = hash(v3, v2);\nv4 = indexForTable(v5, *(_DWORD *)(a1 + 12));\nptr = *(_DWORD **)(*(_QWORD *)(a1 + 24) + 8LL * v4);\nv6 = ptr;\nif ( ptr && v5 == *ptr && a2 == ptr[1] )\n{\n*(_QWORD *)(8LL * v4 + *(_QWORD *)(a1 + 24)) = *((_QWORD *)ptr + 2);\nfree(ptr);\n}\nelse\n{\nfor ( ptra = *(_DWORD **)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * v4) + 16LL);\nptra;\nptra = (_DWORD *)*((_QWORD *)ptra + 2) )\n{\nif ( v5 == *ptra && a2 == ptra[1] )\n{\n*((_QWORD *)v6 + 2) = *((_QWORD *)ptra + 2);\nfree(ptra);\nreturn;\n}\nv6 = (_DWORD *)*((_QWORD *)v6 + 2);\n}\n}\n}\n}\n", "canonical_decompiled_code": "void __fastcall func14(__int64 a1, unsigned int a2)\n{\nunsigned int v2; // ebx\nint v3; // eax\nint v4; // [rsp+18h] [rbp-28h]\nint v5; // [rsp+1Ch] [rbp-24h]\n_DWORD *v6; // [rsp+20h] [rbp-20h]\n_DWORD *ptr; // [rsp+28h] [rbp-18h]\n_DWORD *ptra; // [rsp+28h] [rbp-18h]\n\nif ( a1 && *(_QWORD *)(a1 + 24) )\n{\nv2 = *(_DWORD *)(a1 + 8);\nv3 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv5 = func7(v3, v2);\nv4 = func8(v5, *(_DWORD *)(a1 + 12));\nptr = *(_DWORD **)(*(_QWORD *)(a1 + 24) + 8LL * v4);\nv6 = ptr;\nif ( ptr && v5 == *ptr && a2 == ptr[1] )\n{\n*(_QWORD *)(8LL * v4 + *(_QWORD *)(a1 + 24)) = *((_QWORD *)ptr + 2);\nfree(ptr);\n}\nelse\n{\nfor ( ptra = *(_DWORD **)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * v4) + 16LL);\nptra;\nptra = (_DWORD *)*((_QWORD *)ptra + 2) )\n{\nif ( v5 == *ptra && a2 == ptra[1] )\n{\n*((_QWORD *)v6 + 2) = *((_QWORD *)ptra + 2);\nfree(ptra);\nreturn;\n}\nv6 = (_DWORD *)*((_QWORD *)v6 + 2);\n}\n}\n}\n}", "original_code": "void hashmap_remove(hashmap_t *map, int key)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return;\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n hashmap_list_t *temp = map->table[index], *prev = map->table[index];\n if(temp != ((void *)0) && temp->hash == hash_num && temp->key == key)\n {\n map->table[index] = temp->next;\n free(temp);\n }\n else\n {\n for(temp = map->table[index]->next; temp != ((void *)0); temp = temp->next)\n {\n if(temp->hash == hash_num && temp->key == key)\n {\n prev->next = temp->next;\n free(temp);\n break;\n }\n prev = prev->next;\n }\n }\n}", "canonical_original_code": "void hashmap_remove(struct _hashmap *map, int key)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return;\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n struct _linked_list *temp = map->table[index]; struct _linked_list *prev = map->table[index];\n if(temp != ((void *)0) && temp->hash == hash_num && temp->key == key)\n {\n map->table[index] = temp->next;\n free(temp);\n }\n else\n {\n for(temp = map->table[index]->next; temp != ((void *)0); temp = temp->next)\n {\n if(temp->hash == hash_num && temp->key == key)\n {\n prev->next = temp->next;\n free(temp);\n break;\n }\n prev = prev->next;\n }\n }\n}", "variable_types": [ [ "map", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ], [ "key", "int" ], [ "hash_num", "int" ], [ "index", "int" ], [ "temp", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ], [ "prev", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hashmap_get", "canonical_name": "func15", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall hashmap_get(__int64 a1, unsigned int a2)\n{\nunsigned int v3; // ebx\nint v4; // eax\nint v5; // [rsp+10h] [rbp-20h]\nint v6; // [rsp+14h] [rbp-1Ch]\n__int64 i; // [rsp+18h] [rbp-18h]\n\nif ( !a1 || !*(_QWORD *)(a1 + 24) )\nreturn 0xFFFFFFFFLL;\nv3 = *(_DWORD *)(a1 + 8);\nv4 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv6 = hash(v4, v3);\nv5 = indexForTable(v6, *(_DWORD *)(a1 + 12));\nif ( *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * v5) )\n{\nfor ( i = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * v5); i; i = *(_QWORD *)(i + 16) )\n{\nif ( v6 == *(_DWORD *)i && a2 == *(_DWORD *)(i + 4) )\nreturn *(unsigned int *)(i + 8);\n}\n}\nreturn 0xFFFFFFFFLL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func15(__int64 a1, unsigned int a2)\n{\nunsigned int v3; // ebx\nint v4; // eax\nint v5; // [rsp+10h] [rbp-20h]\nint v6; // [rsp+14h] [rbp-1Ch]\n__int64 i; // [rsp+18h] [rbp-18h]\n\nif ( !a1 || !*(_QWORD *)(a1 + 24) )\nreturn 0xFFFFFFFFLL;\nv3 = *(_DWORD *)(a1 + 8);\nv4 = (*(__int64 (__fastcall **)(_QWORD))(a1 + 16))(a2);\nv6 = func7(v4, v3);\nv5 = func8(v6, *(_DWORD *)(a1 + 12));\nif ( *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * v5) )\n{\nfor ( i = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * v5); i; i = *(_QWORD *)(i + 16) )\n{\nif ( v6 == *(_DWORD *)i && a2 == *(_DWORD *)(i + 4) )\nreturn *(unsigned int *)(i + 8);\n}\n}\nreturn 0xFFFFFFFFLL;\n}", "original_code": "int hashmap_get(hashmap_t *map, int key)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return -1;\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n if(map->table[index] != ((void *)0))\n {\n hashmap_list_t *temp;\n for(temp = map->table[index]; temp != ((void *)0); temp = temp->next)\n if(temp->hash == hash_num && temp->key == key)\n return temp->value;\n }\n return -1;\n}", "canonical_original_code": "int hashmap_get(struct _hashmap *map, int key)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return -1;\n int hash_num = hash((*(map->hash_code))(key), map->hash_base);\n int index = indexForTable(hash_num, map->table_capability);\n if(map->table[index] != ((void *)0))\n {\n struct _linked_list *temp;\n for(temp = map->table[index]; temp != ((void *)0); temp = temp->next)\n if(temp->hash == hash_num && temp->key == key)\n return temp->value;\n }\n return -1;\n}", "variable_types": [ [ "map", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ], [ "key", "int" ], [ "hash_num", "int" ], [ "index", "int" ], [ "temp", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ] ], "return_type": "int", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" }, { "name": "hashmap_free", "canonical_name": "func16", "repo": "norlanliu/data-structure", "decompiled_code": "void __fastcall hashmap_free(__int64 a1)\n{\n_QWORD *j; // [rsp+18h] [rbp-18h]\n_QWORD *ptr; // [rsp+20h] [rbp-10h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nif ( a1 && *(_QWORD *)(a1 + 24) )\n{\nfor ( i = 0; i < *(_DWORD *)(a1 + 12); ++i )\n{\nptr = *(_QWORD **)(*(_QWORD *)(a1 + 24) + 8LL * i);\nfor ( j = ptr; j; ptr = j )\n{\nj = (_QWORD *)j[2];\nfree(ptr);\n}\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * i) = 0LL;\n}\nfree((void *)a1);\n}\n}\n", "canonical_decompiled_code": "void __fastcall func16(__int64 a1)\n{\n_QWORD *j; // [rsp+18h] [rbp-18h]\n_QWORD *ptr; // [rsp+20h] [rbp-10h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nif ( a1 && *(_QWORD *)(a1 + 24) )\n{\nfor ( i = 0; i < *(_DWORD *)(a1 + 12); ++i )\n{\nptr = *(_QWORD **)(*(_QWORD *)(a1 + 24) + 8LL * i);\nfor ( j = ptr; j; ptr = j )\n{\nj = (_QWORD *)j[2];\nfree(ptr);\n}\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL * i) = 0LL;\n}\nfree((void *)a1);\n}\n}", "original_code": "void hashmap_free(hashmap_t *map)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return;\n int i;\n hashmap_list_t *temp1, *temp2;\n for(i = 0; i < map->table_capability; i++)\n {\n temp1 = map->table[i];\n temp2 = temp1;\n while(temp2 != ((void *)0))\n {\n temp2 = temp2->next;\n free(temp1);\n temp1 = temp2;\n }\n map->table[i] = ((void *)0);\n }\n free(map);\n map = ((void *)0);\n}", "canonical_original_code": "void hashmap_free(struct _hashmap *map)\n{\n if(map == ((void *)0) || map->table == ((void *)0))\n return;\n int i;\n struct _linked_list *temp1; struct _linked_list *temp2;\n for(i = 0; i < map->table_capability; i++)\n {\n temp1 = map->table[i];\n temp2 = temp1;\n while(temp2 != ((void *)0))\n {\n temp2 = temp2->next;\n free(temp1);\n temp1 = temp2;\n }\n map->table[i] = ((void *)0);\n }\n free(map);\n map = ((void *)0);\n}", "variable_types": [ [ "map", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ], [ "i", "int" ], [ "temp1", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ], [ "temp2", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "dcb66efe95bcdb506eb3241dd39aec7bd18dec6612d37060c77ac20b7af68f89" } ]
f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a
norlanliu/data-structure
[ [ "insert", "->" ], [ "findItem", "->" ], [ "findPredecessor", "->", "deleteItem" ], [ "deleteItem", "->", "findPredecessor", "remove_duplication" ], [ "freeList", "->" ], [ "printList", "->" ], [ "reverseList", "->" ], [ "hashCode", "->" ], [ "remove_duplication", "->", "deleteItem" ] ]
[]
[ { "name": "insert", "canonical_name": "func0", "repo": "norlanliu/data-structure", "decompiled_code": "void __fastcall insert(__int64 a1, int a2)\n{\n_QWORD *v2; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nv2 = malloc(0x10uLL);\n*(_DWORD *)v2 = a2;\nv2[1] = *(_QWORD *)(a1 + 8);\n*(_QWORD *)(a1 + 8) = v2;\n}\n}\n", "canonical_decompiled_code": "void __fastcall func0(__int64 a1, int a2)\n{\n_QWORD *v2; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nv2 = malloc(0x10uLL);\n*(_DWORD *)v2 = a2;\nv2[1] = *(_QWORD *)(a1 + 8);\n*(_QWORD *)(a1 + 8) = v2;\n}\n}", "original_code": "void insert(list *l, item_type item)\n{\n if(l == ((void *)0))\n return;\n list * newItem = (list *)malloc(sizeof(list));\n newItem->item = item;\n newItem->next = l->next;\n l->next = newItem;\n}", "canonical_original_code": "void insert(struct _list *l, int item)\n{\n if(l == ((void *)0))\n return;\n struct _list *newItem = (list *)malloc(sizeof(list));\n newItem->item = item;\n newItem->next = l->next;\n l->next = newItem;\n}", "variable_types": [ [ "l", "struct _list { int item; struct _list *next; } *" ], [ "item", "int" ], [ "newItem", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "findItem", "canonical_name": "func1", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall findItem(__int64 a1, int a2)\n{\n__int64 i; // [rsp+14h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nfor ( i = a1; i; i = *(_QWORD *)(i + 8) )\n{\nif ( a2 == *(_DWORD *)i )\nreturn i;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, int a2)\n{\n__int64 i; // [rsp+14h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nfor ( i = a1; i; i = *(_QWORD *)(i + 8) )\n{\nif ( a2 == *(_DWORD *)i )\nreturn i;\n}\nreturn 0LL;\n}", "original_code": "list *findItem(list *l, item_type item)\n{\n if(l == ((void *)0))\n return ((void *)0);\n list *p = l;\n while(p != ((void *)0))\n {\n if(p->item == item)\n return p;\n else\n p = p->next;\n }\n return ((void *)0);\n}", "canonical_original_code": "struct _list *findItem(struct _list *l, int item)\n{\n if(l == ((void *)0))\n return ((void *)0);\n struct _list *p = l;\n while(p != ((void *)0))\n {\n if(p->item == item)\n return p;\n else\n p = p->next;\n }\n return ((void *)0);\n}", "variable_types": [ [ "l", "struct _list *" ], [ "item", "int" ], [ "p", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "struct _list { int item; struct _list *next; } *", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "findPredecessor", "canonical_name": "func2", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall findPredecessor(__int64 a1, int a2)\n{\n__int64 i; // [rsp+14h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nfor ( i = a1; *(_QWORD *)(i + 8); i = *(_QWORD *)(i + 8) )\n{\nif ( a2 == **(_DWORD **)(i + 8) )\nreturn i;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, int a2)\n{\n__int64 i; // [rsp+14h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nfor ( i = a1; *(_QWORD *)(i + 8); i = *(_QWORD *)(i + 8) )\n{\nif ( a2 == **(_DWORD **)(i + 8) )\nreturn i;\n}\nreturn 0LL;\n}", "original_code": "list *findPredecessor(list *l, item_type x)\n{\n if(l == ((void *)0))\n return ((void *)0);\n list * p = l;\n while(p->next != ((void *)0))\n {\n if(p->next->item == x)\n return p;\n else\n p = p->next;\n }\n return ((void *)0);\n}", "canonical_original_code": "struct _list *findPredecessor(struct _list *l, int x)\n{\n if(l == ((void *)0))\n return ((void *)0);\n struct _list *p = l;\n while(p->next != ((void *)0))\n {\n if(p->next->item == x)\n return p;\n else\n p = p->next;\n }\n return ((void *)0);\n}", "variable_types": [ [ "l", "struct _list *" ], [ "x", "int" ], [ "p", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "struct _list { int item; struct _list *next; } *", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "deleteItem", "canonical_name": "func3", "repo": "norlanliu/data-structure", "decompiled_code": "void __fastcall deleteItem(__int64 a1, int a2)\n{\n_QWORD *ptr; // [rsp+10h] [rbp-10h]\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nv3 = findPredecessor(a1, a2);\nif ( v3 )\n{\nptr = *(_QWORD **)(v3 + 8);\n*(_QWORD *)(v3 + 8) = ptr[1];\nfree(ptr);\n}\n}\n}\n", "canonical_decompiled_code": "void __fastcall func3(__int64 a1, int a2)\n{\n_QWORD *ptr; // [rsp+10h] [rbp-10h]\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nv3 = func2(a1, a2);\nif ( v3 )\n{\nptr = *(_QWORD **)(v3 + 8);\n*(_QWORD *)(v3 + 8) = ptr[1];\nfree(ptr);\n}\n}\n}", "original_code": "void deleteItem(list *l, item_type x)\n{\n if(l == ((void *)0))\n return;\n list *p = findPredecessor(l,x);\n if(p != ((void *)0))\n {\n list *old = p->next;\n p->next = old->next;\n free(old);\n old = ((void *)0);\n }\n}", "canonical_original_code": "void deleteItem(struct _list *l, int x)\n{\n if(l == ((void *)0))\n return;\n struct _list *p = findPredecessor(l,x);\n if(p != ((void *)0))\n {\n struct _list *old = p->next;\n p->next = old->next;\n free(old);\n old = ((void *)0);\n }\n}", "variable_types": [ [ "l", "struct _list { int item; struct _list *next; } *" ], [ "x", "int" ], [ "p", "struct _list { int item; struct _list *next; } *" ], [ "old", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "freeList", "canonical_name": "func4", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall freeList(__int64 a1)\n{\n__int64 result; // rax\n_QWORD *ptr; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nwhile ( 1 )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( !result )\nbreak;\nptr = *(_QWORD **)(a1 + 8);\n*(_QWORD *)(a1 + 8) = ptr[1];\nfree(ptr);\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1)\n{\n__int64 result; // rax\n_QWORD *ptr; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nwhile ( 1 )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( !result )\nbreak;\nptr = *(_QWORD **)(a1 + 8);\n*(_QWORD *)(a1 + 8) = ptr[1];\nfree(ptr);\n}\n}\nreturn result;\n}", "original_code": "void freeList(list *l)\n{\n if(l != ((void *)0))\n {\n list *temp = ((void *)0);\n while(l->next != ((void *)0))\n {\n temp = l->next;\n l->next = temp->next;\n free(temp);\n temp = ((void *)0);\n }\n }\n}", "canonical_original_code": "void freeList(struct _list *l)\n{\n if(l != ((void *)0))\n {\n struct _list *temp = ((void *)0);\n while(l->next != ((void *)0))\n {\n temp = l->next;\n l->next = temp->next;\n free(temp);\n temp = ((void *)0);\n }\n }\n}", "variable_types": [ [ "l", "struct _list { int item; struct _list *next; } *" ], [ "temp", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "printList", "canonical_name": "func5", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall printList(__int64 a1)\n{\n__int64 result; // rax\n\nif ( a1 )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( result )\n{\nprintf(\"%d\\n\", **(unsigned int **)(a1 + 8));\nresult = printList(*(_QWORD *)(a1 + 8));\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1)\n{\n__int64 result; // rax\n\nif ( a1 )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( result )\n{\nprintf(\"%d\\n\", **(unsigned int **)(a1 + 8));\nresult = func5(*(_QWORD *)(a1 + 8));\n}\n}\nreturn result;\n}", "original_code": "void printList(list *l)\n{\n if(l == ((void *)0) || l->next == ((void *)0))\n return;\n printf(\"%d\\n\", l->next->item);\n printList(l->next);\n}", "canonical_original_code": "void printList(struct _list *l)\n{\n if(l == ((void *)0) || l->next == ((void *)0))\n return;\n printf(\"%d\\n\", l->next->item);\n printList(l->next);\n}", "variable_types": [ [ "l", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "reverseList", "canonical_name": "func6", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall reverseList(__int64 a1)\n{\n__int64 result; // rax\n__int64 i; // [rsp+10h] [rbp-18h]\n__int64 v3; // [rsp+18h] [rbp-10h]\n__int64 v4; // [rsp+20h] [rbp-8h]\n\nif ( a1 )\n{\nv4 = *(_QWORD *)(a1 + 8);\nv3 = *(_QWORD *)(v4 + 8);\n*(_QWORD *)(v4 + 8) = 0LL;\nfor ( i = v3; i; v3 = i )\n{\ni = *(_QWORD *)(v3 + 8);\n*(_QWORD *)(v3 + 8) = v4;\nv4 = v3;\n}\nresult = a1;\n*(_QWORD *)(a1 + 8) = v4;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1)\n{\n__int64 result; // rax\n__int64 i; // [rsp+10h] [rbp-18h]\n__int64 v3; // [rsp+18h] [rbp-10h]\n__int64 v4; // [rsp+20h] [rbp-8h]\n\nif ( a1 )\n{\nv4 = *(_QWORD *)(a1 + 8);\nv3 = *(_QWORD *)(v4 + 8);\n*(_QWORD *)(v4 + 8) = 0LL;\nfor ( i = v3; i; v3 = i )\n{\ni = *(_QWORD *)(v3 + 8);\n*(_QWORD *)(v3 + 8) = v4;\nv4 = v3;\n}\nresult = a1;\n*(_QWORD *)(a1 + 8) = v4;\n}\nreturn result;\n}", "original_code": "void reverseList(list *l)\n{\n if(l == ((void *)0))\n return;\n list *p1 = l->next;\n list *p2 = p1->next;\n p1->next = ((void *)0);\n list *pTemp = p2;\n while(pTemp != ((void *)0))\n {\n pTemp = p2->next;\n p2->next = p1;\n p1 = p2;\n p2 = pTemp;\n }\n l->next = p1;\n}", "canonical_original_code": "void reverseList(struct _list *l)\n{\n if(l == ((void *)0))\n return;\n struct _list *p1 = l->next;\n struct _list *p2 = p1->next;\n p1->next = ((void *)0);\n struct _list *pTemp = p2;\n while(pTemp != ((void *)0))\n {\n pTemp = p2->next;\n p2->next = p1;\n p1 = p2;\n p2 = pTemp;\n }\n l->next = p1;\n}", "variable_types": [ [ "l", "struct _list { int item; struct _list *next; } *" ], [ "p1", "struct _list { int item; struct _list *next; } *" ], [ "p2", "struct _list { int item; struct _list *next; } *" ], [ "pTemp", "struct _list { int item; struct _list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "hashCode", "canonical_name": "func7", "repo": "norlanliu/data-structure", "decompiled_code": "__int64 __fastcall hashCode(int a1)\n{\nreturn (unsigned int)(a1 + 31);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(int a1)\n{\nreturn (unsigned int)(a1 + 31);\n}", "original_code": "static int hashCode(item_type item)\n{\n return 31 + item;\n}", "canonical_original_code": "static int hashCode(int item)\n{\n return 31 + item;\n}", "variable_types": [ [ "item", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" }, { "name": "remove_duplication", "canonical_name": "func8", "repo": "norlanliu/data-structure", "decompiled_code": "int __fastcall remove_duplication(__int64 a1)\n{\nint v3; // [rsp+18h] [rbp-18h]\n__int64 v4; // [rsp+20h] [rbp-10h]\nint v5; // [rsp+28h] [rbp-8h]\n\nv5 = clock();\nv4 = hashmap_initialize(13LL, hashCode);\nwhile ( *(_QWORD *)(a1 + 8) )\n{\nif ( (int)hashmap_put(v4, **(unsigned int **)(a1 + 8), 0LL) >= 0 )\na1 = *(_QWORD *)(a1 + 8);\nelse\ndeleteItem(a1, **(_DWORD **)(a1 + 8));\n}\nv3 = clock();\nreturn printf(\"Total time taken by CPU is %f\\n\", (double)(v3 - v5) / 1000000.0);\n}\n", "canonical_decompiled_code": "int __fastcall func8(__int64 a1)\n{\nint v3; // [rsp+18h] [rbp-18h]\n__int64 v4; // [rsp+20h] [rbp-10h]\nint v5; // [rsp+28h] [rbp-8h]\n\nv5 = clock();\nv4 = hashmap_initialize(13LL, hashCode);\nwhile ( *(_QWORD *)(a1 + 8) )\n{\nif ( (int)hashmap_put(v4, **(unsigned int **)(a1 + 8), 0LL) >= 0 )\na1 = *(_QWORD *)(a1 + 8);\nelse\nfunc3(a1, **(_DWORD **)(a1 + 8));\n}\nv3 = clock();\nreturn printf(\"Total time taken by CPU is %f\\n\", (double)(v3 - v5) / 1000000.0);\n}", "original_code": "void remove_duplication(list *l)\n{\n clock_t start = clock();\n hashmap_t *map = hashmap_initialize(13, &hashCode);\n while(l->next != ((void *)0))\n {\n if(hashmap_put(map, l->next->item, 0) < 0 )\n deleteItem(l, l->next->item);\n else\n l = l->next;\n }\n clock_t end = clock();\n printf(\"Total time taken by CPU is %f\\n\", (double)(end-start)/((__clock_t) 1000000));\n}", "canonical_original_code": "void remove_duplication(struct _list *l)\n{\n long start = clock();\n struct _hashmap *map = hashmap_initialize(13, &hashCode);\n while(l->next != ((void *)0))\n {\n if(hashmap_put(map, l->next->item, 0) < 0 )\n deleteItem(l, l->next->item);\n else\n l = l->next;\n }\n long end = clock();\n printf(\"Total time taken by CPU is %f\\n\", (double)(end-start)/((long) 1000000));\n}", "variable_types": [ [ "l", "struct _list { int item; struct _list *next; } *" ], [ "start", "long" ], [ "map", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list { int hash; int key; int value; struct _linked_list *next; } **table; } *" ], [ "end", "long" ] ], "return_type": "void", "user_defined_types": [ "struct _list { int item; struct _list *next; }", "struct _hashmap { int size; int threshold; int hash_base; int table_capability; int (*hash_code)(int); struct _linked_list **table; }", "struct _linked_list { int hash; int key; int value; struct _linked_list *next; }" ], "binary_hash": "f0fbae09c9584d4d599b2f6361101e0df5d5fdcc1cc3ffcf1597bc6a65d31d3a" } ]
c7db6cbf1eb8f8eb2c6b52725eb05681200eaa0e9960b306bafe0f2a4cb6b4a1
diekmann/C_MemoryManagementManager
[ [ "GenericMemoryManager_malloc_f", "->" ], [ "GenericMemoryManager_free_f", "->" ], [ "GenericMemoryManager_print_stats", "->" ], [ "GenericMemoryManager_delete", "->" ] ]
[]
[ { "name": "GenericMemoryManager_malloc_f", "canonical_name": "func0", "repo": "diekmann/C_MemoryManagementManager", "decompiled_code": "void *__fastcall GenericMemoryManager_malloc_f(size_t *a1)\n{\n_DWORD *v2; // [rsp+18h] [rbp-28h]\nvoid *v3; // [rsp+20h] [rbp-20h]\nint v4; // [rsp+2Ch] [rbp-14h]\nsize_t v5; // [rsp+30h] [rbp-10h]\nsize_t v6; // [rsp+38h] [rbp-8h]\n\nv3 = malloc(*a1);\nprintf(\"[INFO] allocated %zu bytes of memory at %p\\n\", *a1, v3);\n++*((_DWORD *)a1 + 2);\nv6 = a1[2];\nv5 = v6;\nwhile ( v6 )\n{\nv5 = v6;\nv6 = *(_QWORD *)(v6 + 16);\n}\nv2 = malloc(0x18uLL);\nif ( v5 )\n{\n*(_QWORD *)(v5 + 16) = v2;\nv4 = *(_DWORD *)(v5 + 8) + 1;\n}\nelse\n{\na1[2] = (size_t)v2;\nv4 = 0;\n}\n*(_QWORD *)v2 = v3;\nv2[2] = v4;\nreturn v3;\n}\n", "canonical_decompiled_code": "void *__fastcall func0(size_t *a1)\n{\n_DWORD *v2; // [rsp+18h] [rbp-28h]\nvoid *v3; // [rsp+20h] [rbp-20h]\nint v4; // [rsp+2Ch] [rbp-14h]\nsize_t v5; // [rsp+30h] [rbp-10h]\nsize_t v6; // [rsp+38h] [rbp-8h]\n\nv3 = malloc(*a1);\nprintf(\"[INFO] allocated %zu bytes of memory at %p\\n\", *a1, v3);\n++*((_DWORD *)a1 + 2);\nv6 = a1[2];\nv5 = v6;\nwhile ( v6 )\n{\nv5 = v6;\nv6 = *(_QWORD *)(v6 + 16);\n}\nv2 = malloc(0x18uLL);\nif ( v5 )\n{\n*(_QWORD *)(v5 + 16) = v2;\nv4 = *(_DWORD *)(v5 + 8) + 1;\n}\nelse\n{\na1[2] = (size_t)v2;\nv4 = 0;\n}\n*(_QWORD *)v2 = v3;\nv2[2] = v4;\nreturn v3;\n}", "original_code": "void* GenericMemoryManager_malloc_f(struct GenericMemoryManager* this)\n{\n void *m = malloc(this->memsize);\n printf(\"[INFO] allocated %zu bytes of memory at %p\\n\", this->memsize, m);\n ++this->malloc_stats;\n {\n struct ManagedMemoryArea_list* current = this->mamanged_memory_chunks;\n struct ManagedMemoryArea_list* head = current;\n for(; current; current = current->next){\n head = current;\n }\n struct ManagedMemoryArea_list *new = malloc((sizeof(struct ManagedMemoryArea_list)));\n int id;\n if(head == ((void *)0)){\n this->mamanged_memory_chunks = new;\n id = 0;\n }else{\n head->next = new;\n id = head->elem.id + 1;\n }\n new->elem.start = m;\n new->elem.id = id;\n }\n return m;\n}", "canonical_original_code": "void *GenericMemoryManager_malloc_f(struct GenericMemoryManager *this)\n{\n void *m = malloc(this->memsize);\n printf(\"[INFO] allocated %zu bytes of memory at %p\\n\", this->memsize, m);\n ++this->malloc_stats;\n {\n struct ManagedMemoryArea_list *current = this->mamanged_memory_chunks;\n struct ManagedMemoryArea_list *head = current;\n for(; current; current = current->next){\n head = current;\n }\n struct ManagedMemoryArea_list *new = malloc((sizeof(struct ManagedMemoryArea_list)));\n int id;\n if(head == ((void *)0)){\n this->mamanged_memory_chunks = new;\n id = 0;\n }else{\n head->next = new;\n id = head->elem.id + 1;\n }\n new->elem.start = m;\n new->elem.id = id;\n }\n return m;\n}", "variable_types": [ [ "this", "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *mamanged_memory_chunks; } *" ], [ "m", "void *" ], [ "current", "struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *" ], [ "head", "struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *" ], [ "new", "struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *" ], [ "id", "int" ] ], "return_type": "void *", "user_defined_types": [ "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list *mamanged_memory_chunks; }", "struct ManagedMemoryArea_list { struct ManagedMemoryArea elem; struct ManagedMemoryArea_list *next; }", "struct ManagedMemoryArea { void *start; unsigned int id; }" ], "binary_hash": "c7db6cbf1eb8f8eb2c6b52725eb05681200eaa0e9960b306bafe0f2a4cb6b4a1" }, { "name": "GenericMemoryManager_free_f", "canonical_name": "func1", "repo": "diekmann/C_MemoryManagementManager", "decompiled_code": "size_t *__fastcall GenericMemoryManager_free_f(size_t *a1, void *a2)\n{\nsize_t *result; // rax\nint v3; // [rsp+1Ch] [rbp-14h]\n_QWORD *v4; // [rsp+20h] [rbp-10h]\n_QWORD *ptr; // [rsp+28h] [rbp-8h]\n\nprintf(\"[INFO] freeing %zu bytes of memory at %p\\n\", *a1, a2);\nbzero(a2, *a1);\nptr = (_QWORD *)a1[2];\nv4 = 0LL;\nv3 = 0;\nwhile ( ptr )\n{\nif ( a2 == (void *)*ptr )\n{\nprintf(\"[INFO] free: found memory with id %d\\n\", *((unsigned int *)ptr + 2));\nv3 = 1;\nbreak;\n}\nv4 = ptr;\nptr = (_QWORD *)ptr[2];\n}\nif ( v3 )\n{\nif ( v4 )\nv4[2] = ptr[2];\nelse\na1[2] = 0LL;\nfree(ptr);\n}\nelse\n{\nprintf(\"[ERROR] memory at %p not managed by this manager!\\n\", a2);\n}\nfree(a2);\nresult = a1;\n++*((_DWORD *)a1 + 3);\nreturn result;\n}\n", "canonical_decompiled_code": "size_t *__fastcall func1(size_t *a1, void *a2)\n{\nsize_t *result; // rax\nint v3; // [rsp+1Ch] [rbp-14h]\n_QWORD *v4; // [rsp+20h] [rbp-10h]\n_QWORD *ptr; // [rsp+28h] [rbp-8h]\n\nprintf(\"[INFO] freeing %zu bytes of memory at %p\\n\", *a1, a2);\nbzero(a2, *a1);\nptr = (_QWORD *)a1[2];\nv4 = 0LL;\nv3 = 0;\nwhile ( ptr )\n{\nif ( a2 == (void *)*ptr )\n{\nprintf(\"[INFO] free: found memory with id %d\\n\", *((unsigned int *)ptr + 2));\nv3 = 1;\nbreak;\n}\nv4 = ptr;\nptr = (_QWORD *)ptr[2];\n}\nif ( v3 )\n{\nif ( v4 )\nv4[2] = ptr[2];\nelse\na1[2] = 0LL;\nfree(ptr);\n}\nelse\n{\nprintf(\"[ERROR] memory at %p not managed by this manager!\\n\", a2);\n}\nfree(a2);\nresult = a1;\n++*((_DWORD *)a1 + 3);\nreturn result;\n}", "original_code": "void GenericMemoryManager_free_f(struct GenericMemoryManager* this, void* m)\n{\n printf(\"[INFO] freeing %zu bytes of memory at %p\\n\", this->memsize, m);\n bzero(m, this->memsize);\n {\n struct ManagedMemoryArea_list* current = this->mamanged_memory_chunks;\n struct ManagedMemoryArea_list* prev = ((void *)0);\n int found = 0;\n for(; current; current = current->next){\n if(current->elem.start == m){\n printf(\"[INFO] free: found memory with id %d\\n\", current->elem.id);\n found = 1;\n break;\n }\n prev = current;\n }\n if(found){\n if(prev){\n prev->next = current->next;\n }else{\n this->mamanged_memory_chunks = ((void *)0);\n }\n free(current);\n }else{\n printf(\"[ERROR] memory at %p not managed by this manager!\\n\", m);\n }\n }\n free(m);\n ++this->free_stats;\n}", "canonical_original_code": "void GenericMemoryManager_free_f(struct GenericMemoryManager *this, void *m)\n{\n printf(\"[INFO] freeing %zu bytes of memory at %p\\n\", this->memsize, m);\n bzero(m, this->memsize);\n {\n struct ManagedMemoryArea_list *current = this->mamanged_memory_chunks;\n struct ManagedMemoryArea_list *prev = ((void *)0);\n int found = 0;\n for(; current; current = current->next){\n if(current->elem.start == m){\n printf(\"[INFO] free: found memory with id %d\\n\", current->elem.id);\n found = 1;\n break;\n }\n prev = current;\n }\n if(found){\n if(prev){\n prev->next = current->next;\n }else{\n this->mamanged_memory_chunks = ((void *)0);\n }\n free(current);\n }else{\n printf(\"[ERROR] memory at %p not managed by this manager!\\n\", m);\n }\n }\n free(m);\n ++this->free_stats;\n}", "variable_types": [ [ "this", "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *mamanged_memory_chunks; } *" ], [ "m", "void *" ], [ "current", "struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *" ], [ "prev", "struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *" ], [ "found", "int" ] ], "return_type": "void", "user_defined_types": [ "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list *mamanged_memory_chunks; }", "struct ManagedMemoryArea_list { struct ManagedMemoryArea elem; struct ManagedMemoryArea_list *next; }", "struct ManagedMemoryArea { void *start; unsigned int id; }" ], "binary_hash": "c7db6cbf1eb8f8eb2c6b52725eb05681200eaa0e9960b306bafe0f2a4cb6b4a1" }, { "name": "GenericMemoryManager_print_stats", "canonical_name": "func2", "repo": "diekmann/C_MemoryManagementManager", "decompiled_code": "__int64 __fastcall GenericMemoryManager_print_stats(__int64 a1)\n{\n__int64 result; // rax\n__int64 i; // [rsp+18h] [rbp-8h]\n\nprintf(\"Num malloc: %u, Num free: %u \\n\", *(unsigned int *)(a1 + 8), *(unsigned int *)(a1 + 12));\nputs(\"Managed chunks:\");\nresult = *(_QWORD *)(a1 + 16);\nfor ( i = result; i; i = result )\n{\nprintf(\" id: %u\\n\", *(unsigned int *)(i + 8));\nresult = *(_QWORD *)(i + 16);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\n__int64 result; // rax\n__int64 i; // [rsp+18h] [rbp-8h]\n\nprintf(\"Num malloc: %u, Num free: %u \\n\", *(unsigned int *)(a1 + 8), *(unsigned int *)(a1 + 12));\nputs(\"Managed chunks:\");\nresult = *(_QWORD *)(a1 + 16);\nfor ( i = result; i; i = result )\n{\nprintf(\" id: %u\\n\", *(unsigned int *)(i + 8));\nresult = *(_QWORD *)(i + 16);\n}\nreturn result;\n}", "original_code": "void GenericMemoryManager_print_stats(struct GenericMemoryManager* this)\n{\n printf(\"Num malloc: %u, Num free: %u \\n\", this->malloc_stats, this->free_stats);\n printf(\"Managed chunks:\\n\");\n struct ManagedMemoryArea_list* current = this->mamanged_memory_chunks;\n for(; current; current = current->next){\n printf(\" id: %u\\n\", current->elem.id);\n }\n}", "canonical_original_code": "void GenericMemoryManager_print_stats(struct GenericMemoryManager *this)\n{\n printf(\"Num malloc: %u, Num free: %u \\n\", this->malloc_stats, this->free_stats);\n printf(\"Managed chunks:\\n\");\n struct ManagedMemoryArea_list *current = this->mamanged_memory_chunks;\n for(; current; current = current->next){\n printf(\" id: %u\\n\", current->elem.id);\n }\n}", "variable_types": [ [ "this", "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *mamanged_memory_chunks; } *" ], [ "current", "struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list *mamanged_memory_chunks; }", "struct ManagedMemoryArea_list { struct ManagedMemoryArea elem; struct ManagedMemoryArea_list *next; }", "struct ManagedMemoryArea { void *start; unsigned int id; }" ], "binary_hash": "c7db6cbf1eb8f8eb2c6b52725eb05681200eaa0e9960b306bafe0f2a4cb6b4a1" }, { "name": "GenericMemoryManager_delete", "canonical_name": "func3", "repo": "diekmann/C_MemoryManagementManager", "decompiled_code": "void __fastcall GenericMemoryManager_delete(_QWORD *a1)\n{\nprintf(\"[INFO] Deleting GenericMemoryManager at %p for memory of size %zu\\n\", a1, *a1);\nif ( a1[2] )\n{\nputs(\"[ERROR] Memory Mamanager still has managed memory chunks, cannot delete\");\n}\nelse\n{\nif ( *((_DWORD *)a1 + 2) != *((_DWORD *)a1 + 3) )\nputs(\"[ERROR] numer of frees neq number of mallocs\");\nfree(a1);\n}\n}\n", "canonical_decompiled_code": "void __fastcall func3(_QWORD *a1)\n{\nprintf(\"[INFO] Deleting GenericMemoryManager at %p for memory of size %zu\\n\", a1, *a1);\nif ( a1[2] )\n{\nputs(\"[ERROR] Memory Mamanager still has managed memory chunks, cannot delete\");\n}\nelse\n{\nif ( *((_DWORD *)a1 + 2) != *((_DWORD *)a1 + 3) )\nputs(\"[ERROR] numer of frees neq number of mallocs\");\nfree(a1);\n}\n}", "original_code": "void GenericMemoryManager_delete(struct GenericMemoryManager *this)\n{\n printf(\"[INFO] Deleting GenericMemoryManager at %p for memory of size\"\n \" %zu\\n\", this, this->memsize);\n if(this->mamanged_memory_chunks != ((void *)0)){\n printf(\"[ERROR] Memory Mamanager still has managed memory chunks, cannot delete\\n\");\n }else{\n if(this->malloc_stats != this->free_stats){\n printf(\"[ERROR] numer of frees neq number of mallocs\\n\");\n }\n free(this);\n }\n}", "canonical_original_code": "void GenericMemoryManager_delete(struct GenericMemoryManager *this)\n{\n printf(\"[INFO] Deleting GenericMemoryManager at %p for memory of size\"\n \" %zu\\n\", this, this->memsize);\n if(this->mamanged_memory_chunks != ((void *)0)){\n printf(\"[ERROR] Memory Mamanager still has managed memory chunks, cannot delete\\n\");\n }else{\n if(this->malloc_stats != this->free_stats){\n printf(\"[ERROR] numer of frees neq number of mallocs\\n\");\n }\n free(this);\n }\n}", "variable_types": [ [ "this", "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list { struct ManagedMemoryArea { void *start; unsigned int id; } elem; struct ManagedMemoryArea_list *next; } *mamanged_memory_chunks; } *" ] ], "return_type": "void", "user_defined_types": [ "struct GenericMemoryManager { unsigned long memsize; unsigned int malloc_stats; unsigned int free_stats; struct ManagedMemoryArea_list *mamanged_memory_chunks; }", "struct ManagedMemoryArea_list { struct ManagedMemoryArea elem; struct ManagedMemoryArea_list *next; }", "struct ManagedMemoryArea { void *start; unsigned int id; }" ], "binary_hash": "c7db6cbf1eb8f8eb2c6b52725eb05681200eaa0e9960b306bafe0f2a4cb6b4a1" } ]
98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a
NKI-GCF/b6
[ [ "bit_count", "->", "tr_x32b2" ], [ "uo_atox32b2", "->" ], [ "uo_x32b2toa", "->" ], [ "atox32b2", "->", "main" ], [ "x32b2toa", "->", "tr_x32b2" ], [ "test_b6", "->", "main" ], [ "tr_x32b2", "->", "x32b2toa", "bit_count", "main" ], [ "main", "->", "test_b6", "atox32b2", "tr_x32b2" ] ]
[]
[ { "name": "bit_count", "canonical_name": "func0", "repo": "NKI-GCF/b6", "decompiled_code": "unsigned __int64 __fastcall bit_count(unsigned __int64 a1)\n{\nunsigned __int64 v2; // [rsp+0h] [rbp-8h]\n\nv2 = (((a1 - ((a1 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)\n+ ((a1 - ((a1 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL);\nreturn (0x101010101010101LL * ((v2 + (v2 >> 4)) & 0xF0F0F0F0F0F0F0FLL)) >> 56;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func0(unsigned __int64 a1)\n{\nunsigned __int64 v2; // [rsp+0h] [rbp-8h]\n\nv2 = (((a1 - ((a1 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)\n+ ((a1 - ((a1 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL);\nreturn (0x101010101010101LL * ((v2 + (v2 >> 4)) & 0xF0F0F0F0F0F0F0FLL)) >> 56;\n}", "original_code": "static inline ulong bit_count(ulong x)\n{\n x -= (x>>1) & 0x5555555555555555UL;\n x = ((x>>2) & 0x3333333333333333UL) + (x & 0x3333333333333333UL);\n x = ((x>>4) + x) & 0x0f0f0f0f0f0f0f0fUL;\n x *= 0x0101010101010101UL;\n return x>>56;\n}", "canonical_original_code": "static inline unsigned long bit_count(unsigned long x)\n{\n x -= (x>>1) & 0x5555555555555555UL;\n x = ((x>>2) & 0x3333333333333333UL) + (x & 0x3333333333333333UL);\n x = ((x>>4) + x) & 0x0f0f0f0f0f0f0f0fUL;\n x *= 0x0101010101010101UL;\n return x>>56;\n}", "variable_types": [ [ "x", "unsigned long" ] ], "return_type": "unsigned long", "user_defined_types": [], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" }, { "name": "uo_atox32b2", "canonical_name": "func1", "repo": "NKI-GCF/b6", "decompiled_code": "__int64 __fastcall uo_atox32b2(unsigned int a1, int a2, unsigned __int64 *a3)\n{\nunsigned __int64 v4; // [rsp+10h] [rbp-20h]\n__int64 v5; // [rsp+10h] [rbp-20h]\n__int64 v6; // [rsp+10h] [rbp-20h]\nunsigned __int64 v7; // [rsp+18h] [rbp-18h]\nunsigned __int64 v8; // [rsp+18h] [rbp-18h]\nunsigned __int64 v9; // [rsp+18h] [rbp-18h]\nunsigned __int64 v10; // [rsp+18h] [rbp-18h]\nunsigned __int64 v11; // [rsp+18h] [rbp-18h]\n__int64 v12; // [rsp+18h] [rbp-18h]\nunsigned __int64 v13; // [rsp+18h] [rbp-18h]\nunsigned __int64 v14; // [rsp+18h] [rbp-18h]\n__int64 v15; // [rsp+18h] [rbp-18h]\nunsigned __int64 v16; // [rsp+18h] [rbp-18h]\nunsigned __int64 v17; // [rsp+18h] [rbp-18h]\n__int64 v18; // [rsp+18h] [rbp-18h]\n__int64 v19; // [rsp+20h] [rbp-10h]\n\nv19 = 0x101010101010101LL * a1;\nv7 = (((*a3 | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (*a3 | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv8 = ~((((v7 >> 2) & 0x303030303030303LL | v7) >> 1) & 0x101010101010101LL | (v7 >> 2) & 0x303030303030303LL | v7) & 0x101010101010101LL;\nv9 = v19 ^ *a3 ^ ((a2 == 17 ? v8 : 0) | (16 * v8));\n*a3 = v9 & 0xF9F9F9F9F9F9F9F9LL;\nv4 = v9 >> 1;\nv10 = (((a3[1] | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (a3[1] | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv11 = ~((((v10 >> 2) & 0x303030303030303LL | v10) >> 1) & 0x101010101010101LL | (v10 >> 2) & 0x303030303030303LL | v10) & 0x101010101010101LL;\nv12 = v19 ^ a3[1] ^ ((a2 == 17 ? v11 : 0) | (16 * v11));\na3[1] = v12 & 0xF9F9F9F9F9F9F9F9LL;\nv5 = (2 * v12) | v4;\nv13 = (((a3[2] | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (a3[2] | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv14 = ~((((v13 >> 2) & 0x303030303030303LL | v13) >> 1) & 0x101010101010101LL | (v13 >> 2) & 0x303030303030303LL | v13) & 0x101010101010101LL;\nv15 = v19 ^ a3[2] ^ ((a2 == 17 ? v14 : 0) | (16 * v14));\na3[2] = v15 & 0xF9F9F9F9F9F9F9F9LL;\nv6 = (8 * v15) | v5;\nv16 = (((a3[3] | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (a3[3] | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv17 = ~((((v16 >> 2) & 0x303030303030303LL | v16) >> 1) & 0x101010101010101LL | (v16 >> 2) & 0x303030303030303LL | v16) & 0x101010101010101LL;\nv18 = v19 ^ a3[3] ^ ((a2 == 17 ? v17 : 0) | (16 * v17));\na3[3] = v18 & 0xF9F9F9F9F9F9F9F9LL;\nreturn (32 * v18) | v6;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(unsigned int a1, int a2, unsigned __int64 *a3)\n{\nunsigned __int64 v4; // [rsp+10h] [rbp-20h]\n__int64 v5; // [rsp+10h] [rbp-20h]\n__int64 v6; // [rsp+10h] [rbp-20h]\nunsigned __int64 v7; // [rsp+18h] [rbp-18h]\nunsigned __int64 v8; // [rsp+18h] [rbp-18h]\nunsigned __int64 v9; // [rsp+18h] [rbp-18h]\nunsigned __int64 v10; // [rsp+18h] [rbp-18h]\nunsigned __int64 v11; // [rsp+18h] [rbp-18h]\n__int64 v12; // [rsp+18h] [rbp-18h]\nunsigned __int64 v13; // [rsp+18h] [rbp-18h]\nunsigned __int64 v14; // [rsp+18h] [rbp-18h]\n__int64 v15; // [rsp+18h] [rbp-18h]\nunsigned __int64 v16; // [rsp+18h] [rbp-18h]\nunsigned __int64 v17; // [rsp+18h] [rbp-18h]\n__int64 v18; // [rsp+18h] [rbp-18h]\n__int64 v19; // [rsp+20h] [rbp-10h]\n\nv19 = 0x101010101010101LL * a1;\nv7 = (((*a3 | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (*a3 | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv8 = ~((((v7 >> 2) & 0x303030303030303LL | v7) >> 1) & 0x101010101010101LL | (v7 >> 2) & 0x303030303030303LL | v7) & 0x101010101010101LL;\nv9 = v19 ^ *a3 ^ ((a2 == 17 ? v8 : 0) | (16 * v8));\n*a3 = v9 & 0xF9F9F9F9F9F9F9F9LL;\nv4 = v9 >> 1;\nv10 = (((a3[1] | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (a3[1] | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv11 = ~((((v10 >> 2) & 0x303030303030303LL | v10) >> 1) & 0x101010101010101LL | (v10 >> 2) & 0x303030303030303LL | v10) & 0x101010101010101LL;\nv12 = v19 ^ a3[1] ^ ((a2 == 17 ? v11 : 0) | (16 * v11));\na3[1] = v12 & 0xF9F9F9F9F9F9F9F9LL;\nv5 = (2 * v12) | v4;\nv13 = (((a3[2] | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (a3[2] | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv14 = ~((((v13 >> 2) & 0x303030303030303LL | v13) >> 1) & 0x101010101010101LL | (v13 >> 2) & 0x303030303030303LL | v13) & 0x101010101010101LL;\nv15 = v19 ^ a3[2] ^ ((a2 == 17 ? v14 : 0) | (16 * v14));\na3[2] = v15 & 0xF9F9F9F9F9F9F9F9LL;\nv6 = (8 * v15) | v5;\nv16 = (((a3[3] | 0x3131313131313131LL) ^ 0x7575757575757575LL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (a3[3] | 0x3131313131313131LL) ^ 0x7575757575757575LL;\nv17 = ~((((v16 >> 2) & 0x303030303030303LL | v16) >> 1) & 0x101010101010101LL | (v16 >> 2) & 0x303030303030303LL | v16) & 0x101010101010101LL;\nv18 = v19 ^ a3[3] ^ ((a2 == 17 ? v17 : 0) | (16 * v17));\na3[3] = v18 & 0xF9F9F9F9F9F9F9F9LL;\nreturn (32 * v18) | v6;\n}", "original_code": "uint64_t\nuo_atox32b2(const na_case cs, const na_ribose r, uint64_t s[4])\n{\n uint64_t q, ret, a_to_x32b2 = atob2 * 0x0101010101010101;\n uint64_t x32cs = cs * 0x0101010101010101;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (*s | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; *s ^ ((-(r == deoxy) & q) | (q << 4)); });\n *s = q & ~0x0606060606060606;\n ret = q >> 1;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (s[1] | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; s[1] ^ ((-(r == deoxy) & q) | (q << 4)); });\n s[1] = q & ~0x0606060606060606;\n ret |= q << 1;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (s[2] | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; s[2] ^ ((-(r == deoxy) & q) | (q << 4)); });\n s[2] = q & ~0x0606060606060606;\n ret |= q << 3;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (s[3] | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; s[3] ^ ((-(r == deoxy) & q) | (q << 4)); });\n s[3] = q & ~0x0606060606060606;\n ret |= q << 5;\n return ret;\n}", "canonical_original_code": "unsigned long uo_atox32b2(enum na_case cs, enum na_ribose r, unsigned long s[4])\n{\n unsigned long q; unsigned long ret; unsigned long a_to_x32b2 = atob2 * 0x0101010101010101;\n unsigned long x32cs = cs * 0x0101010101010101;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (*s | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; *s ^ ((-(r == deoxy) & q) | (q << 4)); });\n *s = q & ~0x0606060606060606;\n ret = q >> 1;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (s[1] | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; s[1] ^ ((-(r == deoxy) & q) | (q << 4)); });\n s[1] = q & ~0x0606060606060606;\n ret |= q << 1;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (s[2] | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; s[2] ^ ((-(r == deoxy) & q) | (q << 4)); });\n s[2] = q & ~0x0606060606060606;\n ret |= q << 3;\n q = x32cs ^ ({ q = a_to_x32b2 ^ (s[3] | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; s[3] ^ ((-(r == deoxy) & q) | (q << 4)); });\n s[3] = q & ~0x0606060606060606;\n ret |= q << 5;\n return ret;\n}", "variable_types": [ [ "cs", "enum na_case { alt_case=32, uc=65, lc=97 }" ], [ "r", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], [ "s", "unsigned long [4]" ], [ "q", "unsigned long" ], [ "ret", "unsigned long" ], [ "a_to_x32b2", "unsigned long" ], [ "x32cs", "unsigned long" ] ], "return_type": "unsigned long", "user_defined_types": [ "enum na_case { alt_case=32, uc=65, lc=97 }", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" }, { "name": "uo_x32b2toa", "canonical_name": "func2", "repo": "NKI-GCF/b6", "decompiled_code": "__int64 __fastcall uo_x32b2toa(unsigned int a1, int a2, unsigned __int64 *a3)\n{\n__int64 result; // rax\nunsigned __int64 v4; // [rsp+18h] [rbp-28h]\nunsigned __int64 v5; // [rsp+18h] [rbp-28h]\nunsigned __int64 v6; // [rsp+18h] [rbp-28h]\nunsigned __int64 v7; // [rsp+18h] [rbp-28h]\nunsigned __int64 v8; // [rsp+18h] [rbp-28h]\nunsigned __int64 v9; // [rsp+18h] [rbp-28h]\nunsigned __int64 v10; // [rsp+18h] [rbp-28h]\nunsigned __int64 v11; // [rsp+18h] [rbp-28h]\n__int64 v12; // [rsp+20h] [rbp-20h]\n__int64 v13; // [rsp+20h] [rbp-20h]\n__int64 v14; // [rsp+20h] [rbp-20h]\n__int64 v15; // [rsp+20h] [rbp-20h]\n__int64 v16; // [rsp+28h] [rbp-18h]\nunsigned __int64 v17; // [rsp+38h] [rbp-8h]\n\nv17 = *a3;\nv16 = 0x101010101010101LL * a1;\nv12 = (2 * *a3) & 0x606060606060606LL;\nv4 = (((v12 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v12 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv5 = ~((((v4 >> 2) & 0x303030303030303LL | v4) >> 1) & 0x101010101010101LL | (v4 >> 2) & 0x303030303030303LL | v4) & 0x101010101010101LL;\n*a3 = v16 ^ v12 ^ ((a2 == 17 ? v5 : 0) | (16 * v5));\nv13 = (v17 >> 1) & 0x606060606060606LL;\nv6 = (((v13 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v13 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv7 = ~((((v6 >> 2) & 0x303030303030303LL | v6) >> 1) & 0x101010101010101LL | (v6 >> 2) & 0x303030303030303LL | v6) & 0x101010101010101LL;\na3[1] = v16 ^ v13 ^ ((a2 == 17 ? v7 : 0) | (16 * v7));\nv14 = (v17 >> 3) & 0x606060606060606LL;\nv8 = (((v14 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v14 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv9 = ~((((v8 >> 2) & 0x303030303030303LL | v8) >> 1) & 0x101010101010101LL | (v8 >> 2) & 0x303030303030303LL | v8) & 0x101010101010101LL;\na3[2] = v16 ^ v14 ^ ((a2 == 17 ? v9 : 0) | (16 * v9));\nv15 = (v17 >> 5) & 0x606060606060606LL;\nv10 = (((v15 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v15 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv11 = ~((((v10 >> 2) & 0x303030303030303LL | v10) >> 1) & 0x101010101010101LL | (v10 >> 2) & 0x303030303030303LL | v10) & 0x101010101010101LL;\nresult = v16 ^ v15 ^ ((a2 == 17 ? v11 : 0) | (16 * v11));\na3[3] = result;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(unsigned int a1, int a2, unsigned __int64 *a3)\n{\n__int64 result; // rax\nunsigned __int64 v4; // [rsp+18h] [rbp-28h]\nunsigned __int64 v5; // [rsp+18h] [rbp-28h]\nunsigned __int64 v6; // [rsp+18h] [rbp-28h]\nunsigned __int64 v7; // [rsp+18h] [rbp-28h]\nunsigned __int64 v8; // [rsp+18h] [rbp-28h]\nunsigned __int64 v9; // [rsp+18h] [rbp-28h]\nunsigned __int64 v10; // [rsp+18h] [rbp-28h]\nunsigned __int64 v11; // [rsp+18h] [rbp-28h]\n__int64 v12; // [rsp+20h] [rbp-20h]\n__int64 v13; // [rsp+20h] [rbp-20h]\n__int64 v14; // [rsp+20h] [rbp-20h]\n__int64 v15; // [rsp+20h] [rbp-20h]\n__int64 v16; // [rsp+28h] [rbp-18h]\nunsigned __int64 v17; // [rsp+38h] [rbp-8h]\n\nv17 = *a3;\nv16 = 0x101010101010101LL * a1;\nv12 = (2 * *a3) & 0x606060606060606LL;\nv4 = (((v12 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v12 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv5 = ~((((v4 >> 2) & 0x303030303030303LL | v4) >> 1) & 0x101010101010101LL | (v4 >> 2) & 0x303030303030303LL | v4) & 0x101010101010101LL;\n*a3 = v16 ^ v12 ^ ((a2 == 17 ? v5 : 0) | (16 * v5));\nv13 = (v17 >> 1) & 0x606060606060606LL;\nv6 = (((v13 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v13 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv7 = ~((((v6 >> 2) & 0x303030303030303LL | v6) >> 1) & 0x101010101010101LL | (v6 >> 2) & 0x303030303030303LL | v6) & 0x101010101010101LL;\na3[1] = v16 ^ v13 ^ ((a2 == 17 ? v7 : 0) | (16 * v7));\nv14 = (v17 >> 3) & 0x606060606060606LL;\nv8 = (((v14 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v14 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv9 = ~((((v8 >> 2) & 0x303030303030303LL | v8) >> 1) & 0x101010101010101LL | (v8 >> 2) & 0x303030303030303LL | v8) & 0x101010101010101LL;\na3[2] = v16 ^ v14 ^ ((a2 == 17 ? v9 : 0) | (16 * v9));\nv15 = (v17 >> 5) & 0x606060606060606LL;\nv10 = (((v15 | 0x3131313131313131LL) ^ 0x3535353535353535uLL) >> 4) & 0xF0F0F0F0F0F0F0FLL | (v15 | 0x3131313131313131LL) ^ 0x3535353535353535LL;\nv11 = ~((((v10 >> 2) & 0x303030303030303LL | v10) >> 1) & 0x101010101010101LL | (v10 >> 2) & 0x303030303030303LL | v10) & 0x101010101010101LL;\nresult = v16 ^ v15 ^ ((a2 == 17 ? v11 : 0) | (16 * v11));\na3[3] = result;\nreturn result;\n}", "original_code": "void\nuo_x32b2toa(const na_case cs, const na_ribose r, uint64_t s[4])\n{\n uint64_t t, q, orig = *s, x32b2_to_a = b2toa * 0x0101010101010101;\n uint64_t x32cs = cs * 0x0101010101010101;\n t = (orig & 0x0303030303030303) << 1;\n *s = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n t = (orig >> 1) & 0x0606060606060606;\n s[1] = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n t = (orig >> 3) & 0x0606060606060606;\n s[2] = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n t = (orig >> 5) & 0x0606060606060606;\n s[3] = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n}", "canonical_original_code": "void uo_x32b2toa(enum na_case cs, enum na_ribose r, unsigned long s[4])\n{\n unsigned long t; unsigned long q; unsigned long orig = *s; unsigned long x32b2_to_a = b2toa * 0x0101010101010101;\n unsigned long x32cs = cs * 0x0101010101010101;\n t = (orig & 0x0303030303030303) << 1;\n *s = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n t = (orig >> 1) & 0x0606060606060606;\n s[1] = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n t = (orig >> 3) & 0x0606060606060606;\n s[2] = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n t = (orig >> 5) & 0x0606060606060606;\n s[3] = x32cs ^ ({ q = x32b2_to_a ^ (t | 0x3131313131313131); q |= (q & 0xf0f0f0f0f0f0f0f0) >> 4; q |= (q & 0x0c0c0c0c0c0c0c0c) >> 2; q |= (q & 0x0202020202020202) >> 1; q = (q & 0x0101010101010101) ^ 0x0101010101010101; t ^ ((-(r == deoxy) & q) | (q << 4)); });\n}", "variable_types": [ [ "cs", "enum na_case { alt_case=32, uc=65, lc=97 }" ], [ "r", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], [ "s", "unsigned long [4]" ], [ "t", "unsigned long" ], [ "q", "unsigned long" ], [ "orig", "unsigned long" ], [ "x32b2_to_a", "unsigned long" ], [ "x32cs", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "enum na_case { alt_case=32, uc=65, lc=97 }", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" }, { "name": "atox32b2", "canonical_name": "func3", "repo": "NKI-GCF/b6", "decompiled_code": "__int64 __fastcall atox32b2(unsigned int a1, unsigned int a2, _QWORD *a3)\n{\nunsigned int v5; // [rsp+1Ch] [rbp-14h]\nunsigned int v6; // [rsp+20h] [rbp-10h]\nunsigned int i; // [rsp+24h] [rbp-Ch]\n__int64 v8; // [rsp+28h] [rbp-8h]\n\nv8 = 0LL;\nv6 = 0;\nfor ( i = 0; i != 32; ++i )\n{\nv5 = b6(a1, a2, 117LL, (unsigned __int8)a3[i >> 3]);\nv8 |= (unsigned __int64)((v5 >> 1) & 3) << (2 * (unsigned __int8)i);\na3[i >> 3] >>= 8;\nv6 |= ((unsigned int)isb6(v5) == 0) << i;\n}\na3[3] = v6;\na3[2] = a3[3];\na3[1] = a3[2];\n*a3 = a3[1];\nreturn v8;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(unsigned int a1, unsigned int a2, _QWORD *a3)\n{\nunsigned int v5; // [rsp+1Ch] [rbp-14h]\nunsigned int v6; // [rsp+20h] [rbp-10h]\nunsigned int i; // [rsp+24h] [rbp-Ch]\n__int64 v8; // [rsp+28h] [rbp-8h]\n\nv8 = 0LL;\nv6 = 0;\nfor ( i = 0; i != 32; ++i )\n{\nv5 = b6(a1, a2, 117LL, (unsigned __int8)a3[i >> 3]);\nv8 |= (unsigned __int64)((v5 >> 1) & 3) << (2 * (unsigned __int8)i);\na3[i >> 3] >>= 8;\nv6 |= ((unsigned int)isb6(v5) == 0) << i;\n}\na3[3] = v6;\na3[2] = a3[3];\na3[1] = a3[2];\n*a3 = a3[1];\nreturn v8;\n}", "original_code": "uint64_t\natox32b2(const na_case cs, const na_ribose r, uint64_t s[4])\n{\n uint64_t ret = 0ul;\n unsigned i, c, gotN = 0;\n for (i = 0; i != 32; ++i) {\n c = b6(cs, r, atob2, s[i >> 3] & 0xff);\n ret |= (uint64_t)((c & 6) >> 1) << (i << 1);\n s[i >> 3] >>= 8;\n gotN |= !isb6(c) << i;\n }\n s[0] = s[1] = s[2] = s[3] = gotN;\n return ret;\n}", "canonical_original_code": "unsigned long atox32b2(enum na_case cs, enum na_ribose r, unsigned long s[4])\n{\n unsigned long ret = 0ul;\n unsigned int i; unsigned int c; unsigned int gotN = 0;\n for (i = 0; i != 32; ++i) {\n c = b6(cs, r, atob2, s[i >> 3] & 0xff);\n ret |= (unsigned long)((c & 6) >> 1) << (i << 1);\n s[i >> 3] >>= 8;\n gotN |= !isb6(c) << i;\n }\n s[0] = s[1] = s[2] = s[3] = gotN;\n return ret;\n}", "variable_types": [ [ "cs", "enum na_case { alt_case=32, uc=65, lc=97 }" ], [ "r", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], [ "s", "unsigned long [4]" ], [ "ret", "unsigned long" ], [ "i", "unsigned int" ], [ "c", "unsigned int" ], [ "gotN", "unsigned int" ] ], "return_type": "unsigned long", "user_defined_types": [ "enum na_case { alt_case=32, uc=65, lc=97 }", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" }, { "name": "x32b2toa", "canonical_name": "func4", "repo": "NKI-GCF/b6", "decompiled_code": "unsigned __int64 *__fastcall x32b2toa(unsigned int a1, unsigned int a2, unsigned __int64 *a3)\n{\nunsigned __int64 *v3; // rax\nunsigned __int64 *v4; // rdx\nunsigned __int64 *result; // rax\nunsigned __int64 v6; // rdx\nunsigned __int64 v8; // [rsp+20h] [rbp-10h]\nunsigned int i; // [rsp+2Ch] [rbp-4h]\n\nv8 = *a3;\nv3 = a3 + 3;\na3[3] = 0LL;\nv4 = a3 + 2;\n*v4 = *v3;\na3[1] = *v4;\nresult = a3;\n*a3 = a3[1];\nfor ( i = 0; i != 32; ++i )\n{\nv6 = (unsigned __int64)(unsigned int)b6(a1, a2, 53LL, (2 * (unsigned __int8)(v8 >> (2 * (unsigned __int8)i))) & 6) << ((8 * i) & 0x38);\nresult = &a3[i >> 3];\n*result |= v6;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 *__fastcall func4(unsigned int a1, unsigned int a2, unsigned __int64 *a3)\n{\nunsigned __int64 *v3; // rax\nunsigned __int64 *v4; // rdx\nunsigned __int64 *result; // rax\nunsigned __int64 v6; // rdx\nunsigned __int64 v8; // [rsp+20h] [rbp-10h]\nunsigned int i; // [rsp+2Ch] [rbp-4h]\n\nv8 = *a3;\nv3 = a3 + 3;\na3[3] = 0LL;\nv4 = a3 + 2;\n*v4 = *v3;\na3[1] = *v4;\nresult = a3;\n*a3 = a3[1];\nfor ( i = 0; i != 32; ++i )\n{\nv6 = (unsigned __int64)(unsigned int)b6(a1, a2, 53LL, (2 * (unsigned __int8)(v8 >> (2 * (unsigned __int8)i))) & 6) << ((8 * i) & 0x38);\nresult = &a3[i >> 3];\n*result |= v6;\n}\nreturn result;\n}", "original_code": "void\nx32b2toa(const na_case cs, const na_ribose r, uint64_t s[4])\n{\n uint64_t orig = *s;\n unsigned i, c;\n s[0] = s[1] = s[2] = s[3] = 0;\n for (i = 0; i != 32; ++i) {\n c = b6(cs, r, b2toa, ((orig >> (i << 1)) << 1) & 0x6);\n s[i >> 3] |= (uint64_t)c << ((i & 7) << 3);\n }\n}", "canonical_original_code": "void x32b2toa(enum na_case cs, enum na_ribose r, unsigned long s[4])\n{\n unsigned long orig = *s;\n unsigned int i; unsigned int c;\n s[0] = s[1] = s[2] = s[3] = 0;\n for (i = 0; i != 32; ++i) {\n c = b6(cs, r, b2toa, ((orig >> (i << 1)) << 1) & 0x6);\n s[i >> 3] |= (unsigned long)c << ((i & 7) << 3);\n }\n}", "variable_types": [ [ "cs", "enum na_case { alt_case=32, uc=65, lc=97 }" ], [ "r", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], [ "s", "unsigned long [4]" ], [ "orig", "unsigned long" ], [ "i", "unsigned int" ], [ "c", "unsigned int" ] ], "return_type": "void", "user_defined_types": [ "enum na_case { alt_case=32, uc=65, lc=97 }", "enum na_ribose { alt_ribose=1, deoxy=17, oxy=16 }" ], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" }, { "name": "test_b6", "canonical_name": "func5", "repo": "NKI-GCF/b6", "decompiled_code": "int test_b6()\n{\nunsigned int v0; // eax\nunsigned int v1; // eax\nunsigned int v3; // [rsp+4h] [rbp-Ch]\nunsigned int v4; // [rsp+4h] [rbp-Ch]\nunsigned int v5; // [rsp+8h] [rbp-8h]\nunsigned int i; // [rsp+Ch] [rbp-4h]\n\nfor ( i = 0; i <= 6; i += 2 )\n{\nv5 = b6(65LL, 17LL, 53LL, i);\nv3 = b6(65LL, 17LL, 117LL, v5);\nv0 = isb6(v3);\nprintf(\"%u: %c(0x%x) :%u, isb6:%u\\n\", i, (unsigned int)(char)v5, v5, v3, v0);\n}\nv4 = b6(65LL, 17LL, 117LL, 78LL);\nv1 = isb6(v4);\nreturn printf(\"rev: %c(0x%x) => 0x%x, isb6:%u\\n\", 78LL, 78LL, v4, v1);\n}\n", "canonical_decompiled_code": "int func5()\n{\nunsigned int v0; // eax\nunsigned int v1; // eax\nunsigned int v3; // [rsp+4h] [rbp-Ch]\nunsigned int v4; // [rsp+4h] [rbp-Ch]\nunsigned int v5; // [rsp+8h] [rbp-8h]\nunsigned int i; // [rsp+Ch] [rbp-4h]\n\nfor ( i = 0; i <= 6; i += 2 )\n{\nv5 = b6(65LL, 17LL, 53LL, i);\nv3 = b6(65LL, 17LL, 117LL, v5);\nv0 = isb6(v3);\nprintf(\"%u: %c(0x%x) :%u, isb6:%u\\n\", i, (unsigned int)(char)v5, v5, v3, v0);\n}\nv4 = b6(65LL, 17LL, 117LL, 78LL);\nv1 = isb6(v4);\nreturn printf(\"rev: %c(0x%x) => 0x%x, isb6:%u\\n\", 78LL, 78LL, v4, v1);\n}", "original_code": "void\ntest_b6()\n{\n unsigned t, i, c;\n for (i = 0; i <= 6; i += 2) {\n c = b6(uc, deoxy, b2toa, i);\n t = b6(uc, deoxy, atob2, c);\n printf(\"%u: %c(0x%x) :%u, isb6:%u\\n\", i, (char) c, c, t, isb6(t));\n }\n c = 'N';\n t = b6(uc, deoxy, atob2, c);\n printf(\"rev: %c(0x%x) => 0x%x, isb6:%u\\n\", (char) c, c, t, isb6(t));\n}", "canonical_original_code": "void test_b6()\n{\n unsigned int t; unsigned int i; unsigned int c;\n for (i = 0; i <= 6; i += 2) {\n c = b6(uc, deoxy, b2toa, i);\n t = b6(uc, deoxy, atob2, c);\n printf(\"%u: %c(0x%x) :%u, isb6:%u\\n\", i, (char) c, c, t, isb6(t));\n }\n c = 'N';\n t = b6(uc, deoxy, atob2, c);\n printf(\"rev: %c(0x%x) => 0x%x, isb6:%u\\n\", (char) c, c, t, isb6(t));\n}", "variable_types": [ [ "t", "unsigned int" ], [ "i", "unsigned int" ], [ "c", "unsigned int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" }, { "name": "tr_x32b2", "canonical_name": "func6", "repo": "NKI-GCF/b6", "decompiled_code": "int __fastcall tr_x32b2(unsigned __int64 a1, __int64 a2, const char *a3, __int64 a4, const char *a5)\n{\nunsigned __int64 v5; // rax\nunsigned __int64 v10[5]; // [rsp+30h] [rbp-30h] BYREF\nint i; // [rsp+58h] [rbp-8h]\nint j; // [rsp+5Ch] [rbp-4h]\n\nv10[1] = 0LL;\nv10[2] = 0LL;\nv10[3] = 0LL;\nv10[0] = a1;\nx32b2toa(0x41u, 0x11u, v10);\nv5 = bit_count(a2 ^ a1);\nfprintf(stderr, \"b2:%lx\\t%s:\\t%lu\\n\", a1, a5, v5);\nfor ( i = 0; i != 4; ++i )\n{\nfor ( j = 0; j != 8; ++j )\n*(_BYTE *)((unsigned int)(8 * i + j) + a4) = v10[i] >> (8 * (unsigned __int8)j);\n}\n*(_BYTE *)(a4 + 32) = 0;\nfprintf(stderr, \"%s\\n\", a3);\nreturn fprintf(stderr, \"%s\\n\\n\", (const char *)a4);\n}\n", "canonical_decompiled_code": "int __fastcall func6(unsigned __int64 a1, __int64 a2, const char *a3, __int64 a4, const char *a5)\n{\nunsigned __int64 v5; // rax\nunsigned __int64 v10[5]; // [rsp+30h] [rbp-30h] BYREF\nint i; // [rsp+58h] [rbp-8h]\nint j; // [rsp+5Ch] [rbp-4h]\n\nv10[1] = 0LL;\nv10[2] = 0LL;\nv10[3] = 0LL;\nv10[0] = a1;\nfunc4(0x41u, 0x11u, v10);\nv5 = func0(a2 ^ a1);\nfprintf(stderr, \"b2:%lx\\t%s:\\t%lu\\n\", a1, a5, v5);\nfor ( i = 0; i != 4; ++i )\n{\nfor ( j = 0; j != 8; ++j )\n*(_BYTE *)((unsigned int)(8 * i + j) + a4) = v10[i] >> (8 * (unsigned __int8)j);\n}\n*(_BYTE *)(a4 + 32) = 0;\nfprintf(stderr, \"%s\\n\", a3);\nreturn fprintf(stderr, \"%s\\n\\n\", (const char *)a4);\n}", "original_code": "void\ntr_x32b2(uint64_t b2, uint64_t o, const char *s, char q[33], const char *msg)\n{\n uint64_t t[4] = { 0, 0, 0, 0 };\n t[0] = b2;\n x32b2toa(uc, deoxy, &t[0]);\n fprintf(stderr, \"b2:%lx\\t%s:\\t%lu\\n\", b2, msg, bit_count(b2 ^ o));\n unsigned i, j;\n for (j = 0; j != 4; ++j) {\n for (i = 0; i != 8; ++i) {\n q[i+j*8] = (char)(t[j] >> (i*8));\n }\n }\n q[32] = '\\0';\n fprintf(stderr, \"%s\\n\", s);\n fprintf(stderr, \"%s\\n\\n\", q);\n}", "canonical_original_code": "void tr_x32b2(unsigned long b2, unsigned long o, char *s, char q[33], char *msg)\n{\n unsigned long t[4] = { 0, 0, 0, 0 };\n t[0] = b2;\n x32b2toa(uc, deoxy, &t[0]);\n fprintf(stderr, \"b2:%lx\\t%s:\\t%lu\\n\", b2, msg, bit_count(b2 ^ o));\n unsigned int i; unsigned int j;\n for (j = 0; j != 4; ++j) {\n for (i = 0; i != 8; ++i) {\n q[i+j*8] = (char)(t[j] >> (i*8));\n }\n }\n q[32] = '\\0';\n fprintf(stderr, \"%s\\n\", s);\n fprintf(stderr, \"%s\\n\\n\", q);\n}", "variable_types": [ [ "b2", "unsigned long" ], [ "o", "unsigned long" ], [ "s", "char *" ], [ "q", "char [33]" ], [ "msg", "char *" ], [ "t", "unsigned long [4]" ], [ "i", "unsigned int" ], [ "j", "unsigned int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" }, { "name": "main", "canonical_name": "main", "repo": "NKI-GCF/b6", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nunsigned __int64 v4; // rax\nunsigned __int64 v5; // rax\n__int64 v6; // [rsp+0h] [rbp-70h] BYREF\n__int64 v7; // [rsp+8h] [rbp-68h]\n__int64 v8; // [rsp+10h] [rbp-60h]\n__int64 v9; // [rsp+18h] [rbp-58h]\nchar v10[40]; // [rsp+20h] [rbp-50h] BYREF\n__int64 v11; // [rsp+48h] [rbp-28h]\n__int64 v12; // [rsp+50h] [rbp-20h]\n__int64 v13; // [rsp+58h] [rbp-18h]\nconst char *v14; // [rsp+60h] [rbp-10h]\nunsigned int i; // [rsp+68h] [rbp-8h]\nint j; // [rsp+6Ch] [rbp-4h]\n\nfwrite(\"\\nSingle character conversion:\\n\", 1uLL, 0x1EuLL, stderr);\ntest_b6();\nv14 = \"ACTGGTGCCTGCTCCAAGTTGACCATGTCACA\";\nfwrite(\"\\n32 character conversion:\\n\", 1uLL, 0x1AuLL, stderr);\nfprintf(stderr, \"%s\\n\", \"ACTGGTGCCTGCTCCAAGTTGACCATGTCACA\");\nv6 = 0LL;\nv7 = 0LL;\nv8 = 0LL;\nv9 = 0LL;\nfor ( i = 0; i != 4; ++i )\n{\nfor ( j = 0; j != 8; ++j )\n*(&v6 + i) |= (__int64)v14[8 * i + j] << (8 * (unsigned __int8)j);\n}\nv13 = atox32b2(0x41u, 0x11u, &v6);\nif ( v8 | v7 | v6 | v9 )\n{\nputs(\"Got strange characters in nucleotides\");\n}\nelse\n{\ntr_x32b2(v13, v13, v14, (__int64)v10, \"Converted back\");\nv12 = x32b2_rcpx(v13);\nfprintf(stderr, \"\\thalf template rcpx:\\t%lx\\n\", v12);\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\ttest template rcpx:\\t%lx\\n\", v12);\nv4 = x32b2_rev_rcpx2(v12);\ntr_x32b2(v4, v13, v14, (__int64)v10, \"Template, converted back from rcpx\");\nv11 = x32b2_rc(v13);\ntr_x32b2(v11, v11, v14, (__int64)v10, \"Reverse complement\");\nv12 = x32b2_rcpx(v11);\nfprintf(stderr, \"\\thalf revcomp rcpx:\\t%lx\\n\", v12);\nv12 = x32b2_rcpx2(v11);\nfprintf(stderr, \"\\ttest revcomp rcpx:\\t%lx\\n\", v12);\nv5 = x32b2_rev_rcpx2(v12);\ntr_x32b2(v5, v11, v14, (__int64)v10, \"Reverse complement, converted back from rcpx\");\nv13 ^= 0x1000uLL;\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\t[AC] <=> [TG] substtitution, rcpx:\\t%lx\\n\", v12);\nv13 ^= 0x1000uLL;\nv13 ^= 0x200000uLL;\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\t[AT] <=> [CG] substtitution, rcpx:\\t%lx\\n\", v12);\nv13 ^= 0x200000uLL;\nv13 ^= 0x30000000uLL;\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\ty/ACGT/GTAC/ substtitution, rcpx:\\t%lx\\n\", v12);\nv13 ^= 0x30000000uLL;\n}\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nunsigned __int64 v4; // rax\nunsigned __int64 v5; // rax\n__int64 v6; // [rsp+0h] [rbp-70h] BYREF\n__int64 v7; // [rsp+8h] [rbp-68h]\n__int64 v8; // [rsp+10h] [rbp-60h]\n__int64 v9; // [rsp+18h] [rbp-58h]\nchar v10[40]; // [rsp+20h] [rbp-50h] BYREF\n__int64 v11; // [rsp+48h] [rbp-28h]\n__int64 v12; // [rsp+50h] [rbp-20h]\n__int64 v13; // [rsp+58h] [rbp-18h]\nconst char *v14; // [rsp+60h] [rbp-10h]\nunsigned int i; // [rsp+68h] [rbp-8h]\nint j; // [rsp+6Ch] [rbp-4h]\n\nfwrite(\"\\nSingle character conversion:\\n\", 1uLL, 0x1EuLL, stderr);\nfunc5();\nv14 = \"ACTGGTGCCTGCTCCAAGTTGACCATGTCACA\";\nfwrite(\"\\n32 character conversion:\\n\", 1uLL, 0x1AuLL, stderr);\nfprintf(stderr, \"%s\\n\", \"ACTGGTGCCTGCTCCAAGTTGACCATGTCACA\");\nv6 = 0LL;\nv7 = 0LL;\nv8 = 0LL;\nv9 = 0LL;\nfor ( i = 0; i != 4; ++i )\n{\nfor ( j = 0; j != 8; ++j )\n*(&v6 + i) |= (__int64)v14[8 * i + j] << (8 * (unsigned __int8)j);\n}\nv13 = func3(0x41u, 0x11u, &v6);\nif ( v8 | v7 | v6 | v9 )\n{\nputs(\"Got strange characters in nucleotides\");\n}\nelse\n{\nfunc6(v13, v13, v14, (__int64)v10, \"Converted back\");\nv12 = x32b2_rcpx(v13);\nfprintf(stderr, \"\\thalf template rcpx:\\t%lx\\n\", v12);\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\ttest template rcpx:\\t%lx\\n\", v12);\nv4 = x32b2_rev_rcpx2(v12);\nfunc6(v4, v13, v14, (__int64)v10, \"Template, converted back from rcpx\");\nv11 = x32b2_rc(v13);\nfunc6(v11, v11, v14, (__int64)v10, \"Reverse complement\");\nv12 = x32b2_rcpx(v11);\nfprintf(stderr, \"\\thalf revcomp rcpx:\\t%lx\\n\", v12);\nv12 = x32b2_rcpx2(v11);\nfprintf(stderr, \"\\ttest revcomp rcpx:\\t%lx\\n\", v12);\nv5 = x32b2_rev_rcpx2(v12);\nfunc6(v5, v11, v14, (__int64)v10, \"Reverse complement, converted back from rcpx\");\nv13 ^= 0x1000uLL;\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\t[AC] <=> [TG] substtitution, rcpx:\\t%lx\\n\", v12);\nv13 ^= 0x1000uLL;\nv13 ^= 0x200000uLL;\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\t[AT] <=> [CG] substtitution, rcpx:\\t%lx\\n\", v12);\nv13 ^= 0x200000uLL;\nv13 ^= 0x30000000uLL;\nv12 = x32b2_rcpx2(v13);\nfprintf(stderr, \"\\ty/ACGT/GTAC/ substtitution, rcpx:\\t%lx\\n\", v12);\nv13 ^= 0x30000000uLL;\n}\nreturn 0;\n}", "original_code": "int\nmain()\n{\n fprintf(stderr, \"\\nSingle character conversion:\\n\");\n test_b6();\n unsigned i, j;\n const char *s = \"ACTGGTGCCTGCTCCAAGTTGACCATGTCACA\";\n fprintf(stderr, \"\\n32 character conversion:\\n\");\n fprintf(stderr, \"%s\\n\", s);\n char q[33];\n uint64_t t[4] = { 0, 0, 0, 0 };\n for (j = 0; j != 4; ++j) {\n for (i = 0; i != 8; ++i) {\n t[j] |= (uint64_t) s[i + (j * 8)] << (i * 8);\n }\n }\n uint64_t ret = atox32b2(uc, deoxy, &t[0]);\n if (t[0] | t[1] | t[2] | t[3]) {\n printf(\"Got strange characters in nucleotides\\n\");\n return 0;\n }\n tr_x32b2(ret, ret, s, q, \"Converted back\");\n uint64_t rcpx;\n rcpx = x32b2_rcpx(ret);\n fprintf(stderr, \"\\thalf template rcpx:\\t%lx\\n\", rcpx);\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\ttest template rcpx:\\t%lx\\n\", rcpx);\n tr_x32b2(x32b2_rev_rcpx2(rcpx), ret, s, q,\n \"Template, converted back from rcpx\");\n uint64_t rc = x32b2_rc(ret);\n tr_x32b2(rc, rc, s, q, \"Reverse complement\");\n rcpx = x32b2_rcpx(rc);\n fprintf(stderr, \"\\thalf revcomp rcpx:\\t%lx\\n\", rcpx);\n rcpx = x32b2_rcpx2(rc);\n fprintf(stderr, \"\\ttest revcomp rcpx:\\t%lx\\n\", rcpx);\n tr_x32b2(x32b2_rev_rcpx2(rcpx), rc, s, q,\n \"Reverse complement, converted back from rcpx\");\n ret ^= 0x1000;\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\t[AC] <=> [TG] substtitution, rcpx:\\t%lx\\n\", rcpx);\n ret ^= 0x1000;\n ret ^= 0x200000;\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\t[AT] <=> [CG] substtitution, rcpx:\\t%lx\\n\", rcpx);\n ret ^= 0x200000;\n ret ^= 0x30000000;\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\ty/ACGT/GTAC/ substtitution, rcpx:\\t%lx\\n\", rcpx);\n ret ^= 0x30000000;\n return 0;\n}", "canonical_original_code": "int main()\n{\n fprintf(stderr, \"\\nSingle character conversion:\\n\");\n test_b6();\n unsigned int i; unsigned int j;\n char *s = \"ACTGGTGCCTGCTCCAAGTTGACCATGTCACA\";\n fprintf(stderr, \"\\n32 character conversion:\\n\");\n fprintf(stderr, \"%s\\n\", s);\n char q[33];\n unsigned long t[4] = { 0, 0, 0, 0 };\n for (j = 0; j != 4; ++j) {\n for (i = 0; i != 8; ++i) {\n t[j] |= (unsigned long) s[i + (j * 8)] << (i * 8);\n }\n }\n unsigned long ret = atox32b2(uc, deoxy, &t[0]);\n if (t[0] | t[1] | t[2] | t[3]) {\n printf(\"Got strange characters in nucleotides\\n\");\n return 0;\n }\n tr_x32b2(ret, ret, s, q, \"Converted back\");\n unsigned long rcpx;\n rcpx = x32b2_rcpx(ret);\n fprintf(stderr, \"\\thalf template rcpx:\\t%lx\\n\", rcpx);\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\ttest template rcpx:\\t%lx\\n\", rcpx);\n tr_x32b2(x32b2_rev_rcpx2(rcpx), ret, s, q,\n \"Template, converted back from rcpx\");\n unsigned long rc = x32b2_rc(ret);\n tr_x32b2(rc, rc, s, q, \"Reverse complement\");\n rcpx = x32b2_rcpx(rc);\n fprintf(stderr, \"\\thalf revcomp rcpx:\\t%lx\\n\", rcpx);\n rcpx = x32b2_rcpx2(rc);\n fprintf(stderr, \"\\ttest revcomp rcpx:\\t%lx\\n\", rcpx);\n tr_x32b2(x32b2_rev_rcpx2(rcpx), rc, s, q,\n \"Reverse complement, converted back from rcpx\");\n ret ^= 0x1000;\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\t[AC] <=> [TG] substtitution, rcpx:\\t%lx\\n\", rcpx);\n ret ^= 0x1000;\n ret ^= 0x200000;\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\t[AT] <=> [CG] substtitution, rcpx:\\t%lx\\n\", rcpx);\n ret ^= 0x200000;\n ret ^= 0x30000000;\n rcpx = x32b2_rcpx2(ret);\n fprintf(stderr, \"\\ty/ACGT/GTAC/ substtitution, rcpx:\\t%lx\\n\", rcpx);\n ret ^= 0x30000000;\n return 0;\n}", "variable_types": [ [ "i", "unsigned int" ], [ "j", "unsigned int" ], [ "s", "char *" ], [ "q", "char [33]" ], [ "t", "unsigned long [4]" ], [ "ret", "unsigned long" ], [ "rcpx", "unsigned long" ], [ "rc", "unsigned long" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "98ec3f6c182230eedda72a9be094cdf12fd375d454c714a43536c8f80ee4ad3a" } ]
48fbefd2be9773c4dedf9a96d79662bd7496508c78afb60651b51fa39b565473
ivartj/platformer
[ [ "rgba", "->" ], [ "rgb", "->" ], [ "getrgb", "->" ] ]
[]
[ { "name": "rgba", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall rgba(double a1, double a2, double a3, double a4)\n{\nreturn (unsigned __int8)(int)(255.0 * a3) | (((unsigned __int8)(int)(255.0 * a2) | (((unsigned __int8)(int)(255.0 * a1) | ((unsigned __int8)(int)(255.0 * a4) << 8)) << 8)) << 8);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(double a1, double a2, double a3, double a4)\n{\nreturn (unsigned __int8)(int)(255.0 * a3) | (((unsigned __int8)(int)(255.0 * a2) | (((unsigned __int8)(int)(255.0 * a1) | ((unsigned __int8)(int)(255.0 * a4) << 8)) << 8)) << 8);\n}", "original_code": "color rgba(double r, double g, double b, double a)\n{\n color c;\n c = 0;\n c |= (uint8_t)(a * 255.0); c <<= 8;\n c |= (uint8_t)(r * 255.0); c <<= 8;\n c |= (uint8_t)(g * 255.0); c <<= 8;\n c |= (uint8_t)(b * 255.0);\n return c;\n}", "canonical_original_code": "unsigned int rgba(double r, double g, double b, double a)\n{\n unsigned int c;\n c = 0;\n c |= (unsigned char)(a * 255.0); c <<= 8;\n c |= (unsigned char)(r * 255.0); c <<= 8;\n c |= (unsigned char)(g * 255.0); c <<= 8;\n c |= (unsigned char)(b * 255.0);\n return c;\n}", "variable_types": [ [ "r", "double" ], [ "g", "double" ], [ "b", "double" ], [ "a", "double" ], [ "c", "unsigned int" ] ], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "48fbefd2be9773c4dedf9a96d79662bd7496508c78afb60651b51fa39b565473" }, { "name": "rgb", "canonical_name": "func1", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall rgb(double a1, double a2, double a3)\n{\nreturn (unsigned __int8)(int)(255.0 * a3) | (((unsigned __int8)(int)(255.0 * a2) | (((unsigned __int8)(int)(255.0 * a1) | ((unsigned __int8)(int)(255.0 * 1.0) << 8)) << 8)) << 8);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(double a1, double a2, double a3)\n{\nreturn (unsigned __int8)(int)(255.0 * a3) | (((unsigned __int8)(int)(255.0 * a2) | (((unsigned __int8)(int)(255.0 * a1) | ((unsigned __int8)(int)(255.0 * 1.0) << 8)) << 8)) << 8);\n}", "original_code": "color rgb(double r, double g, double b)\n{\n color c;\n double a;\n a = 1.0;\n c = 0;\n c |= (uint8_t)(a * 255.0); c <<= 8;\n c |= (uint8_t)(r * 255.0); c <<= 8;\n c |= (uint8_t)(g * 255.0); c <<= 8;\n c |= (uint8_t)(b * 255.0);\n return c;\n}", "canonical_original_code": "unsigned int rgb(double r, double g, double b)\n{\n unsigned int c;\n double a;\n a = 1.0;\n c = 0;\n c |= (unsigned char)(a * 255.0); c <<= 8;\n c |= (unsigned char)(r * 255.0); c <<= 8;\n c |= (unsigned char)(g * 255.0); c <<= 8;\n c |= (unsigned char)(b * 255.0);\n return c;\n}", "variable_types": [ [ "r", "double" ], [ "g", "double" ], [ "b", "double" ], [ "c", "unsigned int" ], [ "a", "double" ] ], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "48fbefd2be9773c4dedf9a96d79662bd7496508c78afb60651b51fa39b565473" }, { "name": "getrgb", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "double *__fastcall getrgb(int a1, double *a2, double *a3, double *a4)\n{\ndouble *result; // rax\n\n*a2 = (double)BYTE2(a1) / 255.0;\n*a3 = (double)BYTE1(a1) / 255.0;\nresult = a4;\n*a4 = (double)(unsigned __int8)a1 / 255.0;\nreturn result;\n}\n", "canonical_decompiled_code": "double *__fastcall func2(int a1, double *a2, double *a3, double *a4)\n{\ndouble *result; // rax\n\n*a2 = (double)BYTE2(a1) / 255.0;\n*a3 = (double)BYTE1(a1) / 255.0;\nresult = a4;\n*a4 = (double)(unsigned __int8)a1 / 255.0;\nreturn result;\n}", "original_code": "void getrgb(color c, double *r, double *g, double *b)\n{\n *r = (double)((0x00FF0000 & c) >> 16) / 255.0;\n *g = (double)((0x0000FF00 & c) >> 8) / 255.0;\n *b = (double)((0x000000FF & c) >> 0) / 255.0;\n}", "canonical_original_code": "void getrgb(unsigned int c, double *r, double *g, double *b)\n{\n *r = (double)((0x00FF0000 & c) >> 16) / 255.0;\n *g = (double)((0x0000FF00 & c) >> 8) / 255.0;\n *b = (double)((0x000000FF & c) >> 0) / 255.0;\n}", "variable_types": [ [ "c", "unsigned int" ], [ "r", "double *" ], [ "g", "double *" ], [ "b", "double *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "48fbefd2be9773c4dedf9a96d79662bd7496508c78afb60651b51fa39b565473" } ]
5ed7817edadffaf9b03e5a84ee7402de95b8fa2eb2a1ee4dcd3d1c515d0655fa
ivartj/platformer
[ [ "hash_create", "->" ] ]
[]
[ { "name": "hash_create", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall hash_create(__int64 a1, unsigned __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-18h] BYREF\n__int64 *v4; // [rsp+20h] [rbp-10h]\nint v5; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nv3 = 0LL;\nv5 = 8;\nv4 = &v3;\nfor ( i = 0; a2 > i; ++i )\n*((_BYTE *)v4 + i % v5) ^= *(_BYTE *)(i + a1);\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, unsigned __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-18h] BYREF\n__int64 *v4; // [rsp+20h] [rbp-10h]\nint v5; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nv3 = 0LL;\nv5 = 8;\nv4 = &v3;\nfor ( i = 0; a2 > i; ++i )\n*((_BYTE *)v4 + i % v5) ^= *(_BYTE *)(i + a1);\nreturn v3;\n}", "original_code": "uint64_t hash_create(unsigned char *data, size_t len)\n{\n uint64_t hash;\n int hashlen;\n unsigned char *bytes;\n int i;\n hash = 0;\n hashlen = sizeof(hash);\n bytes = (unsigned char *)&hash;\n for(i = 0; i < len; i++)\n bytes[i % hashlen] ^= data[i];\n return hash;\n}", "canonical_original_code": "unsigned long hash_create(unsigned char *data, unsigned long len)\n{\n unsigned long hash;\n int hashlen;\n unsigned char *bytes;\n int i;\n hash = 0;\n hashlen = sizeof(hash);\n bytes = (unsigned char *)&hash;\n for(i = 0; i < len; i++)\n bytes[i % hashlen] ^= data[i];\n return hash;\n}", "variable_types": [ [ "data", "unsigned char *" ], [ "len", "unsigned long" ], [ "hash", "unsigned long" ], [ "hashlen", "int" ], [ "bytes", "unsigned char *" ], [ "i", "int" ] ], "return_type": "unsigned long", "user_defined_types": [], "binary_hash": "5ed7817edadffaf9b03e5a84ee7402de95b8fa2eb2a1ee4dcd3d1c515d0655fa" } ]
667b9dd9a51842bfa94baad0933bd0c944f88c1f3cf8201d01957a646edae841
ivartj/platformer
[ [ "sdl_init", "->", "video_init" ], [ "video_init", "->", "sdl_init", "lockcanvas" ], [ "lockcanvas", "->", "video_init", "video_update" ], [ "unlockcanvas", "->", "video_update" ], [ "video_update", "->", "unlockcanvas", "lockcanvas" ], [ "image_destroy", "->" ], [ "image_fill", "->" ], [ "blit", "->" ], [ "blitxy", "->" ], [ "blitrxy", "->" ], [ "blitxymask", "->" ], [ "event_translate", "->", "event_wait", "event_poll" ], [ "event_wait", "->", "event_translate" ], [ "event_poll", "->", "event_translate" ] ]
[ [ "image_destroy", "void __fastcall func5(_QWORD *a1)\n{\n_DWORD *v1; // [rsp+18h] [rbp-8h]\n\nv1 = (_DWORD *)a1[2];\nif ( v1[10] || (*v1 & 0x4005) != 0 )\nSDL_UnlockSurface(v1);\nSDL_FreeSurface(v1);\nfree(a1);\n}" ], [ "image_fill", "__int64 __fastcall func6(__int64 a1, _DWORD *a2, unsigned int a3)\n{\n__int64 result; // rax\n__int16 v5[4]; // [rsp+20h] [rbp-10h] BYREF\n_DWORD *v6; // [rsp+28h] [rbp-8h]\n\nv5[0] = *a2;\nv5[1] = a2[1];\nv5[2] = a2[2];\nv5[3] = a2[3];\nv6 = *(_DWORD **)(a1 + 16);\nif ( v6[10] || (*v6 & 0x4005) != 0 )\nSDL_UnlockSurface(v6);\nSDL_FillRect(v6, v5, a3);\nif ( v6[10] || (result = *v6 & 0x4005, (_DWORD)result) )\nresult = SDL_LockSurface(v6);\nreturn result;\n}" ], [ "blit", "__int64 __fastcall func7(__int64 a1, __int64 a2)\n{\nconst char *v2; // rax\n_DWORD *v4; // [rsp+18h] [rbp-18h]\n_DWORD *v5; // [rsp+20h] [rbp-10h]\nunsigned int v6; // [rsp+2Ch] [rbp-4h]\n\nv5 = *(_DWORD **)(a1 + 16);\nv4 = *(_DWORD **)(a2 + 16);\nif ( v5[10] || (*v5 & 0x4005) != 0 )\nSDL_UnlockSurface(v5);\nif ( v4[10] || (*v4 & 0x4005) != 0 )\nSDL_UnlockSurface(v4);\nv6 = SDL_UpperBlit(*(_QWORD *)(a1 + 16), 0LL, *(_QWORD *)(a2 + 16), 0LL);\nif ( v6 )\n{\nv2 = (const char *)SDL_GetError();\nv6 = seterrmsg(\"SDL_BlitSurface: %s\", v2);\n}\nif ( v5[10] || (*v5 & 0x4005) != 0 )\nSDL_LockSurface(v5);\nif ( v4[10] || (*v4 & 0x4005) != 0 )\nSDL_LockSurface(v4);\nreturn v6;\n}" ], [ "blitxy", "__int64 __fastcall func8(__int64 a1, __int64 a2, unsigned __int16 a3, __int16 a4)\n{\nconst char *v4; // rax\n__int64 v6; // [rsp+20h] [rbp-20h] BYREF\n_DWORD *v7; // [rsp+28h] [rbp-18h]\n_DWORD *v8; // [rsp+30h] [rbp-10h]\nunsigned int v9; // [rsp+3Ch] [rbp-4h]\n\nv6 = a3;\nWORD1(v6) = a4;\nv8 = *(_DWORD **)(a1 + 16);\nv7 = *(_DWORD **)(a2 + 16);\nif ( v8[10] || (*v8 & 0x4005) != 0 )\nSDL_UnlockSurface(v8);\nif ( v7[10] || (*v7 & 0x4005) != 0 )\nSDL_UnlockSurface(v7);\nv9 = SDL_UpperBlit(*(_QWORD *)(a1 + 16), 0LL, *(_QWORD *)(a2 + 16), &v6);\nif ( v9 )\n{\nv4 = (const char *)SDL_GetError();\nv9 = seterrmsg(\"SDL_BlitSurface: %s\", v4);\n}\nif ( v8[10] || (*v8 & 0x4005) != 0 )\nSDL_LockSurface(v8);\nif ( v7[10] || (*v7 & 0x4005) != 0 )\nSDL_LockSurface(v7);\nreturn v9;\n}" ], [ "blitrxy", "__int64 __fastcall func9(__int64 a1, _DWORD *a2, __int64 a3, __int16 a4, __int16 a5)\n{\n__int64 v5; // rdi\nconst char *v6; // rax\n__int64 v9; // [rsp+28h] [rbp-28h] BYREF\n__int64 v10; // [rsp+30h] [rbp-20h] BYREF\n_DWORD *v11; // [rsp+38h] [rbp-18h]\n_DWORD *v12; // [rsp+40h] [rbp-10h]\nunsigned int v13; // [rsp+4Ch] [rbp-4h]\n\nv10 = 0LL;\nv9 = 0LL;\nv10 = (unsigned __int16)*a2;\n*(_DWORD *)((char *)&v10 + 2) = (unsigned __int16)a2[1];\nWORD2(v10) = a2[2];\nHIWORD(v10) = a2[3];\nLOWORD(v9) = a4;\nWORD1(v9) = a5;\nv12 = *(_DWORD **)(a1 + 16);\nv11 = *(_DWORD **)(a3 + 16);\nif ( v12[10] || (*v12 & 0x4005) != 0 )\nSDL_UnlockSurface(v12);\nif ( v11[10] || (*v11 & 0x4005) != 0 )\nSDL_UnlockSurface(v11);\nv5 = *(_QWORD *)(a1 + 16);\nv13 = SDL_UpperBlit(v5, &v10, *(_QWORD *)(a3 + 16), &v9);\nif ( v13 )\n{\nv6 = (const char *)SDL_GetError(v5);\nv13 = seterrmsg(\"SDL_BlitSurface: %s\", v6);\n}\nif ( v12[10] || (*v12 & 0x4005) != 0 )\nSDL_LockSurface(v12);\nif ( v11[10] || (*v11 & 0x4005) != 0 )\nSDL_LockSurface(v11);\nreturn v13;\n}" ], [ "event_translate", "__int64 __fastcall func11(__int64 a1, unsigned __int8 *a2)\n{\nint v2; // eax\n\nv2 = *a2;\nif ( v2 == 12 )\nexit(0);\nif ( *a2 > 0xCu )\nreturn 1LL;\nif ( v2 == 2 )\n{\n*(_DWORD *)a1 = 1;\n*(_BYTE *)(a1 + 4) = a2[4];\n*(_WORD *)(a1 + 6) = *((_DWORD *)a2 + 3);\n*(_WORD *)(a1 + 8) = *((_DWORD *)a2 + 2);\nreturn 0LL;\n}\nif ( *a2 < 2u || (unsigned int)(v2 - 4) > 1 )\nreturn 1LL;\n*(_DWORD *)a1 = 2;\nif ( *a2 == 5 )\n*(_BYTE *)(a1 + 12) = a2[3];\nelse\n*(_BYTE *)(a1 + 12) = a2[2];\n*(_DWORD *)(a1 + 4) = *((unsigned __int16 *)a2 + 2);\n*(_DWORD *)(a1 + 8) = *((unsigned __int16 *)a2 + 3);\nreturn 0LL;\n}" ], [ "event_wait", "__int64 __fastcall func12(__int64 a1)\n{\nunsigned __int8 v2[24]; // [rsp+10h] [rbp-20h] BYREF\nint v4; // [rsp+2Ch] [rbp-4h]\n\ndo\n{\nv4 = 0;\nif ( !(unsigned int)SDL_WaitEvent(v2) )\nreturn 0LL;\nv4 = func11(a1, v2);\n}\nwhile ( v4 );\nreturn 1LL;\n}" ], [ "event_poll", "__int64 __fastcall func13(__int64 a1)\n{\nunsigned __int8 v2[24]; // [rsp+10h] [rbp-20h] BYREF\nint v4; // [rsp+2Ch] [rbp-4h]\n\ndo\n{\nv4 = 0;\nif ( !(unsigned int)SDL_PollEvent(v2) )\nreturn 0LL;\nv4 = func11(a1, v2);\n}\nwhile ( v4 );\nreturn 1LL;\n}" ] ]
[ { "name": "sdl_init", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "__int64 sdl_init()\n{\n__int64 result; // rax\nconst char *v1; // rax\n\nif ( sdl_initialized )\nreturn 0LL;\nif ( (unsigned int)SDL_Init(32LL) )\n{\nv1 = (const char *)SDL_GetError();\nresult = seterrmsg(\"SDL failed to initialize: %s\", v1);\n}\nelse\n{\natexit((void (*)(void))&SDL_Quit);\nsdl_initialized = 1;\nresult = 0LL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func0()\n{\n__int64 result; // rax\nconst char *v1; // rax\n\nif ( sdl_initialized )\nreturn 0LL;\nif ( (unsigned int)SDL_Init(32LL) )\n{\nv1 = (const char *)SDL_GetError();\nresult = seterrmsg(\"SDL failed to initialize: %s\", v1);\n}\nelse\n{\natexit((void (*)(void))&SDL_Quit);\nsdl_initialized = 1;\nresult = 0LL;\n}\nreturn result;\n}", "original_code": "int sdl_init(void)\n{\n int err;\n if(sdl_initialized)\n return 0;\n err = SDL_Init(0x00000020);\n if(err)\n return seterrmsg(\"SDL failed to initialize: %s\", SDL_GetError());\n atexit(SDL_Quit);\n sdl_initialized = 1;\n return 0;\n}", "canonical_original_code": "int sdl_init()\n{\n int err;\n if(sdl_initialized)\n return 0;\n err = SDL_Init(0x00000020);\n if(err)\n return seterrmsg(\"SDL failed to initialize: %s\", SDL_GetError());\n atexit(SDL_Quit);\n sdl_initialized = 1;\n return 0;\n}", "variable_types": [ [ "err", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "667b9dd9a51842bfa94baad0933bd0c944f88c1f3cf8201d01957a646edae841" }, { "name": "video_init", "canonical_name": "func1", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall video_init(unsigned int a1, unsigned int a2)\n{\n__int64 result; // rax\nconst char *v3; // rax\nconst char *v4; // rax\nunsigned int v5; // [rsp+1Ch] [rbp-4h]\n\nv5 = sdl_init();\nif ( v5 )\nreturn v5;\ncanvas = SDL_CreateRGBSurface(1LL, a1, a2, 32LL, 16711680LL, 65280LL, 255LL, -16777216LL);\nif ( canvas )\n{\nwindow = SDL_SetVideoMode(a1, a2, 32LL, 1LL);\nif ( window )\n{\nlockcanvas();\nresult = 0LL;\n}\nelse\n{\nv4 = (const char *)SDL_GetError();\nresult = seterrmsg(\"Failed to open SDL window: %s\", v4);\n}\n}\nelse\n{\nv3 = (const char *)SDL_GetError();\nresult = seterrmsg(\"Failed to create SDL canvas: %s\", v3);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(unsigned int a1, unsigned int a2)\n{\n__int64 result; // rax\nconst char *v3; // rax\nconst char *v4; // rax\nunsigned int v5; // [rsp+1Ch] [rbp-4h]\n\nv5 = func0();\nif ( v5 )\nreturn v5;\ncanvas = SDL_CreateRGBSurface(1LL, a1, a2, 32LL, 16711680LL, 65280LL, 255LL, -16777216LL);\nif ( canvas )\n{\nwindow = SDL_SetVideoMode(a1, a2, 32LL, 1LL);\nif ( window )\n{\nfunc2();\nresult = 0LL;\n}\nelse\n{\nv4 = (const char *)SDL_GetError();\nresult = seterrmsg(\"Failed to open SDL window: %s\", v4);\n}\n}\nelse\n{\nv3 = (const char *)SDL_GetError();\nresult = seterrmsg(\"Failed to create SDL canvas: %s\", v3);\n}\nreturn result;\n}", "original_code": "int video_init(int w, int h)\n{\n int err;\n err = sdl_init();\n if(err)\n return err;\n canvas = SDL_CreateRGBSurface(0x00000001, w, h, 32,\n 0x00FF0000,\n 0x0000FF00,\n 0x000000FF,\n 0xFF000000);\n if(canvas == ((void *)0))\n return seterrmsg(\"Failed to create SDL canvas: %s\", SDL_GetError());\n window = SDL_SetVideoMode(w, h, 32, 0x00000001);\n if(window == ((void *)0))\n return seterrmsg(\"Failed to open SDL window: %s\", SDL_GetError());\n lockcanvas();\n return 0;\n}", "canonical_original_code": "int video_init(int w, int h)\n{\n int err;\n err = sdl_init();\n if(err)\n return err;\n canvas = SDL_CreateRGBSurface(0x00000001, w, h, 32,\n 0x00FF0000,\n 0x0000FF00,\n 0x000000FF,\n 0xFF000000);\n if(canvas == ((void *)0))\n return seterrmsg(\"Failed to create SDL canvas: %s\", SDL_GetError());\n window = SDL_SetVideoMode(w, h, 32, 0x00000001);\n if(window == ((void *)0))\n return seterrmsg(\"Failed to open SDL window: %s\", SDL_GetError());\n lockcanvas();\n return 0;\n}", "variable_types": [ [ "w", "int" ], [ "h", "int" ], [ "err", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "667b9dd9a51842bfa94baad0933bd0c944f88c1f3cf8201d01957a646edae841" }, { "name": "lockcanvas", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "__int64 lockcanvas()\n{\n__int64 result; // rax\n\nif ( *(_DWORD *)(canvas + 40) || (*(_DWORD *)canvas & 0x4005) != 0 )\nSDL_LockSurface(canvas);\nif ( !video )\nvideo = (__int64)calloc(1uLL, 0x18uLL);\n*(_QWORD *)(video + 8) = *(_QWORD *)(canvas + 32);\n*(_DWORD *)video = *(_DWORD *)(canvas + 16);\n*(_DWORD *)(video + 4) = *(_DWORD *)(canvas + 20);\nresult = video;\n*(_QWORD *)(video + 16) = canvas;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\n__int64 result; // rax\n\nif ( *(_DWORD *)(canvas + 40) || (*(_DWORD *)canvas & 0x4005) != 0 )\nSDL_LockSurface(canvas);\nif ( !video )\nvideo = (__int64)calloc(1uLL, 0x18uLL);\n*(_QWORD *)(video + 8) = *(_QWORD *)(canvas + 32);\n*(_DWORD *)video = *(_DWORD *)(canvas + 16);\n*(_DWORD *)(video + 4) = *(_DWORD *)(canvas + 20);\nresult = video;\n*(_QWORD *)(video + 16) = canvas;\nreturn result;\n}", "original_code": "void lockcanvas(void)\n{\n if((canvas->offset || ((canvas->flags & (0x00000001|0x00000004|0x00004000)) != 0)))\n SDL_LockSurface(canvas);\n if(video == ((void *)0))\n video = calloc(1, sizeof(image));\n video->pix = canvas->pixels;\n video->w = canvas->w;\n video->h = canvas->h;\n video->private = canvas;\n}", "canonical_original_code": "void lockcanvas()\n{\n if((canvas->offset || ((canvas->flags & (0x00000001|0x00000004|0x00004000)) != 0)))\n SDL_LockSurface(canvas);\n if(video == ((void *)0))\n video = calloc(1, sizeof(image));\n video->pix = canvas->pixels;\n video->w = canvas->w;\n video->h = canvas->h;\n video->private = canvas;\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "667b9dd9a51842bfa94baad0933bd0c944f88c1f3cf8201d01957a646edae841" }, { "name": "unlockcanvas", "canonical_name": "func3", "repo": "ivartj/platformer", "decompiled_code": "__int64 unlockcanvas()\n{\n__int64 result; // rax\n\nif ( *(_DWORD *)(canvas + 40) || (result = *(_DWORD *)canvas & 0x4005, (_DWORD)result) )\nresult = SDL_UnlockSurface(canvas);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\n__int64 result; // rax\n\nif ( *(_DWORD *)(canvas + 40) || (result = *(_DWORD *)canvas & 0x4005, (_DWORD)result) )\nresult = SDL_UnlockSurface(canvas);\nreturn result;\n}", "original_code": "void unlockcanvas(void)\n{\n if((canvas->offset || ((canvas->flags & (0x00000001|0x00000004|0x00004000)) != 0)))\n SDL_UnlockSurface(canvas);\n}", "canonical_original_code": "void unlockcanvas()\n{\n if((canvas->offset || ((canvas->flags & (0x00000001|0x00000004|0x00004000)) != 0)))\n SDL_UnlockSurface(canvas);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "667b9dd9a51842bfa94baad0933bd0c944f88c1f3cf8201d01957a646edae841" }, { "name": "video_update", "canonical_name": "func4", "repo": "ivartj/platformer", "decompiled_code": "__int64 video_update()\n{\nunlockcanvas();\nSDL_UpperBlit(canvas, 0LL, window, 0LL);\nSDL_Flip(window);\nreturn lockcanvas();\n}\n", "canonical_decompiled_code": "__int64 func4()\n{\nfunc3();\nSDL_UpperBlit(canvas, 0LL, window, 0LL);\nSDL_Flip(window);\nreturn func2();\n}", "original_code": "void video_update(void)\n{\n unlockcanvas();\n SDL_UpperBlit(canvas, ((void *)0), window, ((void *)0));\n SDL_Flip(window);\n lockcanvas();\n}", "canonical_original_code": "void video_update()\n{\n unlockcanvas();\n SDL_UpperBlit(canvas, ((void *)0), window, ((void *)0));\n SDL_Flip(window);\n lockcanvas();\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "667b9dd9a51842bfa94baad0933bd0c944f88c1f3cf8201d01957a646edae841" }, { "name": "blitxymask", "canonical_name": "func10", "repo": "ivartj/platformer", "decompiled_code": "__int64 blitxymask()\n{\nreturn seterrmsg(\"Unimplemented method blitxymask\");\n}\n", "canonical_decompiled_code": "__int64 func10()\n{\nreturn seterrmsg(\"Unimplemented method blitxymask\");\n}", "original_code": "int blitxymask(image *src, image *dest, int x, int y, image *mask)\n{\n return seterrmsg(\"Unimplemented method blitxymask\");\n}", "canonical_original_code": "int blitxymask(struct _image *src, struct _image *dest, int x, int y, struct _image *mask)\n{\n return seterrmsg(\"Unimplemented method blitxymask\");\n}", "variable_types": [ [ "src", "struct _image { int w; unsigned int *pix; void *private; } *" ], [ "dest", "struct _image *" ], [ "x", "int" ], [ "y", "int" ], [ "mask", "struct _image *" ] ], "return_type": "int", "user_defined_types": [ "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "667b9dd9a51842bfa94baad0933bd0c944f88c1f3cf8201d01957a646edae841" } ]
672899941491b5433f45b2a93a67c3786624c1304325578b89d05d3bea50c5d7
ivartj/platformer
[ [ "iterate", "->" ] ]
[]
[ { "name": "iterate", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall iterate(__int64 a1, __int64 a2)\n{\nreturn (*(__int64 (__fastcall **)(__int64, __int64))(a1 + 8))(a1, a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, __int64 a2)\n{\nreturn (*(__int64 (__fastcall **)(__int64, __int64))(a1 + 8))(a1, a2);\n}", "original_code": "int iterate(iter *i, void *retval)\n{\n return i->next(i, retval);\n}", "canonical_original_code": "int iterate(struct _iter *i, void *retval)\n{\n return i->next(i, retval);\n}", "variable_types": [ [ "i", "struct _iter { union _data { void *v; int i; double d; } data; int (*next)(struct _iter *i, void *retval); } *" ], [ "retval", "void *" ] ], "return_type": "int", "user_defined_types": [ "struct _iter { union _data data; int (*next)(struct _iter *i, void *retval); }", "union _data { void *v; int i; double d; }" ], "binary_hash": "672899941491b5433f45b2a93a67c3786624c1304325578b89d05d3bea50c5d7" } ]
860c1acdbd3958695af5f0ae9b169ee043159dcc1fc4eae4f42f90be23ea0c4b
ivartj/platformer
[ [ "thread_sleep", "->" ] ]
[]
[ { "name": "thread_sleep", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall thread_sleep(unsigned int a1)\n{\nreturn SDL_Delay(a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(unsigned int a1)\n{\nreturn SDL_Delay(a1);\n}", "original_code": "void thread_sleep(int ms)\n{\n SDL_Delay(ms);\n}", "canonical_original_code": "void thread_sleep(int ms)\n{\n SDL_Delay(ms);\n}", "variable_types": [ [ "ms", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "860c1acdbd3958695af5f0ae9b169ee043159dcc1fc4eae4f42f90be23ea0c4b" } ]
88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7
ivartj/platformer
[ [ "gfx_destroy", "->" ], [ "gfx_translate", "->" ], [ "gfx_color", "->" ], [ "gfx_dot", "->" ], [ "gfx_fill", "->" ], [ "gfx_get", "->" ], [ "gfx_blit", "->" ] ]
[]
[ { "name": "gfx_destroy", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "void __fastcall gfx_destroy(void *a1)\n{\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func0(void *a1)\n{\nfree(a1);\n}", "original_code": "void gfx_destroy(gfx *g)\n{\n free(g);\n}", "canonical_original_code": "void gfx_destroy(struct _gfx *g)\n{\n free(g);\n}", "variable_types": [ [ "g", "struct _gfx { struct _image { int w; unsigned int *pix; void *private; } *img; int x; unsigned int c; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _gfx { struct _image *img; int x; unsigned int c; }", "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7" }, { "name": "gfx_translate", "canonical_name": "func1", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall gfx_translate(__int64 a1, int a2, int a3)\n{\n__int64 result; // rax\n\n*(_DWORD *)(a1 + 8) += a2;\nresult = a1;\n*(_DWORD *)(a1 + 12) += a3;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, int a2, int a3)\n{\n__int64 result; // rax\n\n*(_DWORD *)(a1 + 8) += a2;\nresult = a1;\n*(_DWORD *)(a1 + 12) += a3;\nreturn result;\n}", "original_code": "void gfx_translate(gfx *g, int x, int y)\n{\n g->x += x;\n g->y += y;\n}", "canonical_original_code": "void gfx_translate(struct _gfx *g, int x, int y)\n{\n g->x += x;\n g->y += y;\n}", "variable_types": [ [ "g", "struct _gfx { struct _image { int w; unsigned int *pix; void *private; } *img; int x; unsigned int c; } *" ], [ "x", "int" ], [ "y", "int" ] ], "return_type": "void", "user_defined_types": [ "struct _gfx { struct _image *img; int x; unsigned int c; }", "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7" }, { "name": "gfx_color", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall gfx_color(__int64 a1, int a2)\n{\n__int64 result; // rax\n\nresult = a1;\n*(_DWORD *)(a1 + 16) = a2;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, int a2)\n{\n__int64 result; // rax\n\nresult = a1;\n*(_DWORD *)(a1 + 16) = a2;\nreturn result;\n}", "original_code": "void gfx_color(gfx *g, color c)\n{\n g->c = c;\n}", "canonical_original_code": "void gfx_color(struct _gfx *g, unsigned int c)\n{\n g->c = c;\n}", "variable_types": [ [ "g", "struct _gfx { struct _image { int w; unsigned int *pix; void *private; } *img; int x; unsigned int c; } *" ], [ "c", "unsigned int" ] ], "return_type": "void", "user_defined_types": [ "struct _gfx { struct _image *img; int x; unsigned int c; }", "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7" }, { "name": "gfx_dot", "canonical_name": "func3", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall gfx_dot(_DWORD *a1, int a2, int a3)\n{\nint v3; // edx\n__int64 result; // rax\nint v6; // [rsp+18h] [rbp-8h]\nint v7; // [rsp+1Ch] [rbp-4h]\n\nv7 = a1[2] + a2;\nv3 = a1[3];\nresult = (unsigned int)(v3 + a3);\nv6 = v3 + a3;\nif ( v7 >= 0 )\n{\nresult = **(unsigned int **)a1;\nif ( v7 < (int)result && v6 >= 0 )\n{\nresult = *(unsigned int *)(*(_QWORD *)a1 + 4LL);\nif ( v6 < (int)result )\n{\nresult = (unsigned int)a1[4];\n*(_DWORD *)(4LL * (v6 * **(_DWORD **)a1 + v7) + *(_QWORD *)(*(_QWORD *)a1 + 8LL)) = result;\n}\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(_DWORD *a1, int a2, int a3)\n{\nint v3; // edx\n__int64 result; // rax\nint v6; // [rsp+18h] [rbp-8h]\nint v7; // [rsp+1Ch] [rbp-4h]\n\nv7 = a1[2] + a2;\nv3 = a1[3];\nresult = (unsigned int)(v3 + a3);\nv6 = v3 + a3;\nif ( v7 >= 0 )\n{\nresult = **(unsigned int **)a1;\nif ( v7 < (int)result && v6 >= 0 )\n{\nresult = *(unsigned int *)(*(_QWORD *)a1 + 4LL);\nif ( v6 < (int)result )\n{\nresult = (unsigned int)a1[4];\n*(_DWORD *)(4LL * (v6 * **(_DWORD **)a1 + v7) + *(_QWORD *)(*(_QWORD *)a1 + 8LL)) = result;\n}\n}\n}\nreturn result;\n}", "original_code": "void gfx_dot(gfx *g, int x, int y)\n{\n int tx, ty;\n tx = x + g->x;\n ty = y + g->y;\n if(tx < 0 || tx >= g->img->w)\n return;\n if(ty < 0 || ty >= g->img->h)\n return;\n g->img->pix[tx + ty * g->img->w] = g->c;\n}", "canonical_original_code": "void gfx_dot(struct _gfx *g, int x, int y)\n{\n int tx; int ty;\n tx = x + g->x;\n ty = y + g->y;\n if(tx < 0 || tx >= g->img->w)\n return;\n if(ty < 0 || ty >= g->img->h)\n return;\n g->img->pix[tx + ty * g->img->w] = g->c;\n}", "variable_types": [ [ "g", "struct _gfx { struct _image { int w; unsigned int *pix; void *private; } *img; int x; unsigned int c; } *" ], [ "x", "int" ], [ "y", "int" ], [ "tx", "int" ], [ "ty", "int" ] ], "return_type": "void", "user_defined_types": [ "struct _gfx { struct _image *img; int x; unsigned int c; }", "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7" }, { "name": "gfx_fill", "canonical_name": "func4", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall gfx_fill(__int64 a1, __int64 *a2)\n{\n__int64 v2; // rdx\n__int64 v4[2]; // [rsp+10h] [rbp-10h] BYREF\n\nv2 = a2[1];\nv4[0] = *a2;\nv4[1] = v2;\nLODWORD(v4[0]) += *(_DWORD *)(a1 + 8);\nHIDWORD(v4[0]) += *(_DWORD *)(a1 + 12);\nreturn image_fill(*(_QWORD *)a1, v4, *(unsigned int *)(a1 + 16));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, __int64 *a2)\n{\n__int64 v2; // rdx\n__int64 v4[2]; // [rsp+10h] [rbp-10h] BYREF\n\nv2 = a2[1];\nv4[0] = *a2;\nv4[1] = v2;\nLODWORD(v4[0]) += *(_DWORD *)(a1 + 8);\nHIDWORD(v4[0]) += *(_DWORD *)(a1 + 12);\nreturn image_fill(*(_QWORD *)a1, v4, *(unsigned int *)(a1 + 16));\n}", "original_code": "void gfx_fill(gfx *g, rect *r)\n{\n rect rr;\n memcpy(&rr, r, sizeof(rr));\n rr.x += g->x;\n rr.y += g->y;\n image_fill(g->img, &rr, g->c);\n}", "canonical_original_code": "void gfx_fill(struct _gfx *g, struct rect *r)\n{\n struct rect rr;\n memcpy(&rr, r, sizeof(rr));\n rr.x += g->x;\n rr.y += g->y;\n image_fill(g->img, &rr, g->c);\n}", "variable_types": [ [ "g", "struct _gfx { struct _image { int w; unsigned int *pix; void *private; } *img; int x; unsigned int c; } *" ], [ "r", "struct rect { int x; } *" ], [ "rr", "struct rect { int x; }" ] ], "return_type": "void", "user_defined_types": [ "struct rect { int x; }", "struct _gfx { struct _image *img; int x; unsigned int c; }", "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7" }, { "name": "gfx_get", "canonical_name": "func5", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall gfx_get(_DWORD *a1, int a2, int a3)\n{\nint v4; // [rsp+0h] [rbp-10h]\nint v5; // [rsp+4h] [rbp-Ch]\n\nv5 = a1[2] + a2;\nv4 = a1[3] + a3;\nif ( v5 < 0 || v5 >= **(_DWORD **)a1 )\nreturn 0LL;\nif ( v4 >= 0 && v4 < *(_DWORD *)(*(_QWORD *)a1 + 4LL) )\nreturn *(unsigned int *)(*(_QWORD *)(*(_QWORD *)a1 + 8LL) + 4LL * (v4 * **(_DWORD **)a1 + v5));\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(_DWORD *a1, int a2, int a3)\n{\nint v4; // [rsp+0h] [rbp-10h]\nint v5; // [rsp+4h] [rbp-Ch]\n\nv5 = a1[2] + a2;\nv4 = a1[3] + a3;\nif ( v5 < 0 || v5 >= **(_DWORD **)a1 )\nreturn 0LL;\nif ( v4 >= 0 && v4 < *(_DWORD *)(*(_QWORD *)a1 + 4LL) )\nreturn *(unsigned int *)(*(_QWORD *)(*(_QWORD *)a1 + 8LL) + 4LL * (v4 * **(_DWORD **)a1 + v5));\nreturn 0LL;\n}", "original_code": "color gfx_get(gfx *g, int x, int y)\n{\n x += g->x;\n y += g->y;\n if(x < 0 || x >= g->img->w)\n return 0;\n if(y < 0 || y >= g->img->h)\n return 0;\n return g->img->pix[x + g->img->w * y];\n}", "canonical_original_code": "unsigned int gfx_get(struct _gfx *g, int x, int y)\n{\n x += g->x;\n y += g->y;\n if(x < 0 || x >= g->img->w)\n return 0;\n if(y < 0 || y >= g->img->h)\n return 0;\n return g->img->pix[x + g->img->w * y];\n}", "variable_types": [ [ "g", "struct _gfx { struct _image { int w; unsigned int *pix; void *private; } *img; int x; unsigned int c; } *" ], [ "x", "int" ], [ "y", "int" ] ], "return_type": "unsigned int", "user_defined_types": [ "struct _gfx { struct _image *img; int x; unsigned int c; }", "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7" }, { "name": "gfx_blit", "canonical_name": "func6", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall gfx_blit(__int64 a1, __int64 a2, __int64 a3, int a4, int a5)\n{\nreturn blitrxy(\na2,\na3,\n*(_QWORD *)a1,\n(unsigned int)(*(_DWORD *)(a1 + 8) + a4),\n(unsigned int)(*(_DWORD *)(a1 + 12) + a5));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1, __int64 a2, __int64 a3, int a4, int a5)\n{\nreturn blitrxy(\na2,\na3,\n*(_QWORD *)a1,\n(unsigned int)(*(_DWORD *)(a1 + 8) + a4),\n(unsigned int)(*(_DWORD *)(a1 + 12) + a5));\n}", "original_code": "void gfx_blit(gfx *g, image *img, rect *r, int x, int y)\n{\n blitrxy(img, r, g->img, g->x + x, g->y + y);\n}", "canonical_original_code": "void gfx_blit(struct _gfx *g, struct _image *img, struct rect *r, int x, int y)\n{\n blitrxy(img, r, g->img, g->x + x, g->y + y);\n}", "variable_types": [ [ "g", "struct _gfx { struct _image { int w; unsigned int *pix; void *private; } *img; int x; unsigned int c; } *" ], [ "img", "struct _image *" ], [ "r", "struct rect { int x; } *" ], [ "x", "int" ], [ "y", "int" ] ], "return_type": "void", "user_defined_types": [ "struct _gfx { struct _image *img; int x; unsigned int c; }", "struct rect { int x; }", "struct _image { int w; unsigned int *pix; void *private; }" ], "binary_hash": "88f5ed586597aacc3f06e570186d435996ca171f15a1f407fe4b8b8d30a30fc7" } ]
94086feca732a85e0456d1f74f355b8c381ebb829d7d621088c2ec2d6b4b7bbc
ivartj/platformer
[ [ "add", "->", "inc" ], [ "inc", "->", "add", "prime_check", "prime_get" ], [ "prime_get", "->", "inc", "prime_check" ], [ "prime_check", "->", "inc", "prime_get", "prime_above" ], [ "prime_above", "->", "prime_check" ] ]
[]
[ { "name": "add", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall add(unsigned int a1)\n{\nint v1; // eax\n\nif ( cap == len )\n{\nif ( cap )\ncap *= 2;\nelse\ncap = 256;\nprimes = realloc(primes, 4LL * cap);\n}\nv1 = len++;\n*((_DWORD *)primes + v1) = a1;\nreturn a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(unsigned int a1)\n{\nint v1; // eax\n\nif ( cap == len )\n{\nif ( cap )\ncap *= 2;\nelse\ncap = 256;\nprimes = realloc(primes, 4LL * cap);\n}\nv1 = len++;\n*((_DWORD *)primes + v1) = a1;\nreturn a1;\n}", "original_code": "int add(int prime)\n{\n if(cap == len) {\n if(cap == 0)\n cap = 256;\n else\n cap <<= 1;\n primes = realloc(primes, sizeof(int) * cap);\n }\n primes[len++] = prime;\n return prime;\n}", "canonical_original_code": "int add(int prime)\n{\n if(cap == len) {\n if(cap == 0)\n cap = 256;\n else\n cap <<= 1;\n primes = realloc(primes, sizeof(int) * cap);\n }\n primes[len++] = prime;\n return prime;\n}", "variable_types": [ [ "prime", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "94086feca732a85e0456d1f74f355b8c381ebb829d7d621088c2ec2d6b4b7bbc" }, { "name": "inc", "canonical_name": "func1", "repo": "ivartj/platformer", "decompiled_code": "__int64 inc()\n{\nunsigned int v1; // [rsp+Ch] [rbp-4h]\n\nif ( !len )\nreturn add(2u);\nif ( len == 1 )\nreturn add(3u);\nv1 = *((_DWORD *)primes + len - 1);\ndo\nv1 += 2;\nwhile ( !(unsigned int)prime_check(v1) );\nreturn add(v1);\n}\n", "canonical_decompiled_code": "__int64 func1()\n{\nunsigned int v1; // [rsp+Ch] [rbp-4h]\n\nif ( !len )\nreturn func0(2u);\nif ( len == 1 )\nreturn func0(3u);\nv1 = *((_DWORD *)primes + len - 1);\ndo\nv1 += 2;\nwhile ( !(unsigned int)func3(v1) );\nreturn func0(v1);\n}", "original_code": "int inc(void)\n{\n int num;\n switch(len) {\n case 0:\n return add(2);\n case 1:\n return add(3);\n default:\n num = primes[len - 1];\n do {\n num += 2;\n } while(!prime_check(num));\n return add(num);\n }\n}", "canonical_original_code": "int inc()\n{\n int num;\n switch(len) {\n case 0:\n return add(2);\n case 1:\n return add(3);\n default:\n num = primes[len - 1];\n do {\n num += 2;\n } while(!prime_check(num));\n return add(num);\n }\n}", "variable_types": [ [ "num", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "94086feca732a85e0456d1f74f355b8c381ebb829d7d621088c2ec2d6b4b7bbc" }, { "name": "prime_get", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall prime_get(int a1)\n{\nwhile ( a1 >= len )\ninc();\nreturn *((unsigned int *)primes + a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(int a1)\n{\nwhile ( a1 >= len )\nfunc1();\nreturn *((unsigned int *)primes + a1);\n}", "original_code": "int prime_get(int idx)\n{\n while(len <= idx)\n inc();\n return primes[idx];\n}", "canonical_original_code": "int prime_get(int idx)\n{\n while(len <= idx)\n inc();\n return primes[idx];\n}", "variable_types": [ [ "idx", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "94086feca732a85e0456d1f74f355b8c381ebb829d7d621088c2ec2d6b4b7bbc" }, { "name": "prime_check", "canonical_name": "func3", "repo": "ivartj/platformer", "decompiled_code": "_BOOL8 __fastcall prime_check(int a1)\n{\nint i; // [rsp+18h] [rbp-8h]\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = 0;\nfor ( i = prime_get(0); a1 >= i * i && a1 % i; i = prime_get(v3) )\n++v3;\nreturn a1 < i * i;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func3(int a1)\n{\nint i; // [rsp+18h] [rbp-8h]\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = 0;\nfor ( i = func2(0); a1 >= i * i && a1 % i; i = func2(v3) )\n++v3;\nreturn a1 < i * i;\n}", "original_code": "int prime_check(int num)\n{\n int i;\n int prime;\n for(prime = prime_get(i = 0);\n (prime * prime <= num) && (num % prime != 0);\n prime = prime_get(++i));\n if(prime * prime > num)\n return 1;\n else\n return 0;\n}", "canonical_original_code": "int prime_check(int num)\n{\n int i;\n int prime;\n for(prime = prime_get(i = 0);\n (prime * prime <= num) && (num % prime != 0);\n prime = prime_get(++i));\n if(prime * prime > num)\n return 1;\n else\n return 0;\n}", "variable_types": [ [ "num", "int" ], [ "i", "int" ], [ "prime", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "94086feca732a85e0456d1f74f355b8c381ebb829d7d621088c2ec2d6b4b7bbc" }, { "name": "prime_above", "canonical_name": "func4", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall prime_above(int a1)\n{\n_BOOL4 i; // eax\nunsigned int v3; // [rsp+Ch] [rbp-4h]\n\nv3 = a1 + 1;\nfor ( i = prime_check(a1 + 1); !i; i = prime_check(v3) )\n++v3;\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(int a1)\n{\n_BOOL4 i; // eax\nunsigned int v3; // [rsp+Ch] [rbp-4h]\n\nv3 = a1 + 1;\nfor ( i = func3(a1 + 1); !i; i = func3(v3) )\n++v3;\nreturn v3;\n}", "original_code": "int prime_above(int num)\n{\n for(++num; !prime_check(num); num++);\n return num;\n}", "canonical_original_code": "int prime_above(int num)\n{\n for(++num; !prime_check(num); num++);\n return num;\n}", "variable_types": [ [ "num", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "94086feca732a85e0456d1f74f355b8c381ebb829d7d621088c2ec2d6b4b7bbc" } ]
bad56f4f9a108600defa720c7c6c4fa52efa75f2824166a38217fb9fc65fe138
ivartj/platformer
[ [ "array_create", "->" ], [ "array_add", "->" ], [ "array_get", "->" ] ]
[]
[ { "name": "array_create", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "void *array_create()\n{\nreturn calloc(1uLL, 0x10uLL);\n}\n", "canonical_decompiled_code": "void *func0()\n{\nreturn calloc(1uLL, 0x10uLL);\n}", "original_code": "array *array_create(void)\n{\n return (array *)calloc(1, sizeof(array));\n}", "canonical_original_code": "struct _array *array_create()\n{\n return (struct _array *)calloc(1, sizeof(array));\n}", "variable_types": [], "return_type": "struct _array { int len; void **els; } *", "user_defined_types": [ "struct _array { int len; void **els; }" ], "binary_hash": "bad56f4f9a108600defa720c7c6c4fa52efa75f2824166a38217fb9fc65fe138" }, { "name": "array_add", "canonical_name": "func1", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall array_add(__int64 a1, __int64 a2)\n{\n__int64 v2; // rsi\nint v3; // eax\n\nif ( *(_DWORD *)a1 == *(_DWORD *)(a1 + 4) )\n{\nif ( *(_DWORD *)(a1 + 4) )\n*(_DWORD *)(a1 + 4) *= 2;\nelse\n*(_DWORD *)(a1 + 4) = 256;\n*(_QWORD *)(a1 + 8) = realloc(*(void **)(a1 + 8), 8LL * *(int *)(a1 + 4));\n}\nv2 = *(_QWORD *)(a1 + 8);\nv3 = (*(_DWORD *)a1)++;\n*(_QWORD *)(v2 + 8LL * v3) = a2;\nreturn (unsigned int)(*(_DWORD *)a1 - 1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, __int64 a2)\n{\n__int64 v2; // rsi\nint v3; // eax\n\nif ( *(_DWORD *)a1 == *(_DWORD *)(a1 + 4) )\n{\nif ( *(_DWORD *)(a1 + 4) )\n*(_DWORD *)(a1 + 4) *= 2;\nelse\n*(_DWORD *)(a1 + 4) = 256;\n*(_QWORD *)(a1 + 8) = realloc(*(void **)(a1 + 8), 8LL * *(int *)(a1 + 4));\n}\nv2 = *(_QWORD *)(a1 + 8);\nv3 = (*(_DWORD *)a1)++;\n*(_QWORD *)(v2 + 8LL * v3) = a2;\nreturn (unsigned int)(*(_DWORD *)a1 - 1);\n}", "original_code": "int array_add(array *a, void *el)\n{\n if(a->len == a->cap) {\n if(a->cap == 0)\n a->cap = 256;\n else\n a->cap <<= 1;\n a->els = realloc(a->els, a->cap * sizeof(void *));\n }\n a->els[a->len++] = el;\n return a->len - 1;\n}", "canonical_original_code": "int array_add(struct _array *a, void *el)\n{\n if(a->len == a->cap) {\n if(a->cap == 0)\n a->cap = 256;\n else\n a->cap <<= 1;\n a->els = realloc(a->els, a->cap * sizeof(void *));\n }\n a->els[a->len++] = el;\n return a->len - 1;\n}", "variable_types": [ [ "a", "struct _array { int len; void **els; } *" ], [ "el", "void *" ] ], "return_type": "int", "user_defined_types": [ "struct _array { int len; void **els; }" ], "binary_hash": "bad56f4f9a108600defa720c7c6c4fa52efa75f2824166a38217fb9fc65fe138" }, { "name": "array_get", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall array_get(__int64 a1, int a2)\n{\n__int64 result; // rax\n\nif ( a2 < *(_DWORD *)a1 )\nresult = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8LL * a2);\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, int a2)\n{\n__int64 result; // rax\n\nif ( a2 < *(_DWORD *)a1 )\nresult = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 8LL * a2);\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "void *array_get(array *a, int idx)\n{\n if(idx >= a->len)\n return ((void *)0);\n return a->els[idx];\n}", "canonical_original_code": "void *array_get(struct _array *a, int idx)\n{\n if(idx >= a->len)\n return ((void *)0);\n return a->els[idx];\n}", "variable_types": [ [ "a", "struct _array { int len; void **els; } *" ], [ "idx", "int" ] ], "return_type": "void *", "user_defined_types": [ "struct _array { int len; void **els; }" ], "binary_hash": "bad56f4f9a108600defa720c7c6c4fa52efa75f2824166a38217fb9fc65fe138" } ]
bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b
ivartj/platformer
[ [ "dlist_create", "->" ], [ "dnode_data", "->" ], [ "dnode_next", "->" ], [ "dnode_prev", "->" ], [ "dlist_last", "->" ], [ "dlist_first", "->" ], [ "dnode_rem", "->" ], [ "dlist_add_last", "->" ], [ "dlist_add_first", "->" ], [ "dlist_iter", "->" ], [ "dnode_iter_next", "->" ] ]
[ [ "dnode_data", "void *__fastcall func1(__int64 a1, void *a2, size_t a3)\n{\nsize_t n; // [rsp+8h] [rbp-18h]\n\nn = a3;\nif ( a3 != *(_QWORD *)(a1 + 8) )\nwarning(\"dnode_data: mismatch between data type sizes stored and requested\");\nif ( n > *(_QWORD *)(a1 + 8) )\nn = *(_QWORD *)(a1 + 8);\nreturn memcpy(a2, *(const void **)a1, n);\n}" ], [ "dlist_add_last", "void **__fastcall func7(void ***a1, const void *a2, size_t a3)\n{\nvoid **v5; // [rsp+28h] [rbp-8h]\n\nv5 = (void **)calloc(1uLL, 0x28uLL);\n*v5 = malloc(a3);\nmemcpy(*v5, a2, a3);\nv5[1] = (void *)a3;\nv5[4] = a1;\nif ( a1[1] )\n{\na1[1][2] = v5;\nv5[3] = a1[1];\n}\nelse\n{\n*a1 = v5;\n}\na1[1] = v5;\nreturn v5;\n}" ], [ "dlist_add_first", "void **__fastcall func8(void ***a1, const void *a2, size_t a3)\n{\nvoid **v5; // [rsp+28h] [rbp-8h]\n\nv5 = (void **)calloc(1uLL, 0x28uLL);\n*v5 = malloc(a3);\nmemcpy(*v5, a2, a3);\nv5[1] = (void *)a3;\nv5[4] = a1;\nif ( *a1 )\n{\n(*a1)[3] = v5;\nv5[2] = *a1;\n}\nelse\n{\na1[1] = v5;\n}\n*a1 = v5;\nreturn v5;\n}" ] ]
[ { "name": "dlist_create", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "void *dlist_create()\n{\nreturn calloc(1uLL, 0x10uLL);\n}\n", "canonical_decompiled_code": "void *func0()\n{\nreturn calloc(1uLL, 0x10uLL);\n}", "original_code": "dlist *dlist_create(void)\n{\n dlist *dl;\n dl = calloc(1, sizeof(dlist));\n return dl;\n}", "canonical_original_code": "struct _dlist *dlist_create()\n{\n struct _dlist *dl;\n dl = calloc(1, sizeof(dlist));\n return dl;\n}", "variable_types": [ [ "dl", "struct _dlist { struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; } *first; struct _dnode *last; } *" ] ], "return_type": "struct _dlist { struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; } *first; struct _dnode *last; } *", "user_defined_types": [ "struct _dlist { struct _dnode *first; struct _dnode *last; }", "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" }, { "name": "dnode_next", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall dnode_next(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 16);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 16);\n}", "original_code": "dnode *dnode_next(dnode *dn)\n{\n return dn->next;\n}", "canonical_original_code": "struct _dnode *dnode_next(struct _dnode *dn)\n{\n return dn->next;\n}", "variable_types": [ [ "dn", "struct _dnode *" ] ], "return_type": "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist { struct _dnode *first; struct _dnode *last; } *list; } *", "user_defined_types": [ "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }", "struct _dlist { struct _dnode *first; struct _dnode *last; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" }, { "name": "dnode_prev", "canonical_name": "func3", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall dnode_prev(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 24);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 24);\n}", "original_code": "dnode *dnode_prev(dnode *dn)\n{\n return dn->prev;\n}", "canonical_original_code": "struct _dnode *dnode_prev(struct _dnode *dn)\n{\n return dn->prev;\n}", "variable_types": [ [ "dn", "struct _dnode *" ] ], "return_type": "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist { struct _dnode *first; struct _dnode *last; } *list; } *", "user_defined_types": [ "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }", "struct _dlist { struct _dnode *first; struct _dnode *last; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" }, { "name": "dlist_last", "canonical_name": "func4", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall dlist_last(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 8);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 8);\n}", "original_code": "dnode *dlist_last(dlist *dl)\n{\n return dl->last;\n}", "canonical_original_code": "struct _dnode *dlist_last(struct _dlist *dl)\n{\n return dl->last;\n}", "variable_types": [ [ "dl", "struct _dlist *" ] ], "return_type": "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist { struct _dnode *first; struct _dnode *last; } *list; } *", "user_defined_types": [ "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }", "struct _dlist { struct _dnode *first; struct _dnode *last; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" }, { "name": "dlist_first", "canonical_name": "func5", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall dlist_first(__int64 a1)\n{\nreturn *(_QWORD *)a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1)\n{\nreturn *(_QWORD *)a1;\n}", "original_code": "dnode *dlist_first(dlist *dl)\n{\n return dl->first;\n}", "canonical_original_code": "struct _dnode *dlist_first(struct _dlist *dl)\n{\n return dl->first;\n}", "variable_types": [ [ "dl", "struct _dlist *" ] ], "return_type": "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist { struct _dnode *first; struct _dnode *last; } *list; } *", "user_defined_types": [ "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }", "struct _dlist { struct _dnode *first; struct _dnode *last; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" }, { "name": "dnode_rem", "canonical_name": "func6", "repo": "ivartj/platformer", "decompiled_code": "void __fastcall dnode_rem(__int64 a1)\n{\nif ( *(_QWORD *)(a1 + 24) )\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 16LL) = *(_QWORD *)(a1 + 16);\nelse\n**(_QWORD **)(a1 + 32) = *(_QWORD *)(a1 + 16);\nif ( *(_QWORD *)(a1 + 16) )\n*(_QWORD *)(*(_QWORD *)(a1 + 16) + 24LL) = *(_QWORD *)(a1 + 24);\nelse\n*(_QWORD *)(*(_QWORD *)(a1 + 32) + 8LL) = *(_QWORD *)(a1 + 24);\nfree(*(void **)a1);\nfree((void *)a1);\n}\n", "canonical_decompiled_code": "void __fastcall func6(__int64 a1)\n{\nif ( *(_QWORD *)(a1 + 24) )\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 16LL) = *(_QWORD *)(a1 + 16);\nelse\n**(_QWORD **)(a1 + 32) = *(_QWORD *)(a1 + 16);\nif ( *(_QWORD *)(a1 + 16) )\n*(_QWORD *)(*(_QWORD *)(a1 + 16) + 24LL) = *(_QWORD *)(a1 + 24);\nelse\n*(_QWORD *)(*(_QWORD *)(a1 + 32) + 8LL) = *(_QWORD *)(a1 + 24);\nfree(*(void **)a1);\nfree((void *)a1);\n}", "original_code": "void dnode_rem(dnode *dn)\n{\n if(dn->prev != ((void *)0))\n dn->prev->next = dn->next;\n else\n dn->list->first = dn->next;\n if(dn->next != ((void *)0))\n dn->next->prev = dn->prev;\n else\n dn->list->last = dn->prev;\n free(dn->data);\n free(dn);\n}", "canonical_original_code": "void dnode_rem(struct _dnode *dn)\n{\n if(dn->prev != ((void *)0))\n dn->prev->next = dn->next;\n else\n dn->list->first = dn->next;\n if(dn->next != ((void *)0))\n dn->next->prev = dn->prev;\n else\n dn->list->last = dn->prev;\n free(dn->data);\n free(dn);\n}", "variable_types": [ [ "dn", "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist { struct _dnode *first; struct _dnode *last; } *list; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }", "struct _dlist { struct _dnode *first; struct _dnode *last; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" }, { "name": "dlist_iter", "canonical_name": "func9", "repo": "ivartj/platformer", "decompiled_code": "_BOOL8 __fastcall dlist_iter(_QWORD *a1, _QWORD *a2)\n{\n*a2 = *a1;\na2[1] = dnode_iter_next;\nreturn *a1 != 0LL;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func9(_QWORD *a1, _QWORD *a2)\n{\n*a2 = *a1;\na2[1] = dnode_iter_next;\nreturn *a1 != 0LL;\n}", "original_code": "int dlist_iter(dlist *dl, iter *i)\n{\n i->data.v = dl->first;\n i->next = dnode_iter_next;\n return dl->first != ((void *)0);\n}", "canonical_original_code": "int dlist_iter(struct _dlist *dl, struct _iter *i)\n{\n i->data.v = dl->first;\n i->next = dnode_iter_next;\n return dl->first != ((void *)0);\n}", "variable_types": [ [ "dl", "struct _dlist { struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; } *first; struct _dnode *last; } *" ], [ "i", "struct _iter { union _data { void *v; int i; double d; } data; int (*next)(struct _iter *i, void *retval); } *" ] ], "return_type": "int", "user_defined_types": [ "struct _dlist { struct _dnode *first; struct _dnode *last; }", "struct _iter { union _data data; int (*next)(struct _iter *i, void *retval); }", "union _data { void *v; int i; double d; }", "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" }, { "name": "dnode_iter_next", "canonical_name": "func10", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall dnode_iter_next(__int64 *a1, void *a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = *a1;\nif ( !*a1 )\nreturn 0LL;\n*a1 = *(_QWORD *)(v3 + 16);\nmemcpy(a2, *(const void **)v3, *(_QWORD *)(v3 + 8));\nreturn 1LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(__int64 *a1, void *a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = *a1;\nif ( !*a1 )\nreturn 0LL;\n*a1 = *(_QWORD *)(v3 + 16);\nmemcpy(a2, *(const void **)v3, *(_QWORD *)(v3 + 8));\nreturn 1LL;\n}", "original_code": "int dnode_iter_next(iter *i, void *retval)\n{\n dnode *dn;\n dn = (dnode *)(i->data.v);\n if(dn == ((void *)0))\n return 0;\n i->data.v = dn->next;\n memcpy(retval, dn->data, dn->datalen);\n return 1;\n}", "canonical_original_code": "int dnode_iter_next(struct _iter *i, void *retval)\n{\n struct _dnode *dn;\n dn = (struct _dnode *)(i->data.v);\n if(dn == ((void *)0))\n return 0;\n i->data.v = dn->next;\n memcpy(retval, dn->data, dn->datalen);\n return 1;\n}", "variable_types": [ [ "i", "struct _iter { union _data { void *v; int i; double d; } data; int (*next)(struct _iter *i, void *retval); } *" ], [ "retval", "void *" ], [ "dn", "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist { struct _dnode *first; struct _dnode *last; } *list; } *" ] ], "return_type": "int", "user_defined_types": [ "struct _iter { union _data data; int (*next)(struct _iter *i, void *retval); }", "struct _dnode { void *data; unsigned long datalen; struct _dnode *next; struct _dnode *prev; struct _dlist *list; }", "union _data { void *v; int i; double d; }", "struct _dlist { struct _dnode *first; struct _dnode *last; }" ], "binary_hash": "bfc74420505029695b687851c9461f9d168a41e4da35900be338cd34eb423f2b" } ]
d756886964b3524f15b971877c8cadd81f2de76039e76b782bdd482f7c269c0b
ivartj/platformer
[ [ "ps2rect", "->" ], [ "rect_isoverlap", "->" ], [ "rect_iswithin", "->" ] ]
[]
[ { "name": "ps2rect", "canonical_name": "func0", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall ps2rect(int a1, int a2, int a3, int a4)\n{\n__int64 v5; // [rsp+10h] [rbp-10h]\n\nif ( a1 >= a3 )\nLODWORD(v5) = a3;\nelse\nLODWORD(v5) = a1;\nif ( a2 >= a4 )\nHIDWORD(v5) = a4;\nelse\nHIDWORD(v5) = a2;\nreturn v5;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(int a1, int a2, int a3, int a4)\n{\n__int64 v5; // [rsp+10h] [rbp-10h]\n\nif ( a1 >= a3 )\nLODWORD(v5) = a3;\nelse\nLODWORD(v5) = a1;\nif ( a2 >= a4 )\nHIDWORD(v5) = a4;\nelse\nHIDWORD(v5) = a2;\nreturn v5;\n}", "original_code": "rect ps2rect(int x, int y, int x2, int y2)\n{\n rect r;\n if(x < x2) {\n r.x = x;\n r.w = x2 - x;\n } else {\n r.x = x2;\n r.w = x - x2;\n }\n if(y < y2) {\n r.y = y;\n r.h = y2 - y;\n } else {\n r.y = y2;\n r.h = y - y2;\n }\n return r;\n}", "canonical_original_code": "struct rect ps2rect(int x, int y, int x2, int y2)\n{\n struct rect r;\n if(x < x2) {\n r.x = x;\n r.w = x2 - x;\n } else {\n r.x = x2;\n r.w = x - x2;\n }\n if(y < y2) {\n r.y = y;\n r.h = y2 - y;\n } else {\n r.y = y2;\n r.h = y - y2;\n }\n return r;\n}", "variable_types": [ [ "x", "int" ], [ "y", "int" ], [ "x2", "int" ], [ "y2", "int" ], [ "r", "struct rect { int x; }" ] ], "return_type": "struct rect { int x; }", "user_defined_types": [ "struct rect { int x; }" ], "binary_hash": "d756886964b3524f15b971877c8cadd81f2de76039e76b782bdd482f7c269c0b" }, { "name": "rect_isoverlap", "canonical_name": "func1", "repo": "ivartj/platformer", "decompiled_code": "_BOOL8 __fastcall rect_isoverlap(_DWORD *a1, _DWORD *a2)\n{\nif ( *a2 >= *a1 + a1[2] )\nreturn 0LL;\nif ( *a1 >= *a2 + a2[2] )\nreturn 0LL;\nif ( a2[1] < a1[1] + a1[3] )\nreturn a1[1] < a2[1] + a2[3];\nreturn 0LL;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func1(_DWORD *a1, _DWORD *a2)\n{\nif ( *a2 >= *a1 + a1[2] )\nreturn 0LL;\nif ( *a1 >= *a2 + a2[2] )\nreturn 0LL;\nif ( a2[1] < a1[1] + a1[3] )\nreturn a1[1] < a2[1] + a2[3];\nreturn 0LL;\n}", "original_code": "int rect_isoverlap(rect *a, rect *b)\n{\n if(b->x >= a->x + a->w)\n return 0;\n if(a->x >= b->x + b->w)\n return 0;\n if(b->y >= a->y + a->h)\n return 0;\n if(a->y >= b->y + b->h)\n return 0;\n return 1;\n}", "canonical_original_code": "int rect_isoverlap(struct rect *a, struct rect *b)\n{\n if(b->x >= a->x + a->w)\n return 0;\n if(a->x >= b->x + b->w)\n return 0;\n if(b->y >= a->y + a->h)\n return 0;\n if(a->y >= b->y + b->h)\n return 0;\n return 1;\n}", "variable_types": [ [ "a", "struct rect { int x; } *" ], [ "b", "struct rect *" ] ], "return_type": "int", "user_defined_types": [ "struct rect { int x; }" ], "binary_hash": "d756886964b3524f15b971877c8cadd81f2de76039e76b782bdd482f7c269c0b" }, { "name": "rect_iswithin", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "_BOOL8 __fastcall rect_iswithin(_DWORD *a1, _DWORD *a2)\n{\nif ( *a1 > *a2 )\nreturn 0LL;\nif ( a1[2] + *a1 < *a2 + a2[2] )\nreturn 0LL;\nif ( a1[1] <= a2[1] )\nreturn a1[3] + a1[1] >= a2[1] + a2[3];\nreturn 0LL;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func2(_DWORD *a1, _DWORD *a2)\n{\nif ( *a1 > *a2 )\nreturn 0LL;\nif ( a1[2] + *a1 < *a2 + a2[2] )\nreturn 0LL;\nif ( a1[1] <= a2[1] )\nreturn a1[3] + a1[1] >= a2[1] + a2[3];\nreturn 0LL;\n}", "original_code": "int rect_iswithin(rect *a, rect *b)\n{\n if(a->x > b->x)\n return 0;\n if(a->x + a->w < b->x + b->w)\n return 0;\n if(a->y > b->y)\n return 0;\n if(a->y + a->h < b->y + b->h)\n return 0;\n return 1;\n}", "canonical_original_code": "int rect_iswithin(struct rect *a, struct rect *b)\n{\n if(a->x > b->x)\n return 0;\n if(a->x + a->w < b->x + b->w)\n return 0;\n if(a->y > b->y)\n return 0;\n if(a->y + a->h < b->y + b->h)\n return 0;\n return 1;\n}", "variable_types": [ [ "a", "struct rect { int x; } *" ], [ "b", "struct rect *" ] ], "return_type": "int", "user_defined_types": [ "struct rect { int x; }" ], "binary_hash": "d756886964b3524f15b971877c8cadd81f2de76039e76b782bdd482f7c269c0b" } ]
e06c9b7b1f298134c86cfefa7c6407c3d9b9d07cb7f8663d60e8759667a34906
ivartj/platformer
[ [ "usage", "->", "parseargs" ], [ "parseargs", "->", "usage", "main" ], [ "init", "->", "main" ], [ "fail", "->" ], [ "quit", "->", "main" ], [ "main", "->", "parseargs", "init", "quit" ] ]
[ [ "usage", "size_t __fastcall func0(FILE *a1)\n{\nreturn fwrite(\"usage: game\\n\", 1uLL, 0xCuLL, a1);\n}" ] ]
[ { "name": "parseargs", "canonical_name": "func1", "repo": "ivartj/platformer", "decompiled_code": "__int64 __fastcall parseargs(int a1, char *const *a2)\n{\nint v2; // eax\n__int64 result; // rax\n\nwhile ( 1 )\n{\nv2 = getopt_long(a1, a2, \"h\", &longopts_0, 0LL);\nif ( v2 == -1 )\nbreak;\nif ( v2 == 104 )\n{\nusage(stdout);\nexit(0);\n}\nif ( v2 <= 104 && (v2 == 58 || v2 == 63) )\n{\nusage(stderr);\nexit(1);\n}\n}\nresult = (unsigned int)(a1 - optind);\nif ( a1 != optind )\n{\nusage(stderr);\nexit(1);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(int a1, char *const *a2)\n{\nint v2; // eax\n__int64 result; // rax\n\nwhile ( 1 )\n{\nv2 = getopt_long(a1, a2, \"h\", &longopts_0, 0LL);\nif ( v2 == -1 )\nbreak;\nif ( v2 == 104 )\n{\nfunc0(stdout);\nexit(0);\n}\nif ( v2 <= 104 && (v2 == 58 || v2 == 63) )\n{\nfunc0(stderr);\nexit(1);\n}\n}\nresult = (unsigned int)(a1 - optind);\nif ( a1 != optind )\n{\nfunc0(stderr);\nexit(1);\n}\nreturn result;\n}", "original_code": "void parseargs(int argc, char *argv[])\n{\n int c;\n static struct option longopts[] = {\n { \"help\", 0, ((void *)0), 'h' },\n { 0, 0, 0, 0 },\n };\n while((c = getopt_long(argc, argv, \"h\", longopts, ((void *)0))) != -1)\n switch(c) {\n case 'h':\n usage(stdout);\n exit(0);\n case '?':\n case ':':\n usage(stderr);\n exit(1);\n }\n switch(argc - optind) {\n case 0:\n break;\n default:\n usage(stderr);\n exit(1);\n }\n}", "canonical_original_code": "void parseargs(int argc, char *argv[])\n{\n int c;\n static struct option longopts[] = {\n { \"help\", 0, ((void *)0), 'h' },\n { 0, 0, 0, 0 },\n };\n while((c = getopt_long(argc, argv, \"h\", longopts, ((void *)0))) != -1)\n switch(c) {\n case 'h':\n usage(stdout);\n exit(0);\n case '?':\n case ':':\n usage(stderr);\n exit(1);\n }\n switch(argc - optind) {\n case 0:\n break;\n default:\n usage(stderr);\n exit(1);\n }\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "c", "int" ], [ "longopts", "struct option { char *name; int has_arg; int *flag; int val; } []" ] ], "return_type": "void", "user_defined_types": [ "struct option { char *name; int has_arg; int *flag; int val; }" ], "binary_hash": "e06c9b7b1f298134c86cfefa7c6407c3d9b9d07cb7f8663d60e8759667a34906" }, { "name": "init", "canonical_name": "func2", "repo": "ivartj/platformer", "decompiled_code": "void init()\n{\nint v0; // eax\nconst char *v1; // rdx\nint v2; // eax\nconst char *v3; // rdx\n\nif ( (unsigned int)video_init(640LL, 480LL) )\n{\nv0 = geterrmsg();\nerror((int)\"Failed to initialize video: %s\", v0, v1);\n}\nif ( (unsigned int)load_init() )\n{\nv2 = geterrmsg();\nerror((int)\"Failed to initialize image loading: %s\", v2, v3);\n}\n}\n", "canonical_decompiled_code": "void func2()\n{\nint v0; // eax\nconst char *v1; // rdx\nint v2; // eax\nconst char *v3; // rdx\n\nif ( (unsigned int)video_init(640LL, 480LL) )\n{\nv0 = geterrmsg();\nerror((int)\"Failed to initialize video: %s\", v0, v1);\n}\nif ( (unsigned int)load_init() )\n{\nv2 = geterrmsg();\nerror((int)\"Failed to initialize image loading: %s\", v2, v3);\n}\n}", "original_code": "void init(void)\n{\n int err;\n err = video_init(640, 480);\n if(err)\n error(\"Failed to initialize video: %s\", geterrmsg());\n err = load_init();\n if(err)\n error(\"Failed to initialize image loading: %s\", geterrmsg());\n}", "canonical_original_code": "void init()\n{\n int err;\n err = video_init(640, 480);\n if(err)\n error(\"Failed to initialize video: %s\", geterrmsg());\n err = load_init();\n if(err)\n error(\"Failed to initialize image loading: %s\", geterrmsg());\n}", "variable_types": [ [ "err", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "e06c9b7b1f298134c86cfefa7c6407c3d9b9d07cb7f8663d60e8759667a34906" }, { "name": "fail", "canonical_name": "func3", "repo": "ivartj/platformer", "decompiled_code": "void __noreturn fail()\n{\nexit(1);\n}\n", "canonical_decompiled_code": "void __noreturn func3()\n{\nexit(1);\n}", "original_code": "void fail(void)\n{\n exit(1);\n}", "canonical_original_code": "void fail()\n{\n exit(1);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "e06c9b7b1f298134c86cfefa7c6407c3d9b9d07cb7f8663d60e8759667a34906" }, { "name": "quit", "canonical_name": "func4", "repo": "ivartj/platformer", "decompiled_code": "void __noreturn quit()\n{\nexit(0);\n}\n", "canonical_decompiled_code": "void __noreturn func4()\n{\nexit(0);\n}", "original_code": "void quit(void)\n{\n exit(0);\n}", "canonical_original_code": "void quit()\n{\n exit(0);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "e06c9b7b1f298134c86cfefa7c6407c3d9b9d07cb7f8663d60e8759667a34906" }, { "name": "main", "canonical_name": "main", "repo": "ivartj/platformer", "decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nparseargs(argc, (char *const *)argv);\ninit();\nquit((unsigned int)argc);\n}\n", "canonical_decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nfunc1(argc, (char *const *)argv);\nfunc2();\nfunc4((unsigned int)argc);\n}", "original_code": "int main(int argc, char *argv[])\n{\n parseargs(argc, argv);\n init();\n quit();\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n parseargs(argc, argv);\n init();\n quit();\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "e06c9b7b1f298134c86cfefa7c6407c3d9b9d07cb7f8663d60e8759667a34906" } ]
End of preview. Expand in Data Studio

Dataset Card for REALTYPE

This dataset is a slightly modified version of the REALTYPE dataset released as part of the paper Idioms: Neural Decompilation With Joint Code and Type Prediction. It was slightly modified to make it compatible with Huggingface's datasets, which struggles with complex JSON datasets.

Dataset Details

Dataset Description

The paper Idioms: Neural Decompilation With Joint Code and Type Prediction introduces a new approach to neural decompilation that jointly predicts code and user-defined types to improve readability and usability of decompiled code. To support this research, the authors constructed REALTYPE, a comprehensive dataset containing 154,301 training functions, 540 validation functions, and 2,322 test functions. Unlike existing benchmarks, REALTYPE includes a substantial number of user-defined types (UDTs) extracted from real-world C code repositories on GitHub. The dataset was carefully constructed to capture complete definitions of all UDTs for all functions by parsing preprocessed original source code, with special attention to maintaining call graph information to enable interprocedural analysis. REALTYPE underwent rigorous deduplication through minhashing and by-project splitting to prevent data leakage between training and testing sets. It represents a significant advancement over previous benchmarks like EXEBENCH and HUMANEVAL-DECOMPILE, which contained very few, if any, realistic UDTs, making REALTYPE particularly valuable for training neural decompilers that can handle the complexity of real-world code with sophisticated type definitions.

This dataset is slightly modified from the original to make it compatible with Huggingface's datasets, which struggles with complex JSON datasets.

Dataset Sources

Uses

Direct Use

The REALTYPE dataset is primarily intended for training and evaluating neural decompilers that can jointly predict code and user-defined types. As described in the Idioms paper, the dataset was specifically created to address the shortcomings of existing neural decompilation benchmarks which lack realistic user-defined types (UDTs). REALTYPE is suitable for training models that need to handle real-world code with complex type structures, particularly for security applications such as malware analysis, vulnerability research, and fixing legacy software without source code. The dataset provides paired examples of decompiled code and original source code with complete UDT definitions, making it valuable for research on improving the readability and semantic accuracy of decompiled code.

Dataset Structure

The REALTYPE dataset contains 154,301 training functions, 540 validation functions, and 2,322 test functions, all extracted from C code repositories on GitHub. Each example in the dataset consists of:

  • Decompiled code: The output of running the Hex-Rays decompiler on compiled binaries.
  • Original source code: The canonicalized form of the original function from source.
  • User-defined type definitions: Complete definitions of all UDTs used in the function.
  • Call graph information: Data about which functions call or are called by each function.

The original REALTYPE dataset was only organized by binary. This view can be accessed using the by_binary configuration. This dataset also contains a by_function configuration, which organizes the data by function. Most data is in both views, but the by_function view does not contain the call graph or unmatched functions (decompiled functions for which the original source code could not be found).

Dataset Creation

Curation Rationale

The REALTYPE dataset was created to address key limitations in existing neural decompilation benchmarks: (1) a lack of variables with user-defined types and their definitions, and (2) insufficient information to build call graphs. The authors identified these limitations as critical gaps preventing neural decompilers from handling real-world code effectively. As the paper explains, "user-defined types (UDTs), such as structs, are widespread in real code" but "existing neural decompilers are not designed to predict the definitions of UDTs." The dataset was specifically designed to enable joint prediction of code and type definitions, addressing what the authors call the "scattered evidence problem" where only a subset of a UDT's fields are accessed within any given function.

Source Data

Data Collection and Processing

The REALTYPE dataset was built by cloning and compiling majority-C-language repositories from GitHub using the GitHub Cloner and Compiler (GHCC) tool. The authors followed these key steps:

  1. Executed standard build configuration scripts and extracted resulting ELF-format binary files.
  2. Used Hex-Rays decompiler to decompile each binary.
  3. Processed original source code by running gcc's preprocessor (gcc -E -P) on the repository archives.
  4. Parsed the preprocessed code, tracking typedef aliases and recording the definitions of UDTs.
  5. Extracted and canonicalized each function by traversing the function's AST and recording all type descriptors.
  6. Matched preprocessed functions with decompiled functions and organized them by the binary in which they occur.
  7. Computed and stored the call graph between functions in each binary.

For deduplication, the authors used both minhashing (to cluster similar text files) and by-project splitting (ensuring all data from a given repository ends up entirely in either the train, validation, or test set).

Bias, Risks, and Limitations

The REALTYPE dataset has several technical limitations acknowledged in the paper:

  • The dataset is biased toward open-source projects on GitHub that could be successfully built. As the authors note, "It is possible that some decompilation targets, especially malware, may have systematic differences from our data and thus affect performance."
  • The dataset only includes unoptimized (-O0) code. The authors mention that "optimizations cause a small-to-moderate decrease in efficacy" in neural decompilation but investigating this would have required excessive computational resources.
  • The dataset does not include obfuscated code, which is common in malware. The authors view deobfuscation as "an orthogonal problem" that could be addressed by separate techniques before neural decompilation.
  • There is a potential risk of data leakage through pretraining, though the authors believe this risk is small because "relatively little decompiled code is found on GitHub or on the internet in general."
  • The dataset is focused on C code and might not generalize well to other programming languages.

Dataset Card Contact

Downloads last month
54