function_name
stringlengths 3
34
| binary_name
stringlengths 64
64
| author_name
stringlengths 2
36
| project_name
stringlengths 2
48
| opt
stringclasses 1
value | src
stringlengths 82
18.8k
| dbg
stringclasses 1
value | codeart
stringlengths 461
87.8k
| lmpa
stringlengths 492
9.74k
| retrieved_index
sequencelengths 2
2
|
---|---|---|---|---|---|---|---|---|---|
read_file | 52873c6b9518cfb23adf74a2c247ecf59c8a27f0b1b6e037bd573d7f8c4042ed | posixninja | ideviceactivate | NA | int read_file(const char *filename, char data[BUFSIZE])
{
FILE *f=fopen(filename, "r");
if (f==NULL)
{
printf("ERROR: Could not open %s for reading\n", filename);
fclose(f);
return -1;
}
else {
uint32_t read=fread(data, 1, BUFSIZE, f);
while (read>0)
{
read=fread(data, 1, BUFSIZE, f);
printf(".");
}
printf("\nINFO: Read sucessfully from %s\n", filename);
return 0;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4035BB", "function_addr": 4208059, "binary_name": "52873c6b9518cfb23adf74a2c247ecf59c8a27f0b1b6e037bd573d7f8c4042ed.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+filename], rdi"], [4, "mov [rbp+ptr], rsi"], [5, "mov rax, [rbp+filename]"], [6, "mov esi, offset aR"], [7, "mov rdi, rax"], [8, "call _fopen"], [9, "mov [rbp+stream], rax"], [10, "cmp [rbp+stream], 0"], [11, "jnz short loc_403610"], [12, "mov rax, [rbp+filename]"], [13, "mov rsi, rax"], [14, "mov edi, offset aErrorCouldNotO_0"], [15, "mov eax, 0"], [16, "call _printf"], [17, "mov rax, [rbp+stream]"], [18, "mov rdi, rax"], [19, "call _fclose"], [20, "mov eax, 0FFFFFFFFh"], [21, "jmp short locret_40367D"], [22, "mov rdx, [rbp+stream]"], [23, "mov rax, [rbp+ptr]"], [24, "mov rcx, rdx"], [25, "mov edx, 200000h"], [26, "mov esi, 1"], [27, "mov rdi, rax"], [28, "call _fread"], [29, "mov [rbp+var_4], eax"], [30, "jmp short loc_40365C"], [31, "mov rdx, [rbp+stream]"], [32, "mov rax, [rbp+ptr]"], [33, "mov rcx, rdx"], [34, "mov edx, 200000h"], [35, "mov esi, 1"], [36, "mov rdi, rax"], [37, "call _fread"], [38, "mov [rbp+var_4], eax"], [39, "mov edi, 2Eh "], [40, "call _putchar"], [41, "cmp [rbp+var_4], 0"], [42, "jnz short loc_403632"], [43, "mov rax, [rbp+filename]"], [44, "mov rsi, rax"], [45, "mov edi, offset aInfoReadSucess"], [46, "mov eax, 0"], [47, "call _printf"], [48, "mov eax, 0"], [49, "leave"], [50, "retn"]], "data_dep": [[5, 3], [7, 5], [9, 8], [10, 9], [11, 10], [12, 3], [13, 12], [17, 9], [18, 17], [22, 9], [23, 4], [24, 22], [27, 23], [29, 28], [31, 9], [32, 4], [33, 31], [36, 32], [38, 37], [41, 29], [41, 38], [42, 41], [43, 3], [44, 43], [50, 48], [50, 20]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/52873c6b9518cfb23adf74a2c247ecf59c8a27f0b1b6e037bd573d7f8c4042ed_52873c6b9518cfb23adf74a2c247ecf59c8a27f0b1b6e037bd573d7f8c4042ed.jsonl.gz", "strip_func_name": "sub_4035BB", "query": "\n\n\n__int64 __fastcall sub_4035BB(const char *a1, void *a2)\n{\n__int64 result; // rax\nFILE *stream; // [rsp+10h] [rbp-10h]\nint v4; // [rsp+1Ch] [rbp-4h]\n\nstream = fopen(a1, \"r\");\nif ( stream )\n{\nv4 = fread(a2, 1uLL, 0x200000uLL, stream);\nwhile ( v4 )\n{\nv4 = fread(a2, 1uLL, 0x200000uLL, stream);\nputchar(46);\n}\nprintf(\"\\nINFO: Read sucessfully from %s\\n\", a1);\nresult = 0LL;\n}\nelse\n{\nprintf(\"ERROR: Could not open %s for reading\\n\", a1);\nfclose(0LL);\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,stream,v4,sub_4035BB,]", "hints": "[]", "response": "{'a1': 'filename', 'a2': 'data', 'stream': 'f', 'v4': 'read', 'sub_4035BB': 'read_file'}"} | [
[
0.8056653738021851,
0.8022002577781677,
0.7876855134963989,
0.787020206451416,
0.7796953916549683,
0.7777220606803894,
0.7743584513664246,
0.7707808017730713,
0.7667345404624939,
0.7666357755661011,
0.7653436660766602,
0.7629669904708862,
0.7612272500991821,
0.7608036994934082,
0.7606289386749268,
0.7605344653129578,
0.7591648101806641,
0.7582341432571411,
0.7563984990119934,
0.7528082728385925
],
[
222382,
164371,
119899,
152407,
255620,
226981,
75386,
168305,
175951,
23134,
59784,
246274,
114290,
150204,
197276,
127611,
102430,
160858,
158122,
89482
]
] |
|
arm_add_f32 | 3526c04555a94d0995ced9ef5f01f3f820e7668c15ce7f2c8c442d3438eb57ec | gwsystems | sledge-serverless-framework | NA | void arm_add_f32(
const float32_t * pSrcA,
const float32_t * pSrcB,
float32_t * pDst,
uint32_t blockSize)
{
uint32_t blkCnt; /* Loop counter */
#if defined(ARM_MATH_NEON) && !defined(ARM_MATH_AUTOVECTORIZE)
f32x4_t vec1;
f32x4_t vec2;
f32x4_t res;
/* Compute 4 outputs at a time */
blkCnt = blockSize >> 2U;
while (blkCnt > 0U)
{
/* C = A + B */
/* Add and then store the results in the destination buffer. */
vec1 = vld1q_f32(pSrcA);
vec2 = vld1q_f32(pSrcB);
res = vaddq_f32(vec1, vec2);
vst1q_f32(pDst, res);
/* Increment pointers */
pSrcA += 4;
pSrcB += 4;
pDst += 4;
/* Decrement the loop counter */
blkCnt--;
}
/* Tail */
blkCnt = blockSize & 0x3;
#else
#if defined (ARM_MATH_LOOPUNROLL) && !defined(ARM_MATH_AUTOVECTORIZE)
/* Loop unrolling: Compute 4 outputs at a time */
blkCnt = blockSize >> 2U;
while (blkCnt > 0U)
{
/* C = A + B */
/* Add and store result in destination buffer. */
*pDst++ = (*pSrcA++) + (*pSrcB++);
*pDst++ = (*pSrcA++) + (*pSrcB++);
*pDst++ = (*pSrcA++) + (*pSrcB++);
*pDst++ = (*pSrcA++) + (*pSrcB++);
/* Decrement loop counter */
blkCnt--;
}
/* Loop unrolling: Compute remaining outputs */
blkCnt = blockSize % 0x4U;
#else
/* Initialize blkCnt with number of samples */
blkCnt = blockSize;
#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
#endif /* #if defined(ARM_MATH_NEON) */
while (blkCnt > 0U)
{
/* C = A + B */
/* Add and store result in destination buffer. */
*pDst++ = (*pSrcA++) + (*pSrcB++);
/* Decrement loop counter */
blkCnt--;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_41FABB", "function_addr": 4324027, "binary_name": "3526c04555a94d0995ced9ef5f01f3f820e7668c15ce7f2c8c442d3438eb57ec.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_18], rdi"], [3, "mov [rbp+var_20], rsi"], [4, "mov [rbp+var_28], rdx"], [5, "mov [rbp+var_2C], ecx"], [6, "mov eax, [rbp+var_2C]"], [7, "mov [rbp+var_4], eax"], [8, "jmp short loc_41FB0E"], [9, "mov rax, [rbp+var_18]"], [10, "lea rdx, [rax+4]"], [11, "mov [rbp+var_18], rdx"], [12, "movss xmm1, dword ptr [rax]"], [13, "mov rax, [rbp+var_20]"], [14, "lea rdx, [rax+4]"], [15, "mov [rbp+var_20], rdx"], [16, "movss xmm0, dword ptr [rax]"], [17, "mov rax, [rbp+var_28]"], [18, "lea rdx, [rax+4]"], [19, "mov [rbp+var_28], rdx"], [20, "addss xmm0, xmm1"], [21, "movss dword ptr [rax], xmm0"], [22, "sub [rbp+var_4], 1"], [23, "cmp [rbp+var_4], 0"], [24, "jnz short loc_41FAD6"], [25, "nop"], [26, "nop"], [27, "pop rbp"], [28, "retn"]], "data_dep": [[6, 5], [7, 6], [9, 2], [9, 11], [10, 9], [10, 18], [10, 21], [11, 10], [12, 9], [12, 21], [13, 3], [13, 15], [14, 10], [14, 13], [14, 21], [15, 14], [16, 13], [16, 21], [17, 4], [17, 19], [18, 17], [18, 21], [18, 14], [19, 18], [20, 16], [20, 12], [21, 17], [21, 20], [22, 7], [22, 22], [23, 7], [23, 22], [24, 23], [27, 0], [28, 6], [28, 17]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/3526c04555a94d0995ced9ef5f01f3f820e7668c15ce7f2c8c442d3438eb57ec_3526c04555a94d0995ced9ef5f01f3f820e7668c15ce7f2c8c442d3438eb57ec.jsonl.gz", "strip_func_name": "sub_41FABB", "query": "\n\n\nunsigned __int64 __fastcall sub_41FABB(float *a1, float *a2, float *a3, unsigned int a4)\n{\nunsigned __int64 result; // rax\nfloat *v5; // rax\nfloat v6; // xmm1_4\nfloat *v7; // rax\nfloat v8; // xmm0_4\nunsigned int i; // [rsp+28h] [rbp-4h]\n\nresult = a4;\nfor ( i = a4; i; --i )\n{\nv5 = a1++;\nv6 = *v5;\nv7 = a2++;\nv8 = *v7;\nresult = (unsigned __int64)a3++;\n*(float *)result = v8 + v6;\n}\nreturn result;\n}\n\n\n\nQ:[a3,a4,a1,a2,sub_41FABB,]", "hints": "[]", "response": "{'a3': 'pDst', 'a4': 'blockSize', 'a1': 'pSrcA', 'a2': 'pSrcB', 'sub_41FABB': 'arm_add_f32'}"} | [
[
0.7912064790725708,
0.7716326713562012,
0.7677892446517944,
0.7640966176986694,
0.7639912366867065,
0.7577878832817078,
0.7575250864028931,
0.7523738145828247,
0.7500044107437134,
0.7499697208404541,
0.7473292946815491,
0.7459140419960022,
0.7451806664466858,
0.7363170981407166,
0.7347731590270996,
0.7345262765884399,
0.7334499359130859,
0.7271559834480286,
0.7256431579589844,
0.7246354222297668
],
[
21595,
114099,
104107,
7516,
230915,
91911,
43842,
88667,
125659,
41438,
201384,
154538,
233108,
123763,
52224,
199963,
236238,
22464,
105898,
32213
]
] |
|
htu21d_read_temperature | 1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0 | hepingood | htu21d | NA | uint8_t htu21d_read_temperature(htu21d_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
{
uint8_t res;
uint8_t buf[3];
uint8_t status;
uint16_t data;
if (handle == NULL) /* check handle */
{
return 2; /* return error */
}
if (handle->inited != 1) /* check handle initialization */
{
return 3; /* return error */
}
if (handle->mode == HTU21D_MODE_HOLD_MASTER) /* hold master mode */
{
res = a_htu21d_read(handle, HTU21D_MODE_HOLD_MASTER,
HTU21D_COMMAND_TRIG_TEMP_HOLD_MASTER, buf, 3); /* read temperature */
if (res != 0) /* check the result */
{
handle->debug_print("htu21d: read failed.\n"); /* read failed */
return 1; /* return error */
}
data = ((uint16_t)buf[0] << 8) | buf[1]; /* get the raw data */
if (a_htu21d_crc(data, buf[2]) != 0) /* check the crc */
{
handle->debug_print("htu21d: crc is error.\n"); /* crc is error */
return 4; /* return error */
}
status = data & 0x3; /* get the status */
if (status != 0x00) /* check the status */
{
handle->debug_print("htu21d: status is error.\n"); /* status is error */
return 5; /* return error */
}
*temperature_raw = data; /* copy data */
}
else /* no hold master mode */
{
uint8_t cmd;
cmd = HTU21D_COMMAND_TRIG_TEMP_NO_HOLD_MASTER; /* read temperature */
res = a_htu21d_write_cmd(handle, &cmd, 1); /* write the command */
if (res != 0) /* check the result */
{
handle->debug_print("htu21d: write cmd failed.\n"); /* write cmd failed */
return 1; /* return error */
}
if (handle->resolution == HTU21D_RESOLUTION_TEMP_11_BITS_RH_11_BITS) /* temp 11 bits and rh 11 bits */
{
handle->delay_ms(7); /* delay 7 ms */
}
else if (handle->resolution == HTU21D_RESOLUTION_TEMP_12_BITS_RH_8_BITS) /* temp 12 bits and rh 8 bits */
{
handle->delay_ms(13); /* delay 13 ms */
}
else if (handle->resolution == HTU21D_RESOLUTION_TEMP_13_BITS_RH_10_BITS) /* temp 13 bits and rh 10 bits */
{
handle->delay_ms(25); /* delay 25 ms */
}
else /* temp 14 bits and rh 12 bits */
{
handle->delay_ms(50); /* delay 50 ms */
}
res = a_htu21d_read_cmd(handle, buf, 3);
if (res != 0) /* check the result */
{
handle->debug_print("htu21d: read cmd failed.\n"); /* read cmd failed */
return 1; /* return error */
}
data = ((uint16_t)buf[0] << 8) | buf[1]; /* get the raw data */
if (a_htu21d_crc(data, buf[2]) != 0) /* check the crc */
{
handle->debug_print("htu21d: crc is error.\n"); /* crc is error */
return 4; /* return error */
}
status = data & 0x3; /* get the status */
if (status != 0x00) /* check the status */
{
handle->debug_print("htu21d: status is error.\n"); /* status is error */
return 5; /* return error */
}
*temperature_raw = data; /* copy data */
}
*temperature_s = (float)(*temperature_raw) / 65536.0f * 175.72f - 46.85f; /* convert raw temperature */
return 0; /* success return 0 */
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401A39", "function_addr": 4201017, "binary_name": "1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_28], rdx"], [6, "cmp [rbp+var_18], 0"], [7, "jnz short loc_401A5E"], [8, "mov eax, 2"], [9, "jmp locret_401D0B"], [10, "mov rax, [rbp+var_18]"], [11, "movzx eax, byte ptr [rax+4Ah]"], [12, "cmp al, 1"], [13, "jz short loc_401A74"], [14, "mov eax, 3"], [15, "jmp locret_401D0B"], [16, "mov rax, [rbp+var_18]"], [17, "movzx eax, byte ptr [rax+48h]"], [18, "test al, al"], [19, "jnz loc_401B5B"], [20, "lea rdx, [rbp+var_8]"], [21, "mov rax, [rbp+var_18]"], [22, "mov r8d, 3"], [23, "mov rcx, rdx"], [24, "mov edx, 0E3h"], [25, "mov esi, 0"], [26, "mov rdi, rax"], [27, "call sub_4012D1"], [28, "mov [rbp+var_1], al"], [29, "cmp [rbp+var_1], 0"], [30, "jz short loc_401ACE"], [31, "mov rax, [rbp+var_18]"], [32, "mov rdx, [rax+40h]"], [33, "mov edi, offset aHtu21dReadFail"], [34, "mov eax, 0"], [35, "call rdx"], [36, "mov eax, 1"], [37, "jmp locret_401D0B"], [38, "movzx eax, [rbp+var_8]"], [39, "movzx eax, al"], [40, "shl eax, 8"], [41, "mov edx, eax"], [42, "movzx eax, [rbp+var_7]"], [43, "movzx eax, al"], [44, "or eax, edx"], [45, "mov [rbp+var_4], ax"], [46, "movzx eax, [rbp+var_6]"], [47, "movzx edx, al"], [48, "movzx eax, [rbp+var_4]"], [49, "mov esi, edx"], [50, "mov edi, eax"], [51, "call sub_401356"], [52, "test al, al"], [53, "jz short loc_401B1D"], [54, "mov rax, [rbp+var_18]"], [55, "mov rdx, [rax+40h]"], [56, "mov edi, offset aHtu21dCrcIsErr"], [57, "mov eax, 0"], [58, "call rdx"], [59, "mov eax, 4"], [60, "jmp locret_401D0B"], [61, "movzx eax, [rbp+var_4]"], [62, "and eax, 3"], [63, "mov [rbp+var_5], al"], [64, "cmp [rbp+var_5], 0"], [65, "jz short loc_401B4B"], [66, "mov rax, [rbp+var_18]"], [67, "mov rdx, [rax+40h]"], [68, "mov edi, offset aHtu21dStatusIs"], [69, "mov eax, 0"], [70, "call rdx"], [71, "mov eax, 5"], [72, "jmp locret_401D0B"], [73, "mov rax, [rbp+var_20]"], [74, "movzx edx, [rbp+var_4]"], [75, "mov [rax], dx"], [76, "jmp loc_401CC5"], [77, "mov [rbp+var_9], 0F3h"], [78, "lea rcx, [rbp+var_9]"], [79, "mov rax, [rbp+var_18]"], [80, "mov edx, 1"], [81, "mov rsi, rcx"], [82, "mov rdi, rax"], [83, "call sub_401202"], [84, "mov [rbp+var_1], al"], [85, "cmp [rbp+var_1], 0"], [86, "jz short loc_401B9E"], [87, "mov rax, [rbp+var_18]"], [88, "mov rdx, [rax+40h]"], [89, "mov edi, offset aHtu21dWriteCmd"], [90, "mov eax, 0"], [91, "call rdx"], [92, "mov eax, 1"], [93, "jmp locret_401D0B"], [94, "mov rax, [rbp+var_18]"], [95, "movzx eax, byte ptr [rax+49h]"], [96, "cmp al, 3"], [97, "jnz short loc_401BBB"], [98, "mov rax, [rbp+var_18]"], [99, "mov rax, [rax+38h]"], [100, "mov edi, 7"], [101, "call rax"], [102, "jmp short loc_401C04"], [103, "mov rax, [rbp+var_18]"], [104, "movzx eax, byte ptr [rax+49h]"], [105, "cmp al, 1"], [106, "jnz short loc_401BD8"], [107, "mov rax, [rbp+var_18]"], [108, "mov rax, [rax+38h]"], [109, "mov edi, 0Dh"], [110, "call rax"], [111, "jmp short loc_401C04"], [112, "mov rax, [rbp+var_18]"], [113, "movzx eax, byte ptr [rax+49h]"], [114, "cmp al, 2"], [115, "jnz short loc_401BF5"], [116, "mov rax, [rbp+var_18]"], [117, "mov rax, [rax+38h]"], [118, "mov edi, 19h"], [119, "call rax"], [120, "jmp short loc_401C04"], [121, "mov rax, [rbp+var_18]"], [122, "mov rax, [rax+38h]"], [123, "mov edi, 32h "], [124, "call rax"], [125, "lea rcx, [rbp+var_8]"], [126, "mov rax, [rbp+var_18]"], [127, "mov edx, 3"], [128, "mov rsi, rcx"], [129, "mov rdi, rax"], [130, "call sub_401244"], [131, "mov [rbp+var_1], al"], [132, "cmp [rbp+var_1], 0"], [133, "jz short loc_401C43"], [134, "mov rax, [rbp+var_18]"], [135, "mov rdx, [rax+40h]"], [136, "mov edi, offset aHtu21dReadCmdF"], [137, "mov eax, 0"], [138, "call rdx"], [139, "mov eax, 1"], [140, "jmp locret_401D0B"], [141, "movzx eax, [rbp+var_8]"], [142, "movzx eax, al"], [143, "shl eax, 8"], [144, "mov edx, eax"], [145, "movzx eax, [rbp+var_7]"], [146, "movzx eax, al"], [147, "or eax, edx"], [148, "mov [rbp+var_4], ax"], [149, "movzx eax, [rbp+var_6]"], [150, "movzx edx, al"], [151, "movzx eax, [rbp+var_4]"], [152, "mov esi, edx"], [153, "mov edi, eax"], [154, "call sub_401356"], [155, "test al, al"], [156, "jz short loc_401C8F"], [157, "mov rax, [rbp+var_18]"], [158, "mov rdx, [rax+40h]"], [159, "mov edi, offset aHtu21dCrcIsErr"], [160, "mov eax, 0"], [161, "call rdx"], [162, "mov eax, 4"], [163, "jmp short locret_401D0B"], [164, "movzx eax, [rbp+var_4]"], [165, "and eax, 3"], [166, "mov [rbp+var_5], al"], [167, "cmp [rbp+var_5], 0"], [168, "jz short loc_401CBA"], [169, "mov rax, [rbp+var_18]"], [170, "mov rdx, [rax+40h]"], [171, "mov edi, offset aHtu21dStatusIs"], [172, "mov eax, 0"], [173, "call rdx"], [174, "mov eax, 5"], [175, "jmp short locret_401D0B"], [176, "mov rax, [rbp+var_20]"], [177, "movzx edx, [rbp+var_4]"], [178, "mov [rax], dx"], [179, "mov rax, [rbp+var_20]"], [180, "movzx eax, word ptr [rax]"], [181, "movzx eax, ax"], [182, "pxor xmm0, xmm0"], [183, "cvtsi2ss xmm0, eax"], [184, "movss xmm2, cs:dword_40624C"], [185, "movaps xmm1, xmm0"], [186, "divss xmm1, xmm2"], [187, "movss xmm0, cs:dword_406250"], [188, "mulss xmm0, xmm1"], [189, "movss xmm1, cs:dword_406254"], [190, "subss xmm0, xmm1"], [191, "mov rax, [rbp+var_28]"], [192, "movss dword ptr [rax], xmm0"], [193, "mov eax, 0"], [194, "leave"], [195, "retn"]], "data_dep": [[6, 3], [7, 6], [10, 3], [11, 10], [12, 11], [13, 12], [16, 3], [17, 16], [18, 17], [19, 18], [21, 3], [23, 20], [26, 21], [28, 27], [29, 28], [30, 29], [31, 3], [32, 31], [35, 32], [39, 38], [40, 39], [41, 40], [43, 42], [44, 41], [44, 43], [45, 44], [47, 46], [48, 45], [49, 47], [50, 48], [52, 51], [53, 52], [54, 3], [55, 54], [58, 55], [61, 45], [62, 61], [63, 62], [64, 63], [65, 64], [66, 3], [67, 66], [70, 67], [73, 4], [74, 45], [75, 74], [75, 73], [78, 77], [79, 3], [81, 78], [82, 79], [84, 83], [85, 84], [86, 85], [87, 3], [88, 87], [91, 88], [94, 3], [95, 94], [96, 95], [97, 96], [98, 3], [99, 98], [101, 99], [103, 3], [104, 103], [105, 104], [106, 105], [107, 3], [108, 107], [110, 108], [112, 3], [113, 112], [114, 113], [115, 114], [116, 3], [117, 116], [119, 117], [121, 3], [122, 121], [124, 122], [125, 78], [126, 3], [128, 125], [129, 126], [131, 130], [132, 131], [133, 132], [134, 3], [135, 134], [138, 135], [142, 141], [143, 142], [144, 143], [146, 145], [147, 144], [147, 146], [148, 147], [150, 149], [151, 148], [152, 150], [153, 151], [155, 154], [156, 155], [157, 3], [158, 157], [161, 158], [164, 148], [165, 164], [166, 165], [167, 166], [168, 167], [169, 3], [170, 169], [173, 170], [176, 4], [177, 148], [178, 177], [178, 176], [179, 4], [180, 192], [180, 75], [180, 179], [180, 178], [181, 180], [183, 181], [183, 182], [185, 183], [186, 184], [186, 185], [188, 187], [188, 186], [190, 188], [190, 189], [191, 5], [192, 190], [192, 191], [195, 162], [195, 36], [195, 139], [195, 8], [195, 193], [195, 14], [195, 71], [195, 92], [195, 174], [195, 59]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0_1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0.jsonl.gz", "strip_func_name": "sub_401A39", "query": "\n\n\n__int64 __fastcall sub_401A39(__int64 a1, _WORD *a2, float *a3)\n{\nchar v5; // [rsp+27h] [rbp-9h] BYREF\nunsigned __int16 v6; // [rsp+28h] [rbp-8h] BYREF\nunsigned __int8 v7; // [rsp+2Ah] [rbp-6h]\nchar v8; // [rsp+2Bh] [rbp-5h]\nunsigned __int16 v9; // [rsp+2Ch] [rbp-4h]\nbool v10; // [rsp+2Fh] [rbp-1h]\n\nif ( !a1 )\nreturn 2LL;\nif ( *(_BYTE *)(a1 + 74) != 1 )\nreturn 3LL;\nif ( *(_BYTE *)(a1 + 72) )\n{\nv5 = -13;\nv10 = sub_401202(a1, (__int64)&v5, 1u);\nif ( v10 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: write cmd failed.\\n\");\nreturn 1LL;\n}\nswitch ( *(_BYTE *)(a1 + 73) )\n{\ncase 3:\n(*(void (__fastcall **)(__int64))(a1 + 56))(7LL);\nbreak;\ncase 1:\n(*(void (__fastcall **)(__int64))(a1 + 56))(13LL);\nbreak;\ncase 2:\n(*(void (__fastcall **)(__int64))(a1 + 56))(25LL);\nbreak;\ndefault:\n(*(void (__fastcall **)(__int64))(a1 + 56))(50LL);\nbreak;\n}\nv10 = sub_401244(a1, (__int64)&v6, 3u);\nif ( v10 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: read cmd failed.\\n\");\nreturn 1LL;\n}\nv9 = _byteswap_ushort(v6);\nif ( sub_401356(v9, v7) )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: crc is error.\\n\");\nreturn 4LL;\n}\nv8 = v9 & 3;\nif ( (v9 & 3) != 0 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: status is error.\\n\");\nreturn 5LL;\n}\n*a2 = v9;\n}\nelse\n{\nv10 = sub_4012D1(a1, 0, 0xE3u, (__int64)&v6, 3u);\nif ( v10 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: read failed.\\n\");\nreturn 1LL;\n}\nv9 = _byteswap_ushort(v6);\nif ( sub_401356(v9, v7) )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: crc is error.\\n\");\nreturn 4LL;\n}\nv8 = v9 & 3;\nif ( (v9 & 3) != 0 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: status is error.\\n\");\nreturn 5LL;\n}\n*a2 = v9;\n}\n*a3 = (float)(175.72 * (float)((float)(unsigned __int16)*a2 / 65536.0)) - 46.849998;\nreturn 0LL;\n}\n\n\n\nQ:[a3,a1,a2,v5,v6,v8,v9,v10,sub_401A39,sub_401202,sub_401244,sub_401356,sub_4012D1,]", "hints": "[]", "response": "{'a3': 'temperature_s', 'a1': 'handle', 'a2': 'temperature_raw', 'v5': 'cmd', 'v6': 'buf', 'v8': 'status', 'v9': 'data', 'v10': 'res', 'sub_401A39': 'htu21d_read_temperature', 'sub_401202': 'a_htu21d_write_cmd', 'sub_401244': 'a_htu21d_read_cmd', 'sub_401356': 'a_htu21d_crc', 'sub_4012D1': 'a_htu21d_read'}"} | [
[
0.8088207244873047,
0.792382001876831,
0.788719654083252,
0.7862687110900879,
0.7827785611152649,
0.7679269909858704,
0.7666707038879395,
0.7655020952224731,
0.7626428008079529,
0.7620380520820618,
0.7608879208564758,
0.7605727910995483,
0.759287416934967,
0.7591960430145264,
0.7583573460578918,
0.752205491065979,
0.7505710124969482,
0.750017523765564,
0.7497122287750244,
0.7449650764465332
],
[
54420,
84826,
254852,
259833,
174090,
94280,
103108,
75439,
210215,
110016,
48196,
65390,
87735,
178305,
264782,
55191,
145392,
31701,
153130,
136056
]
] |
|
wait_for_peer | c07b801f4c22cba9eb2c590b289cb646007790d4994bcedc7f2700fb67eb3721 | jflyup | nat_traversal | NA | static int wait_for_peer(int* socks, int sock_num, struct timeval *timeout) {
fd_set fds;
int max_fd = 0;
FD_ZERO(&fds);
int i;
for (i = 0; i < sock_num; ++i) {
FD_SET(socks[i], &fds);
if (socks[i] > max_fd) {
max_fd = socks[i];
}
}
int ret = select(max_fd + 1, &fds, NULL, NULL, timeout);
int index = -1;
if (ret > 0) {
for (i = 0; i < sock_num; ++i) {
if (FD_ISSET(socks[i], &fds)) {
index = i;
break;
}
}
} else {
// timeout or error
}
// one of the fds is ready, close others
if (index != -1) {
for (i = 0; i < sock_num; ++i) {
if (index != i) {
close(socks[i]);
}
}
return socks[index];
}
return -1;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401913", "function_addr": 4200723, "binary_name": "c07b801f4c22cba9eb2c590b289cb646007790d4994bcedc7f2700fb67eb3721.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 0C0h"], [3, "mov [rbp+var_A8], rdi"], [4, "mov [rbp+var_AC], esi"], [5, "mov [rbp+timeout], rdx"], [6, "mov [rbp+var_4], 0"], [7, "mov eax, 0"], [8, "mov ecx, 10h"], [9, "lea rdx, [rbp+readfds]"], [10, "mov rdi, rdx"], [11, "cld"], [12, "rep stosq"], [13, "mov eax, edi"], [14, "mov edx, ecx"], [15, "mov [rbp+var_10], edx"], [16, "mov [rbp+var_14], eax"], [17, "mov [rbp+var_8], 0"], [18, "jmp loc_401A18"], [19, "mov eax, [rbp+var_8]"], [20, "cdqe"], [21, "lea rdx, ds:0[rax*4]"], [22, "mov rax, [rbp+var_A8]"], [23, "add rax, rdx"], [24, "mov eax, [rax]"], [25, "lea edx, [rax+3Fh]"], [26, "test eax, eax"], [27, "cmovs eax, edx"], [28, "sar eax, 6"], [29, "mov esi, eax"], [30, "movsxd rax, esi"], [31, "mov rdi, [rbp+rax*8+readfds.fds_bits]"], [32, "mov eax, [rbp+var_8]"], [33, "cdqe"], [34, "lea rdx, ds:0[rax*4]"], [35, "mov rax, [rbp+var_A8]"], [36, "add rax, rdx"], [37, "mov eax, [rax]"], [38, "cdq"], [39, "shr edx, 1Ah"], [40, "add eax, edx"], [41, "and eax, 3Fh"], [42, "sub eax, edx"], [43, "mov edx, 1"], [44, "mov ecx, eax"], [45, "shl rdx, cl"], [46, "mov rax, rdx"], [47, "or rdi, rax"], [48, "mov rdx, rdi"], [49, "movsxd rax, esi"], [50, "mov [rbp+rax*8+readfds.fds_bits], rdx"], [51, "mov eax, [rbp+var_8]"], [52, "cdqe"], [53, "lea rdx, ds:0[rax*4]"], [54, "mov rax, [rbp+var_A8]"], [55, "add rax, rdx"], [56, "mov eax, [rax]"], [57, "cmp [rbp+var_4], eax"], [58, "jge short loc_401A14"], [59, "mov eax, [rbp+var_8]"], [60, "cdqe"], [61, "lea rdx, ds:0[rax*4]"], [62, "mov rax, [rbp+var_A8]"], [63, "add rax, rdx"], [64, "mov eax, [rax]"], [65, "mov [rbp+var_4], eax"], [66, "add [rbp+var_8], 1"], [67, "mov eax, [rbp+var_8]"], [68, "cmp eax, [rbp+var_AC]"], [69, "jl loc_401967"], [70, "mov eax, [rbp+var_4]"], [71, "lea edi, [rax+1]"], [72, "mov rdx, [rbp+timeout]"], [73, "lea rax, [rbp+readfds]"], [74, "mov r8, rdx"], [75, "mov ecx, 0"], [76, "mov edx, 0"], [77, "mov rsi, rax"], [78, "call _select"], [79, "mov [rbp+var_18], eax"], [80, "mov [rbp+var_C], 0FFFFFFFFh"], [81, "cmp [rbp+var_18], 0"], [82, "jle loc_401AEB"], [83, "mov [rbp+var_8], 0"], [84, "jmp short loc_401AE0"], [85, "mov eax, [rbp+var_8]"], [86, "cdqe"], [87, "lea rdx, ds:0[rax*4]"], [88, "mov rax, [rbp+var_A8]"], [89, "add rax, rdx"], [90, "mov eax, [rax]"], [91, "lea edx, [rax+3Fh]"], [92, "test eax, eax"], [93, "cmovs eax, edx"], [94, "sar eax, 6"], [95, "cdqe"], [96, "mov rsi, [rbp+rax*8+readfds.fds_bits]"], [97, "mov eax, [rbp+var_8]"], [98, "cdqe"], [99, "lea rdx, ds:0[rax*4]"], [100, "mov rax, [rbp+var_A8]"], [101, "add rax, rdx"], [102, "mov eax, [rax]"], [103, "cdq"], [104, "shr edx, 1Ah"], [105, "add eax, edx"], [106, "and eax, 3Fh"], [107, "sub eax, edx"], [108, "mov edx, 1"], [109, "mov ecx, eax"], [110, "shl rdx, cl"], [111, "mov rax, rdx"], [112, "and rax, rsi"], [113, "test rax, rax"], [114, "jz short loc_401ADC"], [115, "mov eax, [rbp+var_8]"], [116, "mov [rbp+var_C], eax"], [117, "jmp short loc_401AEB"], [118, "add [rbp+var_8], 1"], [119, "mov eax, [rbp+var_8]"], [120, "cmp eax, [rbp+var_AC]"], [121, "jl short loc_401A6D"], [122, "cmp [rbp+var_C], 0FFFFFFFFh"], [123, "jz short loc_401B4C"], [124, "mov [rbp+var_8], 0"], [125, "jmp short loc_401B26"], [126, "mov eax, [rbp+var_C]"], [127, "cmp eax, [rbp+var_8]"], [128, "jz short loc_401B22"], [129, "mov eax, [rbp+var_8]"], [130, "cdqe"], [131, "lea rdx, ds:0[rax*4]"], [132, "mov rax, [rbp+var_A8]"], [133, "add rax, rdx"], [134, "mov eax, [rax]"], [135, "mov edi, eax"], [136, "call _close"], [137, "add [rbp+var_8], 1"], [138, "mov eax, [rbp+var_8]"], [139, "cmp eax, [rbp+var_AC]"], [140, "jl short loc_401AFA"], [141, "mov eax, [rbp+var_C]"], [142, "cdqe"], [143, "lea rdx, ds:0[rax*4]"], [144, "mov rax, [rbp+var_A8]"], [145, "add rax, rdx"], [146, "mov eax, [rax]"], [147, "jmp short locret_401B51"], [148, "mov eax, 0FFFFFFFFh"], [149, "leave"], [150, "retn"]], "data_dep": [[10, 9], [13, 10], [14, 8], [15, 14], [16, 13], [19, 66], [19, 17], [21, 61], [21, 14], [21, 53], [22, 3], [23, 22], [23, 21], [24, 23], [25, 24], [25, 21], [26, 24], [27, 26], [27, 25], [28, 27], [29, 28], [30, 29], [31, 30], [31, 50], [32, 66], [32, 17], [34, 25], [35, 3], [36, 34], [36, 35], [37, 36], [39, 34], [40, 37], [40, 39], [41, 40], [42, 39], [42, 41], [44, 42], [45, 43], [45, 44], [46, 45], [47, 31], [47, 46], [48, 47], [49, 29], [50, 49], [50, 48], [51, 66], [51, 17], [53, 48], [54, 3], [55, 54], [55, 53], [56, 55], [57, 6], [57, 56], [57, 65], [58, 57], [59, 66], [59, 17], [61, 53], [62, 3], [63, 61], [63, 62], [64, 63], [65, 64], [66, 66], [66, 17], [67, 17], [67, 66], [68, 4], [68, 67], [69, 68], [70, 6], [70, 65], [71, 47], [71, 10], [71, 70], [72, 5], [73, 70], [74, 72], [77, 73], [79, 78], [81, 79], [82, 81], [85, 118], [85, 83], [87, 110], [87, 76], [88, 3], [89, 88], [89, 87], [90, 89], [91, 90], [91, 87], [92, 90], [93, 92], [93, 91], [94, 93], [96, 94], [96, 50], [97, 83], [97, 118], [99, 91], [100, 3], [101, 99], [101, 100], [102, 101], [104, 99], [105, 102], [105, 104], [106, 105], [107, 104], [107, 106], [109, 107], [110, 109], [110, 108], [111, 110], [112, 111], [112, 96], [113, 112], [114, 113], [115, 118], [115, 83], [116, 115], [118, 83], [118, 118], [119, 118], [119, 83], [120, 119], [120, 4], [121, 120], [122, 80], [122, 116], [123, 122], [126, 80], [126, 116], [127, 124], [127, 126], [127, 137], [128, 127], [129, 137], [129, 124], [131, 131], [131, 76], [131, 110], [132, 3], [133, 132], [133, 131], [134, 133], [135, 134], [137, 124], [137, 137], [138, 137], [138, 124], [139, 4], [139, 138], [140, 139], [141, 80], [141, 116], [143, 110], [143, 131], [143, 76], [144, 3], [145, 144], [145, 143], [146, 145], [150, 148], [150, 146]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/c07b801f4c22cba9eb2c590b289cb646007790d4994bcedc7f2700fb67eb3721_c07b801f4c22cba9eb2c590b289cb646007790d4994bcedc7f2700fb67eb3721.jsonl.gz", "strip_func_name": "sub_401913", "query": "\n\n\n__int64 __fastcall sub_401913(__int64 a1, int a2, struct timeval *a3)\n{\nint v3; // esi\n__int64 v4; // kr00_8\n__int64 v5; // kr08_8\nfd_set readfds; // [rsp+20h] [rbp-A0h] BYREF\n__int64 v9; // [rsp+A0h] [rbp-20h] BYREF\nint v10; // [rsp+A8h] [rbp-18h]\nunsigned int v11; // [rsp+ACh] [rbp-14h]\nint v12; // [rsp+B0h] [rbp-10h]\nint v13; // [rsp+B4h] [rbp-Ch]\nint i; // [rsp+B8h] [rbp-8h]\nint v15; // [rsp+BCh] [rbp-4h]\n\nv15 = 0;\nmemset(&readfds, 0, sizeof(readfds));\nv12 = 0;\nv11 = (unsigned int)&v9;\nfor ( i = 0; i < a2; ++i )\n{\nv3 = *(_DWORD *)(4LL * i + a1) / 64;\nv4 = *(int *)(4LL * i + a1);\nreadfds.fds_bits[v3] |= 1LL << ((((HIDWORD(v4) >> 26) + v4) & 0x3F) - (HIDWORD(v4) >> 26));\nif ( v15 < *(_DWORD *)(4LL * i + a1) )\nv15 = *(_DWORD *)(4LL * i + a1);\n}\nv10 = select(v15 + 1, &readfds, 0LL, 0LL, a3);\nv13 = -1;\nif ( v10 > 0 )\n{\nfor ( i = 0; i < a2; ++i )\n{\nv5 = *(int *)(4LL * i + a1);\nif ( (readfds.fds_bits[*(_DWORD *)(4LL * i + a1) / 64] & (1LL << ((((HIDWORD(v5) >> 26) + v5) & 0x3F)\n- (HIDWORD(v5) >> 26)))) != 0 )\n{\nv13 = i;\nbreak;\n}\n}\n}\nif ( v13 == -1 )\nreturn 0xFFFFFFFFLL;\nfor ( i = 0; i < a2; ++i )\n{\nif ( v13 != i )\nclose(*(_DWORD *)(4LL * i + a1));\n}\nreturn *(unsigned int *)(4LL * v13 + a1);\n}\n\n\n\nQ:[a3,a1,a2,readfds,v11,v12,v13,v15,sub_401913,]", "hints": "[]", "response": "{'a3': 'timeout', 'a1': 'socks', 'a2': 'sock_num', 'readfds': 'fds', 'v11': '__d1', 'v12': '__d0', 'v13': 'index', 'v15': 'max_fd', 'sub_401913': 'wait_for_peer'}"} | [
[
0.8675127625465393,
0.8364257216453552,
0.8085562586784363,
0.7938538193702698,
0.7815291881561279,
0.7438061237335205,
0.7300469875335693,
0.7250066995620728,
0.7200819849967957,
0.7121471166610718,
0.7081298828125,
0.7070616483688354,
0.7062727212905884,
0.7023341059684753,
0.6983301043510437,
0.6943182349205017,
0.6942285299301147,
0.6918002963066101,
0.6907106637954712,
0.6883132457733154
],
[
154192,
71473,
141154,
236439,
87609,
148068,
108675,
57773,
170285,
129022,
49263,
178041,
145895,
249798,
228800,
175087,
94289,
136153,
189014,
46851
]
] |
|
m_exp | 7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807 | arendst | Tasmota | NA | static int m_exp(bvm *vm)
{
if (be_top(vm) >= 1 && be_isnumber(vm, 1)) {
breal x = be_toreal(vm, 1);
be_pushreal(vm, mathfunc(exp)(x));
} else {
be_pushreal(vm, (breal)0.0);
}
be_return(vm);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_427DA6", "function_addr": 4357542, "binary_name": "7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov rax, [rbp+var_18]"], [5, "mov rdi, rax"], [6, "call be_top"], [7, "test eax, eax"], [8, "jle short loc_427E11"], [9, "mov rax, [rbp+var_18]"], [10, "mov esi, 1"], [11, "mov rdi, rax"], [12, "call be_isnumber"], [13, "test al, al"], [14, "jz short loc_427E11"], [15, "mov rax, [rbp+var_18]"], [16, "mov esi, 1"], [17, "mov rdi, rax"], [18, "call be_toreal"], [19, "movd eax, xmm0"], [20, "mov [rbp+x], eax"], [21, "mov eax, [rbp+x]"], [22, "movd xmm0, eax"], [23, "call _expf"], [24, "movd eax, xmm0"], [25, "mov rdx, [rbp+var_18]"], [26, "movd xmm0, eax"], [27, "mov rdi, rdx"], [28, "call be_pushreal"], [29, "jmp short loc_427E21"], [30, "mov rax, [rbp+var_18]"], [31, "pxor xmm0, xmm0"], [32, "mov rdi, rax"], [33, "call be_pushreal"], [34, "mov rax, [rbp+var_18]"], [35, "mov rdi, rax"], [36, "call be_returnvalue"], [37, "leave"], [38, "retn"]], "data_dep": [[4, 3], [5, 4], [7, 6], [8, 7], [9, 3], [11, 9], [13, 12], [14, 13], [15, 3], [17, 15], [20, 19], [21, 20], [22, 21], [24, 22], [25, 3], [26, 24], [27, 25], [30, 3], [32, 30], [34, 3], [35, 34], [38, 36]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807_7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.jsonl.gz", "strip_func_name": "sub_427DA6", "query": "\n\n\n__int64 __fastcall sub_427DA6(__int64 a1, __m128i a2)\n{\n__m128i v2; // xmm0\n\nif ( (int)be_top(a1) > 0 && be_isnumber(a1, 1u) )\n{\na2.m128i_u64[0] = (unsigned __int64)be_toreal(a1, 1u);\nv2 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(a2));\n*(float *)v2.m128i_i32 = expf(*(float *)v2.m128i_i32);\nbe_pushreal(a1, COERCE_FLOAT(_mm_cvtsi128_si32(v2)));\n}\nelse\n{\nbe_pushreal(a1, 0.0);\n}\nreturn be_returnvalue(a1);\n}\n\n\n\nQ:[a1,sub_427DA6,]", "hints": "[]", "response": "{'a1': 'vm', 'sub_427DA6': 'm_exp'}"} | [
[
0.7535898685455322,
0.7451308369636536,
0.7404457330703735,
0.7400349378585815,
0.7382684946060181,
0.7378913760185242,
0.7377275824546814,
0.736804723739624,
0.7363510131835938,
0.7356937527656555,
0.7339704632759094,
0.7326108813285828,
0.7323963642120361,
0.7301305532455444,
0.7296918034553528,
0.7296028137207031,
0.7274366021156311,
0.7271922826766968,
0.7264435291290283,
0.7251923084259033
],
[
243776,
29063,
47277,
259240,
119522,
233921,
188973,
258100,
127430,
247074,
215476,
104708,
137038,
123404,
21993,
7804,
171576,
77905,
241351,
14015
]
] |
|
cmp_msg | f14f03e2ad91a86fde479b7e3453c83ebb1d8af9cf080462d99e6025027308e2 | asterisk | pjproject-archive | NA | static int cmp_msg(const pj_stun_msg *msg1, const pj_stun_msg *msg2)
{
unsigned i;
if (msg1->hdr.type != msg2->hdr.type)
return -10;
if (msg1->hdr.length != msg2->hdr.length)
return -20;
if (msg1->hdr.magic != msg2->hdr.magic)
return -30;
if (pj_memcmp(msg1->hdr.tsx_id, msg2->hdr.tsx_id, sizeof(msg1->hdr.tsx_id)))
return -40;
if (msg1->attr_count != msg2->attr_count)
return -50;
for (i=0; i<msg1->attr_count; ++i) {
const pj_stun_attr_hdr *a1 = msg1->attr[i];
const pj_stun_attr_hdr *a2 = msg2->attr[i];
if (a1->type != a2->type)
return -60;
if (a1->length != a2->length)
return -70;
}
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40AEA1", "function_addr": 4239009, "binary_name": "f14f03e2ad91a86fde479b7e3453c83ebb1d8af9cf080462d99e6025027308e2.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_28], rdi"], [4, "mov [rbp+var_30], rsi"], [5, "mov rax, [rbp+var_28]"], [6, "movzx edx, word ptr [rax]"], [7, "mov rax, [rbp+var_30]"], [8, "movzx eax, word ptr [rax]"], [9, "cmp dx, ax"], [10, "jz short loc_40AECE"], [11, "mov eax, 0FFFFFFF6h"], [12, "jmp locret_40AFCC"], [13, "mov rax, [rbp+var_28]"], [14, "movzx edx, word ptr [rax+2]"], [15, "mov rax, [rbp+var_30]"], [16, "movzx eax, word ptr [rax+2]"], [17, "cmp dx, ax"], [18, "jz short loc_40AEED"], [19, "mov eax, 0FFFFFFECh"], [20, "jmp locret_40AFCC"], [21, "mov rax, [rbp+var_28]"], [22, "mov edx, [rax+4]"], [23, "mov rax, [rbp+var_30]"], [24, "mov eax, [rax+4]"], [25, "cmp edx, eax"], [26, "jz short loc_40AF09"], [27, "mov eax, 0FFFFFFE2h"], [28, "jmp locret_40AFCC"], [29, "mov rax, [rbp+var_30]"], [30, "lea rcx, [rax+8]"], [31, "mov rax, [rbp+var_28]"], [32, "add rax, 8"], [33, "mov edx, 0Ch"], [34, "mov rsi, rcx"], [35, "mov rdi, rax"], [36, "call sub_409C1A"], [37, "test eax, eax"], [38, "jz short loc_40AF37"], [39, "mov eax, 0FFFFFFD8h"], [40, "jmp locret_40AFCC"], [41, "mov rax, [rbp+var_28]"], [42, "mov edx, [rax+14h]"], [43, "mov rax, [rbp+var_30]"], [44, "mov eax, [rax+14h]"], [45, "cmp edx, eax"], [46, "jz short loc_40AF50"], [47, "mov eax, 0FFFFFFCEh"], [48, "jmp short locret_40AFCC"], [49, "mov [rbp+var_4], 0"], [50, "jmp short loc_40AFBB"], [51, "mov rax, [rbp+var_28]"], [52, "mov edx, [rbp+var_4]"], [53, "add rdx, 2"], [54, "mov rax, [rax+rdx*8+8]"], [55, "mov [rbp+var_10], rax"], [56, "mov rax, [rbp+var_30]"], [57, "mov edx, [rbp+var_4]"], [58, "add rdx, 2"], [59, "mov rax, [rax+rdx*8+8]"], [60, "mov [rbp+var_18], rax"], [61, "mov rax, [rbp+var_10]"], [62, "movzx edx, word ptr [rax]"], [63, "mov rax, [rbp+var_18]"], [64, "movzx eax, word ptr [rax]"], [65, "cmp dx, ax"], [66, "jz short loc_40AF9B"], [67, "mov eax, 0FFFFFFC4h"], [68, "jmp short locret_40AFCC"], [69, "mov rax, [rbp+var_10]"], [70, "movzx edx, word ptr [rax+2]"], [71, "mov rax, [rbp+var_18]"], [72, "movzx eax, word ptr [rax+2]"], [73, "cmp dx, ax"], [74, "jz short loc_40AFB7"], [75, "mov eax, 0FFFFFFBAh"], [76, "jmp short locret_40AFCC"], [77, "add [rbp+var_4], 1"], [78, "mov rax, [rbp+var_28]"], [79, "mov eax, [rax+14h]"], [80, "cmp [rbp+var_4], eax"], [81, "jb short loc_40AF59"], [82, "mov eax, 0"], [83, "leave"], [84, "retn"]], "data_dep": [[5, 3], [6, 5], [7, 4], [8, 7], [9, 8], [9, 6], [10, 9], [13, 3], [14, 13], [15, 4], [16, 15], [17, 14], [17, 16], [18, 17], [21, 3], [22, 21], [23, 4], [24, 23], [25, 22], [25, 24], [26, 25], [29, 4], [30, 29], [31, 3], [32, 31], [34, 30], [35, 32], [37, 36], [38, 37], [41, 3], [42, 41], [43, 4], [44, 43], [45, 42], [45, 44], [46, 45], [51, 3], [52, 49], [52, 77], [53, 52], [54, 51], [55, 54], [56, 4], [57, 77], [57, 49], [58, 57], [59, 56], [60, 59], [61, 55], [62, 61], [63, 60], [64, 63], [65, 62], [65, 64], [66, 65], [69, 55], [70, 69], [71, 60], [72, 71], [73, 70], [73, 72], [74, 73], [77, 77], [77, 49], [78, 3], [79, 78], [80, 49], [80, 77], [80, 79], [81, 80], [84, 75], [84, 47], [84, 19], [84, 67], [84, 39], [84, 82], [84, 27], [84, 11]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/f14f03e2ad91a86fde479b7e3453c83ebb1d8af9cf080462d99e6025027308e2_f14f03e2ad91a86fde479b7e3453c83ebb1d8af9cf080462d99e6025027308e2.jsonl.gz", "strip_func_name": "sub_40AEA1", "query": "\n\n\n__int64 __fastcall sub_40AEA1(__int64 a1, __int64 a2)\n{\n_WORD *v3; // [rsp+18h] [rbp-18h]\n_WORD *v4; // [rsp+20h] [rbp-10h]\nunsigned int i; // [rsp+2Ch] [rbp-4h]\n\nif ( *(_WORD *)a1 != *(_WORD *)a2 )\nreturn 4294967286LL;\nif ( *(_WORD *)(a1 + 2) != *(_WORD *)(a2 + 2) )\nreturn 4294967276LL;\nif ( *(_DWORD *)(a1 + 4) != *(_DWORD *)(a2 + 4) )\nreturn 4294967266LL;\nif ( sub_409C1A((const void *)(a1 + 8), (const void *)(a2 + 8), 0xCuLL) )\nreturn 4294967256LL;\nif ( *(_DWORD *)(a1 + 20) != *(_DWORD *)(a2 + 20) )\nreturn 4294967246LL;\nfor ( i = 0; i < *(_DWORD *)(a1 + 20); ++i )\n{\nv4 = *(_WORD **)(a1 + 8 * (i + 2LL) + 8);\nv3 = *(_WORD **)(a2 + 8 * (i + 2LL) + 8);\nif ( *v4 != *v3 )\nreturn 4294967236LL;\nif ( v4[1] != v3[1] )\nreturn 4294967226LL;\n}\nreturn 0LL;\n}\n\n\n\nQ:[a1,a2,sub_40AEA1,sub_409C1A,]", "hints": "[]", "response": "{'a1': 'msg1', 'a2': 'msg2', 'sub_40AEA1': 'cmp_msg', 'sub_409C1A': 'pj_memcmp'}"} | [
[
0.7777568101882935,
0.7666628956794739,
0.7385159134864807,
0.711692214012146,
0.6981884241104126,
0.695960521697998,
0.6909903287887573,
0.6890398263931274,
0.681583821773529,
0.6694899797439575,
0.6657131910324097,
0.6636478900909424,
0.6596877574920654,
0.6596100330352783,
0.6586281061172485,
0.6578419208526611,
0.6538377404212952,
0.6537065505981445,
0.6516042947769165,
0.650474488735199
],
[
74551,
242536,
221470,
218687,
11808,
132655,
215720,
229200,
76296,
193471,
129731,
260939,
34506,
19865,
230978,
42649,
54799,
147508,
55681,
163425
]
] |
|
print_dist | 59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd | microsoft | dsb | NA | void
print_dist(d_idx_t * t)
{
int j, k;
printf("\tname: %s[length: %d] --> (v_width: %d, w_width: %d)\n",
t->name,
t->length,
t->v_width,
t->w_width);
if (t->name_space)
printf(" names_space: %d\n", t->name_space);
printf("\t[dist] strings: %s, size %d\n",
t->dist->strings, t->dist->size);
// Print the information of each weight set.
// Print the information of each weight set.
for (j = 0; j < t->w_width; ++j) {
// maximum seems to be NULL.
if (t->length < 5) {
printf("\t[dist] weight set %d, weights: [", j);
for (k = 0; k < t->length; ++k) {
printf(",%d", t->dist->weight_sets[j][k]);
}
printf("]\n");
}
else {
printf("\t[dist] weight set %d, last weight %d\n",
j, t->dist->weight_sets[j][t->length - 1]);
}
}
printf("\n");
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_405E50", "function_addr": 4218448, "binary_name": "59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov rax, [rbp+var_18]"], [5, "mov esi, [rax+34h]"], [6, "mov rax, [rbp+var_18]"], [7, "mov ecx, [rax+38h]"], [8, "mov rax, [rbp+var_18]"], [9, "mov edx, [rax+30h]"], [10, "mov rax, [rbp+var_18]"], [11, "mov r8d, esi"], [12, "mov rsi, rax"], [13, "mov edi, offset aNameSLengthDVW"], [14, "mov eax, 0"], [15, "call _printf"], [16, "mov rax, [rbp+var_18]"], [17, "mov eax, [rax+2Ch]"], [18, "test eax, eax"], [19, "jz short loc_405EAD"], [20, "mov rax, [rbp+var_18]"], [21, "mov eax, [rax+2Ch]"], [22, "mov esi, eax"], [23, "mov edi, offset aNamesSpaceD"], [24, "mov eax, 0"], [25, "call _printf"], [26, "mov rax, [rbp+var_18]"], [27, "mov rax, [rax+40h]"], [28, "mov edx, [rax+30h]"], [29, "mov rax, [rbp+var_18]"], [30, "mov rax, [rax+40h]"], [31, "mov rax, [rax+20h]"], [32, "mov rsi, rax"], [33, "mov edi, offset aDistStringsSSi"], [34, "mov eax, 0"], [35, "call _printf"], [36, "mov [rbp+var_4], 0"], [37, "jmp loc_405FAA"], [38, "mov rax, [rbp+var_18]"], [39, "mov eax, [rax+30h]"], [40, "cmp eax, 4"], [41, "jg short loc_405F61"], [42, "mov eax, [rbp+var_4]"], [43, "mov esi, eax"], [44, "mov edi, offset aDistWeightSetD"], [45, "mov eax, 0"], [46, "call _printf"], [47, "mov [rbp+var_8], 0"], [48, "jmp short loc_405F49"], [49, "mov rax, [rbp+var_18]"], [50, "mov rax, [rax+40h]"], [51, "mov rdx, [rax+8]"], [52, "mov eax, [rbp+var_4]"], [53, "cdqe"], [54, "shl rax, 3"], [55, "add rax, rdx"], [56, "mov rdx, [rax]"], [57, "mov eax, [rbp+var_8]"], [58, "cdqe"], [59, "shl rax, 2"], [60, "add rax, rdx"], [61, "mov eax, [rax]"], [62, "mov esi, eax"], [63, "mov edi, offset aD"], [64, "mov eax, 0"], [65, "call _printf"], [66, "add [rbp+var_8], 1"], [67, "mov rax, [rbp+var_18]"], [68, "mov eax, [rax+30h]"], [69, "cmp [rbp+var_8], eax"], [70, "jl short loc_405F0B"], [71, "mov edi, offset asc_40C946"], [72, "call _puts"], [73, "jmp short loc_405FA6"], [74, "mov rax, [rbp+var_18]"], [75, "mov rax, [rax+40h]"], [76, "mov rdx, [rax+8]"], [77, "mov eax, [rbp+var_4]"], [78, "cdqe"], [79, "shl rax, 3"], [80, "add rax, rdx"], [81, "mov rdx, [rax]"], [82, "mov rax, [rbp+var_18]"], [83, "mov eax, [rax+30h]"], [84, "cdqe"], [85, "shl rax, 2"], [86, "sub rax, 4"], [87, "add rax, rdx"], [88, "mov edx, [rax]"], [89, "mov eax, [rbp+var_4]"], [90, "mov esi, eax"], [91, "mov edi, offset aDistWeightSetD_0"], [92, "mov eax, 0"], [93, "call _printf"], [94, "add [rbp+var_4], 1"], [95, "mov rax, [rbp+var_18]"], [96, "mov eax, [rax+34h]"], [97, "cmp [rbp+var_4], eax"], [98, "jl loc_405EE2"], [99, "mov edi, 0Ah"], [100, "call _putchar"], [101, "nop"], [102, "leave"], [103, "retn"]], "data_dep": [[4, 3], [5, 4], [6, 3], [7, 6], [8, 3], [9, 8], [10, 3], [11, 5], [12, 10], [16, 3], [17, 16], [18, 17], [19, 18], [20, 3], [21, 20], [22, 21], [26, 3], [27, 26], [28, 27], [29, 3], [30, 29], [31, 30], [32, 31], [38, 3], [39, 38], [40, 39], [41, 40], [42, 36], [42, 94], [43, 42], [49, 3], [50, 49], [51, 50], [52, 94], [52, 36], [54, 52], [55, 54], [55, 51], [56, 55], [57, 66], [57, 47], [59, 57], [60, 59], [60, 56], [61, 60], [62, 61], [66, 66], [66, 47], [67, 3], [68, 67], [69, 66], [69, 68], [69, 47], [70, 69], [74, 3], [75, 74], [76, 75], [77, 94], [77, 36], [79, 77], [80, 76], [80, 79], [81, 80], [82, 3], [83, 82], [85, 83], [86, 85], [87, 86], [87, 81], [88, 87], [89, 36], [89, 94], [90, 89], [94, 94], [94, 36], [95, 3], [96, 95], [97, 94], [97, 96], [97, 36], [98, 97], [103, 100]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd_59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd.jsonl.gz", "strip_func_name": "sub_405E50", "query": "\n\n\nint __fastcall sub_405E50(__int64 a1)\n{\nint j; // [rsp+18h] [rbp-8h]\nunsigned int i; // [rsp+1Ch] [rbp-4h]\n\nprintf(\n\"\\tname: %s[length: %d] --> (v_width: %d, w_width: %d)\\n\",\n(const char *)a1,\n*(unsigned int *)(a1 + 48),\n*(unsigned int *)(a1 + 56),\n*(unsigned int *)(a1 + 52));\nif ( *(_DWORD *)(a1 + 44) )\nprintf(\" names_space: %d\\n\", *(unsigned int *)(a1 + 44));\nprintf(\n\"\\t[dist] strings: %s, size %d\\n\",\n*(const char **)(*(_QWORD *)(a1 + 64) + 32LL),\n*(unsigned int *)(*(_QWORD *)(a1 + 64) + 48LL));\nfor ( i = 0; (signed int)i < *(_DWORD *)(a1 + 52); ++i )\n{\nif ( *(int *)(a1 + 48) > 4 )\n{\nprintf(\n\"\\t[dist] weight set %d, last weight %d\\n\",\ni,\n*(unsigned int *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 64) + 8LL) + 8LL * (int)i)\n+ 4LL * *(int *)(a1 + 48)\n- 4));\n}\nelse\n{\nprintf(\"\\t[dist] weight set %d, weights: [\", i);\nfor ( j = 0; j < *(_DWORD *)(a1 + 48); ++j )\nprintf(\",%d\", *(unsigned int *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 64) + 8LL) + 8LL * (int)i) + 4LL * j));\nputs(\"]\");\n}\n}\nreturn putchar(10);\n}\n\n\n\nQ:[a1,sub_405E50,]", "hints": "[]", "response": "{'a1': 't', 'sub_405E50': 'print_dist'}"} | [
[
0.8164656162261963,
0.8100037574768066,
0.8033389449119568,
0.7992013692855835,
0.7983818054199219,
0.7982567548751831,
0.7923206090927124,
0.791237473487854,
0.7881747484207153,
0.785110592842102,
0.7821917533874512,
0.7758544087409973,
0.7752071619033813,
0.7745724320411682,
0.7585448026657104,
0.7499955296516418,
0.7491602301597595,
0.7491241097450256,
0.7481610774993896,
0.7448607683181763
],
[
218964,
9636,
253541,
158136,
64907,
142331,
261581,
63645,
227476,
123026,
113607,
213588,
113447,
163887,
58556,
63592,
216876,
137189,
237690,
200068
]
] |
|
htu21d_info | 1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0 | hepingood | htu21d | NA | uint8_t htu21d_info(htu21d_info_t *info)
{
if (info == NULL) /* check handle */
{
return 2; /* return error */
}
memset(info, 0, sizeof(htu21d_info_t)); /* initialize htu21d info structure */
strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
strncpy(info->interface, "IIC", 8); /* copy interface name */
info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
info->max_current_ma = MAX_CURRENT; /* set maximum current */
info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
info->driver_version = DRIVER_VERSION; /* set driver version */
return 0; /* success return 0 */
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402B8E", "function_addr": 4205454, "binary_name": "1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 10h"], [3, "mov [rbp+s], rdi"], [4, "cmp [rbp+s], 0"], [5, "jnz short loc_402BAB"], [6, "mov eax, 2"], [7, "jmp locret_402C70"], [8, "mov rax, [rbp+s]"], [9, "mov edx, 60h "], [10, "mov esi, 0"], [11, "mov rdi, rax"], [12, "call _memset"], [13, "mov rax, [rbp+s]"], [14, "mov edx, 20h "], [15, "mov esi, offset src"], [16, "mov rdi, rax"], [17, "call _strncpy"], [18, "mov rax, [rbp+s]"], [19, "add rax, 20h "], [20, "mov edx, 20h "], [21, "mov esi, offset aTe"], [22, "mov rdi, rax"], [23, "call _strncpy"], [24, "mov rax, [rbp+s]"], [25, "add rax, 40h "], [26, "mov edx, 8"], [27, "mov esi, offset aIic"], [28, "mov rdi, rax"], [29, "call _strncpy"], [30, "mov rax, [rbp+s]"], [31, "movss xmm0, cs:dword_406260"], [32, "movss dword ptr [rax+48h], xmm0"], [33, "mov rax, [rbp+s]"], [34, "movss xmm0, cs:dword_406264"], [35, "movss dword ptr [rax+4Ch], xmm0"], [36, "mov rax, [rbp+s]"], [37, "movss xmm0, cs:dword_406268"], [38, "movss dword ptr [rax+50h], xmm0"], [39, "mov rax, [rbp+s]"], [40, "movss xmm0, cs:dword_406258"], [41, "movss dword ptr [rax+58h], xmm0"], [42, "mov rax, [rbp+s]"], [43, "movss xmm0, cs:dword_40626C"], [44, "movss dword ptr [rax+54h], xmm0"], [45, "mov rax, [rbp+s]"], [46, "mov dword ptr [rax+5Ch], 3E8h"], [47, "mov eax, 0"], [48, "leave"], [49, "retn"]], "data_dep": [[4, 3], [5, 4], [8, 3], [11, 8], [13, 3], [16, 13], [18, 3], [19, 18], [22, 19], [24, 3], [25, 24], [28, 25], [30, 3], [32, 31], [32, 30], [33, 3], [35, 33], [35, 34], [36, 3], [38, 37], [38, 36], [39, 3], [41, 40], [41, 39], [42, 3], [44, 42], [44, 43], [45, 3], [46, 45], [49, 47], [49, 6]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0_1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0.jsonl.gz", "strip_func_name": "sub_402B8E", "query": "\n\n\n__int64 __fastcall sub_402B8E(__int64 a1)\n{\nif ( !a1 )\nreturn 2LL;\nmemset((void *)a1, 0, 0x60uLL);\nstrncpy((char *)a1, \"TE HTU21D\", 0x20uLL);\nstrncpy((char *)(a1 + 32), \"TE\", 0x20uLL);\nstrncpy((char *)(a1 + 64), \"IIC\", 8uLL);\n*(_DWORD *)(a1 + 72) = 1069547520;\n*(_DWORD *)(a1 + 76) = 1080452710;\n*(_DWORD *)(a1 + 80) = 1056964608;\n*(_DWORD *)(a1 + 88) = 1123680256;\n*(_DWORD *)(a1 + 84) = -1038090240;\n*(_DWORD *)(a1 + 92) = 1000;\nreturn 0LL;\n}\n\n\n\nQ:[a1,sub_402B8E,]", "hints": "[]", "response": "{'a1': 'info', 'sub_402B8E': 'htu21d_info'}"} | [
[
0.8996396064758301,
0.8980282545089722,
0.8968982696533203,
0.8967269659042358,
0.8966897130012512,
0.8966528177261353,
0.8964791297912598,
0.8962370157241821,
0.8959030508995056,
0.8957128524780273,
0.8957102298736572,
0.8956246376037598,
0.895530104637146,
0.8953444957733154,
0.8946839570999146,
0.7841209769248962,
0.7816140651702881,
0.7593516111373901,
0.7590174674987793,
0.7588682770729065
],
[
192211,
97583,
261057,
43840,
204068,
182185,
99757,
258780,
128084,
109159,
59272,
84212,
131754,
230322,
40024,
235706,
3272,
106636,
83641,
25571
]
] |
|
htu21d_init | 1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0 | hepingood | htu21d | NA | uint8_t htu21d_init(htu21d_handle_t *handle)
{
uint8_t res;
uint8_t prev;
if (handle == NULL) /* check handle */
{
return 2; /* return error */
}
if (handle->debug_print == NULL) /* check debug_print */
{
return 3; /* return error */
}
if (handle->iic_init == NULL) /* check iic_init */
{
handle->debug_print("htu21d: iic_init is null.\n"); /* iic_init is null */
return 3; /* return error */
}
if (handle->iic_deinit == NULL) /* check iic_deinit */
{
handle->debug_print("htu21d: iic_deinit is null.\n"); /* iic_deinit is null */
return 3; /* return error */
}
if (handle->iic_read == NULL) /* check iic_read */
{
handle->debug_print("htu21d: iic_read is null.\n"); /* iic_read is null */
return 3; /* return error */
}
if (handle->iic_read_cmd == NULL) /* check iic_read_cmd */
{
handle->debug_print("htu21d: iic_read_cmd is null.\n"); /* iic_read_cmd is null */
return 3; /* return error */
}
if (handle->iic_read_with_scl == NULL) /* check iic_read_with_scl */
{
handle->debug_print("htu21d: iic_read_with_scl is null.\n"); /* iic_read_with_scl is null */
return 3; /* return error */
}
if (handle->iic_write == NULL) /* check iic_write */
{
handle->debug_print("htu21d: iic_write is null.\n"); /* iic_write is null */
return 3; /* return error */
}
if (handle->iic_write_cmd == NULL) /* check iic_write_cmd */
{
handle->debug_print("htu21d: iic_write_cmd is null.\n"); /* iic_write_cmd is null */
return 3; /* return error */
}
if (handle->delay_ms == NULL) /* check delay_ms */
{
handle->debug_print("htu21d: delay_ms is null.\n"); /* delay_ms is null */
return 3; /* return error */
}
if (handle->iic_init() != 0) /* iic init */
{
handle->debug_print("htu21d: iic init failed.\n"); /* iic init failed */
return 1; /* return error */
}
res = a_htu21d_write(handle, HTU21D_COMMAND_SOFT_RESET, NULL, 0); /* soft reset */
if (res != 0) /* check the result */
{
handle->debug_print("htu21d: soft reset failed.\n"); /* soft reset failed */
(void)handle->iic_deinit(); /* iic deinit */
return 4; /* return error */
}
handle->delay_ms(15); /* delay 15 ms */
res = a_htu21d_read(handle, HUT21D_MODE_NO_HOLD_MASTER,
HTU21D_COMMAND_READ_USER_REGISTER, &prev, 1); /* read config */
if (res != 0) /* check the result */
{
handle->debug_print("htu21d: read config failed.\n"); /* read config failed */
(void)handle->iic_deinit(); /* iic deinit */
return 5; /* return error */
}
handle->resolution = (htu21d_resolution_t)((((prev >> 7) & 0x01) << 1)
| (((prev >> 0) & 0x01) << 0)); /* save the resolution */
handle->mode = HUT21D_MODE_NO_HOLD_MASTER; /* set no hold master */
handle->inited = 1; /* flag finish initialization */
return 0; /* success return 0 */
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402799", "function_addr": 4204441, "binary_name": "1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "cmp [rbp+var_18], 0"], [5, "jnz short loc_4027B6"], [6, "mov eax, 2"], [7, "jmp locret_402A33"], [8, "mov rax, [rbp+var_18]"], [9, "mov rax, [rax+40h]"], [10, "test rax, rax"], [11, "jnz short loc_4027CD"], [12, "mov eax, 3"], [13, "jmp locret_402A33"], [14, "mov rax, [rbp+var_18]"], [15, "mov rax, [rax]"], [16, "test rax, rax"], [17, "jnz short loc_4027F7"], [18, "mov rax, [rbp+var_18]"], [19, "mov rdx, [rax+40h]"], [20, "mov edi, offset aHtu21dIicInitI"], [21, "mov eax, 0"], [22, "call rdx"], [23, "mov eax, 3"], [24, "jmp locret_402A33"], [25, "mov rax, [rbp+var_18]"], [26, "mov rax, [rax+8]"], [27, "test rax, rax"], [28, "jnz short loc_402822"], [29, "mov rax, [rbp+var_18]"], [30, "mov rdx, [rax+40h]"], [31, "mov edi, offset aHtu21dIicDeini"], [32, "mov eax, 0"], [33, "call rdx"], [34, "mov eax, 3"], [35, "jmp locret_402A33"], [36, "mov rax, [rbp+var_18]"], [37, "mov rax, [rax+28h]"], [38, "test rax, rax"], [39, "jnz short loc_40284D"], [40, "mov rax, [rbp+var_18]"], [41, "mov rdx, [rax+40h]"], [42, "mov edi, offset aHtu21dIicReadI"], [43, "mov eax, 0"], [44, "call rdx"], [45, "mov eax, 3"], [46, "jmp locret_402A33"], [47, "mov rax, [rbp+var_18]"], [48, "mov rax, [rax+18h]"], [49, "test rax, rax"], [50, "jnz short loc_402878"], [51, "mov rax, [rbp+var_18]"], [52, "mov rdx, [rax+40h]"], [53, "mov edi, offset aHtu21dIicReadC"], [54, "mov eax, 0"], [55, "call rdx"], [56, "mov eax, 3"], [57, "jmp locret_402A33"], [58, "mov rax, [rbp+var_18]"], [59, "mov rax, [rax+30h]"], [60, "test rax, rax"], [61, "jnz short loc_4028A3"], [62, "mov rax, [rbp+var_18]"], [63, "mov rdx, [rax+40h]"], [64, "mov edi, offset aHtu21dIicReadW"], [65, "mov eax, 0"], [66, "call rdx"], [67, "mov eax, 3"], [68, "jmp locret_402A33"], [69, "mov rax, [rbp+var_18]"], [70, "mov rax, [rax+20h]"], [71, "test rax, rax"], [72, "jnz short loc_4028CE"], [73, "mov rax, [rbp+var_18]"], [74, "mov rdx, [rax+40h]"], [75, "mov edi, offset aHtu21dIicWrite"], [76, "mov eax, 0"], [77, "call rdx"], [78, "mov eax, 3"], [79, "jmp locret_402A33"], [80, "mov rax, [rbp+var_18]"], [81, "mov rax, [rax+10h]"], [82, "test rax, rax"], [83, "jnz short loc_4028F9"], [84, "mov rax, [rbp+var_18]"], [85, "mov rdx, [rax+40h]"], [86, "mov edi, offset aHtu21dIicWrite_0"], [87, "mov eax, 0"], [88, "call rdx"], [89, "mov eax, 3"], [90, "jmp locret_402A33"], [91, "mov rax, [rbp+var_18]"], [92, "mov rax, [rax+38h]"], [93, "test rax, rax"], [94, "jnz short loc_402924"], [95, "mov rax, [rbp+var_18]"], [96, "mov rdx, [rax+40h]"], [97, "mov edi, offset aHtu21dDelayMsI"], [98, "mov eax, 0"], [99, "call rdx"], [100, "mov eax, 3"], [101, "jmp locret_402A33"], [102, "mov rax, [rbp+var_18]"], [103, "mov rax, [rax]"], [104, "call rax"], [105, "test al, al"], [106, "jz short loc_40294F"], [107, "mov rax, [rbp+var_18]"], [108, "mov rdx, [rax+40h]"], [109, "mov edi, offset aHtu21dIicInitF"], [110, "mov eax, 0"], [111, "call rdx"], [112, "mov eax, 1"], [113, "jmp locret_402A33"], [114, "mov rax, [rbp+var_18]"], [115, "mov ecx, 0"], [116, "mov edx, 0"], [117, "mov esi, 0FEh"], [118, "mov rdi, rax"], [119, "call sub_401286"], [120, "mov [rbp+var_1], al"], [121, "cmp [rbp+var_1], 0"], [122, "jz short loc_40299B"], [123, "mov rax, [rbp+var_18]"], [124, "mov rdx, [rax+40h]"], [125, "mov edi, offset aHtu21dSoftRese"], [126, "mov eax, 0"], [127, "call rdx"], [128, "mov rax, [rbp+var_18]"], [129, "mov rax, [rax+8]"], [130, "call rax"], [131, "mov eax, 4"], [132, "jmp locret_402A33"], [133, "mov rax, [rbp+var_18]"], [134, "mov rax, [rax+38h]"], [135, "mov edi, 0Fh"], [136, "call rax"], [137, "lea rdx, [rbp+var_2]"], [138, "mov rax, [rbp+var_18]"], [139, "mov r8d, 1"], [140, "mov rcx, rdx"], [141, "mov edx, 0E7h"], [142, "mov esi, 1"], [143, "mov rdi, rax"], [144, "call sub_4012D1"], [145, "mov [rbp+var_1], al"], [146, "cmp [rbp+var_1], 0"], [147, "jz short loc_4029FB"], [148, "mov rax, [rbp+var_18]"], [149, "mov rdx, [rax+40h]"], [150, "mov edi, offset aHtu21dReadConf"], [151, "mov eax, 0"], [152, "call rdx"], [153, "mov rax, [rbp+var_18]"], [154, "mov rax, [rax+8]"], [155, "call rax"], [156, "mov eax, 5"], [157, "jmp short locret_402A33"], [158, "movzx eax, [rbp+var_2]"], [159, "shr al, 7"], [160, "movzx eax, al"], [161, "add eax, eax"], [162, "and eax, 2"], [163, "mov edx, eax"], [164, "movzx eax, [rbp+var_2]"], [165, "and eax, 1"], [166, "or eax, edx"], [167, "mov edx, eax"], [168, "mov rax, [rbp+var_18]"], [169, "mov [rax+49h], dl"], [170, "mov rax, [rbp+var_18]"], [171, "mov byte ptr [rax+48h], 1"], [172, "mov rax, [rbp+var_18]"], [173, "mov byte ptr [rax+4Ah], 1"], [174, "mov eax, 0"], [175, "leave"], [176, "retn"]], "data_dep": [[4, 3], [5, 4], [8, 3], [9, 8], [10, 9], [11, 10], [14, 3], [15, 14], [16, 15], [17, 16], [18, 3], [19, 18], [22, 19], [25, 3], [26, 25], [27, 26], [28, 27], [29, 3], [30, 29], [33, 30], [36, 3], [37, 36], [38, 37], [39, 38], [40, 3], [41, 40], [44, 41], [47, 3], [48, 47], [49, 48], [50, 49], [51, 3], [52, 51], [55, 52], [58, 3], [59, 58], [60, 59], [61, 60], [62, 3], [63, 62], [66, 63], [69, 3], [70, 69], [71, 70], [72, 71], [73, 3], [74, 73], [77, 74], [80, 3], [81, 80], [82, 81], [83, 82], [84, 3], [85, 84], [88, 85], [91, 3], [92, 91], [93, 92], [94, 93], [95, 3], [96, 95], [99, 96], [102, 3], [103, 102], [104, 103], [105, 104], [106, 105], [107, 3], [108, 107], [111, 108], [114, 3], [118, 114], [120, 119], [121, 120], [122, 121], [123, 3], [124, 123], [127, 124], [128, 3], [129, 128], [130, 129], [133, 3], [134, 133], [136, 134], [137, 116], [138, 3], [140, 137], [143, 138], [145, 144], [146, 145], [147, 146], [148, 3], [149, 148], [152, 149], [153, 3], [154, 153], [155, 154], [159, 158], [160, 159], [161, 160], [162, 161], [163, 162], [165, 164], [166, 165], [166, 163], [167, 166], [168, 3], [169, 167], [169, 168], [170, 3], [171, 170], [172, 3], [173, 172], [176, 112], [176, 78], [176, 23], [176, 89], [176, 34], [176, 100], [176, 6], [176, 45], [176, 56], [176, 67], [176, 12], [176, 131], [176, 156], [176, 174]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0_1a06f9077a2966c5357b2b2d2a32724643173e01b1d4a4bf2abf78fde9f7cea0.jsonl.gz", "strip_func_name": "sub_402799", "query": "\n\n\n__int64 __fastcall sub_402799(__int64 a1)\n{\n__int64 result; // rax\nunsigned __int8 v2; // [rsp+1Eh] [rbp-2h] BYREF\nbool v3; // [rsp+1Fh] [rbp-1h]\n\nif ( !a1 )\nreturn 2LL;\nif ( !*(_QWORD *)(a1 + 64) )\nreturn 3LL;\nif ( *(_QWORD *)a1 )\n{\nif ( *(_QWORD *)(a1 + 8) )\n{\nif ( *(_QWORD *)(a1 + 40) )\n{\nif ( *(_QWORD *)(a1 + 24) )\n{\nif ( *(_QWORD *)(a1 + 48) )\n{\nif ( *(_QWORD *)(a1 + 32) )\n{\nif ( *(_QWORD *)(a1 + 16) )\n{\nif ( *(_QWORD *)(a1 + 56) )\n{\nif ( (*(unsigned __int8 (**)(void))a1)() )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic init failed.\\n\");\nresult = 1LL;\n}\nelse\n{\nv3 = sub_401286(a1, 0xFEu, 0LL, 0);\nif ( v3 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: soft reset failed.\\n\");\n(*(void (**)(void))(a1 + 8))();\nresult = 4LL;\n}\nelse\n{\n(*(void (__fastcall **)(__int64))(a1 + 56))(15LL);\nv3 = sub_4012D1(a1, 1, 0xE7u, (__int64)&v2, 1u);\nif ( v3 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: read config failed.\\n\");\n(*(void (**)(void))(a1 + 8))();\nresult = 5LL;\n}\nelse\n{\n*(_BYTE *)(a1 + 73) = (2 * (v2 >> 7)) & 2 | v2 & 1;\n*(_BYTE *)(a1 + 72) = 1;\n*(_BYTE *)(a1 + 74) = 1;\nresult = 0LL;\n}\n}\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: delay_ms is null.\\n\");\nresult = 3LL;\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic_write_cmd is null.\\n\");\nresult = 3LL;\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic_write is null.\\n\");\nresult = 3LL;\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic_read_with_scl is null.\\n\");\nresult = 3LL;\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic_read_cmd is null.\\n\");\nresult = 3LL;\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic_read is null.\\n\");\nresult = 3LL;\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic_deinit is null.\\n\");\nresult = 3LL;\n}\n}\nelse\n{\n(*(void (__fastcall **)(const char *))(a1 + 64))(\"htu21d: iic_init is null.\\n\");\nresult = 3LL;\n}\nreturn result;\n}\n\n\n\nQ:[a1,v2,v3,sub_402799,sub_401286,sub_4012D1,]", "hints": "[]", "response": "{'a1': 'handle', 'v2': 'prev', 'v3': 'res', 'sub_402799': 'htu21d_init', 'sub_401286': 'a_htu21d_write', 'sub_4012D1': 'a_htu21d_read'}"} | [
[
0.8697372674942017,
0.8694620728492737,
0.8677809238433838,
0.8669183850288391,
0.8658612370491028,
0.8603766560554504,
0.8571090698242188,
0.8521209955215454,
0.8353552222251892,
0.8334488868713379,
0.8317455649375916,
0.8316088318824768,
0.8245322704315186,
0.8236539959907532,
0.8227061033248901,
0.7867921590805054,
0.7760758996009827,
0.756889820098877,
0.7526949644088745,
0.7496981620788574
],
[
35390,
118614,
222045,
199419,
263851,
204485,
223968,
226459,
80808,
41907,
100824,
45390,
211757,
228943,
221928,
226280,
191711,
832,
244835,
261746
]
] |
|
baB64Decode | ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e | RealTimeLogic | BAS | NA | BA_API int
baB64Decode(U8* disableevent, int queryinput, const char* resourcecamera)
{
const char* cp;
int len, phase;
int d, prev_d;
U8 c;
prev_d = len = phase = 0;
for ( cp = resourcecamera; *cp != '\000'; ++cp )
{
d = decompsetup[(int)*cp];
if ( d != -1 )
{
switch ( phase )
{
case 0:
++phase;
break;
case 1:
c = (char)( ( prev_d << 2 ) | ( ( d & 0x30 ) >> 4 ) );
if ( len < queryinput )
disableevent[len++] = c;
++phase;
break;
case 2:
c = (char)( ( ( prev_d & 0xf ) << 4 ) | ( ( d & 0x3c ) >> 2 ) );
if ( len < queryinput )
disableevent[len++] = c;
++phase;
break;
case 3:
c = (char)( ( ( prev_d & 0x03 ) << 6 ) | d );
if ( len < queryinput )
disableevent[len++] = c;
phase = 0;
break;
}
prev_d = d;
}
}
return len;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4180DD", "function_addr": 4292829, "binary_name": "ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_28], rdi"], [3, "mov [rbp+var_2C], esi"], [4, "mov [rbp+var_38], rdx"], [5, "mov [rbp+var_10], 0"], [6, "mov eax, [rbp+var_10]"], [7, "mov [rbp+var_C], eax"], [8, "mov eax, [rbp+var_C]"], [9, "mov [rbp+var_14], eax"], [10, "mov rax, [rbp+var_38]"], [11, "mov [rbp+var_8], rax"], [12, "jmp loc_418228"], [13, "mov rax, [rbp+var_8]"], [14, "movzx eax, byte ptr [rax]"], [15, "movsx eax, al"], [16, "cdqe"], [17, "mov eax, ds:dword_479EE0[rax*4]"], [18, "mov [rbp+var_18], eax"], [19, "cmp [rbp+var_18], 0FFFFFFFFh"], [20, "jz loc_418223"], [21, "cmp [rbp+var_10], 3"], [22, "jz loc_4181E4"], [23, "cmp [rbp+var_10], 3"], [24, "jg loc_41821D"], [25, "cmp [rbp+var_10], 2"], [26, "jz short loc_4181A7"], [27, "cmp [rbp+var_10], 2"], [28, "jg loc_41821D"], [29, "cmp [rbp+var_10], 0"], [30, "jz short loc_418161"], [31, "cmp [rbp+var_10], 1"], [32, "jz short loc_41816A"], [33, "jmp loc_41821D"], [34, "add [rbp+var_10], 1"], [35, "jmp loc_41821D"], [36, "mov eax, [rbp+var_14]"], [37, "shl eax, 2"], [38, "mov edx, eax"], [39, "mov eax, [rbp+var_18]"], [40, "sar eax, 4"], [41, "and eax, 3"], [42, "or eax, edx"], [43, "mov [rbp+var_19], al"], [44, "mov eax, [rbp+var_C]"], [45, "cmp eax, [rbp+var_2C]"], [46, "jge short loc_4181A1"], [47, "mov eax, [rbp+var_C]"], [48, "lea edx, [rax+1]"], [49, "mov [rbp+var_C], edx"], [50, "movsxd rdx, eax"], [51, "mov rax, [rbp+var_28]"], [52, "add rdx, rax"], [53, "movzx eax, [rbp+var_19]"], [54, "mov [rdx], al"], [55, "add [rbp+var_10], 1"], [56, "jmp short loc_41821D"], [57, "mov eax, [rbp+var_14]"], [58, "shl eax, 4"], [59, "mov edx, eax"], [60, "mov eax, [rbp+var_18]"], [61, "sar eax, 2"], [62, "and eax, 0Fh"], [63, "or eax, edx"], [64, "mov [rbp+var_19], al"], [65, "mov eax, [rbp+var_C]"], [66, "cmp eax, [rbp+var_2C]"], [67, "jge short loc_4181DE"], [68, "mov eax, [rbp+var_C]"], [69, "lea edx, [rax+1]"], [70, "mov [rbp+var_C], edx"], [71, "movsxd rdx, eax"], [72, "mov rax, [rbp+var_28]"], [73, "add rdx, rax"], [74, "movzx eax, [rbp+var_19]"], [75, "mov [rdx], al"], [76, "add [rbp+var_10], 1"], [77, "jmp short loc_41821D"], [78, "mov eax, [rbp+var_14]"], [79, "shl eax, 6"], [80, "mov edx, eax"], [81, "mov eax, [rbp+var_18]"], [82, "or eax, edx"], [83, "mov [rbp+var_19], al"], [84, "mov eax, [rbp+var_C]"], [85, "cmp eax, [rbp+var_2C]"], [86, "jge short loc_418215"], [87, "mov eax, [rbp+var_C]"], [88, "lea edx, [rax+1]"], [89, "mov [rbp+var_C], edx"], [90, "movsxd rdx, eax"], [91, "mov rax, [rbp+var_28]"], [92, "add rdx, rax"], [93, "movzx eax, [rbp+var_19]"], [94, "mov [rdx], al"], [95, "mov [rbp+var_10], 0"], [96, "nop"], [97, "mov eax, [rbp+var_18]"], [98, "mov [rbp+var_14], eax"], [99, "add [rbp+var_8], 1"], [100, "mov rax, [rbp+var_8]"], [101, "movzx eax, byte ptr [rax]"], [102, "test al, al"], [103, "jnz loc_41810C"], [104, "mov eax, [rbp+var_C]"], [105, "pop rbp"], [106, "retn"]], "data_dep": [[6, 5], [7, 6], [8, 7], [9, 8], [10, 4], [11, 10], [13, 99], [13, 11], [14, 13], [14, 94], [14, 75], [14, 54], [15, 14], [18, 17], [19, 18], [20, 19], [21, 55], [21, 34], [21, 95], [21, 76], [21, 5], [22, 21], [23, 34], [23, 95], [23, 76], [23, 5], [23, 55], [24, 23], [25, 34], [25, 95], [25, 76], [25, 5], [25, 55], [26, 25], [27, 34], [27, 95], [27, 76], [27, 5], [27, 55], [28, 27], [29, 34], [29, 95], [29, 76], [29, 5], [29, 55], [30, 29], [31, 95], [31, 76], [31, 5], [31, 55], [31, 34], [32, 31], [34, 76], [34, 5], [34, 55], [34, 34], [34, 95], [36, 9], [36, 98], [37, 36], [38, 37], [39, 18], [40, 39], [41, 40], [42, 41], [42, 38], [43, 42], [44, 49], [44, 7], [44, 89], [44, 70], [45, 3], [45, 44], [46, 45], [47, 7], [47, 89], [47, 70], [47, 49], [48, 54], [48, 38], [48, 47], [48, 94], [48, 75], [49, 48], [50, 47], [51, 2], [52, 51], [52, 50], [53, 43], [54, 53], [54, 52], [55, 95], [55, 76], [55, 5], [55, 34], [55, 55], [57, 98], [57, 9], [58, 57], [59, 58], [60, 18], [61, 60], [62, 61], [63, 62], [63, 59], [64, 63], [65, 70], [65, 49], [65, 7], [65, 89], [66, 65], [66, 3], [67, 66], [68, 70], [68, 49], [68, 7], [68, 89], [69, 94], [69, 75], [69, 59], [69, 68], [69, 54], [70, 69], [71, 68], [72, 2], [73, 71], [73, 72], [74, 64], [75, 74], [75, 73], [76, 95], [76, 55], [76, 76], [76, 5], [76, 34], [78, 98], [78, 9], [79, 78], [80, 79], [81, 18], [82, 81], [82, 80], [83, 82], [84, 70], [84, 49], [84, 7], [84, 89], [85, 84], [85, 3], [86, 85], [87, 7], [87, 89], [87, 70], [87, 49], [88, 54], [88, 94], [88, 87], [88, 80], [88, 75], [89, 88], [90, 87], [91, 2], [92, 90], [92, 91], [93, 83], [94, 93], [94, 92], [97, 18], [98, 97], [99, 99], [99, 11], [100, 11], [100, 99], [101, 94], [101, 75], [101, 100], [101, 54], [102, 101], [103, 102], [104, 7], [104, 89], [104, 70], [104, 49], [105, 0], [106, 104]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e_ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e.jsonl.gz", "strip_func_name": "sub_4180DD", "query": "\n\n\n__int64 __fastcall sub_4180DD(__int64 a1, int a2, _BYTE *a3)\n{\nint v3; // eax\nint v4; // eax\nint v5; // eax\nint v7; // [rsp+20h] [rbp-18h]\nchar v8; // [rsp+24h] [rbp-14h]\nint v9; // [rsp+28h] [rbp-10h]\nsigned int v10; // [rsp+2Ch] [rbp-Ch]\n\nv9 = 0;\nv10 = 0;\nv8 = 0;\nwhile ( *a3 )\n{\nv7 = dword_479EE0[(char)*a3];\nif ( v7 != -1 )\n{\nif ( v9 == 3 )\n{\nif ( v10 < a2 )\n{\nv5 = v10++;\n*(_BYTE *)(a1 + v5) = (v8 << 6) | v7;\n}\nv9 = 0;\n}\nelse if ( v9 == 2 )\n{\nif ( v10 < a2 )\n{\nv4 = v10++;\n*(_BYTE *)(a1 + v4) = (16 * v8) | (v7 >> 2) & 0xF;\n}\nv9 = 3;\n}\nelse if ( v9 )\n{\nif ( v10 < a2 )\n{\nv3 = v10++;\n*(_BYTE *)(a1 + v3) = (4 * v8) | (v7 >> 4) & 3;\n}\nv9 = 2;\n}\nelse\n{\nv9 = 1;\n}\nv8 = v7;\n}\n++a3;\n}\nreturn (unsigned int)v10;\n}\n\n\n\nQ:[a3,a1,a2,v7,v8,v9,v10,sub_4180DD,]", "hints": "[]", "response": "{'a3': 'resourcecamera', 'a1': 'disableevent', 'a2': 'queryinput', 'v7': 'd', 'v8': 'prev_d', 'v9': 'phase', 'v10': 'len', 'sub_4180DD': 'baB64Decode'}"} | [
[
0.7176907062530518,
0.713981032371521,
0.7061079740524292,
0.7037911415100098,
0.6977384090423584,
0.687142014503479,
0.6827816367149353,
0.6826792359352112,
0.6817660331726074,
0.6752349138259888,
0.6745495796203613,
0.6726835370063782,
0.6701897382736206,
0.6698402166366577,
0.6664566397666931,
0.6643391847610474,
0.6624259948730469,
0.6621840000152588,
0.6616166830062866,
0.6577339172363281
],
[
257920,
222099,
178155,
176002,
167328,
253583,
154283,
149273,
248644,
90387,
176172,
241353,
263988,
36304,
205928,
155199,
151843,
244023,
206837,
2246
]
] |
|
ina219_set_mode | 12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab | hepingood | ina219 | NA | uint8_t ina219_set_mode(ina219_handle_t *handle, ina219_mode_t mode)
{
uint8_t res;
uint16_t prev;
if (handle == NULL) /* check handle */
{
return 2; /* return error */
}
if (handle->inited != 1) /* check handle initialization */
{
return 3; /* return error */
}
res = a_ina219_iic_read(handle, INA219_REG_CONF, (uint16_t *)&prev); /* read config */
if (res != 0) /* check result */
{
handle->debug_print("ina219: read conf register failed.\n"); /* read conf register failed */
return 1; /* return error */
}
prev &= ~(0x7 << 0); /* clear mode bit */
prev |= mode << 0; /* set mode bit */
res = a_ina219_iic_write(handle, INA219_REG_CONF, (uint16_t )prev); /* write config */
if (res != 0) /* check result */
{
handle->debug_print("ina219: write conf register failed.\n"); /* write conf register failed */
return 1; /* return error */
}
if ((mode >= INA219_MODE_SHUNT_VOLTAGE_TRIGGERED) && /* check mode */
(mode <= INA219_MODE_SHUNT_BUS_VOLTAGE_TRIGGERED))
{
uint8_t m, mode1, mode2, t;
mode1 = (prev >> 3) & 0xF; /* get shunt adc mode */
mode2 = (prev >> 7) & 0xF; /* get bus adc mode */
m = (mode1 > mode2) ? mode1 : mode2; /* get max mode */
if (m <= 8) /* check mode */
{
handle->delay_ms(1); /* delay 1 ms */
}
else
{
t = (uint8_t)(0.532 * pow(2, m - 8)) + 1; /* get time */
handle->delay_ms(t); /* delay time */
}
return 0; /* success return 0 */
}
else
{
return 0; /* success return 0 */
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401913", "function_addr": 4200723, "binary_name": "12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_1C], esi"], [5, "cmp [rbp+var_18], 0"], [6, "jnz short loc_401933"], [7, "mov eax, 2"], [8, "jmp locret_401A8C"], [9, "mov rax, [rbp+var_18]"], [10, "movzx eax, byte ptr [rax+48h]"], [11, "cmp al, 1"], [12, "jz short loc_401949"], [13, "mov eax, 3"], [14, "jmp locret_401A8C"], [15, "lea rdx, [rbp+var_8]"], [16, "mov rax, [rbp+var_18]"], [17, "mov esi, 0"], [18, "mov rdi, rax"], [19, "call sub_401232"], [20, "mov [rbp+var_1], al"], [21, "cmp [rbp+var_1], 0"], [22, "jz short loc_401985"], [23, "mov rax, [rbp+var_18]"], [24, "mov rdx, [rax+30h]"], [25, "mov edi, offset aIna219ReadConf"], [26, "mov eax, 0"], [27, "call rdx"], [28, "mov eax, 1"], [29, "jmp locret_401A8C"], [30, "movzx eax, [rbp+var_8]"], [31, "and eax, 0FFFFFFF8h"], [32, "mov [rbp+var_8], ax"], [33, "mov eax, [rbp+var_1C]"], [34, "mov edx, eax"], [35, "movzx eax, [rbp+var_8]"], [36, "or eax, edx"], [37, "mov [rbp+var_8], ax"], [38, "movzx eax, [rbp+var_8]"], [39, "movzx edx, ax"], [40, "mov rax, [rbp+var_18]"], [41, "mov esi, 0"], [42, "mov rdi, rax"], [43, "call sub_4012B1"], [44, "mov [rbp+var_1], al"], [45, "cmp [rbp+var_1], 0"], [46, "jz short loc_4019DE"], [47, "mov rax, [rbp+var_18]"], [48, "mov rdx, [rax+30h]"], [49, "mov edi, offset aIna219WriteCon"], [50, "mov eax, 0"], [51, "call rdx"], [52, "mov eax, 1"], [53, "jmp locret_401A8C"], [54, "cmp [rbp+var_1C], 0"], [55, "jz loc_401A87"], [56, "cmp [rbp+var_1C], 3"], [57, "ja loc_401A87"], [58, "movzx eax, [rbp+var_8]"], [59, "shr ax, 3"], [60, "and eax, 0Fh"], [61, "mov [rbp+var_2], al"], [62, "movzx eax, [rbp+var_8]"], [63, "shr ax, 7"], [64, "and eax, 0Fh"], [65, "mov [rbp+var_3], al"], [66, "movzx eax, [rbp+var_2]"], [67, "movzx edx, [rbp+var_3]"], [68, "cmp [rbp+var_3], al"], [69, "cmovnb eax, edx"], [70, "mov [rbp+var_4], al"], [71, "cmp [rbp+var_4], 8"], [72, "ja short loc_401A36"], [73, "mov rax, [rbp+var_18]"], [74, "mov rax, [rax+28h]"], [75, "mov edi, 1"], [76, "call rax"], [77, "jmp short loc_401A80"], [78, "movzx eax, [rbp+var_4]"], [79, "sub eax, 8"], [80, "pxor xmm0, xmm0"], [81, "cvtsi2sd xmm0, eax"], [82, "mov rax, cs:x"], [83, "movapd xmm1, xmm0"], [84, "movq xmm0, rax"], [85, "call _pow"], [86, "movsd xmm1, cs:qword_4082E0"], [87, "mulsd xmm0, xmm1"], [88, "cvttsd2si eax, xmm0"], [89, "add eax, 1"], [90, "mov [rbp+var_5], al"], [91, "mov rax, [rbp+var_18]"], [92, "mov rdx, [rax+28h]"], [93, "movzx eax, [rbp+var_5]"], [94, "mov edi, eax"], [95, "call rdx"], [96, "mov eax, 0"], [97, "jmp short locret_401A8C"], [98, "mov eax, 0"], [99, "leave"], [100, "retn"]], "data_dep": [[5, 3], [6, 5], [9, 3], [10, 9], [11, 10], [12, 11], [16, 3], [18, 16], [20, 19], [21, 20], [22, 21], [23, 3], [24, 23], [27, 24], [31, 30], [32, 31], [33, 4], [34, 33], [35, 32], [36, 34], [36, 35], [37, 36], [38, 37], [39, 38], [40, 3], [42, 40], [44, 43], [45, 44], [46, 45], [47, 3], [48, 47], [51, 48], [54, 4], [55, 54], [56, 4], [57, 56], [58, 37], [59, 58], [60, 59], [61, 60], [62, 37], [63, 62], [64, 63], [65, 64], [66, 61], [67, 65], [68, 66], [68, 65], [69, 67], [69, 68], [70, 69], [71, 70], [72, 71], [73, 3], [74, 73], [76, 74], [78, 70], [79, 78], [81, 80], [81, 79], [83, 81], [84, 82], [87, 84], [87, 86], [88, 85], [88, 87], [89, 88], [90, 89], [91, 3], [92, 91], [93, 90], [94, 93], [95, 92], [100, 28], [100, 96], [100, 7], [100, 98], [100, 13], [100, 52]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab_12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab.jsonl.gz", "strip_func_name": "sub_401913", "query": "\n\n\n__int64 __fastcall sub_401913(__int64 a1, unsigned int a2)\n{\n__int64 result; // rax\nunsigned __int8 v3; // al\nunsigned __int16 v4; // [rsp+18h] [rbp-8h] BYREF\nunsigned __int8 v5; // [rsp+1Bh] [rbp-5h]\nunsigned __int8 v6; // [rsp+1Ch] [rbp-4h]\nunsigned __int8 v7; // [rsp+1Dh] [rbp-3h]\nunsigned __int8 v8; // [rsp+1Eh] [rbp-2h]\nchar v9; // [rsp+1Fh] [rbp-1h]\n\nif ( !a1 )\nreturn 2LL;\nif ( *(_BYTE *)(a1 + 72) != 1 )\nreturn 3LL;\nv9 = sub_401232((unsigned __int8 *)a1, 0, &v4);\nif ( v9 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 48))(\"ina219: read conf register failed.\\n\");\nresult = 1LL;\n}\nelse\n{\nv4 &= 0xFFF8u;\nv4 |= a2;\nv9 = sub_4012B1((unsigned __int8 *)a1, 0, v4);\nif ( v9 )\n{\n(*(void (__fastcall **)(const char *))(a1 + 48))(\"ina219: write conf register failed.\\n\");\nresult = 1LL;\n}\nelse if ( a2 && a2 <= 3 )\n{\nv8 = (v4 >> 3) & 0xF;\nv7 = (v4 >> 7) & 0xF;\nv3 = v8;\nif ( v7 >= v8 )\nv3 = (v4 >> 7) & 0xF;\nv6 = v3;\nif ( v3 > 8u )\n{\nv5 = (int)(pow(2.0, (double)(v6 - 8)) * 0.532) + 1;\n(*(void (__fastcall **)(_QWORD))(a1 + 40))(v5);\n}\nelse\n{\n(*(void (__fastcall **)(__int64))(a1 + 40))(1LL);\n}\nresult = 0LL;\n}\nelse\n{\nresult = 0LL;\n}\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,v4,v5,v6,v7,v8,v9,sub_401913,sub_401232,sub_4012B1,]", "hints": "[]", "response": "{'a1': 'handle', 'a2': 'mode', 'v4': 'prev', 'v5': 't', 'v6': 'm', 'v7': 'mode2', 'v8': 'mode1', 'v9': 'res', 'sub_401913': 'ina219_set_mode', 'sub_401232': 'a_ina219_iic_read', 'sub_4012B1': 'a_ina219_iic_write'}"} | [
[
0.7690611481666565,
0.7690611481666565,
0.7558301687240601,
0.754642903804779,
0.7502034306526184,
0.7455583214759827,
0.7396909594535828,
0.7377018928527832,
0.7354235649108887,
0.7350164651870728,
0.7346938252449036,
0.7346229553222656,
0.7345049977302551,
0.7345049977302551,
0.7321373224258423,
0.7316597700119019,
0.7301959991455078,
0.7296018600463867,
0.7293524742126465,
0.7293344736099243
],
[
197714,
169894,
110210,
203395,
254755,
187364,
227314,
162955,
28160,
19211,
131176,
204520,
27873,
102058,
110794,
123722,
142566,
107563,
165077,
244115
]
] |
|
get_mask | 6c8dcd3e30f0aae299843feb0fbc953ae9222b0e639ff49220cd6726beb0c78a | jfdelnero | HxCModPlayer | NA | unsigned char get_mask(uint32_t old,uint32_t new, int * final_size)
{
uint32_t mask;
int size,i;
mask = 0;
size = 0;
for(i=0;i<4;i++)
{
if( (old&(0xFF<<(i*8))) != (new&(0xFF<<(i*8))) )
{
mask |= (0x01<<i);
size++;
}
}
if(final_size)
*final_size = size;
return mask;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4016C6", "function_addr": 4200134, "binary_name": "6c8dcd3e30f0aae299843feb0fbc953ae9222b0e639ff49220cd6726beb0c78a.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_14], edi"], [3, "mov [rbp+var_18], esi"], [4, "mov [rbp+var_20], rdx"], [5, "mov [rbp+var_4], 0"], [6, "mov [rbp+var_8], 0"], [7, "mov [rbp+var_C], 0"], [8, "jmp short loc_401723"], [9, "mov eax, [rbp+var_14]"], [10, "xor eax, [rbp+var_18]"], [11, "mov edx, eax"], [12, "mov eax, [rbp+var_C]"], [13, "shl eax, 3"], [14, "mov esi, 0FFh"], [15, "mov ecx, eax"], [16, "shl esi, cl"], [17, "mov eax, esi"], [18, "and eax, edx"], [19, "test eax, eax"], [20, "jz short loc_40171F"], [21, "mov eax, [rbp+var_C]"], [22, "mov edx, 1"], [23, "mov ecx, eax"], [24, "shl edx, cl"], [25, "mov eax, edx"], [26, "or [rbp+var_4], eax"], [27, "add [rbp+var_8], 1"], [28, "add [rbp+var_C], 1"], [29, "cmp [rbp+var_C], 3"], [30, "jle short loc_4016EB"], [31, "cmp [rbp+var_20], 0"], [32, "jz short loc_401739"], [33, "mov rax, [rbp+var_20]"], [34, "mov edx, [rbp+var_8]"], [35, "mov [rax], edx"], [36, "mov eax, [rbp+var_4]"], [37, "pop rbp"], [38, "retn"]], "data_dep": [[9, 2], [10, 3], [10, 9], [11, 10], [12, 7], [12, 28], [13, 12], [15, 13], [16, 15], [16, 14], [17, 16], [18, 17], [18, 11], [19, 18], [20, 19], [21, 28], [21, 7], [23, 21], [24, 23], [24, 22], [25, 24], [26, 5], [26, 26], [26, 25], [27, 6], [27, 27], [28, 7], [28, 28], [29, 7], [29, 28], [30, 29], [31, 4], [32, 31], [33, 4], [34, 6], [34, 27], [35, 33], [35, 34], [36, 5], [36, 26], [37, 0], [38, 36]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/6c8dcd3e30f0aae299843feb0fbc953ae9222b0e639ff49220cd6726beb0c78a_6c8dcd3e30f0aae299843feb0fbc953ae9222b0e639ff49220cd6726beb0c78a.jsonl.gz", "strip_func_name": "sub_4016C6", "query": "\n\n\n__int64 __fastcall sub_4016C6(int a1, int a2, _DWORD *a3)\n{\nint i; // [rsp+14h] [rbp-Ch]\nint v5; // [rsp+18h] [rbp-8h]\nunsigned int v6; // [rsp+1Ch] [rbp-4h]\n\nv6 = 0;\nv5 = 0;\nfor ( i = 0; i <= 3; ++i )\n{\nif ( ((a2 ^ a1) & (255 << (8 * i))) != 0 )\n{\nv6 |= 1 << i;\n++v5;\n}\n}\nif ( a3 )\n*a3 = v5;\nreturn v6;\n}\n\n\n\nQ:[a3,a1,v5,v6,sub_4016C6,]", "hints": "[]", "response": "{'a3': 'final_size', 'a1': 'old', 'v5': 'size', 'v6': 'mask', 'sub_4016C6': 'get_mask'}"} | [
[
0.798523485660553,
0.793431282043457,
0.7920615673065186,
0.7904468774795532,
0.7903335094451904,
0.7780290842056274,
0.7603462934494019,
0.7573062777519226,
0.7571731209754944,
0.7570392489433289,
0.7543298006057739,
0.7446789145469666,
0.7436663508415222,
0.736991822719574,
0.7362655997276306,
0.7339571714401245,
0.7259122133255005,
0.7257466316223145,
0.7226723432540894,
0.7186993956565857
],
[
65939,
68124,
235608,
82680,
258174,
135827,
194344,
82142,
165742,
194330,
112616,
193984,
103939,
190700,
126181,
174016,
106345,
135688,
1148,
184678
]
] |
|
AcpiOsWaitSemaphore | 945ed0fc3371195cab2c0d4ae99cce69735a87793ae6198953c52d56d950810f | bitdefender | napoca | NA | ACPI_STATUS
AcpiOsWaitSemaphore (
ACPI_HANDLE Handle,
UINT32 Units,
UINT16 MsecTimeout)
{
ACPI_STATUS Status = AE_OK;
sem_t *Sem = (sem_t *) Handle;
int RetVal;
#ifndef ACPI_USE_ALTERNATE_TIMEOUT
struct timespec Time;
#endif
if (!Sem)
{
return (AE_BAD_PARAMETER);
}
switch (MsecTimeout)
{
/*
* No Wait:
* --------
* A zero timeout value indicates that we shouldn't wait - just
* acquire the semaphore if available otherwise return AE_TIME
* (a.k.a. 'would block').
*/
case 0:
if (sem_trywait(Sem) == -1)
{
Status = (AE_TIME);
}
break;
/* Wait Indefinitely */
case ACPI_WAIT_FOREVER:
while (((RetVal = sem_wait (Sem)) == -1) && (errno == EINTR))
{
continue; /* Restart if interrupted */
}
if (RetVal != 0)
{
Status = (AE_TIME);
}
break;
/* Wait with MsecTimeout */
default:
#ifdef ACPI_USE_ALTERNATE_TIMEOUT
/*
* Alternate timeout mechanism for environments where
* sem_timedwait is not available or does not work properly.
*/
while (MsecTimeout)
{
if (sem_trywait (Sem) == 0)
{
/* Got the semaphore */
return (AE_OK);
}
if (MsecTimeout >= 10)
{
MsecTimeout -= 10;
usleep (10 * ACPI_USEC_PER_MSEC); /* ten milliseconds */
}
else
{
MsecTimeout--;
usleep (ACPI_USEC_PER_MSEC); /* one millisecond */
}
}
Status = (AE_TIME);
#else
/*
* The interface to sem_timedwait is an absolute time, so we need to
* get the current time, then add in the millisecond Timeout value.
*/
if (clock_gettime (CLOCK_REALTIME, &Time) == -1)
{
perror ("clock_gettime");
return (AE_TIME);
}
Time.tv_sec += (MsecTimeout / ACPI_MSEC_PER_SEC);
Time.tv_nsec += ((MsecTimeout % ACPI_MSEC_PER_SEC) * ACPI_NSEC_PER_MSEC);
/* Handle nanosecond overflow (field must be less than one second) */
if (Time.tv_nsec >= ACPI_NSEC_PER_SEC)
{
Time.tv_sec += (Time.tv_nsec / ACPI_NSEC_PER_SEC);
Time.tv_nsec = (Time.tv_nsec % ACPI_NSEC_PER_SEC);
}
while (((RetVal = sem_timedwait (Sem, &Time)) == -1) && (errno == EINTR))
{
continue; /* Restart if interrupted */
}
if (RetVal != 0)
{
if (errno != ETIMEDOUT)
{
perror ("sem_timedwait");
}
Status = (AE_TIME);
}
#endif
break;
}
return (Status);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_450F69", "function_addr": 4525929, "binary_name": "945ed0fc3371195cab2c0d4ae99cce69735a87793ae6198953c52d56d950810f.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 40h"], [3, "mov [rbp+var_38], rdi"], [4, "mov [rbp+var_3C], esi"], [5, "mov eax, edx"], [6, "mov [rbp+var_40], ax"], [7, "mov [rbp+var_4], 0"], [8, "mov rax, [rbp+var_38]"], [9, "mov [rbp+sem], rax"], [10, "cmp [rbp+sem], 0"], [11, "jnz short loc_450F9E"], [12, "mov eax, 1001h"], [13, "jmp locret_45115C"], [14, "movzx eax, [rbp+var_40]"], [15, "test eax, eax"], [16, "jz short loc_450FAF"], [17, "cmp eax, 0FFFFh"], [18, "jz short loc_450FD1"], [19, "jmp short loc_451008"], [20, "mov rax, [rbp+sem]"], [21, "mov rdi, rax"], [22, "call _sem_trywait"], [23, "cmp eax, 0FFFFFFFFh"], [24, "jnz loc_451152"], [25, "mov [rbp+var_4], 11h"], [26, "jmp loc_451152"], [27, "nop"], [28, "mov rax, [rbp+sem]"], [29, "mov rdi, rax"], [30, "call _sem_wait"], [31, "mov [rbp+var_14], eax"], [32, "cmp [rbp+var_14], 0FFFFFFFFh"], [33, "jnz short loc_450FF2"], [34, "call ___errno_location"], [35, "mov eax, [rax]"], [36, "cmp eax, 4"], [37, "jz short loc_450FD0"], [38, "cmp [rbp+var_14], 0"], [39, "jz loc_451155"], [40, "mov [rbp+var_4], 11h"], [41, "jmp loc_451155"], [42, "lea rax, [rbp+tp]"], [43, "mov rsi, rax"], [44, "mov edi, 0"], [45, "call _clock_gettime"], [46, "cmp eax, 0FFFFFFFFh"], [47, "jnz short loc_451032"], [48, "mov edi, offset aClockGettime_0"], [49, "call _perror"], [50, "mov eax, 11h"], [51, "jmp locret_45115C"], [52, "mov rdx, [rbp+tp.tv_sec]"], [53, "movzx eax, [rbp+var_40]"], [54, "shr ax, 3"], [55, "movzx eax, ax"], [56, "imul eax, 20C5h"], [57, "shr eax, 10h"], [58, "shr ax, 4"], [59, "movzx eax, ax"], [60, "add rax, rdx"], [61, "mov [rbp+tp.tv_sec], rax"], [62, "mov rcx, [rbp+tp.tv_nsec]"], [63, "movzx edx, [rbp+var_40]"], [64, "mov eax, edx"], [65, "shr ax, 3"], [66, "movzx eax, ax"], [67, "imul eax, 20C5h"], [68, "shr eax, 10h"], [69, "shr ax, 4"], [70, "imul si, ax, 3E8h"], [71, "mov eax, edx"], [72, "sub eax, esi"], [73, "movzx eax, ax"], [74, "imul rax, 0F4240h"], [75, "add rax, rcx"], [76, "mov [rbp+tp.tv_nsec], rax"], [77, "mov rax, [rbp+tp.tv_nsec]"], [78, "cmp rax, 3B9AC9FFh"], [79, "jle short loc_451105"], [80, "mov rsi, [rbp+tp.tv_sec]"], [81, "mov rcx, [rbp+tp.tv_nsec]"], [82, "mov rdx, 112E0BE826D694B3h"], [83, "mov rax, rcx"], [84, "imul rdx"], [85, "mov rax, rdx"], [86, "sar rax, 1Ah"], [87, "sar rcx, 3Fh"], [88, "mov rdx, rcx"], [89, "sub rax, rdx"], [90, "add rax, rsi"], [91, "mov [rbp+tp.tv_sec], rax"], [92, "mov rcx, [rbp+tp.tv_nsec]"], [93, "mov rdx, 112E0BE826D694B3h"], [94, "mov rax, rcx"], [95, "imul rdx"], [96, "mov rax, rdx"], [97, "sar rax, 1Ah"], [98, "mov rdx, rcx"], [99, "sar rdx, 3Fh"], [100, "sub rax, rdx"], [101, "imul rdx, rax, 3B9ACA00h"], [102, "mov rax, rcx"], [103, "sub rax, rdx"], [104, "mov [rbp+tp.tv_nsec], rax"], [105, "jmp short loc_451105"], [106, "nop"], [107, "lea rdx, [rbp+tp]"], [108, "mov rax, [rbp+sem]"], [109, "mov rsi, rdx"], [110, "mov rdi, rax"], [111, "call _sem_timedwait"], [112, "mov [rbp+var_14], eax"], [113, "cmp [rbp+var_14], 0FFFFFFFFh"], [114, "jnz short loc_45112D"], [115, "call ___errno_location"], [116, "mov eax, [rax]"], [117, "cmp eax, 4"], [118, "jz short loc_451104"], [119, "cmp [rbp+var_14], 0"], [120, "jz short loc_451158"], [121, "call ___errno_location"], [122, "mov eax, [rax]"], [123, "cmp eax, 6Eh "], [124, "jz short loc_451149"], [125, "mov edi, offset aSemTimedwait_0"], [126, "call _perror"], [127, "mov [rbp+var_4], 11h"], [128, "jmp short loc_451158"], [129, "nop"], [130, "jmp short loc_451159"], [131, "nop"], [132, "jmp short loc_451159"], [133, "nop"], [134, "mov eax, [rbp+var_4]"], [135, "leave"], [136, "retn"]], "data_dep": [[6, 5], [8, 3], [9, 8], [10, 9], [11, 10], [14, 6], [15, 14], [16, 15], [17, 15], [18, 17], [20, 9], [21, 20], [23, 22], [24, 23], [28, 9], [29, 28], [31, 30], [32, 31], [33, 32], [35, 34], [36, 35], [37, 36], [38, 31], [39, 38], [42, 15], [43, 42], [46, 45], [47, 46], [53, 6], [54, 53], [55, 54], [56, 55], [57, 56], [58, 57], [59, 58], [60, 59], [60, 52], [61, 60], [63, 6], [64, 63], [65, 64], [66, 65], [67, 66], [68, 67], [69, 68], [70, 43], [70, 69], [71, 63], [72, 70], [72, 71], [73, 72], [74, 73], [75, 74], [75, 62], [76, 75], [77, 76], [78, 77], [79, 78], [80, 61], [81, 76], [83, 81], [84, 82], [85, 84], [86, 85], [87, 81], [88, 87], [89, 86], [89, 88], [90, 80], [90, 89], [91, 90], [92, 76], [94, 92], [95, 93], [96, 95], [97, 96], [98, 92], [99, 98], [100, 97], [100, 99], [101, 99], [101, 100], [102, 92], [103, 102], [103, 101], [104, 103], [107, 101], [107, 107], [107, 63], [108, 9], [109, 107], [110, 108], [112, 111], [113, 112], [114, 113], [116, 115], [117, 116], [118, 117], [119, 112], [120, 119], [122, 121], [123, 122], [124, 123], [134, 7], [134, 25], [134, 127], [134, 40], [136, 50], [136, 134], [136, 12]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/945ed0fc3371195cab2c0d4ae99cce69735a87793ae6198953c52d56d950810f_945ed0fc3371195cab2c0d4ae99cce69735a87793ae6198953c52d56d950810f.jsonl.gz", "strip_func_name": "sub_450F69", "query": "\n\n\n__int64 __fastcall sub_450F69(sem_t *a1, __int64 a2, unsigned __int16 a3)\n{\nstruct timespec tp; // [rsp+10h] [rbp-30h] BYREF\nint v6; // [rsp+2Ch] [rbp-14h]\nsem_t *sem; // [rsp+30h] [rbp-10h]\nunsigned int v8; // [rsp+3Ch] [rbp-4h]\n\nv8 = 0;\nsem = a1;\nif ( !a1 )\nreturn 4097LL;\nif ( a3 )\n{\nif ( a3 == 0xFFFF )\n{\ndo\nv6 = sem_wait(sem);\nwhile ( v6 == -1 && *__errno_location() == 4 );\nif ( v6 )\nv8 = 17;\n}\nelse\n{\nif ( clock_gettime(0, &tp) == -1 )\n{\nperror(\"clock_gettime\");\nreturn 17LL;\n}\ntp.tv_sec += a3 / 0x3E8u;\ntp.tv_nsec += 1000000LL * (a3 % 0x3E8u);\nif ( tp.tv_nsec > 999999999 )\n{\ntp.tv_sec += tp.tv_nsec / 1000000000;\ntp.tv_nsec %= 1000000000LL;\n}\ndo\nv6 = sem_timedwait(sem, &tp);\nwhile ( v6 == -1 && *__errno_location() == 4 );\nif ( v6 )\n{\nif ( *__errno_location() != 110 )\nperror(\"sem_timedwait\");\nv8 = 17;\n}\n}\n}\nelse if ( sem_trywait(sem) == -1 )\n{\nv8 = 17;\n}\nreturn v8;\n}\n\n\n\nQ:[a3,a1,a2,tp,v6,sem,v8,sub_450F69,]", "hints": "[]", "response": "{'a3': 'MsecTimeout', 'a1': 'Handle', 'a2': 'Units', 'tp': 'Time', 'v6': 'RetVal', 'sem': 'Sem', 'v8': 'Status', 'sub_450F69': 'AcpiOsWaitSemaphore'}"} | [
[
0.7677060961723328,
0.718868613243103,
0.7086153626441956,
0.7033998966217041,
0.6909318566322327,
0.641270637512207,
0.635611355304718,
0.6333303451538086,
0.6325939893722534,
0.630351722240448,
0.6283695697784424,
0.6228151321411133,
0.6223112344741821,
0.6191112995147705,
0.6096227169036865,
0.6074832081794739,
0.6068100333213806,
0.6038049459457397,
0.6011735796928406,
0.6010873913764954
],
[
98940,
162239,
37147,
197861,
235773,
121646,
22651,
251120,
130267,
32239,
95584,
132113,
81689,
84804,
233449,
59650,
84420,
58261,
185595,
12238
]
] |
|
check_page | ddac7fc87639a4f1a51dab56b1f09c3aa090022833a91cf6ba744a4defdd1dbe | freeors | War-Of-Kingdom | NA | void check_page(unsigned char *data,const int *header,ogg_page *og){
long j;
/* Test data */
for(j=0;j<og->body_len;j++)
if(og->body[j]!=data[j]){
fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n",
j,data[j],og->body[j]);
exit(1);
}
/* Test header */
for(j=0;j<og->header_len;j++){
if(og->header[j]!=header[j]){
fprintf(stderr,"header content mismatch at pos %ld:\n",j);
for(j=0;j<header[26]+27;j++)
fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]);
fprintf(stderr,"\n");
exit(1);
}
}
if(og->header_len!=header[26]+27){
fprintf(stderr,"header length incorrect! (%ld!=%d)\n",
og->header_len,header[26]+27);
exit(1);
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4034D8", "function_addr": 4207832, "binary_name": "ddac7fc87639a4f1a51dab56b1f09c3aa090022833a91cf6ba744a4defdd1dbe.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_28], rdx"], [6, "mov [rbp+var_8], 0"], [7, "jmp short loc_40356F"], [8, "mov rax, [rbp+var_28]"], [9, "mov rdx, [rax+10h]"], [10, "mov rax, [rbp+var_8]"], [11, "add rax, rdx"], [12, "movzx edx, byte ptr [rax]"], [13, "mov rcx, [rbp+var_8]"], [14, "mov rax, [rbp+var_18]"], [15, "add rax, rcx"], [16, "movzx eax, byte ptr [rax]"], [17, "cmp dl, al"], [18, "jz short loc_40356A"], [19, "mov rax, [rbp+var_28]"], [20, "mov rdx, [rax+10h]"], [21, "mov rax, [rbp+var_8]"], [22, "add rax, rdx"], [23, "movzx eax, byte ptr [rax]"], [24, "movzx esi, al"], [25, "mov rdx, [rbp+var_8]"], [26, "mov rax, [rbp+var_18]"], [27, "add rax, rdx"], [28, "movzx eax, byte ptr [rax]"], [29, "movzx ecx, al"], [30, "mov rax, cs:stderr"], [31, "mov rdx, [rbp+var_8]"], [32, "mov r8d, esi"], [33, "mov esi, offset aBodyDataMismat_0"], [34, "mov rdi, rax"], [35, "mov eax, 0"], [36, "call _fprintf"], [37, "mov edi, 1"], [38, "call _exit"], [39, "add [rbp+var_8], 1"], [40, "mov rax, [rbp+var_28]"], [41, "mov rax, [rax+18h]"], [42, "cmp [rbp+var_8], rax"], [43, "jl loc_4034F6"], [44, "mov [rbp+var_8], 0"], [45, "jmp loc_40366C"], [46, "mov rax, [rbp+var_28]"], [47, "mov rdx, [rax]"], [48, "mov rax, [rbp+var_8]"], [49, "add rax, rdx"], [50, "movzx eax, byte ptr [rax]"], [51, "movzx edx, al"], [52, "mov rax, [rbp+var_8]"], [53, "lea rcx, ds:0[rax*4]"], [54, "mov rax, [rbp+var_20]"], [55, "add rax, rcx"], [56, "mov eax, [rax]"], [57, "cmp edx, eax"], [58, "jz loc_403667"], [59, "mov rax, cs:stderr"], [60, "mov rdx, [rbp+var_8]"], [61, "mov esi, offset aHeaderContentM"], [62, "mov rdi, rax"], [63, "mov eax, 0"], [64, "call _fprintf"], [65, "mov [rbp+var_8], 0"], [66, "jmp short loc_403634"], [67, "mov rax, [rbp+var_28]"], [68, "mov rdx, [rax]"], [69, "mov rax, [rbp+var_8]"], [70, "add rax, rdx"], [71, "movzx eax, byte ptr [rax]"], [72, "movzx esi, al"], [73, "mov rax, [rbp+var_8]"], [74, "lea rdx, ds:0[rax*4]"], [75, "mov rax, [rbp+var_20]"], [76, "add rax, rdx"], [77, "mov ecx, [rax]"], [78, "mov rax, cs:stderr"], [79, "mov rdx, [rbp+var_8]"], [80, "mov r8d, esi"], [81, "mov esi, offset aLd02x02x"], [82, "mov rdi, rax"], [83, "mov eax, 0"], [84, "call _fprintf"], [85, "add [rbp+var_8], 1"], [86, "mov rax, [rbp+var_20]"], [87, "add rax, 68h "], [88, "mov eax, [rax]"], [89, "add eax, 1Bh"], [90, "cdqe"], [91, "cmp [rbp+var_8], rax"], [92, "jl short loc_4035E6"], [93, "mov rax, cs:stderr"], [94, "mov rsi, rax"], [95, "mov edi, 0Ah"], [96, "call _fputc"], [97, "mov edi, 1"], [98, "call _exit"], [99, "add [rbp+var_8], 1"], [100, "mov rax, [rbp+var_28]"], [101, "mov rax, [rax+8]"], [102, "cmp [rbp+var_8], rax"], [103, "jl loc_40358E"], [104, "mov rax, [rbp+var_28]"], [105, "mov rdx, [rax+8]"], [106, "mov rax, [rbp+var_20]"], [107, "add rax, 68h "], [108, "mov eax, [rax]"], [109, "add eax, 1Bh"], [110, "cdqe"], [111, "cmp rdx, rax"], [112, "jz short loc_4036D2"], [113, "mov rax, [rbp+var_20]"], [114, "add rax, 68h "], [115, "mov eax, [rax]"], [116, "lea ecx, [rax+1Bh]"], [117, "mov rax, [rbp+var_28]"], [118, "mov rdx, [rax+8]"], [119, "mov rax, cs:stderr"], [120, "mov esi, offset aHeaderLengthIn"], [121, "mov rdi, rax"], [122, "mov eax, 0"], [123, "call _fprintf"], [124, "mov edi, 1"], [125, "call _exit"], [126, "nop"], [127, "leave"], [128, "retn"]], "data_dep": [[8, 5], [9, 8], [10, 6], [10, 39], [11, 9], [11, 10], [12, 11], [13, 39], [13, 6], [14, 3], [15, 14], [15, 13], [16, 15], [17, 12], [17, 16], [18, 17], [19, 5], [20, 19], [21, 39], [21, 6], [22, 21], [22, 20], [23, 22], [24, 23], [25, 6], [25, 39], [26, 3], [27, 26], [27, 25], [28, 27], [29, 28], [31, 39], [31, 6], [32, 24], [34, 30], [39, 39], [39, 6], [40, 5], [41, 40], [42, 39], [42, 41], [42, 6], [43, 42], [46, 5], [47, 46], [48, 99], [48, 44], [49, 48], [49, 47], [50, 49], [51, 50], [52, 99], [52, 44], [53, 13], [53, 53], [54, 4], [55, 54], [55, 53], [56, 55], [57, 56], [57, 51], [58, 57], [60, 99], [60, 44], [62, 59], [67, 5], [68, 67], [69, 65], [69, 85], [70, 68], [70, 69], [71, 70], [72, 71], [73, 85], [73, 65], [74, 68], [75, 4], [76, 74], [76, 75], [77, 76], [79, 85], [79, 65], [80, 72], [82, 78], [85, 65], [85, 85], [86, 4], [87, 86], [88, 87], [89, 88], [91, 89], [91, 65], [91, 85], [92, 91], [94, 93], [99, 99], [99, 44], [100, 5], [101, 100], [102, 99], [102, 44], [102, 101], [103, 102], [104, 5], [105, 104], [106, 4], [107, 106], [108, 107], [109, 108], [111, 105], [111, 109], [112, 111], [113, 4], [114, 113], [115, 114], [116, 115], [116, 53], [116, 13], [117, 5], [118, 117], [121, 119], [128, 109]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/ddac7fc87639a4f1a51dab56b1f09c3aa090022833a91cf6ba744a4defdd1dbe_ddac7fc87639a4f1a51dab56b1f09c3aa090022833a91cf6ba744a4defdd1dbe.jsonl.gz", "strip_func_name": "sub_4034D8", "query": "\n\n\n__int64 __fastcall sub_4034D8(__int64 a1, __int64 a2, _QWORD *a3)\n{\n__int64 result; // rax\n__int64 i; // [rsp+28h] [rbp-8h]\n__int64 j; // [rsp+28h] [rbp-8h]\n__int64 k; // [rsp+28h] [rbp-8h]\n\nfor ( i = 0LL; i < a3[3]; ++i )\n{\nif ( *(_BYTE *)(a3[2] + i) != *(_BYTE *)(i + a1) )\n{\nfprintf(\nstderr,\n\"body data mismatch (2) at pos %ld: %x!=%x!\\n\\n\",\ni,\n*(unsigned __int8 *)(i + a1),\n*(unsigned __int8 *)(a3[2] + i));\nexit(1);\n}\n}\nfor ( j = 0LL; j < a3[1]; ++j )\n{\nif ( *(unsigned __int8 *)(*a3 + j) != *(_DWORD *)(4 * j + a2) )\n{\nfprintf(stderr, \"header content mismatch at pos %ld:\\n\", j);\nfor ( k = 0LL; k < *(_DWORD *)(a2 + 104) + 27; ++k )\nfprintf(stderr, \" (%ld)%02x:%02x\", k, *(unsigned int *)(4 * k + a2), *(unsigned __int8 *)(*a3 + k));\nfputc(10, stderr);\nexit(1);\n}\n}\nresult = *(_DWORD *)(a2 + 104) + 27;\nif ( a3[1] != result )\n{\nfprintf(stderr, \"header length incorrect! (%ld!=%d)\\n\", a3[1], (unsigned int)(*(_DWORD *)(a2 + 104) + 27));\nexit(1);\n}\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,i,sub_4034D8,]", "hints": "[]", "response": "{'a3': 'og', 'a1': 'data', 'a2': 'header', 'i': 'jb', 'sub_4034D8': 'check_page'}"} | [
[
0.7602730393409729,
0.7119978666305542,
0.7025036811828613,
0.6912402510643005,
0.6889283061027527,
0.6793555021286011,
0.679067075252533,
0.6751316785812378,
0.6747255921363831,
0.6710795164108276,
0.6704133152961731,
0.6694884300231934,
0.6690557599067688,
0.6661086678504944,
0.662825345993042,
0.6617648601531982,
0.6591120362281799,
0.6590536832809448,
0.6573825478553772,
0.6540610194206238
],
[
50102,
119941,
180052,
186697,
84667,
163608,
203156,
153355,
4830,
165297,
69748,
55822,
83658,
76632,
206755,
33453,
2787,
220883,
98170,
251305
]
] |
|
file_exists | 3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413 | emikulic | darkhttpd | NA | static int file_exists(const char *path) {
struct stat filestat;
if ((stat(path, &filestat) == -1) && (errno == ENOENT))
return 0;
else
return 1;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_413AC8", "function_addr": 4274888, "binary_name": "3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push r14"], [3, "push r13"], [4, "push r12"], [5, "push rbx"], [6, "sub rsp, 110h"], [7, "mov [rbp+filename], rdi"], [8, "lea rbx, [rbp+var_120]"], [9, "mov r14, rbx"], [10, "cmp cs:__asan_option_detect_stack_use_after_return, 0"], [11, "jz short loc_413B06"], [12, "mov edi, 100h"], [13, "call ___asan_stack_malloc_2"], [14, "test rax, rax"], [15, "jz short loc_413B06"], [16, "mov rbx, rax"], [17, "lea rax, [rbx+100h]"], [18, "mov r13, rax"], [19, "mov qword ptr [rbx], 41B58AB3h"], [20, "mov qword ptr [rbx+8], offset a14814413Filest"], [21, "mov qword ptr [rbx+10h], offset sub_413AC8"], [22, "mov r12, rbx"], [23, "shr r12, 3"], [24, "mov dword ptr [r12+7FFF8000h], 0F1F1F1F1h"], [25, "mov dword ptr [r12+7FFF8004h], 0F1F1h"], [26, "mov dword ptr [r12+7FFF8018h], 0F3F3F3F3h"], [27, "mov dword ptr [r12+7FFF801Ch], 0F3F3F3F3h"], [28, "cmp [rbp+filename], 0"], [29, "jnz short loc_413B72"], [30, "mov edi, offset off_447A40"], [31, "call ___ubsan_handle_nonnull_arg"], [32, "lea rdx, [r13-0D0h]"], [33, "mov rax, [rbp+filename]"], [34, "mov rsi, rdx"], [35, "mov rdi, rax"], [36, "call sub_41F750"], [37, "cmp eax, 0FFFFFFFFh"], [38, "jnz short loc_413BFE"], [39, "call ___errno_location"], [40, "mov r13, rax"], [41, "mov rax, r13"], [42, "test r13, r13"], [43, "jz short loc_413BAB"], [44, "mov rdx, rax"], [45, "and edx, 3"], [46, "test rdx, rdx"], [47, "jz short loc_413BB8"], [48, "mov rsi, rax"], [49, "mov edi, offset off_43D320"], [50, "call ___ubsan_handle_type_mismatch_v1"], [51, "mov rax, r13"], [52, "mov rdx, rax"], [53, "shr rdx, 3"], [54, "add rdx, 7FFF8000h"], [55, "movzx edx, byte ptr [rdx]"], [56, "test dl, dl"], [57, "setnz sil"], [58, "mov rcx, rax"], [59, "and ecx, 7"], [60, "add ecx, 3"], [61, "cmp cl, dl"], [62, "setnl dl"], [63, "and edx, esi"], [64, "test dl, dl"], [65, "jz short loc_413BEE"], [66, "mov rdi, rax"], [67, "call ___asan_report_load4"], [68, "mov eax, [r13+0]"], [69, "cmp eax, 2"], [70, "jnz short loc_413BFE"], [71, "mov eax, 0"], [72, "jmp short loc_413C03"], [73, "mov eax, 1"], [74, "mov edx, eax"], [75, "cmp r14, rbx"], [76, "jz short loc_413C51"], [77, "mov qword ptr [rbx], 45E0360Eh"], [78, "mov rsi, 0F5F5F5F5F5F5F5F5h"], [79, "mov rdi, 0F5F5F5F5F5F5F5F5h"], [80, "mov [r12+7FFF8000h], rsi"], [81, "mov [r12+7FFF8008h], rdi"], [82, "mov [r12+7FFF8010h], rsi"], [83, "mov [r12+7FFF8018h], rdi"], [84, "mov rax, [rbx+0F8h]"], [85, "mov byte ptr [rax], 0"], [86, "jmp short loc_413C69"], [87, "mov qword ptr [r12+7FFF8000h], 0"], [88, "mov qword ptr [r12+7FFF8018h], 0"], [89, "mov eax, edx"], [90, "add rsp, 110h"], [91, "pop rbx"], [92, "pop r12"], [93, "pop r13"], [94, "pop r14"], [95, "pop rbp"], [96, "retn"]], "data_dep": [[9, 8], [11, 10], [14, 13], [15, 14], [16, 14], [17, 14], [17, 16], [17, 8], [18, 17], [19, 8], [19, 16], [20, 8], [20, 16], [21, 16], [21, 8], [22, 16], [22, 8], [23, 22], [24, 23], [25, 23], [26, 23], [27, 23], [28, 7], [29, 28], [32, 21], [32, 25], [32, 18], [32, 27], [32, 20], [32, 24], [32, 26], [32, 19], [33, 7], [34, 32], [35, 33], [37, 36], [38, 37], [40, 39], [41, 40], [42, 40], [43, 42], [44, 41], [45, 44], [46, 45], [47, 46], [48, 41], [51, 42], [52, 51], [53, 52], [54, 53], [55, 20], [55, 54], [55, 24], [55, 26], [55, 19], [55, 21], [55, 25], [55, 27], [56, 55], [57, 48], [57, 34], [57, 56], [58, 51], [59, 58], [60, 59], [61, 56], [61, 60], [62, 61], [62, 56], [63, 62], [63, 57], [64, 63], [65, 64], [66, 51], [68, 20], [68, 24], [68, 42], [68, 26], [68, 19], [68, 21], [68, 25], [68, 27], [69, 68], [70, 69], [74, 73], [74, 71], [75, 8], [75, 16], [75, 9], [76, 75], [77, 16], [77, 8], [80, 78], [80, 23], [81, 23], [81, 79], [82, 78], [82, 23], [83, 23], [83, 79], [84, 8], [84, 83], [84, 16], [85, 84], [87, 23], [88, 23], [89, 74], [90, 6], [91, 5], [92, 4], [93, 3], [94, 2], [95, 0], [96, 89]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413_3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413.jsonl.gz", "strip_func_name": "sub_413AC8", "query": "\n\n\n__int64 __fastcall sub_413AC8(char *a1)\n{\nunsigned __int64 v1; // rbx\n__int64 v2; // rax\n_DWORD *v3; // r12\nint *v4; // rax\nunsigned __int64 v5; // r13\n__int64 result; // rax\nchar v7[288]; // [rsp+10h] [rbp-120h] BYREF\n\nv1 = (unsigned __int64)v7;\nif ( _asan_option_detect_stack_use_after_return )\n{\nv2 = __asan_stack_malloc_2();\nif ( v2 )\nv1 = v2;\n}\n*(_QWORD *)v1 = 1102416563LL;\n*(_QWORD *)(v1 + 8) = \"1 48 144 13 filestat:1827\";\n*(_QWORD *)(v1 + 16) = sub_413AC8;\nv3 = (_DWORD *)(v1 >> 3);\nv3[536862720] = -235802127;\nv3[536862721] = 61937;\nv3[536862726] = -202116109;\nv3[536862727] = -202116109;\nif ( !a1 )\n__ubsan_handle_nonnull_arg();\nif ( (unsigned int)sub_41F750(a1, (struct stat64 *)(v1 + 48)) != -1 )\ngoto LABEL_14;\nv4 = __errno_location();\nv5 = (unsigned __int64)v4;\nif ( !v4 || ((unsigned __int8)v4 & 3) != 0 )\n__ubsan_handle_type_mismatch_v1();\nif ( *(_BYTE *)((v5 >> 3) + 0x7FFF8000) != 0 && (char)((v5 & 7) + 3) >= *(_BYTE *)((v5 >> 3) + 0x7FFF8000) )\n__asan_report_load4();\nif ( *(_DWORD *)v5 == 2 )\nLODWORD(result) = 0;\nelse\nLABEL_14:\nLODWORD(result) = 1;\nif ( v7 == (char *)v1 )\n{\n*(_QWORD *)((v1 >> 3) + 0x7FFF8000) = 0LL;\n*(_QWORD *)((v1 >> 3) + 0x7FFF8018) = 0LL;\n}\nelse\n{\n*(_QWORD *)v1 = 1172321806LL;\n*(_QWORD *)((v1 >> 3) + 0x7FFF8000) = 0xF5F5F5F5F5F5F5F5LL;\n*(_QWORD *)((v1 >> 3) + 0x7FFF8008) = 0xF5F5F5F5F5F5F5F5LL;\n*(_QWORD *)((v1 >> 3) + 0x7FFF8010) = 0xF5F5F5F5F5F5F5F5LL;\n*(_QWORD *)((v1 >> 3) + 0x7FFF8018) = 0xF5F5F5F5F5F5F5F5LL;\n**(_BYTE **)(v1 + 248) = 0;\n}\nreturn (unsigned int)result;\n}\n\n\n\nQ:[a1,sub_413AC8,sub_41F750,]", "hints": "[]", "response": "{'a1': 'path', 'sub_413AC8': 'file_exists', 'sub_41F750': 'stat64'}"} | [
[
0.8409252166748047,
0.7725542187690735,
0.769758939743042,
0.7655106782913208,
0.7369437217712402,
0.7313411235809326,
0.7275071144104004,
0.7229743003845215,
0.7223451137542725,
0.7216330170631409,
0.7214816212654114,
0.7209073901176453,
0.7094223499298096,
0.7086924314498901,
0.7079251408576965,
0.70301353931427,
0.7028347253799438,
0.7008712291717529,
0.7006497383117676,
0.6937344074249268
],
[
253799,
12071,
104145,
252906,
211374,
180964,
244722,
179434,
205535,
1981,
89897,
67458,
182288,
191125,
261402,
232394,
29618,
41648,
175302,
7362
]
] |
|
str_to_hex | af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4 | rgerganov | nfqsed | NA | void str_to_hex(const char *str, uint8_t *dest, int length)
{
for (int i = 0 ; i < length ; i++) {
int ret = sscanf(str, "%2hhx", &dest[i]);
if (ret != 1) {
fprintf(stderr, "Incorrect hex byte: %c%c\n", str[0], str[1]);
exit(1);
}
str += 2;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4015BC", "function_addr": 4199868, "binary_name": "af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_24], edx"], [6, "mov [rbp+var_4], 0"], [7, "jmp short loc_401648"], [8, "mov eax, [rbp+var_4]"], [9, "movsxd rdx, eax"], [10, "mov rax, [rbp+var_20]"], [11, "add rdx, rax"], [12, "mov rax, [rbp+var_18]"], [13, "mov esi, offset a2hhx"], [14, "mov rdi, rax"], [15, "mov eax, 0"], [16, "call ___isoc99_sscanf"], [17, "mov [rbp+var_8], eax"], [18, "cmp [rbp+var_8], 1"], [19, "jz short loc_40163F"], [20, "mov rax, [rbp+var_18]"], [21, "add rax, 1"], [22, "movzx eax, byte ptr [rax]"], [23, "movsx ecx, al"], [24, "mov rax, [rbp+var_18]"], [25, "movzx eax, byte ptr [rax]"], [26, "movsx edx, al"], [27, "mov rax, cs:stderr"], [28, "mov esi, offset aIncorrectHexBy"], [29, "mov rdi, rax"], [30, "mov eax, 0"], [31, "call _fprintf"], [32, "mov edi, 1"], [33, "call _exit"], [34, "add [rbp+var_18], 2"], [35, "add [rbp+var_4], 1"], [36, "mov eax, [rbp+var_4]"], [37, "cmp eax, [rbp+var_24]"], [38, "jl short loc_4015D8"], [39, "nop"], [40, "nop"], [41, "leave"], [42, "retn"]], "data_dep": [[8, 6], [8, 35], [9, 8], [10, 4], [11, 10], [11, 9], [12, 34], [12, 3], [14, 12], [17, 16], [18, 17], [19, 18], [20, 34], [20, 3], [21, 20], [22, 21], [23, 22], [24, 34], [24, 3], [25, 24], [26, 25], [29, 27], [34, 34], [34, 3], [35, 35], [35, 6], [36, 6], [36, 35], [37, 36], [37, 5], [38, 37], [42, 36]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4_af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4.jsonl.gz", "strip_func_name": "sub_4015BC", "query": "\n\n\n__int64 __fastcall sub_4015BC(char *a1, __int64 a2, int a3)\n{\n__int64 result; // rax\nunsigned int i; // [rsp+2Ch] [rbp-4h]\n\nfor ( i = 0; ; ++i )\n{\nresult = i;\nif ( (int)i >= a3 )\nbreak;\nif ( (unsigned int)__isoc99_sscanf() != 1 )\n{\nfprintf(stderr, \"Incorrect hex byte: %c%c\\n\", (unsigned int)*a1, (unsigned int)a1[1]);\nexit(1);\n}\na1 += 2;\n}\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,sub_4015BC,]", "hints": "[]", "response": "{'a3': 'length', 'a1': 'str', 'a2': 'dest', 'sub_4015BC': 'str_to_hex'}"} | [
[
0.7682209014892578,
0.7540361285209656,
0.7499207258224487,
0.7397542595863342,
0.7361189126968384,
0.7356398105621338,
0.7264953255653381,
0.7042713165283203,
0.7027913331985474,
0.7025863528251648,
0.7007708549499512,
0.6992696523666382,
0.6969457864761353,
0.6940090656280518,
0.6898154616355896,
0.689659833908081,
0.6776627898216248,
0.6775813102722168,
0.677150309085846,
0.6752821207046509
],
[
229675,
88620,
232028,
187998,
204693,
93702,
23845,
255822,
239706,
207780,
57268,
56411,
50567,
131219,
182677,
54217,
47356,
148727,
251811,
210387
]
] |
|
di_compare | 59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd | microsoft | dsb | NA | int
di_compare(const void *op1, const void *op2)
{
d_idx_t *ie1 = (d_idx_t *)op1,
*ie2 = (d_idx_t *)op2;
return(strcasecmp(ie1->name, ie2->name));
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "compar", "function_addr": 4216213, "binary_name": "59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov rax, [rbp+var_18]"], [6, "mov [rbp+s1], rax"], [7, "mov rax, [rbp+var_20]"], [8, "mov [rbp+s2], rax"], [9, "mov rdx, [rbp+s2]"], [10, "mov rax, [rbp+s1]"], [11, "mov rsi, rdx"], [12, "mov rdi, rax"], [13, "call _strcasecmp"], [14, "leave"], [15, "retn"]], "data_dep": [[5, 3], [6, 5], [7, 4], [8, 7], [9, 8], [10, 6], [11, 9], [12, 10], [15, 13]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd_59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd.jsonl.gz", "strip_func_name": "compar", "query": "\n\n\nint __fastcall compar(const void *a1, const void *a2)\n{\nreturn strcasecmp((const char *)a1, (const char *)a2);\n}\n\n\n\nQ:[a1,a2,]", "hints": "[]", "response": "{'a1': 'op1', 'a2': 'op2'}"} | [
[
0.8853527903556824,
0.8739755153656006,
0.873470664024353,
0.8718202710151672,
0.8718110918998718,
0.8713638782501221,
0.8704260587692261,
0.8685932159423828,
0.8668258190155029,
0.8659909963607788,
0.8657244443893433,
0.8648034334182739,
0.8644245862960815,
0.8636124730110168,
0.8635245561599731,
0.8621830940246582,
0.8611661195755005,
0.860456645488739,
0.8598646521568298,
0.858207106590271
],
[
115948,
182497,
101494,
246851,
175126,
250415,
89896,
202408,
38121,
53793,
231171,
12945,
128118,
243898,
20763,
42645,
140096,
243606,
137724,
217659
]
] |
|
create_file | b0da503e2f389ee99f2233d8dd618577205250b48e518a43ed0a03d4970adb18 | MEGA65 | mega65-tools | NA | int create_file(int id, int size)
{
FILE *f = fopen(FILE_NAME, "wb+");
if (!f) {
fprintf(stderr, "ERROR: Failed to write to file '%s'\n", FILE_NAME);
exit(-1);
}
for (int i = 0; i < size; i++) {
fputc(CONTENT_EQUATION(id, i), f);
}
fclose(f);
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4011F2", "function_addr": 4198898, "binary_name": "b0da503e2f389ee99f2233d8dd618577205250b48e518a43ed0a03d4970adb18.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_14], edi"], [4, "mov [rbp+var_18], esi"], [5, "mov esi, offset modes"], [6, "mov edi, offset name"], [7, "call _fopen"], [8, "mov [rbp+stream], rax"], [9, "cmp [rbp+stream], 0"], [10, "jnz short loc_401242"], [11, "mov rax, cs:stderr"], [12, "mov edx, offset name"], [13, "mov esi, offset format"], [14, "mov rdi, rax"], [15, "mov eax, 0"], [16, "call _fprintf"], [17, "mov edi, 0FFFFFFFFh"], [18, "call _exit"], [19, "mov [rbp+var_4], 0"], [20, "jmp short loc_401278"], [21, "mov edx, [rbp+var_14]"], [22, "mov eax, [rbp+var_4]"], [23, "add edx, eax"], [24, "mov eax, [rbp+var_4]"], [25, "sar eax, 8"], [26, "add edx, eax"], [27, "mov eax, [rbp+var_4]"], [28, "sar eax, 10h"], [29, "add eax, edx"], [30, "movzx eax, al"], [31, "mov rdx, [rbp+stream]"], [32, "mov rsi, rdx"], [33, "mov edi, eax"], [34, "call _fputc"], [35, "add [rbp+var_4], 1"], [36, "mov eax, [rbp+var_4]"], [37, "cmp eax, [rbp+var_18]"], [38, "jl short loc_40124B"], [39, "mov rax, [rbp+stream]"], [40, "mov rdi, rax"], [41, "call _fclose"], [42, "mov eax, 0"], [43, "leave"], [44, "retn"]], "data_dep": [[8, 7], [9, 8], [10, 9], [14, 11], [21, 3], [22, 35], [22, 19], [23, 22], [23, 21], [24, 35], [24, 19], [25, 24], [26, 23], [26, 25], [27, 19], [27, 35], [28, 27], [29, 26], [29, 28], [30, 29], [31, 8], [32, 31], [33, 30], [35, 35], [35, 19], [36, 19], [36, 35], [37, 36], [37, 4], [38, 37], [39, 8], [40, 39], [44, 42]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/b0da503e2f389ee99f2233d8dd618577205250b48e518a43ed0a03d4970adb18_b0da503e2f389ee99f2233d8dd618577205250b48e518a43ed0a03d4970adb18.jsonl.gz", "strip_func_name": "sub_4011F2", "query": "\n\n\n__int64 __fastcall sub_4011F2(char a1, int a2)\n{\nFILE *stream; // [rsp+10h] [rbp-10h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nstream = fopen(\"TEST2.BIN\", \"wb+\");\nif ( !stream )\n{\nfprintf(stderr, \"ERROR: Failed to write to file '%s'\\n\", \"TEST2.BIN\");\nexit(-1);\n}\nfor ( i = 0; i < a2; ++i )\nfputc((unsigned __int8)(BYTE1(i) + i + a1 + BYTE2(i)), stream);\nfclose(stream);\nreturn 0LL;\n}\n\n\n\nQ:[a1,a2,stream,sub_4011F2,]", "hints": "[]", "response": "{'a1': 'id', 'a2': 'size', 'stream': 'f', 'sub_4011F2': 'create_file'}"} | [
[
0.7722681760787964,
0.7608263492584229,
0.7531675696372986,
0.7477577328681946,
0.7351447939872742,
0.7331035137176514,
0.7330837249755859,
0.7277311086654663,
0.7264598608016968,
0.7219949960708618,
0.7188444137573242,
0.7172427773475647,
0.7170481085777283,
0.716836154460907,
0.7149544358253479,
0.7143815159797668,
0.7141201496124268,
0.7117697596549988,
0.7106294631958008,
0.7101340889930725
],
[
238534,
147917,
46524,
17510,
142179,
34301,
16817,
39119,
4604,
1620,
143660,
93933,
127927,
200628,
164280,
153768,
12852,
15700,
58390,
241955
]
] |
|
add_rule | af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4 | rgerganov | nfqsed | NA | void add_rule(const char *rule_str)
{
char delim = rule_str[0];
char *pos = NULL;
int length = 0;
struct rule_t *rule;
if (strlen(rule_str) < 4) {
fprintf(stderr, "rule too short: %s\n", rule_str);
exit(1);
}
pos = strchr(rule_str+1, delim);
if (!pos) {
fprintf(stderr, "incorrect rule: %s\n", rule_str);
exit(1);
}
length = strlen(pos+1);
if (pos - rule_str - 1 != length) {
fprintf(stderr, "val1 and val2 must be the same length: %s\n", rule_str);
exit(1);
}
rule = malloc(sizeof(struct rule_t));
rule->val1 = malloc(length);
memcpy(rule->val1, rule_str + 1, length);
rule->val2 = malloc(length);
memcpy(rule->val2, pos + 1, length);
rule->length = length;
rule->next = NULL;
if (rules) {
rule->next = rules;
rules = rule;
} else {
rules = rule;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4013FC", "function_addr": 4199420, "binary_name": "af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+s], rdi"], [4, "mov rax, [rbp+s]"], [5, "movzx eax, byte ptr [rax]"], [6, "mov [rbp+var_1], al"], [7, "mov [rbp+var_10], 0"], [8, "mov [rbp+var_14], 0"], [9, "mov rax, [rbp+s]"], [10, "mov rdi, rax"], [11, "call _strlen"], [12, "cmp rax, 3"], [13, "ja short loc_40145A"], [14, "mov rax, cs:stderr"], [15, "mov rdx, [rbp+s]"], [16, "mov esi, offset aRuleTooShortS"], [17, "mov rdi, rax"], [18, "mov eax, 0"], [19, "call _fprintf"], [20, "mov edi, 1"], [21, "call _exit"], [22, "movsx eax, [rbp+var_1]"], [23, "mov rdx, [rbp+s]"], [24, "add rdx, 1"], [25, "mov esi, eax"], [26, "mov rdi, rdx"], [27, "call _strchr"], [28, "mov [rbp+var_10], rax"], [29, "cmp [rbp+var_10], 0"], [30, "jnz short loc_4014A2"], [31, "mov rax, cs:stderr"], [32, "mov rdx, [rbp+s]"], [33, "mov esi, offset aIncorrectRuleS"], [34, "mov rdi, rax"], [35, "mov eax, 0"], [36, "call _fprintf"], [37, "mov edi, 1"], [38, "call _exit"], [39, "mov rax, [rbp+var_10]"], [40, "add rax, 1"], [41, "mov rdi, rax"], [42, "call _strlen"], [43, "mov [rbp+var_14], eax"], [44, "mov rax, [rbp+var_10]"], [45, "sub rax, [rbp+s]"], [46, "lea rdx, [rax-1]"], [47, "mov eax, [rbp+var_14]"], [48, "cdqe"], [49, "cmp rdx, rax"], [50, "jz short loc_4014F2"], [51, "mov rax, cs:stderr"], [52, "mov rdx, [rbp+s]"], [53, "mov esi, offset aVal1AndVal2Mus"], [54, "mov rdi, rax"], [55, "mov eax, 0"], [56, "call _fprintf"], [57, "mov edi, 1"], [58, "call _exit"], [59, "mov edi, 20h "], [60, "call _malloc"], [61, "mov [rbp+var_20], rax"], [62, "mov eax, [rbp+var_14]"], [63, "cdqe"], [64, "mov rdi, rax"], [65, "call _malloc"], [66, "mov rdx, rax"], [67, "mov rax, [rbp+var_20]"], [68, "mov [rax], rdx"], [69, "mov eax, [rbp+var_14]"], [70, "movsxd rdx, eax"], [71, "mov rax, [rbp+s]"], [72, "lea rcx, [rax+1]"], [73, "mov rax, [rbp+var_20]"], [74, "mov rax, [rax]"], [75, "mov rsi, rcx"], [76, "mov rdi, rax"], [77, "call _memcpy"], [78, "mov eax, [rbp+var_14]"], [79, "cdqe"], [80, "mov rdi, rax"], [81, "call _malloc"], [82, "mov rdx, rax"], [83, "mov rax, [rbp+var_20]"], [84, "mov [rax+8], rdx"], [85, "mov eax, [rbp+var_14]"], [86, "movsxd rdx, eax"], [87, "mov rax, [rbp+var_10]"], [88, "lea rcx, [rax+1]"], [89, "mov rax, [rbp+var_20]"], [90, "mov rax, [rax+8]"], [91, "mov rsi, rcx"], [92, "mov rdi, rax"], [93, "call _memcpy"], [94, "mov rax, [rbp+var_20]"], [95, "mov edx, [rbp+var_14]"], [96, "mov [rax+10h], edx"], [97, "mov rax, [rbp+var_20]"], [98, "mov qword ptr [rax+18h], 0"], [99, "mov rax, cs:qword_405170"], [100, "test rax, rax"], [101, "jz short loc_4015AE"], [102, "mov rdx, cs:qword_405170"], [103, "mov rax, [rbp+var_20]"], [104, "mov [rax+18h], rdx"], [105, "mov rax, [rbp+var_20]"], [106, "mov cs:qword_405170, rax"], [107, "jmp short loc_4015B9"], [108, "mov rax, [rbp+var_20]"], [109, "mov cs:qword_405170, rax"], [110, "nop"], [111, "leave"], [112, "retn"]], "data_dep": [[4, 3], [5, 4], [6, 5], [9, 3], [10, 9], [12, 11], [13, 12], [15, 3], [17, 14], [22, 6], [23, 3], [24, 23], [25, 22], [26, 24], [28, 27], [29, 28], [30, 29], [32, 3], [34, 31], [39, 28], [40, 39], [41, 40], [43, 42], [44, 28], [45, 3], [45, 44], [46, 45], [46, 24], [47, 43], [49, 46], [49, 47], [50, 49], [52, 3], [54, 51], [61, 60], [62, 43], [64, 62], [66, 65], [67, 61], [68, 66], [68, 67], [69, 43], [70, 69], [71, 3], [72, 68], [72, 71], [73, 61], [74, 73], [74, 68], [75, 72], [76, 74], [78, 43], [80, 78], [82, 81], [83, 61], [84, 83], [84, 82], [85, 43], [86, 85], [87, 28], [88, 72], [88, 87], [88, 84], [89, 61], [90, 89], [90, 84], [91, 88], [92, 90], [94, 61], [95, 43], [96, 95], [96, 94], [97, 61], [98, 97], [100, 99], [101, 100], [103, 61], [104, 102], [104, 103], [105, 61], [106, 105], [108, 61], [109, 108], [112, 108], [112, 105]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4_af49be92a1bdab7206b2187d7806b8321f130a844037ab713dd9daa5f84e75c4.jsonl.gz", "strip_func_name": "sub_4013FC", "query": "\n\n\nvoid **__fastcall sub_4013FC(const char *a1)\n{\nvoid **result; // rax\nvoid **v2; // [rsp+10h] [rbp-20h]\nint v3; // [rsp+1Ch] [rbp-14h]\nchar *v4; // [rsp+20h] [rbp-10h]\nchar v5; // [rsp+2Fh] [rbp-1h]\n\nv5 = *a1;\nif ( strlen(a1) <= 3 )\n{\nfprintf(stderr, \"rule too short: %s\\n\", a1);\nexit(1);\n}\nv4 = strchr(a1 + 1, v5);\nif ( !v4 )\n{\nfprintf(stderr, \"incorrect rule: %s\\n\", a1);\nexit(1);\n}\nv3 = strlen(v4 + 1);\nif ( v4 - a1 - 1 != v3 )\n{\nfprintf(stderr, \"val1 and val2 must be the same length: %s\\n\", a1);\nexit(1);\n}\nv2 = (void **)malloc(0x20uLL);\n*v2 = malloc(v3);\nmemcpy(*v2, a1 + 1, v3);\nv2[1] = malloc(v3);\nmemcpy(v2[1], v4 + 1, v3);\n*((_DWORD *)v2 + 4) = v3;\nv2[3] = 0LL;\nif ( qword_405170 )\nv2[3] = (void *)qword_405170;\nresult = v2;\nqword_405170 = (__int64)v2;\nreturn result;\n}\n\n\n\nQ:[a1,v2,v3,v4,v5,sub_4013FC,]", "hints": "[]", "response": "{'a1': 'rule_str', 'v2': 'rule', 'v3': 'length', 'v4': 'pos', 'v5': 'delim', 'sub_4013FC': 'add_rule'}"} | [
[
0.8313531279563904,
0.8058735728263855,
0.7926464080810547,
0.7809714078903198,
0.7798279523849487,
0.7705304622650146,
0.7657185792922974,
0.7597087621688843,
0.7542794942855835,
0.7537615299224854,
0.7507627010345459,
0.7506992816925049,
0.7487426996231079,
0.7463550567626953,
0.7454816102981567,
0.7436307668685913,
0.7436307668685913,
0.7408277988433838,
0.7399798035621643,
0.7376449108123779
],
[
113209,
257319,
71988,
159163,
241839,
224861,
141279,
188751,
53722,
137314,
167332,
27685,
65739,
66986,
53871,
19428,
81287,
179624,
39247,
82414
]
] |
|
read_msram_file | 56dfa417cb0243577844c2cc09f7018b6f313117d646e362a8cf9da09c47095b | peterbjornx | patchtools_pub | NA | void read_msram_file( patch_body_t *body, const char *filename ) {
char *ts;
FILE *file;
int addr, raddr;
int g;
uint32_t *groupbase;
file = fopen(filename, "r");
if ( !file ) {
perror( "Could not open MSRAM input file" );
exit( EXIT_FAILURE );
}
while ( fgets( line_buf, sizeof line_buf, file ) ) {
ts = strtok(line_buf, ": ");
if ( !ts )
continue;
addr = strtol( ts, NULL, 16 );
if ( addr % 8 ) {
fprintf( stderr, "Misaligned address in input :%08X\n",
addr );
exit( EXIT_FAILURE );
}
if ( addr < MSRAM_BASE_ADDRESS * 8 ) {
fprintf( stderr,
"Address not in MSRAM range :%08X\n",
addr );
exit( EXIT_FAILURE );
}
raddr = ( addr / 8 ) - MSRAM_BASE_ADDRESS;
if ( raddr >= MSRAM_GROUP_COUNT ) {
fprintf( stderr,
"Address not in MSRAM range :%08X\n", addr );
exit( EXIT_FAILURE );
}
groupbase = body->msram + MSRAM_GROUP_SIZE * raddr;
for ( g = 0; g < MSRAM_GROUP_SIZE; g++ ) {
ts = strtok(NULL, " ");
if ( !ts ) {
fprintf( stderr,
"Incomplete data for address %04X",
raddr );
exit( EXIT_FAILURE );
}
groupbase[g] = strtol( ts, NULL, 16 );
}
}
fclose( file );
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40352E", "function_addr": 4207918, "binary_name": "56dfa417cb0243577844c2cc09f7018b6f313117d646e362a8cf9da09c47095b.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 40h"], [3, "mov [rbp+var_38], rdi"], [4, "mov [rbp+filename], rsi"], [5, "mov rax, [rbp+filename]"], [6, "mov esi, offset aR"], [7, "mov rdi, rax"], [8, "call _fopen"], [9, "mov [rbp+stream], rax"], [10, "cmp [rbp+stream], 0"], [11, "jnz loc_4036E2"], [12, "mov edi, offset aCouldNotOpenMs_0"], [13, "call _perror"], [14, "mov edi, 1"], [15, "call _exit"], [16, "mov esi, offset asc_404D18"], [17, "mov edi, offset byte_40A940"], [18, "call _strtok"], [19, "mov [rbp+nptr], rax"], [20, "cmp [rbp+nptr], 0"], [21, "jnz short loc_403591"], [22, "jmp loc_4036E2"], [23, "mov rax, [rbp+nptr]"], [24, "mov edx, 10h"], [25, "mov esi, 0"], [26, "mov rdi, rax"], [27, "call _strtol"], [28, "mov [rbp+var_1C], eax"], [29, "mov eax, [rbp+var_1C]"], [30, "and eax, 7"], [31, "test eax, eax"], [32, "jz short loc_4035DA"], [33, "mov rax, cs:stderr"], [34, "mov edx, [rbp+var_1C]"], [35, "mov esi, offset aMisalignedAddr"], [36, "mov rdi, rax"], [37, "mov eax, 0"], [38, "call _fprintf"], [39, "mov edi, 1"], [40, "call _exit"], [41, "cmp [rbp+var_1C], 7F57h"], [42, "jg short loc_403609"], [43, "mov rax, cs:stderr"], [44, "mov edx, [rbp+var_1C]"], [45, "mov esi, offset aAddressNotInMs"], [46, "mov rdi, rax"], [47, "mov eax, 0"], [48, "call _fprintf"], [49, "mov edi, 1"], [50, "call _exit"], [51, "mov eax, [rbp+var_1C]"], [52, "lea edx, [rax+7]"], [53, "test eax, eax"], [54, "cmovs eax, edx"], [55, "sar eax, 3"], [56, "sub eax, 0FEBh"], [57, "mov [rbp+var_20], eax"], [58, "cmp [rbp+var_20], 14h"], [59, "jle short loc_40364B"], [60, "mov rax, cs:stderr"], [61, "mov edx, [rbp+var_1C]"], [62, "mov esi, offset aAddressNotInMs_0"], [63, "mov rdi, rax"], [64, "mov eax, 0"], [65, "call _fprintf"], [66, "mov edi, 1"], [67, "call _exit"], [68, "mov rdx, [rbp+var_38]"], [69, "mov eax, [rbp+var_20]"], [70, "shl eax, 3"], [71, "cdqe"], [72, "shl rax, 2"], [73, "add rax, rdx"], [74, "mov [rbp+var_28], rax"], [75, "mov [rbp+var_4], 0"], [76, "jmp short loc_4036DC"], [77, "mov esi, offset asc_404B87"], [78, "mov edi, 0"], [79, "call _strtok"], [80, "mov [rbp+nptr], rax"], [81, "cmp [rbp+nptr], 0"], [82, "jnz short loc_4036AB"], [83, "mov rax, cs:stderr"], [84, "mov edx, [rbp+var_20]"], [85, "mov esi, offset aIncompleteData"], [86, "mov rdi, rax"], [87, "mov eax, 0"], [88, "call _fprintf"], [89, "mov edi, 1"], [90, "call _exit"], [91, "mov rax, [rbp+nptr]"], [92, "mov edx, 10h"], [93, "mov esi, 0"], [94, "mov rdi, rax"], [95, "call _strtol"], [96, "mov edx, [rbp+var_4]"], [97, "movsxd rdx, edx"], [98, "lea rcx, ds:0[rdx*4]"], [99, "mov rdx, [rbp+var_28]"], [100, "add rdx, rcx"], [101, "mov [rdx], eax"], [102, "add [rbp+var_4], 1"], [103, "cmp [rbp+var_4], 7"], [104, "jle short loc_40366B"], [105, "mov rax, [rbp+stream]"], [106, "mov rdx, rax"], [107, "mov esi, 1000h"], [108, "mov edi, offset byte_40A940"], [109, "call _fgets"], [110, "test rax, rax"], [111, "jnz loc_403572"], [112, "mov rax, [rbp+stream]"], [113, "mov rdi, rax"], [114, "call _fclose"], [115, "nop"], [116, "leave"], [117, "retn"]], "data_dep": [[5, 4], [7, 5], [9, 8], [10, 9], [11, 10], [19, 18], [20, 19], [21, 20], [23, 19], [26, 23], [28, 27], [29, 28], [30, 29], [31, 30], [32, 31], [34, 28], [36, 33], [41, 28], [42, 41], [44, 28], [46, 43], [51, 28], [52, 24], [52, 51], [52, 101], [53, 51], [54, 52], [54, 53], [55, 54], [56, 55], [57, 56], [58, 57], [59, 58], [61, 28], [63, 60], [68, 3], [69, 57], [70, 69], [72, 70], [73, 68], [73, 72], [74, 73], [80, 79], [81, 80], [82, 81], [84, 57], [86, 83], [91, 80], [94, 91], [96, 75], [96, 102], [97, 96], [98, 98], [99, 74], [100, 98], [100, 99], [101, 100], [101, 95], [102, 75], [102, 102], [103, 75], [103, 102], [104, 103], [105, 9], [106, 105], [110, 109], [111, 110], [112, 9], [113, 112], [117, 114]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/56dfa417cb0243577844c2cc09f7018b6f313117d646e362a8cf9da09c47095b_56dfa417cb0243577844c2cc09f7018b6f313117d646e362a8cf9da09c47095b.jsonl.gz", "strip_func_name": "sub_40352E", "query": "\n\n\nint __fastcall sub_40352E(__int64 a1, const char *a2)\n{\nint v3; // [rsp+20h] [rbp-20h]\nint v4; // [rsp+24h] [rbp-1Ch]\nconst char *nptr; // [rsp+28h] [rbp-18h]\nconst char *nptra; // [rsp+28h] [rbp-18h]\nFILE *stream; // [rsp+30h] [rbp-10h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nstream = fopen(a2, \"r\");\nif ( !stream )\n{\nperror(\"Could not open MSRAM input file\");\nexit(1);\n}\nwhile ( fgets(byte_40A940, 4096, stream) )\n{\nnptr = strtok(byte_40A940, \": \");\nif ( nptr )\n{\nv4 = strtol(nptr, 0LL, 16);\nif ( (v4 & 7) != 0 )\n{\nfprintf(stderr, \"Misaligned address in input :%08X\\n\", (unsigned int)v4);\nexit(1);\n}\nif ( v4 <= 32599 )\n{\nfprintf(stderr, \"Address not in MSRAM range :%08X\\n\", (unsigned int)v4);\nexit(1);\n}\nv3 = (v4 >> 3) - 4075;\nif ( v3 > 20 )\n{\nfprintf(stderr, \"Address not in MSRAM range :%08X\\n\", (unsigned int)v4);\nexit(1);\n}\nfor ( i = 0; i <= 7; ++i )\n{\nnptra = strtok(0LL, \" \");\nif ( !nptra )\n{\nfprintf(stderr, \"Incomplete data for address %04X\", (unsigned int)v3);\nexit(1);\n}\n*(_DWORD *)(4LL * i + a1 + 32LL * v3) = strtol(nptra, 0LL, 16);\n}\n}\n}\nreturn fclose(stream);\n}\n\n\n\nQ:[a1,a2,v3,v4,nptra,stream,i,sub_40352E,]", "hints": "[]", "response": "{'a1': 'body', 'a2': 'filename', 'v3': 'raddr', 'v4': 'addr', 'nptra': 'tsa', 'stream': 'file', 'i': 'g', 'sub_40352E': 'read_msram_file'}"} | [
[
0.7015538811683655,
0.6866379976272583,
0.6787985563278198,
0.6784622669219971,
0.6754095554351807,
0.671367883682251,
0.6686347126960754,
0.6675148010253906,
0.66644287109375,
0.6644203662872314,
0.664138913154602,
0.6614425182342529,
0.6605367660522461,
0.6605309247970581,
0.6602195501327515,
0.6570041179656982,
0.6566870808601379,
0.656406044960022,
0.6562840938568115,
0.6543756723403931
],
[
176698,
250826,
68167,
239464,
233553,
171926,
151594,
177706,
154507,
231308,
143767,
59754,
41711,
188483,
58563,
237114,
76255,
136033,
10149,
203716
]
] |
|
new_value | b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97 | marcobambini | gravity | NA | static int new_value (json_state * state,
json_value ** top, json_value ** root, json_value ** alloc,
json_type type)
{
json_value * value;
int values_size;
if (!state->first_pass)
{
value = *top = *alloc;
*alloc = (*alloc)->_reserved.next_alloc;
if (!*root)
*root = value;
switch (value->type)
{
case json_array:
if (value->u.array.length == 0)
break;
if (! (value->u.array.values = (json_value **) json_alloc
(state, value->u.array.length * sizeof (json_value *), 0)) )
{
return 0;
}
value->u.array.length = 0;
break;
case json_object:
if (value->u.object.length == 0)
break;
values_size = sizeof (*value->u.object.values) * value->u.object.length;
if (! (value->u.object.values = (json_object_entry *) json_alloc
(state, values_size + ((unsigned long) value->u.object.values), 0)) )
{
return 0;
}
value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size;
value->u.object.length = 0;
break;
case json_string:
if (! (value->u.string.ptr = (json_char *) json_alloc
(state, (value->u.string.length + 1) * sizeof (json_char), 0)) )
{
return 0;
}
value->u.string.length = 0;
break;
default:
break;
};
return 1;
}
if (! (value = (json_value *) json_alloc
(state, (unsigned long)(sizeof (json_value) + state->settings.value_extra), 1)))
{
return 0;
}
if (!*root)
*root = value;
value->type = type;
value->parent = *top;
#ifdef JSON_TRACK_SOURCE
value->line = state->cur_line;
value->col = state->cur_col;
#endif
if (*alloc)
(*alloc)->_reserved.next_alloc = value;
*alloc = *top = value;
return 1;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_45B8D9", "function_addr": 4569305, "binary_name": "b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 40h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_28], rdx"], [6, "mov [rbp+var_30], rcx"], [7, "mov [rbp+var_34], r8d"], [8, "mov rax, [rbp+var_18]"], [9, "mov eax, [rax+48h]"], [10, "test eax, eax"], [11, "jnz loc_45BABC"], [12, "mov rax, [rbp+var_30]"], [13, "mov rdx, [rax]"], [14, "mov rax, [rbp+var_20]"], [15, "mov [rax], rdx"], [16, "mov rax, [rbp+var_20]"], [17, "mov rax, [rax]"], [18, "mov [rbp+var_8], rax"], [19, "mov rax, [rbp+var_30]"], [20, "mov rax, [rax]"], [21, "mov rdx, [rax+20h]"], [22, "mov rax, [rbp+var_30]"], [23, "mov [rax], rdx"], [24, "mov rax, [rbp+var_28]"], [25, "mov rax, [rax]"], [26, "test rax, rax"], [27, "jnz short loc_45B946"], [28, "mov rax, [rbp+var_28]"], [29, "mov rdx, [rbp+var_8]"], [30, "mov [rax], rdx"], [31, "mov rax, [rbp+var_8]"], [32, "mov eax, [rax+8]"], [33, "cmp eax, 5"], [34, "jz loc_45BA5F"], [35, "cmp eax, 5"], [36, "ja loc_45BAAB"], [37, "cmp eax, 1"], [38, "jz short loc_45B9D0"], [39, "cmp eax, 2"], [40, "jnz loc_45BAAB"], [41, "mov rax, [rbp+var_8]"], [42, "mov eax, [rax+10h]"], [43, "test eax, eax"], [44, "jz loc_45BAAE"], [45, "mov rax, [rbp+var_8]"], [46, "mov eax, [rax+10h]"], [47, "mov eax, eax"], [48, "lea rcx, ds:0[rax*8]"], [49, "mov rax, [rbp+var_18]"], [50, "mov edx, 0"], [51, "mov rsi, rcx"], [52, "mov rdi, rax"], [53, "call sub_45B846"], [54, "mov rdx, [rbp+var_8]"], [55, "mov [rdx+18h], rax"], [56, "mov rax, [rbp+var_8]"], [57, "mov rax, [rax+18h]"], [58, "test rax, rax"], [59, "jnz short loc_45B9C0"], [60, "mov eax, 0"], [61, "jmp locret_45BB56"], [62, "mov rax, [rbp+var_8]"], [63, "mov dword ptr [rax+10h], 0"], [64, "jmp loc_45BAB2"], [65, "mov rax, [rbp+var_8]"], [66, "mov eax, [rax+10h]"], [67, "test eax, eax"], [68, "jz loc_45BAB1"], [69, "mov rax, [rbp+var_8]"], [70, "mov edx, [rax+10h]"], [71, "mov eax, edx"], [72, "add eax, eax"], [73, "add eax, edx"], [74, "shl eax, 3"], [75, "mov [rbp+var_C], eax"], [76, "mov eax, [rbp+var_C]"], [77, "movsxd rdx, eax"], [78, "mov rax, [rbp+var_8]"], [79, "mov rax, [rax+18h]"], [80, "lea rcx, [rdx+rax]"], [81, "mov rax, [rbp+var_18]"], [82, "mov edx, 0"], [83, "mov rsi, rcx"], [84, "mov rdi, rax"], [85, "call sub_45B846"], [86, "mov rdx, [rbp+var_8]"], [87, "mov [rdx+18h], rax"], [88, "mov rax, [rbp+var_8]"], [89, "mov rax, [rax+18h]"], [90, "test rax, rax"], [91, "jnz short loc_45BA37"], [92, "mov eax, 0"], [93, "jmp locret_45BB56"], [94, "mov rax, [rbp+var_8]"], [95, "add rax, 18h"], [96, "mov rdx, [rax]"], [97, "mov eax, [rbp+var_C]"], [98, "cdqe"], [99, "add rdx, rax"], [100, "mov rax, [rbp+var_8]"], [101, "mov [rax+20h], rdx"], [102, "mov rax, [rbp+var_8]"], [103, "mov dword ptr [rax+10h], 0"], [104, "jmp short loc_45BAB2"], [105, "mov rax, [rbp+var_8]"], [106, "mov eax, [rax+10h]"], [107, "add eax, 1"], [108, "mov ecx, eax"], [109, "mov rax, [rbp+var_18]"], [110, "mov edx, 0"], [111, "mov rsi, rcx"], [112, "mov rdi, rax"], [113, "call sub_45B846"], [114, "mov rdx, [rbp+var_8]"], [115, "mov [rdx+18h], rax"], [116, "mov rax, [rbp+var_8]"], [117, "mov rax, [rax+18h]"], [118, "test rax, rax"], [119, "jnz short loc_45BA9E"], [120, "mov eax, 0"], [121, "jmp locret_45BB56"], [122, "mov rax, [rbp+var_8]"], [123, "mov dword ptr [rax+10h], 0"], [124, "jmp short loc_45BAB2"], [125, "nop"], [126, "jmp short loc_45BAB2"], [127, "nop"], [128, "jmp short loc_45BAB2"], [129, "nop"], [130, "mov eax, 1"], [131, "jmp locret_45BB56"], [132, "mov rax, [rbp+var_18]"], [133, "mov rax, [rax+40h]"], [134, "lea rcx, [rax+28h]"], [135, "mov rax, [rbp+var_18]"], [136, "mov edx, 1"], [137, "mov rsi, rcx"], [138, "mov rdi, rax"], [139, "call sub_45B846"], [140, "mov [rbp+var_8], rax"], [141, "cmp [rbp+var_8], 0"], [142, "jnz short loc_45BAEE"], [143, "mov eax, 0"], [144, "jmp short locret_45BB56"], [145, "mov rax, [rbp+var_28]"], [146, "mov rax, [rax]"], [147, "test rax, rax"], [148, "jnz short loc_45BB05"], [149, "mov rax, [rbp+var_28]"], [150, "mov rdx, [rbp+var_8]"], [151, "mov [rax], rdx"], [152, "mov rax, [rbp+var_8]"], [153, "mov edx, [rbp+var_34]"], [154, "mov [rax+8], edx"], [155, "mov rax, [rbp+var_20]"], [156, "mov rdx, [rax]"], [157, "mov rax, [rbp+var_8]"], [158, "mov [rax], rdx"], [159, "mov rax, [rbp+var_30]"], [160, "mov rax, [rax]"], [161, "test rax, rax"], [162, "jz short loc_45BB38"], [163, "mov rax, [rbp+var_30]"], [164, "mov rax, [rax]"], [165, "mov rdx, [rbp+var_8]"], [166, "mov [rax+20h], rdx"], [167, "mov rax, [rbp+var_20]"], [168, "mov rdx, [rbp+var_8]"], [169, "mov [rax], rdx"], [170, "mov rax, [rbp+var_20]"], [171, "mov rdx, [rax]"], [172, "mov rax, [rbp+var_30]"], [173, "mov [rax], rdx"], [174, "mov eax, 1"], [175, "leave"], [176, "retn"]], "data_dep": [[8, 3], [9, 8], [10, 9], [11, 10], [12, 6], [13, 12], [14, 4], [15, 14], [15, 13], [16, 4], [17, 16], [17, 15], [18, 17], [19, 6], [20, 15], [20, 19], [21, 20], [21, 15], [22, 6], [23, 22], [23, 21], [24, 5], [25, 23], [25, 24], [26, 25], [27, 26], [28, 5], [29, 18], [30, 29], [30, 28], [31, 18], [32, 30], [32, 23], [32, 31], [32, 15], [33, 32], [34, 33], [35, 32], [36, 35], [37, 32], [38, 37], [39, 32], [40, 39], [41, 18], [42, 41], [42, 15], [42, 30], [42, 23], [43, 42], [44, 43], [45, 18], [46, 45], [46, 15], [46, 30], [46, 23], [46, 55], [47, 46], [49, 3], [51, 48], [52, 49], [54, 18], [55, 54], [55, 53], [56, 18], [57, 56], [57, 55], [58, 57], [59, 58], [62, 18], [63, 62], [65, 18], [66, 23], [66, 15], [66, 65], [66, 30], [67, 66], [68, 67], [69, 18], [70, 15], [70, 30], [70, 69], [70, 23], [70, 87], [71, 70], [72, 71], [73, 70], [73, 72], [74, 73], [75, 74], [76, 75], [77, 76], [78, 18], [79, 30], [79, 78], [79, 23], [79, 87], [79, 15], [80, 30], [80, 23], [80, 87], [80, 15], [80, 79], [81, 3], [83, 80], [84, 81], [86, 18], [87, 86], [87, 85], [88, 18], [89, 88], [89, 87], [90, 89], [91, 90], [94, 18], [95, 94], [96, 95], [96, 101], [96, 30], [96, 103], [96, 23], [96, 87], [96, 15], [97, 75], [99, 97], [99, 96], [100, 18], [101, 99], [101, 100], [102, 18], [103, 102], [105, 18], [106, 15], [106, 115], [106, 30], [106, 23], [106, 105], [107, 106], [108, 107], [109, 3], [111, 108], [112, 109], [114, 18], [115, 114], [115, 113], [116, 18], [117, 116], [117, 115], [118, 117], [119, 118], [122, 18], [123, 122], [132, 3], [133, 132], [134, 133], [135, 3], [137, 134], [138, 135], [140, 139], [141, 140], [142, 141], [145, 5], [146, 145], [147, 146], [148, 147], [149, 5], [150, 140], [151, 150], [151, 149], [152, 140], [153, 7], [154, 153], [154, 152], [155, 4], [156, 154], [156, 151], [156, 155], [157, 140], [158, 156], [158, 157], [159, 6], [160, 158], [160, 159], [161, 160], [162, 161], [163, 6], [164, 158], [164, 151], [164, 166], [164, 154], [164, 163], [165, 140], [166, 165], [166, 164], [167, 4], [168, 140], [169, 167], [169, 168], [170, 4], [171, 170], [171, 169], [172, 6], [173, 172], [173, 171], [176, 130], [176, 143], [176, 120], [176, 60], [176, 92], [176, 174]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97_b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97.jsonl.gz", "strip_func_name": "sub_45B8D9", "query": "\n\n\n__int64 __fastcall sub_45B8D9(__int64 a1, __int64 *a2, __int64 *a3, __int64 *a4, int a5)\n{\nunsigned int v5; // eax\n__int64 result; // rax\nint v10; // [rsp+34h] [rbp-Ch]\n__int64 v11; // [rsp+38h] [rbp-8h]\n__int64 v12; // [rsp+38h] [rbp-8h]\n\nif ( *(_DWORD *)(a1 + 72) )\n{\nv12 = sub_45B846(a1, *(_QWORD *)(a1 + 64) + 40LL, 1u);\nif ( v12 )\n{\nif ( !*a3 )\n*a3 = v12;\n*(_DWORD *)(v12 + 8) = a5;\n*(_QWORD *)v12 = *a2;\nif ( *a4 )\n*(_QWORD *)(*a4 + 32) = v12;\n*a2 = v12;\n*a4 = *a2;\nresult = 1LL;\n}\nelse\n{\nresult = 0LL;\n}\n}\nelse\n{\n*a2 = *a4;\nv11 = *a2;\n*a4 = *(_QWORD *)(*a4 + 32);\nif ( !*a3 )\n*a3 = v11;\nv5 = *(_DWORD *)(v11 + 8);\nif ( v5 == 5 )\n{\n*(_QWORD *)(v11 + 24) = sub_45B846(a1, (unsigned int)(*(_DWORD *)(v11 + 16) + 1), 0);\nif ( !*(_QWORD *)(v11 + 24) )\nreturn 0LL;\n*(_DWORD *)(v11 + 16) = 0;\n}\nelse if ( v5 <= 5 )\n{\nif ( v5 == 1 )\n{\nif ( *(_DWORD *)(v11 + 16) )\n{\nv10 = 24 * *(_DWORD *)(v11 + 16);\n*(_QWORD *)(v11 + 24) = sub_45B846(a1, v10 + *(_QWORD *)(v11 + 24), 0);\nif ( !*(_QWORD *)(v11 + 24) )\nreturn 0LL;\n*(_QWORD *)(v11 + 32) = v10 + *(_QWORD *)(v11 + 24);\n*(_DWORD *)(v11 + 16) = 0;\n}\n}\nelse if ( v5 == 2 && *(_DWORD *)(v11 + 16) )\n{\n*(_QWORD *)(v11 + 24) = sub_45B846(a1, 8LL * *(unsigned int *)(v11 + 16), 0);\nif ( !*(_QWORD *)(v11 + 24) )\nreturn 0LL;\n*(_DWORD *)(v11 + 16) = 0;\n}\n}\nresult = 1LL;\n}\nreturn result;\n}\n\n\n\nQ:[a3,a4,a1,a2,a5,v10,v12,sub_45B8D9,sub_45B846,]", "hints": "[]", "response": "{'a3': 'root', 'a4': 'alloc', 'a1': 'state', 'a2': 'top', 'a5': 'type', 'v10': 'values_size', 'v12': 'value', 'sub_45B8D9': 'new_value', 'sub_45B846': 'json_alloc'}"} | [
[
0.7152904868125916,
0.6984429359436035,
0.6901152729988098,
0.6856600642204285,
0.6853875517845154,
0.6839982271194458,
0.6839238405227661,
0.6826799511909485,
0.675826907157898,
0.6699485182762146,
0.66789710521698,
0.664879560470581,
0.6641980409622192,
0.6626833081245422,
0.6607217788696289,
0.6565433144569397,
0.6557243466377258,
0.6546996831893921,
0.6512901782989502,
0.6507261991500854
],
[
178247,
56705,
200094,
235398,
165083,
204461,
96861,
26935,
154759,
40843,
11523,
14025,
214098,
248073,
148698,
114913,
154982,
16595,
189301,
19688
]
] |
|
htoi | ae4ca2c32876c8e1872c092be1a2aebced40bb651c7c2b7d41dd8e449d171ef6 | aloksinha2001 | Linux3188 | NA | static int htoi(char c)
{
if (c >= 'a' && c <= 'f') {
return (c - 'a' + 10);
}
if (c >= 'A' && c <= 'F') {
return (c - 'A' + 10);
}
if (c >= '0' && c <= '9') {
return (c - '0');
}
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401AC9", "function_addr": 4201161, "binary_name": "ae4ca2c32876c8e1872c092be1a2aebced40bb651c7c2b7d41dd8e449d171ef6.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov eax, edi"], [3, "mov [rbp+var_4], al"], [4, "cmp [rbp+var_4], 60h "], [5, "jle short loc_401AE7"], [6, "cmp [rbp+var_4], 66h "], [7, "jg short loc_401AE7"], [8, "movsx eax, [rbp+var_4]"], [9, "sub eax, 57h "], [10, "jmp short loc_401B16"], [11, "cmp [rbp+var_4], 40h "], [12, "jle short loc_401AFC"], [13, "cmp [rbp+var_4], 46h "], [14, "jg short loc_401AFC"], [15, "movsx eax, [rbp+var_4]"], [16, "sub eax, 37h "], [17, "jmp short loc_401B16"], [18, "cmp [rbp+var_4], 2Fh "], [19, "jle short loc_401B11"], [20, "cmp [rbp+var_4], 39h "], [21, "jg short loc_401B11"], [22, "movsx eax, [rbp+var_4]"], [23, "sub eax, 30h "], [24, "jmp short loc_401B16"], [25, "mov eax, 0"], [26, "pop rbp"], [27, "retn"]], "data_dep": [[3, 2], [4, 3], [5, 4], [6, 3], [7, 6], [8, 3], [9, 8], [11, 3], [12, 11], [13, 3], [14, 13], [15, 3], [16, 15], [18, 3], [19, 18], [20, 3], [21, 20], [22, 3], [23, 22], [26, 0], [27, 16], [27, 25], [27, 9], [27, 23]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/ae4ca2c32876c8e1872c092be1a2aebced40bb651c7c2b7d41dd8e449d171ef6_ae4ca2c32876c8e1872c092be1a2aebced40bb651c7c2b7d41dd8e449d171ef6.jsonl.gz", "strip_func_name": "sub_401AC9", "query": "\n\n\n__int64 __fastcall sub_401AC9(char a1)\n{\nif ( a1 > 96 && a1 <= 102 )\nreturn (unsigned int)(a1 - 87);\nif ( a1 > 64 && a1 <= 70 )\nreturn (unsigned int)(a1 - 55);\nif ( a1 <= 47 || a1 > 57 )\nreturn 0LL;\nreturn (unsigned int)(a1 - 48);\n}\n\n\n\nQ:[a1,sub_401AC9,]", "hints": "[]", "response": "{'a1': 'c', 'sub_401AC9': 'htoi'}"} | [
[
0.8900883197784424,
0.8815045356750488,
0.8790293335914612,
0.8746973872184753,
0.8715052604675293,
0.8702989220619202,
0.8696658611297607,
0.8672769069671631,
0.8657259345054626,
0.8652053475379944,
0.8611602783203125,
0.8604984283447266,
0.8584076166152954,
0.858173131942749,
0.8559005260467529,
0.8549890518188477,
0.8524388670921326,
0.8508352041244507,
0.8446289300918579,
0.8445569276809692
],
[
152332,
255994,
62566,
157575,
48525,
18387,
263939,
90113,
152036,
251145,
163938,
93722,
202383,
140672,
115616,
251464,
129369,
203844,
109720,
196418
]
] |
|
mei_init | 5344094cf97126c3fb7806ec8518450fc7cccda2d3265eb837ffbe6600a73e53 | mjg59 | mei-amt-check | NA | static bool mei_init(struct mei *me, const uuid_le *guid,
unsigned char req_protocol_version, bool verbose)
{
int result;
struct mei_client *cl;
struct mei_connect_client_data data;
char *errmsg;
me->verbose = verbose;
errmsg = "Cannot open /dev/mei0";
me->fd = open("/dev/mei0", O_RDWR);
if (me->fd == -1 && errno == ENOENT) {
errmsg = "Cannot open /dev/mei";
me->fd = open("/dev/mei", O_RDWR);
}
if (me->fd == -1) {
if (errno == ENOENT) {
fprintf(stderr, "Unable to find a Management Engine interface - run sudo modprobe mei_me and retry.\nIf you receive the same error, this system does not have AMT\n");
} else {
perror(errmsg);
}
goto err;
}
memcpy(&me->guid, guid, sizeof(*guid));
memset(&data, 0, sizeof(data));
me->initialized = true;
memcpy(&data.in_client_uuid, &me->guid, sizeof(me->guid));
result = ioctl(me->fd, IOCTL_MEI_CONNECT_CLIENT, &data);
if (result) {
mei_err(me, "Management Engine refused connection. This probably means you don't have AMT\n");
goto err;
}
cl = &data.out_client_properties;
mei_msg(me, "max_message_length %d\n", cl->max_msg_length);
mei_msg(me, "protocol_version %d\n", cl->protocol_version);
if ((req_protocol_version > 0) &&
(cl->protocol_version != req_protocol_version)) {
mei_err(me, "Intel MEI protocol version not supported\n");
goto err;
}
me->buf_size = cl->max_msg_length;
me->prot_ver = cl->protocol_version;
return true;
err:
mei_deinit(me);
return false;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401291", "function_addr": 4199057, "binary_name": "5344094cf97126c3fb7806ec8518450fc7cccda2d3265eb837ffbe6600a73e53.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 50h"], [3, "mov [rbp+var_38], rdi"], [4, "mov [rbp+var_40], rsi"], [5, "mov eax, ecx"], [6, "mov [rbp+var_44], dl"], [7, "mov [rbp+var_48], al"], [8, "mov rax, [rbp+var_38]"], [9, "movzx edx, [rbp+var_48]"], [10, "mov [rax+11h], dl"], [11, "mov [rbp+s], offset aCannotOpenDevM"], [12, "mov esi, 2"], [13, "mov edi, offset file"], [14, "mov eax, 0"], [15, "call _open"], [16, "mov rdx, [rbp+var_38]"], [17, "mov [rdx+1Ch], eax"], [18, "mov rax, [rbp+var_38]"], [19, "mov eax, [rax+1Ch]"], [20, "cmp eax, 0FFFFFFFFh"], [21, "jnz short loc_401312"], [22, "call ___errno_location"], [23, "mov eax, [rax]"], [24, "cmp eax, 2"], [25, "jnz short loc_401312"], [26, "mov [rbp+s], offset aCannotOpenDevM_0"], [27, "mov esi, 2"], [28, "mov edi, offset aDevMei"], [29, "mov eax, 0"], [30, "call _open"], [31, "mov rdx, [rbp+var_38]"], [32, "mov [rdx+1Ch], eax"], [33, "mov rax, [rbp+var_38]"], [34, "mov eax, [rax+1Ch]"], [35, "cmp eax, 0FFFFFFFFh"], [36, "jnz short loc_40135E"], [37, "call ___errno_location"], [38, "mov eax, [rax]"], [39, "cmp eax, 2"], [40, "jnz short loc_40134D"], [41, "mov rax, cs:stderr"], [42, "mov rcx, rax"], [43, "mov edx, 90h"], [44, "mov esi, 1"], [45, "mov edi, offset aUnableToFindAM"], [46, "call _fwrite"], [47, "jmp loc_4014A6"], [48, "mov rax, [rbp+s]"], [49, "mov rdi, rax"], [50, "call _perror"], [51, "jmp loc_4014A6"], [52, "mov rcx, [rbp+var_38]"], [53, "mov rax, [rbp+var_40]"], [54, "mov rdx, [rax+8]"], [55, "mov rax, [rax]"], [56, "mov [rcx], rax"], [57, "mov [rcx+8], rdx"], [58, "lea rax, [rbp+var_30]"], [59, "mov edx, 10h"], [60, "mov esi, 0"], [61, "mov rdi, rax"], [62, "call _memset"], [63, "mov rax, [rbp+var_38]"], [64, "mov byte ptr [rax+10h], 1"], [65, "mov rax, [rbp+var_38]"], [66, "mov rdx, [rax+8]"], [67, "mov rax, [rax]"], [68, "mov [rbp+var_30], rax"], [69, "mov [rbp+var_28], rdx"], [70, "mov rax, [rbp+var_38]"], [71, "mov eax, [rax+1Ch]"], [72, "lea rdx, [rbp+var_30]"], [73, "mov esi, 0C0104801h"], [74, "mov edi, eax"], [75, "mov eax, 0"], [76, "call _ioctl"], [77, "mov [rbp+var_C], eax"], [78, "cmp [rbp+var_C], 0"], [79, "jz short loc_4013ED"], [80, "mov rax, cs:stderr"], [81, "mov rcx, rax"], [82, "mov edx, 54h "], [83, "mov esi, 1"], [84, "mov edi, offset aErrorManagemen"], [85, "call _fwrite"], [86, "jmp loc_4014A6"], [87, "lea rax, [rbp+var_30]"], [88, "mov [rbp+var_18], rax"], [89, "mov rax, [rbp+var_38]"], [90, "movzx eax, byte ptr [rax+11h]"], [91, "test al, al"], [92, "jz short loc_401420"], [93, "mov rax, [rbp+var_18]"], [94, "mov edx, [rax]"], [95, "mov rax, cs:stderr"], [96, "mov esi, offset format"], [97, "mov rdi, rax"], [98, "mov eax, 0"], [99, "call _fprintf"], [100, "mov rax, [rbp+var_38]"], [101, "movzx eax, byte ptr [rax+11h]"], [102, "test al, al"], [103, "jz short loc_401450"], [104, "mov rax, [rbp+var_18]"], [105, "movzx eax, byte ptr [rax+4]"], [106, "movzx edx, al"], [107, "mov rax, cs:stderr"], [108, "mov esi, offset aProtocolVersio"], [109, "mov rdi, rax"], [110, "mov eax, 0"], [111, "call _fprintf"], [112, "cmp [rbp+var_44], 0"], [113, "jz short loc_401483"], [114, "mov rax, [rbp+var_18]"], [115, "movzx eax, byte ptr [rax+4]"], [116, "cmp [rbp+var_44], al"], [117, "jz short loc_401483"], [118, "mov rax, cs:stderr"], [119, "mov rcx, rax"], [120, "mov edx, 30h "], [121, "mov esi, 1"], [122, "mov edi, offset aErrorIntelMeiP"], [123, "call _fwrite"], [124, "jmp short loc_4014A6"], [125, "mov rax, [rbp+var_18]"], [126, "mov edx, [rax]"], [127, "mov rax, [rbp+var_38]"], [128, "mov [rax+14h], edx"], [129, "mov rax, [rbp+var_18]"], [130, "movzx edx, byte ptr [rax+4]"], [131, "mov rax, [rbp+var_38]"], [132, "mov [rax+18h], dl"], [133, "mov eax, 1"], [134, "jmp short locret_4014B7"], [135, "mov rax, [rbp+var_38]"], [136, "mov rdi, rax"], [137, "call sub_401242"], [138, "mov eax, 0"], [139, "leave"], [140, "retn"]], "data_dep": [[7, 5], [8, 3], [9, 7], [10, 8], [10, 9], [16, 3], [17, 16], [17, 15], [18, 3], [19, 18], [19, 17], [20, 19], [21, 20], [23, 22], [23, 17], [23, 10], [24, 23], [25, 24], [31, 3], [32, 30], [32, 31], [33, 3], [34, 10], [34, 32], [34, 33], [34, 17], [35, 34], [36, 35], [38, 32], [38, 17], [38, 10], [38, 37], [39, 38], [40, 39], [42, 41], [48, 26], [48, 11], [49, 48], [52, 3], [53, 4], [54, 17], [54, 10], [54, 53], [54, 64], [54, 57], [54, 32], [54, 56], [55, 57], [55, 56], [55, 17], [55, 53], [55, 10], [55, 32], [55, 64], [56, 55], [56, 52], [57, 52], [57, 54], [58, 55], [61, 58], [63, 3], [64, 63], [65, 3], [66, 64], [66, 65], [67, 65], [67, 64], [68, 67], [69, 66], [70, 3], [71, 64], [71, 70], [72, 66], [72, 68], [74, 71], [77, 76], [78, 77], [79, 78], [81, 80], [87, 68], [87, 76], [88, 87], [89, 3], [90, 17], [90, 10], [90, 32], [90, 89], [90, 64], [90, 57], [90, 56], [91, 90], [92, 91], [93, 88], [94, 32], [94, 64], [94, 57], [94, 93], [94, 56], [94, 17], [94, 10], [97, 95], [100, 3], [101, 17], [101, 10], [101, 32], [101, 64], [101, 57], [101, 100], [101, 56], [102, 101], [103, 102], [104, 88], [105, 56], [105, 104], [105, 17], [105, 10], [105, 32], [105, 64], [105, 57], [106, 105], [109, 107], [112, 6], [113, 112], [114, 88], [115, 32], [115, 64], [115, 57], [115, 114], [115, 56], [115, 17], [115, 10], [116, 6], [116, 115], [117, 116], [119, 118], [125, 88], [126, 64], [126, 128], [126, 57], [126, 32], [126, 132], [126, 125], [126, 17], [126, 56], [126, 10], [127, 3], [128, 126], [128, 127], [129, 88], [130, 128], [130, 129], [131, 3], [132, 130], [132, 131], [135, 3], [136, 135], [140, 138], [140, 133]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/5344094cf97126c3fb7806ec8518450fc7cccda2d3265eb837ffbe6600a73e53_5344094cf97126c3fb7806ec8518450fc7cccda2d3265eb837ffbe6600a73e53.jsonl.gz", "strip_func_name": "sub_401291", "query": "\n\n\n__int64 __fastcall sub_401291(__int64 a1, _QWORD *a2, char a3, char a4)\n{\n__int64 v4; // rdx\n__int64 v5; // rdx\n__int64 v8[3]; // [rsp+20h] [rbp-30h] BYREF\n__int64 *v9; // [rsp+38h] [rbp-18h]\nchar *s; // [rsp+48h] [rbp-8h]\n\n*(_BYTE *)(a1 + 17) = a4;\ns = \"Cannot open /dev/mei0\";\n*(_DWORD *)(a1 + 28) = open(\"/dev/mei0\", 2);\nif ( *(_DWORD *)(a1 + 28) == -1 && *__errno_location() == 2 )\n{\ns = \"Cannot open /dev/mei\";\n*(_DWORD *)(a1 + 28) = open(\"/dev/mei\", 2);\n}\nif ( *(_DWORD *)(a1 + 28) == -1 )\n{\nif ( *__errno_location() == 2 )\nfwrite(\n\"Unable to find a Management Engine interface - run sudo modprobe mei_me and retry.\\n\"\n\"If you receive the same error, this system does not have AMT\\n\",\n1uLL,\n0x90uLL,\nstderr);\nelse\nperror(s);\n}\nelse\n{\nv4 = a2[1];\n*(_QWORD *)a1 = *a2;\n*(_QWORD *)(a1 + 8) = v4;\nmemset(v8, 0, 0x10uLL);\n*(_BYTE *)(a1 + 16) = 1;\nv5 = *(_QWORD *)(a1 + 8);\nv8[0] = *(_QWORD *)a1;\nv8[1] = v5;\nif ( ioctl(*(_DWORD *)(a1 + 28), 0xC0104801uLL, v8) )\n{\nfwrite(\n\"Error: Management Engine refused connection. This probably means you don't have AMT\\n\",\n1uLL,\n0x54uLL,\nstderr);\n}\nelse\n{\nv9 = v8;\nif ( *(_BYTE *)(a1 + 17) )\nfprintf(stderr, \"max_message_length %d\\n\", *(unsigned int *)v9);\nif ( *(_BYTE *)(a1 + 17) )\nfprintf(stderr, \"protocol_version %d\\n\", *((unsigned __int8 *)v9 + 4));\nif ( !a3 || a3 == *((_BYTE *)v9 + 4) )\n{\n*(_DWORD *)(a1 + 20) = *(_DWORD *)v9;\n*(_BYTE *)(a1 + 24) = *((_BYTE *)v9 + 4);\nreturn 1LL;\n}\nfwrite(\"Error: Intel MEI protocol version not supported\\n\", 1uLL, 0x30uLL, stderr);\n}\n}\nsub_401242(a1);\nreturn 0LL;\n}\n\n\n\nQ:[a3,a4,a1,a2,v8,v9,s,sub_401291,sub_401242,]", "hints": "[]", "response": "{'a3': 'req_protocol_version', 'a4': 'verbose', 'a1': 'me', 'a2': 'guid', 'v8': 'data', 'v9': 'cl_0', 's': 'errmsg', 'sub_401291': 'mei_init', 'sub_401242': 'mei_deinit'}"} | [
[
0.7157484292984009,
0.7075594663619995,
0.6969161033630371,
0.6940549612045288,
0.6885305643081665,
0.6860372424125671,
0.666322648525238,
0.6649872064590454,
0.6626834869384766,
0.6508599519729614,
0.6489769816398621,
0.643210232257843,
0.6424456834793091,
0.6401364207267761,
0.6390790343284607,
0.638010561466217,
0.6351343393325806,
0.6350755095481873,
0.6348322629928589,
0.6324549913406372
],
[
134634,
249739,
241083,
54435,
126409,
164487,
246924,
14670,
123475,
221853,
118497,
108697,
152415,
23949,
237151,
26268,
62059,
176535,
122106,
203714
]
] |
|
dolog | ddefe5240a14ec5a73d48139ec3e3fdf28efcbbf9247937927ece70fa0892e6c | wongsyrone | lede-1 | NA | static void dolog(int severity, const char *fmt, ...)
{
va_list args;
char msg[1024];
char sev[10];
if (severity <= Verbosity) {
va_start(args, fmt);
vsnprintf(msg, sizeof(msg), fmt, args);
va_end(args);
switch (severity) {
case LOG_DEBUG:
snprintf(sev, sizeof(sev), "Debug");
break;
case LOG_VERBOSE:
snprintf(sev, sizeof(sev), "Verbose");
break;
case LOG_WARN:
snprintf(sev, sizeof(sev), "Warning");
break;
case LOG_ERR:
snprintf(sev, sizeof(sev), "Error");
break;
default:
snprintf(sev, sizeof(sev), "Unknown");
}
printf("jitterentropy-rngd - %s: %s\n", sev, msg);
}
if (LOG_ERR == severity) {
dealloc();
exit(1);
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4021A3", "function_addr": 4202915, "binary_name": "ddefe5240a14ec5a73d48139ec3e3fdf28efcbbf9247937927ece70fa0892e6c.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 500h"], [3, "mov [rbp+var_4F4], edi"], [4, "mov [rbp+format], rsi"], [5, "mov [rbp+var_A0], rdx"], [6, "mov [rbp+var_98], rcx"], [7, "mov [rbp+var_90], r8"], [8, "mov [rbp+var_88], r9"], [9, "test al, al"], [10, "jz short loc_4021FB"], [11, "movaps [rbp+var_80], xmm0"], [12, "movaps [rbp+var_70], xmm1"], [13, "movaps [rbp+var_60], xmm2"], [14, "movaps [rbp+var_50], xmm3"], [15, "movaps [rbp+var_40], xmm4"], [16, "movaps [rbp+var_30], xmm5"], [17, "movaps [rbp+var_20], xmm6"], [18, "movaps [rbp+var_10], xmm7"], [19, "mov rax, fs:28h"], [20, "mov [rbp+var_B8], rax"], [21, "xor eax, eax"], [22, "mov eax, cs:dword_407110"], [23, "cmp [rbp+var_4F4], eax"], [24, "jg loc_40237E"], [25, "mov [rbp+arg], 10h"], [26, "mov [rbp+var_4E4], 30h "], [27, "lea rax, [rbp+arg_0]"], [28, "mov [rbp+var_4E0], rax"], [29, "lea rax, [rbp+var_B0]"], [30, "mov [rbp+var_4D8], rax"], [31, "lea rcx, [rbp+arg]"], [32, "mov rdx, [rbp+format]"], [33, "lea rax, [rbp+s]"], [34, "mov esi, 400h"], [35, "mov rdi, rax"], [36, "call _vsnprintf"], [37, "cmp [rbp+var_4F4], 3"], [38, "jz short loc_4022B1"], [39, "cmp [rbp+var_4F4], 3"], [40, "jg loc_40233C"], [41, "cmp [rbp+var_4F4], 2"], [42, "jz short loc_4022D6"], [43, "cmp [rbp+var_4F4], 2"], [44, "jg loc_40233C"], [45, "cmp [rbp+var_4F4], 0"], [46, "jz short loc_40231A"], [47, "cmp [rbp+var_4F4], 1"], [48, "jz short loc_4022F8"], [49, "jmp loc_40233C"], [50, "lea rax, [rbp+var_4CA]"], [51, "lea rdx, aDebug"], [52, "mov esi, 0Ah"], [53, "mov rdi, rax"], [54, "mov eax, 0"], [55, "call _snprintf"], [56, "jmp loc_40235C"], [57, "lea rax, [rbp+var_4CA]"], [58, "lea rdx, aVerbose"], [59, "mov esi, 0Ah"], [60, "mov rdi, rax"], [61, "mov eax, 0"], [62, "call _snprintf"], [63, "jmp short loc_40235C"], [64, "lea rax, [rbp+var_4CA]"], [65, "lea rdx, aWarning"], [66, "mov esi, 0Ah"], [67, "mov rdi, rax"], [68, "mov eax, 0"], [69, "call _snprintf"], [70, "jmp short loc_40235C"], [71, "lea rax, [rbp+var_4CA]"], [72, "lea rdx, aError"], [73, "mov esi, 0Ah"], [74, "mov rdi, rax"], [75, "mov eax, 0"], [76, "call _snprintf"], [77, "jmp short loc_40235C"], [78, "lea rax, [rbp+var_4CA]"], [79, "lea rdx, aUnknown"], [80, "mov esi, 0Ah"], [81, "mov rdi, rax"], [82, "mov eax, 0"], [83, "call _snprintf"], [84, "lea rdx, [rbp+s]"], [85, "lea rax, [rbp+var_4CA]"], [86, "mov rsi, rax"], [87, "lea rdi, aJitterentropyR_1"], [88, "mov eax, 0"], [89, "call _printf"], [90, "cmp [rbp+var_4F4], 0"], [91, "jnz short loc_402396"], [92, "call sub_402CE0"], [93, "mov edi, 1"], [94, "call _exit"], [95, "nop"], [96, "mov rax, [rbp+var_B8]"], [97, "sub rax, fs:28h"], [98, "jz short locret_4023AE"], [99, "call ___stack_chk_fail"], [100, "leave"], [101, "retn"]], "data_dep": [[10, 9], [20, 19], [23, 22], [23, 3], [24, 23], [27, 22], [28, 27], [29, 27], [30, 29], [31, 25], [32, 4], [33, 29], [35, 33], [37, 3], [38, 37], [39, 3], [40, 39], [41, 3], [42, 41], [43, 3], [44, 43], [45, 3], [46, 45], [47, 3], [48, 47], [50, 36], [51, 32], [53, 50], [57, 36], [58, 32], [60, 57], [64, 36], [65, 32], [67, 64], [71, 36], [72, 32], [74, 71], [78, 36], [79, 32], [81, 78], [84, 65], [84, 58], [84, 79], [84, 51], [84, 72], [85, 55], [85, 76], [85, 69], [85, 62], [85, 83], [86, 85], [87, 74], [87, 67], [87, 60], [87, 81], [87, 53], [90, 3], [91, 90], [96, 20], [97, 96], [98, 97], [101, 97]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/ddefe5240a14ec5a73d48139ec3e3fdf28efcbbf9247937927ece70fa0892e6c_ddefe5240a14ec5a73d48139ec3e3fdf28efcbbf9247937927ece70fa0892e6c.jsonl.gz", "strip_func_name": "sub_4021A3", "query": "\n\n\nunsigned __int64 sub_4021A3(int a1, const char *a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list arg; // [rsp+18h] [rbp-4E8h] BYREF\nchar v8[10]; // [rsp+36h] [rbp-4CAh] BYREF\nchar s[1032]; // [rsp+40h] [rbp-4C0h] BYREF\nunsigned __int64 v10; // [rsp+448h] [rbp-B8h]\n__int64 v11; // [rsp+460h] [rbp-A0h]\n__int64 v12; // [rsp+468h] [rbp-98h]\n__int64 v13; // [rsp+470h] [rbp-90h]\n__int64 v14; // [rsp+478h] [rbp-88h]\n\nv11 = a3;\nv12 = a4;\nv13 = a5;\nv14 = a6;\nv10 = __readfsqword(0x28u);\nif ( a1 <= dword_407110 )\n{\narg[0].gp_offset = 16;\nva_start(arg, a6);\nvsnprintf(s, 0x400uLL, a2, arg);\nif ( a1 == 3 )\n{\nsnprintf(v8, 0xAuLL, \"Debug\");\n}\nelse\n{\nif ( a1 > 3 )\n{\nLABEL_12:\nsnprintf(v8, 0xAuLL, \"Unknown\");\ngoto LABEL_13;\n}\nif ( a1 == 2 )\n{\nsnprintf(v8, 0xAuLL, \"Verbose\");\n}\nelse if ( a1 )\n{\nif ( a1 != 1 )\ngoto LABEL_12;\nsnprintf(v8, 0xAuLL, \"Warning\");\n}\nelse\n{\nsnprintf(v8, 0xAuLL, \"Error\");\n}\n}\nLABEL_13:\nprintf(\"jitterentropy-rngd - %s: %s\\n\", v8, s);\n}\nif ( !a1 )\n{\nsub_402CE0();\nexit(1);\n}\nreturn v10 - __readfsqword(0x28u);\n}\n\n\n\nQ:[a1,a2,arg,v8,s,sub_4021A3,sub_402CE0,]", "hints": "[]", "response": "{'a1': 'severity', 'a2': 'fmt', 'arg': 'args', 'v8': 'sev', 's': 'msg', 'sub_4021A3': 'dolog', 'sub_402CE0': 'dealloc'}"} | [
[
0.7347129583358765,
0.7264183163642883,
0.7199235558509827,
0.7148210406303406,
0.70780348777771,
0.7031285166740417,
0.6975793838500977,
0.6935833692550659,
0.6902740597724915,
0.680954098701477,
0.676468014717102,
0.6734976172447205,
0.6706185340881348,
0.6704302430152893,
0.6698499917984009,
0.6681480407714844,
0.6630469560623169,
0.6623493432998657,
0.6604568362236023,
0.6598893404006958
],
[
235955,
31763,
84218,
210378,
227705,
184141,
26898,
4386,
122240,
162913,
103228,
12267,
236542,
16727,
217621,
199318,
237795,
236856,
244004,
263731
]
] |
|
i_write | 7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807 | arendst | Tasmota | NA | static int i_write(bvm *vm)
{
be_getmember(vm, 1, ".p");
if(be_iscomptr(vm, -1) && (be_isstring(vm, 2) || be_isbytes(vm, 2))) {
void *fh = be_tocomptr(vm, -1);
size_t size = 0;
const char *data = NULL;
if (be_isstring(vm, 2)) {
data = be_tostring(vm, 2);
size = be_strlen(vm, 2);
} else {
data = be_tobytes(vm, 2, &size);
}
be_fwrite(fh, data, size);
}
be_return_nil(vm);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_429DA9", "function_addr": 4365737, "binary_name": "7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_28], rdi"], [4, "mov rax, [rbp+var_28]"], [5, "mov edx, offset unk_444900"], [6, "mov esi, 1"], [7, "mov rdi, rax"], [8, "call be_getmember"], [9, "mov rax, [rbp+var_28]"], [10, "mov esi, 0FFFFFFFFh"], [11, "mov rdi, rax"], [12, "call be_iscomptr"], [13, "test al, al"], [14, "jz loc_429EAA"], [15, "mov rax, [rbp+var_28]"], [16, "mov esi, 2"], [17, "mov rdi, rax"], [18, "call be_isstring"], [19, "test al, al"], [20, "jnz short loc_429E12"], [21, "mov rax, [rbp+var_28]"], [22, "mov esi, 2"], [23, "mov rdi, rax"], [24, "call be_isbytes"], [25, "test al, al"], [26, "jz loc_429EAA"], [27, "mov rax, [rbp+var_28]"], [28, "mov esi, 0FFFFFFFFh"], [29, "mov rdi, rax"], [30, "call be_tocomptr"], [31, "mov [rbp+var_10], rax"], [32, "mov [rbp+var_18], 0"], [33, "mov [rbp+var_8], 0"], [34, "mov rax, [rbp+var_28]"], [35, "mov esi, 2"], [36, "mov rdi, rax"], [37, "call be_isstring"], [38, "test al, al"], [39, "jz short loc_429E7A"], [40, "mov rax, [rbp+var_28]"], [41, "mov esi, 2"], [42, "mov rdi, rax"], [43, "call be_tostring"], [44, "mov [rbp+var_8], rax"], [45, "mov rax, [rbp+var_28]"], [46, "mov esi, 2"], [47, "mov rdi, rax"], [48, "call be_strlen"], [49, "cdqe"], [50, "mov [rbp+var_18], rax"], [51, "jmp short loc_429E93"], [52, "lea rdx, [rbp+var_18]"], [53, "mov rax, [rbp+var_28]"], [54, "mov esi, 2"], [55, "mov rdi, rax"], [56, "call be_tobytes"], [57, "mov [rbp+var_8], rax"], [58, "mov rdx, [rbp+var_18]"], [59, "mov rcx, [rbp+var_8]"], [60, "mov rax, [rbp+var_10]"], [61, "mov rsi, rcx"], [62, "mov rdi, rax"], [63, "call be_fwrite"], [64, "mov rax, [rbp+var_28]"], [65, "mov rdi, rax"], [66, "call be_returnnilvalue"], [67, "leave"], [68, "retn"]], "data_dep": [[4, 3], [7, 4], [9, 3], [11, 9], [13, 12], [14, 13], [15, 3], [17, 15], [19, 18], [20, 19], [21, 3], [23, 21], [25, 24], [26, 25], [27, 3], [29, 27], [31, 30], [34, 3], [36, 34], [38, 37], [39, 38], [40, 3], [42, 40], [44, 43], [45, 3], [47, 45], [50, 48], [52, 5], [52, 32], [53, 3], [55, 53], [57, 56], [58, 50], [58, 32], [59, 57], [59, 44], [60, 31], [61, 59], [62, 60], [64, 3], [65, 64], [68, 66]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807_7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.jsonl.gz", "strip_func_name": "sub_429DA9", "query": "\n\n\n__int64 __fastcall sub_429DA9(__int64 a1)\n{\n__int64 v2; // [rsp+18h] [rbp-18h] BYREF\n__int64 v3; // [rsp+20h] [rbp-10h]\n__int64 v4; // [rsp+28h] [rbp-8h]\n\nbe_getmember(a1, 1u, (__int64)&unk_444900);\nif ( be_iscomptr(a1, 0xFFFFFFFF) && (be_isstring(a1, 2u) || (unsigned __int8)be_isbytes(a1, 2)) )\n{\nv3 = be_tocomptr(a1, 0xFFFFFFFF);\nv2 = 0LL;\nv4 = 0LL;\nif ( be_isstring(a1, 2u) )\n{\nv4 = be_tostring(a1, 2u);\nv2 = (int)be_strlen(a1, 2u);\n}\nelse\n{\nv4 = be_tobytes(a1, 2, &v2);\n}\nbe_fwrite(v3, v4, v2);\n}\nreturn be_returnnilvalue(a1);\n}\n\n\n\nQ:[a1,v2,v3,v4,sub_429DA9,]", "hints": "[]", "response": "{'a1': 'vm', 'v2': 'size', 'v3': 'fh', 'v4': 'data', 'sub_429DA9': 'i_write'}"} | [
[
0.814067006111145,
0.7970660328865051,
0.7909218072891235,
0.7818690538406372,
0.7750742435455322,
0.7674621343612671,
0.7607699632644653,
0.7559719681739807,
0.7551310658454895,
0.7524724006652832,
0.7523154616355896,
0.750393271446228,
0.7459633946418762,
0.744281530380249,
0.7425156831741333,
0.7415457963943481,
0.7382253408432007,
0.7234466075897217,
0.7229762077331543,
0.7202160954475403
],
[
253163,
50710,
34718,
1334,
203316,
157107,
234182,
114521,
205257,
163623,
195408,
81191,
131012,
194949,
179415,
1986,
173499,
92718,
178573,
222352
]
] |
|
m_atan | 7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807 | arendst | Tasmota | NA | static int m_atan(bvm *vm)
{
if (be_top(vm) >= 1 && be_isnumber(vm, 1)) {
breal x = be_toreal(vm, 1);
be_pushreal(vm, mathfunc(atan)(x));
} else {
be_pushreal(vm, (breal)0.0);
}
be_return(vm);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_427A36", "function_addr": 4356662, "binary_name": "7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov rax, [rbp+var_18]"], [5, "mov rdi, rax"], [6, "call be_top"], [7, "test eax, eax"], [8, "jle short loc_427AA1"], [9, "mov rax, [rbp+var_18]"], [10, "mov esi, 1"], [11, "mov rdi, rax"], [12, "call be_isnumber"], [13, "test al, al"], [14, "jz short loc_427AA1"], [15, "mov rax, [rbp+var_18]"], [16, "mov esi, 1"], [17, "mov rdi, rax"], [18, "call be_toreal"], [19, "movd eax, xmm0"], [20, "mov [rbp+x], eax"], [21, "mov eax, [rbp+x]"], [22, "movd xmm0, eax"], [23, "call _atanf"], [24, "movd eax, xmm0"], [25, "mov rdx, [rbp+var_18]"], [26, "movd xmm0, eax"], [27, "mov rdi, rdx"], [28, "call be_pushreal"], [29, "jmp short loc_427AB1"], [30, "mov rax, [rbp+var_18]"], [31, "pxor xmm0, xmm0"], [32, "mov rdi, rax"], [33, "call be_pushreal"], [34, "mov rax, [rbp+var_18]"], [35, "mov rdi, rax"], [36, "call be_returnvalue"], [37, "leave"], [38, "retn"]], "data_dep": [[4, 3], [5, 4], [7, 6], [8, 7], [9, 3], [11, 9], [13, 12], [14, 13], [15, 3], [17, 15], [20, 19], [21, 20], [22, 21], [24, 22], [25, 3], [26, 24], [27, 25], [30, 3], [32, 30], [34, 3], [35, 34], [38, 36]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807_7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.jsonl.gz", "strip_func_name": "sub_427A36", "query": "\n\n\n__int64 __fastcall sub_427A36(__int64 a1, __m128i a2)\n{\n__m128i v2; // xmm0\n\nif ( (int)be_top(a1) > 0 && be_isnumber(a1, 1u) )\n{\na2.m128i_u64[0] = (unsigned __int64)be_toreal(a1, 1u);\nv2 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(a2));\n*(float *)v2.m128i_i32 = atanf(*(float *)v2.m128i_i32);\nbe_pushreal(a1, COERCE_FLOAT(_mm_cvtsi128_si32(v2)));\n}\nelse\n{\nbe_pushreal(a1, 0.0);\n}\nreturn be_returnvalue(a1);\n}\n\n\n\nQ:[a1,sub_427A36,]", "hints": "[]", "response": "{'a1': 'vm', 'sub_427A36': 'm_atan'}"} | [
[
0.738968014717102,
0.7369297742843628,
0.7333179712295532,
0.7314159870147705,
0.7299368977546692,
0.7295361757278442,
0.7294656038284302,
0.7288851737976074,
0.7286841869354248,
0.728613555431366,
0.7274848222732544,
0.7257726192474365,
0.7238711714744568,
0.7235010862350464,
0.7222266793251038,
0.7222183346748352,
0.7214471101760864,
0.719113290309906,
0.7179593443870544,
0.7169447541236877
],
[
243776,
29063,
259240,
47277,
233921,
119522,
188973,
171576,
127430,
258100,
247074,
215476,
137038,
104708,
123404,
21993,
7804,
77905,
241351,
14015
]
] |
|
htable_insert | 89a9c1b8f9af20ca6897667f072aa5900d78d8b0e43ebee937509ffa8143ac6f | DNSPod | dnspod-sr | NA | int
htable_insert(struct htable *ht, struct hentry *he, int klen, int rpl)
{
uchar *key = he->key;
uchar *val = he->val;
hashval_t hash;
int ret, debug = DEBUG_TIMES;
uint idx, off;
struct hentry *cl = NULL;
struct hdata *hd = NULL; //slot header
struct mvalue *pt = NULL; //protect root and gtld
pt = (struct mvalue *) val;
if (pt->len > MAX_RECORD_SIZE)
return -1;
hash = ht->h(key, klen);
idx = hash & ht->mask;
off = (hash >> 32) & (MULTI_HASH - 1);
ht = ht + off;
hd = ht->table + idx;
pthread_mutex_lock(&hd->lock);
he->next = NULL;
if (hd->list == NULL)
hd->list = he;
else {
cl = hd->list;
while (cl != NULL) {
if ((ht->c) (cl->key, he->key) == 0) //the exactly same elements
{
printf("dup\n");
ret = -1; //drop
pthread_mutex_unlock(&hd->lock);
//free(he);
//rbt del
return ret; //replace
}
cl = cl->next;
debug--;
if (debug == 0) {
printf("error in storage2\n");
exit(0);
}
}
he->next = hd->list;
hd->list = he;
}
pthread_mutex_unlock(&hd->lock);
pthread_mutex_lock(&ht->lock);
ht->now++;
pthread_mutex_unlock(&ht->lock);
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402634", "function_addr": 4204084, "binary_name": "89a9c1b8f9af20ca6897667f072aa5900d78d8b0e43ebee937509ffa8143ac6f.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 70h"], [3, "mov [rbp+mutex], rdi"], [4, "mov [rbp+var_60], rsi"], [5, "mov [rbp+var_64], edx"], [6, "mov [rbp+var_68], ecx"], [7, "mov rax, [rbp+var_60]"], [8, "add rax, 38h "], [9, "mov [rbp+var_18], rax"], [10, "mov rax, [rbp+var_60]"], [11, "mov rax, [rax+28h]"], [12, "mov [rbp+var_20], rax"], [13, "mov [rbp+var_4], 64h "], [14, "mov [rbp+var_10], 0"], [15, "mov [rbp+var_28], 0"], [16, "mov [rbp+var_30], 0"], [17, "mov rax, [rbp+var_20]"], [18, "mov [rbp+var_30], rax"], [19, "mov rax, [rbp+var_30]"], [20, "mov eax, [rax]"], [21, "cmp eax, 0BB8h"], [22, "jbe short loc_4026A0"], [23, "mov eax, 0FFFFFFFFh"], [24, "jmp locret_402827"], [25, "mov rax, [rbp+mutex]"], [26, "mov rcx, [rax+40h]"], [27, "mov edx, [rbp+var_64]"], [28, "mov rax, [rbp+var_18]"], [29, "mov esi, edx"], [30, "mov rdi, rax"], [31, "call rcx"], [32, "mov [rbp+var_38], rax"], [33, "mov rax, [rbp+mutex]"], [34, "mov edx, [rax+34h]"], [35, "mov rax, [rbp+var_38]"], [36, "and eax, edx"], [37, "mov [rbp+var_3C], eax"], [38, "mov rax, [rbp+var_38]"], [39, "shr rax, 20h"], [40, "and eax, 7"], [41, "mov [rbp+var_40], eax"], [42, "mov edx, [rbp+var_40]"], [43, "mov rax, rdx"], [44, "shl rax, 2"], [45, "add rax, rdx"], [46, "shl rax, 4"], [47, "add [rbp+mutex], rax"], [48, "mov rax, [rbp+mutex]"], [49, "mov rcx, [rax+28h]"], [50, "mov edx, [rbp+var_3C]"], [51, "mov rax, rdx"], [52, "add rax, rax"], [53, "add rax, rdx"], [54, "shl rax, 4"], [55, "add rax, rcx"], [56, "mov [rbp+var_28], rax"], [57, "mov rax, [rbp+var_28]"], [58, "add rax, 8"], [59, "mov rdi, rax"], [60, "call _pthread_mutex_lock"], [61, "mov rax, [rbp+var_60]"], [62, "mov qword ptr [rax+30h], 0"], [63, "mov rax, [rbp+var_28]"], [64, "mov rax, [rax]"], [65, "test rax, rax"], [66, "jnz short loc_402744"], [67, "mov rax, [rbp+var_28]"], [68, "mov rdx, [rbp+var_60]"], [69, "mov [rax], rdx"], [70, "jmp loc_4027E9"], [71, "mov rax, [rbp+var_28]"], [72, "mov rax, [rax]"], [73, "mov [rbp+var_10], rax"], [74, "jmp short loc_4027C8"], [75, "mov rax, [rbp+mutex]"], [76, "mov rax, [rax+48h]"], [77, "mov rdx, [rbp+var_60]"], [78, "lea rcx, [rdx+38h]"], [79, "mov rdx, [rbp+var_10]"], [80, "add rdx, 38h "], [81, "mov rsi, rcx"], [82, "mov rdi, rdx"], [83, "call rax"], [84, "test eax, eax"], [85, "jnz short loc_40279E"], [86, "mov edi, offset aDup"], [87, "call _puts"], [88, "mov [rbp+var_44], 0FFFFFFFFh"], [89, "mov rax, [rbp+var_28]"], [90, "add rax, 8"], [91, "mov rdi, rax"], [92, "call _pthread_mutex_unlock"], [93, "mov eax, [rbp+var_44]"], [94, "jmp locret_402827"], [95, "mov rax, [rbp+var_10]"], [96, "mov rax, [rax+30h]"], [97, "mov [rbp+var_10], rax"], [98, "sub [rbp+var_4], 1"], [99, "cmp [rbp+var_4], 0"], [100, "jnz short loc_4027C8"], [101, "mov edi, offset aErrorInStorage_0"], [102, "call _puts"], [103, "mov edi, 0"], [104, "call _exit"], [105, "cmp [rbp+var_10], 0"], [106, "jnz short loc_402751"], [107, "mov rax, [rbp+var_28]"], [108, "mov rdx, [rax]"], [109, "mov rax, [rbp+var_60]"], [110, "mov [rax+30h], rdx"], [111, "mov rax, [rbp+var_28]"], [112, "mov rdx, [rbp+var_60]"], [113, "mov [rax], rdx"], [114, "mov rax, [rbp+var_28]"], [115, "add rax, 8"], [116, "mov rdi, rax"], [117, "call _pthread_mutex_unlock"], [118, "mov rax, [rbp+mutex]"], [119, "mov rdi, rax"], [120, "call _pthread_mutex_lock"], [121, "mov rax, [rbp+mutex]"], [122, "mov eax, [rax+38h]"], [123, "lea edx, [rax+1]"], [124, "mov rax, [rbp+mutex]"], [125, "mov [rax+38h], edx"], [126, "mov rax, [rbp+mutex]"], [127, "mov rdi, rax"], [128, "call _pthread_mutex_unlock"], [129, "mov eax, 0"], [130, "leave"], [131, "retn"]], "data_dep": [[7, 4], [8, 7], [9, 8], [10, 4], [11, 10], [12, 11], [17, 12], [18, 17], [19, 18], [20, 19], [21, 20], [22, 21], [25, 3], [26, 25], [27, 5], [28, 9], [29, 27], [30, 28], [31, 26], [32, 31], [33, 3], [34, 33], [35, 32], [36, 34], [36, 35], [37, 36], [38, 32], [39, 38], [40, 39], [41, 40], [42, 41], [43, 42], [44, 43], [45, 42], [45, 44], [46, 45], [47, 46], [47, 3], [48, 47], [49, 48], [50, 37], [51, 50], [52, 51], [53, 50], [53, 52], [54, 53], [55, 54], [55, 49], [56, 55], [57, 56], [58, 57], [59, 58], [61, 4], [62, 61], [63, 56], [64, 62], [64, 63], [65, 64], [66, 65], [67, 56], [68, 4], [69, 67], [69, 68], [71, 56], [72, 62], [72, 71], [73, 72], [75, 47], [76, 62], [76, 75], [77, 4], [78, 77], [78, 49], [78, 78], [78, 62], [79, 97], [79, 73], [80, 79], [81, 78], [82, 80], [83, 76], [84, 83], [85, 84], [89, 56], [90, 89], [91, 90], [93, 88], [95, 97], [95, 73], [96, 95], [96, 62], [97, 96], [98, 98], [98, 13], [99, 98], [100, 99], [105, 97], [105, 73], [106, 105], [107, 56], [108, 107], [108, 113], [108, 110], [108, 62], [109, 4], [110, 109], [110, 108], [111, 56], [112, 4], [113, 112], [113, 111], [114, 56], [115, 114], [116, 115], [118, 47], [119, 118], [121, 47], [122, 113], [122, 69], [122, 62], [122, 110], [122, 121], [122, 125], [123, 68], [123, 125], [123, 113], [123, 122], [123, 62], [123, 110], [123, 112], [123, 69], [124, 47], [125, 123], [125, 124], [126, 47], [127, 126], [131, 129], [131, 23], [131, 93]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/89a9c1b8f9af20ca6897667f072aa5900d78d8b0e43ebee937509ffa8143ac6f_89a9c1b8f9af20ca6897667f072aa5900d78d8b0e43ebee937509ffa8143ac6f.jsonl.gz", "strip_func_name": "sub_402634", "query": "\n\n\n__int64 __fastcall sub_402634(__int64 a1, __int64 a2, unsigned int a3)\n{\npthread_mutex_t *mutex; // [rsp+18h] [rbp-58h]\n__int64 v5; // [rsp+38h] [rbp-38h]\n__int64 v6; // [rsp+48h] [rbp-28h]\n__int64 v7; // [rsp+60h] [rbp-10h]\nint v8; // [rsp+6Ch] [rbp-4h]\n\nv8 = 100;\nif ( **(_DWORD **)(a2 + 40) > 0xBB8u )\nreturn 0xFFFFFFFFLL;\nv5 = (*(__int64 (__fastcall **)(__int64, _QWORD))(a1 + 64))(a2 + 56, a3);\nmutex = (pthread_mutex_t *)(80LL * (BYTE4(v5) & 7) + a1);\nv6 = mutex[1].__align + 48LL * (*(_DWORD *)(a1 + 52) & (unsigned int)v5);\npthread_mutex_lock((pthread_mutex_t *)(v6 + 8));\n*(_QWORD *)(a2 + 48) = 0LL;\nif ( *(_QWORD *)v6 )\n{\nv7 = *(_QWORD *)v6;\nwhile ( v7 )\n{\nif ( !((unsigned int (__fastcall *)(__int64, __int64))mutex[1].__list.__next)(v7 + 56, a2 + 56) )\n{\nputs(\"dup\");\npthread_mutex_unlock((pthread_mutex_t *)(v6 + 8));\nreturn 0xFFFFFFFFLL;\n}\nv7 = *(_QWORD *)(v7 + 48);\nif ( !--v8 )\n{\nputs(\"error in storage2\");\nexit(0);\n}\n}\n*(_QWORD *)(a2 + 48) = *(_QWORD *)v6;\n*(_QWORD *)v6 = a2;\n}\nelse\n{\n*(_QWORD *)v6 = a2;\n}\npthread_mutex_unlock((pthread_mutex_t *)(v6 + 8));\npthread_mutex_lock(mutex);\n++mutex[1].__kind;\npthread_mutex_unlock(mutex);\nreturn 0LL;\n}\n\n\n\nQ:[a3,a1,a2,mutex,v5,v6,v7,v8,sub_402634,]", "hints": "[]", "response": "{'a3': 'klen', 'a1': 'ht', 'a2': 'he', 'mutex': 'hta', 'v5': 'hash', 'v6': 'hd', 'v7': 'cl_0', 'v8': 'debug', 'sub_402634': 'htable_insert'}"} | [
[
0.7377029061317444,
0.7314871549606323,
0.7137314677238464,
0.7084189057350159,
0.7054641246795654,
0.7050922513008118,
0.704694390296936,
0.6966039538383484,
0.6948808431625366,
0.6929541826248169,
0.6899504065513611,
0.6889427900314331,
0.6888249516487122,
0.6837462186813354,
0.6791989207267761,
0.6767091155052185,
0.6755639910697937,
0.6748541593551636,
0.673713743686676,
0.6710915565490723
],
[
168762,
45989,
5894,
47032,
119282,
261570,
27480,
263476,
157345,
11110,
97881,
50717,
76297,
166588,
223482,
58735,
73586,
237990,
248351,
244681
]
] |
|
free_proto | 7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807 | arendst | Tasmota | NA | static void free_proto(bvm *vm, bgcobject *obj)
{
bproto *proto = cast_proto(obj);
gc_try (proto != NULL) {
be_free(vm, proto->upvals, proto->nupvals * sizeof(bupvaldesc));
be_free(vm, proto->ktab, proto->nconst * sizeof(bvalue));
be_free(vm, proto->ptab, proto->nproto * sizeof(bproto*));
be_free(vm, proto->code, proto->codesize * sizeof(binstruction));
#if BE_DEBUG_RUNTIME_INFO
be_free(vm, proto->lineinfo, proto->nlineinfo * sizeof(blineinfo));
#endif
#if BE_DEBUG_VAR_INFO
be_free(vm, proto->varinfo, proto->nvarinfo * sizeof(bvarinfo));
#endif
be_free(vm, proto, sizeof(bproto));
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_42C5D0", "function_addr": 4376016, "binary_name": "7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "cmp [rbp+var_20], 0"], [6, "jz short loc_42C5F9"], [7, "mov rax, [rbp+var_20]"], [8, "movzx eax, byte ptr [rax+8]"], [9, "cmp al, 13h"], [10, "jnz short loc_42C5F9"], [11, "mov rax, [rbp+var_20]"], [12, "jmp short loc_42C5FE"], [13, "mov eax, 0"], [14, "mov [rbp+var_8], rax"], [15, "cmp [rbp+var_8], 0"], [16, "jz loc_42C6CC"], [17, "mov rax, [rbp+var_8]"], [18, "movzx eax, byte ptr [rax+0Bh]"], [19, "movzx eax, al"], [20, "lea rdx, [rax+rax]"], [21, "mov rax, [rbp+var_8]"], [22, "mov rsi, [rax+18h]"], [23, "mov rax, [rbp+var_18]"], [24, "mov ecx, 0"], [25, "mov rdi, rax"], [26, "call be_realloc"], [27, "mov rax, [rbp+var_8]"], [28, "mov eax, [rax+44h]"], [29, "cdqe"], [30, "shl rax, 4"], [31, "mov rdx, rax"], [32, "mov rax, [rbp+var_8]"], [33, "mov rsi, [rax+20h]"], [34, "mov rax, [rbp+var_18]"], [35, "mov ecx, 0"], [36, "mov rdi, rax"], [37, "call be_realloc"], [38, "mov rax, [rbp+var_8]"], [39, "mov eax, [rax+48h]"], [40, "cdqe"], [41, "lea rdx, ds:0[rax*8]"], [42, "mov rax, [rbp+var_8]"], [43, "mov rsi, [rax+28h]"], [44, "mov rax, [rbp+var_18]"], [45, "mov ecx, 0"], [46, "mov rdi, rax"], [47, "call be_realloc"], [48, "mov rax, [rbp+var_8]"], [49, "mov eax, [rax+40h]"], [50, "cdqe"], [51, "lea rdx, ds:0[rax*4]"], [52, "mov rax, [rbp+var_8]"], [53, "mov rsi, [rax+30h]"], [54, "mov rax, [rbp+var_18]"], [55, "mov ecx, 0"], [56, "mov rdi, rax"], [57, "call be_realloc"], [58, "mov rsi, [rbp+var_8]"], [59, "mov rax, [rbp+var_18]"], [60, "mov ecx, 0"], [61, "mov edx, 58h "], [62, "mov rdi, rax"], [63, "call be_realloc"], [64, "nop"], [65, "leave"], [66, "retn"]], "data_dep": [[5, 4], [6, 5], [7, 4], [8, 7], [9, 8], [10, 9], [11, 4], [14, 13], [14, 11], [15, 14], [16, 15], [17, 14], [18, 17], [19, 18], [20, 19], [21, 14], [22, 21], [23, 3], [25, 23], [27, 14], [28, 27], [30, 28], [31, 30], [32, 14], [33, 32], [34, 3], [36, 34], [38, 14], [39, 38], [41, 31], [42, 14], [43, 42], [44, 3], [46, 44], [48, 14], [49, 48], [51, 41], [52, 14], [53, 52], [54, 3], [56, 54], [58, 14], [59, 3], [62, 59], [66, 63], [66, 11], [66, 13]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807_7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.jsonl.gz", "strip_func_name": "sub_42C5D0", "query": "\n\n\nvoid **__fastcall sub_42C5D0(__int64 a1, void **a2)\n{\nvoid **result; // rax\nvoid **v3; // [rsp+18h] [rbp-8h]\n\nif ( a2 && *((_BYTE *)a2 + 8) == 19 )\nresult = a2;\nelse\nresult = 0LL;\nv3 = result;\nif ( result )\n{\nbe_realloc(a1, result[3], 2LL * *((unsigned __int8 *)result + 11), 0LL);\nbe_realloc(a1, v3[4], 16LL * *((int *)v3 + 17), 0LL);\nbe_realloc(a1, v3[5], 8LL * *((int *)v3 + 18), 0LL);\nbe_realloc(a1, v3[6], 4LL * *((int *)v3 + 16), 0LL);\nresult = (void **)be_realloc(a1, v3, 0x58uLL, 0LL);\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,v3,sub_42C5D0,]", "hints": "[]", "response": "{'a1': 'vm', 'a2': 'obj', 'v3': 'proto', 'sub_42C5D0': 'free_proto'}"} | [
[
0.7357215881347656,
0.7346324324607849,
0.7319791913032532,
0.7283375263214111,
0.7144526839256287,
0.7133997678756714,
0.712120532989502,
0.7077558040618896,
0.7033128142356873,
0.7024928331375122,
0.6996288299560547,
0.6982971429824829,
0.6979470252990723,
0.6957525610923767,
0.6922792196273804,
0.69049471616745,
0.6904736161231995,
0.6847540736198425,
0.6803836822509766,
0.6743330955505371
],
[
8159,
18540,
4840,
76152,
100371,
240358,
14051,
20444,
2737,
170941,
262593,
200191,
110110,
111862,
122269,
246474,
243337,
91067,
140530,
56815
]
] |
|
database_delete | f08c2850f027efd17ecdf12ab33387b1d801794d588afeef0f16b0085df45311 | skeeto | minimail | NA | int database_delete(struct database *db, int id)
{
CHECK(db, sqlite3_reset(db->del), -1);
CHECK(db, sqlite3_bind_int(db->del, 1, id), -1);
while (sqlite3_step(db->del) == SQLITE_ROW);
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_403AB8", "function_addr": 4209336, "binary_name": "f08c2850f027efd17ecdf12ab33387b1d801794d588afeef0f16b0085df45311.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 10h"], [3, "mov [rbp+var_8], rdi"], [4, "mov [rbp+var_C], esi"], [5, "mov rax, [rbp+var_8]"], [6, "mov rax, [rax+18h]"], [7, "mov rdi, rax"], [8, "call _sqlite3_reset"], [9, "test eax, eax"], [10, "jz short loc_403B0D"], [11, "mov rax, [rbp+var_8]"], [12, "mov rax, [rax]"], [13, "mov rdi, rax"], [14, "call _sqlite3_errmsg"], [15, "mov rdx, rax"], [16, "mov rax, cs:stderr"], [17, "mov esi, offset aSqlite3S"], [18, "mov rdi, rax"], [19, "mov eax, 0"], [20, "call _fprintf"], [21, "mov eax, 0FFFFFFFFh"], [22, "jmp short locret_403B76"], [23, "mov rax, [rbp+var_8]"], [24, "mov rax, [rax+18h]"], [25, "mov edx, [rbp+var_C]"], [26, "mov esi, 1"], [27, "mov rdi, rax"], [28, "call _sqlite3_bind_int"], [29, "test eax, eax"], [30, "jz short loc_403B5B"], [31, "mov rax, [rbp+var_8]"], [32, "mov rax, [rax]"], [33, "mov rdi, rax"], [34, "call _sqlite3_errmsg"], [35, "mov rdx, rax"], [36, "mov rax, cs:stderr"], [37, "mov esi, offset aSqlite3S"], [38, "mov rdi, rax"], [39, "mov eax, 0"], [40, "call _fprintf"], [41, "mov eax, 0FFFFFFFFh"], [42, "jmp short locret_403B76"], [43, "nop"], [44, "mov rax, [rbp+var_8]"], [45, "mov rax, [rax+18h]"], [46, "mov rdi, rax"], [47, "call _sqlite3_step"], [48, "cmp eax, 64h "], [49, "jz short loc_403B5C"], [50, "mov eax, 0"], [51, "leave"], [52, "retn"]], "data_dep": [[5, 3], [6, 5], [7, 6], [9, 8], [10, 9], [11, 3], [12, 11], [13, 12], [15, 14], [18, 16], [23, 3], [24, 23], [25, 4], [27, 24], [29, 28], [30, 29], [31, 3], [32, 31], [33, 32], [35, 34], [38, 36], [44, 3], [45, 44], [46, 45], [48, 47], [49, 48], [52, 21], [52, 41], [52, 50]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/f08c2850f027efd17ecdf12ab33387b1d801794d588afeef0f16b0085df45311_f08c2850f027efd17ecdf12ab33387b1d801794d588afeef0f16b0085df45311.jsonl.gz", "strip_func_name": "sub_403AB8", "query": "\n\n\n__int64 sub_403AB8()\n{\nconst char *v0; // rax\n__int64 result; // rax\n\nif ( (unsigned int)sqlite3_reset() || (unsigned int)sqlite3_bind_int() )\n{\nv0 = (const char *)sqlite3_errmsg();\nfprintf(stderr, \"sqlite3: %s\\n\", v0);\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nwhile ( (unsigned int)sqlite3_step() == 100 )\n;\nresult = 0LL;\n}\nreturn result;\n}\n\n\n\nQ:[sub_403AB8,]", "hints": "[]", "response": "{'sub_403AB8': 'database_delete'}"} | [
[
0.7979404330253601,
0.7430341839790344,
0.7410876750946045,
0.7375665903091431,
0.7364237904548645,
0.7315104603767395,
0.7238717675209045,
0.7197986841201782,
0.7181641459465027,
0.7170358300209045,
0.7150446772575378,
0.7147506475448608,
0.7135938405990601,
0.7129001021385193,
0.7128317356109619,
0.7099690437316895,
0.7077449560165405,
0.7038254141807556,
0.7035244703292847,
0.7034137845039368
],
[
76175,
130908,
249405,
127237,
255710,
226444,
168185,
189472,
83924,
123853,
183088,
192821,
105075,
535,
23848,
17772,
224335,
42991,
1781,
240609
]
] |
|
strndecode | afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4 | michael-lazar | hn-gopher | NA | void strndecode(char *out, char *in, size_t outsize)
{
unsigned char c;
unsigned int i;
/* Loop through the input string */
while (--outsize) {
/* End of source? */
if (!(c = *in++)) break;
/* Parse %hex encoding */
if (c == '%' && strlen(in) >= 2) {
sscanf(in, "%2x", &i);
*out++ = i;
in += 2;
continue;
}
/* Parse #octal encoding */
if (c == '#' && strlen(in) >= 3) {
sscanf(in, "%3o", &i);
*out++ = i;
in += 3;
continue;
}
/* Copy non-encoded chars */
*out++ = c;
}
/* Zero-terminate output */
*out = '\0';
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4079D0", "function_addr": 4225488, "binary_name": "afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+s], rsi"], [5, "mov [rbp+var_28], rdx"], [6, "jmp loc_407AAF"], [7, "mov rax, [rbp+s]"], [8, "lea rdx, [rax+1]"], [9, "mov [rbp+s], rdx"], [10, "movzx eax, byte ptr [rax]"], [11, "mov [rbp+var_1], al"], [12, "cmp [rbp+var_1], 0"], [13, "jz loc_407AC1"], [14, "cmp [rbp+var_1], 25h "], [15, "jnz short loc_407A51"], [16, "mov rax, [rbp+s]"], [17, "mov rdi, rax"], [18, "call _strlen"], [19, "cmp rax, 1"], [20, "jbe short loc_407A51"], [21, "lea rdx, [rbp+var_8]"], [22, "mov rax, [rbp+s]"], [23, "mov esi, offset a2x"], [24, "mov rdi, rax"], [25, "mov eax, 0"], [26, "call ___isoc99_sscanf"], [27, "mov ecx, [rbp+var_8]"], [28, "mov rax, [rbp+var_18]"], [29, "lea rdx, [rax+1]"], [30, "mov [rbp+var_18], rdx"], [31, "mov edx, ecx"], [32, "mov [rax], dl"], [33, "add [rbp+s], 2"], [34, "jmp short loc_407AAF"], [35, "cmp [rbp+var_1], 23h "], [36, "jnz short loc_407A9D"], [37, "mov rax, [rbp+s]"], [38, "mov rdi, rax"], [39, "call _strlen"], [40, "cmp rax, 2"], [41, "jbe short loc_407A9D"], [42, "lea rdx, [rbp+var_8]"], [43, "mov rax, [rbp+s]"], [44, "mov esi, offset a3o_0"], [45, "mov rdi, rax"], [46, "mov eax, 0"], [47, "call ___isoc99_sscanf"], [48, "mov ecx, [rbp+var_8]"], [49, "mov rax, [rbp+var_18]"], [50, "lea rdx, [rax+1]"], [51, "mov [rbp+var_18], rdx"], [52, "mov edx, ecx"], [53, "mov [rax], dl"], [54, "add [rbp+s], 3"], [55, "jmp short loc_407AAF"], [56, "mov rax, [rbp+var_18]"], [57, "lea rdx, [rax+1]"], [58, "mov [rbp+var_18], rdx"], [59, "movzx edx, [rbp+var_1]"], [60, "mov [rax], dl"], [61, "sub [rbp+var_28], 1"], [62, "cmp [rbp+var_28], 0"], [63, "jnz loc_4079E9"], [64, "jmp short loc_407AC2"], [65, "nop"], [66, "mov rax, [rbp+var_18]"], [67, "mov byte ptr [rax], 0"], [68, "nop"], [69, "leave"], [70, "retn"]], "data_dep": [[7, 9], [7, 4], [7, 54], [7, 33], [8, 32], [8, 59], [8, 52], [8, 31], [8, 60], [8, 53], [8, 7], [9, 8], [10, 60], [10, 32], [10, 53], [10, 7], [11, 10], [12, 11], [13, 12], [14, 11], [15, 14], [16, 9], [17, 16], [19, 18], [20, 19], [21, 8], [22, 9], [24, 22], [28, 58], [28, 3], [28, 30], [28, 51], [29, 32], [29, 28], [29, 21], [29, 60], [29, 53], [30, 29], [31, 27], [32, 31], [32, 28], [33, 9], [35, 11], [36, 35], [37, 9], [38, 37], [40, 39], [41, 40], [42, 8], [43, 9], [45, 43], [49, 58], [49, 3], [49, 30], [49, 51], [50, 49], [50, 42], [50, 60], [50, 32], [50, 53], [51, 50], [52, 48], [53, 52], [53, 49], [54, 9], [56, 3], [56, 30], [56, 58], [56, 51], [57, 56], [57, 8], [57, 60], [57, 32], [57, 53], [58, 57], [59, 11], [60, 59], [60, 56], [61, 61], [61, 5], [62, 61], [63, 62], [66, 30], [66, 58], [66, 51], [66, 3], [67, 66], [70, 66]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4_afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.jsonl.gz", "strip_func_name": "sub_4079D0", "query": "\n\n\nchar *__fastcall sub_4079D0(char *a1, const char *a2, __int64 a3)\n{\nconst char *v3; // rax\nchar *v4; // rax\nchar *v5; // rax\nchar *v6; // rax\nchar *result; // rax\nchar v11; // [rsp+28h] [rbp-8h]\nchar v12; // [rsp+2Fh] [rbp-1h]\n\nwhile ( --a3 )\n{\nv3 = a2++;\nv12 = *v3;\nif ( !*v3 )\nbreak;\nif ( v12 == 37 && strlen(a2) > 1 )\n{\n__isoc99_sscanf();\nv4 = a1++;\n*v4 = v11;\na2 += 2;\n}\nelse if ( v12 == 35 && strlen(a2) > 2 )\n{\n__isoc99_sscanf();\nv5 = a1++;\n*v5 = v11;\na2 += 3;\n}\nelse\n{\nv6 = a1++;\n*v6 = v12;\n}\n}\nresult = a1;\n*a1 = 0;\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,v12,sub_4079D0,]", "hints": "[]", "response": "{'a3': 'outsize', 'a1': 'out', 'a2': 'in', 'v12': 'c', 'sub_4079D0': 'strndecode'}"} | [
[
0.7863503098487854,
0.740134060382843,
0.7368758916854858,
0.7316834926605225,
0.7175880670547485,
0.7174494862556458,
0.7118637561798096,
0.7092577219009399,
0.7084180116653442,
0.7064144611358643,
0.7027657628059387,
0.6997255682945251,
0.6985464692115784,
0.6952143907546997,
0.6941508650779724,
0.6934927701950073,
0.6934614181518555,
0.6921444535255432,
0.6918022036552429,
0.6850988268852234
],
[
42299,
135451,
120639,
253675,
19590,
227831,
12006,
57042,
151711,
212207,
234414,
15508,
263660,
6470,
187034,
196410,
164419,
60371,
7514,
10874
]
] |
|
Read | af2418bba405fbf5220b9940a54335ec3975a39b83ee1982a79ca109415bc88a | xlucn | PAT | NA | void Read(Graph G)
{
int nrescue;
for (int i = 0; i < G->nvertex; i++) {
Vertex v = G->vs + i;
scanf("%d", &nrescue);
v->known = 0;
v->dist = Inf;
v->nrescue = nrescue;
v->totrescue = nrescue;
v->npath = 0;
v->adj = NULL;
}
int id1, id2, length;
for (int i = 0; i < G->nadj; i++) {
scanf("%d %d %d", &id1, &id2, &length);
/* From id1 to id2 */
Adj e = G->es + i;
e->id = id2;
e->length = length;
e->iter = G->vs[id1].adj;
G->vs[id1].adj = e;
/* The other direction */
e++, i++;
e->id = id1;
e->length = length;
e->iter = G->vs[id2].adj;
G->vs[id2].adj = e;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401142", "function_addr": 4198722, "binary_name": "af2418bba405fbf5220b9940a54335ec3975a39b83ee1982a79ca109415bc88a.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 40h"], [3, "mov [rbp+var_38], rdi"], [4, "mov [rbp+var_4], 0"], [5, "jmp short loc_4011C8"], [6, "mov rax, [rbp+var_38]"], [7, "mov rdx, [rax]"], [8, "mov eax, [rbp+var_4]"], [9, "cdqe"], [10, "shl rax, 5"], [11, "add rax, rdx"], [12, "mov [rbp+var_18], rax"], [13, "lea rax, [rbp+var_1C]"], [14, "mov rsi, rax"], [15, "mov edi, offset unk_402004"], [16, "mov eax, 0"], [17, "call ___isoc99_scanf"], [18, "mov rax, [rbp+var_18]"], [19, "mov dword ptr [rax], 0"], [20, "mov rax, [rbp+var_18]"], [21, "mov dword ptr [rax+4], 7FFFFFFFh"], [22, "mov edx, [rbp+var_1C]"], [23, "mov rax, [rbp+var_18]"], [24, "mov [rax+8], edx"], [25, "mov edx, [rbp+var_1C]"], [26, "mov rax, [rbp+var_18]"], [27, "mov [rax+0Ch], edx"], [28, "mov rax, [rbp+var_18]"], [29, "mov dword ptr [rax+10h], 0"], [30, "mov rax, [rbp+var_18]"], [31, "mov qword ptr [rax+18h], 0"], [32, "add [rbp+var_4], 1"], [33, "mov rax, [rbp+var_38]"], [34, "mov eax, [rax+10h]"], [35, "cmp [rbp+var_4], eax"], [36, "jl short loc_401157"], [37, "mov [rbp+var_8], 0"], [38, "jmp loc_4012BD"], [39, "lea rcx, [rbp+var_28]"], [40, "lea rdx, [rbp+var_24]"], [41, "lea rax, [rbp+var_20]"], [42, "mov rsi, rax"], [43, "mov edi, offset aDDD"], [44, "mov eax, 0"], [45, "call ___isoc99_scanf"], [46, "mov rax, [rbp+var_38]"], [47, "mov rdx, [rax+8]"], [48, "mov eax, [rbp+var_8]"], [49, "cdqe"], [50, "shl rax, 4"], [51, "add rax, rdx"], [52, "mov [rbp+var_10], rax"], [53, "mov edx, [rbp+var_24]"], [54, "mov rax, [rbp+var_10]"], [55, "mov [rax], edx"], [56, "mov edx, [rbp+var_28]"], [57, "mov rax, [rbp+var_10]"], [58, "mov [rax+4], edx"], [59, "mov rax, [rbp+var_38]"], [60, "mov rdx, [rax]"], [61, "mov eax, [rbp+var_20]"], [62, "cdqe"], [63, "shl rax, 5"], [64, "add rax, rdx"], [65, "mov rdx, [rax+18h]"], [66, "mov rax, [rbp+var_10]"], [67, "mov [rax+8], rdx"], [68, "mov rax, [rbp+var_38]"], [69, "mov rdx, [rax]"], [70, "mov eax, [rbp+var_20]"], [71, "cdqe"], [72, "shl rax, 5"], [73, "add rdx, rax"], [74, "mov rax, [rbp+var_10]"], [75, "mov [rdx+18h], rax"], [76, "add [rbp+var_10], 10h"], [77, "add [rbp+var_8], 1"], [78, "mov edx, [rbp+var_20]"], [79, "mov rax, [rbp+var_10]"], [80, "mov [rax], edx"], [81, "mov edx, [rbp+var_28]"], [82, "mov rax, [rbp+var_10]"], [83, "mov [rax+4], edx"], [84, "mov rax, [rbp+var_38]"], [85, "mov rdx, [rax]"], [86, "mov eax, [rbp+var_24]"], [87, "cdqe"], [88, "shl rax, 5"], [89, "add rax, rdx"], [90, "mov rdx, [rax+18h]"], [91, "mov rax, [rbp+var_10]"], [92, "mov [rax+8], rdx"], [93, "mov rax, [rbp+var_38]"], [94, "mov rdx, [rax]"], [95, "mov eax, [rbp+var_24]"], [96, "cdqe"], [97, "shl rax, 5"], [98, "add rdx, rax"], [99, "mov rax, [rbp+var_10]"], [100, "mov [rdx+18h], rax"], [101, "add [rbp+var_8], 1"], [102, "mov rax, [rbp+var_38]"], [103, "mov eax, [rax+14h]"], [104, "cmp [rbp+var_8], eax"], [105, "jl loc_4011E0"], [106, "nop"], [107, "nop"], [108, "leave"], [109, "retn"]], "data_dep": [[6, 3], [7, 19], [7, 21], [7, 27], [7, 29], [7, 31], [7, 6], [7, 24], [8, 32], [8, 4], [10, 8], [11, 7], [11, 10], [12, 11], [13, 11], [14, 13], [18, 12], [19, 18], [20, 12], [21, 20], [23, 12], [24, 23], [24, 22], [26, 12], [27, 26], [27, 25], [28, 12], [29, 28], [30, 12], [31, 30], [32, 32], [32, 4], [33, 3], [34, 19], [34, 21], [34, 27], [34, 29], [34, 31], [34, 24], [34, 33], [35, 32], [35, 4], [35, 34], [36, 35], [39, 39], [40, 98], [40, 25], [41, 103], [42, 41], [46, 3], [47, 80], [47, 55], [47, 27], [47, 75], [47, 100], [47, 29], [47, 31], [47, 58], [47, 24], [47, 19], [47, 83], [47, 92], [47, 46], [47, 67], [47, 21], [48, 37], [48, 101], [50, 48], [51, 50], [51, 47], [52, 51], [54, 52], [55, 54], [55, 53], [57, 52], [58, 56], [58, 57], [59, 3], [60, 55], [60, 59], [60, 58], [63, 61], [64, 63], [64, 60], [65, 31], [65, 58], [65, 64], [66, 52], [67, 65], [67, 66], [68, 3], [69, 67], [69, 55], [69, 68], [72, 70], [73, 69], [73, 72], [74, 52], [75, 74], [75, 73], [76, 52], [77, 37], [77, 101], [79, 76], [80, 78], [80, 79], [82, 76], [83, 82], [83, 81], [84, 3], [85, 84], [85, 83], [85, 80], [88, 86], [89, 88], [89, 85], [90, 83], [90, 89], [90, 31], [91, 76], [92, 90], [92, 91], [93, 3], [94, 80], [94, 93], [94, 92], [97, 95], [98, 94], [98, 97], [99, 76], [100, 98], [100, 99], [101, 77], [102, 3], [103, 102], [103, 31], [103, 58], [103, 67], [103, 24], [103, 19], [103, 83], [103, 92], [103, 55], [103, 21], [103, 80], [103, 27], [103, 100], [103, 75], [103, 29], [104, 37], [104, 101], [104, 103], [105, 104], [109, 103]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/af2418bba405fbf5220b9940a54335ec3975a39b83ee1982a79ca109415bc88a_af2418bba405fbf5220b9940a54335ec3975a39b83ee1982a79ca109415bc88a.jsonl.gz", "strip_func_name": "sub_401142", "query": "\n\n\n__int64 __fastcall sub_401142(__int64 a1)\n{\n__int64 result; // rax\nint v2; // [rsp+18h] [rbp-28h]\nint v3; // [rsp+1Ch] [rbp-24h]\nint v4; // [rsp+20h] [rbp-20h]\nint v5; // [rsp+24h] [rbp-1Ch]\n__int64 v6; // [rsp+28h] [rbp-18h]\n__int64 v7; // [rsp+30h] [rbp-10h]\nint j; // [rsp+38h] [rbp-8h]\nint i; // [rsp+3Ch] [rbp-4h]\n\nfor ( i = 0; i < *(_DWORD *)(a1 + 16); ++i )\n{\nv6 = *(_QWORD *)a1 + 32LL * i;\n__isoc99_scanf();\n*(_DWORD *)v6 = 0;\n*(_DWORD *)(v6 + 4) = 0x7FFFFFFF;\n*(_DWORD *)(v6 + 8) = v5;\n*(_DWORD *)(v6 + 12) = v5;\n*(_DWORD *)(v6 + 16) = 0;\n*(_QWORD *)(v6 + 24) = 0LL;\n}\nfor ( j = 0; ; j += 2 )\n{\nresult = *(unsigned int *)(a1 + 20);\nif ( j >= (int)result )\nbreak;\n__isoc99_scanf();\nv7 = *(_QWORD *)(a1 + 8) + 16LL * j;\n*(_DWORD *)v7 = v3;\n*(_DWORD *)(v7 + 4) = v2;\n*(_QWORD *)(v7 + 8) = *(_QWORD *)(*(_QWORD *)a1 + 32LL * v4 + 24);\n*(_QWORD *)(32LL * v4 + *(_QWORD *)a1 + 24) = v7;\nv7 += 16LL;\n*(_DWORD *)v7 = v4;\n*(_DWORD *)(v7 + 4) = v2;\n*(_QWORD *)(v7 + 8) = *(_QWORD *)(*(_QWORD *)a1 + 32LL * v3 + 24);\n*(_QWORD *)(32LL * v3 + *(_QWORD *)a1 + 24) = v7;\n}\nreturn result;\n}\n\n\n\nQ:[a1,v2,v3,v4,v5,v6,v7,j,sub_401142,]", "hints": "[]", "response": "{'a1': 'G', 'v2': 'length', 'v3': 'id2', 'v4': 'id1', 'v5': 'nrescue', 'v6': 'v', 'v7': 'e', 'j': 'i_0', 'sub_401142': 'Read'}"} | [
[
0.7101743817329407,
0.700291633605957,
0.6976649761199951,
0.6970349550247192,
0.695167601108551,
0.6871864795684814,
0.686731219291687,
0.6864995956420898,
0.6859469413757324,
0.6806312203407288,
0.670507550239563,
0.6671280860900879,
0.6626909971237183,
0.6625744700431824,
0.6595891118049622,
0.6585750579833984,
0.6558607816696167,
0.6550195813179016,
0.652855634689331,
0.6499151587486267
],
[
248655,
154213,
242247,
159519,
172199,
34315,
236222,
254955,
156599,
58594,
205559,
92009,
106384,
35185,
12456,
129837,
150821,
87546,
256058,
129146
]
] |
|
printn | e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d | CCareaga | useless | NA | int printn(cpu_t *cpu, int *ram, uint16_t type) {
int val = ram[++cpu->pc];
switch (type) {
case (ocode(L, 0, 0, 0)):
printf("%d", val);
break;
case (ocode(M, 0, 0, 0)):
printf("%d", ram[val]);
break;
case (ocode(R, 0, 0, 0)):
printf("%d", ram[ram[val]]);
break;
default:
return 0;
}
fflush(stdout);
return 1;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_403D5B", "function_addr": 4210011, "binary_name": "e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov eax, edx"], [6, "mov [rbp+var_24], ax"], [7, "mov rax, [rbp+var_18]"], [8, "mov eax, [rax]"], [9, "lea edx, [rax+1]"], [10, "mov rax, [rbp+var_18]"], [11, "mov [rax], edx"], [12, "mov rax, [rbp+var_18]"], [13, "mov eax, [rax]"], [14, "cdqe"], [15, "lea rdx, ds:0[rax*4]"], [16, "mov rax, [rbp+var_20]"], [17, "add rax, rdx"], [18, "mov eax, [rax]"], [19, "mov [rbp+var_4], eax"], [20, "movzx eax, [rbp+var_24]"], [21, "cmp eax, 4"], [22, "jz short loc_403DF9"], [23, "cmp eax, 4"], [24, "jg loc_403E35"], [25, "cmp eax, 1"], [26, "jz short loc_403DBA"], [27, "cmp eax, 2"], [28, "jz short loc_403DD0"], [29, "jmp short loc_403E35"], [30, "mov eax, [rbp+var_4]"], [31, "mov esi, eax"], [32, "mov edi, offset aD"], [33, "mov eax, 0"], [34, "call _printf"], [35, "jmp short loc_403E3C"], [36, "mov eax, [rbp+var_4]"], [37, "cdqe"], [38, "lea rdx, ds:0[rax*4]"], [39, "mov rax, [rbp+var_20]"], [40, "add rax, rdx"], [41, "mov eax, [rax]"], [42, "mov esi, eax"], [43, "mov edi, offset aD"], [44, "mov eax, 0"], [45, "call _printf"], [46, "jmp short loc_403E3C"], [47, "mov eax, [rbp+var_4]"], [48, "cdqe"], [49, "lea rdx, ds:0[rax*4]"], [50, "mov rax, [rbp+var_20]"], [51, "add rax, rdx"], [52, "mov eax, [rax]"], [53, "cdqe"], [54, "lea rdx, ds:0[rax*4]"], [55, "mov rax, [rbp+var_20]"], [56, "add rax, rdx"], [57, "mov eax, [rax]"], [58, "mov esi, eax"], [59, "mov edi, offset aD"], [60, "mov eax, 0"], [61, "call _printf"], [62, "jmp short loc_403E3C"], [63, "mov eax, 0"], [64, "jmp short locret_403E50"], [65, "mov rax, cs:stdout"], [66, "mov rdi, rax"], [67, "call _fflush"], [68, "mov eax, 1"], [69, "leave"], [70, "retn"]], "data_dep": [[6, 5], [7, 3], [8, 7], [9, 8], [10, 3], [11, 10], [11, 9], [12, 3], [13, 11], [13, 12], [15, 9], [16, 4], [17, 15], [17, 16], [18, 17], [18, 11], [19, 18], [20, 6], [21, 20], [22, 21], [23, 20], [24, 23], [25, 20], [26, 25], [27, 20], [28, 27], [30, 19], [31, 30], [36, 19], [38, 15], [39, 4], [40, 38], [40, 39], [41, 40], [41, 11], [42, 41], [47, 19], [49, 15], [50, 4], [51, 50], [51, 49], [52, 51], [52, 11], [54, 49], [55, 4], [56, 55], [56, 54], [57, 11], [57, 56], [58, 57], [66, 65], [70, 63], [70, 68]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d_e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d.jsonl.gz", "strip_func_name": "sub_403D5B", "query": "\n\n\n__int64 __fastcall sub_403D5B(_DWORD *a1, __int64 a2, unsigned __int16 a3)\n{\nunsigned int v4; // [rsp+2Ch] [rbp-4h]\n\nv4 = *(_DWORD *)(4LL * (int)++*a1 + a2);\nif ( a3 == 4 )\n{\nprintf(\"%d\", *(unsigned int *)(4LL * *(int *)(4LL * (int)v4 + a2) + a2));\n}\nelse\n{\nif ( a3 > 4u )\nreturn 0LL;\nif ( a3 == 1 )\n{\nprintf(\"%d\", v4);\n}\nelse\n{\nif ( a3 != 2 )\nreturn 0LL;\nprintf(\"%d\", *(unsigned int *)(4LL * (int)v4 + a2));\n}\n}\nfflush(stdout);\nreturn 1LL;\n}\n\n\n\nQ:[a3,a1,a2,v4,sub_403D5B,]", "hints": "[]", "response": "{'a3': 'type', 'a1': 'cpu', 'a2': 'ram', 'v4': 'val', 'sub_403D5B': 'printn'}"} | [
[
0.695618212223053,
0.6609669327735901,
0.6458551287651062,
0.6383601427078247,
0.6372123956680298,
0.6275683641433716,
0.627005398273468,
0.6267004013061523,
0.6234315037727356,
0.6228715777397156,
0.6214107871055603,
0.620543897151947,
0.6194360256195068,
0.6190552115440369,
0.6189709305763245,
0.6187429428100586,
0.6179320812225342,
0.6163991689682007,
0.6155258417129517,
0.6138677000999451
],
[
228963,
136589,
41608,
194934,
222721,
234842,
192064,
202150,
75678,
149930,
27615,
241621,
95314,
175433,
164811,
176946,
207279,
129758,
15498,
180954
]
] |
|
get_running_pid | bbf4fd34a1479faeba7f018ea496cd01e0b532574e364040d6ff27ec9550ed62 | ncopa | pingu | NA | static pid_t get_running_pid(void) {
size_t n;
int fd;
char buf[32] = "/proc/";
fd = open(pid_file, O_RDONLY);
if (fd < 0)
return 0;
n = read(fd, &buf[6], sizeof(buf)-7);
close(fd);
if (n < sizeof(buf)-6)
buf[5+n] = '\0'; /* chomp newline */
if (access(buf, R_OK) == 0)
return atoi(&buf[6]);
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4036C7", "function_addr": 4208327, "binary_name": "bbf4fd34a1479faeba7f018ea496cd01e0b532574e364040d6ff27ec9550ed62.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov rax, 2F636F72702Fh"], [4, "mov edx, 0"], [5, "mov qword ptr [rbp+name], rax"], [6, "mov [rbp+var_28], rdx"], [7, "mov [rbp+var_20], 0"], [8, "mov [rbp+var_18], 0"], [9, "mov rax, cs:file"], [10, "mov esi, 0"], [11, "mov rdi, rax"], [12, "mov eax, 0"], [13, "call _open"], [14, "mov [rbp+fd], eax"], [15, "cmp [rbp+fd], 0"], [16, "jns short loc_40371F"], [17, "mov eax, 0"], [18, "jmp short locret_403787"], [19, "lea rax, [rbp+name]"], [20, "lea rcx, [rax+6]"], [21, "mov eax, [rbp+fd]"], [22, "mov edx, 19h"], [23, "mov rsi, rcx"], [24, "mov edi, eax"], [25, "call _read"], [26, "mov [rbp+var_10], rax"], [27, "mov eax, [rbp+fd]"], [28, "mov edi, eax"], [29, "call _close"], [30, "cmp [rbp+var_10], 19h"], [31, "ja short loc_40375B"], [32, "mov rax, [rbp+var_10]"], [33, "add rax, 5"], [34, "mov [rbp+rax+name], 0"], [35, "lea rax, [rbp+name]"], [36, "mov esi, 4"], [37, "mov rdi, rax"], [38, "call _access"], [39, "test eax, eax"], [40, "jnz short loc_403782"], [41, "lea rax, [rbp+name]"], [42, "add rax, 6"], [43, "mov rdi, rax"], [44, "call _atoi"], [45, "jmp short locret_403787"], [46, "mov eax, 0"], [47, "leave"], [48, "retn"]], "data_dep": [[5, 3], [6, 4], [11, 9], [14, 13], [15, 14], [16, 15], [19, 5], [19, 13], [20, 19], [21, 14], [23, 20], [24, 21], [26, 25], [27, 14], [28, 27], [30, 26], [31, 30], [32, 26], [33, 32], [34, 33], [35, 33], [35, 5], [35, 29], [37, 35], [39, 38], [40, 39], [41, 39], [41, 5], [42, 41], [43, 42], [48, 17], [48, 44], [48, 46]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/bbf4fd34a1479faeba7f018ea496cd01e0b532574e364040d6ff27ec9550ed62_bbf4fd34a1479faeba7f018ea496cd01e0b532574e364040d6ff27ec9550ed62.jsonl.gz", "strip_func_name": "sub_4036C7", "query": "\n\n\nint sub_4036C7()\n{\nint result; // eax\nchar name[8]; // [rsp+0h] [rbp-30h] BYREF\n__int64 v2; // [rsp+8h] [rbp-28h]\n__int64 v3; // [rsp+10h] [rbp-20h]\n__int64 v4; // [rsp+18h] [rbp-18h]\nunsigned __int64 v5; // [rsp+20h] [rbp-10h]\nint fd; // [rsp+2Ch] [rbp-4h]\n\n*(_QWORD *)name = 0x2F636F72702FLL;\nv2 = 0LL;\nv3 = 0LL;\nv4 = 0LL;\nfd = open(file, 0);\nif ( fd < 0 )\nreturn 0;\nv5 = read(fd, &name[6], 0x19uLL);\nclose(fd);\nif ( v5 <= 0x19 )\nname[v5 + 5] = 0;\nif ( access(name, 4) )\nresult = 0;\nelse\nresult = atoi(&name[6]);\nreturn result;\n}\n\n\n\nQ:[name,v5,sub_4036C7,]", "hints": "[]", "response": "{'name': 'buf', 'v5': 'n', 'sub_4036C7': 'get_running_pid'}"} | [
[
0.7118604779243469,
0.6959714889526367,
0.6955112218856812,
0.6931750178337097,
0.6920385956764221,
0.6879321336746216,
0.6854946613311768,
0.6811776161193848,
0.6787307858467102,
0.6715428829193115,
0.6712042689323425,
0.6695516109466553,
0.6686235666275024,
0.6665730476379395,
0.6648552417755127,
0.6627933979034424,
0.6609060168266296,
0.6608847379684448,
0.6604653000831604,
0.6555562019348145
],
[
179114,
138831,
65608,
6918,
177192,
113405,
80368,
18801,
251385,
174007,
142615,
61378,
27733,
82685,
182998,
146446,
244812,
60327,
148869,
109265
]
] |
|
ora_descrypt | a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40 | vanhauser-thc | thc-hydra | NA | int32_t ora_descrypt(unsigned char **rs, unsigned char *result, int32_t siz) {
int32_t i = 0;
char lastkey[8];
DES_key_schedule ks1;
unsigned char key1[8] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
unsigned char ivec1[] = {0, 0, 0, 0, 0, 0, 0, 0};
unsigned char *desresult;
memset(ivec1, 0, sizeof(ivec1));
if ((desresult = malloc(siz)) == NULL) {
hydra_report(stderr, "[ERROR] Can't allocate memory\n");
return 1;
}
DES_key_sched((const_DES_cblock *)key1, &ks1);
DES_ncbc_encrypt(result, desresult, siz, &ks1, &ivec1, DES_ENCRYPT);
for (i = 0; i < 8; i++) {
lastkey[i] = desresult[siz - 8 + i];
}
DES_key_sched((const_DES_cblock *)lastkey, &ks1);
memset(desresult, 0, siz);
memset(ivec1, 0, sizeof(ivec1));
DES_ncbc_encrypt(result, desresult, siz, &ks1, &ivec1, DES_ENCRYPT);
if ((*rs = malloc(siz)) == NULL) {
hydra_report(stderr, "[ERROR] Can't allocate memory\n");
free(desresult);
return 1;
}
memcpy(*rs, desresult, siz);
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4365E9", "function_addr": 4417001, "binary_name": "a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 0D0h"], [3, "mov [rbp+var_B8], rdi"], [4, "mov [rbp+var_C0], rsi"], [5, "mov [rbp+var_C4], edx"], [6, "mov rax, fs:28h"], [7, "mov [rbp+var_8], rax"], [8, "xor eax, eax"], [9, "mov [rbp+var_AC], 0"], [10, "mov rax, 0EFCDAB8967452301h"], [11, "mov [rbp+var_18], rax"], [12, "mov [rbp+s], 0"], [13, "lea rax, [rbp+s]"], [14, "mov edx, 8"], [15, "mov esi, 0"], [16, "mov rdi, rax"], [17, "call _memset"], [18, "mov eax, [rbp+var_C4]"], [19, "cdqe"], [20, "mov rdi, rax"], [21, "call _malloc"], [22, "mov [rbp+ptr], rax"], [23, "cmp [rbp+ptr], 0"], [24, "jnz short loc_436696"], [25, "mov rax, cs:stderr"], [26, "mov rcx, rax"], [27, "mov edx, 1Eh"], [28, "mov esi, 1"], [29, "mov edi, offset aErrorCanTAlloc"], [30, "call _fwrite"], [31, "mov eax, 1"], [32, "jmp loc_436830"], [33, "lea rdx, [rbp+var_A0]"], [34, "lea rax, [rbp+var_18]"], [35, "mov rsi, rdx"], [36, "mov rdi, rax"], [37, "call _DES_key_sched"], [38, "mov eax, [rbp+var_C4]"], [39, "movsxd rdx, eax"], [40, "lea rdi, [rbp+s]"], [41, "lea rcx, [rbp+var_A0]"], [42, "mov rsi, [rbp+ptr]"], [43, "mov rax, [rbp+var_C0]"], [44, "mov r9d, 1"], [45, "mov r8, rdi"], [46, "mov rdi, rax"], [47, "call _DES_ncbc_encrypt"], [48, "mov [rbp+var_AC], 0"], [49, "jmp short loc_436721"], [50, "mov eax, [rbp+var_C4]"], [51, "lea edx, [rax-8]"], [52, "mov eax, [rbp+var_AC]"], [53, "add eax, edx"], [54, "movsxd rdx, eax"], [55, "mov rax, [rbp+ptr]"], [56, "add rax, rdx"], [57, "movzx eax, byte ptr [rax]"], [58, "mov edx, eax"], [59, "mov eax, [rbp+var_AC]"], [60, "cdqe"], [61, "mov [rbp+rax+var_20], dl"], [62, "add [rbp+var_AC], 1"], [63, "cmp [rbp+var_AC], 7"], [64, "jle short loc_4366EB"], [65, "lea rdx, [rbp+var_A0]"], [66, "lea rax, [rbp+var_20]"], [67, "mov rsi, rdx"], [68, "mov rdi, rax"], [69, "call _DES_key_sched"], [70, "mov eax, [rbp+var_C4]"], [71, "movsxd rdx, eax"], [72, "mov rax, [rbp+ptr]"], [73, "mov esi, 0"], [74, "mov rdi, rax"], [75, "call _memset"], [76, "lea rax, [rbp+s]"], [77, "mov edx, 8"], [78, "mov esi, 0"], [79, "mov rdi, rax"], [80, "call _memset"], [81, "mov eax, [rbp+var_C4]"], [82, "movsxd rdx, eax"], [83, "lea rdi, [rbp+s]"], [84, "lea rcx, [rbp+var_A0]"], [85, "mov rsi, [rbp+ptr]"], [86, "mov rax, [rbp+var_C0]"], [87, "mov r9d, 1"], [88, "mov r8, rdi"], [89, "mov rdi, rax"], [90, "call _DES_ncbc_encrypt"], [91, "mov eax, [rbp+var_C4]"], [92, "cdqe"], [93, "mov rdi, rax"], [94, "call _malloc"], [95, "mov rdx, rax"], [96, "mov rax, [rbp+var_B8]"], [97, "mov [rax], rdx"], [98, "mov rax, [rbp+var_B8]"], [99, "mov rax, [rax]"], [100, "test rax, rax"], [101, "jnz short loc_436806"], [102, "mov rax, cs:stderr"], [103, "mov rcx, rax"], [104, "mov edx, 1Eh"], [105, "mov esi, 1"], [106, "mov edi, offset aErrorCanTAlloc"], [107, "call _fwrite"], [108, "mov rax, [rbp+ptr]"], [109, "mov rdi, rax"], [110, "call _free"], [111, "mov eax, 1"], [112, "jmp short loc_436830"], [113, "mov eax, [rbp+var_C4]"], [114, "movsxd rdx, eax"], [115, "mov rax, [rbp+var_B8]"], [116, "mov rax, [rax]"], [117, "mov rcx, [rbp+ptr]"], [118, "mov rsi, rcx"], [119, "mov rdi, rax"], [120, "call _memcpy"], [121, "mov eax, 0"], [122, "mov rcx, [rbp+var_8]"], [123, "sub rcx, fs:28h"], [124, "jz short locret_436844"], [125, "call ___stack_chk_fail"], [126, "leave"], [127, "retn"]], "data_dep": [[7, 6], [11, 10], [13, 10], [13, 12], [16, 13], [18, 5], [20, 18], [22, 21], [23, 22], [24, 23], [26, 25], [33, 14], [34, 21], [34, 11], [35, 33], [36, 34], [38, 5], [39, 38], [40, 36], [40, 12], [42, 22], [43, 4], [45, 40], [46, 43], [50, 5], [51, 50], [51, 58], [51, 39], [52, 62], [52, 48], [53, 52], [53, 51], [54, 53], [55, 22], [56, 55], [56, 54], [57, 56], [58, 57], [59, 48], [59, 62], [61, 58], [61, 59], [62, 62], [62, 48], [63, 62], [63, 48], [64, 63], [65, 58], [65, 39], [66, 59], [66, 47], [67, 65], [68, 66], [70, 5], [71, 70], [72, 22], [74, 72], [76, 12], [76, 75], [79, 76], [81, 5], [82, 81], [83, 12], [83, 79], [84, 41], [85, 22], [86, 4], [88, 83], [89, 86], [91, 5], [93, 91], [95, 94], [96, 3], [97, 95], [97, 96], [98, 3], [99, 97], [99, 98], [100, 99], [101, 100], [103, 102], [108, 22], [109, 108], [113, 5], [114, 113], [115, 3], [116, 97], [116, 115], [117, 22], [118, 117], [119, 116], [122, 7], [123, 122], [124, 123], [127, 111], [127, 31], [127, 121]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40_a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40.jsonl.gz", "strip_func_name": "sub_4365E9", "query": "\n\n\n__int64 __fastcall sub_4365E9(void **a1, __int64 a2, int a3)\n{\n__int64 result; // rax\nint i; // [rsp+24h] [rbp-ACh]\n_BYTE *ptr; // [rsp+28h] [rbp-A8h]\nchar v7[8]; // [rsp+B0h] [rbp-20h]\n__int64 v8; // [rsp+B8h] [rbp-18h]\n__int64 s[2]; // [rsp+C0h] [rbp-10h] BYREF\n\ns[1] = __readfsqword(0x28u);\nv8 = 0xEFCDAB8967452301LL;\ns[0] = 0LL;\nmemset(s, 0, 8uLL);\nptr = malloc(a3);\nif ( ptr )\n{\nDES_key_sched();\nDES_ncbc_encrypt();\nfor ( i = 0; i <= 7; ++i )\nv7[i] = ptr[a3 - 8 + i];\nDES_key_sched();\nmemset(ptr, 0, a3);\nmemset(s, 0, 8uLL);\nDES_ncbc_encrypt();\n*a1 = malloc(a3);\nif ( *a1 )\n{\nmemcpy(*a1, ptr, a3);\nresult = 0LL;\n}\nelse\n{\nfwrite(\"[ERROR] Can't allocate memory\\n\", 1uLL, 0x1EuLL, stderr);\nfree(ptr);\nresult = 1LL;\n}\n}\nelse\n{\nfwrite(\"[ERROR] Can't allocate memory\\n\", 1uLL, 0x1EuLL, stderr);\nresult = 1LL;\n}\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,ptr,v7,v8,s,sub_4365E9,]", "hints": "[]", "response": "{'a3': 'siz', 'a1': 'rs', 'a2': 'result', 'ptr': 'desresult', 'v7': 'lastkey', 'v8': 'key1', 's': 'ivec1', 'sub_4365E9': 'ora_descrypt'}"} | [
[
0.7919743657112122,
0.7456175088882446,
0.7331913113594055,
0.7308753728866577,
0.722726583480835,
0.7160391807556152,
0.7149473428726196,
0.7138441801071167,
0.7128109931945801,
0.7089171409606934,
0.7087538242340088,
0.7079945206642151,
0.703027069568634,
0.7027263641357422,
0.6992766857147217,
0.6985708475112915,
0.6967512965202332,
0.6961562633514404,
0.6946495771408081,
0.6942007541656494
],
[
156057,
149464,
207343,
82066,
231436,
139956,
113384,
99114,
77071,
176617,
105211,
255323,
62709,
172955,
247112,
148939,
200848,
123677,
192326,
105957
]
] |
|
proc_args | 170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76 | atomicobject | heatshrink | NA | static void proc_args(config *cfg, int argc, char **argv) {
cfg->window_sz2 = DEF_WINDOW_SZ2;
cfg->lookahead_sz2 = DEF_LOOKAHEAD_SZ2;
cfg->buffer_size = DEF_BUFFER_SIZE;
cfg->decoder_input_buffer_size = DEF_DECODER_INPUT_BUFFER_SIZE;
cfg->cmd = OP_ENC;
cfg->verbose = 0;
cfg->in_fname = "-";
cfg->out_fname = "-";
int a = 0;
while ((a = getopt(argc, argv, "hedi:w:l:v")) != -1) {
switch (a) {
case 'h': /* help */
usage();
case 'e': /* encode */
cfg->cmd = OP_ENC; break;
case 'd': /* decode */
cfg->cmd = OP_DEC; break;
case 'i': /* input buffer size */
cfg->decoder_input_buffer_size = atoi(optarg);
break;
case 'w': /* window bits */
cfg->window_sz2 = atoi(optarg);
break;
case 'l': /* lookahead bits */
cfg->lookahead_sz2 = atoi(optarg);
break;
case 'v': /* verbosity++ */
cfg->verbose++;
break;
case '?': /* unknown argument */
default:
usage();
}
}
argc -= optind;
argv += optind;
if (argc > 0) {
cfg->in_fname = argv[0];
argc--;
argv++;
}
if (argc > 0) { cfg->out_fname = argv[0]; }
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402032", "function_addr": 4202546, "binary_name": "170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+argc], esi"], [5, "mov [rbp+argv], rdx"], [6, "mov rax, [rbp+var_18]"], [7, "mov byte ptr [rax], 0Bh"], [8, "mov rax, [rbp+var_18]"], [9, "mov byte ptr [rax+1], 4"], [10, "mov rax, [rbp+var_18]"], [11, "mov qword ptr [rax+10h], 10000h"], [12, "mov rax, [rbp+var_18]"], [13, "mov qword ptr [rax+8], 100h"], [14, "mov rax, [rbp+var_18]"], [15, "mov dword ptr [rax+1Ch], 0"], [16, "mov rax, [rbp+var_18]"], [17, "mov byte ptr [rax+18h], 0"], [18, "mov rax, [rbp+var_18]"], [19, "mov qword ptr [rax+20h], offset s1"], [20, "mov rax, [rbp+var_18]"], [21, "mov qword ptr [rax+28h], offset s1"], [22, "mov [rbp+var_4], 0"], [23, "jmp loc_402145"], [24, "mov eax, [rbp+var_4]"], [25, "sub eax, 64h "], [26, "cmp eax, 13h"], [27, "ja def_4020BC"], [28, "mov eax, eax"], [29, "mov rax, ds:jpt_4020BC[rax*8]"], [30, "jmp rax"], [31, "call sub_401212"], [32, "mov rax, [rbp+var_18]"], [33, "mov dword ptr [rax+1Ch], 0"], [34, "jmp short loc_402145"], [35, "mov rax, [rbp+var_18]"], [36, "mov dword ptr [rax+1Ch], 1"], [37, "jmp short loc_402145"], [38, "mov rax, cs:optarg"], [39, "mov rdi, rax"], [40, "call _atoi"], [41, "movsxd rdx, eax"], [42, "mov rax, [rbp+var_18]"], [43, "mov [rax+8], rdx"], [44, "jmp short loc_402145"], [45, "mov rax, cs:optarg"], [46, "mov rdi, rax"], [47, "call _atoi"], [48, "mov edx, eax"], [49, "mov rax, [rbp+var_18]"], [50, "mov [rax], dl"], [51, "jmp short loc_402145"], [52, "mov rax, cs:optarg"], [53, "mov rdi, rax"], [54, "call _atoi"], [55, "mov edx, eax"], [56, "mov rax, [rbp+var_18]"], [57, "mov [rax+1], dl"], [58, "jmp short loc_402145"], [59, "mov rax, [rbp+var_18]"], [60, "movzx eax, byte ptr [rax+18h]"], [61, "lea edx, [rax+1]"], [62, "mov rax, [rbp+var_18]"], [63, "mov [rax+18h], dl"], [64, "jmp short loc_402145"], [65, "call sub_401212"], [66, "mov rcx, [rbp+argv]"], [67, "mov eax, [rbp+argc]"], [68, "mov edx, offset shortopts"], [69, "mov rsi, rcx"], [70, "mov edi, eax"], [71, "call _getopt"], [72, "mov [rbp+var_4], eax"], [73, "cmp [rbp+var_4], 0FFFFFFFFh"], [74, "jnz loc_4020A3"], [75, "mov eax, cs:optind"], [76, "sub [rbp+argc], eax"], [77, "mov eax, cs:optind"], [78, "cdqe"], [79, "shl rax, 3"], [80, "add [rbp+argv], rax"], [81, "cmp [rbp+argc], 0"], [82, "jle short loc_40219F"], [83, "mov rax, [rbp+argv]"], [84, "mov rdx, [rax]"], [85, "mov rax, [rbp+var_18]"], [86, "mov [rax+20h], rdx"], [87, "sub [rbp+argc], 1"], [88, "add [rbp+argv], 8"], [89, "cmp [rbp+argc], 0"], [90, "jle short loc_4021B4"], [91, "mov rax, [rbp+argv]"], [92, "mov rdx, [rax]"], [93, "mov rax, [rbp+var_18]"], [94, "mov [rax+28h], rdx"], [95, "nop"], [96, "leave"], [97, "retn"]], "data_dep": [[6, 3], [7, 6], [8, 3], [9, 8], [10, 3], [11, 10], [12, 3], [13, 12], [14, 3], [15, 14], [16, 3], [17, 16], [18, 3], [19, 18], [20, 3], [21, 20], [24, 72], [25, 24], [26, 25], [27, 26], [28, 25], [30, 29], [32, 3], [33, 32], [35, 3], [36, 35], [39, 38], [41, 40], [42, 3], [43, 41], [43, 42], [46, 45], [48, 47], [49, 3], [50, 49], [50, 48], [53, 52], [55, 54], [56, 3], [57, 56], [57, 55], [59, 3], [60, 19], [60, 21], [60, 7], [60, 9], [60, 57], [60, 11], [60, 50], [60, 59], [60, 13], [60, 43], [60, 15], [60, 36], [60, 63], [60, 33], [60, 17], [61, 36], [61, 63], [61, 15], [61, 33], [61, 17], [61, 19], [61, 21], [61, 60], [61, 7], [61, 9], [61, 57], [61, 11], [61, 50], [61, 68], [61, 13], [61, 43], [62, 3], [63, 61], [63, 62], [66, 5], [67, 4], [69, 66], [70, 67], [72, 71], [73, 72], [74, 73], [76, 75], [76, 4], [79, 77], [80, 5], [80, 79], [81, 76], [82, 81], [83, 80], [84, 50], [84, 13], [84, 43], [84, 15], [84, 36], [84, 63], [84, 86], [84, 33], [84, 17], [84, 19], [84, 83], [84, 21], [84, 7], [84, 9], [84, 57], [84, 11], [85, 3], [86, 85], [86, 84], [87, 76], [88, 80], [89, 76], [89, 87], [90, 89], [91, 80], [91, 88], [92, 15], [92, 33], [92, 17], [92, 19], [92, 21], [92, 94], [92, 7], [92, 9], [92, 57], [92, 11], [92, 50], [92, 13], [92, 43], [92, 91], [92, 36], [92, 63], [92, 86], [93, 3], [94, 93], [94, 92], [97, 85], [97, 93], [97, 79]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76_170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76.jsonl.gz", "strip_func_name": "sub_402032", "query": "\n\n\n__int64 __fastcall sub_402032(__int64 a1, int a2, char *const *a3)\n{\n__int64 result; // rax\nchar **argva; // [rsp+8h] [rbp-28h]\nint argc; // [rsp+14h] [rbp-1Ch]\nint v7; // [rsp+2Ch] [rbp-4h]\n\n*(_BYTE *)a1 = 11;\n*(_BYTE *)(a1 + 1) = 4;\n*(_QWORD *)(a1 + 16) = 0x10000LL;\n*(_QWORD *)(a1 + 8) = 256LL;\n*(_DWORD *)(a1 + 28) = 0;\n*(_BYTE *)(a1 + 24) = 0;\n*(_QWORD *)(a1 + 32) = \"-\";\n*(_QWORD *)(a1 + 40) = \"-\";\nwhile ( 1 )\n{\nv7 = getopt(a2, a3, \"hedi:w:l:v\");\nif ( v7 == -1 )\nbreak;\nswitch ( v7 )\n{\ncase 'd':\n*(_DWORD *)(a1 + 28) = 1;\nbreak;\ncase 'e':\n*(_DWORD *)(a1 + 28) = 0;\nbreak;\ncase 'h':\nsub_401212();\nreturn result;\ncase 'i':\n*(_QWORD *)(a1 + 8) = atoi(optarg);\nbreak;\ncase 'l':\n*(_BYTE *)(a1 + 1) = atoi(optarg);\nbreak;\ncase 'v':\n++*(_BYTE *)(a1 + 24);\nbreak;\ncase 'w':\n*(_BYTE *)a1 = atoi(optarg);\nbreak;\ndefault:\nsub_401212();\nreturn result;\n}\n}\nargc = a2 - optind;\nresult = 8LL * optind;\nargva = (char **)((char *)a3 + result);\nif ( a2 - optind > 0 )\n{\nresult = a1;\n*(_QWORD *)(a1 + 32) = *argva;\n--argc;\n++argva;\n}\nif ( argc > 0 )\n{\nresult = a1;\n*(_QWORD *)(a1 + 40) = *argva;\n}\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,argva,argc,v7,sub_402032,sub_401212,]", "hints": "[]", "response": "{'a3': 'argv', 'a1': 'cfg', 'a2': 'argc', 'argva': 'argvb', 'argc': 'argca', 'v7': 'a', 'sub_402032': 'proc_args', 'sub_401212': 'usage'}"} | [
[
0.8145289421081543,
0.7331277132034302,
0.7227405309677124,
0.714276909828186,
0.7140536308288574,
0.7108135223388672,
0.7108135223388672,
0.7105217576026917,
0.706636905670166,
0.7024408578872681,
0.697253942489624,
0.6900445818901062,
0.6831316351890564,
0.6790697574615479,
0.677958071231842,
0.6761128306388855,
0.6749089956283569,
0.6737454533576965,
0.6736493706703186,
0.6718418002128601
],
[
87740,
114874,
51376,
181304,
105159,
261762,
245252,
1218,
257352,
249006,
7233,
226948,
210779,
93800,
66870,
256490,
121063,
212062,
235016,
128750
]
] |
|
read_table | 9304e89337469d99fb0cddc61f3c9775c57f90c5bad589c09e3b883610329afc | ShadowsocksR-Live | ssrWin | NA | static void read_table (Encoding* enc)
{
int row, col, i, i1, i2, c, j;
enc->charset2uni = (int**) malloc(enc->rows*sizeof(int*));
for (row = 0; row < enc->rows; row++)
enc->charset2uni[row] = (int*) malloc(enc->cols*sizeof(int));
for (row = 0; row < enc->rows; row++)
for (col = 0; col < enc->cols; col++)
enc->charset2uni[row][col] = 0xfffd;
c = getc(stdin);
ungetc(c,stdin);
if (c == '#') {
/* Read a unicode.org style .TXT file. */
for (;;) {
c = getc(stdin);
if (c == EOF)
break;
if (c == '\n' || c == ' ' || c == '\t')
continue;
if (c == '#') {
do { c = getc(stdin); } while (!(c == EOF || c == '\n'));
continue;
}
ungetc(c,stdin);
if (scanf("0x%x", &j) != 1)
exit(1);
i1 = j >> 8;
i2 = j & 0xff;
row = enc->byte_row(i1);
col = enc->byte_col(i2);
if (row < 0 || col < 0) {
fprintf(stderr, "lost entry for %02x %02x\n", i1, i2);
exit(1);
}
if (scanf(" 0x%x", &enc->charset2uni[row][col]) != 1)
exit(1);
}
} else {
/* Read a table of hexadecimal Unicode values. */
for (i1 = 32; i1 < 132; i1++)
for (i2 = 32; i2 < 132; i2++) {
i = scanf("%x", &j);
if (i == EOF)
goto read_done;
if (i != 1)
exit(1);
if (j < 0 || j == 0xffff)
j = 0xfffd;
if (j != 0xfffd) {
if (enc->byte_row(i1) < 0 || enc->byte_col(i2) < 0) {
fprintf(stderr, "lost entry at %02x %02x\n", i1, i2);
exit (1);
}
enc->charset2uni[enc->byte_row(i1)][enc->byte_col(i2)] = j;
}
}
read_done: ;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401333", "function_addr": 4199219, "binary_name": "9304e89337469d99fb0cddc61f3c9775c57f90c5bad589c09e3b883610329afc.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push rbx"], [3, "sub rsp, 38h"], [4, "mov [rbp+var_38], rdi"], [5, "mov rax, [rbp+var_38]"], [6, "mov eax, [rax]"], [7, "cdqe"], [8, "shl rax, 3"], [9, "mov rdi, rax"], [10, "call _malloc"], [11, "mov rdx, rax"], [12, "mov rax, [rbp+var_38]"], [13, "mov [rax+48h], rdx"], [14, "mov [rbp+var_14], 0"], [15, "jmp short loc_40139A"], [16, "mov rax, [rbp+var_38]"], [17, "mov eax, [rax+4]"], [18, "cdqe"], [19, "shl rax, 2"], [20, "mov rdx, [rbp+var_38]"], [21, "mov rcx, [rdx+48h]"], [22, "mov edx, [rbp+var_14]"], [23, "movsxd rdx, edx"], [24, "shl rdx, 3"], [25, "lea rbx, [rcx+rdx]"], [26, "mov rdi, rax"], [27, "call _malloc"], [28, "mov [rbx], rax"], [29, "add [rbp+var_14], 1"], [30, "mov rax, [rbp+var_38]"], [31, "mov eax, [rax]"], [32, "cmp [rbp+var_14], eax"], [33, "jl short loc_401368"], [34, "mov [rbp+var_14], 0"], [35, "jmp short loc_4013F4"], [36, "mov [rbp+var_18], 0"], [37, "jmp short loc_4013E4"], [38, "mov rax, [rbp+var_38]"], [39, "mov rdx, [rax+48h]"], [40, "mov eax, [rbp+var_14]"], [41, "cdqe"], [42, "shl rax, 3"], [43, "add rax, rdx"], [44, "mov rdx, [rax]"], [45, "mov eax, [rbp+var_18]"], [46, "cdqe"], [47, "shl rax, 2"], [48, "add rax, rdx"], [49, "mov dword ptr [rax], 0FFFDh"], [50, "add [rbp+var_18], 1"], [51, "mov rax, [rbp+var_38]"], [52, "mov eax, [rax+4]"], [53, "cmp [rbp+var_18], eax"], [54, "jl short loc_4013B7"], [55, "add [rbp+var_14], 1"], [56, "mov rax, [rbp+var_38]"], [57, "mov eax, [rax]"], [58, "cmp [rbp+var_14], eax"], [59, "jl short loc_4013AE"], [60, "mov rax, cs:stdin"], [61, "mov rdi, rax"], [62, "call _getc"], [63, "mov [rbp+c], eax"], [64, "mov rdx, cs:stdin"], [65, "mov eax, [rbp+c]"], [66, "mov rsi, rdx"], [67, "mov edi, eax"], [68, "call _ungetc"], [69, "cmp [rbp+c], 23h "], [70, "jnz loc_401590"], [71, "mov rax, cs:stdin"], [72, "mov rdi, rax"], [73, "call _getc"], [74, "mov [rbp+c], eax"], [75, "cmp [rbp+c], 0FFFFFFFFh"], [76, "jz loc_4016B6"], [77, "cmp [rbp+c], 0Ah"], [78, "jz loc_401584"], [79, "cmp [rbp+c], 20h "], [80, "jz loc_401584"], [81, "cmp [rbp+c], 9"], [82, "jz loc_401584"], [83, "cmp [rbp+c], 23h "], [84, "jnz short loc_401496"], [85, "mov rax, cs:stdin"], [86, "mov rdi, rax"], [87, "call _getc"], [88, "mov [rbp+c], eax"], [89, "cmp [rbp+c], 0FFFFFFFFh"], [90, "jz loc_40158A"], [91, "cmp [rbp+c], 0Ah"], [92, "jnz short loc_40146F"], [93, "jmp loc_40158A"], [94, "mov rdx, cs:stdin"], [95, "mov eax, [rbp+c]"], [96, "mov rsi, rdx"], [97, "mov edi, eax"], [98, "call _ungetc"], [99, "lea rax, [rbp+var_2C]"], [100, "mov rsi, rax"], [101, "mov edi, offset a0xX"], [102, "mov eax, 0"], [103, "call ___isoc99_scanf"], [104, "cmp eax, 1"], [105, "jz short loc_4014CF"], [106, "mov edi, 1"], [107, "call _exit"], [108, "mov eax, [rbp+var_2C]"], [109, "sar eax, 8"], [110, "mov [rbp+var_1C], eax"], [111, "mov eax, [rbp+var_2C]"], [112, "and eax, 0FFh"], [113, "mov [rbp+var_20], eax"], [114, "mov rax, [rbp+var_38]"], [115, "mov rdx, [rax+18h]"], [116, "mov eax, [rbp+var_1C]"], [117, "mov edi, eax"], [118, "call rdx"], [119, "mov [rbp+var_14], eax"], [120, "mov rax, [rbp+var_38]"], [121, "mov rdx, [rax+20h]"], [122, "mov eax, [rbp+var_20]"], [123, "mov edi, eax"], [124, "call rdx"], [125, "mov [rbp+var_18], eax"], [126, "cmp [rbp+var_14], 0"], [127, "js short loc_401513"], [128, "cmp [rbp+var_18], 0"], [129, "jns short loc_40153C"], [130, "mov rax, cs:stderr"], [131, "mov ecx, [rbp+var_20]"], [132, "mov edx, [rbp+var_1C]"], [133, "mov esi, offset aLostEntryFor02"], [134, "mov rdi, rax"], [135, "mov eax, 0"], [136, "call _fprintf"], [137, "mov edi, 1"], [138, "call _exit"], [139, "mov rax, [rbp+var_38]"], [140, "mov rdx, [rax+48h]"], [141, "mov eax, [rbp+var_14]"], [142, "cdqe"], [143, "shl rax, 3"], [144, "add rax, rdx"], [145, "mov rdx, [rax]"], [146, "mov eax, [rbp+var_18]"], [147, "cdqe"], [148, "shl rax, 2"], [149, "add rax, rdx"], [150, "mov rsi, rax"], [151, "mov edi, offset a0xX_0"], [152, "mov eax, 0"], [153, "call ___isoc99_scanf"], [154, "cmp eax, 1"], [155, "jz loc_40142F"], [156, "mov edi, 1"], [157, "call _exit"], [158, "nop"], [159, "jmp loc_40142F"], [160, "nop"], [161, "jmp loc_40142F"], [162, "mov [rbp+var_1C], 20h "], [163, "jmp loc_4016A6"], [164, "mov [rbp+var_20], 20h "], [165, "jmp loc_401695"], [166, "lea rax, [rbp+var_2C]"], [167, "mov rsi, rax"], [168, "mov edi, offset asc_4093B8"], [169, "mov eax, 0"], [170, "call ___isoc99_scanf"], [171, "mov [rbp+var_28], eax"], [172, "cmp [rbp+var_28], 0FFFFFFFFh"], [173, "jz loc_4016B9"], [174, "cmp [rbp+var_28], 1"], [175, "jz short loc_4015DB"], [176, "mov edi, 1"], [177, "call _exit"], [178, "mov eax, [rbp+var_2C]"], [179, "test eax, eax"], [180, "js short loc_4015EC"], [181, "mov eax, [rbp+var_2C]"], [182, "cmp eax, 0FFFFh"], [183, "jnz short loc_4015F3"], [184, "mov [rbp+var_2C], 0FFFDh"], [185, "mov eax, [rbp+var_2C]"], [186, "cmp eax, 0FFFDh"], [187, "jz loc_401691"], [188, "mov rax, [rbp+var_38]"], [189, "mov rdx, [rax+18h]"], [190, "mov eax, [rbp+var_1C]"], [191, "mov edi, eax"], [192, "call rdx"], [193, "test eax, eax"], [194, "js short loc_401627"], [195, "mov rax, [rbp+var_38]"], [196, "mov rdx, [rax+20h]"], [197, "mov eax, [rbp+var_20]"], [198, "mov edi, eax"], [199, "call rdx"], [200, "test eax, eax"], [201, "jns short loc_401650"], [202, "mov rax, cs:stderr"], [203, "mov ecx, [rbp+var_20]"], [204, "mov edx, [rbp+var_1C]"], [205, "mov esi, offset aLostEntryAt02x"], [206, "mov rdi, rax"], [207, "mov eax, 0"], [208, "call _fprintf"], [209, "mov edi, 1"], [210, "call _exit"], [211, "mov rax, [rbp+var_38]"], [212, "mov rbx, [rax+48h]"], [213, "mov rax, [rbp+var_38]"], [214, "mov rdx, [rax+18h]"], [215, "mov eax, [rbp+var_1C]"], [216, "mov edi, eax"], [217, "call rdx"], [218, "cdqe"], [219, "shl rax, 3"], [220, "add rax, rbx"], [221, "mov rbx, [rax]"], [222, "mov rax, [rbp+var_38]"], [223, "mov rdx, [rax+20h]"], [224, "mov eax, [rbp+var_20]"], [225, "mov edi, eax"], [226, "call rdx"], [227, "cdqe"], [228, "shl rax, 2"], [229, "lea rdx, [rbx+rax]"], [230, "mov eax, [rbp+var_2C]"], [231, "mov [rdx], eax"], [232, "add [rbp+var_20], 1"], [233, "cmp [rbp+var_20], 83h"], [234, "jle loc_4015A8"], [235, "add [rbp+var_1C], 1"], [236, "cmp [rbp+var_1C], 83h"], [237, "jle loc_40159C"], [238, "nop"], [239, "jmp short loc_4016BA"], [240, "nop"], [241, "jmp short loc_4016BA"], [242, "nop"], [243, "nop"], [244, "mov rbx, [rbp+var_8]"], [245, "leave"], [246, "retn"]], "data_dep": [[5, 4], [6, 5], [8, 6], [9, 8], [11, 10], [12, 4], [13, 12], [13, 11], [16, 4], [17, 16], [17, 13], [17, 28], [19, 17], [20, 4], [21, 20], [21, 13], [21, 28], [22, 14], [22, 29], [23, 22], [24, 23], [25, 25], [25, 13], [25, 28], [25, 21], [26, 19], [28, 25], [28, 27], [29, 29], [29, 14], [30, 4], [31, 28], [31, 30], [31, 13], [32, 14], [32, 29], [32, 31], [33, 32], [38, 4], [39, 28], [39, 13], [39, 38], [39, 49], [40, 34], [40, 55], [42, 40], [43, 39], [43, 42], [44, 13], [44, 49], [44, 28], [44, 43], [45, 50], [45, 36], [47, 45], [48, 47], [48, 44], [49, 48], [50, 36], [50, 50], [51, 4], [52, 49], [52, 51], [52, 28], [52, 13], [53, 50], [53, 52], [53, 36], [54, 53], [55, 34], [55, 55], [56, 4], [57, 13], [57, 56], [57, 49], [57, 28], [58, 34], [58, 55], [58, 57], [59, 58], [61, 60], [63, 62], [65, 63], [66, 64], [67, 65], [69, 63], [70, 69], [72, 71], [74, 73], [75, 74], [76, 75], [77, 74], [78, 77], [79, 74], [80, 79], [81, 74], [82, 81], [83, 74], [84, 83], [86, 85], [88, 87], [89, 88], [90, 89], [91, 88], [92, 91], [95, 74], [96, 94], [97, 95], [99, 98], [100, 99], [104, 103], [105, 104], [109, 108], [110, 109], [112, 111], [113, 112], [114, 4], [115, 114], [115, 13], [115, 49], [115, 28], [116, 110], [117, 116], [118, 115], [119, 118], [120, 4], [121, 13], [121, 120], [121, 49], [121, 28], [122, 113], [123, 122], [124, 121], [125, 124], [126, 119], [127, 126], [128, 125], [129, 128], [131, 113], [132, 110], [134, 130], [139, 4], [140, 139], [140, 13], [140, 49], [140, 28], [141, 119], [143, 141], [144, 143], [144, 140], [145, 28], [145, 144], [145, 13], [145, 49], [146, 125], [148, 146], [149, 148], [149, 145], [150, 149], [154, 153], [155, 154], [166, 185], [166, 230], [166, 68], [166, 184], [167, 166], [171, 170], [172, 171], [173, 172], [174, 171], [175, 174], [178, 184], [179, 178], [180, 179], [181, 184], [182, 181], [183, 182], [185, 184], [186, 185], [187, 186], [188, 4], [189, 13], [189, 49], [189, 188], [189, 28], [189, 231], [190, 162], [190, 235], [191, 190], [192, 189], [193, 192], [194, 193], [195, 4], [196, 28], [196, 231], [196, 13], [196, 49], [196, 195], [197, 232], [197, 164], [198, 197], [199, 196], [200, 199], [201, 200], [203, 232], [203, 164], [204, 162], [204, 235], [206, 202], [211, 4], [212, 13], [212, 28], [212, 211], [212, 49], [212, 231], [213, 4], [214, 13], [214, 49], [214, 28], [214, 213], [214, 231], [215, 162], [215, 235], [216, 215], [217, 214], [219, 217], [220, 219], [220, 212], [221, 28], [221, 231], [221, 13], [221, 220], [221, 49], [222, 4], [223, 13], [223, 28], [223, 49], [223, 222], [223, 231], [224, 164], [224, 232], [225, 224], [226, 223], [228, 226], [229, 228], [229, 13], [229, 223], [229, 49], [229, 28], [229, 231], [230, 184], [231, 230], [231, 229], [232, 164], [232, 232], [233, 164], [233, 232], [234, 233], [235, 162], [235, 235], [236, 162], [236, 235], [237, 236], [246, 73], [246, 230], [246, 68], [246, 170], [246, 185]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/9304e89337469d99fb0cddc61f3c9775c57f90c5bad589c09e3b883610329afc_9304e89337469d99fb0cddc61f3c9775c57f90c5bad589c09e3b883610329afc.jsonl.gz", "strip_func_name": "sub_401333", "query": "\n\n\nint __fastcall sub_401333(int *a1)\n{\nvoid **v1; // rbx\nint result; // eax\n__int64 v3; // rbx\n__int64 v4; // rbx\n_DWORD *v5; // rdx\nint v6; // [rsp+14h] [rbp-2Ch] BYREF\nint v7; // [rsp+18h] [rbp-28h]\nint c; // [rsp+1Ch] [rbp-24h]\nunsigned int l; // [rsp+20h] [rbp-20h]\nunsigned int k; // [rsp+24h] [rbp-1Ch]\nint j; // [rsp+28h] [rbp-18h]\nint i; // [rsp+2Ch] [rbp-14h]\n\n*((_QWORD *)a1 + 9) = malloc(8LL * *a1);\nfor ( i = 0; i < *a1; ++i )\n{\nv1 = (void **)(*((_QWORD *)a1 + 9) + 8LL * i);\n*v1 = malloc(4LL * a1[1]);\n}\nfor ( i = 0; i < *a1; ++i )\n{\nfor ( j = 0; j < a1[1]; ++j )\n*(_DWORD *)(*(_QWORD *)(*((_QWORD *)a1 + 9) + 8LL * i) + 4LL * j) = 65533;\n}\nc = getc(stdin);\nresult = ungetc(c, stdin);\nif ( c == 35 )\n{\nwhile ( 1 )\n{\nresult = getc(stdin);\nc = result;\nif ( result == -1 )\nbreak;\nif ( c != 10 && c != 32 && c != 9 )\n{\nif ( c == 35 )\n{\ndo\nc = getc(stdin);\nwhile ( c != -1 && c != 10 );\n}\nelse\n{\nungetc(c, stdin);\nif ( (unsigned int)__isoc99_scanf() != 1 )\nexit(1);\nk = v6 >> 8;\nl = (unsigned __int8)v6;\ni = (*((__int64 (__fastcall **)(_QWORD, int *))a1 + 3))((unsigned int)(v6 >> 8), &v6);\nj = (*((__int64 (__fastcall **)(_QWORD))a1 + 4))(l);\nif ( i < 0 || j < 0 )\n{\nfprintf(stderr, \"lost entry for %02x %02x\\n\", k, l);\nexit(1);\n}\nif ( (unsigned int)__isoc99_scanf() != 1 )\nexit(1);\n}\n}\n}\n}\nelse\n{\nfor ( k = 32; (int)k <= 131; ++k )\n{\nfor ( l = 32; (int)l <= 131; ++l )\n{\nresult = __isoc99_scanf();\nv7 = result;\nif ( result == -1 )\nreturn result;\nif ( v7 != 1 )\nexit(1);\nif ( v6 < 0 || v6 == 0xFFFF )\nv6 = 65533;\nresult = v6;\nif ( v6 != 65533 )\n{\nif ( (*((int (__fastcall **)(_QWORD, int *))a1 + 3))(k, &v6) < 0\n|| (*((int (__fastcall **)(_QWORD))a1 + 4))(l) < 0 )\n{\nfprintf(stderr, \"lost entry at %02x %02x\\n\", k, l);\nexit(1);\n}\nv3 = *((_QWORD *)a1 + 9);\nv4 = *(_QWORD *)(v3 + 8LL * (*((int (__fastcall **)(_QWORD))a1 + 3))(k));\nv5 = (_DWORD *)(v4 + 4LL * (*((int (__fastcall **)(_QWORD))a1 + 4))(l));\nresult = v6;\n*v5 = v6;\n}\n}\n}\n}\nreturn result;\n}\n\n\n\nQ:[a1,l,k,j,i,sub_401333,]", "hints": "[]", "response": "{'a1': 'enc', 'l': 'i2', 'k': 'i1', 'j': 'col', 'i': 'row', 'sub_401333': 'read_table'}"} | [
[
0.724700927734375,
0.7209581136703491,
0.7189830541610718,
0.712593674659729,
0.7101253271102905,
0.7050651907920837,
0.704596757888794,
0.6998764276504517,
0.6960958242416382,
0.6940851807594299,
0.6857395172119141,
0.6828480362892151,
0.6795649528503418,
0.6771903038024902,
0.6764639616012573,
0.668510377407074,
0.6661204099655151,
0.6655987501144409,
0.6652945280075073,
0.6637665033340454
],
[
193681,
153537,
231426,
134708,
163841,
221140,
172653,
39308,
213234,
223823,
94360,
10077,
122028,
10160,
113171,
136844,
17565,
47597,
96822,
154437
]
] |
|
push_args | 7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807 | arendst | Tasmota | NA | static void push_args(bvm *vm, int argc, char *argv[])
{
be_newobject(vm, "list");
while (argc--) {
be_pushstring(vm, *argv++);
be_data_push(vm, -2);
be_pop(vm, 1);
}
be_pop(vm, 1);
be_setglobal(vm, "_argv");
be_pop(vm, 1);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_438A8F", "function_addr": 4426383, "binary_name": "7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_8], rdi"], [4, "mov [rbp+var_C], esi"], [5, "mov [rbp+var_18], rdx"], [6, "mov rax, [rbp+var_8]"], [7, "mov esi, offset aList_12"], [8, "mov rdi, rax"], [9, "call be_newobject"], [10, "jmp short loc_438AF5"], [11, "mov rax, [rbp+var_18]"], [12, "lea rdx, [rax+8]"], [13, "mov [rbp+var_18], rdx"], [14, "mov rdx, [rax]"], [15, "mov rax, [rbp+var_8]"], [16, "mov rsi, rdx"], [17, "mov rdi, rax"], [18, "call be_pushstring"], [19, "mov rax, [rbp+var_8]"], [20, "mov esi, 0FFFFFFFEh"], [21, "mov rdi, rax"], [22, "call be_data_push"], [23, "mov rax, [rbp+var_8]"], [24, "mov esi, 1"], [25, "mov rdi, rax"], [26, "call be_pop"], [27, "mov eax, [rbp+var_C]"], [28, "lea edx, [rax-1]"], [29, "mov [rbp+var_C], edx"], [30, "test eax, eax"], [31, "jnz short loc_438AB5"], [32, "mov rax, [rbp+var_8]"], [33, "mov esi, 1"], [34, "mov rdi, rax"], [35, "call be_pop"], [36, "mov rax, [rbp+var_8]"], [37, "mov esi, offset aArgv"], [38, "mov rdi, rax"], [39, "call be_setglobal"], [40, "mov rax, [rbp+var_8]"], [41, "mov esi, 1"], [42, "mov rdi, rax"], [43, "call be_pop"], [44, "nop"], [45, "leave"], [46, "retn"]], "data_dep": [[6, 3], [8, 6], [11, 5], [11, 13], [12, 28], [12, 11], [13, 12], [14, 11], [15, 3], [16, 14], [17, 15], [19, 3], [21, 19], [23, 3], [25, 23], [27, 4], [27, 29], [28, 27], [28, 14], [29, 28], [30, 27], [31, 30], [32, 3], [34, 32], [36, 3], [38, 36], [40, 3], [42, 40], [46, 43]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807_7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.jsonl.gz", "strip_func_name": "sub_438A8F", "query": "\n\n\n__int64 __fastcall sub_438A8F(__int64 a1, int a2, __int64 *a3)\n{\n__int64 *v3; // rax\n\nbe_newobject(a1, (__int64)\"list\");\nwhile ( a2-- )\n{\nv3 = a3++;\nbe_pushstring(a1, *v3);\nbe_data_push(a1, 0xFFFFFFFE);\nbe_pop(a1, 1);\n}\nbe_pop(a1, 1);\nbe_setglobal(a1, (__int64)\"_argv\");\nreturn be_pop(a1, 1);\n}\n\n\n\nQ:[a3,a1,a2,sub_438A8F,]", "hints": "[]", "response": "{'a3': 'argv', 'a1': 'vm', 'a2': 'argc', 'sub_438A8F': 'push_args'}"} | [
[
0.7159754633903503,
0.7117934226989746,
0.7024769186973572,
0.7005648016929626,
0.6915005445480347,
0.6904956102371216,
0.6860247850418091,
0.6805942058563232,
0.6798889636993408,
0.6703853607177734,
0.6673108339309692,
0.6631237864494324,
0.6595147848129272,
0.658745288848877,
0.6569381952285767,
0.6544570922851562,
0.652176022529602,
0.6504335403442383,
0.6484260559082031,
0.6480616331100464
],
[
168789,
123422,
46081,
24416,
192054,
73844,
209546,
53715,
235701,
130563,
92137,
193939,
29401,
53895,
248586,
64079,
198519,
21102,
11827,
176446
]
] |
|
dump_stack | e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d | CCareaga | useless | NA | static void dump_stack(cpu_t *cpu, int *ram) {
int i = ram[SP];
printf("======== STACK ========\n");
while (i < RAM_SZ) {
printf("%d: %d\n", i, ram[i]);
i++;
}
printf("\nSP: %d \n", ram[SP]);
printf("BP: %d \n", ram[BP]);
printf("=======================\n\n");
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_404648", "function_addr": 4212296, "binary_name": "e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov rax, [rbp+var_20]"], [6, "mov eax, [rax+18h]"], [7, "mov [rbp+var_4], eax"], [8, "mov edi, offset aStack"], [9, "call _puts"], [10, "jmp short loc_40469C"], [11, "mov eax, [rbp+var_4]"], [12, "cdqe"], [13, "lea rdx, ds:0[rax*4]"], [14, "mov rax, [rbp+var_20]"], [15, "add rax, rdx"], [16, "mov edx, [rax]"], [17, "mov eax, [rbp+var_4]"], [18, "mov esi, eax"], [19, "mov edi, offset aDD"], [20, "mov eax, 0"], [21, "call _printf"], [22, "add [rbp+var_4], 1"], [23, "cmp [rbp+var_4], 1FFFh"], [24, "jle short loc_40466E"], [25, "mov rax, [rbp+var_20]"], [26, "add rax, 18h"], [27, "mov eax, [rax]"], [28, "mov esi, eax"], [29, "mov edi, offset aSpD"], [30, "mov eax, 0"], [31, "call _printf"], [32, "mov rax, [rbp+var_20]"], [33, "add rax, 1Ch"], [34, "mov eax, [rax]"], [35, "mov esi, eax"], [36, "mov edi, offset aBpD"], [37, "mov eax, 0"], [38, "call _printf"], [39, "mov edi, offset asc_406FDB"], [40, "call _puts"], [41, "nop"], [42, "leave"], [43, "retn"]], "data_dep": [[5, 4], [6, 5], [7, 6], [11, 7], [11, 22], [13, 16], [14, 4], [15, 14], [15, 13], [16, 15], [17, 7], [17, 22], [18, 17], [22, 7], [22, 22], [23, 7], [23, 22], [24, 23], [25, 4], [26, 25], [27, 26], [28, 27], [32, 4], [33, 32], [34, 33], [35, 34], [43, 40]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d_e010df96f3cdef0246535d118a0927b04105062742aa1adcc03cd3a861f7601d.jsonl.gz", "strip_func_name": "sub_404648", "query": "\n\n\nint __fastcall sub_404648(__int64 a1, __int64 a2)\n{\nint v3; // [rsp+1Ch] [rbp-4h]\n\nv3 = *(_DWORD *)(a2 + 24);\nputs(\"======== STACK ========\");\nwhile ( v3 <= 0x1FFF )\n{\nprintf(\"%d: %d\\n\", (unsigned int)v3, *(unsigned int *)(4LL * v3 + a2));\n++v3;\n}\nprintf(\"\\nSP: %d \\n\", *(unsigned int *)(a2 + 24));\nprintf(\"BP: %d \\n\", *(unsigned int *)(a2 + 28));\nreturn puts(\"=======================\\n\");\n}\n\n\n\nQ:[a2,a1,sub_404648,]", "hints": "[]", "response": "{'a2': 'ram', 'a1': 'cpu', 'sub_404648': 'dump_stack'}"} | [
[
0.8093824982643127,
0.8058305978775024,
0.7961798906326294,
0.7927230596542358,
0.7487068772315979,
0.743286669254303,
0.741887092590332,
0.734749436378479,
0.7191201448440552,
0.718183696269989,
0.7163366079330444,
0.7106732130050659,
0.7094380855560303,
0.7054394483566284,
0.7042863368988037,
0.702370822429657,
0.6998656988143921,
0.6975578665733337,
0.6965045928955078,
0.6946378946304321
],
[
252388,
133547,
69944,
80311,
19417,
138532,
136589,
141439,
241570,
145385,
50700,
75978,
161135,
19895,
71372,
35297,
196714,
234842,
6597,
198517
]
] |
|
xasprintf | 3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413 | emikulic | darkhttpd | NA | static unsigned int xasprintf(char **ret, const char *format, ...) {
va_list va;
unsigned int len;
va_start(va, format);
len = xvasprintf(ret, format, va);
va_end(va);
return len;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_403A5E", "function_addr": 4209246, "binary_name": "3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push r13"], [3, "push r12"], [4, "push rbx"], [5, "sub rsp, 138h"], [6, "mov [rbp+var_148], rdi"], [7, "mov [rbp+var_150], rsi"], [8, "mov [rbp+var_C0], rdx"], [9, "mov [rbp+var_B8], rcx"], [10, "mov [rbp+var_B0], r8"], [11, "mov [rbp+var_A8], r9"], [12, "test al, al"], [13, "jz short loc_403AC2"], [14, "movaps [rbp+var_A0], xmm0"], [15, "movaps [rbp+var_90], xmm1"], [16, "movaps [rbp+var_80], xmm2"], [17, "movaps [rbp+var_70], xmm3"], [18, "movaps [rbp+var_60], xmm4"], [19, "movaps [rbp+var_50], xmm5"], [20, "movaps [rbp+var_40], xmm6"], [21, "movaps [rbp+var_30], xmm7"], [22, "lea rbx, [rbp+var_130]"], [23, "mov r13, rbx"], [24, "cmp cs:__asan_option_detect_stack_use_after_return, 0"], [25, "jz short loc_403AE7"], [26, "mov edi, 60h "], [27, "call ___asan_stack_malloc_1"], [28, "test rax, rax"], [29, "jz short loc_403AE7"], [30, "mov rbx, rax"], [31, "lea rax, [rbx+60h]"], [32, "mov qword ptr [rbx], 41B58AB3h"], [33, "mov qword ptr [rbx+8], offset a132246Va409"], [34, "mov qword ptr [rbx+10h], offset sub_403A5E"], [35, "mov r12, rbx"], [36, "shr r12, 3"], [37, "mov dword ptr [r12+7FFF8000h], 0F1F1F1F1h"], [38, "mov dword ptr [r12+7FFF8004h], 0F3000000h"], [39, "mov dword ptr [r12+7FFF8008h], 0F3F3F3F3h"], [40, "mov dword ptr [rax-40h], 10h"], [41, "mov dword ptr [rax-3Ch], 30h "], [42, "lea rsi, [rbp+arg_0]"], [43, "mov [rax-38h], rsi"], [44, "lea rcx, [rbp+var_D0]"], [45, "mov [rax-30h], rcx"], [46, "lea rdx, [rax-40h]"], [47, "mov rcx, [rbp+var_150]"], [48, "mov rax, [rbp+var_148]"], [49, "mov rsi, rcx"], [50, "mov rdi, rax"], [51, "call sub_403A05"], [52, "mov [rbp+var_134], eax"], [53, "mov eax, [rbp+var_134]"], [54, "mov edx, eax"], [55, "cmp r13, rbx"], [56, "jz short loc_403BAC"], [57, "mov qword ptr [rbx], 45E0360Eh"], [58, "mov rax, 0F5F5F5F5F5F5F5F5h"], [59, "mov [r12+7FFF8000h], rax"], [60, "mov dword ptr [r12+7FFF8008h], 0F5F5F5F5h"], [61, "mov rax, [rbx+78h]"], [62, "mov byte ptr [rax], 0"], [63, "jmp short loc_403BC4"], [64, "mov qword ptr [r12+7FFF8000h], 0"], [65, "mov dword ptr [r12+7FFF8008h], 0"], [66, "mov eax, edx"], [67, "add rsp, 138h"], [68, "pop rbx"], [69, "pop r12"], [70, "pop r13"], [71, "pop rbp"], [72, "retn"]], "data_dep": [[13, 12], [23, 22], [25, 24], [28, 27], [29, 28], [30, 28], [31, 22], [31, 28], [31, 12], [31, 30], [32, 30], [32, 22], [33, 22], [33, 30], [34, 22], [34, 30], [35, 30], [35, 22], [36, 35], [37, 36], [38, 36], [39, 36], [40, 31], [41, 31], [43, 31], [43, 42], [45, 31], [45, 44], [46, 45], [46, 31], [46, 40], [47, 7], [48, 6], [49, 47], [50, 48], [52, 51], [53, 52], [54, 53], [55, 23], [55, 22], [55, 30], [56, 55], [57, 30], [57, 22], [59, 58], [59, 36], [60, 36], [61, 30], [61, 60], [61, 22], [62, 61], [64, 36], [65, 36], [66, 54], [67, 5], [68, 4], [69, 3], [70, 2], [71, 0], [72, 66]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413_3bcf173d341df86f6f8c68ed537bf47f1d919855b29727d483d7dab93b6c4413.jsonl.gz", "strip_func_name": "sub_403A5E", "query": "\n\n\n__int64 __fastcall sub_403A5E(char **a1, const char *a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __m128 a7, __m128 a8, __m128 a9, __m128 a10, __m128 a11, __m128 a12, __m128 a13, __m128 a14, char a15)\n{\nunsigned __int64 v15; // rbx\n__int64 v16; // rax\n_DWORD *v17; // r12\nunsigned int v18; // edx\nchar v20[96]; // [rsp+20h] [rbp-130h] BYREF\nchar v21; // [rsp+80h] [rbp-D0h] BYREF\n__int64 v22; // [rsp+90h] [rbp-C0h]\n__int64 v23; // [rsp+98h] [rbp-B8h]\n__int64 v24; // [rsp+A0h] [rbp-B0h]\n__int64 v25; // [rsp+A8h] [rbp-A8h]\n__m128 v26; // [rsp+B0h] [rbp-A0h]\n__m128 v27; // [rsp+C0h] [rbp-90h]\n__m128 v28; // [rsp+D0h] [rbp-80h]\n__m128 v29; // [rsp+E0h] [rbp-70h]\n__m128 v30; // [rsp+F0h] [rbp-60h]\n__m128 v31; // [rsp+100h] [rbp-50h]\n__m128 v32; // [rsp+110h] [rbp-40h]\n__m128 v33; // [rsp+120h] [rbp-30h]\n\nv26 = a7;\nv27 = a8;\nv28 = a9;\nv29 = a10;\nv30 = a11;\nv31 = a12;\nv32 = a13;\nv33 = a14;\nv22 = a3;\nv23 = a4;\nv24 = a5;\nv25 = a6;\nv15 = (unsigned __int64)v20;\nif ( _asan_option_detect_stack_use_after_return )\n{\nv16 = __asan_stack_malloc_1();\nif ( v16 )\nv15 = v16;\n}\n*(_QWORD *)v15 = 1102416563LL;\n*(_QWORD *)(v15 + 8) = \"1 32 24 6 va:409\";\n*(_QWORD *)(v15 + 16) = sub_403A5E;\nv17 = (_DWORD *)(v15 >> 3);\nv17[536862720] = -235802127;\nv17[536862721] = -218103808;\nv17[536862722] = -202116109;\n*(_DWORD *)(v15 + 32) = 16;\n*(_DWORD *)(v15 + 36) = 48;\n*(_QWORD *)(v15 + 40) = &a15;\n*(_QWORD *)(v15 + 48) = &v21;\nv18 = sub_403A05(a1, a2, (void *)(v15 + 32));\nif ( v20 == (char *)v15 )\n{\n*(_QWORD *)((v15 >> 3) + 0x7FFF8000) = 0LL;\n*(_DWORD *)((v15 >> 3) + 0x7FFF8008) = 0;\n}\nelse\n{\n*(_QWORD *)v15 = 1172321806LL;\n*(_QWORD *)((v15 >> 3) + 0x7FFF8000) = 0xF5F5F5F5F5F5F5F5LL;\n*(_DWORD *)((v15 >> 3) + 0x7FFF8008) = -168430091;\n**(_BYTE **)(v15 + 120) = 0;\n}\nreturn v18;\n}\n\n\n\nQ:[a2,sub_403A5E,sub_403A05,]", "hints": "[]", "response": "{'a2': 'format', 'sub_403A5E': 'xasprintf', 'sub_403A05': 'xvasprintf'}"} | [
[
0.755546510219574,
0.7552051544189453,
0.7527952790260315,
0.7434356808662415,
0.7260645627975464,
0.720960795879364,
0.7195005416870117,
0.7192075848579407,
0.7184736132621765,
0.7173150777816772,
0.7134982943534851,
0.7094539403915405,
0.7070037126541138,
0.7066187262535095,
0.703876256942749,
0.7029932737350464,
0.70265793800354,
0.7023134827613831,
0.7014561891555786,
0.69706130027771
],
[
22094,
64056,
210911,
208591,
12326,
82178,
30281,
39138,
126223,
86546,
253394,
8373,
229683,
18318,
67176,
71104,
111270,
206307,
107169,
210651
]
] |
|
send_length | 163ae97d33eec22b47ee6ffb39d267f44b312fa1a7ee6c73b807e64d10b38cad | haakonnessjoen | librouteros-api | NA | static int send_length(struct ros_connection *conn, int len) {
char data[4];
int written;
int towrite;
if (len < 0x80) {
data[0] = (char)len;
written = _write(conn->socket, data, 1);
towrite = 1;
}
else if (len < 0x4000) {
len = htons(len);
memcpy(data, &len, 2);
data[0] |= 0x80;
written = _write(conn->socket, data, 2);
towrite = 2;
}
else if (len < 0x200000)
{
len = htonl(len);
memcpy(data, &len, 3);
data[0] |= 0xc0;
written = _write(conn->socket, data, 3);
towrite = 3;
}
else if (len < 0x10000000)
{
len = htonl(len);
memcpy(data, &len, 4);
data[0] |= 0xe0;
written = _write(conn->socket, data, 4);
towrite = 4;
}
else // this should never happen
{
printf("length of word is %d\n", len);
printf("word is too long.\n");
exit(1);
}
return written == towrite ? 1 : 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4016CD", "function_addr": 4200141, "binary_name": "163ae97d33eec22b47ee6ffb39d267f44b312fa1a7ee6c73b807e64d10b38cad.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+hostlong], esi"], [5, "mov eax, [rbp+hostlong]"], [6, "cmp eax, 7Fh"], [7, "jg short loc_401713"], [8, "mov eax, [rbp+hostlong]"], [9, "mov byte ptr [rbp+buf], al"], [10, "mov rax, [rbp+var_18]"], [11, "mov eax, [rax+4]"], [12, "lea rcx, [rbp+buf]"], [13, "mov edx, 1"], [14, "mov rsi, rcx"], [15, "mov edi, eax"], [16, "call _write"], [17, "mov [rbp+var_4], eax"], [18, "mov [rbp+var_8], 1"], [19, "jmp loc_40183F"], [20, "mov eax, [rbp+hostlong]"], [21, "cmp eax, 3FFFh"], [22, "jg short loc_40176B"], [23, "mov eax, [rbp+hostlong]"], [24, "movzx eax, ax"], [25, "mov edi, eax"], [26, "call _htons"], [27, "movzx eax, ax"], [28, "mov [rbp+hostlong], eax"], [29, "movzx eax, word ptr [rbp+hostlong]"], [30, "mov word ptr [rbp+buf], ax"], [31, "movzx eax, byte ptr [rbp+buf]"], [32, "or eax, 0FFFFFF80h"], [33, "mov byte ptr [rbp+buf], al"], [34, "mov rax, [rbp+var_18]"], [35, "mov eax, [rax+4]"], [36, "lea rcx, [rbp+buf]"], [37, "mov edx, 2"], [38, "mov rsi, rcx"], [39, "mov edi, eax"], [40, "call _write"], [41, "mov [rbp+var_4], eax"], [42, "mov [rbp+var_8], 2"], [43, "jmp loc_40183F"], [44, "mov eax, [rbp+hostlong]"], [45, "cmp eax, 1FFFFFh"], [46, "jg short loc_4017CA"], [47, "mov eax, [rbp+hostlong]"], [48, "mov edi, eax"], [49, "call _htonl"], [50, "mov [rbp+hostlong], eax"], [51, "lea rcx, [rbp+hostlong]"], [52, "lea rax, [rbp+buf]"], [53, "mov edx, 3"], [54, "mov rsi, rcx"], [55, "mov rdi, rax"], [56, "call _memcpy"], [57, "movzx eax, byte ptr [rbp+buf]"], [58, "or eax, 0FFFFFFC0h"], [59, "mov byte ptr [rbp+buf], al"], [60, "mov rax, [rbp+var_18]"], [61, "mov eax, [rax+4]"], [62, "lea rcx, [rbp+buf]"], [63, "mov edx, 3"], [64, "mov rsi, rcx"], [65, "mov edi, eax"], [66, "call _write"], [67, "mov [rbp+var_4], eax"], [68, "mov [rbp+var_8], 3"], [69, "jmp short loc_40183F"], [70, "mov eax, [rbp+hostlong]"], [71, "cmp eax, 0FFFFFFFh"], [72, "jg short loc_401817"], [73, "mov eax, [rbp+hostlong]"], [74, "mov edi, eax"], [75, "call _htonl"], [76, "mov [rbp+hostlong], eax"], [77, "mov eax, [rbp+hostlong]"], [78, "mov [rbp+buf], eax"], [79, "movzx eax, byte ptr [rbp+buf]"], [80, "or eax, 0FFFFFFE0h"], [81, "mov byte ptr [rbp+buf], al"], [82, "mov rax, [rbp+var_18]"], [83, "mov eax, [rax+4]"], [84, "lea rcx, [rbp+buf]"], [85, "mov edx, 4"], [86, "mov rsi, rcx"], [87, "mov edi, eax"], [88, "call _write"], [89, "mov [rbp+var_4], eax"], [90, "mov [rbp+var_8], 4"], [91, "jmp short loc_40183F"], [92, "mov eax, [rbp+hostlong]"], [93, "mov esi, eax"], [94, "mov edi, offset aLengthOfWordIs"], [95, "mov eax, 0"], [96, "call _printf"], [97, "mov edi, offset aWordIsTooLong"], [98, "call _puts"], [99, "mov edi, 1"], [100, "call _exit"], [101, "mov eax, [rbp+var_4]"], [102, "cmp eax, [rbp+var_8]"], [103, "setz al"], [104, "movzx eax, al"], [105, "leave"], [106, "retn"]], "data_dep": [[5, 4], [6, 5], [7, 6], [8, 4], [9, 8], [10, 3], [11, 10], [12, 9], [14, 12], [15, 11], [17, 16], [20, 4], [21, 20], [22, 21], [23, 4], [24, 23], [25, 24], [27, 26], [28, 27], [29, 28], [30, 29], [31, 30], [32, 31], [33, 32], [34, 3], [35, 34], [36, 33], [38, 36], [39, 35], [41, 40], [44, 4], [45, 44], [46, 45], [47, 4], [48, 47], [50, 49], [51, 50], [52, 49], [54, 51], [55, 52], [58, 57], [59, 58], [60, 3], [61, 60], [62, 59], [62, 51], [64, 62], [65, 61], [67, 66], [70, 4], [71, 70], [72, 71], [73, 4], [74, 73], [76, 75], [77, 76], [78, 77], [79, 78], [80, 79], [81, 80], [82, 3], [83, 82], [84, 81], [86, 84], [87, 83], [89, 88], [92, 4], [93, 92], [101, 17], [101, 41], [101, 89], [101, 67], [102, 18], [102, 68], [102, 42], [102, 90], [102, 101], [103, 102], [103, 101], [104, 103], [106, 104]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/163ae97d33eec22b47ee6ffb39d267f44b312fa1a7ee6c73b807e64d10b38cad_163ae97d33eec22b47ee6ffb39d267f44b312fa1a7ee6c73b807e64d10b38cad.jsonl.gz", "strip_func_name": "sub_4016CD", "query": "\n\n\n_BOOL8 __fastcall sub_4016CD(__int64 a1, signed int a2)\n{\nuint16_t v2; // ax\nuint32_t hostlong; // [rsp+4h] [rbp-1Ch] BYREF\n__int64 v5; // [rsp+8h] [rbp-18h]\nuint32_t buf; // [rsp+14h] [rbp-Ch] BYREF\nint v7; // [rsp+18h] [rbp-8h]\nint v8; // [rsp+1Ch] [rbp-4h]\n\nv5 = a1;\nhostlong = a2;\nif ( a2 > 127 )\n{\nif ( (int)hostlong > 0x3FFF )\n{\nif ( (int)hostlong > 0x1FFFFF )\n{\nif ( (int)hostlong > 0xFFFFFFF )\n{\nprintf(\"length of word is %d\\n\", hostlong);\nputs(\"word is too long.\");\nexit(1);\n}\nhostlong = htonl(hostlong);\nbuf = hostlong;\nLOBYTE(buf) = hostlong | 0xE0;\nv8 = write(*(_DWORD *)(v5 + 4), &buf, 4uLL);\nv7 = 4;\n}\nelse\n{\nhostlong = htonl(hostlong);\nmemcpy(&buf, &hostlong, 3uLL);\nLOBYTE(buf) = buf | 0xC0;\nv8 = write(*(_DWORD *)(v5 + 4), &buf, 3uLL);\nv7 = 3;\n}\n}\nelse\n{\nv2 = htons(hostlong);\nhostlong = v2;\nLOWORD(buf) = v2 | 0x80;\nv8 = write(*(_DWORD *)(v5 + 4), &buf, 2uLL);\nv7 = 2;\n}\n}\nelse\n{\nLOBYTE(buf) = hostlong;\nv8 = write(*(_DWORD *)(v5 + 4), &buf, 1uLL);\nv7 = 1;\n}\nreturn v8 == v7;\n}\n\n\n\nQ:[a1,a2,hostlong,v5,buf,v7,v8,sub_4016CD,]", "hints": "[]", "response": "{'a1': 'conn', 'a2': 'len', 'hostlong': 'lena', 'v5': 'conna', 'buf': 'data', 'v7': 'towrite', 'v8': 'written', 'sub_4016CD': 'send_length'}"} | [
[
0.7312451601028442,
0.7054193615913391,
0.70250004529953,
0.6980687379837036,
0.6979523301124573,
0.6947580575942993,
0.6904137134552002,
0.688228964805603,
0.6868047714233398,
0.6857777237892151,
0.6837838292121887,
0.682988166809082,
0.6829521656036377,
0.6823122501373291,
0.6816205382347107,
0.680573582649231,
0.6784679293632507,
0.6784189939498901,
0.6779874563217163,
0.6779874563217163
],
[
207053,
97846,
137338,
132419,
181442,
192261,
106428,
252375,
213950,
22595,
201702,
122648,
251162,
11216,
211206,
175484,
243244,
169619,
138564,
69449
]
] |
|
log_stderr | 9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc | google | linux-sensor | NA | static int log_stderr(const char *format, ...)
{
int result;
va_list args;
va_start(args, format);
result = vdprintf(STDERR_FILENO, format, args);
va_end(args);
return result;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4012DB", "function_addr": 4199131, "binary_name": "9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 0E0h"], [3, "mov [rbp+fmt], rdi"], [4, "mov [rbp+var_A8], rsi"], [5, "mov [rbp+var_A0], rdx"], [6, "mov [rbp+var_98], rcx"], [7, "mov [rbp+var_90], r8"], [8, "mov [rbp+var_88], r9"], [9, "test al, al"], [10, "jz short loc_401334"], [11, "movaps [rbp+var_80], xmm0"], [12, "movaps [rbp+var_70], xmm1"], [13, "movaps [rbp+var_60], xmm2"], [14, "movaps [rbp+var_50], xmm3"], [15, "movaps [rbp+var_40], xmm4"], [16, "movaps [rbp+var_30], xmm5"], [17, "movaps [rbp+var_20], xmm6"], [18, "movaps [rbp+var_10], xmm7"], [19, "mov [rbp+arg], 8"], [20, "mov [rbp+var_CC], 30h "], [21, "lea rax, [rbp+arg_0]"], [22, "mov [rbp+var_C8], rax"], [23, "lea rax, [rbp+var_B0]"], [24, "mov [rbp+var_C0], rax"], [25, "lea rdx, [rbp+arg]"], [26, "mov rax, [rbp+fmt]"], [27, "mov rsi, rax"], [28, "mov edi, 2"], [29, "call _vdprintf"], [30, "mov [rbp+var_B4], eax"], [31, "mov eax, [rbp+var_B4]"], [32, "leave"], [33, "retn"]], "data_dep": [[10, 9], [21, 9], [22, 21], [23, 21], [24, 23], [25, 19], [26, 3], [27, 26], [30, 29], [31, 30], [33, 31]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc_9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc.jsonl.gz", "strip_func_name": "sub_4012DB", "query": "\n\n\n__int64 sub_4012DB(const char *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, ...)\n{\ngcc_va_list arg; // [rsp+10h] [rbp-D0h] BYREF\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(arg, a6);\nv8 = a2;\nv9 = a3;\nv10 = a4;\nv11 = a5;\nv12 = a6;\narg[0].gp_offset = 8;\nreturn (unsigned int)vdprintf(2, a1, arg);\n}\n\n\n\nQ:[a1,arg,sub_4012DB,]", "hints": "[]", "response": "{'a1': 'format', 'arg': 'args', 'sub_4012DB': 'log_stderr'}"} | [
[
0.7126773595809937,
0.6977168321609497,
0.6881918907165527,
0.6791639924049377,
0.6734819412231445,
0.6708117127418518,
0.6688482761383057,
0.6678940057754517,
0.665601372718811,
0.6646990180015564,
0.6644693613052368,
0.6644616723060608,
0.663933515548706,
0.663101851940155,
0.6626209616661072,
0.6625280380249023,
0.6620370149612427,
0.6616026759147644,
0.6614237427711487,
0.6606773138046265
],
[
186557,
188754,
150287,
61033,
12383,
236240,
162464,
9125,
240607,
2927,
99618,
216844,
137180,
122137,
118801,
208527,
157812,
2876,
161138,
119392
]
] |
|
skipcom | 418d51dde1419e9530a62b81d2c28d1e3a0180b41dc717a19543f7ab5777225c | EtchedPixels | FUZIX | NA | int skipcom(void)
{ /* skip over comments */
int c, i = 0; /* i is the number of lines skipped */
/* skipcom is called after reading a / */
if (getc(finput) != '*')
error("illegal comment");
c = getc(finput);
while (c != EOF) {
while (c == '*') {
if ((c = getc(finput)) == '/')
return (i);
}
if (c == '\n')
++i;
c = getc(finput);
}
error("EOF inside comment");
/* NOTREACHED */
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_404EEA", "function_addr": 4214506, "binary_name": "418d51dde1419e9530a62b81d2c28d1e3a0180b41dc717a19543f7ab5777225c.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 10h"], [3, "mov [rbp+var_8], 0"], [4, "mov rax, cs:stream"], [5, "mov rdi, rax"], [6, "call _getc"], [7, "cmp eax, 2Ah "], [8, "jz short loc_404F1C"], [9, "mov edi, offset aIllegalComment"], [10, "mov eax, 0"], [11, "call error"], [12, "mov rax, cs:stream"], [13, "mov rdi, rax"], [14, "call _getc"], [15, "mov [rbp+var_4], eax"], [16, "jmp short loc_404F6F"], [17, "mov rax, cs:stream"], [18, "mov rdi, rax"], [19, "call _getc"], [20, "mov [rbp+var_4], eax"], [21, "cmp [rbp+var_4], 2Fh "], [22, "jnz short loc_404F4D"], [23, "mov eax, [rbp+var_8]"], [24, "jmp short locret_404F84"], [25, "cmp [rbp+var_4], 2Ah "], [26, "jz short loc_404F30"], [27, "cmp [rbp+var_4], 0Ah"], [28, "jnz short loc_404F5D"], [29, "add [rbp+var_8], 1"], [30, "mov rax, cs:stream"], [31, "mov rdi, rax"], [32, "call _getc"], [33, "mov [rbp+var_4], eax"], [34, "cmp [rbp+var_4], 0FFFFFFFFh"], [35, "jnz short loc_404F4D"], [36, "mov edi, offset aEofInsideComme"], [37, "mov eax, 0"], [38, "call error"], [39, "leave"], [40, "retn"]], "data_dep": [[5, 4], [7, 6], [8, 7], [13, 12], [15, 14], [18, 17], [20, 19], [21, 20], [22, 21], [23, 3], [23, 29], [25, 15], [25, 33], [25, 20], [26, 25], [27, 15], [27, 33], [27, 20], [28, 27], [29, 29], [29, 3], [31, 30], [33, 32], [34, 15], [34, 33], [35, 34], [40, 23], [40, 38]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/418d51dde1419e9530a62b81d2c28d1e3a0180b41dc717a19543f7ab5777225c_418d51dde1419e9530a62b81d2c28d1e3a0180b41dc717a19543f7ab5777225c.jsonl.gz", "strip_func_name": "sub_404EEA", "query": "\n\n\n__int64 sub_404EEA()\n{\nunsigned int v1; // [rsp+8h] [rbp-8h]\nint v2; // [rsp+Ch] [rbp-4h]\n\nv1 = 0;\nif ( getc(stream) != 42 )\nerror(\"illegal comment\");\nwhile ( 1 )\n{\nv2 = getc(stream);\nif ( v2 == -1 )\nbreak;\nwhile ( v2 == 42 )\n{\nv2 = getc(stream);\nif ( v2 == 47 )\nreturn v1;\n}\nif ( v2 == 10 )\n++v1;\n}\nreturn error(\"EOF inside comment\");\n}\n\n\n\nQ:[v2,sub_404EEA,]", "hints": "[]", "response": "{'v2': 'c', 'sub_404EEA': 'skipcom'}"} | [
[
0.8061123490333557,
0.801539957523346,
0.7811363339424133,
0.7692457437515259,
0.7652618885040283,
0.7632808089256287,
0.7595648765563965,
0.7558854222297668,
0.7554667592048645,
0.750548243522644,
0.7474995255470276,
0.7471641302108765,
0.7459108233451843,
0.7436602711677551,
0.7417110204696655,
0.7409397959709167,
0.7385839223861694,
0.7361946105957031,
0.7356170415878296,
0.7350553274154663
],
[
69714,
110867,
186422,
264687,
254605,
148895,
113490,
30092,
201044,
224118,
156537,
157074,
182512,
170930,
230360,
159982,
249284,
28242,
64691,
135774
]
] |
|
StdioFwrite | 001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13 | larryhe | tiny-c-interpreter | NA | void StdioFwrite(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
{
ReturnValue->Val->Integer = fwrite(Param[0]->Val->Pointer, Param[1]->Val->Integer, Param[2]->Val->Integer, Param[3]->Val->Pointer);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_41294C", "function_addr": 4270412, "binary_name": "001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_8], rdi"], [4, "mov [rbp+var_10], rsi"], [5, "mov [rbp+var_18], rdx"], [6, "mov [rbp+var_1C], ecx"], [7, "mov rax, [rbp+var_18]"], [8, "add rax, 18h"], [9, "mov rax, [rax]"], [10, "mov rax, [rax+8]"], [11, "mov rcx, [rax]"], [12, "mov rax, [rbp+var_18]"], [13, "add rax, 10h"], [14, "mov rax, [rax]"], [15, "mov rax, [rax+8]"], [16, "mov eax, [rax]"], [17, "movsxd rdx, eax"], [18, "mov rax, [rbp+var_18]"], [19, "add rax, 8"], [20, "mov rax, [rax]"], [21, "mov rax, [rax+8]"], [22, "mov eax, [rax]"], [23, "movsxd rsi, eax"], [24, "mov rax, [rbp+var_18]"], [25, "mov rax, [rax]"], [26, "mov rax, [rax+8]"], [27, "mov rax, [rax]"], [28, "mov rdi, rax"], [29, "call _fwrite"], [30, "mov rdx, rax"], [31, "mov rax, [rbp+var_10]"], [32, "mov rax, [rax+8]"], [33, "mov [rax], edx"], [34, "nop"], [35, "leave"], [36, "retn"]], "data_dep": [[7, 5], [8, 7], [9, 8], [10, 9], [11, 10], [12, 5], [13, 12], [14, 13], [15, 14], [16, 15], [17, 16], [18, 5], [19, 18], [20, 19], [21, 20], [22, 21], [23, 22], [24, 5], [25, 24], [26, 25], [27, 26], [28, 27], [30, 29], [31, 4], [32, 31], [33, 32], [33, 30], [36, 32]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13_001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13.jsonl.gz", "strip_func_name": "sub_41294C", "query": "\n\n\n_DWORD *__fastcall sub_41294C(__int64 a1, __int64 a2, _QWORD *a3)\n{\nint v3; // edx\n_DWORD *result; // rax\n\nv3 = fwrite(\n**(const void ***)(*a3 + 8LL),\n**(int **)(a3[1] + 8LL),\n**(int **)(a3[2] + 8LL),\n**(FILE ***)(a3[3] + 8LL));\nresult = *(_DWORD **)(a2 + 8);\n*result = v3;\nreturn result;\n}\n\n\n\nQ:[a3,a2,a1,v3,sub_41294C,]", "hints": "[]", "response": "{'a3': 'Param', 'a2': 'ReturnValue', 'a1': 'Parser', 'v3': 'Param', 'sub_41294C': 'StdioFwrite'}"} | [
[
0.6771374940872192,
0.6763269901275635,
0.6745225787162781,
0.6668758392333984,
0.6646656394004822,
0.6643103957176208,
0.6634960770606995,
0.6631880402565002,
0.6627568006515503,
0.6622170805931091,
0.6615816950798035,
0.6612242460250854,
0.659645676612854,
0.6594032645225525,
0.6592950224876404,
0.6591993570327759,
0.6584748029708862,
0.6451635360717773,
0.6450474858283997,
0.6449745297431946
],
[
73751,
20795,
48495,
218111,
128163,
168428,
205022,
120861,
106838,
236583,
130800,
26455,
180351,
143652,
189243,
137588,
241340,
235858,
155860,
247086
]
] |
|
_value_buf_append | 47f71cd70792a360c9603b3c792c3a37bd79dc8802def80796c67c9fb467a470 | rsms | jsont | NA | static void _value_buf_append(jsont_ctx_t* ctx, const uint8_t* data, size_t len) {
//printf("_value_buf_append(<ctx>, %p, %zu)\n", data, len);
if (ctx->value_buf.size == 0) {
assert(ctx->value_buf.data == 0);
ctx->value_buf.length = len;
ctx->value_buf.size = len * 2;
if (ctx->value_buf.size < _VALUE_BUF_MIN_SIZE) {
ctx->value_buf.size = _VALUE_BUF_MIN_SIZE;
}
ctx->value_buf.data = (uint8_t*)malloc(ctx->value_buf.size);
if (len != 0) {
memcpy(ctx->value_buf.data, data, len);
}
} else {
if (ctx->value_buf.length + len > ctx->value_buf.size) {
size_t new_size = ctx->value_buf.size + (len * 2);
ctx->value_buf.data = realloc(ctx->value_buf.data, new_size);
assert(ctx->value_buf.data != 0);
ctx->value_buf.size = new_size;
}
memcpy(ctx->value_buf.data + ctx->value_buf.length, data, len);
ctx->value_buf.length += len;
}
ctx->value_buf.inuse = true;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401C21", "function_addr": 4201505, "binary_name": "47f71cd70792a360c9603b3c792c3a37bd79dc8802def80796c67c9fb467a470.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+src], rsi"], [5, "mov [rbp+n], rdx"], [6, "mov rax, [rbp+var_18]"], [7, "mov rax, [rax+38h]"], [8, "test rax, rax"], [9, "jnz short loc_401CBE"], [10, "mov rax, [rbp+var_18]"], [11, "mov rdx, [rbp+n]"], [12, "mov [rax+40h], rdx"], [13, "mov rax, [rbp+n]"], [14, "lea rdx, [rax+rax]"], [15, "mov rax, [rbp+var_18]"], [16, "mov [rax+38h], rdx"], [17, "mov rax, [rbp+var_18]"], [18, "mov rax, [rax+38h]"], [19, "cmp rax, 3Fh "], [20, "ja short loc_401C78"], [21, "mov rax, [rbp+var_18]"], [22, "mov qword ptr [rax+38h], 40h "], [23, "mov rax, [rbp+var_18]"], [24, "mov rax, [rax+38h]"], [25, "mov rdi, rax"], [26, "call _malloc"], [27, "mov rdx, rax"], [28, "mov rax, [rbp+var_18]"], [29, "mov [rax+30h], rdx"], [30, "cmp [rbp+n], 0"], [31, "jz loc_401D59"], [32, "mov rax, [rbp+var_18]"], [33, "mov rax, [rax+30h]"], [34, "mov rdx, [rbp+n]"], [35, "mov rcx, [rbp+src]"], [36, "mov rsi, rcx"], [37, "mov rdi, rax"], [38, "call _memcpy"], [39, "jmp loc_401D59"], [40, "mov rax, [rbp+var_18]"], [41, "mov rdx, [rax+40h]"], [42, "mov rax, [rbp+n]"], [43, "add rdx, rax"], [44, "mov rax, [rbp+var_18]"], [45, "mov rax, [rax+38h]"], [46, "cmp rdx, rax"], [47, "jbe short loc_401D1B"], [48, "mov rax, [rbp+var_18]"], [49, "mov rdx, [rax+38h]"], [50, "mov rax, [rbp+n]"], [51, "add rax, rax"], [52, "add rax, rdx"], [53, "mov [rbp+size], rax"], [54, "mov rax, [rbp+var_18]"], [55, "mov rax, [rax+30h]"], [56, "mov rdx, [rbp+size]"], [57, "mov rsi, rdx"], [58, "mov rdi, rax"], [59, "call _realloc"], [60, "mov rdx, [rbp+var_18]"], [61, "mov [rdx+30h], rax"], [62, "mov rax, [rbp+var_18]"], [63, "mov rdx, [rbp+size]"], [64, "mov [rax+38h], rdx"], [65, "mov rax, [rbp+var_18]"], [66, "mov rdx, [rax+30h]"], [67, "mov rax, [rbp+var_18]"], [68, "mov rax, [rax+40h]"], [69, "lea rcx, [rdx+rax]"], [70, "mov rdx, [rbp+n]"], [71, "mov rax, [rbp+src]"], [72, "mov rsi, rax"], [73, "mov rdi, rcx"], [74, "call _memcpy"], [75, "mov rax, [rbp+var_18]"], [76, "mov rdx, [rax+40h]"], [77, "mov rax, [rbp+n]"], [78, "add rdx, rax"], [79, "mov rax, [rbp+var_18]"], [80, "mov [rax+40h], rdx"], [81, "mov rax, [rbp+var_18]"], [82, "mov byte ptr [rax+48h], 1"], [83, "nop"], [84, "leave"], [85, "retn"]], "data_dep": [[6, 3], [7, 6], [8, 7], [9, 8], [10, 3], [11, 5], [12, 10], [12, 11], [13, 5], [14, 13], [14, 12], [14, 11], [15, 3], [16, 15], [16, 14], [17, 3], [18, 17], [18, 16], [19, 18], [20, 19], [21, 3], [22, 21], [23, 3], [24, 12], [24, 23], [24, 16], [24, 29], [24, 22], [25, 24], [27, 26], [28, 3], [29, 27], [29, 28], [30, 5], [31, 30], [32, 3], [33, 29], [33, 22], [33, 12], [33, 16], [33, 32], [34, 5], [35, 4], [36, 35], [37, 33], [40, 3], [41, 40], [42, 5], [43, 41], [43, 42], [44, 3], [45, 44], [46, 43], [46, 45], [47, 46], [48, 3], [49, 48], [50, 5], [51, 50], [52, 49], [52, 51], [53, 52], [54, 3], [55, 54], [56, 53], [57, 56], [58, 55], [60, 3], [61, 60], [61, 59], [62, 3], [63, 53], [64, 62], [64, 63], [65, 3], [66, 80], [66, 64], [66, 61], [66, 65], [67, 3], [68, 61], [68, 67], [68, 80], [68, 64], [69, 80], [69, 64], [69, 68], [69, 61], [70, 5], [71, 4], [72, 71], [73, 69], [75, 3], [76, 61], [76, 80], [76, 64], [76, 75], [77, 5], [78, 77], [78, 76], [79, 3], [80, 78], [80, 79], [81, 3], [82, 81], [85, 81]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/47f71cd70792a360c9603b3c792c3a37bd79dc8802def80796c67c9fb467a470_47f71cd70792a360c9603b3c792c3a37bd79dc8802def80796c67c9fb467a470.jsonl.gz", "strip_func_name": "sub_401C21", "query": "\n\n\n__int64 __fastcall sub_401C21(__int64 a1, const void *a2, size_t a3)\n{\n__int64 result; // rax\n__int64 size; // [rsp+28h] [rbp-8h]\n\nif ( *(_QWORD *)(a1 + 56) )\n{\nif ( a3 + *(_QWORD *)(a1 + 64) > *(_QWORD *)(a1 + 56) )\n{\nsize = *(_QWORD *)(a1 + 56) + 2 * a3;\n*(_QWORD *)(a1 + 48) = realloc(*(void **)(a1 + 48), size);\n*(_QWORD *)(a1 + 56) = size;\n}\nmemcpy((void *)(*(_QWORD *)(a1 + 48) + *(_QWORD *)(a1 + 64)), a2, a3);\n*(_QWORD *)(a1 + 64) += a3;\n}\nelse\n{\n*(_QWORD *)(a1 + 64) = a3;\n*(_QWORD *)(a1 + 56) = 2 * a3;\nif ( *(_QWORD *)(a1 + 56) <= 0x3FuLL )\n*(_QWORD *)(a1 + 56) = 64LL;\n*(_QWORD *)(a1 + 48) = malloc(*(_QWORD *)(a1 + 56));\nif ( a3 )\nmemcpy(*(void **)(a1 + 48), a2, a3);\n}\nresult = a1;\n*(_BYTE *)(a1 + 72) = 1;\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,size,sub_401C21,]", "hints": "[]", "response": "{'a3': 'len', 'a1': 'ctx', 'a2': 'data', 'size': 'new_size', 'sub_401C21': '_value_buf_append'}"} | [
[
0.8801448345184326,
0.83104008436203,
0.8103957176208496,
0.8032294511795044,
0.7964491844177246,
0.7913220524787903,
0.7912473082542419,
0.7891857028007507,
0.7866109609603882,
0.7751672267913818,
0.7733750939369202,
0.7697631120681763,
0.7663459777832031,
0.7614824175834656,
0.7603639364242554,
0.7598472237586975,
0.7590839862823486,
0.7560145258903503,
0.7541863918304443,
0.7537680268287659
],
[
199608,
262258,
207542,
25327,
142950,
50934,
136207,
108371,
161778,
11024,
217300,
126627,
143390,
134740,
235753,
143742,
3870,
181644,
223943,
64559
]
] |
|
strip_string | a5d5b25cd438620c6efce9ec3bb72c00ffee4d285821814405e9ff2a1169a28c | coreboot | vboot | NA | void strip_string(char *s, const char *pattern)
{
int len;
assert(s);
len = strlen(s);
while (len-- > 0) {
if (pattern) {
if (!strchr(pattern, s[len]))
break;
} else {
if (!isascii(s[len]) || !isspace(s[len]))
break;
}
s[len] = '\0';
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_41D386", "function_addr": 4313990, "binary_name": "a5d5b25cd438620c6efce9ec3bb72c00ffee4d285821814405e9ff2a1169a28c.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+s], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov rax, [rbp+s]"], [6, "mov rdi, rax"], [7, "call _strlen"], [8, "mov [rbp+var_4], eax"], [9, "jmp loc_41D42E"], [10, "cmp [rbp+var_20], 0"], [11, "jz short loc_41D3D9"], [12, "mov eax, [rbp+var_4]"], [13, "movsxd rdx, eax"], [14, "mov rax, [rbp+s]"], [15, "add rax, rdx"], [16, "movzx eax, byte ptr [rax]"], [17, "movsx edx, al"], [18, "mov rax, [rbp+var_20]"], [19, "mov esi, edx"], [20, "mov rdi, rax"], [21, "call _strchr"], [22, "test rax, rax"], [23, "jnz short loc_41D41E"], [24, "jmp short loc_41D441"], [25, "mov eax, [rbp+var_4]"], [26, "movsxd rdx, eax"], [27, "mov rax, [rbp+s]"], [28, "add rax, rdx"], [29, "movzx eax, byte ptr [rax]"], [30, "test al, al"], [31, "js short loc_41D441"], [32, "call ___ctype_b_loc"], [33, "mov rdx, [rax]"], [34, "mov eax, [rbp+var_4]"], [35, "movsxd rcx, eax"], [36, "mov rax, [rbp+s]"], [37, "add rax, rcx"], [38, "movzx eax, byte ptr [rax]"], [39, "movsx rax, al"], [40, "add rax, rax"], [41, "add rax, rdx"], [42, "movzx eax, word ptr [rax]"], [43, "movzx eax, ax"], [44, "and eax, 2000h"], [45, "test eax, eax"], [46, "jz short loc_41D441"], [47, "mov eax, [rbp+var_4]"], [48, "movsxd rdx, eax"], [49, "mov rax, [rbp+s]"], [50, "add rax, rdx"], [51, "mov byte ptr [rax], 0"], [52, "mov eax, [rbp+var_4]"], [53, "lea edx, [rax-1]"], [54, "mov [rbp+var_4], edx"], [55, "test eax, eax"], [56, "jg loc_41D3AA"], [57, "jmp short $+2"], [58, "nop"], [59, "leave"], [60, "retn"]], "data_dep": [[5, 3], [6, 5], [8, 7], [10, 4], [11, 10], [12, 54], [13, 12], [14, 3], [15, 14], [15, 13], [16, 15], [16, 51], [17, 16], [18, 4], [19, 17], [20, 18], [22, 21], [23, 22], [25, 54], [26, 25], [27, 3], [28, 27], [28, 26], [29, 28], [29, 51], [30, 29], [31, 30], [33, 51], [33, 32], [34, 54], [35, 34], [36, 3], [37, 36], [37, 35], [38, 37], [38, 51], [39, 38], [40, 39], [41, 40], [41, 33], [42, 51], [42, 41], [43, 42], [44, 43], [45, 44], [46, 45], [47, 54], [48, 47], [49, 3], [50, 49], [50, 48], [51, 50], [52, 54], [52, 8], [53, 52], [53, 51], [53, 48], [54, 53], [55, 52], [56, 55], [60, 22], [60, 55], [60, 30], [60, 45]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/a5d5b25cd438620c6efce9ec3bb72c00ffee4d285821814405e9ff2a1169a28c_a5d5b25cd438620c6efce9ec3bb72c00ffee4d285821814405e9ff2a1169a28c.jsonl.gz", "strip_func_name": "sub_41D386", "query": "\n\n\nunsigned __int64 __fastcall sub_41D386(const char *a1, const char *a2)\n{\nunsigned __int64 result; // rax\nunsigned int i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = strlen(a1); ; a1[i] = 0 )\n{\nresult = i--;\nif ( (int)result <= 0 )\nbreak;\nif ( a2 )\n{\nresult = (unsigned __int64)strchr(a2, a1[i]);\nif ( !result )\nreturn result;\n}\nelse\n{\nresult = (unsigned __int8)a1[i];\nif ( (result & 0x80u) != 0LL )\nreturn result;\nresult = (*__ctype_b_loc())[a1[i]] & 0x2000;\nif ( !(_DWORD)result )\nreturn result;\n}\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,i,sub_41D386,]", "hints": "[]", "response": "{'a1': 's', 'a2': 'pattern', 'i': 'len', 'sub_41D386': 'strip_string'}"} | [
[
0.7727501392364502,
0.7566309571266174,
0.7522737383842468,
0.7446926832199097,
0.7344167828559875,
0.7287877202033997,
0.727298378944397,
0.7268403172492981,
0.7216300368309021,
0.7200497388839722,
0.7191703915596008,
0.7187818288803101,
0.7148674726486206,
0.7130385041236877,
0.7111326456069946,
0.7086632251739502,
0.707994282245636,
0.7072234749794006,
0.7067907452583313,
0.7017701864242554
],
[
47593,
37105,
15094,
8449,
215781,
212142,
62293,
164436,
49411,
81695,
97289,
175662,
28473,
260624,
255934,
88781,
149821,
194909,
241125,
16631
]
] |
|
printSizeAsHumanReadable | e525944bf07a102c96ba8f1afd1064984c7658ac0a6c1efaf0b267afc79090e1 | dm-vdo | vdo | NA | static void printSizeAsHumanReadable(const int aFieldWidth,
const uint64_t aSize)
{
static const char UNITS[] = { 'B', 'K', 'M', 'G', 'T' };
double size = (double) aSize;
int divisor = si ? 1000 : 1024;
unsigned int i = 0;
while ((size >= divisor) && (i < (ARRAY_SIZE(UNITS) - 1))) {
size /= divisor;
i++;
}
printf("%*.1f%c ", aFieldWidth - 1, size, UNITS[i]);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402836", "function_addr": 4204598, "binary_name": "e525944bf07a102c96ba8f1afd1064984c7658ac0a6c1efaf0b267afc79090e1.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_14], edi"], [4, "mov [rbp+var_20], rsi"], [5, "mov rax, [rbp+var_20]"], [6, "test rax, rax"], [7, "js short loc_402859"], [8, "pxor xmm0, xmm0"], [9, "cvtsi2sd xmm0, rax"], [10, "jmp short loc_402872"], [11, "mov rdx, rax"], [12, "shr rdx, 1"], [13, "and eax, 1"], [14, "or rdx, rax"], [15, "pxor xmm0, xmm0"], [16, "cvtsi2sd xmm0, rdx"], [17, "addsd xmm0, xmm0"], [18, "movsd [rbp+var_8], xmm0"], [19, "movzx eax, cs:byte_41556D"], [20, "test al, al"], [21, "jz short loc_402889"], [22, "mov eax, 3E8h"], [23, "jmp short loc_40288E"], [24, "mov eax, 400h"], [25, "mov [rbp+var_10], eax"], [26, "mov [rbp+var_C], 0"], [27, "jmp short loc_4028B5"], [28, "pxor xmm1, xmm1"], [29, "cvtsi2sd xmm1, [rbp+var_10]"], [30, "movsd xmm0, [rbp+var_8]"], [31, "divsd xmm0, xmm1"], [32, "movsd [rbp+var_8], xmm0"], [33, "add [rbp+var_C], 1"], [34, "pxor xmm1, xmm1"], [35, "cvtsi2sd xmm1, [rbp+var_10]"], [36, "movsd xmm0, [rbp+var_8]"], [37, "comisd xmm0, xmm1"], [38, "jb short loc_4028CF"], [39, "cmp [rbp+var_C], 3"], [40, "jbe short loc_40289A"], [41, "mov eax, [rbp+var_C]"], [42, "lea rdx, aBkmgt"], [43, "movzx eax, byte ptr [rax+rdx]"], [44, "movsx edx, al"], [45, "mov eax, [rbp+var_14]"], [46, "lea ecx, [rax-1]"], [47, "mov rax, [rbp+var_8]"], [48, "movq xmm0, rax"], [49, "mov esi, ecx"], [50, "lea rdi, format"], [51, "mov eax, 1"], [52, "call _printf"], [53, "nop"], [54, "leave"], [55, "retn"]], "data_dep": [[5, 4], [6, 5], [7, 6], [9, 8], [9, 6], [11, 6], [12, 11], [13, 6], [14, 13], [14, 12], [16, 15], [16, 14], [17, 16], [18, 17], [18, 9], [20, 19], [21, 20], [25, 22], [25, 24], [29, 25], [29, 28], [30, 18], [30, 32], [31, 29], [31, 30], [32, 31], [33, 26], [33, 33], [35, 25], [35, 34], [36, 18], [36, 32], [37, 36], [37, 35], [38, 20], [38, 33], [39, 33], [39, 26], [40, 39], [41, 33], [41, 26], [42, 14], [43, 41], [44, 43], [45, 3], [46, 45], [47, 18], [47, 32], [48, 47], [49, 46], [55, 52]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e525944bf07a102c96ba8f1afd1064984c7658ac0a6c1efaf0b267afc79090e1_e525944bf07a102c96ba8f1afd1064984c7658ac0a6c1efaf0b267afc79090e1.jsonl.gz", "strip_func_name": "sub_402836", "query": "\n\n\nint __fastcall sub_402836(int a1, __int64 a2)\n{\ndouble v2; // xmm0_8\nint v3; // eax\nunsigned int i; // [rsp+14h] [rbp-Ch]\ndouble v6; // [rsp+18h] [rbp-8h]\n\nif ( a2 < 0 )\nv2 = (double)(int)(a2 & 1 | ((unsigned __int64)a2 >> 1)) + (double)(int)(a2 & 1 | ((unsigned __int64)a2 >> 1));\nelse\nv2 = (double)(int)a2;\nv6 = v2;\nif ( byte_41556D )\nv3 = 1000;\nelse\nv3 = 1024;\nfor ( i = 0; v6 >= (double)v3 && i <= 3; ++i )\nv6 = v6 / (double)v3;\nreturn printf(\"%*.1f%c \", a1 - 1, v6, (unsigned int)aBkmgt[i]);\n}\n\n\n\nQ:[a1,a2,v6,sub_402836,]", "hints": "[]", "response": "{'a1': 'aFieldWidth', 'a2': 'aSize', 'v6': 'size', 'sub_402836': 'printSizeAsHumanReadable'}"} | [
[
0.7242056131362915,
0.720111072063446,
0.714234471321106,
0.6992661952972412,
0.6921677589416504,
0.6784132122993469,
0.6761781573295593,
0.6699120402336121,
0.6622146964073181,
0.6612980961799622,
0.6603624820709229,
0.6572462916374207,
0.6569525599479675,
0.6518890857696533,
0.6516718864440918,
0.6514345407485962,
0.6511745452880859,
0.6509514451026917,
0.6488728523254395,
0.6451603174209595
],
[
199876,
164039,
209930,
245937,
250340,
149108,
3801,
145605,
84852,
256865,
221441,
230432,
173832,
253191,
39462,
190314,
107088,
188767,
96148,
95061
]
] |
|
token_to_operator | 7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53 | kgabis | ape | NA | static operator_t token_to_operator(token_type_t tk) {
switch (tk) {
case TOKEN_ASSIGN: return OPERATOR_ASSIGN;
case TOKEN_PLUS: return OPERATOR_PLUS;
case TOKEN_MINUS: return OPERATOR_MINUS;
case TOKEN_BANG: return OPERATOR_BANG;
case TOKEN_ASTERISK: return OPERATOR_ASTERISK;
case TOKEN_SLASH: return OPERATOR_SLASH;
case TOKEN_LT: return OPERATOR_LT;
case TOKEN_LTE: return OPERATOR_LTE;
case TOKEN_GT: return OPERATOR_GT;
case TOKEN_GTE: return OPERATOR_GTE;
case TOKEN_EQ: return OPERATOR_EQ;
case TOKEN_NOT_EQ: return OPERATOR_NOT_EQ;
case TOKEN_PERCENT: return OPERATOR_MODULUS;
case TOKEN_AND: return OPERATOR_LOGICAL_AND;
case TOKEN_OR: return OPERATOR_LOGICAL_OR;
case TOKEN_PLUS_ASSIGN: return OPERATOR_PLUS;
case TOKEN_MINUS_ASSIGN: return OPERATOR_MINUS;
case TOKEN_ASTERISK_ASSIGN: return OPERATOR_ASTERISK;
case TOKEN_SLASH_ASSIGN: return OPERATOR_SLASH;
case TOKEN_PERCENT_ASSIGN: return OPERATOR_MODULUS;
case TOKEN_BIT_AND_ASSIGN: return OPERATOR_BIT_AND;
case TOKEN_BIT_OR_ASSIGN: return OPERATOR_BIT_OR;
case TOKEN_BIT_XOR_ASSIGN: return OPERATOR_BIT_XOR;
case TOKEN_LSHIFT_ASSIGN: return OPERATOR_LSHIFT;
case TOKEN_RSHIFT_ASSIGN: return OPERATOR_RSHIFT;
case TOKEN_BIT_AND: return OPERATOR_BIT_AND;
case TOKEN_BIT_OR: return OPERATOR_BIT_OR;
case TOKEN_BIT_XOR: return OPERATOR_BIT_XOR;
case TOKEN_LSHIFT: return OPERATOR_LSHIFT;
case TOKEN_RSHIFT: return OPERATOR_RSHIFT;
case TOKEN_PLUS_PLUS: return OPERATOR_PLUS;
case TOKEN_MINUS_MINUS: return OPERATOR_MINUS;
default: {
APE_ASSERT(false);
return OPERATOR_NONE;
}
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40E18C", "function_addr": 4252044, "binary_name": "7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_4], edi"], [3, "cmp [rbp+var_4], 2Ch"], [4, "ja def_40E1A8"], [5, "mov eax, [rbp+var_4]"], [6, "mov rax, ds:jpt_40E1A8[rax*8]"], [7, "jmp rax"], [8, "mov eax, 1"], [9, "jmp loc_40E2B9"], [10, "mov eax, 2"], [11, "jmp loc_40E2B9"], [12, "mov eax, 3"], [13, "jmp loc_40E2B9"], [14, "mov eax, 4"], [15, "jmp loc_40E2B9"], [16, "mov eax, 5"], [17, "jmp loc_40E2B9"], [18, "mov eax, 6"], [19, "jmp loc_40E2B9"], [20, "mov eax, 7"], [21, "jmp loc_40E2B9"], [22, "mov eax, 8"], [23, "jmp loc_40E2B9"], [24, "mov eax, 9"], [25, "jmp loc_40E2B9"], [26, "mov eax, 0Ah"], [27, "jmp loc_40E2B9"], [28, "mov eax, 0Bh"], [29, "jmp loc_40E2B9"], [30, "mov eax, 0Ch"], [31, "jmp loc_40E2B9"], [32, "mov eax, 0Dh"], [33, "jmp loc_40E2B9"], [34, "mov eax, 0Eh"], [35, "jmp loc_40E2B9"], [36, "mov eax, 0Fh"], [37, "jmp short loc_40E2B9"], [38, "mov eax, 2"], [39, "jmp short loc_40E2B9"], [40, "mov eax, 3"], [41, "jmp short loc_40E2B9"], [42, "mov eax, 5"], [43, "jmp short loc_40E2B9"], [44, "mov eax, 6"], [45, "jmp short loc_40E2B9"], [46, "mov eax, 0Dh"], [47, "jmp short loc_40E2B9"], [48, "mov eax, 10h"], [49, "jmp short loc_40E2B9"], [50, "mov eax, 11h"], [51, "jmp short loc_40E2B9"], [52, "mov eax, 12h"], [53, "jmp short loc_40E2B9"], [54, "mov eax, 13h"], [55, "jmp short loc_40E2B9"], [56, "mov eax, 14h"], [57, "jmp short loc_40E2B9"], [58, "mov eax, 10h"], [59, "jmp short loc_40E2B9"], [60, "mov eax, 11h"], [61, "jmp short loc_40E2B9"], [62, "mov eax, 12h"], [63, "jmp short loc_40E2B9"], [64, "mov eax, 13h"], [65, "jmp short loc_40E2B9"], [66, "mov eax, 14h"], [67, "jmp short loc_40E2B9"], [68, "mov eax, 2"], [69, "jmp short loc_40E2B9"], [70, "mov eax, 3"], [71, "jmp short loc_40E2B9"], [72, "mov eax, 0"], [73, "pop rbp"], [74, "retn"]], "data_dep": [[3, 2], [4, 3], [5, 2], [7, 6], [73, 0], [74, 40], [74, 46], [74, 52], [74, 58], [74, 64], [74, 70], [74, 12], [74, 18], [74, 24], [74, 30], [74, 36], [74, 42], [74, 48], [74, 54], [74, 60], [74, 8], [74, 66], [74, 72], [74, 14], [74, 20], [74, 26], [74, 32], [74, 38], [74, 44], [74, 50], [74, 56], [74, 62], [74, 68], [74, 10], [74, 16], [74, 22], [74, 28], [74, 34]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53_7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53.jsonl.gz", "strip_func_name": "sub_40E18C", "query": "\n\n\n__int64 __fastcall sub_40E18C(int a1)\n{\n__int64 result; // rax\n\nswitch ( a1 )\n{\ncase 2:\nresult = 1LL;\nbreak;\ncase 3:\nresult = 2LL;\nbreak;\ncase 4:\nresult = 3LL;\nbreak;\ncase 5:\nresult = 5LL;\nbreak;\ncase 6:\nresult = 6LL;\nbreak;\ncase 7:\nresult = 13LL;\nbreak;\ncase 8:\nresult = 16LL;\nbreak;\ncase 9:\nresult = 17LL;\nbreak;\ncase 10:\nresult = 18LL;\nbreak;\ncase 11:\nresult = 19LL;\nbreak;\ncase 12:\nresult = 20LL;\nbreak;\ncase 14:\nresult = 2LL;\nbreak;\ncase 15:\nresult = 2LL;\nbreak;\ncase 16:\nresult = 3LL;\nbreak;\ncase 17:\nresult = 3LL;\nbreak;\ncase 18:\nresult = 4LL;\nbreak;\ncase 19:\nresult = 5LL;\nbreak;\ncase 20:\nresult = 6LL;\nbreak;\ncase 21:\nresult = 7LL;\nbreak;\ncase 22:\nresult = 8LL;\nbreak;\ncase 23:\nresult = 9LL;\nbreak;\ncase 24:\nresult = 10LL;\nbreak;\ncase 25:\nresult = 11LL;\nbreak;\ncase 26:\nresult = 12LL;\nbreak;\ncase 27:\nresult = 14LL;\nbreak;\ncase 28:\nresult = 15LL;\nbreak;\ncase 29:\nresult = 16LL;\nbreak;\ncase 30:\nresult = 17LL;\nbreak;\ncase 31:\nresult = 18LL;\nbreak;\ncase 32:\nresult = 19LL;\nbreak;\ncase 33:\nresult = 20LL;\nbreak;\ncase 44:\nresult = 13LL;\nbreak;\ndefault:\nresult = 0LL;\nbreak;\n}\nreturn result;\n}\n\n\n\nQ:[a1,sub_40E18C,]", "hints": "[]", "response": "{'a1': 'tk', 'sub_40E18C': 'token_to_operator'}"} | [
[
0.8668208122253418,
0.8599822521209717,
0.8539843559265137,
0.8518781065940857,
0.8484907746315002,
0.8426221013069153,
0.8322148323059082,
0.8320420384407043,
0.829076886177063,
0.8263906836509705,
0.8226426243782043,
0.8220357298851013,
0.813713550567627,
0.8112251162528992,
0.809979259967804,
0.809901237487793,
0.8015963435173035,
0.8008649349212646,
0.7945854663848877,
0.7897707223892212
],
[
54940,
94655,
132079,
209809,
111124,
171202,
26898,
243613,
103521,
169078,
218289,
97295,
115519,
177777,
60405,
108051,
223604,
195337,
225811,
212373
]
] |
|
setup_daemon | 4a2436d19e8ef0321db858769cd0f4bb117e0463889ac368782c1575f4f6d0f6 | seclab-ucr | INTANG | NA | void setup_daemon()
{
pid_t pid, sid;
pid = fork();
if (pid < 0) {
fprintf(stderr, "fork failed.\n");
exit(EXIT_FAILURE);
}
if (pid > 0)
exit(EXIT_SUCCESS);
umask(0);
sid = setsid();
if (sid < 0) {
fprintf(stderr, "setsid failed.\n");
exit(EXIT_FAILURE);
}
//if (chdir("/") < 0)
// exit(EXIT_FAILURE);
close(STDIN_FILENO);
//close(STDOUT_FILENO);
//close(STDERR_FILENO);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40648A", "function_addr": 4220042, "binary_name": "4a2436d19e8ef0321db858769cd0f4bb117e0463889ac368782c1575f4f6d0f6.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 10h"], [3, "call _fork"], [4, "mov [rbp+var_4], eax"], [5, "cmp [rbp+var_4], 0"], [6, "jns short loc_4064C8"], [7, "mov rax, cs:stderr"], [8, "mov rcx, rax"], [9, "mov edx, 0Dh"], [10, "mov esi, 1"], [11, "mov edi, offset aForkFailed"], [12, "call _fwrite"], [13, "mov edi, 1"], [14, "call _exit"], [15, "cmp [rbp+var_4], 0"], [16, "jle short loc_4064D8"], [17, "mov edi, 0"], [18, "call _exit"], [19, "mov edi, 0"], [20, "call _umask"], [21, "call _setsid"], [22, "mov [rbp+var_8], eax"], [23, "cmp [rbp+var_8], 0"], [24, "jns short loc_406518"], [25, "mov rax, cs:stderr"], [26, "mov rcx, rax"], [27, "mov edx, 0Fh"], [28, "mov esi, 1"], [29, "mov edi, offset aSetsidFailed"], [30, "call _fwrite"], [31, "mov edi, 1"], [32, "call _exit"], [33, "mov edi, 0"], [34, "call _close"], [35, "nop"], [36, "leave"], [37, "retn"]], "data_dep": [[4, 3], [5, 4], [6, 5], [8, 7], [15, 4], [16, 15], [22, 21], [23, 22], [24, 23], [26, 25], [37, 34]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/4a2436d19e8ef0321db858769cd0f4bb117e0463889ac368782c1575f4f6d0f6_4a2436d19e8ef0321db858769cd0f4bb117e0463889ac368782c1575f4f6d0f6.jsonl.gz", "strip_func_name": "sub_40648A", "query": "\n\n\nint sub_40648A()\n{\n__pid_t v1; // [rsp+Ch] [rbp-4h]\n\nv1 = fork();\nif ( v1 < 0 )\n{\nfwrite(\"fork failed.\\n\", 1uLL, 0xDuLL, stderr);\nexit(1);\n}\nif ( v1 > 0 )\nexit(0);\numask(0);\nif ( setsid() < 0 )\n{\nfwrite(\"setsid failed.\\n\", 1uLL, 0xFuLL, stderr);\nexit(1);\n}\nreturn close(0);\n}\n\n\n\nQ:[v1,sub_40648A,]", "hints": "[]", "response": "{'v1': 'pid', 'sub_40648A': 'setup_daemon'}"} | [
[
0.8747445344924927,
0.8659857511520386,
0.8595138788223267,
0.8594772219657898,
0.8420319557189941,
0.8360192775726318,
0.8194480538368225,
0.8185324668884277,
0.8149895668029785,
0.8050888180732727,
0.7995539903640747,
0.7984181642532349,
0.797398030757904,
0.7953861951828003,
0.792352020740509,
0.7920413017272949,
0.7905887365341187,
0.7780077457427979,
0.7774718403816223,
0.7770483493804932
],
[
126379,
229702,
80685,
35698,
235430,
173556,
135606,
242197,
236292,
260326,
203025,
125039,
250539,
224156,
116789,
155167,
211478,
101466,
54398,
100812
]
] |
|
utf8proc_encode_char | f61ed8ef6ab5ad7275499f10ef94c8c2326a67232c2cc9190dbdb630ddbc2c7b | 0x09 | hfsfuse | NA | UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_encode_char(utf8proc_int32_t uc, utf8proc_uint8_t *dst) {
if (uc < 0x00) {
return 0;
} else if (uc < 0x80) {
dst[0] = (utf8proc_uint8_t) uc;
return 1;
} else if (uc < 0x800) {
dst[0] = (utf8proc_uint8_t)(0xC0 + (uc >> 6));
dst[1] = (utf8proc_uint8_t)(0x80 + (uc & 0x3F));
return 2;
// Note: we allow encoding 0xd800-0xdfff here, so as not to change
// the API, however, these are actually invalid in UTF-8
} else if (uc < 0x10000) {
dst[0] = (utf8proc_uint8_t)(0xE0 + (uc >> 12));
dst[1] = (utf8proc_uint8_t)(0x80 + ((uc >> 6) & 0x3F));
dst[2] = (utf8proc_uint8_t)(0x80 + (uc & 0x3F));
return 3;
} else if (uc < 0x110000) {
dst[0] = (utf8proc_uint8_t)(0xF0 + (uc >> 18));
dst[1] = (utf8proc_uint8_t)(0x80 + ((uc >> 12) & 0x3F));
dst[2] = (utf8proc_uint8_t)(0x80 + ((uc >> 6) & 0x3F));
dst[3] = (utf8proc_uint8_t)(0x80 + (uc & 0x3F));
return 4;
} else return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40F984", "function_addr": 4258180, "binary_name": "f61ed8ef6ab5ad7275499f10ef94c8c2326a67232c2cc9190dbdb630ddbc2c7b.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_4], edi"], [3, "mov [rbp+var_10], rsi"], [4, "cmp [rbp+var_4], 0"], [5, "jns short loc_40F99F"], [6, "mov eax, 0"], [7, "jmp loc_40FAA6"], [8, "cmp [rbp+var_4], 7Fh"], [9, "jg short loc_40F9BA"], [10, "mov eax, [rbp+var_4]"], [11, "mov edx, eax"], [12, "mov rax, [rbp+var_10]"], [13, "mov [rax], dl"], [14, "mov eax, 1"], [15, "jmp loc_40FAA6"], [16, "cmp [rbp+var_4], 7FFh"], [17, "jg short loc_40F9F1"], [18, "mov eax, [rbp+var_4]"], [19, "sar eax, 6"], [20, "lea edx, [rax-40h]"], [21, "mov rax, [rbp+var_10]"], [22, "mov [rax], dl"], [23, "mov eax, [rbp+var_4]"], [24, "and eax, 3Fh"], [25, "mov edx, eax"], [26, "mov rax, [rbp+var_10]"], [27, "add rax, 1"], [28, "add edx, 0FFFFFF80h"], [29, "mov [rax], dl"], [30, "mov eax, 2"], [31, "jmp loc_40FAA6"], [32, "cmp [rbp+var_4], 0FFFFh"], [33, "jg short loc_40FA3D"], [34, "mov eax, [rbp+var_4]"], [35, "sar eax, 0Ch"], [36, "lea edx, [rax-20h]"], [37, "mov rax, [rbp+var_10]"], [38, "mov [rax], dl"], [39, "mov eax, [rbp+var_4]"], [40, "sar eax, 6"], [41, "and eax, 3Fh"], [42, "mov edx, eax"], [43, "mov rax, [rbp+var_10]"], [44, "add rax, 1"], [45, "add edx, 0FFFFFF80h"], [46, "mov [rax], dl"], [47, "mov eax, [rbp+var_4]"], [48, "and eax, 3Fh"], [49, "mov edx, eax"], [50, "mov rax, [rbp+var_10]"], [51, "add rax, 2"], [52, "add edx, 0FFFFFF80h"], [53, "mov [rax], dl"], [54, "mov eax, 3"], [55, "jmp short loc_40FAA6"], [56, "cmp [rbp+var_4], 10FFFFh"], [57, "jg short loc_40FAA1"], [58, "mov eax, [rbp+var_4]"], [59, "sar eax, 12h"], [60, "lea edx, [rax-10h]"], [61, "mov rax, [rbp+var_10]"], [62, "mov [rax], dl"], [63, "mov eax, [rbp+var_4]"], [64, "sar eax, 0Ch"], [65, "and eax, 3Fh"], [66, "mov edx, eax"], [67, "mov rax, [rbp+var_10]"], [68, "add rax, 1"], [69, "add edx, 0FFFFFF80h"], [70, "mov [rax], dl"], [71, "mov eax, [rbp+var_4]"], [72, "sar eax, 6"], [73, "and eax, 3Fh"], [74, "mov edx, eax"], [75, "mov rax, [rbp+var_10]"], [76, "add rax, 2"], [77, "add edx, 0FFFFFF80h"], [78, "mov [rax], dl"], [79, "mov eax, [rbp+var_4]"], [80, "and eax, 3Fh"], [81, "mov edx, eax"], [82, "mov rax, [rbp+var_10]"], [83, "add rax, 3"], [84, "add edx, 0FFFFFF80h"], [85, "mov [rax], dl"], [86, "mov eax, 4"], [87, "jmp short loc_40FAA6"], [88, "mov eax, 0"], [89, "pop rbp"], [90, "retn"]], "data_dep": [[4, 2], [5, 4], [8, 2], [9, 8], [10, 2], [11, 10], [12, 3], [13, 12], [13, 11], [16, 2], [17, 16], [18, 2], [19, 18], [20, 19], [21, 3], [22, 21], [22, 20], [23, 2], [24, 23], [25, 24], [26, 3], [27, 26], [28, 25], [29, 27], [29, 28], [32, 2], [33, 32], [34, 2], [35, 34], [36, 35], [37, 3], [38, 36], [38, 37], [39, 2], [40, 39], [41, 40], [42, 41], [43, 3], [44, 43], [45, 42], [46, 45], [46, 44], [47, 2], [48, 47], [49, 48], [50, 3], [51, 50], [52, 49], [53, 52], [53, 51], [56, 2], [57, 56], [58, 2], [59, 58], [60, 59], [61, 3], [62, 60], [62, 61], [63, 2], [64, 63], [65, 64], [66, 65], [67, 3], [68, 67], [69, 66], [70, 68], [70, 69], [71, 2], [72, 71], [73, 72], [74, 73], [75, 3], [76, 75], [77, 74], [78, 77], [78, 76], [79, 2], [80, 79], [81, 80], [82, 3], [83, 82], [84, 81], [85, 84], [85, 83], [89, 0], [90, 88], [90, 30], [90, 14], [90, 86], [90, 6], [90, 54]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/f61ed8ef6ab5ad7275499f10ef94c8c2326a67232c2cc9190dbdb630ddbc2c7b_f61ed8ef6ab5ad7275499f10ef94c8c2326a67232c2cc9190dbdb630ddbc2c7b.jsonl.gz", "strip_func_name": "sub_40F984", "query": "\n\n\n__int64 __fastcall sub_40F984(int a1, _BYTE *a2)\n{\n__int64 result; // rax\n\nif ( a1 < 0 )\nreturn 0LL;\nif ( a1 > 127 )\n{\nif ( a1 > 2047 )\n{\nif ( a1 > 0xFFFF )\n{\nif ( a1 > 1114111 )\n{\nresult = 0LL;\n}\nelse\n{\n*a2 = (a1 >> 18) - 16;\na2[1] = ((a1 >> 12) & 0x3F) + 0x80;\na2[2] = ((a1 >> 6) & 0x3F) + 0x80;\na2[3] = (a1 & 0x3F) + 0x80;\nresult = 4LL;\n}\n}\nelse\n{\n*a2 = (a1 >> 12) - 32;\na2[1] = ((a1 >> 6) & 0x3F) + 0x80;\na2[2] = (a1 & 0x3F) + 0x80;\nresult = 3LL;\n}\n}\nelse\n{\n*a2 = (a1 >> 6) - 64;\na2[1] = (a1 & 0x3F) + 0x80;\nresult = 2LL;\n}\n}\nelse\n{\n*a2 = a1;\nresult = 1LL;\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,sub_40F984,]", "hints": "[]", "response": "{'a1': 'uc', 'a2': 'dst', 'sub_40F984': 'utf8proc_encode_char'}"} | [
[
0.883320152759552,
0.8747796416282654,
0.8689972758293152,
0.8513071537017822,
0.8047119379043579,
0.7862775921821594,
0.7787922024726868,
0.7716593146324158,
0.7709336280822754,
0.7694845199584961,
0.7683219909667969,
0.7634932994842529,
0.759286105632782,
0.7583907842636108,
0.7567384839057922,
0.7535539865493774,
0.751694917678833,
0.74867182970047,
0.7416096925735474,
0.7404351234436035
],
[
168269,
80493,
41771,
219813,
226849,
140701,
202195,
116654,
63222,
42155,
194389,
92886,
34023,
160096,
139636,
105591,
107708,
114486,
40099,
240665
]
] |
|
print_shfs_hdr_summary | a7b05dcb1e84abd87c043a3e4a23ff8d0cfea42386f393c62eb625ddee6115a0 | sysml | minipython | NA | void print_shfs_hdr_summary(struct shfs_hdr_common *hdr_common,
struct shfs_hdr_config *hdr_config)
{
char volname[17];
uint64_t chunksize;
uint64_t hentry_size;
uint64_t htable_size;
chk_t htable_size_chks;
uint32_t htable_total_entries;
uint8_t m;
char str_uuid[37];
char str_date[20];
chunksize = SHFS_CHUNKSIZE(hdr_common);
hentry_size = SHFS_HENTRY_SIZE;
htable_total_entries = SHFS_HTABLE_NB_ENTRIES(hdr_config);
htable_size_chks = SHFS_HTABLE_SIZE_CHUNKS(hdr_config, chunksize);
htable_size = CHUNKS_TO_BYTES(htable_size_chks, chunksize);
printf("SHFS version: %2x.%02x\n",
hdr_common->version[0],
hdr_common->version[1]);
strncpy(volname, hdr_common->vol_name, 16);
volname[17] = '\0';
printf("Volume name: %s\n", volname);
uuid_unparse(hdr_common->vol_uuid, str_uuid);
printf("Volume UUID: %s\n", str_uuid);
strftimestamp_s(str_date, sizeof(str_date),
"%b %e, %g %H:%M", hdr_common->vol_ts_creation);
printf("Creation date: %s\n", str_date);
printf("Chunksize: %"PRIu64" KiB\n",
chunksize / 1024);
printf("Volume size: %"PRIu64" KiB\n",
(chunksize * hdr_common->vol_size) / 1024);
printf("Hash function: %s (%"PRIu32" bits)\n",
(hdr_config->hfunc == SHFUNC_SHA ? "SHA" :
(hdr_config->hfunc == SHFUNC_CRC ? "CRC" :
(hdr_config->hfunc == SHFUNC_MD5 ? "MD5" :
(hdr_config->hfunc == SHFUNC_HAVAL ? "HAVAL" :
(hdr_config->hfunc == SHFUNC_MANUAL ? "Manual" : "Unknown"))))),
hdr_config->hlen * 8);
printf("Hash table: %"PRIu32" entries in %"PRIu32" buckets\n" \
" %"PRIu64" chunks (%"PRIu64" KiB)\n" \
" %s\n",
htable_total_entries, hdr_config->htable_bucket_count,
htable_size_chks, htable_size / 1024,
hdr_config->htable_bak_ref ? "2nd copy enabled" : "No copy");
printf("Entry size: %"PRIu64" Bytes (raw: %zu Bytes)\n", hentry_size, sizeof(struct shfs_hentry));
printf("Metadata total: %"PRIu64" chunks\n", metadata_size(hdr_common, hdr_config));
printf("Available space: %"PRIu64" chunks\n", avail_space(hdr_common, hdr_config));
printf("\n");
printf("Member stripe size: %"PRIu32" KiB\n", hdr_common->member_stripesize / 1024);
printf("Member stripe mode: %s\n", (hdr_common->member_stripemode == SHFS_SM_COMBINED ?
"Combined" : "Independent" ));
printf("Volume members: %"PRIu8" device(s)\n", hdr_common->member_count);
for (m = 0; m < hdr_common->member_count; m++) {
uuid_unparse(hdr_common->member[m].uuid, str_uuid);
printf(" Member %2d UUID: %s\n", m, str_uuid);
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_403457", "function_addr": 4207703, "binary_name": "a7b05dcb1e84abd87c043a3e4a23ff8d0cfea42386f393c62eb625ddee6115a0.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 0B0h"], [3, "mov [rbp+var_A8], rdi"], [4, "mov [rbp+var_B0], rsi"], [5, "mov rax, [rbp+var_A8]"], [6, "movzx eax, byte ptr [rax+38h]"], [7, "cmp al, 1"], [8, "jnz short loc_40349E"], [9, "mov rax, [rbp+var_A8]"], [10, "mov edx, [rax+39h]"], [11, "mov rax, [rbp+var_A8]"], [12, "movzx eax, byte ptr [rax+4Dh]"], [13, "movzx eax, al"], [14, "imul eax, edx"], [15, "mov eax, eax"], [16, "jmp short loc_4034AA"], [17, "mov rax, [rbp+var_A8]"], [18, "mov eax, [rax+39h]"], [19, "mov eax, eax"], [20, "mov [rbp+var_10], rax"], [21, "mov [rbp+var_18], 100h"], [22, "mov rax, [rbp+var_B0]"], [23, "mov edx, [rax+16h]"], [24, "mov rax, [rbp+var_B0]"], [25, "mov eax, [rax+12h]"], [26, "imul eax, edx"], [27, "mov [rbp+var_1C], eax"], [28, "mov rax, [rbp+var_B0]"], [29, "mov edx, [rax+16h]"], [30, "mov rax, [rbp+var_B0]"], [31, "mov eax, [rax+12h]"], [32, "imul eax, edx"], [33, "mov edx, eax"], [34, "mov rax, [rbp+var_10]"], [35, "shr rax, 8"], [36, "add rax, rdx"], [37, "sub rax, 1"], [38, "mov rdx, [rbp+var_10]"], [39, "mov rcx, rdx"], [40, "shr rcx, 8"], [41, "mov edx, 0"], [42, "div rcx"], [43, "mov [rbp+var_28], rax"], [44, "mov rax, [rbp+var_28]"], [45, "imul rax, [rbp+var_10]"], [46, "mov [rbp+var_30], rax"], [47, "mov rax, [rbp+var_A8]"], [48, "movzx eax, byte ptr [rax+5]"], [49, "movzx edx, al"], [50, "mov rax, [rbp+var_A8]"], [51, "movzx eax, byte ptr [rax+4]"], [52, "movzx eax, al"], [53, "mov esi, eax"], [54, "mov edi, offset aShfsVersion2x0"], [55, "mov eax, 0"], [56, "call _printf"], [57, "mov rax, [rbp+var_A8]"], [58, "lea rcx, [rax+16h]"], [59, "lea rax, [rbp+dest]"], [60, "mov edx, 10h"], [61, "mov rsi, rcx"], [62, "mov rdi, rax"], [63, "call _strncpy"], [64, "mov [rbp+var_3F], 0"], [65, "lea rax, [rbp+dest]"], [66, "mov rsi, rax"], [67, "mov edi, offset aVolumeNameS"], [68, "mov eax, 0"], [69, "call _printf"], [70, "mov rax, [rbp+var_A8]"], [71, "lea rdx, [rax+6]"], [72, "lea rax, [rbp+var_80]"], [73, "mov rsi, rax"], [74, "mov rdi, rdx"], [75, "call _uuid_unparse"], [76, "lea rax, [rbp+var_80]"], [77, "mov rsi, rax"], [78, "mov edi, offset aVolumeUuidS"], [79, "mov eax, 0"], [80, "call _printf"], [81, "mov rax, [rbp+var_A8]"], [82, "mov rdx, [rax+30h]"], [83, "lea rax, [rbp+var_A0]"], [84, "mov rcx, rdx"], [85, "mov edx, offset aBEGHM"], [86, "mov esi, 14h"], [87, "mov rdi, rax"], [88, "call sub_4028B0"], [89, "lea rax, [rbp+var_A0]"], [90, "mov rsi, rax"], [91, "mov edi, offset aCreationDateS"], [92, "mov eax, 0"], [93, "call _printf"], [94, "mov rax, [rbp+var_10]"], [95, "shr rax, 0Ah"], [96, "mov rsi, rax"], [97, "mov edi, offset aChunksizeLuKib"], [98, "mov eax, 0"], [99, "call _printf"], [100, "mov rax, [rbp+var_A8]"], [101, "mov rax, [rax+28h]"], [102, "imul rax, [rbp+var_10]"], [103, "shr rax, 0Ah"], [104, "mov rsi, rax"], [105, "mov edi, offset aVolumeSizeLuKi"], [106, "mov eax, 0"], [107, "call _printf"], [108, "mov rax, [rbp+var_B0]"], [109, "movzx eax, byte ptr [rax+11h]"], [110, "movzx eax, al"], [111, "lea edx, ds:0[rax*8]"], [112, "mov rax, [rbp+var_B0]"], [113, "movzx eax, byte ptr [rax+10h]"], [114, "cmp al, 2"], [115, "jz short loc_4036B5"], [116, "mov rax, [rbp+var_B0]"], [117, "movzx eax, byte ptr [rax+10h]"], [118, "cmp al, 3"], [119, "jz short loc_4036AE"], [120, "mov rax, [rbp+var_B0]"], [121, "movzx eax, byte ptr [rax+10h]"], [122, "cmp al, 4"], [123, "jz short loc_4036A7"], [124, "mov rax, [rbp+var_B0]"], [125, "movzx eax, byte ptr [rax+10h]"], [126, "cmp al, 5"], [127, "jz short loc_4036A0"], [128, "mov rax, [rbp+var_B0]"], [129, "movzx eax, byte ptr [rax+10h]"], [130, "cmp al, 1"], [131, "jnz short loc_403699"], [132, "mov eax, offset aManual_0"], [133, "jmp short loc_4036BA"], [134, "mov eax, offset aUnknown"], [135, "jmp short loc_4036BA"], [136, "mov eax, offset aHaval_0"], [137, "jmp short loc_4036BA"], [138, "mov eax, offset aMd5_0"], [139, "jmp short loc_4036BA"], [140, "mov eax, offset aCrc_0"], [141, "jmp short loc_4036BA"], [142, "mov eax, offset aSha_0"], [143, "mov rsi, rax"], [144, "mov edi, offset aHashFunctionSU"], [145, "mov eax, 0"], [146, "call _printf"], [147, "mov rax, [rbp+var_B0]"], [148, "mov rax, [rax+8]"], [149, "test rax, rax"], [150, "jz short loc_4036E3"], [151, "mov edi, offset a2ndCopyEnabled"], [152, "jmp short loc_4036E8"], [153, "mov edi, offset aNoCopy"], [154, "mov rax, [rbp+var_30]"], [155, "shr rax, 0Ah"], [156, "mov rsi, rax"], [157, "mov rax, [rbp+var_B0]"], [158, "mov edx, [rax+12h]"], [159, "mov rcx, [rbp+var_28]"], [160, "mov eax, [rbp+var_1C]"], [161, "mov r9, rdi"], [162, "mov r8, rsi"], [163, "mov esi, eax"], [164, "mov edi, offset aHashTableUEntr"], [165, "mov eax, 0"], [166, "call _printf"], [167, "mov rax, [rbp+var_18]"], [168, "mov edx, 0F5h"], [169, "mov rsi, rax"], [170, "mov edi, offset aEntrySizeLuByt"], [171, "mov eax, 0"], [172, "call _printf"], [173, "mov rdx, [rbp+var_B0]"], [174, "mov rax, [rbp+var_A8]"], [175, "mov rsi, rdx"], [176, "mov rdi, rax"], [177, "call sub_40396D"], [178, "mov rsi, rax"], [179, "mov edi, offset aMetadataTotalL"], [180, "mov eax, 0"], [181, "call _printf"], [182, "mov rdx, [rbp+var_B0]"], [183, "mov rax, [rbp+var_A8]"], [184, "mov rsi, rdx"], [185, "mov rdi, rax"], [186, "call sub_403A19"], [187, "mov rsi, rax"], [188, "mov edi, offset aAvailableSpace"], [189, "mov eax, 0"], [190, "call _printf"], [191, "mov edi, 0Ah"], [192, "call _putchar"], [193, "mov rax, [rbp+var_A8]"], [194, "mov eax, [rax+39h]"], [195, "shr eax, 0Ah"], [196, "mov esi, eax"], [197, "mov edi, offset aMemberStripeSi"], [198, "mov eax, 0"], [199, "call _printf"], [200, "mov rax, [rbp+var_A8]"], [201, "movzx eax, byte ptr [rax+38h]"], [202, "cmp al, 1"], [203, "jnz short loc_4037CA"], [204, "mov eax, offset aCombined"], [205, "jmp short loc_4037CF"], [206, "mov eax, offset aIndependent"], [207, "mov rsi, rax"], [208, "mov edi, offset aMemberStripeMo"], [209, "mov eax, 0"], [210, "call _printf"], [211, "mov rax, [rbp+var_A8]"], [212, "movzx eax, byte ptr [rax+4Dh]"], [213, "movzx eax, al"], [214, "mov esi, eax"], [215, "mov edi, offset aVolumeMembersU"], [216, "mov eax, 0"], [217, "call _printf"], [218, "mov [rbp+var_1], 0"], [219, "jmp short loc_403857"], [220, "movzx eax, [rbp+var_1]"], [221, "cdqe"], [222, "add rax, 4"], [223, "shl rax, 4"], [224, "mov rdx, rax"], [225, "mov rax, [rbp+var_A8]"], [226, "add rax, rdx"], [227, "lea rdx, [rax+0Eh]"], [228, "lea rax, [rbp+var_80]"], [229, "mov rsi, rax"], [230, "mov rdi, rdx"], [231, "call _uuid_unparse"], [232, "movzx eax, [rbp+var_1]"], [233, "lea rdx, [rbp+var_80]"], [234, "mov esi, eax"], [235, "mov edi, offset aMember2dUuidS"], [236, "mov eax, 0"], [237, "call _printf"], [238, "movzx eax, [rbp+var_1]"], [239, "add eax, 1"], [240, "mov [rbp+var_1], al"], [241, "mov rax, [rbp+var_A8]"], [242, "movzx eax, byte ptr [rax+4Dh]"], [243, "cmp [rbp+var_1], al"], [244, "jb short loc_403806"], [245, "nop"], [246, "nop"], [247, "leave"], [248, "retn"]], "data_dep": [[5, 3], [6, 5], [7, 6], [8, 7], [9, 3], [10, 9], [11, 3], [12, 11], [13, 12], [14, 13], [14, 10], [15, 14], [17, 3], [18, 17], [19, 18], [20, 15], [20, 19], [22, 4], [23, 22], [24, 4], [25, 24], [26, 23], [26, 25], [27, 26], [28, 4], [29, 28], [30, 4], [31, 30], [32, 29], [32, 31], [33, 32], [34, 20], [35, 34], [36, 33], [36, 35], [37, 36], [38, 20], [39, 38], [40, 39], [42, 40], [43, 37], [44, 43], [45, 20], [45, 44], [46, 45], [47, 3], [48, 47], [49, 48], [50, 3], [51, 50], [52, 51], [53, 52], [57, 3], [58, 42], [58, 57], [59, 57], [61, 58], [62, 59], [65, 63], [66, 65], [70, 3], [71, 60], [71, 70], [72, 70], [73, 72], [74, 71], [76, 75], [77, 76], [81, 3], [82, 81], [83, 81], [84, 82], [87, 83], [89, 88], [90, 89], [94, 20], [95, 94], [96, 95], [100, 3], [101, 100], [102, 20], [102, 101], [103, 102], [104, 103], [108, 4], [109, 108], [110, 109], [111, 85], [112, 4], [113, 112], [114, 113], [115, 114], [116, 4], [117, 116], [118, 117], [119, 118], [120, 4], [121, 120], [122, 121], [123, 122], [124, 4], [125, 124], [126, 125], [127, 126], [128, 4], [129, 128], [130, 129], [131, 130], [143, 142], [143, 132], [143, 134], [143, 136], [143, 138], [143, 140], [147, 4], [148, 147], [149, 148], [150, 149], [154, 46], [155, 154], [156, 155], [157, 4], [158, 157], [159, 43], [160, 27], [161, 151], [161, 153], [162, 156], [163, 160], [167, 21], [169, 167], [173, 4], [174, 3], [175, 173], [176, 174], [178, 177], [182, 4], [183, 3], [184, 182], [185, 183], [187, 186], [193, 3], [194, 193], [195, 194], [196, 195], [200, 3], [201, 200], [202, 201], [203, 202], [207, 204], [207, 206], [211, 3], [212, 211], [213, 212], [214, 213], [220, 218], [220, 240], [222, 220], [223, 222], [224, 223], [225, 3], [226, 225], [226, 224], [227, 224], [227, 226], [228, 226], [229, 228], [230, 227], [232, 240], [232, 218], [233, 227], [234, 232], [238, 240], [238, 218], [239, 238], [240, 239], [241, 3], [242, 241], [243, 240], [243, 242], [243, 218], [244, 243], [248, 242]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/a7b05dcb1e84abd87c043a3e4a23ff8d0cfea42386f393c62eb625ddee6115a0_a7b05dcb1e84abd87c043a3e4a23ff8d0cfea42386f393c62eb625ddee6115a0.jsonl.gz", "strip_func_name": "sub_403457", "query": "\n\n\n__int64 __fastcall sub_403457(__int64 a1, __int64 a2)\n{\nunsigned __int64 v2; // rax\nconst char *v3; // rax\nconst char *v4; // rdi\n__int64 v5; // rax\n__int64 v6; // rax\nconst char *v7; // rax\n__int64 result; // rax\nchar v10[32]; // [rsp+10h] [rbp-A0h] BYREF\nchar v11[48]; // [rsp+30h] [rbp-80h] BYREF\nchar dest[32]; // [rsp+60h] [rbp-50h] BYREF\nunsigned __int64 v13; // [rsp+80h] [rbp-30h]\nunsigned __int64 v14; // [rsp+88h] [rbp-28h]\nunsigned int v15; // [rsp+94h] [rbp-1Ch]\n__int64 v16; // [rsp+98h] [rbp-18h]\nunsigned __int64 v17; // [rsp+A0h] [rbp-10h]\nunsigned __int8 i; // [rsp+AFh] [rbp-1h]\n\nif ( *(_BYTE *)(a1 + 56) == 1 )\nv2 = *(_DWORD *)(a1 + 57) * (unsigned int)*(unsigned __int8 *)(a1 + 77);\nelse\nv2 = *(unsigned int *)(a1 + 57);\nv17 = v2;\nv16 = 256LL;\nv15 = *(_DWORD *)(a2 + 22) * *(_DWORD *)(a2 + 18);\nv14 = ((unsigned int)(*(_DWORD *)(a2 + 22) * *(_DWORD *)(a2 + 18)) + (v2 >> 8) - 1) / (v2 >> 8);\nv13 = v2 * v14;\nprintf(\"SHFS version: %2x.%02x\\n\", *(unsigned __int8 *)(a1 + 4), *(unsigned __int8 *)(a1 + 5));\nstrncpy(dest, (const char *)(a1 + 22), 0x10uLL);\ndest[17] = 0;\nprintf(\"Volume name: %s\\n\", dest);\nuuid_unparse();\nprintf(\"Volume UUID: %s\\n\", v11);\nsub_4028B0(v10, 0x14uLL, \"%b %e, %g %H:%M\", *(_QWORD *)(a1 + 48));\nprintf(\"Creation date: %s\\n\", v10);\nprintf(\"Chunksize: %lu KiB\\n\", v17 >> 10);\nprintf(\"Volume size: %lu KiB\\n\", (v17 * *(_QWORD *)(a1 + 40)) >> 10);\nswitch ( *(_BYTE *)(a2 + 16) )\n{\ncase 2:\nv3 = \"SHA\";\nbreak;\ncase 3:\nv3 = \"CRC\";\nbreak;\ncase 4:\nv3 = \"MD5\";\nbreak;\ncase 5:\nv3 = \"HAVAL\";\nbreak;\ncase 1:\nv3 = \"Manual\";\nbreak;\ndefault:\nv3 = \"Unknown\";\nbreak;\n}\nprintf(\"Hash function: %s (%u bits)\\n\", v3, 8 * (unsigned int)*(unsigned __int8 *)(a2 + 17));\nif ( *(_QWORD *)(a2 + 8) )\nv4 = \"2nd copy enabled\";\nelse\nv4 = \"No copy\";\nprintf(\n\"Hash table: %u entries in %u buckets\\n %lu chunks (%lu KiB)\\n %s\\n\",\nv15,\n*(unsigned int *)(a2 + 18),\nv14,\nv13 >> 10,\nv4);\nprintf(\"Entry size: %lu Bytes (raw: %zu Bytes)\\n\", v16, 0xF5uLL);\nv5 = sub_40396D(a1, a2);\nprintf(\"Metadata total: %lu chunks\\n\", v5);\nv6 = sub_403A19(a1, a2);\nprintf(\"Available space: %lu chunks\\n\", v6);\nputchar(10);\nprintf(\"Member stripe size: %u KiB\\n\", *(_DWORD *)(a1 + 57) >> 10);\nif ( *(_BYTE *)(a1 + 56) == 1 )\nv7 = \"Combined\";\nelse\nv7 = \"Independent\";\nprintf(\"Member stripe mode: %s\\n\", v7);\nprintf(\"Volume members: %u device(s)\\n\", *(unsigned __int8 *)(a1 + 77));\nfor ( i = 0; ; ++i )\n{\nresult = *(unsigned __int8 *)(a1 + 77);\nif ( i >= (unsigned __int8)result )\nbreak;\nuuid_unparse();\nprintf(\" Member %2d UUID: %s\\n\", i, v11);\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,v10,v11,dest,v13,v14,v15,v16,v17,i,sub_403457,sub_4028B0,sub_40396D,sub_403A19,]", "hints": "[]", "response": "{'a1': 'hdr_common', 'a2': 'hdr_config', 'v10': 'str_date', 'v11': 'str_uuid', 'dest': 'volname', 'v13': 'htable_size', 'v14': 'htable_size_chks', 'v15': 'htable_total_entries', 'v16': 'hentry_size', 'v17': 'chunksize', 'i': 'm', 'sub_403457': 'print_shfs_hdr_summary', 'sub_4028B0': 'strftimestamp_s', 'sub_40396D': 'metadata_size', 'sub_403A19': 'avail_space'}"} | [
[
0.8034807443618774,
0.784257709980011,
0.7767340540885925,
0.7655316591262817,
0.7574481964111328,
0.7560036778450012,
0.7539896368980408,
0.7496527433395386,
0.7470178008079529,
0.7422350645065308,
0.732120156288147,
0.7297430634498596,
0.7289061546325684,
0.7225559949874878,
0.7215538024902344,
0.7182093858718872,
0.7139617204666138,
0.7131059765815735,
0.7046811580657959,
0.704397976398468
],
[
129374,
225232,
11357,
33440,
63869,
170253,
87984,
192892,
117083,
246481,
198517,
155517,
130495,
241902,
200359,
219417,
118416,
241106,
164807,
233104
]
] |
|
ppu_write_register | e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b | kgabis | agnes | NA | void ppu_write_register(ppu_t *ppu, uint16_t addr, uint8_t val) {
ppu->last_reg_write = val;
switch (addr) {
case 0x2000: { // PPUCTRL
ppu->ctrl.addr_increment = AGNES_GET_BIT(val, 2) ? 32 : 1;
ppu->ctrl.sprite_table_addr = AGNES_GET_BIT(val, 3) ? 0x1000 : 0x0000;
ppu->ctrl.bg_table_addr = AGNES_GET_BIT(val, 4) ? 0x1000 : 0x0000;
ppu->ctrl.use_8x16_sprites = AGNES_GET_BIT(val, 5);
ppu->ctrl.nmi_enabled = AGNES_GET_BIT(val, 7);
// t: |_...|BA..| |....|....| = d: |....|..BA|
ppu->regs.t = (ppu->regs.t & 0xf3ff) | ((val & 0x03) << 10);
break;
}
case 0x2001: { // PPUMASK
ppu->masks.show_leftmost_bg = AGNES_GET_BIT(val, 1);
ppu->masks.show_leftmost_sprites = AGNES_GET_BIT(val, 2);
ppu->masks.show_background = AGNES_GET_BIT(val, 3);
ppu->masks.show_sprites = AGNES_GET_BIT(val, 4);
break;
}
case 0x2003: { // OAMADDR
ppu->oam_address = val;
break;
}
case 0x2004: { // OAMDATA
ppu->oam_data[ppu->oam_address] = val;
ppu->oam_address++;
break;
}
case 0x2005: { // SCROLL
if (ppu->regs.w) {
// t: |_CBA|..HG| |FED.|....| = d: |HGFE|DCBA|
// w: = 0
ppu->regs.t = (ppu->regs.t & 0x8fff) | ((val & 0x7) << 12);
ppu->regs.t = (ppu->regs.t & 0xfc1f) | ((val >> 3) << 5);
ppu->regs.w = 0;
} else {
// t: |_...|....| |...H|GFED| = d: HGFED...
// x: CBA = d: |...|..CBA|
// w: = 1
ppu->regs.t = (ppu->regs.t & 0xffe0) | (val >> 3);
ppu->regs.x = (val & 0x7);
ppu->regs.w = 1;
}
break;
}
case 0x2006: { // PPUADDR
if (ppu->regs.w) {
// t: |_...|....| |HGFE|DCBA| = d: |HGFE|DCBA|
// v = t
// w: = 0
ppu->regs.t = (ppu->regs.t & 0xff00) | val;
ppu->regs.v = ppu->regs.t;
ppu->regs.w = 0;
} else {
// t: |_.FE|DCBA| |....|....| = d: |..FE|DCBA|
// t: |_X..|....| |....|....| = 0
// w: = 1
ppu->regs.t = (ppu->regs.t & 0xc0ff) | ((val & 0x3f) << 8);
ppu->regs.t = ppu->regs.t & 0xbfff;
ppu->regs.w = 1;
}
break;
}
case 0x2007: { // PPUDATA
ppu_write8(ppu, ppu->regs.v, val);
ppu->regs.v += ppu->ctrl.addr_increment;
break;
}
case 0x4014: { // OAMDMA
uint16_t dma_addr = ((uint16_t)val) << 8;
for (int i = 0; i < 256; i++) {
ppu->oam_data[ppu->oam_address] = cpu_read8(&ppu->agnes->cpu, dma_addr);
ppu->oam_address++;
dma_addr++;
}
cpu_set_dma_stall(&ppu->agnes->cpu);
break;
}
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4028B0", "function_addr": 4204720, "binary_name": "e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b.elf_extract.pkl\n"}, "code": [[0, "push r13"], [1, "push r12"], [2, "push rbp"], [3, "mov rbp, rdi"], [4, "push rbx"], [5, "sub rsp, 8"], [6, "mov [rdi+10031h], dl"], [7, "cmp si, 2007h"], [8, "ja short loc_402930"], [9, "sub si, 2000h"], [10, "cmp si, 7"], [11, "ja short def_4028D8"], [12, "movzx esi, si"], [13, "jmp ds:jpt_4028D8[rsi*8]"], [14, "movzx eax, word ptr [rdi+10032h]"], [15, "mov ecx, eax"], [16, "and cx, 3FFFh"], [17, "cmp cx, 3EFFh"], [18, "jbe loc_402B55"], [19, "mov rcx, rax"], [20, "and ecx, 1Fh"], [21, "movsxd rcx, ds:dword_406A40[rcx*4]"], [22, "mov [rdi+rcx+1008h], dl"], [23, "add ax, [rbp+10048h]"], [24, "mov [rbp+10032h], ax"], [25, "add rsp, 8"], [26, "pop rbx"], [27, "pop rbp"], [28, "pop r12"], [29, "pop r13"], [30, "retn"], [31, "cmp si, 4014h"], [32, "jnz short def_4028D8"], [33, "mov r12d, edx"], [34, "movzx ebx, byte ptr [rdi+10054h]"], [35, "shl r12d, 8"], [36, "lea r13d, [r12+100h]"], [37, "nop dword ptr [rax]"], [38, "mov rax, [rbp+0]"], [39, "movzx esi, r12w"], [40, "movzx ebx, bl"], [41, "add r12d, 1"], [42, "mov rdi, [rax]"], [43, "call sub_401E00"], [44, "mov [rbp+rbx+10055h], al"], [45, "movzx eax, byte ptr [rbp+10054h]"], [46, "lea ebx, [rax+1]"], [47, "mov [rbp+10054h], bl"], [48, "cmp r12w, r13w"], [49, "jnz short loc_402950"], [50, "mov rdx, [rbp+0]"], [51, "mov rax, [rdx+18h]"], [52, "and eax, 1"], [53, "add rax, 201h"], [54, "mov [rdx+14h], eax"], [55, "add rsp, 8"], [56, "pop rbx"], [57, "pop rbp"], [58, "pop r12"], [59, "pop r13"], [60, "retn"], [61, "mov eax, edx"], [62, "shr al, 2"], [63, "and eax, 1"], [64, "cmp al, 1"], [65, "sbb eax, eax"], [66, "and eax, 0FFFFFFE1h"], [67, "add eax, 20h "], [68, "mov [rdi+10048h], ax"], [69, "mov eax, edx"], [70, "shr al, 3"], [71, "shl eax, 0Ch"], [72, "and ax, 1000h"], [73, "mov [rdi+1004Ah], ax"], [74, "mov eax, edx"], [75, "shr al, 4"], [76, "shl eax, 0Ch"], [77, "and ax, 1000h"], [78, "mov [rdi+1004Ch], ax"], [79, "mov eax, edx"], [80, "shr al, 5"], [81, "mov [rdi+1004Eh], al"], [82, "mov eax, edx"], [83, "shl edx, 0Ah"], [84, "shr al, 7"], [85, "and dx, 0C00h"], [86, "and byte ptr [rdi+1004Eh], 1"], [87, "mov [rdi+1004Fh], al"], [88, "movzx eax, word ptr [rdi+10034h]"], [89, "and ah, 0F3h"], [90, "or edx, eax"], [91, "mov [rdi+10034h], dx"], [92, "add rsp, 8"], [93, "pop rbx"], [94, "pop rbp"], [95, "pop r12"], [96, "pop r13"], [97, "retn"], [98, "mov eax, edx"], [99, "shr al, 1"], [100, "mov [rdi+10038h], al"], [101, "mov eax, edx"], [102, "shr al, 2"], [103, "and byte ptr [rdi+10038h], 1"], [104, "mov [rdi+10039h], al"], [105, "mov eax, edx"], [106, "shr dl, 4"], [107, "shr al, 3"], [108, "mov [rdi+1003Bh], dl"], [109, "mov [rdi+1003Ah], al"], [110, "and byte ptr [rdi+10039h], 1"], [111, "and byte ptr [rdi+1003Ah], 1"], [112, "and byte ptr [rdi+1003Bh], 1"], [113, "add rsp, 8"], [114, "pop rbx"], [115, "pop rbp"], [116, "pop r12"], [117, "pop r13"], [118, "retn"], [119, "mov [rdi+10054h], dl"], [120, "add rsp, 8"], [121, "pop rbx"], [122, "pop rbp"], [123, "pop r12"], [124, "pop r13"], [125, "retn"], [126, "movzx ecx, byte ptr [rdi+10054h]"], [127, "mov rax, rcx"], [128, "mov [rdi+rcx+10055h], dl"], [129, "add eax, 1"], [130, "mov [rdi+10054h], al"], [131, "add rsp, 8"], [132, "pop rbx"], [133, "pop rbp"], [134, "pop r12"], [135, "pop r13"], [136, "retn"], [137, "mov ecx, edx"], [138, "movzx eax, word ptr [rdi+10034h]"], [139, "shr cl, 3"], [140, "cmp byte ptr [rdi+10037h], 0"], [141, "jz short loc_402B31"], [142, "shl edx, 0Ch"], [143, "and ax, 8C1Fh"], [144, "movzx ecx, cl"], [145, "mov byte ptr [rdi+10037h], 0"], [146, "and dx, 7000h"], [147, "shl ecx, 5"], [148, "or eax, edx"], [149, "or eax, ecx"], [150, "mov [rdi+10034h], ax"], [151, "jmp def_4028D8"], [152, "cmp byte ptr [rdi+10037h], 0"], [153, "movzx eax, word ptr [rdi+10034h]"], [154, "jz short loc_402B77"], [155, "xor al, al"], [156, "movzx edx, dl"], [157, "mov byte ptr [rdi+10037h], 0"], [158, "or eax, edx"], [159, "mov [rdi+10034h], ax"], [160, "mov [rdi+10032h], ax"], [161, "jmp def_4028D8"], [162, "and eax, 0FFFFFFE0h"], [163, "movzx ecx, cl"], [164, "and edx, 7"], [165, "mov byte ptr [rdi+10037h], 1"], [166, "or eax, ecx"], [167, "mov [rdi+10036h], dl"], [168, "mov [rdi+10034h], ax"], [169, "jmp def_4028D8"], [170, "mov rdi, [rdi]"], [171, "test ah, 20h"], [172, "jz short loc_402B97"], [173, "cmp dword ptr [rdi+14A48h], 5"], [174, "ja def_402B70"], [175, "mov esi, [rdi+14A48h]"], [176, "jmp ds:jpt_402B70[rsi*8]"], [177, "shl edx, 8"], [178, "and ah, 80h"], [179, "mov byte ptr [rdi+10037h], 1"], [180, "and dx, 3F00h"], [181, "or eax, edx"], [182, "mov [rdi+10034h], ax"], [183, "jmp def_4028D8"], [184, "movzx edx, dl"], [185, "movzx esi, cx"], [186, "call sub_4024C0"], [187, "movzx eax, word ptr [rbp+10032h]"], [188, "jmp loc_40290E"], [189, "sub cx, 2000h"], [190, "movzx ecx, cx"], [191, "movsxd rcx, ecx"], [192, "mov [rbp+rcx+8], dl"], [193, "jmp loc_40290E"], [194, "mov ecx, eax"], [195, "and ecx, 7FFh"], [196, "jmp short loc_402BB6"], [197, "shr cx, 1"], [198, "mov esi, eax"], [199, "and cx, 400h"], [200, "and si, 3FFh"], [201, "or ecx, esi"], [202, "movzx ecx, cx"], [203, "jmp short loc_402BB6"], [204, "mov ecx, eax"], [205, "and ecx, 3FFh"], [206, "or ch, 4"], [207, "jmp short loc_402BB6"], [208, "mov ecx, eax"], [209, "and ecx, 3FFh"], [210, "jmp short loc_402BB6"], [211, "xor ecx, ecx"], [212, "jmp short loc_402BB6"]], "data_dep": [[8, 7], [10, 9], [11, 10], [12, 9], [14, 6], [15, 14], [16, 15], [17, 16], [18, 17], [19, 14], [20, 19], [22, 21], [23, 187], [23, 171], [23, 14], [24, 23], [25, 5], [26, 4], [27, 2], [28, 1], [29, 0], [30, 166], [30, 149], [30, 158], [30, 23], [30, 181], [32, 31], [34, 6], [35, 33], [36, 6], [36, 35], [37, 6], [39, 35], [39, 41], [40, 34], [40, 46], [41, 35], [41, 41], [42, 38], [42, 6], [42, 37], [44, 40], [44, 43], [45, 47], [46, 6], [46, 45], [46, 40], [47, 46], [48, 36], [48, 41], [49, 48], [51, 50], [51, 6], [51, 54], [52, 51], [53, 52], [54, 53], [54, 50], [55, 5], [56, 4], [57, 2], [58, 1], [59, 0], [60, 53], [62, 61], [63, 62], [64, 63], [65, 63], [66, 65], [67, 66], [68, 67], [70, 69], [71, 70], [72, 71], [73, 72], [75, 74], [76, 75], [77, 76], [78, 77], [80, 79], [81, 80], [84, 82], [85, 83], [86, 81], [87, 84], [88, 87], [89, 88], [90, 85], [90, 89], [91, 90], [92, 5], [93, 4], [94, 2], [95, 1], [96, 0], [97, 89], [99, 98], [100, 99], [102, 101], [103, 100], [104, 102], [107, 105], [108, 106], [109, 107], [110, 109], [110, 104], [111, 110], [111, 109], [112, 111], [112, 108], [113, 5], [114, 4], [115, 2], [116, 1], [117, 0], [118, 107], [120, 5], [121, 4], [122, 2], [123, 1], [124, 0], [126, 128], [126, 130], [126, 6], [127, 126], [128, 126], [129, 127], [130, 129], [131, 5], [132, 4], [133, 2], [134, 1], [135, 0], [136, 129], [138, 6], [139, 137], [140, 6], [141, 140], [143, 138], [144, 139], [146, 142], [147, 144], [148, 143], [148, 146], [149, 148], [149, 147], [150, 149], [152, 6], [153, 6], [154, 152], [158, 156], [158, 155], [159, 158], [160, 158], [162, 138], [163, 139], [166, 162], [166, 163], [167, 164], [168, 166], [170, 6], [171, 14], [172, 171], [173, 170], [173, 6], [174, 173], [175, 170], [175, 6], [178, 153], [180, 177], [181, 178], [181, 180], [182, 181], [185, 16], [189, 16], [190, 189], [191, 209], [191, 202], [191, 211], [191, 195], [191, 190], [191, 206], [192, 191], [194, 171], [195, 194], [197, 16], [198, 171], [199, 197], [200, 198], [201, 200], [201, 199], [202, 201], [204, 171], [205, 204], [206, 205], [208, 171], [209, 208]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b_e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b.jsonl.gz", "strip_func_name": "sub_4028B0", "query": "\n\n\nvoid __fastcall sub_4028B0(__int64 a1, unsigned __int16 a2, int a3)\n{\n__int16 v4; // ax\nunsigned __int16 v5; // cx\nunsigned __int8 v6; // bl\nint v7; // er12\n__int16 v8; // r13\nunsigned __int16 v9; // si\n__int16 v10; // ax\n__int16 v11; // ax\nunsigned __int8 v12; // al\n__int16 v13; // ax\nunsigned __int8 v14; // cl\n__int16 v15; // ax\n__int16 v16; // ax\n__int16 v17; // ax\n__int64 *v18; // rdi\nint v19; // ecx\n\n*(_BYTE *)(a1 + 65585) = a3;\nif ( a2 > 0x2007u )\n{\nif ( a2 == 16404 )\n{\nv6 = *(_BYTE *)(a1 + 65620);\nv7 = a3 << 8;\nv8 = ((_WORD)a3 << 8) + 256;\ndo\n{\nv9 = v7++;\n*(_BYTE *)(a1 + v6 + 65621) = sub_401E00(**(_QWORD **)a1, v9);\nv6 = *(_BYTE *)(a1 + 65620) + 1;\n*(_BYTE *)(a1 + 65620) = v6;\n}\nwhile ( (_WORD)v7 != v8 );\n*(_DWORD *)(*(_QWORD *)a1 + 20LL) = (*(_DWORD *)(*(_QWORD *)a1 + 24LL) & 1) + 513;\n}\n}\nelse\n{\nswitch ( a2 )\n{\ncase 0x2000u:\n*(_WORD *)(a1 + 65608) = (a3 & 4) == 0 ? 1 : 32;\nHIBYTE(v10) = BYTE1(a3);\nLOBYTE(v10) = (unsigned __int8)a3 >> 3;\n*(_WORD *)(a1 + 65610) = (v10 << 12) & 0x1000;\nHIBYTE(v10) = BYTE1(a3);\nLOBYTE(v10) = (unsigned __int8)a3 >> 4;\n*(_WORD *)(a1 + 65612) = (v10 << 12) & 0x1000;\n*(_BYTE *)(a1 + 65614) = (unsigned __int8)a3 >> 5;\n*(_BYTE *)(a1 + 65614) &= 1u;\n*(_BYTE *)(a1 + 65615) = (unsigned __int8)a3 >> 7;\nv11 = *(_WORD *)(a1 + 65588);\nHIBYTE(v11) &= 0xF3u;\n*(_WORD *)(a1 + 65588) = v11 | ((_WORD)a3 << 10) & 0xC00;\nbreak;\ncase 0x2001u:\n*(_BYTE *)(a1 + 65592) = (unsigned __int8)a3 >> 1;\n*(_BYTE *)(a1 + 65592) &= 1u;\n*(_BYTE *)(a1 + 65593) = (unsigned __int8)a3 >> 2;\n*(_BYTE *)(a1 + 65595) = (unsigned __int8)a3 >> 4;\n*(_BYTE *)(a1 + 65594) = (unsigned __int8)a3 >> 3;\n*(_BYTE *)(a1 + 65593) &= 1u;\n*(_BYTE *)(a1 + 65594) &= 1u;\n*(_BYTE *)(a1 + 65595) &= 1u;\nbreak;\ncase 0x2003u:\n*(_BYTE *)(a1 + 65620) = a3;\nbreak;\ncase 0x2004u:\nv12 = *(_BYTE *)(a1 + 65620);\n*(_BYTE *)(a1 + v12 + 65621) = a3;\n*(_BYTE *)(a1 + 65620) = v12 + 1;\nbreak;\ncase 0x2005u:\nv13 = *(_WORD *)(a1 + 65588);\nv14 = (unsigned __int8)a3 >> 3;\nif ( *(_BYTE *)(a1 + 65591) )\n{\n*(_BYTE *)(a1 + 65591) = 0;\nv15 = (32 * v14) | ((_WORD)a3 << 12) & 0x7000 | v13 & 0x8C1F;\n}\nelse\n{\n*(_BYTE *)(a1 + 65591) = 1;\nv15 = v14 | v13 & 0xFFE0;\n*(_BYTE *)(a1 + 65590) = a3 & 7;\n}\n*(_WORD *)(a1 + 65588) = v15;\nbreak;\ncase 0x2006u:\nv16 = *(_WORD *)(a1 + 65588);\nif ( *(_BYTE *)(a1 + 65591) )\n{\nLOBYTE(v16) = 0;\n*(_BYTE *)(a1 + 65591) = 0;\nv17 = (unsigned __int8)a3 | v16;\n*(_WORD *)(a1 + 65588) = v17;\n*(_WORD *)(a1 + 65586) = v17;\n}\nelse\n{\nHIBYTE(v16) &= 0x80u;\n*(_BYTE *)(a1 + 65591) = 1;\n*(_WORD *)(a1 + 65588) = ((_WORD)a3 << 8) & 0x3F00 | v16;\n}\nbreak;\ncase 0x2007u:\nv4 = *(_WORD *)(a1 + 65586);\nv5 = v4 & 0x3FFF;\nif ( (v4 & 0x3FFFu) <= 0x3EFF )\n{\nv18 = *(__int64 **)a1;\nif ( (v4 & 0x2000) != 0 )\n{\nswitch ( *((_DWORD *)v18 + 21138) )\n{\ncase 1:\nv19 = v4 & 0x3FF;\nbreak;\ncase 2:\nv19 = v4 & 0x3FF;\nBYTE1(v19) |= 4u;\nbreak;\ncase 3:\nv19 = v4 & 0x3FF | (v5 >> 1) & 0x400;\nbreak;\ncase 4:\nv19 = v4 & 0x7FF;\nbreak;\ncase 5:\nv19 = (unsigned __int16)(v5 - 0x2000);\nbreak;\ndefault:\nv19 = 0;\nbreak;\n}\n*(_BYTE *)(a1 + v19 + 8) = a3;\n}\nelse\n{\nsub_4024C0((__int64)v18, v5, (unsigned __int8)a3);\nv4 = *(_WORD *)(a1 + 65586);\n}\n}\nelse\n{\n*(_BYTE *)(a1 + dword_406A40[v4 & 0x1F] + 4104) = a3;\n}\n*(_WORD *)(a1 + 65586) = *(_WORD *)(a1 + 65608) + v4;\nbreak;\ndefault:\nreturn;\n}\n}\n}\n\n\n\nQ:[a3,a1,a2,sub_4028B0,sub_401E00,sub_4024C0,]", "hints": "[]", "response": "{'a3': 'val', 'a1': 'ppu', 'a2': 'addr', 'sub_4028B0': 'ppu_write_register', 'sub_401E00': 'cpu_read8', 'sub_4024C0': 'mapper_write'}"} | [
[
0.6905344724655151,
0.6873427629470825,
0.6835699677467346,
0.6744524240493774,
0.666996955871582,
0.6629548668861389,
0.6562119722366333,
0.6536176204681396,
0.6501319408416748,
0.6486587524414062,
0.6479381322860718,
0.6439318060874939,
0.6433297991752625,
0.643035888671875,
0.643033504486084,
0.6422267556190491,
0.6405327320098877,
0.6404789090156555,
0.6399986147880554,
0.6395953893661499
],
[
48098,
174395,
166822,
71684,
176111,
11087,
231816,
165085,
107107,
117189,
167764,
43690,
15519,
201807,
163604,
120979,
139755,
92860,
117972,
178575
]
] |
|
daemon_revoke_privileges | dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b | lavabit | pahoehoe | NA | int daemon_revoke_privileges(void)
{
uid_t uid = getuid();
gid_t gid = getgid();
uid_t euid = geteuid();
gid_t egid = getegid();
if (egid != gid && (setgid(gid) == -1 || getegid() != getgid()))
return -1;
if (euid != uid && (setuid(uid) == -1 || geteuid() != getuid()))
return -1;
endpwent();
endgrent();
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40BCB5", "function_addr": 4242613, "binary_name": "dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push rbx"], [3, "sub rsp, 18h"], [4, "call _getuid"], [5, "mov [rbp+uid], eax"], [6, "call _getgid"], [7, "mov [rbp+gid], eax"], [8, "call _geteuid"], [9, "mov [rbp+var_1C], eax"], [10, "call _getegid"], [11, "mov [rbp+var_20], eax"], [12, "mov eax, [rbp+var_20]"], [13, "cmp eax, [rbp+gid]"], [14, "jz short loc_40BD0C"], [15, "mov eax, [rbp+gid]"], [16, "mov edi, eax"], [17, "call _setgid"], [18, "cmp eax, 0FFFFFFFFh"], [19, "jz short loc_40BD05"], [20, "call _getegid"], [21, "mov ebx, eax"], [22, "call _getgid"], [23, "cmp ebx, eax"], [24, "jz short loc_40BD0C"], [25, "mov eax, 0FFFFFFFFh"], [26, "jmp short loc_40BD49"], [27, "mov eax, [rbp+var_1C]"], [28, "cmp eax, [rbp+uid]"], [29, "jz short loc_40BD3A"], [30, "mov eax, [rbp+uid]"], [31, "mov edi, eax"], [32, "call _setuid"], [33, "cmp eax, 0FFFFFFFFh"], [34, "jz short loc_40BD33"], [35, "call _geteuid"], [36, "mov ebx, eax"], [37, "call _getuid"], [38, "cmp ebx, eax"], [39, "jz short loc_40BD3A"], [40, "mov eax, 0FFFFFFFFh"], [41, "jmp short loc_40BD49"], [42, "call _endpwent"], [43, "call _endgrent"], [44, "mov eax, 0"], [45, "mov rbx, [rbp+var_8]"], [46, "leave"], [47, "retn"]], "data_dep": [[5, 4], [7, 6], [9, 8], [11, 10], [12, 11], [13, 7], [13, 12], [14, 13], [15, 7], [16, 15], [18, 17], [19, 18], [21, 20], [23, 22], [23, 21], [24, 23], [27, 9], [28, 27], [28, 5], [29, 28], [30, 5], [31, 30], [33, 32], [34, 33], [36, 35], [38, 37], [38, 36], [39, 38], [47, 25], [47, 40], [47, 44]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b_dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b.jsonl.gz", "strip_func_name": "sub_40BCB5", "query": "\n\n\n__int64 sub_40BCB5()\n{\n__gid_t v0; // ebx\n__uid_t v2; // ebx\n__uid_t v3; // [rsp+4h] [rbp-1Ch]\n__gid_t gid; // [rsp+8h] [rbp-18h]\n__uid_t uid; // [rsp+Ch] [rbp-14h]\n\nuid = getuid();\ngid = getgid();\nv3 = geteuid();\nif ( getegid() != gid )\n{\nif ( setgid(gid) == -1 )\nreturn 0xFFFFFFFFLL;\nv0 = getegid();\nif ( v0 != getgid() )\nreturn 0xFFFFFFFFLL;\n}\nif ( v3 != uid )\n{\nif ( setuid(uid) == -1 )\nreturn 0xFFFFFFFFLL;\nv2 = geteuid();\nif ( v2 != getuid() )\nreturn 0xFFFFFFFFLL;\n}\nendpwent();\nendgrent();\nreturn 0LL;\n}\n\n\n\nQ:[v3,sub_40BCB5,]", "hints": "[]", "response": "{'v3': 'euid', 'sub_40BCB5': 'daemon_revoke_privileges'}"} | [
[
0.7121813297271729,
0.7069976329803467,
0.6911206841468811,
0.6867946982383728,
0.6833386421203613,
0.6804816722869873,
0.6792910099029541,
0.6772016286849976,
0.6754336357116699,
0.6697728037834167,
0.6684185862541199,
0.6643100380897522,
0.6552789211273193,
0.652442216873169,
0.6512467861175537,
0.6501730680465698,
0.6487243175506592,
0.646139919757843,
0.6454001069068909,
0.6447615623474121
],
[
76727,
108265,
254282,
84901,
182565,
111533,
127016,
244957,
189118,
37204,
135761,
261402,
55859,
231957,
170930,
255647,
239435,
6567,
149724,
252299
]
] |
|
put_char | 4f0434895effbe78ce6e716668e6fe3d18241766a7c398e250ea2e50b9bcdb03 | deater | vmw-meter | NA | int put_char(unsigned char c, int x, int y, int fg_color, int bg_color,
int overwrite, unsigned char font[256][16], unsigned char *buffer) {
int xx,yy;
int output_pointer;
output_pointer=(y*XSIZE)+x;
for(yy=0;yy<FONTSIZE_Y;yy++) {
for(xx=0;xx<FONTSIZE_X;xx++) {
if (font[c][yy]&(1<<(FONTSIZE_X-xx))) {
buffer[output_pointer]=fg_color;
} else if (overwrite) {
buffer[output_pointer]=bg_color;
}
output_pointer++;
}
output_pointer+=(XSIZE-FONTSIZE_X);
}
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401BB2", "function_addr": 4201394, "binary_name": "4f0434895effbe78ce6e716668e6fe3d18241766a7c398e250ea2e50b9bcdb03.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov eax, edi"], [3, "mov [rbp+var_18], esi"], [4, "mov [rbp+var_1C], edx"], [5, "mov [rbp+var_20], ecx"], [6, "mov [rbp+var_24], r8d"], [7, "mov [rbp+var_28], r9d"], [8, "mov [rbp+var_14], al"], [9, "mov edx, [rbp+var_1C]"], [10, "mov eax, edx"], [11, "shl eax, 2"], [12, "add eax, edx"], [13, "shl eax, 7"], [14, "mov edx, eax"], [15, "mov eax, [rbp+var_18]"], [16, "add eax, edx"], [17, "mov [rbp+var_C], eax"], [18, "mov [rbp+var_8], 0"], [19, "jmp loc_401C70"], [20, "mov [rbp+var_4], 0"], [21, "jmp short loc_401C5F"], [22, "movzx eax, [rbp+var_14]"], [23, "shl rax, 4"], [24, "mov rdx, rax"], [25, "mov rax, [rbp+arg_0]"], [26, "add rdx, rax"], [27, "mov eax, [rbp+var_8]"], [28, "cdqe"], [29, "movzx eax, byte ptr [rdx+rax]"], [30, "movzx edx, al"], [31, "mov eax, 8"], [32, "sub eax, [rbp+var_4]"], [33, "mov ecx, eax"], [34, "sar edx, cl"], [35, "mov eax, edx"], [36, "and eax, 1"], [37, "test eax, eax"], [38, "jz short loc_401C3F"], [39, "mov eax, [rbp+var_C]"], [40, "movsxd rdx, eax"], [41, "mov rax, [rbp+arg_8]"], [42, "add rax, rdx"], [43, "mov edx, [rbp+var_20]"], [44, "mov [rax], dl"], [45, "jmp short loc_401C57"], [46, "cmp [rbp+var_28], 0"], [47, "jz short loc_401C57"], [48, "mov eax, [rbp+var_C]"], [49, "movsxd rdx, eax"], [50, "mov rax, [rbp+arg_8]"], [51, "add rax, rdx"], [52, "mov edx, [rbp+var_24]"], [53, "mov [rax], dl"], [54, "add [rbp+var_C], 1"], [55, "add [rbp+var_4], 1"], [56, "cmp [rbp+var_4], 7"], [57, "jle short loc_401BF8"], [58, "add [rbp+var_C], 278h"], [59, "add [rbp+var_8], 1"], [60, "cmp [rbp+var_8], 0Fh"], [61, "jle loc_401BEF"], [62, "mov eax, 0"], [63, "pop rbp"], [64, "retn"]], "data_dep": [[8, 2], [9, 4], [10, 9], [11, 10], [12, 9], [12, 11], [13, 12], [14, 13], [15, 3], [16, 15], [16, 14], [17, 16], [22, 8], [23, 22], [24, 23], [26, 24], [26, 25], [27, 59], [27, 18], [29, 44], [29, 53], [29, 27], [30, 29], [32, 31], [32, 55], [32, 20], [33, 32], [34, 30], [34, 33], [35, 34], [36, 35], [37, 36], [38, 37], [39, 54], [39, 17], [39, 58], [40, 39], [41, 18], [41, 59], [42, 41], [42, 40], [43, 5], [44, 42], [44, 43], [46, 7], [47, 46], [48, 54], [48, 17], [48, 58], [49, 48], [50, 18], [50, 59], [51, 50], [51, 49], [52, 6], [53, 52], [53, 51], [54, 58], [54, 54], [54, 17], [55, 20], [55, 55], [56, 55], [56, 20], [57, 56], [58, 58], [58, 54], [58, 17], [59, 18], [59, 59], [60, 59], [60, 18], [61, 60], [63, 0], [64, 62]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/4f0434895effbe78ce6e716668e6fe3d18241766a7c398e250ea2e50b9bcdb03_4f0434895effbe78ce6e716668e6fe3d18241766a7c398e250ea2e50b9bcdb03.jsonl.gz", "strip_func_name": "sub_401BB2", "query": "\n\n\n__int64 __fastcall sub_401BB2(unsigned __int8 a1, int a2, int a3, char a4, char a5, int a6, __int64 a7, __int64 a8)\n{\nint v9; // [rsp+1Ch] [rbp-Ch]\nint i; // [rsp+20h] [rbp-8h]\nint j; // [rsp+24h] [rbp-4h]\n\nv9 = 640 * a3 + a2;\nfor ( i = 0; i <= 15; ++i )\n{\nfor ( j = 0; j <= 7; ++j )\n{\nif ( (((int)*(unsigned __int8 *)(a7 + 16LL * a1 + i) >> (8 - j)) & 1) != 0 )\n{\n*(_BYTE *)(v9 + a8) = a4;\n}\nelse if ( a6 )\n{\n*(_BYTE *)(v9 + a8) = a5;\n}\n++v9;\n}\nv9 += 632;\n}\nreturn 0LL;\n}\n\n\n\nQ:[a3,a4,a1,a2,a5,a6,a7,a8,v9,i,j,sub_401BB2,]", "hints": "[]", "response": "{'a3': 'y', 'a4': 'fg_color', 'a1': 'c', 'a2': 'x', 'a5': 'bg_color', 'a6': 'overwrite', 'a7': 'font', 'a8': 'buffer', 'v9': 'output_pointer', 'i': 'yy', 'j': 'xx', 'sub_401BB2': 'put_char'}"} | [
[
0.7897962927818298,
0.7609158158302307,
0.7532342076301575,
0.7262731790542603,
0.7121047973632812,
0.7114771604537964,
0.7101823687553406,
0.7090620398521423,
0.7077381014823914,
0.7058482766151428,
0.7011371850967407,
0.7008066177368164,
0.7005770206451416,
0.6998542547225952,
0.6990239024162292,
0.6984003782272339,
0.6974561810493469,
0.6968545913696289,
0.6964435577392578,
0.6942629218101501
],
[
199002,
234753,
203617,
79930,
19516,
239807,
134450,
135559,
82064,
173588,
100638,
18448,
205586,
179513,
215045,
258083,
212770,
196553,
141154,
201447
]
] |
|
parse_int | 4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab | GBert | openwrt-misc | NA | static int
parse_int ()
{
if (*d >= 0x80 && *d <= 0x88)
{
int i, l;
l = *d++ & 0x0f;
i = 0;
while (l)
{
i <<= 8;
i |= *d++;
l--;
}
return i;
}
return *d++;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_404EDD", "function_addr": 4214493, "binary_name": "4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov rax, cs:src"], [3, "movzx eax, byte ptr [rax]"], [4, "test al, al"], [5, "jns short loc_404F52"], [6, "mov rax, cs:src"], [7, "movzx eax, byte ptr [rax]"], [8, "cmp al, 88h"], [9, "ja short loc_404F52"], [10, "mov rax, cs:src"], [11, "lea rdx, [rax+1]"], [12, "mov cs:src, rdx"], [13, "movzx eax, byte ptr [rax]"], [14, "movzx eax, al"], [15, "and eax, 0Fh"], [16, "mov [rbp+var_8], eax"], [17, "mov [rbp+var_4], 0"], [18, "jmp short loc_404F47"], [19, "shl [rbp+var_4], 8"], [20, "mov rax, cs:src"], [21, "lea rdx, [rax+1]"], [22, "mov cs:src, rdx"], [23, "movzx eax, byte ptr [rax]"], [24, "movzx eax, al"], [25, "or [rbp+var_4], eax"], [26, "sub [rbp+var_8], 1"], [27, "cmp [rbp+var_8], 0"], [28, "jnz short loc_404F24"], [29, "mov eax, [rbp+var_4]"], [30, "jmp short loc_404F6A"], [31, "mov rax, cs:src"], [32, "lea rdx, [rax+1]"], [33, "mov cs:src, rdx"], [34, "movzx eax, byte ptr [rax]"], [35, "movzx eax, al"], [36, "pop rbp"], [37, "retn"]], "data_dep": [[3, 2], [4, 3], [5, 4], [7, 6], [8, 7], [9, 8], [11, 10], [12, 11], [13, 10], [14, 13], [15, 14], [16, 15], [19, 17], [19, 25], [20, 22], [20, 12], [21, 21], [21, 11], [21, 20], [22, 21], [23, 20], [24, 23], [25, 19], [25, 24], [26, 26], [26, 16], [27, 16], [27, 26], [28, 27], [29, 17], [29, 25], [32, 31], [33, 32], [34, 31], [35, 34], [36, 0], [37, 35], [37, 29]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab_4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab.jsonl.gz", "strip_func_name": "sub_404EDD", "query": "\n\n\n__int64 sub_404EDD()\n{\n_BYTE *v0; // rax\nunsigned __int8 *v1; // rax\n__int64 result; // rax\nunsigned __int8 *v3; // rax\nint v4; // [rsp+0h] [rbp-8h]\nunsigned int v5; // [rsp+4h] [rbp-4h]\n\nif ( *(char *)src >= 0 || *(_BYTE *)src > 0x88u )\n{\nv3 = (unsigned __int8 *)src;\nsrc = (char *)src + 1;\nresult = *v3;\n}\nelse\n{\nv0 = src;\nsrc = (char *)src + 1;\nv4 = *v0 & 0xF;\nv5 = 0;\nwhile ( v4 )\n{\nv1 = (unsigned __int8 *)src;\nsrc = (char *)src + 1;\nv5 = *v1 | (v5 << 8);\n--v4;\n}\nresult = v5;\n}\nreturn result;\n}\n\n\n\nQ:[v4,sub_404EDD,]", "hints": "[]", "response": "{'v4': 'l', 'sub_404EDD': 'parse_int'}"} | [
[
0.8219849467277527,
0.8066969513893127,
0.795647144317627,
0.7811506986618042,
0.7772975564002991,
0.7729936838150024,
0.7660369277000427,
0.7628639340400696,
0.7537878155708313,
0.75151526927948,
0.7482338547706604,
0.7469943761825562,
0.7457101345062256,
0.7440819144248962,
0.7431219220161438,
0.7430403828620911,
0.743035614490509,
0.7422062158584595,
0.7398706078529358,
0.7388280630111694
],
[
230942,
238331,
234473,
260093,
230374,
227815,
7390,
10850,
119710,
45413,
36896,
220457,
207245,
198537,
76158,
260610,
150849,
75479,
237649,
135249
]
] |
|
utf8proc_encode_char | 2c74eba724c26ae3a60afedfca710a2898f662ed2c9ab1dedac337ea3a2a7cc7 | 0x09 | hfsfuse | NA | UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_encode_char(utf8proc_int32_t uc, utf8proc_uint8_t *dst) {
if (uc < 0x00) {
return 0;
} else if (uc < 0x80) {
dst[0] = (utf8proc_uint8_t) uc;
return 1;
} else if (uc < 0x800) {
dst[0] = (utf8proc_uint8_t)(0xC0 + (uc >> 6));
dst[1] = (utf8proc_uint8_t)(0x80 + (uc & 0x3F));
return 2;
// Note: we allow encoding 0xd800-0xdfff here, so as not to change
// the API, however, these are actually invalid in UTF-8
} else if (uc < 0x10000) {
dst[0] = (utf8proc_uint8_t)(0xE0 + (uc >> 12));
dst[1] = (utf8proc_uint8_t)(0x80 + ((uc >> 6) & 0x3F));
dst[2] = (utf8proc_uint8_t)(0x80 + (uc & 0x3F));
return 3;
} else if (uc < 0x110000) {
dst[0] = (utf8proc_uint8_t)(0xF0 + (uc >> 18));
dst[1] = (utf8proc_uint8_t)(0x80 + ((uc >> 12) & 0x3F));
dst[2] = (utf8proc_uint8_t)(0x80 + ((uc >> 6) & 0x3F));
dst[3] = (utf8proc_uint8_t)(0x80 + (uc & 0x3F));
return 4;
} else return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40194E", "function_addr": 4200782, "binary_name": "2c74eba724c26ae3a60afedfca710a2898f662ed2c9ab1dedac337ea3a2a7cc7.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_4], edi"], [3, "mov [rbp+var_10], rsi"], [4, "cmp [rbp+var_4], 0"], [5, "jns short loc_401969"], [6, "mov eax, 0"], [7, "jmp loc_401A70"], [8, "cmp [rbp+var_4], 7Fh"], [9, "jg short loc_401984"], [10, "mov eax, [rbp+var_4]"], [11, "mov edx, eax"], [12, "mov rax, [rbp+var_10]"], [13, "mov [rax], dl"], [14, "mov eax, 1"], [15, "jmp loc_401A70"], [16, "cmp [rbp+var_4], 7FFh"], [17, "jg short loc_4019BB"], [18, "mov eax, [rbp+var_4]"], [19, "sar eax, 6"], [20, "lea edx, [rax-40h]"], [21, "mov rax, [rbp+var_10]"], [22, "mov [rax], dl"], [23, "mov eax, [rbp+var_4]"], [24, "and eax, 3Fh"], [25, "mov edx, eax"], [26, "mov rax, [rbp+var_10]"], [27, "add rax, 1"], [28, "add edx, 0FFFFFF80h"], [29, "mov [rax], dl"], [30, "mov eax, 2"], [31, "jmp loc_401A70"], [32, "cmp [rbp+var_4], 0FFFFh"], [33, "jg short loc_401A07"], [34, "mov eax, [rbp+var_4]"], [35, "sar eax, 0Ch"], [36, "lea edx, [rax-20h]"], [37, "mov rax, [rbp+var_10]"], [38, "mov [rax], dl"], [39, "mov eax, [rbp+var_4]"], [40, "sar eax, 6"], [41, "and eax, 3Fh"], [42, "mov edx, eax"], [43, "mov rax, [rbp+var_10]"], [44, "add rax, 1"], [45, "add edx, 0FFFFFF80h"], [46, "mov [rax], dl"], [47, "mov eax, [rbp+var_4]"], [48, "and eax, 3Fh"], [49, "mov edx, eax"], [50, "mov rax, [rbp+var_10]"], [51, "add rax, 2"], [52, "add edx, 0FFFFFF80h"], [53, "mov [rax], dl"], [54, "mov eax, 3"], [55, "jmp short loc_401A70"], [56, "cmp [rbp+var_4], 10FFFFh"], [57, "jg short loc_401A6B"], [58, "mov eax, [rbp+var_4]"], [59, "sar eax, 12h"], [60, "lea edx, [rax-10h]"], [61, "mov rax, [rbp+var_10]"], [62, "mov [rax], dl"], [63, "mov eax, [rbp+var_4]"], [64, "sar eax, 0Ch"], [65, "and eax, 3Fh"], [66, "mov edx, eax"], [67, "mov rax, [rbp+var_10]"], [68, "add rax, 1"], [69, "add edx, 0FFFFFF80h"], [70, "mov [rax], dl"], [71, "mov eax, [rbp+var_4]"], [72, "sar eax, 6"], [73, "and eax, 3Fh"], [74, "mov edx, eax"], [75, "mov rax, [rbp+var_10]"], [76, "add rax, 2"], [77, "add edx, 0FFFFFF80h"], [78, "mov [rax], dl"], [79, "mov eax, [rbp+var_4]"], [80, "and eax, 3Fh"], [81, "mov edx, eax"], [82, "mov rax, [rbp+var_10]"], [83, "add rax, 3"], [84, "add edx, 0FFFFFF80h"], [85, "mov [rax], dl"], [86, "mov eax, 4"], [87, "jmp short loc_401A70"], [88, "mov eax, 0"], [89, "pop rbp"], [90, "retn"]], "data_dep": [[4, 2], [5, 4], [8, 2], [9, 8], [10, 2], [11, 10], [12, 3], [13, 12], [13, 11], [16, 2], [17, 16], [18, 2], [19, 18], [20, 19], [21, 3], [22, 21], [22, 20], [23, 2], [24, 23], [25, 24], [26, 3], [27, 26], [28, 25], [29, 27], [29, 28], [32, 2], [33, 32], [34, 2], [35, 34], [36, 35], [37, 3], [38, 36], [38, 37], [39, 2], [40, 39], [41, 40], [42, 41], [43, 3], [44, 43], [45, 42], [46, 45], [46, 44], [47, 2], [48, 47], [49, 48], [50, 3], [51, 50], [52, 49], [53, 52], [53, 51], [56, 2], [57, 56], [58, 2], [59, 58], [60, 59], [61, 3], [62, 60], [62, 61], [63, 2], [64, 63], [65, 64], [66, 65], [67, 3], [68, 67], [69, 66], [70, 68], [70, 69], [71, 2], [72, 71], [73, 72], [74, 73], [75, 3], [76, 75], [77, 74], [78, 77], [78, 76], [79, 2], [80, 79], [81, 80], [82, 3], [83, 82], [84, 81], [85, 84], [85, 83], [89, 0], [90, 88], [90, 30], [90, 14], [90, 86], [90, 6], [90, 54]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/2c74eba724c26ae3a60afedfca710a2898f662ed2c9ab1dedac337ea3a2a7cc7_2c74eba724c26ae3a60afedfca710a2898f662ed2c9ab1dedac337ea3a2a7cc7.jsonl.gz", "strip_func_name": "sub_40194E", "query": "\n\n\n__int64 __fastcall sub_40194E(int a1, _BYTE *a2)\n{\n__int64 result; // rax\n\nif ( a1 < 0 )\nreturn 0LL;\nif ( a1 > 127 )\n{\nif ( a1 > 2047 )\n{\nif ( a1 > 0xFFFF )\n{\nif ( a1 > 1114111 )\n{\nresult = 0LL;\n}\nelse\n{\n*a2 = (a1 >> 18) - 16;\na2[1] = ((a1 >> 12) & 0x3F) + 0x80;\na2[2] = ((a1 >> 6) & 0x3F) + 0x80;\na2[3] = (a1 & 0x3F) + 0x80;\nresult = 4LL;\n}\n}\nelse\n{\n*a2 = (a1 >> 12) - 32;\na2[1] = ((a1 >> 6) & 0x3F) + 0x80;\na2[2] = (a1 & 0x3F) + 0x80;\nresult = 3LL;\n}\n}\nelse\n{\n*a2 = (a1 >> 6) - 64;\na2[1] = (a1 & 0x3F) + 0x80;\nresult = 2LL;\n}\n}\nelse\n{\n*a2 = a1;\nresult = 1LL;\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,sub_40194E,]", "hints": "[]", "response": "{'a1': 'uc', 'a2': 'dst', 'sub_40194E': 'utf8proc_encode_char'}"} | [
[
0.8841904997825623,
0.874174177646637,
0.8690569996833801,
0.8513420224189758,
0.803961455821991,
0.7865617871284485,
0.7791861295700073,
0.7704225182533264,
0.7702316045761108,
0.7690100073814392,
0.7678973078727722,
0.7617836594581604,
0.7590399384498596,
0.7586488723754883,
0.758058488368988,
0.7529850602149963,
0.7518692016601562,
0.7481091022491455,
0.7414668798446655,
0.7383369207382202
],
[
168269,
80493,
41771,
219813,
226849,
140701,
202195,
63222,
116654,
194389,
42155,
92886,
160096,
34023,
139636,
105591,
107708,
114486,
40099,
240665
]
] |
|
parse_one_option | 2c00654bef88d0508fa38ae4f23cd4855f551f44cdb471bbff8963716b7f93f5 | xelerance | xl2tpd | NA | int parse_one_option(char *word, char *value, int context, void *item)
{
struct keyword *kw;
for (kw = words; kw->keyword; kw++)
{
if (!strcasecmp (word, kw->keyword))
{
if (kw->handler (word, value, context, item))
{
return -1;
}
break;
}
}
if (!kw->keyword)
{
return -2;
}
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_417A63", "function_addr": 4291171, "binary_name": "2c00654bef88d0508fa38ae4f23cd4855f551f44cdb471bbff8963716b7f93f5.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+s1], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_24], edx"], [6, "mov [rbp+var_30], rcx"], [7, "mov [rbp+var_8], offset off_424B00"], [8, "jmp short loc_417ACB"], [9, "mov rax, [rbp+var_8]"], [10, "mov rdx, [rax]"], [11, "mov rax, [rbp+s1]"], [12, "mov rsi, rdx"], [13, "mov rdi, rax"], [14, "call _strcasecmp"], [15, "test eax, eax"], [16, "jnz short loc_417AC6"], [17, "mov rax, [rbp+var_8]"], [18, "mov r8, [rax+8]"], [19, "mov rcx, [rbp+var_30]"], [20, "mov edx, [rbp+var_24]"], [21, "mov rsi, [rbp+var_20]"], [22, "mov rax, [rbp+s1]"], [23, "mov rdi, rax"], [24, "call r8"], [25, "test eax, eax"], [26, "jz short loc_417AD9"], [27, "mov eax, 0FFFFFFFFh"], [28, "jmp short locret_417AF2"], [29, "add [rbp+var_8], 10h"], [30, "mov rax, [rbp+var_8]"], [31, "mov rax, [rax]"], [32, "test rax, rax"], [33, "jnz short loc_417A84"], [34, "jmp short loc_417ADA"], [35, "nop"], [36, "mov rax, [rbp+var_8]"], [37, "mov rax, [rax]"], [38, "test rax, rax"], [39, "jnz short loc_417AED"], [40, "mov eax, 0FFFFFFFEh"], [41, "jmp short locret_417AF2"], [42, "mov eax, 0"], [43, "leave"], [44, "retn"]], "data_dep": [[9, 29], [9, 7], [10, 9], [11, 3], [12, 10], [13, 11], [15, 14], [16, 15], [17, 29], [17, 7], [18, 17], [19, 6], [20, 5], [21, 4], [22, 3], [23, 22], [24, 18], [25, 24], [26, 25], [29, 29], [29, 7], [30, 29], [30, 7], [31, 30], [32, 31], [33, 32], [36, 7], [36, 29], [37, 36], [38, 37], [39, 38], [44, 42], [44, 40], [44, 27]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/2c00654bef88d0508fa38ae4f23cd4855f551f44cdb471bbff8963716b7f93f5_2c00654bef88d0508fa38ae4f23cd4855f551f44cdb471bbff8963716b7f93f5.jsonl.gz", "strip_func_name": "sub_417A63", "query": "\n\n\n__int64 __fastcall sub_417A63(const char *a1, __int64 a2, unsigned int a3, __int64 a4)\n{\n__int64 result; // rax\nchar **i; // [rsp+28h] [rbp-8h]\n\nfor ( i = &off_424B00; *i; i += 2 )\n{\nif ( !strcasecmp(a1, *i) )\n{\nif ( ((unsigned int (__fastcall *)(const char *, __int64, _QWORD, __int64))i[1])(a1, a2, a3, a4) )\nreturn 0xFFFFFFFFLL;\nbreak;\n}\n}\nif ( *i )\nresult = 0LL;\nelse\nresult = 4294967294LL;\nreturn result;\n}\n\n\n\nQ:[a3,a4,a1,a2,i,sub_417A63,]", "hints": "[]", "response": "{'a3': 'context', 'a4': 'item', 'a1': 'word', 'a2': 'value', 'i': 'kw', 'sub_417A63': 'parse_one_option'}"} | [
[
0.6856307983398438,
0.6769644618034363,
0.6385979056358337,
0.633610188961029,
0.6247435808181763,
0.6078488826751709,
0.6063697338104248,
0.6061233878135681,
0.6033750772476196,
0.6011607646942139,
0.6008518934249878,
0.5996665954589844,
0.5973328351974487,
0.5927592515945435,
0.5920367240905762,
0.5905275344848633,
0.5902760028839111,
0.5884517431259155,
0.5880483388900757,
0.5863612294197083
],
[
153049,
111187,
220757,
121565,
81454,
12319,
31022,
212810,
76824,
169181,
50074,
156816,
3061,
241771,
42989,
176542,
97055,
242086,
167476,
57879
]
] |
|
deactivate_nonblock | 89443bdfefd0d94018baec5d954a9a6aeca19ff5ba8e5f19dfc1e207d11131c6 | Tachone | Tachftp | NA | void deactivate_nonblock(int fd)
{
int ret;
int flags = fcntl(fd, F_GETFL);
if (flags == -1)
ERR_EXIT("fcntl");
flags &= ~O_NONBLOCK;
ret = fcntl(fd, F_SETFL, flags);
if (ret == -1)
ERR_EXIT("fcntl");
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_403009", "function_addr": 4206601, "binary_name": "89443bdfefd0d94018baec5d954a9a6aeca19ff5ba8e5f19dfc1e207d11131c6.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+fd], edi"], [4, "mov eax, [rbp+fd]"], [5, "mov esi, 3"], [6, "mov edi, eax"], [7, "mov eax, 0"], [8, "call _fcntl"], [9, "mov [rbp+var_4], eax"], [10, "cmp [rbp+var_4], 0FFFFFFFFh"], [11, "jnz short loc_403045"], [12, "mov edi, offset aFcntl_0"], [13, "call _perror"], [14, "mov edi, 1"], [15, "call _exit"], [16, "and [rbp+var_4], 0FFFFF7FFh"], [17, "mov edx, [rbp+var_4]"], [18, "mov eax, [rbp+fd]"], [19, "mov esi, 4"], [20, "mov edi, eax"], [21, "mov eax, 0"], [22, "call _fcntl"], [23, "mov [rbp+var_8], eax"], [24, "cmp [rbp+var_8], 0FFFFFFFFh"], [25, "jnz short loc_403080"], [26, "mov edi, offset aFcntl_0"], [27, "call _perror"], [28, "mov edi, 1"], [29, "call _exit"], [30, "nop"], [31, "leave"], [32, "retn"]], "data_dep": [[4, 3], [6, 4], [9, 8], [10, 9], [11, 10], [16, 9], [17, 16], [18, 3], [20, 18], [23, 22], [24, 23], [25, 24], [32, 22]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/89443bdfefd0d94018baec5d954a9a6aeca19ff5ba8e5f19dfc1e207d11131c6_89443bdfefd0d94018baec5d954a9a6aeca19ff5ba8e5f19dfc1e207d11131c6.jsonl.gz", "strip_func_name": "sub_403009", "query": "\n\n\nint __fastcall sub_403009(int a1)\n{\nint result; // eax\nint v2; // [rsp+1Ch] [rbp-4h]\n\nv2 = fcntl(a1, 3);\nif ( v2 == -1 )\n{\nperror(\"fcntl\");\nexit(1);\n}\nresult = fcntl(a1, 4, v2 & 0xFFFFF7FF);\nif ( result == -1 )\n{\nperror(\"fcntl\");\nexit(1);\n}\nreturn result;\n}\n\n\n\nQ:[a1,v2,sub_403009,]", "hints": "[]", "response": "{'a1': 'fd', 'v2': 'flags', 'sub_403009': 'deactivate_nonblock'}"} | [
[
0.8391196727752686,
0.8389492034912109,
0.8308838605880737,
0.8293908834457397,
0.8067160844802856,
0.8020305633544922,
0.7966554164886475,
0.7841416597366333,
0.7820292115211487,
0.781725287437439,
0.7437475919723511,
0.7404532432556152,
0.738903284072876,
0.738594114780426,
0.7347081899642944,
0.7335952520370483,
0.7282406687736511,
0.7263081669807434,
0.7232624292373657,
0.7202999591827393
],
[
118197,
212830,
139786,
140087,
200456,
141342,
125416,
145771,
239566,
260092,
82971,
260326,
182016,
104494,
215336,
108117,
56514,
242936,
182029,
198232
]
] |
|
ppu_read8 | e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b | kgabis | agnes | NA | static uint8_t ppu_read8(ppu_t *ppu, uint16_t addr) {
addr = addr & 0x3fff;
uint8_t res = 0;
if (addr >= 0x3f00) { // $3F00 - $3FFF, palette reads are most common
unsigned palette_ix = g_palette_addr_map[addr & 0x1f];
res = ppu->palette[palette_ix];
} else if (addr < 0x2000) { // $0000 - $1FFF
res = mapper_read(ppu->agnes, addr);
} else { // $2000 - $3EFF
uint16_t mirrored_addr = mirror_address(ppu, addr);
res = ppu->nametables[mirrored_addr];
}
return res;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401C30", "function_addr": 4201520, "binary_name": "e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b.elf_extract.pkl\n"}, "code": [[0, "mov eax, esi"], [1, "and ax, 3FFFh"], [2, "cmp ax, 3EFFh"], [3, "jbe short loc_401C50"], [4, "and esi, 1Fh"], [5, "mov eax, ds:dword_406A40[rsi*4]"], [6, "movzx eax, byte ptr [rdi+rax+1008h]"], [7, "retn"], [8, "mov rcx, [rdi]"], [9, "test esi, 2000h"], [10, "jz short loc_401C78"], [11, "cmp dword ptr [rcx+14A48h], 5"], [12, "ja def_401C6E"], [13, "mov edx, [rcx+14A48h]"], [14, "jmp ds:jpt_401C6E[rdx*8]"], [15, "movzx edx, byte ptr [rcx+109E1h]"], [16, "movzx edi, ax"], [17, "cmp dl, 2"], [18, "jz loc_401D68"], [19, "ja short loc_401CB0"], [20, "test dl, dl"], [21, "jz short loc_401CF8"], [22, "cmp byte ptr [rcx+10A28h], 0"], [23, "jz loc_401DC0"], [24, "movzx eax, byte ptr [rcx+rdi+10A29h]"], [25, "retn"], [26, "cmp dl, 4"], [27, "jnz short loc_401CF0"], [28, "shr ax, 0Ah"], [29, "mov rdx, rax"], [30, "mov eax, esi"], [31, "and edx, 0Fh"], [32, "and eax, 3FFh"], [33, "add eax, [rcx+rdx*4+10A14h]"], [34, "cmp byte ptr [rcx+12A44h], 0"], [35, "jz loc_401D98"], [36, "and eax, 1FFFh"], [37, "movzx eax, byte ptr [rcx+rax+12A45h]"], [38, "retn"], [39, "xor eax, eax"], [40, "retn"], [41, "cmp byte ptr [rcx+10A00h], 0"], [42, "jz short loc_401D78"], [43, "movzx eax, byte ptr [rcx+rdi+10A01h]"], [44, "retn"], [45, "and esi, 3FFh"], [46, "movsxd rsi, esi"], [47, "movzx eax, byte ptr [rdi+rsi+8]"], [48, "retn"], [49, "and esi, 7FFh"], [50, "jmp short loc_401D16"], [51, "lea esi, [rax-2000h]"], [52, "movzx esi, si"], [53, "jmp short loc_401D16"], [54, "and esi, 3FFh"], [55, "or esi, 400h"], [56, "jmp short loc_401D16"], [57, "shr ax, 1"], [58, "and si, 3FFh"], [59, "and ax, 400h"], [60, "or esi, eax"], [61, "movzx esi, si"], [62, "jmp short loc_401D16"], [63, "movzx eax, byte ptr [rcx+rdi+10A00h]"], [64, "retn"], [65, "mov rax, [rcx+109F0h]"], [66, "add edi, [rax+109D4h]"], [67, "mov rax, [rax+109C8h]"], [68, "movzx eax, byte ptr [rax+rdi]"], [69, "retn"], [70, "mov rsi, [rcx+109F0h]"], [71, "xor edx, edx"], [72, "mov ecx, [rsi+109DCh]"], [73, "shl ecx, 0Dh"], [74, "div ecx"], [75, "mov rax, [rsi+109C8h]"], [76, "add edx, [rsi+109D4h]"], [77, "movzx eax, byte ptr [rax+rdx]"], [78, "retn"], [79, "mov rdx, [rcx+109F0h]"], [80, "shr ax, 0Ch"], [81, "and esi, 0FFFh"], [82, "and eax, 3"], [83, "add esi, [rdx+109D4h]"], [84, "add esi, [rcx+rax*4+10A18h]"], [85, "mov rax, [rdx+109C8h]"], [86, "movzx eax, byte ptr [rax+rsi]"], [87, "retn"], [88, "xor esi, esi"], [89, "jmp loc_401D16"]], "data_dep": [[1, 0], [2, 1], [3, 2], [6, 5], [7, 6], [10, 9], [11, 8], [12, 11], [13, 8], [15, 8], [16, 1], [17, 15], [18, 17], [19, 17], [20, 15], [21, 20], [22, 8], [23, 22], [24, 8], [25, 24], [26, 15], [27, 26], [28, 1], [29, 28], [30, 9], [31, 29], [32, 30], [33, 8], [33, 32], [34, 8], [35, 34], [36, 33], [37, 36], [38, 37], [40, 39], [41, 8], [42, 41], [43, 8], [44, 43], [45, 9], [46, 52], [46, 61], [46, 45], [46, 49], [46, 88], [46, 55], [47, 46], [48, 47], [49, 9], [51, 9], [51, 1], [52, 51], [54, 9], [55, 54], [57, 1], [58, 9], [59, 57], [60, 59], [60, 58], [61, 60], [63, 8], [64, 63], [65, 8], [66, 16], [66, 65], [67, 65], [68, 67], [69, 68], [70, 8], [72, 70], [73, 72], [74, 73], [75, 70], [76, 70], [76, 71], [77, 75], [78, 77], [79, 8], [80, 1], [81, 9], [82, 80], [83, 79], [83, 81], [84, 83], [84, 82], [85, 79], [86, 85], [87, 86]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b_e879ca72f3c404b6db74fbe363649936f5bd80fe179b3aed6967631772dd824b.jsonl.gz", "strip_func_name": "sub_401C30", "query": "\n\n\n__int64 __fastcall sub_401C30(__int64 *a1, __int16 a2)\n{\nunsigned __int16 v2; // ax\n__int64 result; // rax\n__int64 v4; // rcx\nunsigned __int8 v5; // dl\nunsigned int v6; // eax\nint v7; // esi\n\nv2 = a2 & 0x3FFF;\nif ( (a2 & 0x3FFFu) > 0x3EFF )\nreturn *((unsigned __int8 *)a1 + (unsigned int)dword_406A40[a2 & 0x1F] + 4104);\nv4 = *a1;\nif ( (a2 & 0x2000) != 0 )\n{\nswitch ( *(_DWORD *)(v4 + 84552) )\n{\ncase 1:\nv7 = a2 & 0x3FF;\nbreak;\ncase 2:\nv7 = a2 & 0x3FF | 0x400;\nbreak;\ncase 3:\nv7 = (v2 >> 1) & 0x400 | a2 & 0x3FF;\nbreak;\ncase 4:\nv7 = a2 & 0x7FF;\nbreak;\ncase 5:\nv7 = (unsigned __int16)(v2 - 0x2000);\nbreak;\ndefault:\nv7 = 0;\nbreak;\n}\nresult = *((unsigned __int8 *)a1 + v7 + 8);\n}\nelse\n{\nv5 = *(_BYTE *)(v4 + 68065);\nif ( v5 == 2 )\n{\nresult = *(unsigned __int8 *)(v4 + v2 + 68096);\n}\nelse if ( v5 > 2u )\n{\nif ( v5 == 4 )\n{\nv6 = *(_DWORD *)(v4 + 4LL * ((v2 >> 10) & 0xF) + 68116) + (a2 & 0x3FF);\nif ( *(_BYTE *)(v4 + 76356) )\nresult = *(unsigned __int8 *)(v4 + (v6 & 0x1FFF) + 76357);\nelse\nresult = *(unsigned __int8 *)(*(_QWORD *)(*(_QWORD *)(v4 + 68080) + 68040LL)\n+ *(_DWORD *)(*(_QWORD *)(v4 + 68080) + 68052LL)\n+ v6 % (*(_DWORD *)(*(_QWORD *)(v4 + 68080) + 68060LL) << 13));\n}\nelse\n{\nresult = 0LL;\n}\n}\nelse if ( v5 )\n{\nif ( *(_BYTE *)(v4 + 68136) )\nresult = *(unsigned __int8 *)(v4 + v2 + 68137);\nelse\nresult = *(unsigned __int8 *)(*(_QWORD *)(*(_QWORD *)(v4 + 68080) + 68040LL)\n+ *(_DWORD *)(v4 + 4LL * ((v2 >> 12) & 3) + 68120)\n+ *(_DWORD *)(*(_QWORD *)(v4 + 68080) + 68052LL)\n+ (a2 & 0xFFFu));\n}\nelse if ( *(_BYTE *)(v4 + 68096) )\n{\nresult = *(unsigned __int8 *)(v4 + v2 + 68097);\n}\nelse\n{\nresult = *(unsigned __int8 *)(*(_QWORD *)(*(_QWORD *)(v4 + 68080) + 68040LL)\n+ *(_DWORD *)(*(_QWORD *)(v4 + 68080) + 68052LL)\n+ (unsigned int)v2);\n}\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,sub_401C30,]", "hints": "[]", "response": "{'a1': 'ppu', 'a2': 'addr', 'sub_401C30': 'ppu_read8'}"} | [
[
0.6964054107666016,
0.6964054107666016,
0.6948846578598022,
0.6935692429542542,
0.6883127689361572,
0.686295747756958,
0.6748513579368591,
0.6659739017486572,
0.6658053994178772,
0.6587109565734863,
0.6559514999389648,
0.6553962826728821,
0.652432918548584,
0.6439579129219055,
0.643775999546051,
0.6428865790367126,
0.6428865790367126,
0.6391690969467163,
0.6388089060783386,
0.6370987892150879
],
[
820,
198071,
123632,
186524,
142083,
230065,
82588,
74055,
127752,
198764,
152660,
262463,
101711,
133533,
118157,
236346,
209928,
38883,
37775,
106686
]
] |
|
string_nocasencmp | b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97 | marcobambini | gravity | NA | int string_nocasencmp(const char *s1, const char *s2, size_t n) {
while(n > 0 && tolower((unsigned char)*s1) == tolower((unsigned char)*s2)) {
if(*s1 == '\0') return 0;
s1++;
s2++;
n--;
}
if(n == 0) return 0;
return tolower((unsigned char)*s1) - tolower((unsigned char)*s2);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_45F0FB", "function_addr": 4583675, "binary_name": "b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push rbx"], [3, "sub rsp, 28h"], [4, "mov [rbp+var_18], rdi"], [5, "mov [rbp+var_20], rsi"], [6, "mov [rbp+var_28], rdx"], [7, "jmp short loc_45F133"], [8, "mov rax, [rbp+var_18]"], [9, "movzx eax, byte ptr [rax]"], [10, "test al, al"], [11, "jnz short loc_45F124"], [12, "mov eax, 0"], [13, "jmp short loc_45F19A"], [14, "add [rbp+var_18], 1"], [15, "add [rbp+var_20], 1"], [16, "sub [rbp+var_28], 1"], [17, "cmp [rbp+var_28], 0"], [18, "jz short loc_45F162"], [19, "mov rax, [rbp+var_18]"], [20, "movzx eax, byte ptr [rax]"], [21, "movzx eax, al"], [22, "mov edi, eax"], [23, "call _tolower"], [24, "mov ebx, eax"], [25, "mov rax, [rbp+var_20]"], [26, "movzx eax, byte ptr [rax]"], [27, "movzx eax, al"], [28, "mov edi, eax"], [29, "call _tolower"], [30, "cmp ebx, eax"], [31, "jz short loc_45F112"], [32, "cmp [rbp+var_28], 0"], [33, "jnz short loc_45F170"], [34, "mov eax, 0"], [35, "jmp short loc_45F19A"], [36, "mov rax, [rbp+var_18]"], [37, "movzx eax, byte ptr [rax]"], [38, "movzx eax, al"], [39, "mov edi, eax"], [40, "call _tolower"], [41, "mov ebx, eax"], [42, "mov rax, [rbp+var_20]"], [43, "movzx eax, byte ptr [rax]"], [44, "movzx eax, al"], [45, "mov edi, eax"], [46, "call _tolower"], [47, "mov edx, eax"], [48, "mov eax, ebx"], [49, "sub eax, edx"], [50, "mov rbx, [rbp+var_8]"], [51, "leave"], [52, "retn"]], "data_dep": [[8, 14], [8, 4], [9, 8], [10, 9], [11, 10], [14, 4], [14, 14], [15, 5], [15, 15], [16, 16], [16, 6], [17, 6], [17, 16], [18, 17], [19, 14], [19, 4], [20, 19], [21, 20], [22, 21], [24, 23], [25, 15], [25, 5], [26, 25], [27, 26], [28, 27], [30, 24], [30, 29], [31, 30], [32, 6], [32, 16], [33, 32], [36, 4], [36, 14], [37, 36], [38, 37], [39, 38], [41, 40], [42, 5], [42, 15], [43, 42], [44, 43], [45, 44], [47, 46], [48, 41], [49, 47], [49, 48], [52, 49], [52, 12], [52, 34]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97_b2b6239f41efcd906cff8a967b6680bd1e1b9f4105564fc6f50ab0c84f5f6e97.jsonl.gz", "strip_func_name": "sub_45F0FB", "query": "\n\n\n__int64 __fastcall sub_45F0FB(_BYTE *a1, unsigned __int8 *a2, __int64 a3)\n{\nint v4; // ebx\nint v5; // ebx\n\nwhile ( a3 )\n{\nv4 = tolower((unsigned __int8)*a1);\nif ( v4 != tolower(*a2) )\nbreak;\nif ( !*a1 )\nreturn 0LL;\n++a1;\n++a2;\n--a3;\n}\nif ( !a3 )\nreturn 0LL;\nv5 = tolower((unsigned __int8)*a1);\nreturn (unsigned int)(v5 - tolower(*a2));\n}\n\n\n\nQ:[a3,a1,a2,sub_45F0FB,]", "hints": "[]", "response": "{'a3': 'n', 'a1': 's1', 'a2': 's2', 'sub_45F0FB': 'string_nocasencmp'}"} | [
[
0.8575310707092285,
0.8553938865661621,
0.8298635482788086,
0.8254127502441406,
0.8177447319030762,
0.8172773718833923,
0.8099633455276489,
0.8081151247024536,
0.8079192638397217,
0.7925216555595398,
0.7891674637794495,
0.786921501159668,
0.7797714471817017,
0.779457151889801,
0.7760146856307983,
0.7759641408920288,
0.7740232944488525,
0.7574371099472046,
0.7521036267280579,
0.7477656006813049
],
[
208796,
186045,
217697,
56699,
160531,
13988,
74092,
251071,
6268,
1758,
120380,
72484,
230705,
33101,
86033,
120946,
179576,
189917,
5068,
9406
]
] |
|
show_progress | e43bffe93708bb70dadc7d020361366794111a280f2afdad4d536db6335d032e | axboe | fio | NA | static void show_progress(struct worker_thread *threads, unsigned long total)
{
unsigned long last_nitems = 0;
struct timespec last_tv;
fio_gettime(&last_tv, NULL);
while (print_progress) {
unsigned long this_items;
unsigned long nitems = 0;
uint64_t tdiff;
float perc;
int some_done = 0;
int i;
for (i = 0; i < num_threads; i++) {
nitems += threads[i].items;
some_done = threads[i].done;
if (some_done)
break;
}
if (some_done)
break;
perc = (float) nitems / (float) total;
perc *= 100.0;
this_items = nitems - last_nitems;
this_items *= blocksize;
tdiff = mtime_since_now(&last_tv);
if (tdiff) {
this_items = (this_items * 1000) / (tdiff * 1024);
printf("%3.2f%% done (%luKiB/sec)\r", perc, this_items);
last_nitems = nitems;
fio_gettime(&last_tv, NULL);
} else {
printf("%3.2f%% done\r", perc);
}
fflush(stdout);
usleep(250000);
};
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_404541", "function_addr": 4212033, "binary_name": "e43bffe93708bb70dadc7d020361366794111a280f2afdad4d536db6335d032e.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 50h"], [3, "mov [rbp+var_48], rdi"], [4, "mov [rbp+var_50], rsi"], [5, "mov [rbp+var_8], 0"], [6, "lea rax, [rbp+var_40]"], [7, "mov esi, 0"], [8, "mov rdi, rax"], [9, "call fio_gettime"], [10, "jmp loc_40474A"], [11, "mov [rbp+var_10], 0"], [12, "mov [rbp+var_14], 0"], [13, "mov [rbp+var_18], 0"], [14, "jmp short loc_4045DF"], [15, "mov eax, [rbp+var_18]"], [16, "movsxd rdx, eax"], [17, "mov rax, rdx"], [18, "add rax, rax"], [19, "add rax, rdx"], [20, "shl rax, 6"], [21, "mov rdx, rax"], [22, "mov rax, [rbp+var_48]"], [23, "add rax, rdx"], [24, "mov rax, [rax+0A0h]"], [25, "add [rbp+var_10], rax"], [26, "mov eax, [rbp+var_18]"], [27, "movsxd rdx, eax"], [28, "mov rax, rdx"], [29, "add rax, rax"], [30, "add rax, rdx"], [31, "shl rax, 6"], [32, "mov rdx, rax"], [33, "mov rax, [rbp+var_48]"], [34, "add rax, rdx"], [35, "mov eax, [rax+0B8h]"], [36, "mov [rbp+var_14], eax"], [37, "cmp [rbp+var_14], 0"], [38, "jnz short loc_4045EE"], [39, "add [rbp+var_18], 1"], [40, "mov edx, [rbp+var_18]"], [41, "mov eax, cs:dword_411358"], [42, "cmp edx, eax"], [43, "jb short loc_404587"], [44, "jmp short loc_4045EF"], [45, "nop"], [46, "cmp [rbp+var_14], 0"], [47, "jnz loc_40475A"], [48, "mov rax, [rbp+var_10]"], [49, "test rax, rax"], [50, "js short loc_40460D"], [51, "pxor xmm0, xmm0"], [52, "cvtsi2ss xmm0, rax"], [53, "jmp short loc_404626"], [54, "mov rdx, rax"], [55, "shr rdx, 1"], [56, "and eax, 1"], [57, "or rdx, rax"], [58, "pxor xmm0, xmm0"], [59, "cvtsi2ss xmm0, rdx"], [60, "addss xmm0, xmm0"], [61, "mov rax, [rbp+var_50]"], [62, "test rax, rax"], [63, "js short loc_40463A"], [64, "pxor xmm1, xmm1"], [65, "cvtsi2ss xmm1, rax"], [66, "jmp short loc_404653"], [67, "mov rdx, rax"], [68, "shr rdx, 1"], [69, "and eax, 1"], [70, "or rdx, rax"], [71, "pxor xmm1, xmm1"], [72, "cvtsi2ss xmm1, rdx"], [73, "addss xmm1, xmm1"], [74, "divss xmm0, xmm1"], [75, "movss [rbp+var_1C], xmm0"], [76, "movss xmm1, [rbp+var_1C]"], [77, "movss xmm0, cs:dword_40C570"], [78, "mulss xmm0, xmm1"], [79, "movss [rbp+var_1C], xmm0"], [80, "mov rax, [rbp+var_10]"], [81, "sub rax, [rbp+var_8]"], [82, "mov [rbp+var_28], rax"], [83, "mov eax, cs:n"], [84, "mov edx, eax"], [85, "mov rax, [rbp+var_28]"], [86, "imul rax, rdx"], [87, "mov [rbp+var_28], rax"], [88, "lea rax, [rbp+var_40]"], [89, "mov rdi, rax"], [90, "call mtime_since_now"], [91, "mov [rbp+var_30], rax"], [92, "cmp [rbp+var_30], 0"], [93, "jz short loc_40470F"], [94, "mov rax, [rbp+var_28]"], [95, "imul rax, 3E8h"], [96, "mov rdx, [rbp+var_30]"], [97, "mov rcx, rdx"], [98, "shl rcx, 0Ah"], [99, "mov edx, 0"], [100, "div rcx"], [101, "mov [rbp+var_28], rax"], [102, "pxor xmm2, xmm2"], [103, "cvtss2sd xmm2, [rbp+var_1C]"], [104, "movq rax, xmm2"], [105, "mov rdx, [rbp+var_28]"], [106, "mov rsi, rdx"], [107, "movq xmm0, rax"], [108, "mov edi, offset a32fDoneLukibSe"], [109, "mov eax, 1"], [110, "call _printf"], [111, "mov rax, [rbp+var_10]"], [112, "mov [rbp+var_8], rax"], [113, "lea rax, [rbp+var_40]"], [114, "mov esi, 0"], [115, "mov rdi, rax"], [116, "call fio_gettime"], [117, "jmp short loc_404731"], [118, "pxor xmm3, xmm3"], [119, "cvtss2sd xmm3, [rbp+var_1C]"], [120, "movq rax, xmm3"], [121, "movq xmm0, rax"], [122, "mov edi, offset a32fDone"], [123, "mov eax, 1"], [124, "call _printf"], [125, "mov rax, cs:stdout"], [126, "mov rdi, rax"], [127, "call _fflush"], [128, "mov edi, 3D090h"], [129, "call _usleep"], [130, "mov eax, cs:dword_411228"], [131, "test eax, eax"], [132, "jnz loc_40456F"], [133, "jmp short loc_40475B"], [134, "nop"], [135, "nop"], [136, "leave"], [137, "retn"]], "data_dep": [[8, 6], [15, 39], [15, 13], [16, 15], [17, 16], [18, 17], [19, 18], [19, 16], [20, 19], [21, 20], [22, 3], [23, 22], [23, 21], [24, 23], [25, 25], [25, 11], [25, 24], [26, 39], [26, 13], [27, 26], [28, 27], [29, 28], [30, 27], [30, 29], [31, 30], [32, 31], [33, 3], [34, 32], [34, 33], [35, 34], [36, 35], [37, 36], [38, 37], [39, 39], [39, 13], [40, 13], [40, 39], [42, 41], [42, 40], [43, 42], [46, 36], [46, 12], [47, 46], [48, 25], [48, 11], [49, 48], [50, 49], [52, 49], [52, 51], [54, 49], [55, 54], [56, 49], [57, 56], [57, 55], [59, 57], [59, 58], [60, 59], [61, 4], [62, 61], [63, 62], [65, 62], [65, 64], [67, 62], [68, 67], [69, 62], [70, 68], [70, 69], [72, 70], [72, 71], [73, 72], [74, 73], [74, 52], [74, 65], [74, 60], [75, 74], [76, 75], [78, 77], [78, 76], [79, 78], [80, 25], [80, 11], [81, 112], [81, 5], [81, 80], [82, 81], [84, 83], [85, 82], [86, 85], [86, 84], [87, 86], [88, 86], [89, 88], [91, 90], [92, 91], [93, 92], [94, 87], [95, 94], [96, 91], [97, 96], [98, 97], [100, 98], [101, 95], [103, 102], [103, 79], [104, 103], [105, 101], [106, 105], [107, 104], [111, 25], [111, 11], [112, 111], [113, 111], [115, 113], [119, 79], [119, 118], [120, 119], [121, 120], [126, 125], [131, 130], [132, 131], [137, 131], [137, 35], [137, 41]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e43bffe93708bb70dadc7d020361366794111a280f2afdad4d536db6335d032e_e43bffe93708bb70dadc7d020361366794111a280f2afdad4d536db6335d032e.jsonl.gz", "strip_func_name": "sub_404541", "query": "\n\n\n__int64 __fastcall sub_404541(__int64 a1, __int64 a2)\n{\n__int64 v2; // rdx\n__int64 result; // rax\nfloat v4; // xmm0_4\nfloat v5; // xmm1_4\nchar v6[16]; // [rsp+10h] [rbp-40h] BYREF\n__int64 v7; // [rsp+20h] [rbp-30h]\nunsigned __int64 v8; // [rsp+28h] [rbp-28h]\nfloat v9; // [rsp+34h] [rbp-1Ch]\nunsigned int i; // [rsp+38h] [rbp-18h]\nint v11; // [rsp+3Ch] [rbp-14h]\nunsigned __int64 v12; // [rsp+40h] [rbp-10h]\nunsigned __int64 v13; // [rsp+48h] [rbp-8h]\n\nv13 = 0LL;\nfio_gettime(v6, 0LL);\nwhile ( 1 )\n{\nresult = (unsigned int)dword_411228;\nif ( !dword_411228 )\nbreak;\nv12 = 0LL;\nv11 = 0;\nfor ( i = 0; ; ++i )\n{\nresult = (unsigned int)dword_411358;\nif ( i >= dword_411358 )\nbreak;\nv12 += *(_QWORD *)(192LL * (int)i + a1 + 160);\nv2 = 192LL * (int)i;\nresult = *(unsigned int *)(v2 + a1 + 184);\nv11 = *(_DWORD *)(v2 + a1 + 184);\nif ( v11 )\nbreak;\n}\nif ( v11 )\nbreak;\nif ( (v12 & 0x8000000000000000LL) != 0LL )\nv4 = (float)(int)(v12 & 1 | (v12 >> 1)) + (float)(int)(v12 & 1 | (v12 >> 1));\nelse\nv4 = (float)(int)v12;\nif ( a2 < 0 )\nv5 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))\n+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));\nelse\nv5 = (float)(int)a2;\nv9 = 100.0 * (float)(v4 / v5);\nv8 = (unsigned int)n * (v12 - v13);\nv7 = mtime_since_now(v6);\nif ( v7 )\n{\nv8 = 1000 * v8 / (v7 << 10);\nprintf(\"%3.2f%% done (%luKiB/sec)\\r\", v9, v8);\nv13 = v12;\nfio_gettime(v6, 0LL);\n}\nelse\n{\nprintf(\"%3.2f%% done\\r\", v9);\n}\nfflush(stdout);\nusleep(0x3D090u);\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,v6,v7,v8,v9,v11,v12,v13,sub_404541,]", "hints": "[]", "response": "{'a1': 'threads', 'a2': 'total', 'v6': 'last_tv', 'v7': 'tdiff', 'v8': 'this_items', 'v9': 'perc', 'v11': 'some_done', 'v12': 'nitems', 'v13': 'last_nitems', 'sub_404541': 'show_progress'}"} | [
[
0.7402738332748413,
0.7220479249954224,
0.6916587352752686,
0.6773515939712524,
0.6728256344795227,
0.66819828748703,
0.6606165766716003,
0.6583258509635925,
0.6477265357971191,
0.6462040543556213,
0.6441060304641724,
0.643052339553833,
0.6429494023323059,
0.6424474120140076,
0.6414728164672852,
0.6404144167900085,
0.6399344205856323,
0.6361631155014038,
0.634128212928772,
0.6334909796714783
],
[
253214,
137344,
140359,
219166,
40560,
42096,
37889,
55503,
23618,
207008,
247417,
127749,
55735,
192130,
58346,
158914,
208264,
198061,
166557,
158882
]
] |
|
ap_do_options | e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c | microsoft | WSA-Linux-Kernel | NA | static int ap_do_options(int argc, char **argv)
{
int j;
acpi_status status;
/* Command line options */
while ((j =
acpi_getopt(argc, argv, AP_SUPPORTED_OPTIONS)) != ACPI_OPT_END)
switch (j) {
/*
* Global options
*/
case 'b': /* Dump all input tables to binary files */
gbl_binary_mode = TRUE;
continue;
case 'c': /* Dump customized tables */
if (!strcmp(acpi_gbl_optarg, "on")) {
gbl_dump_customized_tables = TRUE;
} else if (!strcmp(acpi_gbl_optarg, "off")) {
gbl_dump_customized_tables = FALSE;
} else {
fprintf(stderr,
"%s: Cannot handle this switch, please use on|off\n",
acpi_gbl_optarg);
return (-1);
}
continue;
case 'h':
case '?':
ap_display_usage();
return (1);
case 'o': /* Redirect output to a single file */
if (ap_open_output_file(acpi_gbl_optarg)) {
return (-1);
}
continue;
case 'r': /* Dump tables from specified RSDP */
status =
acpi_ut_strtoul64(acpi_gbl_optarg, &gbl_rsdp_base);
if (ACPI_FAILURE(status)) {
fprintf(stderr,
"%s: Could not convert to a physical address\n",
acpi_gbl_optarg);
return (-1);
}
continue;
case 's': /* Print table summaries only */
gbl_summary_mode = TRUE;
continue;
case 'x': /* Do not use XSDT */
if (!acpi_gbl_do_not_use_xsdt) {
acpi_gbl_do_not_use_xsdt = TRUE;
} else {
gbl_do_not_dump_xsdt = TRUE;
}
continue;
case 'v': /* -v: (Version): signon already emitted, just exit */
switch (acpi_gbl_optarg[0]) {
case '^': /* -v: (Version) */
fprintf(stderr,
ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
return (1);
case 'd':
fprintf(stderr,
ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
printf(ACPI_COMMON_BUILD_TIME);
return (1);
default:
printf("Unknown option: -v%s\n",
acpi_gbl_optarg);
return (-1);
}
break;
case 'z': /* Verbose mode */
gbl_verbose_mode = TRUE;
fprintf(stderr, ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
continue;
/*
* Table options
*/
case 'a': /* Get table by physical address */
if (ap_insert_action
(acpi_gbl_optarg, AP_DUMP_TABLE_BY_ADDRESS)) {
return (-1);
}
break;
case 'f': /* Get table from a file */
if (ap_insert_action
(acpi_gbl_optarg, AP_DUMP_TABLE_BY_FILE)) {
return (-1);
}
break;
case 'n': /* Get table by input name (signature) */
if (ap_insert_action
(acpi_gbl_optarg, AP_DUMP_TABLE_BY_NAME)) {
return (-1);
}
break;
default:
ap_display_usage();
return (-1);
}
/* If there are no actions, this means "get/dump all tables" */
if (current_action == 0) {
if (ap_insert_action(NULL, AP_DUMP_ALL_TABLES)) {
return (-1);
}
}
return (0);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_403056", "function_addr": 4206678, "binary_name": "e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_14], edi"], [4, "mov [rbp+var_20], rsi"], [5, "jmp loc_40331B"], [6, "mov eax, [rbp+var_4]"], [7, "sub eax, 3Fh "], [8, "cmp eax, 3Bh"], [9, "ja def_403083"], [10, "mov eax, eax"], [11, "mov rax, ds:jpt_403083[rax*8]"], [12, "jmp rax"], [13, "mov cs:byte_40F342, 1"], [14, "jmp loc_40331B"], [15, "mov rax, cs:s1"], [16, "mov esi, offset aOn"], [17, "mov rdi, rax"], [18, "call _strcmp"], [19, "test eax, eax"], [20, "jnz short loc_4030B5"], [21, "mov cs:byte_40F190, 1"], [22, "jmp loc_40331B"], [23, "mov rax, cs:s1"], [24, "mov esi, offset aOff"], [25, "mov rdi, rax"], [26, "call _strcmp"], [27, "test eax, eax"], [28, "jnz short loc_4030D9"], [29, "mov cs:byte_40F190, 0"], [30, "jmp loc_40331B"], [31, "mov rdx, cs:s1"], [32, "mov rax, cs:stderr"], [33, "mov esi, offset aSCannotHandleT"], [34, "mov rdi, rax"], [35, "mov eax, 0"], [36, "call fprintf"], [37, "mov eax, 0FFFFFFFFh"], [38, "jmp locret_403367"], [39, "call sub_402E42"], [40, "mov eax, 1"], [41, "jmp locret_403367"], [42, "mov rax, cs:s1"], [43, "mov rdi, rax"], [44, "call sub_402AAD"], [45, "test eax, eax"], [46, "jz loc_40331B"], [47, "mov eax, 0FFFFFFFFh"], [48, "jmp locret_403367"], [49, "mov rax, cs:s1"], [50, "mov esi, offset qword_40F358"], [51, "mov rdi, rax"], [52, "call sub_406B8F"], [53, "mov [rbp+var_8], eax"], [54, "cmp [rbp+var_8], 0"], [55, "jz loc_40331B"], [56, "mov rdx, cs:s1"], [57, "mov rax, cs:stderr"], [58, "mov esi, offset aSCouldNotConve_0"], [59, "mov rdi, rax"], [60, "mov eax, 0"], [61, "call fprintf"], [62, "mov eax, 0FFFFFFFFh"], [63, "jmp locret_403367"], [64, "mov cs:byte_40F340, 1"], [65, "jmp loc_40331B"], [66, "movzx eax, cs:byte_40F583"], [67, "test al, al"], [68, "jnz short loc_4031A1"], [69, "mov cs:byte_40F583, 1"], [70, "jmp loc_40331B"], [71, "mov cs:byte_40F343, 1"], [72, "jmp loc_40331B"], [73, "mov rax, cs:s1"], [74, "movzx eax, byte ptr [rax]"], [75, "movsx eax, al"], [76, "cmp eax, 5Eh "], [77, "jz short loc_4031C9"], [78, "cmp eax, 64h "], [79, "jz short loc_403202"], [80, "jmp loc_403254"], [81, "mov rax, cs:stderr"], [82, "mov r9d, offset aCopyrightC2000"], [83, "mov r8d, 20200925h"], [84, "mov ecx, offset aAcpiBinaryTabl"], [85, "mov edx, offset aIntelAcpiCompo"], [86, "mov esi, offset aSSVersion88xS"], [87, "mov rdi, rax"], [88, "mov eax, 0"], [89, "call fprintf"], [90, "mov eax, 1"], [91, "jmp locret_403367"], [92, "mov rax, cs:stderr"], [93, "mov r9d, offset aCopyrightC2000"], [94, "mov r8d, 20200925h"], [95, "mov ecx, offset aAcpiBinaryTabl"], [96, "mov edx, offset aIntelAcpiCompo"], [97, "mov esi, offset aSSVersion88xS"], [98, "mov rdi, rax"], [99, "mov eax, 0"], [100, "call fprintf"], [101, "mov edx, offset a094953"], [102, "mov esi, offset aJun32023"], [103, "mov edi, offset aBuildDateTimeS"], [104, "mov eax, 0"], [105, "call printf"], [106, "mov eax, 1"], [107, "jmp locret_403367"], [108, "mov rax, cs:s1"], [109, "mov rsi, rax"], [110, "mov edi, offset aUnknownOptionV"], [111, "mov eax, 0"], [112, "call printf"], [113, "mov eax, 0FFFFFFFFh"], [114, "jmp locret_403367"], [115, "mov cs:byte_40F341, 1"], [116, "mov rax, cs:stderr"], [117, "mov r9d, offset aCopyrightC2000"], [118, "mov r8d, 20200925h"], [119, "mov ecx, offset aAcpiBinaryTabl"], [120, "mov edx, offset aIntelAcpiCompo"], [121, "mov esi, offset aSSVersion88xS"], [122, "mov rdi, rax"], [123, "mov eax, 0"], [124, "call fprintf"], [125, "jmp short loc_40331B"], [126, "mov rax, cs:s1"], [127, "mov esi, 1"], [128, "mov rdi, rax"], [129, "call sub_402FCF"], [130, "test eax, eax"], [131, "jz short loc_40331B"], [132, "mov eax, 0FFFFFFFFh"], [133, "jmp locret_403367"], [134, "mov rax, cs:s1"], [135, "mov esi, 3"], [136, "mov rdi, rax"], [137, "call sub_402FCF"], [138, "test eax, eax"], [139, "jz short loc_40331B"], [140, "mov eax, 0FFFFFFFFh"], [141, "jmp short locret_403367"], [142, "mov rax, cs:s1"], [143, "mov esi, 2"], [144, "mov rdi, rax"], [145, "call sub_402FCF"], [146, "test eax, eax"], [147, "jz short loc_40331B"], [148, "mov eax, 0FFFFFFFFh"], [149, "jmp short locret_403367"], [150, "call sub_402E42"], [151, "mov eax, 0FFFFFFFFh"], [152, "jmp short locret_403367"], [153, "mov rcx, [rbp+var_20]"], [154, "mov eax, [rbp+var_14]"], [155, "mov edx, offset aABcFHnORSvXz"], [156, "mov rsi, rcx"], [157, "mov edi, eax"], [158, "call sub_408A1E"], [159, "mov [rbp+var_4], eax"], [160, "cmp [rbp+var_4], 0FFFFFFFFh"], [161, "jnz loc_40306A"], [162, "mov eax, cs:dword_40F560"], [163, "test eax, eax"], [164, "jnz short loc_403362"], [165, "mov esi, 0"], [166, "mov edi, 0"], [167, "call sub_402FCF"], [168, "test eax, eax"], [169, "jz short loc_403362"], [170, "mov eax, 0FFFFFFFFh"], [171, "jmp short locret_403367"], [172, "mov eax, 0"], [173, "leave"], [174, "retn"]], "data_dep": [[6, 159], [7, 6], [8, 7], [9, 8], [10, 7], [12, 11], [17, 15], [19, 18], [20, 19], [25, 23], [27, 26], [28, 27], [34, 32], [43, 42], [45, 44], [46, 45], [51, 49], [53, 52], [54, 53], [55, 54], [59, 57], [66, 69], [67, 66], [68, 67], [74, 73], [75, 74], [76, 75], [77, 76], [78, 75], [79, 78], [87, 81], [98, 92], [109, 108], [122, 116], [128, 126], [130, 129], [131, 130], [136, 134], [138, 137], [139, 138], [144, 142], [146, 145], [147, 146], [153, 4], [154, 3], [156, 153], [157, 154], [159, 158], [160, 159], [161, 160], [163, 162], [164, 163], [168, 167], [169, 168], [174, 90], [174, 148], [174, 151], [174, 47], [174, 172], [174, 62], [174, 132], [174, 170], [174, 37], [174, 40], [174, 113], [174, 140], [174, 106]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c_e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c.jsonl.gz", "strip_func_name": "sub_403056", "query": "\n\n\n__int64 __fastcall sub_403056(unsigned int a1, __int64 a2)\n{\nint v2; // ecx\nint v3; // er8\nint v4; // er9\n__int64 result; // rax\nint v6; // ecx\nint v7; // er8\nint v8; // er9\nint v9; // eax\nint v10; // ecx\nint v11; // er8\nint v12; // er9\n__int64 v13; // rdx\nint v14; // ecx\nint v15; // er8\nint v16; // er9\nint v17; // [rsp+1Ch] [rbp-4h]\n\nwhile ( 1 )\n{\nv17 = sub_408A1E(a1, a2, \"?a:bc:f:hn:o:r:sv^xz\");\nif ( v17 == -1 )\nbreak;\nswitch ( v17 )\n{\ncase '?':\ncase 'h':\nsub_402E42(a1, a2, v13, v14, v15, v16);\nreturn 1LL;\ncase 'a':\nif ( !(unsigned int)sub_402FCF((__int64)s1, 1, v13, v14, v15, v16) )\ncontinue;\nreturn 0xFFFFFFFFLL;\ncase 'b':\nbyte_40F342 = 1;\ncontinue;\ncase 'c':\nif ( !strcmp(s1, \"on\") )\n{\nbyte_40F190 = 1;\n}\nelse\n{\nif ( strcmp(s1, \"off\") )\n{\nfprintf(\n(_DWORD)stderr,\n(unsigned int)\"%s: Cannot handle this switch, please use on|off\\n\",\n(_DWORD)s1,\nv2,\nv3,\nv4);\nreturn 0xFFFFFFFFLL;\n}\nbyte_40F190 = 0;\n}\nbreak;\ncase 'f':\nif ( !(unsigned int)sub_402FCF((__int64)s1, 3, v13, v14, v15, v16) )\ncontinue;\nreturn 0xFFFFFFFFLL;\ncase 'n':\nif ( !(unsigned int)sub_402FCF((__int64)s1, 2, v13, v14, v15, v16) )\ncontinue;\nreturn 0xFFFFFFFFLL;\ncase 'o':\nif ( !(unsigned int)sub_402AAD(s1) )\ncontinue;\nreturn 0xFFFFFFFFLL;\ncase 'r':\nif ( !(unsigned int)sub_406B8F(s1, &qword_40F358) )\ncontinue;\nfprintf((_DWORD)stderr, (unsigned int)\"%s: Could not convert to a physical address\\n\", (_DWORD)s1, v6, v7, v8);\nreturn 0xFFFFFFFFLL;\ncase 's':\nbyte_40F340 = 1;\ncontinue;\ncase 'v':\nv9 = *s1;\nif ( v9 == 94 )\n{\nfprintf(\n(_DWORD)stderr,\n(unsigned int)\"\\n%s\\n%s version %8.8X\\n%s\\n\\n\",\n(unsigned int)\"Intel ACPI Component Architecture\",\n(unsigned int)\"ACPI Binary Table Dump Utility\",\n538970405,\n(unsigned int)\"Copyright (c) 2000 - 2020 Intel Corporation\");\nresult = 1LL;\n}\nelse if ( v9 == 100 )\n{\nfprintf(\n(_DWORD)stderr,\n(unsigned int)\"\\n%s\\n%s version %8.8X\\n%s\\n\\n\",\n(unsigned int)\"Intel ACPI Component Architecture\",\n(unsigned int)\"ACPI Binary Table Dump Utility\",\n538970405,\n(unsigned int)\"Copyright (c) 2000 - 2020 Intel Corporation\");\nprintf(\n(unsigned int)\"Build date/time: %s %s\\n\",\n(unsigned int)\"Jun 3 2023\",\n(unsigned int)\"09:49:53\",\nv10,\nv11,\nv12);\nresult = 1LL;\n}\nelse\n{\nprintf((unsigned int)\"Unknown option: -v%s\\n\", (_DWORD)s1, v13, v14, v15, v16);\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\ncase 'x':\nif ( byte_40F583 )\nbyte_40F343 = 1;\nelse\nbyte_40F583 = 1;\ncontinue;\ncase 'z':\nbyte_40F341 = 1;\nfprintf(\n(_DWORD)stderr,\n(unsigned int)\"\\n%s\\n%s version %8.8X\\n%s\\n\\n\",\n(unsigned int)\"Intel ACPI Component Architecture\",\n(unsigned int)\"ACPI Binary Table Dump Utility\",\n538970405,\n(unsigned int)\"Copyright (c) 2000 - 2020 Intel Corporation\");\ncontinue;\ndefault:\nsub_402E42(a1, a2, v13, v14, v15, v16);\nreturn 0xFFFFFFFFLL;\n}\n}\nif ( dword_40F560 || !(unsigned int)sub_402FCF(0LL, 0, v13, v14, v15, v16) )\nresult = 0LL;\nelse\nresult = 0xFFFFFFFFLL;\nreturn result;\n}\n\n\n\nQ:[a1,a2,sub_403056,sub_408A1E,sub_402E42,sub_402FCF,sub_402AAD,sub_406B8F,]", "hints": "[]", "response": "{'a1': 'argc', 'a2': 'argv', 'sub_403056': 'ap_do_options', 'sub_408A1E': 'acpi_getopt', 'sub_402E42': 'ap_display_usage', 'sub_402FCF': 'ap_insert_action', 'sub_402AAD': 'ap_open_output_file', 'sub_406B8F': 'acpi_ut_strtoul64'}"} | [
[
0.8970298767089844,
0.7788299322128296,
0.7785256505012512,
0.7587325572967529,
0.7573332190513611,
0.7534253597259521,
0.7528601884841919,
0.7491773962974548,
0.7346093058586121,
0.7327978610992432,
0.730294942855835,
0.7241811156272888,
0.7230197191238403,
0.7215843200683594,
0.7139759659767151,
0.713005542755127,
0.7098817825317383,
0.7090715169906616,
0.7084119319915771,
0.7070375084877014
],
[
124053,
560,
208021,
242633,
64330,
155399,
134691,
65984,
114677,
246734,
207944,
199551,
225058,
115846,
148819,
160747,
64456,
171707,
133518,
194377
]
] |
|
fsize | 843e4c6fffe44f62096dd218ec083ccfea9913dc4ecd337f53217f9ed7ac920a | xbarin02 | x-compressor | NA | size_t fsize(FILE *stream)
{
long begin = ftell(stream);
if (begin == (long)-1) {
fprintf(stderr, "Stream is not seekable\n");
abort();
}
if (fseek(stream, 0, SEEK_END)) {
abort();
}
long end = ftell(stream);
if (end == (long)-1) {
abort();
}
if (fseek(stream, begin, SEEK_SET)) {
abort();
}
return (size_t)end - (size_t)begin;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4012B8", "function_addr": 4199096, "binary_name": "843e4c6fffe44f62096dd218ec083ccfea9913dc4ecd337f53217f9ed7ac920a.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+stream], rdi"], [4, "mov rax, [rbp+stream]"], [5, "mov rdi, rax"], [6, "call _ftell"], [7, "mov [rbp+off], rax"], [8, "cmp [rbp+off], 0FFFFFFFFFFFFFFFFh"], [9, "jnz short loc_4012FE"], [10, "mov rax, cs:stderr"], [11, "mov rcx, rax"], [12, "mov edx, 17h"], [13, "mov esi, 1"], [14, "mov edi, offset aStreamIsNotSee"], [15, "call _fwrite"], [16, "call _abort"], [17, "mov rax, [rbp+stream]"], [18, "mov edx, 2"], [19, "mov esi, 0"], [20, "mov rdi, rax"], [21, "call _fseek"], [22, "test eax, eax"], [23, "jz short loc_40131D"], [24, "call _abort"], [25, "mov rax, [rbp+stream]"], [26, "mov rdi, rax"], [27, "call _ftell"], [28, "mov [rbp+var_10], rax"], [29, "cmp [rbp+var_10], 0FFFFFFFFFFFFFFFFh"], [30, "jnz short loc_401339"], [31, "call _abort"], [32, "mov rcx, [rbp+off]"], [33, "mov rax, [rbp+stream]"], [34, "mov edx, 0"], [35, "mov rsi, rcx"], [36, "mov rdi, rax"], [37, "call _fseek"], [38, "test eax, eax"], [39, "jz short loc_40135A"], [40, "call _abort"], [41, "mov rax, [rbp+var_10]"], [42, "mov rdx, [rbp+off]"], [43, "sub rax, rdx"], [44, "leave"], [45, "retn"]], "data_dep": [[4, 3], [5, 4], [7, 6], [8, 7], [9, 8], [11, 10], [17, 3], [20, 17], [22, 21], [23, 22], [25, 3], [26, 25], [28, 27], [29, 28], [30, 29], [32, 7], [33, 3], [35, 32], [36, 33], [38, 37], [39, 38], [41, 28], [42, 7], [43, 42], [43, 41], [45, 43]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/843e4c6fffe44f62096dd218ec083ccfea9913dc4ecd337f53217f9ed7ac920a_843e4c6fffe44f62096dd218ec083ccfea9913dc4ecd337f53217f9ed7ac920a.jsonl.gz", "strip_func_name": "sub_4012B8", "query": "\n\n\n__int64 __fastcall sub_4012B8(FILE *a1)\n{\n__int64 v2; // [rsp+10h] [rbp-10h]\n__int64 off; // [rsp+18h] [rbp-8h]\n\noff = ftell(a1);\nif ( off == -1 )\n{\nfwrite(\"Stream is not seekable\\n\", 1uLL, 0x17uLL, stderr);\nabort();\n}\nif ( fseek(a1, 0LL, 2) )\nabort();\nv2 = ftell(a1);\nif ( v2 == -1 )\nabort();\nif ( fseek(a1, off, 0) )\nabort();\nreturn v2 - off;\n}\n\n\n\nQ:[a1,v2,off,sub_4012B8,]", "hints": "[]", "response": "{'a1': 'stream', 'v2': 'end', 'off': 'begin', 'sub_4012B8': 'fsize'}"} | [
[
0.8179341554641724,
0.7967535257339478,
0.7659115791320801,
0.7419939041137695,
0.7419793009757996,
0.7317806482315063,
0.7134758234024048,
0.7051621079444885,
0.7015984654426575,
0.699995756149292,
0.699613094329834,
0.6966930627822876,
0.6958032846450806,
0.6940099000930786,
0.691902220249176,
0.6888930797576904,
0.6883535981178284,
0.6876418590545654,
0.6867586374282837,
0.6856697201728821
],
[
38479,
85044,
34362,
16869,
169793,
169039,
176345,
162736,
153134,
157989,
245884,
78135,
116473,
3923,
40014,
60133,
146804,
106588,
146247,
75207
]
] |
|
char_to_hex | d70ef2870385eb844de8ed173aebefc6521cc3c72af4a8dded50c935f040a2d8 | jmesmon | illum | NA | static bool char_to_hex(unsigned char *val, char c)
{
if (c >= '0' && c <= '9') {
*val = c - '0';
return true;
}
if (c >= 'a' && c <= 'f') {
*val = c - 'a' + 10;
return true;
}
if (c >= 'A' && c <= 'F') {
*val = c - 'A' + 10;
return true;
}
return false;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4015DE", "function_addr": 4199902, "binary_name": "d70ef2870385eb844de8ed173aebefc6521cc3c72af4a8dded50c935f040a2d8.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_8], rdi"], [3, "mov eax, esi"], [4, "mov [rbp+var_C], al"], [5, "cmp [rbp+var_C], 2Fh "], [6, "jle short loc_40160B"], [7, "cmp [rbp+var_C], 39h "], [8, "jg short loc_40160B"], [9, "movzx eax, [rbp+var_C]"], [10, "lea edx, [rax-30h]"], [11, "mov rax, [rbp+var_8]"], [12, "mov [rax], dl"], [13, "mov eax, 1"], [14, "jmp short loc_401650"], [15, "cmp [rbp+var_C], 60h "], [16, "jle short loc_40162B"], [17, "cmp [rbp+var_C], 66h "], [18, "jg short loc_40162B"], [19, "movzx eax, [rbp+var_C]"], [20, "lea edx, [rax-57h]"], [21, "mov rax, [rbp+var_8]"], [22, "mov [rax], dl"], [23, "mov eax, 1"], [24, "jmp short loc_401650"], [25, "cmp [rbp+var_C], 40h "], [26, "jle short loc_40164B"], [27, "cmp [rbp+var_C], 46h "], [28, "jg short loc_40164B"], [29, "movzx eax, [rbp+var_C]"], [30, "lea edx, [rax-37h]"], [31, "mov rax, [rbp+var_8]"], [32, "mov [rax], dl"], [33, "mov eax, 1"], [34, "jmp short loc_401650"], [35, "mov eax, 0"], [36, "pop rbp"], [37, "retn"]], "data_dep": [[4, 3], [5, 4], [6, 5], [7, 4], [8, 7], [9, 4], [10, 9], [11, 2], [12, 10], [12, 11], [15, 4], [16, 15], [17, 4], [18, 17], [19, 4], [20, 19], [21, 2], [22, 20], [22, 21], [25, 4], [26, 25], [27, 4], [28, 27], [29, 4], [30, 29], [31, 2], [32, 31], [32, 30], [36, 0], [37, 33], [37, 23], [37, 35], [37, 13]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/d70ef2870385eb844de8ed173aebefc6521cc3c72af4a8dded50c935f040a2d8_d70ef2870385eb844de8ed173aebefc6521cc3c72af4a8dded50c935f040a2d8.jsonl.gz", "strip_func_name": "sub_4015DE", "query": "\n\n\n__int64 __fastcall sub_4015DE(_BYTE *a1, char a2)\n{\n__int64 result; // rax\n\nif ( a2 <= 47 || a2 > 57 )\n{\nif ( a2 <= 96 || a2 > 102 )\n{\nif ( a2 <= 64 || a2 > 70 )\n{\nresult = 0LL;\n}\nelse\n{\n*a1 = a2 - 55;\nresult = 1LL;\n}\n}\nelse\n{\n*a1 = a2 - 87;\nresult = 1LL;\n}\n}\nelse\n{\n*a1 = a2 - 48;\nresult = 1LL;\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,sub_4015DE,]", "hints": "[]", "response": "{'a1': 'val', 'a2': 'c', 'sub_4015DE': 'char_to_hex'}"} | [
[
0.8607534766197205,
0.8278326392173767,
0.8262165784835815,
0.8257044553756714,
0.822443962097168,
0.8075529336929321,
0.797258734703064,
0.754103422164917,
0.7387361526489258,
0.7084007859230042,
0.7044145464897156,
0.6988245844841003,
0.6945375204086304,
0.6943288445472717,
0.6935811042785645,
0.6915271878242493,
0.6906436085700989,
0.6903916597366333,
0.6902137398719788,
0.6880683898925781
],
[
112849,
122384,
7544,
1470,
84446,
203337,
151774,
144110,
44047,
263939,
139943,
233015,
251145,
152089,
40619,
57683,
18387,
115616,
140353,
240501
]
] |
|
print_cluster_node | 90f820d92c2dd478226a03e997c10fd7a6311184865821cacf4685dc144080d3 | gyaikhom | agglomerative-hierarchical-clustering | NA | void print_cluster_node(cluster_t *cluster, int index)
{
cluster_node_t *node = &(cluster->nodes[index]);
fprintf(stdout, "Node %d - height: %d, centroid: (%5.3f, %5.3f)\n",
index, node->height, node->centroid.x, node->centroid.y);
if (node->label)
fprintf(stdout, "\tLeaf: %s\n\t", node->label);
else
fprintf(stdout, "\tMerged: %d, %d\n\t",
node->merged[0], node->merged[1]);
print_cluster_items(cluster, index);
fprintf(stdout, "\tNeighbours: ");
neighbour_t *t = node->neighbours;
while (t) {
fprintf(stdout, "\n\t\t%2d: %5.3f", t->target, t->distance);
t = t->next;
}
fprintf(stdout, "\n");
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401FC7", "function_addr": 4202439, "binary_name": "90f820d92c2dd478226a03e997c10fd7a6311184865821cacf4685dc144080d3.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_1C], esi"], [5, "mov rax, [rbp+var_18]"], [6, "mov rdx, [rax+10h]"], [7, "mov eax, [rbp+var_1C]"], [8, "cdqe"], [9, "shl rax, 6"], [10, "add rax, rdx"], [11, "mov [rbp+var_10], rax"], [12, "mov rax, [rbp+var_10]"], [13, "movss xmm0, dword ptr [rax+10h]"], [14, "cvtss2sd xmm0, xmm0"], [15, "mov rax, [rbp+var_10]"], [16, "movss xmm1, dword ptr [rax+0Ch]"], [17, "pxor xmm2, xmm2"], [18, "cvtss2sd xmm2, xmm1"], [19, "movq rsi, xmm2"], [20, "mov rax, [rbp+var_10]"], [21, "mov ecx, [rax+8]"], [22, "mov rax, cs:stdout"], [23, "mov edx, [rbp+var_1C]"], [24, "movapd xmm1, xmm0"], [25, "movq xmm0, rsi"], [26, "mov esi, offset aNodeDHeightDCe"], [27, "mov rdi, rax"], [28, "mov eax, 2"], [29, "call _fprintf"], [30, "mov rax, [rbp+var_10]"], [31, "mov rax, [rax+18h]"], [32, "test rax, rax"], [33, "jz short loc_40206D"], [34, "mov rax, [rbp+var_10]"], [35, "mov rdx, [rax+18h]"], [36, "mov rax, cs:stdout"], [37, "mov esi, offset aLeafS"], [38, "mov rdi, rax"], [39, "mov eax, 0"], [40, "call _fprintf"], [41, "jmp short loc_40209E"], [42, "mov rax, [rbp+var_10]"], [43, "mov rax, [rax+20h]"], [44, "add rax, 4"], [45, "mov ecx, [rax]"], [46, "mov rax, [rbp+var_10]"], [47, "mov rax, [rax+20h]"], [48, "mov edx, [rax]"], [49, "mov rax, cs:stdout"], [50, "mov esi, offset aMergedDD"], [51, "mov rdi, rax"], [52, "mov eax, 0"], [53, "call _fprintf"], [54, "mov edx, [rbp+var_1C]"], [55, "mov rax, [rbp+var_18]"], [56, "mov esi, edx"], [57, "mov rdi, rax"], [58, "call sub_401ECE"], [59, "mov rax, cs:stdout"], [60, "mov rcx, rax"], [61, "mov edx, 0Dh"], [62, "mov esi, 1"], [63, "mov edi, offset aNeighbours"], [64, "call _fwrite"], [65, "mov rax, [rbp+var_10]"], [66, "mov rax, [rax+38h]"], [67, "mov [rbp+var_8], rax"], [68, "jmp short loc_402121"], [69, "mov rax, [rbp+var_8]"], [70, "movss xmm0, dword ptr [rax+4]"], [71, "pxor xmm3, xmm3"], [72, "cvtss2sd xmm3, xmm0"], [73, "movq rcx, xmm3"], [74, "mov rax, [rbp+var_8]"], [75, "mov edx, [rax]"], [76, "mov rax, cs:stdout"], [77, "movq xmm0, rcx"], [78, "mov esi, offset a2d53f"], [79, "mov rdi, rax"], [80, "mov eax, 1"], [81, "call _fprintf"], [82, "mov rax, [rbp+var_8]"], [83, "mov rax, [rax+8]"], [84, "mov [rbp+var_8], rax"], [85, "cmp [rbp+var_8], 0"], [86, "jnz short loc_4020DB"], [87, "mov rax, cs:stdout"], [88, "mov rsi, rax"], [89, "mov edi, 0Ah"], [90, "call _fputc"], [91, "nop"], [92, "leave"], [93, "retn"]], "data_dep": [[5, 3], [6, 5], [7, 4], [9, 7], [10, 6], [10, 9], [11, 10], [12, 11], [13, 12], [14, 13], [15, 11], [16, 15], [18, 17], [18, 16], [19, 18], [20, 11], [21, 20], [23, 4], [24, 14], [25, 19], [27, 22], [30, 11], [31, 30], [32, 31], [33, 32], [34, 11], [35, 34], [38, 36], [42, 11], [43, 42], [44, 43], [45, 44], [46, 11], [47, 46], [48, 47], [51, 49], [54, 4], [55, 3], [56, 54], [57, 55], [60, 59], [65, 11], [66, 65], [67, 66], [69, 67], [69, 84], [70, 69], [72, 71], [72, 70], [73, 72], [74, 67], [74, 84], [75, 74], [77, 73], [79, 76], [82, 84], [82, 67], [83, 82], [84, 83], [85, 67], [85, 84], [86, 85], [88, 87], [93, 90]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/90f820d92c2dd478226a03e997c10fd7a6311184865821cacf4685dc144080d3_90f820d92c2dd478226a03e997c10fd7a6311184865821cacf4685dc144080d3.jsonl.gz", "strip_func_name": "sub_401FC7", "query": "\n\n\nint __fastcall sub_401FC7(__int64 a1, int a2)\n{\n__int64 v3; // [rsp+10h] [rbp-10h]\nunsigned int *i; // [rsp+18h] [rbp-8h]\n\nv3 = *(_QWORD *)(a1 + 16) + ((__int64)a2 << 6);\nfprintf(\nstdout,\n\"Node %d - height: %d, centroid: (%5.3f, %5.3f)\\n\",\n(unsigned int)a2,\n*(unsigned int *)(v3 + 8),\n*(float *)(v3 + 12),\n*(float *)(v3 + 16));\nif ( *(_QWORD *)(v3 + 24) )\nfprintf(stdout, \"\\tLeaf: %s\\n\\t\", *(const char **)(v3 + 24));\nelse\nfprintf(stdout, \"\\tMerged: %d, %d\\n\\t\", **(unsigned int **)(v3 + 32), *(unsigned int *)(*(_QWORD *)(v3 + 32) + 4LL));\nsub_401ECE(a1, a2);\nfwrite(\"\\tNeighbours: \", 1uLL, 0xDuLL, stdout);\nfor ( i = *(unsigned int **)(v3 + 56); i; i = (unsigned int *)*((_QWORD *)i + 1) )\nfprintf(stdout, \"\\n\\t\\t%2d: %5.3f\", *i, *((float *)i + 1));\nreturn fputc(10, stdout);\n}\n\n\n\nQ:[a1,a2,v3,i,sub_401FC7,sub_401ECE,]", "hints": "[]", "response": "{'a1': 'cluster', 'a2': 'index', 'v3': 'node', 'i': 't', 'sub_401FC7': 'print_cluster_node', 'sub_401ECE': 'print_cluster_items'}"} | [
[
0.7780600786209106,
0.759432315826416,
0.7565356492996216,
0.7535200119018555,
0.7518420815467834,
0.7488988637924194,
0.7407667636871338,
0.7285404801368713,
0.7259212732315063,
0.7167063355445862,
0.71484375,
0.7100367546081543,
0.7063758969306946,
0.7040112018585205,
0.6992305517196655,
0.6978753805160522,
0.6963406801223755,
0.6830790042877197,
0.6813508868217468,
0.6811351180076599
],
[
194993,
113234,
40023,
212182,
18095,
180536,
86183,
202639,
90200,
254485,
119209,
19931,
60268,
235110,
8579,
18271,
167739,
188767,
194543,
134292
]
] |
|
s2n_connection_set_secrets | 4ddab09c3171a036d85094692f061d974b675b9746960b9924a14426d37b827a | aws | s2n-tls | NA | S2N_RESULT s2n_connection_set_secrets(struct s2n_connection *conn)
{
RESULT_ENSURE_REF(conn);
conn->secure->cipher_suite = &s2n_tls13_aes_256_gcm_sha384;
const struct s2n_cipher *cipher = conn->secure->cipher_suite->record_alg->cipher;
uint8_t client_key_bytes[S2N_TLS13_SECRET_MAX_LEN] = "client key";
struct s2n_blob client_key = { 0 };
RESULT_GUARD_POSIX(s2n_blob_init(&client_key, client_key_bytes, cipher->key_material_size));
RESULT_GUARD_POSIX(cipher->init(&conn->secure->client_key));
RESULT_GUARD_POSIX(cipher->set_encryption_key(&conn->secure->client_key, &client_key));
uint8_t server_key_bytes[S2N_TLS13_SECRET_MAX_LEN] = "server key";
struct s2n_blob server_key = { 0 };
RESULT_GUARD_POSIX(s2n_blob_init(&server_key, server_key_bytes, cipher->key_material_size));
RESULT_GUARD_POSIX(cipher->init(&conn->secure->server_key));
RESULT_GUARD_POSIX(cipher->set_encryption_key(&conn->secure->server_key, &server_key));
conn->client = conn->secure;
conn->server = conn->secure;
return S2N_RESULT_OK;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40F7EE", "function_addr": 4257774, "binary_name": "4ddab09c3171a036d85094692f061d974b675b9746960b9924a14426d37b827a.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 0D0h"], [3, "mov [rbp+var_C8], rdi"], [4, "mov rax, fs:28h"], [5, "mov [rbp+var_8], rax"], [6, "xor eax, eax"], [7, "cmp [rbp+var_C8], 0"], [8, "jnz short loc_40F858"], [9, "mov rax, fs:0"], [10, "lea rax, [rax-18h]"], [11, "lea rdx, aErrorEncounter_50"], [12, "mov [rax], rdx"], [13, "mov rax, fs:0"], [14, "lea rax, [rax-20h]"], [15, "mov dword ptr [rax], 18000009h"], [16, "call sub_47F2D1"], [17, "mov eax, 0FFFFFFFFh"], [18, "jmp loc_40FAAB"], [19, "mov rax, [rbp+var_C8]"], [20, "mov rax, [rax+0E0h]"], [21, "mov rdx, offset unk_5C2380"], [22, "mov [rax], rdx"], [23, "mov rax, [rbp+var_C8]"], [24, "mov rax, [rax+0E0h]"], [25, "mov rax, [rax]"], [26, "mov rax, [rax+28h]"], [27, "mov rax, [rax]"], [28, "mov [rbp+var_B8], rax"], [29, "mov rax, 6B20746E65696C63h"], [30, "mov edx, 7965h"], [31, "mov [rbp+var_70], rax"], [32, "mov [rbp+var_68], rdx"], [33, "mov [rbp+var_60], 0"], [34, "mov [rbp+var_58], 0"], [35, "mov [rbp+var_50], 0"], [36, "mov [rbp+var_48], 0"], [37, "mov [rbp+var_B0], 0"], [38, "mov [rbp+var_A8], 0"], [39, "mov [rbp+var_A0], 0"], [40, "mov rax, [rbp+var_B8]"], [41, "movzx eax, byte ptr [rax+30h]"], [42, "movzx edx, al"], [43, "lea rcx, [rbp+var_70]"], [44, "lea rax, [rbp+var_B0]"], [45, "mov rsi, rcx"], [46, "mov rdi, rax"], [47, "call sub_411AD8"], [48, "test eax, eax"], [49, "jns short loc_40F919"], [50, "mov eax, 0FFFFFFFFh"], [51, "jmp loc_40FAAB"], [52, "mov rax, [rbp+var_B8]"], [53, "mov rax, [rax+40h]"], [54, "mov rdx, [rbp+var_C8]"], [55, "mov rdx, [rdx+0E0h]"], [56, "add rdx, 8"], [57, "mov rdi, rdx"], [58, "call rax"], [59, "test eax, eax"], [60, "jns short loc_40F949"], [61, "mov eax, 0FFFFFFFFh"], [62, "jmp loc_40FAAB"], [63, "mov rax, [rbp+var_B8]"], [64, "mov rdx, [rax+50h]"], [65, "mov rax, [rbp+var_C8]"], [66, "mov rax, [rax+0E0h]"], [67, "lea rcx, [rax+8]"], [68, "lea rax, [rbp+var_B0]"], [69, "mov rsi, rax"], [70, "mov rdi, rcx"], [71, "call rdx"], [72, "test eax, eax"], [73, "jns short loc_40F983"], [74, "mov eax, 0FFFFFFFFh"], [75, "jmp loc_40FAAB"], [76, "mov rax, 6B20726576726573h"], [77, "mov edx, 7965h"], [78, "mov [rbp+var_40], rax"], [79, "mov [rbp+var_38], rdx"], [80, "mov [rbp+var_30], 0"], [81, "mov [rbp+var_28], 0"], [82, "mov [rbp+var_20], 0"], [83, "mov [rbp+var_18], 0"], [84, "mov [rbp+var_90], 0"], [85, "mov [rbp+var_88], 0"], [86, "mov [rbp+var_80], 0"], [87, "mov rax, [rbp+var_B8]"], [88, "movzx eax, byte ptr [rax+30h]"], [89, "movzx edx, al"], [90, "lea rcx, [rbp+var_40]"], [91, "lea rax, [rbp+var_90]"], [92, "mov rsi, rcx"], [93, "mov rdi, rax"], [94, "call sub_411AD8"], [95, "test eax, eax"], [96, "jns short loc_40FA0A"], [97, "mov eax, 0FFFFFFFFh"], [98, "jmp loc_40FAAB"], [99, "mov rax, [rbp+var_B8]"], [100, "mov rax, [rax+40h]"], [101, "mov rdx, [rbp+var_C8]"], [102, "mov rdx, [rdx+0E0h]"], [103, "add rdx, 10h"], [104, "mov rdi, rdx"], [105, "call rax"], [106, "test eax, eax"], [107, "jns short loc_40FA37"], [108, "mov eax, 0FFFFFFFFh"], [109, "jmp short loc_40FAAB"], [110, "mov rax, [rbp+var_B8]"], [111, "mov rdx, [rax+50h]"], [112, "mov rax, [rbp+var_C8]"], [113, "mov rax, [rax+0E0h]"], [114, "lea rcx, [rax+10h]"], [115, "lea rax, [rbp+var_90]"], [116, "mov rsi, rax"], [117, "mov rdi, rcx"], [118, "call rdx"], [119, "test eax, eax"], [120, "jns short loc_40FA6E"], [121, "mov eax, 0FFFFFFFFh"], [122, "jmp short loc_40FAAB"], [123, "mov rax, [rbp+var_C8]"], [124, "mov rdx, [rax+0E0h]"], [125, "mov rax, [rbp+var_C8]"], [126, "mov [rax+240h], rdx"], [127, "mov rax, [rbp+var_C8]"], [128, "mov rdx, [rax+0E0h]"], [129, "mov rax, [rbp+var_C8]"], [130, "mov [rax+248h], rdx"], [131, "mov eax, 0"], [132, "mov rsi, [rbp+var_8]"], [133, "sub rsi, fs:28h"], [134, "jz short locret_40FABF"], [135, "call ___stack_chk_fail"], [136, "leave"], [137, "retn"]], "data_dep": [[5, 4], [7, 3], [8, 7], [10, 9], [12, 10], [12, 11], [14, 13], [14, 12], [15, 14], [19, 3], [20, 19], [22, 21], [22, 20], [23, 3], [24, 23], [24, 22], [25, 22], [25, 24], [26, 25], [26, 22], [27, 22], [27, 26], [28, 27], [31, 29], [32, 30], [40, 28], [41, 40], [41, 22], [42, 41], [43, 31], [44, 37], [44, 41], [45, 43], [46, 44], [48, 47], [49, 48], [52, 28], [53, 52], [53, 22], [54, 3], [55, 22], [55, 54], [56, 55], [57, 56], [58, 53], [59, 58], [60, 59], [63, 28], [64, 63], [64, 22], [65, 3], [66, 22], [66, 65], [67, 43], [67, 22], [67, 66], [68, 66], [68, 37], [69, 68], [70, 67], [71, 64], [72, 71], [73, 72], [78, 76], [79, 77], [87, 28], [88, 22], [88, 87], [89, 88], [90, 78], [90, 67], [91, 84], [91, 88], [92, 90], [93, 91], [95, 94], [96, 95], [99, 28], [100, 22], [100, 99], [101, 3], [102, 22], [102, 101], [103, 102], [104, 103], [105, 100], [106, 105], [107, 106], [110, 28], [111, 110], [111, 22], [112, 3], [113, 112], [113, 22], [114, 113], [114, 90], [114, 22], [115, 84], [115, 113], [116, 115], [117, 114], [118, 111], [119, 118], [120, 119], [123, 3], [124, 126], [124, 130], [124, 123], [124, 22], [125, 3], [126, 125], [126, 124], [127, 3], [128, 126], [128, 127], [129, 3], [130, 128], [130, 129], [132, 5], [133, 132], [134, 133], [137, 74], [137, 131], [137, 97], [137, 17], [137, 108], [137, 121], [137, 50], [137, 61]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/4ddab09c3171a036d85094692f061d974b675b9746960b9924a14426d37b827a_4ddab09c3171a036d85094692f061d974b675b9746960b9924a14426d37b827a.jsonl.gz", "strip_func_name": "sub_40F7EE", "query": "\n\n\n__int64 __fastcall sub_40F7EE(__int64 a1)\n{\n__int64 result; // rax\n__int64 v2; // [rsp+18h] [rbp-B8h]\n__int64 v3[4]; // [rsp+20h] [rbp-B0h] BYREF\n__int64 v4[4]; // [rsp+40h] [rbp-90h] BYREF\n__int64 v5[6]; // [rsp+60h] [rbp-70h] BYREF\n__int64 v6[8]; // [rsp+90h] [rbp-40h] BYREF\n\nv6[7] = __readfsqword(0x28u);\nif ( a1 )\n{\n**(_QWORD **)(a1 + 224) = &unk_5C2380;\nv2 = **(_QWORD **)(**(_QWORD **)(a1 + 224) + 40LL);\nv5[0] = 0x6B20746E65696C63LL;\nv5[1] = 31077LL;\nv5[2] = 0LL;\nv5[3] = 0LL;\nv5[4] = 0LL;\nv5[5] = 0LL;\nv3[0] = 0LL;\nv3[1] = 0LL;\nv3[2] = 0LL;\nif ( (int)sub_411AD8(v3, v5, *(unsigned __int8 *)(v2 + 48)) >= 0 )\n{\nif ( (*(int (__fastcall **)(__int64))(v2 + 64))(*(_QWORD *)(a1 + 224) + 8LL) >= 0 )\n{\nif ( (*(int (__fastcall **)(__int64, __int64 *))(v2 + 80))(*(_QWORD *)(a1 + 224) + 8LL, v3) >= 0 )\n{\nv6[0] = 0x6B20726576726573LL;\nv6[1] = 31077LL;\nv6[2] = 0LL;\nv6[3] = 0LL;\nv6[4] = 0LL;\nv6[5] = 0LL;\nv4[0] = 0LL;\nv4[1] = 0LL;\nv4[2] = 0LL;\nif ( (int)sub_411AD8(v4, v6, *(unsigned __int8 *)(v2 + 48)) >= 0 )\n{\nif ( (*(int (__fastcall **)(__int64))(v2 + 64))(*(_QWORD *)(a1 + 224) + 16LL) >= 0 )\n{\nif ( (*(int (__fastcall **)(__int64, __int64 *))(v2 + 80))(*(_QWORD *)(a1 + 224) + 16LL, v4) >= 0 )\n{\n*(_QWORD *)(a1 + 576) = *(_QWORD *)(a1 + 224);\n*(_QWORD *)(a1 + 584) = *(_QWORD *)(a1 + 224);\nresult = 0LL;\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\n*(_QWORD *)(__readfsqword(0) - 24) = \"Error encountered in s2n_connection_test_utils.c:291\";\n*(_DWORD *)(__readfsqword(0) - 32) = 402653193;\nsub_47F2D1();\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}\n\n\n\nQ:[a1,v2,v3,v4,v5,v6,sub_40F7EE,sub_411AD8,sub_47F2D1,]", "hints": "[]", "response": "{'a1': 'conn', 'v2': 'cipher', 'v3': 'client_key', 'v4': 'server_key', 'v5': 'client_key_bytes', 'v6': 'server_key_bytes', 'sub_40F7EE': 's2n_connection_set_secrets', 'sub_411AD8': 's2n_blob_init', 'sub_47F2D1': 's2n_calculate_stacktrace'}"} | [
[
0.7519791722297668,
0.7515606880187988,
0.7510884404182434,
0.7460296750068665,
0.7404033541679382,
0.7288410663604736,
0.7244508266448975,
0.7213215827941895,
0.7207345962524414,
0.7202279567718506,
0.7125533819198608,
0.7112300395965576,
0.7071237564086914,
0.7059237360954285,
0.7054594159126282,
0.7037066221237183,
0.6950401067733765,
0.6949307322502136,
0.6937202215194702,
0.6933716535568237
],
[
165617,
146285,
72475,
197877,
174673,
212313,
156957,
259994,
163331,
164599,
98763,
136630,
123619,
221598,
210584,
214383,
168540,
161610,
129975,
189671
]
] |
|
m_cos | 7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807 | arendst | Tasmota | NA | static int m_cos(bvm *vm)
{
if (be_top(vm) >= 1 && be_isnumber(vm, 1)) {
breal x = be_toreal(vm, 1);
be_pushreal(vm, mathfunc(cos)(x));
} else {
be_pushreal(vm, (breal)0.0);
}
be_return(vm);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_427812", "function_addr": 4356114, "binary_name": "7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov rax, [rbp+var_18]"], [5, "mov rdi, rax"], [6, "call be_top"], [7, "test eax, eax"], [8, "jle short loc_42787D"], [9, "mov rax, [rbp+var_18]"], [10, "mov esi, 1"], [11, "mov rdi, rax"], [12, "call be_isnumber"], [13, "test al, al"], [14, "jz short loc_42787D"], [15, "mov rax, [rbp+var_18]"], [16, "mov esi, 1"], [17, "mov rdi, rax"], [18, "call be_toreal"], [19, "movd eax, xmm0"], [20, "mov [rbp+x], eax"], [21, "mov eax, [rbp+x]"], [22, "movd xmm0, eax"], [23, "call _cosf"], [24, "movd eax, xmm0"], [25, "mov rdx, [rbp+var_18]"], [26, "movd xmm0, eax"], [27, "mov rdi, rdx"], [28, "call be_pushreal"], [29, "jmp short loc_42788D"], [30, "mov rax, [rbp+var_18]"], [31, "pxor xmm0, xmm0"], [32, "mov rdi, rax"], [33, "call be_pushreal"], [34, "mov rax, [rbp+var_18]"], [35, "mov rdi, rax"], [36, "call be_returnvalue"], [37, "leave"], [38, "retn"]], "data_dep": [[4, 3], [5, 4], [7, 6], [8, 7], [9, 3], [11, 9], [13, 12], [14, 13], [15, 3], [17, 15], [20, 19], [21, 20], [22, 21], [24, 22], [25, 3], [26, 24], [27, 25], [30, 3], [32, 30], [34, 3], [35, 34], [38, 36]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807_7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.jsonl.gz", "strip_func_name": "sub_427812", "query": "\n\n\n__int64 __fastcall sub_427812(__int64 a1, __m128i a2)\n{\n__m128i v2; // xmm0\n\nif ( (int)be_top(a1) > 0 && be_isnumber(a1, 1u) )\n{\na2.m128i_u64[0] = (unsigned __int64)be_toreal(a1, 1u);\nv2 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(a2));\n*(float *)v2.m128i_i32 = cosf(*(float *)v2.m128i_i32);\nbe_pushreal(a1, COERCE_FLOAT(_mm_cvtsi128_si32(v2)));\n}\nelse\n{\nbe_pushreal(a1, 0.0);\n}\nreturn be_returnvalue(a1);\n}\n\n\n\nQ:[a1,sub_427812,]", "hints": "[]", "response": "{'a1': 'vm', 'sub_427812': 'm_cos'}"} | [
[
0.7566490173339844,
0.749588131904602,
0.7474391460418701,
0.7415902018547058,
0.741512656211853,
0.7406554222106934,
0.7403476238250732,
0.7387776374816895,
0.738579511642456,
0.7384148836135864,
0.7375027537345886,
0.7359318137168884,
0.7356633543968201,
0.7343701124191284,
0.7339727878570557,
0.7334519028663635,
0.7302041053771973,
0.7302026152610779,
0.7292928695678711,
0.7258254289627075
],
[
243776,
259240,
29063,
233921,
188973,
127430,
47277,
258100,
247074,
119522,
215476,
137038,
104708,
21993,
123404,
7804,
77905,
241351,
14015,
256290
]
] |
|
WriteElfSection | 133b2926cf4d1de977be49e6696857a909fd3b1d0ed4ebce7c0c80872d041d94 | eriksl | esp8266-universal-io-bridge | NA | bool WriteElfSection(MyElf_File *elf, FILE *outfile, char* name, bool headed,
bool zeroaddr, int padto, unsigned char *chksum) {
int i, pad = 0;
bool ret = false;
unsigned char *bindata = 0;
Section_Header sechead;
MyElf_Section *sect;
// get elf section header
sect = GetElfSection(elf, name);
if(!sect) {
error("Error: Section '%s' not found in elf file.\r\n", name);
goto end_function;
}
// create image section header
sechead.addr = (zeroaddr ? 0 : sect->address);
sechead.size = sect->size;
// do we need to pad the section?
if (padto) {
pad = sechead.size % padto;
if (pad > 0) {
pad = padto - pad;
sechead.size += pad;
}
}
debug("Adding section '%s', addr: 0x%08x, size: %d (+%d bytes(s) padding).\r\n",
name, sect->address, sect->size, pad);
// get elf section binary data
bindata = GetElfSectionData(elf, sect);
if (!bindata) {
goto end_function;
}
// write section (and pad if required)
if((headed && fwrite(&sechead, 1, sizeof(sechead), outfile) != sizeof(sechead))
|| fwrite(bindata, 1, sect->size, outfile) != sect->size
|| (pad > 0 && fwrite(PADDING, 1, pad, outfile) != pad)) {
error("Error: Failed to write section '%s' to image file.\r\n", name);
goto end_function;
}
// include section data in the checksum
if(chksum) {
for(i = 0; i < (int)sect->size; i++) {
*chksum ^= bindata[i];
}
}
ret = true;
end_function:
if (bindata) free(bindata);
return ret;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401428", "function_addr": 4199464, "binary_name": "133b2926cf4d1de977be49e6696857a909fd3b1d0ed4ebce7c0c80872d041d94.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 60h"], [3, "mov [rbp+var_38], rdi"], [4, "mov [rbp+s], rsi"], [5, "mov [rbp+var_48], rdx"], [6, "mov eax, ecx"], [7, "mov edx, r8d"], [8, "mov [rbp+var_54], r9d"], [9, "mov [rbp+var_4C], al"], [10, "mov eax, edx"], [11, "mov [rbp+var_50], al"], [12, "mov [rbp+var_8], 0"], [13, "mov [rbp+var_9], 0"], [14, "mov [rbp+var_18], 0"], [15, "mov rdx, [rbp+var_48]"], [16, "mov rax, [rbp+var_38]"], [17, "mov rsi, rdx"], [18, "mov rdi, rax"], [19, "call sub_40288E"], [20, "mov [rbp+var_20], rax"], [21, "cmp [rbp+var_20], 0"], [22, "jnz short loc_401499"], [23, "mov rax, [rbp+var_48]"], [24, "mov rsi, rax"], [25, "mov edi, offset aErrorSectionSN"], [26, "mov eax, 0"], [27, "call error"], [28, "jmp loc_401620"], [29, "cmp [rbp+var_50], 0"], [30, "jz short loc_4014A6"], [31, "mov eax, 0"], [32, "jmp short loc_4014AD"], [33, "mov rax, [rbp+var_20]"], [34, "mov eax, [rax+4]"], [35, "mov [rbp+ptr], eax"], [36, "mov rax, [rbp+var_20]"], [37, "mov eax, [rax+8]"], [38, "mov [rbp+var_24], eax"], [39, "cmp [rbp+var_54], 0"], [40, "jz short loc_4014EC"], [41, "mov eax, [rbp+var_24]"], [42, "mov ecx, [rbp+var_54]"], [43, "mov edx, 0"], [44, "div ecx"], [45, "mov eax, edx"], [46, "mov [rbp+var_8], eax"], [47, "cmp [rbp+var_8], 0"], [48, "jle short loc_4014EC"], [49, "mov eax, [rbp+var_54]"], [50, "sub eax, [rbp+var_8]"], [51, "mov [rbp+var_8], eax"], [52, "mov edx, [rbp+var_24]"], [53, "mov eax, [rbp+var_8]"], [54, "add eax, edx"], [55, "mov [rbp+var_24], eax"], [56, "mov rax, [rbp+var_20]"], [57, "mov ecx, [rax+8]"], [58, "mov rax, [rbp+var_20]"], [59, "mov edx, [rax+4]"], [60, "mov esi, [rbp+var_8]"], [61, "mov rax, [rbp+var_48]"], [62, "mov r8d, esi"], [63, "mov rsi, rax"], [64, "mov edi, offset aAddingSectionS"], [65, "mov eax, 0"], [66, "call sub_4012D2"], [67, "mov rdx, [rbp+var_20]"], [68, "mov rax, [rbp+var_38]"], [69, "mov rsi, rdx"], [70, "mov rdi, rax"], [71, "call sub_40294A"], [72, "mov [rbp+var_18], rax"], [73, "cmp [rbp+var_18], 0"], [74, "jz loc_40161F"], [75, "cmp [rbp+var_4C], 0"], [76, "jz short loc_401561"], [77, "mov rdx, [rbp+s]"], [78, "lea rax, [rbp+ptr]"], [79, "mov rcx, rdx"], [80, "mov edx, 8"], [81, "mov esi, 1"], [82, "mov rdi, rax"], [83, "call _fwrite"], [84, "cmp rax, 8"], [85, "jnz short loc_4015C2"], [86, "mov rax, [rbp+var_20]"], [87, "mov eax, [rax+8]"], [88, "mov esi, eax"], [89, "mov rdx, [rbp+s]"], [90, "mov rax, [rbp+var_18]"], [91, "mov rcx, rdx"], [92, "mov rdx, rsi"], [93, "mov esi, 1"], [94, "mov rdi, rax"], [95, "call _fwrite"], [96, "mov rdx, [rbp+var_20]"], [97, "mov edx, [rdx+8]"], [98, "mov edx, edx"], [99, "cmp rax, rdx"], [100, "jnz short loc_4015C2"], [101, "cmp [rbp+var_8], 0"], [102, "jle short loc_4015DA"], [103, "mov eax, [rbp+var_8]"], [104, "cdqe"], [105, "mov rdx, [rbp+s]"], [106, "mov rcx, rdx"], [107, "mov rdx, rax"], [108, "mov esi, 1"], [109, "mov edi, offset unk_403010"], [110, "call _fwrite"], [111, "mov edx, [rbp+var_8]"], [112, "movsxd rdx, edx"], [113, "cmp rax, rdx"], [114, "jz short loc_4015DA"], [115, "mov rax, [rbp+var_48]"], [116, "mov rsi, rax"], [117, "mov edi, offset aErrorFailedToW"], [118, "mov eax, 0"], [119, "call error"], [120, "jmp short loc_401620"], [121, "cmp [rbp+arg_0], 0"], [122, "jz short loc_401619"], [123, "mov [rbp+var_4], 0"], [124, "jmp short loc_40160D"], [125, "mov rax, [rbp+arg_0]"], [126, "movzx edx, byte ptr [rax]"], [127, "mov eax, [rbp+var_4]"], [128, "movsxd rcx, eax"], [129, "mov rax, [rbp+var_18]"], [130, "add rax, rcx"], [131, "movzx eax, byte ptr [rax]"], [132, "xor edx, eax"], [133, "mov rax, [rbp+arg_0]"], [134, "mov [rax], dl"], [135, "add [rbp+var_4], 1"], [136, "mov rax, [rbp+var_20]"], [137, "mov eax, [rax+8]"], [138, "cmp [rbp+var_4], eax"], [139, "jl short loc_4015EA"], [140, "mov [rbp+var_9], 1"], [141, "jmp short loc_401620"], [142, "nop"], [143, "cmp [rbp+var_18], 0"], [144, "jz short loc_401633"], [145, "mov rax, [rbp+var_18]"], [146, "mov rdi, rax"], [147, "call _free"], [148, "movzx eax, [rbp+var_9]"], [149, "leave"], [150, "retn"]], "data_dep": [[9, 6], [10, 7], [11, 10], [15, 5], [16, 3], [17, 15], [18, 16], [20, 19], [21, 20], [22, 21], [23, 5], [24, 23], [29, 11], [30, 29], [33, 20], [34, 33], [35, 34], [35, 31], [36, 20], [37, 36], [38, 37], [39, 8], [40, 39], [41, 38], [42, 8], [44, 42], [45, 43], [46, 45], [47, 46], [48, 47], [49, 8], [50, 49], [50, 46], [51, 50], [52, 38], [53, 51], [54, 53], [54, 52], [55, 54], [56, 20], [57, 56], [58, 20], [59, 58], [60, 46], [60, 12], [60, 51], [61, 5], [62, 60], [63, 61], [67, 20], [68, 3], [69, 67], [70, 68], [72, 71], [73, 72], [74, 73], [75, 9], [76, 75], [77, 4], [78, 35], [78, 71], [79, 77], [82, 78], [84, 83], [85, 84], [86, 20], [87, 86], [88, 87], [89, 4], [90, 72], [91, 89], [92, 88], [94, 90], [96, 20], [97, 96], [98, 97], [99, 95], [99, 98], [100, 99], [101, 51], [101, 46], [101, 12], [102, 101], [103, 51], [103, 46], [103, 12], [105, 4], [106, 105], [107, 103], [111, 46], [111, 12], [111, 51], [112, 111], [113, 110], [113, 112], [114, 113], [115, 5], [116, 115], [122, 121], [126, 125], [126, 134], [127, 135], [127, 123], [128, 127], [129, 72], [130, 128], [130, 129], [131, 134], [131, 130], [132, 126], [132, 131], [134, 133], [134, 132], [135, 135], [135, 123], [136, 20], [137, 136], [137, 134], [138, 135], [138, 137], [138, 123], [139, 138], [143, 14], [143, 72], [144, 143], [145, 14], [145, 72], [146, 145], [148, 13], [148, 140], [150, 148]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/133b2926cf4d1de977be49e6696857a909fd3b1d0ed4ebce7c0c80872d041d94_133b2926cf4d1de977be49e6696857a909fd3b1d0ed4ebce7c0c80872d041d94.jsonl.gz", "strip_func_name": "sub_401428", "query": "\n\n\n__int64 __fastcall sub_401428(__int64 a1, FILE *a2, __int64 a3, char a4, char a5, unsigned int a6, _BYTE *a7)\n{\n__int64 v7; // rdx\n__int64 v8; // rcx\n__int64 v9; // r8\n__int64 v10; // r9\nint v11; // eax\n__int64 v12; // rdx\n__int64 v13; // rcx\n__int64 v14; // r8\n__int64 v15; // r9\nsize_t v16; // rax\nsize_t v17; // rax\nint ptr; // [rsp+38h] [rbp-28h] BYREF\nunsigned int v24; // [rsp+3Ch] [rbp-24h]\n__int64 v25; // [rsp+40h] [rbp-20h]\nvoid *v26; // [rsp+48h] [rbp-18h]\nunsigned __int8 v27; // [rsp+57h] [rbp-9h]\nunsigned int v28; // [rsp+58h] [rbp-8h]\nint i; // [rsp+5Ch] [rbp-4h]\n\nv28 = 0;\nv27 = 0;\nv26 = 0LL;\nv25 = sub_40288E(a1, a3);\nif ( v25 )\n{\nif ( a5 )\nv11 = 0;\nelse\nv11 = *(_DWORD *)(v25 + 4);\nptr = v11;\nv24 = *(_DWORD *)(v25 + 8);\nif ( a6 )\n{\nv28 = v24 % a6;\nif ( (int)(v24 % a6) > 0 )\n{\nv28 = a6 - v28;\nv24 += v28;\n}\n}\nsub_4012D2(\n\"Adding section '%s', addr: 0x%08x, size: %d (+%d bytes(s) padding).\\r\\n\",\na3,\n*(unsigned int *)(v25 + 4),\n*(unsigned int *)(v25 + 8),\nv28,\nv10);\nv26 = (void *)sub_40294A(a1, v25);\nif ( v26 )\n{\nif ( (!a4 || fwrite(&ptr, 1uLL, 8uLL, a2) == 8)\n&& (v16 = fwrite(v26, 1uLL, *(unsigned int *)(v25 + 8), a2), v12 = *(unsigned int *)(v25 + 8), v16 == v12)\n&& ((int)v28 <= 0 || (v17 = fwrite(&unk_403010, 1uLL, (int)v28, a2), v12 = (int)v28, v17 == v28)) )\n{\nif ( a7 )\n{\nfor ( i = 0; i < *(_DWORD *)(v25 + 8); ++i )\n*a7 ^= *((_BYTE *)v26 + i);\n}\nv27 = 1;\n}\nelse\n{\nerror(\"Error: Failed to write section '%s' to image file.\\r\\n\", a3, v12, v13, v14, v15);\n}\n}\n}\nelse\n{\nerror(\"Error: Section '%s' not found in elf file.\\r\\n\", a3, v7, v8, v9, v10);\n}\nif ( v26 )\nfree(v26);\nreturn v27;\n}\n\n\n\nQ:[a3,a4,a1,a2,a5,a6,a7,v12,v8,v14,v15,ptr,v25,v26,v28,sub_401428,sub_40288E,sub_4012D2,sub_40294A,]", "hints": "[]", "response": "{'a3': 'name', 'a4': 'headed', 'a1': 'elf', 'a2': 'outfile', 'a5': 'zeroaddr', 'a6': 'padto', 'a7': 'chksum', 'v12': 'name', 'v8': 'headed', 'v14': 'zeroaddr', 'v15': 'padto', 'ptr': 'sechead', 'v25': 'sect', 'v26': 'bindata', 'v28': 'pad', 'sub_401428': 'WriteElfSection', 'sub_40288E': 'GetElfSection', 'sub_4012D2': 'debug', 'sub_40294A': 'GetElfSectionData'}"} | [
[
0.7872744798660278,
0.7805992960929871,
0.7706454992294312,
0.7704529762268066,
0.7645742893218994,
0.7406802177429199,
0.7393858432769775,
0.7358863353729248,
0.7358717918395996,
0.7355853915214539,
0.7320764064788818,
0.7304468750953674,
0.7298177480697632,
0.7293641567230225,
0.7282074093818665,
0.7274876832962036,
0.7250698804855347,
0.7242646217346191,
0.7232304215431213,
0.7231326699256897
],
[
229798,
229893,
178973,
134892,
110286,
43059,
252235,
223429,
146298,
86865,
3542,
155593,
227124,
227314,
40451,
67128,
39697,
145202,
135933,
222285
]
] |
|
setenv_cgi | afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4 | michael-lazar | hn-gopher | NA | void setenv_cgi(state *st, char *script)
{
char buf[BUFSIZE];
/* Security */
setenv("PATH", SAFE_PATH, 1);
/* Set up the environment as per CGI spec */
setenv("GATEWAY_INTERFACE", "CGI/1.1", 1);
setenv("CONTENT_LENGTH", "0", 1);
setenv("QUERY_STRING", st->req_query_string, 1);
snprintf(buf, sizeof(buf), SERVER_SOFTWARE_FULL, st->server_platform);
setenv("SERVER_SOFTWARE", buf, 1);
setenv("SERVER_ARCH", st->server_platform, 1);
setenv("SERVER_DESCRIPTION", st->server_description, 1);
snprintf(buf, sizeof(buf), SERVER_SOFTWARE "/" VERSION);
setenv("SERVER_VERSION", buf, 1);
if (st->req_protocol == PROTO_HTTP)
setenv("SERVER_PROTOCOL", "HTTP/0.9", 1);
else
setenv("SERVER_PROTOCOL", "RFC1436", 1);
if (st->server_port == st->server_tls_port) {
setenv("HTTPS", "on", 1);
setenv("TLS", "on", 1);
}
setenv("SERVER_NAME", st->server_host, 1);
snprintf(buf, sizeof(buf), "%i", st->server_port);
setenv("SERVER_PORT", buf, 1);
snprintf(buf, sizeof(buf), "%i", st->server_tls_port);
setenv("SERVER_TLS_PORT", buf, 1);
setenv("REQUEST_METHOD", "GET", 1);
setenv("DOCUMENT_ROOT", st->server_root, 1);
setenv("SCRIPT_NAME", st->req_selector, 1);
setenv("SCRIPT_FILENAME", script, 1);
setenv("LOCAL_ADDR", st->req_local_addr, 1);
setenv("REMOTE_ADDR", st->req_remote_addr, 1);
setenv("HTTP_REFERER", st->req_referrer, 1);
#ifdef HAVE_SHMEM
snprintf(buf, sizeof(buf), "%x", st->session_id);
setenv("SESSION_ID", buf, 1);
#endif
setenv("HTTP_ACCEPT_CHARSET", strcharset(st->out_charset), 1);
/* Gophernicus extras */
snprintf(buf, sizeof(buf), "%c", st->req_filetype);
setenv("GOPHER_FILETYPE", buf, 1);
setenv("GOPHER_CHARSET", strcharset(st->out_charset), 1);
setenv("GOPHER_REFERER", st->req_referrer, 1);
snprintf(buf, sizeof(buf), "%i", st->out_width);
setenv("COLUMNS", buf, 1);
snprintf(buf, sizeof(buf), CODENAME);
setenv("SERVER_CODENAME", buf, 1);
/* Bucktooth extras */
if (*st->req_query_string) {
snprintf(buf, sizeof(buf), "%s?%s",
st->req_selector, st->req_query_string);
setenv("SELECTOR", buf, 1);
}
else setenv("SELECTOR", st->req_selector, 1);
setenv("SERVER_HOST", st->server_host, 1);
setenv("REQUEST", st->req_selector, 1);
setenv("SEARCHREQUEST", st->req_query_string, 1);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_404CAB", "function_addr": 4213931, "binary_name": "afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 410h"], [3, "mov [rbp+value], rdi"], [4, "mov [rbp+var_410], rsi"], [5, "mov edx, 1"], [6, "mov esi, offset value"], [7, "mov edi, offset aPath"], [8, "call _setenv"], [9, "mov edx, 1"], [10, "mov esi, offset aCgi11"], [11, "mov edi, offset aGatewayInterfa"], [12, "call _setenv"], [13, "mov edx, 1"], [14, "mov esi, offset a0"], [15, "mov edi, offset aContentLength"], [16, "call _setenv"], [17, "mov rax, [rbp+value]"], [18, "add rax, 800h"], [19, "mov edx, 1"], [20, "mov rsi, rax"], [21, "mov edi, offset aQueryString"], [22, "call _setenv"], [23, "mov rax, [rbp+value]"], [24, "lea rdx, [rax+1118h]"], [25, "lea rax, [rbp+s]"], [26, "mov rcx, rdx"], [27, "mov edx, offset aGophernicus24S"], [28, "mov esi, 400h"], [29, "mov rdi, rax"], [30, "mov eax, 0"], [31, "call _snprintf"], [32, "lea rax, [rbp+s]"], [33, "mov edx, 1"], [34, "mov rsi, rax"], [35, "mov edi, offset aServerSoftware"], [36, "call _setenv"], [37, "mov rax, [rbp+value]"], [38, "add rax, 1118h"], [39, "mov edx, 1"], [40, "mov rsi, rax"], [41, "mov edi, offset aServerArch"], [42, "call _setenv"], [43, "mov rax, [rbp+value]"], [44, "add rax, 1098h"], [45, "mov edx, 1"], [46, "mov rsi, rax"], [47, "mov edi, offset aServerDescript"], [48, "call _setenv"], [49, "lea rax, [rbp+s]"], [50, "mov edx, offset aGophernicus24"], [51, "mov esi, 400h"], [52, "mov rdi, rax"], [53, "mov eax, 0"], [54, "call _snprintf"], [55, "lea rax, [rbp+s]"], [56, "mov edx, 1"], [57, "mov rsi, rax"], [58, "mov edi, offset aServerVersion"], [59, "call _setenv"], [60, "mov rax, [rbp+value]"], [61, "movzx eax, byte ptr [rax+1081h]"], [62, "cmp al, 68h "], [63, "jnz short loc_404E04"], [64, "mov edx, 1"], [65, "mov esi, offset aHttp09"], [66, "mov edi, offset aServerProtocol"], [67, "call _setenv"], [68, "jmp short loc_404E18"], [69, "mov edx, 1"], [70, "mov esi, offset aRfc1436"], [71, "mov edi, offset aServerProtocol"], [72, "call _setenv"], [73, "mov rax, [rbp+value]"], [74, "mov edx, [rax+1318h]"], [75, "mov rax, [rbp+value]"], [76, "mov eax, [rax+131Ch]"], [77, "cmp edx, eax"], [78, "jnz short loc_404E5E"], [79, "mov edx, 1"], [80, "mov esi, offset aOn"], [81, "mov edi, offset aHttps_0"], [82, "call _setenv"], [83, "mov edx, 1"], [84, "mov esi, offset aOn"], [85, "mov edi, offset aTls"], [86, "call _setenv"], [87, "mov rax, [rbp+value]"], [88, "add rax, 12D8h"], [89, "mov edx, 1"], [90, "mov rsi, rax"], [91, "mov edi, offset aServerName"], [92, "call _setenv"], [93, "mov rax, [rbp+value]"], [94, "mov edx, [rax+1318h]"], [95, "lea rax, [rbp+s]"], [96, "mov ecx, edx"], [97, "mov edx, offset aI"], [98, "mov esi, 400h"], [99, "mov rdi, rax"], [100, "mov eax, 0"], [101, "call _snprintf"], [102, "lea rax, [rbp+s]"], [103, "mov edx, 1"], [104, "mov rsi, rax"], [105, "mov edi, offset aServerPort"], [106, "call _setenv"], [107, "mov rax, [rbp+value]"], [108, "mov edx, [rax+131Ch]"], [109, "lea rax, [rbp+s]"], [110, "mov ecx, edx"], [111, "mov edx, offset aI"], [112, "mov esi, 400h"], [113, "mov rdi, rax"], [114, "mov eax, 0"], [115, "call _snprintf"], [116, "lea rax, [rbp+s]"], [117, "mov edx, 1"], [118, "mov rsi, rax"], [119, "mov edi, offset aServerTlsPort"], [120, "call _setenv"], [121, "mov edx, 1"], [122, "mov esi, offset aGet_0"], [123, "mov edi, offset aRequestMethod"], [124, "call _setenv"], [125, "mov rax, [rbp+value]"], [126, "add rax, 1198h"], [127, "mov edx, 1"], [128, "mov rsi, rax"], [129, "mov edi, offset aDocumentRoot"], [130, "call _setenv"], [131, "mov rax, [rbp+value]"], [132, "mov edx, 1"], [133, "mov rsi, rax"], [134, "mov edi, offset aScriptName"], [135, "call _setenv"], [136, "mov rax, [rbp+var_410]"], [137, "mov edx, 1"], [138, "mov rsi, rax"], [139, "mov edi, offset aScriptFilename"], [140, "call _setenv"], [141, "mov rax, [rbp+value]"], [142, "add rax, 1000h"], [143, "mov edx, 1"], [144, "mov rsi, rax"], [145, "mov edi, offset aLocalAddr"], [146, "call _setenv"], [147, "mov rax, [rbp+value]"], [148, "add rax, 1040h"], [149, "mov edx, 1"], [150, "mov rsi, rax"], [151, "mov edi, offset aRemoteAddr_0"], [152, "call _setenv"], [153, "mov rax, [rbp+value]"], [154, "add rax, 0C00h"], [155, "mov edx, 1"], [156, "mov rsi, rax"], [157, "mov edi, offset aHttpReferer"], [158, "call _setenv"], [159, "mov rax, [rbp+value]"], [160, "mov edx, [rax+13D7Ch]"], [161, "lea rax, [rbp+s]"], [162, "mov ecx, edx"], [163, "mov edx, offset asc_40AFD5"], [164, "mov esi, 400h"], [165, "mov rdi, rax"], [166, "mov eax, 0"], [167, "call _snprintf"], [168, "lea rax, [rbp+s]"], [169, "mov edx, 1"], [170, "mov rsi, rax"], [171, "mov edi, offset aSessionId"], [172, "call _setenv"], [173, "mov rax, [rbp+value]"], [174, "mov eax, [rax+1094h]"], [175, "mov edi, eax"], [176, "call sub_4074D1"], [177, "mov edx, 1"], [178, "mov rsi, rax"], [179, "mov edi, offset aHttpAcceptChar"], [180, "call _setenv"], [181, "mov rax, [rbp+value]"], [182, "movzx eax, byte ptr [rax+1080h]"], [183, "movsx edx, al"], [184, "lea rax, [rbp+s]"], [185, "mov ecx, edx"], [186, "mov edx, offset aC"], [187, "mov esi, 400h"], [188, "mov rdi, rax"], [189, "mov eax, 0"], [190, "call _snprintf"], [191, "lea rax, [rbp+s]"], [192, "mov edx, 1"], [193, "mov rsi, rax"], [194, "mov edi, offset aGopherFiletype"], [195, "call _setenv"], [196, "mov rax, [rbp+value]"], [197, "mov eax, [rax+1094h]"], [198, "mov edi, eax"], [199, "call sub_4074D1"], [200, "mov edx, 1"], [201, "mov rsi, rax"], [202, "mov edi, offset aGopherCharset"], [203, "call _setenv"], [204, "mov rax, [rbp+value]"], [205, "add rax, 0C00h"], [206, "mov edx, 1"], [207, "mov rsi, rax"], [208, "mov edi, offset aGopherReferer"], [209, "call _setenv"], [210, "mov rax, [rbp+value]"], [211, "mov edx, [rax+1090h]"], [212, "lea rax, [rbp+s]"], [213, "mov ecx, edx"], [214, "mov edx, offset aI"], [215, "mov esi, 400h"], [216, "mov rdi, rax"], [217, "mov eax, 0"], [218, "call _snprintf"], [219, "lea rax, [rbp+s]"], [220, "mov edx, 1"], [221, "mov rsi, rax"], [222, "mov edi, offset aColumns"], [223, "call _setenv"], [224, "lea rax, [rbp+s]"], [225, "mov edx, offset aMillenniumEdit"], [226, "mov esi, 400h"], [227, "mov rdi, rax"], [228, "mov eax, 0"], [229, "call _snprintf"], [230, "lea rax, [rbp+s]"], [231, "mov edx, 1"], [232, "mov rsi, rax"], [233, "mov edi, offset aServerCodename"], [234, "call _setenv"], [235, "mov rax, [rbp+value]"], [236, "movzx eax, byte ptr [rax+800h]"], [237, "test al, al"], [238, "jz short loc_4051A9"], [239, "mov rax, [rbp+value]"], [240, "lea rcx, [rax+800h]"], [241, "mov rdx, [rbp+value]"], [242, "lea rax, [rbp+s]"], [243, "mov r8, rcx"], [244, "mov rcx, rdx"], [245, "mov edx, offset aSS_0"], [246, "mov esi, 400h"], [247, "mov rdi, rax"], [248, "mov eax, 0"], [249, "call _snprintf"], [250, "lea rax, [rbp+s]"], [251, "mov edx, 1"], [252, "mov rsi, rax"], [253, "mov edi, offset aSelector"], [254, "call _setenv"], [255, "jmp short loc_4051C2"], [256, "mov rax, [rbp+value]"], [257, "mov edx, 1"], [258, "mov rsi, rax"], [259, "mov edi, offset aSelector"], [260, "call _setenv"], [261, "mov rax, [rbp+value]"], [262, "add rax, 12D8h"], [263, "mov edx, 1"], [264, "mov rsi, rax"], [265, "mov edi, offset aServerHost"], [266, "call _setenv"], [267, "mov rax, [rbp+value]"], [268, "mov edx, 1"], [269, "mov rsi, rax"], [270, "mov edi, offset aRequest"], [271, "call _setenv"], [272, "mov rax, [rbp+value]"], [273, "add rax, 800h"], [274, "mov edx, 1"], [275, "mov rsi, rax"], [276, "mov edi, offset aSearchrequest"], [277, "call _setenv"], [278, "nop"], [279, "leave"], [280, "retn"]], "data_dep": [[17, 3], [18, 17], [20, 18], [23, 3], [24, 19], [24, 23], [25, 23], [26, 24], [29, 25], [32, 31], [34, 32], [37, 3], [38, 37], [40, 38], [43, 3], [44, 43], [46, 44], [49, 48], [52, 49], [55, 54], [57, 55], [60, 3], [61, 60], [62, 61], [63, 62], [73, 3], [74, 73], [75, 3], [76, 75], [77, 76], [77, 74], [78, 77], [87, 3], [88, 87], [90, 88], [93, 3], [94, 93], [95, 93], [96, 94], [99, 95], [102, 101], [104, 102], [107, 3], [108, 107], [109, 107], [110, 108], [113, 109], [116, 115], [118, 116], [125, 3], [126, 125], [128, 126], [131, 3], [133, 131], [136, 4], [138, 136], [141, 3], [142, 141], [144, 142], [147, 3], [148, 147], [150, 148], [153, 3], [154, 153], [156, 154], [159, 3], [160, 159], [161, 159], [162, 160], [165, 161], [168, 167], [170, 168], [173, 3], [174, 173], [175, 174], [178, 176], [181, 3], [182, 181], [183, 182], [184, 182], [185, 183], [188, 184], [191, 190], [193, 191], [196, 3], [197, 196], [198, 197], [201, 199], [204, 3], [205, 204], [207, 205], [210, 3], [211, 210], [212, 210], [213, 211], [216, 212], [219, 218], [221, 219], [224, 223], [227, 224], [230, 229], [232, 230], [235, 3], [236, 235], [237, 236], [238, 237], [239, 3], [240, 239], [240, 213], [241, 3], [242, 239], [243, 240], [244, 241], [247, 242], [250, 249], [252, 250], [256, 3], [258, 256], [261, 3], [262, 261], [264, 262], [267, 3], [269, 267], [272, 3], [273, 272], [275, 273], [280, 277]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4_afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.jsonl.gz", "strip_func_name": "sub_404CAB", "query": "\n\n\nint __fastcall sub_404CAB(__int64 a1, const char *a2)\n{\nconst char *v2; // rax\nconst char *v3; // rax\nchar s[1024]; // [rsp+10h] [rbp-400h] BYREF\n\nsetenv(\"PATH\", \"/usr/bin:/bin\", 1);\nsetenv(\"GATEWAY_INTERFACE\", \"CGI/1.1\", 1);\nsetenv(\"CONTENT_LENGTH\", \"0\", 1);\nsetenv(\"QUERY_STRING\", (const char *)(a1 + 2048), 1);\nsnprintf(s, 0x400uLL, \"Gophernicus/2.4 (%s)\", (const char *)(a1 + 4376));\nsetenv(\"SERVER_SOFTWARE\", s, 1);\nsetenv(\"SERVER_ARCH\", (const char *)(a1 + 4376), 1);\nsetenv(\"SERVER_DESCRIPTION\", (const char *)(a1 + 4248), 1);\nsnprintf(s, 0x400uLL, \"Gophernicus/2.4\");\nsetenv(\"SERVER_VERSION\", s, 1);\nif ( *(_BYTE *)(a1 + 4225) == 104 )\nsetenv(\"SERVER_PROTOCOL\", \"HTTP/0.9\", 1);\nelse\nsetenv(\"SERVER_PROTOCOL\", \"RFC1436\", 1);\nif ( *(_DWORD *)(a1 + 4888) == *(_DWORD *)(a1 + 4892) )\n{\nsetenv(\"HTTPS\", \"on\", 1);\nsetenv(\"TLS\", \"on\", 1);\n}\nsetenv(\"SERVER_NAME\", (const char *)(a1 + 4824), 1);\nsnprintf(s, 0x400uLL, \"%i\", *(unsigned int *)(a1 + 4888));\nsetenv(\"SERVER_PORT\", s, 1);\nsnprintf(s, 0x400uLL, \"%i\", *(unsigned int *)(a1 + 4892));\nsetenv(\"SERVER_TLS_PORT\", s, 1);\nsetenv(\"REQUEST_METHOD\", \"GET\", 1);\nsetenv(\"DOCUMENT_ROOT\", (const char *)(a1 + 4504), 1);\nsetenv(\"SCRIPT_NAME\", (const char *)a1, 1);\nsetenv(\"SCRIPT_FILENAME\", a2, 1);\nsetenv(\"LOCAL_ADDR\", (const char *)(a1 + 4096), 1);\nsetenv(\"REMOTE_ADDR\", (const char *)(a1 + 4160), 1);\nsetenv(\"HTTP_REFERER\", (const char *)(a1 + 3072), 1);\nsnprintf(s, 0x400uLL, \"%x\", *(unsigned int *)(a1 + 81276));\nsetenv(\"SESSION_ID\", s, 1);\nv2 = (const char *)sub_4074D1(*(unsigned int *)(a1 + 4244));\nsetenv(\"HTTP_ACCEPT_CHARSET\", v2, 1);\nsnprintf(s, 0x400uLL, \"%c\", (unsigned int)*(char *)(a1 + 4224));\nsetenv(\"GOPHER_FILETYPE\", s, 1);\nv3 = (const char *)sub_4074D1(*(unsigned int *)(a1 + 4244));\nsetenv(\"GOPHER_CHARSET\", v3, 1);\nsetenv(\"GOPHER_REFERER\", (const char *)(a1 + 3072), 1);\nsnprintf(s, 0x400uLL, \"%i\", *(unsigned int *)(a1 + 4240));\nsetenv(\"COLUMNS\", s, 1);\nsnprintf(s, 0x400uLL, \"Millennium Edition\");\nsetenv(\"SERVER_CODENAME\", s, 1);\nif ( *(_BYTE *)(a1 + 2048) )\n{\nsnprintf(s, 0x400uLL, \"%s?%s\", (const char *)a1, (const char *)(a1 + 2048));\nsetenv(\"SELECTOR\", s, 1);\n}\nelse\n{\nsetenv(\"SELECTOR\", (const char *)a1, 1);\n}\nsetenv(\"SERVER_HOST\", (const char *)(a1 + 4824), 1);\nsetenv(\"REQUEST\", (const char *)a1, 1);\nreturn setenv(\"SEARCHREQUEST\", (const char *)(a1 + 2048), 1);\n}\n\n\n\nQ:[a1,a2,s,sub_404CAB,sub_4074D1,]", "hints": "[]", "response": "{'a1': 'st', 'a2': 'script', 's': 'buf', 'sub_404CAB': 'setenv_cgi', 'sub_4074D1': 'strcharset'}"} | [
[
0.767554759979248,
0.7141314148902893,
0.6947618722915649,
0.6900217533111572,
0.6855134963989258,
0.6839131116867065,
0.681465208530426,
0.680802047252655,
0.6768310070037842,
0.6765034794807434,
0.6719878911972046,
0.6696272492408752,
0.6630682349205017,
0.6618660688400269,
0.6615205407142639,
0.661076009273529,
0.660536527633667,
0.6598266363143921,
0.6592051386833191,
0.6586482524871826
],
[
101727,
100654,
137610,
220354,
254389,
8024,
207842,
101391,
159316,
31926,
41154,
243035,
207103,
163886,
7436,
239950,
229219,
34759,
208714,
202322
]
] |
|
loadfile | 75c69214e4703e37535c2975073fa40e2ea7d4e2cb6218681e4e8f3c2b1362dc | x43x61x69 | gbdk-osx | NA | VOID
loadfile(filspc)
char *filspc;
{
FILE *fp;
char str[NINPUT+2];
int i;
if ((fp = fopen(filspc,"r")) != NULL) {
while (fgets(str, NINPUT, fp) != NULL) {
str[NINPUT+1] = '\0';
i = strlen(str) - 1;
if (str[i] == '\n')
str[i] = '\0';
ip = str;
link();
}
fclose(fp);
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40319C", "function_addr": 4207004, "binary_name": "75c69214e4703e37535c2975073fa40e2ea7d4e2cb6218681e4e8f3c2b1362dc.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 1020h"], [3, "mov [rbp+filename], rdi"], [4, "mov rax, [rbp+filename]"], [5, "mov esi, offset modes"], [6, "mov rdi, rax"], [7, "call _fopen"], [8, "mov [rbp+stream], rax"], [9, "cmp [rbp+stream], 0"], [10, "jz short loc_403247"], [11, "jmp short loc_40321E"], [12, "mov [rbp+var_F], 0"], [13, "lea rax, [rbp+s]"], [14, "mov rdi, rax"], [15, "call _strlen"], [16, "sub eax, 1"], [17, "mov [rbp+var_C], eax"], [18, "mov eax, [rbp+var_C]"], [19, "cdqe"], [20, "movzx eax, [rbp+rax+s]"], [21, "cmp al, 0Ah"], [22, "jnz short loc_403206"], [23, "mov eax, [rbp+var_C]"], [24, "cdqe"], [25, "mov [rbp+rax+s], 0"], [26, "lea rax, [rbp+s]"], [27, "mov cs:src, rax"], [28, "mov eax, 0"], [29, "call link"], [30, "mov rdx, [rbp+stream]"], [31, "lea rax, [rbp+s]"], [32, "mov esi, 1000h"], [33, "mov rdi, rax"], [34, "call _fgets"], [35, "test rax, rax"], [36, "jnz short loc_4031CF"], [37, "mov rax, [rbp+stream]"], [38, "mov rdi, rax"], [39, "call _fclose"], [40, "nop"], [41, "leave"], [42, "retn"]], "data_dep": [[4, 3], [6, 4], [8, 7], [9, 8], [10, 9], [13, 35], [14, 13], [16, 15], [17, 16], [18, 17], [20, 25], [20, 18], [21, 20], [22, 21], [23, 17], [25, 23], [26, 20], [26, 23], [27, 26], [30, 8], [31, 29], [31, 7], [33, 31], [35, 34], [36, 35], [37, 8], [38, 37], [42, 39], [42, 7]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/75c69214e4703e37535c2975073fa40e2ea7d4e2cb6218681e4e8f3c2b1362dc_75c69214e4703e37535c2975073fa40e2ea7d4e2cb6218681e4e8f3c2b1362dc.jsonl.gz", "strip_func_name": "sub_40319C", "query": "\n\n\nint __fastcall sub_40319C(const char *a1)\n{\nFILE *v1; // rax\nchar s[4100]; // [rsp+10h] [rbp-1010h] BYREF\nint v4; // [rsp+1014h] [rbp-Ch]\nFILE *stream; // [rsp+1018h] [rbp-8h]\n\nv1 = fopen(a1, \"r\");\nstream = v1;\nif ( v1 )\n{\nwhile ( fgets(s, 4096, stream) )\n{\ns[4097] = 0;\nv4 = strlen(s) - 1;\nif ( s[v4] == 10 )\ns[v4] = 0;\nsrc = s;\nlink();\n}\nLODWORD(v1) = fclose(stream);\n}\nreturn (int)v1;\n}\n\n\n\nQ:[a1,s,stream,sub_40319C,]", "hints": "[]", "response": "{'a1': 'filspc', 's': 'str', 'stream': 'fp', 'sub_40319C': 'loadfile'}"} | [
[
0.797202467918396,
0.7946410775184631,
0.7923828363418579,
0.7819273471832275,
0.7792910933494568,
0.7781769037246704,
0.7755979895591736,
0.7736787796020508,
0.7636595368385315,
0.7611859440803528,
0.7572662830352783,
0.7544417381286621,
0.7520702481269836,
0.7432911396026611,
0.7418190240859985,
0.7399395108222961,
0.7392887473106384,
0.7376704216003418,
0.7360612154006958,
0.7296398878097534
],
[
75813,
23768,
111793,
41543,
15632,
168751,
54705,
181295,
240297,
75428,
3191,
221338,
205175,
134960,
228158,
144001,
145523,
113507,
38670,
38925
]
] |
|
init_user | 25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c | legitbs | quals-2013 | NA | int init_user( struct passwd * pw )
{
uid_t procuid = 0;
gid_t procgid = 0;
if (pw == NULL )
{
return -1;
}
procuid = getuid( );
procgid = getgid( );
if ( initgroups( pw->pw_name, pw->pw_gid ) != 0 )
{
return -1;
}
if ( setresgid( pw->pw_gid, pw->pw_gid, pw->pw_gid ) != 0 )
{
printf("setresgid failed\n");
return -1;
}
if ( setresuid( pw->pw_uid, pw->pw_uid, pw->pw_uid ) != 0 )
{
printf("setresuid failed\n");
return -1;
}
if ( procgid != pw->pw_gid )
{
if ( setgid( procgid ) != -1 )
{
printf("setgid failed\n");
return -1;
}
if ( setegid( procgid ) != -1 )
{
printf("setegid failed\n");
return -1;
}
}
if ( procuid != pw->pw_uid )
{
if ( setuid( procuid ) != -1 )
{
printf("setuid failed\n");
return -1;
}
if ( seteuid( procuid ) != -1 )
{
printf("seteuid failed\n");
return -1;
}
}
if ( getgid( ) != pw->pw_gid )
{
return -1;
}
if ( getegid( ) != pw->pw_gid )
{
return -1;
}
if ( getuid( ) != pw->pw_uid )
{
return -1;
}
if ( geteuid( ) != pw->pw_uid )
{
return -1;
}
if ( chdir( pw->pw_dir ) != 0 )
{
printf("chdir failed\n");
return -1;
}
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40138E", "function_addr": 4199310, "binary_name": "25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+uid], 0"], [5, "mov [rbp+gid], 0"], [6, "cmp [rbp+var_18], 0"], [7, "jnz short loc_4013B9"], [8, "mov eax, 0FFFFFFFFh"], [9, "jmp locret_40158F"], [10, "call _getuid"], [11, "mov [rbp+uid], eax"], [12, "call _getgid"], [13, "mov [rbp+gid], eax"], [14, "mov rax, [rbp+var_18]"], [15, "mov edx, [rax+14h]"], [16, "mov rax, [rbp+var_18]"], [17, "mov rax, [rax]"], [18, "mov esi, edx"], [19, "mov rdi, rax"], [20, "call _initgroups"], [21, "test eax, eax"], [22, "jz short loc_4013EF"], [23, "mov eax, 0FFFFFFFFh"], [24, "jmp locret_40158F"], [25, "mov rax, [rbp+var_18]"], [26, "mov edx, [rax+14h]"], [27, "mov rax, [rbp+var_18]"], [28, "mov ecx, [rax+14h]"], [29, "mov rax, [rbp+var_18]"], [30, "mov eax, [rax+14h]"], [31, "mov esi, ecx"], [32, "mov edi, eax"], [33, "mov eax, 0"], [34, "call _setresgid"], [35, "test eax, eax"], [36, "jz short loc_40142A"], [37, "mov edi, offset s"], [38, "call _puts"], [39, "mov eax, 0FFFFFFFFh"], [40, "jmp locret_40158F"], [41, "mov rax, [rbp+var_18]"], [42, "mov edx, [rax+10h]"], [43, "mov rax, [rbp+var_18]"], [44, "mov ecx, [rax+10h]"], [45, "mov rax, [rbp+var_18]"], [46, "mov eax, [rax+10h]"], [47, "mov esi, ecx"], [48, "mov edi, eax"], [49, "mov eax, 0"], [50, "call _setresuid"], [51, "test eax, eax"], [52, "jz short loc_401465"], [53, "mov edi, offset aSetresuidFaile"], [54, "call _puts"], [55, "mov eax, 0FFFFFFFFh"], [56, "jmp locret_40158F"], [57, "mov rax, [rbp+var_18]"], [58, "mov eax, [rax+14h]"], [59, "cmp [rbp+gid], eax"], [60, "jz short loc_4014B7"], [61, "mov eax, [rbp+gid]"], [62, "mov edi, eax"], [63, "call _setgid"], [64, "cmp eax, 0FFFFFFFFh"], [65, "jz short loc_401494"], [66, "mov edi, offset aSetgidFailed"], [67, "call _puts"], [68, "mov eax, 0FFFFFFFFh"], [69, "jmp locret_40158F"], [70, "mov eax, [rbp+gid]"], [71, "mov edi, eax"], [72, "call _setegid"], [73, "cmp eax, 0FFFFFFFFh"], [74, "jz short loc_4014B7"], [75, "mov edi, offset aSetegidFailed"], [76, "call _puts"], [77, "mov eax, 0FFFFFFFFh"], [78, "jmp locret_40158F"], [79, "mov rax, [rbp+var_18]"], [80, "mov eax, [rax+10h]"], [81, "cmp [rbp+uid], eax"], [82, "jz short loc_401509"], [83, "mov eax, [rbp+uid]"], [84, "mov edi, eax"], [85, "call _setuid"], [86, "cmp eax, 0FFFFFFFFh"], [87, "jz short loc_4014E6"], [88, "mov edi, offset aSetuidFailed"], [89, "call _puts"], [90, "mov eax, 0FFFFFFFFh"], [91, "jmp locret_40158F"], [92, "mov eax, [rbp+uid]"], [93, "mov edi, eax"], [94, "call _seteuid"], [95, "cmp eax, 0FFFFFFFFh"], [96, "jz short loc_401509"], [97, "mov edi, offset aSeteuidFailed"], [98, "call _puts"], [99, "mov eax, 0FFFFFFFFh"], [100, "jmp locret_40158F"], [101, "call _getgid"], [102, "mov rdx, [rbp+var_18]"], [103, "mov edx, [rdx+14h]"], [104, "cmp eax, edx"], [105, "jz short loc_401520"], [106, "mov eax, 0FFFFFFFFh"], [107, "jmp short locret_40158F"], [108, "call _getegid"], [109, "mov rdx, [rbp+var_18]"], [110, "mov edx, [rdx+14h]"], [111, "cmp eax, edx"], [112, "jz short loc_401537"], [113, "mov eax, 0FFFFFFFFh"], [114, "jmp short locret_40158F"], [115, "call _getuid"], [116, "mov rdx, [rbp+var_18]"], [117, "mov edx, [rdx+10h]"], [118, "cmp eax, edx"], [119, "jz short loc_40154E"], [120, "mov eax, 0FFFFFFFFh"], [121, "jmp short locret_40158F"], [122, "call _geteuid"], [123, "mov rdx, [rbp+var_18]"], [124, "mov edx, [rdx+10h]"], [125, "cmp eax, edx"], [126, "jz short loc_401565"], [127, "mov eax, 0FFFFFFFFh"], [128, "jmp short locret_40158F"], [129, "mov rax, [rbp+var_18]"], [130, "mov rax, [rax+20h]"], [131, "mov rdi, rax"], [132, "call _chdir"], [133, "test eax, eax"], [134, "jz short loc_40158A"], [135, "mov edi, offset aChdirFailed"], [136, "call _puts"], [137, "mov eax, 0FFFFFFFFh"], [138, "jmp short locret_40158F"], [139, "mov eax, 0"], [140, "leave"], [141, "retn"]], "data_dep": [[6, 3], [7, 6], [11, 10], [13, 12], [14, 3], [15, 14], [16, 3], [17, 16], [18, 15], [19, 17], [21, 20], [22, 21], [25, 3], [26, 25], [27, 3], [28, 27], [29, 3], [30, 29], [31, 28], [32, 30], [35, 34], [36, 35], [41, 3], [42, 41], [43, 3], [44, 43], [45, 3], [46, 45], [47, 44], [48, 46], [51, 50], [52, 51], [57, 3], [58, 57], [59, 13], [59, 58], [60, 59], [61, 13], [62, 61], [64, 63], [65, 64], [70, 13], [71, 70], [73, 72], [74, 73], [79, 3], [80, 79], [81, 80], [81, 11], [82, 81], [83, 11], [84, 83], [86, 85], [87, 86], [92, 11], [93, 92], [95, 94], [96, 95], [102, 3], [103, 102], [104, 101], [104, 103], [105, 104], [109, 3], [110, 109], [111, 110], [111, 108], [112, 111], [116, 3], [117, 116], [118, 115], [118, 117], [119, 118], [123, 3], [124, 123], [125, 122], [125, 124], [126, 125], [129, 3], [130, 129], [131, 130], [133, 132], [134, 133], [141, 8], [141, 127], [141, 120], [141, 113], [141, 106], [141, 90], [141, 99], [141, 55], [141, 39], [141, 23], [141, 137], [141, 139], [141, 68], [141, 77]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c_25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c.jsonl.gz", "strip_func_name": "sub_40138E", "query": "\n\n\n__int64 __fastcall sub_40138E(__int64 a1)\n{\n__int64 result; // rax\n__gid_t gid; // [rsp+18h] [rbp-8h]\n__uid_t uid; // [rsp+1Ch] [rbp-4h]\n\nif ( !a1 )\nreturn 0xFFFFFFFFLL;\nuid = getuid();\ngid = getgid();\nif ( initgroups(*(const char **)a1, *(_DWORD *)(a1 + 20)) )\nreturn 0xFFFFFFFFLL;\nif ( setresgid(*(_DWORD *)(a1 + 20), *(_DWORD *)(a1 + 20), *(_DWORD *)(a1 + 20)) )\n{\nputs(\"setresgid failed\");\nreturn 0xFFFFFFFFLL;\n}\nif ( setresuid(*(_DWORD *)(a1 + 16), *(_DWORD *)(a1 + 16), *(_DWORD *)(a1 + 16)) )\n{\nputs(\"setresuid failed\");\nreturn 0xFFFFFFFFLL;\n}\nif ( gid != *(_DWORD *)(a1 + 20) )\n{\nif ( setgid(gid) != -1 )\n{\nputs(\"setgid failed\");\nreturn 0xFFFFFFFFLL;\n}\nif ( setegid(gid) != -1 )\n{\nputs(\"setegid failed\");\nreturn 0xFFFFFFFFLL;\n}\n}\nif ( uid == *(_DWORD *)(a1 + 16) )\ngoto LABEL_19;\nif ( setuid(uid) != -1 )\n{\nputs(\"setuid failed\");\nreturn 0xFFFFFFFFLL;\n}\nif ( seteuid(uid) == -1 )\n{\nLABEL_19:\nif ( getgid() == *(_DWORD *)(a1 + 20) )\n{\nif ( getegid() == *(_DWORD *)(a1 + 20) )\n{\nif ( getuid() == *(_DWORD *)(a1 + 16) )\n{\nif ( geteuid() == *(_DWORD *)(a1 + 16) )\n{\nif ( chdir(*(const char **)(a1 + 32)) )\n{\nputs(\"chdir failed\");\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nresult = 0LL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nresult = 0xFFFFFFFFLL;\n}\n}\nelse\n{\nputs(\"seteuid failed\");\nresult = 0xFFFFFFFFLL;\n}\nreturn result;\n}\n\n\n\nQ:[a1,gid,uid,sub_40138E,]", "hints": "[]", "response": "{'a1': 'pw', 'gid': 'procgid', 'uid': 'procuid', 'sub_40138E': 'init_user'}"} | [
[
0.7557117938995361,
0.7432501912117004,
0.722724974155426,
0.7051730155944824,
0.6995817422866821,
0.6972182989120483,
0.6945732831954956,
0.6920208930969238,
0.6917068958282471,
0.6909412741661072,
0.68758225440979,
0.6866781115531921,
0.6817060112953186,
0.6814916729927063,
0.6814041137695312,
0.67516028881073,
0.6705586910247803,
0.6703929901123047,
0.6702492237091064,
0.6674785017967224
],
[
207902,
34437,
54453,
50089,
54737,
27623,
44974,
128109,
234613,
59809,
244770,
65430,
149606,
184606,
176443,
194350,
207154,
41361,
227022,
196152
]
] |
|
serial_init | 55cb13d7343cc326bc0856a8ace853fefaba3d25b4f82fb54f1d66c8deea64bd | GBert | openwrt-misc | NA | void
serial_init(char *_port, int baud)
{
int lockf;
char *portbase;
struct termios attr;
saved_baud = baud;
baud = baud_to_baud (baud);
if (!_port)
_port = "/dev/ttyUSB0";
portbase = strrchr(_port, '/');
if (portbase == 0)
portbase = _port;
else
portbase ++;
lockn = (char *) malloc (strlen(portbase) + 16);
sprintf(lockn, "/var/lock/LCK..%s", portbase);
lockf = open(lockn, O_RDWR|O_CREAT|O_EXCL, 0666);
if (lockf < 0)
{
printf("cannot lock %s - is someone else using it?\n", _port);
printf("lock %s\n", lockn);
perror("The error was");
exit(1);
}
port = _port;
fd = open(port, O_RDWR|O_NOCTTY|O_NDELAY);
if (fd < 0)
{
printf("can't open %s\n", port);
perror("The error was");
exit(1);
}
atexit (serial_close);
fcntl(fd, F_SETFL, 0);
/* Reset by DTR - might work :-) */
tcgetattr(fd, &attr);
cfsetispeed(&attr, 0);
cfsetospeed(&attr, 0);
tcsetattr(fd, TCSAFLUSH, &attr);
usleep(3*1000);
tcgetattr(fd, &attr);
cfsetispeed(&attr, baud);
cfsetospeed(&attr, baud);
cfmakeraw(&attr);
if (rx_stick)
set_stick_mode (1);
attr.c_iflag &= ~(IXON | IXOFF | IXANY);
attr.c_iflag |= IGNBRK;
attr.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
attr.c_cflag &= ~(PARENB | CSIZE | CRTSCTS);
attr.c_cflag |= CS8 | CLOCAL | CSTOPB;
attr.c_cc[VTIME] = 5;
tcsetattr(fd, TCSANOW, &attr);
/* 1 mSec delay to let board "wake up" after reset */
usleep(3*1000);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_406A9B", "function_addr": 4221595, "binary_name": "55cb13d7343cc326bc0856a8ace853fefaba3d25b4f82fb54f1d66c8deea64bd.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 60h"], [3, "mov [rbp+s], rdi"], [4, "mov [rbp+speed], esi"], [5, "mov eax, [rbp+speed]"], [6, "mov cs:dword_40D2BC, eax"], [7, "mov eax, [rbp+speed]"], [8, "mov edi, eax"], [9, "call sub_406796"], [10, "mov [rbp+speed], eax"], [11, "cmp [rbp+s], 0"], [12, "jnz short loc_406ACF"], [13, "mov [rbp+s], offset aDevTtyusb0"], [14, "mov rax, [rbp+s]"], [15, "mov esi, 2Fh "], [16, "mov rdi, rax"], [17, "call _strrchr"], [18, "mov [rbp+var_8], rax"], [19, "cmp [rbp+var_8], 0"], [20, "jnz short loc_406AF5"], [21, "mov rax, [rbp+s]"], [22, "mov [rbp+var_8], rax"], [23, "jmp short loc_406AFA"], [24, "add [rbp+var_8], 1"], [25, "mov rax, [rbp+var_8]"], [26, "mov rdi, rax"], [27, "call _strlen"], [28, "add rax, 10h"], [29, "mov rdi, rax"], [30, "call _malloc"], [31, "mov cs:name, rax"], [32, "mov rax, cs:name"], [33, "mov rdx, [rbp+var_8]"], [34, "mov esi, offset aVarLockLckS"], [35, "mov rdi, rax"], [36, "mov eax, 0"], [37, "call _sprintf"], [38, "mov rax, cs:name"], [39, "mov edx, 1B6h"], [40, "mov esi, 0C2h"], [41, "mov rdi, rax"], [42, "mov eax, 0"], [43, "call _open"], [44, "mov [rbp+var_C], eax"], [45, "cmp [rbp+var_C], 0"], [46, "jns short loc_406BA0"], [47, "mov rax, [rbp+s]"], [48, "mov rsi, rax"], [49, "mov edi, offset aCannotLockSIsS"], [50, "mov eax, 0"], [51, "call _printf"], [52, "mov rax, cs:name"], [53, "mov rsi, rax"], [54, "mov edi, offset aLockS"], [55, "mov eax, 0"], [56, "call _printf"], [57, "mov edi, offset aTheErrorWas"], [58, "call _perror"], [59, "mov edi, 1"], [60, "call _exit"], [61, "mov rax, [rbp+s]"], [62, "mov cs:qword_40D2B0, rax"], [63, "mov rax, cs:qword_40D2B0"], [64, "mov esi, 902h"], [65, "mov rdi, rax"], [66, "mov eax, 0"], [67, "call _open"], [68, "mov cs:fd, eax"], [69, "mov eax, cs:fd"], [70, "test eax, eax"], [71, "jns short loc_406C01"], [72, "mov rax, cs:qword_40D2B0"], [73, "mov rsi, rax"], [74, "mov edi, offset aCanTOpenS"], [75, "mov eax, 0"], [76, "call _printf"], [77, "mov edi, offset aTheErrorWas"], [78, "call _perror"], [79, "mov edi, 1"], [80, "call _exit"], [81, "mov edi, offset sub_406A3F"], [82, "call sub_407290"], [83, "mov eax, cs:fd"], [84, "mov edx, 0"], [85, "mov esi, 4"], [86, "mov edi, eax"], [87, "mov eax, 0"], [88, "call _fcntl"], [89, "mov eax, cs:fd"], [90, "lea rdx, [rbp+termios_p]"], [91, "mov rsi, rdx"], [92, "mov edi, eax"], [93, "call _tcgetattr"], [94, "lea rax, [rbp+termios_p]"], [95, "mov esi, 0"], [96, "mov rdi, rax"], [97, "call _cfsetispeed"], [98, "lea rax, [rbp+termios_p]"], [99, "mov esi, 0"], [100, "mov rdi, rax"], [101, "call _cfsetospeed"], [102, "mov eax, cs:fd"], [103, "lea rdx, [rbp+termios_p]"], [104, "mov esi, 2"], [105, "mov edi, eax"], [106, "call _tcsetattr"], [107, "mov edi, 0BB8h"], [108, "call _usleep"], [109, "mov eax, cs:fd"], [110, "lea rdx, [rbp+termios_p]"], [111, "mov rsi, rdx"], [112, "mov edi, eax"], [113, "call _tcgetattr"], [114, "mov edx, [rbp+speed]"], [115, "lea rax, [rbp+termios_p]"], [116, "mov esi, edx"], [117, "mov rdi, rax"], [118, "call _cfsetispeed"], [119, "mov edx, [rbp+speed]"], [120, "lea rax, [rbp+termios_p]"], [121, "mov esi, edx"], [122, "mov rdi, rax"], [123, "call _cfsetospeed"], [124, "lea rax, [rbp+termios_p]"], [125, "mov rdi, rax"], [126, "call _cfmakeraw"], [127, "mov eax, cs:dword_40D2C4"], [128, "test eax, eax"], [129, "jz short loc_406CD3"], [130, "mov edi, 1"], [131, "call sub_406958"], [132, "mov eax, [rbp+termios_p.c_iflag]"], [133, "and ah, 0E3h"], [134, "mov [rbp+termios_p.c_iflag], eax"], [135, "mov eax, [rbp+termios_p.c_iflag]"], [136, "or eax, 1"], [137, "mov [rbp+termios_p.c_iflag], eax"], [138, "mov eax, [rbp+termios_p.c_lflag]"], [139, "and eax, 0FFFFFFE4h"], [140, "mov [rbp+termios_p.c_lflag], eax"], [141, "mov eax, [rbp+termios_p.c_cflag]"], [142, "and eax, 7FFFFECFh"], [143, "mov [rbp+termios_p.c_cflag], eax"], [144, "mov eax, [rbp+termios_p.c_cflag]"], [145, "or eax, 870h"], [146, "mov [rbp+termios_p.c_cflag], eax"], [147, "mov [rbp+termios_p.c_cc+5], 5"], [148, "mov eax, cs:fd"], [149, "lea rdx, [rbp+termios_p]"], [150, "mov esi, 0"], [151, "mov edi, eax"], [152, "call _tcsetattr"], [153, "mov edi, 0BB8h"], [154, "call _usleep"], [155, "nop"], [156, "leave"], [157, "retn"]], "data_dep": [[5, 4], [6, 5], [7, 4], [8, 7], [10, 9], [11, 3], [12, 11], [14, 13], [14, 3], [16, 14], [18, 17], [19, 18], [20, 19], [21, 13], [21, 3], [22, 21], [24, 18], [25, 22], [25, 24], [26, 25], [28, 27], [29, 28], [31, 30], [32, 31], [33, 22], [33, 24], [35, 32], [38, 31], [41, 38], [44, 43], [45, 44], [46, 45], [47, 13], [47, 3], [48, 47], [52, 31], [53, 52], [61, 3], [61, 13], [62, 61], [63, 62], [65, 63], [68, 67], [69, 68], [70, 69], [71, 70], [72, 62], [73, 72], [83, 68], [86, 83], [89, 68], [90, 84], [91, 90], [92, 89], [94, 93], [96, 94], [98, 97], [100, 98], [102, 68], [103, 90], [105, 102], [109, 68], [110, 103], [111, 110], [112, 109], [114, 10], [115, 113], [116, 114], [117, 115], [119, 10], [120, 118], [121, 119], [122, 120], [124, 123], [125, 124], [128, 127], [129, 128], [133, 132], [134, 133], [135, 134], [136, 135], [137, 136], [139, 138], [140, 139], [142, 141], [143, 142], [144, 143], [145, 144], [146, 145], [148, 68], [149, 119], [151, 148], [157, 154]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/55cb13d7343cc326bc0856a8ace853fefaba3d25b4f82fb54f1d66c8deea64bd_55cb13d7343cc326bc0856a8ace853fefaba3d25b4f82fb54f1d66c8deea64bd.jsonl.gz", "strip_func_name": "sub_406A9B", "query": "\n\n\nint __fastcall sub_406A9B(char *a1, int a2)\n{\nsize_t v2; // rax\ntcflag_t v3; // eax\nspeed_t speed; // [rsp+4h] [rbp-5Ch]\nchar *s; // [rsp+8h] [rbp-58h]\nstruct termios termios_p; // [rsp+10h] [rbp-50h] BYREF\nint v8; // [rsp+54h] [rbp-Ch]\nchar *v9; // [rsp+58h] [rbp-8h]\n\ns = a1;\ndword_40D2BC = a2;\nspeed = sub_406796(a2);\nif ( !a1 )\ns = \"/dev/ttyUSB0\";\nv9 = strrchr(s, 47);\nif ( v9 )\n++v9;\nelse\nv9 = s;\nv2 = strlen(v9);\nname = (char *)malloc(v2 + 16);\nsprintf(name, \"/var/lock/LCK..%s\", v9);\nv8 = open(name, 194, 438LL);\nif ( v8 < 0 )\n{\nprintf(\"cannot lock %s - is someone else using it?\\n\", s);\nprintf(\"lock %s\\n\", name);\nperror(\"The error was\");\nexit(1);\n}\nqword_40D2B0 = s;\nfd = open(s, 2306);\nif ( fd < 0 )\n{\nprintf(\"can't open %s\\n\", qword_40D2B0);\nperror(\"The error was\");\nexit(1);\n}\nsub_407290(sub_406A3F);\nfcntl(fd, 4, 0LL);\ntcgetattr(fd, &termios_p);\ncfsetispeed(&termios_p, 0);\ncfsetospeed(&termios_p, 0);\ntcsetattr(fd, 2, &termios_p);\nusleep(0xBB8u);\ntcgetattr(fd, &termios_p);\ncfsetispeed(&termios_p, speed);\ncfsetospeed(&termios_p, speed);\ncfmakeraw(&termios_p);\nif ( dword_40D2C4 )\nsub_406958(1u);\nv3 = termios_p.c_iflag;\nBYTE1(v3) = BYTE1(termios_p.c_iflag) & 0xE3;\ntermios_p.c_iflag = v3 | 1;\ntermios_p.c_lflag &= 0xFFFFFFE4;\ntermios_p.c_cflag = termios_p.c_cflag & 0x7FFFFECF | 0x870;\ntermios_p.c_cc[5] = 5;\ntcsetattr(fd, 0, &termios_p);\nreturn usleep(0xBB8u);\n}\n\n\n\nQ:[a1,a2,speed,s,termios_p,v8,v9,sub_406A9B,sub_406796,sub_407290,sub_406958,]", "hints": "[]", "response": "{'a1': '_port', 'a2': 'baud', 'speed': 'bauda', 's': '_porta', 'termios_p': 'attr', 'v8': 'lockf', 'v9': 'portbase', 'sub_406A9B': 'serial_init', 'sub_406796': 'baud_to_baud', 'sub_407290': 'atexit', 'sub_406958': 'set_stick_mode'}"} | [
[
0.7779257893562317,
0.7729095220565796,
0.7719299793243408,
0.7715691328048706,
0.7670766115188599,
0.7609373331069946,
0.7582333087921143,
0.7563591003417969,
0.7559704184532166,
0.7538862228393555,
0.753052830696106,
0.7501525282859802,
0.7433223724365234,
0.7405433654785156,
0.7397132515907288,
0.7381662726402283,
0.7378748059272766,
0.7374330163002014,
0.7373796105384827,
0.7367938160896301
],
[
213719,
208648,
229573,
221729,
215554,
99868,
220779,
105732,
163817,
196735,
104789,
192966,
147460,
72714,
175585,
187194,
70594,
252855,
255307,
154507
]
] |
|
decode_half | b076f0bb06e40e2fe065406d56d85693a7c9c8682f0f249bacedec3ccebf055f | InfiniTimeOrg | InfiniTime | NA | double decode_half(unsigned char *halfp) {
int half = (halfp[0] << 8) + halfp[1];
int exp = (half >> 10) & 0x1f;
int mant = half & 0x3ff;
double val;
if (exp == 0) val = ldexp(mant, -24);
else if (exp != 31) val = ldexp(mant + 1024, exp - 25);
else val = mant == 0 ? INFINITY : NAN;
return half & 0x8000 ? -val : val;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_41BC62", "function_addr": 4308066, "binary_name": "b076f0bb06e40e2fe065406d56d85693a7c9c8682f0f249bacedec3ccebf055f.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_28], rdi"], [4, "mov rax, [rbp+var_28]"], [5, "movzx eax, byte ptr [rax]"], [6, "movzx eax, al"], [7, "shl eax, 8"], [8, "mov edx, eax"], [9, "mov rax, [rbp+var_28]"], [10, "add rax, 1"], [11, "movzx eax, byte ptr [rax]"], [12, "movzx eax, al"], [13, "add eax, edx"], [14, "mov [rbp+var_C], eax"], [15, "mov eax, [rbp+var_C]"], [16, "sar eax, 0Ah"], [17, "and eax, 1Fh"], [18, "mov [rbp+var_10], eax"], [19, "mov eax, [rbp+var_C]"], [20, "and eax, 3FFh"], [21, "mov [rbp+var_14], eax"], [22, "cmp [rbp+var_10], 0"], [23, "jnz short loc_41BCD5"], [24, "pxor xmm2, xmm2"], [25, "cvtsi2sd xmm2, [rbp+var_14]"], [26, "movq rax, xmm2"], [27, "mov edi, 0FFFFFFE8h"], [28, "movq xmm0, rax"], [29, "call _ldexp"], [30, "movq rax, xmm0"], [31, "mov [rbp+var_8], rax"], [32, "jmp short loc_41BD2A"], [33, "cmp [rbp+var_10], 1Fh"], [34, "jz short loc_41BD0D"], [35, "mov eax, [rbp+var_10]"], [36, "lea edx, [rax-19h]"], [37, "mov eax, [rbp+var_14]"], [38, "add eax, 400h"], [39, "pxor xmm3, xmm3"], [40, "cvtsi2sd xmm3, eax"], [41, "movq rax, xmm3"], [42, "mov edi, edx"], [43, "movq xmm0, rax"], [44, "call _ldexp"], [45, "movq rax, xmm0"], [46, "mov [rbp+var_8], rax"], [47, "jmp short loc_41BD2A"], [48, "cmp [rbp+var_14], 0"], [49, "jnz short loc_41BD1D"], [50, "movsd xmm0, cs:qword_42A240"], [51, "jmp short loc_41BD25"], [52, "movsd xmm0, cs:qword_42A248"], [53, "movsd [rbp+var_8], xmm0"], [54, "mov eax, [rbp+var_C]"], [55, "and eax, 8000h"], [56, "test eax, eax"], [57, "jz short loc_41BD49"], [58, "movsd xmm0, [rbp+var_8]"], [59, "movq xmm1, cs:qword_42A250"], [60, "xorpd xmm0, xmm1"], [61, "jmp short loc_41BD4E"], [62, "movsd xmm0, [rbp+var_8]"], [63, "movq rax, xmm0"], [64, "movq xmm0, rax"], [65, "leave"], [66, "retn"]], "data_dep": [[4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 3], [10, 9], [11, 10], [12, 11], [13, 8], [13, 12], [14, 13], [15, 14], [16, 15], [17, 16], [18, 17], [19, 14], [20, 19], [21, 20], [22, 18], [23, 22], [25, 21], [25, 24], [26, 25], [28, 26], [30, 28], [31, 30], [33, 18], [34, 33], [35, 18], [36, 8], [36, 35], [37, 21], [38, 37], [40, 38], [40, 39], [41, 40], [42, 36], [43, 41], [45, 43], [46, 45], [48, 21], [49, 48], [53, 50], [53, 52], [54, 14], [55, 54], [56, 55], [57, 56], [58, 31], [58, 46], [58, 53], [60, 59], [60, 58], [62, 53], [62, 31], [62, 46], [63, 60], [63, 62], [64, 63], [66, 63]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/b076f0bb06e40e2fe065406d56d85693a7c9c8682f0f249bacedec3ccebf055f_b076f0bb06e40e2fe065406d56d85693a7c9c8682f0f249bacedec3ccebf055f.jsonl.gz", "strip_func_name": "sub_41BC62", "query": "\n\n\n__int64 __fastcall sub_41BC62(unsigned __int8 *a1)\n{\n__int64 v1; // xmm0_8\ndouble v2; // xmm0_8\nint v4; // [rsp+1Ch] [rbp-14h]\nint v5; // [rsp+20h] [rbp-10h]\nint v6; // [rsp+24h] [rbp-Ch]\ndouble v7; // [rsp+28h] [rbp-8h]\n\nv6 = (*a1 << 8) + a1[1];\nv5 = (v6 >> 10) & 0x1F;\nv4 = v6 & 0x3FF;\nif ( v5 )\n{\nif ( v5 == 31 )\n{\nif ( (v6 & 0x3FF) != 0 )\nv1 = 0x7FF8000000000000LL;\nelse\nv1 = 0x7FF0000000000000LL;\nv7 = *(double *)&v1;\n}\nelse\n{\nv7 = ldexp((double)(v4 + 1024), v5 - 25);\n}\n}\nelse\n{\nv7 = ldexp((double)v4, -24);\n}\nif ( (v6 & 0x8000) != 0 )\nv2 = -v7;\nelse\nv2 = v7;\nreturn *(_QWORD *)&v2;\n}\n\n\n\nQ:[a1,v2,v4,v5,v6,v7,sub_41BC62,]", "hints": "[]", "response": "{'a1': 'halfp', 'v2': 'result', 'v4': 'mant', 'v5': 'exp', 'v6': 'half', 'v7': 'val', 'sub_41BC62': 'decode_half'}"} | [
[
0.743498682975769,
0.7182648777961731,
0.715121865272522,
0.7019907236099243,
0.6892504692077637,
0.6858251094818115,
0.682754397392273,
0.6804237961769104,
0.6775818467140198,
0.6735419034957886,
0.6603907346725464,
0.6594989895820618,
0.6564459800720215,
0.6529613137245178,
0.6514772772789001,
0.6510657072067261,
0.6504581570625305,
0.6499276161193848,
0.6492710709571838,
0.647429883480072
],
[
121131,
130317,
64288,
216601,
173240,
128433,
192524,
245108,
47493,
67524,
175162,
110135,
137277,
69017,
156023,
17464,
21185,
43918,
25757,
56812
]
] |
|
opt_process | dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b | lavabit | pahoehoe | NA | int opt_process(int argc, char **argv, Options *options, char *msgbuf, size_t bufsize)
{
option *long_options;
char *optstring;
if (!(long_options = opt_convert(options)))
return optind;
if (!(optstring = opt_optstring(options)))
{
mem_release(long_options);
return optind;
}
for (;;)
{
int longindex = -1;
int rc;
if ((rc = getopt_long(argc, argv, optstring, long_options, &longindex)) == EOF)
break;
if (rc == '?' || rc == ':')
{
mem_release(long_options);
mem_release(optstring);
return set_errno(EINVAL);
}
if (rc == '\001')
rc = '?';
errno = 0;
opt_action(options, rc, longindex, optarg);
if (errno == ERANGE || errno == EDOM)
{
if (msgbuf)
{
char optname[256];
if (rc != 0 && longindex == -1) /* Short option */
snprintf(optname, 256, "-%c", rc);
else if (rc == 0 && longindex != -1) /* Long option */
snprintf(optname, 256, "--%s", long_options[longindex].name);
snprintf(msgbuf, bufsize, "%s: invalid %s argument: %s", *argv, optname, (errno == EDOM) ? "not an integer" : "integer out of range");
}
mem_release(long_options);
mem_release(optstring);
return -1;
}
}
mem_release(long_options);
mem_release(optstring);
return optind;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4188AC", "function_addr": 4294828, "binary_name": "dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 150h"], [3, "mov [rbp+argc], edi"], [4, "mov [rbp+argv], rsi"], [5, "mov [rbp+var_138], rdx"], [6, "mov [rbp+var_140], rcx"], [7, "mov [rbp+maxlen], r8"], [8, "mov rax, [rbp+var_138]"], [9, "mov rdi, rax"], [10, "call sub_4181AE"], [11, "mov [rbp+ptr], rax"], [12, "cmp [rbp+ptr], 0"], [13, "jnz short loc_4188FE"], [14, "mov eax, cs:optind"], [15, "jmp locret_418AFD"], [16, "mov rax, [rbp+var_138]"], [17, "mov rdi, rax"], [18, "call sub_418350"], [19, "mov [rbp+shortopts], rax"], [20, "cmp [rbp+shortopts], 0"], [21, "jnz short loc_41892F"], [22, "mov rax, [rbp+ptr]"], [23, "mov rdi, rax"], [24, "call _free"], [25, "mov eax, cs:optind"], [26, "jmp locret_418AFD"], [27, "mov [rbp+longind], 0FFFFFFFFh"], [28, "lea rdi, [rbp+longind]"], [29, "mov rcx, [rbp+ptr]"], [30, "mov rdx, [rbp+shortopts]"], [31, "mov rsi, [rbp+argv]"], [32, "mov eax, [rbp+argc]"], [33, "mov r8, rdi"], [34, "mov edi, eax"], [35, "call _getopt_long"], [36, "mov [rbp+var_4], eax"], [37, "cmp [rbp+var_4], 0FFFFFFFFh"], [38, "jnz short loc_418985"], [39, "mov rax, [rbp+ptr]"], [40, "mov rdi, rax"], [41, "call _free"], [42, "mov rax, [rbp+shortopts]"], [43, "mov rdi, rax"], [44, "call _free"], [45, "mov eax, cs:optind"], [46, "jmp locret_418AFD"], [47, "cmp [rbp+var_4], 3Fh "], [48, "jz short loc_418991"], [49, "cmp [rbp+var_4], 3Ah "], [50, "jnz short loc_4189B8"], [51, "mov rax, [rbp+ptr]"], [52, "mov rdi, rax"], [53, "call _free"], [54, "mov rax, [rbp+shortopts]"], [55, "mov rdi, rax"], [56, "call _free"], [57, "mov edi, 16h"], [58, "call sub_40E241"], [59, "jmp locret_418AFD"], [60, "cmp [rbp+var_4], 1"], [61, "jnz short loc_4189C5"], [62, "mov [rbp+var_4], 3Fh "], [63, "call ___errno_location"], [64, "mov dword ptr [rax], 0"], [65, "mov rcx, cs:optarg"], [66, "mov edx, [rbp+longind]"], [67, "mov esi, [rbp+var_4]"], [68, "mov rax, [rbp+var_138]"], [69, "mov rdi, rax"], [70, "call sub_41858E"], [71, "call ___errno_location"], [72, "mov eax, [rax]"], [73, "cmp eax, 22h "], [74, "jz short loc_418A08"], [75, "call ___errno_location"], [76, "mov eax, [rax]"], [77, "cmp eax, 21h "], [78, "jnz loc_41892F"], [79, "cmp [rbp+var_140], 0"], [80, "jz loc_418AE0"], [81, "cmp [rbp+var_4], 0"], [82, "jz short loc_418A49"], [83, "mov eax, [rbp+longind]"], [84, "cmp eax, 0FFFFFFFFh"], [85, "jnz short loc_418A49"], [86, "mov edx, [rbp+var_4]"], [87, "lea rax, [rbp+s]"], [88, "mov ecx, edx"], [89, "mov edx, offset aC_0"], [90, "mov esi, 100h"], [91, "mov rdi, rax"], [92, "mov eax, 0"], [93, "call _snprintf"], [94, "jmp short loc_418A8E"], [95, "cmp [rbp+var_4], 0"], [96, "jnz short loc_418A8E"], [97, "mov eax, [rbp+longind]"], [98, "cmp eax, 0FFFFFFFFh"], [99, "jz short loc_418A8E"], [100, "mov eax, [rbp+longind]"], [101, "cdqe"], [102, "shl rax, 5"], [103, "mov rdx, rax"], [104, "mov rax, [rbp+ptr]"], [105, "add rax, rdx"], [106, "mov rdx, [rax]"], [107, "lea rax, [rbp+s]"], [108, "mov rcx, rdx"], [109, "mov edx, offset aS_9"], [110, "mov esi, 100h"], [111, "mov rdi, rax"], [112, "mov eax, 0"], [113, "call _snprintf"], [114, "call ___errno_location"], [115, "mov eax, [rax]"], [116, "cmp eax, 21h "], [117, "jnz short loc_418AA1"], [118, "mov edi, offset aNotAnInteger"], [119, "jmp short loc_418AA6"], [120, "mov edi, offset aIntegerOutOfRa"], [121, "mov rax, [rbp+argv]"], [122, "mov rdx, [rax]"], [123, "lea rcx, [rbp+s]"], [124, "mov rsi, [rbp+maxlen]"], [125, "mov rax, [rbp+var_140]"], [126, "mov r9, rdi"], [127, "mov r8, rcx"], [128, "mov rcx, rdx"], [129, "mov edx, offset aSInvalidSArgum"], [130, "mov rdi, rax"], [131, "mov eax, 0"], [132, "call _snprintf"], [133, "mov rax, [rbp+ptr]"], [134, "mov rdi, rax"], [135, "call _free"], [136, "mov rax, [rbp+shortopts]"], [137, "mov rdi, rax"], [138, "call _free"], [139, "mov eax, 0FFFFFFFFh"], [140, "leave"], [141, "retn"]], "data_dep": [[8, 5], [9, 8], [11, 10], [12, 11], [13, 12], [16, 5], [17, 16], [19, 18], [20, 19], [21, 20], [22, 11], [23, 22], [28, 69], [28, 27], [28, 17], [29, 11], [30, 19], [31, 4], [32, 3], [33, 28], [34, 32], [36, 35], [37, 36], [38, 37], [39, 11], [40, 39], [42, 19], [43, 42], [47, 36], [48, 47], [49, 36], [50, 49], [51, 11], [52, 51], [54, 19], [55, 54], [60, 36], [61, 60], [64, 63], [66, 27], [67, 36], [67, 62], [68, 5], [69, 68], [72, 71], [72, 64], [73, 72], [74, 73], [76, 64], [76, 75], [77, 76], [78, 77], [79, 6], [80, 79], [81, 62], [81, 36], [82, 81], [83, 27], [84, 83], [85, 84], [86, 62], [86, 36], [87, 83], [88, 86], [91, 87], [95, 36], [95, 62], [96, 95], [97, 27], [98, 97], [99, 98], [100, 27], [102, 100], [103, 102], [104, 11], [105, 104], [105, 103], [106, 105], [106, 64], [107, 105], [108, 106], [111, 107], [115, 64], [115, 114], [116, 115], [117, 116], [121, 4], [122, 64], [122, 121], [123, 88], [123, 65], [123, 108], [124, 7], [125, 6], [126, 118], [126, 120], [127, 123], [128, 122], [130, 125], [133, 11], [134, 133], [136, 19], [137, 136], [141, 58], [141, 14], [141, 25], [141, 139], [141, 45]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b_dbef1d827ccd2a42e8941d50152f102df28295732bfb69acb1ef6314d264873b.jsonl.gz", "strip_func_name": "sub_4188AC", "query": "\n\n\n__int64 __fastcall sub_4188AC(int a1, char *const *a2, _QWORD *a3, char *a4, size_t a5)\n{\n__int64 result; // rax\nconst char *v6; // rdi\nchar s[260]; // [rsp+30h] [rbp-120h] BYREF\nint longind; // [rsp+134h] [rbp-1Ch] BYREF\nchar *shortopts; // [rsp+138h] [rbp-18h]\nvoid *ptr; // [rsp+140h] [rbp-10h]\nint v14; // [rsp+14Ch] [rbp-4h]\n\nptr = sub_4181AE(a3);\nif ( !ptr )\nreturn (unsigned int)optind;\nshortopts = sub_418350(a3);\nif ( shortopts )\n{\ndo\n{\nlongind = -1;\nv14 = getopt_long(a1, a2, shortopts, (const struct option *)ptr, &longind);\nswitch ( v14 )\n{\ncase -1:\nfree(ptr);\nfree(shortopts);\nreturn (unsigned int)optind;\ncase 63:\ncase 58:\nfree(ptr);\nfree(shortopts);\nreturn sub_40E241(22);\ncase 1:\nv14 = 63;\nbreak;\n}\n*__errno_location() = 0;\nsub_41858E(a3, v14, longind, (const char *)optarg);\n}\nwhile ( *__errno_location() != 34 && *__errno_location() != 33 );\nif ( a4 )\n{\nif ( v14 && longind == -1 )\n{\nsnprintf(s, 0x100uLL, \"-%c\", (unsigned int)v14);\n}\nelse if ( !v14 && longind != -1 )\n{\nsnprintf(s, 0x100uLL, \"--%s\", *((const char **)ptr + 4 * longind));\n}\nif ( *__errno_location() == 33 )\nv6 = \"not an integer\";\nelse\nv6 = \"integer out of range\";\nsnprintf(a4, a5, \"%s: invalid %s argument: %s\", *(const char **)a2, s, v6);\n}\nfree(ptr);\nfree(shortopts);\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nfree(ptr);\nresult = (unsigned int)optind;\n}\nreturn result;\n}\n\n\n\nQ:[a3,a4,a1,a2,a5,s,longind,shortopts,ptr,v14,sub_4188AC,sub_4181AE,sub_418350,sub_40E241,sub_41858E,]", "hints": "[]", "response": "{'a3': 'options', 'a4': 'msgbuf', 'a1': 'argc', 'a2': 'argv', 'a5': 'bufsize', 's': 'optname', 'longind': 'longindex', 'shortopts': 'optstring', 'ptr': 'long_options', 'v14': 'rc', 'sub_4188AC': 'opt_process', 'sub_4181AE': 'opt_convert', 'sub_418350': 'opt_optstring', 'sub_40E241': 'set_errno', 'sub_41858E': 'opt_action'}"} | [
[
0.7381049394607544,
0.7022217512130737,
0.6885398626327515,
0.680008590221405,
0.6685369610786438,
0.6684837937355042,
0.6673519015312195,
0.6615147590637207,
0.6613284349441528,
0.655561625957489,
0.6491038799285889,
0.6448686122894287,
0.6387444734573364,
0.6367236971855164,
0.6354403495788574,
0.6346351504325867,
0.6322062015533447,
0.6312924027442932,
0.6298937201499939,
0.6273545622825623
],
[
242438,
254581,
184251,
31096,
230608,
163965,
184549,
23050,
23355,
14312,
112223,
212158,
29826,
162102,
113279,
103439,
31561,
73333,
156008,
19585
]
] |
|
handle_read | 170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76 | atomicobject | heatshrink | NA | static ssize_t handle_read(io_handle *io, size_t size, uint8_t **buf) {
LOG("@ read %zd\n", size);
if (buf == NULL) { return -1; }
if (size > io->size) {
fprintf(stderr, "size %zd, io->size %zd\n", size, io->size);
return -1;
}
if (io->mode != IO_READ) { return -1; }
size_t rem = io->fill - io->read;
if (rem >= size) {
*buf = &io->buf[io->read];
return size;
} else { /* read and replenish */
if (io->fd == -1) { /* already closed, return what we've got */
*buf = &io->buf[io->read];
return rem;
}
memmove(io->buf, &io->buf[io->read], rem);
io->fill -= io->read;
io->read = 0;
ssize_t read_sz = read(io->fd, &io->buf[io->fill], io->size - io->fill);
if (read_sz < 0) { HEATSHRINK_ERR(1, "read"); }
io->total += read_sz;
if (read_sz == 0) { /* EOF */
if (close(io->fd) < 0) { HEATSHRINK_ERR(1, "close"); }
io->fd = -1;
}
io->fill += read_sz;
*buf = io->buf;
return io->fill > size ? size : io->fill;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4013F7", "function_addr": 4199415, "binary_name": "170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_28], rdx"], [6, "cmp [rbp+var_28], 0"], [7, "jnz short loc_40141E"], [8, "mov rax, 0FFFFFFFFFFFFFFFFh"], [9, "jmp locret_401623"], [10, "mov rax, [rbp+var_18]"], [11, "mov rax, [rax+18h]"], [12, "cmp [rbp+var_20], rax"], [13, "jbe short loc_40145D"], [14, "mov rax, [rbp+var_18]"], [15, "mov rcx, [rax+18h]"], [16, "mov rax, cs:stderr"], [17, "mov rdx, [rbp+var_20]"], [18, "mov esi, offset aSizeZdIoSizeZd"], [19, "mov rdi, rax"], [20, "mov eax, 0"], [21, "call _fprintf"], [22, "mov rax, 0FFFFFFFFFFFFFFFFh"], [23, "jmp locret_401623"], [24, "mov rax, [rbp+var_18]"], [25, "mov eax, [rax+4]"], [26, "test eax, eax"], [27, "jz short loc_401474"], [28, "mov rax, 0FFFFFFFFFFFFFFFFh"], [29, "jmp locret_401623"], [30, "mov rax, [rbp+var_18]"], [31, "mov rdx, [rax+8]"], [32, "mov rax, [rbp+var_18]"], [33, "mov rcx, [rax+10h]"], [34, "mov rax, rdx"], [35, "sub rax, rcx"], [36, "mov [rbp+n], rax"], [37, "mov rax, [rbp+n]"], [38, "cmp rax, [rbp+var_20]"], [39, "jb short loc_4014BF"], [40, "mov rax, [rbp+var_18]"], [41, "mov rax, [rax+10h]"], [42, "lea rdx, [rax+20h]"], [43, "mov rax, [rbp+var_18]"], [44, "add rax, rdx"], [45, "lea rdx, [rax+8]"], [46, "mov rax, [rbp+var_28]"], [47, "mov [rax], rdx"], [48, "mov rax, [rbp+var_20]"], [49, "jmp locret_401623"], [50, "mov rax, [rbp+var_18]"], [51, "mov eax, [rax]"], [52, "cmp eax, 0FFFFFFFFh"], [53, "jnz short loc_4014F1"], [54, "mov rax, [rbp+var_18]"], [55, "mov rax, [rax+10h]"], [56, "lea rdx, [rax+20h]"], [57, "mov rax, [rbp+var_18]"], [58, "add rax, rdx"], [59, "lea rdx, [rax+8]"], [60, "mov rax, [rbp+var_28]"], [61, "mov [rax], rdx"], [62, "mov rax, [rbp+n]"], [63, "jmp locret_401623"], [64, "mov rax, [rbp+var_18]"], [65, "mov rax, [rax+10h]"], [66, "lea rdx, [rax+20h]"], [67, "mov rax, [rbp+var_18]"], [68, "add rax, rdx"], [69, "lea rsi, [rax+8]"], [70, "mov rax, [rbp+var_18]"], [71, "lea rcx, [rax+28h]"], [72, "mov rax, [rbp+n]"], [73, "mov rdx, rax"], [74, "mov rdi, rcx"], [75, "call _memmove"], [76, "mov rax, [rbp+var_18]"], [77, "mov rdx, [rax+8]"], [78, "mov rax, [rbp+var_18]"], [79, "mov rax, [rax+10h]"], [80, "sub rdx, rax"], [81, "mov rax, [rbp+var_18]"], [82, "mov [rax+8], rdx"], [83, "mov rax, [rbp+var_18]"], [84, "mov qword ptr [rax+10h], 0"], [85, "mov rax, [rbp+var_18]"], [86, "mov rdx, [rax+18h]"], [87, "mov rax, [rbp+var_18]"], [88, "mov rax, [rax+8]"], [89, "sub rdx, rax"], [90, "mov rax, [rbp+var_18]"], [91, "mov rax, [rax+8]"], [92, "lea rcx, [rax+20h]"], [93, "mov rax, [rbp+var_18]"], [94, "add rax, rcx"], [95, "lea rcx, [rax+8]"], [96, "mov rax, [rbp+var_18]"], [97, "mov eax, [rax]"], [98, "mov rsi, rcx"], [99, "mov edi, eax"], [100, "call _read"], [101, "mov [rbp+var_10], rax"], [102, "cmp [rbp+var_10], 0"], [103, "jns short loc_40159F"], [104, "mov esi, offset aRead_0"], [105, "mov edi, 1"], [106, "mov eax, 0"], [107, "call _err"], [108, "mov rax, [rbp+var_18]"], [109, "mov rdx, [rax+20h]"], [110, "mov rax, [rbp+var_10]"], [111, "add rdx, rax"], [112, "mov rax, [rbp+var_18]"], [113, "mov [rax+20h], rdx"], [114, "cmp [rbp+var_10], 0"], [115, "jnz short loc_4015EC"], [116, "mov rax, [rbp+var_18]"], [117, "mov eax, [rax]"], [118, "mov edi, eax"], [119, "call _close"], [120, "test eax, eax"], [121, "jns short loc_4015E2"], [122, "mov esi, offset aClose_0"], [123, "mov edi, 1"], [124, "mov eax, 0"], [125, "call _err"], [126, "mov rax, [rbp+var_18]"], [127, "mov dword ptr [rax], 0FFFFFFFFh"], [128, "mov rax, [rbp+var_18]"], [129, "mov rdx, [rax+8]"], [130, "mov rax, [rbp+var_10]"], [131, "add rdx, rax"], [132, "mov rax, [rbp+var_18]"], [133, "mov [rax+8], rdx"], [134, "mov rax, [rbp+var_18]"], [135, "lea rdx, [rax+28h]"], [136, "mov rax, [rbp+var_28]"], [137, "mov [rax], rdx"], [138, "mov rax, [rbp+var_18]"], [139, "mov rax, [rax+8]"], [140, "cmp [rbp+var_20], rax"], [141, "cmovbe rax, [rbp+var_20]"], [142, "leave"], [143, "retn"]], "data_dep": [[6, 5], [7, 6], [10, 3], [11, 10], [12, 4], [12, 11], [13, 12], [14, 3], [15, 14], [17, 4], [19, 16], [24, 3], [25, 24], [26, 25], [27, 26], [30, 3], [31, 30], [32, 3], [33, 32], [34, 31], [35, 33], [35, 34], [36, 35], [37, 36], [38, 4], [38, 37], [39, 38], [40, 3], [41, 40], [42, 41], [42, 31], [43, 3], [44, 42], [44, 43], [45, 42], [45, 44], [46, 5], [47, 45], [47, 46], [48, 4], [50, 3], [51, 50], [52, 51], [53, 52], [54, 3], [55, 54], [56, 55], [56, 31], [57, 3], [58, 56], [58, 57], [59, 56], [59, 58], [60, 5], [61, 60], [61, 59], [62, 36], [64, 3], [65, 64], [66, 31], [66, 65], [67, 3], [68, 66], [68, 67], [69, 68], [70, 3], [71, 33], [71, 70], [72, 36], [73, 72], [74, 71], [76, 3], [77, 76], [78, 3], [79, 78], [80, 77], [80, 79], [81, 3], [82, 81], [82, 80], [83, 3], [84, 83], [85, 3], [86, 85], [86, 84], [87, 3], [88, 87], [88, 82], [88, 84], [89, 86], [89, 88], [90, 3], [91, 82], [91, 84], [91, 90], [92, 71], [92, 84], [92, 91], [93, 3], [94, 93], [94, 92], [95, 84], [95, 92], [95, 94], [95, 82], [96, 3], [97, 96], [97, 84], [98, 95], [99, 97], [101, 100], [102, 101], [103, 102], [108, 3], [109, 113], [109, 108], [109, 82], [109, 84], [110, 101], [111, 110], [111, 109], [112, 3], [113, 112], [113, 111], [114, 101], [115, 114], [116, 3], [117, 82], [117, 84], [117, 116], [117, 113], [118, 117], [120, 119], [121, 120], [126, 3], [127, 126], [128, 3], [129, 128], [129, 137], [129, 82], [129, 84], [129, 127], [129, 113], [129, 133], [130, 101], [131, 129], [131, 130], [132, 3], [133, 132], [133, 131], [134, 3], [135, 131], [135, 133], [135, 134], [136, 5], [137, 135], [137, 136], [138, 3], [139, 137], [139, 138], [139, 133], [140, 139], [140, 4], [141, 140], [141, 4], [143, 62], [143, 28], [143, 48], [143, 22], [143, 141], [143, 8]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76_170e0496bcf78b08399ea4fe7ecfa11dc5d7174cef1bfd604cebb4dea72fbd76.jsonl.gz", "strip_func_name": "sub_4013F7", "query": "\n\n\nunsigned __int64 __fastcall sub_4013F7(__int64 a1, size_t a2, _QWORD *a3)\n{\nunsigned __int64 result; // rax\nssize_t v5; // [rsp+20h] [rbp-10h]\nsize_t n; // [rsp+28h] [rbp-8h]\n\nif ( !a3 )\nreturn -1LL;\nif ( a2 <= *(_QWORD *)(a1 + 24) )\n{\nif ( *(_DWORD *)(a1 + 4) )\n{\nresult = -1LL;\n}\nelse\n{\nn = *(_QWORD *)(a1 + 8) - *(_QWORD *)(a1 + 16);\nif ( n < a2 )\n{\nif ( *(_DWORD *)a1 == -1 )\n{\n*a3 = *(_QWORD *)(a1 + 16) + 32LL + a1 + 8;\nresult = n;\n}\nelse\n{\nmemmove((void *)(a1 + 40), (const void *)(*(_QWORD *)(a1 + 16) + 32LL + a1 + 8), n);\n*(_QWORD *)(a1 + 8) -= *(_QWORD *)(a1 + 16);\n*(_QWORD *)(a1 + 16) = 0LL;\nv5 = read(\n*(_DWORD *)a1,\n(void *)(*(_QWORD *)(a1 + 8) + 32LL + a1 + 8),\n*(_QWORD *)(a1 + 24) - *(_QWORD *)(a1 + 8));\nif ( v5 < 0 )\nerr(1, \"read\");\n*(_QWORD *)(a1 + 32) += v5;\nif ( !v5 )\n{\nif ( close(*(_DWORD *)a1) < 0 )\nerr(1, \"close\");\n*(_DWORD *)a1 = -1;\n}\n*(_QWORD *)(a1 + 8) += v5;\n*a3 = a1 + 40;\nresult = *(_QWORD *)(a1 + 8);\nif ( a2 <= result )\nresult = a2;\n}\n}\nelse\n{\n*a3 = *(_QWORD *)(a1 + 16) + 32LL + a1 + 8;\nresult = a2;\n}\n}\n}\nelse\n{\nfprintf(stderr, \"size %zd, io->size %zd\\n\", a2, *(_QWORD *)(a1 + 24));\nresult = -1LL;\n}\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,v5,n,sub_4013F7,]", "hints": "[]", "response": "{'a3': 'buf', 'a1': 'io', 'a2': 'size', 'v5': 'read_sz', 'n': 'rem', 'sub_4013F7': 'handle_read'}"} | [
[
0.823071300983429,
0.7845845222473145,
0.7747886776924133,
0.7652122378349304,
0.7534987926483154,
0.7510553002357483,
0.7420182228088379,
0.7391787767410278,
0.7388771176338196,
0.7368903160095215,
0.7315078377723694,
0.7296735048294067,
0.7280937433242798,
0.7279280424118042,
0.7262132167816162,
0.725253701210022,
0.7226272225379944,
0.7223572731018066,
0.7208511829376221,
0.7208365201950073
],
[
249977,
222690,
3132,
218389,
192590,
85407,
222505,
5766,
248017,
81517,
187441,
108483,
24362,
108170,
22235,
10669,
25327,
97627,
24670,
11258
]
] |
|
create_socket | 492f02c603c6ff3a52a1940c20677e9b5c4dd694a096b81bd2fdc72245459773 | GBert | openwrt-misc | NA | int create_socket(int port) {
int server_sock, optval;
struct sockaddr_in server_addr;
if ((server_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
return SERVER_SOCKET_ERROR;
}
if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
return SERVER_SETSOCKOPT_ERROR;
}
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(port);
server_addr.sin_addr.s_addr = INADDR_ANY;
if (bind(server_sock, (struct sockaddr*)&server_addr, sizeof(server_addr)) != 0) {
return SERVER_BIND_ERROR;
}
if (listen(server_sock, 20) < 0) {
return SERVER_LISTEN_ERROR;
}
return server_sock;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4014B1", "function_addr": 4199601, "binary_name": "492f02c603c6ff3a52a1940c20677e9b5c4dd694a096b81bd2fdc72245459773.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_24], edi"], [4, "mov edx, 0"], [5, "mov esi, 1"], [6, "mov edi, 2"], [7, "call _socket"], [8, "mov [rbp+fd], eax"], [9, "cmp [rbp+fd], 0"], [10, "jns short loc_4014E3"], [11, "mov eax, 0FFFFFFFFh"], [12, "jmp locret_401581"], [13, "lea rdx, [rbp+optval]"], [14, "mov eax, [rbp+fd]"], [15, "mov r8d, 4"], [16, "mov rcx, rdx"], [17, "mov edx, 2"], [18, "mov esi, 1"], [19, "mov edi, eax"], [20, "call _setsockopt"], [21, "test eax, eax"], [22, "jns short loc_40150F"], [23, "mov eax, 0FFFFFFFEh"], [24, "jmp short locret_401581"], [25, "lea rax, [rbp+s]"], [26, "mov edx, 10h"], [27, "mov esi, 0"], [28, "mov rdi, rax"], [29, "call _memset"], [30, "mov [rbp+s], 2"], [31, "mov eax, [rbp+var_24]"], [32, "movzx eax, ax"], [33, "mov edi, eax"], [34, "call _htons"], [35, "mov [rbp+var_1E], ax"], [36, "mov [rbp+var_1C], 0"], [37, "lea rcx, [rbp+s]"], [38, "mov eax, [rbp+fd]"], [39, "mov edx, 10h"], [40, "mov rsi, rcx"], [41, "mov edi, eax"], [42, "call _bind"], [43, "test eax, eax"], [44, "jz short loc_401564"], [45, "mov eax, 0FFFFFFFDh"], [46, "jmp short locret_401581"], [47, "mov eax, [rbp+fd]"], [48, "mov esi, 14h"], [49, "mov edi, eax"], [50, "call _listen"], [51, "test eax, eax"], [52, "jns short loc_40157E"], [53, "mov eax, 0FFFFFFFCh"], [54, "jmp short locret_401581"], [55, "mov eax, [rbp+fd]"], [56, "leave"], [57, "retn"]], "data_dep": [[8, 7], [9, 8], [10, 9], [13, 4], [14, 8], [16, 13], [19, 14], [21, 20], [22, 21], [25, 21], [28, 25], [31, 3], [32, 31], [33, 32], [35, 34], [37, 30], [37, 16], [38, 8], [40, 37], [41, 38], [43, 42], [44, 43], [47, 8], [49, 47], [51, 50], [52, 51], [55, 8], [57, 45], [57, 11], [57, 23], [57, 53], [57, 55]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/492f02c603c6ff3a52a1940c20677e9b5c4dd694a096b81bd2fdc72245459773_492f02c603c6ff3a52a1940c20677e9b5c4dd694a096b81bd2fdc72245459773.jsonl.gz", "strip_func_name": "sub_4014B1", "query": "\n\n\n__int64 __fastcall sub_4014B1(uint16_t a1)\n{\nstruct sockaddr s; // [rsp+10h] [rbp-20h] BYREF\nchar optval[4]; // [rsp+28h] [rbp-8h] BYREF\nint fd; // [rsp+2Ch] [rbp-4h]\n\nfd = socket(2, 1, 0);\nif ( fd < 0 )\nreturn 0xFFFFFFFFLL;\nif ( setsockopt(fd, 1, 2, optval, 4u) < 0 )\nreturn 4294967294LL;\nmemset(&s, 0, sizeof(s));\ns.sa_family = 2;\n*(_WORD *)s.sa_data = htons(a1);\n*(_DWORD *)&s.sa_data[2] = 0;\nif ( bind(fd, &s, 0x10u) )\nreturn 4294967293LL;\nif ( listen(fd, 20) >= 0 )\nreturn (unsigned int)fd;\nreturn 4294967292LL;\n}\n\n\n\nQ:[a1,s,fd,sub_4014B1,]", "hints": "[]", "response": "{'a1': 'port', 's': 'server_addr', 'fd': 'server_sock', 'sub_4014B1': 'create_socket'}"} | [
[
0.8979071378707886,
0.8674517869949341,
0.8601310849189758,
0.8537828922271729,
0.8440866470336914,
0.8345175981521606,
0.8316571116447449,
0.8288584351539612,
0.8279927372932434,
0.8197455406188965,
0.8160549998283386,
0.8076024055480957,
0.8041600584983826,
0.803035318851471,
0.8018136024475098,
0.7921021580696106,
0.7863385677337646,
0.7848434448242188,
0.780816376209259,
0.7800514698028564
],
[
71252,
7909,
158422,
42488,
125873,
29095,
222271,
48715,
198890,
255898,
198420,
78420,
242714,
132366,
60719,
15448,
146325,
97442,
43474,
94941
]
] |
|
gopher_filetype | afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4 | michael-lazar | hn-gopher | NA | char gopher_filetype(state *st, char *file, char magic)
{
FILE *fp;
char buf[BUFSIZE];
char *c;
int i;
/* If it ends with an slash it's a menu */
if (!*file) return st->default_filetype;
if (strlast(file) == '/') return TYPE_MENU;
/* Get file suffix */
if ((c = strrchr(file, '.'))) {
c++;
/* Loop through the filetype array looking for a match*/
for (i = 0; i < st->filetype_count; i++)
if (strcasecmp(st->filetype[i].suffix, c) == MATCH)
return st->filetype[i].type;
}
/* Are we allowed to look inside files? */
if (!magic) return st->default_filetype;
/* Read data from the file */
if ((fp = fopen(file , "r")) == NULL) return st->default_filetype;
i = fread(buf, 1, sizeof(buf) - 1, fp);
buf[i] = '\0';
fclose(fp);
/* GIF images */
if (sstrncmp(buf, "GIF89a") == MATCH ||
sstrncmp(buf, "GIF87a") == MATCH) return TYPE_GIF;
/* JPEG images */
if (sstrncmp(buf, "\377\330\377\340") == MATCH) return TYPE_IMAGE;
/* PNG images */
if (sstrncmp(buf, "\211PNG") == MATCH) return TYPE_IMAGE;
/* mbox */
if (strstr(buf, "\nFrom: ") &&
strstr(buf, "\nSubject: ")) return TYPE_MIME;
/* MIME */
if (strstr(buf, "\nContent-Type: ")) return TYPE_MIME;
/* HTML files */
if (buf[0] == '<' &&
(strstr(buf, "<html") ||
strstr(buf, "<HTML"))) return TYPE_HTML;
/* PDF and PostScript */
if (sstrncmp(buf, "%PDF-") == MATCH ||
sstrncmp(buf, "%!") == MATCH) return TYPE_DOC;
/* compress and gzip */
if (sstrncmp(buf, "\037\235\220") == MATCH ||
sstrncmp(buf, "\037\213\010") == MATCH) return TYPE_GZIP;
/* Unknown content - binary or text? */
if (memchr(buf, '\0', i)) return TYPE_BINARY;
return st->default_filetype;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_405D24", "function_addr": 4218148, "binary_name": "afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 440h"], [3, "mov [rbp+var_428], rdi"], [4, "mov [rbp+s], rsi"], [5, "mov eax, edx"], [6, "mov [rbp+var_434], al"], [7, "mov rax, [rbp+s]"], [8, "movzx eax, byte ptr [rax]"], [9, "test al, al"], [10, "jnz short loc_405D66"], [11, "mov rax, [rbp+var_428]"], [12, "movzx eax, byte ptr [rax+1320h]"], [13, "jmp locret_406096"], [14, "mov rax, [rbp+s]"], [15, "mov rdi, rax"], [16, "call sub_40743F"], [17, "cmp al, 2Fh "], [18, "jnz short loc_405D83"], [19, "mov eax, 31h "], [20, "jmp locret_406096"], [21, "mov rax, [rbp+s]"], [22, "mov esi, 2Eh "], [23, "mov rdi, rax"], [24, "call _strrchr"], [25, "mov [rbp+s2], rax"], [26, "cmp [rbp+s2], 0"], [27, "jz short loc_405E1E"], [28, "add [rbp+s2], 1"], [29, "mov [rbp+var_4], 0"], [30, "jmp short loc_405E0C"], [31, "mov eax, [rbp+var_4]"], [32, "cdqe"], [33, "add rax, 352h"], [34, "shl rax, 4"], [35, "mov rdx, rax"], [36, "mov rax, [rbp+var_428]"], [37, "add rax, rdx"], [38, "lea rdx, [rax+8]"], [39, "mov rax, [rbp+s2]"], [40, "mov rsi, rax"], [41, "mov rdi, rdx"], [42, "call _strcasecmp"], [43, "test eax, eax"], [44, "jnz short loc_405E08"], [45, "mov rdx, [rbp+var_428]"], [46, "mov eax, [rbp+var_4]"], [47, "cdqe"], [48, "add rax, 352h"], [49, "shl rax, 4"], [50, "add rax, rdx"], [51, "add rax, 17h"], [52, "movzx eax, byte ptr [rax]"], [53, "jmp locret_406096"], [54, "add [rbp+var_4], 1"], [55, "mov rax, [rbp+var_428]"], [56, "mov eax, [rax+3D28h]"], [57, "cmp [rbp+var_4], eax"], [58, "jl short loc_405DB0"], [59, "cmp [rbp+var_434], 0"], [60, "jnz short loc_405E3A"], [61, "mov rax, [rbp+var_428]"], [62, "movzx eax, byte ptr [rax+1320h]"], [63, "jmp locret_406096"], [64, "mov rax, [rbp+s]"], [65, "mov esi, offset aR_0"], [66, "mov rdi, rax"], [67, "call _fopen64"], [68, "mov [rbp+stream], rax"], [69, "cmp [rbp+stream], 0"], [70, "jnz short loc_405E6C"], [71, "mov rax, [rbp+var_428]"], [72, "movzx eax, byte ptr [rax+1320h]"], [73, "jmp locret_406096"], [74, "mov rdx, [rbp+stream]"], [75, "lea rax, [rbp+ptr]"], [76, "mov rcx, rdx"], [77, "mov edx, 3FFh"], [78, "mov esi, 1"], [79, "mov rdi, rax"], [80, "call _fread"], [81, "mov [rbp+var_4], eax"], [82, "mov eax, [rbp+var_4]"], [83, "cdqe"], [84, "mov [rbp+rax+ptr], 0"], [85, "mov rax, [rbp+stream]"], [86, "mov rdi, rax"], [87, "call _fclose"], [88, "lea rax, [rbp+ptr]"], [89, "mov edx, 6"], [90, "mov esi, offset aGif89a"], [91, "mov rdi, rax"], [92, "call _strncmp"], [93, "test eax, eax"], [94, "jz short loc_405EE2"], [95, "lea rax, [rbp+ptr]"], [96, "mov edx, 6"], [97, "mov esi, offset aGif87a"], [98, "mov rdi, rax"], [99, "call _strncmp"], [100, "test eax, eax"], [101, "jnz short loc_405EEC"], [102, "mov eax, 67h "], [103, "jmp locret_406096"], [104, "lea rax, [rbp+ptr]"], [105, "mov edx, 4"], [106, "mov esi, offset byte_40B1D8"], [107, "mov rdi, rax"], [108, "call _strncmp"], [109, "test eax, eax"], [110, "jnz short loc_405F13"], [111, "mov eax, 49h "], [112, "jmp locret_406096"], [113, "lea rax, [rbp+ptr]"], [114, "mov edx, 4"], [115, "mov esi, offset byte_40B1DD"], [116, "mov rdi, rax"], [117, "call _strncmp"], [118, "test eax, eax"], [119, "jnz short loc_405F3A"], [120, "mov eax, 49h "], [121, "jmp locret_406096"], [122, "lea rax, [rbp+ptr]"], [123, "mov esi, offset aFrom"], [124, "mov rdi, rax"], [125, "call _strstr"], [126, "test rax, rax"], [127, "jz short loc_405F76"], [128, "lea rax, [rbp+ptr]"], [129, "mov esi, offset aSubject"], [130, "mov rdi, rax"], [131, "call _strstr"], [132, "test rax, rax"], [133, "jz short loc_405F76"], [134, "mov eax, 4Dh "], [135, "jmp locret_406096"], [136, "lea rax, [rbp+ptr]"], [137, "mov esi, offset aContentType"], [138, "mov rdi, rax"], [139, "call _strstr"], [140, "test rax, rax"], [141, "jz short loc_405F99"], [142, "mov eax, 4Dh "], [143, "jmp locret_406096"], [144, "movzx eax, [rbp+ptr]"], [145, "cmp al, 3Ch "], [146, "jnz short loc_405FE0"], [147, "lea rax, [rbp+ptr]"], [148, "mov esi, offset aHtml"], [149, "mov rdi, rax"], [150, "call _strstr"], [151, "test rax, rax"], [152, "jnz short loc_405FD6"], [153, "lea rax, [rbp+ptr]"], [154, "mov esi, offset aHtml_0"], [155, "mov rdi, rax"], [156, "call _strstr"], [157, "test rax, rax"], [158, "jz short loc_405FE0"], [159, "mov eax, 68h "], [160, "jmp locret_406096"], [161, "lea rax, [rbp+ptr]"], [162, "mov edx, 5"], [163, "mov esi, offset aPdf"], [164, "mov rdi, rax"], [165, "call _strncmp"], [166, "test eax, eax"], [167, "jz short loc_40601A"], [168, "lea rax, [rbp+ptr]"], [169, "mov edx, 2"], [170, "mov esi, offset asc_40B217"], [171, "mov rdi, rax"], [172, "call _strncmp"], [173, "test eax, eax"], [174, "jnz short loc_406021"], [175, "mov eax, 64h "], [176, "jmp short locret_406096"], [177, "lea rax, [rbp+ptr]"], [178, "mov edx, 3"], [179, "mov esi, offset byte_40B21A"], [180, "mov rdi, rax"], [181, "call _strncmp"], [182, "test eax, eax"], [183, "jz short loc_40605B"], [184, "lea rax, [rbp+ptr]"], [185, "mov edx, 3"], [186, "mov esi, offset byte_40B21E"], [187, "mov rdi, rax"], [188, "call _strncmp"], [189, "test eax, eax"], [190, "jnz short loc_406062"], [191, "mov eax, 35h "], [192, "jmp short locret_406096"], [193, "mov eax, [rbp+var_4]"], [194, "movsxd rdx, eax"], [195, "lea rax, [rbp+ptr]"], [196, "mov esi, 0"], [197, "mov rdi, rax"], [198, "call _memchr"], [199, "test rax, rax"], [200, "jz short loc_406088"], [201, "mov eax, 39h "], [202, "jmp short locret_406096"], [203, "mov rax, [rbp+var_428]"], [204, "movzx eax, byte ptr [rax+1320h]"], [205, "leave"], [206, "retn"]], "data_dep": [[6, 5], [7, 4], [8, 7], [9, 8], [10, 9], [11, 3], [12, 11], [14, 4], [15, 14], [17, 16], [18, 17], [21, 4], [23, 21], [25, 24], [26, 25], [27, 26], [28, 25], [31, 29], [31, 54], [33, 31], [34, 33], [35, 34], [36, 3], [37, 35], [37, 36], [38, 35], [38, 37], [39, 28], [40, 39], [41, 38], [43, 42], [44, 43], [45, 3], [46, 54], [46, 29], [48, 46], [49, 48], [50, 45], [50, 49], [51, 50], [52, 51], [54, 54], [54, 29], [55, 3], [56, 55], [57, 54], [57, 29], [57, 56], [58, 57], [59, 6], [60, 59], [61, 3], [62, 61], [64, 4], [66, 64], [68, 67], [69, 68], [70, 69], [71, 3], [72, 71], [74, 68], [75, 67], [76, 74], [79, 75], [81, 80], [82, 81], [84, 82], [85, 68], [86, 85], [88, 87], [91, 88], [93, 92], [94, 93], [95, 93], [98, 95], [100, 99], [101, 100], [104, 100], [107, 104], [109, 108], [110, 109], [113, 109], [116, 113], [118, 117], [119, 118], [122, 118], [124, 122], [126, 125], [127, 126], [128, 126], [130, 128], [132, 131], [133, 132], [136, 132], [136, 126], [138, 136], [140, 139], [141, 140], [145, 144], [146, 145], [147, 144], [149, 147], [151, 150], [152, 151], [153, 151], [155, 153], [157, 156], [158, 157], [161, 157], [161, 144], [164, 161], [166, 165], [167, 166], [168, 166], [171, 168], [173, 172], [174, 173], [177, 173], [180, 177], [182, 181], [183, 182], [184, 182], [187, 184], [189, 188], [190, 189], [193, 81], [194, 193], [195, 193], [197, 195], [199, 198], [200, 199], [203, 3], [204, 203], [206, 52], [206, 102], [206, 111], [206, 175], [206, 159], [206, 134], [206, 72], [206, 191], [206, 120], [206, 19], [206, 12], [206, 204], [206, 142], [206, 62], [206, 201]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4_afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.jsonl.gz", "strip_func_name": "sub_405D24", "query": "\n\n\n__int64 __fastcall sub_405D24(__int64 a1, const char *a2, char a3)\n{\nchar ptr[1032]; // [rsp+20h] [rbp-420h] BYREF\nFILE *stream; // [rsp+428h] [rbp-18h]\nchar *s2; // [rsp+430h] [rbp-10h]\nint i; // [rsp+43Ch] [rbp-4h]\n\nif ( !*a2 )\nreturn *(unsigned __int8 *)(a1 + 4896);\nif ( (unsigned __int8)sub_40743F(a2) == 47 )\nreturn 49LL;\ns2 = strrchr(a2, 46);\nif ( s2 )\n{\n++s2;\nfor ( i = 0; i < *(_DWORD *)(a1 + 15656); ++i )\n{\nif ( !strcasecmp((const char *)(16 * (i + 850LL) + a1 + 8), s2) )\nreturn *(unsigned __int8 *)(a1 + 16 * (i + 850LL) + 23);\n}\n}\nif ( !a3 )\nreturn *(unsigned __int8 *)(a1 + 4896);\nstream = fopen64(a2, \"r\");\nif ( !stream )\nreturn *(unsigned __int8 *)(a1 + 4896);\ni = fread(ptr, 1uLL, 0x3FFuLL, stream);\nptr[i] = 0;\nfclose(stream);\nif ( !strncmp(ptr, \"GIF89a\", 6uLL) || !strncmp(ptr, \"GIF87a\", 6uLL) )\nreturn 103LL;\nif ( !strncmp(ptr, &byte_40B1D8, 4uLL) )\nreturn 73LL;\nif ( !strncmp(ptr, &byte_40B1DD, 4uLL) )\nreturn 73LL;\nif ( strstr(ptr, \"\\nFrom: \") && strstr(ptr, \"\\nSubject: \") )\nreturn 77LL;\nif ( strstr(ptr, \"\\nContent-Type: \") )\nreturn 77LL;\nif ( ptr[0] == 60 && (strstr(ptr, \"<html\") || strstr(ptr, \"<HTML\")) )\nreturn 104LL;\nif ( !strncmp(ptr, \"%PDF-\", 5uLL) || !strncmp(ptr, \"%!\", 2uLL) )\nreturn 100LL;\nif ( !strncmp(ptr, &byte_40B21A, 3uLL) || !strncmp(ptr, &byte_40B21E, 3uLL) )\nreturn 53LL;\nif ( memchr(ptr, 0, i) )\nreturn 57LL;\nreturn *(unsigned __int8 *)(a1 + 4896);\n}\n\n\n\nQ:[a3,a1,a2,ptr,stream,s2,sub_405D24,sub_40743F,]", "hints": "[]", "response": "{'a3': 'magic', 'a1': 'st', 'a2': 'file', 'ptr': 'buf', 'stream': 'fp', 's2': 'c', 'sub_405D24': 'gopher_filetype', 'sub_40743F': 'strlast'}"} | [
[
0.7593088150024414,
0.6873197555541992,
0.6636549234390259,
0.6508887410163879,
0.6460358500480652,
0.6455971598625183,
0.6394603848457336,
0.6333043575286865,
0.6282431483268738,
0.626306414604187,
0.6262606978416443,
0.6242570877075195,
0.6235923767089844,
0.6197201013565063,
0.6177140474319458,
0.6175582408905029,
0.6165676116943359,
0.6159448027610779,
0.6139110326766968,
0.6132477521896362
],
[
92375,
211834,
188282,
76763,
249401,
113751,
191298,
251601,
255538,
166191,
261776,
108968,
253221,
3307,
72957,
186838,
125017,
46865,
46491,
83372
]
] |
|
extract_raw | c137d2e1de0eb5fa8b6d0867b12f020688b47a2ce12e25753c30d5076b60dbca | yquake2 | pakextract | NA | static void
extract_raw(FILE* in, directory *d)
{
FILE* out = fopen(d->file_name, "w");
if (out == NULL)
{
perror("Could open the outputfile");
return;
}
// just copy the data from the .pak to the output file (in chunks for speed)
int bytes_left = d->file_length;
char buf[2048];
fseek(in, d->file_pos, SEEK_SET);
while(bytes_left >= sizeof(buf))
{
fread(buf, sizeof(buf), 1, in);
fwrite(buf, sizeof(buf), 1, out);
bytes_left -= sizeof(buf);
}
if(bytes_left > 0)
{
fread(buf, bytes_left, 1, in);
fwrite(buf, bytes_left, 1, out);
}
fclose(out);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401ACC", "function_addr": 4201164, "binary_name": "c137d2e1de0eb5fa8b6d0867b12f020688b47a2ce12e25753c30d5076b60dbca.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 820h"], [3, "mov [rbp+stream], rdi"], [4, "mov [rbp+filename], rsi"], [5, "mov rax, [rbp+filename]"], [6, "mov esi, offset modes"], [7, "mov rdi, rax"], [8, "call _fopen"], [9, "mov [rbp+s], rax"], [10, "cmp [rbp+s], 0"], [11, "jnz short loc_401B13"], [12, "mov edi, offset aCouldOpenTheOu"], [13, "call _perror"], [14, "jmp locret_401BF5"], [15, "mov rax, [rbp+filename]"], [16, "mov eax, [rax+7Ch]"], [17, "mov [rbp+var_4], eax"], [18, "mov rax, [rbp+filename]"], [19, "mov eax, [rax+78h]"], [20, "movsxd rcx, eax"], [21, "mov rax, [rbp+stream]"], [22, "mov edx, 0"], [23, "mov rsi, rcx"], [24, "mov rdi, rax"], [25, "call _fseek"], [26, "jmp short loc_401B94"], [27, "mov rdx, [rbp+stream]"], [28, "lea rax, [rbp+ptr]"], [29, "mov rcx, rdx"], [30, "mov edx, 1"], [31, "mov esi, 800h"], [32, "mov rdi, rax"], [33, "call _fread"], [34, "mov rdx, [rbp+s]"], [35, "lea rax, [rbp+ptr]"], [36, "mov rcx, rdx"], [37, "mov edx, 1"], [38, "mov esi, 800h"], [39, "mov rdi, rax"], [40, "call _fwrite"], [41, "mov eax, [rbp+var_4]"], [42, "sub eax, 800h"], [43, "mov [rbp+var_4], eax"], [44, "mov eax, [rbp+var_4]"], [45, "cmp eax, 7FFh"], [46, "ja short loc_401B46"], [47, "cmp [rbp+var_4], 0"], [48, "jle short loc_401BE9"], [49, "mov eax, [rbp+var_4]"], [50, "movsxd rsi, eax"], [51, "mov rdx, [rbp+stream]"], [52, "lea rax, [rbp+ptr]"], [53, "mov rcx, rdx"], [54, "mov edx, 1"], [55, "mov rdi, rax"], [56, "call _fread"], [57, "mov eax, [rbp+var_4]"], [58, "movsxd rsi, eax"], [59, "mov rdx, [rbp+s]"], [60, "lea rax, [rbp+ptr]"], [61, "mov rcx, rdx"], [62, "mov edx, 1"], [63, "mov rdi, rax"], [64, "call _fwrite"], [65, "mov rax, [rbp+s]"], [66, "mov rdi, rax"], [67, "call _fclose"], [68, "leave"], [69, "retn"]], "data_dep": [[5, 4], [7, 5], [9, 8], [10, 9], [11, 10], [15, 4], [16, 15], [17, 16], [18, 4], [19, 18], [20, 19], [21, 3], [23, 20], [24, 21], [27, 3], [28, 44], [29, 27], [32, 28], [34, 9], [35, 33], [36, 34], [39, 35], [41, 43], [41, 17], [42, 41], [43, 42], [44, 17], [44, 43], [45, 44], [46, 45], [47, 43], [47, 17], [48, 47], [49, 43], [49, 17], [50, 49], [51, 3], [52, 49], [53, 51], [55, 52], [57, 17], [57, 43], [58, 57], [59, 9], [60, 57], [61, 59], [63, 60], [65, 9], [66, 65], [69, 13], [69, 67]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/c137d2e1de0eb5fa8b6d0867b12f020688b47a2ce12e25753c30d5076b60dbca_c137d2e1de0eb5fa8b6d0867b12f020688b47a2ce12e25753c30d5076b60dbca.jsonl.gz", "strip_func_name": "sub_401ACC", "query": "\n\n\nvoid __fastcall sub_401ACC(FILE *a1, __int64 a2)\n{\nchar ptr[2048]; // [rsp+10h] [rbp-810h] BYREF\nFILE *s; // [rsp+810h] [rbp-10h]\nunsigned int v4; // [rsp+81Ch] [rbp-4h]\n\ns = fopen((const char *)a2, \"w\");\nif ( s )\n{\nv4 = *(_DWORD *)(a2 + 124);\nfseek(a1, *(int *)(a2 + 120), 0);\nwhile ( v4 > 0x7FF )\n{\nfread(ptr, 0x800uLL, 1uLL, a1);\nfwrite(ptr, 0x800uLL, 1uLL, s);\nv4 -= 2048;\n}\nif ( (int)v4 > 0 )\n{\nfread(ptr, (int)v4, 1uLL, a1);\nfwrite(ptr, (int)v4, 1uLL, s);\n}\nfclose(s);\n}\nelse\n{\nperror(\"Could open the outputfile\");\n}\n}\n\n\n\nQ:[a1,a2,ptr,s,v4,sub_401ACC,]", "hints": "[]", "response": "{'a1': 'in', 'a2': 'd', 'ptr': 'buf', 's': 'out', 'v4': 'bytes_left', 'sub_401ACC': 'extract_raw'}"} | [
[
0.8089211583137512,
0.7800745964050293,
0.7721959948539734,
0.7626118063926697,
0.7508581280708313,
0.7505750060081482,
0.7488365173339844,
0.7483552694320679,
0.7454472780227661,
0.7391782999038696,
0.7390351891517639,
0.7307125926017761,
0.7262872457504272,
0.7261523008346558,
0.7235023975372314,
0.7202032804489136,
0.7201685309410095,
0.7200199365615845,
0.7196729779243469,
0.7192853093147278
],
[
139629,
119652,
91975,
109039,
116087,
103998,
80801,
136257,
83481,
141133,
241707,
132502,
70252,
244628,
37134,
41443,
221581,
85760,
252762,
136063
]
] |
|
serial_init | 4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab | GBert | openwrt-misc | NA | void
serial_init(char *_port, int baud)
{
int lockf;
char *portbase;
struct termios attr;
saved_baud = baud;
baud = baud_to_baud (baud);
if (!_port)
_port = "/dev/ttyUSB0";
portbase = strrchr(_port, '/');
if (portbase == 0)
portbase = _port;
else
portbase ++;
lockn = (char *) malloc (strlen(portbase) + 16);
sprintf(lockn, "/var/lock/LCK..%s", portbase);
lockf = open(lockn, O_RDWR|O_CREAT|O_EXCL, 0666);
if (lockf < 0)
{
printf("cannot lock %s - is someone else using it?\n", _port);
printf("lock %s\n", lockn);
perror("The error was");
exit(1);
}
port = _port;
fd = open(port, O_RDWR|O_NOCTTY|O_NDELAY);
if (fd < 0)
{
printf("can't open %s\n", port);
perror("The error was");
exit(1);
}
atexit (serial_close);
fcntl(fd, F_SETFL, 0);
/* Reset by DTR - might work :-) */
tcgetattr(fd, &attr);
cfsetispeed(&attr, 0);
cfsetospeed(&attr, 0);
tcsetattr(fd, TCSAFLUSH, &attr);
usleep(3*1000);
tcgetattr(fd, &attr);
cfsetispeed(&attr, baud);
cfsetospeed(&attr, baud);
cfmakeraw(&attr);
if (rx_stick)
set_stick_mode (1);
attr.c_iflag &= ~(IXON | IXOFF | IXANY);
attr.c_iflag |= IGNBRK;
attr.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
attr.c_cflag &= ~(PARENB | CSIZE | CRTSCTS);
attr.c_cflag |= CS8 | CLOCAL | CSTOPB;
attr.c_cc[VTIME] = 5;
tcsetattr(fd, TCSANOW, &attr);
/* 1 mSec delay to let board "wake up" after reset */
usleep(3*1000);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_405E16", "function_addr": 4218390, "binary_name": "4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 60h"], [3, "mov [rbp+s], rdi"], [4, "mov [rbp+speed], esi"], [5, "mov eax, [rbp+speed]"], [6, "mov cs:dword_40AF9C, eax"], [7, "mov eax, [rbp+speed]"], [8, "mov edi, eax"], [9, "call sub_405B11"], [10, "mov [rbp+speed], eax"], [11, "cmp [rbp+s], 0"], [12, "jnz short loc_405E4A"], [13, "mov [rbp+s], offset aDevTtyusb0"], [14, "mov rax, [rbp+s]"], [15, "mov esi, 2Fh "], [16, "mov rdi, rax"], [17, "call _strrchr"], [18, "mov [rbp+var_8], rax"], [19, "cmp [rbp+var_8], 0"], [20, "jnz short loc_405E70"], [21, "mov rax, [rbp+s]"], [22, "mov [rbp+var_8], rax"], [23, "jmp short loc_405E75"], [24, "add [rbp+var_8], 1"], [25, "mov rax, [rbp+var_8]"], [26, "mov rdi, rax"], [27, "call _strlen"], [28, "add rax, 10h"], [29, "mov rdi, rax"], [30, "call _malloc"], [31, "mov cs:file, rax"], [32, "mov rax, cs:file"], [33, "mov rdx, [rbp+var_8]"], [34, "mov esi, offset aVarLockLckS"], [35, "mov rdi, rax"], [36, "mov eax, 0"], [37, "call _sprintf"], [38, "mov rax, cs:file"], [39, "mov edx, 1B6h"], [40, "mov esi, 0C2h"], [41, "mov rdi, rax"], [42, "mov eax, 0"], [43, "call _open"], [44, "mov [rbp+var_C], eax"], [45, "cmp [rbp+var_C], 0"], [46, "jns short loc_405F1B"], [47, "mov rax, [rbp+s]"], [48, "mov rsi, rax"], [49, "mov edi, offset aCannotLockSIsS"], [50, "mov eax, 0"], [51, "call _printf"], [52, "mov rax, cs:file"], [53, "mov rsi, rax"], [54, "mov edi, offset aLockS"], [55, "mov eax, 0"], [56, "call _printf"], [57, "mov edi, offset aTheErrorWas"], [58, "call _perror"], [59, "mov edi, 1"], [60, "call _exit"], [61, "mov rax, [rbp+s]"], [62, "mov cs:qword_40AF90, rax"], [63, "mov rax, cs:qword_40AF90"], [64, "mov esi, 902h"], [65, "mov rdi, rax"], [66, "mov eax, 0"], [67, "call _open"], [68, "mov cs:fd, eax"], [69, "mov eax, cs:fd"], [70, "test eax, eax"], [71, "jns short loc_405F7C"], [72, "mov rax, cs:qword_40AF90"], [73, "mov rsi, rax"], [74, "mov edi, offset aCanTOpenS"], [75, "mov eax, 0"], [76, "call _printf"], [77, "mov edi, offset aTheErrorWas"], [78, "call _perror"], [79, "mov edi, 1"], [80, "call _exit"], [81, "mov edi, offset sub_405DBA"], [82, "call sub_406610"], [83, "mov eax, cs:fd"], [84, "mov edx, 0"], [85, "mov esi, 4"], [86, "mov edi, eax"], [87, "mov eax, 0"], [88, "call _fcntl"], [89, "mov eax, cs:fd"], [90, "lea rdx, [rbp+termios_p]"], [91, "mov rsi, rdx"], [92, "mov edi, eax"], [93, "call _tcgetattr"], [94, "lea rax, [rbp+termios_p]"], [95, "mov esi, 0"], [96, "mov rdi, rax"], [97, "call _cfsetispeed"], [98, "lea rax, [rbp+termios_p]"], [99, "mov esi, 0"], [100, "mov rdi, rax"], [101, "call _cfsetospeed"], [102, "mov eax, cs:fd"], [103, "lea rdx, [rbp+termios_p]"], [104, "mov esi, 2"], [105, "mov edi, eax"], [106, "call _tcsetattr"], [107, "mov edi, 0BB8h"], [108, "call _usleep"], [109, "mov eax, cs:fd"], [110, "lea rdx, [rbp+termios_p]"], [111, "mov rsi, rdx"], [112, "mov edi, eax"], [113, "call _tcgetattr"], [114, "mov edx, [rbp+speed]"], [115, "lea rax, [rbp+termios_p]"], [116, "mov esi, edx"], [117, "mov rdi, rax"], [118, "call _cfsetispeed"], [119, "mov edx, [rbp+speed]"], [120, "lea rax, [rbp+termios_p]"], [121, "mov esi, edx"], [122, "mov rdi, rax"], [123, "call _cfsetospeed"], [124, "lea rax, [rbp+termios_p]"], [125, "mov rdi, rax"], [126, "call _cfmakeraw"], [127, "mov eax, cs:dword_40AFA4"], [128, "test eax, eax"], [129, "jz short loc_40604E"], [130, "mov edi, 1"], [131, "call sub_405CD3"], [132, "mov eax, [rbp+termios_p.c_iflag]"], [133, "and ah, 0E3h"], [134, "mov [rbp+termios_p.c_iflag], eax"], [135, "mov eax, [rbp+termios_p.c_iflag]"], [136, "or eax, 1"], [137, "mov [rbp+termios_p.c_iflag], eax"], [138, "mov eax, [rbp+termios_p.c_lflag]"], [139, "and eax, 0FFFFFFE4h"], [140, "mov [rbp+termios_p.c_lflag], eax"], [141, "mov eax, [rbp+termios_p.c_cflag]"], [142, "and eax, 7FFFFECFh"], [143, "mov [rbp+termios_p.c_cflag], eax"], [144, "mov eax, [rbp+termios_p.c_cflag]"], [145, "or eax, 870h"], [146, "mov [rbp+termios_p.c_cflag], eax"], [147, "mov [rbp+termios_p.c_cc+5], 5"], [148, "mov eax, cs:fd"], [149, "lea rdx, [rbp+termios_p]"], [150, "mov esi, 0"], [151, "mov edi, eax"], [152, "call _tcsetattr"], [153, "mov edi, 0BB8h"], [154, "call _usleep"], [155, "nop"], [156, "leave"], [157, "retn"]], "data_dep": [[5, 4], [6, 5], [7, 4], [8, 7], [10, 9], [11, 3], [12, 11], [14, 13], [14, 3], [16, 14], [18, 17], [19, 18], [20, 19], [21, 13], [21, 3], [22, 21], [24, 18], [25, 22], [25, 24], [26, 25], [28, 27], [29, 28], [31, 30], [32, 31], [33, 22], [33, 24], [35, 32], [38, 31], [41, 38], [44, 43], [45, 44], [46, 45], [47, 13], [47, 3], [48, 47], [52, 31], [53, 52], [61, 3], [61, 13], [62, 61], [63, 62], [65, 63], [68, 67], [69, 68], [70, 69], [71, 70], [72, 62], [73, 72], [83, 68], [86, 83], [89, 68], [90, 84], [91, 90], [92, 89], [94, 93], [96, 94], [98, 97], [100, 98], [102, 68], [103, 90], [105, 102], [109, 68], [110, 103], [111, 110], [112, 109], [114, 10], [115, 113], [116, 114], [117, 115], [119, 10], [120, 118], [121, 119], [122, 120], [124, 123], [125, 124], [128, 127], [129, 128], [133, 132], [134, 133], [135, 134], [136, 135], [137, 136], [139, 138], [140, 139], [142, 141], [143, 142], [144, 143], [145, 144], [146, 145], [148, 68], [149, 119], [151, 148], [157, 154]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab_4cd3942ee2150d1998d8164c708fe5a3ee2f80f2a0cf82e96663577c51402bab.jsonl.gz", "strip_func_name": "sub_405E16", "query": "\n\n\nint __fastcall sub_405E16(char *a1, int a2)\n{\nsize_t v2; // rax\ntcflag_t v3; // eax\nspeed_t speed; // [rsp+4h] [rbp-5Ch]\nchar *s; // [rsp+8h] [rbp-58h]\nstruct termios termios_p; // [rsp+10h] [rbp-50h] BYREF\nint v8; // [rsp+54h] [rbp-Ch]\nchar *v9; // [rsp+58h] [rbp-8h]\n\ns = a1;\ndword_40AF9C = a2;\nspeed = sub_405B11(a2);\nif ( !a1 )\ns = \"/dev/ttyUSB0\";\nv9 = strrchr(s, 47);\nif ( v9 )\n++v9;\nelse\nv9 = s;\nv2 = strlen(v9);\nfile = (char *)malloc(v2 + 16);\nsprintf(file, \"/var/lock/LCK..%s\", v9);\nv8 = open(file, 194, 438LL);\nif ( v8 < 0 )\n{\nprintf(\"cannot lock %s - is someone else using it?\\n\", s);\nprintf(\"lock %s\\n\", file);\nperror(\"The error was\");\nexit(1);\n}\nqword_40AF90 = s;\nfd = open(s, 2306);\nif ( fd < 0 )\n{\nprintf(\"can't open %s\\n\", qword_40AF90);\nperror(\"The error was\");\nexit(1);\n}\nsub_406610(sub_405DBA);\nfcntl(fd, 4, 0LL);\ntcgetattr(fd, &termios_p);\ncfsetispeed(&termios_p, 0);\ncfsetospeed(&termios_p, 0);\ntcsetattr(fd, 2, &termios_p);\nusleep(0xBB8u);\ntcgetattr(fd, &termios_p);\ncfsetispeed(&termios_p, speed);\ncfsetospeed(&termios_p, speed);\ncfmakeraw(&termios_p);\nif ( dword_40AFA4 )\nsub_405CD3(1u);\nv3 = termios_p.c_iflag;\nBYTE1(v3) = BYTE1(termios_p.c_iflag) & 0xE3;\ntermios_p.c_iflag = v3 | 1;\ntermios_p.c_lflag &= 0xFFFFFFE4;\ntermios_p.c_cflag = termios_p.c_cflag & 0x7FFFFECF | 0x870;\ntermios_p.c_cc[5] = 5;\ntcsetattr(fd, 0, &termios_p);\nreturn usleep(0xBB8u);\n}\n\n\n\nQ:[a1,a2,speed,s,termios_p,v8,v9,sub_405E16,sub_405B11,sub_406610,sub_405CD3,]", "hints": "[]", "response": "{'a1': '_port', 'a2': 'baud', 'speed': 'bauda', 's': '_porta', 'termios_p': 'attr', 'v8': 'lockf', 'v9': 'portbase', 'sub_405E16': 'serial_init', 'sub_405B11': 'baud_to_baud', 'sub_406610': 'atexit', 'sub_405CD3': 'set_stick_mode'}"} | [
[
0.7755357623100281,
0.7732066512107849,
0.770455539226532,
0.7634721994400024,
0.7633117437362671,
0.758129894733429,
0.7550176382064819,
0.7548052668571472,
0.7527705430984497,
0.7501437664031982,
0.7500981092453003,
0.7462342977523804,
0.7445937991142273,
0.7437254190444946,
0.7422515153884888,
0.7406144142150879,
0.7393151521682739,
0.7384875416755676,
0.73807692527771,
0.7366775274276733
],
[
229573,
208648,
213719,
196735,
220779,
221729,
215554,
192966,
99868,
163817,
105732,
147460,
242681,
72714,
104789,
187194,
175538,
244574,
204202,
151584
]
] |
|
read_until | 25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c | legitbs | quals-2013 | NA | void read_until(int sock, char *buffer, int max) {
int i = 0;
char local_char[2];
int n;
alarm(5);
while ((n = read(sock,local_char,1)) == 1) {
if (local_char[0] == '\n' || i == max) {
break;
}
buffer[i++] = local_char[0];
}
buffer[i] = '\0';
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401743", "function_addr": 4200259, "binary_name": "25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+fd], edi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_18], edx"], [6, "mov [rbp+var_4], 0"], [7, "mov edi, 5"], [8, "call _alarm"], [9, "jmp short loc_401791"], [10, "movzx eax, [rbp+buf]"], [11, "cmp al, 0Ah"], [12, "jz short loc_4017B0"], [13, "mov eax, [rbp+var_4]"], [14, "cmp eax, [rbp+var_18]"], [15, "jz short loc_4017B0"], [16, "mov eax, [rbp+var_4]"], [17, "lea edx, [rax+1]"], [18, "mov [rbp+var_4], edx"], [19, "movsxd rdx, eax"], [20, "mov rax, [rbp+var_20]"], [21, "add rdx, rax"], [22, "movzx eax, [rbp+buf]"], [23, "mov [rdx], al"], [24, "lea rcx, [rbp+buf]"], [25, "mov eax, [rbp+fd]"], [26, "mov edx, 1"], [27, "mov rsi, rcx"], [28, "mov edi, eax"], [29, "call _read"], [30, "mov [rbp+var_8], eax"], [31, "cmp [rbp+var_8], 1"], [32, "jz short loc_401768"], [33, "mov eax, [rbp+var_4]"], [34, "movsxd rdx, eax"], [35, "mov rax, [rbp+var_20]"], [36, "add rax, rdx"], [37, "mov byte ptr [rax], 0"], [38, "nop"], [39, "leave"], [40, "retn"]], "data_dep": [[11, 10], [12, 11], [13, 6], [13, 18], [14, 13], [14, 5], [15, 14], [16, 6], [16, 18], [17, 23], [17, 26], [17, 16], [18, 17], [19, 16], [20, 4], [21, 19], [21, 20], [23, 22], [23, 21], [24, 24], [25, 3], [27, 24], [28, 25], [30, 29], [31, 30], [32, 31], [33, 6], [33, 18], [34, 33], [35, 4], [36, 34], [36, 35], [37, 36], [40, 36]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c_25ec39413e2f65f5e1a6091047d0e7999693cb21acbac6a99bf5134f1c22669c.jsonl.gz", "strip_func_name": "sub_401743", "query": "\n\n\n_BYTE *__fastcall sub_401743(int a1, __int64 a2, int a3)\n{\nint v3; // eax\n_BYTE *result; // rax\nchar buf[2]; // [rsp+16h] [rbp-Ah] BYREF\nint v7; // [rsp+18h] [rbp-8h]\nint v8; // [rsp+1Ch] [rbp-4h]\n\nv8 = 0;\nalarm(5u);\nwhile ( 1 )\n{\nv7 = read(a1, buf, 1uLL);\nif ( v7 != 1 || buf[0] == 10 || v8 == a3 )\nbreak;\nv3 = v8++;\n*(_BYTE *)(a2 + v3) = buf[0];\n}\nresult = (_BYTE *)(v8 + a2);\n*result = 0;\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,buf,v7,sub_401743,]", "hints": "[]", "response": "{'a3': 'max', 'a1': 'sock', 'a2': 'buffer', 'buf': 'local_char', 'v7': 'n', 'sub_401743': 'read_until'}"} | [
[
0.7197158336639404,
0.7135162353515625,
0.701075553894043,
0.6979888677597046,
0.6907708644866943,
0.6868765354156494,
0.6848574280738831,
0.6696202754974365,
0.6572504639625549,
0.6563689708709717,
0.6554274559020996,
0.6549121141433716,
0.6538608074188232,
0.6532073020935059,
0.6518892645835876,
0.6512462496757507,
0.6466727256774902,
0.6466066837310791,
0.6454756259918213,
0.644004225730896
],
[
170156,
140666,
51985,
243311,
145608,
186400,
93233,
1586,
34296,
19547,
106893,
99134,
207215,
209039,
12270,
260464,
9288,
93000,
131530,
200524
]
] |
|
m_log10 | 7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807 | arendst | Tasmota | NA | static int m_log10(bvm *vm)
{
if (be_top(vm) >= 1 && be_isnumber(vm, 1)) {
breal x = be_toreal(vm, 1);
be_pushreal(vm, mathfunc(log10)(x));
} else {
be_pushreal(vm, (breal)0.0);
}
be_return(vm);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_427EB8", "function_addr": 4357816, "binary_name": "7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov rax, [rbp+var_18]"], [5, "mov rdi, rax"], [6, "call be_top"], [7, "test eax, eax"], [8, "jle short loc_427F23"], [9, "mov rax, [rbp+var_18]"], [10, "mov esi, 1"], [11, "mov rdi, rax"], [12, "call be_isnumber"], [13, "test al, al"], [14, "jz short loc_427F23"], [15, "mov rax, [rbp+var_18]"], [16, "mov esi, 1"], [17, "mov rdi, rax"], [18, "call be_toreal"], [19, "movd eax, xmm0"], [20, "mov [rbp+x], eax"], [21, "mov eax, [rbp+x]"], [22, "movd xmm0, eax"], [23, "call _log10f"], [24, "movd eax, xmm0"], [25, "mov rdx, [rbp+var_18]"], [26, "movd xmm0, eax"], [27, "mov rdi, rdx"], [28, "call be_pushreal"], [29, "jmp short loc_427F33"], [30, "mov rax, [rbp+var_18]"], [31, "pxor xmm0, xmm0"], [32, "mov rdi, rax"], [33, "call be_pushreal"], [34, "mov rax, [rbp+var_18]"], [35, "mov rdi, rax"], [36, "call be_returnvalue"], [37, "leave"], [38, "retn"]], "data_dep": [[4, 3], [5, 4], [7, 6], [8, 7], [9, 3], [11, 9], [13, 12], [14, 13], [15, 3], [17, 15], [20, 19], [21, 20], [22, 21], [24, 22], [25, 3], [26, 24], [27, 25], [30, 3], [32, 30], [34, 3], [35, 34], [38, 36]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807_7c16ecc1f4177280f9c554334c74c60179f6cbd74ce0674df9f0cc7c89723807.jsonl.gz", "strip_func_name": "sub_427EB8", "query": "\n\n\n__int64 __fastcall sub_427EB8(__int64 a1, __m128i a2)\n{\n__m128i v2; // xmm0\n\nif ( (int)be_top(a1) > 0 && be_isnumber(a1, 1u) )\n{\na2.m128i_u64[0] = (unsigned __int64)be_toreal(a1, 1u);\nv2 = _mm_cvtsi32_si128(_mm_cvtsi128_si32(a2));\n*(float *)v2.m128i_i32 = log10f(*(float *)v2.m128i_i32);\nbe_pushreal(a1, COERCE_FLOAT(_mm_cvtsi128_si32(v2)));\n}\nelse\n{\nbe_pushreal(a1, 0.0);\n}\nreturn be_returnvalue(a1);\n}\n\n\n\nQ:[a1,sub_427EB8,]", "hints": "[]", "response": "{'a1': 'vm', 'sub_427EB8': 'm_log10'}"} | [
[
0.7513336539268494,
0.7470870018005371,
0.7450191974639893,
0.7427109479904175,
0.7405890822410583,
0.7382792234420776,
0.7375738620758057,
0.7372199892997742,
0.7360044121742249,
0.7348917722702026,
0.733511209487915,
0.7317050099372864,
0.7314478754997253,
0.731418251991272,
0.7311472296714783,
0.7306581735610962,
0.7279353737831116,
0.727299153804779,
0.7272133231163025,
0.7263156771659851
],
[
243776,
259240,
29063,
47277,
119522,
258100,
233921,
188973,
127430,
247074,
215476,
137038,
123404,
104708,
21993,
7804,
77905,
241351,
171576,
14015
]
] |
|
decode_limits | db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219 | sergev | baoclone | NA | static void decode_limits(char band, int *enable, int *lower, int *upper)
{
int offset = (band == 'V') ? 0x1EC0 + 0x100 : 0x1EC0 + 0x105;
limits_t *limits = (limits_t *)(radio_mem + offset);
*enable = limits->enable;
*lower = ((limits->lower_msb >> 4) & 15) * 1000 + (limits->lower_msb & 15) * 100 +
((limits->lower_lsb >> 4) & 15) * 10 + (limits->lower_lsb & 15);
*upper = ((limits->upper_msb >> 4) & 15) * 1000 + (limits->upper_msb & 15) * 100 +
((limits->upper_lsb >> 4) & 15) * 10 + (limits->upper_lsb & 15);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40511A", "function_addr": 4215066, "binary_name": "db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov eax, edi"], [3, "mov [rbp+var_20], rsi"], [4, "mov [rbp+var_28], rdx"], [5, "mov [rbp+var_30], rcx"], [6, "mov [rbp+var_14], al"], [7, "cmp [rbp+var_14], 56h "], [8, "jnz short loc_40513C"], [9, "mov eax, 1FC0h"], [10, "jmp short loc_405141"], [11, "mov eax, 1FC5h"], [12, "mov [rbp+var_4], eax"], [13, "mov eax, [rbp+var_4]"], [14, "cdqe"], [15, "add rax, 41A9E0h"], [16, "mov [rbp+var_10], rax"], [17, "mov rax, [rbp+var_10]"], [18, "movzx eax, byte ptr [rax]"], [19, "movzx edx, al"], [20, "mov rax, [rbp+var_20]"], [21, "mov [rax], edx"], [22, "mov rax, [rbp+var_10]"], [23, "movzx eax, byte ptr [rax+1]"], [24, "shr al, 4"], [25, "movzx eax, al"], [26, "and eax, 0Fh"], [27, "imul edx, eax, 3E8h"], [28, "mov rax, [rbp+var_10]"], [29, "movzx eax, byte ptr [rax+1]"], [30, "movzx eax, al"], [31, "and eax, 0Fh"], [32, "imul eax, 64h "], [33, "lea ecx, [rdx+rax]"], [34, "mov rax, [rbp+var_10]"], [35, "movzx eax, byte ptr [rax+2]"], [36, "shr al, 4"], [37, "movzx eax, al"], [38, "and eax, 0Fh"], [39, "mov edx, eax"], [40, "mov eax, edx"], [41, "shl eax, 2"], [42, "add eax, edx"], [43, "add eax, eax"], [44, "lea edx, [rcx+rax]"], [45, "mov rax, [rbp+var_10]"], [46, "movzx eax, byte ptr [rax+2]"], [47, "movzx eax, al"], [48, "and eax, 0Fh"], [49, "add edx, eax"], [50, "mov rax, [rbp+var_28]"], [51, "mov [rax], edx"], [52, "mov rax, [rbp+var_10]"], [53, "movzx eax, byte ptr [rax+3]"], [54, "shr al, 4"], [55, "movzx eax, al"], [56, "and eax, 0Fh"], [57, "imul edx, eax, 3E8h"], [58, "mov rax, [rbp+var_10]"], [59, "movzx eax, byte ptr [rax+3]"], [60, "movzx eax, al"], [61, "and eax, 0Fh"], [62, "imul eax, 64h "], [63, "lea ecx, [rdx+rax]"], [64, "mov rax, [rbp+var_10]"], [65, "movzx eax, byte ptr [rax+4]"], [66, "shr al, 4"], [67, "movzx eax, al"], [68, "and eax, 0Fh"], [69, "mov edx, eax"], [70, "mov eax, edx"], [71, "shl eax, 2"], [72, "add eax, edx"], [73, "add eax, eax"], [74, "lea edx, [rcx+rax]"], [75, "mov rax, [rbp+var_10]"], [76, "movzx eax, byte ptr [rax+4]"], [77, "movzx eax, al"], [78, "and eax, 0Fh"], [79, "add edx, eax"], [80, "mov rax, [rbp+var_30]"], [81, "mov [rax], edx"], [82, "nop"], [83, "pop rbp"], [84, "retn"]], "data_dep": [[6, 2], [7, 6], [8, 7], [12, 9], [12, 11], [13, 12], [15, 13], [16, 15], [17, 16], [18, 17], [19, 18], [20, 3], [21, 20], [21, 19], [22, 16], [23, 22], [23, 21], [24, 23], [25, 24], [26, 25], [27, 26], [27, 19], [28, 16], [29, 28], [29, 21], [30, 29], [31, 30], [32, 31], [33, 21], [33, 32], [34, 16], [35, 21], [35, 34], [36, 35], [37, 36], [38, 37], [39, 38], [40, 39], [41, 40], [42, 39], [42, 41], [43, 42], [44, 21], [44, 39], [44, 43], [45, 16], [46, 45], [46, 21], [47, 46], [48, 47], [49, 48], [49, 44], [50, 4], [51, 50], [51, 49], [52, 16], [53, 52], [53, 51], [54, 53], [55, 54], [56, 55], [57, 56], [57, 49], [58, 16], [59, 58], [59, 51], [60, 59], [61, 60], [62, 61], [63, 33], [63, 51], [63, 62], [64, 16], [65, 51], [65, 64], [66, 65], [67, 66], [68, 67], [69, 68], [70, 69], [71, 70], [72, 69], [72, 71], [73, 72], [74, 73], [74, 51], [74, 69], [75, 16], [76, 51], [76, 75], [77, 76], [78, 77], [79, 74], [79, 78], [80, 5], [81, 80], [81, 79], [83, 0], [84, 80]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219_db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219.jsonl.gz", "strip_func_name": "sub_40511A", "query": "\n\n\nint *__fastcall sub_40511A(char a1, _DWORD *a2, _DWORD *a3, int *a4)\n{\nint v4; // eax\nint v5; // edx\nint *result; // rax\n__int64 v7; // [rsp+20h] [rbp-10h]\n\nif ( a1 == 86 )\nv4 = 8128;\nelse\nv4 = 8133;\nv7 = v4 + 4303328LL;\n*a2 = (unsigned __int8)byte_41A9E0[v4];\n*a3 = (*(_BYTE *)(v7 + 2) & 0xF)\n+ 1000 * ((*(_BYTE *)(v7 + 1) >> 4) & 0xF)\n+ 100 * (*(_BYTE *)(v7 + 1) & 0xF)\n+ 10 * ((*(_BYTE *)(v7 + 2) >> 4) & 0xF);\nv5 = (algn_41A9E1[v4 + 3] & 0xF)\n+ 1000 * (((unsigned __int8)algn_41A9E1[v4 + 2] >> 4) & 0xF)\n+ 100 * (algn_41A9E1[v4 + 2] & 0xF)\n+ 10 * (((unsigned __int8)algn_41A9E1[v4 + 3] >> 4) & 0xF);\nresult = a4;\n*a4 = v5;\nreturn result;\n}\n\n\n\nQ:[a3,a4,a1,a2,v5,v7,sub_40511A,]", "hints": "[]", "response": "{'a3': 'lower', 'a4': 'upper', 'a1': 'band', 'a2': 'enable', 'v5': 'lower', 'v7': 'limits', 'sub_40511A': 'decode_limits'}"} | [
[
0.7363178133964539,
0.6851660013198853,
0.6765580177307129,
0.6756923198699951,
0.6751563549041748,
0.6732914447784424,
0.6728752255439758,
0.6606950759887695,
0.6588457822799683,
0.6521275043487549,
0.6497145891189575,
0.6456438302993774,
0.6413605809211731,
0.6406293511390686,
0.6389774680137634,
0.6342058181762695,
0.6327800750732422,
0.6281725168228149,
0.6281708478927612,
0.6277692317962646
],
[
254717,
178779,
173547,
122008,
195830,
261162,
31583,
61754,
15359,
45548,
102063,
95304,
29450,
150245,
38396,
178307,
87803,
16758,
133261,
241424
]
] |
|
setup_watch | 994a98b83871aeefd80b5c457febff9397911ef8d4d74123c545d6fe38796bf6 | troydhanson | examples | NA | int setup_watch(int argc, char *argv[], int fd, struct inotify_event **eb) {
int i,wd,mask=IN_ALL_EVENTS;
char *dir;
for(i=1; i < argc; i++) {
dir = argv[i];
if ( (wd = inotify_add_watch(fd, dir, mask)) == -1) {
perror("inotify_add_watch failed");
exit(-1);
}
}
if ( (*eb = malloc(eb_sz)) == NULL) {
fprintf(stderr,"out of memory\n");
exit(-1);
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4012A5", "function_addr": 4199077, "binary_name": "994a98b83871aeefd80b5c457febff9397911ef8d4d74123c545d6fe38796bf6.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 40h"], [3, "mov [rbp+var_24], edi"], [4, "mov [rbp+var_30], rsi"], [5, "mov [rbp+fd], edx"], [6, "mov [rbp+var_38], rcx"], [7, "mov [rbp+mask], 0FFFh"], [8, "mov [rbp+var_4], 1"], [9, "jmp short loc_40131B"], [10, "mov eax, [rbp+var_4]"], [11, "cdqe"], [12, "lea rdx, ds:0[rax*8]"], [13, "mov rax, [rbp+var_30]"], [14, "add rax, rdx"], [15, "mov rax, [rax]"], [16, "mov [rbp+name], rax"], [17, "mov edx, [rbp+mask]"], [18, "mov rcx, [rbp+name]"], [19, "mov eax, [rbp+fd]"], [20, "mov rsi, rcx"], [21, "mov edi, eax"], [22, "call _inotify_add_watch"], [23, "mov [rbp+var_14], eax"], [24, "cmp [rbp+var_14], 0FFFFFFFFh"], [25, "jnz short loc_401317"], [26, "mov edi, offset s"], [27, "call _perror"], [28, "mov edi, 0FFFFFFFFh"], [29, "call _exit"], [30, "add [rbp+var_4], 1"], [31, "mov eax, [rbp+var_4]"], [32, "cmp eax, [rbp+var_24]"], [33, "jl short loc_4012CB"], [34, "mov eax, 1010h"], [35, "mov rdi, rax"], [36, "call _malloc"], [37, "mov rdx, rax"], [38, "mov rax, [rbp+var_38]"], [39, "mov [rax], rdx"], [40, "mov rax, [rbp+var_38]"], [41, "mov rax, [rax]"], [42, "test rax, rax"], [43, "jnz short loc_40136E"], [44, "mov rax, cs:stderr"], [45, "mov rcx, rax"], [46, "mov edx, 0Eh"], [47, "mov esi, 1"], [48, "mov edi, offset aOutOfMemory"], [49, "call _fwrite"], [50, "mov edi, 0FFFFFFFFh"], [51, "call _exit"], [52, "nop"], [53, "leave"], [54, "retn"]], "data_dep": [[10, 30], [10, 8], [12, 17], [13, 4], [14, 13], [14, 12], [15, 14], [16, 15], [17, 7], [18, 16], [19, 5], [20, 18], [21, 19], [23, 22], [24, 23], [25, 24], [30, 30], [30, 8], [31, 8], [31, 30], [32, 31], [32, 3], [33, 32], [35, 34], [37, 36], [38, 6], [39, 38], [39, 37], [40, 6], [41, 40], [41, 39], [42, 41], [43, 42], [45, 44], [54, 42]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/994a98b83871aeefd80b5c457febff9397911ef8d4d74123c545d6fe38796bf6_994a98b83871aeefd80b5c457febff9397911ef8d4d74123c545d6fe38796bf6.jsonl.gz", "strip_func_name": "sub_4012A5", "query": "\n\n\nvoid *__fastcall sub_4012A5(int a1, __int64 a2, int a3, void **a4)\n{\nvoid *result; // rax\nint i; // [rsp+3Ch] [rbp-4h]\n\nfor ( i = 1; i < a1; ++i )\n{\nif ( inotify_add_watch(a3, *(const char **)(8LL * i + a2), 0xFFFu) == -1 )\n{\nperror(\"inotify_add_watch failed\");\nexit(-1);\n}\n}\n*a4 = malloc(0x1010uLL);\nresult = *a4;\nif ( !*a4 )\n{\nfwrite(\"out of memory\\n\", 1uLL, 0xEuLL, stderr);\nexit(-1);\n}\nreturn result;\n}\n\n\n\nQ:[a3,a4,a1,a2,sub_4012A5,]", "hints": "[]", "response": "{'a3': 'fd', 'a4': 'eb', 'a1': 'argc', 'a2': 'argv', 'sub_4012A5': 'setup_watch'}"} | [
[
0.7977091670036316,
0.7788450717926025,
0.747009813785553,
0.7460836172103882,
0.7338494658470154,
0.7311848402023315,
0.7221408486366272,
0.7217318415641785,
0.7095422148704529,
0.7079708576202393,
0.704727053642273,
0.7046080827713013,
0.6963434219360352,
0.6903762817382812,
0.6862930655479431,
0.6843715906143188,
0.6814078688621521,
0.6813941597938538,
0.6800114512443542,
0.6796513199806213
],
[
195302,
137371,
190059,
65207,
262549,
176810,
204825,
170156,
226384,
217232,
26154,
13708,
157936,
117935,
118826,
185851,
25089,
210352,
30579,
174296
]
] |
|
saref_recvfrom | 5bccc316131b0bf67c81683bef6cd122d955dcbc50133040664b00c41897eff0 | xelerance | Openswan | NA | int saref_recvfrom (fd, buf, len, flags, src_addr, addrlen)
int fd;
char *buf;
size_t len;
int flags;
SA *src_addr;
socklen_t *addrlen;
{
#ifdef HAVE_IPSEC_SAREF
int rc;
struct msghdr msgh;
struct iovec iov;
char cbuf[256];
struct cmsghdr *cmsg;
if (!requested_refinfo) {
int val = 1;
rc = setsockopt (fd, IPPROTO_IP, IP_IPSEC_REFINFO, &val, sizeof (val));
if (rc == -1)
bail ("failed setting IPsec SAref cmsg info flag");
requested_refinfo = 1;
}
memset(&msgh, 0, sizeof(struct msghdr));
iov.iov_base = buf;
iov.iov_len = len;
msgh.msg_control = cbuf;
msgh.msg_controllen = sizeof(cbuf);
msgh.msg_name = src_addr;
msgh.msg_namelen = *addrlen;
msgh.msg_iov = &iov;
msgh.msg_iovlen = 1;
msgh.msg_flags = 0;
rc = recvmsg(fd, &msgh, flags);
if (rc < 0)
return rc;
*addrlen = msgh.msg_namelen;
/* Process auxiliary received data in msgh */
for (cmsg = CMSG_FIRSTHDR(&msgh);
cmsg != NULL;
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
if (cmsg->cmsg_level == IPPROTO_IP
&& cmsg->cmsg_type == IP_IPSEC_REFINFO) {
unsigned int *refp;
refp = (unsigned int *)CMSG_DATA(cmsg);
holler("UDP saref me=%04x him=%04x",
refp[0], refp[1]);
/* refme =refp[0]; */
o_saref = refp[1];
}
}
#else /* ! HAVE_IPSEC_SAREF */
return recvfrom (fd, buf, len, flags, src_addr, addrlen);
#endif
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4034D4", "function_addr": 4207828, "binary_name": "5bccc316131b0bf67c81683bef6cd122d955dcbc50133040664b00c41897eff0.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 1A0h"], [3, "mov [rbp+fd], edi"], [4, "mov [rbp+var_180], rsi"], [5, "mov [rbp+var_188], rdx"], [6, "mov [rbp+flags], ecx"], [7, "mov [rbp+var_190], r8"], [8, "mov [rbp+var_198], r9"], [9, "mov eax, cs:dword_409440"], [10, "test eax, eax"], [11, "jnz short loc_403564"], [12, "mov [rbp+optval], 1"], [13, "lea rdx, [rbp+optval]"], [14, "mov eax, [rbp+fd]"], [15, "mov r8d, 4"], [16, "mov rcx, rdx"], [17, "mov edx, 16h"], [18, "mov esi, 0"], [19, "mov edi, eax"], [20, "call _setsockopt"], [21, "mov [rbp+var_C], eax"], [22, "cmp [rbp+var_C], 0FFFFFFFFh"], [23, "jnz short loc_40355A"], [24, "mov edi, offset aFailedSettingI_0"], [25, "mov eax, 0"], [26, "call sub_4025D3"], [27, "mov cs:dword_409440, 1"], [28, "lea rax, [rbp+s]"], [29, "mov edx, 38h "], [30, "mov esi, 0"], [31, "mov rdi, rax"], [32, "call _memset"], [33, "mov rax, [rbp+var_180]"], [34, "mov [rbp+var_60], rax"], [35, "mov rax, [rbp+var_188]"], [36, "mov [rbp+var_58], rax"], [37, "lea rax, [rbp+var_160]"], [38, "mov [rbp+var_30], rax"], [39, "mov [rbp+var_28], 100h"], [40, "mov rax, [rbp+var_190]"], [41, "mov [rbp+s], rax"], [42, "mov rax, [rbp+var_198]"], [43, "mov eax, [rax]"], [44, "mov [rbp+var_48], eax"], [45, "lea rax, [rbp+var_60]"], [46, "mov [rbp+var_40], rax"], [47, "mov [rbp+var_38], 1"], [48, "mov [rbp+var_20], 0"], [49, "mov edx, [rbp+flags]"], [50, "lea rcx, [rbp+s]"], [51, "mov eax, [rbp+fd]"], [52, "mov rsi, rcx"], [53, "mov edi, eax"], [54, "call _recvmsg"], [55, "mov [rbp+var_C], eax"], [56, "cmp [rbp+var_C], 0"], [57, "jns short loc_4035FC"], [58, "mov eax, [rbp+var_C]"], [59, "jmp locret_403692"], [60, "mov edx, [rbp+var_48]"], [61, "mov rax, [rbp+var_198]"], [62, "mov [rax], edx"], [63, "mov rax, [rbp+var_28]"], [64, "cmp rax, 0Fh"], [65, "jbe short loc_403618"], [66, "mov rax, [rbp+var_30]"], [67, "jmp short loc_40361D"], [68, "mov eax, 0"], [69, "mov [rbp+cmsg], rax"], [70, "jmp short loc_40368B"], [71, "mov rax, [rbp+cmsg]"], [72, "mov eax, [rax+8]"], [73, "test eax, eax"], [74, "jnz short loc_403674"], [75, "mov rax, [rbp+cmsg]"], [76, "mov eax, [rax+0Ch]"], [77, "cmp eax, 16h"], [78, "jnz short loc_403674"], [79, "mov rax, [rbp+cmsg]"], [80, "add rax, 10h"], [81, "mov [rbp+var_18], rax"], [82, "mov rax, [rbp+var_18]"], [83, "add rax, 4"], [84, "mov edx, [rax]"], [85, "mov rax, [rbp+var_18]"], [86, "mov eax, [rax]"], [87, "mov esi, eax"], [88, "mov edi, offset aUdpSarefMe04xH"], [89, "mov eax, 0"], [90, "call sub_4024C2"], [91, "mov rax, [rbp+var_18]"], [92, "mov eax, [rax+4]"], [93, "mov cs:dword_409454, eax"], [94, "mov rdx, [rbp+cmsg]"], [95, "lea rax, [rbp+s]"], [96, "mov rsi, rdx"], [97, "mov rdi, rax"], [98, "call ___cmsg_nxthdr"], [99, "mov [rbp+cmsg], rax"], [100, "cmp [rbp+cmsg], 0"], [101, "jnz short loc_403623"], [102, "leave"], [103, "retn"]], "data_dep": [[10, 9], [11, 10], [13, 12], [14, 3], [16, 13], [19, 14], [21, 20], [22, 21], [23, 22], [28, 20], [28, 10], [31, 28], [33, 4], [34, 33], [35, 5], [36, 35], [37, 35], [38, 37], [40, 7], [41, 40], [42, 8], [43, 42], [44, 43], [45, 34], [45, 43], [46, 45], [49, 6], [50, 16], [50, 41], [51, 3], [52, 50], [53, 51], [55, 54], [56, 55], [57, 56], [58, 55], [60, 44], [61, 8], [62, 60], [62, 61], [63, 39], [64, 63], [65, 64], [66, 38], [69, 66], [69, 68], [71, 99], [71, 69], [72, 62], [72, 71], [73, 72], [74, 73], [75, 99], [75, 69], [76, 62], [76, 75], [77, 76], [78, 77], [79, 99], [79, 69], [80, 79], [81, 80], [82, 81], [83, 82], [84, 83], [84, 62], [85, 81], [86, 85], [86, 62], [87, 86], [91, 81], [92, 62], [92, 91], [93, 92], [94, 69], [94, 99], [95, 92], [95, 76], [95, 41], [95, 73], [96, 94], [97, 95], [99, 98], [100, 69], [100, 99], [101, 100], [103, 58], [103, 98], [103, 66], [103, 68]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/5bccc316131b0bf67c81683bef6cd122d955dcbc50133040664b00c41897eff0_5bccc316131b0bf67c81683bef6cd122d955dcbc50133040664b00c41897eff0.jsonl.gz", "strip_func_name": "sub_4034D4", "query": "\n\n\nstruct cmsghdr *__fastcall sub_4034D4(int a1, __int64 a2, __int64 a3, int a4, void *a5, socklen_t *a6)\n{\n__int64 v6; // rdx\n__int64 v7; // rcx\n__int64 v8; // r8\n__int64 v9; // r9\n__int64 v10; // rcx\n__int64 v11; // r8\n__int64 v12; // r9\nstruct cmsghdr *result; // rax\n__int64 v14; // [rsp+0h] [rbp-1A0h]\nint optval; // [rsp+3Ch] [rbp-164h] BYREF\nchar v20; // [rsp+40h] [rbp-160h] BYREF\n__int64 v21[2]; // [rsp+140h] [rbp-60h] BYREF\nstruct msghdr s; // [rsp+150h] [rbp-50h] BYREF\nunsigned __int8 *v23; // [rsp+188h] [rbp-18h]\nunsigned int v24; // [rsp+194h] [rbp-Ch]\nstruct cmsghdr *cmsg; // [rsp+198h] [rbp-8h]\n\nif ( !dword_409440 )\n{\noptval = 1;\nv24 = setsockopt(a1, 0, 22, &optval, 4u);\nif ( v24 == -1 )\nsub_4025D3(\"failed setting IPsec SAref cmsg info flag\", 0LL, v6, v7, v8, v9, v14);\ndword_409440 = 1;\n}\nmemset(&s, 0, sizeof(s));\nv21[0] = a2;\nv21[1] = a3;\ns.msg_control = &v20;\ns.msg_controllen = 256LL;\ns.msg_name = a5;\ns.msg_namelen = *a6;\ns.msg_iov = (struct iovec *)v21;\ns.msg_iovlen = 1LL;\ns.msg_flags = 0;\nv24 = recvmsg(a1, &s, a4);\nif ( (v24 & 0x80000000) != 0 )\nreturn (struct cmsghdr *)v24;\n*a6 = s.msg_namelen;\nif ( s.msg_controllen <= 0xF )\nresult = 0LL;\nelse\nresult = (struct cmsghdr *)s.msg_control;\nfor ( cmsg = result; cmsg; cmsg = result )\n{\nif ( !cmsg->cmsg_level && cmsg->cmsg_type == 22 )\n{\nv23 = cmsg->__cmsg_data;\nsub_4024C2(\n\"UDP saref me=%04x him=%04x\",\n*(unsigned int *)cmsg->__cmsg_data,\n*(unsigned int *)&cmsg->__cmsg_data[4],\nv10,\nv11,\nv12,\nv14);\ndword_409454 = *((_DWORD *)v23 + 1);\n}\nresult = __cmsg_nxthdr(&s, cmsg);\n}\nreturn result;\n}\n\n\n\nQ:[a3,a4,a1,a2,a5,a6,optval,v20,v21,s,v23,v24,sub_4034D4,sub_4025D3,sub_4024C2,]", "hints": "[]", "response": "{'a3': 'len', 'a4': 'flags', 'a1': 'fd', 'a2': 'buf', 'a5': 'src_addr', 'a6': 'addrlen', 'optval': 'val', 'v20': 'cbuf', 'v21': 'iov', 's': 'msgh', 'v23': 'refp', 'v24': 'rc', 'sub_4034D4': 'saref_recvfrom', 'sub_4025D3': 'bail', 'sub_4024C2': 'holler'}"} | [
[
0.8350892663002014,
0.7615550756454468,
0.7411072850227356,
0.7405390739440918,
0.7326328754425049,
0.7303647398948669,
0.7244174480438232,
0.7221778631210327,
0.7175857424736023,
0.7164239287376404,
0.7150431871414185,
0.7069264054298401,
0.7021077871322632,
0.6990038156509399,
0.698057234287262,
0.6907812356948853,
0.6903654336929321,
0.6898754835128784,
0.6875896453857422,
0.6865796446800232
],
[
237779,
250203,
51740,
250176,
208428,
162699,
25027,
45594,
42710,
189019,
13670,
76261,
33920,
197384,
227307,
63478,
194887,
218248,
96426,
217630
]
] |
|
encode_char | db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219 | sergev | baoclone | NA | static int encode_char(int c)
{
// Replace underscore by space.
if (c == '_')
c = ' ';
// Only uppercase letters.
if (c >= 'a' && c <= 'z')
c += 'A' - 'a';
if (c > '~')
c = '~';
return c;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_404DB3", "function_addr": 4214195, "binary_name": "db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_4], edi"], [3, "cmp [rbp+var_4], 5Fh "], [4, "jnz short loc_404DC7"], [5, "mov [rbp+var_4], 20h "], [6, "cmp [rbp+var_4], 60h "], [7, "jle short loc_404DD7"], [8, "cmp [rbp+var_4], 7Ah "], [9, "jg short loc_404DD7"], [10, "sub [rbp+var_4], 20h "], [11, "cmp [rbp+var_4], 7Eh "], [12, "jle short loc_404DE4"], [13, "mov [rbp+var_4], 7Eh "], [14, "mov eax, [rbp+var_4]"], [15, "pop rbp"], [16, "retn"]], "data_dep": [[3, 2], [4, 3], [6, 2], [6, 5], [7, 6], [8, 2], [8, 5], [9, 8], [10, 2], [10, 5], [11, 2], [11, 5], [11, 10], [12, 11], [14, 10], [14, 13], [14, 2], [14, 5], [15, 0], [16, 14]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219_db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219.jsonl.gz", "strip_func_name": "sub_404DB3", "query": "\n\n\n__int64 __fastcall sub_404DB3(int a1)\n{\nint v2; // [rsp+0h] [rbp-4h]\n\nv2 = a1;\nif ( a1 == 95 )\nv2 = 32;\nif ( v2 > 96 && v2 <= 122 )\nv2 -= 32;\nif ( v2 > 126 )\nv2 = 126;\nreturn (unsigned int)v2;\n}\n\n\n\nQ:[a1,v2,sub_404DB3,]", "hints": "[]", "response": "{'a1': 'c', 'v2': 'ca', 'sub_404DB3': 'encode_char'}"} | [
[
0.8860281109809875,
0.8852090835571289,
0.8774779438972473,
0.8744331002235413,
0.863079845905304,
0.8627597689628601,
0.8619320392608643,
0.8605830669403076,
0.8593072891235352,
0.858665943145752,
0.8576884269714355,
0.856594443321228,
0.8459994792938232,
0.8424511551856995,
0.8382979035377502,
0.8343932032585144,
0.8339434266090393,
0.8332540392875671,
0.8296897411346436,
0.8274990320205688
],
[
135487,
43871,
86049,
29368,
228532,
123894,
42624,
259396,
126542,
36614,
234913,
13240,
280,
59362,
87510,
246141,
156506,
214088,
187970,
239883
]
] |
|
print_squelch | db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219 | sergev | baoclone | NA | static void print_squelch(FILE *out, int ctcs, int dcs)
{
if (ctcs)
fprintf(out, "%5.1f", ctcs / 10.0);
else if (dcs > 0)
fprintf(out, "D%03dN", dcs);
else if (dcs < 0)
fprintf(out, "D%03dI", -dcs);
else
fprintf(out, " - ");
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_409B53", "function_addr": 4234067, "binary_name": "db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 10h"], [3, "mov [rbp+stream], rdi"], [4, "mov [rbp+var_C], esi"], [5, "mov [rbp+var_10], edx"], [6, "cmp [rbp+var_C], 0"], [7, "jz short loc_409BA2"], [8, "pxor xmm0, xmm0"], [9, "cvtsi2sd xmm0, [rbp+var_C]"], [10, "movsd xmm1, cs:qword_4150D0"], [11, "divsd xmm0, xmm1"], [12, "movq rdx, xmm0"], [13, "mov rax, [rbp+stream]"], [14, "movq xmm0, rdx"], [15, "mov esi, offset a51f_0"], [16, "mov rdi, rax"], [17, "mov eax, 1"], [18, "call _fprintf"], [19, "jmp short loc_409C03"], [20, "cmp [rbp+var_10], 0"], [21, "jle short loc_409BC3"], [22, "mov edx, [rbp+var_10]"], [23, "mov rax, [rbp+stream]"], [24, "mov esi, offset aD03dn_0"], [25, "mov rdi, rax"], [26, "mov eax, 0"], [27, "call _fprintf"], [28, "jmp short loc_409C03"], [29, "cmp [rbp+var_10], 0"], [30, "jns short loc_409BE8"], [31, "mov eax, [rbp+var_10]"], [32, "neg eax"], [33, "mov edx, eax"], [34, "mov rax, [rbp+stream]"], [35, "mov esi, offset aD03di_1"], [36, "mov rdi, rax"], [37, "mov eax, 0"], [38, "call _fprintf"], [39, "jmp short loc_409C03"], [40, "mov rax, [rbp+stream]"], [41, "mov rcx, rax"], [42, "mov edx, 5"], [43, "mov esi, 1"], [44, "mov edi, offset asc_414120"], [45, "call _fwrite"], [46, "nop"], [47, "leave"], [48, "retn"]], "data_dep": [[6, 4], [7, 6], [9, 8], [9, 4], [11, 10], [11, 9], [12, 11], [13, 3], [14, 12], [16, 13], [20, 5], [21, 20], [22, 5], [23, 3], [25, 23], [29, 5], [30, 29], [31, 5], [32, 31], [33, 32], [34, 3], [36, 34], [40, 3], [41, 40], [48, 27], [48, 45], [48, 38], [48, 18]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219_db55e649e2cb5357ba74db4dd5cc89adf17b200bc32f8bf1531f9512b4b7a219.jsonl.gz", "strip_func_name": "sub_409B53", "query": "\n\n\nint __fastcall sub_409B53(FILE *a1, int a2, int a3)\n{\nif ( a2 )\nreturn fprintf(a1, \"%5.1f\", (double)a2 / 10.0);\nif ( a3 > 0 )\nreturn fprintf(a1, \"D%03dN\", (unsigned int)a3);\nif ( a3 >= 0 )\nreturn fwrite(\" - \", 1uLL, 5uLL, a1);\nreturn fprintf(a1, \"D%03dI\", (unsigned int)-a3);\n}\n\n\n\nQ:[a3,a1,a2,sub_409B53,]", "hints": "[]", "response": "{'a3': 'dcs', 'a1': 'out', 'a2': 'ctcs', 'sub_409B53': 'print_squelch_0'}"} | [
[
0.8348610401153564,
0.8007310628890991,
0.7799339294433594,
0.7732744812965393,
0.7718992829322815,
0.7693153023719788,
0.7597856521606445,
0.7561034560203552,
0.749915361404419,
0.7457722425460815,
0.7356324195861816,
0.7343654632568359,
0.7328566908836365,
0.7325994372367859,
0.7319132089614868,
0.7249045968055725,
0.7244685888290405,
0.7241929173469543,
0.723933219909668,
0.7239298820495605
],
[
45277,
68183,
172711,
142936,
1243,
44205,
198720,
36700,
220523,
63762,
84484,
197757,
62003,
23074,
22925,
58016,
191413,
81667,
229655,
183872
]
] |
|
LexSkipComment | 001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13 | larryhe | tiny-c-interpreter | NA | void LexSkipComment(struct LexState *Lexer, char NextChar, enum LexToken *ReturnToken)
{
if (NextChar == '*')
{
/* conventional C comment */
while (Lexer->Pos != Lexer->End && (*(Lexer->Pos-1) != '*' || *Lexer->Pos != '/'))
{
if (*Lexer->Pos == '\n')
Lexer->EmitExtraNewlines++;
LEXER_INC(Lexer);
}
if (Lexer->Pos != Lexer->End)
LEXER_INC(Lexer);
Lexer->Mode = LexModeNormal;
}
else
{
/* C++ style comment */
while (Lexer->Pos != Lexer->End && *Lexer->Pos != '\n')
LEXER_INC(Lexer);
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4063C9", "function_addr": 4219849, "binary_name": "001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov [rbp+var_8], rdi"], [3, "mov eax, esi"], [4, "mov [rbp+var_18], rdx"], [5, "mov [rbp+var_C], al"], [6, "cmp [rbp+var_C], 2Ah "], [7, "jnz loc_4064C3"], [8, "jmp short loc_406428"], [9, "mov rax, [rbp+var_8]"], [10, "mov rax, [rax]"], [11, "movzx eax, byte ptr [rax]"], [12, "cmp al, 0Ah"], [13, "jnz short loc_406405"], [14, "mov rax, [rbp+var_8]"], [15, "mov eax, [rax+2Ch]"], [16, "lea edx, [rax+1]"], [17, "mov rax, [rbp+var_8]"], [18, "mov [rax+2Ch], edx"], [19, "mov rax, [rbp+var_8]"], [20, "mov rax, [rax]"], [21, "lea rdx, [rax+1]"], [22, "mov rax, [rbp+var_8]"], [23, "mov [rax], rdx"], [24, "mov rax, [rbp+var_8]"], [25, "mov eax, [rax+1Ch]"], [26, "lea edx, [rax+1]"], [27, "mov rax, [rbp+var_8]"], [28, "mov [rax+1Ch], edx"], [29, "mov rax, [rbp+var_8]"], [30, "mov rdx, [rax]"], [31, "mov rax, [rbp+var_8]"], [32, "mov rax, [rax+8]"], [33, "cmp rdx, rax"], [34, "jz short loc_40645C"], [35, "mov rax, [rbp+var_8]"], [36, "mov rax, [rax]"], [37, "sub rax, 1"], [38, "movzx eax, byte ptr [rax]"], [39, "cmp al, 2Ah "], [40, "jnz short loc_4063E6"], [41, "mov rax, [rbp+var_8]"], [42, "mov rax, [rax]"], [43, "movzx eax, byte ptr [rax]"], [44, "cmp al, 2Fh "], [45, "jnz short loc_4063E6"], [46, "mov rax, [rbp+var_8]"], [47, "mov rdx, [rax]"], [48, "mov rax, [rbp+var_8]"], [49, "mov rax, [rax+8]"], [50, "cmp rdx, rax"], [51, "jz short loc_406493"], [52, "mov rax, [rbp+var_8]"], [53, "mov rax, [rax]"], [54, "lea rdx, [rax+1]"], [55, "mov rax, [rbp+var_8]"], [56, "mov [rax], rdx"], [57, "mov rax, [rbp+var_8]"], [58, "mov eax, [rax+1Ch]"], [59, "lea edx, [rax+1]"], [60, "mov rax, [rbp+var_8]"], [61, "mov [rax+1Ch], edx"], [62, "mov rax, [rbp+var_8]"], [63, "mov dword ptr [rax+28h], 0"], [64, "jmp short loc_4064E5"], [65, "mov rax, [rbp+var_8]"], [66, "mov rax, [rax]"], [67, "lea rdx, [rax+1]"], [68, "mov rax, [rbp+var_8]"], [69, "mov [rax], rdx"], [70, "mov rax, [rbp+var_8]"], [71, "mov eax, [rax+1Ch]"], [72, "lea edx, [rax+1]"], [73, "mov rax, [rbp+var_8]"], [74, "mov [rax+1Ch], edx"], [75, "mov rax, [rbp+var_8]"], [76, "mov rdx, [rax]"], [77, "mov rax, [rbp+var_8]"], [78, "mov rax, [rax+8]"], [79, "cmp rdx, rax"], [80, "jz short loc_4064E5"], [81, "mov rax, [rbp+var_8]"], [82, "mov rax, [rax]"], [83, "movzx eax, byte ptr [rax]"], [84, "cmp al, 0Ah"], [85, "jnz short loc_4064A0"], [86, "nop"], [87, "pop rbp"], [88, "retn"]], "data_dep": [[5, 3], [6, 5], [7, 6], [9, 2], [10, 28], [10, 23], [10, 9], [10, 18], [11, 23], [11, 18], [11, 10], [11, 28], [12, 11], [13, 12], [14, 2], [15, 14], [15, 23], [15, 18], [15, 28], [16, 15], [16, 28], [16, 30], [16, 23], [16, 18], [17, 2], [18, 17], [18, 16], [19, 2], [20, 19], [20, 28], [20, 23], [20, 18], [21, 16], [21, 18], [21, 20], [21, 28], [21, 30], [21, 23], [22, 2], [23, 22], [23, 21], [24, 2], [25, 23], [25, 24], [25, 28], [26, 21], [26, 23], [26, 25], [27, 2], [28, 27], [28, 26], [29, 2], [30, 18], [30, 29], [30, 28], [30, 23], [31, 2], [32, 23], [32, 18], [32, 31], [32, 28], [33, 30], [33, 32], [34, 33], [35, 2], [36, 18], [36, 35], [36, 28], [36, 23], [37, 36], [38, 23], [38, 18], [38, 28], [38, 37], [39, 38], [40, 39], [41, 2], [42, 41], [42, 18], [42, 28], [42, 23], [43, 23], [43, 28], [43, 18], [43, 42], [44, 43], [45, 44], [46, 2], [47, 18], [47, 28], [47, 46], [47, 23], [48, 2], [49, 23], [49, 18], [49, 48], [49, 28], [50, 47], [50, 49], [51, 50], [52, 2], [53, 23], [53, 18], [53, 52], [53, 61], [53, 56], [53, 28], [54, 28], [54, 23], [54, 53], [54, 18], [54, 61], [54, 47], [54, 56], [55, 2], [56, 55], [56, 54], [57, 2], [58, 56], [58, 28], [58, 57], [59, 54], [59, 56], [59, 58], [60, 2], [61, 60], [61, 59], [62, 2], [63, 62], [65, 2], [66, 69], [66, 65], [66, 74], [67, 74], [67, 76], [67, 69], [67, 66], [68, 2], [69, 67], [69, 68], [70, 2], [71, 74], [71, 69], [71, 70], [72, 67], [72, 69], [72, 71], [73, 2], [74, 73], [74, 72], [75, 2], [76, 74], [76, 69], [76, 75], [77, 2], [78, 77], [78, 74], [78, 69], [79, 76], [79, 78], [80, 79], [81, 2], [82, 81], [82, 74], [82, 69], [83, 69], [83, 82], [83, 74], [84, 83], [85, 84], [87, 0], [88, 83], [88, 78], [88, 62]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13_001b6d37eda4b0b2e25f571e67a7549b8179adaa5dd1fa31408b780e16287d13.jsonl.gz", "strip_func_name": "sub_4063C9", "query": "\n\n\nunsigned __int8 *__fastcall sub_4063C9(unsigned __int8 **a1, char a2)\n{\nunsigned __int8 *result; // rax\n\nif ( a2 == 42 )\n{\nwhile ( *a1 != a1[1] && (*(*a1 - 1) != 42 || **a1 != 47) )\n{\nif ( **a1 == 10 )\n++*((_DWORD *)a1 + 11);\n++*a1;\n++*((_DWORD *)a1 + 7);\n}\nif ( *a1 != a1[1] )\n{\n++*a1;\n++*((_DWORD *)a1 + 7);\n}\nresult = (unsigned __int8 *)a1;\n*((_DWORD *)a1 + 10) = 0;\n}\nelse\n{\nwhile ( 1 )\n{\nresult = a1[1];\nif ( *a1 == result )\nbreak;\nresult = (unsigned __int8 *)**a1;\nif ( (_BYTE)result == 10 )\nbreak;\n++*a1;\n++*((_DWORD *)a1 + 7);\n}\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,sub_4063C9,]", "hints": "[]", "response": "{'a1': 'Lexer', 'a2': 'NextChar', 'sub_4063C9': 'LexSkipComment'}"} | [
[
0.7218221426010132,
0.7140006422996521,
0.7100353837013245,
0.6922659873962402,
0.6883788108825684,
0.6743430495262146,
0.6737526655197144,
0.6677136421203613,
0.6635477542877197,
0.6616619229316711,
0.6611316800117493,
0.651827335357666,
0.6492882370948792,
0.6485720872879028,
0.6476782560348511,
0.6460604667663574,
0.6445636749267578,
0.6445614695549011,
0.6431090831756592,
0.6429831981658936
],
[
84462,
20517,
131392,
27468,
112239,
251881,
39936,
202530,
35324,
61669,
105430,
153170,
122885,
199031,
58320,
34151,
129639,
179315,
213843,
100393
]
] |
|
usage_smtp | a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40 | vanhauser-thc | thc-hydra | NA | void usage_smtp(const char *service) {
printf("Module smtp is optionally taking one authentication type of:\n"
" LOGIN (default), PLAIN, CRAM-MD5, DIGEST-MD5, NTLM\n\n"
"Additionally TLS encryption via STARTTLS can be enforced with the "
"TLS option.\n\n"
"Example: smtp://target/TLS:PLAIN\n");
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_432CA7", "function_addr": 4402343, "binary_name": "a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov rax, fs:28h"], [5, "mov [rbp+var_8], rax"], [6, "xor eax, eax"], [7, "mov edi, offset aModuleSmtpIsOp"], [8, "call _puts"], [9, "nop"], [10, "mov rax, [rbp+var_8]"], [11, "sub rax, fs:28h"], [12, "jz short locret_432CE1"], [13, "call ___stack_chk_fail"], [14, "leave"], [15, "retn"]], "data_dep": [[5, 4], [10, 5], [11, 10], [12, 11], [15, 11]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40_a8fb2edbd6bde6f75d208a747818d072741a3159e43047c86a6c260940123f40.jsonl.gz", "strip_func_name": "sub_432CA7", "query": "\n\n\nunsigned __int64 sub_432CA7()\n{\nunsigned __int64 v1; // [rsp+18h] [rbp-8h]\n\nv1 = __readfsqword(0x28u);\nputs(\n\"Module smtp is optionally taking one authentication type of:\\n\"\n\" LOGIN (default), PLAIN, CRAM-MD5, DIGEST-MD5, NTLM\\n\"\n\"\\n\"\n\"Additionally TLS encryption via STARTTLS can be enforced with the TLS option.\\n\"\n\"\\n\"\n\"Example: smtp://target/TLS:PLAIN\");\nreturn v1 - __readfsqword(0x28u);\n}\n\n\n\nQ:[sub_432CA7,]", "hints": "[]", "response": "{'sub_432CA7': 'usage_smtp'}"} | [
[
0.8622634410858154,
0.8586710095405579,
0.8532870411872864,
0.8511518239974976,
0.8498656749725342,
0.8494555354118347,
0.8489367365837097,
0.8483443856239319,
0.8455971479415894,
0.8455289602279663,
0.8439341187477112,
0.8417204022407532,
0.8407490253448486,
0.8391605019569397,
0.839134693145752,
0.8383798599243164,
0.835640549659729,
0.8355579972267151,
0.8306753635406494,
0.8303855657577515
],
[
28437,
225536,
115027,
104806,
40522,
182346,
87047,
176097,
25552,
209168,
142223,
216069,
17743,
224667,
133846,
194804,
183632,
249524,
242332,
244415
]
] |
|
tcp_connect | c2a2b5404737108dc4c32df8ab1d39a5df674831900c1c518dcf26f85e3a8841 | stefanha | nc-vsock | NA | static int tcp_connect(const char *node, const char *service)
{
int fd;
int ret;
const struct addrinfo hints = {
.ai_family = AF_INET,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo *res = NULL;
struct addrinfo *addrinfo;
ret = getaddrinfo(node, service, &hints, &res);
if (ret != 0) {
fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret));
return -1;
}
for (addrinfo = res; addrinfo; addrinfo = addrinfo->ai_next) {
fd = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol);
if (fd < 0) {
perror("socket");
continue;
}
if (connect(fd, addrinfo->ai_addr, addrinfo->ai_addrlen) != 0) {
perror("connect");
close(fd);
continue;
}
break;
}
freeaddrinfo(res);
return fd;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_401473", "function_addr": 4199539, "binary_name": "c2a2b5404737108dc4c32df8ab1d39a5df674831900c1c518dcf26f85e3a8841.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 70h"], [3, "mov [rbp+name], rdi"], [4, "mov [rbp+service], rsi"], [5, "mov qword ptr [rbp+req.ai_flags], 0"], [6, "mov qword ptr [rbp+req.ai_socktype], 0"], [7, "mov qword ptr [rbp+req.ai_addrlen], 0"], [8, "mov [rbp+req.ai_addr], 0"], [9, "mov [rbp+req.ai_canonname], 0"], [10, "mov [rbp+req.ai_next], 0"], [11, "mov [rbp+req.ai_family], 2"], [12, "mov [rbp+req.ai_socktype], 1"], [13, "mov [rbp+pai], 0"], [14, "lea rcx, [rbp+pai]"], [15, "lea rdx, [rbp+req]"], [16, "mov rsi, [rbp+service]"], [17, "mov rax, [rbp+name]"], [18, "mov rdi, rax"], [19, "call _getaddrinfo"], [20, "mov [rbp+ecode], eax"], [21, "cmp [rbp+ecode], 0"], [22, "jz short loc_40151A"], [23, "mov eax, [rbp+ecode]"], [24, "mov edi, eax"], [25, "call _gai_strerror"], [26, "mov rdx, rax"], [27, "mov rax, cs:stderr"], [28, "mov esi, offset aGetaddrinfoFai"], [29, "mov rdi, rax"], [30, "mov eax, 0"], [31, "call _fprintf"], [32, "mov eax, 0FFFFFFFFh"], [33, "jmp locret_4015B1"], [34, "mov rax, [rbp+pai]"], [35, "mov [rbp+var_10], rax"], [36, "jmp short loc_401598"], [37, "mov rax, [rbp+var_10]"], [38, "mov edx, [rax+0Ch]"], [39, "mov rax, [rbp+var_10]"], [40, "mov ecx, [rax+8]"], [41, "mov rax, [rbp+var_10]"], [42, "mov eax, [rax+4]"], [43, "mov esi, ecx"], [44, "mov edi, eax"], [45, "call _socket"], [46, "mov [rbp+fd], eax"], [47, "cmp [rbp+fd], 0"], [48, "jns short loc_401557"], [49, "mov edi, offset s"], [50, "call _perror"], [51, "jmp short loc_40158C"], [52, "mov rax, [rbp+var_10]"], [53, "mov edx, [rax+10h]"], [54, "mov rax, [rbp+var_10]"], [55, "mov rcx, [rax+18h]"], [56, "mov eax, [rbp+fd]"], [57, "mov rsi, rcx"], [58, "mov edi, eax"], [59, "call _connect"], [60, "test eax, eax"], [61, "jz short loc_4015A1"], [62, "mov edi, offset aConnect_0"], [63, "call _perror"], [64, "mov eax, [rbp+fd]"], [65, "mov edi, eax"], [66, "call _close"], [67, "nop"], [68, "mov rax, [rbp+var_10]"], [69, "mov rax, [rax+28h]"], [70, "mov [rbp+var_10], rax"], [71, "cmp [rbp+var_10], 0"], [72, "jnz short loc_401524"], [73, "jmp short loc_4015A2"], [74, "nop"], [75, "mov rax, [rbp+pai]"], [76, "mov rdi, rax"], [77, "call _freeaddrinfo"], [78, "mov eax, [rbp+fd]"], [79, "leave"], [80, "retn"]], "data_dep": [[14, 13], [16, 4], [17, 3], [18, 17], [20, 19], [21, 20], [22, 21], [23, 20], [24, 23], [26, 25], [29, 27], [34, 13], [35, 34], [37, 70], [37, 35], [38, 37], [39, 35], [39, 70], [40, 39], [41, 70], [41, 35], [42, 41], [43, 40], [44, 42], [46, 45], [47, 46], [48, 47], [52, 70], [52, 35], [53, 52], [54, 70], [54, 35], [55, 54], [56, 46], [57, 55], [58, 56], [60, 59], [61, 60], [64, 46], [65, 64], [68, 35], [68, 70], [69, 68], [70, 69], [71, 35], [71, 70], [72, 71], [75, 13], [76, 75], [78, 46], [80, 78], [80, 32]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/c2a2b5404737108dc4c32df8ab1d39a5df674831900c1c518dcf26f85e3a8841_c2a2b5404737108dc4c32df8ab1d39a5df674831900c1c518dcf26f85e3a8841.jsonl.gz", "strip_func_name": "sub_401473", "query": "\n\n\n__int64 __fastcall sub_401473(const char *a1, const char *a2)\n{\nconst char *v2; // rax\n__int64 result; // rax\nstruct addrinfo *pai; // [rsp+18h] [rbp-58h] BYREF\nstruct addrinfo req; // [rsp+20h] [rbp-50h] BYREF\nint ecode; // [rsp+5Ch] [rbp-14h]\nstruct addrinfo *i; // [rsp+60h] [rbp-10h]\nint fd; // [rsp+6Ch] [rbp-4h]\n\n*(_QWORD *)&req.ai_flags = 0x200000000LL;\n*(_QWORD *)&req.ai_socktype = 1LL;\n*(_QWORD *)&req.ai_addrlen = 0LL;\nreq.ai_addr = 0LL;\nreq.ai_canonname = 0LL;\nreq.ai_next = 0LL;\npai = 0LL;\necode = getaddrinfo(a1, a2, &req, &pai);\nif ( ecode )\n{\nv2 = gai_strerror(ecode);\nfprintf(stderr, \"getaddrinfo failed: %s\\n\", v2);\nresult = 0xFFFFFFFFLL;\n}\nelse\n{\nfor ( i = pai; i; i = i->ai_next )\n{\nfd = socket(i->ai_family, i->ai_socktype, i->ai_protocol);\nif ( fd >= 0 )\n{\nif ( !connect(fd, i->ai_addr, i->ai_addrlen) )\nbreak;\nperror(\"connect\");\nclose(fd);\n}\nelse\n{\nperror(\"socket\");\n}\n}\nfreeaddrinfo(pai);\nresult = (unsigned int)fd;\n}\nreturn result;\n}\n\n\n\nQ:[a1,a2,v2,pai,req,i,sub_401473,]", "hints": "[]", "response": "{'a1': 'node', 'a2': 'service', 'v2': 'result', 'pai': 'res', 'req': 'hints', 'i': 'addrinfo', 'sub_401473': 'tcp_connect'}"} | [
[
0.8177611231803894,
0.7819749116897583,
0.7536657452583313,
0.7536524534225464,
0.7435855865478516,
0.7417925596237183,
0.7399498820304871,
0.7375174760818481,
0.7356522083282471,
0.7254717350006104,
0.7223466634750366,
0.7218796014785767,
0.7208371162414551,
0.717393159866333,
0.7168088555335999,
0.7116777300834656,
0.7103669047355652,
0.704627513885498,
0.700350284576416,
0.6968243718147278
],
[
18986,
105102,
93681,
187106,
212227,
221735,
7727,
85295,
129585,
2142,
73911,
34452,
27960,
185074,
199460,
29544,
99707,
60575,
187950,
14902
]
] |
|
generate_slug | 2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567 | solusipse | fiche | NA | static void generate_slug(char **output, uint8_t length, uint8_t extra_length) {
// Realloc buffer for slug when we want it to be bigger
// This happens in case when directory with this name already
// exists. To save time, we don't generate new slugs until
// we spot an available one. We add another letter instead.
if (extra_length > 0) {
free(*output);
}
// Create a buffer for slug with extra_length if any
*output = calloc(length + 1 + extra_length, sizeof(char));
if (*output == NULL) {
return;
}
// Take n-th symbol from symbol table and use it for slug generation
for (int i = 0; i < length + extra_length; i++) {
int n = rand_r(&seed) % strlen(Fiche_Symbols);
*(output[0] + sizeof(char) * i) = Fiche_Symbols[n];
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402277", "function_addr": 4203127, "binary_name": "2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push rbx"], [3, "sub rsp, 28h"], [4, "mov [rbp+var_28], rdi"], [5, "mov ecx, esi"], [6, "mov eax, edx"], [7, "mov edx, ecx"], [8, "mov [rbp+var_2C], dl"], [9, "mov [rbp+var_30], al"], [10, "cmp [rbp+var_30], 0"], [11, "jz short loc_4022A5"], [12, "mov rax, [rbp+var_28]"], [13, "mov rax, [rax]"], [14, "mov rdi, rax"], [15, "call _free"], [16, "movzx eax, [rbp+var_2C]"], [17, "lea edx, [rax+1]"], [18, "movzx eax, [rbp+var_30]"], [19, "add eax, edx"], [20, "cdqe"], [21, "mov esi, 1"], [22, "mov rdi, rax"], [23, "call _calloc"], [24, "mov rdx, rax"], [25, "mov rax, [rbp+var_28]"], [26, "mov [rax], rdx"], [27, "mov rax, [rbp+var_28]"], [28, "mov rax, [rax]"], [29, "test rax, rax"], [30, "jz short loc_40234C"], [31, "mov [rbp+var_14], 0"], [32, "jmp short loc_40233B"], [33, "mov edi, offset seed"], [34, "call _rand_r"], [35, "movsxd rbx, eax"], [36, "mov rax, cs:off_405178"], [37, "mov rdi, rax"], [38, "call _strlen"], [39, "mov rsi, rax"], [40, "mov rax, rbx"], [41, "mov edx, 0"], [42, "div rsi"], [43, "mov rcx, rdx"], [44, "mov rax, rcx"], [45, "mov [rbp+var_18], eax"], [46, "mov rdx, cs:off_405178"], [47, "mov eax, [rbp+var_18]"], [48, "cdqe"], [49, "lea rcx, [rdx+rax]"], [50, "mov rax, [rbp+var_28]"], [51, "mov rdx, [rax]"], [52, "mov eax, [rbp+var_14]"], [53, "cdqe"], [54, "add rdx, rax"], [55, "movzx eax, byte ptr [rcx]"], [56, "mov [rdx], al"], [57, "add [rbp+var_14], 1"], [58, "movzx edx, [rbp+var_2C]"], [59, "movzx eax, [rbp+var_30]"], [60, "add eax, edx"], [61, "cmp [rbp+var_14], eax"], [62, "jl short loc_4022E0"], [63, "jmp short loc_40234D"], [64, "nop"], [65, "mov rbx, [rbp+var_8]"], [66, "leave"], [67, "retn"]], "data_dep": [[7, 5], [8, 7], [9, 6], [10, 9], [11, 10], [12, 4], [13, 12], [14, 13], [16, 8], [17, 7], [17, 16], [18, 9], [19, 18], [19, 17], [22, 19], [24, 23], [25, 4], [26, 24], [26, 25], [27, 4], [28, 27], [28, 26], [29, 28], [30, 29], [35, 34], [37, 36], [39, 38], [40, 35], [42, 39], [43, 41], [44, 43], [45, 44], [47, 45], [49, 26], [49, 47], [49, 56], [49, 43], [50, 4], [51, 50], [51, 56], [51, 26], [52, 57], [52, 31], [54, 52], [54, 51], [55, 26], [55, 56], [55, 49], [56, 55], [56, 54], [57, 57], [57, 31], [58, 8], [59, 9], [60, 59], [60, 58], [61, 57], [61, 60], [61, 31], [62, 61], [67, 60], [67, 29]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567_2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567.jsonl.gz", "strip_func_name": "sub_402277", "query": "\n\n\nvoid *__fastcall sub_402277(void **a1, unsigned __int8 a2, unsigned __int8 a3)\n{\nvoid *result; // rax\nunsigned __int64 v4; // rbx\nint i; // [rsp+1Ch] [rbp-14h]\n\nif ( a3 )\nfree(*a1);\n*a1 = calloc(a2 + 1 + a3, 1uLL);\nresult = *a1;\nif ( *a1 )\n{\nfor ( i = 0; ; ++i )\n{\nresult = (void *)(a2 + (unsigned int)a3);\nif ( i >= (int)result )\nbreak;\nv4 = rand_r(&seed);\n*((_BYTE *)*a1 + i) = off_405178[(int)(v4 % strlen(off_405178))];\n}\n}\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,sub_402277,]", "hints": "[]", "response": "{'a3': 'extra_length', 'a1': 'output', 'a2': 'length', 'sub_402277': 'generate_slug'}"} | [
[
0.7294408082962036,
0.7019400000572205,
0.6905611753463745,
0.6845787167549133,
0.6791456341743469,
0.6778247356414795,
0.6771995425224304,
0.6746401190757751,
0.6640446186065674,
0.6632499098777771,
0.6622559428215027,
0.6613804697990417,
0.6607527136802673,
0.6605930328369141,
0.6603288054466248,
0.6592869758605957,
0.6582893133163452,
0.6582038998603821,
0.6559407711029053,
0.6535083055496216
],
[
52939,
132248,
189374,
157941,
61305,
19315,
145559,
142349,
74975,
83904,
168299,
43561,
42487,
174307,
48875,
126487,
19239,
24042,
83657,
155845
]
] |
|
create_threads | 7e4d48d3e470410ab6f608a6efa37f2e7e934463f558e9ab26ac5aec13f071c7 | marmolak | gray486linux | NA | static int create_threads(int num, struct futex_info *finfo)
{
int i;
for (i = 0; i < num; i++) {
int next_nr;
finfo[i].nr = i;
/*
* Thread 'i' will wait on this mutex to
* be unlocked. Lock it immediately after
* initialization:
*/
pthread_mutex_init(&finfo[i].mutex, NULL);
pthread_mutex_lock(&finfo[i].mutex);
next_nr = (i + 1) % num;
finfo[i].next = &finfo[next_nr];
if (pthread_create(&finfo[i].thread, NULL, check_tiledata, &finfo[i]))
fatal_error("pthread_create()");
}
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4021A0", "function_addr": 4202912, "binary_name": "7e4d48d3e470410ab6f608a6efa37f2e7e934463f558e9ab26ac5aec13f071c7.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_14], edi"], [4, "mov [rbp+var_20], rsi"], [5, "mov [rbp+var_4], 0"], [6, "jmp loc_4022A6"], [7, "mov eax, [rbp+var_4]"], [8, "cdqe"], [9, "shl rax, 6"], [10, "mov rdx, rax"], [11, "mov rax, [rbp+var_20]"], [12, "add rdx, rax"], [13, "mov eax, [rbp+var_4]"], [14, "mov [rdx+8], eax"], [15, "mov eax, [rbp+var_4]"], [16, "cdqe"], [17, "shl rax, 6"], [18, "mov rdx, rax"], [19, "mov rax, [rbp+var_20]"], [20, "add rax, rdx"], [21, "add rax, 10h"], [22, "mov esi, 0"], [23, "mov rdi, rax"], [24, "call _pthread_mutex_init"], [25, "mov eax, [rbp+var_4]"], [26, "cdqe"], [27, "shl rax, 6"], [28, "mov rdx, rax"], [29, "mov rax, [rbp+var_20]"], [30, "add rax, rdx"], [31, "add rax, 10h"], [32, "mov rdi, rax"], [33, "call _pthread_mutex_lock"], [34, "mov eax, [rbp+var_4]"], [35, "add eax, 1"], [36, "cdq"], [37, "idiv [rbp+var_14]"], [38, "mov [rbp+var_8], edx"], [39, "mov eax, [rbp+var_8]"], [40, "cdqe"], [41, "shl rax, 6"], [42, "mov rcx, rax"], [43, "mov eax, [rbp+var_4]"], [44, "cdqe"], [45, "shl rax, 6"], [46, "mov rdx, rax"], [47, "mov rax, [rbp+var_20]"], [48, "add rax, rdx"], [49, "mov rdx, [rbp+var_20]"], [50, "add rdx, rcx"], [51, "mov [rax+38h], rdx"], [52, "mov eax, [rbp+var_4]"], [53, "cdqe"], [54, "shl rax, 6"], [55, "mov rdx, rax"], [56, "mov rax, [rbp+var_20]"], [57, "add rax, rdx"], [58, "mov edx, [rbp+var_4]"], [59, "movsxd rdx, edx"], [60, "mov rcx, rdx"], [61, "shl rcx, 6"], [62, "mov rdx, [rbp+var_20]"], [63, "add rdx, rcx"], [64, "mov rdi, rdx"], [65, "mov rcx, rax"], [66, "mov edx, offset start_routine"], [67, "mov esi, 0"], [68, "call _pthread_create"], [69, "test eax, eax"], [70, "jz short loc_4022A2"], [71, "mov esi, offset aFailPthreadCre"], [72, "mov edi, 1"], [73, "mov eax, 0"], [74, "call _err"], [75, "add [rbp+var_4], 1"], [76, "mov eax, [rbp+var_4]"], [77, "cmp eax, [rbp+var_14]"], [78, "jl loc_4021BB"], [79, "mov eax, 0"], [80, "leave"], [81, "retn"]], "data_dep": [[7, 5], [7, 75], [9, 7], [10, 9], [11, 4], [12, 10], [12, 11], [13, 5], [13, 75], [14, 13], [14, 12], [15, 5], [15, 75], [17, 15], [18, 17], [19, 4], [20, 19], [20, 18], [21, 20], [23, 21], [25, 75], [25, 5], [27, 25], [28, 27], [29, 4], [30, 29], [30, 28], [31, 30], [32, 31], [34, 5], [34, 75], [35, 34], [37, 3], [37, 37], [38, 28], [39, 38], [41, 39], [42, 41], [43, 5], [43, 75], [45, 43], [46, 45], [47, 4], [48, 47], [48, 46], [49, 4], [50, 49], [50, 42], [51, 50], [51, 48], [52, 5], [52, 75], [54, 52], [55, 54], [56, 4], [57, 56], [57, 55], [58, 5], [58, 75], [59, 58], [60, 59], [61, 60], [62, 4], [63, 61], [63, 62], [64, 63], [65, 57], [69, 68], [70, 69], [75, 5], [75, 75], [76, 5], [76, 75], [77, 37], [77, 76], [77, 3], [78, 77], [81, 79]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7e4d48d3e470410ab6f608a6efa37f2e7e934463f558e9ab26ac5aec13f071c7_7e4d48d3e470410ab6f608a6efa37f2e7e934463f558e9ab26ac5aec13f071c7.jsonl.gz", "strip_func_name": "sub_4021A0", "query": "\n\n\n__int64 __fastcall sub_4021A0(int a1, __int64 a2)\n{\nint i; // [rsp+1Ch] [rbp-4h]\n\nfor ( i = 0; i < a1; ++i )\n{\n*(_DWORD *)(a2 + ((__int64)i << 6) + 8) = i;\npthread_mutex_init((pthread_mutex_t *)(((__int64)i << 6) + a2 + 16), 0LL);\npthread_mutex_lock((pthread_mutex_t *)(((__int64)i << 6) + a2 + 16));\n*(_QWORD *)(((__int64)i << 6) + a2 + 56) = ((__int64)((i + 1) % a1) << 6) + a2;\nif ( pthread_create((pthread_t *)(((__int64)i << 6) + a2), 0LL, start_routine, (void *)(((__int64)i << 6) + a2)) )\nerr(1, \"[FAIL]\\tpthread_create()\");\n}\nreturn 0LL;\n}\n\n\n\nQ:[a1,a2,sub_4021A0,]", "hints": "[]", "response": "{'a1': 'num', 'a2': 'finfo', 'sub_4021A0': 'create_threads'}"} | [
[
0.7569763660430908,
0.7325035929679871,
0.7248110771179199,
0.7192845344543457,
0.7150642275810242,
0.7064877152442932,
0.6981839537620544,
0.697960615158081,
0.6924233436584473,
0.6889646053314209,
0.6877927184104919,
0.6872478127479553,
0.6836485862731934,
0.6821725368499756,
0.6814031600952148,
0.6749278903007507,
0.6676108241081238,
0.6672859787940979,
0.6639747619628906,
0.6623002290725708
],
[
94741,
43290,
60970,
144829,
29875,
13592,
156374,
143911,
139184,
201959,
75309,
127819,
249798,
187894,
145895,
203711,
49911,
37425,
142998,
45575
]
] |
|
print_options | 59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd | microsoft | dsb | NA | static void
print_options(struct OPTION_T *o, int bShowOptional)
{
int i,
w_adjust,
bShow = 0,
nCount = 0;
for (i=0; options[i].name != NULL; i++)
{
/*
* options come in two groups, general and "hidden". Decide which group to show
* in this pass, and ignore others
*/
bShow = 0;
if (bShowOptional && (o[i].flags & OPT_ADV))
bShow = 1;
if (!bShowOptional && !(o[i].flags & OPT_ADV))
bShow = 1;
if (!bShow || (o[i].flags & OPT_HIDE))
continue;
nCount += 1;
printf("%s = ", o[i].name);
w_adjust = 15 - strlen(o[i].name);
if (o[i].flags & OPT_INT)
printf(" <n> ");
else if (o[i].flags & OPT_STR)
printf(" <s> ");
else if (o[i].flags & OPT_SUB)
printf(" <opt> ");
else if (o[i].flags & OPT_FLG)
printf(" [Y|N] ");
else printf(" ");
printf("%*s-- %s", w_adjust, " ", o[i].usage);
if (o[i].flags & OPT_NOP)
printf(" NOT IMPLEMENTED");
printf("\n");
}
if (nCount == 0)
printf("None defined.\n");
return;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40A557", "function_addr": 4236631, "binary_name": "59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_1C], esi"], [5, "mov [rbp+var_8], 0"], [6, "mov [rbp+var_C], 0"], [7, "mov [rbp+var_4], 0"], [8, "jmp loc_40A814"], [9, "mov [rbp+var_8], 0"], [10, "cmp [rbp+var_1C], 0"], [11, "jz short loc_40A5BC"], [12, "mov eax, [rbp+var_4]"], [13, "movsxd rdx, eax"], [14, "mov rax, rdx"], [15, "shl rax, 2"], [16, "add rax, rdx"], [17, "shl rax, 3"], [18, "mov rdx, rax"], [19, "mov rax, [rbp+var_18]"], [20, "add rax, rdx"], [21, "mov eax, [rax+8]"], [22, "and eax, 20h"], [23, "test eax, eax"], [24, "jz short loc_40A5BC"], [25, "mov [rbp+var_8], 1"], [26, "cmp [rbp+var_1C], 0"], [27, "jnz short loc_40A5F1"], [28, "mov eax, [rbp+var_4]"], [29, "movsxd rdx, eax"], [30, "mov rax, rdx"], [31, "shl rax, 2"], [32, "add rax, rdx"], [33, "shl rax, 3"], [34, "mov rdx, rax"], [35, "mov rax, [rbp+var_18]"], [36, "add rax, rdx"], [37, "mov eax, [rax+8]"], [38, "and eax, 20h"], [39, "test eax, eax"], [40, "jnz short loc_40A5F1"], [41, "mov [rbp+var_8], 1"], [42, "cmp [rbp+var_8], 0"], [43, "jz loc_40A80F"], [44, "mov eax, [rbp+var_4]"], [45, "movsxd rdx, eax"], [46, "mov rax, rdx"], [47, "shl rax, 2"], [48, "add rax, rdx"], [49, "shl rax, 3"], [50, "mov rdx, rax"], [51, "mov rax, [rbp+var_18]"], [52, "add rax, rdx"], [53, "mov eax, [rax+8]"], [54, "and eax, 200h"], [55, "test eax, eax"], [56, "jnz loc_40A80F"], [57, "add [rbp+var_C], 1"], [58, "mov eax, [rbp+var_4]"], [59, "movsxd rdx, eax"], [60, "mov rax, rdx"], [61, "shl rax, 2"], [62, "add rax, rdx"], [63, "shl rax, 3"], [64, "mov rdx, rax"], [65, "mov rax, [rbp+var_18]"], [66, "add rax, rdx"], [67, "mov rax, [rax]"], [68, "mov rsi, rax"], [69, "mov edi, offset aS_1"], [70, "mov eax, 0"], [71, "call _printf"], [72, "mov eax, [rbp+var_4]"], [73, "movsxd rdx, eax"], [74, "mov rax, rdx"], [75, "shl rax, 2"], [76, "add rax, rdx"], [77, "shl rax, 3"], [78, "mov rdx, rax"], [79, "mov rax, [rbp+var_18]"], [80, "add rax, rdx"], [81, "mov rax, [rax]"], [82, "mov rdi, rax"], [83, "call _strlen"], [84, "mov edx, eax"], [85, "mov eax, 0Fh"], [86, "sub eax, edx"], [87, "mov [rbp+var_10], eax"], [88, "mov eax, [rbp+var_4]"], [89, "movsxd rdx, eax"], [90, "mov rax, rdx"], [91, "shl rax, 2"], [92, "add rax, rdx"], [93, "shl rax, 3"], [94, "mov rdx, rax"], [95, "mov rax, [rbp+var_18]"], [96, "add rax, rdx"], [97, "mov eax, [rax+8]"], [98, "and eax, 2"], [99, "test eax, eax"], [100, "jz short loc_40A6D1"], [101, "mov edi, offset aN"], [102, "mov eax, 0"], [103, "call _printf"], [104, "jmp loc_40A78E"], [105, "mov eax, [rbp+var_4]"], [106, "movsxd rdx, eax"], [107, "mov rax, rdx"], [108, "shl rax, 2"], [109, "add rax, rdx"], [110, "shl rax, 3"], [111, "mov rdx, rax"], [112, "mov rax, [rbp+var_18]"], [113, "add rax, rdx"], [114, "mov eax, [rax+8]"], [115, "and eax, 4"], [116, "test eax, eax"], [117, "jz short loc_40A70D"], [118, "mov edi, offset aS_2"], [119, "mov eax, 0"], [120, "call _printf"], [121, "jmp loc_40A78E"], [122, "mov eax, [rbp+var_4]"], [123, "movsxd rdx, eax"], [124, "mov rax, rdx"], [125, "shl rax, 2"], [126, "add rax, rdx"], [127, "shl rax, 3"], [128, "mov rdx, rax"], [129, "mov rax, [rbp+var_18]"], [130, "add rax, rdx"], [131, "mov eax, [rax+8]"], [132, "and eax, 10h"], [133, "test eax, eax"], [134, "jz short loc_40A746"], [135, "mov edi, offset aOpt"], [136, "mov eax, 0"], [137, "call _printf"], [138, "jmp short loc_40A78E"], [139, "mov eax, [rbp+var_4]"], [140, "movsxd rdx, eax"], [141, "mov rax, rdx"], [142, "shl rax, 2"], [143, "add rax, rdx"], [144, "shl rax, 3"], [145, "mov rdx, rax"], [146, "mov rax, [rbp+var_18]"], [147, "add rax, rdx"], [148, "mov eax, [rax+8]"], [149, "and eax, 1"], [150, "test eax, eax"], [151, "jz short loc_40A77F"], [152, "mov edi, offset aYN"], [153, "mov eax, 0"], [154, "call _printf"], [155, "jmp short loc_40A78E"], [156, "mov edi, offset asc_40D504"], [157, "mov eax, 0"], [158, "call _printf"], [159, "mov eax, [rbp+var_4]"], [160, "movsxd rdx, eax"], [161, "mov rax, rdx"], [162, "shl rax, 2"], [163, "add rax, rdx"], [164, "shl rax, 3"], [165, "mov rdx, rax"], [166, "mov rax, [rbp+var_18]"], [167, "add rax, rdx"], [168, "mov rdx, [rax+10h]"], [169, "mov eax, [rbp+var_10]"], [170, "mov rcx, rdx"], [171, "mov edx, offset asc_40D50C"], [172, "mov esi, eax"], [173, "mov edi, offset aSS_1"], [174, "mov eax, 0"], [175, "call _printf"], [176, "mov eax, [rbp+var_4]"], [177, "movsxd rdx, eax"], [178, "mov rax, rdx"], [179, "shl rax, 2"], [180, "add rax, rdx"], [181, "shl rax, 3"], [182, "mov rdx, rax"], [183, "mov rax, [rbp+var_18]"], [184, "add rax, rdx"], [185, "mov eax, [rax+8]"], [186, "and eax, 8"], [187, "test eax, eax"], [188, "jz short loc_40A803"], [189, "mov edi, offset aNotImplemented"], [190, "mov eax, 0"], [191, "call _printf"], [192, "mov edi, 0Ah"], [193, "call _putchar"], [194, "jmp short loc_40A810"], [195, "nop"], [196, "add [rbp+var_4], 1"], [197, "mov eax, [rbp+var_4]"], [198, "movsxd rdx, eax"], [199, "mov rax, rdx"], [200, "shl rax, 2"], [201, "add rax, rdx"], [202, "shl rax, 3"], [203, "add rax, 411320h"], [204, "mov rax, [rax]"], [205, "test rax, rax"], [206, "jnz loc_40A580"], [207, "cmp [rbp+var_C], 0"], [208, "jnz short loc_40A84B"], [209, "mov edi, offset aNoneDefined_0"], [210, "call _puts"], [211, "nop"], [212, "nop"], [213, "leave"], [214, "retn"]], "data_dep": [[10, 4], [11, 10], [12, 196], [12, 7], [13, 12], [14, 13], [15, 14], [16, 13], [16, 15], [17, 16], [18, 17], [19, 3], [20, 19], [20, 18], [21, 20], [22, 21], [23, 22], [24, 23], [26, 4], [27, 26], [28, 7], [28, 196], [29, 28], [30, 29], [31, 30], [32, 29], [32, 31], [33, 32], [34, 33], [35, 3], [36, 34], [36, 35], [37, 36], [38, 37], [39, 38], [40, 39], [42, 41], [42, 25], [42, 9], [43, 42], [44, 7], [44, 196], [45, 44], [46, 45], [47, 46], [48, 45], [48, 47], [49, 48], [50, 49], [51, 3], [52, 51], [52, 50], [53, 52], [54, 53], [55, 54], [56, 55], [57, 57], [57, 6], [58, 7], [58, 196], [59, 58], [60, 59], [61, 60], [62, 59], [62, 61], [63, 62], [64, 63], [65, 3], [66, 64], [66, 65], [67, 66], [68, 67], [72, 196], [72, 7], [73, 72], [74, 73], [75, 74], [76, 73], [76, 75], [77, 76], [78, 77], [79, 3], [80, 78], [80, 79], [81, 80], [82, 81], [84, 83], [86, 85], [86, 84], [87, 86], [88, 7], [88, 196], [89, 88], [90, 89], [91, 90], [92, 89], [92, 91], [93, 92], [94, 93], [95, 3], [96, 95], [96, 94], [97, 96], [98, 97], [99, 98], [100, 99], [105, 7], [105, 196], [106, 105], [107, 106], [108, 107], [109, 106], [109, 108], [110, 109], [111, 110], [112, 3], [113, 112], [113, 111], [114, 113], [115, 114], [116, 115], [117, 116], [122, 7], [122, 196], [123, 122], [124, 123], [125, 124], [126, 123], [126, 125], [127, 126], [128, 127], [129, 3], [130, 128], [130, 129], [131, 130], [132, 131], [133, 132], [134, 133], [139, 7], [139, 196], [140, 139], [141, 140], [142, 141], [143, 142], [143, 140], [144, 143], [145, 144], [146, 3], [147, 146], [147, 145], [148, 147], [149, 148], [150, 149], [151, 150], [159, 7], [159, 196], [160, 159], [161, 160], [162, 161], [163, 160], [163, 162], [164, 163], [165, 164], [166, 3], [167, 166], [167, 165], [168, 167], [169, 87], [170, 168], [172, 169], [176, 7], [176, 196], [177, 176], [178, 177], [179, 178], [180, 177], [180, 179], [181, 180], [182, 181], [183, 3], [184, 182], [184, 183], [185, 184], [186, 185], [187, 186], [188, 187], [196, 7], [196, 196], [197, 7], [197, 196], [198, 197], [199, 198], [200, 199], [201, 198], [201, 200], [202, 201], [203, 202], [204, 203], [205, 204], [206, 205], [207, 57], [207, 6], [208, 207], [214, 205], [214, 210]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd_59e0648dc3d2e9379b4cecf91d33c8862748195708ab3133972cad6269e9b2cd.jsonl.gz", "strip_func_name": "sub_40A557", "query": "\n\n\nint __fastcall sub_40A557(__int64 a1, int a2)\n{\nchar *v2; // rax\nint v4; // [rsp+10h] [rbp-10h]\nint v5; // [rsp+14h] [rbp-Ch]\nint v6; // [rsp+18h] [rbp-8h]\nint i; // [rsp+1Ch] [rbp-4h]\n\nv5 = 0;\nfor ( i = 0; ; ++i )\n{\nv2 = (&off_411320)[5 * i];\nif ( !v2 )\nbreak;\nv6 = 0;\nif ( a2 && (*(_DWORD *)(40LL * i + a1 + 8) & 0x20) != 0 )\nv6 = 1;\nif ( !a2 && (*(_DWORD *)(40LL * i + a1 + 8) & 0x20) == 0 )\nv6 = 1;\nif ( v6 && (*(_DWORD *)(40LL * i + a1 + 8) & 0x200) == 0 )\n{\n++v5;\nprintf(\"%s = \", *(const char **)(40LL * i + a1));\nv4 = 15 - strlen(*(const char **)(40LL * i + a1));\nif ( (*(_DWORD *)(40LL * i + a1 + 8) & 2) != 0 )\n{\nprintf(\" <n> \");\n}\nelse if ( (*(_DWORD *)(40LL * i + a1 + 8) & 4) != 0 )\n{\nprintf(\" <s> \");\n}\nelse if ( (*(_DWORD *)(40LL * i + a1 + 8) & 0x10) != 0 )\n{\nprintf(\" <opt> \");\n}\nelse if ( (*(_DWORD *)(40LL * i + a1 + 8) & 1) != 0 )\n{\nprintf(\" [Y|N] \");\n}\nelse\n{\nprintf(\" \");\n}\nprintf(\"%*s-- %s\", v4, \" \", *(const char **)(40LL * i + a1 + 16));\nif ( (*(_DWORD *)(40LL * i + a1 + 8) & 8) != 0 )\nprintf(\" NOT IMPLEMENTED\");\nputchar(10);\n}\n}\nif ( !v5 )\nLODWORD(v2) = puts(\"None defined.\");\nreturn (int)v2;\n}\n\n\n\nQ:[a1,a2,v4,v5,v6,sub_40A557,]", "hints": "[]", "response": "{'a1': 'o', 'a2': 'bShowOptional', 'v4': 'w_adjust', 'v5': 'nCount', 'v6': 'bShow', 'sub_40A557': 'print_options'}"} | [
[
0.7494309544563293,
0.7410684823989868,
0.7404880523681641,
0.7391204237937927,
0.7172638773918152,
0.7031137347221375,
0.6963422894477844,
0.6944141387939453,
0.6765133142471313,
0.6731851100921631,
0.6718193888664246,
0.6700292229652405,
0.6676967144012451,
0.6644123196601868,
0.6623601913452148,
0.6600771546363831,
0.6583968997001648,
0.6546334028244019,
0.6530704498291016,
0.6525693535804749
],
[
103852,
239984,
243443,
14181,
163427,
182054,
76289,
208360,
151299,
174950,
10318,
175548,
148814,
25185,
69745,
152495,
43439,
69425,
19578,
113607
]
] |
|
DynBuffer_release | ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e | RealTimeLogic | BAS | NA | BA_API void
DynBuffer_release(DynBuffer* o)
{
BufPrint* fdc37m81xconfig = (BufPrint*)o;
if(fdc37m81xconfig->buf)
{
AllocatorIntf_free(o->alloc, fdc37m81xconfig->buf);
fdc37m81xconfig->buf=0;
fdc37m81xconfig->cursor=0;
fdc37m81xconfig->bufSize=0;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_41DD67", "function_addr": 4316519, "binary_name": "ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov rax, [rbp+var_18]"], [5, "mov [rbp+var_8], rax"], [6, "mov rax, [rbp+var_8]"], [7, "mov rax, [rax+10h]"], [8, "test rax, rax"], [9, "jz short loc_41DDCE"], [10, "mov rax, [rbp+var_18]"], [11, "mov rax, [rax+20h]"], [12, "mov rcx, [rax+10h]"], [13, "mov rax, [rbp+var_8]"], [14, "mov rdx, [rax+10h]"], [15, "mov rax, [rbp+var_18]"], [16, "mov rax, [rax+20h]"], [17, "mov rsi, rdx"], [18, "mov rdi, rax"], [19, "call rcx"], [20, "mov rax, [rbp+var_8]"], [21, "mov qword ptr [rax+10h], 0"], [22, "mov rax, [rbp+var_8]"], [23, "mov dword ptr [rax+18h], 0"], [24, "mov rax, [rbp+var_8]"], [25, "mov dword ptr [rax+1Ch], 0"], [26, "nop"], [27, "leave"], [28, "retn"]], "data_dep": [[4, 3], [5, 4], [6, 5], [7, 6], [8, 7], [9, 8], [10, 3], [11, 10], [12, 11], [13, 5], [14, 13], [15, 3], [16, 15], [17, 14], [18, 16], [19, 12], [20, 5], [21, 20], [22, 5], [23, 22], [24, 5], [25, 24], [28, 24], [28, 8]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e_ff8ff7374fd9abd9716a29b0df0eb0854160b16481658efc9dc3c2fb8b26960e.jsonl.gz", "strip_func_name": "sub_41DD67", "query": "\n\n\n__int64 __fastcall sub_41DD67(__int64 a1)\n{\n__int64 result; // rax\n\nresult = *(_QWORD *)(a1 + 16);\nif ( result )\n{\n(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)(a1 + 32) + 16LL))(*(_QWORD *)(a1 + 32), *(_QWORD *)(a1 + 16));\n*(_QWORD *)(a1 + 16) = 0LL;\n*(_DWORD *)(a1 + 24) = 0;\nresult = a1;\n*(_DWORD *)(a1 + 28) = 0;\n}\nreturn result;\n}\n\n\n\nQ:[a1,sub_41DD67,]", "hints": "[]", "response": "{'a1': 'o', 'sub_41DD67': 'DynBuffer_release'}"} | [
[
0.8622984886169434,
0.8610539436340332,
0.8574026823043823,
0.8265751600265503,
0.823261022567749,
0.8221436738967896,
0.7859541177749634,
0.7776105999946594,
0.7759072780609131,
0.775333821773529,
0.7715686559677124,
0.769465446472168,
0.7666040062904358,
0.7620364427566528,
0.7562127113342285,
0.7532192468643188,
0.7515100836753845,
0.7477498650550842,
0.7458727359771729,
0.7445095777511597
],
[
155719,
113788,
203645,
83280,
61452,
80749,
12297,
62273,
62815,
8406,
31864,
104662,
429,
262193,
28971,
7731,
201321,
13423,
219801,
245134
]
] |
|
create_directory | 2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567 | solusipse | fiche | NA | static int create_directory(char *output_dir, char *slug) {
if (!slug) {
return -1;
}
// Additional byte is for the slash
size_t len = strlen(output_dir) + strlen(slug) + 2;
// Generate a path
char *path = malloc(len);
if (!path) {
return -1;
}
snprintf(path, len, "%s%s%s", output_dir, "/", slug);
// Create output directory, just in case
mkdir(output_dir, S_IRWXU | S_IRGRP | S_IROTH | S_IXOTH | S_IXGRP);
// Create slug directory
const int r = mkdir(
path,
S_IRWXU | S_IRGRP | S_IROTH | S_IXOTH | S_IXGRP
);
free(path);
return r;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402353", "function_addr": 4203347, "binary_name": "2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push rbx"], [3, "sub rsp, 38h"], [4, "mov [rbp+s], rdi"], [5, "mov [rbp+var_40], rsi"], [6, "cmp [rbp+var_40], 0"], [7, "jnz short loc_402375"], [8, "mov eax, 0FFFFFFFFh"], [9, "jmp loc_40241B"], [10, "mov rax, [rbp+s]"], [11, "mov rdi, rax"], [12, "call _strlen"], [13, "mov rbx, rax"], [14, "mov rax, [rbp+var_40]"], [15, "mov rdi, rax"], [16, "call _strlen"], [17, "add rax, rbx"], [18, "add rax, 2"], [19, "mov [rbp+size], rax"], [20, "mov rax, [rbp+size]"], [21, "mov rdi, rax"], [22, "call _malloc"], [23, "mov [rbp+path], rax"], [24, "cmp [rbp+path], 0"], [25, "jnz short loc_4023B9"], [26, "mov eax, 0FFFFFFFFh"], [27, "jmp short loc_40241B"], [28, "mov rcx, [rbp+var_40]"], [29, "mov rdx, [rbp+s]"], [30, "mov rsi, [rbp+size]"], [31, "mov rax, [rbp+path]"], [32, "mov r9, rcx"], [33, "mov r8d, offset asc_4036B8"], [34, "mov rcx, rdx"], [35, "mov edx, offset aSSS"], [36, "mov rdi, rax"], [37, "mov eax, 0"], [38, "call _snprintf"], [39, "mov rax, [rbp+s]"], [40, "mov esi, 1EDh"], [41, "mov rdi, rax"], [42, "call _mkdir"], [43, "mov rax, [rbp+path]"], [44, "mov esi, 1EDh"], [45, "mov rdi, rax"], [46, "call _mkdir"], [47, "mov [rbp+var_24], eax"], [48, "mov rax, [rbp+path]"], [49, "mov rdi, rax"], [50, "call _free"], [51, "mov eax, [rbp+var_24]"], [52, "mov rbx, [rbp+var_8]"], [53, "leave"], [54, "retn"]], "data_dep": [[6, 5], [7, 6], [10, 4], [11, 10], [13, 12], [14, 5], [15, 14], [17, 16], [17, 13], [18, 17], [19, 18], [20, 19], [21, 20], [23, 22], [24, 23], [25, 24], [28, 5], [29, 4], [30, 19], [31, 23], [32, 28], [34, 29], [36, 31], [39, 4], [41, 39], [43, 23], [45, 43], [47, 46], [48, 23], [49, 48], [51, 47], [54, 51], [54, 8], [54, 26]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567_2f9a70287dba42e5f72b74bacaaa190f03def97bf7d7c0c64d2141f0330e0567.jsonl.gz", "strip_func_name": "sub_402353", "query": "\n\n\n__int64 __fastcall sub_402353(const char *a1, const char *a2)\n{\nsize_t v3; // rbx\nunsigned int v4; // [rsp+1Ch] [rbp-24h]\nchar *path; // [rsp+20h] [rbp-20h]\nsize_t size; // [rsp+28h] [rbp-18h]\n\nif ( !a2 )\nreturn 0xFFFFFFFFLL;\nv3 = strlen(a1);\nsize = v3 + strlen(a2) + 2;\npath = (char *)malloc(size);\nif ( !path )\nreturn 0xFFFFFFFFLL;\nsnprintf(path, size, \"%s%s%s\", a1, \"/\", a2);\nmkdir(a1, 0x1EDu);\nv4 = mkdir(path, 0x1EDu);\nfree(path);\nreturn v4;\n}\n\n\n\nQ:[a1,a2,v4,size,sub_402353,]", "hints": "[]", "response": "{'a1': 'output_dir', 'a2': 'slug', 'v4': 'r', 'size': 'len', 'sub_402353': 'create_directory'}"} | [
[
0.8518528342247009,
0.7767437100410461,
0.7753773927688599,
0.7684204578399658,
0.764256477355957,
0.761533796787262,
0.7518913745880127,
0.7510131001472473,
0.7478273510932922,
0.7430679798126221,
0.7411268949508667,
0.7411145567893982,
0.7377965450286865,
0.7337808609008789,
0.7318466901779175,
0.7303715348243713,
0.7301883101463318,
0.7297099232673645,
0.7296156883239746,
0.729491114616394
],
[
230358,
237015,
228305,
158059,
211989,
19756,
35049,
62090,
226152,
140809,
114290,
88607,
23134,
75796,
246199,
257876,
70504,
127611,
59784,
20029
]
] |
|
setup_paging | ef6b4f95e3562335c5d08e18e7bf907d0be250d8b01d1e188e121c3a5f912f9f | david942j | kvm-kernel-example | NA | void setup_paging(VM *vm) {
struct kvm_sregs sregs;
if(ioctl(vm->vcpufd, KVM_GET_SREGS, &sregs) < 0) pexit("ioctl(KVM_GET_SREGS)");
uint64_t pml4_addr = MAX_KERNEL_SIZE;
uint64_t *pml4 = (void*) (vm->mem + pml4_addr);
uint64_t pdp_addr = pml4_addr + 0x1000;
uint64_t *pdp = (void*) (vm->mem + pdp_addr);
uint64_t pd_addr = pdp_addr + 0x1000;
uint64_t *pd = (void*) (vm->mem + pd_addr);
pml4[0] = PDE64_PRESENT | PDE64_RW | PDE64_USER | pdp_addr;
pdp[0] = PDE64_PRESENT | PDE64_RW | PDE64_USER | pd_addr;
pd[0] = PDE64_PRESENT | PDE64_RW | PDE64_PS; /* kernel only, no PED64_USER */
sregs.cr3 = pml4_addr;
sregs.cr4 = CR4_PAE;
sregs.cr4 |= CR4_OSFXSR | CR4_OSXMMEXCPT; /* enable SSE instruction */
sregs.cr0 = CR0_PE | CR0_MP | CR0_ET | CR0_NE | CR0_WP | CR0_AM | CR0_PG;
sregs.efer = EFER_LME | EFER_LMA;
sregs.efer |= EFER_SCE; /* enable syscall instruction */
if(ioctl(vm->vcpufd, KVM_SET_SREGS, &sregs) < 0) pexit("ioctl(KVM_SET_SREGS)");
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4014E1", "function_addr": 4199649, "binary_name": "ef6b4f95e3562335c5d08e18e7bf907d0be250d8b01d1e188e121c3a5f912f9f.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 180h"], [3, "mov [rbp+var_178], rdi"], [4, "mov rax, [rbp+var_178]"], [5, "mov eax, [rax+10h]"], [6, "lea rdx, [rbp+var_170]"], [7, "mov esi, 8138AE83h"], [8, "mov edi, eax"], [9, "mov eax, 0"], [10, "call _ioctl"], [11, "test eax, eax"], [12, "jns short loc_40152D"], [13, "mov edi, offset aIoctlKvmGetSre"], [14, "call _perror"], [15, "mov edi, 1"], [16, "call _exit"], [17, "mov [rbp+var_8], 1F7000h"], [18, "mov rax, [rbp+var_178]"], [19, "mov rdx, [rax]"], [20, "mov rax, [rbp+var_8]"], [21, "add rax, rdx"], [22, "mov [rbp+var_10], rax"], [23, "mov rax, [rbp+var_8]"], [24, "add rax, 1000h"], [25, "mov [rbp+var_18], rax"], [26, "mov rax, [rbp+var_178]"], [27, "mov rdx, [rax]"], [28, "mov rax, [rbp+var_18]"], [29, "add rax, rdx"], [30, "mov [rbp+var_20], rax"], [31, "mov rax, [rbp+var_18]"], [32, "add rax, 1000h"], [33, "mov [rbp+var_28], rax"], [34, "mov rax, [rbp+var_178]"], [35, "mov rdx, [rax]"], [36, "mov rax, [rbp+var_28]"], [37, "add rax, rdx"], [38, "mov [rbp+var_30], rax"], [39, "mov rax, [rbp+var_18]"], [40, "or rax, 7"], [41, "mov rdx, rax"], [42, "mov rax, [rbp+var_10]"], [43, "mov [rax], rdx"], [44, "mov rax, [rbp+var_28]"], [45, "or rax, 7"], [46, "mov rdx, rax"], [47, "mov rax, [rbp+var_20]"], [48, "mov [rax], rdx"], [49, "mov rax, [rbp+var_30]"], [50, "mov qword ptr [rax], 83h"], [51, "mov rax, [rbp+var_8]"], [52, "mov [rbp+var_80], rax"], [53, "mov [rbp+var_78], 20h "], [54, "mov rax, [rbp+var_78]"], [55, "or ah, 6"], [56, "mov [rbp+var_78], rax"], [57, "mov eax, 80050033h"], [58, "mov [rbp+var_90], rax"], [59, "mov [rbp+var_68], 500h"], [60, "mov rax, [rbp+var_68]"], [61, "or rax, 1"], [62, "mov [rbp+var_68], rax"], [63, "mov rax, [rbp+var_178]"], [64, "mov eax, [rax+10h]"], [65, "lea rdx, [rbp+var_170]"], [66, "mov esi, 4138AE84h"], [67, "mov edi, eax"], [68, "mov eax, 0"], [69, "call _ioctl"], [70, "test eax, eax"], [71, "jns short loc_401634"], [72, "mov edi, offset aIoctlKvmSetSre"], [73, "call _perror"], [74, "mov edi, 1"], [75, "call _exit"], [76, "nop"], [77, "leave"], [78, "retn"]], "data_dep": [[4, 3], [5, 4], [8, 5], [11, 10], [12, 11], [18, 3], [19, 18], [20, 17], [21, 19], [21, 20], [22, 21], [23, 17], [24, 23], [25, 24], [26, 3], [27, 26], [28, 25], [29, 28], [29, 27], [30, 29], [31, 25], [32, 31], [33, 32], [34, 3], [35, 34], [36, 33], [37, 36], [37, 35], [38, 37], [39, 25], [40, 39], [41, 40], [42, 22], [43, 42], [43, 41], [44, 33], [45, 44], [46, 45], [47, 30], [48, 47], [48, 46], [49, 38], [50, 49], [51, 17], [52, 51], [54, 53], [55, 54], [56, 55], [58, 57], [60, 59], [61, 60], [62, 61], [63, 3], [64, 50], [64, 63], [65, 46], [67, 64], [70, 69], [71, 70], [78, 70]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/ef6b4f95e3562335c5d08e18e7bf907d0be250d8b01d1e188e121c3a5f912f9f_ef6b4f95e3562335c5d08e18e7bf907d0be250d8b01d1e188e121c3a5f912f9f.jsonl.gz", "strip_func_name": "sub_4014E1", "query": "\n\n\nint __fastcall sub_4014E1(int *a1)\n{\nint result; // eax\nchar v2[224]; // [rsp+10h] [rbp-170h] BYREF\n__int64 v3; // [rsp+F0h] [rbp-90h]\n__int64 v4; // [rsp+100h] [rbp-80h]\n__int64 v5; // [rsp+108h] [rbp-78h]\n__int64 v6; // [rsp+118h] [rbp-68h]\n_QWORD *v7; // [rsp+150h] [rbp-30h]\n__int64 v8; // [rsp+158h] [rbp-28h]\n__int64 *v9; // [rsp+160h] [rbp-20h]\n__int64 v10; // [rsp+168h] [rbp-18h]\n_QWORD *v11; // [rsp+170h] [rbp-10h]\n__int64 v12; // [rsp+178h] [rbp-8h]\n\nif ( ioctl(a1[4], 0x8138AE83uLL, v2) < 0 )\n{\nperror(\"ioctl(KVM_GET_SREGS)\");\nexit(1);\n}\nv12 = 2060288LL;\nv11 = (_QWORD *)(*(_QWORD *)a1 + 2060288LL);\nv10 = 2064384LL;\nv9 = (__int64 *)(*(_QWORD *)a1 + 2064384LL);\nv8 = 2068480LL;\nv7 = (_QWORD *)(*(_QWORD *)a1 + 2068480LL);\n*v11 = 2064391LL;\n*v9 = v8 | 7;\n*v7 = 131LL;\nv4 = v12;\nv5 = 1568LL;\nv3 = 2147811379LL;\nv6 = 1281LL;\nresult = ioctl(a1[4], 0x4138AE84uLL, v2);\nif ( result < 0 )\n{\nperror(\"ioctl(KVM_SET_SREGS)\");\nexit(1);\n}\nreturn result;\n}\n\n\n\nQ:[a1,v2,v7,v8,v9,v10,v11,v12,sub_4014E1,]", "hints": "[]", "response": "{'a1': 'vm', 'v2': 'sregs', 'v7': 'pd', 'v8': 'pd_addr', 'v9': 'pdp', 'v10': 'pdp_addr', 'v11': 'pml4', 'v12': 'pml4_addr', 'sub_4014E1': 'setup_paging'}"} | [
[
0.6976304054260254,
0.6834961175918579,
0.6680943965911865,
0.6599282622337341,
0.6590389609336853,
0.6520198583602905,
0.6509679555892944,
0.638623058795929,
0.638470470905304,
0.6383501887321472,
0.6347354054450989,
0.6344847083091736,
0.6338440179824829,
0.6324025988578796,
0.6313861608505249,
0.6283043026924133,
0.6273325681686401,
0.6270828247070312,
0.6174826622009277,
0.6173836588859558
],
[
100738,
30637,
62300,
104869,
77246,
193651,
22392,
58029,
152625,
237044,
230519,
116958,
158490,
58818,
98056,
29641,
191417,
102039,
164003,
95886
]
] |
|
server_status | afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4 | michael-lazar | hn-gopher | NA | void server_status(state *st, shm_state *shm, int shmid)
{
struct shmid_ds shm_ds;
time_t now;
time_t uptime;
int sessions;
int i;
/* Log the request */
if (st->opt_syslog) {
syslog(LOG_INFO, "request for \"gopher%s://%s:%i/0" SERVER_STATUS "\" from %s",
(st->server_port == st->server_tls_port ? "s" : ""),
st->server_host,
st->server_port,
st->req_remote_addr);
}
log_combined(st, HTTP_OK);
/* Quit if shared memory isn't initialized yet */
if (!shm) return;
/* Update counters */
shm->hits++;
shm->kbytes += 1;
/* Get server uptime */
now = time(NULL);
uptime = (now - shm->start_time) + 1;
/* Get shared memory info */
shmctl(shmid, IPC_STAT, &shm_ds);
/* Print statistics */
printf("Total Accesses: %li" CRLF
"Total kBytes: %li" CRLF
"Uptime: %i" CRLF
"ReqPerSec: %.3f" CRLF
"BytesPerSec: %li" CRLF
"BytesPerReq: %li" CRLF
"BusyServers: %i" CRLF
"IdleServers: 0" CRLF
"CPULoad: %.2f" CRLF,
shm->hits,
shm->kbytes,
(int) uptime,
(float) shm->hits / (float) uptime,
shm->kbytes * 1024 / (int) uptime,
shm->kbytes * 1024 / (shm->hits + 1),
(int) shm_ds.shm_nattch,
loadavg());
/* Print active sessions */
sessions = 0;
for (i = 0; i < SHM_SESSIONS; i++) {
if ((now - shm->session[i].req_atime) < st->session_timeout) {
sessions++;
printf("Session: %-4i %-40s %-4li %-7li gopher%s://%s:%i/%c%s" CRLF,
(int) (now - shm->session[i].req_atime),
shm->session[i].req_remote_addr,
shm->session[i].hits,
shm->session[i].kbytes,
(shm->session[i].server_port == st->server_tls_port ? "s" : ""),
shm->session[i].server_host,
shm->session[i].server_port,
shm->session[i].req_filetype,
shm->session[i].req_selector);
}
}
printf("Total Sessions: %i" CRLF, sessions);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40464A", "function_addr": 4212298, "binary_name": "afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "push r13"], [3, "push r12"], [4, "push rbx"], [5, "sub rsp, 0B8h"], [6, "mov [rbp+var_B8], rdi"], [7, "mov [rbp+var_C0], rsi"], [8, "mov [rbp+shmid], edx"], [9, "mov rax, [rbp+var_B8]"], [10, "movzx eax, byte ptr [rax+13D84h]"], [11, "test al, al"], [12, "jz short loc_4046EF"], [13, "mov rax, [rbp+var_B8]"], [14, "lea rdi, [rax+1040h]"], [15, "mov rax, [rbp+var_B8]"], [16, "mov esi, [rax+1318h]"], [17, "mov rax, [rbp+var_B8]"], [18, "add rax, 12D8h"], [19, "mov rdx, [rbp+var_B8]"], [20, "mov ecx, [rdx+1318h]"], [21, "mov rdx, [rbp+var_B8]"], [22, "mov edx, [rdx+131Ch]"], [23, "cmp ecx, edx"], [24, "jnz short loc_4046CD"], [25, "mov edx, offset aS_2"], [26, "jmp short loc_4046D2"], [27, "mov edx, offset unk_40A9C4"], [28, "mov r9, rdi"], [29, "mov r8d, esi"], [30, "mov rcx, rax"], [31, "mov esi, offset aRequestForGoph_1"], [32, "mov edi, 6"], [33, "mov eax, 0"], [34, "call _syslog"], [35, "mov rax, [rbp+var_B8]"], [36, "mov esi, 0C8h"], [37, "mov rdi, rax"], [38, "call sub_402905"], [39, "cmp [rbp+var_C0], 0"], [40, "jz loc_404AD9"], [41, "mov rax, [rbp+var_C0]"], [42, "mov rax, [rax+8]"], [43, "lea rdx, [rax+1]"], [44, "mov rax, [rbp+var_C0]"], [45, "mov [rax+8], rdx"], [46, "mov rax, [rbp+var_C0]"], [47, "mov rax, [rax+10h]"], [48, "lea rdx, [rax+1]"], [49, "mov rax, [rbp+var_C0]"], [50, "mov [rax+10h], rdx"], [51, "mov edi, 0"], [52, "call _time"], [53, "mov [rbp+var_30], rax"], [54, "mov rax, [rbp+var_C0]"], [55, "mov rdx, [rax]"], [56, "mov rax, [rbp+var_30]"], [57, "sub rax, rdx"], [58, "add rax, 1"], [59, "mov [rbp+var_38], rax"], [60, "lea rdx, [rbp+buf]"], [61, "mov eax, [rbp+shmid]"], [62, "mov esi, 2"], [63, "mov edi, eax"], [64, "call _shmctl"], [65, "call sub_4085FC"], [66, "pxor xmm2, xmm2"], [67, "cvtss2sd xmm2, xmm0"], [68, "mov rax, [rbp+buf.shm_nattch]"], [69, "mov edi, eax"], [70, "mov rax, [rbp+var_C0]"], [71, "mov rax, [rax+10h]"], [72, "shl rax, 0Ah"], [73, "mov rdx, rax"], [74, "mov rax, [rbp+var_C0]"], [75, "mov rax, [rax+8]"], [76, "lea rcx, [rax+1]"], [77, "mov rax, rdx"], [78, "cqo"], [79, "idiv rcx"], [80, "mov r9, rax"], [81, "mov rax, [rbp+var_C0]"], [82, "mov rax, [rax+10h]"], [83, "shl rax, 0Ah"], [84, "mov rdx, [rbp+var_38]"], [85, "movsxd rbx, edx"], [86, "cqo"], [87, "idiv rbx"], [88, "mov r8, rax"], [89, "mov rax, [rbp+var_C0]"], [90, "mov rax, [rax+8]"], [91, "pxor xmm0, xmm0"], [92, "cvtsi2ss xmm0, rax"], [93, "pxor xmm1, xmm1"], [94, "cvtsi2ss xmm1, [rbp+var_38]"], [95, "divss xmm0, xmm1"], [96, "pxor xmm3, xmm3"], [97, "cvtss2sd xmm3, xmm0"], [98, "movq rcx, xmm3"], [99, "mov rax, [rbp+var_38]"], [100, "mov esi, eax"], [101, "mov rax, [rbp+var_C0]"], [102, "mov rdx, [rax+10h]"], [103, "mov rax, [rbp+var_C0]"], [104, "mov rax, [rax+8]"], [105, "sub rsp, 8"], [106, "push rdi"], [107, "movapd xmm1, xmm2"], [108, "movq xmm0, rcx"], [109, "mov ecx, esi"], [110, "mov rsi, rax"], [111, "mov edi, offset aTotalAccessesL"], [112, "mov eax, 2"], [113, "call _printf"], [114, "add rsp, 10h"], [115, "mov [rbp+var_24], 0"], [116, "mov [rbp+var_28], 0"], [117, "jmp loc_404AB6"], [118, "mov rcx, [rbp+var_C0]"], [119, "mov eax, [rbp+var_28]"], [120, "movsxd rdx, eax"], [121, "mov rax, rdx"], [122, "shl rax, 3"], [123, "add rax, rdx"], [124, "shl rax, 2"], [125, "add rax, rdx"], [126, "shl rax, 3"], [127, "add rax, rcx"], [128, "add rax, 0A8h"], [129, "mov rcx, [rax]"], [130, "mov rax, [rbp+var_30]"], [131, "sub rax, rcx"], [132, "mov rdx, rax"], [133, "mov rax, [rbp+var_B8]"], [134, "mov eax, [rax+13D70h]"], [135, "cdqe"], [136, "cmp rdx, rax"], [137, "jge loc_404AB2"], [138, "add [rbp+var_24], 1"], [139, "mov eax, [rbp+var_28]"], [140, "movsxd rdx, eax"], [141, "mov rax, rdx"], [142, "shl rax, 3"], [143, "add rax, rdx"], [144, "shl rax, 2"], [145, "add rax, rdx"], [146, "shl rax, 3"], [147, "lea rdx, [rax+0A0h]"], [148, "mov rax, [rbp+var_C0]"], [149, "add rax, rdx"], [150, "lea r10, [rax+10h]"], [151, "mov rcx, [rbp+var_C0]"], [152, "mov eax, [rbp+var_28]"], [153, "movsxd rdx, eax"], [154, "mov rax, rdx"], [155, "shl rax, 3"], [156, "add rax, rdx"], [157, "shl rax, 2"], [158, "add rax, rdx"], [159, "shl rax, 3"], [160, "add rax, rcx"], [161, "add rax, 170h"], [162, "movzx eax, byte ptr [rax]"], [163, "movsx r8d, al"], [164, "mov rcx, [rbp+var_C0]"], [165, "mov eax, [rbp+var_28]"], [166, "movsxd rdx, eax"], [167, "mov rax, rdx"], [168, "shl rax, 3"], [169, "add rax, rdx"], [170, "shl rax, 2"], [171, "add rax, rdx"], [172, "shl rax, 3"], [173, "add rax, rcx"], [174, "add rax, 1B8h"], [175, "mov edi, [rax]"], [176, "mov eax, [rbp+var_28]"], [177, "movsxd rdx, eax"], [178, "mov rax, rdx"], [179, "shl rax, 3"], [180, "add rax, rdx"], [181, "shl rax, 2"], [182, "add rax, rdx"], [183, "shl rax, 3"], [184, "lea rdx, [rax+170h]"], [185, "mov rax, [rbp+var_C0]"], [186, "add rax, rdx"], [187, "lea r9, [rax+8]"], [188, "mov rcx, [rbp+var_C0]"], [189, "mov eax, [rbp+var_28]"], [190, "movsxd rdx, eax"], [191, "mov rax, rdx"], [192, "shl rax, 3"], [193, "add rax, rdx"], [194, "shl rax, 2"], [195, "add rax, rdx"], [196, "shl rax, 3"], [197, "add rax, rcx"], [198, "add rax, 1B8h"], [199, "mov edx, [rax]"], [200, "mov rax, [rbp+var_B8]"], [201, "mov eax, [rax+131Ch]"], [202, "cmp edx, eax"], [203, "jnz short loc_4049BF"], [204, "mov r12d, offset aS_2"], [205, "jmp short loc_4049C5"], [206, "mov r12d, offset unk_40A9C4"], [207, "mov rcx, [rbp+var_C0]"], [208, "mov eax, [rbp+var_28]"], [209, "movsxd rdx, eax"], [210, "mov rax, rdx"], [211, "shl rax, 3"], [212, "add rax, rdx"], [213, "shl rax, 2"], [214, "add rax, rdx"], [215, "shl rax, 3"], [216, "add rax, rcx"], [217, "add rax, 0A0h"], [218, "mov r11, [rax]"], [219, "mov rcx, [rbp+var_C0]"], [220, "mov eax, [rbp+var_28]"], [221, "movsxd rdx, eax"], [222, "mov rax, rdx"], [223, "shl rax, 3"], [224, "add rax, rdx"], [225, "shl rax, 2"], [226, "add rax, rdx"], [227, "shl rax, 3"], [228, "add rax, rcx"], [229, "add rax, 98h"], [230, "mov rcx, [rax]"], [231, "mov eax, [rbp+var_28]"], [232, "movsxd rdx, eax"], [233, "mov rax, rdx"], [234, "shl rax, 3"], [235, "add rax, rdx"], [236, "shl rax, 2"], [237, "add rax, rdx"], [238, "shl rax, 3"], [239, "lea rdx, [rax+120h]"], [240, "mov rax, [rbp+var_C0]"], [241, "add rax, rdx"], [242, "lea rsi, [rax+10h]"], [243, "mov rax, [rbp+var_30]"], [244, "mov r13d, eax"], [245, "mov rbx, [rbp+var_C0]"], [246, "mov eax, [rbp+var_28]"], [247, "movsxd rdx, eax"], [248, "mov rax, rdx"], [249, "shl rax, 3"], [250, "add rax, rdx"], [251, "shl rax, 2"], [252, "add rax, rdx"], [253, "shl rax, 3"], [254, "add rax, rbx"], [255, "add rax, 0A8h"], [256, "mov rax, [rax]"], [257, "mov edx, eax"], [258, "mov eax, r13d"], [259, "sub eax, edx"], [260, "push r10"], [261, "push r8"], [262, "push rdi"], [263, "push r9"], [264, "mov r9, r12"], [265, "mov r8, r11"], [266, "mov rdx, rsi"], [267, "mov esi, eax"], [268, "mov edi, offset aSession4i40s4l"], [269, "mov eax, 0"], [270, "call _printf"], [271, "add rsp, 20h"], [272, "add [rbp+var_28], 1"], [273, "cmp [rbp+var_28], 0FFh"], [274, "jle loc_404866"], [275, "mov eax, [rbp+var_24]"], [276, "mov esi, eax"], [277, "mov edi, offset aTotalSessionsI"], [278, "mov eax, 0"], [279, "call _printf"], [280, "jmp short loc_404ADA"], [281, "nop"], [282, "lea rsp, [rbp-18h]"], [283, "pop rbx"], [284, "pop r12"], [285, "pop r13"], [286, "pop rbp"], [287, "retn"]], "data_dep": [[9, 6], [10, 9], [11, 10], [12, 11], [13, 6], [14, 13], [15, 6], [16, 15], [17, 6], [18, 17], [19, 6], [20, 19], [21, 6], [22, 21], [23, 20], [23, 22], [24, 23], [28, 14], [29, 16], [30, 18], [35, 6], [37, 35], [39, 7], [40, 39], [41, 7], [42, 41], [43, 25], [43, 42], [43, 27], [44, 7], [45, 43], [45, 44], [46, 7], [47, 46], [47, 45], [48, 45], [48, 43], [48, 47], [49, 7], [50, 48], [50, 49], [53, 52], [54, 7], [55, 50], [55, 54], [56, 53], [57, 55], [57, 56], [58, 57], [59, 58], [60, 55], [61, 8], [63, 61], [67, 66], [69, 68], [70, 7], [71, 50], [71, 70], [72, 71], [73, 72], [74, 7], [75, 74], [75, 50], [75, 45], [76, 50], [76, 30], [76, 75], [77, 73], [79, 76], [80, 77], [81, 7], [82, 50], [82, 81], [83, 82], [84, 59], [85, 84], [87, 85], [88, 83], [89, 7], [90, 50], [90, 45], [90, 89], [92, 91], [92, 90], [94, 93], [94, 59], [95, 92], [95, 94], [97, 95], [97, 96], [98, 97], [99, 59], [100, 99], [101, 7], [102, 101], [102, 50], [103, 7], [104, 50], [104, 45], [104, 103], [105, 5], [106, 69], [107, 67], [108, 98], [109, 100], [110, 104], [114, 105], [118, 7], [119, 272], [119, 116], [120, 119], [121, 120], [122, 121], [123, 120], [123, 122], [124, 123], [125, 120], [125, 124], [126, 125], [127, 118], [127, 126], [128, 127], [129, 128], [129, 50], [129, 45], [130, 53], [131, 130], [131, 129], [132, 131], [133, 6], [134, 50], [134, 45], [134, 133], [136, 134], [136, 132], [137, 136], [138, 138], [138, 115], [139, 116], [139, 272], [140, 139], [141, 140], [142, 141], [143, 140], [143, 142], [144, 143], [145, 144], [145, 140], [146, 145], [147, 50], [147, 45], [147, 146], [147, 140], [148, 7], [149, 147], [149, 148], [150, 149], [150, 50], [150, 45], [150, 150], [151, 7], [152, 272], [152, 116], [153, 152], [154, 153], [155, 154], [156, 153], [156, 155], [157, 156], [158, 153], [158, 157], [159, 158], [160, 151], [160, 159], [161, 160], [162, 161], [162, 50], [162, 45], [163, 162], [164, 7], [165, 272], [165, 116], [166, 165], [167, 166], [168, 167], [169, 166], [169, 168], [170, 169], [171, 170], [171, 166], [172, 171], [173, 164], [173, 172], [174, 173], [175, 50], [175, 45], [175, 174], [176, 272], [176, 116], [177, 176], [178, 177], [179, 178], [180, 177], [180, 179], [181, 180], [182, 177], [182, 181], [183, 182], [184, 45], [184, 183], [184, 177], [184, 50], [185, 7], [186, 185], [186, 184], [187, 45], [187, 80], [187, 186], [187, 50], [187, 264], [188, 7], [189, 116], [189, 272], [190, 189], [191, 190], [192, 191], [193, 192], [193, 190], [194, 193], [195, 190], [195, 194], [196, 195], [197, 196], [197, 188], [198, 197], [199, 50], [199, 45], [199, 198], [200, 6], [201, 45], [201, 200], [201, 50], [202, 199], [202, 201], [203, 202], [207, 7], [208, 272], [208, 116], [209, 208], [210, 209], [211, 210], [212, 211], [212, 209], [213, 212], [214, 209], [214, 213], [215, 214], [216, 215], [216, 207], [217, 216], [218, 50], [218, 45], [218, 217], [219, 7], [220, 272], [220, 116], [221, 220], [222, 221], [223, 222], [224, 223], [224, 221], [225, 224], [226, 221], [226, 225], [227, 226], [228, 219], [228, 227], [229, 228], [230, 229], [230, 50], [230, 45], [231, 272], [231, 116], [232, 231], [233, 232], [234, 233], [235, 232], [235, 234], [236, 235], [237, 232], [237, 236], [238, 237], [239, 238], [239, 232], [239, 50], [239, 45], [240, 7], [241, 240], [241, 239], [242, 50], [242, 45], [242, 241], [242, 110], [242, 267], [243, 53], [244, 243], [245, 7], [246, 116], [246, 272], [247, 246], [248, 247], [249, 248], [250, 249], [250, 247], [251, 250], [252, 247], [252, 251], [253, 252], [254, 245], [254, 253], [255, 254], [256, 50], [256, 45], [256, 255], [257, 256], [258, 244], [259, 258], [259, 257], [260, 150], [261, 163], [262, 175], [263, 187], [264, 206], [264, 204], [265, 218], [266, 242], [267, 259], [271, 271], [271, 114], [272, 272], [272, 116], [273, 116], [273, 272], [274, 273], [275, 138], [275, 115], [276, 275], [282, 271], [282, 5], [282, 114], [283, 4], [284, 3], [285, 2], [286, 0], [287, 38], [287, 279]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4_afacd2886605ed9cc7c713ccbfe9b543c82a146172cfda04c07bad88bb9581d4.jsonl.gz", "strip_func_name": "sub_40464A", "query": "\n\n\nint __fastcall sub_40464A(__int64 a1, _QWORD *a2, int a3)\n{\nconst char *v3; // rdx\nint result; // eax\nfloat v5; // xmm0_4\nconst char *v6; // r12\nstruct shmid_ds buf; // [rsp+20h] [rbp-B0h] BYREF\ntime_t v9; // [rsp+98h] [rbp-38h]\ntime_t v10; // [rsp+A0h] [rbp-30h]\nint i; // [rsp+A8h] [rbp-28h]\nunsigned int v12; // [rsp+ACh] [rbp-24h]\n\nif ( *(_BYTE *)(a1 + 81284) )\n{\nif ( *(_DWORD *)(a1 + 4888) == *(_DWORD *)(a1 + 4892) )\nv3 = \"s\";\nelse\nv3 = (const char *)&unk_40A9C4;\nsyslog(\n6,\n\"request for \\\"gopher%s://%s:%i/0/server-status\\\" from %s\",\nv3,\n(const char *)(a1 + 4824),\n*(unsigned int *)(a1 + 4888),\n(const char *)(a1 + 4160));\n}\nresult = sub_402905(a1, 0xC8u);\nif ( a2 )\n{\n++a2[1];\n++a2[2];\nv10 = time(0LL);\nv9 = v10 - *a2 + 1;\nshmctl(a3, 2, &buf);\nv5 = sub_4085FC();\nprintf(\n\"Total Accesses: %li\\r\\n\"\n\"Total kBytes: %li\\r\\n\"\n\"Uptime: %i\\r\\n\"\n\"ReqPerSec: %.3f\\r\\n\"\n\"BytesPerSec: %li\\r\\n\"\n\"BytesPerReq: %li\\r\\n\"\n\"BusyServers: %i\\r\\n\"\n\"IdleServers: 0\\r\\n\"\n\"CPULoad: %.2f\\r\\n\",\na2[1],\na2[2],\n(unsigned int)v9,\n(float)((float)(int)a2[1] / (float)(int)v9),\n(a2[2] << 10) / (int)v9,\n(a2[2] << 10) / (a2[1] + 1LL),\nLODWORD(buf.shm_nattch),\nv5);\nv12 = 0;\nfor ( i = 0; i <= 255; ++i )\n{\nif ( v10 - a2[37 * i + 21] < *(int *)(a1 + 81264) )\n{\n++v12;\nif ( LODWORD(a2[37 * i + 55]) == *(_DWORD *)(a1 + 4892) )\nv6 = \"s\";\nelse\nv6 = (const char *)&unk_40A9C4;\nprintf(\n\"Session: %-4i %-40s %-4li %-7li gopher%s://%s:%i/%c%s\\r\\n\",\n(unsigned int)v10 - (unsigned int)a2[37 * i + 21],\n(const char *)&a2[37 * i + 38],\na2[37 * i + 19],\na2[37 * i + 20],\nv6,\n(const char *)&a2[37 * i + 47],\nLODWORD(a2[37 * i + 55]),\n(unsigned int)SLOBYTE(a2[37 * i + 46]),\n(const char *)&a2[37 * i + 22]);\n}\n}\nresult = printf(\"Total Sessions: %i\\r\\n\", v12);\n}\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,buf,v9,v10,v12,sub_40464A,sub_402905,sub_4085FC,]", "hints": "[]", "response": "{'a3': 'shmid', 'a1': 'st', 'a2': 'shm', 'buf': 'shm_ds', 'v9': 'uptime', 'v10': 'now', 'v12': 'sessions', 'sub_40464A': 'server_status', 'sub_402905': 'log_combined', 'sub_4085FC': 'loadavg'}"} | [
[
0.6816946864128113,
0.6767486929893494,
0.6626967191696167,
0.6534150242805481,
0.6479296088218689,
0.6463972330093384,
0.6310976147651672,
0.6309537887573242,
0.6279221773147583,
0.6232447624206543,
0.6218564510345459,
0.6182941198348999,
0.6180898547172546,
0.6161013841629028,
0.6128533482551575,
0.6119524836540222,
0.6108881831169128,
0.6105714440345764,
0.6080708503723145,
0.6079813838005066
],
[
204906,
33013,
68644,
169101,
207993,
28846,
247484,
246196,
142041,
47962,
46518,
91648,
9358,
187392,
10016,
45371,
37315,
79410,
41327,
178009
]
] |
|
ReadAll | ba102fe13880c2bef73fc2869f9f74aee9909a8a594754560b8da970adec862b | csdvrx | derasterize | NA | static void ReadAll(int fd, char *p, size_t n) {
ssize_t rc;
size_t got;
do {
ORDIE((rc = read(fd, p, n)) != -1);
got = rc;
if (!got && n) {
exit(EXIT_FAILURE);
}
p += got;
n -= got;
} while (n);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_402276", "function_addr": 4203126, "binary_name": "ba102fe13880c2bef73fc2869f9f74aee9909a8a594754560b8da970adec862b.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+fd], edi"], [4, "mov [rbp+buf], rsi"], [5, "mov [rbp+nbytes], rdx"], [6, "mov rdx, [rbp+nbytes]"], [7, "mov rcx, [rbp+buf]"], [8, "mov eax, [rbp+fd]"], [9, "mov rsi, rcx"], [10, "mov edi, eax"], [11, "call _read"], [12, "mov [rbp+var_8], rax"], [13, "cmp [rbp+var_8], 0FFFFFFFFFFFFFFFFh"], [14, "jnz short loc_4022B3"], [15, "mov edi, 1"], [16, "call _exit"], [17, "mov rax, [rbp+var_8]"], [18, "mov [rbp+var_10], rax"], [19, "cmp [rbp+var_10], 0"], [20, "jnz short loc_4022D3"], [21, "cmp [rbp+nbytes], 0"], [22, "jz short loc_4022D3"], [23, "mov edi, 1"], [24, "call _exit"], [25, "mov rax, [rbp+var_10]"], [26, "add [rbp+buf], rax"], [27, "mov rax, [rbp+var_10]"], [28, "sub [rbp+nbytes], rax"], [29, "cmp [rbp+nbytes], 0"], [30, "jnz short loc_402289"], [31, "nop"], [32, "nop"], [33, "leave"], [34, "retn"]], "data_dep": [[6, 5], [6, 28], [7, 26], [7, 4], [8, 3], [9, 7], [10, 8], [12, 11], [13, 12], [14, 13], [17, 12], [18, 17], [19, 18], [20, 19], [21, 28], [21, 5], [22, 21], [25, 18], [26, 26], [26, 4], [26, 25], [27, 18], [28, 27], [28, 5], [28, 28], [29, 28], [30, 29], [34, 27]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/ba102fe13880c2bef73fc2869f9f74aee9909a8a594754560b8da970adec862b_ba102fe13880c2bef73fc2869f9f74aee9909a8a594754560b8da970adec862b.jsonl.gz", "strip_func_name": "sub_402276", "query": "\n\n\nssize_t __fastcall sub_402276(int a1, char *a2, size_t a3)\n{\nssize_t result; // rax\nssize_t v6; // [rsp+28h] [rbp-8h]\n\ndo\n{\nv6 = read(a1, a2, a3);\nif ( v6 == -1 )\nexit(1);\nif ( !v6 )\n{\nif ( a3 )\nexit(1);\n}\na2 += v6;\nresult = v6;\na3 -= v6;\n}\nwhile ( a3 );\nreturn result;\n}\n\n\n\nQ:[a3,a1,a2,v6,sub_402276,]", "hints": "[]", "response": "{'a3': 'n', 'a1': 'fd', 'a2': 'p', 'v6': 'rc', 'sub_402276': 'ReadAll'}"} | [
[
0.8827685713768005,
0.8821739554405212,
0.8540225625038147,
0.8096891641616821,
0.8095421195030212,
0.8057900071144104,
0.7981839179992676,
0.7969763278961182,
0.7885159850120544,
0.7878195643424988,
0.786770761013031,
0.7864950895309448,
0.7853054404258728,
0.7766131162643433,
0.7749806642532349,
0.7731879353523254,
0.7675008773803711,
0.7631034851074219,
0.7613666653633118,
0.7598284482955933
],
[
123100,
195359,
220058,
130290,
116583,
31749,
112196,
3650,
97464,
117126,
84838,
20487,
121962,
209248,
259548,
233676,
57003,
117060,
216439,
257970
]
] |
|
escape_char | 7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53 | kgabis | ape | NA | static char escape_char(const char c) {
switch (c) {
case '\"': return '\"';
case '\\': return '\\';
case '/': return '/';
case 'b': return '\b';
case 'f': return '\f';
case 'n': return '\n';
case 'r': return '\r';
case 't': return '\t';
case '0': return '\0';
default: return c;
}
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_40E2BB", "function_addr": 4252347, "binary_name": "7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "mov eax, edi"], [3, "mov [rbp+var_4], al"], [4, "movsx eax, [rbp+var_4]"], [5, "cmp eax, 74h "], [6, "jg short def_40E2FA"], [7, "cmp eax, 5Ch "], [8, "jge short loc_40E2E8"], [9, "cmp eax, 30h "], [10, "jz short loc_40E334"], [11, "cmp eax, 30h "], [12, "jg short def_40E2FA"], [13, "cmp eax, 22h "], [14, "jz short loc_40E2FC"], [15, "cmp eax, 2Fh "], [16, "jz short loc_40E30A"], [17, "jmp short def_40E2FA"], [18, "sub eax, 5Ch "], [19, "cmp eax, 18h"], [20, "ja short def_40E2FA"], [21, "mov eax, eax"], [22, "mov rax, ds:jpt_40E2FA[rax*8]"], [23, "jmp rax"], [24, "mov eax, 22h "], [25, "jmp short loc_40E33F"], [26, "mov eax, 5Ch "], [27, "jmp short loc_40E33F"], [28, "mov eax, 2Fh "], [29, "jmp short loc_40E33F"], [30, "mov eax, 8"], [31, "jmp short loc_40E33F"], [32, "mov eax, 0Ch"], [33, "jmp short loc_40E33F"], [34, "mov eax, 0Ah"], [35, "jmp short loc_40E33F"], [36, "mov eax, 0Dh"], [37, "jmp short loc_40E33F"], [38, "mov eax, 9"], [39, "jmp short loc_40E33F"], [40, "mov eax, 0"], [41, "jmp short loc_40E33F"], [42, "movzx eax, [rbp+var_4]"], [43, "pop rbp"], [44, "retn"]], "data_dep": [[3, 2], [4, 3], [5, 4], [6, 5], [7, 4], [8, 7], [9, 4], [10, 9], [11, 4], [12, 11], [13, 4], [14, 13], [15, 4], [16, 15], [18, 4], [19, 18], [20, 19], [21, 18], [23, 22], [42, 3], [43, 0], [44, 36], [44, 42], [44, 26], [44, 32], [44, 38], [44, 28], [44, 34], [44, 40], [44, 24], [44, 30]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53_7fc81bc5e05805462160f0f7e72ba32357f81d09a102ced059628d2f6c88ce53.jsonl.gz", "strip_func_name": "sub_40E2BB", "query": "\n\n\n__int64 __fastcall sub_40E2BB(unsigned __int8 a1)\n{\n__int64 result; // rax\n\nif ( (char)a1 > 116 )\nreturn a1;\nif ( (char)a1 < 92 )\n{\nif ( a1 == 48 )\nreturn 0LL;\nif ( (char)a1 <= 48 )\n{\nif ( a1 == 34 )\nreturn 34LL;\nif ( a1 == 47 )\nreturn 47LL;\n}\nreturn a1;\n}\nswitch ( a1 )\n{\ncase '\\\\':\nresult = 92LL;\nbreak;\ncase 'b':\nresult = 8LL;\nbreak;\ncase 'f':\nresult = 12LL;\nbreak;\ncase 'n':\nresult = 10LL;\nbreak;\ncase 'r':\nresult = 13LL;\nbreak;\ncase 't':\nresult = 9LL;\nbreak;\ndefault:\nreturn a1;\n}\nreturn result;\n}\n\n\n\nQ:[a1,sub_40E2BB,]", "hints": "[]", "response": "{'a1': 'c', 'sub_40E2BB': 'escape_char'}"} | [
[
0.8667993545532227,
0.8569537401199341,
0.8516242504119873,
0.8509829044342041,
0.8487697839736938,
0.8461779952049255,
0.8367939591407776,
0.833072304725647,
0.8257480263710022,
0.8250841498374939,
0.8246732950210571,
0.82245934009552,
0.8221495151519775,
0.8217717409133911,
0.8201903104782104,
0.8196797370910645,
0.8186204433441162,
0.818547248840332,
0.8178220987319946,
0.8176791667938232
],
[
114044,
200128,
78222,
74879,
151520,
56082,
15014,
222821,
58306,
134055,
110524,
44234,
28679,
30828,
8989,
114370,
243887,
217039,
129333,
258266
]
] |
|
parse_unsigned_int | 9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc | google | linux-sensor | NA | static int parse_unsigned_int(unsigned int *value, const char *str)
{
unsigned long tmp;
char *end;
tmp = strtoul(str, &end, 10);
if (!*str || *end || (tmp > UINT32_MAX && tmp != -1))
return -1;
*value = tmp == -1 ? UINT32_MAX : (unsigned int) tmp;
return 0;
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4013E7", "function_addr": 4199399, "binary_name": "9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 20h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+nptr], rsi"], [5, "lea rcx, [rbp+endptr]"], [6, "mov rax, [rbp+nptr]"], [7, "mov edx, 0Ah"], [8, "mov rsi, rcx"], [9, "mov rdi, rax"], [10, "call _strtoul"], [11, "mov [rbp+var_8], rax"], [12, "mov rax, [rbp+nptr]"], [13, "movzx eax, byte ptr [rax]"], [14, "test al, al"], [15, "jz short loc_40143B"], [16, "mov rax, [rbp+endptr]"], [17, "movzx eax, byte ptr [rax]"], [18, "test al, al"], [19, "jnz short loc_40143B"], [20, "mov eax, 0FFFFFFFFh"], [21, "cmp [rbp+var_8], rax"], [22, "jbe short loc_401442"], [23, "cmp [rbp+var_8], 0FFFFFFFFFFFFFFFFh"], [24, "jz short loc_401442"], [25, "mov eax, 0FFFFFFFFh"], [26, "jmp short locret_401461"], [27, "cmp [rbp+var_8], 0FFFFFFFFFFFFFFFFh"], [28, "jz short loc_401451"], [29, "mov rax, [rbp+var_8]"], [30, "mov edx, eax"], [31, "jmp short loc_401456"], [32, "mov edx, 0FFFFFFFFh"], [33, "mov rax, [rbp+var_18]"], [34, "mov [rax], edx"], [35, "mov eax, 0"], [36, "leave"], [37, "retn"]], "data_dep": [[6, 4], [8, 5], [9, 6], [11, 10], [12, 4], [13, 12], [14, 13], [15, 14], [17, 16], [18, 17], [19, 18], [21, 11], [21, 20], [22, 21], [23, 11], [24, 23], [27, 11], [28, 27], [29, 11], [30, 29], [33, 3], [34, 30], [34, 33], [34, 32], [37, 35], [37, 25]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc_9060b0f6008c2a2fdde5eb96e6c995acc65c62a75af2bb33808e2863941855dc.jsonl.gz", "strip_func_name": "sub_4013E7", "query": "\n\n\n__int64 __fastcall sub_4013E7(int *a1, const char *a2)\n{\nint v3; // edx\nchar *endptr; // [rsp+10h] [rbp-10h] BYREF\nunsigned __int64 v5; // [rsp+18h] [rbp-8h]\n\nv5 = strtoul(a2, &endptr, 10);\nif ( !*a2 || *endptr || v5 > 0xFFFFFFFF && v5 != -1LL )\nreturn 0xFFFFFFFFLL;\nif ( v5 == -1LL )\nv3 = -1;\nelse\nv3 = v5;\n*a1 = v3;\nreturn 0LL;\n}\n\n\n\nQ:[a1,a2,endptr,v5,sub_4013E7,]", "hints": "[]", "response": "{'a1': 'value', 'a2': 'str', 'endptr': 'end', 'v5': 'tmp', 'sub_4013E7': 'parse_unsigned_int'}"} | [
[
0.8824684619903564,
0.8817371726036072,
0.8811781406402588,
0.8798885941505432,
0.8398862481117249,
0.8242131471633911,
0.8199630379676819,
0.8084983825683594,
0.8069733381271362,
0.8001079559326172,
0.7959048748016357,
0.7941904067993164,
0.779719889163971,
0.7709474563598633,
0.76939857006073,
0.7642637491226196,
0.7641019225120544,
0.7581365704536438,
0.7577255964279175,
0.7550491690635681
],
[
196818,
243712,
88529,
256207,
117747,
14722,
100390,
2960,
98932,
180168,
10602,
182998,
114826,
193070,
213609,
92051,
98006,
264061,
245318,
6529
]
] |
|
ina219_info | 12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab | hepingood | ina219 | NA | uint8_t ina219_info(ina219_info_t *info)
{
if (info == NULL) /* check handle */
{
return 2; /* return error */
}
memset(info, 0, sizeof(ina219_info_t)); /* initialize ina219 info structure */
strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
strncpy(info->interface, "IIC", 8); /* copy interface name */
info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
info->max_current_ma = MAX_CURRENT; /* set maximum current */
info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
info->driver_version = DRIVER_VERSION; /* set driver version */
return 0; /* success return 0 */
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_4024CE", "function_addr": 4203726, "binary_name": "12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 10h"], [3, "mov [rbp+s], rdi"], [4, "cmp [rbp+s], 0"], [5, "jnz short loc_4024EB"], [6, "mov eax, 2"], [7, "jmp locret_4025B0"], [8, "mov rax, [rbp+s]"], [9, "mov edx, 60h "], [10, "mov esi, 0"], [11, "mov rdi, rax"], [12, "call _memset"], [13, "mov rax, [rbp+s]"], [14, "mov edx, 20h "], [15, "mov esi, offset src"], [16, "mov rdi, rax"], [17, "call _strncpy"], [18, "mov rax, [rbp+s]"], [19, "add rax, 20h "], [20, "mov edx, 20h "], [21, "mov esi, offset aTexasInstrumen_0"], [22, "mov rdi, rax"], [23, "call _strncpy"], [24, "mov rax, [rbp+s]"], [25, "add rax, 40h "], [26, "mov edx, 8"], [27, "mov esi, offset aIic"], [28, "mov rdi, rax"], [29, "call _strncpy"], [30, "mov rax, [rbp+s]"], [31, "movss xmm0, cs:dword_408340"], [32, "movss dword ptr [rax+48h], xmm0"], [33, "mov rax, [rbp+s]"], [34, "movss xmm0, cs:dword_408344"], [35, "movss dword ptr [rax+4Ch], xmm0"], [36, "mov rax, [rbp+s]"], [37, "movss xmm0, cs:dword_408348"], [38, "movss dword ptr [rax+50h], xmm0"], [39, "mov rax, [rbp+s]"], [40, "movss xmm0, cs:dword_40834C"], [41, "movss dword ptr [rax+58h], xmm0"], [42, "mov rax, [rbp+s]"], [43, "movss xmm0, cs:dword_408350"], [44, "movss dword ptr [rax+54h], xmm0"], [45, "mov rax, [rbp+s]"], [46, "mov dword ptr [rax+5Ch], 3E8h"], [47, "mov eax, 0"], [48, "leave"], [49, "retn"]], "data_dep": [[4, 3], [5, 4], [8, 3], [11, 8], [13, 3], [16, 13], [18, 3], [19, 18], [22, 19], [24, 3], [25, 24], [28, 25], [30, 3], [32, 31], [32, 30], [33, 3], [35, 33], [35, 34], [36, 3], [38, 37], [38, 36], [39, 3], [41, 40], [41, 39], [42, 3], [44, 42], [44, 43], [45, 3], [46, 45], [49, 47], [49, 6]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab_12d96baabfcf2470c3759a118fb8b6777fb61250d9155b0a78f4ef1b4326aaab.jsonl.gz", "strip_func_name": "sub_4024CE", "query": "\n\n\n__int64 __fastcall sub_4024CE(__int64 a1)\n{\nif ( !a1 )\nreturn 2LL;\nmemset((void *)a1, 0, 0x60uLL);\nstrncpy((char *)a1, \"Texas Instruments INA219\", 0x20uLL);\nstrncpy((char *)(a1 + 32), \"Texas Instruments\", 0x20uLL);\nstrncpy((char *)(a1 + 64), \"IIC\", 8uLL);\n*(_DWORD *)(a1 + 72) = 1077936128;\n*(_DWORD *)(a1 + 76) = 1085276160;\n*(_DWORD *)(a1 + 80) = 1065353216;\n*(_DWORD *)(a1 + 88) = 1118437376;\n*(_DWORD *)(a1 + 84) = -1043857408;\n*(_DWORD *)(a1 + 92) = 1000;\nreturn 0LL;\n}\n\n\n\nQ:[a1,sub_4024CE,]", "hints": "[]", "response": "{'a1': 'info', 'sub_4024CE': 'ina219_info'}"} | [
[
0.8962876796722412,
0.8943020701408386,
0.8931602835655212,
0.8929623365402222,
0.8929264545440674,
0.8928000330924988,
0.8927361965179443,
0.892368495464325,
0.8922163844108582,
0.8919454216957092,
0.8918591141700745,
0.8918211460113525,
0.8916340470314026,
0.8915486335754395,
0.8906571865081787,
0.7825512886047363,
0.7786126732826233,
0.7578365802764893,
0.756018877029419,
0.7524505853652954
],
[
192211,
97583,
261057,
43840,
204068,
182185,
99757,
258780,
131754,
128084,
59272,
84212,
230322,
109159,
40024,
235706,
3272,
25571,
83641,
106636
]
] |
|
acpi_os_get_line | e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c | microsoft | WSA-Linux-Kernel | NA | acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read)
{
int input_char;
u32 end_of_line;
/* Standard acpi_os_get_line for all utilities except acpi_exec */
for (end_of_line = 0;; end_of_line++) {
if (end_of_line >= buffer_length) {
return (AE_BUFFER_OVERFLOW);
}
if ((input_char = getchar()) == EOF) {
return (AE_ERROR);
}
if (!input_char || input_char == _ASCII_NEWLINE) {
break;
}
buffer[end_of_line] = (char)input_char;
}
/* Null terminate the buffer */
buffer[end_of_line] = 0;
/* Return the number of bytes in the string */
if (bytes_read) {
*bytes_read = end_of_line;
}
return (AE_OK);
} | {"metadata": {"project_name": "lmpa-bins-ret", "function_name": "sub_403C14", "function_addr": 4209684, "binary_name": "e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c.elf_extract.pkl\n"}, "code": [[0, "push rbp"], [1, "mov rbp, rsp"], [2, "sub rsp, 30h"], [3, "mov [rbp+var_18], rdi"], [4, "mov [rbp+var_1C], esi"], [5, "mov [rbp+var_28], rdx"], [6, "mov [rbp+var_4], 0"], [7, "mov eax, [rbp+var_4]"], [8, "cmp eax, [rbp+var_1C]"], [9, "jb short loc_403C3D"], [10, "mov eax, 0Bh"], [11, "jmp short locret_403C95"], [12, "call _getchar"], [13, "mov [rbp+var_8], eax"], [14, "cmp [rbp+var_8], 0FFFFFFFFh"], [15, "jnz short loc_403C52"], [16, "mov eax, 1"], [17, "jmp short locret_403C95"], [18, "cmp [rbp+var_8], 0"], [19, "jz short loc_403C73"], [20, "cmp [rbp+var_8], 0Ah"], [21, "jz short loc_403C73"], [22, "mov edx, [rbp+var_4]"], [23, "mov rax, [rbp+var_18]"], [24, "add rax, rdx"], [25, "mov edx, [rbp+var_8]"], [26, "mov [rax], dl"], [27, "add [rbp+var_4], 1"], [28, "jmp short loc_403C2E"], [29, "mov edx, [rbp+var_4]"], [30, "mov rax, [rbp+var_18]"], [31, "add rax, rdx"], [32, "mov byte ptr [rax], 0"], [33, "cmp [rbp+var_28], 0"], [34, "jz short loc_403C90"], [35, "mov rax, [rbp+var_28]"], [36, "mov edx, [rbp+var_4]"], [37, "mov [rax], edx"], [38, "mov eax, 0"], [39, "leave"], [40, "retn"]], "data_dep": [[7, 6], [7, 27], [8, 4], [8, 7], [9, 8], [13, 12], [14, 13], [15, 14], [18, 13], [19, 18], [20, 13], [21, 20], [22, 6], [22, 27], [23, 3], [24, 23], [24, 22], [25, 13], [26, 24], [26, 25], [27, 6], [27, 27], [29, 6], [29, 27], [30, 3], [31, 29], [31, 30], [32, 31], [33, 5], [34, 33], [35, 5], [36, 6], [36, 27], [37, 36], [37, 35], [40, 38], [40, 10], [40, 16]]}
| {"prompt": "Help user generate meaningful names for variables and functions in the following code snippet.", "prog_name": "gh-dataset-dirty/bins/e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c_e51db2b6266a20e43b95e636e5c5b6ccfaccb0589946b9180204c54456a7630c.jsonl.gz", "strip_func_name": "sub_403C14", "query": "\n\n\n__int64 __fastcall sub_403C14(__int64 a1, unsigned int a2, unsigned int *a3)\n{\nint v5; // [rsp+28h] [rbp-8h]\nunsigned int i; // [rsp+2Ch] [rbp-4h]\n\nfor ( i = 0; ; ++i )\n{\nif ( i >= a2 )\nreturn 11LL;\nv5 = getchar();\nif ( v5 == -1 )\nreturn 1LL;\nif ( !v5 || v5 == 10 )\nbreak;\n*(_BYTE *)(i + a1) = v5;\n}\n*(_BYTE *)(i + a1) = 0;\nif ( a3 )\n*a3 = i;\nreturn 0LL;\n}\n\n\n\nQ:[a3,a1,a2,v5,i,sub_403C14,]", "hints": "[]", "response": "{'a3': 'bytes_read', 'a1': 'buffer', 'a2': 'buffer_length', 'v5': 'input_char', 'i': 'end_of_line', 'sub_403C14': 'acpi_os_get_line'}"} | [
[
0.9201619625091553,
0.7798834443092346,
0.7781247496604919,
0.7731866240501404,
0.7415164113044739,
0.7238556146621704,
0.7234323620796204,
0.7205778956413269,
0.7182717323303223,
0.7128878831863403,
0.7123661041259766,
0.7090080976486206,
0.7088828682899475,
0.7015612125396729,
0.7014816403388977,
0.7005987167358398,
0.7002576589584351,
0.6994118690490723,
0.6976354122161865,
0.6955568194389343
],
[
102602,
241921,
82626,
146421,
204244,
46010,
84718,
198777,
103016,
65679,
190066,
105594,
53252,
128113,
88896,
172137,
27203,
175612,
238455,
11442
]
] |