id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
2,922
static void bonito_pciconf_writel(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIBonitoState *s = opaque; PCIDevice *d = PCI_DEVICE(s); DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val); d->config_write(d, addr, val, 4); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void bonito_pciconf_writel(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIBonitoState *s = opaque; PCIDevice *d = PCI_DEVICE(s); DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val); d->config_write(d, addr, val, 4); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { PCIBonitoState *s = VAR_0; PCIDevice *d = PCI_DEVICE(s); DPRINTF("FUNC_0 "TARGET_FMT_plx" VAR_2 %x\n", VAR_1, VAR_2); d->config_write(d, VAR_1, VAR_2, 4); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PCIBonitoState *s = VAR_0;", "PCIDevice *d = PCI_DEVICE(s);", "DPRINTF(\"FUNC_0 \"TARGET_FMT_plx\" VAR_2 %x\\n\", VAR_1, VAR_2);", "d->config_write(d, VAR_1, VAR_2, 4);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ] ]
2,923
void ff_snow_vertical_compose97i_sse2(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width){ long i = width; while(i & 0xF) { i--; b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS; b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS; b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS; b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS; } asm volatile ( "jmp 2f \n\t" "1: \n\t" "mov %6, %%"REG_a" \n\t" "mov %4, %%"REG_S" \n\t" snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_r2r_add("xmm0","xmm2","xmm4","xmm6","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") "pcmpeqd %%xmm1, %%xmm1 \n\t" "pslld $31, %%xmm1 \n\t" "psrld $29, %%xmm1 \n\t" "mov %5, %%"REG_a" \n\t" snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("3","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_load(REG_a,"xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sub("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_store(REG_a,"xmm1","xmm3","xmm5","xmm7") "mov %3, %%"REG_c" \n\t" snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_S,"xmm0","xmm2","xmm4","xmm6") "mov %2, %%"REG_a" \n\t" snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6") "pcmpeqd %%xmm1, %%xmm1 \n\t" "pslld $31, %%xmm1 \n\t" "psrld $30, %%xmm1 \n\t" "mov %1, %%"REG_S" \n\t" snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_c,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sra("1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_a,"xmm0","xmm2","xmm4","xmm6") "2: \n\t" "sub $16, %%"REG_d" \n\t" "jge 1b \n\t" :"+d"(i) : "m"(b0),"m"(b1),"m"(b2),"m"(b3),"m"(b4),"m"(b5): "%"REG_a"","%"REG_S"","%"REG_c""); }
true
FFmpeg
3e0f7126b53b395d9e79df57b2e626eb99ad846b
void ff_snow_vertical_compose97i_sse2(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width){ long i = width; while(i & 0xF) { i--; b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS; b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS; b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS; b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS; } asm volatile ( "jmp 2f \n\t" "1: \n\t" "mov %6, %%"REG_a" \n\t" "mov %4, %%"REG_S" \n\t" snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_r2r_add("xmm0","xmm2","xmm4","xmm6","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") "pcmpeqd %%xmm1, %%xmm1 \n\t" "pslld $31, %%xmm1 \n\t" "psrld $29, %%xmm1 \n\t" "mov %5, %%"REG_a" \n\t" snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("3","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_load(REG_a,"xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sub("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_store(REG_a,"xmm1","xmm3","xmm5","xmm7") "mov %3, %%"REG_c" \n\t" snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_S,"xmm0","xmm2","xmm4","xmm6") "mov %2, %%"REG_a" \n\t" snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6") "pcmpeqd %%xmm1, %%xmm1 \n\t" "pslld $31, %%xmm1 \n\t" "psrld $30, %%xmm1 \n\t" "mov %1, %%"REG_S" \n\t" snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_c,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sra("1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_a,"xmm0","xmm2","xmm4","xmm6") "2: \n\t" "sub $16, %%"REG_d" \n\t" "jge 1b \n\t" :"+d"(i) : "m"(b0),"m"(b1),"m"(b2),"m"(b3),"m"(b4),"m"(b5): "%"REG_a"","%"REG_S"","%"REG_c""); }
{ "code": [ "void ff_snow_vertical_compose97i_sse2(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width){", " while(i & 0xF)", " \"pslld $31, %%xmm1 \\n\\t\"", " \"psrld $29, %%xmm1 \\n\\t\"", " \"pslld $31, %%xmm1 \\n\\t\"", " \"psrld $30, %%xmm1 \\n\\t\"", " \"sub $16, %%\"REG_d\" \\n\\t\"" ], "line_no": [ 1, 7, 53, 55, 53, 95, 125 ] }
void FUNC_0(DWTELEM *VAR_0, DWTELEM *VAR_1, DWTELEM *VAR_2, DWTELEM *VAR_3, DWTELEM *VAR_4, DWTELEM *VAR_5, int VAR_6){ long VAR_7 = VAR_6; while(VAR_7 & 0xF) { VAR_7--; VAR_4[VAR_7] -= (W_DM*(VAR_3[VAR_7] + VAR_5[VAR_7])+W_DO)>>W_DS; VAR_3[VAR_7] -= (W_CM*(VAR_2[VAR_7] + VAR_4[VAR_7])+W_CO)>>W_CS; VAR_2[VAR_7] += (W_BM*(VAR_1[VAR_7] + VAR_3[VAR_7])+4*VAR_2[VAR_7]+W_BO)>>W_BS; VAR_1[VAR_7] += (W_AM*(VAR_0[VAR_7] + VAR_2[VAR_7])+W_AO)>>W_AS; } asm volatile ( "jmp 2f \n\t" "1: \n\t" "mov %6, %%"REG_a" \n\t" "mov %4, %%"REG_S" \n\t" snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_r2r_add("xmm0","xmm2","xmm4","xmm6","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") "pcmpeqd %%xmm1, %%xmm1 \n\t" "pslld $31, %%xmm1 \n\t" "psrld $29, %%xmm1 \n\t" "mov %5, %%"REG_a" \n\t" snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("3","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_load(REG_a,"xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sub("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_store(REG_a,"xmm1","xmm3","xmm5","xmm7") "mov %3, %%"REG_c" \n\t" snow_vertical_compose_sse2_load(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_S,"xmm0","xmm2","xmm4","xmm6") "mov %2, %%"REG_a" \n\t" snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6") "pcmpeqd %%xmm1, %%xmm1 \n\t" "pslld $31, %%xmm1 \n\t" "psrld $30, %%xmm1 \n\t" "mov %1, %%"REG_S" \n\t" snow_vertical_compose_sse2_r2r_add("xmm1","xmm1","xmm1","xmm1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_sra("2","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_c,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_c,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_S,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") snow_vertical_compose_sse2_sra("1","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_add(REG_a,"xmm0","xmm2","xmm4","xmm6") snow_vertical_compose_sse2_store(REG_a,"xmm0","xmm2","xmm4","xmm6") "2: \n\t" "sub $16, %%"REG_d" \n\t" "jge 1b \n\t" :"+d"(VAR_7) : "m"(VAR_0),"m"(VAR_1),"m"(VAR_2),"m"(VAR_3),"m"(VAR_4),"m"(VAR_5): "%"REG_a"","%"REG_S"","%"REG_c""); }
[ "void FUNC_0(DWTELEM *VAR_0, DWTELEM *VAR_1, DWTELEM *VAR_2, DWTELEM *VAR_3, DWTELEM *VAR_4, DWTELEM *VAR_5, int VAR_6){", "long VAR_7 = VAR_6;", "while(VAR_7 & 0xF)\n{", "VAR_7--;", "VAR_4[VAR_7] -= (W_DM*(VAR_3[VAR_7] + VAR_5[VAR_7])+W_DO)>>W_DS;", "VAR_3[VAR_7] -= (W_CM*(VAR_2[VAR_7] + VAR_4[VAR_7])+W_CO)>>W_CS;", "VAR_2[VAR_7] += (W_BM*(VAR_1[VAR_7] + VAR_3[VAR_7])+4*VAR_2[VAR_7]+W_BO)>>W_BS;", "VAR_1[VAR_7] += (W_AM*(VAR_0[VAR_7] + VAR_2[VAR_7])+W_AO)>>W_AS;", "}", "asm volatile (\n\"jmp 2f \\n\\t\"\n\"1: \\n\\t\"\n\"mov %6, %%\"REG_a\" \\n\\t\"\n\"mov %4, %%\"REG_S\" \\n\\t\"\nsnow_vertical_compose_sse2_load(REG_S,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_add(REG_a,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_move(\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\",\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\")\nsnow_vertical_compose_sse2_r2r_add(\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_r2r_add(\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\n\"pcmpeqd %%xmm1, %%xmm1 \\n\\t\"\n\"pslld $31, %%xmm1 \\n\\t\"\n\"psrld $29, %%xmm1 \\n\\t\"\n\"mov %5, %%\"REG_a\" \\n\\t\"\nsnow_vertical_compose_sse2_r2r_add(\"xmm1\",\"xmm1\",\"xmm1\",\"xmm1\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_sra(\"3\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_load(REG_a,\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\")\nsnow_vertical_compose_sse2_sub(\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\",\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\")\nsnow_vertical_compose_sse2_store(REG_a,\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\")\n\"mov %3, %%\"REG_c\" \\n\\t\"\nsnow_vertical_compose_sse2_load(REG_S,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_add(REG_c,\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\")\nsnow_vertical_compose_sse2_sub(\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_store(REG_S,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\n\"mov %2, %%\"REG_a\" \\n\\t\"\nsnow_vertical_compose_sse2_add(REG_a,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_sra(\"2\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_add(REG_c,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\n\"pcmpeqd %%xmm1, %%xmm1 \\n\\t\"\n\"pslld $31, %%xmm1 \\n\\t\"\n\"psrld $30, %%xmm1 \\n\\t\"\n\"mov %1, %%\"REG_S\" \\n\\t\"\nsnow_vertical_compose_sse2_r2r_add(\"xmm1\",\"xmm1\",\"xmm1\",\"xmm1\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_sra(\"2\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_add(REG_c,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_store(REG_c,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_add(REG_S,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_move(\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\",\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\")\nsnow_vertical_compose_sse2_sra(\"1\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_r2r_add(\"xmm1\",\"xmm3\",\"xmm5\",\"xmm7\",\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_add(REG_a,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\nsnow_vertical_compose_sse2_store(REG_a,\"xmm0\",\"xmm2\",\"xmm4\",\"xmm6\")\n\"2: \\n\\t\"\n\"sub $16, %%\"REG_d\" \\n\\t\"\n\"jge 1b \\n\\t\"\n:\"+d\"(VAR_7)\n:\n\"m\"(VAR_0),\"m\"(VAR_1),\"m\"(VAR_2),\"m\"(VAR_3),\"m\"(VAR_4),\"m\"(VAR_5):\n\"%\"REG_a\"\",\"%\"REG_S\"\",\"%\"REG_c\"\");", "}" ]
[ 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1 ], [ 3 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29, 33, 35, 39, 41, 43, 45, 47, 51, 53, 55, 57, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 91, 93, 95, 97, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 123, 125, 127, 129, 131, 133, 135 ], [ 137 ] ]
2,924
int qemu_fclose(QEMUFile *f) { int ret = 0; qemu_fflush(f); if (f->close) ret = f->close(f->opaque); g_free(f); return ret; }
true
qemu
d82ca915875ac55ba291435f7eb4fe7bfcb2cecb
int qemu_fclose(QEMUFile *f) { int ret = 0; qemu_fflush(f); if (f->close) ret = f->close(f->opaque); g_free(f); return ret; }
{ "code": [ "int qemu_fclose(QEMUFile *f)", " qemu_fflush(f);", " if (f->close)" ], "line_no": [ 1, 7, 9 ] }
int FUNC_0(QEMUFile *VAR_0) { int VAR_1 = 0; qemu_fflush(VAR_0); if (VAR_0->close) VAR_1 = VAR_0->close(VAR_0->opaque); g_free(VAR_0); return VAR_1; }
[ "int FUNC_0(QEMUFile *VAR_0)\n{", "int VAR_1 = 0;", "qemu_fflush(VAR_0);", "if (VAR_0->close)\nVAR_1 = VAR_0->close(VAR_0->opaque);", "g_free(VAR_0);", "return VAR_1;", "}" ]
[ 1, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ] ]
2,925
static bool block_is_active(void *opaque) { return block_mig_state.blk_enable == 1; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static bool block_is_active(void *opaque) { return block_mig_state.blk_enable == 1; }
{ "code": [], "line_no": [] }
static bool FUNC_0(void *opaque) { return block_mig_state.blk_enable == 1; }
[ "static bool FUNC_0(void *opaque)\n{", "return block_mig_state.blk_enable == 1;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,926
static void filter1(int32_t *dst, const int32_t *src, int32_t coeff, ptrdiff_t len) { int i; for (i = 0; i < len; i++) dst[i] -= mul23(src[i], coeff); }
true
FFmpeg
29638d4db90d5e3fc107c1beb40808f53cc7acaa
static void filter1(int32_t *dst, const int32_t *src, int32_t coeff, ptrdiff_t len) { int i; for (i = 0; i < len; i++) dst[i] -= mul23(src[i], coeff); }
{ "code": [ "static void filter1(int32_t *dst, const int32_t *src, int32_t coeff, ptrdiff_t len)" ], "line_no": [ 1 ] }
static void FUNC_0(int32_t *VAR_0, const int32_t *VAR_1, int32_t VAR_2, ptrdiff_t VAR_3) { int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) VAR_0[VAR_4] -= mul23(VAR_1[VAR_4], VAR_2); }
[ "static void FUNC_0(int32_t *VAR_0, const int32_t *VAR_1, int32_t VAR_2, ptrdiff_t VAR_3)\n{", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++)", "VAR_0[VAR_4] -= mul23(VAR_1[VAR_4], VAR_2);", "}" ]
[ 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
2,927
static int mpegts_write_end(AVFormatContext *s) { MpegTSWrite *ts = s->priv_data; MpegTSWriteStream *ts_st; MpegTSService *service; AVStream *st; int i; /* flush current packets */ for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; ts_st = st->priv_data; if (ts_st->payload_index > 0) { mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, ts_st->payload_pts); } } put_flush_packet(&s->pb); for(i = 0; i < ts->nb_services; i++) { service = ts->services[i]; av_freep(&service->provider_name); av_freep(&service->name); av_free(service); } av_free(ts->services); for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; av_free(st->priv_data); } return 0; }
true
FFmpeg
0044a8f80df366643bcfaf74011e41a2658c88f8
static int mpegts_write_end(AVFormatContext *s) { MpegTSWrite *ts = s->priv_data; MpegTSWriteStream *ts_st; MpegTSService *service; AVStream *st; int i; for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; ts_st = st->priv_data; if (ts_st->payload_index > 0) { mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, ts_st->payload_pts); } } put_flush_packet(&s->pb); for(i = 0; i < ts->nb_services; i++) { service = ts->services[i]; av_freep(&service->provider_name); av_freep(&service->name); av_free(service); } av_free(ts->services); for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; av_free(st->priv_data); } return 0; }
{ "code": [ " for(i = 0; i < s->nb_streams; i++) {", " st = s->streams[i];", " av_free(st->priv_data);" ], "line_no": [ 19, 21, 59 ] }
static int FUNC_0(AVFormatContext *VAR_0) { MpegTSWrite *ts = VAR_0->priv_data; MpegTSWriteStream *ts_st; MpegTSService *service; AVStream *st; int VAR_1; for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { st = VAR_0->streams[VAR_1]; ts_st = st->priv_data; if (ts_st->payload_index > 0) { mpegts_write_pes(VAR_0, st, ts_st->payload, ts_st->payload_index, ts_st->payload_pts); } } put_flush_packet(&VAR_0->pb); for(VAR_1 = 0; VAR_1 < ts->nb_services; VAR_1++) { service = ts->services[VAR_1]; av_freep(&service->provider_name); av_freep(&service->name); av_free(service); } av_free(ts->services); for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { st = VAR_0->streams[VAR_1]; av_free(st->priv_data); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "MpegTSWrite *ts = VAR_0->priv_data;", "MpegTSWriteStream *ts_st;", "MpegTSService *service;", "AVStream *st;", "int VAR_1;", "for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "st = VAR_0->streams[VAR_1];", "ts_st = st->priv_data;", "if (ts_st->payload_index > 0) {", "mpegts_write_pes(VAR_0, st, ts_st->payload, ts_st->payload_index,\nts_st->payload_pts);", "}", "}", "put_flush_packet(&VAR_0->pb);", "for(VAR_1 = 0; VAR_1 < ts->nb_services; VAR_1++) {", "service = ts->services[VAR_1];", "av_freep(&service->provider_name);", "av_freep(&service->name);", "av_free(service);", "}", "av_free(ts->services);", "for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "st = VAR_0->streams[VAR_1];", "av_free(st->priv_data);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
2,928
static int microdvd_probe(AVProbeData *p) { unsigned char c; const uint8_t *ptr = p->buf; int i; if (AV_RB24(ptr) == 0xEFBBBF) ptr += 3; /* skip UTF-8 BOM */ for (i=0; i<3; i++) { if (sscanf(ptr, "{%*d}{}%c", &c) != 1 && sscanf(ptr, "{%*d}{%*d}%c", &c) != 1 && sscanf(ptr, "{DEFAULT}{}%c", &c) != 1) return 0; ptr += strcspn(ptr, "\n") + 1; } return AVPROBE_SCORE_MAX; }
true
FFmpeg
90fc00a623de44e137fe1601b91356e8cd8bdd54
static int microdvd_probe(AVProbeData *p) { unsigned char c; const uint8_t *ptr = p->buf; int i; if (AV_RB24(ptr) == 0xEFBBBF) ptr += 3; for (i=0; i<3; i++) { if (sscanf(ptr, "{%*d}{}%c", &c) != 1 && sscanf(ptr, "{%*d}{%*d}%c", &c) != 1 && sscanf(ptr, "{DEFAULT}{}%c", &c) != 1) return 0; ptr += strcspn(ptr, "\n") + 1; } return AVPROBE_SCORE_MAX; }
{ "code": [ " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;", " ptr += strcspn(ptr, \"\\n\") + 1;" ], "line_no": [ 29, 29, 29, 29, 29 ] }
static int FUNC_0(AVProbeData *VAR_0) { unsigned char VAR_1; const uint8_t *VAR_2 = VAR_0->buf; int VAR_3; if (AV_RB24(VAR_2) == 0xEFBBBF) VAR_2 += 3; for (VAR_3=0; VAR_3<3; VAR_3++) { if (sscanf(VAR_2, "{%*d}{}%VAR_1", &VAR_1) != 1 && sscanf(VAR_2, "{%*d}{%*d}%VAR_1", &VAR_1) != 1 && sscanf(VAR_2, "{DEFAULT}{}%VAR_1", &VAR_1) != 1) return 0; VAR_2 += strcspn(VAR_2, "\n") + 1; } return AVPROBE_SCORE_MAX; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "unsigned char VAR_1;", "const uint8_t *VAR_2 = VAR_0->buf;", "int VAR_3;", "if (AV_RB24(VAR_2) == 0xEFBBBF)\nVAR_2 += 3;", "for (VAR_3=0; VAR_3<3; VAR_3++) {", "if (sscanf(VAR_2, \"{%*d}{}%VAR_1\", &VAR_1) != 1 &&", "sscanf(VAR_2, \"{%*d}{%*d}%VAR_1\", &VAR_1) != 1 &&", "sscanf(VAR_2, \"{DEFAULT}{}%VAR_1\", &VAR_1) != 1)", "return 0;", "VAR_2 += strcspn(VAR_2, \"\\n\") + 1;", "}", "return AVPROBE_SCORE_MAX;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
2,930
static void draw_char(AVCodecContext *avctx, int c) { AnsiContext *s = avctx->priv_data; int fg = s->fg; int bg = s->bg; if ((s->attributes & ATTR_BOLD)) fg += 8; if ((s->attributes & ATTR_BLINK)) bg += 8; if ((s->attributes & ATTR_REVERSE)) FFSWAP(int, fg, bg); if ((s->attributes & ATTR_CONCEALED)) fg = bg; ff_draw_pc_font(s->frame->data[0] + s->y * s->frame->linesize[0] + s->x, s->frame->linesize[0], s->font, s->font_height, c, fg, bg); s->x += FONT_WIDTH; if (s->x >= avctx->width) { s->x = 0; hscroll(avctx); } }
false
FFmpeg
6021615bbe393381f23b34a7cd0dcfd1a42687ba
static void draw_char(AVCodecContext *avctx, int c) { AnsiContext *s = avctx->priv_data; int fg = s->fg; int bg = s->bg; if ((s->attributes & ATTR_BOLD)) fg += 8; if ((s->attributes & ATTR_BLINK)) bg += 8; if ((s->attributes & ATTR_REVERSE)) FFSWAP(int, fg, bg); if ((s->attributes & ATTR_CONCEALED)) fg = bg; ff_draw_pc_font(s->frame->data[0] + s->y * s->frame->linesize[0] + s->x, s->frame->linesize[0], s->font, s->font_height, c, fg, bg); s->x += FONT_WIDTH; if (s->x >= avctx->width) { s->x = 0; hscroll(avctx); } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecContext *VAR_0, int VAR_1) { AnsiContext *s = VAR_0->priv_data; int VAR_2 = s->VAR_2; int VAR_3 = s->VAR_3; if ((s->attributes & ATTR_BOLD)) VAR_2 += 8; if ((s->attributes & ATTR_BLINK)) VAR_3 += 8; if ((s->attributes & ATTR_REVERSE)) FFSWAP(int, VAR_2, VAR_3); if ((s->attributes & ATTR_CONCEALED)) VAR_2 = VAR_3; ff_draw_pc_font(s->frame->data[0] + s->y * s->frame->linesize[0] + s->x, s->frame->linesize[0], s->font, s->font_height, VAR_1, VAR_2, VAR_3); s->x += FONT_WIDTH; if (s->x >= VAR_0->width) { s->x = 0; hscroll(VAR_0); } }
[ "static void FUNC_0(AVCodecContext *VAR_0, int VAR_1)\n{", "AnsiContext *s = VAR_0->priv_data;", "int VAR_2 = s->VAR_2;", "int VAR_3 = s->VAR_3;", "if ((s->attributes & ATTR_BOLD))\nVAR_2 += 8;", "if ((s->attributes & ATTR_BLINK))\nVAR_3 += 8;", "if ((s->attributes & ATTR_REVERSE))\nFFSWAP(int, VAR_2, VAR_3);", "if ((s->attributes & ATTR_CONCEALED))\nVAR_2 = VAR_3;", "ff_draw_pc_font(s->frame->data[0] + s->y * s->frame->linesize[0] + s->x,\ns->frame->linesize[0], s->font, s->font_height, VAR_1, VAR_2, VAR_3);", "s->x += FONT_WIDTH;", "if (s->x >= VAR_0->width) {", "s->x = 0;", "hscroll(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
2,931
static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, vorbis_residue *vr, unsigned ch, uint8_t *do_not_decode, float *vec, unsigned vlen, unsigned ch_left, int vr_type) { GetBitContext *gb = &vc->gb; unsigned c_p_c = vc->codebooks[vr->classbook].dimensions; uint8_t *classifs = vr->classifs; unsigned pass, ch_used, i, j, k, l; unsigned max_output = (ch - 1) * vlen; int ptns_to_read = vr->ptns_to_read; if (vr_type == 2) { for (j = 1; j < ch; ++j) do_not_decode[0] &= do_not_decode[j]; // FIXME - clobbering input if (do_not_decode[0]) return 0; ch_used = 1; max_output += vr->end / ch; } else { ch_used = ch; max_output += vr->end; } if (max_output > ch_left * vlen) { av_log(vc->avctx, AV_LOG_ERROR, "Insufficient output buffer\n"); return AVERROR_INVALIDDATA; } av_dlog(NULL, " residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, c_p_c); for (pass = 0; pass <= vr->maxpass; ++pass) { // FIXME OPTIMIZE? int voffset, partition_count, j_times_ptns_to_read; voffset = vr->begin; for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC error if (!pass) { setup_classifs(vc, vr, do_not_decode, ch_used, partition_count); } for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) { for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { unsigned voffs; if (!do_not_decode[j]) { unsigned vqclass = classifs[j_times_ptns_to_read + partition_count]; int vqbook = vr->books[vqclass][pass]; if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) { unsigned coffs; unsigned dim = vc->codebooks[vqbook].dimensions; unsigned step = FASTDIV(vr->partition_size << 1, dim << 1); vorbis_codebook codebook = vc->codebooks[vqbook]; if (vr_type == 0) { voffs = voffset+j*vlen; for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l) vec[voffs + k + l * step] += codebook.codevectors[coffs + l]; } } else if (vr_type == 1) { voffs = voffset + j * vlen; for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l, ++voffs) { vec[voffs]+=codebook.codevectors[coffs+l]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d \n", pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs); } } } else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (dim & 1) == 0) { // most frequent case optimized voffs = voffset >> 1; if (dim == 2) { for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2; vec[voffs + k ] += codebook.codevectors[coffs ]; vec[voffs + k + vlen] += codebook.codevectors[coffs + 1]; } } else if (dim == 4) { for (k = 0; k < step; ++k, voffs += 2) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4; vec[voffs ] += codebook.codevectors[coffs ]; vec[voffs + 1 ] += codebook.codevectors[coffs + 2]; vec[voffs + vlen ] += codebook.codevectors[coffs + 1]; vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3]; } } else for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; l += 2, voffs++) { vec[voffs ] += codebook.codevectors[coffs + l ]; vec[voffs + vlen] += codebook.codevectors[coffs + l + 1]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l); } } } else if (vr_type == 2) { unsigned voffs_div = FASTDIV(voffset << 1, ch <<1); unsigned voffs_mod = voffset - voffs_div * ch; for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l) { vec[voffs_div + voffs_mod * vlen] += codebook.codevectors[coffs + l]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", pass, voffs_div + voffs_mod * vlen, vec[voffs_div + voffs_mod * vlen], codebook.codevectors[coffs + l], coffs, l); if (++voffs_mod == ch) { voffs_div++; voffs_mod = 0; } } } } } } j_times_ptns_to_read += ptns_to_read; } ++partition_count; voffset += vr->partition_size; } } } return 0; }
false
FFmpeg
0025f7408a0fab2cab4a950064e4784a67463994
static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, vorbis_residue *vr, unsigned ch, uint8_t *do_not_decode, float *vec, unsigned vlen, unsigned ch_left, int vr_type) { GetBitContext *gb = &vc->gb; unsigned c_p_c = vc->codebooks[vr->classbook].dimensions; uint8_t *classifs = vr->classifs; unsigned pass, ch_used, i, j, k, l; unsigned max_output = (ch - 1) * vlen; int ptns_to_read = vr->ptns_to_read; if (vr_type == 2) { for (j = 1; j < ch; ++j) do_not_decode[0] &= do_not_decode[j]; if (do_not_decode[0]) return 0; ch_used = 1; max_output += vr->end / ch; } else { ch_used = ch; max_output += vr->end; } if (max_output > ch_left * vlen) { av_log(vc->avctx, AV_LOG_ERROR, "Insufficient output buffer\n"); return AVERROR_INVALIDDATA; } av_dlog(NULL, " residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, c_p_c); for (pass = 0; pass <= vr->maxpass; ++pass) { int voffset, partition_count, j_times_ptns_to_read; voffset = vr->begin; for (partition_count = 0; partition_count < ptns_to_read;) { if (!pass) { setup_classifs(vc, vr, do_not_decode, ch_used, partition_count); } for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) { for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { unsigned voffs; if (!do_not_decode[j]) { unsigned vqclass = classifs[j_times_ptns_to_read + partition_count]; int vqbook = vr->books[vqclass][pass]; if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) { unsigned coffs; unsigned dim = vc->codebooks[vqbook].dimensions; unsigned step = FASTDIV(vr->partition_size << 1, dim << 1); vorbis_codebook codebook = vc->codebooks[vqbook]; if (vr_type == 0) { voffs = voffset+j*vlen; for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l) vec[voffs + k + l * step] += codebook.codevectors[coffs + l]; } } else if (vr_type == 1) { voffs = voffset + j * vlen; for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l, ++voffs) { vec[voffs]+=codebook.codevectors[coffs+l]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d \n", pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs); } } } else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (dim & 1) == 0) { voffs = voffset >> 1; if (dim == 2) { for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2; vec[voffs + k ] += codebook.codevectors[coffs ]; vec[voffs + k + vlen] += codebook.codevectors[coffs + 1]; } } else if (dim == 4) { for (k = 0; k < step; ++k, voffs += 2) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4; vec[voffs ] += codebook.codevectors[coffs ]; vec[voffs + 1 ] += codebook.codevectors[coffs + 2]; vec[voffs + vlen ] += codebook.codevectors[coffs + 1]; vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3]; } } else for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; l += 2, voffs++) { vec[voffs ] += codebook.codevectors[coffs + l ]; vec[voffs + vlen] += codebook.codevectors[coffs + l + 1]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l); } } } else if (vr_type == 2) { unsigned voffs_div = FASTDIV(voffset << 1, ch <<1); unsigned voffs_mod = voffset - voffs_div * ch; for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l) { vec[voffs_div + voffs_mod * vlen] += codebook.codevectors[coffs + l]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", pass, voffs_div + voffs_mod * vlen, vec[voffs_div + voffs_mod * vlen], codebook.codevectors[coffs + l], coffs, l); if (++voffs_mod == ch) { voffs_div++; voffs_mod = 0; } } } } } } j_times_ptns_to_read += ptns_to_read; } ++partition_count; voffset += vr->partition_size; } } } return 0; }
{ "code": [], "line_no": [] }
static av_always_inline int FUNC_0(vorbis_context *vc, vorbis_residue *vr, unsigned ch, uint8_t *do_not_decode, float *vec, unsigned vlen, unsigned ch_left, int vr_type) { GetBitContext *gb = &vc->gb; unsigned VAR_0 = vc->codebooks[vr->classbook].dimensions; uint8_t *classifs = vr->classifs; unsigned VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; unsigned VAR_7 = (ch - 1) * vlen; int VAR_8 = vr->VAR_8; if (vr_type == 2) { for (VAR_4 = 1; VAR_4 < ch; ++VAR_4) do_not_decode[0] &= do_not_decode[VAR_4]; if (do_not_decode[0]) return 0; VAR_2 = 1; VAR_7 += vr->end / ch; } else { VAR_2 = ch; VAR_7 += vr->end; } if (VAR_7 > ch_left * vlen) { av_log(vc->avctx, AV_LOG_ERROR, "Insufficient output buffer\n"); return AVERROR_INVALIDDATA; } av_dlog(NULL, " residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, VAR_0); for (VAR_1 = 0; VAR_1 <= vr->maxpass; ++VAR_1) { int voffset, partition_count, j_times_ptns_to_read; voffset = vr->begin; for (partition_count = 0; partition_count < VAR_8;) { if (!VAR_1) { setup_classifs(vc, vr, do_not_decode, VAR_2, partition_count); } for (VAR_3 = 0; (VAR_3 < VAR_0) && (partition_count < VAR_8); ++VAR_3) { for (j_times_ptns_to_read = 0, VAR_4 = 0; VAR_4 < VAR_2; ++VAR_4) { unsigned voffs; if (!do_not_decode[VAR_4]) { unsigned vqclass = classifs[j_times_ptns_to_read + partition_count]; int vqbook = vr->books[vqclass][VAR_1]; if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) { unsigned coffs; unsigned dim = vc->codebooks[vqbook].dimensions; unsigned step = FASTDIV(vr->partition_size << 1, dim << 1); vorbis_codebook codebook = vc->codebooks[vqbook]; if (vr_type == 0) { voffs = voffset+VAR_4*vlen; for (VAR_5 = 0; VAR_5 < step; ++VAR_5) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (VAR_6 = 0; VAR_6 < dim; ++VAR_6) vec[voffs + VAR_5 + VAR_6 * step] += codebook.codevectors[coffs + VAR_6]; } } else if (vr_type == 1) { voffs = voffset + VAR_4 * vlen; for (VAR_5 = 0; VAR_5 < step; ++VAR_5) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (VAR_6 = 0; VAR_6 < dim; ++VAR_6, ++voffs) { vec[voffs]+=codebook.codevectors[coffs+VAR_6]; av_dlog(NULL, " VAR_1 %d offs: %d curr: %f change: %f cv offs.: %d \n", VAR_1, voffs, vec[voffs], codebook.codevectors[coffs+VAR_6], coffs); } } } else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (dim & 1) == 0) { voffs = voffset >> 1; if (dim == 2) { for (VAR_5 = 0; VAR_5 < step; ++VAR_5) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2; vec[voffs + VAR_5 ] += codebook.codevectors[coffs ]; vec[voffs + VAR_5 + vlen] += codebook.codevectors[coffs + 1]; } } else if (dim == 4) { for (VAR_5 = 0; VAR_5 < step; ++VAR_5, voffs += 2) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4; vec[voffs ] += codebook.codevectors[coffs ]; vec[voffs + 1 ] += codebook.codevectors[coffs + 2]; vec[voffs + vlen ] += codebook.codevectors[coffs + 1]; vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3]; } } else for (VAR_5 = 0; VAR_5 < step; ++VAR_5) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (VAR_6 = 0; VAR_6 < dim; VAR_6 += 2, voffs++) { vec[voffs ] += codebook.codevectors[coffs + VAR_6 ]; vec[voffs + vlen] += codebook.codevectors[coffs + VAR_6 + 1]; av_dlog(NULL, " VAR_1 %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", VAR_1, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + VAR_6], coffs, VAR_6); } } } else if (vr_type == 2) { unsigned voffs_div = FASTDIV(voffset << 1, ch <<1); unsigned voffs_mod = voffset - voffs_div * ch; for (VAR_5 = 0; VAR_5 < step; ++VAR_5) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (VAR_6 = 0; VAR_6 < dim; ++VAR_6) { vec[voffs_div + voffs_mod * vlen] += codebook.codevectors[coffs + VAR_6]; av_dlog(NULL, " VAR_1 %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", VAR_1, voffs_div + voffs_mod * vlen, vec[voffs_div + voffs_mod * vlen], codebook.codevectors[coffs + VAR_6], coffs, VAR_6); if (++voffs_mod == ch) { voffs_div++; voffs_mod = 0; } } } } } } j_times_ptns_to_read += VAR_8; } ++partition_count; voffset += vr->partition_size; } } } return 0; }
[ "static av_always_inline int FUNC_0(vorbis_context *vc,\nvorbis_residue *vr,\nunsigned ch,\nuint8_t *do_not_decode,\nfloat *vec,\nunsigned vlen,\nunsigned ch_left,\nint vr_type)\n{", "GetBitContext *gb = &vc->gb;", "unsigned VAR_0 = vc->codebooks[vr->classbook].dimensions;", "uint8_t *classifs = vr->classifs;", "unsigned VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "unsigned VAR_7 = (ch - 1) * vlen;", "int VAR_8 = vr->VAR_8;", "if (vr_type == 2) {", "for (VAR_4 = 1; VAR_4 < ch; ++VAR_4)", "do_not_decode[0] &= do_not_decode[VAR_4];", "if (do_not_decode[0])\nreturn 0;", "VAR_2 = 1;", "VAR_7 += vr->end / ch;", "} else {", "VAR_2 = ch;", "VAR_7 += vr->end;", "}", "if (VAR_7 > ch_left * vlen) {", "av_log(vc->avctx, AV_LOG_ERROR, \"Insufficient output buffer\\n\");", "return AVERROR_INVALIDDATA;", "}", "av_dlog(NULL, \" residue type 0/1/2 decode begin, ch: %d cpc %d \\n\", ch, VAR_0);", "for (VAR_1 = 0; VAR_1 <= vr->maxpass; ++VAR_1) {", "int voffset, partition_count, j_times_ptns_to_read;", "voffset = vr->begin;", "for (partition_count = 0; partition_count < VAR_8;) {", "if (!VAR_1) {", "setup_classifs(vc, vr, do_not_decode, VAR_2, partition_count);", "}", "for (VAR_3 = 0; (VAR_3 < VAR_0) && (partition_count < VAR_8); ++VAR_3) {", "for (j_times_ptns_to_read = 0, VAR_4 = 0; VAR_4 < VAR_2; ++VAR_4) {", "unsigned voffs;", "if (!do_not_decode[VAR_4]) {", "unsigned vqclass = classifs[j_times_ptns_to_read + partition_count];", "int vqbook = vr->books[vqclass][VAR_1];", "if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) {", "unsigned coffs;", "unsigned dim = vc->codebooks[vqbook].dimensions;", "unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);", "vorbis_codebook codebook = vc->codebooks[vqbook];", "if (vr_type == 0) {", "voffs = voffset+VAR_4*vlen;", "for (VAR_5 = 0; VAR_5 < step; ++VAR_5) {", "coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;", "for (VAR_6 = 0; VAR_6 < dim; ++VAR_6)", "vec[voffs + VAR_5 + VAR_6 * step] += codebook.codevectors[coffs + VAR_6];", "}", "} else if (vr_type == 1) {", "voffs = voffset + VAR_4 * vlen;", "for (VAR_5 = 0; VAR_5 < step; ++VAR_5) {", "coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;", "for (VAR_6 = 0; VAR_6 < dim; ++VAR_6, ++voffs) {", "vec[voffs]+=codebook.codevectors[coffs+VAR_6];", "av_dlog(NULL, \" VAR_1 %d offs: %d curr: %f change: %f cv offs.: %d \\n\",\nVAR_1, voffs, vec[voffs], codebook.codevectors[coffs+VAR_6], coffs);", "}", "}", "} else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (dim & 1) == 0) {", "voffs = voffset >> 1;", "if (dim == 2) {", "for (VAR_5 = 0; VAR_5 < step; ++VAR_5) {", "coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2;", "vec[voffs + VAR_5 ] += codebook.codevectors[coffs ];", "vec[voffs + VAR_5 + vlen] += codebook.codevectors[coffs + 1];", "}", "} else if (dim == 4) {", "for (VAR_5 = 0; VAR_5 < step; ++VAR_5, voffs += 2) {", "coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4;", "vec[voffs ] += codebook.codevectors[coffs ];", "vec[voffs + 1 ] += codebook.codevectors[coffs + 2];", "vec[voffs + vlen ] += codebook.codevectors[coffs + 1];", "vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3];", "}", "} else", "for (VAR_5 = 0; VAR_5 < step; ++VAR_5) {", "coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;", "for (VAR_6 = 0; VAR_6 < dim; VAR_6 += 2, voffs++) {", "vec[voffs ] += codebook.codevectors[coffs + VAR_6 ];", "vec[voffs + vlen] += codebook.codevectors[coffs + VAR_6 + 1];", "av_dlog(NULL, \" VAR_1 %d offs: %d curr: %f change: %f cv offs.: %d+%d \\n\",\nVAR_1, voffset / ch + (voffs % ch) * vlen,\nvec[voffset / ch + (voffs % ch) * vlen],\ncodebook.codevectors[coffs + VAR_6], coffs, VAR_6);", "}", "}", "} else if (vr_type == 2) {", "unsigned voffs_div = FASTDIV(voffset << 1, ch <<1);", "unsigned voffs_mod = voffset - voffs_div * ch;", "for (VAR_5 = 0; VAR_5 < step; ++VAR_5) {", "coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;", "for (VAR_6 = 0; VAR_6 < dim; ++VAR_6) {", "vec[voffs_div + voffs_mod * vlen] +=\ncodebook.codevectors[coffs + VAR_6];", "av_dlog(NULL, \" VAR_1 %d offs: %d curr: %f change: %f cv offs.: %d+%d \\n\",\nVAR_1, voffs_div + voffs_mod * vlen,\nvec[voffs_div + voffs_mod * vlen],\ncodebook.codevectors[coffs + VAR_6], coffs, VAR_6);", "if (++voffs_mod == ch) {", "voffs_div++;", "voffs_mod = 0;", "}", "}", "}", "}", "}", "}", "j_times_ptns_to_read += VAR_8;", "}", "++partition_count;", "voffset += vr->partition_size;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201, 203, 205, 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 235, 237, 239, 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ] ]
2,932
static int init_quantization_noise(DCAEncContext *c, int noise) { int ch, band, ret = 0; c->consumed_bits = 132 + 493 * c->fullband_channels; if (c->lfe_channel) c->consumed_bits += 72; /* attempt to guess the bit distribution based on the prevoius frame */ for (ch = 0; ch < c->fullband_channels; ch++) { for (band = 0; band < 32; band++) { int snr_cb = c->peak_cb[band][ch] - c->band_masking_cb[band] - noise; if (snr_cb >= 1312) { c->abits[band][ch] = 26; ret |= USED_26ABITS; } else if (snr_cb >= 222) { c->abits[band][ch] = 8 + mul32(snr_cb - 222, 69000000); ret |= USED_NABITS; } else if (snr_cb >= 0) { c->abits[band][ch] = 2 + mul32(snr_cb, 106000000); ret |= USED_NABITS; } else { c->abits[band][ch] = 1; ret |= USED_1ABITS; } } } for (band = 0; band < 32; band++) for (ch = 0; ch < c->fullband_channels; ch++) { c->consumed_bits += bit_consumption[c->abits[band][ch]]; } return ret; }
false
FFmpeg
a6191d098a03f94685ae4c072bfdf10afcd86223
static int init_quantization_noise(DCAEncContext *c, int noise) { int ch, band, ret = 0; c->consumed_bits = 132 + 493 * c->fullband_channels; if (c->lfe_channel) c->consumed_bits += 72; for (ch = 0; ch < c->fullband_channels; ch++) { for (band = 0; band < 32; band++) { int snr_cb = c->peak_cb[band][ch] - c->band_masking_cb[band] - noise; if (snr_cb >= 1312) { c->abits[band][ch] = 26; ret |= USED_26ABITS; } else if (snr_cb >= 222) { c->abits[band][ch] = 8 + mul32(snr_cb - 222, 69000000); ret |= USED_NABITS; } else if (snr_cb >= 0) { c->abits[band][ch] = 2 + mul32(snr_cb, 106000000); ret |= USED_NABITS; } else { c->abits[band][ch] = 1; ret |= USED_1ABITS; } } } for (band = 0; band < 32; band++) for (ch = 0; ch < c->fullband_channels; ch++) { c->consumed_bits += bit_consumption[c->abits[band][ch]]; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(DCAEncContext *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4 = 0; VAR_0->consumed_bits = 132 + 493 * VAR_0->fullband_channels; if (VAR_0->lfe_channel) VAR_0->consumed_bits += 72; for (VAR_2 = 0; VAR_2 < VAR_0->fullband_channels; VAR_2++) { for (VAR_3 = 0; VAR_3 < 32; VAR_3++) { int snr_cb = VAR_0->peak_cb[VAR_3][VAR_2] - VAR_0->band_masking_cb[VAR_3] - VAR_1; if (snr_cb >= 1312) { VAR_0->abits[VAR_3][VAR_2] = 26; VAR_4 |= USED_26ABITS; } else if (snr_cb >= 222) { VAR_0->abits[VAR_3][VAR_2] = 8 + mul32(snr_cb - 222, 69000000); VAR_4 |= USED_NABITS; } else if (snr_cb >= 0) { VAR_0->abits[VAR_3][VAR_2] = 2 + mul32(snr_cb, 106000000); VAR_4 |= USED_NABITS; } else { VAR_0->abits[VAR_3][VAR_2] = 1; VAR_4 |= USED_1ABITS; } } } for (VAR_3 = 0; VAR_3 < 32; VAR_3++) for (VAR_2 = 0; VAR_2 < VAR_0->fullband_channels; VAR_2++) { VAR_0->consumed_bits += bit_consumption[VAR_0->abits[VAR_3][VAR_2]]; } return VAR_4; }
[ "static int FUNC_0(DCAEncContext *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4 = 0;", "VAR_0->consumed_bits = 132 + 493 * VAR_0->fullband_channels;", "if (VAR_0->lfe_channel)\nVAR_0->consumed_bits += 72;", "for (VAR_2 = 0; VAR_2 < VAR_0->fullband_channels; VAR_2++) {", "for (VAR_3 = 0; VAR_3 < 32; VAR_3++) {", "int snr_cb = VAR_0->peak_cb[VAR_3][VAR_2] - VAR_0->band_masking_cb[VAR_3] - VAR_1;", "if (snr_cb >= 1312) {", "VAR_0->abits[VAR_3][VAR_2] = 26;", "VAR_4 |= USED_26ABITS;", "} else if (snr_cb >= 222) {", "VAR_0->abits[VAR_3][VAR_2] = 8 + mul32(snr_cb - 222, 69000000);", "VAR_4 |= USED_NABITS;", "} else if (snr_cb >= 0) {", "VAR_0->abits[VAR_3][VAR_2] = 2 + mul32(snr_cb, 106000000);", "VAR_4 |= USED_NABITS;", "} else {", "VAR_0->abits[VAR_3][VAR_2] = 1;", "VAR_4 |= USED_1ABITS;", "}", "}", "}", "for (VAR_3 = 0; VAR_3 < 32; VAR_3++)", "for (VAR_2 = 0; VAR_2 < VAR_0->fullband_channels; VAR_2++) {", "VAR_0->consumed_bits += bit_consumption[VAR_0->abits[VAR_3][VAR_2]];", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
2,933
static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref, const Mv *mv, int y0, int height) { int y = FFMAX(0, (mv->y >> 2) + y0 + height + 9); if (s->threads_type == FF_THREAD_FRAME ) ff_thread_await_progress(&ref->tf, y, 0); }
false
FFmpeg
b77e26b28525f366c5f978214b230a5324bedf81
static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref, const Mv *mv, int y0, int height) { int y = FFMAX(0, (mv->y >> 2) + y0 + height + 9); if (s->threads_type == FF_THREAD_FRAME ) ff_thread_await_progress(&ref->tf, y, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(HEVCContext *VAR_0, HEVCFrame *VAR_1, const Mv *VAR_2, int VAR_3, int VAR_4) { int VAR_5 = FFMAX(0, (VAR_2->VAR_5 >> 2) + VAR_3 + VAR_4 + 9); if (VAR_0->threads_type == FF_THREAD_FRAME ) ff_thread_await_progress(&VAR_1->tf, VAR_5, 0); }
[ "static void FUNC_0(HEVCContext *VAR_0, HEVCFrame *VAR_1,\nconst Mv *VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5 = FFMAX(0, (VAR_2->VAR_5 >> 2) + VAR_3 + VAR_4 + 9);", "if (VAR_0->threads_type == FF_THREAD_FRAME )\nff_thread_await_progress(&VAR_1->tf, VAR_5, 0);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ] ]
2,934
static inline void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) { int d; for( d = 0; d < 16; d++ ) { const int p2 = pix[-3*xstride]; const int p1 = pix[-2*xstride]; const int p0 = pix[-1*xstride]; const int q0 = pix[ 0*xstride]; const int q1 = pix[ 1*xstride]; const int q2 = pix[ 2*xstride]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ if( FFABS( p2 - p0 ) < beta) { const int p3 = pix[-4*xstride]; /* p0', p1', p2' */ pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; } else { /* p0' */ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } if( FFABS( q2 - q0 ) < beta) { const int q3 = pix[3*xstride]; /* q0', q1', q2' */ pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; } else { /* q0' */ pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } }else{ /* p0', q0' */ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } } pix += ystride; } }
false
FFmpeg
3f50965b28d0c4ef10dde0bf2f7a9f78fa36b378
static inline void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) { int d; for( d = 0; d < 16; d++ ) { const int p2 = pix[-3*xstride]; const int p1 = pix[-2*xstride]; const int p0 = pix[-1*xstride]; const int q0 = pix[ 0*xstride]; const int q1 = pix[ 1*xstride]; const int q2 = pix[ 2*xstride]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ if( FFABS( p2 - p0 ) < beta) { const int p3 = pix[-4*xstride]; pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; } else { pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } if( FFABS( q2 - q0 ) < beta) { const int q3 = pix[3*xstride]; pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; } else { pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } }else{ pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } } pix += ystride; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5; for( VAR_5 = 0; VAR_5 < 16; VAR_5++ ) { const int VAR_6 = VAR_0[-3*VAR_1]; const int VAR_7 = VAR_0[-2*VAR_1]; const int VAR_8 = VAR_0[-1*VAR_1]; const int VAR_9 = VAR_0[ 0*VAR_1]; const int VAR_10 = VAR_0[ 1*VAR_1]; const int VAR_11 = VAR_0[ 2*VAR_1]; if( FFABS( VAR_8 - VAR_9 ) < VAR_3 && FFABS( VAR_7 - VAR_8 ) < VAR_4 && FFABS( VAR_10 - VAR_9 ) < VAR_4 ) { if(FFABS( VAR_8 - VAR_9 ) < (( VAR_3 >> 2 ) + 2 )){ if( FFABS( VAR_6 - VAR_8 ) < VAR_4) { const int VAR_12 = VAR_0[-4*VAR_1]; VAR_0[-1*VAR_1] = ( VAR_6 + 2*VAR_7 + 2*VAR_8 + 2*VAR_9 + VAR_10 + 4 ) >> 3; VAR_0[-2*VAR_1] = ( VAR_6 + VAR_7 + VAR_8 + VAR_9 + 2 ) >> 2; VAR_0[-3*VAR_1] = ( 2*VAR_12 + 3*VAR_6 + VAR_7 + VAR_8 + VAR_9 + 4 ) >> 3; } else { VAR_0[-1*VAR_1] = ( 2*VAR_7 + VAR_8 + VAR_10 + 2 ) >> 2; } if( FFABS( VAR_11 - VAR_9 ) < VAR_4) { const int VAR_13 = VAR_0[3*VAR_1]; VAR_0[0*VAR_1] = ( VAR_7 + 2*VAR_8 + 2*VAR_9 + 2*VAR_10 + VAR_11 + 4 ) >> 3; VAR_0[1*VAR_1] = ( VAR_8 + VAR_9 + VAR_10 + VAR_11 + 2 ) >> 2; VAR_0[2*VAR_1] = ( 2*VAR_13 + 3*VAR_11 + VAR_10 + VAR_9 + VAR_8 + 4 ) >> 3; } else { VAR_0[0*VAR_1] = ( 2*VAR_10 + VAR_9 + VAR_7 + 2 ) >> 2; } }else{ VAR_0[-1*VAR_1] = ( 2*VAR_7 + VAR_8 + VAR_10 + 2 ) >> 2; VAR_0[ 0*VAR_1] = ( 2*VAR_10 + VAR_9 + VAR_7 + 2 ) >> 2; } } VAR_0 += VAR_2; } }
[ "static inline void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5;", "for( VAR_5 = 0; VAR_5 < 16; VAR_5++ ) {", "const int VAR_6 = VAR_0[-3*VAR_1];", "const int VAR_7 = VAR_0[-2*VAR_1];", "const int VAR_8 = VAR_0[-1*VAR_1];", "const int VAR_9 = VAR_0[ 0*VAR_1];", "const int VAR_10 = VAR_0[ 1*VAR_1];", "const int VAR_11 = VAR_0[ 2*VAR_1];", "if( FFABS( VAR_8 - VAR_9 ) < VAR_3 &&\nFFABS( VAR_7 - VAR_8 ) < VAR_4 &&\nFFABS( VAR_10 - VAR_9 ) < VAR_4 ) {", "if(FFABS( VAR_8 - VAR_9 ) < (( VAR_3 >> 2 ) + 2 )){", "if( FFABS( VAR_6 - VAR_8 ) < VAR_4)\n{", "const int VAR_12 = VAR_0[-4*VAR_1];", "VAR_0[-1*VAR_1] = ( VAR_6 + 2*VAR_7 + 2*VAR_8 + 2*VAR_9 + VAR_10 + 4 ) >> 3;", "VAR_0[-2*VAR_1] = ( VAR_6 + VAR_7 + VAR_8 + VAR_9 + 2 ) >> 2;", "VAR_0[-3*VAR_1] = ( 2*VAR_12 + 3*VAR_6 + VAR_7 + VAR_8 + VAR_9 + 4 ) >> 3;", "} else {", "VAR_0[-1*VAR_1] = ( 2*VAR_7 + VAR_8 + VAR_10 + 2 ) >> 2;", "}", "if( FFABS( VAR_11 - VAR_9 ) < VAR_4)\n{", "const int VAR_13 = VAR_0[3*VAR_1];", "VAR_0[0*VAR_1] = ( VAR_7 + 2*VAR_8 + 2*VAR_9 + 2*VAR_10 + VAR_11 + 4 ) >> 3;", "VAR_0[1*VAR_1] = ( VAR_8 + VAR_9 + VAR_10 + VAR_11 + 2 ) >> 2;", "VAR_0[2*VAR_1] = ( 2*VAR_13 + 3*VAR_11 + VAR_10 + VAR_9 + VAR_8 + 4 ) >> 3;", "} else {", "VAR_0[0*VAR_1] = ( 2*VAR_10 + VAR_9 + VAR_7 + 2 ) >> 2;", "}", "}else{", "VAR_0[-1*VAR_1] = ( 2*VAR_7 + VAR_8 + VAR_10 + 2 ) >> 2;", "VAR_0[ 0*VAR_1] = ( 2*VAR_10 + VAR_9 + VAR_7 + 2 ) >> 2;", "}", "}", "VAR_0 += VAR_2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
2,935
void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)) { AVPacketList **next_point, *this_pktl; this_pktl = av_mallocz(sizeof(AVPacketList)); this_pktl->pkt = *pkt; #if FF_API_DESTRUCT_PACKET FF_DISABLE_DEPRECATION_WARNINGS pkt->destruct = NULL; // do not free original but only the copy FF_ENABLE_DEPRECATION_WARNINGS #endif pkt->buf = NULL; av_dup_packet(&this_pktl->pkt); // duplicate the packet if it uses non-alloced memory if (s->streams[pkt->stream_index]->last_in_packet_buffer) { next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next); } else next_point = &s->packet_buffer; if (*next_point) { if (compare(s, &s->packet_buffer_end->pkt, pkt)) { while (!compare(s, &(*next_point)->pkt, pkt)) next_point = &(*next_point)->next; goto next_non_null; } else { next_point = &(s->packet_buffer_end->next); } } assert(!*next_point); s->packet_buffer_end = this_pktl; next_non_null: this_pktl->next = *next_point; s->streams[pkt->stream_index]->last_in_packet_buffer = *next_point = this_pktl; }
false
FFmpeg
324ff59444ff5470bb325ff1e2be7c4b054fc944
void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)) { AVPacketList **next_point, *this_pktl; this_pktl = av_mallocz(sizeof(AVPacketList)); this_pktl->pkt = *pkt; #if FF_API_DESTRUCT_PACKET FF_DISABLE_DEPRECATION_WARNINGS pkt->destruct = NULL; FF_ENABLE_DEPRECATION_WARNINGS #endif pkt->buf = NULL; av_dup_packet(&this_pktl->pkt); if (s->streams[pkt->stream_index]->last_in_packet_buffer) { next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next); } else next_point = &s->packet_buffer; if (*next_point) { if (compare(s, &s->packet_buffer_end->pkt, pkt)) { while (!compare(s, &(*next_point)->pkt, pkt)) next_point = &(*next_point)->next; goto next_non_null; } else { next_point = &(s->packet_buffer_end->next); } } assert(!*next_point); s->packet_buffer_end = this_pktl; next_non_null: this_pktl->next = *next_point; s->streams[pkt->stream_index]->last_in_packet_buffer = *next_point = this_pktl; }
{ "code": [], "line_no": [] }
VAR_4voidVAR_4 VAR_4ff_interleave_add_packetVAR_4(VAR_4AVFormatContextVAR_4 *VAR_4VAR_0VAR_4, VAR_4AVPacketVAR_4 *VAR_4VAR_1VAR_4, VAR_4intVAR_4 (*VAR_4VAR_2VAR_4)(VAR_4AVFormatContextVAR_4 *, VAR_4AVPacketVAR_4 *, VAR_4AVPacketVAR_4 *)) { VAR_4AVPacketListVAR_4 **VAR_4next_pointVAR_4, *VAR_4this_pktlVAR_4; VAR_4this_pktlVAR_4 = VAR_4av_malloczVAR_4(VAR_4sizeofVAR_4(VAR_4AVPacketListVAR_4)); VAR_4this_pktlVAR_4->VAR_4VAR_1VAR_4 = *VAR_4VAR_1VAR_4; #VAR_4ifVAR_4 VAR_4FF_API_DESTRUCT_PACKETVAR_4 VAR_4FF_DISABLE_DEPRECATION_WARNINGSVAR_4 VAR_4VAR_1VAR_4->VAR_4destructVAR_4 = VAR_4NULLVAR_4; VAR_4FF_ENABLE_DEPRECATION_WARNINGSVAR_4 #VAR_4endifVAR_4 VAR_4VAR_1VAR_4->VAR_4bufVAR_4 = VAR_4NULLVAR_4; VAR_4av_dup_packetVAR_4(&VAR_4this_pktlVAR_4->VAR_4VAR_1VAR_4); VAR_4ifVAR_4 (VAR_4VAR_0VAR_4->VAR_4streamsVAR_4[VAR_4VAR_1VAR_4->VAR_4stream_indexVAR_4]->VAR_4last_in_packet_bufferVAR_4) { VAR_4next_pointVAR_4 = &(VAR_4VAR_0VAR_4->VAR_4streamsVAR_4[VAR_4VAR_1VAR_4->VAR_4stream_indexVAR_4]->VAR_4last_in_packet_bufferVAR_4->VAR_4nextVAR_4); } VAR_4elseVAR_4 VAR_4next_pointVAR_4 = &VAR_4VAR_0VAR_4->VAR_4packet_bufferVAR_4; VAR_4ifVAR_4 (*VAR_4next_pointVAR_4) { VAR_4ifVAR_4 (VAR_4VAR_2VAR_4(VAR_4VAR_0VAR_4, &VAR_4VAR_0VAR_4->VAR_4packet_buffer_endVAR_4->VAR_4VAR_1VAR_4, VAR_4VAR_1VAR_4)) { VAR_4whileVAR_4 (!VAR_4VAR_2VAR_4(VAR_4VAR_0VAR_4, &(*VAR_4next_pointVAR_4)->VAR_4VAR_1VAR_4, VAR_4VAR_1VAR_4)) VAR_4next_pointVAR_4 = &(*VAR_4next_pointVAR_4)->VAR_4nextVAR_4; VAR_4gotoVAR_4 VAR_4next_non_nullVAR_4; } VAR_4elseVAR_4 { VAR_4next_pointVAR_4 = &(VAR_4VAR_0VAR_4->VAR_4packet_buffer_endVAR_4->VAR_4nextVAR_4); } } VAR_4assertVAR_4(!*VAR_4next_pointVAR_4); VAR_4VAR_0VAR_4->VAR_4packet_buffer_endVAR_4 = VAR_4this_pktlVAR_4; VAR_4next_non_nullVAR_4: VAR_4this_pktlVAR_4->VAR_4nextVAR_4 = *VAR_4next_pointVAR_4; VAR_4VAR_0VAR_4->VAR_4streamsVAR_4[VAR_4VAR_1VAR_4->VAR_4stream_indexVAR_4]->VAR_4last_in_packet_bufferVAR_4 = *VAR_4next_pointVAR_4 = VAR_4this_pktlVAR_4; }
[ "VAR_4voidVAR_4 VAR_4ff_interleave_add_packetVAR_4(VAR_4AVFormatContextVAR_4 *VAR_4VAR_0VAR_4, VAR_4AVPacketVAR_4 *VAR_4VAR_1VAR_4,\nVAR_4intVAR_4 (*VAR_4VAR_2VAR_4)(VAR_4AVFormatContextVAR_4 *, VAR_4AVPacketVAR_4 *, VAR_4AVPacketVAR_4 *))\n{", "VAR_4AVPacketListVAR_4 **VAR_4next_pointVAR_4, *VAR_4this_pktlVAR_4;", "VAR_4this_pktlVAR_4 = VAR_4av_malloczVAR_4(VAR_4sizeofVAR_4(VAR_4AVPacketListVAR_4));", "VAR_4this_pktlVAR_4->VAR_4VAR_1VAR_4 = *VAR_4VAR_1VAR_4;", "#VAR_4ifVAR_4 VAR_4FF_API_DESTRUCT_PACKETVAR_4\nVAR_4FF_DISABLE_DEPRECATION_WARNINGSVAR_4\nVAR_4VAR_1VAR_4->VAR_4destructVAR_4 = VAR_4NULLVAR_4;", "VAR_4FF_ENABLE_DEPRECATION_WARNINGSVAR_4\n#VAR_4endifVAR_4\nVAR_4VAR_1VAR_4->VAR_4bufVAR_4 = VAR_4NULLVAR_4;", "VAR_4av_dup_packetVAR_4(&VAR_4this_pktlVAR_4->VAR_4VAR_1VAR_4);", "VAR_4ifVAR_4 (VAR_4VAR_0VAR_4->VAR_4streamsVAR_4[VAR_4VAR_1VAR_4->VAR_4stream_indexVAR_4]->VAR_4last_in_packet_bufferVAR_4) {", "VAR_4next_pointVAR_4 = &(VAR_4VAR_0VAR_4->VAR_4streamsVAR_4[VAR_4VAR_1VAR_4->VAR_4stream_indexVAR_4]->VAR_4last_in_packet_bufferVAR_4->VAR_4nextVAR_4);", "} VAR_4elseVAR_4", "VAR_4next_pointVAR_4 = &VAR_4VAR_0VAR_4->VAR_4packet_bufferVAR_4;", "VAR_4ifVAR_4 (*VAR_4next_pointVAR_4) {", "VAR_4ifVAR_4 (VAR_4VAR_2VAR_4(VAR_4VAR_0VAR_4, &VAR_4VAR_0VAR_4->VAR_4packet_buffer_endVAR_4->VAR_4VAR_1VAR_4, VAR_4VAR_1VAR_4)) {", "VAR_4whileVAR_4 (!VAR_4VAR_2VAR_4(VAR_4VAR_0VAR_4, &(*VAR_4next_pointVAR_4)->VAR_4VAR_1VAR_4, VAR_4VAR_1VAR_4))\nVAR_4next_pointVAR_4 = &(*VAR_4next_pointVAR_4)->VAR_4nextVAR_4;", "VAR_4gotoVAR_4 VAR_4next_non_nullVAR_4;", "} VAR_4elseVAR_4 {", "VAR_4next_pointVAR_4 = &(VAR_4VAR_0VAR_4->VAR_4packet_buffer_endVAR_4->VAR_4nextVAR_4);", "}", "}", "VAR_4assertVAR_4(!*VAR_4next_pointVAR_4);", "VAR_4VAR_0VAR_4->VAR_4packet_buffer_endVAR_4 = VAR_4this_pktlVAR_4;", "VAR_4next_non_nullVAR_4:\nVAR_4this_pktlVAR_4->VAR_4nextVAR_4 = *VAR_4next_pointVAR_4;", "VAR_4VAR_0VAR_4->VAR_4streamsVAR_4[VAR_4VAR_1VAR_4->VAR_4stream_indexVAR_4]->VAR_4last_in_packet_bufferVAR_4 =\n*VAR_4next_pointVAR_4 = VAR_4this_pktlVAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 21, 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 69 ], [ 73, 75 ], [ 77 ] ]
2,937
static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s, AVFrame *frame) { int x, y; unsigned char P[2]; unsigned int flags; /* 2-color encoding */ P[0] = bytestream2_get_byte(&s->stream_ptr); P[1] = bytestream2_get_byte(&s->stream_ptr); if (P[0] <= P[1]) { /* need 8 more bytes from the stream */ for (y = 0; y < 8; y++) { flags = bytestream2_get_byte(&s->stream_ptr) | 0x100; for (; flags != 1; flags >>= 1) *s->pixel_ptr++ = P[flags & 1]; s->pixel_ptr += s->line_inc; } else { /* need 2 more bytes from the stream */ flags = bytestream2_get_le16(&s->stream_ptr); for (y = 0; y < 8; y += 2) { for (x = 0; x < 8; x += 2, flags >>= 1) { s->pixel_ptr[x ] = s->pixel_ptr[x + 1 ] = s->pixel_ptr[x + s->stride] = s->pixel_ptr[x + 1 + s->stride] = P[flags & 1]; s->pixel_ptr += s->stride * 2; /* report success */ return 0;
true
FFmpeg
8eb76217d0137b7adad438f6c923310fbc1fc4c1
static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s, AVFrame *frame) { int x, y; unsigned char P[2]; unsigned int flags; P[0] = bytestream2_get_byte(&s->stream_ptr); P[1] = bytestream2_get_byte(&s->stream_ptr); if (P[0] <= P[1]) { for (y = 0; y < 8; y++) { flags = bytestream2_get_byte(&s->stream_ptr) | 0x100; for (; flags != 1; flags >>= 1) *s->pixel_ptr++ = P[flags & 1]; s->pixel_ptr += s->line_inc; } else { flags = bytestream2_get_le16(&s->stream_ptr); for (y = 0; y < 8; y += 2) { for (x = 0; x < 8; x += 2, flags >>= 1) { s->pixel_ptr[x ] = s->pixel_ptr[x + 1 ] = s->pixel_ptr[x + s->stride] = s->pixel_ptr[x + 1 + s->stride] = P[flags & 1]; s->pixel_ptr += s->stride * 2; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1) { int VAR_2, VAR_3; unsigned char VAR_4[2]; unsigned int VAR_5; VAR_4[0] = bytestream2_get_byte(&VAR_0->stream_ptr); VAR_4[1] = bytestream2_get_byte(&VAR_0->stream_ptr); if (VAR_4[0] <= VAR_4[1]) { for (VAR_3 = 0; VAR_3 < 8; VAR_3++) { VAR_5 = bytestream2_get_byte(&VAR_0->stream_ptr) | 0x100; for (; VAR_5 != 1; VAR_5 >>= 1) *VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1]; VAR_0->pixel_ptr += VAR_0->line_inc; } else { VAR_5 = bytestream2_get_le16(&VAR_0->stream_ptr); for (VAR_3 = 0; VAR_3 < 8; VAR_3 += 2) { for (VAR_2 = 0; VAR_2 < 8; VAR_2 += 2, VAR_5 >>= 1) { VAR_0->pixel_ptr[VAR_2 ] = VAR_0->pixel_ptr[VAR_2 + 1 ] = VAR_0->pixel_ptr[VAR_2 + VAR_0->stride] = VAR_0->pixel_ptr[VAR_2 + 1 + VAR_0->stride] = VAR_4[VAR_5 & 1]; VAR_0->pixel_ptr += VAR_0->stride * 2; return 0;
[ "static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1)\n{", "int VAR_2, VAR_3;", "unsigned char VAR_4[2];", "unsigned int VAR_5;", "VAR_4[0] = bytestream2_get_byte(&VAR_0->stream_ptr);", "VAR_4[1] = bytestream2_get_byte(&VAR_0->stream_ptr);", "if (VAR_4[0] <= VAR_4[1]) {", "for (VAR_3 = 0; VAR_3 < 8; VAR_3++) {", "VAR_5 = bytestream2_get_byte(&VAR_0->stream_ptr) | 0x100;", "for (; VAR_5 != 1; VAR_5 >>= 1)", "*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 1];", "VAR_0->pixel_ptr += VAR_0->line_inc;", "} else {", "VAR_5 = bytestream2_get_le16(&VAR_0->stream_ptr);", "for (VAR_3 = 0; VAR_3 < 8; VAR_3 += 2) {", "for (VAR_2 = 0; VAR_2 < 8; VAR_2 += 2, VAR_5 >>= 1) {", "VAR_0->pixel_ptr[VAR_2 ] =\nVAR_0->pixel_ptr[VAR_2 + 1 ] =\nVAR_0->pixel_ptr[VAR_2 + VAR_0->stride] =\nVAR_0->pixel_ptr[VAR_2 + 1 + VAR_0->stride] = VAR_4[VAR_5 & 1];", "VAR_0->pixel_ptr += VAR_0->stride * 2;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 7 ], [ 8 ], [ 9 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22, 23, 24 ], [ 25 ], [ 27 ] ]
2,938
void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, GArray *dsm_dma_arrea, uint32_t ram_slots) { GSList *device_list; device_list = nvdimm_get_plugged_device_list(); /* NVDIMM device is plugged. */ if (device_list) { nvdimm_build_nfit(device_list, table_offsets, table_data, linker); g_slist_free(device_list); } /* * NVDIMM device is allowed to be plugged only if there is available * slot. */ if (ram_slots) { nvdimm_build_ssdt(table_offsets, table_data, linker, dsm_dma_arrea, ram_slots); } }
true
qemu
75b0713e189a981e5bfd087d5f35705446bbb12a
void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, GArray *dsm_dma_arrea, uint32_t ram_slots) { GSList *device_list; device_list = nvdimm_get_plugged_device_list(); if (device_list) { nvdimm_build_nfit(device_list, table_offsets, table_data, linker); g_slist_free(device_list); } if (ram_slots) { nvdimm_build_ssdt(table_offsets, table_data, linker, dsm_dma_arrea, ram_slots); } }
{ "code": [ " BIOSLinker *linker, GArray *dsm_dma_arrea,", " GSList *device_list;", " device_list = nvdimm_get_plugged_device_list();", " if (device_list) {", " nvdimm_build_nfit(device_list, table_offsets, table_data, linker);", " g_slist_free(device_list);", " nvdimm_build_ssdt(table_offsets, table_data, linker, dsm_dma_arrea,", " BIOSLinker *linker, GArray *dsm_dma_arrea," ], "line_no": [ 3, 9, 13, 19, 21, 23, 39, 3 ] }
void FUNC_0(GArray *VAR_0, GArray *VAR_1, BIOSLinker *VAR_2, GArray *VAR_3, uint32_t VAR_4) { GSList *device_list; device_list = nvdimm_get_plugged_device_list(); if (device_list) { nvdimm_build_nfit(device_list, VAR_0, VAR_1, VAR_2); g_slist_free(device_list); } if (VAR_4) { nvdimm_build_ssdt(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } }
[ "void FUNC_0(GArray *VAR_0, GArray *VAR_1,\nBIOSLinker *VAR_2, GArray *VAR_3,\nuint32_t VAR_4)\n{", "GSList *device_list;", "device_list = nvdimm_get_plugged_device_list();", "if (device_list) {", "nvdimm_build_nfit(device_list, VAR_0, VAR_1, VAR_2);", "g_slist_free(device_list);", "}", "if (VAR_4) {", "nvdimm_build_ssdt(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_4);", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ] ]
2,939
int msmpeg4_decode_picture_header(MpegEncContext * s) { int code; #if 0 { int i; for(i=0; i<s->gb.size_in_bits; i++) printf("%d", get_bits1(&s->gb)); // get_bits1(&s->gb); printf("END\n"); #endif if(s->msmpeg4_version==1){ int start_code, num; start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16); if(start_code!=0x00000100){ fprintf(stderr, "invalid startcode\n"); num= get_bits(&s->gb, 5); // frame number */ s->pict_type = get_bits(&s->gb, 2) + 1; if (s->pict_type != I_TYPE && s->pict_type != P_TYPE){ fprintf(stderr, "invalid picture type\n"); #if 0 { static int had_i=0; if(s->pict_type == I_TYPE) had_i=1; if(!had_i) return -1; #endif s->qscale = get_bits(&s->gb, 5); if (s->pict_type == I_TYPE) { code = get_bits(&s->gb, 5); if(s->msmpeg4_version==1){ if(code==0 || code>s->mb_height){ fprintf(stderr, "invalid slice height %d\n", code); s->slice_height = code; }else{ /* 0x17: one slice, 0x18: two slices, ... */ if (code < 0x17){ fprintf(stderr, "error, slice code was %X\n", code); s->slice_height = s->mb_height / (code - 0x16); switch(s->msmpeg4_version){ case 1: case 2: s->rl_chroma_table_index = 2; s->rl_table_index = 2; s->dc_table_index = 0; //not used break; case 3: s->rl_chroma_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb); s->dc_table_index = get_bits1(&s->gb); break; case 4: msmpeg4_decode_ext_header(s, (2+5+5+17+7)/8); if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb); else s->per_mb_rl_table= 0; if(!s->per_mb_rl_table){ s->rl_chroma_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb); s->dc_table_index = get_bits1(&s->gb); s->inter_intra_pred= 0; break; s->no_rounding = 1; /* printf("qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d \n", s->qscale, s->rl_chroma_table_index, s->rl_table_index, s->dc_table_index, s->per_mb_rl_table, s->slice_height);*/ } else { switch(s->msmpeg4_version){ case 1: case 2: if(s->msmpeg4_version==1) s->use_skip_mb_code = 1; else s->use_skip_mb_code = get_bits1(&s->gb); s->rl_table_index = 2; s->rl_chroma_table_index = s->rl_table_index; s->dc_table_index = 0; //not used s->mv_table_index = 0; break; case 3: s->use_skip_mb_code = get_bits1(&s->gb); s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; s->dc_table_index = get_bits1(&s->gb); s->mv_table_index = get_bits1(&s->gb); break; case 4: s->use_skip_mb_code = get_bits1(&s->gb); if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb); else s->per_mb_rl_table= 0; if(!s->per_mb_rl_table){ s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; s->dc_table_index = get_bits1(&s->gb); s->mv_table_index = get_bits1(&s->gb); s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE); break; /* printf("skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d \n", s->use_skip_mb_code, s->rl_table_index, s->rl_chroma_table_index, s->dc_table_index, s->mv_table_index, s->per_mb_rl_table, s->qscale);*/ if(s->flipflop_rounding){ s->no_rounding ^= 1; }else{ s->no_rounding = 0; //printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height); s->esc3_level_length= 0; s->esc3_run_length= 0; #ifdef DEBUG printf("*****frame %d:\n", frame_count++); #endif return 0;
true
FFmpeg
ae2d2d6c41c3b55ba06a021a3681a3173502423f
int msmpeg4_decode_picture_header(MpegEncContext * s) { int code; #if 0 { int i; for(i=0; i<s->gb.size_in_bits; i++) printf("%d", get_bits1(&s->gb)); printf("END\n"); #endif if(s->msmpeg4_version==1){ int start_code, num; start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16); if(start_code!=0x00000100){ fprintf(stderr, "invalid startcode\n"); num= get_bits(&s->gb, 5); s->pict_type = get_bits(&s->gb, 2) + 1; if (s->pict_type != I_TYPE && s->pict_type != P_TYPE){ fprintf(stderr, "invalid picture type\n"); #if 0 { static int had_i=0; if(s->pict_type == I_TYPE) had_i=1; if(!had_i) return -1; #endif s->qscale = get_bits(&s->gb, 5); if (s->pict_type == I_TYPE) { code = get_bits(&s->gb, 5); if(s->msmpeg4_version==1){ if(code==0 || code>s->mb_height){ fprintf(stderr, "invalid slice height %d\n", code); s->slice_height = code; }else{ if (code < 0x17){ fprintf(stderr, "error, slice code was %X\n", code); s->slice_height = s->mb_height / (code - 0x16); switch(s->msmpeg4_version){ case 1: case 2: s->rl_chroma_table_index = 2; s->rl_table_index = 2; s->dc_table_index = 0; break; case 3: s->rl_chroma_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb); s->dc_table_index = get_bits1(&s->gb); break; case 4: msmpeg4_decode_ext_header(s, (2+5+5+17+7)/8); if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb); else s->per_mb_rl_table= 0; if(!s->per_mb_rl_table){ s->rl_chroma_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb); s->dc_table_index = get_bits1(&s->gb); s->inter_intra_pred= 0; break; s->no_rounding = 1; } else { switch(s->msmpeg4_version){ case 1: case 2: if(s->msmpeg4_version==1) s->use_skip_mb_code = 1; else s->use_skip_mb_code = get_bits1(&s->gb); s->rl_table_index = 2; s->rl_chroma_table_index = s->rl_table_index; s->dc_table_index = 0; s->mv_table_index = 0; break; case 3: s->use_skip_mb_code = get_bits1(&s->gb); s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; s->dc_table_index = get_bits1(&s->gb); s->mv_table_index = get_bits1(&s->gb); break; case 4: s->use_skip_mb_code = get_bits1(&s->gb); if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb); else s->per_mb_rl_table= 0; if(!s->per_mb_rl_table){ s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; s->dc_table_index = get_bits1(&s->gb); s->mv_table_index = get_bits1(&s->gb); s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE); break; if(s->flipflop_rounding){ s->no_rounding ^= 1; }else{ s->no_rounding = 0; s->esc3_level_length= 0; s->esc3_run_length= 0; #ifdef DEBUG printf("*****frame %d:\n", frame_count++); #endif return 0;
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext * VAR_0) { int VAR_1; #if 0 { int i; for(i=0; i<VAR_0->gb.size_in_bits; i++) printf("%d", get_bits1(&VAR_0->gb)); printf("END\n"); #endif if(VAR_0->msmpeg4_version==1){ int VAR_2, VAR_3; VAR_2 = (get_bits(&VAR_0->gb, 16)<<16) | get_bits(&VAR_0->gb, 16); if(VAR_2!=0x00000100){ fprintf(stderr, "invalid startcode\n"); VAR_3= get_bits(&VAR_0->gb, 5); VAR_0->pict_type = get_bits(&VAR_0->gb, 2) + 1; if (VAR_0->pict_type != I_TYPE && VAR_0->pict_type != P_TYPE){ fprintf(stderr, "invalid picture type\n"); #if 0 { static int had_i=0; if(VAR_0->pict_type == I_TYPE) had_i=1; if(!had_i) return -1; #endif VAR_0->qscale = get_bits(&VAR_0->gb, 5); if (VAR_0->pict_type == I_TYPE) { VAR_1 = get_bits(&VAR_0->gb, 5); if(VAR_0->msmpeg4_version==1){ if(VAR_1==0 || VAR_1>VAR_0->mb_height){ fprintf(stderr, "invalid slice height %d\n", VAR_1); VAR_0->slice_height = VAR_1; }else{ if (VAR_1 < 0x17){ fprintf(stderr, "error, slice VAR_1 was %X\n", VAR_1); VAR_0->slice_height = VAR_0->mb_height / (VAR_1 - 0x16); switch(VAR_0->msmpeg4_version){ case 1: case 2: VAR_0->rl_chroma_table_index = 2; VAR_0->rl_table_index = 2; VAR_0->dc_table_index = 0; break; case 3: VAR_0->rl_chroma_table_index = decode012(&VAR_0->gb); VAR_0->rl_table_index = decode012(&VAR_0->gb); VAR_0->dc_table_index = get_bits1(&VAR_0->gb); break; case 4: msmpeg4_decode_ext_header(VAR_0, (2+5+5+17+7)/8); if(VAR_0->bit_rate > MBAC_BITRATE) VAR_0->per_mb_rl_table= get_bits1(&VAR_0->gb); else VAR_0->per_mb_rl_table= 0; if(!VAR_0->per_mb_rl_table){ VAR_0->rl_chroma_table_index = decode012(&VAR_0->gb); VAR_0->rl_table_index = decode012(&VAR_0->gb); VAR_0->dc_table_index = get_bits1(&VAR_0->gb); VAR_0->inter_intra_pred= 0; break; VAR_0->no_rounding = 1; } else { switch(VAR_0->msmpeg4_version){ case 1: case 2: if(VAR_0->msmpeg4_version==1) VAR_0->use_skip_mb_code = 1; else VAR_0->use_skip_mb_code = get_bits1(&VAR_0->gb); VAR_0->rl_table_index = 2; VAR_0->rl_chroma_table_index = VAR_0->rl_table_index; VAR_0->dc_table_index = 0; VAR_0->mv_table_index = 0; break; case 3: VAR_0->use_skip_mb_code = get_bits1(&VAR_0->gb); VAR_0->rl_table_index = decode012(&VAR_0->gb); VAR_0->rl_chroma_table_index = VAR_0->rl_table_index; VAR_0->dc_table_index = get_bits1(&VAR_0->gb); VAR_0->mv_table_index = get_bits1(&VAR_0->gb); break; case 4: VAR_0->use_skip_mb_code = get_bits1(&VAR_0->gb); if(VAR_0->bit_rate > MBAC_BITRATE) VAR_0->per_mb_rl_table= get_bits1(&VAR_0->gb); else VAR_0->per_mb_rl_table= 0; if(!VAR_0->per_mb_rl_table){ VAR_0->rl_table_index = decode012(&VAR_0->gb); VAR_0->rl_chroma_table_index = VAR_0->rl_table_index; VAR_0->dc_table_index = get_bits1(&VAR_0->gb); VAR_0->mv_table_index = get_bits1(&VAR_0->gb); VAR_0->inter_intra_pred= (VAR_0->width*VAR_0->height < 320*240 && VAR_0->bit_rate<=II_BITRATE); break; if(VAR_0->flipflop_rounding){ VAR_0->no_rounding ^= 1; }else{ VAR_0->no_rounding = 0; VAR_0->esc3_level_length= 0; VAR_0->esc3_run_length= 0; #ifdef DEBUG printf("*****frame %d:\n", frame_count++); #endif return 0;
[ "int FUNC_0(MpegEncContext * VAR_0)\n{", "int VAR_1;", "#if 0\n{", "int i;", "for(i=0; i<VAR_0->gb.size_in_bits; i++)", "printf(\"%d\", get_bits1(&VAR_0->gb));", "printf(\"END\\n\");", "#endif\nif(VAR_0->msmpeg4_version==1){", "int VAR_2, VAR_3;", "VAR_2 = (get_bits(&VAR_0->gb, 16)<<16) | get_bits(&VAR_0->gb, 16);", "if(VAR_2!=0x00000100){", "fprintf(stderr, \"invalid startcode\\n\");", "VAR_3= get_bits(&VAR_0->gb, 5);", "VAR_0->pict_type = get_bits(&VAR_0->gb, 2) + 1;", "if (VAR_0->pict_type != I_TYPE &&\nVAR_0->pict_type != P_TYPE){", "fprintf(stderr, \"invalid picture type\\n\");", "#if 0\n{", "static int had_i=0;", "if(VAR_0->pict_type == I_TYPE) had_i=1;", "if(!had_i) return -1;", "#endif\nVAR_0->qscale = get_bits(&VAR_0->gb, 5);", "if (VAR_0->pict_type == I_TYPE) {", "VAR_1 = get_bits(&VAR_0->gb, 5);", "if(VAR_0->msmpeg4_version==1){", "if(VAR_1==0 || VAR_1>VAR_0->mb_height){", "fprintf(stderr, \"invalid slice height %d\\n\", VAR_1);", "VAR_0->slice_height = VAR_1;", "}else{", "if (VAR_1 < 0x17){", "fprintf(stderr, \"error, slice VAR_1 was %X\\n\", VAR_1);", "VAR_0->slice_height = VAR_0->mb_height / (VAR_1 - 0x16);", "switch(VAR_0->msmpeg4_version){", "case 1:\ncase 2:\nVAR_0->rl_chroma_table_index = 2;", "VAR_0->rl_table_index = 2;", "VAR_0->dc_table_index = 0;", "break;", "case 3:\nVAR_0->rl_chroma_table_index = decode012(&VAR_0->gb);", "VAR_0->rl_table_index = decode012(&VAR_0->gb);", "VAR_0->dc_table_index = get_bits1(&VAR_0->gb);", "break;", "case 4:\nmsmpeg4_decode_ext_header(VAR_0, (2+5+5+17+7)/8);", "if(VAR_0->bit_rate > MBAC_BITRATE) VAR_0->per_mb_rl_table= get_bits1(&VAR_0->gb);", "else VAR_0->per_mb_rl_table= 0;", "if(!VAR_0->per_mb_rl_table){", "VAR_0->rl_chroma_table_index = decode012(&VAR_0->gb);", "VAR_0->rl_table_index = decode012(&VAR_0->gb);", "VAR_0->dc_table_index = get_bits1(&VAR_0->gb);", "VAR_0->inter_intra_pred= 0;", "break;", "VAR_0->no_rounding = 1;", "} else {", "switch(VAR_0->msmpeg4_version){", "case 1:\ncase 2:\nif(VAR_0->msmpeg4_version==1)\nVAR_0->use_skip_mb_code = 1;", "else\nVAR_0->use_skip_mb_code = get_bits1(&VAR_0->gb);", "VAR_0->rl_table_index = 2;", "VAR_0->rl_chroma_table_index = VAR_0->rl_table_index;", "VAR_0->dc_table_index = 0;", "VAR_0->mv_table_index = 0;", "break;", "case 3:\nVAR_0->use_skip_mb_code = get_bits1(&VAR_0->gb);", "VAR_0->rl_table_index = decode012(&VAR_0->gb);", "VAR_0->rl_chroma_table_index = VAR_0->rl_table_index;", "VAR_0->dc_table_index = get_bits1(&VAR_0->gb);", "VAR_0->mv_table_index = get_bits1(&VAR_0->gb);", "break;", "case 4:\nVAR_0->use_skip_mb_code = get_bits1(&VAR_0->gb);", "if(VAR_0->bit_rate > MBAC_BITRATE) VAR_0->per_mb_rl_table= get_bits1(&VAR_0->gb);", "else VAR_0->per_mb_rl_table= 0;", "if(!VAR_0->per_mb_rl_table){", "VAR_0->rl_table_index = decode012(&VAR_0->gb);", "VAR_0->rl_chroma_table_index = VAR_0->rl_table_index;", "VAR_0->dc_table_index = get_bits1(&VAR_0->gb);", "VAR_0->mv_table_index = get_bits1(&VAR_0->gb);", "VAR_0->inter_intra_pred= (VAR_0->width*VAR_0->height < 320*240 && VAR_0->bit_rate<=II_BITRATE);", "break;", "if(VAR_0->flipflop_rounding){", "VAR_0->no_rounding ^= 1;", "}else{", "VAR_0->no_rounding = 0;", "VAR_0->esc3_level_length= 0;", "VAR_0->esc3_run_length= 0;", "#ifdef DEBUG\nprintf(\"*****frame %d:\\n\", frame_count++);", "#endif\nreturn 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 48 ], [ 50, 52 ], [ 54 ], [ 58, 60 ], [ 62 ], [ 64 ], [ 66 ], [ 69, 71 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 107 ], [ 112 ], [ 114, 116, 118 ], [ 120 ], [ 124 ], [ 126 ], [ 128, 130 ], [ 132 ], [ 136 ], [ 138 ], [ 140, 142 ], [ 146 ], [ 148 ], [ 152 ], [ 154 ], [ 156 ], [ 161 ], [ 163 ], [ 165 ], [ 168 ], [ 184 ], [ 186 ], [ 188, 190, 192, 194 ], [ 196, 198 ], [ 200 ], [ 202 ], [ 204 ], [ 206 ], [ 208 ], [ 210, 212 ], [ 214 ], [ 216 ], [ 220 ], [ 224 ], [ 226 ], [ 228, 230 ], [ 234 ], [ 236 ], [ 240 ], [ 242 ], [ 244 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 276 ], [ 278 ], [ 280 ], [ 282 ], [ 290 ], [ 292 ], [ 296, 298 ], [ 300, 302 ] ]
2,940
int64_t qcow2_alloc_clusters(BlockDriverState *bs, int64_t size) { int64_t offset; int ret; BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC); offset = alloc_clusters_noref(bs, size); if (offset < 0) { return offset; } ret = update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER); if (ret < 0) { return ret; } return offset; }
true
qemu
b106ad9185f35fc4ad669555ad0e79e276083bd7
int64_t qcow2_alloc_clusters(BlockDriverState *bs, int64_t size) { int64_t offset; int ret; BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC); offset = alloc_clusters_noref(bs, size); if (offset < 0) { return offset; } ret = update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER); if (ret < 0) { return ret; } return offset; }
{ "code": [ " offset = alloc_clusters_noref(bs, size);", " if (offset < 0) {", " return offset;", " ret = update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER);" ], "line_no": [ 13, 15, 17, 23 ] }
int64_t FUNC_0(BlockDriverState *bs, int64_t size) { int64_t offset; int VAR_0; BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC); offset = alloc_clusters_noref(bs, size); if (offset < 0) { return offset; } VAR_0 = update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER); if (VAR_0 < 0) { return VAR_0; } return offset; }
[ "int64_t FUNC_0(BlockDriverState *bs, int64_t size)\n{", "int64_t offset;", "int VAR_0;", "BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC);", "offset = alloc_clusters_noref(bs, size);", "if (offset < 0) {", "return offset;", "}", "VAR_0 = update_refcount(bs, offset, size, 1, QCOW2_DISCARD_NEVER);", "if (VAR_0 < 0) {", "return VAR_0;", "}", "return offset;", "}" ]
[ 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
2,941
void vm_stop(int reason) { do_vm_stop(reason); }
true
qemu
12d4536f7d911b6d87a766ad7300482ea663cea2
void vm_stop(int reason) { do_vm_stop(reason); }
{ "code": [ "void vm_stop(int reason)", " do_vm_stop(reason);" ], "line_no": [ 1, 5 ] }
void FUNC_0(int VAR_0) { do_vm_stop(VAR_0); }
[ "void FUNC_0(int VAR_0)\n{", "do_vm_stop(VAR_0);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,942
int virtio_bus_device_plugged(VirtIODevice *vdev) { DeviceState *qdev = DEVICE(vdev); BusState *qbus = BUS(qdev_get_parent_bus(qdev)); VirtioBusState *bus = VIRTIO_BUS(qbus); VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus); VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); DPRINTF("%s: plug device.\n", qbus->name); if (klass->device_plugged != NULL) { klass->device_plugged(qbus->parent); } /* Get the features of the plugged device. */ assert(vdc->get_features != NULL); vdev->host_features = vdc->get_features(vdev, vdev->host_features); return 0; }
true
qemu
e83980455c8c7eb066405de512be7c4bace3ac4d
int virtio_bus_device_plugged(VirtIODevice *vdev) { DeviceState *qdev = DEVICE(vdev); BusState *qbus = BUS(qdev_get_parent_bus(qdev)); VirtioBusState *bus = VIRTIO_BUS(qbus); VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus); VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); DPRINTF("%s: plug device.\n", qbus->name); if (klass->device_plugged != NULL) { klass->device_plugged(qbus->parent); } assert(vdc->get_features != NULL); vdev->host_features = vdc->get_features(vdev, vdev->host_features); return 0; }
{ "code": [ "int virtio_bus_device_plugged(VirtIODevice *vdev)", " klass->device_plugged(qbus->parent);", " return 0;" ], "line_no": [ 1, 23, 35 ] }
int FUNC_0(VirtIODevice *VAR_0) { DeviceState *qdev = DEVICE(VAR_0); BusState *qbus = BUS(qdev_get_parent_bus(qdev)); VirtioBusState *bus = VIRTIO_BUS(qbus); VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus); VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(VAR_0); DPRINTF("%s: plug device.\n", qbus->name); if (klass->device_plugged != NULL) { klass->device_plugged(qbus->parent); } assert(vdc->get_features != NULL); VAR_0->host_features = vdc->get_features(VAR_0, VAR_0->host_features); return 0; }
[ "int FUNC_0(VirtIODevice *VAR_0)\n{", "DeviceState *qdev = DEVICE(VAR_0);", "BusState *qbus = BUS(qdev_get_parent_bus(qdev));", "VirtioBusState *bus = VIRTIO_BUS(qbus);", "VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus);", "VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(VAR_0);", "DPRINTF(\"%s: plug device.\\n\", qbus->name);", "if (klass->device_plugged != NULL) {", "klass->device_plugged(qbus->parent);", "}", "assert(vdc->get_features != NULL);", "VAR_0->host_features = vdc->get_features(VAR_0, VAR_0->host_features);", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
2,944
static int config_input_props(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; Frei0rContext *s = ctx->priv; if (!(s->instance = s->construct(inlink->w, inlink->h))) { av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance"); return AVERROR(EINVAL); } return set_params(ctx, s->params); }
true
FFmpeg
d371c3c2e2830d9783465ecfe1ab7d93351083b7
static int config_input_props(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; Frei0rContext *s = ctx->priv; if (!(s->instance = s->construct(inlink->w, inlink->h))) { av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance"); return AVERROR(EINVAL); } return set_params(ctx, s->params); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterLink *VAR_0) { AVFilterContext *ctx = VAR_0->dst; Frei0rContext *s = ctx->priv; if (!(s->instance = s->construct(VAR_0->w, VAR_0->h))) { av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance"); return AVERROR(EINVAL); } return set_params(ctx, s->params); }
[ "static int FUNC_0(AVFilterLink *VAR_0)\n{", "AVFilterContext *ctx = VAR_0->dst;", "Frei0rContext *s = ctx->priv;", "if (!(s->instance = s->construct(VAR_0->w, VAR_0->h))) {", "av_log(ctx, AV_LOG_ERROR, \"Impossible to load frei0r instance\");", "return AVERROR(EINVAL);", "}", "return set_params(ctx, s->params);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
2,945
int qdev_prop_check_globals(void) { GlobalProperty *prop; int ret = 0; QTAILQ_FOREACH(prop, &global_props, next) { ObjectClass *oc; DeviceClass *dc; if (prop->used) { continue; } if (!prop->user_provided) { continue; } oc = object_class_by_name(prop->driver); oc = object_class_dynamic_cast(oc, TYPE_DEVICE); if (!oc) { error_report("Warning: global %s.%s has invalid class name", prop->driver, prop->property); ret = 1; continue; } dc = DEVICE_CLASS(oc); if (!dc->hotpluggable && !prop->used) { error_report("Warning: global %s.%s=%s not used", prop->driver, prop->property, prop->value); ret = 1; continue; } } return ret; }
true
qemu
f9a8b5530d438f836f9697639814f585aaec554d
int qdev_prop_check_globals(void) { GlobalProperty *prop; int ret = 0; QTAILQ_FOREACH(prop, &global_props, next) { ObjectClass *oc; DeviceClass *dc; if (prop->used) { continue; } if (!prop->user_provided) { continue; } oc = object_class_by_name(prop->driver); oc = object_class_dynamic_cast(oc, TYPE_DEVICE); if (!oc) { error_report("Warning: global %s.%s has invalid class name", prop->driver, prop->property); ret = 1; continue; } dc = DEVICE_CLASS(oc); if (!dc->hotpluggable && !prop->used) { error_report("Warning: global %s.%s=%s not used", prop->driver, prop->property, prop->value); ret = 1; continue; } } return ret; }
{ "code": [ " GlobalProperty *prop;", " QTAILQ_FOREACH(prop, &global_props, next) {", " GlobalProperty *prop;", " QTAILQ_FOREACH(prop, &global_props, next) {" ], "line_no": [ 5, 11, 5, 11 ] }
int FUNC_0(void) { GlobalProperty *prop; int VAR_0 = 0; QTAILQ_FOREACH(prop, &global_props, next) { ObjectClass *oc; DeviceClass *dc; if (prop->used) { continue; } if (!prop->user_provided) { continue; } oc = object_class_by_name(prop->driver); oc = object_class_dynamic_cast(oc, TYPE_DEVICE); if (!oc) { error_report("Warning: global %s.%s has invalid class name", prop->driver, prop->property); VAR_0 = 1; continue; } dc = DEVICE_CLASS(oc); if (!dc->hotpluggable && !prop->used) { error_report("Warning: global %s.%s=%s not used", prop->driver, prop->property, prop->value); VAR_0 = 1; continue; } } return VAR_0; }
[ "int FUNC_0(void)\n{", "GlobalProperty *prop;", "int VAR_0 = 0;", "QTAILQ_FOREACH(prop, &global_props, next) {", "ObjectClass *oc;", "DeviceClass *dc;", "if (prop->used) {", "continue;", "}", "if (!prop->user_provided) {", "continue;", "}", "oc = object_class_by_name(prop->driver);", "oc = object_class_dynamic_cast(oc, TYPE_DEVICE);", "if (!oc) {", "error_report(\"Warning: global %s.%s has invalid class name\",\nprop->driver, prop->property);", "VAR_0 = 1;", "continue;", "}", "dc = DEVICE_CLASS(oc);", "if (!dc->hotpluggable && !prop->used) {", "error_report(\"Warning: global %s.%s=%s not used\",\nprop->driver, prop->property, prop->value);", "VAR_0 = 1;", "continue;", "}", "}", "return VAR_0;", "}" ]
[ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
2,947
static inline void RENAME(rgb32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1==src2); for(i=0; i<width; i++) { const int a= ((uint32_t*)src1)[2*i+0]; const int e= ((uint32_t*)src1)[2*i+1]; const int l= (a&0xFF00FF) + (e&0xFF00FF); const int h= (a&0x00FF00) + (e&0x00FF00); const int r= l&0x3FF; const int g= h>>8; const int b= l>>16; dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128; dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128; } }
true
FFmpeg
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
static inline void RENAME(rgb32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1==src2); for(i=0; i<width; i++) { const int a= ((uint32_t*)src1)[2*i+0]; const int e= ((uint32_t*)src1)[2*i+1]; const int l= (a&0xFF00FF) + (e&0xFF00FF); const int h= (a&0x00FF00) + (e&0x00FF00); const int r= l&0x3FF; const int g= h>>8; const int b= l>>16; dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128; dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128; } }
{ "code": [ "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tconst int a= ((uint32_t*)src1)[2*i+0];", "\t\tconst int e= ((uint32_t*)src1)[2*i+1];", "\t\tconst int l= (a&0xFF00FF) + (e&0xFF00FF);", "\t\tconst int h= (a&0x00FF00) + (e&0x00FF00);", "\t\tconst int g= h>>8;", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\t\tconst int a= ((uint32_t*)src1)[2*i+0];", "\t\tconst int e= ((uint32_t*)src1)[2*i+1];", "\t\tconst int l= (a&0xFF00FF) + (e&0xFF00FF);", "\t\tconst int h= (a&0x00FF00) + (e&0x00FF00);", " \t\tconst int r= l&0x3FF;", "\t\tconst int g= h>>8;", "\t\tconst int b= l>>16;", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1==src2);", "\tfor(i=0; i<width; i++)", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;" ], "line_no": [ 5, 5, 5, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 13, 15, 17, 19, 23, 29, 31, 5, 9, 5, 9, 29, 31, 5, 9, 5, 7, 9, 5, 9, 5, 7, 9, 5, 9, 5, 7, 9, 13, 15, 17, 19, 21, 23, 25, 29, 31, 5, 9, 5, 7, 9, 29, 31, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 5, 5, 5, 5 ] }
static inline void FUNC_0(rgb32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int VAR_0; assert(src1==src2); for(VAR_0=0; VAR_0<width; VAR_0++) { const int a= ((uint32_t*)src1)[2*VAR_0+0]; const int e= ((uint32_t*)src1)[2*VAR_0+1]; const int l= (a&0xFF00FF) + (e&0xFF00FF); const int h= (a&0x00FF00) + (e&0x00FF00); const int r= l&0x3FF; const int g= h>>8; const int b= l>>16; dstU[VAR_0]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128; dstV[VAR_0]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128; } }
[ "static inline void FUNC_0(rgb32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)\n{", "int VAR_0;", "assert(src1==src2);", "for(VAR_0=0; VAR_0<width; VAR_0++)", "{", "const int a= ((uint32_t*)src1)[2*VAR_0+0];", "const int e= ((uint32_t*)src1)[2*VAR_0+1];", "const int l= (a&0xFF00FF) + (e&0xFF00FF);", "const int h= (a&0x00FF00) + (e&0x00FF00);", "const int r= l&0x3FF;", "const int g= h>>8;", "const int b= l>>16;", "dstU[VAR_0]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "dstV[VAR_0]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "}", "}" ]
[ 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
2,949
static av_cold void init_vlcs(FourXContext *f) { static VLC_TYPE table[8][32][2]; int i; for (i = 0; i < 8; i++) { block_type_vlc[0][i].table = table[i]; block_type_vlc[0][i].table_allocated = 32; init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7, &block_type_tab[0][i][0][1], 2, 1, &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC); } }
true
FFmpeg
acb2c79c2102026747468dcafa6780ab1094b3c5
static av_cold void init_vlcs(FourXContext *f) { static VLC_TYPE table[8][32][2]; int i; for (i = 0; i < 8; i++) { block_type_vlc[0][i].table = table[i]; block_type_vlc[0][i].table_allocated = 32; init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7, &block_type_tab[0][i][0][1], 2, 1, &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC); } }
{ "code": [ " static VLC_TYPE table[8][32][2];", " int i;", " for (i = 0; i < 8; i++) {", " block_type_vlc[0][i].table = table[i];", " block_type_vlc[0][i].table_allocated = 32;", " init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7,", " &block_type_tab[0][i][0][1], 2, 1,", " &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);" ], "line_no": [ 5, 7, 11, 13, 15, 17, 19, 21 ] }
static av_cold void FUNC_0(FourXContext *f) { static VLC_TYPE VAR_0[8][32][2]; int VAR_1; for (VAR_1 = 0; VAR_1 < 8; VAR_1++) { block_type_vlc[0][VAR_1].VAR_0 = VAR_0[VAR_1]; block_type_vlc[0][VAR_1].table_allocated = 32; init_vlc(&block_type_vlc[0][VAR_1], BLOCK_TYPE_VLC_BITS, 7, &block_type_tab[0][VAR_1][0][1], 2, 1, &block_type_tab[0][VAR_1][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC); } }
[ "static av_cold void FUNC_0(FourXContext *f)\n{", "static VLC_TYPE VAR_0[8][32][2];", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 8; VAR_1++) {", "block_type_vlc[0][VAR_1].VAR_0 = VAR_0[VAR_1];", "block_type_vlc[0][VAR_1].table_allocated = 32;", "init_vlc(&block_type_vlc[0][VAR_1], BLOCK_TYPE_VLC_BITS, 7,\n&block_type_tab[0][VAR_1][0][1], 2, 1,\n&block_type_tab[0][VAR_1][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);", "}", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25 ] ]
2,951
static BlockAIOCB *blkverify_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov, nb_sectors, cb, opaque); bdrv_aio_writev(s->test_file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); return &acb->common; }
true
qemu
44b6789299a8acca3f25331bc411055cafc7bb06
static BlockAIOCB *blkverify_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov, nb_sectors, cb, opaque); bdrv_aio_writev(s->test_file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); return &acb->common; }
{ "code": [ " int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,", " BlockCompletionFunc *cb, void *opaque)", " BDRVBlkverifyState *s = bs->opaque;", " nb_sectors, cb, opaque);", " return &acb->common;", "static BlockAIOCB *blkverify_aio_writev(BlockDriverState *bs,", " int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,", " BlockCompletionFunc *cb, void *opaque)", " BDRVBlkverifyState *s = bs->opaque;", " BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov,", " nb_sectors, cb, opaque);", " bdrv_aio_writev(s->test_file, sector_num, qiov, nb_sectors,", " blkverify_aio_cb, acb);", " bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors,", " blkverify_aio_cb, acb);", " return &acb->common;" ], "line_no": [ 3, 5, 9, 13, 25, 1, 3, 5, 9, 11, 13, 17, 19, 21, 19, 25 ] }
static BlockAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { BDRVBlkverifyState *s = bs->opaque; BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov, nb_sectors, cb, opaque); bdrv_aio_writev(s->test_file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, blkverify_aio_cb, acb); return &acb->common; }
[ "static BlockAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num, QEMUIOVector *qiov, int nb_sectors,\nBlockCompletionFunc *cb, void *opaque)\n{", "BDRVBlkverifyState *s = bs->opaque;", "BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov,\nnb_sectors, cb, opaque);", "bdrv_aio_writev(s->test_file, sector_num, qiov, nb_sectors,\nblkverify_aio_cb, acb);", "bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors,\nblkverify_aio_cb, acb);", "return &acb->common;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11, 13 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27 ] ]
2,952
static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; int64_t sector_num; unsigned int nb_sectors; if (drv->bdrv_co_preadv) { return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags); } sector_num = offset >> BDRV_SECTOR_BITS; nb_sectors = bytes >> BDRV_SECTOR_BITS; assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS); if (drv->bdrv_co_readv) { return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); } else { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors, bdrv_co_io_em_complete, &co); if (acb == NULL) { return -EIO; } else { qemu_coroutine_yield(); return co.ret; } } }
true
qemu
fa166538743d4e28de7374c41332c3e448826f4b
static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; int64_t sector_num; unsigned int nb_sectors; if (drv->bdrv_co_preadv) { return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags); } sector_num = offset >> BDRV_SECTOR_BITS; nb_sectors = bytes >> BDRV_SECTOR_BITS; assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS); if (drv->bdrv_co_readv) { return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); } else { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors, bdrv_co_io_em_complete, &co); if (acb == NULL) { return -EIO; } else { qemu_coroutine_yield(); return co.ret; } } }
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_driver_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; int64_t sector_num; unsigned int nb_sectors; if (drv->bdrv_co_preadv) { return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags); } sector_num = offset >> BDRV_SECTOR_BITS; nb_sectors = bytes >> BDRV_SECTOR_BITS; assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS); if (drv->bdrv_co_readv) { return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); } else { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors, bdrv_co_io_em_complete, &co); if (acb == NULL) { return -EIO; } else { qemu_coroutine_yield(); return co.ret; } } }
[ "static int VAR_0 bdrv_driver_preadv(BlockDriverState *bs,\nuint64_t offset, uint64_t bytes,\nQEMUIOVector *qiov, int flags)\n{", "BlockDriver *drv = bs->drv;", "int64_t sector_num;", "unsigned int nb_sectors;", "if (drv->bdrv_co_preadv) {", "return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags);", "}", "sector_num = offset >> BDRV_SECTOR_BITS;", "nb_sectors = bytes >> BDRV_SECTOR_BITS;", "assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);", "assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);", "assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);", "if (drv->bdrv_co_readv) {", "return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov);", "} else {", "BlockAIOCB *acb;", "CoroutineIOCompletion co = {", ".coroutine = qemu_coroutine_self(),\n};", "acb = bs->drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors,\nbdrv_co_io_em_complete, &co);", "if (acb == NULL) {", "return -EIO;", "} else {", "qemu_coroutine_yield();", "return co.ret;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22 ], [ 23, 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ] ]
2,953
static void bdrv_close(BlockDriverState *bs) { BdrvAioNotifier *ban, *ban_next; assert(!bs->job); assert(!bs->refcnt); bdrv_drained_begin(bs); /* complete I/O */ bdrv_flush(bs); bdrv_drain(bs); /* in case flush left pending I/O */ if (bs->drv) { BdrvChild *child, *next; bs->drv->bdrv_close(bs); bs->drv = NULL; bdrv_set_backing_hd(bs, NULL, &error_abort); if (bs->file != NULL) { bdrv_unref_child(bs, bs->file); bs->file = NULL; } QLIST_FOREACH_SAFE(child, &bs->children, next, next) { /* TODO Remove bdrv_unref() from drivers' close function and use * bdrv_unref_child() here */ if (child->bs->inherits_from == bs) { child->bs->inherits_from = NULL; } bdrv_detach_child(child); } g_free(bs->opaque); bs->opaque = NULL; atomic_set(&bs->copy_on_read, 0); bs->backing_file[0] = '\0'; bs->backing_format[0] = '\0'; bs->total_sectors = 0; bs->encrypted = false; bs->sg = false; QDECREF(bs->options); QDECREF(bs->explicit_options); bs->options = NULL; bs->explicit_options = NULL; QDECREF(bs->full_open_options); bs->full_open_options = NULL; } bdrv_release_named_dirty_bitmaps(bs); assert(QLIST_EMPTY(&bs->dirty_bitmaps)); QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) { g_free(ban); } QLIST_INIT(&bs->aio_notifiers); bdrv_drained_end(bs); }
true
qemu
50a3efb0f05bcfbe04201d4ebac0b96551a1b551
static void bdrv_close(BlockDriverState *bs) { BdrvAioNotifier *ban, *ban_next; assert(!bs->job); assert(!bs->refcnt); bdrv_drained_begin(bs); bdrv_flush(bs); bdrv_drain(bs); if (bs->drv) { BdrvChild *child, *next; bs->drv->bdrv_close(bs); bs->drv = NULL; bdrv_set_backing_hd(bs, NULL, &error_abort); if (bs->file != NULL) { bdrv_unref_child(bs, bs->file); bs->file = NULL; } QLIST_FOREACH_SAFE(child, &bs->children, next, next) { if (child->bs->inherits_from == bs) { child->bs->inherits_from = NULL; } bdrv_detach_child(child); } g_free(bs->opaque); bs->opaque = NULL; atomic_set(&bs->copy_on_read, 0); bs->backing_file[0] = '\0'; bs->backing_format[0] = '\0'; bs->total_sectors = 0; bs->encrypted = false; bs->sg = false; QDECREF(bs->options); QDECREF(bs->explicit_options); bs->options = NULL; bs->explicit_options = NULL; QDECREF(bs->full_open_options); bs->full_open_options = NULL; } bdrv_release_named_dirty_bitmaps(bs); assert(QLIST_EMPTY(&bs->dirty_bitmaps)); QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) { g_free(ban); } QLIST_INIT(&bs->aio_notifiers); bdrv_drained_end(bs); }
{ "code": [ " BdrvChild *child, *next;", " bdrv_set_backing_hd(bs, NULL, &error_abort);", " if (bs->file != NULL) {", " bdrv_unref_child(bs, bs->file);", " bs->file = NULL;", " QLIST_FOREACH_SAFE(child, &bs->children, next, next) {", " if (child->bs->inherits_from == bs) {", " child->bs->inherits_from = NULL;", " bdrv_detach_child(child);", " g_free(bs->opaque);", " bs->opaque = NULL;", " atomic_set(&bs->copy_on_read, 0);", " bs->backing_file[0] = '\\0';", " bs->backing_format[0] = '\\0';", " bs->total_sectors = 0;", " bs->encrypted = false;", " bs->sg = false;", " QDECREF(bs->options);", " QDECREF(bs->explicit_options);", " bs->options = NULL;", " bs->explicit_options = NULL;", " QDECREF(bs->full_open_options);", " bs->full_open_options = NULL;" ], "line_no": [ 25, 35, 39, 41, 43, 49, 55, 57, 61, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93 ] }
static void FUNC_0(BlockDriverState *VAR_0) { BdrvAioNotifier *ban, *ban_next; assert(!VAR_0->job); assert(!VAR_0->refcnt); bdrv_drained_begin(VAR_0); bdrv_flush(VAR_0); bdrv_drain(VAR_0); if (VAR_0->drv) { BdrvChild *child, *next; VAR_0->drv->FUNC_0(VAR_0); VAR_0->drv = NULL; bdrv_set_backing_hd(VAR_0, NULL, &error_abort); if (VAR_0->file != NULL) { bdrv_unref_child(VAR_0, VAR_0->file); VAR_0->file = NULL; } QLIST_FOREACH_SAFE(child, &VAR_0->children, next, next) { if (child->VAR_0->inherits_from == VAR_0) { child->VAR_0->inherits_from = NULL; } bdrv_detach_child(child); } g_free(VAR_0->opaque); VAR_0->opaque = NULL; atomic_set(&VAR_0->copy_on_read, 0); VAR_0->backing_file[0] = '\0'; VAR_0->backing_format[0] = '\0'; VAR_0->total_sectors = 0; VAR_0->encrypted = false; VAR_0->sg = false; QDECREF(VAR_0->options); QDECREF(VAR_0->explicit_options); VAR_0->options = NULL; VAR_0->explicit_options = NULL; QDECREF(VAR_0->full_open_options); VAR_0->full_open_options = NULL; } bdrv_release_named_dirty_bitmaps(VAR_0); assert(QLIST_EMPTY(&VAR_0->dirty_bitmaps)); QLIST_FOREACH_SAFE(ban, &VAR_0->aio_notifiers, list, ban_next) { g_free(ban); } QLIST_INIT(&VAR_0->aio_notifiers); bdrv_drained_end(VAR_0); }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "BdrvAioNotifier *ban, *ban_next;", "assert(!VAR_0->job);", "assert(!VAR_0->refcnt);", "bdrv_drained_begin(VAR_0);", "bdrv_flush(VAR_0);", "bdrv_drain(VAR_0);", "if (VAR_0->drv) {", "BdrvChild *child, *next;", "VAR_0->drv->FUNC_0(VAR_0);", "VAR_0->drv = NULL;", "bdrv_set_backing_hd(VAR_0, NULL, &error_abort);", "if (VAR_0->file != NULL) {", "bdrv_unref_child(VAR_0, VAR_0->file);", "VAR_0->file = NULL;", "}", "QLIST_FOREACH_SAFE(child, &VAR_0->children, next, next) {", "if (child->VAR_0->inherits_from == VAR_0) {", "child->VAR_0->inherits_from = NULL;", "}", "bdrv_detach_child(child);", "}", "g_free(VAR_0->opaque);", "VAR_0->opaque = NULL;", "atomic_set(&VAR_0->copy_on_read, 0);", "VAR_0->backing_file[0] = '\\0';", "VAR_0->backing_format[0] = '\\0';", "VAR_0->total_sectors = 0;", "VAR_0->encrypted = false;", "VAR_0->sg = false;", "QDECREF(VAR_0->options);", "QDECREF(VAR_0->explicit_options);", "VAR_0->options = NULL;", "VAR_0->explicit_options = NULL;", "QDECREF(VAR_0->full_open_options);", "VAR_0->full_open_options = NULL;", "}", "bdrv_release_named_dirty_bitmaps(VAR_0);", "assert(QLIST_EMPTY(&VAR_0->dirty_bitmaps));", "QLIST_FOREACH_SAFE(ban, &VAR_0->aio_notifiers, list, ban_next) {", "g_free(ban);", "}", "QLIST_INIT(&VAR_0->aio_notifiers);", "bdrv_drained_end(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ] ]
2,954
static void kvm_add_routing_entry(KVMState *s, struct kvm_irq_routing_entry *entry) { struct kvm_irq_routing_entry *new; int n, size; if (s->irq_routes->nr == s->nr_allocated_irq_routes) { n = s->nr_allocated_irq_routes * 2; if (n < 64) { n = 64; } size = sizeof(struct kvm_irq_routing); size += n * sizeof(*new); s->irq_routes = g_realloc(s->irq_routes, size); s->nr_allocated_irq_routes = n; } n = s->irq_routes->nr++; new = &s->irq_routes->entries[n]; memset(new, 0, sizeof(*new)); new->gsi = entry->gsi; new->type = entry->type; new->flags = entry->flags; new->u = entry->u; set_gsi(s, entry->gsi); }
true
qemu
0fbc20740342713f282b118b4a446c4c43df3f4a
static void kvm_add_routing_entry(KVMState *s, struct kvm_irq_routing_entry *entry) { struct kvm_irq_routing_entry *new; int n, size; if (s->irq_routes->nr == s->nr_allocated_irq_routes) { n = s->nr_allocated_irq_routes * 2; if (n < 64) { n = 64; } size = sizeof(struct kvm_irq_routing); size += n * sizeof(*new); s->irq_routes = g_realloc(s->irq_routes, size); s->nr_allocated_irq_routes = n; } n = s->irq_routes->nr++; new = &s->irq_routes->entries[n]; memset(new, 0, sizeof(*new)); new->gsi = entry->gsi; new->type = entry->type; new->flags = entry->flags; new->u = entry->u; set_gsi(s, entry->gsi); }
{ "code": [ " memset(new, 0, sizeof(*new));", " new->gsi = entry->gsi;", " new->type = entry->type;", " new->flags = entry->flags;", " new->u = entry->u;" ], "line_no": [ 37, 39, 41, 43, 45 ] }
static void FUNC_0(KVMState *VAR_0, struct kvm_irq_routing_entry *VAR_1) { struct kvm_irq_routing_entry *VAR_2; int VAR_3, VAR_4; if (VAR_0->irq_routes->nr == VAR_0->nr_allocated_irq_routes) { VAR_3 = VAR_0->nr_allocated_irq_routes * 2; if (VAR_3 < 64) { VAR_3 = 64; } VAR_4 = sizeof(struct kvm_irq_routing); VAR_4 += VAR_3 * sizeof(*VAR_2); VAR_0->irq_routes = g_realloc(VAR_0->irq_routes, VAR_4); VAR_0->nr_allocated_irq_routes = VAR_3; } VAR_3 = VAR_0->irq_routes->nr++; VAR_2 = &VAR_0->irq_routes->entries[VAR_3]; memset(VAR_2, 0, sizeof(*VAR_2)); VAR_2->gsi = VAR_1->gsi; VAR_2->type = VAR_1->type; VAR_2->flags = VAR_1->flags; VAR_2->u = VAR_1->u; set_gsi(VAR_0, VAR_1->gsi); }
[ "static void FUNC_0(KVMState *VAR_0,\nstruct kvm_irq_routing_entry *VAR_1)\n{", "struct kvm_irq_routing_entry *VAR_2;", "int VAR_3, VAR_4;", "if (VAR_0->irq_routes->nr == VAR_0->nr_allocated_irq_routes) {", "VAR_3 = VAR_0->nr_allocated_irq_routes * 2;", "if (VAR_3 < 64) {", "VAR_3 = 64;", "}", "VAR_4 = sizeof(struct kvm_irq_routing);", "VAR_4 += VAR_3 * sizeof(*VAR_2);", "VAR_0->irq_routes = g_realloc(VAR_0->irq_routes, VAR_4);", "VAR_0->nr_allocated_irq_routes = VAR_3;", "}", "VAR_3 = VAR_0->irq_routes->nr++;", "VAR_2 = &VAR_0->irq_routes->entries[VAR_3];", "memset(VAR_2, 0, sizeof(*VAR_2));", "VAR_2->gsi = VAR_1->gsi;", "VAR_2->type = VAR_1->type;", "VAR_2->flags = VAR_1->flags;", "VAR_2->u = VAR_1->u;", "set_gsi(VAR_0, VAR_1->gsi);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
2,955
PCA *ff_pca_init(int n){ PCA *pca; if(n<=0) pca= av_mallocz(sizeof(*pca)); pca->n= n; pca->z = av_malloc_array(n, sizeof(*pca->z)); pca->count=0; pca->covariance= av_calloc(n*n, sizeof(double)); pca->mean= av_calloc(n, sizeof(double)); return pca;
true
FFmpeg
dadc43eee4d9036aa532665a04720238cc15e922
PCA *ff_pca_init(int n){ PCA *pca; if(n<=0) pca= av_mallocz(sizeof(*pca)); pca->n= n; pca->z = av_malloc_array(n, sizeof(*pca->z)); pca->count=0; pca->covariance= av_calloc(n*n, sizeof(double)); pca->mean= av_calloc(n, sizeof(double)); return pca;
{ "code": [], "line_no": [] }
PCA *FUNC_0(int n){ PCA *pca; if(n<=0) pca= av_mallocz(sizeof(*pca)); pca->n= n; pca->z = av_malloc_array(n, sizeof(*pca->z)); pca->count=0; pca->covariance= av_calloc(n*n, sizeof(double)); pca->mean= av_calloc(n, sizeof(double)); return pca;
[ "PCA *FUNC_0(int n){", "PCA *pca;", "if(n<=0)\npca= av_mallocz(sizeof(*pca));", "pca->n= n;", "pca->z = av_malloc_array(n, sizeof(*pca->z));", "pca->count=0;", "pca->covariance= av_calloc(n*n, sizeof(double));", "pca->mean= av_calloc(n, sizeof(double));", "return pca;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 2 ], [ 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ] ]
2,956
static int nuv_header(AVFormatContext *s) { NUVContext *ctx = s->priv_data; AVIOContext *pb = s->pb; char id_string[12]; double aspect, fps; int is_mythtv, width, height, v_packs, a_packs, ret; AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); avio_skip(pb, 5); // version string avio_skip(pb, 3); // padding width = avio_rl32(pb); height = avio_rl32(pb); avio_rl32(pb); // unused, "desiredwidth" avio_rl32(pb); // unused, "desiredheight" avio_r8(pb); // 'P' == progressive, 'I' == interlaced avio_skip(pb, 3); // padding aspect = av_int2double(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; fps = av_int2double(avio_rl64(pb)); if (fps < 0.0f) { if (s->error_recognition & AV_EF_EXPLODE) { av_log(s, AV_LOG_ERROR, "Invalid frame rate %f\n", fps); return AVERROR_INVALIDDATA; } else { av_log(s, AV_LOG_WARNING, "Invalid frame rate %f, setting to 0.\n", fps); fps = 0.0f; } } // number of packets per stream type, -1 means unknown, e.g. streaming v_packs = avio_rl32(pb); a_packs = avio_rl32(pb); avio_rl32(pb); // text avio_rl32(pb); // keyframe distance (?) if (v_packs) { vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); ctx->v_id = vst->index; ret = av_image_check_size(width, height, 0, s); if (ret < 0) return ret; vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; vst->codecpar->codec_id = AV_CODEC_ID_NUV; vst->codecpar->width = width; vst->codecpar->height = height; vst->codecpar->bits_per_coded_sample = 10; vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000); #if FF_API_R_FRAME_RATE vst->r_frame_rate = #endif vst->avg_frame_rate = av_d2q(fps, 60000); avpriv_set_pts_info(vst, 32, 1, 1000); } else ctx->v_id = -1; if (a_packs) { ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ctx->a_id = ast->index; ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; ast->codecpar->channels = 2; ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; ast->codecpar->sample_rate = 44100; ast->codecpar->bit_rate = 2 * 2 * 44100 * 8; ast->codecpar->block_align = 2 * 2; ast->codecpar->bits_per_coded_sample = 16; avpriv_set_pts_info(ast, 32, 1, 1000); } else ctx->a_id = -1; if ((ret = get_codec_data(pb, vst, ast, is_mythtv)) < 0) return ret; ctx->rtjpg_video = vst && vst->codecpar->codec_id == AV_CODEC_ID_NUV; return 0; }
false
FFmpeg
f748e3b5a219061db021d8b6b7ebb097c65f23c5
static int nuv_header(AVFormatContext *s) { NUVContext *ctx = s->priv_data; AVIOContext *pb = s->pb; char id_string[12]; double aspect, fps; int is_mythtv, width, height, v_packs, a_packs, ret; AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); avio_skip(pb, 5); avio_skip(pb, 3); width = avio_rl32(pb); height = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_r8(pb); avio_skip(pb, 3); aspect = av_int2double(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; fps = av_int2double(avio_rl64(pb)); if (fps < 0.0f) { if (s->error_recognition & AV_EF_EXPLODE) { av_log(s, AV_LOG_ERROR, "Invalid frame rate %f\n", fps); return AVERROR_INVALIDDATA; } else { av_log(s, AV_LOG_WARNING, "Invalid frame rate %f, setting to 0.\n", fps); fps = 0.0f; } } v_packs = avio_rl32(pb); a_packs = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); if (v_packs) { vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); ctx->v_id = vst->index; ret = av_image_check_size(width, height, 0, s); if (ret < 0) return ret; vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; vst->codecpar->codec_id = AV_CODEC_ID_NUV; vst->codecpar->width = width; vst->codecpar->height = height; vst->codecpar->bits_per_coded_sample = 10; vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000); #if FF_API_R_FRAME_RATE vst->r_frame_rate = #endif vst->avg_frame_rate = av_d2q(fps, 60000); avpriv_set_pts_info(vst, 32, 1, 1000); } else ctx->v_id = -1; if (a_packs) { ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ctx->a_id = ast->index; ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; ast->codecpar->channels = 2; ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; ast->codecpar->sample_rate = 44100; ast->codecpar->bit_rate = 2 * 2 * 44100 * 8; ast->codecpar->block_align = 2 * 2; ast->codecpar->bits_per_coded_sample = 16; avpriv_set_pts_info(ast, 32, 1, 1000); } else ctx->a_id = -1; if ((ret = get_codec_data(pb, vst, ast, is_mythtv)) < 0) return ret; ctx->rtjpg_video = vst && vst->codecpar->codec_id == AV_CODEC_ID_NUV; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { NUVContext *ctx = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; char VAR_1[12]; double VAR_2, VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; AVStream *vst = NULL, *ast = NULL; avio_read(pb, VAR_1, 12); VAR_4 = !memcmp(VAR_1, "MythTVVideo", 12); avio_skip(pb, 5); avio_skip(pb, 3); VAR_5 = avio_rl32(pb); VAR_6 = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_r8(pb); avio_skip(pb, 3); VAR_2 = av_int2double(avio_rl64(pb)); if (VAR_2 > 0.9999 && VAR_2 < 1.0001) VAR_2 = 4.0 / 3.0; VAR_3 = av_int2double(avio_rl64(pb)); if (VAR_3 < 0.0f) { if (VAR_0->error_recognition & AV_EF_EXPLODE) { av_log(VAR_0, AV_LOG_ERROR, "Invalid frame rate %f\n", VAR_3); return AVERROR_INVALIDDATA; } else { av_log(VAR_0, AV_LOG_WARNING, "Invalid frame rate %f, setting to 0.\n", VAR_3); VAR_3 = 0.0f; } } VAR_7 = avio_rl32(pb); VAR_8 = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); if (VAR_7) { vst = avformat_new_stream(VAR_0, NULL); if (!vst) return AVERROR(ENOMEM); ctx->v_id = vst->index; VAR_9 = av_image_check_size(VAR_5, VAR_6, 0, VAR_0); if (VAR_9 < 0) return VAR_9; vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; vst->codecpar->codec_id = AV_CODEC_ID_NUV; vst->codecpar->VAR_5 = VAR_5; vst->codecpar->VAR_6 = VAR_6; vst->codecpar->bits_per_coded_sample = 10; vst->sample_aspect_ratio = av_d2q(VAR_2 * VAR_6 / VAR_5, 10000); #if FF_API_R_FRAME_RATE vst->r_frame_rate = #endif vst->avg_frame_rate = av_d2q(VAR_3, 60000); avpriv_set_pts_info(vst, 32, 1, 1000); } else ctx->v_id = -1; if (VAR_8) { ast = avformat_new_stream(VAR_0, NULL); if (!ast) return AVERROR(ENOMEM); ctx->a_id = ast->index; ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; ast->codecpar->channels = 2; ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; ast->codecpar->sample_rate = 44100; ast->codecpar->bit_rate = 2 * 2 * 44100 * 8; ast->codecpar->block_align = 2 * 2; ast->codecpar->bits_per_coded_sample = 16; avpriv_set_pts_info(ast, 32, 1, 1000); } else ctx->a_id = -1; if ((VAR_9 = get_codec_data(pb, vst, ast, VAR_4)) < 0) return VAR_9; ctx->rtjpg_video = vst && vst->codecpar->codec_id == AV_CODEC_ID_NUV; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "NUVContext *ctx = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "char VAR_1[12];", "double VAR_2, VAR_3;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "AVStream *vst = NULL, *ast = NULL;", "avio_read(pb, VAR_1, 12);", "VAR_4 = !memcmp(VAR_1, \"MythTVVideo\", 12);", "avio_skip(pb, 5);", "avio_skip(pb, 3);", "VAR_5 = avio_rl32(pb);", "VAR_6 = avio_rl32(pb);", "avio_rl32(pb);", "avio_rl32(pb);", "avio_r8(pb);", "avio_skip(pb, 3);", "VAR_2 = av_int2double(avio_rl64(pb));", "if (VAR_2 > 0.9999 && VAR_2 < 1.0001)\nVAR_2 = 4.0 / 3.0;", "VAR_3 = av_int2double(avio_rl64(pb));", "if (VAR_3 < 0.0f) {", "if (VAR_0->error_recognition & AV_EF_EXPLODE) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid frame rate %f\\n\", VAR_3);", "return AVERROR_INVALIDDATA;", "} else {", "av_log(VAR_0, AV_LOG_WARNING, \"Invalid frame rate %f, setting to 0.\\n\", VAR_3);", "VAR_3 = 0.0f;", "}", "}", "VAR_7 = avio_rl32(pb);", "VAR_8 = avio_rl32(pb);", "avio_rl32(pb);", "avio_rl32(pb);", "if (VAR_7) {", "vst = avformat_new_stream(VAR_0, NULL);", "if (!vst)\nreturn AVERROR(ENOMEM);", "ctx->v_id = vst->index;", "VAR_9 = av_image_check_size(VAR_5, VAR_6, 0, VAR_0);", "if (VAR_9 < 0)\nreturn VAR_9;", "vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;", "vst->codecpar->codec_id = AV_CODEC_ID_NUV;", "vst->codecpar->VAR_5 = VAR_5;", "vst->codecpar->VAR_6 = VAR_6;", "vst->codecpar->bits_per_coded_sample = 10;", "vst->sample_aspect_ratio = av_d2q(VAR_2 * VAR_6 / VAR_5,\n10000);", "#if FF_API_R_FRAME_RATE\nvst->r_frame_rate =\n#endif\nvst->avg_frame_rate = av_d2q(VAR_3, 60000);", "avpriv_set_pts_info(vst, 32, 1, 1000);", "} else", "ctx->v_id = -1;", "if (VAR_8) {", "ast = avformat_new_stream(VAR_0, NULL);", "if (!ast)\nreturn AVERROR(ENOMEM);", "ctx->a_id = ast->index;", "ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;", "ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;", "ast->codecpar->channels = 2;", "ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;", "ast->codecpar->sample_rate = 44100;", "ast->codecpar->bit_rate = 2 * 2 * 44100 * 8;", "ast->codecpar->block_align = 2 * 2;", "ast->codecpar->bits_per_coded_sample = 16;", "avpriv_set_pts_info(ast, 32, 1, 1000);", "} else", "ctx->a_id = -1;", "if ((VAR_9 = get_codec_data(pb, vst, ast, VAR_4)) < 0)\nreturn VAR_9;", "ctx->rtjpg_video = vst && vst->codecpar->codec_id == AV_CODEC_ID_NUV;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115, 117, 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167, 169 ], [ 173 ], [ 177 ], [ 179 ] ]
2,957
setup_return(CPUARMState *env, struct target_sigaction *ka, abi_ulong *rc, abi_ulong frame_addr, int usig, abi_ulong rc_addr) { abi_ulong handler = ka->_sa_handler; abi_ulong retcode; int thumb = handler & 1; uint32_t cpsr = cpsr_read(env); cpsr &= ~CPSR_IT; if (thumb) { cpsr |= CPSR_T; } else { cpsr &= ~CPSR_T; } if (ka->sa_flags & TARGET_SA_RESTORER) { retcode = ka->sa_restorer; } else { unsigned int idx = thumb; if (ka->sa_flags & TARGET_SA_SIGINFO) idx += 2; if (__put_user(retcodes[idx], rc)) return 1; retcode = rc_addr + thumb; } env->regs[0] = usig; env->regs[13] = frame_addr; env->regs[14] = retcode; env->regs[15] = handler & (thumb ? ~1 : ~3); cpsr_write(env, cpsr, 0xffffffff); return 0; }
true
qemu
0188fadb7fe460d8c4c743372b1f7b25773e183e
setup_return(CPUARMState *env, struct target_sigaction *ka, abi_ulong *rc, abi_ulong frame_addr, int usig, abi_ulong rc_addr) { abi_ulong handler = ka->_sa_handler; abi_ulong retcode; int thumb = handler & 1; uint32_t cpsr = cpsr_read(env); cpsr &= ~CPSR_IT; if (thumb) { cpsr |= CPSR_T; } else { cpsr &= ~CPSR_T; } if (ka->sa_flags & TARGET_SA_RESTORER) { retcode = ka->sa_restorer; } else { unsigned int idx = thumb; if (ka->sa_flags & TARGET_SA_SIGINFO) idx += 2; if (__put_user(retcodes[idx], rc)) return 1; retcode = rc_addr + thumb; } env->regs[0] = usig; env->regs[13] = frame_addr; env->regs[14] = retcode; env->regs[15] = handler & (thumb ? ~1 : ~3); cpsr_write(env, cpsr, 0xffffffff); return 0; }
{ "code": [ "\t\tif (__put_user(retcodes[idx], rc))", "\t\t\treturn 1;", "\treturn 0;" ], "line_no": [ 47, 49, 71 ] }
FUNC_0(CPUARMState *VAR_0, struct target_sigaction *VAR_1, abi_ulong *VAR_2, abi_ulong VAR_3, int VAR_4, abi_ulong VAR_5) { abi_ulong handler = VAR_1->_sa_handler; abi_ulong retcode; int VAR_6 = handler & 1; uint32_t cpsr = cpsr_read(VAR_0); cpsr &= ~CPSR_IT; if (VAR_6) { cpsr |= CPSR_T; } else { cpsr &= ~CPSR_T; } if (VAR_1->sa_flags & TARGET_SA_RESTORER) { retcode = VAR_1->sa_restorer; } else { unsigned int VAR_7 = VAR_6; if (VAR_1->sa_flags & TARGET_SA_SIGINFO) VAR_7 += 2; if (__put_user(retcodes[VAR_7], VAR_2)) return 1; retcode = VAR_5 + VAR_6; } VAR_0->regs[0] = VAR_4; VAR_0->regs[13] = VAR_3; VAR_0->regs[14] = retcode; VAR_0->regs[15] = handler & (VAR_6 ? ~1 : ~3); cpsr_write(VAR_0, cpsr, 0xffffffff); return 0; }
[ "FUNC_0(CPUARMState *VAR_0, struct target_sigaction *VAR_1,\nabi_ulong *VAR_2, abi_ulong VAR_3, int VAR_4, abi_ulong VAR_5)\n{", "abi_ulong handler = VAR_1->_sa_handler;", "abi_ulong retcode;", "int VAR_6 = handler & 1;", "uint32_t cpsr = cpsr_read(VAR_0);", "cpsr &= ~CPSR_IT;", "if (VAR_6) {", "cpsr |= CPSR_T;", "} else {", "cpsr &= ~CPSR_T;", "}", "if (VAR_1->sa_flags & TARGET_SA_RESTORER) {", "retcode = VAR_1->sa_restorer;", "} else {", "unsigned int VAR_7 = VAR_6;", "if (VAR_1->sa_flags & TARGET_SA_SIGINFO)\nVAR_7 += 2;", "if (__put_user(retcodes[VAR_7], VAR_2))\nreturn 1;", "retcode = VAR_5 + VAR_6;", "}", "VAR_0->regs[0] = VAR_4;", "VAR_0->regs[13] = VAR_3;", "VAR_0->regs[14] = retcode;", "VAR_0->regs[15] = handler & (VAR_6 ? ~1 : ~3);", "cpsr_write(VAR_0, cpsr, 0xffffffff);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ] ]
2,959
static void floor_fit(vorbis_enc_context *venc, vorbis_enc_floor *fc, float *coeffs, uint_fast16_t *posts, int samples) { int range = 255 / fc->multiplier + 1; int i; float tot_average = 0.; float averages[fc->values]; for (i = 0; i < fc->values; i++) { averages[i] = get_floor_average(fc, coeffs, i); tot_average += averages[i]; } tot_average /= fc->values; tot_average /= venc->quality; for (i = 0; i < fc->values; i++) { int position = fc->list[fc->list[i].sort].x; float average = averages[i]; int j; average *= pow(tot_average / average, 0.5) * pow(1.25, position/200.); // MAGIC! for (j = 0; j < range - 1; j++) if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average) break; posts[fc->list[i].sort] = j; } }
true
FFmpeg
83b707613181c01fd4e9d25dda6787af439d2e41
static void floor_fit(vorbis_enc_context *venc, vorbis_enc_floor *fc, float *coeffs, uint_fast16_t *posts, int samples) { int range = 255 / fc->multiplier + 1; int i; float tot_average = 0.; float averages[fc->values]; for (i = 0; i < fc->values; i++) { averages[i] = get_floor_average(fc, coeffs, i); tot_average += averages[i]; } tot_average /= fc->values; tot_average /= venc->quality; for (i = 0; i < fc->values; i++) { int position = fc->list[fc->list[i].sort].x; float average = averages[i]; int j; average *= pow(tot_average / average, 0.5) * pow(1.25, position/200.); for (j = 0; j < range - 1; j++) if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average) break; posts[fc->list[i].sort] = j; } }
{ "code": [], "line_no": [] }
static void FUNC_0(vorbis_enc_context *VAR_0, vorbis_enc_floor *VAR_1, float *VAR_2, uint_fast16_t *VAR_3, int VAR_4) { int VAR_5 = 255 / VAR_1->multiplier + 1; int VAR_6; float VAR_7 = 0.; float VAR_8[VAR_1->values]; for (VAR_6 = 0; VAR_6 < VAR_1->values; VAR_6++) { VAR_8[VAR_6] = get_floor_average(VAR_1, VAR_2, VAR_6); VAR_7 += VAR_8[VAR_6]; } VAR_7 /= VAR_1->values; VAR_7 /= VAR_0->quality; for (VAR_6 = 0; VAR_6 < VAR_1->values; VAR_6++) { int position = VAR_1->list[VAR_1->list[VAR_6].sort].x; float average = VAR_8[VAR_6]; int j; average *= pow(VAR_7 / average, 0.5) * pow(1.25, position/200.); for (j = 0; j < VAR_5 - 1; j++) if (ff_vorbis_floor1_inverse_db_table[j * VAR_1->multiplier] > average) break; VAR_3[VAR_1->list[VAR_6].sort] = j; } }
[ "static void FUNC_0(vorbis_enc_context *VAR_0, vorbis_enc_floor *VAR_1,\nfloat *VAR_2, uint_fast16_t *VAR_3, int VAR_4)\n{", "int VAR_5 = 255 / VAR_1->multiplier + 1;", "int VAR_6;", "float VAR_7 = 0.;", "float VAR_8[VAR_1->values];", "for (VAR_6 = 0; VAR_6 < VAR_1->values; VAR_6++) {", "VAR_8[VAR_6] = get_floor_average(VAR_1, VAR_2, VAR_6);", "VAR_7 += VAR_8[VAR_6];", "}", "VAR_7 /= VAR_1->values;", "VAR_7 /= VAR_0->quality;", "for (VAR_6 = 0; VAR_6 < VAR_1->values; VAR_6++) {", "int position = VAR_1->list[VAR_1->list[VAR_6].sort].x;", "float average = VAR_8[VAR_6];", "int j;", "average *= pow(VAR_7 / average, 0.5) * pow(1.25, position/200.);", "for (j = 0; j < VAR_5 - 1; j++)", "if (ff_vorbis_floor1_inverse_db_table[j * VAR_1->multiplier] > average)\nbreak;", "VAR_3[VAR_1->list[VAR_6].sort] = j;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ] ]
2,960
void av_destruct_packet(AVPacket *pkt) { int i; av_free(pkt->data); pkt->data = NULL; pkt->size = 0; for (i = 0; i < pkt->side_data_elems; i++) av_free(pkt->side_data[i].data); av_freep(&pkt->side_data); pkt->side_data_elems = 0; }
true
FFmpeg
c4ba5198ea48f8f648d85a853ea46e29001c12c8
void av_destruct_packet(AVPacket *pkt) { int i; av_free(pkt->data); pkt->data = NULL; pkt->size = 0; for (i = 0; i < pkt->side_data_elems; i++) av_free(pkt->side_data[i].data); av_freep(&pkt->side_data); pkt->side_data_elems = 0; }
{ "code": [ "void av_destruct_packet(AVPacket *pkt)", " av_free(pkt->data);", " pkt->data = NULL; pkt->size = 0;" ], "line_no": [ 1, 9, 11 ] }
void FUNC_0(AVPacket *VAR_0) { int VAR_1; av_free(VAR_0->data); VAR_0->data = NULL; VAR_0->size = 0; for (VAR_1 = 0; VAR_1 < VAR_0->side_data_elems; VAR_1++) av_free(VAR_0->side_data[VAR_1].data); av_freep(&VAR_0->side_data); VAR_0->side_data_elems = 0; }
[ "void FUNC_0(AVPacket *VAR_0)\n{", "int VAR_1;", "av_free(VAR_0->data);", "VAR_0->data = NULL; VAR_0->size = 0;", "for (VAR_1 = 0; VAR_1 < VAR_0->side_data_elems; VAR_1++)", "av_free(VAR_0->side_data[VAR_1].data);", "av_freep(&VAR_0->side_data);", "VAR_0->side_data_elems = 0;", "}" ]
[ 1, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
2,961
GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **errp) { GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; int write_count; GuestFileHandle *gfh = guest_file_handle_find(handle, errp); FILE *fh; if (!gfh) { return NULL; } fh = gfh->fh; buf = g_base64_decode(buf_b64, &buf_len); if (!has_count) { count = buf_len; } else if (count < 0 || count > buf_len) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); g_free(buf); return NULL; } write_count = fwrite(buf, 1, count, fh); if (ferror(fh)) { error_setg_errno(errp, errno, "failed to write to file"); slog("guest-file-write failed, handle: %" PRId64, handle); } else { write_data = g_malloc0(sizeof(GuestFileWrite)); write_data->count = write_count; write_data->eof = feof(fh); } g_free(buf); clearerr(fh); return write_data; }
true
qemu
f3a06403b82c7f036564e4caf18b52ce6885fcfb
GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **errp) { GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; int write_count; GuestFileHandle *gfh = guest_file_handle_find(handle, errp); FILE *fh; if (!gfh) { return NULL; } fh = gfh->fh; buf = g_base64_decode(buf_b64, &buf_len); if (!has_count) { count = buf_len; } else if (count < 0 || count > buf_len) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); g_free(buf); return NULL; } write_count = fwrite(buf, 1, count, fh); if (ferror(fh)) { error_setg_errno(errp, errno, "failed to write to file"); slog("guest-file-write failed, handle: %" PRId64, handle); } else { write_data = g_malloc0(sizeof(GuestFileWrite)); write_data->count = write_count; write_data->eof = feof(fh); } g_free(buf); clearerr(fh); return write_data; }
{ "code": [ " write_data = g_malloc0(sizeof(GuestFileWrite));", " write_data = g_malloc0(sizeof(GuestFileWrite));" ], "line_no": [ 65, 65 ] }
GuestFileWrite *FUNC_0(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **errp) { GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; int VAR_0; GuestFileHandle *gfh = guest_file_handle_find(handle, errp); FILE *fh; if (!gfh) { return NULL; } fh = gfh->fh; buf = g_base64_decode(buf_b64, &buf_len); if (!has_count) { count = buf_len; } else if (count < 0 || count > buf_len) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); g_free(buf); return NULL; } VAR_0 = fwrite(buf, 1, count, fh); if (ferror(fh)) { error_setg_errno(errp, errno, "failed to write to file"); slog("guest-file-write failed, handle: %" PRId64, handle); } else { write_data = g_malloc0(sizeof(GuestFileWrite)); write_data->count = VAR_0; write_data->eof = feof(fh); } g_free(buf); clearerr(fh); return write_data; }
[ "GuestFileWrite *FUNC_0(int64_t handle, const char *buf_b64,\nbool has_count, int64_t count,\nError **errp)\n{", "GuestFileWrite *write_data = NULL;", "guchar *buf;", "gsize buf_len;", "int VAR_0;", "GuestFileHandle *gfh = guest_file_handle_find(handle, errp);", "FILE *fh;", "if (!gfh) {", "return NULL;", "}", "fh = gfh->fh;", "buf = g_base64_decode(buf_b64, &buf_len);", "if (!has_count) {", "count = buf_len;", "} else if (count < 0 || count > buf_len) {", "error_setg(errp, \"value '%\" PRId64 \"' is invalid for argument count\",\ncount);", "g_free(buf);", "return NULL;", "}", "VAR_0 = fwrite(buf, 1, count, fh);", "if (ferror(fh)) {", "error_setg_errno(errp, errno, \"failed to write to file\");", "slog(\"guest-file-write failed, handle: %\" PRId64, handle);", "} else {", "write_data = g_malloc0(sizeof(GuestFileWrite));", "write_data->count = VAR_0;", "write_data->eof = feof(fh);", "}", "g_free(buf);", "clearerr(fh);", "return write_data;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
2,962
static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf) { int au_headers_length, au_header_size, i; GetBitContext getbitcontext; RTPPayloadData *infos; infos = s->rtp_payload_data; if (infos == NULL) return -1; /* decode the first 2 bytes where the AUHeader sections are stored length in bits */ au_headers_length = AV_RB16(buf); if (au_headers_length > RTP_MAX_PACKET_LENGTH) return -1; infos->au_headers_length_bytes = (au_headers_length + 7) / 8; /* skip AU headers length section (2 bytes) */ buf += 2; init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8); /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */ au_header_size = infos->sizelength + infos->indexlength; if (au_header_size <= 0 || (au_headers_length % au_header_size != 0)) return -1; infos->nb_au_headers = au_headers_length / au_header_size; infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers); /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving) In my test, the FAAD decoder does not behave correctly when sending each AU one by one but does when sending the whole as one big packet... */ infos->au_headers[0].size = 0; infos->au_headers[0].index = 0; for (i = 0; i < infos->nb_au_headers; ++i) { infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength); infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength); infos->nb_au_headers = 1; return 0;
true
FFmpeg
0e4b185a8df12c7b42642699a8df45e0de48de07
static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf) { int au_headers_length, au_header_size, i; GetBitContext getbitcontext; RTPPayloadData *infos; infos = s->rtp_payload_data; if (infos == NULL) return -1; au_headers_length = AV_RB16(buf); if (au_headers_length > RTP_MAX_PACKET_LENGTH) return -1; infos->au_headers_length_bytes = (au_headers_length + 7) / 8; buf += 2; init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8); au_header_size = infos->sizelength + infos->indexlength; if (au_header_size <= 0 || (au_headers_length % au_header_size != 0)) return -1; infos->nb_au_headers = au_headers_length / au_header_size; infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers); infos->au_headers[0].size = 0; infos->au_headers[0].index = 0; for (i = 0; i < infos->nb_au_headers; ++i) { infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength); infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength); infos->nb_au_headers = 1; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(RTPDemuxContext *VAR_0, const uint8_t *VAR_1) { int VAR_2, VAR_3, VAR_4; GetBitContext getbitcontext; RTPPayloadData *infos; infos = VAR_0->rtp_payload_data; if (infos == NULL) return -1; VAR_2 = AV_RB16(VAR_1); if (VAR_2 > RTP_MAX_PACKET_LENGTH) return -1; infos->au_headers_length_bytes = (VAR_2 + 7) / 8; VAR_1 += 2; init_get_bits(&getbitcontext, VAR_1, infos->au_headers_length_bytes * 8); VAR_3 = infos->sizelength + infos->indexlength; if (VAR_3 <= 0 || (VAR_2 % VAR_3 != 0)) return -1; infos->nb_au_headers = VAR_2 / VAR_3; infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers); infos->au_headers[0].size = 0; infos->au_headers[0].index = 0; for (VAR_4 = 0; VAR_4 < infos->nb_au_headers; ++VAR_4) { infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength); infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength); infos->nb_au_headers = 1; return 0;
[ "static int FUNC_0(RTPDemuxContext *VAR_0, const uint8_t *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "GetBitContext getbitcontext;", "RTPPayloadData *infos;", "infos = VAR_0->rtp_payload_data;", "if (infos == NULL)\nreturn -1;", "VAR_2 = AV_RB16(VAR_1);", "if (VAR_2 > RTP_MAX_PACKET_LENGTH)\nreturn -1;", "infos->au_headers_length_bytes = (VAR_2 + 7) / 8;", "VAR_1 += 2;", "init_get_bits(&getbitcontext, VAR_1, infos->au_headers_length_bytes * 8);", "VAR_3 = infos->sizelength + infos->indexlength;", "if (VAR_3 <= 0 || (VAR_2 % VAR_3 != 0))\nreturn -1;", "infos->nb_au_headers = VAR_2 / VAR_3;", "infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);", "infos->au_headers[0].size = 0;", "infos->au_headers[0].index = 0;", "for (VAR_4 = 0; VAR_4 < infos->nb_au_headers; ++VAR_4) {", "infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength);", "infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength);", "infos->nb_au_headers = 1;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 43 ], [ 47 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 65 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 90 ], [ 94 ] ]
2,963
static void vc1_mc_4mv_chroma(VC1Context *v, int dir) { MpegEncContext *s = &v->s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcU, *srcV; int uvmx, uvmy, uvsrc_x, uvsrc_y; int k, tx = 0, ty = 0; int mvx[4], mvy[4], intra[4], mv_f[4]; int valid_count; int chroma_ref_type = v->cur_field_type, off = 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; if (!v->field_mode && !v->s.last_picture.f.data[0]) return; if (s->flags & CODEC_FLAG_GRAY) return; for (k = 0; k < 4; k++) { mvx[k] = s->mv[dir][k][0]; mvy[k] = s->mv[dir][k][1]; intra[k] = v->mb_type[0][s->block_index[k]]; if (v->field_mode) mv_f[k] = v->mv_f[dir][s->block_index[k] + v->blocks_off]; } /* calculate chroma MV vector from four luma MVs */ if (!v->field_mode || (v->field_mode && !v->numref)) { valid_count = get_chroma_mv(mvx, mvy, intra, 0, &tx, &ty); chroma_ref_type = v->reffield; if (!valid_count) { s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; return; //no need to do MC for intra blocks } } else { int dominant = 0; if (mv_f[0] + mv_f[1] + mv_f[2] + mv_f[3] > 2) dominant = 1; valid_count = get_chroma_mv(mvx, mvy, mv_f, dominant, &tx, &ty); if (dominant) chroma_ref_type = !v->cur_field_type; } if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_picture.f.data[0]) return; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; uvmx = (tx + ((tx & 3) == 3)) >> 1; uvmy = (ty + ((ty & 3) == 3)) >> 1; v->luma_mv[s->mb_x][0] = uvmx; v->luma_mv[s->mb_x][1] = uvmy; if (v->fastuvmc) { uvmx = uvmx + ((uvmx < 0) ? (uvmx & 1) : -(uvmx & 1)); uvmy = uvmy + ((uvmy < 0) ? (uvmy & 1) : -(uvmy & 1)); } // Field conversion bias if (v->cur_field_type != chroma_ref_type) uvmy += 2 - 4 * chroma_ref_type; uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); if (v->profile != PROFILE_ADVANCED) { uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); } else { uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); } if (!dir) { if (v->field_mode) { if ((v->cur_field_type != chroma_ref_type) && v->cur_field_type) { srcU = s->current_picture.f.data[1]; srcV = s->current_picture.f.data[2]; } else { srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; } } else { srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; } } else { srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; } if(!srcU) return; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; if (v->field_mode) { if (chroma_ref_type) { srcU += s->current_picture_ptr->f.linesize[1]; srcV += s->current_picture_ptr->f.linesize[2]; } off = v->second_field ? s->current_picture_ptr->f.linesize[1] : 0; } if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) || s->h_edge_pos < 18 || v_edge_pos < 18 || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 || (unsigned)uvsrc_y > (v_edge_pos >> 1) - 9) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; /* if we deal with range reduction we need to scale source blocks */ if (v->rangeredfrm) { int i, j; uint8_t *src, *src2; src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { for (i = 0; i < 9; i++) { src[i] = ((src[i] - 128) >> 1) + 128; src2[i] = ((src2[i] - 128) >> 1) + 128; } src += s->uvlinesize; src2 += s->uvlinesize; } } /* if we deal with intensity compensation we need to scale source blocks */ if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int i, j; uint8_t *src, *src2; src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { for (i = 0; i < 9; i++) { src[i] = v->lutuv[src[i]]; src2[i] = v->lutuv[src2[i]]; } src += s->uvlinesize; src2 += s->uvlinesize; } } } /* Chroma MC always uses qpel bilinear */ uvmx = (uvmx & 3) << 1; uvmy = (uvmy & 3) << 1; if (!v->rnd) { h264chroma->put_h264_chroma_pixels_tab[0](s->dest[1] + off, srcU, s->uvlinesize, 8, uvmx, uvmy); h264chroma->put_h264_chroma_pixels_tab[0](s->dest[2] + off, srcV, s->uvlinesize, 8, uvmx, uvmy); } else { v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off, srcU, s->uvlinesize, 8, uvmx, uvmy); v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off, srcV, s->uvlinesize, 8, uvmx, uvmy); } }
false
FFmpeg
0d194ee51ed477f843900e657a7edbcbecdffa42
static void vc1_mc_4mv_chroma(VC1Context *v, int dir) { MpegEncContext *s = &v->s; H264ChromaContext *h264chroma = &v->h264chroma; uint8_t *srcU, *srcV; int uvmx, uvmy, uvsrc_x, uvsrc_y; int k, tx = 0, ty = 0; int mvx[4], mvy[4], intra[4], mv_f[4]; int valid_count; int chroma_ref_type = v->cur_field_type, off = 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; if (!v->field_mode && !v->s.last_picture.f.data[0]) return; if (s->flags & CODEC_FLAG_GRAY) return; for (k = 0; k < 4; k++) { mvx[k] = s->mv[dir][k][0]; mvy[k] = s->mv[dir][k][1]; intra[k] = v->mb_type[0][s->block_index[k]]; if (v->field_mode) mv_f[k] = v->mv_f[dir][s->block_index[k] + v->blocks_off]; } if (!v->field_mode || (v->field_mode && !v->numref)) { valid_count = get_chroma_mv(mvx, mvy, intra, 0, &tx, &ty); chroma_ref_type = v->reffield; if (!valid_count) { s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; return; } } else { int dominant = 0; if (mv_f[0] + mv_f[1] + mv_f[2] + mv_f[3] > 2) dominant = 1; valid_count = get_chroma_mv(mvx, mvy, mv_f, dominant, &tx, &ty); if (dominant) chroma_ref_type = !v->cur_field_type; } if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_picture.f.data[0]) return; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; uvmx = (tx + ((tx & 3) == 3)) >> 1; uvmy = (ty + ((ty & 3) == 3)) >> 1; v->luma_mv[s->mb_x][0] = uvmx; v->luma_mv[s->mb_x][1] = uvmy; if (v->fastuvmc) { uvmx = uvmx + ((uvmx < 0) ? (uvmx & 1) : -(uvmx & 1)); uvmy = uvmy + ((uvmy < 0) ? (uvmy & 1) : -(uvmy & 1)); } if (v->cur_field_type != chroma_ref_type) uvmy += 2 - 4 * chroma_ref_type; uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); if (v->profile != PROFILE_ADVANCED) { uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); } else { uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); } if (!dir) { if (v->field_mode) { if ((v->cur_field_type != chroma_ref_type) && v->cur_field_type) { srcU = s->current_picture.f.data[1]; srcV = s->current_picture.f.data[2]; } else { srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; } } else { srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; } } else { srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; } if(!srcU) return; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; if (v->field_mode) { if (chroma_ref_type) { srcU += s->current_picture_ptr->f.linesize[1]; srcV += s->current_picture_ptr->f.linesize[2]; } off = v->second_field ? s->current_picture_ptr->f.linesize[1] : 0; } if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) || s->h_edge_pos < 18 || v_edge_pos < 18 || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 || (unsigned)uvsrc_y > (v_edge_pos >> 1) - 9) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; if (v->rangeredfrm) { int i, j; uint8_t *src, *src2; src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { for (i = 0; i < 9; i++) { src[i] = ((src[i] - 128) >> 1) + 128; src2[i] = ((src2[i] - 128) >> 1) + 128; } src += s->uvlinesize; src2 += s->uvlinesize; } } if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int i, j; uint8_t *src, *src2; src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { for (i = 0; i < 9; i++) { src[i] = v->lutuv[src[i]]; src2[i] = v->lutuv[src2[i]]; } src += s->uvlinesize; src2 += s->uvlinesize; } } } uvmx = (uvmx & 3) << 1; uvmy = (uvmy & 3) << 1; if (!v->rnd) { h264chroma->put_h264_chroma_pixels_tab[0](s->dest[1] + off, srcU, s->uvlinesize, 8, uvmx, uvmy); h264chroma->put_h264_chroma_pixels_tab[0](s->dest[2] + off, srcV, s->uvlinesize, 8, uvmx, uvmy); } else { v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off, srcU, s->uvlinesize, 8, uvmx, uvmy); v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off, srcV, s->uvlinesize, 8, uvmx, uvmy); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VC1Context *VAR_0, int VAR_1) { MpegEncContext *s = &VAR_0->s; H264ChromaContext *h264chroma = &VAR_0->h264chroma; uint8_t *srcU, *srcV; int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7 = 0, VAR_8 = 0; int VAR_9[4], VAR_10[4], VAR_11[4], VAR_12[4]; int VAR_13; int VAR_14 = VAR_0->cur_field_type, VAR_15 = 0; int VAR_16 = s->VAR_16 >> VAR_0->field_mode; if (!VAR_0->field_mode && !VAR_0->s.last_picture.f.data[0]) return; if (s->flags & CODEC_FLAG_GRAY) return; for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { VAR_9[VAR_6] = s->mv[VAR_1][VAR_6][0]; VAR_10[VAR_6] = s->mv[VAR_1][VAR_6][1]; VAR_11[VAR_6] = VAR_0->mb_type[0][s->block_index[VAR_6]]; if (VAR_0->field_mode) VAR_12[VAR_6] = VAR_0->VAR_12[VAR_1][s->block_index[VAR_6] + VAR_0->blocks_off]; } if (!VAR_0->field_mode || (VAR_0->field_mode && !VAR_0->numref)) { VAR_13 = get_chroma_mv(VAR_9, VAR_10, VAR_11, 0, &VAR_7, &VAR_8); VAR_14 = VAR_0->reffield; if (!VAR_13) { s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][1] = 0; VAR_0->luma_mv[s->mb_x][0] = VAR_0->luma_mv[s->mb_x][1] = 0; return; } } else { int VAR_17 = 0; if (VAR_12[0] + VAR_12[1] + VAR_12[2] + VAR_12[3] > 2) VAR_17 = 1; VAR_13 = get_chroma_mv(VAR_9, VAR_10, VAR_12, VAR_17, &VAR_7, &VAR_8); if (VAR_17) VAR_14 = !VAR_0->cur_field_type; } if (VAR_0->field_mode && VAR_14 == 1 && VAR_0->cur_field_type == 1 && !VAR_0->s.last_picture.f.data[0]) return; s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][0] = VAR_7; s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][1] = VAR_8; VAR_2 = (VAR_7 + ((VAR_7 & 3) == 3)) >> 1; VAR_3 = (VAR_8 + ((VAR_8 & 3) == 3)) >> 1; VAR_0->luma_mv[s->mb_x][0] = VAR_2; VAR_0->luma_mv[s->mb_x][1] = VAR_3; if (VAR_0->fastuvmc) { VAR_2 = VAR_2 + ((VAR_2 < 0) ? (VAR_2 & 1) : -(VAR_2 & 1)); VAR_3 = VAR_3 + ((VAR_3 < 0) ? (VAR_3 & 1) : -(VAR_3 & 1)); } if (VAR_0->cur_field_type != VAR_14) VAR_3 += 2 - 4 * VAR_14; VAR_4 = s->mb_x * 8 + (VAR_2 >> 2); VAR_5 = s->mb_y * 8 + (VAR_3 >> 2); if (VAR_0->profile != PROFILE_ADVANCED) { VAR_4 = av_clip(VAR_4, -8, s->mb_width * 8); VAR_5 = av_clip(VAR_5, -8, s->mb_height * 8); } else { VAR_4 = av_clip(VAR_4, -8, s->avctx->coded_width >> 1); VAR_5 = av_clip(VAR_5, -8, s->avctx->coded_height >> 1); } if (!VAR_1) { if (VAR_0->field_mode) { if ((VAR_0->cur_field_type != VAR_14) && VAR_0->cur_field_type) { srcU = s->current_picture.f.data[1]; srcV = s->current_picture.f.data[2]; } else { srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; } } else { srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; } } else { srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; } if(!srcU) return; srcU += VAR_5 * s->uvlinesize + VAR_4; srcV += VAR_5 * s->uvlinesize + VAR_4; if (VAR_0->field_mode) { if (VAR_14) { srcU += s->current_picture_ptr->f.linesize[1]; srcV += s->current_picture_ptr->f.linesize[2]; } VAR_15 = VAR_0->second_field ? s->current_picture_ptr->f.linesize[1] : 0; } if (VAR_0->rangeredfrm || (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) || s->h_edge_pos < 18 || VAR_16 < 18 || (unsigned)VAR_4 > (s->h_edge_pos >> 1) - 9 || (unsigned)VAR_5 > (VAR_16 >> 1) - 9) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8 + 1, 8 + 1, VAR_4, VAR_5, s->h_edge_pos >> 1, VAR_16 >> 1); s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1, VAR_4, VAR_5, s->h_edge_pos >> 1, VAR_16 >> 1); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; if (VAR_0->rangeredfrm) { int VAR_20, VAR_20; uint8_t *src, *src2; src = srcU; src2 = srcV; for (VAR_20 = 0; VAR_20 < 9; VAR_20++) { for (VAR_20 = 0; VAR_20 < 9; VAR_20++) { src[VAR_20] = ((src[VAR_20] - 128) >> 1) + 128; src2[VAR_20] = ((src2[VAR_20] - 128) >> 1) + 128; } src += s->uvlinesize; src2 += s->uvlinesize; } } if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) { int VAR_20, VAR_20; uint8_t *src, *src2; src = srcU; src2 = srcV; for (VAR_20 = 0; VAR_20 < 9; VAR_20++) { for (VAR_20 = 0; VAR_20 < 9; VAR_20++) { src[VAR_20] = VAR_0->lutuv[src[VAR_20]]; src2[VAR_20] = VAR_0->lutuv[src2[VAR_20]]; } src += s->uvlinesize; src2 += s->uvlinesize; } } } VAR_2 = (VAR_2 & 3) << 1; VAR_3 = (VAR_3 & 3) << 1; if (!VAR_0->rnd) { h264chroma->put_h264_chroma_pixels_tab[0](s->dest[1] + VAR_15, srcU, s->uvlinesize, 8, VAR_2, VAR_3); h264chroma->put_h264_chroma_pixels_tab[0](s->dest[2] + VAR_15, srcV, s->uvlinesize, 8, VAR_2, VAR_3); } else { VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + VAR_15, srcU, s->uvlinesize, 8, VAR_2, VAR_3); VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + VAR_15, srcV, s->uvlinesize, 8, VAR_2, VAR_3); } }
[ "static void FUNC_0(VC1Context *VAR_0, int VAR_1)\n{", "MpegEncContext *s = &VAR_0->s;", "H264ChromaContext *h264chroma = &VAR_0->h264chroma;", "uint8_t *srcU, *srcV;", "int VAR_2, VAR_3, VAR_4, VAR_5;", "int VAR_6, VAR_7 = 0, VAR_8 = 0;", "int VAR_9[4], VAR_10[4], VAR_11[4], VAR_12[4];", "int VAR_13;", "int VAR_14 = VAR_0->cur_field_type, VAR_15 = 0;", "int VAR_16 = s->VAR_16 >> VAR_0->field_mode;", "if (!VAR_0->field_mode && !VAR_0->s.last_picture.f.data[0])\nreturn;", "if (s->flags & CODEC_FLAG_GRAY)\nreturn;", "for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "VAR_9[VAR_6] = s->mv[VAR_1][VAR_6][0];", "VAR_10[VAR_6] = s->mv[VAR_1][VAR_6][1];", "VAR_11[VAR_6] = VAR_0->mb_type[0][s->block_index[VAR_6]];", "if (VAR_0->field_mode)\nVAR_12[VAR_6] = VAR_0->VAR_12[VAR_1][s->block_index[VAR_6] + VAR_0->blocks_off];", "}", "if (!VAR_0->field_mode || (VAR_0->field_mode && !VAR_0->numref)) {", "VAR_13 = get_chroma_mv(VAR_9, VAR_10, VAR_11, 0, &VAR_7, &VAR_8);", "VAR_14 = VAR_0->reffield;", "if (!VAR_13) {", "s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][0] = 0;", "s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][1] = 0;", "VAR_0->luma_mv[s->mb_x][0] = VAR_0->luma_mv[s->mb_x][1] = 0;", "return;", "}", "} else {", "int VAR_17 = 0;", "if (VAR_12[0] + VAR_12[1] + VAR_12[2] + VAR_12[3] > 2)\nVAR_17 = 1;", "VAR_13 = get_chroma_mv(VAR_9, VAR_10, VAR_12, VAR_17, &VAR_7, &VAR_8);", "if (VAR_17)\nVAR_14 = !VAR_0->cur_field_type;", "}", "if (VAR_0->field_mode && VAR_14 == 1 && VAR_0->cur_field_type == 1 && !VAR_0->s.last_picture.f.data[0])\nreturn;", "s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][0] = VAR_7;", "s->current_picture.f.motion_val[1][s->block_index[0] + VAR_0->blocks_off][1] = VAR_8;", "VAR_2 = (VAR_7 + ((VAR_7 & 3) == 3)) >> 1;", "VAR_3 = (VAR_8 + ((VAR_8 & 3) == 3)) >> 1;", "VAR_0->luma_mv[s->mb_x][0] = VAR_2;", "VAR_0->luma_mv[s->mb_x][1] = VAR_3;", "if (VAR_0->fastuvmc) {", "VAR_2 = VAR_2 + ((VAR_2 < 0) ? (VAR_2 & 1) : -(VAR_2 & 1));", "VAR_3 = VAR_3 + ((VAR_3 < 0) ? (VAR_3 & 1) : -(VAR_3 & 1));", "}", "if (VAR_0->cur_field_type != VAR_14)\nVAR_3 += 2 - 4 * VAR_14;", "VAR_4 = s->mb_x * 8 + (VAR_2 >> 2);", "VAR_5 = s->mb_y * 8 + (VAR_3 >> 2);", "if (VAR_0->profile != PROFILE_ADVANCED) {", "VAR_4 = av_clip(VAR_4, -8, s->mb_width * 8);", "VAR_5 = av_clip(VAR_5, -8, s->mb_height * 8);", "} else {", "VAR_4 = av_clip(VAR_4, -8, s->avctx->coded_width >> 1);", "VAR_5 = av_clip(VAR_5, -8, s->avctx->coded_height >> 1);", "}", "if (!VAR_1) {", "if (VAR_0->field_mode) {", "if ((VAR_0->cur_field_type != VAR_14) && VAR_0->cur_field_type) {", "srcU = s->current_picture.f.data[1];", "srcV = s->current_picture.f.data[2];", "} else {", "srcU = s->last_picture.f.data[1];", "srcV = s->last_picture.f.data[2];", "}", "} else {", "srcU = s->last_picture.f.data[1];", "srcV = s->last_picture.f.data[2];", "}", "} else {", "srcU = s->next_picture.f.data[1];", "srcV = s->next_picture.f.data[2];", "}", "if(!srcU)\nreturn;", "srcU += VAR_5 * s->uvlinesize + VAR_4;", "srcV += VAR_5 * s->uvlinesize + VAR_4;", "if (VAR_0->field_mode) {", "if (VAR_14) {", "srcU += s->current_picture_ptr->f.linesize[1];", "srcV += s->current_picture_ptr->f.linesize[2];", "}", "VAR_15 = VAR_0->second_field ? s->current_picture_ptr->f.linesize[1] : 0;", "}", "if (VAR_0->rangeredfrm || (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP)\n|| s->h_edge_pos < 18 || VAR_16 < 18\n|| (unsigned)VAR_4 > (s->h_edge_pos >> 1) - 9\n|| (unsigned)VAR_5 > (VAR_16 >> 1) - 9) {", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize,\n8 + 1, 8 + 1, VAR_4, VAR_5,\ns->h_edge_pos >> 1, VAR_16 >> 1);", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize,\n8 + 1, 8 + 1, VAR_4, VAR_5,\ns->h_edge_pos >> 1, VAR_16 >> 1);", "srcU = s->edge_emu_buffer;", "srcV = s->edge_emu_buffer + 16;", "if (VAR_0->rangeredfrm) {", "int VAR_20, VAR_20;", "uint8_t *src, *src2;", "src = srcU;", "src2 = srcV;", "for (VAR_20 = 0; VAR_20 < 9; VAR_20++) {", "for (VAR_20 = 0; VAR_20 < 9; VAR_20++) {", "src[VAR_20] = ((src[VAR_20] - 128) >> 1) + 128;", "src2[VAR_20] = ((src2[VAR_20] - 128) >> 1) + 128;", "}", "src += s->uvlinesize;", "src2 += s->uvlinesize;", "}", "}", "if (VAR_0->mv_mode == MV_PMODE_INTENSITY_COMP) {", "int VAR_20, VAR_20;", "uint8_t *src, *src2;", "src = srcU;", "src2 = srcV;", "for (VAR_20 = 0; VAR_20 < 9; VAR_20++) {", "for (VAR_20 = 0; VAR_20 < 9; VAR_20++) {", "src[VAR_20] = VAR_0->lutuv[src[VAR_20]];", "src2[VAR_20] = VAR_0->lutuv[src2[VAR_20]];", "}", "src += s->uvlinesize;", "src2 += s->uvlinesize;", "}", "}", "}", "VAR_2 = (VAR_2 & 3) << 1;", "VAR_3 = (VAR_3 & 3) << 1;", "if (!VAR_0->rnd) {", "h264chroma->put_h264_chroma_pixels_tab[0](s->dest[1] + VAR_15, srcU, s->uvlinesize, 8, VAR_2, VAR_3);", "h264chroma->put_h264_chroma_pixels_tab[0](s->dest[2] + VAR_15, srcV, s->uvlinesize, 8, VAR_2, VAR_3);", "} else {", "VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + VAR_15, srcU, s->uvlinesize, 8, VAR_2, VAR_3);", "VAR_0->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + VAR_15, srcV, s->uvlinesize, 8, VAR_2, VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181, 183 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209, 211, 213, 215 ], [ 217, 219, 221 ], [ 223, 225, 227 ], [ 229 ], [ 231 ], [ 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ] ]
2,966
PPC_OP(addc) { T2 = T0; T0 += T1; if (T0 < T2) { xer_ca = 1; } else { xer_ca = 0; } RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
PPC_OP(addc) { T2 = T0; T0 += T1; if (T0 < T2) { xer_ca = 1; } else { xer_ca = 0; } RETURN(); }
{ "code": [ " RETURN();", "PPC_OP(addc)", " T2 = T0;", " T0 += T1;", " if (T0 < T2) {", " xer_ca = 1;", " } else {", " xer_ca = 0;", " xer_ca = 1;", " } else {", " xer_ca = 0;", " xer_ca = 1;", " } else {", " T2 = T0;", " T0 += T1;", " } else {", " T2 = T0;", " T0 += T1;", " xer_ca = 0;", " } else {", " xer_ca = 1;", " } else {", " } else {", " xer_ca = 0;", " } else {", " T2 = T0;", " RETURN();", " T2 = T0;", " xer_ca = 0;", " } else {", " xer_ca = 1;", " T2 = T0;", " xer_ca = 0;", " } else {" ], "line_no": [ 19, 1, 5, 7, 9, 11, 13, 15, 11, 13, 15, 11, 13, 5, 7, 13, 5, 7, 15, 13, 11, 13, 13, 15, 13, 5, 19, 5, 15, 13, 11, 5, 15, 13 ] }
FUNC_0(VAR_0) { T2 = T0; T0 += T1; if (T0 < T2) { xer_ca = 1; } else { xer_ca = 0; } RETURN(); }
[ "FUNC_0(VAR_0)\n{", "T2 = T0;", "T0 += T1;", "if (T0 < T2) {", "xer_ca = 1;", "} else {", "xer_ca = 0;", "}", "RETURN();", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
2,968
static void spapr_phb_class_init(ObjectClass *klass, void *data) { PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); HotplugHandlerClass *hp = HOTPLUG_HANDLER_CLASS(klass); hc->root_bus_path = spapr_phb_root_bus_path; dc->realize = spapr_phb_realize; dc->props = spapr_phb_properties; dc->reset = spapr_phb_reset; dc->vmsd = &vmstate_spapr_pci; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); hp->plug = spapr_phb_hot_plug_child; hp->unplug = spapr_phb_hot_unplug_child; }
true
qemu
e4f4fb1eca795e36f363b4647724221e774523c1
static void spapr_phb_class_init(ObjectClass *klass, void *data) { PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); HotplugHandlerClass *hp = HOTPLUG_HANDLER_CLASS(klass); hc->root_bus_path = spapr_phb_root_bus_path; dc->realize = spapr_phb_realize; dc->props = spapr_phb_properties; dc->reset = spapr_phb_reset; dc->vmsd = &vmstate_spapr_pci; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); hp->plug = spapr_phb_hot_plug_child; hp->unplug = spapr_phb_hot_unplug_child; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(VAR_0); DeviceClass *dc = DEVICE_CLASS(VAR_0); HotplugHandlerClass *hp = HOTPLUG_HANDLER_CLASS(VAR_0); hc->root_bus_path = spapr_phb_root_bus_path; dc->realize = spapr_phb_realize; dc->props = spapr_phb_properties; dc->reset = spapr_phb_reset; dc->vmsd = &vmstate_spapr_pci; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); hp->plug = spapr_phb_hot_plug_child; hp->unplug = spapr_phb_hot_unplug_child; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(VAR_0);", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "HotplugHandlerClass *hp = HOTPLUG_HANDLER_CLASS(VAR_0);", "hc->root_bus_path = spapr_phb_root_bus_path;", "dc->realize = spapr_phb_realize;", "dc->props = spapr_phb_properties;", "dc->reset = spapr_phb_reset;", "dc->vmsd = &vmstate_spapr_pci;", "set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);", "hp->plug = spapr_phb_hot_plug_child;", "hp->unplug = spapr_phb_hot_unplug_child;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
2,969
int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count, const uint8_t *in_arg [SWR_CH_MAX], int in_count){ AudioData * in= &s->in; AudioData *out= &s->out; if (!swr_is_initialized(s)) { av_log(s, AV_LOG_ERROR, "Context has not been initialized\n"); return AVERROR(EINVAL); } while(s->drop_output > 0){ int ret; uint8_t *tmp_arg[SWR_CH_MAX]; #define MAX_DROP_STEP 16384 if((ret=swri_realloc_audio(&s->drop_temp, FFMIN(s->drop_output, MAX_DROP_STEP)))<0) return ret; reversefill_audiodata(&s->drop_temp, tmp_arg); s->drop_output *= -1; //FIXME find a less hackish solution ret = swr_convert(s, tmp_arg, FFMIN(-s->drop_output, MAX_DROP_STEP), in_arg, in_count); //FIXME optimize but this is as good as never called so maybe it doesn't matter s->drop_output *= -1; in_count = 0; if(ret>0) { s->drop_output -= ret; if (!s->drop_output && !out_arg) return 0; continue; } av_assert0(s->drop_output); return 0; } if(!in_arg){ if(s->resample){ if (!s->flushed) s->resampler->flush(s); s->resample_in_constraint = 0; s->flushed = 1; }else if(!s->in_buffer_count){ return 0; } }else fill_audiodata(in , (void*)in_arg); fill_audiodata(out, out_arg); if(s->resample){ int ret = swr_convert_internal(s, out, out_count, in, in_count); if(ret>0 && !s->drop_output) s->outpts += ret * (int64_t)s->in_sample_rate; return ret; }else{ AudioData tmp= *in; int ret2=0; int ret, size; size = FFMIN(out_count, s->in_buffer_count); if(size){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); ret= swr_convert_internal(s, out, size, &tmp, size); if(ret<0) return ret; ret2= ret; s->in_buffer_count -= ret; s->in_buffer_index += ret; buf_set(out, out, ret); out_count -= ret; if(!s->in_buffer_count) s->in_buffer_index = 0; } if(in_count){ size= s->in_buffer_index + s->in_buffer_count + in_count - out_count; if(in_count > out_count) { //FIXME move after swr_convert_internal if( size > s->in_buffer.count && s->in_buffer_count + in_count - out_count <= s->in_buffer_index){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); copy(&s->in_buffer, &tmp, s->in_buffer_count); s->in_buffer_index=0; }else if((ret=swri_realloc_audio(&s->in_buffer, size)) < 0) return ret; } if(out_count){ size = FFMIN(in_count, out_count); ret= swr_convert_internal(s, out, size, in, size); if(ret<0) return ret; buf_set(in, in, ret); in_count -= ret; ret2 += ret; } if(in_count){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index + s->in_buffer_count); copy(&tmp, in, in_count); s->in_buffer_count += in_count; } } if(ret2>0 && !s->drop_output) s->outpts += ret2 * (int64_t)s->in_sample_rate; return ret2; } }
true
FFmpeg
adb7372f7495927a226edf9b8e1d0ac9453985ea
int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count, const uint8_t *in_arg [SWR_CH_MAX], int in_count){ AudioData * in= &s->in; AudioData *out= &s->out; if (!swr_is_initialized(s)) { av_log(s, AV_LOG_ERROR, "Context has not been initialized\n"); return AVERROR(EINVAL); } while(s->drop_output > 0){ int ret; uint8_t *tmp_arg[SWR_CH_MAX]; #define MAX_DROP_STEP 16384 if((ret=swri_realloc_audio(&s->drop_temp, FFMIN(s->drop_output, MAX_DROP_STEP)))<0) return ret; reversefill_audiodata(&s->drop_temp, tmp_arg); s->drop_output *= -1; ret = swr_convert(s, tmp_arg, FFMIN(-s->drop_output, MAX_DROP_STEP), in_arg, in_count); s->drop_output *= -1; in_count = 0; if(ret>0) { s->drop_output -= ret; if (!s->drop_output && !out_arg) return 0; continue; } av_assert0(s->drop_output); return 0; } if(!in_arg){ if(s->resample){ if (!s->flushed) s->resampler->flush(s); s->resample_in_constraint = 0; s->flushed = 1; }else if(!s->in_buffer_count){ return 0; } }else fill_audiodata(in , (void*)in_arg); fill_audiodata(out, out_arg); if(s->resample){ int ret = swr_convert_internal(s, out, out_count, in, in_count); if(ret>0 && !s->drop_output) s->outpts += ret * (int64_t)s->in_sample_rate; return ret; }else{ AudioData tmp= *in; int ret2=0; int ret, size; size = FFMIN(out_count, s->in_buffer_count); if(size){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); ret= swr_convert_internal(s, out, size, &tmp, size); if(ret<0) return ret; ret2= ret; s->in_buffer_count -= ret; s->in_buffer_index += ret; buf_set(out, out, ret); out_count -= ret; if(!s->in_buffer_count) s->in_buffer_index = 0; } if(in_count){ size= s->in_buffer_index + s->in_buffer_count + in_count - out_count; if(in_count > out_count) { if( size > s->in_buffer.count && s->in_buffer_count + in_count - out_count <= s->in_buffer_index){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); copy(&s->in_buffer, &tmp, s->in_buffer_count); s->in_buffer_index=0; }else if((ret=swri_realloc_audio(&s->in_buffer, size)) < 0) return ret; } if(out_count){ size = FFMIN(in_count, out_count); ret= swr_convert_internal(s, out, size, in, size); if(ret<0) return ret; buf_set(in, in, ret); in_count -= ret; ret2 += ret; } if(in_count){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index + s->in_buffer_count); copy(&tmp, in, in_count); s->in_buffer_count += in_count; } } if(ret2>0 && !s->drop_output) s->outpts += ret2 * (int64_t)s->in_sample_rate; return ret2; } }
{ "code": [ "int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count,", " const uint8_t *in_arg [SWR_CH_MAX], int in_count){" ], "line_no": [ 1, 3 ] }
int FUNC_0(struct SwrContext *VAR_0, uint8_t *VAR_1[SWR_CH_MAX], int VAR_2, const uint8_t *VAR_3 [SWR_CH_MAX], int VAR_4){ AudioData * in= &VAR_0->in; AudioData *out= &VAR_0->out; if (!swr_is_initialized(VAR_0)) { av_log(VAR_0, AV_LOG_ERROR, "Context has not been initialized\n"); return AVERROR(EINVAL); } while(VAR_0->drop_output > 0){ int VAR_7; uint8_t *tmp_arg[SWR_CH_MAX]; #define MAX_DROP_STEP 16384 if((VAR_7=swri_realloc_audio(&VAR_0->drop_temp, FFMIN(VAR_0->drop_output, MAX_DROP_STEP)))<0) return VAR_7; reversefill_audiodata(&VAR_0->drop_temp, tmp_arg); VAR_0->drop_output *= -1; VAR_7 = FUNC_0(VAR_0, tmp_arg, FFMIN(-VAR_0->drop_output, MAX_DROP_STEP), VAR_3, VAR_4); VAR_0->drop_output *= -1; VAR_4 = 0; if(VAR_7>0) { VAR_0->drop_output -= VAR_7; if (!VAR_0->drop_output && !VAR_1) return 0; continue; } av_assert0(VAR_0->drop_output); return 0; } if(!VAR_3){ if(VAR_0->resample){ if (!VAR_0->flushed) VAR_0->resampler->flush(VAR_0); VAR_0->resample_in_constraint = 0; VAR_0->flushed = 1; }else if(!VAR_0->in_buffer_count){ return 0; } }else fill_audiodata(in , (void*)VAR_3); fill_audiodata(out, VAR_1); if(VAR_0->resample){ int VAR_7 = swr_convert_internal(VAR_0, out, VAR_2, in, VAR_4); if(VAR_7>0 && !VAR_0->drop_output) VAR_0->outpts += VAR_7 * (int64_t)VAR_0->in_sample_rate; return VAR_7; }else{ AudioData tmp= *in; int VAR_6=0; int VAR_7, VAR_7; VAR_7 = FFMIN(VAR_2, VAR_0->in_buffer_count); if(VAR_7){ buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index); VAR_7= swr_convert_internal(VAR_0, out, VAR_7, &tmp, VAR_7); if(VAR_7<0) return VAR_7; VAR_6= VAR_7; VAR_0->in_buffer_count -= VAR_7; VAR_0->in_buffer_index += VAR_7; buf_set(out, out, VAR_7); VAR_2 -= VAR_7; if(!VAR_0->in_buffer_count) VAR_0->in_buffer_index = 0; } if(VAR_4){ VAR_7= VAR_0->in_buffer_index + VAR_0->in_buffer_count + VAR_4 - VAR_2; if(VAR_4 > VAR_2) { if( VAR_7 > VAR_0->in_buffer.count && VAR_0->in_buffer_count + VAR_4 - VAR_2 <= VAR_0->in_buffer_index){ buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index); copy(&VAR_0->in_buffer, &tmp, VAR_0->in_buffer_count); VAR_0->in_buffer_index=0; }else if((VAR_7=swri_realloc_audio(&VAR_0->in_buffer, VAR_7)) < 0) return VAR_7; } if(VAR_2){ VAR_7 = FFMIN(VAR_4, VAR_2); VAR_7= swr_convert_internal(VAR_0, out, VAR_7, in, VAR_7); if(VAR_7<0) return VAR_7; buf_set(in, in, VAR_7); VAR_4 -= VAR_7; VAR_6 += VAR_7; } if(VAR_4){ buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index + VAR_0->in_buffer_count); copy(&tmp, in, VAR_4); VAR_0->in_buffer_count += VAR_4; } } if(VAR_6>0 && !VAR_0->drop_output) VAR_0->outpts += VAR_6 * (int64_t)VAR_0->in_sample_rate; return VAR_6; } }
[ "int FUNC_0(struct SwrContext *VAR_0, uint8_t *VAR_1[SWR_CH_MAX], int VAR_2,\nconst uint8_t *VAR_3 [SWR_CH_MAX], int VAR_4){", "AudioData * in= &VAR_0->in;", "AudioData *out= &VAR_0->out;", "if (!swr_is_initialized(VAR_0)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Context has not been initialized\\n\");", "return AVERROR(EINVAL);", "}", "while(VAR_0->drop_output > 0){", "int VAR_7;", "uint8_t *tmp_arg[SWR_CH_MAX];", "#define MAX_DROP_STEP 16384\nif((VAR_7=swri_realloc_audio(&VAR_0->drop_temp, FFMIN(VAR_0->drop_output, MAX_DROP_STEP)))<0)\nreturn VAR_7;", "reversefill_audiodata(&VAR_0->drop_temp, tmp_arg);", "VAR_0->drop_output *= -1;", "VAR_7 = FUNC_0(VAR_0, tmp_arg, FFMIN(-VAR_0->drop_output, MAX_DROP_STEP), VAR_3, VAR_4);", "VAR_0->drop_output *= -1;", "VAR_4 = 0;", "if(VAR_7>0) {", "VAR_0->drop_output -= VAR_7;", "if (!VAR_0->drop_output && !VAR_1)\nreturn 0;", "continue;", "}", "av_assert0(VAR_0->drop_output);", "return 0;", "}", "if(!VAR_3){", "if(VAR_0->resample){", "if (!VAR_0->flushed)\nVAR_0->resampler->flush(VAR_0);", "VAR_0->resample_in_constraint = 0;", "VAR_0->flushed = 1;", "}else if(!VAR_0->in_buffer_count){", "return 0;", "}", "}else", "fill_audiodata(in , (void*)VAR_3);", "fill_audiodata(out, VAR_1);", "if(VAR_0->resample){", "int VAR_7 = swr_convert_internal(VAR_0, out, VAR_2, in, VAR_4);", "if(VAR_7>0 && !VAR_0->drop_output)\nVAR_0->outpts += VAR_7 * (int64_t)VAR_0->in_sample_rate;", "return VAR_7;", "}else{", "AudioData tmp= *in;", "int VAR_6=0;", "int VAR_7, VAR_7;", "VAR_7 = FFMIN(VAR_2, VAR_0->in_buffer_count);", "if(VAR_7){", "buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index);", "VAR_7= swr_convert_internal(VAR_0, out, VAR_7, &tmp, VAR_7);", "if(VAR_7<0)\nreturn VAR_7;", "VAR_6= VAR_7;", "VAR_0->in_buffer_count -= VAR_7;", "VAR_0->in_buffer_index += VAR_7;", "buf_set(out, out, VAR_7);", "VAR_2 -= VAR_7;", "if(!VAR_0->in_buffer_count)\nVAR_0->in_buffer_index = 0;", "}", "if(VAR_4){", "VAR_7= VAR_0->in_buffer_index + VAR_0->in_buffer_count + VAR_4 - VAR_2;", "if(VAR_4 > VAR_2) {", "if( VAR_7 > VAR_0->in_buffer.count\n&& VAR_0->in_buffer_count + VAR_4 - VAR_2 <= VAR_0->in_buffer_index){", "buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index);", "copy(&VAR_0->in_buffer, &tmp, VAR_0->in_buffer_count);", "VAR_0->in_buffer_index=0;", "}else", "if((VAR_7=swri_realloc_audio(&VAR_0->in_buffer, VAR_7)) < 0)\nreturn VAR_7;", "}", "if(VAR_2){", "VAR_7 = FFMIN(VAR_4, VAR_2);", "VAR_7= swr_convert_internal(VAR_0, out, VAR_7, in, VAR_7);", "if(VAR_7<0)\nreturn VAR_7;", "buf_set(in, in, VAR_7);", "VAR_4 -= VAR_7;", "VAR_6 += VAR_7;", "}", "if(VAR_4){", "buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index + VAR_0->in_buffer_count);", "copy(&tmp, in, VAR_4);", "VAR_0->in_buffer_count += VAR_4;", "}", "}", "if(VAR_6>0 && !VAR_0->drop_output)\nVAR_0->outpts += VAR_6 * (int64_t)VAR_0->in_sample_rate;", "return VAR_6;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 143 ], [ 145 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ] ]
2,970
static void spapr_machine_2_6_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); spapr_machine_2_7_class_options(mc); smc->dr_cpu_enabled = false; SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6); }
true
qemu
3c0c47e3464f3c54bd3f1cc6d4da2cbf7465e295
static void spapr_machine_2_6_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); spapr_machine_2_7_class_options(mc); smc->dr_cpu_enabled = false; SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6); }
{ "code": [ " sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);", " smc->dr_cpu_enabled = false;" ], "line_no": [ 5, 11 ] }
static void FUNC_0(MachineClass *VAR_0) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(VAR_0); spapr_machine_2_7_class_options(VAR_0); smc->dr_cpu_enabled = false; SET_MACHINE_COMPAT(VAR_0, SPAPR_COMPAT_2_6); }
[ "static void FUNC_0(MachineClass *VAR_0)\n{", "sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(VAR_0);", "spapr_machine_2_7_class_options(VAR_0);", "smc->dr_cpu_enabled = false;", "SET_MACHINE_COMPAT(VAR_0, SPAPR_COMPAT_2_6);", "}" ]
[ 0, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
2,971
static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set) { mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets)); if (!mxf->metadata_sets) return -1; mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set; mxf->metadata_sets_count++; return 0; }
true
FFmpeg
b4800b8b7dfba22117d8edd02164b00c83ae3753
static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set) { mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets)); if (!mxf->metadata_sets) return -1; mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set; mxf->metadata_sets_count++; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MXFContext *VAR_0, void *VAR_1) { VAR_0->metadata_sets = av_realloc(VAR_0->metadata_sets, (VAR_0->metadata_sets_count + 1) * sizeof(*VAR_0->metadata_sets)); if (!VAR_0->metadata_sets) return -1; VAR_0->metadata_sets[VAR_0->metadata_sets_count] = VAR_1; VAR_0->metadata_sets_count++; return 0; }
[ "static int FUNC_0(MXFContext *VAR_0, void *VAR_1)\n{", "VAR_0->metadata_sets = av_realloc(VAR_0->metadata_sets, (VAR_0->metadata_sets_count + 1) * sizeof(*VAR_0->metadata_sets));", "if (!VAR_0->metadata_sets)\nreturn -1;", "VAR_0->metadata_sets[VAR_0->metadata_sets_count] = VAR_1;", "VAR_0->metadata_sets_count++;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
2,972
monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) { CPUDebug *s = container_of(info, CPUDebug, info); if (monitor_disas_is_physical) { cpu_physical_memory_read(memaddr, myaddr, length); } else { cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); } return 0; }
true
qemu
b8d8720892f7912e8a2621b30ebac0e9a48e89e3
monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) { CPUDebug *s = container_of(info, CPUDebug, info); if (monitor_disas_is_physical) { cpu_physical_memory_read(memaddr, myaddr, length); } else { cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); } return 0; }
{ "code": [ "monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,", " CPUDebug *s = container_of(info, CPUDebug, info);", " if (monitor_disas_is_physical) {", " cpu_physical_memory_read(memaddr, myaddr, length);", " } else {", " cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);" ], "line_no": [ 1, 7, 11, 13, 15, 17 ] }
FUNC_0 (bfd_vma VAR_0, bfd_byte *VAR_1, int VAR_2, struct disassemble_info *VAR_3) { CPUDebug *s = container_of(VAR_3, CPUDebug, VAR_3); if (monitor_disas_is_physical) { cpu_physical_memory_read(VAR_0, VAR_1, VAR_2); } else { cpu_memory_rw_debug(s->cpu, VAR_0, VAR_1, VAR_2, 0); } return 0; }
[ "FUNC_0 (bfd_vma VAR_0, bfd_byte *VAR_1, int VAR_2,\nstruct disassemble_info *VAR_3)\n{", "CPUDebug *s = container_of(VAR_3, CPUDebug, VAR_3);", "if (monitor_disas_is_physical) {", "cpu_physical_memory_read(VAR_0, VAR_1, VAR_2);", "} else {", "cpu_memory_rw_debug(s->cpu, VAR_0, VAR_1, VAR_2, 0);", "}", "return 0;", "}" ]
[ 1, 1, 1, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
2,974
static int ftp_type(FTPContext *s) { const char *command = "TYPE I\r\n"; const int type_codes[] = {200, 0}; if (!ftp_send_command(s, command, type_codes, NULL)) return AVERROR(EIO); return 0; }
false
FFmpeg
ddbcc48b646737c8bff7f8e28e0a69dca65509cf
static int ftp_type(FTPContext *s) { const char *command = "TYPE I\r\n"; const int type_codes[] = {200, 0}; if (!ftp_send_command(s, command, type_codes, NULL)) return AVERROR(EIO); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FTPContext *VAR_0) { const char *VAR_1 = "TYPE I\r\n"; const int VAR_2[] = {200, 0}; if (!ftp_send_command(VAR_0, VAR_1, VAR_2, NULL)) return AVERROR(EIO); return 0; }
[ "static int FUNC_0(FTPContext *VAR_0)\n{", "const char *VAR_1 = \"TYPE I\\r\\n\";", "const int VAR_2[] = {200, 0};", "if (!ftp_send_command(VAR_0, VAR_1, VAR_2, NULL))\nreturn AVERROR(EIO);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ] ]
2,975
static int shorten_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ShortenContext *s = avctx->priv_data; int i, input_buf_size = 0; int ret; /* allocate internal bitstream buffer */ if (s->max_framesize == 0) { void *tmp_ptr; s->max_framesize = 8192; // should hopefully be enough for the first header tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE); if (!tmp_ptr) { av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n"); return AVERROR(ENOMEM); } memset(tmp_ptr, 0, s->allocated_bitstream_size); s->bitstream = tmp_ptr; } /* append current packet data to bitstream buffer */ if (1 && s->max_framesize) { //FIXME truncated buf_size = FFMIN(buf_size, s->max_framesize - s->bitstream_size); input_buf_size = buf_size; if (s->bitstream_index + s->bitstream_size + buf_size + FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_size) { memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); s->bitstream_index = 0; } if (buf) memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size); buf = &s->bitstream[s->bitstream_index]; buf_size += s->bitstream_size; s->bitstream_size = buf_size; /* do not decode until buffer has at least max_framesize bytes or * the end of the file has been reached */ if (buf_size < s->max_framesize && avpkt->data) { *got_frame_ptr = 0; return input_buf_size; } } /* init and position bitstream reader */ init_get_bits(&s->gb, buf, buf_size * 8); skip_bits(&s->gb, s->bitindex); /* process header or next subblock */ if (!s->got_header) { if ((ret = read_header(s)) < 0) return ret; *got_frame_ptr = 0; goto finish_frame; } /* if quit command was read previously, don't decode anything */ if (s->got_quit_command) { *got_frame_ptr = 0; return avpkt->size; } s->cur_chan = 0; while (s->cur_chan < s->channels) { unsigned cmd; int len; if (get_bits_left(&s->gb) < 3 + FNSIZE) { *got_frame_ptr = 0; break; } cmd = get_ur_golomb_shorten(&s->gb, FNSIZE); if (cmd > FN_VERBATIM) { av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd); *got_frame_ptr = 0; break; } if (!is_audio_command[cmd]) { /* process non-audio command */ switch (cmd) { case FN_VERBATIM: len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE); while (len--) get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); break; case FN_BITSHIFT: s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE); break; case FN_BLOCKSIZE: { unsigned blocksize = get_uint(s, av_log2(s->blocksize)); if (blocksize > s->blocksize) { av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n"); return AVERROR_PATCHWELCOME; } if (!blocksize || blocksize > MAX_BLOCKSIZE) { av_log(avctx, AV_LOG_ERROR, "invalid or unsupported " "block size: %d\n", blocksize); return AVERROR(EINVAL); } s->blocksize = blocksize; break; } case FN_QUIT: s->got_quit_command = 1; break; } if (cmd == FN_BLOCKSIZE || cmd == FN_QUIT) { *got_frame_ptr = 0; break; } } else { /* process audio command */ int residual_size = 0; int channel = s->cur_chan; int32_t coffset; /* get Rice code for residual decoding */ if (cmd != FN_ZERO) { residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE); /* This is a hack as version 0 differed in the definition * of get_sr_golomb_shorten(). */ if (s->version == 0) residual_size--; } /* calculate sample offset using means from previous blocks */ if (s->nmean == 0) coffset = s->offset[channel][0]; else { int32_t sum = (s->version < 2) ? 0 : s->nmean / 2; for (i = 0; i < s->nmean; i++) sum += s->offset[channel][i]; coffset = sum / s->nmean; if (s->version >= 2) coffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1; } /* decode samples for this channel */ if (cmd == FN_ZERO) { for (i = 0; i < s->blocksize; i++) s->decoded[channel][i] = 0; } else { if ((ret = decode_subframe_lpc(s, cmd, channel, residual_size, coffset)) < 0) return ret; } /* update means with info from the current block */ if (s->nmean > 0) { int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2; for (i = 0; i < s->blocksize; i++) sum += s->decoded[channel][i]; for (i = 1; i < s->nmean; i++) s->offset[channel][i - 1] = s->offset[channel][i]; if (s->version < 2) s->offset[channel][s->nmean - 1] = sum / s->blocksize; else s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift; } /* copy wrap samples for use with next block */ for (i = -s->nwrap; i < 0; i++) s->decoded[channel][i] = s->decoded[channel][i + s->blocksize]; /* shift samples to add in unused zero bits which were removed * during encoding */ fix_bitshift(s, s->decoded[channel]); /* if this is the last channel in the block, output the samples */ s->cur_chan++; if (s->cur_chan == s->channels) { uint8_t *samples_u8; int16_t *samples_s16; int chan; /* get output buffer */ frame->nb_samples = s->blocksize; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; for (chan = 0; chan < s->channels; chan++) { samples_u8 = ((uint8_t **)frame->extended_data)[chan]; samples_s16 = ((int16_t **)frame->extended_data)[chan]; for (i = 0; i < s->blocksize; i++) { switch (s->internal_ftype) { case TYPE_U8: *samples_u8++ = av_clip_uint8(s->decoded[chan][i]); break; case TYPE_S16HL: case TYPE_S16LH: *samples_s16++ = av_clip_int16(s->decoded[chan][i]); break; } } } *got_frame_ptr = 1; } } } if (s->cur_chan < s->channels) *got_frame_ptr = 0; finish_frame: s->bitindex = get_bits_count(&s->gb) - 8 * (get_bits_count(&s->gb) / 8); i = get_bits_count(&s->gb) / 8; if (i > buf_size) { av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size); s->bitstream_size = 0; s->bitstream_index = 0; return AVERROR_INVALIDDATA; } if (s->bitstream_size) { s->bitstream_index += i; s->bitstream_size -= i; return input_buf_size; } else return i; }
false
FFmpeg
e20ebe491c17388a312e04ff060c217ecfafc914
static int shorten_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ShortenContext *s = avctx->priv_data; int i, input_buf_size = 0; int ret; if (s->max_framesize == 0) { void *tmp_ptr; s->max_framesize = 8192; tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE); if (!tmp_ptr) { av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n"); return AVERROR(ENOMEM); } memset(tmp_ptr, 0, s->allocated_bitstream_size); s->bitstream = tmp_ptr; } if (1 && s->max_framesize) { buf_size = FFMIN(buf_size, s->max_framesize - s->bitstream_size); input_buf_size = buf_size; if (s->bitstream_index + s->bitstream_size + buf_size + FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_size) { memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); s->bitstream_index = 0; } if (buf) memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size); buf = &s->bitstream[s->bitstream_index]; buf_size += s->bitstream_size; s->bitstream_size = buf_size; if (buf_size < s->max_framesize && avpkt->data) { *got_frame_ptr = 0; return input_buf_size; } } init_get_bits(&s->gb, buf, buf_size * 8); skip_bits(&s->gb, s->bitindex); if (!s->got_header) { if ((ret = read_header(s)) < 0) return ret; *got_frame_ptr = 0; goto finish_frame; } if (s->got_quit_command) { *got_frame_ptr = 0; return avpkt->size; } s->cur_chan = 0; while (s->cur_chan < s->channels) { unsigned cmd; int len; if (get_bits_left(&s->gb) < 3 + FNSIZE) { *got_frame_ptr = 0; break; } cmd = get_ur_golomb_shorten(&s->gb, FNSIZE); if (cmd > FN_VERBATIM) { av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd); *got_frame_ptr = 0; break; } if (!is_audio_command[cmd]) { switch (cmd) { case FN_VERBATIM: len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE); while (len--) get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); break; case FN_BITSHIFT: s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE); break; case FN_BLOCKSIZE: { unsigned blocksize = get_uint(s, av_log2(s->blocksize)); if (blocksize > s->blocksize) { av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n"); return AVERROR_PATCHWELCOME; } if (!blocksize || blocksize > MAX_BLOCKSIZE) { av_log(avctx, AV_LOG_ERROR, "invalid or unsupported " "block size: %d\n", blocksize); return AVERROR(EINVAL); } s->blocksize = blocksize; break; } case FN_QUIT: s->got_quit_command = 1; break; } if (cmd == FN_BLOCKSIZE || cmd == FN_QUIT) { *got_frame_ptr = 0; break; } } else { int residual_size = 0; int channel = s->cur_chan; int32_t coffset; if (cmd != FN_ZERO) { residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE); if (s->version == 0) residual_size--; } if (s->nmean == 0) coffset = s->offset[channel][0]; else { int32_t sum = (s->version < 2) ? 0 : s->nmean / 2; for (i = 0; i < s->nmean; i++) sum += s->offset[channel][i]; coffset = sum / s->nmean; if (s->version >= 2) coffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1; } if (cmd == FN_ZERO) { for (i = 0; i < s->blocksize; i++) s->decoded[channel][i] = 0; } else { if ((ret = decode_subframe_lpc(s, cmd, channel, residual_size, coffset)) < 0) return ret; } if (s->nmean > 0) { int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2; for (i = 0; i < s->blocksize; i++) sum += s->decoded[channel][i]; for (i = 1; i < s->nmean; i++) s->offset[channel][i - 1] = s->offset[channel][i]; if (s->version < 2) s->offset[channel][s->nmean - 1] = sum / s->blocksize; else s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift; } for (i = -s->nwrap; i < 0; i++) s->decoded[channel][i] = s->decoded[channel][i + s->blocksize]; fix_bitshift(s, s->decoded[channel]); s->cur_chan++; if (s->cur_chan == s->channels) { uint8_t *samples_u8; int16_t *samples_s16; int chan; frame->nb_samples = s->blocksize; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; for (chan = 0; chan < s->channels; chan++) { samples_u8 = ((uint8_t **)frame->extended_data)[chan]; samples_s16 = ((int16_t **)frame->extended_data)[chan]; for (i = 0; i < s->blocksize; i++) { switch (s->internal_ftype) { case TYPE_U8: *samples_u8++ = av_clip_uint8(s->decoded[chan][i]); break; case TYPE_S16HL: case TYPE_S16LH: *samples_s16++ = av_clip_int16(s->decoded[chan][i]); break; } } } *got_frame_ptr = 1; } } } if (s->cur_chan < s->channels) *got_frame_ptr = 0; finish_frame: s->bitindex = get_bits_count(&s->gb) - 8 * (get_bits_count(&s->gb) / 8); i = get_bits_count(&s->gb) / 8; if (i > buf_size) { av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size); s->bitstream_size = 0; s->bitstream_index = 0; return AVERROR_INVALIDDATA; } if (s->bitstream_size) { s->bitstream_index += i; s->bitstream_size -= i; return input_buf_size; } else return i; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { AVFrame *frame = VAR_1; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; ShortenContext *s = VAR_0->priv_data; int VAR_6, VAR_7 = 0; int VAR_8; if (s->max_framesize == 0) { void *VAR_9; s->max_framesize = 8192; VAR_9 = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_9) { av_log(VAR_0, AV_LOG_ERROR, "error allocating bitstream buffer\n"); return AVERROR(ENOMEM); } memset(VAR_9, 0, s->allocated_bitstream_size); s->bitstream = VAR_9; } if (1 && s->max_framesize) { VAR_5 = FFMIN(VAR_5, s->max_framesize - s->bitstream_size); VAR_7 = VAR_5; if (s->bitstream_index + s->bitstream_size + VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_size) { memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); s->bitstream_index = 0; } if (VAR_4) memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], VAR_4, VAR_5); VAR_4 = &s->bitstream[s->bitstream_index]; VAR_5 += s->bitstream_size; s->bitstream_size = VAR_5; if (VAR_5 < s->max_framesize && VAR_3->VAR_1) { *VAR_2 = 0; return VAR_7; } } init_get_bits(&s->gb, VAR_4, VAR_5 * 8); skip_bits(&s->gb, s->bitindex); if (!s->got_header) { if ((VAR_8 = read_header(s)) < 0) return VAR_8; *VAR_2 = 0; goto finish_frame; } if (s->got_quit_command) { *VAR_2 = 0; return VAR_3->size; } s->cur_chan = 0; while (s->cur_chan < s->channels) { unsigned VAR_10; int VAR_11; if (get_bits_left(&s->gb) < 3 + FNSIZE) { *VAR_2 = 0; break; } VAR_10 = get_ur_golomb_shorten(&s->gb, FNSIZE); if (VAR_10 > FN_VERBATIM) { av_log(VAR_0, AV_LOG_ERROR, "unknown shorten function %d\n", VAR_10); *VAR_2 = 0; break; } if (!is_audio_command[VAR_10]) { switch (VAR_10) { case FN_VERBATIM: VAR_11 = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE); while (VAR_11--) get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); break; case FN_BITSHIFT: s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE); break; case FN_BLOCKSIZE: { unsigned VAR_12 = get_uint(s, av_log2(s->VAR_12)); if (VAR_12 > s->VAR_12) { av_log(VAR_0, AV_LOG_ERROR, "Increasing block size is not supported\n"); return AVERROR_PATCHWELCOME; } if (!VAR_12 || VAR_12 > MAX_BLOCKSIZE) { av_log(VAR_0, AV_LOG_ERROR, "invalid or unsupported " "block size: %d\n", VAR_12); return AVERROR(EINVAL); } s->VAR_12 = VAR_12; break; } case FN_QUIT: s->got_quit_command = 1; break; } if (VAR_10 == FN_BLOCKSIZE || VAR_10 == FN_QUIT) { *VAR_2 = 0; break; } } else { int VAR_13 = 0; int VAR_14 = s->cur_chan; int32_t coffset; if (VAR_10 != FN_ZERO) { VAR_13 = get_ur_golomb_shorten(&s->gb, ENERGYSIZE); if (s->version == 0) VAR_13--; } if (s->nmean == 0) coffset = s->offset[VAR_14][0]; else { int32_t sum = (s->version < 2) ? 0 : s->nmean / 2; for (VAR_6 = 0; VAR_6 < s->nmean; VAR_6++) sum += s->offset[VAR_14][VAR_6]; coffset = sum / s->nmean; if (s->version >= 2) coffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1; } if (VAR_10 == FN_ZERO) { for (VAR_6 = 0; VAR_6 < s->VAR_12; VAR_6++) s->decoded[VAR_14][VAR_6] = 0; } else { if ((VAR_8 = decode_subframe_lpc(s, VAR_10, VAR_14, VAR_13, coffset)) < 0) return VAR_8; } if (s->nmean > 0) { int32_t sum = (s->version < 2) ? 0 : s->VAR_12 / 2; for (VAR_6 = 0; VAR_6 < s->VAR_12; VAR_6++) sum += s->decoded[VAR_14][VAR_6]; for (VAR_6 = 1; VAR_6 < s->nmean; VAR_6++) s->offset[VAR_14][VAR_6 - 1] = s->offset[VAR_14][VAR_6]; if (s->version < 2) s->offset[VAR_14][s->nmean - 1] = sum / s->VAR_12; else s->offset[VAR_14][s->nmean - 1] = (sum / s->VAR_12) << s->bitshift; } for (VAR_6 = -s->nwrap; VAR_6 < 0; VAR_6++) s->decoded[VAR_14][VAR_6] = s->decoded[VAR_14][VAR_6 + s->VAR_12]; fix_bitshift(s, s->decoded[VAR_14]); s->cur_chan++; if (s->cur_chan == s->channels) { uint8_t *samples_u8; int16_t *samples_s16; int VAR_15; frame->nb_samples = s->VAR_12; if ((VAR_8 = ff_get_buffer(VAR_0, frame, 0)) < 0) return VAR_8; for (VAR_15 = 0; VAR_15 < s->channels; VAR_15++) { samples_u8 = ((uint8_t **)frame->extended_data)[VAR_15]; samples_s16 = ((int16_t **)frame->extended_data)[VAR_15]; for (VAR_6 = 0; VAR_6 < s->VAR_12; VAR_6++) { switch (s->internal_ftype) { case TYPE_U8: *samples_u8++ = av_clip_uint8(s->decoded[VAR_15][VAR_6]); break; case TYPE_S16HL: case TYPE_S16LH: *samples_s16++ = av_clip_int16(s->decoded[VAR_15][VAR_6]); break; } } } *VAR_2 = 1; } } } if (s->cur_chan < s->channels) *VAR_2 = 0; finish_frame: s->bitindex = get_bits_count(&s->gb) - 8 * (get_bits_count(&s->gb) / 8); VAR_6 = get_bits_count(&s->gb) / 8; if (VAR_6 > VAR_5) { av_log(s->VAR_0, AV_LOG_ERROR, "overread: %d\n", VAR_6 - VAR_5); s->bitstream_size = 0; s->bitstream_index = 0; return AVERROR_INVALIDDATA; } if (s->bitstream_size) { s->bitstream_index += VAR_6; s->bitstream_size -= VAR_6; return VAR_7; } else return VAR_6; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "AVFrame *frame = VAR_1;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "ShortenContext *s = VAR_0->priv_data;", "int VAR_6, VAR_7 = 0;", "int VAR_8;", "if (s->max_framesize == 0) {", "void *VAR_9;", "s->max_framesize = 8192;", "VAR_9 = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size,\ns->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_9) {", "av_log(VAR_0, AV_LOG_ERROR, \"error allocating bitstream buffer\\n\");", "return AVERROR(ENOMEM);", "}", "memset(VAR_9, 0, s->allocated_bitstream_size);", "s->bitstream = VAR_9;", "}", "if (1 && s->max_framesize) {", "VAR_5 = FFMIN(VAR_5, s->max_framesize - s->bitstream_size);", "VAR_7 = VAR_5;", "if (s->bitstream_index + s->bitstream_size + VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE >\ns->allocated_bitstream_size) {", "memmove(s->bitstream, &s->bitstream[s->bitstream_index],\ns->bitstream_size);", "s->bitstream_index = 0;", "}", "if (VAR_4)\nmemcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], VAR_4,\nVAR_5);", "VAR_4 = &s->bitstream[s->bitstream_index];", "VAR_5 += s->bitstream_size;", "s->bitstream_size = VAR_5;", "if (VAR_5 < s->max_framesize && VAR_3->VAR_1) {", "*VAR_2 = 0;", "return VAR_7;", "}", "}", "init_get_bits(&s->gb, VAR_4, VAR_5 * 8);", "skip_bits(&s->gb, s->bitindex);", "if (!s->got_header) {", "if ((VAR_8 = read_header(s)) < 0)\nreturn VAR_8;", "*VAR_2 = 0;", "goto finish_frame;", "}", "if (s->got_quit_command) {", "*VAR_2 = 0;", "return VAR_3->size;", "}", "s->cur_chan = 0;", "while (s->cur_chan < s->channels) {", "unsigned VAR_10;", "int VAR_11;", "if (get_bits_left(&s->gb) < 3 + FNSIZE) {", "*VAR_2 = 0;", "break;", "}", "VAR_10 = get_ur_golomb_shorten(&s->gb, FNSIZE);", "if (VAR_10 > FN_VERBATIM) {", "av_log(VAR_0, AV_LOG_ERROR, \"unknown shorten function %d\\n\", VAR_10);", "*VAR_2 = 0;", "break;", "}", "if (!is_audio_command[VAR_10]) {", "switch (VAR_10) {", "case FN_VERBATIM:\nVAR_11 = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);", "while (VAR_11--)\nget_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);", "break;", "case FN_BITSHIFT:\ns->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);", "break;", "case FN_BLOCKSIZE: {", "unsigned VAR_12 = get_uint(s, av_log2(s->VAR_12));", "if (VAR_12 > s->VAR_12) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Increasing block size is not supported\\n\");", "return AVERROR_PATCHWELCOME;", "}", "if (!VAR_12 || VAR_12 > MAX_BLOCKSIZE) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid or unsupported \"\n\"block size: %d\\n\", VAR_12);", "return AVERROR(EINVAL);", "}", "s->VAR_12 = VAR_12;", "break;", "}", "case FN_QUIT:\ns->got_quit_command = 1;", "break;", "}", "if (VAR_10 == FN_BLOCKSIZE || VAR_10 == FN_QUIT) {", "*VAR_2 = 0;", "break;", "}", "} else {", "int VAR_13 = 0;", "int VAR_14 = s->cur_chan;", "int32_t coffset;", "if (VAR_10 != FN_ZERO) {", "VAR_13 = get_ur_golomb_shorten(&s->gb, ENERGYSIZE);", "if (s->version == 0)\nVAR_13--;", "}", "if (s->nmean == 0)\ncoffset = s->offset[VAR_14][0];", "else {", "int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;", "for (VAR_6 = 0; VAR_6 < s->nmean; VAR_6++)", "sum += s->offset[VAR_14][VAR_6];", "coffset = sum / s->nmean;", "if (s->version >= 2)\ncoffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1;", "}", "if (VAR_10 == FN_ZERO) {", "for (VAR_6 = 0; VAR_6 < s->VAR_12; VAR_6++)", "s->decoded[VAR_14][VAR_6] = 0;", "} else {", "if ((VAR_8 = decode_subframe_lpc(s, VAR_10, VAR_14,\nVAR_13, coffset)) < 0)\nreturn VAR_8;", "}", "if (s->nmean > 0) {", "int32_t sum = (s->version < 2) ? 0 : s->VAR_12 / 2;", "for (VAR_6 = 0; VAR_6 < s->VAR_12; VAR_6++)", "sum += s->decoded[VAR_14][VAR_6];", "for (VAR_6 = 1; VAR_6 < s->nmean; VAR_6++)", "s->offset[VAR_14][VAR_6 - 1] = s->offset[VAR_14][VAR_6];", "if (s->version < 2)\ns->offset[VAR_14][s->nmean - 1] = sum / s->VAR_12;", "else\ns->offset[VAR_14][s->nmean - 1] = (sum / s->VAR_12) << s->bitshift;", "}", "for (VAR_6 = -s->nwrap; VAR_6 < 0; VAR_6++)", "s->decoded[VAR_14][VAR_6] = s->decoded[VAR_14][VAR_6 + s->VAR_12];", "fix_bitshift(s, s->decoded[VAR_14]);", "s->cur_chan++;", "if (s->cur_chan == s->channels) {", "uint8_t *samples_u8;", "int16_t *samples_s16;", "int VAR_15;", "frame->nb_samples = s->VAR_12;", "if ((VAR_8 = ff_get_buffer(VAR_0, frame, 0)) < 0)\nreturn VAR_8;", "for (VAR_15 = 0; VAR_15 < s->channels; VAR_15++) {", "samples_u8 = ((uint8_t **)frame->extended_data)[VAR_15];", "samples_s16 = ((int16_t **)frame->extended_data)[VAR_15];", "for (VAR_6 = 0; VAR_6 < s->VAR_12; VAR_6++) {", "switch (s->internal_ftype) {", "case TYPE_U8:\n*samples_u8++ = av_clip_uint8(s->decoded[VAR_15][VAR_6]);", "break;", "case TYPE_S16HL:\ncase TYPE_S16LH:\n*samples_s16++ = av_clip_int16(s->decoded[VAR_15][VAR_6]);", "break;", "}", "}", "}", "*VAR_2 = 1;", "}", "}", "}", "if (s->cur_chan < s->channels)\n*VAR_2 = 0;", "finish_frame:\ns->bitindex = get_bits_count(&s->gb) - 8 * (get_bits_count(&s->gb) / 8);", "VAR_6 = get_bits_count(&s->gb) / 8;", "if (VAR_6 > VAR_5) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"overread: %d\\n\", VAR_6 - VAR_5);", "s->bitstream_size = 0;", "s->bitstream_index = 0;", "return AVERROR_INVALIDDATA;", "}", "if (s->bitstream_size) {", "s->bitstream_index += VAR_6;", "s->bitstream_size -= VAR_6;", "return VAR_7;", "} else", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 175 ], [ 177, 179 ], [ 181, 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 253 ], [ 255 ], [ 261, 263 ], [ 265 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285, 287 ], [ 289 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305, 307 ], [ 309 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 331, 333 ], [ 335, 337 ], [ 339 ], [ 345 ], [ 347 ], [ 355 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 375 ], [ 377, 379 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399, 401, 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423, 425 ], [ 429, 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ] ]
2,976
static PCIReqIDCache pci_req_id_cache_get(PCIDevice *dev) { PCIDevice *parent; PCIReqIDCache cache = { .dev = dev, .type = PCI_REQ_ID_BDF, }; while (!pci_bus_is_root(dev->bus)) { /* We are under PCI/PCIe bridges */ parent = dev->bus->parent_dev; if (pci_is_express(parent)) { if (pcie_cap_get_type(parent) == PCI_EXP_TYPE_PCI_BRIDGE) { /* When we pass through PCIe-to-PCI/PCIX bridges, we * override the requester ID using secondary bus * number of parent bridge with zeroed devfn * (pcie-to-pci bridge spec chap 2.3). */ cache.type = PCI_REQ_ID_SECONDARY_BUS; cache.dev = dev; } } else { /* Legacy PCI, override requester ID with the bridge's * BDF upstream. When the root complex connects to * legacy PCI devices (including buses), it can only * obtain requester ID info from directly attached * devices. If devices are attached under bridges, only * the requester ID of the bridge that is directly * attached to the root complex can be recognized. */ cache.type = PCI_REQ_ID_BDF; cache.dev = parent; } dev = parent; } return cache; }
false
qemu
fd56e0612b6454a282fa6a953fdb09281a98c589
static PCIReqIDCache pci_req_id_cache_get(PCIDevice *dev) { PCIDevice *parent; PCIReqIDCache cache = { .dev = dev, .type = PCI_REQ_ID_BDF, }; while (!pci_bus_is_root(dev->bus)) { parent = dev->bus->parent_dev; if (pci_is_express(parent)) { if (pcie_cap_get_type(parent) == PCI_EXP_TYPE_PCI_BRIDGE) { cache.type = PCI_REQ_ID_SECONDARY_BUS; cache.dev = dev; } } else { cache.type = PCI_REQ_ID_BDF; cache.dev = parent; } dev = parent; } return cache; }
{ "code": [], "line_no": [] }
static PCIReqIDCache FUNC_0(PCIDevice *dev) { PCIDevice *parent; PCIReqIDCache cache = { .dev = dev, .type = PCI_REQ_ID_BDF, }; while (!pci_bus_is_root(dev->bus)) { parent = dev->bus->parent_dev; if (pci_is_express(parent)) { if (pcie_cap_get_type(parent) == PCI_EXP_TYPE_PCI_BRIDGE) { cache.type = PCI_REQ_ID_SECONDARY_BUS; cache.dev = dev; } } else { cache.type = PCI_REQ_ID_BDF; cache.dev = parent; } dev = parent; } return cache; }
[ "static PCIReqIDCache FUNC_0(PCIDevice *dev)\n{", "PCIDevice *parent;", "PCIReqIDCache cache = {", ".dev = dev,\n.type = PCI_REQ_ID_BDF,\n};", "while (!pci_bus_is_root(dev->bus)) {", "parent = dev->bus->parent_dev;", "if (pci_is_express(parent)) {", "if (pcie_cap_get_type(parent) == PCI_EXP_TYPE_PCI_BRIDGE) {", "cache.type = PCI_REQ_ID_SECONDARY_BUS;", "cache.dev = dev;", "}", "} else {", "cache.type = PCI_REQ_ID_BDF;", "cache.dev = parent;", "}", "dev = parent;", "}", "return cache;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
2,977
static void test_visitor_out_struct_nested(TestOutputVisitorData *data, const void *unused) { int64_t value = 42; Error *err = NULL; UserDefNested *ud2; QObject *obj; QDict *qdict, *dict1, *dict2, *dict3, *userdef; const char *string = "user def string"; const char *strings[] = { "forty two", "forty three", "forty four", "forty five" }; ud2 = g_malloc0(sizeof(*ud2)); ud2->string0 = g_strdup(strings[0]); ud2->dict1.string1 = g_strdup(strings[1]); ud2->dict1.dict2.userdef1 = g_malloc0(sizeof(UserDefOne)); ud2->dict1.dict2.userdef1->string = g_strdup(string); ud2->dict1.dict2.userdef1->base = g_new0(UserDefZero, 1); ud2->dict1.dict2.userdef1->base->integer = value; ud2->dict1.dict2.string2 = g_strdup(strings[2]); ud2->dict1.has_dict3 = true; ud2->dict1.dict3.userdef2 = g_malloc0(sizeof(UserDefOne)); ud2->dict1.dict3.userdef2->string = g_strdup(string); ud2->dict1.dict3.userdef2->base = g_new0(UserDefZero, 1); ud2->dict1.dict3.userdef2->base->integer = value; ud2->dict1.dict3.string3 = g_strdup(strings[3]); visit_type_UserDefNested(data->ov, &ud2, "unused", &err); g_assert(!err); obj = qmp_output_get_qobject(data->qov); g_assert(obj != NULL); g_assert(qobject_type(obj) == QTYPE_QDICT); qdict = qobject_to_qdict(obj); g_assert_cmpint(qdict_size(qdict), ==, 2); g_assert_cmpstr(qdict_get_str(qdict, "string0"), ==, strings[0]); dict1 = qdict_get_qdict(qdict, "dict1"); g_assert_cmpint(qdict_size(dict1), ==, 3); g_assert_cmpstr(qdict_get_str(dict1, "string1"), ==, strings[1]); dict2 = qdict_get_qdict(dict1, "dict2"); g_assert_cmpint(qdict_size(dict2), ==, 2); g_assert_cmpstr(qdict_get_str(dict2, "string2"), ==, strings[2]); userdef = qdict_get_qdict(dict2, "userdef1"); g_assert_cmpint(qdict_size(userdef), ==, 2); g_assert_cmpint(qdict_get_int(userdef, "integer"), ==, value); g_assert_cmpstr(qdict_get_str(userdef, "string"), ==, string); dict3 = qdict_get_qdict(dict1, "dict3"); g_assert_cmpint(qdict_size(dict3), ==, 2); g_assert_cmpstr(qdict_get_str(dict3, "string3"), ==, strings[3]); userdef = qdict_get_qdict(dict3, "userdef2"); g_assert_cmpint(qdict_size(userdef), ==, 2); g_assert_cmpint(qdict_get_int(userdef, "integer"), ==, value); g_assert_cmpstr(qdict_get_str(userdef, "string"), ==, string); QDECREF(qdict); qapi_free_UserDefNested(ud2); }
false
qemu
b6fcf32d9b851a83dedcb609091236b97cc4a985
static void test_visitor_out_struct_nested(TestOutputVisitorData *data, const void *unused) { int64_t value = 42; Error *err = NULL; UserDefNested *ud2; QObject *obj; QDict *qdict, *dict1, *dict2, *dict3, *userdef; const char *string = "user def string"; const char *strings[] = { "forty two", "forty three", "forty four", "forty five" }; ud2 = g_malloc0(sizeof(*ud2)); ud2->string0 = g_strdup(strings[0]); ud2->dict1.string1 = g_strdup(strings[1]); ud2->dict1.dict2.userdef1 = g_malloc0(sizeof(UserDefOne)); ud2->dict1.dict2.userdef1->string = g_strdup(string); ud2->dict1.dict2.userdef1->base = g_new0(UserDefZero, 1); ud2->dict1.dict2.userdef1->base->integer = value; ud2->dict1.dict2.string2 = g_strdup(strings[2]); ud2->dict1.has_dict3 = true; ud2->dict1.dict3.userdef2 = g_malloc0(sizeof(UserDefOne)); ud2->dict1.dict3.userdef2->string = g_strdup(string); ud2->dict1.dict3.userdef2->base = g_new0(UserDefZero, 1); ud2->dict1.dict3.userdef2->base->integer = value; ud2->dict1.dict3.string3 = g_strdup(strings[3]); visit_type_UserDefNested(data->ov, &ud2, "unused", &err); g_assert(!err); obj = qmp_output_get_qobject(data->qov); g_assert(obj != NULL); g_assert(qobject_type(obj) == QTYPE_QDICT); qdict = qobject_to_qdict(obj); g_assert_cmpint(qdict_size(qdict), ==, 2); g_assert_cmpstr(qdict_get_str(qdict, "string0"), ==, strings[0]); dict1 = qdict_get_qdict(qdict, "dict1"); g_assert_cmpint(qdict_size(dict1), ==, 3); g_assert_cmpstr(qdict_get_str(dict1, "string1"), ==, strings[1]); dict2 = qdict_get_qdict(dict1, "dict2"); g_assert_cmpint(qdict_size(dict2), ==, 2); g_assert_cmpstr(qdict_get_str(dict2, "string2"), ==, strings[2]); userdef = qdict_get_qdict(dict2, "userdef1"); g_assert_cmpint(qdict_size(userdef), ==, 2); g_assert_cmpint(qdict_get_int(userdef, "integer"), ==, value); g_assert_cmpstr(qdict_get_str(userdef, "string"), ==, string); dict3 = qdict_get_qdict(dict1, "dict3"); g_assert_cmpint(qdict_size(dict3), ==, 2); g_assert_cmpstr(qdict_get_str(dict3, "string3"), ==, strings[3]); userdef = qdict_get_qdict(dict3, "userdef2"); g_assert_cmpint(qdict_size(userdef), ==, 2); g_assert_cmpint(qdict_get_int(userdef, "integer"), ==, value); g_assert_cmpstr(qdict_get_str(userdef, "string"), ==, string); QDECREF(qdict); qapi_free_UserDefNested(ud2); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestOutputVisitorData *VAR_0, const void *VAR_1) { int64_t value = 42; Error *err = NULL; UserDefNested *ud2; QObject *obj; QDict *qdict, *dict1, *dict2, *dict3, *userdef; const char *VAR_2 = "user def VAR_2"; const char *VAR_3[] = { "forty two", "forty three", "forty four", "forty five" }; ud2 = g_malloc0(sizeof(*ud2)); ud2->string0 = g_strdup(VAR_3[0]); ud2->dict1.string1 = g_strdup(VAR_3[1]); ud2->dict1.dict2.userdef1 = g_malloc0(sizeof(UserDefOne)); ud2->dict1.dict2.userdef1->VAR_2 = g_strdup(VAR_2); ud2->dict1.dict2.userdef1->base = g_new0(UserDefZero, 1); ud2->dict1.dict2.userdef1->base->integer = value; ud2->dict1.dict2.string2 = g_strdup(VAR_3[2]); ud2->dict1.has_dict3 = true; ud2->dict1.dict3.userdef2 = g_malloc0(sizeof(UserDefOne)); ud2->dict1.dict3.userdef2->VAR_2 = g_strdup(VAR_2); ud2->dict1.dict3.userdef2->base = g_new0(UserDefZero, 1); ud2->dict1.dict3.userdef2->base->integer = value; ud2->dict1.dict3.string3 = g_strdup(VAR_3[3]); visit_type_UserDefNested(VAR_0->ov, &ud2, "VAR_1", &err); g_assert(!err); obj = qmp_output_get_qobject(VAR_0->qov); g_assert(obj != NULL); g_assert(qobject_type(obj) == QTYPE_QDICT); qdict = qobject_to_qdict(obj); g_assert_cmpint(qdict_size(qdict), ==, 2); g_assert_cmpstr(qdict_get_str(qdict, "string0"), ==, VAR_3[0]); dict1 = qdict_get_qdict(qdict, "dict1"); g_assert_cmpint(qdict_size(dict1), ==, 3); g_assert_cmpstr(qdict_get_str(dict1, "string1"), ==, VAR_3[1]); dict2 = qdict_get_qdict(dict1, "dict2"); g_assert_cmpint(qdict_size(dict2), ==, 2); g_assert_cmpstr(qdict_get_str(dict2, "string2"), ==, VAR_3[2]); userdef = qdict_get_qdict(dict2, "userdef1"); g_assert_cmpint(qdict_size(userdef), ==, 2); g_assert_cmpint(qdict_get_int(userdef, "integer"), ==, value); g_assert_cmpstr(qdict_get_str(userdef, "VAR_2"), ==, VAR_2); dict3 = qdict_get_qdict(dict1, "dict3"); g_assert_cmpint(qdict_size(dict3), ==, 2); g_assert_cmpstr(qdict_get_str(dict3, "string3"), ==, VAR_3[3]); userdef = qdict_get_qdict(dict3, "userdef2"); g_assert_cmpint(qdict_size(userdef), ==, 2); g_assert_cmpint(qdict_get_int(userdef, "integer"), ==, value); g_assert_cmpstr(qdict_get_str(userdef, "VAR_2"), ==, VAR_2); QDECREF(qdict); qapi_free_UserDefNested(ud2); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "int64_t value = 42;", "Error *err = NULL;", "UserDefNested *ud2;", "QObject *obj;", "QDict *qdict, *dict1, *dict2, *dict3, *userdef;", "const char *VAR_2 = \"user def VAR_2\";", "const char *VAR_3[] = { \"forty two\", \"forty three\", \"forty four\",", "\"forty five\" };", "ud2 = g_malloc0(sizeof(*ud2));", "ud2->string0 = g_strdup(VAR_3[0]);", "ud2->dict1.string1 = g_strdup(VAR_3[1]);", "ud2->dict1.dict2.userdef1 = g_malloc0(sizeof(UserDefOne));", "ud2->dict1.dict2.userdef1->VAR_2 = g_strdup(VAR_2);", "ud2->dict1.dict2.userdef1->base = g_new0(UserDefZero, 1);", "ud2->dict1.dict2.userdef1->base->integer = value;", "ud2->dict1.dict2.string2 = g_strdup(VAR_3[2]);", "ud2->dict1.has_dict3 = true;", "ud2->dict1.dict3.userdef2 = g_malloc0(sizeof(UserDefOne));", "ud2->dict1.dict3.userdef2->VAR_2 = g_strdup(VAR_2);", "ud2->dict1.dict3.userdef2->base = g_new0(UserDefZero, 1);", "ud2->dict1.dict3.userdef2->base->integer = value;", "ud2->dict1.dict3.string3 = g_strdup(VAR_3[3]);", "visit_type_UserDefNested(VAR_0->ov, &ud2, \"VAR_1\", &err);", "g_assert(!err);", "obj = qmp_output_get_qobject(VAR_0->qov);", "g_assert(obj != NULL);", "g_assert(qobject_type(obj) == QTYPE_QDICT);", "qdict = qobject_to_qdict(obj);", "g_assert_cmpint(qdict_size(qdict), ==, 2);", "g_assert_cmpstr(qdict_get_str(qdict, \"string0\"), ==, VAR_3[0]);", "dict1 = qdict_get_qdict(qdict, \"dict1\");", "g_assert_cmpint(qdict_size(dict1), ==, 3);", "g_assert_cmpstr(qdict_get_str(dict1, \"string1\"), ==, VAR_3[1]);", "dict2 = qdict_get_qdict(dict1, \"dict2\");", "g_assert_cmpint(qdict_size(dict2), ==, 2);", "g_assert_cmpstr(qdict_get_str(dict2, \"string2\"), ==, VAR_3[2]);", "userdef = qdict_get_qdict(dict2, \"userdef1\");", "g_assert_cmpint(qdict_size(userdef), ==, 2);", "g_assert_cmpint(qdict_get_int(userdef, \"integer\"), ==, value);", "g_assert_cmpstr(qdict_get_str(userdef, \"VAR_2\"), ==, VAR_2);", "dict3 = qdict_get_qdict(dict1, \"dict3\");", "g_assert_cmpint(qdict_size(dict3), ==, 2);", "g_assert_cmpstr(qdict_get_str(dict3, \"string3\"), ==, VAR_3[3]);", "userdef = qdict_get_qdict(dict3, \"userdef2\");", "g_assert_cmpint(qdict_size(userdef), ==, 2);", "g_assert_cmpint(qdict_get_int(userdef, \"integer\"), ==, value);", "g_assert_cmpstr(qdict_get_str(userdef, \"VAR_2\"), ==, VAR_2);", "QDECREF(qdict);", "qapi_free_UserDefNested(ud2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ] ]
2,979
void bdrv_info_stats(Monitor *mon, QObject **ret_data) { QObject *obj; QList *devices; BlockDriverState *bs; devices = qlist_new(); for (bs = bdrv_first; bs != NULL; bs = bs->next) { obj = qobject_from_jsonf("{ 'device': %s, 'stats': {" "'rd_bytes': %" PRId64 "," "'wr_bytes': %" PRId64 "," "'rd_operations': %" PRId64 "," "'wr_operations': %" PRId64 "} }", bs->device_name, bs->rd_bytes, bs->wr_bytes, bs->rd_ops, bs->wr_ops); assert(obj != NULL); qlist_append_obj(devices, obj); } *ret_data = QOBJECT(devices); }
false
qemu
ba14414174b72fa231997243a9650feaa520d054
void bdrv_info_stats(Monitor *mon, QObject **ret_data) { QObject *obj; QList *devices; BlockDriverState *bs; devices = qlist_new(); for (bs = bdrv_first; bs != NULL; bs = bs->next) { obj = qobject_from_jsonf("{ 'device': %s, 'stats': {" "'rd_bytes': %" PRId64 "," "'wr_bytes': %" PRId64 "," "'rd_operations': %" PRId64 "," "'wr_operations': %" PRId64 "} }", bs->device_name, bs->rd_bytes, bs->wr_bytes, bs->rd_ops, bs->wr_ops); assert(obj != NULL); qlist_append_obj(devices, obj); } *ret_data = QOBJECT(devices); }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, QObject **VAR_1) { QObject *obj; QList *devices; BlockDriverState *bs; devices = qlist_new(); for (bs = bdrv_first; bs != NULL; bs = bs->next) { obj = qobject_from_jsonf("{ 'device': %s, 'stats': {" "'rd_bytes': %" PRId64 "," "'wr_bytes': %" PRId64 "," "'rd_operations': %" PRId64 "," "'wr_operations': %" PRId64 "} }", bs->device_name, bs->rd_bytes, bs->wr_bytes, bs->rd_ops, bs->wr_ops); assert(obj != NULL); qlist_append_obj(devices, obj); } *VAR_1 = QOBJECT(devices); }
[ "void FUNC_0(Monitor *VAR_0, QObject **VAR_1)\n{", "QObject *obj;", "QList *devices;", "BlockDriverState *bs;", "devices = qlist_new();", "for (bs = bdrv_first; bs != NULL; bs = bs->next) {", "obj = qobject_from_jsonf(\"{ 'device': %s, 'stats': {\"", "\"'rd_bytes': %\" PRId64 \",\"\n\"'wr_bytes': %\" PRId64 \",\"\n\"'rd_operations': %\" PRId64 \",\"\n\"'wr_operations': %\" PRId64\n\"} }\",", "bs->device_name,\nbs->rd_bytes, bs->wr_bytes,\nbs->rd_ops, bs->wr_ops);", "assert(obj != NULL);", "qlist_append_obj(devices, obj);", "}", "*VAR_1 = QOBJECT(devices);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23, 25, 27, 29 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
2,980
static block_number_t eckd_block_num(BootMapPointer *p) { const uint64_t sectors = virtio_get_sectors(); const uint64_t heads = virtio_get_heads(); const uint64_t cylinder = p->eckd.cylinder + ((p->eckd.head & 0xfff0) << 12); const uint64_t head = p->eckd.head & 0x000f; const block_number_t block = sectors * heads * cylinder + sectors * head + p->eckd.sector - 1; /* block nr starts with zero */ return block; }
false
qemu
f04db28b86654d1c7ff805b40eff27bba6b0f686
static block_number_t eckd_block_num(BootMapPointer *p) { const uint64_t sectors = virtio_get_sectors(); const uint64_t heads = virtio_get_heads(); const uint64_t cylinder = p->eckd.cylinder + ((p->eckd.head & 0xfff0) << 12); const uint64_t head = p->eckd.head & 0x000f; const block_number_t block = sectors * heads * cylinder + sectors * head + p->eckd.sector - 1; return block; }
{ "code": [], "line_no": [] }
static block_number_t FUNC_0(BootMapPointer *p) { const uint64_t VAR_0 = virtio_get_sectors(); const uint64_t VAR_1 = virtio_get_heads(); const uint64_t VAR_2 = p->eckd.VAR_2 + ((p->eckd.VAR_3 & 0xfff0) << 12); const uint64_t VAR_3 = p->eckd.VAR_3 & 0x000f; const block_number_t VAR_4 = VAR_0 * VAR_1 * VAR_2 + VAR_0 * VAR_3 + p->eckd.sector - 1; return VAR_4; }
[ "static block_number_t FUNC_0(BootMapPointer *p)\n{", "const uint64_t VAR_0 = virtio_get_sectors();", "const uint64_t VAR_1 = virtio_get_heads();", "const uint64_t VAR_2 = p->eckd.VAR_2\n+ ((p->eckd.VAR_3 & 0xfff0) << 12);", "const uint64_t VAR_3 = p->eckd.VAR_3 & 0x000f;", "const block_number_t VAR_4 = VAR_0 * VAR_1 * VAR_2\n+ VAR_0 * VAR_3\n+ p->eckd.sector\n- 1;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17, 19, 21 ], [ 23 ], [ 25 ] ]
2,983
static int colo_packet_compare_other(Packet *spkt, Packet *ppkt) { trace_colo_compare_main("compare other"); trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src), inet_ntoa(ppkt->ip->ip_dst), spkt->size, inet_ntoa(spkt->ip->ip_src), inet_ntoa(spkt->ip->ip_dst)); return colo_packet_compare(ppkt, spkt); }
false
qemu
2ad7ca4c81733cba5c5c464078a643aba61044f8
static int colo_packet_compare_other(Packet *spkt, Packet *ppkt) { trace_colo_compare_main("compare other"); trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src), inet_ntoa(ppkt->ip->ip_dst), spkt->size, inet_ntoa(spkt->ip->ip_src), inet_ntoa(spkt->ip->ip_dst)); return colo_packet_compare(ppkt, spkt); }
{ "code": [], "line_no": [] }
static int FUNC_0(Packet *VAR_0, Packet *VAR_1) { trace_colo_compare_main("compare other"); trace_colo_compare_ip_info(VAR_1->size, inet_ntoa(VAR_1->ip->ip_src), inet_ntoa(VAR_1->ip->ip_dst), VAR_0->size, inet_ntoa(VAR_0->ip->ip_src), inet_ntoa(VAR_0->ip->ip_dst)); return colo_packet_compare(VAR_1, VAR_0); }
[ "static int FUNC_0(Packet *VAR_0, Packet *VAR_1)\n{", "trace_colo_compare_main(\"compare other\");", "trace_colo_compare_ip_info(VAR_1->size, inet_ntoa(VAR_1->ip->ip_src),\ninet_ntoa(VAR_1->ip->ip_dst), VAR_0->size,\ninet_ntoa(VAR_0->ip->ip_src),\ninet_ntoa(VAR_0->ip->ip_dst));", "return colo_packet_compare(VAR_1, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13 ], [ 15 ], [ 17 ] ]
2,984
static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc) { int addr_reg, data_reg, data_reg2, bswap; #ifdef CONFIG_SOFTMMU int mem_index, s_bits; # if TARGET_LONG_BITS == 64 int addr_reg2; # endif uint32_t *label_ptr; #endif #ifdef TARGET_WORDS_BIGENDIAN bswap = 1; #else bswap = 0; #endif data_reg = *args++; if (opc == 3) data_reg2 = *args++; else data_reg2 = 0; /* suppress warning */ addr_reg = *args++; #ifdef CONFIG_SOFTMMU # if TARGET_LONG_BITS == 64 addr_reg2 = *args++; # endif mem_index = *args; s_bits = opc & 3; /* Should generate something like the following: * shr r8, addr_reg, #TARGET_PAGE_BITS * and r0, r8, #(CPU_TLB_SIZE - 1) @ Assumption: CPU_TLB_BITS <= 8 * add r0, env, r0 lsl #CPU_TLB_ENTRY_BITS */ tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R8, 0, addr_reg, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); tcg_out_dat_imm(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_R8, CPU_TLB_SIZE - 1); tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_AREG0, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); /* In the * ldr r1 [r0, #(offsetof(CPUState, tlb_table[mem_index][0].addr_write))] * below, the offset is likely to exceed 12 bits if mem_index != 0 and * not exceed otherwise, so use an * add r0, r0, #(mem_index * sizeof *CPUState.tlb_table) * before. */ if (mem_index) tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_REG_R0, (mem_index << (TLB_SHIFT & 1)) | ((16 - (TLB_SHIFT >> 1)) << 8)); tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addr_write)); tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R1, TCG_REG_R8, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); /* Check alignment. */ if (s_bits) tcg_out_dat_imm(s, COND_EQ, ARITH_TST, 0, addr_reg, (1 << s_bits) - 1); # if TARGET_LONG_BITS == 64 /* XXX: possibly we could use a block data load or writeback in * the first access. */ tcg_out_ld32_12(s, COND_EQ, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addr_write) + 4); tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addr_reg2, SHIFT_IMM_LSL(0)); # endif tcg_out_ld32_12(s, COND_EQ, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addend)); switch (opc) { case 0: tcg_out_st8_r(s, COND_EQ, data_reg, addr_reg, TCG_REG_R1); break; case 1: if (bswap) { tcg_out_bswap16(s, COND_EQ, TCG_REG_R0, data_reg); tcg_out_st16_r(s, COND_EQ, TCG_REG_R0, addr_reg, TCG_REG_R1); } else { tcg_out_st16_r(s, COND_EQ, data_reg, addr_reg, TCG_REG_R1); } break; case 2: default: if (bswap) { tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg); tcg_out_st32_r(s, COND_EQ, TCG_REG_R0, addr_reg, TCG_REG_R1); } else { tcg_out_st32_r(s, COND_EQ, data_reg, addr_reg, TCG_REG_R1); } break; case 3: if (bswap) { tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg2); tcg_out_st32_rwb(s, COND_EQ, TCG_REG_R0, TCG_REG_R1, addr_reg); tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg); tcg_out_st32_12(s, COND_EQ, data_reg, TCG_REG_R1, 4); } else { tcg_out_st32_rwb(s, COND_EQ, data_reg, TCG_REG_R1, addr_reg); tcg_out_st32_12(s, COND_EQ, data_reg2, TCG_REG_R1, 4); } break; } label_ptr = (void *) s->code_ptr; tcg_out_b(s, COND_EQ, 8); /* TODO: move this code to where the constants pool will be */ if (addr_reg != TCG_REG_R0) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R0, 0, addr_reg, SHIFT_IMM_LSL(0)); } # if TARGET_LONG_BITS == 32 switch (opc) { case 0: tcg_out_ext8u(s, COND_AL, TCG_REG_R1, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 1: tcg_out_ext16u(s, COND_AL, TCG_REG_R1, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 2: if (data_reg != TCG_REG_R1) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R1, 0, data_reg, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 3: if (data_reg != TCG_REG_R1) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R1, 0, data_reg, SHIFT_IMM_LSL(0)); } if (data_reg2 != TCG_REG_R2) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, data_reg2, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; } # else if (addr_reg2 != TCG_REG_R1) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R1, 0, addr_reg2, SHIFT_IMM_LSL(0)); } switch (opc) { case 0: tcg_out_ext8u(s, COND_AL, TCG_REG_R2, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 1: tcg_out_ext16u(s, COND_AL, TCG_REG_R2, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 2: if (data_reg != TCG_REG_R2) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, data_reg, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 3: tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R8, 0, mem_index); tcg_out32(s, (COND_AL << 28) | 0x052d8010); /* str r8, [sp, #-0x10]! */ if (data_reg != TCG_REG_R2) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, data_reg, SHIFT_IMM_LSL(0)); } if (data_reg2 != TCG_REG_R3) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, data_reg2, SHIFT_IMM_LSL(0)); } break; } # endif tcg_out_bl(s, COND_AL, (tcg_target_long) qemu_st_helpers[s_bits] - (tcg_target_long) s->code_ptr); # if TARGET_LONG_BITS == 64 if (opc == 3) tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R13, TCG_REG_R13, 0x10); # endif *label_ptr += ((void *) s->code_ptr - (void *) label_ptr - 8) >> 2; #else /* !CONFIG_SOFTMMU */ if (GUEST_BASE) { uint32_t offset = GUEST_BASE; int i; int rot; while (offset) { i = ctz32(offset) & ~1; rot = ((32 - i) << 7) & 0xf00; tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R1, addr_reg, ((offset >> i) & 0xff) | rot); addr_reg = TCG_REG_R1; offset &= ~(0xff << i); } } switch (opc) { case 0: tcg_out_st8_12(s, COND_AL, data_reg, addr_reg, 0); break; case 1: if (bswap) { tcg_out_bswap16(s, COND_AL, TCG_REG_R0, data_reg); tcg_out_st16_8(s, COND_AL, TCG_REG_R0, addr_reg, 0); } else { tcg_out_st16_8(s, COND_AL, data_reg, addr_reg, 0); } break; case 2: default: if (bswap) { tcg_out_bswap32(s, COND_AL, TCG_REG_R0, data_reg); tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addr_reg, 0); } else { tcg_out_st32_12(s, COND_AL, data_reg, addr_reg, 0); } break; case 3: /* TODO: use block store - * check that data_reg2 > data_reg or the other way */ if (bswap) { tcg_out_bswap32(s, COND_AL, TCG_REG_R0, data_reg2); tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addr_reg, 0); tcg_out_bswap32(s, COND_AL, TCG_REG_R0, data_reg); tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addr_reg, 4); } else { tcg_out_st32_12(s, COND_AL, data_reg, addr_reg, 0); tcg_out_st32_12(s, COND_AL, data_reg2, addr_reg, 4); } break; } #endif }
false
qemu
2633a2d015b0ba57432f1e11970cc080eb5119a3
static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc) { int addr_reg, data_reg, data_reg2, bswap; #ifdef CONFIG_SOFTMMU int mem_index, s_bits; # if TARGET_LONG_BITS == 64 int addr_reg2; # endif uint32_t *label_ptr; #endif #ifdef TARGET_WORDS_BIGENDIAN bswap = 1; #else bswap = 0; #endif data_reg = *args++; if (opc == 3) data_reg2 = *args++; else data_reg2 = 0; addr_reg = *args++; #ifdef CONFIG_SOFTMMU # if TARGET_LONG_BITS == 64 addr_reg2 = *args++; # endif mem_index = *args; s_bits = opc & 3; tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R8, 0, addr_reg, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); tcg_out_dat_imm(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_R8, CPU_TLB_SIZE - 1); tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_AREG0, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); if (mem_index) tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_REG_R0, (mem_index << (TLB_SHIFT & 1)) | ((16 - (TLB_SHIFT >> 1)) << 8)); tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addr_write)); tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R1, TCG_REG_R8, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); if (s_bits) tcg_out_dat_imm(s, COND_EQ, ARITH_TST, 0, addr_reg, (1 << s_bits) - 1); # if TARGET_LONG_BITS == 64 tcg_out_ld32_12(s, COND_EQ, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addr_write) + 4); tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addr_reg2, SHIFT_IMM_LSL(0)); # endif tcg_out_ld32_12(s, COND_EQ, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addend)); switch (opc) { case 0: tcg_out_st8_r(s, COND_EQ, data_reg, addr_reg, TCG_REG_R1); break; case 1: if (bswap) { tcg_out_bswap16(s, COND_EQ, TCG_REG_R0, data_reg); tcg_out_st16_r(s, COND_EQ, TCG_REG_R0, addr_reg, TCG_REG_R1); } else { tcg_out_st16_r(s, COND_EQ, data_reg, addr_reg, TCG_REG_R1); } break; case 2: default: if (bswap) { tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg); tcg_out_st32_r(s, COND_EQ, TCG_REG_R0, addr_reg, TCG_REG_R1); } else { tcg_out_st32_r(s, COND_EQ, data_reg, addr_reg, TCG_REG_R1); } break; case 3: if (bswap) { tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg2); tcg_out_st32_rwb(s, COND_EQ, TCG_REG_R0, TCG_REG_R1, addr_reg); tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg); tcg_out_st32_12(s, COND_EQ, data_reg, TCG_REG_R1, 4); } else { tcg_out_st32_rwb(s, COND_EQ, data_reg, TCG_REG_R1, addr_reg); tcg_out_st32_12(s, COND_EQ, data_reg2, TCG_REG_R1, 4); } break; } label_ptr = (void *) s->code_ptr; tcg_out_b(s, COND_EQ, 8); if (addr_reg != TCG_REG_R0) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R0, 0, addr_reg, SHIFT_IMM_LSL(0)); } # if TARGET_LONG_BITS == 32 switch (opc) { case 0: tcg_out_ext8u(s, COND_AL, TCG_REG_R1, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 1: tcg_out_ext16u(s, COND_AL, TCG_REG_R1, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 2: if (data_reg != TCG_REG_R1) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R1, 0, data_reg, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 3: if (data_reg != TCG_REG_R1) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R1, 0, data_reg, SHIFT_IMM_LSL(0)); } if (data_reg2 != TCG_REG_R2) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, data_reg2, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; } # else if (addr_reg2 != TCG_REG_R1) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R1, 0, addr_reg2, SHIFT_IMM_LSL(0)); } switch (opc) { case 0: tcg_out_ext8u(s, COND_AL, TCG_REG_R2, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 1: tcg_out_ext16u(s, COND_AL, TCG_REG_R2, data_reg); tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 2: if (data_reg != TCG_REG_R2) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, data_reg, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 3: tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R8, 0, mem_index); tcg_out32(s, (COND_AL << 28) | 0x052d8010); if (data_reg != TCG_REG_R2) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R2, 0, data_reg, SHIFT_IMM_LSL(0)); } if (data_reg2 != TCG_REG_R3) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_R3, 0, data_reg2, SHIFT_IMM_LSL(0)); } break; } # endif tcg_out_bl(s, COND_AL, (tcg_target_long) qemu_st_helpers[s_bits] - (tcg_target_long) s->code_ptr); # if TARGET_LONG_BITS == 64 if (opc == 3) tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R13, TCG_REG_R13, 0x10); # endif *label_ptr += ((void *) s->code_ptr - (void *) label_ptr - 8) >> 2; #else if (GUEST_BASE) { uint32_t offset = GUEST_BASE; int i; int rot; while (offset) { i = ctz32(offset) & ~1; rot = ((32 - i) << 7) & 0xf00; tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R1, addr_reg, ((offset >> i) & 0xff) | rot); addr_reg = TCG_REG_R1; offset &= ~(0xff << i); } } switch (opc) { case 0: tcg_out_st8_12(s, COND_AL, data_reg, addr_reg, 0); break; case 1: if (bswap) { tcg_out_bswap16(s, COND_AL, TCG_REG_R0, data_reg); tcg_out_st16_8(s, COND_AL, TCG_REG_R0, addr_reg, 0); } else { tcg_out_st16_8(s, COND_AL, data_reg, addr_reg, 0); } break; case 2: default: if (bswap) { tcg_out_bswap32(s, COND_AL, TCG_REG_R0, data_reg); tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addr_reg, 0); } else { tcg_out_st32_12(s, COND_AL, data_reg, addr_reg, 0); } break; case 3: if (bswap) { tcg_out_bswap32(s, COND_AL, TCG_REG_R0, data_reg2); tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addr_reg, 0); tcg_out_bswap32(s, COND_AL, TCG_REG_R0, data_reg); tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addr_reg, 4); } else { tcg_out_st32_12(s, COND_AL, data_reg, addr_reg, 0); tcg_out_st32_12(s, COND_AL, data_reg2, addr_reg, 4); } break; } #endif }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGContext *VAR_0, const TCGArg *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; #ifdef CONFIG_SOFTMMU int mem_index, s_bits; # if TARGET_LONG_BITS == 64 int addr_reg2; # endif uint32_t *label_ptr; #endif #ifdef TARGET_WORDS_BIGENDIAN VAR_6 = 1; #else VAR_6 = 0; #endif VAR_4 = *VAR_1++; if (VAR_2 == 3) VAR_5 = *VAR_1++; else VAR_5 = 0; VAR_3 = *VAR_1++; #ifdef CONFIG_SOFTMMU # if TARGET_LONG_BITS == 64 addr_reg2 = *VAR_1++; # endif mem_index = *VAR_1; s_bits = VAR_2 & 3; tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R8, 0, VAR_3, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); tcg_out_dat_imm(VAR_0, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_R8, CPU_TLB_SIZE - 1); tcg_out_dat_reg(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_AREG0, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); if (mem_index) tcg_out_dat_imm(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_REG_R0, (mem_index << (TLB_SHIFT & 1)) | ((16 - (TLB_SHIFT >> 1)) << 8)); tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addr_write)); tcg_out_dat_reg(VAR_0, COND_AL, ARITH_CMP, 0, TCG_REG_R1, TCG_REG_R8, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); if (s_bits) tcg_out_dat_imm(VAR_0, COND_EQ, ARITH_TST, 0, VAR_3, (1 << s_bits) - 1); # if TARGET_LONG_BITS == 64 tcg_out_ld32_12(VAR_0, COND_EQ, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addr_write) + 4); tcg_out_dat_reg(VAR_0, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addr_reg2, SHIFT_IMM_LSL(0)); # endif tcg_out_ld32_12(VAR_0, COND_EQ, TCG_REG_R1, TCG_REG_R0, offsetof(CPUState, tlb_table[0][0].addend)); switch (VAR_2) { case 0: tcg_out_st8_r(VAR_0, COND_EQ, VAR_4, VAR_3, TCG_REG_R1); break; case 1: if (VAR_6) { tcg_out_bswap16(VAR_0, COND_EQ, TCG_REG_R0, VAR_4); tcg_out_st16_r(VAR_0, COND_EQ, TCG_REG_R0, VAR_3, TCG_REG_R1); } else { tcg_out_st16_r(VAR_0, COND_EQ, VAR_4, VAR_3, TCG_REG_R1); } break; case 2: default: if (VAR_6) { tcg_out_bswap32(VAR_0, COND_EQ, TCG_REG_R0, VAR_4); tcg_out_st32_r(VAR_0, COND_EQ, TCG_REG_R0, VAR_3, TCG_REG_R1); } else { tcg_out_st32_r(VAR_0, COND_EQ, VAR_4, VAR_3, TCG_REG_R1); } break; case 3: if (VAR_6) { tcg_out_bswap32(VAR_0, COND_EQ, TCG_REG_R0, VAR_5); tcg_out_st32_rwb(VAR_0, COND_EQ, TCG_REG_R0, TCG_REG_R1, VAR_3); tcg_out_bswap32(VAR_0, COND_EQ, TCG_REG_R0, VAR_4); tcg_out_st32_12(VAR_0, COND_EQ, VAR_4, TCG_REG_R1, 4); } else { tcg_out_st32_rwb(VAR_0, COND_EQ, VAR_4, TCG_REG_R1, VAR_3); tcg_out_st32_12(VAR_0, COND_EQ, VAR_5, TCG_REG_R1, 4); } break; } label_ptr = (void *) VAR_0->code_ptr; tcg_out_b(VAR_0, COND_EQ, 8); if (VAR_3 != TCG_REG_R0) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R0, 0, VAR_3, SHIFT_IMM_LSL(0)); } # if TARGET_LONG_BITS == 32 switch (VAR_2) { case 0: tcg_out_ext8u(VAR_0, COND_AL, TCG_REG_R1, VAR_4); tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 1: tcg_out_ext16u(VAR_0, COND_AL, TCG_REG_R1, VAR_4); tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 2: if (VAR_4 != TCG_REG_R1) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R1, 0, VAR_4, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index); break; case 3: if (VAR_4 != TCG_REG_R1) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R1, 0, VAR_4, SHIFT_IMM_LSL(0)); } if (VAR_5 != TCG_REG_R2) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, VAR_5, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; } # else if (addr_reg2 != TCG_REG_R1) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R1, 0, addr_reg2, SHIFT_IMM_LSL(0)); } switch (VAR_2) { case 0: tcg_out_ext8u(VAR_0, COND_AL, TCG_REG_R2, VAR_4); tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 1: tcg_out_ext16u(VAR_0, COND_AL, TCG_REG_R2, VAR_4); tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 2: if (VAR_4 != TCG_REG_R2) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, VAR_4, SHIFT_IMM_LSL(0)); } tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index); break; case 3: tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R8, 0, mem_index); tcg_out32(VAR_0, (COND_AL << 28) | 0x052d8010); if (VAR_4 != TCG_REG_R2) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, VAR_4, SHIFT_IMM_LSL(0)); } if (VAR_5 != TCG_REG_R3) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, VAR_5, SHIFT_IMM_LSL(0)); } break; } # endif tcg_out_bl(VAR_0, COND_AL, (tcg_target_long) qemu_st_helpers[s_bits] - (tcg_target_long) VAR_0->code_ptr); # if TARGET_LONG_BITS == 64 if (VAR_2 == 3) tcg_out_dat_imm(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R13, TCG_REG_R13, 0x10); # endif *label_ptr += ((void *) VAR_0->code_ptr - (void *) label_ptr - 8) >> 2; #else if (GUEST_BASE) { uint32_t offset = GUEST_BASE; int VAR_7; int VAR_8; while (offset) { VAR_7 = ctz32(offset) & ~1; VAR_8 = ((32 - VAR_7) << 7) & 0xf00; tcg_out_dat_imm(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R1, VAR_3, ((offset >> VAR_7) & 0xff) | VAR_8); VAR_3 = TCG_REG_R1; offset &= ~(0xff << VAR_7); } } switch (VAR_2) { case 0: tcg_out_st8_12(VAR_0, COND_AL, VAR_4, VAR_3, 0); break; case 1: if (VAR_6) { tcg_out_bswap16(VAR_0, COND_AL, TCG_REG_R0, VAR_4); tcg_out_st16_8(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 0); } else { tcg_out_st16_8(VAR_0, COND_AL, VAR_4, VAR_3, 0); } break; case 2: default: if (VAR_6) { tcg_out_bswap32(VAR_0, COND_AL, TCG_REG_R0, VAR_4); tcg_out_st32_12(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 0); } else { tcg_out_st32_12(VAR_0, COND_AL, VAR_4, VAR_3, 0); } break; case 3: if (VAR_6) { tcg_out_bswap32(VAR_0, COND_AL, TCG_REG_R0, VAR_5); tcg_out_st32_12(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 0); tcg_out_bswap32(VAR_0, COND_AL, TCG_REG_R0, VAR_4); tcg_out_st32_12(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 4); } else { tcg_out_st32_12(VAR_0, COND_AL, VAR_4, VAR_3, 0); tcg_out_st32_12(VAR_0, COND_AL, VAR_5, VAR_3, 4); } break; } #endif }
[ "static inline void FUNC_0(TCGContext *VAR_0, const TCGArg *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "#ifdef CONFIG_SOFTMMU\nint mem_index, s_bits;", "# if TARGET_LONG_BITS == 64\nint addr_reg2;", "# endif\nuint32_t *label_ptr;", "#endif\n#ifdef TARGET_WORDS_BIGENDIAN\nVAR_6 = 1;", "#else\nVAR_6 = 0;", "#endif\nVAR_4 = *VAR_1++;", "if (VAR_2 == 3)\nVAR_5 = *VAR_1++;", "else\nVAR_5 = 0;", "VAR_3 = *VAR_1++;", "#ifdef CONFIG_SOFTMMU\n# if TARGET_LONG_BITS == 64\naddr_reg2 = *VAR_1++;", "# endif\nmem_index = *VAR_1;", "s_bits = VAR_2 & 3;", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R8, 0, VAR_3, SHIFT_IMM_LSR(TARGET_PAGE_BITS));", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_AND,\nTCG_REG_R0, TCG_REG_R8, CPU_TLB_SIZE - 1);", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R0,\nTCG_AREG0, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS));", "if (mem_index)\ntcg_out_dat_imm(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R0, TCG_REG_R0,\n(mem_index << (TLB_SHIFT & 1)) |\n((16 - (TLB_SHIFT >> 1)) << 8));", "tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_R1, TCG_REG_R0,\noffsetof(CPUState, tlb_table[0][0].addr_write));", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_CMP, 0, TCG_REG_R1,\nTCG_REG_R8, SHIFT_IMM_LSL(TARGET_PAGE_BITS));", "if (s_bits)\ntcg_out_dat_imm(VAR_0, COND_EQ, ARITH_TST,\n0, VAR_3, (1 << s_bits) - 1);", "# if TARGET_LONG_BITS == 64\ntcg_out_ld32_12(VAR_0, COND_EQ, TCG_REG_R1, TCG_REG_R0,\noffsetof(CPUState, tlb_table[0][0].addr_write) + 4);", "tcg_out_dat_reg(VAR_0, COND_EQ, ARITH_CMP, 0,\nTCG_REG_R1, addr_reg2, SHIFT_IMM_LSL(0));", "# endif\ntcg_out_ld32_12(VAR_0, COND_EQ, TCG_REG_R1, TCG_REG_R0,\noffsetof(CPUState, tlb_table[0][0].addend));", "switch (VAR_2) {", "case 0:\ntcg_out_st8_r(VAR_0, COND_EQ, VAR_4, VAR_3, TCG_REG_R1);", "break;", "case 1:\nif (VAR_6) {", "tcg_out_bswap16(VAR_0, COND_EQ, TCG_REG_R0, VAR_4);", "tcg_out_st16_r(VAR_0, COND_EQ, TCG_REG_R0, VAR_3, TCG_REG_R1);", "} else {", "tcg_out_st16_r(VAR_0, COND_EQ, VAR_4, VAR_3, TCG_REG_R1);", "}", "break;", "case 2:\ndefault:\nif (VAR_6) {", "tcg_out_bswap32(VAR_0, COND_EQ, TCG_REG_R0, VAR_4);", "tcg_out_st32_r(VAR_0, COND_EQ, TCG_REG_R0, VAR_3, TCG_REG_R1);", "} else {", "tcg_out_st32_r(VAR_0, COND_EQ, VAR_4, VAR_3, TCG_REG_R1);", "}", "break;", "case 3:\nif (VAR_6) {", "tcg_out_bswap32(VAR_0, COND_EQ, TCG_REG_R0, VAR_5);", "tcg_out_st32_rwb(VAR_0, COND_EQ, TCG_REG_R0, TCG_REG_R1, VAR_3);", "tcg_out_bswap32(VAR_0, COND_EQ, TCG_REG_R0, VAR_4);", "tcg_out_st32_12(VAR_0, COND_EQ, VAR_4, TCG_REG_R1, 4);", "} else {", "tcg_out_st32_rwb(VAR_0, COND_EQ, VAR_4, TCG_REG_R1, VAR_3);", "tcg_out_st32_12(VAR_0, COND_EQ, VAR_5, TCG_REG_R1, 4);", "}", "break;", "}", "label_ptr = (void *) VAR_0->code_ptr;", "tcg_out_b(VAR_0, COND_EQ, 8);", "if (VAR_3 != TCG_REG_R0) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R0, 0, VAR_3, SHIFT_IMM_LSL(0));", "}", "# if TARGET_LONG_BITS == 32\nswitch (VAR_2) {", "case 0:\ntcg_out_ext8u(VAR_0, COND_AL, TCG_REG_R1, VAR_4);", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index);", "break;", "case 1:\ntcg_out_ext16u(VAR_0, COND_AL, TCG_REG_R1, VAR_4);", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index);", "break;", "case 2:\nif (VAR_4 != TCG_REG_R1) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R1, 0, VAR_4, SHIFT_IMM_LSL(0));", "}", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R2, 0, mem_index);", "break;", "case 3:\nif (VAR_4 != TCG_REG_R1) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R1, 0, VAR_4, SHIFT_IMM_LSL(0));", "}", "if (VAR_5 != TCG_REG_R2) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R2, 0, VAR_5, SHIFT_IMM_LSL(0));", "}", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index);", "break;", "}", "# else\nif (addr_reg2 != TCG_REG_R1) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R1, 0, addr_reg2, SHIFT_IMM_LSL(0));", "}", "switch (VAR_2) {", "case 0:\ntcg_out_ext8u(VAR_0, COND_AL, TCG_REG_R2, VAR_4);", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index);", "break;", "case 1:\ntcg_out_ext16u(VAR_0, COND_AL, TCG_REG_R2, VAR_4);", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index);", "break;", "case 2:\nif (VAR_4 != TCG_REG_R2) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R2, 0, VAR_4, SHIFT_IMM_LSL(0));", "}", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R3, 0, mem_index);", "break;", "case 3:\ntcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R8, 0, mem_index);", "tcg_out32(VAR_0, (COND_AL << 28) | 0x052d8010);", "if (VAR_4 != TCG_REG_R2) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R2, 0, VAR_4, SHIFT_IMM_LSL(0));", "}", "if (VAR_5 != TCG_REG_R3) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nTCG_REG_R3, 0, VAR_5, SHIFT_IMM_LSL(0));", "}", "break;", "}", "# endif\ntcg_out_bl(VAR_0, COND_AL, (tcg_target_long) qemu_st_helpers[s_bits] -\n(tcg_target_long) VAR_0->code_ptr);", "# if TARGET_LONG_BITS == 64\nif (VAR_2 == 3)\ntcg_out_dat_imm(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R13, TCG_REG_R13, 0x10);", "# endif\n*label_ptr += ((void *) VAR_0->code_ptr - (void *) label_ptr - 8) >> 2;", "#else\nif (GUEST_BASE) {", "uint32_t offset = GUEST_BASE;", "int VAR_7;", "int VAR_8;", "while (offset) {", "VAR_7 = ctz32(offset) & ~1;", "VAR_8 = ((32 - VAR_7) << 7) & 0xf00;", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_ADD, TCG_REG_R1, VAR_3,\n((offset >> VAR_7) & 0xff) | VAR_8);", "VAR_3 = TCG_REG_R1;", "offset &= ~(0xff << VAR_7);", "}", "}", "switch (VAR_2) {", "case 0:\ntcg_out_st8_12(VAR_0, COND_AL, VAR_4, VAR_3, 0);", "break;", "case 1:\nif (VAR_6) {", "tcg_out_bswap16(VAR_0, COND_AL, TCG_REG_R0, VAR_4);", "tcg_out_st16_8(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 0);", "} else {", "tcg_out_st16_8(VAR_0, COND_AL, VAR_4, VAR_3, 0);", "}", "break;", "case 2:\ndefault:\nif (VAR_6) {", "tcg_out_bswap32(VAR_0, COND_AL, TCG_REG_R0, VAR_4);", "tcg_out_st32_12(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 0);", "} else {", "tcg_out_st32_12(VAR_0, COND_AL, VAR_4, VAR_3, 0);", "}", "break;", "case 3:\nif (VAR_6) {", "tcg_out_bswap32(VAR_0, COND_AL, TCG_REG_R0, VAR_5);", "tcg_out_st32_12(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 0);", "tcg_out_bswap32(VAR_0, COND_AL, TCG_REG_R0, VAR_4);", "tcg_out_st32_12(VAR_0, COND_AL, TCG_REG_R0, VAR_3, 4);", "} else {", "tcg_out_st32_12(VAR_0, COND_AL, VAR_4, VAR_3, 0);", "tcg_out_st32_12(VAR_0, COND_AL, VAR_5, VAR_3, 4);", "}", "break;", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45, 47, 49 ], [ 51, 53 ], [ 55 ], [ 69, 71 ], [ 73, 75 ], [ 77, 79 ], [ 95, 97, 99, 101 ], [ 103, 105 ], [ 107, 109 ], [ 113, 115, 117 ], [ 119, 125, 127 ], [ 129, 131 ], [ 133, 135, 137 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225, 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283, 285 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 339 ], [ 341, 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351, 355, 357 ], [ 359, 361, 363 ], [ 365, 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 383 ], [ 385 ], [ 387 ], [ 391, 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405, 407 ], [ 409 ], [ 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427, 429, 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445, 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473, 475 ] ]
2,986
static av_cold int indeo3_decode_init(AVCodecContext *avctx) { Indeo3DecodeContext *s = avctx->priv_data; s->avctx = avctx; s->width = avctx->width; s->height = avctx->height; avctx->pix_fmt = PIX_FMT_YUV410P; build_modpred(s); iv_alloc_frames(s); return 0; }
false
FFmpeg
8b27f76bf8790536afccb96780b5feb9c65636be
static av_cold int indeo3_decode_init(AVCodecContext *avctx) { Indeo3DecodeContext *s = avctx->priv_data; s->avctx = avctx; s->width = avctx->width; s->height = avctx->height; avctx->pix_fmt = PIX_FMT_YUV410P; build_modpred(s); iv_alloc_frames(s); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { Indeo3DecodeContext *s = avctx->priv_data; s->avctx = avctx; s->width = avctx->width; s->height = avctx->height; avctx->pix_fmt = PIX_FMT_YUV410P; build_modpred(s); iv_alloc_frames(s); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "Indeo3DecodeContext *s = avctx->priv_data;", "s->avctx = avctx;", "s->width = avctx->width;", "s->height = avctx->height;", "avctx->pix_fmt = PIX_FMT_YUV410P;", "build_modpred(s);", "iv_alloc_frames(s);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
2,987
static uint32_t cuda_readl (void *opaque, target_phys_addr_t addr) { return 0; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint32_t cuda_readl (void *opaque, target_phys_addr_t addr) { return 0; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0 (void *opaque, target_phys_addr_t addr) { return 0; }
[ "static uint32_t FUNC_0 (void *opaque, target_phys_addr_t addr)\n{", "return 0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,988
int AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) { u32 *rk; int i = 0; u32 temp; if (!userKey || !key) return -1; if (bits != 128 && bits != 192 && bits != 256) return -2; rk = key->rd_key; if (bits==128) key->rounds = 10; else if (bits==192) key->rounds = 12; else key->rounds = 14; rk[0] = GETU32(userKey ); rk[1] = GETU32(userKey + 4); rk[2] = GETU32(userKey + 8); rk[3] = GETU32(userKey + 12); if (bits == 128) { while (1) { temp = rk[3]; rk[4] = rk[0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[5] = rk[1] ^ rk[4]; rk[6] = rk[2] ^ rk[5]; rk[7] = rk[3] ^ rk[6]; if (++i == 10) { return 0; } rk += 4; } } rk[4] = GETU32(userKey + 16); rk[5] = GETU32(userKey + 20); if (bits == 192) { while (1) { temp = rk[ 5]; rk[ 6] = rk[ 0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 7] = rk[ 1] ^ rk[ 6]; rk[ 8] = rk[ 2] ^ rk[ 7]; rk[ 9] = rk[ 3] ^ rk[ 8]; if (++i == 8) { return 0; } rk[10] = rk[ 4] ^ rk[ 9]; rk[11] = rk[ 5] ^ rk[10]; rk += 6; } } rk[6] = GETU32(userKey + 24); rk[7] = GETU32(userKey + 28); if (bits == 256) { while (1) { temp = rk[ 7]; rk[ 8] = rk[ 0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 9] = rk[ 1] ^ rk[ 8]; rk[10] = rk[ 2] ^ rk[ 9]; rk[11] = rk[ 3] ^ rk[10]; if (++i == 7) { return 0; } temp = rk[11]; rk[12] = rk[ 4] ^ (AES_Te4[(temp >> 24) ] & 0xff000000) ^ (AES_Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp ) & 0xff] & 0x000000ff); rk[13] = rk[ 5] ^ rk[12]; rk[14] = rk[ 6] ^ rk[13]; rk[15] = rk[ 7] ^ rk[14]; rk += 8; } } return 0; }
false
qemu
a50c7c869a4fa1c78b4c38d3419566dd25d32e90
int AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) { u32 *rk; int i = 0; u32 temp; if (!userKey || !key) return -1; if (bits != 128 && bits != 192 && bits != 256) return -2; rk = key->rd_key; if (bits==128) key->rounds = 10; else if (bits==192) key->rounds = 12; else key->rounds = 14; rk[0] = GETU32(userKey ); rk[1] = GETU32(userKey + 4); rk[2] = GETU32(userKey + 8); rk[3] = GETU32(userKey + 12); if (bits == 128) { while (1) { temp = rk[3]; rk[4] = rk[0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[5] = rk[1] ^ rk[4]; rk[6] = rk[2] ^ rk[5]; rk[7] = rk[3] ^ rk[6]; if (++i == 10) { return 0; } rk += 4; } } rk[4] = GETU32(userKey + 16); rk[5] = GETU32(userKey + 20); if (bits == 192) { while (1) { temp = rk[ 5]; rk[ 6] = rk[ 0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 7] = rk[ 1] ^ rk[ 6]; rk[ 8] = rk[ 2] ^ rk[ 7]; rk[ 9] = rk[ 3] ^ rk[ 8]; if (++i == 8) { return 0; } rk[10] = rk[ 4] ^ rk[ 9]; rk[11] = rk[ 5] ^ rk[10]; rk += 6; } } rk[6] = GETU32(userKey + 24); rk[7] = GETU32(userKey + 28); if (bits == 256) { while (1) { temp = rk[ 7]; rk[ 8] = rk[ 0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 9] = rk[ 1] ^ rk[ 8]; rk[10] = rk[ 2] ^ rk[ 9]; rk[11] = rk[ 3] ^ rk[10]; if (++i == 7) { return 0; } temp = rk[11]; rk[12] = rk[ 4] ^ (AES_Te4[(temp >> 24) ] & 0xff000000) ^ (AES_Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp ) & 0xff] & 0x000000ff); rk[13] = rk[ 5] ^ rk[12]; rk[14] = rk[ 6] ^ rk[13]; rk[15] = rk[ 7] ^ rk[14]; rk += 8; } } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const unsigned char *VAR_0, const int VAR_1, AES_KEY *VAR_2) { u32 *rk; int VAR_3 = 0; u32 temp; if (!VAR_0 || !VAR_2) return -1; if (VAR_1 != 128 && VAR_1 != 192 && VAR_1 != 256) return -2; rk = VAR_2->rd_key; if (VAR_1==128) VAR_2->rounds = 10; else if (VAR_1==192) VAR_2->rounds = 12; else VAR_2->rounds = 14; rk[0] = GETU32(VAR_0 ); rk[1] = GETU32(VAR_0 + 4); rk[2] = GETU32(VAR_0 + 8); rk[3] = GETU32(VAR_0 + 12); if (VAR_1 == 128) { while (1) { temp = rk[3]; rk[4] = rk[0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[VAR_3]; rk[5] = rk[1] ^ rk[4]; rk[6] = rk[2] ^ rk[5]; rk[7] = rk[3] ^ rk[6]; if (++VAR_3 == 10) { return 0; } rk += 4; } } rk[4] = GETU32(VAR_0 + 16); rk[5] = GETU32(VAR_0 + 20); if (VAR_1 == 192) { while (1) { temp = rk[ 5]; rk[ 6] = rk[ 0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[VAR_3]; rk[ 7] = rk[ 1] ^ rk[ 6]; rk[ 8] = rk[ 2] ^ rk[ 7]; rk[ 9] = rk[ 3] ^ rk[ 8]; if (++VAR_3 == 8) { return 0; } rk[10] = rk[ 4] ^ rk[ 9]; rk[11] = rk[ 5] ^ rk[10]; rk += 6; } } rk[6] = GETU32(VAR_0 + 24); rk[7] = GETU32(VAR_0 + 28); if (VAR_1 == 256) { while (1) { temp = rk[ 7]; rk[ 8] = rk[ 0] ^ (AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[VAR_3]; rk[ 9] = rk[ 1] ^ rk[ 8]; rk[10] = rk[ 2] ^ rk[ 9]; rk[11] = rk[ 3] ^ rk[10]; if (++VAR_3 == 7) { return 0; } temp = rk[11]; rk[12] = rk[ 4] ^ (AES_Te4[(temp >> 24) ] & 0xff000000) ^ (AES_Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ (AES_Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ (AES_Te4[(temp ) & 0xff] & 0x000000ff); rk[13] = rk[ 5] ^ rk[12]; rk[14] = rk[ 6] ^ rk[13]; rk[15] = rk[ 7] ^ rk[14]; rk += 8; } } return 0; }
[ "int FUNC_0(const unsigned char *VAR_0, const int VAR_1,\nAES_KEY *VAR_2) {", "u32 *rk;", "int VAR_3 = 0;", "u32 temp;", "if (!VAR_0 || !VAR_2)\nreturn -1;", "if (VAR_1 != 128 && VAR_1 != 192 && VAR_1 != 256)\nreturn -2;", "rk = VAR_2->rd_key;", "if (VAR_1==128)\nVAR_2->rounds = 10;", "else if (VAR_1==192)\nVAR_2->rounds = 12;", "else\nVAR_2->rounds = 14;", "rk[0] = GETU32(VAR_0 );", "rk[1] = GETU32(VAR_0 + 4);", "rk[2] = GETU32(VAR_0 + 8);", "rk[3] = GETU32(VAR_0 + 12);", "if (VAR_1 == 128) {", "while (1) {", "temp = rk[3];", "rk[4] = rk[0] ^\n(AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^\n(AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^\n(AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^\n(AES_Te4[(temp >> 24) ] & 0x000000ff) ^\nrcon[VAR_3];", "rk[5] = rk[1] ^ rk[4];", "rk[6] = rk[2] ^ rk[5];", "rk[7] = rk[3] ^ rk[6];", "if (++VAR_3 == 10) {", "return 0;", "}", "rk += 4;", "}", "}", "rk[4] = GETU32(VAR_0 + 16);", "rk[5] = GETU32(VAR_0 + 20);", "if (VAR_1 == 192) {", "while (1) {", "temp = rk[ 5];", "rk[ 6] = rk[ 0] ^\n(AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^\n(AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^\n(AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^\n(AES_Te4[(temp >> 24) ] & 0x000000ff) ^\nrcon[VAR_3];", "rk[ 7] = rk[ 1] ^ rk[ 6];", "rk[ 8] = rk[ 2] ^ rk[ 7];", "rk[ 9] = rk[ 3] ^ rk[ 8];", "if (++VAR_3 == 8) {", "return 0;", "}", "rk[10] = rk[ 4] ^ rk[ 9];", "rk[11] = rk[ 5] ^ rk[10];", "rk += 6;", "}", "}", "rk[6] = GETU32(VAR_0 + 24);", "rk[7] = GETU32(VAR_0 + 28);", "if (VAR_1 == 256) {", "while (1) {", "temp = rk[ 7];", "rk[ 8] = rk[ 0] ^\n(AES_Te4[(temp >> 16) & 0xff] & 0xff000000) ^\n(AES_Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^\n(AES_Te4[(temp ) & 0xff] & 0x0000ff00) ^\n(AES_Te4[(temp >> 24) ] & 0x000000ff) ^\nrcon[VAR_3];", "rk[ 9] = rk[ 1] ^ rk[ 8];", "rk[10] = rk[ 2] ^ rk[ 9];", "rk[11] = rk[ 3] ^ rk[10];", "if (++VAR_3 == 7) {", "return 0;", "}", "temp = rk[11];", "rk[12] = rk[ 4] ^\n(AES_Te4[(temp >> 24) ] & 0xff000000) ^\n(AES_Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^\n(AES_Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^\n(AES_Te4[(temp ) & 0xff] & 0x000000ff);", "rk[13] = rk[ 5] ^ rk[12];", "rk[14] = rk[ 6] ^ rk[13];", "rk[15] = rk[ 7] ^ rk[14];", "rk += 8;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21 ], [ 25 ], [ 29, 31 ], [ 33, 35 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59, 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99, 101, 103, 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143, 145, 147, 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169, 171, 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ] ]
2,989
static void coroutine_fn mirror_pause(BlockJob *job) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common); mirror_drain(s); }
false
qemu
bae8196d9f97916de6323e70e3e374362ee16ec4
static void coroutine_fn mirror_pause(BlockJob *job) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common); mirror_drain(s); }
{ "code": [], "line_no": [] }
static void VAR_0 mirror_pause(BlockJob *job) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common); mirror_drain(s); }
[ "static void VAR_0 mirror_pause(BlockJob *job)\n{", "MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);", "mirror_drain(s);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
2,990
static Coroutine *coroutine_new(void) { const size_t stack_size = 1 << 20; CoroutineUContext *co; CoroutineThreadState *coTS; struct sigaction sa; struct sigaction osa; struct sigaltstack ss; struct sigaltstack oss; sigset_t sigs; sigset_t osigs; jmp_buf old_env; /* The way to manipulate stack is with the sigaltstack function. We * prepare a stack, with it delivering a signal to ourselves and then * put setjmp/longjmp where needed. * This has been done keeping coroutine-ucontext as a model and with the * pth ideas (GNU Portable Threads). See coroutine-ucontext for the basics * of the coroutines and see pth_mctx.c (from the pth project) for the * sigaltstack way of manipulating stacks. */ co = g_malloc0(sizeof(*co)); co->stack = g_malloc(stack_size); co->base.entry_arg = &old_env; /* stash away our jmp_buf */ coTS = coroutine_get_thread_state(); coTS->tr_handler = co; /* * Preserve the SIGUSR2 signal state, block SIGUSR2, * and establish our signal handler. The signal will * later transfer control onto the signal stack. */ sigemptyset(&sigs); sigaddset(&sigs, SIGUSR2); pthread_sigmask(SIG_BLOCK, &sigs, &osigs); sa.sa_handler = coroutine_trampoline; sigfillset(&sa.sa_mask); sa.sa_flags = SA_ONSTACK; if (sigaction(SIGUSR2, &sa, &osa) != 0) { abort(); } /* * Set the new stack. */ ss.ss_sp = co->stack; ss.ss_size = stack_size; ss.ss_flags = 0; if (sigaltstack(&ss, &oss) < 0) { abort(); } /* * Now transfer control onto the signal stack and set it up. * It will return immediately via "return" after the setjmp() * was performed. Be careful here with race conditions. The * signal can be delivered the first time sigsuspend() is * called. */ coTS->tr_called = 0; kill(getpid(), SIGUSR2); sigfillset(&sigs); sigdelset(&sigs, SIGUSR2); while (!coTS->tr_called) { sigsuspend(&sigs); } /* * Inform the system that we are back off the signal stack by * removing the alternative signal stack. Be careful here: It * first has to be disabled, before it can be removed. */ sigaltstack(NULL, &ss); ss.ss_flags = SS_DISABLE; if (sigaltstack(&ss, NULL) < 0) { abort(); } sigaltstack(NULL, &ss); if (!(oss.ss_flags & SS_DISABLE)) { sigaltstack(&oss, NULL); } /* * Restore the old SIGUSR2 signal handler and mask */ sigaction(SIGUSR2, &osa, NULL); pthread_sigmask(SIG_SETMASK, &osigs, NULL); /* * Now enter the trampoline again, but this time not as a signal * handler. Instead we jump into it directly. The functionally * redundant ping-pong pointer arithmentic is neccessary to avoid * type-conversion warnings related to the `volatile' qualifier and * the fact that `jmp_buf' usually is an array type. */ if (!setjmp(old_env)) { longjmp(coTS->tr_reenter, 1); } /* * Ok, we returned again, so now we're finished */ return &co->base; }
false
qemu
a31f053129f378ff0e8f6e855b3f35d21143b9ef
static Coroutine *coroutine_new(void) { const size_t stack_size = 1 << 20; CoroutineUContext *co; CoroutineThreadState *coTS; struct sigaction sa; struct sigaction osa; struct sigaltstack ss; struct sigaltstack oss; sigset_t sigs; sigset_t osigs; jmp_buf old_env; co = g_malloc0(sizeof(*co)); co->stack = g_malloc(stack_size); co->base.entry_arg = &old_env; coTS = coroutine_get_thread_state(); coTS->tr_handler = co; sigemptyset(&sigs); sigaddset(&sigs, SIGUSR2); pthread_sigmask(SIG_BLOCK, &sigs, &osigs); sa.sa_handler = coroutine_trampoline; sigfillset(&sa.sa_mask); sa.sa_flags = SA_ONSTACK; if (sigaction(SIGUSR2, &sa, &osa) != 0) { abort(); } ss.ss_sp = co->stack; ss.ss_size = stack_size; ss.ss_flags = 0; if (sigaltstack(&ss, &oss) < 0) { abort(); } coTS->tr_called = 0; kill(getpid(), SIGUSR2); sigfillset(&sigs); sigdelset(&sigs, SIGUSR2); while (!coTS->tr_called) { sigsuspend(&sigs); } sigaltstack(NULL, &ss); ss.ss_flags = SS_DISABLE; if (sigaltstack(&ss, NULL) < 0) { abort(); } sigaltstack(NULL, &ss); if (!(oss.ss_flags & SS_DISABLE)) { sigaltstack(&oss, NULL); } sigaction(SIGUSR2, &osa, NULL); pthread_sigmask(SIG_SETMASK, &osigs, NULL); if (!setjmp(old_env)) { longjmp(coTS->tr_reenter, 1); } return &co->base; }
{ "code": [], "line_no": [] }
static Coroutine *FUNC_0(void) { const size_t VAR_0 = 1 << 20; CoroutineUContext *co; CoroutineThreadState *coTS; struct sigaction VAR_1; struct sigaction VAR_2; struct sigaltstack VAR_3; struct sigaltstack VAR_4; sigset_t sigs; sigset_t osigs; jmp_buf old_env; co = g_malloc0(sizeof(*co)); co->stack = g_malloc(VAR_0); co->base.entry_arg = &old_env; coTS = coroutine_get_thread_state(); coTS->tr_handler = co; sigemptyset(&sigs); sigaddset(&sigs, SIGUSR2); pthread_sigmask(SIG_BLOCK, &sigs, &osigs); VAR_1.sa_handler = coroutine_trampoline; sigfillset(&VAR_1.sa_mask); VAR_1.sa_flags = SA_ONSTACK; if (sigaction(SIGUSR2, &VAR_1, &VAR_2) != 0) { abort(); } VAR_3.ss_sp = co->stack; VAR_3.ss_size = VAR_0; VAR_3.ss_flags = 0; if (sigaltstack(&VAR_3, &VAR_4) < 0) { abort(); } coTS->tr_called = 0; kill(getpid(), SIGUSR2); sigfillset(&sigs); sigdelset(&sigs, SIGUSR2); while (!coTS->tr_called) { sigsuspend(&sigs); } sigaltstack(NULL, &VAR_3); VAR_3.ss_flags = SS_DISABLE; if (sigaltstack(&VAR_3, NULL) < 0) { abort(); } sigaltstack(NULL, &VAR_3); if (!(VAR_4.ss_flags & SS_DISABLE)) { sigaltstack(&VAR_4, NULL); } sigaction(SIGUSR2, &VAR_2, NULL); pthread_sigmask(SIG_SETMASK, &osigs, NULL); if (!setjmp(old_env)) { longjmp(coTS->tr_reenter, 1); } return &co->base; }
[ "static Coroutine *FUNC_0(void)\n{", "const size_t VAR_0 = 1 << 20;", "CoroutineUContext *co;", "CoroutineThreadState *coTS;", "struct sigaction VAR_1;", "struct sigaction VAR_2;", "struct sigaltstack VAR_3;", "struct sigaltstack VAR_4;", "sigset_t sigs;", "sigset_t osigs;", "jmp_buf old_env;", "co = g_malloc0(sizeof(*co));", "co->stack = g_malloc(VAR_0);", "co->base.entry_arg = &old_env;", "coTS = coroutine_get_thread_state();", "coTS->tr_handler = co;", "sigemptyset(&sigs);", "sigaddset(&sigs, SIGUSR2);", "pthread_sigmask(SIG_BLOCK, &sigs, &osigs);", "VAR_1.sa_handler = coroutine_trampoline;", "sigfillset(&VAR_1.sa_mask);", "VAR_1.sa_flags = SA_ONSTACK;", "if (sigaction(SIGUSR2, &VAR_1, &VAR_2) != 0) {", "abort();", "}", "VAR_3.ss_sp = co->stack;", "VAR_3.ss_size = VAR_0;", "VAR_3.ss_flags = 0;", "if (sigaltstack(&VAR_3, &VAR_4) < 0) {", "abort();", "}", "coTS->tr_called = 0;", "kill(getpid(), SIGUSR2);", "sigfillset(&sigs);", "sigdelset(&sigs, SIGUSR2);", "while (!coTS->tr_called) {", "sigsuspend(&sigs);", "}", "sigaltstack(NULL, &VAR_3);", "VAR_3.ss_flags = SS_DISABLE;", "if (sigaltstack(&VAR_3, NULL) < 0) {", "abort();", "}", "sigaltstack(NULL, &VAR_3);", "if (!(VAR_4.ss_flags & SS_DISABLE)) {", "sigaltstack(&VAR_4, NULL);", "}", "sigaction(SIGUSR2, &VAR_2, NULL);", "pthread_sigmask(SIG_SETMASK, &osigs, NULL);", "if (!setjmp(old_env)) {", "longjmp(coTS->tr_reenter, 1);", "}", "return &co->base;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 175 ], [ 177 ], [ 195 ], [ 197 ], [ 199 ], [ 211 ], [ 213 ] ]
2,991
static AddressParts gen_lea_modrm_0(CPUX86State *env, DisasContext *s, int modrm) { int def_seg, base, index, scale, mod, rm; target_long disp; bool havesib; def_seg = R_DS; index = -1; scale = 0; disp = 0; mod = (modrm >> 6) & 3; rm = modrm & 7; base = rm | REX_B(s); if (mod == 3) { /* Normally filtered out earlier, but including this path simplifies multi-byte nop, as well as bndcl, bndcu, bndcn. */ goto done; } switch (s->aflag) { case MO_64: case MO_32: havesib = 0; if (rm == 4) { int code = cpu_ldub_code(env, s->pc++); scale = (code >> 6) & 3; index = ((code >> 3) & 7) | REX_X(s); if (index == 4) { index = -1; /* no index */ } base = (code & 7) | REX_B(s); havesib = 1; } switch (mod) { case 0: if ((base & 7) == 5) { base = -1; disp = (int32_t)cpu_ldl_code(env, s->pc); s->pc += 4; if (CODE64(s) && !havesib) { base = -2; disp += s->pc + s->rip_offset; } } break; case 1: disp = (int8_t)cpu_ldub_code(env, s->pc++); break; default: case 2: disp = (int32_t)cpu_ldl_code(env, s->pc); s->pc += 4; break; } /* For correct popl handling with esp. */ if (base == R_ESP && s->popl_esp_hack) { disp += s->popl_esp_hack; } if (base == R_EBP || base == R_ESP) { def_seg = R_SS; } break; case MO_16: if (mod == 0) { if (rm == 6) { base = -1; disp = cpu_lduw_code(env, s->pc); s->pc += 2; break; } } else if (mod == 1) { disp = (int8_t)cpu_ldub_code(env, s->pc++); } else { disp = (int16_t)cpu_lduw_code(env, s->pc); s->pc += 2; } switch (rm) { case 0: base = R_EBX; index = R_ESI; break; case 1: base = R_EBX; index = R_EDI; break; case 2: base = R_EBP; index = R_ESI; def_seg = R_SS; break; case 3: base = R_EBP; index = R_EDI; def_seg = R_SS; break; case 4: base = R_ESI; break; case 5: base = R_EDI; break; case 6: base = R_EBP; def_seg = R_SS; break; default: case 7: base = R_EBX; break; } break; default: tcg_abort(); } done: return (AddressParts){ def_seg, base, index, scale, disp }; }
false
qemu
e3af7c788b73a6495eb9d94992ef11f6ad6f3c56
static AddressParts gen_lea_modrm_0(CPUX86State *env, DisasContext *s, int modrm) { int def_seg, base, index, scale, mod, rm; target_long disp; bool havesib; def_seg = R_DS; index = -1; scale = 0; disp = 0; mod = (modrm >> 6) & 3; rm = modrm & 7; base = rm | REX_B(s); if (mod == 3) { goto done; } switch (s->aflag) { case MO_64: case MO_32: havesib = 0; if (rm == 4) { int code = cpu_ldub_code(env, s->pc++); scale = (code >> 6) & 3; index = ((code >> 3) & 7) | REX_X(s); if (index == 4) { index = -1; } base = (code & 7) | REX_B(s); havesib = 1; } switch (mod) { case 0: if ((base & 7) == 5) { base = -1; disp = (int32_t)cpu_ldl_code(env, s->pc); s->pc += 4; if (CODE64(s) && !havesib) { base = -2; disp += s->pc + s->rip_offset; } } break; case 1: disp = (int8_t)cpu_ldub_code(env, s->pc++); break; default: case 2: disp = (int32_t)cpu_ldl_code(env, s->pc); s->pc += 4; break; } if (base == R_ESP && s->popl_esp_hack) { disp += s->popl_esp_hack; } if (base == R_EBP || base == R_ESP) { def_seg = R_SS; } break; case MO_16: if (mod == 0) { if (rm == 6) { base = -1; disp = cpu_lduw_code(env, s->pc); s->pc += 2; break; } } else if (mod == 1) { disp = (int8_t)cpu_ldub_code(env, s->pc++); } else { disp = (int16_t)cpu_lduw_code(env, s->pc); s->pc += 2; } switch (rm) { case 0: base = R_EBX; index = R_ESI; break; case 1: base = R_EBX; index = R_EDI; break; case 2: base = R_EBP; index = R_ESI; def_seg = R_SS; break; case 3: base = R_EBP; index = R_EDI; def_seg = R_SS; break; case 4: base = R_ESI; break; case 5: base = R_EDI; break; case 6: base = R_EBP; def_seg = R_SS; break; default: case 7: base = R_EBX; break; } break; default: tcg_abort(); } done: return (AddressParts){ def_seg, base, index, scale, disp }; }
{ "code": [], "line_no": [] }
static AddressParts FUNC_0(CPUX86State *env, DisasContext *s, int modrm) { int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; target_long disp; bool havesib; VAR_0 = R_DS; VAR_2 = -1; VAR_3 = 0; disp = 0; VAR_4 = (modrm >> 6) & 3; VAR_5 = modrm & 7; VAR_1 = VAR_5 | REX_B(s); if (VAR_4 == 3) { goto done; } switch (s->aflag) { case MO_64: case MO_32: havesib = 0; if (VAR_5 == 4) { int VAR_6 = cpu_ldub_code(env, s->pc++); VAR_3 = (VAR_6 >> 6) & 3; VAR_2 = ((VAR_6 >> 3) & 7) | REX_X(s); if (VAR_2 == 4) { VAR_2 = -1; } VAR_1 = (VAR_6 & 7) | REX_B(s); havesib = 1; } switch (VAR_4) { case 0: if ((VAR_1 & 7) == 5) { VAR_1 = -1; disp = (int32_t)cpu_ldl_code(env, s->pc); s->pc += 4; if (CODE64(s) && !havesib) { VAR_1 = -2; disp += s->pc + s->rip_offset; } } break; case 1: disp = (int8_t)cpu_ldub_code(env, s->pc++); break; default: case 2: disp = (int32_t)cpu_ldl_code(env, s->pc); s->pc += 4; break; } if (VAR_1 == R_ESP && s->popl_esp_hack) { disp += s->popl_esp_hack; } if (VAR_1 == R_EBP || VAR_1 == R_ESP) { VAR_0 = R_SS; } break; case MO_16: if (VAR_4 == 0) { if (VAR_5 == 6) { VAR_1 = -1; disp = cpu_lduw_code(env, s->pc); s->pc += 2; break; } } else if (VAR_4 == 1) { disp = (int8_t)cpu_ldub_code(env, s->pc++); } else { disp = (int16_t)cpu_lduw_code(env, s->pc); s->pc += 2; } switch (VAR_5) { case 0: VAR_1 = R_EBX; VAR_2 = R_ESI; break; case 1: VAR_1 = R_EBX; VAR_2 = R_EDI; break; case 2: VAR_1 = R_EBP; VAR_2 = R_ESI; VAR_0 = R_SS; break; case 3: VAR_1 = R_EBP; VAR_2 = R_EDI; VAR_0 = R_SS; break; case 4: VAR_1 = R_ESI; break; case 5: VAR_1 = R_EDI; break; case 6: VAR_1 = R_EBP; VAR_0 = R_SS; break; default: case 7: VAR_1 = R_EBX; break; } break; default: tcg_abort(); } done: return (AddressParts){ VAR_0, VAR_1, VAR_2, VAR_3, disp }; }
[ "static AddressParts FUNC_0(CPUX86State *env, DisasContext *s,\nint modrm)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "target_long disp;", "bool havesib;", "VAR_0 = R_DS;", "VAR_2 = -1;", "VAR_3 = 0;", "disp = 0;", "VAR_4 = (modrm >> 6) & 3;", "VAR_5 = modrm & 7;", "VAR_1 = VAR_5 | REX_B(s);", "if (VAR_4 == 3) {", "goto done;", "}", "switch (s->aflag) {", "case MO_64:\ncase MO_32:\nhavesib = 0;", "if (VAR_5 == 4) {", "int VAR_6 = cpu_ldub_code(env, s->pc++);", "VAR_3 = (VAR_6 >> 6) & 3;", "VAR_2 = ((VAR_6 >> 3) & 7) | REX_X(s);", "if (VAR_2 == 4) {", "VAR_2 = -1;", "}", "VAR_1 = (VAR_6 & 7) | REX_B(s);", "havesib = 1;", "}", "switch (VAR_4) {", "case 0:\nif ((VAR_1 & 7) == 5) {", "VAR_1 = -1;", "disp = (int32_t)cpu_ldl_code(env, s->pc);", "s->pc += 4;", "if (CODE64(s) && !havesib) {", "VAR_1 = -2;", "disp += s->pc + s->rip_offset;", "}", "}", "break;", "case 1:\ndisp = (int8_t)cpu_ldub_code(env, s->pc++);", "break;", "default:\ncase 2:\ndisp = (int32_t)cpu_ldl_code(env, s->pc);", "s->pc += 4;", "break;", "}", "if (VAR_1 == R_ESP && s->popl_esp_hack) {", "disp += s->popl_esp_hack;", "}", "if (VAR_1 == R_EBP || VAR_1 == R_ESP) {", "VAR_0 = R_SS;", "}", "break;", "case MO_16:\nif (VAR_4 == 0) {", "if (VAR_5 == 6) {", "VAR_1 = -1;", "disp = cpu_lduw_code(env, s->pc);", "s->pc += 2;", "break;", "}", "} else if (VAR_4 == 1) {", "disp = (int8_t)cpu_ldub_code(env, s->pc++);", "} else {", "disp = (int16_t)cpu_lduw_code(env, s->pc);", "s->pc += 2;", "}", "switch (VAR_5) {", "case 0:\nVAR_1 = R_EBX;", "VAR_2 = R_ESI;", "break;", "case 1:\nVAR_1 = R_EBX;", "VAR_2 = R_EDI;", "break;", "case 2:\nVAR_1 = R_EBP;", "VAR_2 = R_ESI;", "VAR_0 = R_SS;", "break;", "case 3:\nVAR_1 = R_EBP;", "VAR_2 = R_EDI;", "VAR_0 = R_SS;", "break;", "case 4:\nVAR_1 = R_ESI;", "break;", "case 5:\nVAR_1 = R_EDI;", "break;", "case 6:\nVAR_1 = R_EBP;", "VAR_0 = R_SS;", "break;", "default:\ncase 7:\nVAR_1 = R_EBX;", "break;", "}", "break;", "default:\ntcg_abort();", "}", "done:\nreturn (AddressParts){ VAR_0, VAR_1, VAR_2, VAR_3, disp };", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105, 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225, 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239, 241 ], [ 243 ], [ 247, 249 ], [ 251 ] ]
2,992
static int omap_validate_local_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return addr >= OMAP_LOCALBUS_BASE && addr < OMAP_LOCALBUS_BASE + 0x1000000; }
false
qemu
45416789e8ccced568a4984af61974adfbfa0f62
static int omap_validate_local_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return addr >= OMAP_LOCALBUS_BASE && addr < OMAP_LOCALBUS_BASE + 0x1000000; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct omap_mpu_state_s *VAR_0, target_phys_addr_t VAR_1) { return VAR_1 >= OMAP_LOCALBUS_BASE && VAR_1 < OMAP_LOCALBUS_BASE + 0x1000000; }
[ "static int FUNC_0(struct omap_mpu_state_s *VAR_0,\ntarget_phys_addr_t VAR_1)\n{", "return VAR_1 >= OMAP_LOCALBUS_BASE && VAR_1 < OMAP_LOCALBUS_BASE + 0x1000000;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
2,993
int net_init_bridge(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { const NetdevBridgeOptions *bridge; const char *helper, *br; TAPState *s; int fd, vnet_hdr; assert(opts->type == NET_CLIENT_OPTIONS_KIND_BRIDGE); bridge = opts->u.bridge; helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER; br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE; fd = net_bridge_run_helper(helper, br, errp); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper, br); return 0; }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
int net_init_bridge(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { const NetdevBridgeOptions *bridge; const char *helper, *br; TAPState *s; int fd, vnet_hdr; assert(opts->type == NET_CLIENT_OPTIONS_KIND_BRIDGE); bridge = opts->u.bridge; helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER; br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE; fd = net_bridge_run_helper(helper, br, errp); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper, br); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1, NetClientState *VAR_2, Error **VAR_3) { const NetdevBridgeOptions *VAR_4; const char *VAR_5, *VAR_6; TAPState *s; int VAR_7, VAR_8; assert(VAR_0->type == NET_CLIENT_OPTIONS_KIND_BRIDGE); VAR_4 = VAR_0->u.VAR_4; VAR_5 = VAR_4->has_helper ? VAR_4->VAR_5 : DEFAULT_BRIDGE_HELPER; VAR_6 = VAR_4->has_br ? VAR_4->VAR_6 : DEFAULT_BRIDGE_INTERFACE; VAR_7 = net_bridge_run_helper(VAR_5, VAR_6, VAR_3); if (VAR_7 == -1) { return -1; } fcntl(VAR_7, F_SETFL, O_NONBLOCK); VAR_8 = tap_probe_vnet_hdr(VAR_7); s = net_tap_fd_init(VAR_2, "VAR_4", VAR_1, VAR_7, VAR_8); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "VAR_5=%s,VAR_6=%s", VAR_5, VAR_6); return 0; }
[ "int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,\nNetClientState *VAR_2, Error **VAR_3)\n{", "const NetdevBridgeOptions *VAR_4;", "const char *VAR_5, *VAR_6;", "TAPState *s;", "int VAR_7, VAR_8;", "assert(VAR_0->type == NET_CLIENT_OPTIONS_KIND_BRIDGE);", "VAR_4 = VAR_0->u.VAR_4;", "VAR_5 = VAR_4->has_helper ? VAR_4->VAR_5 : DEFAULT_BRIDGE_HELPER;", "VAR_6 = VAR_4->has_br ? VAR_4->VAR_6 : DEFAULT_BRIDGE_INTERFACE;", "VAR_7 = net_bridge_run_helper(VAR_5, VAR_6, VAR_3);", "if (VAR_7 == -1) {", "return -1;", "}", "fcntl(VAR_7, F_SETFL, O_NONBLOCK);", "VAR_8 = tap_probe_vnet_hdr(VAR_7);", "s = net_tap_fd_init(VAR_2, \"VAR_4\", VAR_1, VAR_7, VAR_8);", "snprintf(s->nc.info_str, sizeof(s->nc.info_str), \"VAR_5=%s,VAR_6=%s\", VAR_5,\nVAR_6);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 55 ] ]
2,994
static inline void t_gen_raise_exception(uint32_t index) { tcg_gen_helper_0_1(helper_raise_exception, tcg_const_tl(index)); }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static inline void t_gen_raise_exception(uint32_t index) { tcg_gen_helper_0_1(helper_raise_exception, tcg_const_tl(index)); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(uint32_t VAR_0) { tcg_gen_helper_0_1(helper_raise_exception, tcg_const_tl(VAR_0)); }
[ "static inline void FUNC_0(uint32_t VAR_0)\n{", "tcg_gen_helper_0_1(helper_raise_exception, tcg_const_tl(VAR_0));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,995
uint64_t ram_bytes_total(void) { return last_ram_offset; }
false
qemu
ad96090a01d848df67d70c5259ed8aa321fa8716
uint64_t ram_bytes_total(void) { return last_ram_offset; }
{ "code": [], "line_no": [] }
uint64_t FUNC_0(void) { return last_ram_offset; }
[ "uint64_t FUNC_0(void)\n{", "return last_ram_offset;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
2,997
void ff_g729_postfilter(DSPContext *dsp, int16_t* ht_prev_data, int* voicing, const int16_t *lp_filter_coeffs, int pitch_delay_int, int16_t* residual, int16_t* res_filter_data, int16_t* pos_filter_data, int16_t *speech, int subframe_size) { int16_t residual_filt_buf[SUBFRAME_SIZE+10]; int16_t lp_gn[33]; // (3.12) int16_t lp_gd[11]; // (3.12) int tilt_comp_coeff; int i; /* Zero-filling is necessary for tilt-compensation filter. */ memset(lp_gn, 0, 33 * sizeof(int16_t)); /* Calculate A(z/FORMANT_PP_FACTOR_NUM) filter coefficients. */ for (i = 0; i < 10; i++) lp_gn[i + 11] = (lp_filter_coeffs[i + 1] * formant_pp_factor_num_pow[i] + 0x4000) >> 15; /* Calculate A(z/FORMANT_PP_FACTOR_DEN) filter coefficients. */ for (i = 0; i < 10; i++) lp_gd[i + 1] = (lp_filter_coeffs[i + 1] * formant_pp_factor_den_pow[i] + 0x4000) >> 15; /* residual signal calculation (one-half of short-term postfilter) */ memcpy(speech - 10, res_filter_data, 10 * sizeof(int16_t)); residual_filter(residual + RES_PREV_DATA_SIZE, lp_gn + 11, speech, subframe_size); /* Save data to use it in the next subframe. */ memcpy(res_filter_data, speech + subframe_size - 10, 10 * sizeof(int16_t)); /* long-term filter. If long-term prediction gain is larger than 3dB (returned value is nonzero) then declare current subframe as periodic. */ *voicing = FFMAX(*voicing, long_term_filter(dsp, pitch_delay_int, residual, residual_filt_buf + 10, subframe_size)); /* shift residual for using in next subframe */ memmove(residual, residual + subframe_size, RES_PREV_DATA_SIZE * sizeof(int16_t)); /* short-term filter tilt compensation */ tilt_comp_coeff = get_tilt_comp(dsp, lp_gn, lp_gd, residual_filt_buf + 10, subframe_size); /* Apply second half of short-term postfilter: 1/A(z/FORMANT_PP_FACTOR_DEN) */ ff_celp_lp_synthesis_filter(pos_filter_data + 10, lp_gd + 1, residual_filt_buf + 10, subframe_size, 10, 0, 0, 0x800); memcpy(pos_filter_data, pos_filter_data + subframe_size, 10 * sizeof(int16_t)); *ht_prev_data = apply_tilt_comp(speech, pos_filter_data + 10, tilt_comp_coeff, subframe_size, *ht_prev_data); }
false
FFmpeg
fe70c1f45f108c73ebb9c23009e271a96336796f
void ff_g729_postfilter(DSPContext *dsp, int16_t* ht_prev_data, int* voicing, const int16_t *lp_filter_coeffs, int pitch_delay_int, int16_t* residual, int16_t* res_filter_data, int16_t* pos_filter_data, int16_t *speech, int subframe_size) { int16_t residual_filt_buf[SUBFRAME_SIZE+10]; int16_t lp_gn[33]; int16_t lp_gd[11]; int tilt_comp_coeff; int i; memset(lp_gn, 0, 33 * sizeof(int16_t)); for (i = 0; i < 10; i++) lp_gn[i + 11] = (lp_filter_coeffs[i + 1] * formant_pp_factor_num_pow[i] + 0x4000) >> 15; for (i = 0; i < 10; i++) lp_gd[i + 1] = (lp_filter_coeffs[i + 1] * formant_pp_factor_den_pow[i] + 0x4000) >> 15; memcpy(speech - 10, res_filter_data, 10 * sizeof(int16_t)); residual_filter(residual + RES_PREV_DATA_SIZE, lp_gn + 11, speech, subframe_size); memcpy(res_filter_data, speech + subframe_size - 10, 10 * sizeof(int16_t)); *voicing = FFMAX(*voicing, long_term_filter(dsp, pitch_delay_int, residual, residual_filt_buf + 10, subframe_size)); memmove(residual, residual + subframe_size, RES_PREV_DATA_SIZE * sizeof(int16_t)); tilt_comp_coeff = get_tilt_comp(dsp, lp_gn, lp_gd, residual_filt_buf + 10, subframe_size); ff_celp_lp_synthesis_filter(pos_filter_data + 10, lp_gd + 1, residual_filt_buf + 10, subframe_size, 10, 0, 0, 0x800); memcpy(pos_filter_data, pos_filter_data + subframe_size, 10 * sizeof(int16_t)); *ht_prev_data = apply_tilt_comp(speech, pos_filter_data + 10, tilt_comp_coeff, subframe_size, *ht_prev_data); }
{ "code": [], "line_no": [] }
void FUNC_0(DSPContext *VAR_0, int16_t* VAR_1, int* VAR_2, const int16_t *VAR_3, int VAR_4, int16_t* VAR_5, int16_t* VAR_6, int16_t* VAR_7, int16_t *VAR_8, int VAR_9) { int16_t residual_filt_buf[SUBFRAME_SIZE+10]; int16_t lp_gn[33]; int16_t lp_gd[11]; int VAR_10; int VAR_11; memset(lp_gn, 0, 33 * sizeof(int16_t)); for (VAR_11 = 0; VAR_11 < 10; VAR_11++) lp_gn[VAR_11 + 11] = (VAR_3[VAR_11 + 1] * formant_pp_factor_num_pow[VAR_11] + 0x4000) >> 15; for (VAR_11 = 0; VAR_11 < 10; VAR_11++) lp_gd[VAR_11 + 1] = (VAR_3[VAR_11 + 1] * formant_pp_factor_den_pow[VAR_11] + 0x4000) >> 15; memcpy(VAR_8 - 10, VAR_6, 10 * sizeof(int16_t)); residual_filter(VAR_5 + RES_PREV_DATA_SIZE, lp_gn + 11, VAR_8, VAR_9); memcpy(VAR_6, VAR_8 + VAR_9 - 10, 10 * sizeof(int16_t)); *VAR_2 = FFMAX(*VAR_2, long_term_filter(VAR_0, VAR_4, VAR_5, residual_filt_buf + 10, VAR_9)); memmove(VAR_5, VAR_5 + VAR_9, RES_PREV_DATA_SIZE * sizeof(int16_t)); VAR_10 = get_tilt_comp(VAR_0, lp_gn, lp_gd, residual_filt_buf + 10, VAR_9); ff_celp_lp_synthesis_filter(VAR_7 + 10, lp_gd + 1, residual_filt_buf + 10, VAR_9, 10, 0, 0, 0x800); memcpy(VAR_7, VAR_7 + VAR_9, 10 * sizeof(int16_t)); *VAR_1 = apply_tilt_comp(VAR_8, VAR_7 + 10, VAR_10, VAR_9, *VAR_1); }
[ "void FUNC_0(DSPContext *VAR_0, int16_t* VAR_1, int* VAR_2,\nconst int16_t *VAR_3, int VAR_4,\nint16_t* VAR_5, int16_t* VAR_6,\nint16_t* VAR_7, int16_t *VAR_8, int VAR_9)\n{", "int16_t residual_filt_buf[SUBFRAME_SIZE+10];", "int16_t lp_gn[33];", "int16_t lp_gd[11];", "int VAR_10;", "int VAR_11;", "memset(lp_gn, 0, 33 * sizeof(int16_t));", "for (VAR_11 = 0; VAR_11 < 10; VAR_11++)", "lp_gn[VAR_11 + 11] = (VAR_3[VAR_11 + 1] * formant_pp_factor_num_pow[VAR_11] + 0x4000) >> 15;", "for (VAR_11 = 0; VAR_11 < 10; VAR_11++)", "lp_gd[VAR_11 + 1] = (VAR_3[VAR_11 + 1] * formant_pp_factor_den_pow[VAR_11] + 0x4000) >> 15;", "memcpy(VAR_8 - 10, VAR_6, 10 * sizeof(int16_t));", "residual_filter(VAR_5 + RES_PREV_DATA_SIZE, lp_gn + 11, VAR_8, VAR_9);", "memcpy(VAR_6, VAR_8 + VAR_9 - 10, 10 * sizeof(int16_t));", "*VAR_2 = FFMAX(*VAR_2, long_term_filter(VAR_0, VAR_4,\nVAR_5, residual_filt_buf + 10,\nVAR_9));", "memmove(VAR_5, VAR_5 + VAR_9, RES_PREV_DATA_SIZE * sizeof(int16_t));", "VAR_10 = get_tilt_comp(VAR_0, lp_gn, lp_gd, residual_filt_buf + 10, VAR_9);", "ff_celp_lp_synthesis_filter(VAR_7 + 10, lp_gd + 1,\nresidual_filt_buf + 10,\nVAR_9, 10, 0, 0, 0x800);", "memcpy(VAR_7, VAR_7 + VAR_9, 10 * sizeof(int16_t));", "*VAR_1 = apply_tilt_comp(VAR_8, VAR_7 + 10, VAR_10,\nVAR_9, *VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 53 ], [ 61, 63, 65 ], [ 71 ], [ 77 ], [ 83, 85, 87 ], [ 89 ], [ 93, 95 ], [ 97 ] ]
2,998
static int asink_query_formats(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; unsigned i; int ret; if (buf->sample_fmts_size % sizeof(*buf->sample_fmts) || buf->sample_rates_size % sizeof(*buf->sample_rates) || buf->channel_layouts_size % sizeof(*buf->channel_layouts) || buf->channel_counts_size % sizeof(*buf->channel_counts)) { av_log(ctx, AV_LOG_ERROR, "Invalid size for format lists\n"); #define LOG_ERROR(field) \ if (buf->field ## _size % sizeof(*buf->field)) \ av_log(ctx, AV_LOG_ERROR, " " #field " is %d, should be " \ "multiple of %d\n", \ buf->field ## _size, (int)sizeof(*buf->field)); LOG_ERROR(sample_fmts); LOG_ERROR(sample_rates); LOG_ERROR(channel_layouts); LOG_ERROR(channel_counts); #undef LOG_ERROR return AVERROR(EINVAL); } if (buf->sample_fmts_size) { for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++) if ((ret = ff_add_format(&formats, buf->sample_fmts[i])) < 0) return ret; ff_set_common_formats(ctx, formats); } if (buf->channel_layouts_size || buf->channel_counts_size || buf->all_channel_counts) { for (i = 0; i < NB_ITEMS(buf->channel_layouts); i++) if ((ret = ff_add_channel_layout(&layouts, buf->channel_layouts[i])) < 0) return ret; for (i = 0; i < NB_ITEMS(buf->channel_counts); i++) if ((ret = ff_add_channel_layout(&layouts, FF_COUNT2LAYOUT(buf->channel_counts[i]))) < 0) return ret; if (buf->all_channel_counts) { if (layouts) av_log(ctx, AV_LOG_WARNING, "Conflicting all_channel_counts and list in options\n"); else if (!(layouts = ff_all_channel_counts())) return AVERROR(ENOMEM); } ff_set_common_channel_layouts(ctx, layouts); } if (buf->sample_rates_size) { formats = NULL; for (i = 0; i < NB_ITEMS(buf->sample_rates); i++) if ((ret = ff_add_format(&formats, buf->sample_rates[i])) < 0) return ret; ff_set_common_samplerates(ctx, formats); } return 0; }
false
FFmpeg
6fbb21d6858b9d0152f89e1b30ffe683a9d33948
static int asink_query_formats(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; unsigned i; int ret; if (buf->sample_fmts_size % sizeof(*buf->sample_fmts) || buf->sample_rates_size % sizeof(*buf->sample_rates) || buf->channel_layouts_size % sizeof(*buf->channel_layouts) || buf->channel_counts_size % sizeof(*buf->channel_counts)) { av_log(ctx, AV_LOG_ERROR, "Invalid size for format lists\n"); #define LOG_ERROR(field) \ if (buf->field ## _size % sizeof(*buf->field)) \ av_log(ctx, AV_LOG_ERROR, " " #field " is %d, should be " \ "multiple of %d\n", \ buf->field ## _size, (int)sizeof(*buf->field)); LOG_ERROR(sample_fmts); LOG_ERROR(sample_rates); LOG_ERROR(channel_layouts); LOG_ERROR(channel_counts); #undef LOG_ERROR return AVERROR(EINVAL); } if (buf->sample_fmts_size) { for (i = 0; i < NB_ITEMS(buf->sample_fmts); i++) if ((ret = ff_add_format(&formats, buf->sample_fmts[i])) < 0) return ret; ff_set_common_formats(ctx, formats); } if (buf->channel_layouts_size || buf->channel_counts_size || buf->all_channel_counts) { for (i = 0; i < NB_ITEMS(buf->channel_layouts); i++) if ((ret = ff_add_channel_layout(&layouts, buf->channel_layouts[i])) < 0) return ret; for (i = 0; i < NB_ITEMS(buf->channel_counts); i++) if ((ret = ff_add_channel_layout(&layouts, FF_COUNT2LAYOUT(buf->channel_counts[i]))) < 0) return ret; if (buf->all_channel_counts) { if (layouts) av_log(ctx, AV_LOG_WARNING, "Conflicting all_channel_counts and list in options\n"); else if (!(layouts = ff_all_channel_counts())) return AVERROR(ENOMEM); } ff_set_common_channel_layouts(ctx, layouts); } if (buf->sample_rates_size) { formats = NULL; for (i = 0; i < NB_ITEMS(buf->sample_rates); i++) if ((ret = ff_add_format(&formats, buf->sample_rates[i])) < 0) return ret; ff_set_common_samplerates(ctx, formats); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0) { BufferSinkContext *buf = VAR_0->priv; AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; unsigned VAR_1; int VAR_2; if (buf->sample_fmts_size % sizeof(*buf->sample_fmts) || buf->sample_rates_size % sizeof(*buf->sample_rates) || buf->channel_layouts_size % sizeof(*buf->channel_layouts) || buf->channel_counts_size % sizeof(*buf->channel_counts)) { av_log(VAR_0, AV_LOG_ERROR, "Invalid size for format lists\n"); #define LOG_ERROR(field) \ if (buf->field ## _size % sizeof(*buf->field)) \ av_log(VAR_0, AV_LOG_ERROR, " " #field " is %d, should be " \ "multiple of %d\n", \ buf->field ## _size, (int)sizeof(*buf->field)); LOG_ERROR(sample_fmts); LOG_ERROR(sample_rates); LOG_ERROR(channel_layouts); LOG_ERROR(channel_counts); #undef LOG_ERROR return AVERROR(EINVAL); } if (buf->sample_fmts_size) { for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->sample_fmts); VAR_1++) if ((VAR_2 = ff_add_format(&formats, buf->sample_fmts[VAR_1])) < 0) return VAR_2; ff_set_common_formats(VAR_0, formats); } if (buf->channel_layouts_size || buf->channel_counts_size || buf->all_channel_counts) { for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->channel_layouts); VAR_1++) if ((VAR_2 = ff_add_channel_layout(&layouts, buf->channel_layouts[VAR_1])) < 0) return VAR_2; for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->channel_counts); VAR_1++) if ((VAR_2 = ff_add_channel_layout(&layouts, FF_COUNT2LAYOUT(buf->channel_counts[VAR_1]))) < 0) return VAR_2; if (buf->all_channel_counts) { if (layouts) av_log(VAR_0, AV_LOG_WARNING, "Conflicting all_channel_counts and list in options\n"); else if (!(layouts = ff_all_channel_counts())) return AVERROR(ENOMEM); } ff_set_common_channel_layouts(VAR_0, layouts); } if (buf->sample_rates_size) { formats = NULL; for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->sample_rates); VAR_1++) if ((VAR_2 = ff_add_format(&formats, buf->sample_rates[VAR_1])) < 0) return VAR_2; ff_set_common_samplerates(VAR_0, formats); } return 0; }
[ "static int FUNC_0(AVFilterContext *VAR_0)\n{", "BufferSinkContext *buf = VAR_0->priv;", "AVFilterFormats *formats = NULL;", "AVFilterChannelLayouts *layouts = NULL;", "unsigned VAR_1;", "int VAR_2;", "if (buf->sample_fmts_size % sizeof(*buf->sample_fmts) ||\nbuf->sample_rates_size % sizeof(*buf->sample_rates) ||\nbuf->channel_layouts_size % sizeof(*buf->channel_layouts) ||\nbuf->channel_counts_size % sizeof(*buf->channel_counts)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid size for format lists\\n\");", "#define LOG_ERROR(field) \\\nif (buf->field ## _size % sizeof(*buf->field)) \\\nav_log(VAR_0, AV_LOG_ERROR, \" \" #field \" is %d, should be \" \\\n\"multiple of %d\\n\", \\\nbuf->field ## _size, (int)sizeof(*buf->field));", "LOG_ERROR(sample_fmts);", "LOG_ERROR(sample_rates);", "LOG_ERROR(channel_layouts);", "LOG_ERROR(channel_counts);", "#undef LOG_ERROR\nreturn AVERROR(EINVAL);", "}", "if (buf->sample_fmts_size) {", "for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->sample_fmts); VAR_1++)", "if ((VAR_2 = ff_add_format(&formats, buf->sample_fmts[VAR_1])) < 0)\nreturn VAR_2;", "ff_set_common_formats(VAR_0, formats);", "}", "if (buf->channel_layouts_size || buf->channel_counts_size ||\nbuf->all_channel_counts) {", "for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->channel_layouts); VAR_1++)", "if ((VAR_2 = ff_add_channel_layout(&layouts, buf->channel_layouts[VAR_1])) < 0)\nreturn VAR_2;", "for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->channel_counts); VAR_1++)", "if ((VAR_2 = ff_add_channel_layout(&layouts, FF_COUNT2LAYOUT(buf->channel_counts[VAR_1]))) < 0)\nreturn VAR_2;", "if (buf->all_channel_counts) {", "if (layouts)\nav_log(VAR_0, AV_LOG_WARNING,\n\"Conflicting all_channel_counts and list in options\\n\");", "else if (!(layouts = ff_all_channel_counts()))\nreturn AVERROR(ENOMEM);", "}", "ff_set_common_channel_layouts(VAR_0, layouts);", "}", "if (buf->sample_rates_size) {", "formats = NULL;", "for (VAR_1 = 0; VAR_1 < NB_ITEMS(buf->sample_rates); VAR_1++)", "if ((VAR_2 = ff_add_format(&formats, buf->sample_rates[VAR_1])) < 0)\nreturn VAR_2;", "ff_set_common_samplerates(VAR_0, formats);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19, 21, 23 ], [ 25 ], [ 27, 29, 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ] ]
2,999
void avcodec_set_dimensions(AVCodecContext *s, int width, int height){ s->coded_width = width; s->coded_height= height; s->width = width; s->height = height; }
false
FFmpeg
70d54392f5015b9c6594fcae558f59f952501e3b
void avcodec_set_dimensions(AVCodecContext *s, int width, int height){ s->coded_width = width; s->coded_height= height; s->width = width; s->height = height; }
{ "code": [], "line_no": [] }
void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2){ VAR_0->coded_width = VAR_1; VAR_0->coded_height= VAR_2; VAR_0->VAR_1 = VAR_1; VAR_0->VAR_2 = VAR_2; }
[ "void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2){", "VAR_0->coded_width = VAR_1;", "VAR_0->coded_height= VAR_2;", "VAR_0->VAR_1 = VAR_1;", "VAR_0->VAR_2 = VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
3,000
int qemu_acl_remove(qemu_acl *acl, const char *match) { qemu_acl_entry *entry; int i = 0; QTAILQ_FOREACH(entry, &acl->entries, next) { i++; if (strcmp(entry->match, match) == 0) { QTAILQ_REMOVE(&acl->entries, entry, next); return i; } } return -1; }
true
qemu
c23c15d30b901bb447cdcada96cae64c0046d146
int qemu_acl_remove(qemu_acl *acl, const char *match) { qemu_acl_entry *entry; int i = 0; QTAILQ_FOREACH(entry, &acl->entries, next) { i++; if (strcmp(entry->match, match) == 0) { QTAILQ_REMOVE(&acl->entries, entry, next); return i; } } return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(qemu_acl *VAR_0, const char *VAR_1) { qemu_acl_entry *entry; int VAR_2 = 0; QTAILQ_FOREACH(entry, &VAR_0->entries, next) { VAR_2++; if (strcmp(entry->VAR_1, VAR_1) == 0) { QTAILQ_REMOVE(&VAR_0->entries, entry, next); return VAR_2; } } return -1; }
[ "int FUNC_0(qemu_acl *VAR_0,\nconst char *VAR_1)\n{", "qemu_acl_entry *entry;", "int VAR_2 = 0;", "QTAILQ_FOREACH(entry, &VAR_0->entries, next) {", "VAR_2++;", "if (strcmp(entry->VAR_1, VAR_1) == 0) {", "QTAILQ_REMOVE(&VAR_0->entries, entry, next);", "return VAR_2;", "}", "}", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ] ]
3,002
static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size) { SDHCIState *s = (SDHCIState *)opaque; uint32_t ret = 0; switch (offset & ~0x3) { case SDHC_SYSAD: ret = s->sdmasysad; break; case SDHC_BLKSIZE: ret = s->blksize | (s->blkcnt << 16); break; case SDHC_ARGUMENT: ret = s->argument; break; case SDHC_TRNMOD: ret = s->trnmod | (s->cmdreg << 16); break; case SDHC_RSPREG0 ... SDHC_RSPREG3: ret = s->rspreg[((offset & ~0x3) - SDHC_RSPREG0) >> 2]; break; case SDHC_BDATA: if (sdhci_buff_access_is_sequential(s, offset - SDHC_BDATA)) { ret = sdhci_read_dataport(s, size); DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, ret, ret); return ret; } break; case SDHC_PRNSTS: ret = s->prnsts; break; case SDHC_HOSTCTL: ret = s->hostctl | (s->pwrcon << 8) | (s->blkgap << 16) | (s->wakcon << 24); break; case SDHC_CLKCON: ret = s->clkcon | (s->timeoutcon << 16); break; case SDHC_NORINTSTS: ret = s->norintsts | (s->errintsts << 16); break; case SDHC_NORINTSTSEN: ret = s->norintstsen | (s->errintstsen << 16); break; case SDHC_NORINTSIGEN: ret = s->norintsigen | (s->errintsigen << 16); break; case SDHC_ACMD12ERRSTS: ret = s->acmd12errsts; break; case SDHC_CAPAREG: ret = s->capareg; break; case SDHC_MAXCURR: ret = s->maxcurr; break; case SDHC_ADMAERR: ret = s->admaerr; break; case SDHC_ADMASYSADDR: ret = (uint32_t)s->admasysaddr; break; case SDHC_ADMASYSADDR + 4: ret = (uint32_t)(s->admasysaddr >> 32); break; case SDHC_SLOT_INT_STATUS: ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s); break; default: qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " " "not implemented\n", size, offset); break; } ret >>= (offset & 0x3) * 8; ret &= (1ULL << (size * 8)) - 1; DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, ret, ret); return ret; }
true
qemu
8be487d8f184f2f721cabeac559fb7a6cba18c95
static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size) { SDHCIState *s = (SDHCIState *)opaque; uint32_t ret = 0; switch (offset & ~0x3) { case SDHC_SYSAD: ret = s->sdmasysad; break; case SDHC_BLKSIZE: ret = s->blksize | (s->blkcnt << 16); break; case SDHC_ARGUMENT: ret = s->argument; break; case SDHC_TRNMOD: ret = s->trnmod | (s->cmdreg << 16); break; case SDHC_RSPREG0 ... SDHC_RSPREG3: ret = s->rspreg[((offset & ~0x3) - SDHC_RSPREG0) >> 2]; break; case SDHC_BDATA: if (sdhci_buff_access_is_sequential(s, offset - SDHC_BDATA)) { ret = sdhci_read_dataport(s, size); DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, ret, ret); return ret; } break; case SDHC_PRNSTS: ret = s->prnsts; break; case SDHC_HOSTCTL: ret = s->hostctl | (s->pwrcon << 8) | (s->blkgap << 16) | (s->wakcon << 24); break; case SDHC_CLKCON: ret = s->clkcon | (s->timeoutcon << 16); break; case SDHC_NORINTSTS: ret = s->norintsts | (s->errintsts << 16); break; case SDHC_NORINTSTSEN: ret = s->norintstsen | (s->errintstsen << 16); break; case SDHC_NORINTSIGEN: ret = s->norintsigen | (s->errintsigen << 16); break; case SDHC_ACMD12ERRSTS: ret = s->acmd12errsts; break; case SDHC_CAPAREG: ret = s->capareg; break; case SDHC_MAXCURR: ret = s->maxcurr; break; case SDHC_ADMAERR: ret = s->admaerr; break; case SDHC_ADMASYSADDR: ret = (uint32_t)s->admasysaddr; break; case SDHC_ADMASYSADDR + 4: ret = (uint32_t)(s->admasysaddr >> 32); break; case SDHC_SLOT_INT_STATUS: ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s); break; default: qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " " "not implemented\n", size, offset); break; } ret >>= (offset & 0x3) * 8; ret &= (1ULL << (size * 8)) - 1; DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, ret, ret); return ret; }
{ "code": [ " DPRINT_L2(\"read %ub: addr[0x%04x] -> %u(0x%x)\\n\", size, (int)offset,", " ret, ret);", " DPRINT_L2(\"read %ub: addr[0x%04x] -> %u(0x%x)\\n\", size, (int)offset, ret, ret);" ], "line_no": [ 49, 51, 155 ] }
static uint64_t FUNC_0(void *opaque, hwaddr offset, unsigned size) { SDHCIState *s = (SDHCIState *)opaque; uint32_t ret = 0; switch (offset & ~0x3) { case SDHC_SYSAD: ret = s->sdmasysad; break; case SDHC_BLKSIZE: ret = s->blksize | (s->blkcnt << 16); break; case SDHC_ARGUMENT: ret = s->argument; break; case SDHC_TRNMOD: ret = s->trnmod | (s->cmdreg << 16); break; case SDHC_RSPREG0 ... SDHC_RSPREG3: ret = s->rspreg[((offset & ~0x3) - SDHC_RSPREG0) >> 2]; break; case SDHC_BDATA: if (sdhci_buff_access_is_sequential(s, offset - SDHC_BDATA)) { ret = sdhci_read_dataport(s, size); DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, ret, ret); return ret; } break; case SDHC_PRNSTS: ret = s->prnsts; break; case SDHC_HOSTCTL: ret = s->hostctl | (s->pwrcon << 8) | (s->blkgap << 16) | (s->wakcon << 24); break; case SDHC_CLKCON: ret = s->clkcon | (s->timeoutcon << 16); break; case SDHC_NORINTSTS: ret = s->norintsts | (s->errintsts << 16); break; case SDHC_NORINTSTSEN: ret = s->norintstsen | (s->errintstsen << 16); break; case SDHC_NORINTSIGEN: ret = s->norintsigen | (s->errintsigen << 16); break; case SDHC_ACMD12ERRSTS: ret = s->acmd12errsts; break; case SDHC_CAPAREG: ret = s->capareg; break; case SDHC_MAXCURR: ret = s->maxcurr; break; case SDHC_ADMAERR: ret = s->admaerr; break; case SDHC_ADMASYSADDR: ret = (uint32_t)s->admasysaddr; break; case SDHC_ADMASYSADDR + 4: ret = (uint32_t)(s->admasysaddr >> 32); break; case SDHC_SLOT_INT_STATUS: ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s); break; default: qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " " "not implemented\n", size, offset); break; } ret >>= (offset & 0x3) * 8; ret &= (1ULL << (size * 8)) - 1; DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, ret, ret); return ret; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr offset, unsigned size)\n{", "SDHCIState *s = (SDHCIState *)opaque;", "uint32_t ret = 0;", "switch (offset & ~0x3) {", "case SDHC_SYSAD:\nret = s->sdmasysad;", "break;", "case SDHC_BLKSIZE:\nret = s->blksize | (s->blkcnt << 16);", "break;", "case SDHC_ARGUMENT:\nret = s->argument;", "break;", "case SDHC_TRNMOD:\nret = s->trnmod | (s->cmdreg << 16);", "break;", "case SDHC_RSPREG0 ... SDHC_RSPREG3:\nret = s->rspreg[((offset & ~0x3) - SDHC_RSPREG0) >> 2];", "break;", "case SDHC_BDATA:\nif (sdhci_buff_access_is_sequential(s, offset - SDHC_BDATA)) {", "ret = sdhci_read_dataport(s, size);", "DPRINT_L2(\"read %ub: addr[0x%04x] -> %u(0x%x)\\n\", size, (int)offset,\nret, ret);", "return ret;", "}", "break;", "case SDHC_PRNSTS:\nret = s->prnsts;", "break;", "case SDHC_HOSTCTL:\nret = s->hostctl | (s->pwrcon << 8) | (s->blkgap << 16) |\n(s->wakcon << 24);", "break;", "case SDHC_CLKCON:\nret = s->clkcon | (s->timeoutcon << 16);", "break;", "case SDHC_NORINTSTS:\nret = s->norintsts | (s->errintsts << 16);", "break;", "case SDHC_NORINTSTSEN:\nret = s->norintstsen | (s->errintstsen << 16);", "break;", "case SDHC_NORINTSIGEN:\nret = s->norintsigen | (s->errintsigen << 16);", "break;", "case SDHC_ACMD12ERRSTS:\nret = s->acmd12errsts;", "break;", "case SDHC_CAPAREG:\nret = s->capareg;", "break;", "case SDHC_MAXCURR:\nret = s->maxcurr;", "break;", "case SDHC_ADMAERR:\nret = s->admaerr;", "break;", "case SDHC_ADMASYSADDR:\nret = (uint32_t)s->admasysaddr;", "break;", "case SDHC_ADMASYSADDR + 4:\nret = (uint32_t)(s->admasysaddr >> 32);", "break;", "case SDHC_SLOT_INT_STATUS:\nret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s);", "break;", "default:\nqemu_log_mask(LOG_UNIMP, \"SDHC rd_%ub @0x%02\" HWADDR_PRIx \" \"\n\"not implemented\\n\", size, offset);", "break;", "}", "ret >>= (offset & 0x3) * 8;", "ret &= (1ULL << (size * 8)) - 1;", "DPRINT_L2(\"read %ub: addr[0x%04x] -> %u(0x%x)\\n\", size, (int)offset, ret, ret);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139, 141, 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ] ]
3,004
static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){ Plane *p= &s->plane[plane_index]; const int mb_w= s->b_width << s->block_max_depth; const int mb_h= s->b_height << s->block_max_depth; int x, y, mb_x; int block_size = MB_SIZE >> s->block_max_depth; int block_w = plane_index ? block_size>>s->chroma_h_shift : block_size; int block_h = plane_index ? block_size>>s->chroma_v_shift : block_size; const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth]; int obmc_stride= plane_index ? (2*block_size)>>s->chroma_h_shift : 2*block_size; int ref_stride= s->current_picture->linesize[plane_index]; uint8_t *dst8= s->current_picture->data[plane_index]; int w= p->width; int h= p->height; if(s->keyframe || (s->avctx->debug&512)){ if(mb_y==mb_h) return; if(add){ for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){ // DWTELEM * line = slice_buffer_get_line(sb, y); IDWTELEM * line = sb->line[y]; for(x=0; x<w; x++){ // int v= buf[x + y*w] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); v >>= FRAC_BITS; if(v&(~255)) v= ~(v>>31); dst8[x + y*ref_stride]= v; } } }else{ for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){ // DWTELEM * line = slice_buffer_get_line(sb, y); IDWTELEM * line = sb->line[y]; for(x=0; x<w; x++){ line[x] -= 128 << FRAC_BITS; // buf[x + y*w]-= 128<<FRAC_BITS; } } } return; } for(mb_x=0; mb_x<=mb_w; mb_x++){ add_yblock(s, 1, sb, old_buffer, dst8, obmc, block_w*mb_x - block_w/2, block_h*mb_y - block_h/2, block_w, block_h, w, h, w, ref_stride, obmc_stride, mb_x - 1, mb_y - 1, add, 0, plane_index); } if(s->avmv && mb_y < mb_h && plane_index == 0) for(mb_x=0; mb_x<mb_w; mb_x++){ AVMotionVector *avmv = s->avmv + (s->avmv_index++); const int b_width = s->b_width << s->block_max_depth; const int b_stride= b_width; BlockNode *bn= &s->block[mb_x + mb_y*b_stride]; if (bn->type) continue; avmv->w = block_w; avmv->h = block_h; avmv->dst_x = block_w*mb_x - block_w/2; avmv->dst_y = block_h*mb_y - block_h/2; avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8; avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8; avmv->source= -1 - bn->ref; avmv->flags = 0; } }
true
FFmpeg
6c91afe4973f25f050c8b704b62a8367fc5e7a8c
static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){ Plane *p= &s->plane[plane_index]; const int mb_w= s->b_width << s->block_max_depth; const int mb_h= s->b_height << s->block_max_depth; int x, y, mb_x; int block_size = MB_SIZE >> s->block_max_depth; int block_w = plane_index ? block_size>>s->chroma_h_shift : block_size; int block_h = plane_index ? block_size>>s->chroma_v_shift : block_size; const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth]; int obmc_stride= plane_index ? (2*block_size)>>s->chroma_h_shift : 2*block_size; int ref_stride= s->current_picture->linesize[plane_index]; uint8_t *dst8= s->current_picture->data[plane_index]; int w= p->width; int h= p->height; if(s->keyframe || (s->avctx->debug&512)){ if(mb_y==mb_h) return; if(add){ for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){ IDWTELEM * line = sb->line[y]; for(x=0; x<w; x++){ int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); v >>= FRAC_BITS; if(v&(~255)) v= ~(v>>31); dst8[x + y*ref_stride]= v; } } }else{ for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){ IDWTELEM * line = sb->line[y]; for(x=0; x<w; x++){ line[x] -= 128 << FRAC_BITS; } } } return; } for(mb_x=0; mb_x<=mb_w; mb_x++){ add_yblock(s, 1, sb, old_buffer, dst8, obmc, block_w*mb_x - block_w/2, block_h*mb_y - block_h/2, block_w, block_h, w, h, w, ref_stride, obmc_stride, mb_x - 1, mb_y - 1, add, 0, plane_index); } if(s->avmv && mb_y < mb_h && plane_index == 0) for(mb_x=0; mb_x<mb_w; mb_x++){ AVMotionVector *avmv = s->avmv + (s->avmv_index++); const int b_width = s->b_width << s->block_max_depth; const int b_stride= b_width; BlockNode *bn= &s->block[mb_x + mb_y*b_stride]; if (bn->type) continue; avmv->w = block_w; avmv->h = block_h; avmv->dst_x = block_w*mb_x - block_w/2; avmv->dst_y = block_h*mb_y - block_h/2; avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8; avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8; avmv->source= -1 - bn->ref; avmv->flags = 0; } }
{ "code": [ " AVMotionVector *avmv = s->avmv + (s->avmv_index++);" ], "line_no": [ 117 ] }
static av_always_inline void FUNC_0(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){ Plane *p= &s->plane[plane_index]; const int VAR_0= s->VAR_14 << s->block_max_depth; const int VAR_1= s->b_height << s->block_max_depth; int VAR_2, VAR_3, VAR_4; int VAR_5 = MB_SIZE >> s->block_max_depth; int VAR_6 = plane_index ? VAR_5>>s->chroma_h_shift : VAR_5; int VAR_7 = plane_index ? VAR_5>>s->chroma_v_shift : VAR_5; const uint8_t *VAR_8 = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth]; int VAR_9= plane_index ? (2*VAR_5)>>s->chroma_h_shift : 2*VAR_5; int VAR_10= s->current_picture->linesize[plane_index]; uint8_t *dst8= s->current_picture->data[plane_index]; int VAR_11= p->width; int VAR_12= p->height; if(s->keyframe || (s->avctx->debug&512)){ if(mb_y==VAR_1) return; if(add){ for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){ IDWTELEM * line = sb->line[VAR_3]; for(VAR_2=0; VAR_2<VAR_11; VAR_2++){ int VAR_13= line[VAR_2] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); VAR_13 >>= FRAC_BITS; if(VAR_13&(~255)) VAR_13= ~(VAR_13>>31); dst8[VAR_2 + VAR_3*VAR_10]= VAR_13; } } }else{ for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){ IDWTELEM * line = sb->line[VAR_3]; for(VAR_2=0; VAR_2<VAR_11; VAR_2++){ line[VAR_2] -= 128 << FRAC_BITS; } } } return; } for(VAR_4=0; VAR_4<=VAR_0; VAR_4++){ add_yblock(s, 1, sb, old_buffer, dst8, VAR_8, VAR_6*VAR_4 - VAR_6/2, VAR_7*mb_y - VAR_7/2, VAR_6, VAR_7, VAR_11, VAR_12, VAR_11, VAR_10, VAR_9, VAR_4 - 1, mb_y - 1, add, 0, plane_index); } if(s->avmv && mb_y < VAR_1 && plane_index == 0) for(VAR_4=0; VAR_4<VAR_0; VAR_4++){ AVMotionVector *avmv = s->avmv + (s->avmv_index++); const int VAR_14 = s->VAR_14 << s->block_max_depth; const int VAR_15= VAR_14; BlockNode *bn= &s->block[VAR_4 + mb_y*VAR_15]; if (bn->type) continue; avmv->VAR_11 = VAR_6; avmv->VAR_12 = VAR_7; avmv->dst_x = VAR_6*VAR_4 - VAR_6/2; avmv->dst_y = VAR_7*mb_y - VAR_7/2; avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8; avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8; avmv->source= -1 - bn->ref; avmv->flags = 0; } }
[ "static av_always_inline void FUNC_0(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){", "Plane *p= &s->plane[plane_index];", "const int VAR_0= s->VAR_14 << s->block_max_depth;", "const int VAR_1= s->b_height << s->block_max_depth;", "int VAR_2, VAR_3, VAR_4;", "int VAR_5 = MB_SIZE >> s->block_max_depth;", "int VAR_6 = plane_index ? VAR_5>>s->chroma_h_shift : VAR_5;", "int VAR_7 = plane_index ? VAR_5>>s->chroma_v_shift : VAR_5;", "const uint8_t *VAR_8 = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth];", "int VAR_9= plane_index ? (2*VAR_5)>>s->chroma_h_shift : 2*VAR_5;", "int VAR_10= s->current_picture->linesize[plane_index];", "uint8_t *dst8= s->current_picture->data[plane_index];", "int VAR_11= p->width;", "int VAR_12= p->height;", "if(s->keyframe || (s->avctx->debug&512)){", "if(mb_y==VAR_1)\nreturn;", "if(add){", "for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){", "IDWTELEM * line = sb->line[VAR_3];", "for(VAR_2=0; VAR_2<VAR_11; VAR_2++){", "int VAR_13= line[VAR_2] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));", "VAR_13 >>= FRAC_BITS;", "if(VAR_13&(~255)) VAR_13= ~(VAR_13>>31);", "dst8[VAR_2 + VAR_3*VAR_10]= VAR_13;", "}", "}", "}else{", "for(VAR_3=VAR_7*mb_y; VAR_3<FFMIN(VAR_12,VAR_7*(mb_y+1)); VAR_3++){", "IDWTELEM * line = sb->line[VAR_3];", "for(VAR_2=0; VAR_2<VAR_11; VAR_2++){", "line[VAR_2] -= 128 << FRAC_BITS;", "}", "}", "}", "return;", "}", "for(VAR_4=0; VAR_4<=VAR_0; VAR_4++){", "add_yblock(s, 1, sb, old_buffer, dst8, VAR_8,\nVAR_6*VAR_4 - VAR_6/2,\nVAR_7*mb_y - VAR_7/2,\nVAR_6, VAR_7,\nVAR_11, VAR_12,\nVAR_11, VAR_10, VAR_9,\nVAR_4 - 1, mb_y - 1,\nadd, 0, plane_index);", "}", "if(s->avmv && mb_y < VAR_1 && plane_index == 0)\nfor(VAR_4=0; VAR_4<VAR_0; VAR_4++){", "AVMotionVector *avmv = s->avmv + (s->avmv_index++);", "const int VAR_14 = s->VAR_14 << s->block_max_depth;", "const int VAR_15= VAR_14;", "BlockNode *bn= &s->block[VAR_4 + mb_y*VAR_15];", "if (bn->type)\ncontinue;", "avmv->VAR_11 = VAR_6;", "avmv->VAR_12 = VAR_7;", "avmv->dst_x = VAR_6*VAR_4 - VAR_6/2;", "avmv->dst_y = VAR_7*mb_y - VAR_7/2;", "avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8;", "avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8;", "avmv->source= -1 - bn->ref;", "avmv->flags = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95, 97, 99, 101, 103, 105, 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
3,005
static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, struct elfhdr *exec, struct image_info *info, struct image_info *interp_info) { abi_ulong sp; abi_ulong u_argc, u_argv, u_envp, u_auxv; int size; int i; abi_ulong u_rand_bytes; uint8_t k_rand_bytes[16]; abi_ulong u_platform; const char *k_platform; const int n = sizeof(elf_addr_t); sp = p; #ifdef CONFIG_USE_FDPIC /* Needs to be before we load the env/argc/... */ if (elf_is_fdpic(exec)) { /* Need 4 byte alignment for these structs */ sp &= ~3; sp = loader_build_fdpic_loadmap(info, sp); info->other_info = interp_info; if (interp_info) { interp_info->other_info = info; sp = loader_build_fdpic_loadmap(interp_info, sp); } } #endif u_platform = 0; k_platform = ELF_PLATFORM; if (k_platform) { size_t len = strlen(k_platform) + 1; if (STACK_GROWS_DOWN) { sp -= (len + n - 1) & ~(n - 1); u_platform = sp; /* FIXME - check return value of memcpy_to_target() for failure */ memcpy_to_target(sp, k_platform, len); } else { memcpy_to_target(sp, k_platform, len); u_platform = sp; sp += len + 1; } } /* Provide 16 byte alignment for the PRNG, and basic alignment for * the argv and envp pointers. */ if (STACK_GROWS_DOWN) { sp = QEMU_ALIGN_DOWN(sp, 16); } else { sp = QEMU_ALIGN_UP(sp, 16); } /* * Generate 16 random bytes for userspace PRNG seeding (not * cryptically secure but it's not the aim of QEMU). */ for (i = 0; i < 16; i++) { k_rand_bytes[i] = rand(); } if (STACK_GROWS_DOWN) { sp -= 16; u_rand_bytes = sp; /* FIXME - check return value of memcpy_to_target() for failure */ memcpy_to_target(sp, k_rand_bytes, 16); } else { memcpy_to_target(sp, k_rand_bytes, 16); u_rand_bytes = sp; sp += 16; } size = (DLINFO_ITEMS + 1) * 2; if (k_platform) size += 2; #ifdef DLINFO_ARCH_ITEMS size += DLINFO_ARCH_ITEMS * 2; #endif #ifdef ELF_HWCAP2 size += 2; #endif size += envc + argc + 2; size += 1; /* argc itself */ size *= n; /* Allocate space and finalize stack alignment for entry now. */ if (STACK_GROWS_DOWN) { u_argc = QEMU_ALIGN_DOWN(sp - size, STACK_ALIGNMENT); sp = u_argc; } else { u_argc = sp; sp = QEMU_ALIGN_UP(sp + size, STACK_ALIGNMENT); } u_argv = u_argc + n; u_envp = u_argv + (argc + 1) * n; u_auxv = u_envp + (envc + 1) * n; info->saved_auxv = u_auxv; info->arg_start = u_argv; info->arg_end = u_argv + argc * n; /* This is correct because Linux defines * elf_addr_t as Elf32_Off / Elf64_Off */ #define NEW_AUX_ENT(id, val) do { \ put_user_ual(id, u_auxv); u_auxv += n; \ put_user_ual(val, u_auxv); u_auxv += n; \ } while(0) /* There must be exactly DLINFO_ITEMS entries here. */ #ifdef ARCH_DLINFO /* * ARCH_DLINFO must come first so platform specific code can enforce * special alignment requirements on the AUXV if necessary (eg. PPC). */ ARCH_DLINFO; #endif NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff)); NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr))); NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum)); NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE, getpagesize()))); NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0)); NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0); NEW_AUX_ENT(AT_ENTRY, info->entry); NEW_AUX_ENT(AT_UID, (abi_ulong) getuid()); NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid()); NEW_AUX_ENT(AT_GID, (abi_ulong) getgid()); NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid()); NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP); NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK)); NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes); #ifdef ELF_HWCAP2 NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2); #endif if (u_platform) { NEW_AUX_ENT(AT_PLATFORM, u_platform); } NEW_AUX_ENT (AT_NULL, 0); #undef NEW_AUX_ENT info->auxv_len = u_argv - info->saved_auxv; put_user_ual(argc, u_argc); p = info->arg_strings; for (i = 0; i < argc; ++i) { put_user_ual(p, u_argv); u_argv += n; p += target_strlen(p) + 1; } put_user_ual(0, u_argv); p = info->env_strings; for (i = 0; i < envc; ++i) { put_user_ual(p, u_envp); u_envp += n; p += target_strlen(p) + 1; } put_user_ual(0, u_envp); return sp; }
true
qemu
f516511ea84d8bb3395d6ea95a7c7b80dc2a05e9
static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, struct elfhdr *exec, struct image_info *info, struct image_info *interp_info) { abi_ulong sp; abi_ulong u_argc, u_argv, u_envp, u_auxv; int size; int i; abi_ulong u_rand_bytes; uint8_t k_rand_bytes[16]; abi_ulong u_platform; const char *k_platform; const int n = sizeof(elf_addr_t); sp = p; #ifdef CONFIG_USE_FDPIC if (elf_is_fdpic(exec)) { sp &= ~3; sp = loader_build_fdpic_loadmap(info, sp); info->other_info = interp_info; if (interp_info) { interp_info->other_info = info; sp = loader_build_fdpic_loadmap(interp_info, sp); } } #endif u_platform = 0; k_platform = ELF_PLATFORM; if (k_platform) { size_t len = strlen(k_platform) + 1; if (STACK_GROWS_DOWN) { sp -= (len + n - 1) & ~(n - 1); u_platform = sp; memcpy_to_target(sp, k_platform, len); } else { memcpy_to_target(sp, k_platform, len); u_platform = sp; sp += len + 1; } } if (STACK_GROWS_DOWN) { sp = QEMU_ALIGN_DOWN(sp, 16); } else { sp = QEMU_ALIGN_UP(sp, 16); } for (i = 0; i < 16; i++) { k_rand_bytes[i] = rand(); } if (STACK_GROWS_DOWN) { sp -= 16; u_rand_bytes = sp; memcpy_to_target(sp, k_rand_bytes, 16); } else { memcpy_to_target(sp, k_rand_bytes, 16); u_rand_bytes = sp; sp += 16; } size = (DLINFO_ITEMS + 1) * 2; if (k_platform) size += 2; #ifdef DLINFO_ARCH_ITEMS size += DLINFO_ARCH_ITEMS * 2; #endif #ifdef ELF_HWCAP2 size += 2; #endif size += envc + argc + 2; size += 1; size *= n; if (STACK_GROWS_DOWN) { u_argc = QEMU_ALIGN_DOWN(sp - size, STACK_ALIGNMENT); sp = u_argc; } else { u_argc = sp; sp = QEMU_ALIGN_UP(sp + size, STACK_ALIGNMENT); } u_argv = u_argc + n; u_envp = u_argv + (argc + 1) * n; u_auxv = u_envp + (envc + 1) * n; info->saved_auxv = u_auxv; info->arg_start = u_argv; info->arg_end = u_argv + argc * n; #define NEW_AUX_ENT(id, val) do { \ put_user_ual(id, u_auxv); u_auxv += n; \ put_user_ual(val, u_auxv); u_auxv += n; \ } while(0) #ifdef ARCH_DLINFO ARCH_DLINFO; #endif NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff)); NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr))); NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum)); NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE, getpagesize()))); NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0)); NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0); NEW_AUX_ENT(AT_ENTRY, info->entry); NEW_AUX_ENT(AT_UID, (abi_ulong) getuid()); NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid()); NEW_AUX_ENT(AT_GID, (abi_ulong) getgid()); NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid()); NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP); NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK)); NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes); #ifdef ELF_HWCAP2 NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2); #endif if (u_platform) { NEW_AUX_ENT(AT_PLATFORM, u_platform); } NEW_AUX_ENT (AT_NULL, 0); #undef NEW_AUX_ENT info->auxv_len = u_argv - info->saved_auxv; put_user_ual(argc, u_argc); p = info->arg_strings; for (i = 0; i < argc; ++i) { put_user_ual(p, u_argv); u_argv += n; p += target_strlen(p) + 1; } put_user_ual(0, u_argv); p = info->env_strings; for (i = 0; i < envc; ++i) { put_user_ual(p, u_envp); u_envp += n; p += target_strlen(p) + 1; } put_user_ual(0, u_envp); return sp; }
{ "code": [ " info->auxv_len = u_argv - info->saved_auxv;" ], "line_no": [ 289 ] }
static abi_ulong FUNC_0(abi_ulong p, int argc, int envc, struct elfhdr *exec, struct image_info *info, struct image_info *interp_info) { abi_ulong sp; abi_ulong u_argc, u_argv, u_envp, u_auxv; int VAR_0; int VAR_1; abi_ulong u_rand_bytes; uint8_t k_rand_bytes[16]; abi_ulong u_platform; const char *VAR_2; const int VAR_3 = sizeof(elf_addr_t); sp = p; #ifdef CONFIG_USE_FDPIC if (elf_is_fdpic(exec)) { sp &= ~3; sp = loader_build_fdpic_loadmap(info, sp); info->other_info = interp_info; if (interp_info) { interp_info->other_info = info; sp = loader_build_fdpic_loadmap(interp_info, sp); } } #endif u_platform = 0; VAR_2 = ELF_PLATFORM; if (VAR_2) { size_t len = strlen(VAR_2) + 1; if (STACK_GROWS_DOWN) { sp -= (len + VAR_3 - 1) & ~(VAR_3 - 1); u_platform = sp; memcpy_to_target(sp, VAR_2, len); } else { memcpy_to_target(sp, VAR_2, len); u_platform = sp; sp += len + 1; } } if (STACK_GROWS_DOWN) { sp = QEMU_ALIGN_DOWN(sp, 16); } else { sp = QEMU_ALIGN_UP(sp, 16); } for (VAR_1 = 0; VAR_1 < 16; VAR_1++) { k_rand_bytes[VAR_1] = rand(); } if (STACK_GROWS_DOWN) { sp -= 16; u_rand_bytes = sp; memcpy_to_target(sp, k_rand_bytes, 16); } else { memcpy_to_target(sp, k_rand_bytes, 16); u_rand_bytes = sp; sp += 16; } VAR_0 = (DLINFO_ITEMS + 1) * 2; if (VAR_2) VAR_0 += 2; #ifdef DLINFO_ARCH_ITEMS VAR_0 += DLINFO_ARCH_ITEMS * 2; #endif #ifdef ELF_HWCAP2 VAR_0 += 2; #endif VAR_0 += envc + argc + 2; VAR_0 += 1; VAR_0 *= VAR_3; if (STACK_GROWS_DOWN) { u_argc = QEMU_ALIGN_DOWN(sp - VAR_0, STACK_ALIGNMENT); sp = u_argc; } else { u_argc = sp; sp = QEMU_ALIGN_UP(sp + VAR_0, STACK_ALIGNMENT); } u_argv = u_argc + VAR_3; u_envp = u_argv + (argc + 1) * VAR_3; u_auxv = u_envp + (envc + 1) * VAR_3; info->saved_auxv = u_auxv; info->arg_start = u_argv; info->arg_end = u_argv + argc * VAR_3; #define NEW_AUX_ENT(id, val) do { \ put_user_ual(id, u_auxv); u_auxv += VAR_3; \ put_user_ual(val, u_auxv); u_auxv += VAR_3; \ } while(0) #ifdef ARCH_DLINFO ARCH_DLINFO; #endif NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff)); NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr))); NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum)); NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE, getpagesize()))); NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0)); NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0); NEW_AUX_ENT(AT_ENTRY, info->entry); NEW_AUX_ENT(AT_UID, (abi_ulong) getuid()); NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid()); NEW_AUX_ENT(AT_GID, (abi_ulong) getgid()); NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid()); NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP); NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK)); NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes); #ifdef ELF_HWCAP2 NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2); #endif if (u_platform) { NEW_AUX_ENT(AT_PLATFORM, u_platform); } NEW_AUX_ENT (AT_NULL, 0); #undef NEW_AUX_ENT info->auxv_len = u_argv - info->saved_auxv; put_user_ual(argc, u_argc); p = info->arg_strings; for (VAR_1 = 0; VAR_1 < argc; ++VAR_1) { put_user_ual(p, u_argv); u_argv += VAR_3; p += target_strlen(p) + 1; } put_user_ual(0, u_argv); p = info->env_strings; for (VAR_1 = 0; VAR_1 < envc; ++VAR_1) { put_user_ual(p, u_envp); u_envp += VAR_3; p += target_strlen(p) + 1; } put_user_ual(0, u_envp); return sp; }
[ "static abi_ulong FUNC_0(abi_ulong p, int argc, int envc,\nstruct elfhdr *exec,\nstruct image_info *info,\nstruct image_info *interp_info)\n{", "abi_ulong sp;", "abi_ulong u_argc, u_argv, u_envp, u_auxv;", "int VAR_0;", "int VAR_1;", "abi_ulong u_rand_bytes;", "uint8_t k_rand_bytes[16];", "abi_ulong u_platform;", "const char *VAR_2;", "const int VAR_3 = sizeof(elf_addr_t);", "sp = p;", "#ifdef CONFIG_USE_FDPIC\nif (elf_is_fdpic(exec)) {", "sp &= ~3;", "sp = loader_build_fdpic_loadmap(info, sp);", "info->other_info = interp_info;", "if (interp_info) {", "interp_info->other_info = info;", "sp = loader_build_fdpic_loadmap(interp_info, sp);", "}", "}", "#endif\nu_platform = 0;", "VAR_2 = ELF_PLATFORM;", "if (VAR_2) {", "size_t len = strlen(VAR_2) + 1;", "if (STACK_GROWS_DOWN) {", "sp -= (len + VAR_3 - 1) & ~(VAR_3 - 1);", "u_platform = sp;", "memcpy_to_target(sp, VAR_2, len);", "} else {", "memcpy_to_target(sp, VAR_2, len);", "u_platform = sp;", "sp += len + 1;", "}", "}", "if (STACK_GROWS_DOWN) {", "sp = QEMU_ALIGN_DOWN(sp, 16);", "} else {", "sp = QEMU_ALIGN_UP(sp, 16);", "}", "for (VAR_1 = 0; VAR_1 < 16; VAR_1++) {", "k_rand_bytes[VAR_1] = rand();", "}", "if (STACK_GROWS_DOWN) {", "sp -= 16;", "u_rand_bytes = sp;", "memcpy_to_target(sp, k_rand_bytes, 16);", "} else {", "memcpy_to_target(sp, k_rand_bytes, 16);", "u_rand_bytes = sp;", "sp += 16;", "}", "VAR_0 = (DLINFO_ITEMS + 1) * 2;", "if (VAR_2)\nVAR_0 += 2;", "#ifdef DLINFO_ARCH_ITEMS\nVAR_0 += DLINFO_ARCH_ITEMS * 2;", "#endif\n#ifdef ELF_HWCAP2\nVAR_0 += 2;", "#endif\nVAR_0 += envc + argc + 2;", "VAR_0 += 1;", "VAR_0 *= VAR_3;", "if (STACK_GROWS_DOWN) {", "u_argc = QEMU_ALIGN_DOWN(sp - VAR_0, STACK_ALIGNMENT);", "sp = u_argc;", "} else {", "u_argc = sp;", "sp = QEMU_ALIGN_UP(sp + VAR_0, STACK_ALIGNMENT);", "}", "u_argv = u_argc + VAR_3;", "u_envp = u_argv + (argc + 1) * VAR_3;", "u_auxv = u_envp + (envc + 1) * VAR_3;", "info->saved_auxv = u_auxv;", "info->arg_start = u_argv;", "info->arg_end = u_argv + argc * VAR_3;", "#define NEW_AUX_ENT(id, val) do { \\", "put_user_ual(id, u_auxv); u_auxv += VAR_3; \\", "put_user_ual(val, u_auxv); u_auxv += VAR_3; \\", "} while(0)", "#ifdef ARCH_DLINFO\nARCH_DLINFO;", "#endif\nNEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff));", "NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));", "NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));", "NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE, getpagesize())));", "NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0));", "NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0);", "NEW_AUX_ENT(AT_ENTRY, info->entry);", "NEW_AUX_ENT(AT_UID, (abi_ulong) getuid());", "NEW_AUX_ENT(AT_EUID, (abi_ulong) geteuid());", "NEW_AUX_ENT(AT_GID, (abi_ulong) getgid());", "NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid());", "NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP);", "NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK));", "NEW_AUX_ENT(AT_RANDOM, (abi_ulong) u_rand_bytes);", "#ifdef ELF_HWCAP2\nNEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2);", "#endif\nif (u_platform) {", "NEW_AUX_ENT(AT_PLATFORM, u_platform);", "}", "NEW_AUX_ENT (AT_NULL, 0);", "#undef NEW_AUX_ENT\ninfo->auxv_len = u_argv - info->saved_auxv;", "put_user_ual(argc, u_argc);", "p = info->arg_strings;", "for (VAR_1 = 0; VAR_1 < argc; ++VAR_1) {", "put_user_ual(p, u_argv);", "u_argv += VAR_3;", "p += target_strlen(p) + 1;", "}", "put_user_ual(0, u_argv);", "p = info->env_strings;", "for (VAR_1 = 0; VAR_1 < envc; ++VAR_1) {", "put_user_ual(p, u_envp);", "u_envp += VAR_3;", "p += target_strlen(p) + 1;", "}", "put_user_ual(0, u_envp);", "return sp;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151, 153 ], [ 155, 157 ], [ 159, 161, 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 225, 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269, 271 ], [ 273, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285, 289 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ] ]
3,006
void cpu_reset(CPUM68KState *env) { memset(env, 0, offsetof(CPUM68KState, breakpoints)); #if !defined (CONFIG_USER_ONLY) env->sr = 0x2700; #endif m68k_switch_sp(env); /* ??? FP regs should be initialized to NaN. */ env->cc_op = CC_OP_FLAGS; /* TODO: We should set PC from the interrupt vector. */ env->pc = 0; tlb_flush(env, 1);
true
qemu
eca1bdf415c454093dfc7eb983cd49287c043967
void cpu_reset(CPUM68KState *env) { memset(env, 0, offsetof(CPUM68KState, breakpoints)); #if !defined (CONFIG_USER_ONLY) env->sr = 0x2700; #endif m68k_switch_sp(env); env->cc_op = CC_OP_FLAGS; env->pc = 0; tlb_flush(env, 1);
{ "code": [], "line_no": [] }
void FUNC_0(CPUM68KState *VAR_0) { memset(VAR_0, 0, offsetof(CPUM68KState, breakpoints)); #if !defined (CONFIG_USER_ONLY) VAR_0->sr = 0x2700; #endif m68k_switch_sp(VAR_0); VAR_0->cc_op = CC_OP_FLAGS; VAR_0->pc = 0; tlb_flush(VAR_0, 1);
[ "void FUNC_0(CPUM68KState *VAR_0)\n{", "memset(VAR_0, 0, offsetof(CPUM68KState, breakpoints));", "#if !defined (CONFIG_USER_ONLY)\nVAR_0->sr = 0x2700;", "#endif\nm68k_switch_sp(VAR_0);", "VAR_0->cc_op = CC_OP_FLAGS;", "VAR_0->pc = 0;", "tlb_flush(VAR_0, 1);" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4, 5 ], [ 6, 7 ], [ 9 ], [ 11 ], [ 12 ] ]
3,007
static int serial_parse(const char *devname) { static int index = 0; char label[32]; if (strcmp(devname, "none") == 0) return 0; if (index == MAX_SERIAL_PORTS) { fprintf(stderr, "qemu: too many serial ports\n"); exit(1); } snprintf(label, sizeof(label), "serial%d", index); serial_hds[index] = qemu_chr_new(label, devname, NULL); if (!serial_hds[index]) { fprintf(stderr, "qemu: could not connect serial device" " to character backend '%s'\n", devname); return -1; } index++; return 0; }
false
qemu
f61eddcb2bb5cbbdd1d911b7e937db9affc29028
static int serial_parse(const char *devname) { static int index = 0; char label[32]; if (strcmp(devname, "none") == 0) return 0; if (index == MAX_SERIAL_PORTS) { fprintf(stderr, "qemu: too many serial ports\n"); exit(1); } snprintf(label, sizeof(label), "serial%d", index); serial_hds[index] = qemu_chr_new(label, devname, NULL); if (!serial_hds[index]) { fprintf(stderr, "qemu: could not connect serial device" " to character backend '%s'\n", devname); return -1; } index++; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0) { static int VAR_1 = 0; char VAR_2[32]; if (strcmp(VAR_0, "none") == 0) return 0; if (VAR_1 == MAX_SERIAL_PORTS) { fprintf(stderr, "qemu: too many serial ports\n"); exit(1); } snprintf(VAR_2, sizeof(VAR_2), "serial%d", VAR_1); serial_hds[VAR_1] = qemu_chr_new(VAR_2, VAR_0, NULL); if (!serial_hds[VAR_1]) { fprintf(stderr, "qemu: could not connect serial device" " to character backend '%s'\n", VAR_0); return -1; } VAR_1++; return 0; }
[ "static int FUNC_0(const char *VAR_0)\n{", "static int VAR_1 = 0;", "char VAR_2[32];", "if (strcmp(VAR_0, \"none\") == 0)\nreturn 0;", "if (VAR_1 == MAX_SERIAL_PORTS) {", "fprintf(stderr, \"qemu: too many serial ports\\n\");", "exit(1);", "}", "snprintf(VAR_2, sizeof(VAR_2), \"serial%d\", VAR_1);", "serial_hds[VAR_1] = qemu_chr_new(VAR_2, VAR_0, NULL);", "if (!serial_hds[VAR_1]) {", "fprintf(stderr, \"qemu: could not connect serial device\"\n\" to character backend '%s'\\n\", VAR_0);", "return -1;", "}", "VAR_1++;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
3,008
void do_info_migrate(Monitor *mon, QObject **ret_data) { QDict *qdict; MigrationState *s = current_migration; if (s) { switch (s->get_status(s)) { case MIG_STATE_ACTIVE: qdict = qdict_new(); qdict_put(qdict, "status", qstring_from_str("active")); migrate_put_status(qdict, "ram", ram_bytes_transferred(), ram_bytes_remaining(), ram_bytes_total()); if (blk_mig_active()) { migrate_put_status(qdict, "disk", blk_mig_bytes_transferred(), blk_mig_bytes_remaining(), blk_mig_bytes_total()); } *ret_data = QOBJECT(qdict); break; case MIG_STATE_COMPLETED: *ret_data = qobject_from_jsonf("{ 'status': 'completed' }"); break; case MIG_STATE_ERROR: *ret_data = qobject_from_jsonf("{ 'status': 'failed' }"); break; case MIG_STATE_CANCELLED: *ret_data = qobject_from_jsonf("{ 'status': 'cancelled' }"); break; } assert(*ret_data != NULL); } }
false
qemu
ba14414174b72fa231997243a9650feaa520d054
void do_info_migrate(Monitor *mon, QObject **ret_data) { QDict *qdict; MigrationState *s = current_migration; if (s) { switch (s->get_status(s)) { case MIG_STATE_ACTIVE: qdict = qdict_new(); qdict_put(qdict, "status", qstring_from_str("active")); migrate_put_status(qdict, "ram", ram_bytes_transferred(), ram_bytes_remaining(), ram_bytes_total()); if (blk_mig_active()) { migrate_put_status(qdict, "disk", blk_mig_bytes_transferred(), blk_mig_bytes_remaining(), blk_mig_bytes_total()); } *ret_data = QOBJECT(qdict); break; case MIG_STATE_COMPLETED: *ret_data = qobject_from_jsonf("{ 'status': 'completed' }"); break; case MIG_STATE_ERROR: *ret_data = qobject_from_jsonf("{ 'status': 'failed' }"); break; case MIG_STATE_CANCELLED: *ret_data = qobject_from_jsonf("{ 'status': 'cancelled' }"); break; } assert(*ret_data != NULL); } }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, QObject **VAR_1) { QDict *qdict; MigrationState *s = current_migration; if (s) { switch (s->get_status(s)) { case MIG_STATE_ACTIVE: qdict = qdict_new(); qdict_put(qdict, "status", qstring_from_str("active")); migrate_put_status(qdict, "ram", ram_bytes_transferred(), ram_bytes_remaining(), ram_bytes_total()); if (blk_mig_active()) { migrate_put_status(qdict, "disk", blk_mig_bytes_transferred(), blk_mig_bytes_remaining(), blk_mig_bytes_total()); } *VAR_1 = QOBJECT(qdict); break; case MIG_STATE_COMPLETED: *VAR_1 = qobject_from_jsonf("{ 'status': 'completed' }"); break; case MIG_STATE_ERROR: *VAR_1 = qobject_from_jsonf("{ 'status': 'failed' }"); break; case MIG_STATE_CANCELLED: *VAR_1 = qobject_from_jsonf("{ 'status': 'cancelled' }"); break; } assert(*VAR_1 != NULL); } }
[ "void FUNC_0(Monitor *VAR_0, QObject **VAR_1)\n{", "QDict *qdict;", "MigrationState *s = current_migration;", "if (s) {", "switch (s->get_status(s)) {", "case MIG_STATE_ACTIVE:\nqdict = qdict_new();", "qdict_put(qdict, \"status\", qstring_from_str(\"active\"));", "migrate_put_status(qdict, \"ram\", ram_bytes_transferred(),\nram_bytes_remaining(), ram_bytes_total());", "if (blk_mig_active()) {", "migrate_put_status(qdict, \"disk\", blk_mig_bytes_transferred(),\nblk_mig_bytes_remaining(),\nblk_mig_bytes_total());", "}", "*VAR_1 = QOBJECT(qdict);", "break;", "case MIG_STATE_COMPLETED:\n*VAR_1 = qobject_from_jsonf(\"{ 'status': 'completed' }\");", "break;", "case MIG_STATE_ERROR:\n*VAR_1 = qobject_from_jsonf(\"{ 'status': 'failed' }\");", "break;", "case MIG_STATE_CANCELLED:\n*VAR_1 = qobject_from_jsonf(\"{ 'status': 'cancelled' }\");", "break;", "}", "assert(*VAR_1 != NULL);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ] ]
3,009
static abi_long do_connect(int sockfd, abi_ulong target_addr, socklen_t addrlen) { void *addr; if (addrlen < 0) return -TARGET_EINVAL; addr = alloca(addrlen); target_to_host_sockaddr(addr, target_addr, addrlen); return get_errno(connect(sockfd, addr, addrlen)); }
false
qemu
917507b01efea8017bfcb4188ac696612e363e72
static abi_long do_connect(int sockfd, abi_ulong target_addr, socklen_t addrlen) { void *addr; if (addrlen < 0) return -TARGET_EINVAL; addr = alloca(addrlen); target_to_host_sockaddr(addr, target_addr, addrlen); return get_errno(connect(sockfd, addr, addrlen)); }
{ "code": [], "line_no": [] }
static abi_long FUNC_0(int sockfd, abi_ulong target_addr, socklen_t addrlen) { void *VAR_0; if (addrlen < 0) return -TARGET_EINVAL; VAR_0 = alloca(addrlen); target_to_host_sockaddr(VAR_0, target_addr, addrlen); return get_errno(connect(sockfd, VAR_0, addrlen)); }
[ "static abi_long FUNC_0(int sockfd, abi_ulong target_addr,\nsocklen_t addrlen)\n{", "void *VAR_0;", "if (addrlen < 0)\nreturn -TARGET_EINVAL;", "VAR_0 = alloca(addrlen);", "target_to_host_sockaddr(VAR_0, target_addr, addrlen);", "return get_errno(connect(sockfd, VAR_0, addrlen));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ] ]
3,010
static GenericList *qmp_input_next_list(Visitor *v, GenericList **list, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); GenericList *entry; StackObject *so = &qiv->stack[qiv->nb_stack - 1]; if (so->entry == NULL) { return NULL; } entry = g_malloc0(sizeof(*entry)); if (*list) { so->entry = qlist_next(so->entry); if (so->entry == NULL) { g_free(entry); return NULL; } (*list)->next = entry; } return entry; }
false
qemu
3a86a0fa76b5103a122b6e817b3827b2837f4956
static GenericList *qmp_input_next_list(Visitor *v, GenericList **list, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); GenericList *entry; StackObject *so = &qiv->stack[qiv->nb_stack - 1]; if (so->entry == NULL) { return NULL; } entry = g_malloc0(sizeof(*entry)); if (*list) { so->entry = qlist_next(so->entry); if (so->entry == NULL) { g_free(entry); return NULL; } (*list)->next = entry; } return entry; }
{ "code": [], "line_no": [] }
static GenericList *FUNC_0(Visitor *v, GenericList **list, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); GenericList *entry; StackObject *so = &qiv->stack[qiv->nb_stack - 1]; if (so->entry == NULL) { return NULL; } entry = g_malloc0(sizeof(*entry)); if (*list) { so->entry = qlist_next(so->entry); if (so->entry == NULL) { g_free(entry); return NULL; } (*list)->next = entry; } return entry; }
[ "static GenericList *FUNC_0(Visitor *v, GenericList **list,\nError **errp)\n{", "QmpInputVisitor *qiv = to_qiv(v);", "GenericList *entry;", "StackObject *so = &qiv->stack[qiv->nb_stack - 1];", "if (so->entry == NULL) {", "return NULL;", "}", "entry = g_malloc0(sizeof(*entry));", "if (*list) {", "so->entry = qlist_next(so->entry);", "if (so->entry == NULL) {", "g_free(entry);", "return NULL;", "}", "(*list)->next = entry;", "}", "return entry;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
3,011
int gdbserver_start(const char *port) { GDBState *s; char gdbstub_port_name[128]; int port_num; char *p; CharDriverState *chr; if (!port || !*port) return -1; port_num = strtol(port, &p, 10); if (*p == 0) { /* A numeric value is interpreted as a port number. */ snprintf(gdbstub_port_name, sizeof(gdbstub_port_name), "tcp::%d,nowait,nodelay,server", port_num); port = gdbstub_port_name; } chr = qemu_chr_open("gdb", port); if (!chr) return -1; s = qemu_mallocz(sizeof(GDBState)); if (!s) { return -1; } s->env = first_cpu; /* XXX: allow to change CPU */ s->chr = chr; qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event, s); qemu_add_vm_stop_handler(gdb_vm_stopped, s); return 0; }
false
qemu
880a7578381d1c7ed4d41c7599ae3cc06567a824
int gdbserver_start(const char *port) { GDBState *s; char gdbstub_port_name[128]; int port_num; char *p; CharDriverState *chr; if (!port || !*port) return -1; port_num = strtol(port, &p, 10); if (*p == 0) { snprintf(gdbstub_port_name, sizeof(gdbstub_port_name), "tcp::%d,nowait,nodelay,server", port_num); port = gdbstub_port_name; } chr = qemu_chr_open("gdb", port); if (!chr) return -1; s = qemu_mallocz(sizeof(GDBState)); if (!s) { return -1; } s->env = first_cpu; s->chr = chr; qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event, s); qemu_add_vm_stop_handler(gdb_vm_stopped, s); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0) { GDBState *s; char VAR_1[128]; int VAR_2; char *VAR_3; CharDriverState *chr; if (!VAR_0 || !*VAR_0) return -1; VAR_2 = strtol(VAR_0, &VAR_3, 10); if (*VAR_3 == 0) { snprintf(VAR_1, sizeof(VAR_1), "tcp::%d,nowait,nodelay,server", VAR_2); VAR_0 = VAR_1; } chr = qemu_chr_open("gdb", VAR_0); if (!chr) return -1; s = qemu_mallocz(sizeof(GDBState)); if (!s) { return -1; } s->env = first_cpu; s->chr = chr; qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive, gdb_chr_event, s); qemu_add_vm_stop_handler(gdb_vm_stopped, s); return 0; }
[ "int FUNC_0(const char *VAR_0)\n{", "GDBState *s;", "char VAR_1[128];", "int VAR_2;", "char *VAR_3;", "CharDriverState *chr;", "if (!VAR_0 || !*VAR_0)\nreturn -1;", "VAR_2 = strtol(VAR_0, &VAR_3, 10);", "if (*VAR_3 == 0) {", "snprintf(VAR_1, sizeof(VAR_1),\n\"tcp::%d,nowait,nodelay,server\", VAR_2);", "VAR_0 = VAR_1;", "}", "chr = qemu_chr_open(\"gdb\", VAR_0);", "if (!chr)\nreturn -1;", "s = qemu_mallocz(sizeof(GDBState));", "if (!s) {", "return -1;", "}", "s->env = first_cpu;", "s->chr = chr;", "qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive,\ngdb_chr_event, s);", "qemu_add_vm_stop_handler(gdb_vm_stopped, s);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ] ]
3,012
static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x, float z[320], float W[2][32][32][2]) { int i, k; memcpy(W[0], W[1], sizeof(W[0])); memcpy(x , x+1024, (320-32)*sizeof(x[0])); memcpy(x+288, in, 1024*sizeof(x[0])); for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames // are not supported dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); for (k = 0; k < 64; k++) { float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256]; z[k] = f; } //Shuffle to IMDCT z[64] = z[0]; for (k = 1; k < 32; k++) { z[64+2*k-1] = z[ k]; z[64+2*k ] = -z[64-k]; } z[64+63] = z[32]; mdct->imdct_half(mdct, z, z+64); for (k = 0; k < 32; k++) { W[1][i][k][0] = -z[63-k]; W[1][i][k][1] = z[k]; } x += 32; } }
false
FFmpeg
aac46e088d67a390489af686b846dea4987d8ffb
static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x, float z[320], float W[2][32][32][2]) { int i, k; memcpy(W[0], W[1], sizeof(W[0])); memcpy(x , x+1024, (320-32)*sizeof(x[0])); memcpy(x+288, in, 1024*sizeof(x[0])); for (i = 0; i < 32; i++) { dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); for (k = 0; k < 64; k++) { float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256]; z[k] = f; } z[64] = z[0]; for (k = 1; k < 32; k++) { z[64+2*k-1] = z[ k]; z[64+2*k ] = -z[64-k]; } z[64+63] = z[32]; mdct->imdct_half(mdct, z, z+64); for (k = 0; k < 32; k++) { W[1][i][k][0] = -z[63-k]; W[1][i][k][1] = z[k]; } x += 32; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DSPContext *VAR_0, FFTContext *VAR_1, const float *VAR_2, float *VAR_3, float VAR_4[320], float VAR_5[2][32][32][2]) { int VAR_6, VAR_7; memcpy(VAR_5[0], VAR_5[1], sizeof(VAR_5[0])); memcpy(VAR_3 , VAR_3+1024, (320-32)*sizeof(VAR_3[0])); memcpy(VAR_3+288, VAR_2, 1024*sizeof(VAR_3[0])); for (VAR_6 = 0; VAR_6 < 32; VAR_6++) { VAR_0->vector_fmul_reverse(VAR_4, sbr_qmf_window_ds, VAR_3, 320); for (VAR_7 = 0; VAR_7 < 64; VAR_7++) { float VAR_8 = VAR_4[VAR_7] + VAR_4[VAR_7 + 64] + VAR_4[VAR_7 + 128] + VAR_4[VAR_7 + 192] + VAR_4[VAR_7 + 256]; VAR_4[VAR_7] = VAR_8; } VAR_4[64] = VAR_4[0]; for (VAR_7 = 1; VAR_7 < 32; VAR_7++) { VAR_4[64+2*VAR_7-1] = VAR_4[ VAR_7]; VAR_4[64+2*VAR_7 ] = -VAR_4[64-VAR_7]; } VAR_4[64+63] = VAR_4[32]; VAR_1->imdct_half(VAR_1, VAR_4, VAR_4+64); for (VAR_7 = 0; VAR_7 < 32; VAR_7++) { VAR_5[1][VAR_6][VAR_7][0] = -VAR_4[63-VAR_7]; VAR_5[1][VAR_6][VAR_7][1] = VAR_4[VAR_7]; } VAR_3 += 32; } }
[ "static void FUNC_0(DSPContext *VAR_0, FFTContext *VAR_1, const float *VAR_2, float *VAR_3,\nfloat VAR_4[320], float VAR_5[2][32][32][2])\n{", "int VAR_6, VAR_7;", "memcpy(VAR_5[0], VAR_5[1], sizeof(VAR_5[0]));", "memcpy(VAR_3 , VAR_3+1024, (320-32)*sizeof(VAR_3[0]));", "memcpy(VAR_3+288, VAR_2, 1024*sizeof(VAR_3[0]));", "for (VAR_6 = 0; VAR_6 < 32; VAR_6++) {", "VAR_0->vector_fmul_reverse(VAR_4, sbr_qmf_window_ds, VAR_3, 320);", "for (VAR_7 = 0; VAR_7 < 64; VAR_7++) {", "float VAR_8 = VAR_4[VAR_7] + VAR_4[VAR_7 + 64] + VAR_4[VAR_7 + 128] + VAR_4[VAR_7 + 192] + VAR_4[VAR_7 + 256];", "VAR_4[VAR_7] = VAR_8;", "}", "VAR_4[64] = VAR_4[0];", "for (VAR_7 = 1; VAR_7 < 32; VAR_7++) {", "VAR_4[64+2*VAR_7-1] = VAR_4[ VAR_7];", "VAR_4[64+2*VAR_7 ] = -VAR_4[64-VAR_7];", "}", "VAR_4[64+63] = VAR_4[32];", "VAR_1->imdct_half(VAR_1, VAR_4, VAR_4+64);", "for (VAR_7 = 0; VAR_7 < 32; VAR_7++) {", "VAR_5[1][VAR_6][VAR_7][0] = -VAR_4[63-VAR_7];", "VAR_5[1][VAR_6][VAR_7][1] = VAR_4[VAR_7];", "}", "VAR_3 += 32;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
3,014
static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) { /* 99% of the time, we can signal the use of extension registers by looking to see if the opcode handles 64-bit data. */ TCGType ext = (tcg_op_defs[opc].flags & TCG_OPF_64BIT) != 0; /* Hoist the loads of the most common arguments. */ TCGArg a0 = args[0]; TCGArg a1 = args[1]; TCGArg a2 = args[2]; int c2 = const_args[2]; /* Some operands are defined with "rZ" constraint, a register or the zero register. These need not actually test args[I] == 0. */ #define REG0(I) (const_args[I] ? TCG_REG_XZR : (TCGReg)args[I]) switch (opc) { case INDEX_op_exit_tb: tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0); tcg_out_goto(s, tb_ret_addr); break; case INDEX_op_goto_tb: #ifndef USE_DIRECT_JUMP #error "USE_DIRECT_JUMP required for aarch64" #endif assert(s->tb_jmp_offset != NULL); /* consistency for USE_DIRECT_JUMP */ s->tb_jmp_offset[a0] = tcg_current_code_size(s); /* actual branch destination will be patched by aarch64_tb_set_jmp_target later, beware retranslation. */ tcg_out_goto_noaddr(s); s->tb_next_offset[a0] = tcg_current_code_size(s); break; case INDEX_op_br: tcg_out_goto_label(s, arg_label(a0)); break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: tcg_out_ldst(s, I3312_LDRB, a0, a1, a2); break; case INDEX_op_ld8s_i32: tcg_out_ldst(s, I3312_LDRSBW, a0, a1, a2); break; case INDEX_op_ld8s_i64: tcg_out_ldst(s, I3312_LDRSBX, a0, a1, a2); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: tcg_out_ldst(s, I3312_LDRH, a0, a1, a2); break; case INDEX_op_ld16s_i32: tcg_out_ldst(s, I3312_LDRSHW, a0, a1, a2); break; case INDEX_op_ld16s_i64: tcg_out_ldst(s, I3312_LDRSHX, a0, a1, a2); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: tcg_out_ldst(s, I3312_LDRW, a0, a1, a2); break; case INDEX_op_ld32s_i64: tcg_out_ldst(s, I3312_LDRSWX, a0, a1, a2); break; case INDEX_op_ld_i64: tcg_out_ldst(s, I3312_LDRX, a0, a1, a2); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: tcg_out_ldst(s, I3312_STRB, REG0(0), a1, a2); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: tcg_out_ldst(s, I3312_STRH, REG0(0), a1, a2); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: tcg_out_ldst(s, I3312_STRW, REG0(0), a1, a2); break; case INDEX_op_st_i64: tcg_out_ldst(s, I3312_STRX, REG0(0), a1, a2); break; case INDEX_op_add_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_add_i64: if (c2) { tcg_out_addsubi(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3502, ADD, ext, a0, a1, a2); } break; case INDEX_op_sub_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_sub_i64: if (c2) { tcg_out_addsubi(s, ext, a0, a1, -a2); } else { tcg_out_insn(s, 3502, SUB, ext, a0, a1, a2); } break; case INDEX_op_neg_i64: case INDEX_op_neg_i32: tcg_out_insn(s, 3502, SUB, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_and_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_and_i64: if (c2) { tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, AND, ext, a0, a1, a2); } break; case INDEX_op_andc_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_andc_i64: if (c2) { tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, BIC, ext, a0, a1, a2); } break; case INDEX_op_or_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_or_i64: if (c2) { tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, ORR, ext, a0, a1, a2); } break; case INDEX_op_orc_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_orc_i64: if (c2) { tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, ORN, ext, a0, a1, a2); } break; case INDEX_op_xor_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_xor_i64: if (c2) { tcg_out_logicali(s, I3404_EORI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, EOR, ext, a0, a1, a2); } break; case INDEX_op_eqv_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_eqv_i64: if (c2) { tcg_out_logicali(s, I3404_EORI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, EON, ext, a0, a1, a2); } break; case INDEX_op_not_i64: case INDEX_op_not_i32: tcg_out_insn(s, 3510, ORN, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_mul_i64: case INDEX_op_mul_i32: tcg_out_insn(s, 3509, MADD, ext, a0, a1, a2, TCG_REG_XZR); break; case INDEX_op_div_i64: case INDEX_op_div_i32: tcg_out_insn(s, 3508, SDIV, ext, a0, a1, a2); break; case INDEX_op_divu_i64: case INDEX_op_divu_i32: tcg_out_insn(s, 3508, UDIV, ext, a0, a1, a2); break; case INDEX_op_rem_i64: case INDEX_op_rem_i32: tcg_out_insn(s, 3508, SDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(s, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_remu_i64: case INDEX_op_remu_i32: tcg_out_insn(s, 3508, UDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(s, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_shl_i64: case INDEX_op_shl_i32: if (c2) { tcg_out_shl(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, LSLV, ext, a0, a1, a2); } break; case INDEX_op_shr_i64: case INDEX_op_shr_i32: if (c2) { tcg_out_shr(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, LSRV, ext, a0, a1, a2); } break; case INDEX_op_sar_i64: case INDEX_op_sar_i32: if (c2) { tcg_out_sar(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, ASRV, ext, a0, a1, a2); } break; case INDEX_op_rotr_i64: case INDEX_op_rotr_i32: if (c2) { tcg_out_rotr(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, RORV, ext, a0, a1, a2); } break; case INDEX_op_rotl_i64: case INDEX_op_rotl_i32: if (c2) { tcg_out_rotl(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3502, SUB, 0, TCG_REG_TMP, TCG_REG_XZR, a2); tcg_out_insn(s, 3508, RORV, ext, a0, a1, TCG_REG_TMP); } break; case INDEX_op_brcond_i32: a1 = (int32_t)a1; /* FALLTHRU */ case INDEX_op_brcond_i64: tcg_out_brcond(s, ext, a2, a0, a1, const_args[1], arg_label(args[3])); break; case INDEX_op_setcond_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_setcond_i64: tcg_out_cmp(s, ext, a1, a2, c2); /* Use CSET alias of CSINC Wd, WZR, WZR, invert(cond). */ tcg_out_insn(s, 3506, CSINC, TCG_TYPE_I32, a0, TCG_REG_XZR, TCG_REG_XZR, tcg_invert_cond(args[3])); break; case INDEX_op_movcond_i32: a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_movcond_i64: tcg_out_cmp(s, ext, a1, a2, c2); tcg_out_insn(s, 3506, CSEL, ext, a0, REG0(3), REG0(4), args[5]); break; case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(s, a0, a1, a2, ext); break; case INDEX_op_qemu_st_i32: case INDEX_op_qemu_st_i64: tcg_out_qemu_st(s, REG0(0), a1, a2); break; case INDEX_op_bswap64_i64: tcg_out_rev64(s, a0, a1); break; case INDEX_op_bswap32_i64: case INDEX_op_bswap32_i32: tcg_out_rev32(s, a0, a1); break; case INDEX_op_bswap16_i64: case INDEX_op_bswap16_i32: tcg_out_rev16(s, a0, a1); break; case INDEX_op_ext8s_i64: case INDEX_op_ext8s_i32: tcg_out_sxt(s, ext, MO_8, a0, a1); break; case INDEX_op_ext16s_i64: case INDEX_op_ext16s_i32: tcg_out_sxt(s, ext, MO_16, a0, a1); break; case INDEX_op_ext_i32_i64: case INDEX_op_ext32s_i64: tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1); break; case INDEX_op_ext8u_i64: case INDEX_op_ext8u_i32: tcg_out_uxt(s, MO_8, a0, a1); break; case INDEX_op_ext16u_i64: case INDEX_op_ext16u_i32: tcg_out_uxt(s, MO_16, a0, a1); break; case INDEX_op_extu_i32_i64: case INDEX_op_ext32u_i64: tcg_out_movr(s, TCG_TYPE_I32, a0, a1); break; case INDEX_op_deposit_i64: case INDEX_op_deposit_i32: tcg_out_dep(s, ext, a0, REG0(2), args[3], args[4]); break; case INDEX_op_add2_i32: tcg_out_addsub2(s, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)args[4], args[5], const_args[4], const_args[5], false); break; case INDEX_op_add2_i64: tcg_out_addsub2(s, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), args[4], args[5], const_args[4], const_args[5], false); break; case INDEX_op_sub2_i32: tcg_out_addsub2(s, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)args[4], args[5], const_args[4], const_args[5], true); break; case INDEX_op_sub2_i64: tcg_out_addsub2(s, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), args[4], args[5], const_args[4], const_args[5], true); break; case INDEX_op_muluh_i64: tcg_out_insn(s, 3508, UMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mulsh_i64: tcg_out_insn(s, 3508, SMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */ case INDEX_op_mov_i64: case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */ case INDEX_op_movi_i64: case INDEX_op_call: /* Always emitted via tcg_out_call. */ default: tcg_abort(); } #undef REG0 }
false
qemu
eabb7b91b36b202b4dac2df2d59d698e3aff197a
static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) { TCGType ext = (tcg_op_defs[opc].flags & TCG_OPF_64BIT) != 0; TCGArg a0 = args[0]; TCGArg a1 = args[1]; TCGArg a2 = args[2]; int c2 = const_args[2]; #define REG0(I) (const_args[I] ? TCG_REG_XZR : (TCGReg)args[I]) switch (opc) { case INDEX_op_exit_tb: tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0); tcg_out_goto(s, tb_ret_addr); break; case INDEX_op_goto_tb: #ifndef USE_DIRECT_JUMP #error "USE_DIRECT_JUMP required for aarch64" #endif assert(s->tb_jmp_offset != NULL); s->tb_jmp_offset[a0] = tcg_current_code_size(s); tcg_out_goto_noaddr(s); s->tb_next_offset[a0] = tcg_current_code_size(s); break; case INDEX_op_br: tcg_out_goto_label(s, arg_label(a0)); break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: tcg_out_ldst(s, I3312_LDRB, a0, a1, a2); break; case INDEX_op_ld8s_i32: tcg_out_ldst(s, I3312_LDRSBW, a0, a1, a2); break; case INDEX_op_ld8s_i64: tcg_out_ldst(s, I3312_LDRSBX, a0, a1, a2); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: tcg_out_ldst(s, I3312_LDRH, a0, a1, a2); break; case INDEX_op_ld16s_i32: tcg_out_ldst(s, I3312_LDRSHW, a0, a1, a2); break; case INDEX_op_ld16s_i64: tcg_out_ldst(s, I3312_LDRSHX, a0, a1, a2); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: tcg_out_ldst(s, I3312_LDRW, a0, a1, a2); break; case INDEX_op_ld32s_i64: tcg_out_ldst(s, I3312_LDRSWX, a0, a1, a2); break; case INDEX_op_ld_i64: tcg_out_ldst(s, I3312_LDRX, a0, a1, a2); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: tcg_out_ldst(s, I3312_STRB, REG0(0), a1, a2); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: tcg_out_ldst(s, I3312_STRH, REG0(0), a1, a2); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: tcg_out_ldst(s, I3312_STRW, REG0(0), a1, a2); break; case INDEX_op_st_i64: tcg_out_ldst(s, I3312_STRX, REG0(0), a1, a2); break; case INDEX_op_add_i32: a2 = (int32_t)a2; case INDEX_op_add_i64: if (c2) { tcg_out_addsubi(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3502, ADD, ext, a0, a1, a2); } break; case INDEX_op_sub_i32: a2 = (int32_t)a2; case INDEX_op_sub_i64: if (c2) { tcg_out_addsubi(s, ext, a0, a1, -a2); } else { tcg_out_insn(s, 3502, SUB, ext, a0, a1, a2); } break; case INDEX_op_neg_i64: case INDEX_op_neg_i32: tcg_out_insn(s, 3502, SUB, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_and_i32: a2 = (int32_t)a2; case INDEX_op_and_i64: if (c2) { tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, AND, ext, a0, a1, a2); } break; case INDEX_op_andc_i32: a2 = (int32_t)a2; case INDEX_op_andc_i64: if (c2) { tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, BIC, ext, a0, a1, a2); } break; case INDEX_op_or_i32: a2 = (int32_t)a2; case INDEX_op_or_i64: if (c2) { tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, ORR, ext, a0, a1, a2); } break; case INDEX_op_orc_i32: a2 = (int32_t)a2; case INDEX_op_orc_i64: if (c2) { tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, ORN, ext, a0, a1, a2); } break; case INDEX_op_xor_i32: a2 = (int32_t)a2; case INDEX_op_xor_i64: if (c2) { tcg_out_logicali(s, I3404_EORI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, EOR, ext, a0, a1, a2); } break; case INDEX_op_eqv_i32: a2 = (int32_t)a2; case INDEX_op_eqv_i64: if (c2) { tcg_out_logicali(s, I3404_EORI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, EON, ext, a0, a1, a2); } break; case INDEX_op_not_i64: case INDEX_op_not_i32: tcg_out_insn(s, 3510, ORN, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_mul_i64: case INDEX_op_mul_i32: tcg_out_insn(s, 3509, MADD, ext, a0, a1, a2, TCG_REG_XZR); break; case INDEX_op_div_i64: case INDEX_op_div_i32: tcg_out_insn(s, 3508, SDIV, ext, a0, a1, a2); break; case INDEX_op_divu_i64: case INDEX_op_divu_i32: tcg_out_insn(s, 3508, UDIV, ext, a0, a1, a2); break; case INDEX_op_rem_i64: case INDEX_op_rem_i32: tcg_out_insn(s, 3508, SDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(s, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_remu_i64: case INDEX_op_remu_i32: tcg_out_insn(s, 3508, UDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(s, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_shl_i64: case INDEX_op_shl_i32: if (c2) { tcg_out_shl(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, LSLV, ext, a0, a1, a2); } break; case INDEX_op_shr_i64: case INDEX_op_shr_i32: if (c2) { tcg_out_shr(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, LSRV, ext, a0, a1, a2); } break; case INDEX_op_sar_i64: case INDEX_op_sar_i32: if (c2) { tcg_out_sar(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, ASRV, ext, a0, a1, a2); } break; case INDEX_op_rotr_i64: case INDEX_op_rotr_i32: if (c2) { tcg_out_rotr(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, RORV, ext, a0, a1, a2); } break; case INDEX_op_rotl_i64: case INDEX_op_rotl_i32: if (c2) { tcg_out_rotl(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3502, SUB, 0, TCG_REG_TMP, TCG_REG_XZR, a2); tcg_out_insn(s, 3508, RORV, ext, a0, a1, TCG_REG_TMP); } break; case INDEX_op_brcond_i32: a1 = (int32_t)a1; case INDEX_op_brcond_i64: tcg_out_brcond(s, ext, a2, a0, a1, const_args[1], arg_label(args[3])); break; case INDEX_op_setcond_i32: a2 = (int32_t)a2; case INDEX_op_setcond_i64: tcg_out_cmp(s, ext, a1, a2, c2); tcg_out_insn(s, 3506, CSINC, TCG_TYPE_I32, a0, TCG_REG_XZR, TCG_REG_XZR, tcg_invert_cond(args[3])); break; case INDEX_op_movcond_i32: a2 = (int32_t)a2; case INDEX_op_movcond_i64: tcg_out_cmp(s, ext, a1, a2, c2); tcg_out_insn(s, 3506, CSEL, ext, a0, REG0(3), REG0(4), args[5]); break; case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(s, a0, a1, a2, ext); break; case INDEX_op_qemu_st_i32: case INDEX_op_qemu_st_i64: tcg_out_qemu_st(s, REG0(0), a1, a2); break; case INDEX_op_bswap64_i64: tcg_out_rev64(s, a0, a1); break; case INDEX_op_bswap32_i64: case INDEX_op_bswap32_i32: tcg_out_rev32(s, a0, a1); break; case INDEX_op_bswap16_i64: case INDEX_op_bswap16_i32: tcg_out_rev16(s, a0, a1); break; case INDEX_op_ext8s_i64: case INDEX_op_ext8s_i32: tcg_out_sxt(s, ext, MO_8, a0, a1); break; case INDEX_op_ext16s_i64: case INDEX_op_ext16s_i32: tcg_out_sxt(s, ext, MO_16, a0, a1); break; case INDEX_op_ext_i32_i64: case INDEX_op_ext32s_i64: tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1); break; case INDEX_op_ext8u_i64: case INDEX_op_ext8u_i32: tcg_out_uxt(s, MO_8, a0, a1); break; case INDEX_op_ext16u_i64: case INDEX_op_ext16u_i32: tcg_out_uxt(s, MO_16, a0, a1); break; case INDEX_op_extu_i32_i64: case INDEX_op_ext32u_i64: tcg_out_movr(s, TCG_TYPE_I32, a0, a1); break; case INDEX_op_deposit_i64: case INDEX_op_deposit_i32: tcg_out_dep(s, ext, a0, REG0(2), args[3], args[4]); break; case INDEX_op_add2_i32: tcg_out_addsub2(s, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)args[4], args[5], const_args[4], const_args[5], false); break; case INDEX_op_add2_i64: tcg_out_addsub2(s, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), args[4], args[5], const_args[4], const_args[5], false); break; case INDEX_op_sub2_i32: tcg_out_addsub2(s, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)args[4], args[5], const_args[4], const_args[5], true); break; case INDEX_op_sub2_i64: tcg_out_addsub2(s, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), args[4], args[5], const_args[4], const_args[5], true); break; case INDEX_op_muluh_i64: tcg_out_insn(s, 3508, UMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mulsh_i64: tcg_out_insn(s, 3508, SMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mov_i32: case INDEX_op_mov_i64: case INDEX_op_movi_i32: case INDEX_op_movi_i64: case INDEX_op_call: default: tcg_abort(); } #undef REG0 }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, TCGOpcode VAR_1, const TCGArg VAR_2[TCG_MAX_OP_ARGS], const int VAR_3[TCG_MAX_OP_ARGS]) { TCGType ext = (tcg_op_defs[VAR_1].flags & TCG_OPF_64BIT) != 0; TCGArg a0 = VAR_2[0]; TCGArg a1 = VAR_2[1]; TCGArg a2 = VAR_2[2]; int VAR_4 = VAR_3[2]; #define REG0(I) (VAR_3[I] ? TCG_REG_XZR : (TCGReg)VAR_2[I]) switch (VAR_1) { case INDEX_op_exit_tb: tcg_out_movi(VAR_0, TCG_TYPE_I64, TCG_REG_X0, a0); tcg_out_goto(VAR_0, tb_ret_addr); break; case INDEX_op_goto_tb: #ifndef USE_DIRECT_JUMP #error "USE_DIRECT_JUMP required for aarch64" #endif assert(VAR_0->tb_jmp_offset != NULL); VAR_0->tb_jmp_offset[a0] = tcg_current_code_size(VAR_0); tcg_out_goto_noaddr(VAR_0); VAR_0->tb_next_offset[a0] = tcg_current_code_size(VAR_0); break; case INDEX_op_br: tcg_out_goto_label(VAR_0, arg_label(a0)); break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: tcg_out_ldst(VAR_0, I3312_LDRB, a0, a1, a2); break; case INDEX_op_ld8s_i32: tcg_out_ldst(VAR_0, I3312_LDRSBW, a0, a1, a2); break; case INDEX_op_ld8s_i64: tcg_out_ldst(VAR_0, I3312_LDRSBX, a0, a1, a2); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: tcg_out_ldst(VAR_0, I3312_LDRH, a0, a1, a2); break; case INDEX_op_ld16s_i32: tcg_out_ldst(VAR_0, I3312_LDRSHW, a0, a1, a2); break; case INDEX_op_ld16s_i64: tcg_out_ldst(VAR_0, I3312_LDRSHX, a0, a1, a2); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: tcg_out_ldst(VAR_0, I3312_LDRW, a0, a1, a2); break; case INDEX_op_ld32s_i64: tcg_out_ldst(VAR_0, I3312_LDRSWX, a0, a1, a2); break; case INDEX_op_ld_i64: tcg_out_ldst(VAR_0, I3312_LDRX, a0, a1, a2); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: tcg_out_ldst(VAR_0, I3312_STRB, REG0(0), a1, a2); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: tcg_out_ldst(VAR_0, I3312_STRH, REG0(0), a1, a2); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: tcg_out_ldst(VAR_0, I3312_STRW, REG0(0), a1, a2); break; case INDEX_op_st_i64: tcg_out_ldst(VAR_0, I3312_STRX, REG0(0), a1, a2); break; case INDEX_op_add_i32: a2 = (int32_t)a2; case INDEX_op_add_i64: if (VAR_4) { tcg_out_addsubi(VAR_0, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3502, ADD, ext, a0, a1, a2); } break; case INDEX_op_sub_i32: a2 = (int32_t)a2; case INDEX_op_sub_i64: if (VAR_4) { tcg_out_addsubi(VAR_0, ext, a0, a1, -a2); } else { tcg_out_insn(VAR_0, 3502, SUB, ext, a0, a1, a2); } break; case INDEX_op_neg_i64: case INDEX_op_neg_i32: tcg_out_insn(VAR_0, 3502, SUB, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_and_i32: a2 = (int32_t)a2; case INDEX_op_and_i64: if (VAR_4) { tcg_out_logicali(VAR_0, I3404_ANDI, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3510, AND, ext, a0, a1, a2); } break; case INDEX_op_andc_i32: a2 = (int32_t)a2; case INDEX_op_andc_i64: if (VAR_4) { tcg_out_logicali(VAR_0, I3404_ANDI, ext, a0, a1, ~a2); } else { tcg_out_insn(VAR_0, 3510, BIC, ext, a0, a1, a2); } break; case INDEX_op_or_i32: a2 = (int32_t)a2; case INDEX_op_or_i64: if (VAR_4) { tcg_out_logicali(VAR_0, I3404_ORRI, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3510, ORR, ext, a0, a1, a2); } break; case INDEX_op_orc_i32: a2 = (int32_t)a2; case INDEX_op_orc_i64: if (VAR_4) { tcg_out_logicali(VAR_0, I3404_ORRI, ext, a0, a1, ~a2); } else { tcg_out_insn(VAR_0, 3510, ORN, ext, a0, a1, a2); } break; case INDEX_op_xor_i32: a2 = (int32_t)a2; case INDEX_op_xor_i64: if (VAR_4) { tcg_out_logicali(VAR_0, I3404_EORI, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3510, EOR, ext, a0, a1, a2); } break; case INDEX_op_eqv_i32: a2 = (int32_t)a2; case INDEX_op_eqv_i64: if (VAR_4) { tcg_out_logicali(VAR_0, I3404_EORI, ext, a0, a1, ~a2); } else { tcg_out_insn(VAR_0, 3510, EON, ext, a0, a1, a2); } break; case INDEX_op_not_i64: case INDEX_op_not_i32: tcg_out_insn(VAR_0, 3510, ORN, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_mul_i64: case INDEX_op_mul_i32: tcg_out_insn(VAR_0, 3509, MADD, ext, a0, a1, a2, TCG_REG_XZR); break; case INDEX_op_div_i64: case INDEX_op_div_i32: tcg_out_insn(VAR_0, 3508, SDIV, ext, a0, a1, a2); break; case INDEX_op_divu_i64: case INDEX_op_divu_i32: tcg_out_insn(VAR_0, 3508, UDIV, ext, a0, a1, a2); break; case INDEX_op_rem_i64: case INDEX_op_rem_i32: tcg_out_insn(VAR_0, 3508, SDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(VAR_0, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_remu_i64: case INDEX_op_remu_i32: tcg_out_insn(VAR_0, 3508, UDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(VAR_0, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_shl_i64: case INDEX_op_shl_i32: if (VAR_4) { tcg_out_shl(VAR_0, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3508, LSLV, ext, a0, a1, a2); } break; case INDEX_op_shr_i64: case INDEX_op_shr_i32: if (VAR_4) { tcg_out_shr(VAR_0, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3508, LSRV, ext, a0, a1, a2); } break; case INDEX_op_sar_i64: case INDEX_op_sar_i32: if (VAR_4) { tcg_out_sar(VAR_0, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3508, ASRV, ext, a0, a1, a2); } break; case INDEX_op_rotr_i64: case INDEX_op_rotr_i32: if (VAR_4) { tcg_out_rotr(VAR_0, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3508, RORV, ext, a0, a1, a2); } break; case INDEX_op_rotl_i64: case INDEX_op_rotl_i32: if (VAR_4) { tcg_out_rotl(VAR_0, ext, a0, a1, a2); } else { tcg_out_insn(VAR_0, 3502, SUB, 0, TCG_REG_TMP, TCG_REG_XZR, a2); tcg_out_insn(VAR_0, 3508, RORV, ext, a0, a1, TCG_REG_TMP); } break; case INDEX_op_brcond_i32: a1 = (int32_t)a1; case INDEX_op_brcond_i64: tcg_out_brcond(VAR_0, ext, a2, a0, a1, VAR_3[1], arg_label(VAR_2[3])); break; case INDEX_op_setcond_i32: a2 = (int32_t)a2; case INDEX_op_setcond_i64: tcg_out_cmp(VAR_0, ext, a1, a2, VAR_4); tcg_out_insn(VAR_0, 3506, CSINC, TCG_TYPE_I32, a0, TCG_REG_XZR, TCG_REG_XZR, tcg_invert_cond(VAR_2[3])); break; case INDEX_op_movcond_i32: a2 = (int32_t)a2; case INDEX_op_movcond_i64: tcg_out_cmp(VAR_0, ext, a1, a2, VAR_4); tcg_out_insn(VAR_0, 3506, CSEL, ext, a0, REG0(3), REG0(4), VAR_2[5]); break; case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(VAR_0, a0, a1, a2, ext); break; case INDEX_op_qemu_st_i32: case INDEX_op_qemu_st_i64: tcg_out_qemu_st(VAR_0, REG0(0), a1, a2); break; case INDEX_op_bswap64_i64: tcg_out_rev64(VAR_0, a0, a1); break; case INDEX_op_bswap32_i64: case INDEX_op_bswap32_i32: tcg_out_rev32(VAR_0, a0, a1); break; case INDEX_op_bswap16_i64: case INDEX_op_bswap16_i32: tcg_out_rev16(VAR_0, a0, a1); break; case INDEX_op_ext8s_i64: case INDEX_op_ext8s_i32: tcg_out_sxt(VAR_0, ext, MO_8, a0, a1); break; case INDEX_op_ext16s_i64: case INDEX_op_ext16s_i32: tcg_out_sxt(VAR_0, ext, MO_16, a0, a1); break; case INDEX_op_ext_i32_i64: case INDEX_op_ext32s_i64: tcg_out_sxt(VAR_0, TCG_TYPE_I64, MO_32, a0, a1); break; case INDEX_op_ext8u_i64: case INDEX_op_ext8u_i32: tcg_out_uxt(VAR_0, MO_8, a0, a1); break; case INDEX_op_ext16u_i64: case INDEX_op_ext16u_i32: tcg_out_uxt(VAR_0, MO_16, a0, a1); break; case INDEX_op_extu_i32_i64: case INDEX_op_ext32u_i64: tcg_out_movr(VAR_0, TCG_TYPE_I32, a0, a1); break; case INDEX_op_deposit_i64: case INDEX_op_deposit_i32: tcg_out_dep(VAR_0, ext, a0, REG0(2), VAR_2[3], VAR_2[4]); break; case INDEX_op_add2_i32: tcg_out_addsub2(VAR_0, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)VAR_2[4], VAR_2[5], VAR_3[4], VAR_3[5], false); break; case INDEX_op_add2_i64: tcg_out_addsub2(VAR_0, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), VAR_2[4], VAR_2[5], VAR_3[4], VAR_3[5], false); break; case INDEX_op_sub2_i32: tcg_out_addsub2(VAR_0, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)VAR_2[4], VAR_2[5], VAR_3[4], VAR_3[5], true); break; case INDEX_op_sub2_i64: tcg_out_addsub2(VAR_0, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), VAR_2[4], VAR_2[5], VAR_3[4], VAR_3[5], true); break; case INDEX_op_muluh_i64: tcg_out_insn(VAR_0, 3508, UMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mulsh_i64: tcg_out_insn(VAR_0, 3508, SMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mov_i32: case INDEX_op_mov_i64: case INDEX_op_movi_i32: case INDEX_op_movi_i64: case INDEX_op_call: default: tcg_abort(); } #undef REG0 }
[ "static void FUNC_0(TCGContext *VAR_0, TCGOpcode VAR_1,\nconst TCGArg VAR_2[TCG_MAX_OP_ARGS],\nconst int VAR_3[TCG_MAX_OP_ARGS])\n{", "TCGType ext = (tcg_op_defs[VAR_1].flags & TCG_OPF_64BIT) != 0;", "TCGArg a0 = VAR_2[0];", "TCGArg a1 = VAR_2[1];", "TCGArg a2 = VAR_2[2];", "int VAR_4 = VAR_3[2];", "#define REG0(I) (VAR_3[I] ? TCG_REG_XZR : (TCGReg)VAR_2[I])\nswitch (VAR_1) {", "case INDEX_op_exit_tb:\ntcg_out_movi(VAR_0, TCG_TYPE_I64, TCG_REG_X0, a0);", "tcg_out_goto(VAR_0, tb_ret_addr);", "break;", "case INDEX_op_goto_tb:\n#ifndef USE_DIRECT_JUMP\n#error \"USE_DIRECT_JUMP required for aarch64\"\n#endif\nassert(VAR_0->tb_jmp_offset != NULL);", "VAR_0->tb_jmp_offset[a0] = tcg_current_code_size(VAR_0);", "tcg_out_goto_noaddr(VAR_0);", "VAR_0->tb_next_offset[a0] = tcg_current_code_size(VAR_0);", "break;", "case INDEX_op_br:\ntcg_out_goto_label(VAR_0, arg_label(a0));", "break;", "case INDEX_op_ld8u_i32:\ncase INDEX_op_ld8u_i64:\ntcg_out_ldst(VAR_0, I3312_LDRB, a0, a1, a2);", "break;", "case INDEX_op_ld8s_i32:\ntcg_out_ldst(VAR_0, I3312_LDRSBW, a0, a1, a2);", "break;", "case INDEX_op_ld8s_i64:\ntcg_out_ldst(VAR_0, I3312_LDRSBX, a0, a1, a2);", "break;", "case INDEX_op_ld16u_i32:\ncase INDEX_op_ld16u_i64:\ntcg_out_ldst(VAR_0, I3312_LDRH, a0, a1, a2);", "break;", "case INDEX_op_ld16s_i32:\ntcg_out_ldst(VAR_0, I3312_LDRSHW, a0, a1, a2);", "break;", "case INDEX_op_ld16s_i64:\ntcg_out_ldst(VAR_0, I3312_LDRSHX, a0, a1, a2);", "break;", "case INDEX_op_ld_i32:\ncase INDEX_op_ld32u_i64:\ntcg_out_ldst(VAR_0, I3312_LDRW, a0, a1, a2);", "break;", "case INDEX_op_ld32s_i64:\ntcg_out_ldst(VAR_0, I3312_LDRSWX, a0, a1, a2);", "break;", "case INDEX_op_ld_i64:\ntcg_out_ldst(VAR_0, I3312_LDRX, a0, a1, a2);", "break;", "case INDEX_op_st8_i32:\ncase INDEX_op_st8_i64:\ntcg_out_ldst(VAR_0, I3312_STRB, REG0(0), a1, a2);", "break;", "case INDEX_op_st16_i32:\ncase INDEX_op_st16_i64:\ntcg_out_ldst(VAR_0, I3312_STRH, REG0(0), a1, a2);", "break;", "case INDEX_op_st_i32:\ncase INDEX_op_st32_i64:\ntcg_out_ldst(VAR_0, I3312_STRW, REG0(0), a1, a2);", "break;", "case INDEX_op_st_i64:\ntcg_out_ldst(VAR_0, I3312_STRX, REG0(0), a1, a2);", "break;", "case INDEX_op_add_i32:\na2 = (int32_t)a2;", "case INDEX_op_add_i64:\nif (VAR_4) {", "tcg_out_addsubi(VAR_0, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3502, ADD, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_sub_i32:\na2 = (int32_t)a2;", "case INDEX_op_sub_i64:\nif (VAR_4) {", "tcg_out_addsubi(VAR_0, ext, a0, a1, -a2);", "} else {", "tcg_out_insn(VAR_0, 3502, SUB, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_neg_i64:\ncase INDEX_op_neg_i32:\ntcg_out_insn(VAR_0, 3502, SUB, ext, a0, TCG_REG_XZR, a1);", "break;", "case INDEX_op_and_i32:\na2 = (int32_t)a2;", "case INDEX_op_and_i64:\nif (VAR_4) {", "tcg_out_logicali(VAR_0, I3404_ANDI, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3510, AND, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_andc_i32:\na2 = (int32_t)a2;", "case INDEX_op_andc_i64:\nif (VAR_4) {", "tcg_out_logicali(VAR_0, I3404_ANDI, ext, a0, a1, ~a2);", "} else {", "tcg_out_insn(VAR_0, 3510, BIC, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_or_i32:\na2 = (int32_t)a2;", "case INDEX_op_or_i64:\nif (VAR_4) {", "tcg_out_logicali(VAR_0, I3404_ORRI, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3510, ORR, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_orc_i32:\na2 = (int32_t)a2;", "case INDEX_op_orc_i64:\nif (VAR_4) {", "tcg_out_logicali(VAR_0, I3404_ORRI, ext, a0, a1, ~a2);", "} else {", "tcg_out_insn(VAR_0, 3510, ORN, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_xor_i32:\na2 = (int32_t)a2;", "case INDEX_op_xor_i64:\nif (VAR_4) {", "tcg_out_logicali(VAR_0, I3404_EORI, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3510, EOR, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_eqv_i32:\na2 = (int32_t)a2;", "case INDEX_op_eqv_i64:\nif (VAR_4) {", "tcg_out_logicali(VAR_0, I3404_EORI, ext, a0, a1, ~a2);", "} else {", "tcg_out_insn(VAR_0, 3510, EON, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_not_i64:\ncase INDEX_op_not_i32:\ntcg_out_insn(VAR_0, 3510, ORN, ext, a0, TCG_REG_XZR, a1);", "break;", "case INDEX_op_mul_i64:\ncase INDEX_op_mul_i32:\ntcg_out_insn(VAR_0, 3509, MADD, ext, a0, a1, a2, TCG_REG_XZR);", "break;", "case INDEX_op_div_i64:\ncase INDEX_op_div_i32:\ntcg_out_insn(VAR_0, 3508, SDIV, ext, a0, a1, a2);", "break;", "case INDEX_op_divu_i64:\ncase INDEX_op_divu_i32:\ntcg_out_insn(VAR_0, 3508, UDIV, ext, a0, a1, a2);", "break;", "case INDEX_op_rem_i64:\ncase INDEX_op_rem_i32:\ntcg_out_insn(VAR_0, 3508, SDIV, ext, TCG_REG_TMP, a1, a2);", "tcg_out_insn(VAR_0, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1);", "break;", "case INDEX_op_remu_i64:\ncase INDEX_op_remu_i32:\ntcg_out_insn(VAR_0, 3508, UDIV, ext, TCG_REG_TMP, a1, a2);", "tcg_out_insn(VAR_0, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1);", "break;", "case INDEX_op_shl_i64:\ncase INDEX_op_shl_i32:\nif (VAR_4) {", "tcg_out_shl(VAR_0, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3508, LSLV, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_shr_i64:\ncase INDEX_op_shr_i32:\nif (VAR_4) {", "tcg_out_shr(VAR_0, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3508, LSRV, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_sar_i64:\ncase INDEX_op_sar_i32:\nif (VAR_4) {", "tcg_out_sar(VAR_0, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3508, ASRV, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_rotr_i64:\ncase INDEX_op_rotr_i32:\nif (VAR_4) {", "tcg_out_rotr(VAR_0, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3508, RORV, ext, a0, a1, a2);", "}", "break;", "case INDEX_op_rotl_i64:\ncase INDEX_op_rotl_i32:\nif (VAR_4) {", "tcg_out_rotl(VAR_0, ext, a0, a1, a2);", "} else {", "tcg_out_insn(VAR_0, 3502, SUB, 0, TCG_REG_TMP, TCG_REG_XZR, a2);", "tcg_out_insn(VAR_0, 3508, RORV, ext, a0, a1, TCG_REG_TMP);", "}", "break;", "case INDEX_op_brcond_i32:\na1 = (int32_t)a1;", "case INDEX_op_brcond_i64:\ntcg_out_brcond(VAR_0, ext, a2, a0, a1, VAR_3[1], arg_label(VAR_2[3]));", "break;", "case INDEX_op_setcond_i32:\na2 = (int32_t)a2;", "case INDEX_op_setcond_i64:\ntcg_out_cmp(VAR_0, ext, a1, a2, VAR_4);", "tcg_out_insn(VAR_0, 3506, CSINC, TCG_TYPE_I32, a0, TCG_REG_XZR,\nTCG_REG_XZR, tcg_invert_cond(VAR_2[3]));", "break;", "case INDEX_op_movcond_i32:\na2 = (int32_t)a2;", "case INDEX_op_movcond_i64:\ntcg_out_cmp(VAR_0, ext, a1, a2, VAR_4);", "tcg_out_insn(VAR_0, 3506, CSEL, ext, a0, REG0(3), REG0(4), VAR_2[5]);", "break;", "case INDEX_op_qemu_ld_i32:\ncase INDEX_op_qemu_ld_i64:\ntcg_out_qemu_ld(VAR_0, a0, a1, a2, ext);", "break;", "case INDEX_op_qemu_st_i32:\ncase INDEX_op_qemu_st_i64:\ntcg_out_qemu_st(VAR_0, REG0(0), a1, a2);", "break;", "case INDEX_op_bswap64_i64:\ntcg_out_rev64(VAR_0, a0, a1);", "break;", "case INDEX_op_bswap32_i64:\ncase INDEX_op_bswap32_i32:\ntcg_out_rev32(VAR_0, a0, a1);", "break;", "case INDEX_op_bswap16_i64:\ncase INDEX_op_bswap16_i32:\ntcg_out_rev16(VAR_0, a0, a1);", "break;", "case INDEX_op_ext8s_i64:\ncase INDEX_op_ext8s_i32:\ntcg_out_sxt(VAR_0, ext, MO_8, a0, a1);", "break;", "case INDEX_op_ext16s_i64:\ncase INDEX_op_ext16s_i32:\ntcg_out_sxt(VAR_0, ext, MO_16, a0, a1);", "break;", "case INDEX_op_ext_i32_i64:\ncase INDEX_op_ext32s_i64:\ntcg_out_sxt(VAR_0, TCG_TYPE_I64, MO_32, a0, a1);", "break;", "case INDEX_op_ext8u_i64:\ncase INDEX_op_ext8u_i32:\ntcg_out_uxt(VAR_0, MO_8, a0, a1);", "break;", "case INDEX_op_ext16u_i64:\ncase INDEX_op_ext16u_i32:\ntcg_out_uxt(VAR_0, MO_16, a0, a1);", "break;", "case INDEX_op_extu_i32_i64:\ncase INDEX_op_ext32u_i64:\ntcg_out_movr(VAR_0, TCG_TYPE_I32, a0, a1);", "break;", "case INDEX_op_deposit_i64:\ncase INDEX_op_deposit_i32:\ntcg_out_dep(VAR_0, ext, a0, REG0(2), VAR_2[3], VAR_2[4]);", "break;", "case INDEX_op_add2_i32:\ntcg_out_addsub2(VAR_0, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3),\n(int32_t)VAR_2[4], VAR_2[5], VAR_3[4],\nVAR_3[5], false);", "break;", "case INDEX_op_add2_i64:\ntcg_out_addsub2(VAR_0, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), VAR_2[4],\nVAR_2[5], VAR_3[4], VAR_3[5], false);", "break;", "case INDEX_op_sub2_i32:\ntcg_out_addsub2(VAR_0, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3),\n(int32_t)VAR_2[4], VAR_2[5], VAR_3[4],\nVAR_3[5], true);", "break;", "case INDEX_op_sub2_i64:\ntcg_out_addsub2(VAR_0, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), VAR_2[4],\nVAR_2[5], VAR_3[4], VAR_3[5], true);", "break;", "case INDEX_op_muluh_i64:\ntcg_out_insn(VAR_0, 3508, UMULH, TCG_TYPE_I64, a0, a1, a2);", "break;", "case INDEX_op_mulsh_i64:\ntcg_out_insn(VAR_0, 3508, SMULH, TCG_TYPE_I64, a0, a1, a2);", "break;", "case INDEX_op_mov_i32:\ncase INDEX_op_mov_i64:\ncase INDEX_op_movi_i32:\ncase INDEX_op_movi_i64:\ncase INDEX_op_call:\ndefault:\ntcg_abort();", "}", "#undef REG0\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 33, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49, 51, 53, 55, 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 81, 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121, 123, 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 143, 145, 147 ], [ 149 ], [ 151, 153, 155 ], [ 157 ], [ 159, 161, 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 175, 177 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197, 199 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219, 221, 223 ], [ 225 ], [ 229, 231 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251, 253 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273, 275 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295, 297 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 317, 319 ], [ 323, 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339, 341 ], [ 345, 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361, 363, 365 ], [ 367 ], [ 371, 373, 375 ], [ 377 ], [ 381, 383, 385 ], [ 387 ], [ 389, 391, 393 ], [ 395 ], [ 399, 401, 403 ], [ 405 ], [ 407 ], [ 409, 411, 413 ], [ 415 ], [ 417 ], [ 421, 423, 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 439, 441, 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 457, 459, 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 475, 477, 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 493, 495, 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 513, 515 ], [ 519, 521 ], [ 523 ], [ 527, 529 ], [ 533, 535 ], [ 539, 541 ], [ 543 ], [ 547, 549 ], [ 553, 555 ], [ 557 ], [ 559 ], [ 563, 565, 567 ], [ 569 ], [ 571, 573, 575 ], [ 577 ], [ 581, 583 ], [ 585 ], [ 587, 589, 591 ], [ 593 ], [ 595, 597, 599 ], [ 601 ], [ 605, 607, 609 ], [ 611 ], [ 613, 615, 617 ], [ 619 ], [ 621, 623, 625 ], [ 627 ], [ 629, 631, 633 ], [ 635 ], [ 637, 639, 641 ], [ 643 ], [ 645, 647, 649 ], [ 651 ], [ 655, 657, 659 ], [ 661 ], [ 665, 667, 669, 671 ], [ 673 ], [ 675, 677, 679 ], [ 681 ], [ 683, 685, 687, 689 ], [ 691 ], [ 693, 695, 697 ], [ 699 ], [ 703, 705 ], [ 707 ], [ 709, 711 ], [ 713 ], [ 717, 719, 721, 723, 725, 727, 729 ], [ 731 ], [ 735, 737 ] ]
3,015
void kvm_arch_reset_vcpu(CPUX86State *env) { env->exception_injected = -1; env->interrupt_injected = -1; env->xcr0 = 1; if (kvm_irqchip_in_kernel()) { env->mp_state = cpu_is_bsp(env) ? KVM_MP_STATE_RUNNABLE : KVM_MP_STATE_UNINITIALIZED; } else { env->mp_state = KVM_MP_STATE_RUNNABLE; } }
false
qemu
dd673288a8ff73ad77fcc1c255486d2466a772e1
void kvm_arch_reset_vcpu(CPUX86State *env) { env->exception_injected = -1; env->interrupt_injected = -1; env->xcr0 = 1; if (kvm_irqchip_in_kernel()) { env->mp_state = cpu_is_bsp(env) ? KVM_MP_STATE_RUNNABLE : KVM_MP_STATE_UNINITIALIZED; } else { env->mp_state = KVM_MP_STATE_RUNNABLE; } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUX86State *VAR_0) { VAR_0->exception_injected = -1; VAR_0->interrupt_injected = -1; VAR_0->xcr0 = 1; if (kvm_irqchip_in_kernel()) { VAR_0->mp_state = cpu_is_bsp(VAR_0) ? KVM_MP_STATE_RUNNABLE : KVM_MP_STATE_UNINITIALIZED; } else { VAR_0->mp_state = KVM_MP_STATE_RUNNABLE; } }
[ "void FUNC_0(CPUX86State *VAR_0)\n{", "VAR_0->exception_injected = -1;", "VAR_0->interrupt_injected = -1;", "VAR_0->xcr0 = 1;", "if (kvm_irqchip_in_kernel()) {", "VAR_0->mp_state = cpu_is_bsp(VAR_0) ? KVM_MP_STATE_RUNNABLE :\nKVM_MP_STATE_UNINITIALIZED;", "} else {", "VAR_0->mp_state = KVM_MP_STATE_RUNNABLE;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
3,016
static void tight_pack24(VncState *vs, uint8_t *buf, size_t count, size_t *ret) { uint32_t *buf32; uint32_t pix; int rshift, gshift, bshift; buf32 = (uint32_t *)buf; if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) == (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) { rshift = vs->clientds.pf.rshift; gshift = vs->clientds.pf.gshift; bshift = vs->clientds.pf.bshift; } else { rshift = 24 - vs->clientds.pf.rshift; gshift = 24 - vs->clientds.pf.gshift; bshift = 24 - vs->clientds.pf.bshift; } if (ret) { *ret = count * 3; } while (count--) { pix = *buf32++; *buf++ = (char)(pix >> rshift); *buf++ = (char)(pix >> gshift); *buf++ = (char)(pix >> bshift); } }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
static void tight_pack24(VncState *vs, uint8_t *buf, size_t count, size_t *ret) { uint32_t *buf32; uint32_t pix; int rshift, gshift, bshift; buf32 = (uint32_t *)buf; if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) == (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) { rshift = vs->clientds.pf.rshift; gshift = vs->clientds.pf.gshift; bshift = vs->clientds.pf.bshift; } else { rshift = 24 - vs->clientds.pf.rshift; gshift = 24 - vs->clientds.pf.gshift; bshift = 24 - vs->clientds.pf.bshift; } if (ret) { *ret = count * 3; } while (count--) { pix = *buf32++; *buf++ = (char)(pix >> rshift); *buf++ = (char)(pix >> gshift); *buf++ = (char)(pix >> bshift); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2, size_t *VAR_3) { uint32_t *buf32; uint32_t pix; int VAR_4, VAR_5, VAR_6; buf32 = (uint32_t *)VAR_1; if ((VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG) == (VAR_0->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) { VAR_4 = VAR_0->clientds.pf.VAR_4; VAR_5 = VAR_0->clientds.pf.VAR_5; VAR_6 = VAR_0->clientds.pf.VAR_6; } else { VAR_4 = 24 - VAR_0->clientds.pf.VAR_4; VAR_5 = 24 - VAR_0->clientds.pf.VAR_5; VAR_6 = 24 - VAR_0->clientds.pf.VAR_6; } if (VAR_3) { *VAR_3 = VAR_2 * 3; } while (VAR_2--) { pix = *buf32++; *VAR_1++ = (char)(pix >> VAR_4); *VAR_1++ = (char)(pix >> VAR_5); *VAR_1++ = (char)(pix >> VAR_6); } }
[ "static void FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2, size_t *VAR_3)\n{", "uint32_t *buf32;", "uint32_t pix;", "int VAR_4, VAR_5, VAR_6;", "buf32 = (uint32_t *)VAR_1;", "if ((VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==\n(VAR_0->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) {", "VAR_4 = VAR_0->clientds.pf.VAR_4;", "VAR_5 = VAR_0->clientds.pf.VAR_5;", "VAR_6 = VAR_0->clientds.pf.VAR_6;", "} else {", "VAR_4 = 24 - VAR_0->clientds.pf.VAR_4;", "VAR_5 = 24 - VAR_0->clientds.pf.VAR_5;", "VAR_6 = 24 - VAR_0->clientds.pf.VAR_6;", "}", "if (VAR_3) {", "*VAR_3 = VAR_2 * 3;", "}", "while (VAR_2--) {", "pix = *buf32++;", "*VAR_1++ = (char)(pix >> VAR_4);", "*VAR_1++ = (char)(pix >> VAR_5);", "*VAR_1++ = (char)(pix >> VAR_6);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
3,017
static void slow_bar_writew(void *opaque, target_phys_addr_t addr, uint32_t val) { AssignedDevRegion *d = opaque; uint16_t *out = (uint16_t *)(d->u.r_virtbase + addr); DEBUG("slow_bar_writew addr=0x" TARGET_FMT_plx " val=0x%04x\n", addr, val); *out = val; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void slow_bar_writew(void *opaque, target_phys_addr_t addr, uint32_t val) { AssignedDevRegion *d = opaque; uint16_t *out = (uint16_t *)(d->u.r_virtbase + addr); DEBUG("slow_bar_writew addr=0x" TARGET_FMT_plx " val=0x%04x\n", addr, val); *out = val; }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { AssignedDevRegion *d = VAR_0; uint16_t *out = (uint16_t *)(d->u.r_virtbase + VAR_1); DEBUG("FUNC_0 VAR_1=0x" TARGET_FMT_plx " VAR_2=0x%04x\n", VAR_1, VAR_2); *out = VAR_2; }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2)\n{", "AssignedDevRegion *d = VAR_0;", "uint16_t *out = (uint16_t *)(d->u.r_virtbase + VAR_1);", "DEBUG(\"FUNC_0 VAR_1=0x\" TARGET_FMT_plx \" VAR_2=0x%04x\\n\", VAR_1, VAR_2);", "*out = VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
3,018
static uint64_t gic_thiscpu_read(void *opaque, target_phys_addr_t addr, unsigned size) { GICState *s = (GICState *)opaque; return gic_cpu_read(s, gic_get_current_cpu(s), addr); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t gic_thiscpu_read(void *opaque, target_phys_addr_t addr, unsigned size) { GICState *s = (GICState *)opaque; return gic_cpu_read(s, gic_get_current_cpu(s), addr); }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { GICState *s = (GICState *)opaque; return gic_cpu_read(s, gic_get_current_cpu(s), addr); }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "GICState *s = (GICState *)opaque;", "return gic_cpu_read(s, gic_get_current_cpu(s), addr);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
3,021
int isa_vga_mm_init(hwaddr vram_base, hwaddr ctrl_base, int it_shift, MemoryRegion *address_space) { ISAVGAMMState *s; s = g_malloc0(sizeof(*s)); s->vga.vram_size_mb = VGA_RAM_SIZE >> 20; vga_common_init(&s->vga); vga_mm_init(s, vram_base, ctrl_base, it_shift, address_space); s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, s); vga_init_vbe(&s->vga, address_space); return 0; }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
int isa_vga_mm_init(hwaddr vram_base, hwaddr ctrl_base, int it_shift, MemoryRegion *address_space) { ISAVGAMMState *s; s = g_malloc0(sizeof(*s)); s->vga.vram_size_mb = VGA_RAM_SIZE >> 20; vga_common_init(&s->vga); vga_mm_init(s, vram_base, ctrl_base, it_shift, address_space); s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, s); vga_init_vbe(&s->vga, address_space); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(hwaddr VAR_0, hwaddr VAR_1, int VAR_2, MemoryRegion *VAR_3) { ISAVGAMMState *s; s = g_malloc0(sizeof(*s)); s->vga.vram_size_mb = VGA_RAM_SIZE >> 20; vga_common_init(&s->vga); vga_mm_init(s, VAR_0, VAR_1, VAR_2, VAR_3); s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, s); vga_init_vbe(&s->vga, VAR_3); return 0; }
[ "int FUNC_0(hwaddr VAR_0,\nhwaddr VAR_1, int VAR_2,\nMemoryRegion *VAR_3)\n{", "ISAVGAMMState *s;", "s = g_malloc0(sizeof(*s));", "s->vga.vram_size_mb = VGA_RAM_SIZE >> 20;", "vga_common_init(&s->vga);", "vga_mm_init(s, VAR_0, VAR_1, VAR_2, VAR_3);", "s->vga.con = graphic_console_init(s->vga.update, s->vga.invalidate,\ns->vga.screen_dump, s->vga.text_update,\ns);", "vga_init_vbe(&s->vga, VAR_3);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 33 ], [ 35 ], [ 37 ] ]
3,022
float64 helper_fitod(CPUSPARCState *env, int32_t src) { /* No possible exceptions converting int to double. */ return int32_to_float64(src, &env->fp_status); }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
float64 helper_fitod(CPUSPARCState *env, int32_t src) { return int32_to_float64(src, &env->fp_status); }
{ "code": [], "line_no": [] }
float64 FUNC_0(CPUSPARCState *env, int32_t src) { return int32_to_float64(src, &env->fp_status); }
[ "float64 FUNC_0(CPUSPARCState *env, int32_t src)\n{", "return int32_to_float64(src, &env->fp_status);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ] ]
3,023
audio_get_output_timestamp(AVFormatContext *s1, int stream, int64_t *dts, int64_t *wall) { AlsaData *s = s1->priv_data; snd_pcm_sframes_t delay = 0; *wall = av_gettime(); snd_pcm_delay(s->h, &delay); *dts = s1->streams[0]->cur_dts - delay; }
false
FFmpeg
6ac9afd16e385fc450c58b8a3fb44baa99ea4af9
audio_get_output_timestamp(AVFormatContext *s1, int stream, int64_t *dts, int64_t *wall) { AlsaData *s = s1->priv_data; snd_pcm_sframes_t delay = 0; *wall = av_gettime(); snd_pcm_delay(s->h, &delay); *dts = s1->streams[0]->cur_dts - delay; }
{ "code": [], "line_no": [] }
FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t *VAR_2, int64_t *VAR_3) { AlsaData *s = VAR_0->priv_data; snd_pcm_sframes_t delay = 0; *VAR_3 = av_gettime(); snd_pcm_delay(s->h, &delay); *VAR_2 = VAR_0->streams[0]->cur_dts - delay; }
[ "FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nint64_t *VAR_2, int64_t *VAR_3)\n{", "AlsaData *s = VAR_0->priv_data;", "snd_pcm_sframes_t delay = 0;", "*VAR_3 = av_gettime();", "snd_pcm_delay(s->h, &delay);", "*VAR_2 = VAR_0->streams[0]->cur_dts - delay;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
3,024
static void do_vm_stop(RunState state) { if (runstate_is_running()) { cpu_disable_ticks(); pause_all_vcpus(); runstate_set(state); vm_state_notify(0, state); qemu_aio_flush(); bdrv_flush_all(); monitor_protocol_event(QEVENT_STOP, NULL); } }
false
qemu
922453bca6a927bb527068ae8679d587cfa45dbc
static void do_vm_stop(RunState state) { if (runstate_is_running()) { cpu_disable_ticks(); pause_all_vcpus(); runstate_set(state); vm_state_notify(0, state); qemu_aio_flush(); bdrv_flush_all(); monitor_protocol_event(QEVENT_STOP, NULL); } }
{ "code": [], "line_no": [] }
static void FUNC_0(RunState VAR_0) { if (runstate_is_running()) { cpu_disable_ticks(); pause_all_vcpus(); runstate_set(VAR_0); vm_state_notify(0, VAR_0); qemu_aio_flush(); bdrv_flush_all(); monitor_protocol_event(QEVENT_STOP, NULL); } }
[ "static void FUNC_0(RunState VAR_0)\n{", "if (runstate_is_running()) {", "cpu_disable_ticks();", "pause_all_vcpus();", "runstate_set(VAR_0);", "vm_state_notify(0, VAR_0);", "qemu_aio_flush();", "bdrv_flush_all();", "monitor_protocol_event(QEVENT_STOP, NULL);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
3,025
static int vt82c686b_pm_initfn(PCIDevice *dev) { VT686PMState *s = DO_UPCAST(VT686PMState, dev, dev); uint8_t *pci_conf; pci_conf = s->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_ACPI); pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER); pci_config_set_revision(pci_conf, 0x40); pci_set_word(pci_conf + PCI_COMMAND, 0); pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM); /* 0x48-0x4B is Power Management I/O Base */ pci_set_long(pci_conf + 0x48, 0x00000001); /* SMB ports:0xeee0~0xeeef */ s->smb_io_base =((s->smb_io_base & 0xfff0) + 0x0); pci_conf[0x90] = s->smb_io_base | 1; pci_conf[0x91] = s->smb_io_base >> 8; pci_conf[0xd2] = 0x90; register_ioport_write(s->smb_io_base, 0xf, 1, smb_ioport_writeb, &s->smb); register_ioport_read(s->smb_io_base, 0xf, 1, smb_ioport_readb, &s->smb); apm_init(&s->apm, NULL, s); acpi_pm_tmr_init(&s->tmr, pm_tmr_timer); acpi_pm1_cnt_init(&s->pm1_cnt, NULL); pm_smbus_init(&s->dev.qdev, &s->smb); return 0; }
false
qemu
1cf0d2b8352a2df35919030b84dbfc713ee9b9be
static int vt82c686b_pm_initfn(PCIDevice *dev) { VT686PMState *s = DO_UPCAST(VT686PMState, dev, dev); uint8_t *pci_conf; pci_conf = s->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_ACPI); pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER); pci_config_set_revision(pci_conf, 0x40); pci_set_word(pci_conf + PCI_COMMAND, 0); pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM); pci_set_long(pci_conf + 0x48, 0x00000001); s->smb_io_base =((s->smb_io_base & 0xfff0) + 0x0); pci_conf[0x90] = s->smb_io_base | 1; pci_conf[0x91] = s->smb_io_base >> 8; pci_conf[0xd2] = 0x90; register_ioport_write(s->smb_io_base, 0xf, 1, smb_ioport_writeb, &s->smb); register_ioport_read(s->smb_io_base, 0xf, 1, smb_ioport_readb, &s->smb); apm_init(&s->apm, NULL, s); acpi_pm_tmr_init(&s->tmr, pm_tmr_timer); acpi_pm1_cnt_init(&s->pm1_cnt, NULL); pm_smbus_init(&s->dev.qdev, &s->smb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { VT686PMState *s = DO_UPCAST(VT686PMState, VAR_0, VAR_0); uint8_t *pci_conf; pci_conf = s->VAR_0.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_ACPI); pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER); pci_config_set_revision(pci_conf, 0x40); pci_set_word(pci_conf + PCI_COMMAND, 0); pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM); pci_set_long(pci_conf + 0x48, 0x00000001); s->smb_io_base =((s->smb_io_base & 0xfff0) + 0x0); pci_conf[0x90] = s->smb_io_base | 1; pci_conf[0x91] = s->smb_io_base >> 8; pci_conf[0xd2] = 0x90; register_ioport_write(s->smb_io_base, 0xf, 1, smb_ioport_writeb, &s->smb); register_ioport_read(s->smb_io_base, 0xf, 1, smb_ioport_readb, &s->smb); apm_init(&s->apm, NULL, s); acpi_pm_tmr_init(&s->tmr, pm_tmr_timer); acpi_pm1_cnt_init(&s->pm1_cnt, NULL); pm_smbus_init(&s->VAR_0.qdev, &s->smb); return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "VT686PMState *s = DO_UPCAST(VT686PMState, VAR_0, VAR_0);", "uint8_t *pci_conf;", "pci_conf = s->VAR_0.config;", "pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA);", "pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_ACPI);", "pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER);", "pci_config_set_revision(pci_conf, 0x40);", "pci_set_word(pci_conf + PCI_COMMAND, 0);", "pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_FAST_BACK |\nPCI_STATUS_DEVSEL_MEDIUM);", "pci_set_long(pci_conf + 0x48, 0x00000001);", "s->smb_io_base =((s->smb_io_base & 0xfff0) + 0x0);", "pci_conf[0x90] = s->smb_io_base | 1;", "pci_conf[0x91] = s->smb_io_base >> 8;", "pci_conf[0xd2] = 0x90;", "register_ioport_write(s->smb_io_base, 0xf, 1, smb_ioport_writeb, &s->smb);", "register_ioport_read(s->smb_io_base, 0xf, 1, smb_ioport_readb, &s->smb);", "apm_init(&s->apm, NULL, s);", "acpi_pm_tmr_init(&s->tmr, pm_tmr_timer);", "acpi_pm1_cnt_init(&s->pm1_cnt, NULL);", "pm_smbus_init(&s->VAR_0.qdev, &s->smb);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ] ]
3,026
restore_sigcontext(CPUM68KState *env, struct target_sigcontext *sc, int *pd0) { int temp; __get_user(env->aregs[7], &sc->sc_usp); __get_user(env->dregs[1], &sc->sc_d1); __get_user(env->aregs[0], &sc->sc_a0); __get_user(env->aregs[1], &sc->sc_a1); __get_user(env->pc, &sc->sc_pc); __get_user(temp, &sc->sc_sr); env->sr = (env->sr & 0xff00) | (temp & 0xff); *pd0 = tswapl(sc->sc_d0); }
false
qemu
7ccb84a91618eda626b12ce83d62cfe678cfc58f
restore_sigcontext(CPUM68KState *env, struct target_sigcontext *sc, int *pd0) { int temp; __get_user(env->aregs[7], &sc->sc_usp); __get_user(env->dregs[1], &sc->sc_d1); __get_user(env->aregs[0], &sc->sc_a0); __get_user(env->aregs[1], &sc->sc_a1); __get_user(env->pc, &sc->sc_pc); __get_user(temp, &sc->sc_sr); env->sr = (env->sr & 0xff00) | (temp & 0xff); *pd0 = tswapl(sc->sc_d0); }
{ "code": [], "line_no": [] }
FUNC_0(CPUM68KState *VAR_0, struct target_sigcontext *VAR_1, int *VAR_2) { int VAR_3; __get_user(VAR_0->aregs[7], &VAR_1->sc_usp); __get_user(VAR_0->dregs[1], &VAR_1->sc_d1); __get_user(VAR_0->aregs[0], &VAR_1->sc_a0); __get_user(VAR_0->aregs[1], &VAR_1->sc_a1); __get_user(VAR_0->pc, &VAR_1->sc_pc); __get_user(VAR_3, &VAR_1->sc_sr); VAR_0->sr = (VAR_0->sr & 0xff00) | (VAR_3 & 0xff); *VAR_2 = tswapl(VAR_1->sc_d0); }
[ "FUNC_0(CPUM68KState *VAR_0, struct target_sigcontext *VAR_1, int *VAR_2)\n{", "int VAR_3;", "__get_user(VAR_0->aregs[7], &VAR_1->sc_usp);", "__get_user(VAR_0->dregs[1], &VAR_1->sc_d1);", "__get_user(VAR_0->aregs[0], &VAR_1->sc_a0);", "__get_user(VAR_0->aregs[1], &VAR_1->sc_a1);", "__get_user(VAR_0->pc, &VAR_1->sc_pc);", "__get_user(VAR_3, &VAR_1->sc_sr);", "VAR_0->sr = (VAR_0->sr & 0xff00) | (VAR_3 & 0xff);", "*VAR_2 = tswapl(VAR_1->sc_d0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
3,027
void DMA_run (void) { }
false
qemu
492c30af2567a59413c064f88eb81e1691865195
void DMA_run (void) { }
{ "code": [], "line_no": [] }
void FUNC_0 (void) { }
[ "void FUNC_0 (void)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 5 ] ]
3,028
static void set_blocksize(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint16_t value, *ptr = qdev_get_prop_ptr(dev, prop); Error *local_err = NULL; const int64_t min = 512; const int64_t max = 32768; if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); return; } visit_type_uint16(v, &value, name, &local_err); if (local_err) { error_propagate(errp, local_err); return; } if (value < min || value > max) { error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, dev->id?:"", name, (int64_t)value, min, max); return; } /* We rely on power-of-2 blocksizes for bitmasks */ if ((value & (value - 1)) != 0) { error_setg(errp, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2", dev->id ?: "", name, (int64_t)value); return; } *ptr = value; }
false
qemu
0eb28a42284ec32e6f283985d2d638474a05eba4
static void set_blocksize(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint16_t value, *ptr = qdev_get_prop_ptr(dev, prop); Error *local_err = NULL; const int64_t min = 512; const int64_t max = 32768; if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); return; } visit_type_uint16(v, &value, name, &local_err); if (local_err) { error_propagate(errp, local_err); return; } if (value < min || value > max) { error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, dev->id?:"", name, (int64_t)value, min, max); return; } if ((value & (value - 1)) != 0) { error_setg(errp, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2", dev->id ?: "", name, (int64_t)value); return; } *ptr = value; }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0, Visitor *VAR_1, void *VAR_2, const char *VAR_3, Error **VAR_4) { DeviceState *dev = DEVICE(VAR_0); Property *prop = VAR_2; uint16_t value, *ptr = qdev_get_prop_ptr(dev, prop); Error *local_err = NULL; const int64_t VAR_5 = 512; const int64_t VAR_6 = 32768; if (dev->realized) { qdev_prop_set_after_realize(dev, VAR_3, VAR_4); return; } visit_type_uint16(VAR_1, &value, VAR_3, &local_err); if (local_err) { error_propagate(VAR_4, local_err); return; } if (value < VAR_5 || value > VAR_6) { error_set(VAR_4, QERR_PROPERTY_VALUE_OUT_OF_RANGE, dev->id?:"", VAR_3, (int64_t)value, VAR_5, VAR_6); return; } if ((value & (value - 1)) != 0) { error_setg(VAR_4, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2", dev->id ?: "", VAR_3, (int64_t)value); return; } *ptr = value; }
[ "static void FUNC_0(Object *VAR_0, Visitor *VAR_1, void *VAR_2,\nconst char *VAR_3, Error **VAR_4)\n{", "DeviceState *dev = DEVICE(VAR_0);", "Property *prop = VAR_2;", "uint16_t value, *ptr = qdev_get_prop_ptr(dev, prop);", "Error *local_err = NULL;", "const int64_t VAR_5 = 512;", "const int64_t VAR_6 = 32768;", "if (dev->realized) {", "qdev_prop_set_after_realize(dev, VAR_3, VAR_4);", "return;", "}", "visit_type_uint16(VAR_1, &value, VAR_3, &local_err);", "if (local_err) {", "error_propagate(VAR_4, local_err);", "return;", "}", "if (value < VAR_5 || value > VAR_6) {", "error_set(VAR_4, QERR_PROPERTY_VALUE_OUT_OF_RANGE,\ndev->id?:\"\", VAR_3, (int64_t)value, VAR_5, VAR_6);", "return;", "}", "if ((value & (value - 1)) != 0) {", "error_setg(VAR_4,\n\"Property %s.%s doesn't take value '%\" PRId64 \"', it's not a power of 2\",\ndev->id ?: \"\", VAR_3, (int64_t)value);", "return;", "}", "*ptr = value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
3,029
static void load_linux(FWCfgState *fw_cfg, const char *kernel_filename, const char *initrd_filename, const char *kernel_cmdline, hwaddr max_ram_size) { uint16_t protocol; int setup_size, kernel_size, initrd_size = 0, cmdline_size; uint32_t initrd_max; uint8_t header[8192], *setup, *kernel, *initrd_data; hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0; FILE *f; char *vmode; /* Align to 16 bytes as a paranoia measure */ cmdline_size = (strlen(kernel_cmdline)+16) & ~15; /* load the kernel header */ f = fopen(kernel_filename, "rb"); if (!f || !(kernel_size = get_file_size(f)) || fread(header, 1, MIN(ARRAY_SIZE(header), kernel_size), f) != MIN(ARRAY_SIZE(header), kernel_size)) { fprintf(stderr, "qemu: could not load kernel '%s': %s\n", kernel_filename, strerror(errno)); exit(1); } /* kernel protocol version */ #if 0 fprintf(stderr, "header magic: %#x\n", ldl_p(header+0x202)); #endif if (ldl_p(header+0x202) == 0x53726448) { protocol = lduw_p(header+0x206); } else { /* This looks like a multiboot kernel. If it is, let's stop treating it like a Linux kernel. */ if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, kernel_cmdline, kernel_size, header)) { return; } protocol = 0; } if (protocol < 0x200 || !(header[0x211] & 0x01)) { /* Low kernel */ real_addr = 0x90000; cmdline_addr = 0x9a000 - cmdline_size; prot_addr = 0x10000; } else if (protocol < 0x202) { /* High but ancient kernel */ real_addr = 0x90000; cmdline_addr = 0x9a000 - cmdline_size; prot_addr = 0x100000; } else { /* High and recent kernel */ real_addr = 0x10000; cmdline_addr = 0x20000; prot_addr = 0x100000; } #if 0 fprintf(stderr, "qemu: real_addr = 0x" TARGET_FMT_plx "\n" "qemu: cmdline_addr = 0x" TARGET_FMT_plx "\n" "qemu: prot_addr = 0x" TARGET_FMT_plx "\n", real_addr, cmdline_addr, prot_addr); #endif /* highest address for loading the initrd */ if (protocol >= 0x203) { initrd_max = ldl_p(header+0x22c); } else { initrd_max = 0x37ffffff; } if (initrd_max >= max_ram_size-ACPI_DATA_SIZE) initrd_max = max_ram_size-ACPI_DATA_SIZE-1; fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_ADDR, cmdline_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(kernel_cmdline)+1); fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, kernel_cmdline); if (protocol >= 0x202) { stl_p(header+0x228, cmdline_addr); } else { stw_p(header+0x20, 0xA33F); stw_p(header+0x22, cmdline_addr-real_addr); } /* handle vga= parameter */ vmode = strstr(kernel_cmdline, "vga="); if (vmode) { unsigned int video_mode; /* skip "vga=" */ vmode += 4; if (!strncmp(vmode, "normal", 6)) { video_mode = 0xffff; } else if (!strncmp(vmode, "ext", 3)) { video_mode = 0xfffe; } else if (!strncmp(vmode, "ask", 3)) { video_mode = 0xfffd; } else { video_mode = strtol(vmode, NULL, 0); } stw_p(header+0x1fa, video_mode); } /* loader type */ /* High nybble = B reserved for QEMU; low nybble is revision number. If this code is substantially changed, you may want to consider incrementing the revision. */ if (protocol >= 0x200) { header[0x210] = 0xB0; } /* heap */ if (protocol >= 0x201) { header[0x211] |= 0x80; /* CAN_USE_HEAP */ stw_p(header+0x224, cmdline_addr-real_addr-0x200); } /* load initrd */ if (initrd_filename) { if (protocol < 0x200) { fprintf(stderr, "qemu: linux kernel too old to load a ram disk\n"); exit(1); } initrd_size = get_image_size(initrd_filename); if (initrd_size < 0) { fprintf(stderr, "qemu: error reading initrd %s: %s\n", initrd_filename, strerror(errno)); exit(1); } initrd_addr = (initrd_max-initrd_size) & ~4095; initrd_data = g_malloc(initrd_size); load_image(initrd_filename, initrd_data); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, initrd_data, initrd_size); stl_p(header+0x218, initrd_addr); stl_p(header+0x21c, initrd_size); } /* load kernel and setup */ setup_size = header[0x1f1]; if (setup_size == 0) { setup_size = 4; } setup_size = (setup_size+1)*512; kernel_size -= setup_size; setup = g_malloc(setup_size); kernel = g_malloc(kernel_size); fseek(f, 0, SEEK_SET); if (fread(setup, 1, setup_size, f) != setup_size) { fprintf(stderr, "fread() failed\n"); exit(1); } if (fread(kernel, 1, kernel_size, f) != kernel_size) { fprintf(stderr, "fread() failed\n"); exit(1); } fclose(f); memcpy(setup, header, MIN(sizeof(header), setup_size)); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, prot_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_KERNEL_DATA, kernel, kernel_size); fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_ADDR, real_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_SIZE, setup_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_SETUP_DATA, setup, setup_size); option_rom[nb_option_roms].name = "linuxboot.bin"; option_rom[nb_option_roms].bootindex = 0; nb_option_roms++; }
false
qemu
927766c7d34275ecf586020cc5305e377cc4af10
static void load_linux(FWCfgState *fw_cfg, const char *kernel_filename, const char *initrd_filename, const char *kernel_cmdline, hwaddr max_ram_size) { uint16_t protocol; int setup_size, kernel_size, initrd_size = 0, cmdline_size; uint32_t initrd_max; uint8_t header[8192], *setup, *kernel, *initrd_data; hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0; FILE *f; char *vmode; cmdline_size = (strlen(kernel_cmdline)+16) & ~15; f = fopen(kernel_filename, "rb"); if (!f || !(kernel_size = get_file_size(f)) || fread(header, 1, MIN(ARRAY_SIZE(header), kernel_size), f) != MIN(ARRAY_SIZE(header), kernel_size)) { fprintf(stderr, "qemu: could not load kernel '%s': %s\n", kernel_filename, strerror(errno)); exit(1); } #if 0 fprintf(stderr, "header magic: %#x\n", ldl_p(header+0x202)); #endif if (ldl_p(header+0x202) == 0x53726448) { protocol = lduw_p(header+0x206); } else { if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, kernel_cmdline, kernel_size, header)) { return; } protocol = 0; } if (protocol < 0x200 || !(header[0x211] & 0x01)) { real_addr = 0x90000; cmdline_addr = 0x9a000 - cmdline_size; prot_addr = 0x10000; } else if (protocol < 0x202) { real_addr = 0x90000; cmdline_addr = 0x9a000 - cmdline_size; prot_addr = 0x100000; } else { real_addr = 0x10000; cmdline_addr = 0x20000; prot_addr = 0x100000; } #if 0 fprintf(stderr, "qemu: real_addr = 0x" TARGET_FMT_plx "\n" "qemu: cmdline_addr = 0x" TARGET_FMT_plx "\n" "qemu: prot_addr = 0x" TARGET_FMT_plx "\n", real_addr, cmdline_addr, prot_addr); #endif if (protocol >= 0x203) { initrd_max = ldl_p(header+0x22c); } else { initrd_max = 0x37ffffff; } if (initrd_max >= max_ram_size-ACPI_DATA_SIZE) initrd_max = max_ram_size-ACPI_DATA_SIZE-1; fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_ADDR, cmdline_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(kernel_cmdline)+1); fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, kernel_cmdline); if (protocol >= 0x202) { stl_p(header+0x228, cmdline_addr); } else { stw_p(header+0x20, 0xA33F); stw_p(header+0x22, cmdline_addr-real_addr); } vmode = strstr(kernel_cmdline, "vga="); if (vmode) { unsigned int video_mode; vmode += 4; if (!strncmp(vmode, "normal", 6)) { video_mode = 0xffff; } else if (!strncmp(vmode, "ext", 3)) { video_mode = 0xfffe; } else if (!strncmp(vmode, "ask", 3)) { video_mode = 0xfffd; } else { video_mode = strtol(vmode, NULL, 0); } stw_p(header+0x1fa, video_mode); } if (protocol >= 0x200) { header[0x210] = 0xB0; } if (protocol >= 0x201) { header[0x211] |= 0x80; stw_p(header+0x224, cmdline_addr-real_addr-0x200); } if (initrd_filename) { if (protocol < 0x200) { fprintf(stderr, "qemu: linux kernel too old to load a ram disk\n"); exit(1); } initrd_size = get_image_size(initrd_filename); if (initrd_size < 0) { fprintf(stderr, "qemu: error reading initrd %s: %s\n", initrd_filename, strerror(errno)); exit(1); } initrd_addr = (initrd_max-initrd_size) & ~4095; initrd_data = g_malloc(initrd_size); load_image(initrd_filename, initrd_data); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, initrd_data, initrd_size); stl_p(header+0x218, initrd_addr); stl_p(header+0x21c, initrd_size); } setup_size = header[0x1f1]; if (setup_size == 0) { setup_size = 4; } setup_size = (setup_size+1)*512; kernel_size -= setup_size; setup = g_malloc(setup_size); kernel = g_malloc(kernel_size); fseek(f, 0, SEEK_SET); if (fread(setup, 1, setup_size, f) != setup_size) { fprintf(stderr, "fread() failed\n"); exit(1); } if (fread(kernel, 1, kernel_size, f) != kernel_size) { fprintf(stderr, "fread() failed\n"); exit(1); } fclose(f); memcpy(setup, header, MIN(sizeof(header), setup_size)); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, prot_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_KERNEL_DATA, kernel, kernel_size); fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_ADDR, real_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_SIZE, setup_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_SETUP_DATA, setup, setup_size); option_rom[nb_option_roms].name = "linuxboot.bin"; option_rom[nb_option_roms].bootindex = 0; nb_option_roms++; }
{ "code": [], "line_no": [] }
static void FUNC_0(FWCfgState *VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, hwaddr VAR_4) { uint16_t protocol; int VAR_5, VAR_6, VAR_7 = 0, VAR_8; uint32_t initrd_max; uint8_t header[8192], *setup, *kernel, *initrd_data; hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0; FILE *f; char *VAR_9; VAR_8 = (strlen(VAR_3)+16) & ~15; f = fopen(VAR_1, "rb"); if (!f || !(VAR_6 = get_file_size(f)) || fread(header, 1, MIN(ARRAY_SIZE(header), VAR_6), f) != MIN(ARRAY_SIZE(header), VAR_6)) { fprintf(stderr, "qemu: could not load kernel '%s': %s\n", VAR_1, strerror(errno)); exit(1); } #if 0 fprintf(stderr, "header magic: %#x\n", ldl_p(header+0x202)); #endif if (ldl_p(header+0x202) == 0x53726448) { protocol = lduw_p(header+0x206); } else { if (load_multiboot(VAR_0, f, VAR_1, VAR_2, VAR_3, VAR_6, header)) { return; } protocol = 0; } if (protocol < 0x200 || !(header[0x211] & 0x01)) { real_addr = 0x90000; cmdline_addr = 0x9a000 - VAR_8; prot_addr = 0x10000; } else if (protocol < 0x202) { real_addr = 0x90000; cmdline_addr = 0x9a000 - VAR_8; prot_addr = 0x100000; } else { real_addr = 0x10000; cmdline_addr = 0x20000; prot_addr = 0x100000; } #if 0 fprintf(stderr, "qemu: real_addr = 0x" TARGET_FMT_plx "\n" "qemu: cmdline_addr = 0x" TARGET_FMT_plx "\n" "qemu: prot_addr = 0x" TARGET_FMT_plx "\n", real_addr, cmdline_addr, prot_addr); #endif if (protocol >= 0x203) { initrd_max = ldl_p(header+0x22c); } else { initrd_max = 0x37ffffff; } if (initrd_max >= VAR_4-ACPI_DATA_SIZE) initrd_max = VAR_4-ACPI_DATA_SIZE-1; fw_cfg_add_i32(VAR_0, FW_CFG_CMDLINE_ADDR, cmdline_addr); fw_cfg_add_i32(VAR_0, FW_CFG_CMDLINE_SIZE, strlen(VAR_3)+1); fw_cfg_add_string(VAR_0, FW_CFG_CMDLINE_DATA, VAR_3); if (protocol >= 0x202) { stl_p(header+0x228, cmdline_addr); } else { stw_p(header+0x20, 0xA33F); stw_p(header+0x22, cmdline_addr-real_addr); } VAR_9 = strstr(VAR_3, "vga="); if (VAR_9) { unsigned int VAR_10; VAR_9 += 4; if (!strncmp(VAR_9, "normal", 6)) { VAR_10 = 0xffff; } else if (!strncmp(VAR_9, "ext", 3)) { VAR_10 = 0xfffe; } else if (!strncmp(VAR_9, "ask", 3)) { VAR_10 = 0xfffd; } else { VAR_10 = strtol(VAR_9, NULL, 0); } stw_p(header+0x1fa, VAR_10); } if (protocol >= 0x200) { header[0x210] = 0xB0; } if (protocol >= 0x201) { header[0x211] |= 0x80; stw_p(header+0x224, cmdline_addr-real_addr-0x200); } if (VAR_2) { if (protocol < 0x200) { fprintf(stderr, "qemu: linux kernel too old to load a ram disk\n"); exit(1); } VAR_7 = get_image_size(VAR_2); if (VAR_7 < 0) { fprintf(stderr, "qemu: error reading initrd %s: %s\n", VAR_2, strerror(errno)); exit(1); } initrd_addr = (initrd_max-VAR_7) & ~4095; initrd_data = g_malloc(VAR_7); load_image(VAR_2, initrd_data); fw_cfg_add_i32(VAR_0, FW_CFG_INITRD_ADDR, initrd_addr); fw_cfg_add_i32(VAR_0, FW_CFG_INITRD_SIZE, VAR_7); fw_cfg_add_bytes(VAR_0, FW_CFG_INITRD_DATA, initrd_data, VAR_7); stl_p(header+0x218, initrd_addr); stl_p(header+0x21c, VAR_7); } VAR_5 = header[0x1f1]; if (VAR_5 == 0) { VAR_5 = 4; } VAR_5 = (VAR_5+1)*512; VAR_6 -= VAR_5; setup = g_malloc(VAR_5); kernel = g_malloc(VAR_6); fseek(f, 0, SEEK_SET); if (fread(setup, 1, VAR_5, f) != VAR_5) { fprintf(stderr, "fread() failed\n"); exit(1); } if (fread(kernel, 1, VAR_6, f) != VAR_6) { fprintf(stderr, "fread() failed\n"); exit(1); } fclose(f); memcpy(setup, header, MIN(sizeof(header), VAR_5)); fw_cfg_add_i32(VAR_0, FW_CFG_KERNEL_ADDR, prot_addr); fw_cfg_add_i32(VAR_0, FW_CFG_KERNEL_SIZE, VAR_6); fw_cfg_add_bytes(VAR_0, FW_CFG_KERNEL_DATA, kernel, VAR_6); fw_cfg_add_i32(VAR_0, FW_CFG_SETUP_ADDR, real_addr); fw_cfg_add_i32(VAR_0, FW_CFG_SETUP_SIZE, VAR_5); fw_cfg_add_bytes(VAR_0, FW_CFG_SETUP_DATA, setup, VAR_5); option_rom[nb_option_roms].name = "linuxboot.bin"; option_rom[nb_option_roms].bootindex = 0; nb_option_roms++; }
[ "static void FUNC_0(FWCfgState *VAR_0,\nconst char *VAR_1,\nconst char *VAR_2,\nconst char *VAR_3,\nhwaddr VAR_4)\n{", "uint16_t protocol;", "int VAR_5, VAR_6, VAR_7 = 0, VAR_8;", "uint32_t initrd_max;", "uint8_t header[8192], *setup, *kernel, *initrd_data;", "hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0;", "FILE *f;", "char *VAR_9;", "VAR_8 = (strlen(VAR_3)+16) & ~15;", "f = fopen(VAR_1, \"rb\");", "if (!f || !(VAR_6 = get_file_size(f)) ||\nfread(header, 1, MIN(ARRAY_SIZE(header), VAR_6), f) !=\nMIN(ARRAY_SIZE(header), VAR_6)) {", "fprintf(stderr, \"qemu: could not load kernel '%s': %s\\n\",\nVAR_1, strerror(errno));", "exit(1);", "}", "#if 0\nfprintf(stderr, \"header magic: %#x\\n\", ldl_p(header+0x202));", "#endif\nif (ldl_p(header+0x202) == 0x53726448) {", "protocol = lduw_p(header+0x206);", "} else {", "if (load_multiboot(VAR_0, f, VAR_1, VAR_2,\nVAR_3, VAR_6, header)) {", "return;", "}", "protocol = 0;", "}", "if (protocol < 0x200 || !(header[0x211] & 0x01)) {", "real_addr = 0x90000;", "cmdline_addr = 0x9a000 - VAR_8;", "prot_addr = 0x10000;", "} else if (protocol < 0x202) {", "real_addr = 0x90000;", "cmdline_addr = 0x9a000 - VAR_8;", "prot_addr = 0x100000;", "} else {", "real_addr = 0x10000;", "cmdline_addr = 0x20000;", "prot_addr = 0x100000;", "}", "#if 0\nfprintf(stderr,\n\"qemu: real_addr = 0x\" TARGET_FMT_plx \"\\n\"\n\"qemu: cmdline_addr = 0x\" TARGET_FMT_plx \"\\n\"\n\"qemu: prot_addr = 0x\" TARGET_FMT_plx \"\\n\",\nreal_addr,\ncmdline_addr,\nprot_addr);", "#endif\nif (protocol >= 0x203) {", "initrd_max = ldl_p(header+0x22c);", "} else {", "initrd_max = 0x37ffffff;", "}", "if (initrd_max >= VAR_4-ACPI_DATA_SIZE)\ninitrd_max = VAR_4-ACPI_DATA_SIZE-1;", "fw_cfg_add_i32(VAR_0, FW_CFG_CMDLINE_ADDR, cmdline_addr);", "fw_cfg_add_i32(VAR_0, FW_CFG_CMDLINE_SIZE, strlen(VAR_3)+1);", "fw_cfg_add_string(VAR_0, FW_CFG_CMDLINE_DATA, VAR_3);", "if (protocol >= 0x202) {", "stl_p(header+0x228, cmdline_addr);", "} else {", "stw_p(header+0x20, 0xA33F);", "stw_p(header+0x22, cmdline_addr-real_addr);", "}", "VAR_9 = strstr(VAR_3, \"vga=\");", "if (VAR_9) {", "unsigned int VAR_10;", "VAR_9 += 4;", "if (!strncmp(VAR_9, \"normal\", 6)) {", "VAR_10 = 0xffff;", "} else if (!strncmp(VAR_9, \"ext\", 3)) {", "VAR_10 = 0xfffe;", "} else if (!strncmp(VAR_9, \"ask\", 3)) {", "VAR_10 = 0xfffd;", "} else {", "VAR_10 = strtol(VAR_9, NULL, 0);", "}", "stw_p(header+0x1fa, VAR_10);", "}", "if (protocol >= 0x200) {", "header[0x210] = 0xB0;", "}", "if (protocol >= 0x201) {", "header[0x211] |= 0x80;", "stw_p(header+0x224, cmdline_addr-real_addr-0x200);", "}", "if (VAR_2) {", "if (protocol < 0x200) {", "fprintf(stderr, \"qemu: linux kernel too old to load a ram disk\\n\");", "exit(1);", "}", "VAR_7 = get_image_size(VAR_2);", "if (VAR_7 < 0) {", "fprintf(stderr, \"qemu: error reading initrd %s: %s\\n\",\nVAR_2, strerror(errno));", "exit(1);", "}", "initrd_addr = (initrd_max-VAR_7) & ~4095;", "initrd_data = g_malloc(VAR_7);", "load_image(VAR_2, initrd_data);", "fw_cfg_add_i32(VAR_0, FW_CFG_INITRD_ADDR, initrd_addr);", "fw_cfg_add_i32(VAR_0, FW_CFG_INITRD_SIZE, VAR_7);", "fw_cfg_add_bytes(VAR_0, FW_CFG_INITRD_DATA, initrd_data, VAR_7);", "stl_p(header+0x218, initrd_addr);", "stl_p(header+0x21c, VAR_7);", "}", "VAR_5 = header[0x1f1];", "if (VAR_5 == 0) {", "VAR_5 = 4;", "}", "VAR_5 = (VAR_5+1)*512;", "VAR_6 -= VAR_5;", "setup = g_malloc(VAR_5);", "kernel = g_malloc(VAR_6);", "fseek(f, 0, SEEK_SET);", "if (fread(setup, 1, VAR_5, f) != VAR_5) {", "fprintf(stderr, \"fread() failed\\n\");", "exit(1);", "}", "if (fread(kernel, 1, VAR_6, f) != VAR_6) {", "fprintf(stderr, \"fread() failed\\n\");", "exit(1);", "}", "fclose(f);", "memcpy(setup, header, MIN(sizeof(header), VAR_5));", "fw_cfg_add_i32(VAR_0, FW_CFG_KERNEL_ADDR, prot_addr);", "fw_cfg_add_i32(VAR_0, FW_CFG_KERNEL_SIZE, VAR_6);", "fw_cfg_add_bytes(VAR_0, FW_CFG_KERNEL_DATA, kernel, VAR_6);", "fw_cfg_add_i32(VAR_0, FW_CFG_SETUP_ADDR, real_addr);", "fw_cfg_add_i32(VAR_0, FW_CFG_SETUP_SIZE, VAR_5);", "fw_cfg_add_bytes(VAR_0, FW_CFG_SETUP_DATA, setup, VAR_5);", "option_rom[nb_option_roms].name = \"linuxboot.bin\";", "option_rom[nb_option_roms].bootindex = 0;", "nb_option_roms++;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 37 ], [ 39, 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123, 125, 127, 129, 131, 133, 135 ], [ 137, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 273 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 343 ], [ 345 ], [ 347 ], [ 351 ], [ 353 ], [ 355 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ] ]
3,030
void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) { SaveStateEntry *se, *new_se; char id[256] = ""; if (dev) { char *path = qdev_get_dev_path(dev); if (path) { pstrcpy(id, sizeof(id), path); pstrcat(id, sizeof(id), "/"); g_free(path); } } pstrcat(id, sizeof(id), idstr); QTAILQ_FOREACH_SAFE(se, &savevm_state.handlers, entry, new_se) { if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { QTAILQ_REMOVE(&savevm_state.handlers, se, entry); if (se->compat) { g_free(se->compat); } g_free(se->ops); g_free(se); } } }
false
qemu
ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374
void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) { SaveStateEntry *se, *new_se; char id[256] = ""; if (dev) { char *path = qdev_get_dev_path(dev); if (path) { pstrcpy(id, sizeof(id), path); pstrcat(id, sizeof(id), "/"); g_free(path); } } pstrcat(id, sizeof(id), idstr); QTAILQ_FOREACH_SAFE(se, &savevm_state.handlers, entry, new_se) { if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { QTAILQ_REMOVE(&savevm_state.handlers, se, entry); if (se->compat) { g_free(se->compat); } g_free(se->ops); g_free(se); } } }
{ "code": [], "line_no": [] }
void FUNC_0(DeviceState *VAR_0, const char *VAR_1, void *VAR_2) { SaveStateEntry *se, *new_se; char VAR_3[256] = ""; if (VAR_0) { char *VAR_4 = qdev_get_dev_path(VAR_0); if (VAR_4) { pstrcpy(VAR_3, sizeof(VAR_3), VAR_4); pstrcat(VAR_3, sizeof(VAR_3), "/"); g_free(VAR_4); } } pstrcat(VAR_3, sizeof(VAR_3), VAR_1); QTAILQ_FOREACH_SAFE(se, &savevm_state.handlers, entry, new_se) { if (strcmp(se->VAR_1, VAR_3) == 0 && se->VAR_2 == VAR_2) { QTAILQ_REMOVE(&savevm_state.handlers, se, entry); if (se->compat) { g_free(se->compat); } g_free(se->ops); g_free(se); } } }
[ "void FUNC_0(DeviceState *VAR_0, const char *VAR_1, void *VAR_2)\n{", "SaveStateEntry *se, *new_se;", "char VAR_3[256] = \"\";", "if (VAR_0) {", "char *VAR_4 = qdev_get_dev_path(VAR_0);", "if (VAR_4) {", "pstrcpy(VAR_3, sizeof(VAR_3), VAR_4);", "pstrcat(VAR_3, sizeof(VAR_3), \"/\");", "g_free(VAR_4);", "}", "}", "pstrcat(VAR_3, sizeof(VAR_3), VAR_1);", "QTAILQ_FOREACH_SAFE(se, &savevm_state.handlers, entry, new_se) {", "if (strcmp(se->VAR_1, VAR_3) == 0 && se->VAR_2 == VAR_2) {", "QTAILQ_REMOVE(&savevm_state.handlers, se, entry);", "if (se->compat) {", "g_free(se->compat);", "}", "g_free(se->ops);", "g_free(se);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
3,031
static int get_cluster_offset(BlockDriverState *bs, VmdkExtent *extent, VmdkMetaData *m_data, uint64_t offset, int allocate, uint64_t *cluster_offset) { unsigned int l1_index, l2_offset, l2_index; int min_index, i, j; uint32_t min_count, *l2_table, tmp = 0; if (m_data) m_data->valid = 0; if (extent->flat) { *cluster_offset = extent->flat_start_offset; return 0; } l1_index = (offset >> 9) / extent->l1_entry_sectors; if (l1_index >= extent->l1_size) { return -1; } l2_offset = extent->l1_table[l1_index]; if (!l2_offset) { return -1; } for (i = 0; i < L2_CACHE_SIZE; i++) { if (l2_offset == extent->l2_cache_offsets[i]) { /* increment the hit count */ if (++extent->l2_cache_counts[i] == 0xffffffff) { for (j = 0; j < L2_CACHE_SIZE; j++) { extent->l2_cache_counts[j] >>= 1; } } l2_table = extent->l2_cache + (i * extent->l2_size); goto found; } } /* not found: load a new entry in the least used one */ min_index = 0; min_count = 0xffffffff; for (i = 0; i < L2_CACHE_SIZE; i++) { if (extent->l2_cache_counts[i] < min_count) { min_count = extent->l2_cache_counts[i]; min_index = i; } } l2_table = extent->l2_cache + (min_index * extent->l2_size); if (bdrv_pread( extent->file, (int64_t)l2_offset * 512, l2_table, extent->l2_size * sizeof(uint32_t) ) != extent->l2_size * sizeof(uint32_t)) { return -1; } extent->l2_cache_offsets[min_index] = l2_offset; extent->l2_cache_counts[min_index] = 1; found: l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size; *cluster_offset = le32_to_cpu(l2_table[l2_index]); if (!*cluster_offset) { if (!allocate) { return -1; } // Avoid the L2 tables update for the images that have snapshots. *cluster_offset = bdrv_getlength(extent->file); bdrv_truncate( extent->file, *cluster_offset + (extent->cluster_sectors << 9) ); *cluster_offset >>= 9; tmp = cpu_to_le32(*cluster_offset); l2_table[l2_index] = tmp; /* First of all we write grain itself, to avoid race condition * that may to corrupt the image. * This problem may occur because of insufficient space on host disk * or inappropriate VM shutdown. */ if (get_whole_cluster( bs, extent, *cluster_offset, offset, allocate) == -1) return -1; if (m_data) { m_data->offset = tmp; m_data->l1_index = l1_index; m_data->l2_index = l2_index; m_data->l2_offset = l2_offset; m_data->valid = 1; } } *cluster_offset <<= 9; return 0; }
false
qemu
ae261c86aaed62e7acddafab8262a2bf286d40b7
static int get_cluster_offset(BlockDriverState *bs, VmdkExtent *extent, VmdkMetaData *m_data, uint64_t offset, int allocate, uint64_t *cluster_offset) { unsigned int l1_index, l2_offset, l2_index; int min_index, i, j; uint32_t min_count, *l2_table, tmp = 0; if (m_data) m_data->valid = 0; if (extent->flat) { *cluster_offset = extent->flat_start_offset; return 0; } l1_index = (offset >> 9) / extent->l1_entry_sectors; if (l1_index >= extent->l1_size) { return -1; } l2_offset = extent->l1_table[l1_index]; if (!l2_offset) { return -1; } for (i = 0; i < L2_CACHE_SIZE; i++) { if (l2_offset == extent->l2_cache_offsets[i]) { if (++extent->l2_cache_counts[i] == 0xffffffff) { for (j = 0; j < L2_CACHE_SIZE; j++) { extent->l2_cache_counts[j] >>= 1; } } l2_table = extent->l2_cache + (i * extent->l2_size); goto found; } } min_index = 0; min_count = 0xffffffff; for (i = 0; i < L2_CACHE_SIZE; i++) { if (extent->l2_cache_counts[i] < min_count) { min_count = extent->l2_cache_counts[i]; min_index = i; } } l2_table = extent->l2_cache + (min_index * extent->l2_size); if (bdrv_pread( extent->file, (int64_t)l2_offset * 512, l2_table, extent->l2_size * sizeof(uint32_t) ) != extent->l2_size * sizeof(uint32_t)) { return -1; } extent->l2_cache_offsets[min_index] = l2_offset; extent->l2_cache_counts[min_index] = 1; found: l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size; *cluster_offset = le32_to_cpu(l2_table[l2_index]); if (!*cluster_offset) { if (!allocate) { return -1; } *cluster_offset = bdrv_getlength(extent->file); bdrv_truncate( extent->file, *cluster_offset + (extent->cluster_sectors << 9) ); *cluster_offset >>= 9; tmp = cpu_to_le32(*cluster_offset); l2_table[l2_index] = tmp; if (get_whole_cluster( bs, extent, *cluster_offset, offset, allocate) == -1) return -1; if (m_data) { m_data->offset = tmp; m_data->l1_index = l1_index; m_data->l2_index = l2_index; m_data->l2_offset = l2_offset; m_data->valid = 1; } } *cluster_offset <<= 9; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, VmdkExtent *VAR_1, VmdkMetaData *VAR_2, uint64_t VAR_3, int VAR_4, uint64_t *VAR_5) { unsigned int VAR_6, VAR_7, VAR_8; int VAR_9, VAR_10, VAR_11; uint32_t min_count, *l2_table, tmp = 0; if (VAR_2) VAR_2->valid = 0; if (VAR_1->flat) { *VAR_5 = VAR_1->flat_start_offset; return 0; } VAR_6 = (VAR_3 >> 9) / VAR_1->l1_entry_sectors; if (VAR_6 >= VAR_1->l1_size) { return -1; } VAR_7 = VAR_1->l1_table[VAR_6]; if (!VAR_7) { return -1; } for (VAR_10 = 0; VAR_10 < L2_CACHE_SIZE; VAR_10++) { if (VAR_7 == VAR_1->l2_cache_offsets[VAR_10]) { if (++VAR_1->l2_cache_counts[VAR_10] == 0xffffffff) { for (VAR_11 = 0; VAR_11 < L2_CACHE_SIZE; VAR_11++) { VAR_1->l2_cache_counts[VAR_11] >>= 1; } } l2_table = VAR_1->l2_cache + (VAR_10 * VAR_1->l2_size); goto found; } } VAR_9 = 0; min_count = 0xffffffff; for (VAR_10 = 0; VAR_10 < L2_CACHE_SIZE; VAR_10++) { if (VAR_1->l2_cache_counts[VAR_10] < min_count) { min_count = VAR_1->l2_cache_counts[VAR_10]; VAR_9 = VAR_10; } } l2_table = VAR_1->l2_cache + (VAR_9 * VAR_1->l2_size); if (bdrv_pread( VAR_1->file, (int64_t)VAR_7 * 512, l2_table, VAR_1->l2_size * sizeof(uint32_t) ) != VAR_1->l2_size * sizeof(uint32_t)) { return -1; } VAR_1->l2_cache_offsets[VAR_9] = VAR_7; VAR_1->l2_cache_counts[VAR_9] = 1; found: VAR_8 = ((VAR_3 >> 9) / VAR_1->cluster_sectors) % VAR_1->l2_size; *VAR_5 = le32_to_cpu(l2_table[VAR_8]); if (!*VAR_5) { if (!VAR_4) { return -1; } *VAR_5 = bdrv_getlength(VAR_1->file); bdrv_truncate( VAR_1->file, *VAR_5 + (VAR_1->cluster_sectors << 9) ); *VAR_5 >>= 9; tmp = cpu_to_le32(*VAR_5); l2_table[VAR_8] = tmp; if (get_whole_cluster( VAR_0, VAR_1, *VAR_5, VAR_3, VAR_4) == -1) return -1; if (VAR_2) { VAR_2->VAR_3 = tmp; VAR_2->VAR_6 = VAR_6; VAR_2->VAR_8 = VAR_8; VAR_2->VAR_7 = VAR_7; VAR_2->valid = 1; } } *VAR_5 <<= 9; return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nVmdkExtent *VAR_1,\nVmdkMetaData *VAR_2,\nuint64_t VAR_3,\nint VAR_4,\nuint64_t *VAR_5)\n{", "unsigned int VAR_6, VAR_7, VAR_8;", "int VAR_9, VAR_10, VAR_11;", "uint32_t min_count, *l2_table, tmp = 0;", "if (VAR_2)\nVAR_2->valid = 0;", "if (VAR_1->flat) {", "*VAR_5 = VAR_1->flat_start_offset;", "return 0;", "}", "VAR_6 = (VAR_3 >> 9) / VAR_1->l1_entry_sectors;", "if (VAR_6 >= VAR_1->l1_size) {", "return -1;", "}", "VAR_7 = VAR_1->l1_table[VAR_6];", "if (!VAR_7) {", "return -1;", "}", "for (VAR_10 = 0; VAR_10 < L2_CACHE_SIZE; VAR_10++) {", "if (VAR_7 == VAR_1->l2_cache_offsets[VAR_10]) {", "if (++VAR_1->l2_cache_counts[VAR_10] == 0xffffffff) {", "for (VAR_11 = 0; VAR_11 < L2_CACHE_SIZE; VAR_11++) {", "VAR_1->l2_cache_counts[VAR_11] >>= 1;", "}", "}", "l2_table = VAR_1->l2_cache + (VAR_10 * VAR_1->l2_size);", "goto found;", "}", "}", "VAR_9 = 0;", "min_count = 0xffffffff;", "for (VAR_10 = 0; VAR_10 < L2_CACHE_SIZE; VAR_10++) {", "if (VAR_1->l2_cache_counts[VAR_10] < min_count) {", "min_count = VAR_1->l2_cache_counts[VAR_10];", "VAR_9 = VAR_10;", "}", "}", "l2_table = VAR_1->l2_cache + (VAR_9 * VAR_1->l2_size);", "if (bdrv_pread(\nVAR_1->file,\n(int64_t)VAR_7 * 512,\nl2_table,\nVAR_1->l2_size * sizeof(uint32_t)\n) != VAR_1->l2_size * sizeof(uint32_t)) {", "return -1;", "}", "VAR_1->l2_cache_offsets[VAR_9] = VAR_7;", "VAR_1->l2_cache_counts[VAR_9] = 1;", "found:\nVAR_8 = ((VAR_3 >> 9) / VAR_1->cluster_sectors) % VAR_1->l2_size;", "*VAR_5 = le32_to_cpu(l2_table[VAR_8]);", "if (!*VAR_5) {", "if (!VAR_4) {", "return -1;", "}", "*VAR_5 = bdrv_getlength(VAR_1->file);", "bdrv_truncate(\nVAR_1->file,\n*VAR_5 + (VAR_1->cluster_sectors << 9)\n);", "*VAR_5 >>= 9;", "tmp = cpu_to_le32(*VAR_5);", "l2_table[VAR_8] = tmp;", "if (get_whole_cluster(\nVAR_0, VAR_1, *VAR_5, VAR_3, VAR_4) == -1)\nreturn -1;", "if (VAR_2) {", "VAR_2->VAR_3 = tmp;", "VAR_2->VAR_6 = VAR_6;", "VAR_2->VAR_8 = VAR_8;", "VAR_2->VAR_7 = VAR_7;", "VAR_2->valid = 1;", "}", "}", "*VAR_5 <<= 9;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99, 101, 103, 105, 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141, 143, 145, 147 ], [ 151 ], [ 153 ], [ 155 ], [ 169, 171, 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ] ]
3,032
static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type, int is_user, uint32_t *phys_ptr, int *prot) { int code; uint32_t table; uint32_t desc; uint32_t xn; int type; int ap; int domain; uint32_t phys_addr; /* Pagetable walk. */ /* Lookup l1 descriptor. */ table = get_level1_table_address(env, address); desc = ldl_phys(table); type = (desc & 3); if (type == 0) { /* Section translation fault. */ code = 5; domain = 0; goto do_fault; } else if (type == 2 && (desc & (1 << 18))) { /* Supersection. */ domain = 0; } else { /* Section or page. */ domain = (desc >> 4) & 0x1e; } domain = (env->cp15.c3 >> domain) & 3; if (domain == 0 || domain == 2) { if (type == 2) code = 9; /* Section domain fault. */ else code = 11; /* Page domain fault. */ goto do_fault; } if (type == 2) { if (desc & (1 << 18)) { /* Supersection. */ phys_addr = (desc & 0xff000000) | (address & 0x00ffffff); } else { /* Section. */ phys_addr = (desc & 0xfff00000) | (address & 0x000fffff); } ap = ((desc >> 10) & 3) | ((desc >> 13) & 4); xn = desc & (1 << 4); code = 13; } else { /* Lookup l2 entry. */ table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc); desc = ldl_phys(table); ap = ((desc >> 4) & 3) | ((desc >> 7) & 4); switch (desc & 3) { case 0: /* Page translation fault. */ code = 7; goto do_fault; case 1: /* 64k page. */ phys_addr = (desc & 0xffff0000) | (address & 0xffff); xn = desc & (1 << 15); break; case 2: case 3: /* 4k page. */ phys_addr = (desc & 0xfffff000) | (address & 0xfff); xn = desc & 1; break; default: /* Never happens, but compiler isn't smart enough to tell. */ abort(); } code = 15; } if (xn && access_type == 2) goto do_fault; /* The simplified model uses AP[0] as an access control bit. */ if ((env->cp15.c1_sys & (1 << 29)) && (ap & 1) == 0) { /* Access flag fault. */ code = (code == 15) ? 6 : 3; goto do_fault; } *prot = check_ap(env, ap, domain, access_type, is_user); if (!*prot) { /* Access permission fault. */ goto do_fault; } *phys_ptr = phys_addr; return 0; do_fault: return code | (domain << 4); }
false
qemu
d4c430a80f000d722bb70287af4d4c184a8d7006
static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type, int is_user, uint32_t *phys_ptr, int *prot) { int code; uint32_t table; uint32_t desc; uint32_t xn; int type; int ap; int domain; uint32_t phys_addr; table = get_level1_table_address(env, address); desc = ldl_phys(table); type = (desc & 3); if (type == 0) { code = 5; domain = 0; goto do_fault; } else if (type == 2 && (desc & (1 << 18))) { domain = 0; } else { domain = (desc >> 4) & 0x1e; } domain = (env->cp15.c3 >> domain) & 3; if (domain == 0 || domain == 2) { if (type == 2) code = 9; else code = 11; goto do_fault; } if (type == 2) { if (desc & (1 << 18)) { phys_addr = (desc & 0xff000000) | (address & 0x00ffffff); } else { phys_addr = (desc & 0xfff00000) | (address & 0x000fffff); } ap = ((desc >> 10) & 3) | ((desc >> 13) & 4); xn = desc & (1 << 4); code = 13; } else { table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc); desc = ldl_phys(table); ap = ((desc >> 4) & 3) | ((desc >> 7) & 4); switch (desc & 3) { case 0: code = 7; goto do_fault; case 1: phys_addr = (desc & 0xffff0000) | (address & 0xffff); xn = desc & (1 << 15); break; case 2: case 3: phys_addr = (desc & 0xfffff000) | (address & 0xfff); xn = desc & 1; break; default: abort(); } code = 15; } if (xn && access_type == 2) goto do_fault; if ((env->cp15.c1_sys & (1 << 29)) && (ap & 1) == 0) { code = (code == 15) ? 6 : 3; goto do_fault; } *prot = check_ap(env, ap, domain, access_type, is_user); if (!*prot) { goto do_fault; } *phys_ptr = phys_addr; return 0; do_fault: return code | (domain << 4); }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState *VAR_0, uint32_t VAR_1, int VAR_2, int VAR_3, uint32_t *VAR_4, int *VAR_5) { int VAR_6; uint32_t table; uint32_t desc; uint32_t xn; int VAR_7; int VAR_8; int VAR_9; uint32_t phys_addr; table = get_level1_table_address(VAR_0, VAR_1); desc = ldl_phys(table); VAR_7 = (desc & 3); if (VAR_7 == 0) { VAR_6 = 5; VAR_9 = 0; goto do_fault; } else if (VAR_7 == 2 && (desc & (1 << 18))) { VAR_9 = 0; } else { VAR_9 = (desc >> 4) & 0x1e; } VAR_9 = (VAR_0->cp15.c3 >> VAR_9) & 3; if (VAR_9 == 0 || VAR_9 == 2) { if (VAR_7 == 2) VAR_6 = 9; else VAR_6 = 11; goto do_fault; } if (VAR_7 == 2) { if (desc & (1 << 18)) { phys_addr = (desc & 0xff000000) | (VAR_1 & 0x00ffffff); } else { phys_addr = (desc & 0xfff00000) | (VAR_1 & 0x000fffff); } VAR_8 = ((desc >> 10) & 3) | ((desc >> 13) & 4); xn = desc & (1 << 4); VAR_6 = 13; } else { table = (desc & 0xfffffc00) | ((VAR_1 >> 10) & 0x3fc); desc = ldl_phys(table); VAR_8 = ((desc >> 4) & 3) | ((desc >> 7) & 4); switch (desc & 3) { case 0: VAR_6 = 7; goto do_fault; case 1: phys_addr = (desc & 0xffff0000) | (VAR_1 & 0xffff); xn = desc & (1 << 15); break; case 2: case 3: phys_addr = (desc & 0xfffff000) | (VAR_1 & 0xfff); xn = desc & 1; break; default: abort(); } VAR_6 = 15; } if (xn && VAR_2 == 2) goto do_fault; if ((VAR_0->cp15.c1_sys & (1 << 29)) && (VAR_8 & 1) == 0) { VAR_6 = (VAR_6 == 15) ? 6 : 3; goto do_fault; } *VAR_5 = check_ap(VAR_0, VAR_8, VAR_9, VAR_2, VAR_3); if (!*VAR_5) { goto do_fault; } *VAR_4 = phys_addr; return 0; do_fault: return VAR_6 | (VAR_9 << 4); }
[ "static int FUNC_0(CPUState *VAR_0, uint32_t VAR_1, int VAR_2,\nint VAR_3, uint32_t *VAR_4, int *VAR_5)\n{", "int VAR_6;", "uint32_t table;", "uint32_t desc;", "uint32_t xn;", "int VAR_7;", "int VAR_8;", "int VAR_9;", "uint32_t phys_addr;", "table = get_level1_table_address(VAR_0, VAR_1);", "desc = ldl_phys(table);", "VAR_7 = (desc & 3);", "if (VAR_7 == 0) {", "VAR_6 = 5;", "VAR_9 = 0;", "goto do_fault;", "} else if (VAR_7 == 2 && (desc & (1 << 18))) {", "VAR_9 = 0;", "} else {", "VAR_9 = (desc >> 4) & 0x1e;", "}", "VAR_9 = (VAR_0->cp15.c3 >> VAR_9) & 3;", "if (VAR_9 == 0 || VAR_9 == 2) {", "if (VAR_7 == 2)\nVAR_6 = 9;", "else\nVAR_6 = 11;", "goto do_fault;", "}", "if (VAR_7 == 2) {", "if (desc & (1 << 18)) {", "phys_addr = (desc & 0xff000000) | (VAR_1 & 0x00ffffff);", "} else {", "phys_addr = (desc & 0xfff00000) | (VAR_1 & 0x000fffff);", "}", "VAR_8 = ((desc >> 10) & 3) | ((desc >> 13) & 4);", "xn = desc & (1 << 4);", "VAR_6 = 13;", "} else {", "table = (desc & 0xfffffc00) | ((VAR_1 >> 10) & 0x3fc);", "desc = ldl_phys(table);", "VAR_8 = ((desc >> 4) & 3) | ((desc >> 7) & 4);", "switch (desc & 3) {", "case 0:\nVAR_6 = 7;", "goto do_fault;", "case 1:\nphys_addr = (desc & 0xffff0000) | (VAR_1 & 0xffff);", "xn = desc & (1 << 15);", "break;", "case 2: case 3:\nphys_addr = (desc & 0xfffff000) | (VAR_1 & 0xfff);", "xn = desc & 1;", "break;", "default:\nabort();", "}", "VAR_6 = 15;", "}", "if (xn && VAR_2 == 2)\ngoto do_fault;", "if ((VAR_0->cp15.c1_sys & (1 << 29)) && (VAR_8 & 1) == 0) {", "VAR_6 = (VAR_6 == 15) ? 6 : 3;", "goto do_fault;", "}", "*VAR_5 = check_ap(VAR_0, VAR_8, VAR_9, VAR_2, VAR_3);", "if (!*VAR_5) {", "goto do_fault;", "}", "*VAR_4 = phys_addr;", "return 0;", "do_fault:\nreturn VAR_6 | (VAR_9 << 4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179 ] ]
3,033
void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap, uint8_t *buf, uint64_t start, uint64_t count, bool finish) { hbitmap_deserialize_part(bitmap->bitmap, buf, start, count, finish); }
false
qemu
86f6ae67e157362f3b141649874213ce01dcc622
void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap, uint8_t *buf, uint64_t start, uint64_t count, bool finish) { hbitmap_deserialize_part(bitmap->bitmap, buf, start, count, finish); }
{ "code": [], "line_no": [] }
void FUNC_0(BdrvDirtyBitmap *VAR_0, uint8_t *VAR_1, uint64_t VAR_2, uint64_t VAR_3, bool VAR_4) { hbitmap_deserialize_part(VAR_0->VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); }
[ "void FUNC_0(BdrvDirtyBitmap *VAR_0,\nuint8_t *VAR_1, uint64_t VAR_2,\nuint64_t VAR_3, bool VAR_4)\n{", "hbitmap_deserialize_part(VAR_0->VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ] ]
3,034
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){ int flags=0; memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; s->codec_type = codec_type; if(codec_type == AVMEDIA_TYPE_AUDIO) flags= AV_OPT_FLAG_AUDIO_PARAM; else if(codec_type == AVMEDIA_TYPE_VIDEO) flags= AV_OPT_FLAG_VIDEO_PARAM; else if(codec_type == AVMEDIA_TYPE_SUBTITLE) flags= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(s, flags, flags); s->time_base= (AVRational){0,1}; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; s->execute2= avcodec_default_execute2; s->sample_aspect_ratio= (AVRational){0,1}; s->pix_fmt= PIX_FMT_NONE; s->sample_fmt= AV_SAMPLE_FMT_NONE; s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; s->reordered_opaque= AV_NOPTS_VALUE; }
false
FFmpeg
79eff9132581af69fbbd2674337b75fad29aa306
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){ int flags=0; memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; s->codec_type = codec_type; if(codec_type == AVMEDIA_TYPE_AUDIO) flags= AV_OPT_FLAG_AUDIO_PARAM; else if(codec_type == AVMEDIA_TYPE_VIDEO) flags= AV_OPT_FLAG_VIDEO_PARAM; else if(codec_type == AVMEDIA_TYPE_SUBTITLE) flags= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(s, flags, flags); s->time_base= (AVRational){0,1}; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; s->execute2= avcodec_default_execute2; s->sample_aspect_ratio= (AVRational){0,1}; s->pix_fmt= PIX_FMT_NONE; s->sample_fmt= AV_SAMPLE_FMT_NONE; s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; s->reordered_opaque= AV_NOPTS_VALUE; }
{ "code": [], "line_no": [] }
void FUNC_0(AVCodecContext *VAR_0, enum AVMediaType VAR_1){ int VAR_2=0; memset(VAR_0, 0, sizeof(AVCodecContext)); VAR_0->av_class= &av_codec_context_class; VAR_0->VAR_1 = VAR_1; if(VAR_1 == AVMEDIA_TYPE_AUDIO) VAR_2= AV_OPT_FLAG_AUDIO_PARAM; else if(VAR_1 == AVMEDIA_TYPE_VIDEO) VAR_2= AV_OPT_FLAG_VIDEO_PARAM; else if(VAR_1 == AVMEDIA_TYPE_SUBTITLE) VAR_2= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(VAR_0, VAR_2, VAR_2); VAR_0->time_base= (AVRational){0,1}; VAR_0->get_buffer= avcodec_default_get_buffer; VAR_0->release_buffer= avcodec_default_release_buffer; VAR_0->get_format= avcodec_default_get_format; VAR_0->execute= avcodec_default_execute; VAR_0->execute2= avcodec_default_execute2; VAR_0->sample_aspect_ratio= (AVRational){0,1}; VAR_0->pix_fmt= PIX_FMT_NONE; VAR_0->sample_fmt= AV_SAMPLE_FMT_NONE; VAR_0->palctrl = NULL; VAR_0->reget_buffer= avcodec_default_reget_buffer; VAR_0->reordered_opaque= AV_NOPTS_VALUE; }
[ "void FUNC_0(AVCodecContext *VAR_0, enum AVMediaType VAR_1){", "int VAR_2=0;", "memset(VAR_0, 0, sizeof(AVCodecContext));", "VAR_0->av_class= &av_codec_context_class;", "VAR_0->VAR_1 = VAR_1;", "if(VAR_1 == AVMEDIA_TYPE_AUDIO)\nVAR_2= AV_OPT_FLAG_AUDIO_PARAM;", "else if(VAR_1 == AVMEDIA_TYPE_VIDEO)\nVAR_2= AV_OPT_FLAG_VIDEO_PARAM;", "else if(VAR_1 == AVMEDIA_TYPE_SUBTITLE)\nVAR_2= AV_OPT_FLAG_SUBTITLE_PARAM;", "av_opt_set_defaults2(VAR_0, VAR_2, VAR_2);", "VAR_0->time_base= (AVRational){0,1};", "VAR_0->get_buffer= avcodec_default_get_buffer;", "VAR_0->release_buffer= avcodec_default_release_buffer;", "VAR_0->get_format= avcodec_default_get_format;", "VAR_0->execute= avcodec_default_execute;", "VAR_0->execute2= avcodec_default_execute2;", "VAR_0->sample_aspect_ratio= (AVRational){0,1};", "VAR_0->pix_fmt= PIX_FMT_NONE;", "VAR_0->sample_fmt= AV_SAMPLE_FMT_NONE;", "VAR_0->palctrl = NULL;", "VAR_0->reget_buffer= avcodec_default_reget_buffer;", "VAR_0->reordered_opaque= AV_NOPTS_VALUE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
3,035
static bool qemu_gluster_test_seek(struct glfs_fd *fd) { off_t ret, eof; eof = glfs_lseek(fd, 0, SEEK_END); if (eof < 0) { /* this should never occur */ return false; } /* this should always fail with ENXIO if SEEK_DATA is supported */ ret = glfs_lseek(fd, eof, SEEK_DATA); return (ret < 0) && (errno == ENXIO); }
false
qemu
d9b789745b88df367674e45c55df29e9c7de8d8a
static bool qemu_gluster_test_seek(struct glfs_fd *fd) { off_t ret, eof; eof = glfs_lseek(fd, 0, SEEK_END); if (eof < 0) { return false; } ret = glfs_lseek(fd, eof, SEEK_DATA); return (ret < 0) && (errno == ENXIO); }
{ "code": [], "line_no": [] }
static bool FUNC_0(struct glfs_fd *fd) { off_t ret, eof; eof = glfs_lseek(fd, 0, SEEK_END); if (eof < 0) { return false; } ret = glfs_lseek(fd, eof, SEEK_DATA); return (ret < 0) && (errno == ENXIO); }
[ "static bool FUNC_0(struct glfs_fd *fd)\n{", "off_t ret, eof;", "eof = glfs_lseek(fd, 0, SEEK_END);", "if (eof < 0) {", "return false;", "}", "ret = glfs_lseek(fd, eof, SEEK_DATA);", "return (ret < 0) && (errno == ENXIO);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ] ]
3,036
static unsigned int dec10_quick_imm(DisasContext *dc) { int32_t imm, simm; int op; /* sign extend. */ imm = dc->ir & ((1 << 6) - 1); simm = (int8_t) (imm << 2); simm >>= 2; switch (dc->opcode) { case CRISV10_QIMM_BDAP_R0: case CRISV10_QIMM_BDAP_R1: case CRISV10_QIMM_BDAP_R2: case CRISV10_QIMM_BDAP_R3: simm = (int8_t)dc->ir; LOG_DIS("bdap %d $r%d\n", simm, dc->dst); LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n", dc->pc, dc->mode, dc->opcode, dc->src, dc->dst); cris_set_prefix(dc); if (dc->dst == 15) { tcg_gen_movi_tl(cpu_PR[PR_PREFIX], dc->pc + 2 + simm); } else { tcg_gen_addi_tl(cpu_PR[PR_PREFIX], cpu_R[dc->dst], simm); } break; case CRISV10_QIMM_MOVEQ: LOG_DIS("moveq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_MOVE, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_CMPQ: LOG_DIS("cmpq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_CMP, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_ADDQ: LOG_DIS("addq %d, $r%d\n", imm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_ADD, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_ANDQ: LOG_DIS("andq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_AND, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_ASHQ: LOG_DIS("ashq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); op = imm & (1 << 5); imm &= 0x1f; if (op) { cris_alu(dc, CC_OP_ASR, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); } else { /* BTST */ cris_update_cc_op(dc, CC_OP_FLAGS, 4); gen_helper_btst(cpu_PR[PR_CCS], cpu_R[dc->dst], tcg_const_tl(imm), cpu_PR[PR_CCS]); } break; case CRISV10_QIMM_LSHQ: LOG_DIS("lshq %d, $r%d\n", simm, dc->dst); op = CC_OP_LSL; if (imm & (1 << 5)) { op = CC_OP_LSR; } imm &= 0x1f; cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, op, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_SUBQ: LOG_DIS("subq %d, $r%d\n", imm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_SUB, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_ORQ: LOG_DIS("andq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_OR, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_BCC_R0: if (!dc->ir) { cpu_abort(dc->env, "opcode zero\n"); } case CRISV10_QIMM_BCC_R1: case CRISV10_QIMM_BCC_R2: case CRISV10_QIMM_BCC_R3: imm = dc->ir & 0xff; /* bit 0 is a sign bit. */ if (imm & 1) { imm |= 0xffffff00; /* sign extend. */ imm &= ~1; /* get rid of the sign bit. */ } imm += 2; LOG_DIS("b%s %d\n", cc_name(dc->cond), imm); cris_cc_mask(dc, 0); cris_prepare_cc_branch(dc, imm, dc->cond); break; default: LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n", dc->pc, dc->mode, dc->opcode, dc->src, dc->dst); cpu_abort(dc->env, "Unhandled quickimm\n"); break; } return 2; }
false
qemu
3ab20e206ce74299e836bfec5ec27b7f261826be
static unsigned int dec10_quick_imm(DisasContext *dc) { int32_t imm, simm; int op; imm = dc->ir & ((1 << 6) - 1); simm = (int8_t) (imm << 2); simm >>= 2; switch (dc->opcode) { case CRISV10_QIMM_BDAP_R0: case CRISV10_QIMM_BDAP_R1: case CRISV10_QIMM_BDAP_R2: case CRISV10_QIMM_BDAP_R3: simm = (int8_t)dc->ir; LOG_DIS("bdap %d $r%d\n", simm, dc->dst); LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n", dc->pc, dc->mode, dc->opcode, dc->src, dc->dst); cris_set_prefix(dc); if (dc->dst == 15) { tcg_gen_movi_tl(cpu_PR[PR_PREFIX], dc->pc + 2 + simm); } else { tcg_gen_addi_tl(cpu_PR[PR_PREFIX], cpu_R[dc->dst], simm); } break; case CRISV10_QIMM_MOVEQ: LOG_DIS("moveq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_MOVE, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_CMPQ: LOG_DIS("cmpq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_CMP, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_ADDQ: LOG_DIS("addq %d, $r%d\n", imm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_ADD, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_ANDQ: LOG_DIS("andq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_AND, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_ASHQ: LOG_DIS("ashq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); op = imm & (1 << 5); imm &= 0x1f; if (op) { cris_alu(dc, CC_OP_ASR, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); } else { cris_update_cc_op(dc, CC_OP_FLAGS, 4); gen_helper_btst(cpu_PR[PR_CCS], cpu_R[dc->dst], tcg_const_tl(imm), cpu_PR[PR_CCS]); } break; case CRISV10_QIMM_LSHQ: LOG_DIS("lshq %d, $r%d\n", simm, dc->dst); op = CC_OP_LSL; if (imm & (1 << 5)) { op = CC_OP_LSR; } imm &= 0x1f; cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, op, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_SUBQ: LOG_DIS("subq %d, $r%d\n", imm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_SUB, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_ORQ: LOG_DIS("andq %d, $r%d\n", simm, dc->dst); cris_cc_mask(dc, CC_MASK_NZVC); cris_alu(dc, CC_OP_OR, cpu_R[dc->dst], cpu_R[dc->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_BCC_R0: if (!dc->ir) { cpu_abort(dc->env, "opcode zero\n"); } case CRISV10_QIMM_BCC_R1: case CRISV10_QIMM_BCC_R2: case CRISV10_QIMM_BCC_R3: imm = dc->ir & 0xff; if (imm & 1) { imm |= 0xffffff00; imm &= ~1; } imm += 2; LOG_DIS("b%s %d\n", cc_name(dc->cond), imm); cris_cc_mask(dc, 0); cris_prepare_cc_branch(dc, imm, dc->cond); break; default: LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n", dc->pc, dc->mode, dc->opcode, dc->src, dc->dst); cpu_abort(dc->env, "Unhandled quickimm\n"); break; } return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { int32_t imm, simm; int VAR_1; imm = VAR_0->ir & ((1 << 6) - 1); simm = (int8_t) (imm << 2); simm >>= 2; switch (VAR_0->opcode) { case CRISV10_QIMM_BDAP_R0: case CRISV10_QIMM_BDAP_R1: case CRISV10_QIMM_BDAP_R2: case CRISV10_QIMM_BDAP_R3: simm = (int8_t)VAR_0->ir; LOG_DIS("bdap %d $r%d\n", simm, VAR_0->dst); LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n", VAR_0->pc, VAR_0->mode, VAR_0->opcode, VAR_0->src, VAR_0->dst); cris_set_prefix(VAR_0); if (VAR_0->dst == 15) { tcg_gen_movi_tl(cpu_PR[PR_PREFIX], VAR_0->pc + 2 + simm); } else { tcg_gen_addi_tl(cpu_PR[PR_PREFIX], cpu_R[VAR_0->dst], simm); } break; case CRISV10_QIMM_MOVEQ: LOG_DIS("moveq %d, $r%d\n", simm, VAR_0->dst); cris_cc_mask(VAR_0, CC_MASK_NZVC); cris_alu(VAR_0, CC_OP_MOVE, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_CMPQ: LOG_DIS("cmpq %d, $r%d\n", simm, VAR_0->dst); cris_cc_mask(VAR_0, CC_MASK_NZVC); cris_alu(VAR_0, CC_OP_CMP, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_ADDQ: LOG_DIS("addq %d, $r%d\n", imm, VAR_0->dst); cris_cc_mask(VAR_0, CC_MASK_NZVC); cris_alu(VAR_0, CC_OP_ADD, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_ANDQ: LOG_DIS("andq %d, $r%d\n", simm, VAR_0->dst); cris_cc_mask(VAR_0, CC_MASK_NZVC); cris_alu(VAR_0, CC_OP_AND, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_ASHQ: LOG_DIS("ashq %d, $r%d\n", simm, VAR_0->dst); cris_cc_mask(VAR_0, CC_MASK_NZVC); VAR_1 = imm & (1 << 5); imm &= 0x1f; if (VAR_1) { cris_alu(VAR_0, CC_OP_ASR, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(imm), 4); } else { cris_update_cc_op(VAR_0, CC_OP_FLAGS, 4); gen_helper_btst(cpu_PR[PR_CCS], cpu_R[VAR_0->dst], tcg_const_tl(imm), cpu_PR[PR_CCS]); } break; case CRISV10_QIMM_LSHQ: LOG_DIS("lshq %d, $r%d\n", simm, VAR_0->dst); VAR_1 = CC_OP_LSL; if (imm & (1 << 5)) { VAR_1 = CC_OP_LSR; } imm &= 0x1f; cris_cc_mask(VAR_0, CC_MASK_NZVC); cris_alu(VAR_0, VAR_1, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_SUBQ: LOG_DIS("subq %d, $r%d\n", imm, VAR_0->dst); cris_cc_mask(VAR_0, CC_MASK_NZVC); cris_alu(VAR_0, CC_OP_SUB, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(imm), 4); break; case CRISV10_QIMM_ORQ: LOG_DIS("andq %d, $r%d\n", simm, VAR_0->dst); cris_cc_mask(VAR_0, CC_MASK_NZVC); cris_alu(VAR_0, CC_OP_OR, cpu_R[VAR_0->dst], cpu_R[VAR_0->dst], tcg_const_tl(simm), 4); break; case CRISV10_QIMM_BCC_R0: if (!VAR_0->ir) { cpu_abort(VAR_0->env, "opcode zero\n"); } case CRISV10_QIMM_BCC_R1: case CRISV10_QIMM_BCC_R2: case CRISV10_QIMM_BCC_R3: imm = VAR_0->ir & 0xff; if (imm & 1) { imm |= 0xffffff00; imm &= ~1; } imm += 2; LOG_DIS("b%s %d\n", cc_name(VAR_0->cond), imm); cris_cc_mask(VAR_0, 0); cris_prepare_cc_branch(VAR_0, imm, VAR_0->cond); break; default: LOG_DIS("pc=%x mode=%x quickimm %d r%d r%d\n", VAR_0->pc, VAR_0->mode, VAR_0->opcode, VAR_0->src, VAR_0->dst); cpu_abort(VAR_0->env, "Unhandled quickimm\n"); break; } return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "int32_t imm, simm;", "int VAR_1;", "imm = VAR_0->ir & ((1 << 6) - 1);", "simm = (int8_t) (imm << 2);", "simm >>= 2;", "switch (VAR_0->opcode) {", "case CRISV10_QIMM_BDAP_R0:\ncase CRISV10_QIMM_BDAP_R1:\ncase CRISV10_QIMM_BDAP_R2:\ncase CRISV10_QIMM_BDAP_R3:\nsimm = (int8_t)VAR_0->ir;", "LOG_DIS(\"bdap %d $r%d\\n\", simm, VAR_0->dst);", "LOG_DIS(\"pc=%x mode=%x quickimm %d r%d r%d\\n\",\nVAR_0->pc, VAR_0->mode, VAR_0->opcode, VAR_0->src, VAR_0->dst);", "cris_set_prefix(VAR_0);", "if (VAR_0->dst == 15) {", "tcg_gen_movi_tl(cpu_PR[PR_PREFIX], VAR_0->pc + 2 + simm);", "} else {", "tcg_gen_addi_tl(cpu_PR[PR_PREFIX], cpu_R[VAR_0->dst], simm);", "}", "break;", "case CRISV10_QIMM_MOVEQ:\nLOG_DIS(\"moveq %d, $r%d\\n\", simm, VAR_0->dst);", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "cris_alu(VAR_0, CC_OP_MOVE, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(simm), 4);", "break;", "case CRISV10_QIMM_CMPQ:\nLOG_DIS(\"cmpq %d, $r%d\\n\", simm, VAR_0->dst);", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "cris_alu(VAR_0, CC_OP_CMP, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(simm), 4);", "break;", "case CRISV10_QIMM_ADDQ:\nLOG_DIS(\"addq %d, $r%d\\n\", imm, VAR_0->dst);", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "cris_alu(VAR_0, CC_OP_ADD, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(imm), 4);", "break;", "case CRISV10_QIMM_ANDQ:\nLOG_DIS(\"andq %d, $r%d\\n\", simm, VAR_0->dst);", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "cris_alu(VAR_0, CC_OP_AND, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(simm), 4);", "break;", "case CRISV10_QIMM_ASHQ:\nLOG_DIS(\"ashq %d, $r%d\\n\", simm, VAR_0->dst);", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "VAR_1 = imm & (1 << 5);", "imm &= 0x1f;", "if (VAR_1) {", "cris_alu(VAR_0, CC_OP_ASR, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(imm), 4);", "} else {", "cris_update_cc_op(VAR_0, CC_OP_FLAGS, 4);", "gen_helper_btst(cpu_PR[PR_CCS], cpu_R[VAR_0->dst],\ntcg_const_tl(imm), cpu_PR[PR_CCS]);", "}", "break;", "case CRISV10_QIMM_LSHQ:\nLOG_DIS(\"lshq %d, $r%d\\n\", simm, VAR_0->dst);", "VAR_1 = CC_OP_LSL;", "if (imm & (1 << 5)) {", "VAR_1 = CC_OP_LSR;", "}", "imm &= 0x1f;", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "cris_alu(VAR_0, VAR_1, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(imm), 4);", "break;", "case CRISV10_QIMM_SUBQ:\nLOG_DIS(\"subq %d, $r%d\\n\", imm, VAR_0->dst);", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "cris_alu(VAR_0, CC_OP_SUB, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(imm), 4);", "break;", "case CRISV10_QIMM_ORQ:\nLOG_DIS(\"andq %d, $r%d\\n\", simm, VAR_0->dst);", "cris_cc_mask(VAR_0, CC_MASK_NZVC);", "cris_alu(VAR_0, CC_OP_OR, cpu_R[VAR_0->dst],\ncpu_R[VAR_0->dst], tcg_const_tl(simm), 4);", "break;", "case CRISV10_QIMM_BCC_R0:\nif (!VAR_0->ir) {", "cpu_abort(VAR_0->env, \"opcode zero\\n\");", "}", "case CRISV10_QIMM_BCC_R1:\ncase CRISV10_QIMM_BCC_R2:\ncase CRISV10_QIMM_BCC_R3:\nimm = VAR_0->ir & 0xff;", "if (imm & 1) {", "imm |= 0xffffff00;", "imm &= ~1;", "}", "imm += 2;", "LOG_DIS(\"b%s %d\\n\", cc_name(VAR_0->cond), imm);", "cris_cc_mask(VAR_0, 0);", "cris_prepare_cc_branch(VAR_0, imm, VAR_0->cond);", "break;", "default:\nLOG_DIS(\"pc=%x mode=%x quickimm %d r%d r%d\\n\",\nVAR_0->pc, VAR_0->mode, VAR_0->opcode, VAR_0->src, VAR_0->dst);", "cpu_abort(VAR_0->env, \"Unhandled quickimm\\n\");", "break;", "}", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23, 25, 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179, 181 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203, 205, 207, 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 235, 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ] ]
3,037
PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) { PXA2xxState *s; int iomemtype, i; DriveInfo *dinfo; s = (PXA2xxState *) qemu_mallocz(sizeof(PXA2xxState)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } if (!revision) revision = "pxa270"; s->env = cpu_init(revision); if (!s->env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0]; /* SDRAM & Internal Memory Storage */ cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(NULL, "pxa270.sdram", sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(NULL, "pxa270.internal", 0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = pxa2xx_mmci_init(0x41100000, dinfo->bdrv, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa270_serial[i].io_base; i ++) if (serial_hds[i]) #ifdef TARGET_WORDS_BIGENDIAN serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], 14857000/16, serial_hds[i], 1, 1); #else serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], 14857000/16, serial_hds[i], 1, 0); #endif else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD]); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 2] = 0x02000210; /* 416.0 MHz */ s->clkcfg = 0x00000009; /* Turbo mode active */ iomemtype = cpu_register_io_memory(pxa2xx_cm_readfn, pxa2xx_cm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->cm_base, 0x1000, iomemtype); register_savevm(NULL, "pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; /* Two PC Card sockets */ iomemtype = cpu_register_io_memory(pxa2xx_mm_readfn, pxa2xx_mm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->mm_base, 0x1000, iomemtype); register_savevm(NULL, "pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(pxa2xx_pm_readfn, pxa2xx_pm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->pm_base, 0x100, iomemtype); register_savevm(NULL, "pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (SSIBus **)qemu_mallocz(sizeof(SSIBus *) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { DeviceState *dev; dev = sysbus_create_simple("pxa2xx-ssp", pxa27x_ssp[i].io_base, s->pic[pxa27x_ssp[i].irqn]); s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } if (usb_enabled) { sysbus_create_simple("sysbus-ohci", 0x4c000000, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->rtc_base, 0x1000, iomemtype); pxa2xx_rtc_init(s); register_savevm(NULL, "pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); s->kp = pxa27x_keypad_init(0x41500000, s->pic[PXA2XX_PIC_KEYPAD]); /* GPIO1 resets the processor */ /* The handler can be overridden by board-specific code */ qdev_connect_gpio_out(s->gpio, 1, s->reset); return s; }
false
qemu
e1f8c729fa890c67bb4532f22c22ace6fb0e1aaf
PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) { PXA2xxState *s; int iomemtype, i; DriveInfo *dinfo; s = (PXA2xxState *) qemu_mallocz(sizeof(PXA2xxState)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } if (!revision) revision = "pxa270"; s->env = cpu_init(revision); if (!s->env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0]; cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(NULL, "pxa270.sdram", sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(NULL, "pxa270.internal", 0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = pxa2xx_mmci_init(0x41100000, dinfo->bdrv, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa270_serial[i].io_base; i ++) if (serial_hds[i]) #ifdef TARGET_WORDS_BIGENDIAN serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], 14857000/16, serial_hds[i], 1, 1); #else serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], 14857000/16, serial_hds[i], 1, 0); #endif else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD]); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 2] = 0x02000210; s->clkcfg = 0x00000009; iomemtype = cpu_register_io_memory(pxa2xx_cm_readfn, pxa2xx_cm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->cm_base, 0x1000, iomemtype); register_savevm(NULL, "pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; iomemtype = cpu_register_io_memory(pxa2xx_mm_readfn, pxa2xx_mm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->mm_base, 0x1000, iomemtype); register_savevm(NULL, "pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(pxa2xx_pm_readfn, pxa2xx_pm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->pm_base, 0x100, iomemtype); register_savevm(NULL, "pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (SSIBus **)qemu_mallocz(sizeof(SSIBus *) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { DeviceState *dev; dev = sysbus_create_simple("pxa2xx-ssp", pxa27x_ssp[i].io_base, s->pic[pxa27x_ssp[i].irqn]); s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } if (usb_enabled) { sysbus_create_simple("sysbus-ohci", 0x4c000000, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->rtc_base, 0x1000, iomemtype); pxa2xx_rtc_init(s); register_savevm(NULL, "pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); s->kp = pxa27x_keypad_init(0x41500000, s->pic[PXA2XX_PIC_KEYPAD]); qdev_connect_gpio_out(s->gpio, 1, s->reset); return s; }
{ "code": [], "line_no": [] }
PXA2xxState *FUNC_0(unsigned int sdram_size, const char *revision) { PXA2xxState *s; int VAR_0, VAR_1; DriveInfo *dinfo; s = (PXA2xxState *) qemu_mallocz(sizeof(PXA2xxState)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } if (!revision) revision = "pxa270"; s->env = cpu_init(revision); if (!s->env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0]; cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(NULL, "pxa270.sdram", sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(NULL, "pxa270.internal", 0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = pxa2xx_mmci_init(0x41100000, dinfo->bdrv, s->pic[PXA2XX_PIC_MMC], s->dma); for (VAR_1 = 0; pxa270_serial[VAR_1].io_base; VAR_1 ++) if (serial_hds[VAR_1]) #ifdef TARGET_WORDS_BIGENDIAN serial_mm_init(pxa270_serial[VAR_1].io_base, 2, s->pic[pxa270_serial[VAR_1].irqn], 14857000/16, serial_hds[VAR_1], 1, 1); #else serial_mm_init(pxa270_serial[VAR_1].io_base, 2, s->pic[pxa270_serial[VAR_1].irqn], 14857000/16, serial_hds[VAR_1], 1, 0); #endif else break; if (serial_hds[VAR_1]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[VAR_1]); s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD]); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 2] = 0x02000210; s->clkcfg = 0x00000009; VAR_0 = cpu_register_io_memory(pxa2xx_cm_readfn, pxa2xx_cm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->cm_base, 0x1000, VAR_0); register_savevm(NULL, "pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; VAR_0 = cpu_register_io_memory(pxa2xx_mm_readfn, pxa2xx_mm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->mm_base, 0x1000, VAR_0); register_savevm(NULL, "pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base = 0x40f00000; VAR_0 = cpu_register_io_memory(pxa2xx_pm_readfn, pxa2xx_pm_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->pm_base, 0x100, VAR_0); register_savevm(NULL, "pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); for (VAR_1 = 0; pxa27x_ssp[VAR_1].io_base; VAR_1 ++); s->ssp = (SSIBus **)qemu_mallocz(sizeof(SSIBus *) * VAR_1); for (VAR_1 = 0; pxa27x_ssp[VAR_1].io_base; VAR_1 ++) { DeviceState *dev; dev = sysbus_create_simple("pxa2xx-ssp", pxa27x_ssp[VAR_1].io_base, s->pic[pxa27x_ssp[VAR_1].irqn]); s->ssp[VAR_1] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } if (usb_enabled) { sysbus_create_simple("sysbus-ohci", 0x4c000000, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; VAR_0 = cpu_register_io_memory(pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(s->rtc_base, 0x1000, VAR_0); pxa2xx_rtc_init(s); register_savevm(NULL, "pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); s->kp = pxa27x_keypad_init(0x41500000, s->pic[PXA2XX_PIC_KEYPAD]); qdev_connect_gpio_out(s->gpio, 1, s->reset); return s; }
[ "PXA2xxState *FUNC_0(unsigned int sdram_size, const char *revision)\n{", "PXA2xxState *s;", "int VAR_0, VAR_1;", "DriveInfo *dinfo;", "s = (PXA2xxState *) qemu_mallocz(sizeof(PXA2xxState));", "if (revision && strncmp(revision, \"pxa27\", 5)) {", "fprintf(stderr, \"Machine requires a PXA27x processor.\\n\");", "exit(1);", "}", "if (!revision)\nrevision = \"pxa270\";", "s->env = cpu_init(revision);", "if (!s->env) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0];", "cpu_register_physical_memory(PXA2XX_SDRAM_BASE,\nsdram_size, qemu_ram_alloc(NULL, \"pxa270.sdram\",\nsdram_size) | IO_MEM_RAM);", "cpu_register_physical_memory(PXA2XX_INTERNAL_BASE,\n0x40000, qemu_ram_alloc(NULL, \"pxa270.internal\",\n0x40000) | IO_MEM_RAM);", "s->pic = pxa2xx_pic_init(0x40d00000, s->env);", "s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]);", "pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0],\ns->pic[PXA27X_PIC_OST_4_11]);", "s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121);", "dinfo = drive_get(IF_SD, 0, 0);", "if (!dinfo) {", "fprintf(stderr, \"qemu: missing SecureDigital device\\n\");", "exit(1);", "}", "s->mmc = pxa2xx_mmci_init(0x41100000, dinfo->bdrv,\ns->pic[PXA2XX_PIC_MMC], s->dma);", "for (VAR_1 = 0; pxa270_serial[VAR_1].io_base; VAR_1 ++)", "if (serial_hds[VAR_1])\n#ifdef TARGET_WORDS_BIGENDIAN\nserial_mm_init(pxa270_serial[VAR_1].io_base, 2,\ns->pic[pxa270_serial[VAR_1].irqn], 14857000/16,\nserial_hds[VAR_1], 1, 1);", "#else\nserial_mm_init(pxa270_serial[VAR_1].io_base, 2,\ns->pic[pxa270_serial[VAR_1].irqn], 14857000/16,\nserial_hds[VAR_1], 1, 0);", "#endif\nelse\nbreak;", "if (serial_hds[VAR_1])\ns->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP],\ns->dma, serial_hds[VAR_1]);", "s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD]);", "s->cm_base = 0x41300000;", "s->cm_regs[CCCR >> 2] = 0x02000210;", "s->clkcfg = 0x00000009;", "VAR_0 = cpu_register_io_memory(pxa2xx_cm_readfn,\npxa2xx_cm_writefn, s, DEVICE_NATIVE_ENDIAN);", "cpu_register_physical_memory(s->cm_base, 0x1000, VAR_0);", "register_savevm(NULL, \"pxa2xx_cm\", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s);", "cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s);", "s->mm_base = 0x48000000;", "s->mm_regs[MDMRS >> 2] = 0x00020002;", "s->mm_regs[MDREFR >> 2] = 0x03ca4000;", "s->mm_regs[MECR >> 2] = 0x00000001;", "VAR_0 = cpu_register_io_memory(pxa2xx_mm_readfn,\npxa2xx_mm_writefn, s, DEVICE_NATIVE_ENDIAN);", "cpu_register_physical_memory(s->mm_base, 0x1000, VAR_0);", "register_savevm(NULL, \"pxa2xx_mm\", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s);", "s->pm_base = 0x40f00000;", "VAR_0 = cpu_register_io_memory(pxa2xx_pm_readfn,\npxa2xx_pm_writefn, s, DEVICE_NATIVE_ENDIAN);", "cpu_register_physical_memory(s->pm_base, 0x100, VAR_0);", "register_savevm(NULL, \"pxa2xx_pm\", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s);", "for (VAR_1 = 0; pxa27x_ssp[VAR_1].io_base; VAR_1 ++);", "s->ssp = (SSIBus **)qemu_mallocz(sizeof(SSIBus *) * VAR_1);", "for (VAR_1 = 0; pxa27x_ssp[VAR_1].io_base; VAR_1 ++) {", "DeviceState *dev;", "dev = sysbus_create_simple(\"pxa2xx-ssp\", pxa27x_ssp[VAR_1].io_base,\ns->pic[pxa27x_ssp[VAR_1].irqn]);", "s->ssp[VAR_1] = (SSIBus *)qdev_get_child_bus(dev, \"ssi\");", "}", "if (usb_enabled) {", "sysbus_create_simple(\"sysbus-ohci\", 0x4c000000,\ns->pic[PXA2XX_PIC_USBH1]);", "}", "s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);", "s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);", "s->rtc_base = 0x40900000;", "VAR_0 = cpu_register_io_memory(pxa2xx_rtc_readfn,\npxa2xx_rtc_writefn, s, DEVICE_NATIVE_ENDIAN);", "cpu_register_physical_memory(s->rtc_base, 0x1000, VAR_0);", "pxa2xx_rtc_init(s);", "register_savevm(NULL, \"pxa2xx_rtc\", 0, 0, pxa2xx_rtc_save,\npxa2xx_rtc_load, s);", "s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff);", "s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff);", "s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma);", "s->kp = pxa27x_keypad_init(0x41500000, s->pic[PXA2XX_PIC_KEYPAD]);", "qdev_connect_gpio_out(s->gpio, 1, s->reset);", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47, 49 ], [ 51, 53, 55 ], [ 59 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 93 ], [ 95, 97, 99, 101, 103 ], [ 105, 107, 109, 111 ], [ 113, 115, 117 ], [ 119, 121, 123 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 209 ], [ 211 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 231 ], [ 233 ], [ 237 ], [ 241 ], [ 249 ], [ 251 ], [ 253 ] ]
3,038
static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info, const char *name) { QEMUSnapshotInfo *sn_tab, *sn; int nb_sns, i, ret; ret = -ENOENT; nb_sns = bdrv_snapshot_list(bs, &sn_tab); if (nb_sns < 0) return ret; for(i = 0; i < nb_sns; i++) { sn = &sn_tab[i]; if (!strcmp(sn->id_str, name) || !strcmp(sn->name, name)) { *sn_info = *sn; ret = 0; break; } } g_free(sn_tab); return ret; }
false
qemu
de08c606f9ddafe647b6843e2b10a6d6030b0fc0
static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info, const char *name) { QEMUSnapshotInfo *sn_tab, *sn; int nb_sns, i, ret; ret = -ENOENT; nb_sns = bdrv_snapshot_list(bs, &sn_tab); if (nb_sns < 0) return ret; for(i = 0; i < nb_sns; i++) { sn = &sn_tab[i]; if (!strcmp(sn->id_str, name) || !strcmp(sn->name, name)) { *sn_info = *sn; ret = 0; break; } } g_free(sn_tab); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QEMUSnapshotInfo *VAR_1, const char *VAR_2) { QEMUSnapshotInfo *sn_tab, *sn; int VAR_3, VAR_4, VAR_5; VAR_5 = -ENOENT; VAR_3 = bdrv_snapshot_list(VAR_0, &sn_tab); if (VAR_3 < 0) return VAR_5; for(VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { sn = &sn_tab[VAR_4]; if (!strcmp(sn->id_str, VAR_2) || !strcmp(sn->VAR_2, VAR_2)) { *VAR_1 = *sn; VAR_5 = 0; break; } } g_free(sn_tab); return VAR_5; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QEMUSnapshotInfo *VAR_1,\nconst char *VAR_2)\n{", "QEMUSnapshotInfo *sn_tab, *sn;", "int VAR_3, VAR_4, VAR_5;", "VAR_5 = -ENOENT;", "VAR_3 = bdrv_snapshot_list(VAR_0, &sn_tab);", "if (VAR_3 < 0)\nreturn VAR_5;", "for(VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {", "sn = &sn_tab[VAR_4];", "if (!strcmp(sn->id_str, VAR_2) || !strcmp(sn->VAR_2, VAR_2)) {", "*VAR_1 = *sn;", "VAR_5 = 0;", "break;", "}", "}", "g_free(sn_tab);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
3,041
static int vfio_set_trigger_eventfd(VFIOINTp *intp, eventfd_user_side_handler_t handler) { VFIODevice *vbasedev = &intp->vdev->vbasedev; struct vfio_irq_set *irq_set; int argsz, ret; int32_t *pfd; argsz = sizeof(*irq_set) + sizeof(*pfd); irq_set = g_malloc0(argsz); irq_set->argsz = argsz; irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER; irq_set->index = intp->pin; irq_set->start = 0; irq_set->count = 1; pfd = (int32_t *)&irq_set->data; *pfd = event_notifier_get_fd(&intp->interrupt); qemu_set_fd_handler(*pfd, (IOHandler *)handler, NULL, intp); ret = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set); g_free(irq_set); if (ret < 0) { error_report("vfio: Failed to set trigger eventfd: %m"); qemu_set_fd_handler(*pfd, NULL, NULL, NULL); } return ret; }
false
qemu
a22313deca720e038ebc5805cf451b3a685d29ce
static int vfio_set_trigger_eventfd(VFIOINTp *intp, eventfd_user_side_handler_t handler) { VFIODevice *vbasedev = &intp->vdev->vbasedev; struct vfio_irq_set *irq_set; int argsz, ret; int32_t *pfd; argsz = sizeof(*irq_set) + sizeof(*pfd); irq_set = g_malloc0(argsz); irq_set->argsz = argsz; irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER; irq_set->index = intp->pin; irq_set->start = 0; irq_set->count = 1; pfd = (int32_t *)&irq_set->data; *pfd = event_notifier_get_fd(&intp->interrupt); qemu_set_fd_handler(*pfd, (IOHandler *)handler, NULL, intp); ret = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set); g_free(irq_set); if (ret < 0) { error_report("vfio: Failed to set trigger eventfd: %m"); qemu_set_fd_handler(*pfd, NULL, NULL, NULL); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(VFIOINTp *VAR_0, eventfd_user_side_handler_t VAR_1) { VFIODevice *vbasedev = &VAR_0->vdev->vbasedev; struct vfio_irq_set *VAR_2; int VAR_3, VAR_4; int32_t *pfd; VAR_3 = sizeof(*VAR_2) + sizeof(*pfd); VAR_2 = g_malloc0(VAR_3); VAR_2->VAR_3 = VAR_3; VAR_2->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER; VAR_2->index = VAR_0->pin; VAR_2->start = 0; VAR_2->count = 1; pfd = (int32_t *)&VAR_2->data; *pfd = event_notifier_get_fd(&VAR_0->interrupt); qemu_set_fd_handler(*pfd, (IOHandler *)VAR_1, NULL, VAR_0); VAR_4 = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, VAR_2); g_free(VAR_2); if (VAR_4 < 0) { error_report("vfio: Failed to set trigger eventfd: %m"); qemu_set_fd_handler(*pfd, NULL, NULL, NULL); } return VAR_4; }
[ "static int FUNC_0(VFIOINTp *VAR_0,\neventfd_user_side_handler_t VAR_1)\n{", "VFIODevice *vbasedev = &VAR_0->vdev->vbasedev;", "struct vfio_irq_set *VAR_2;", "int VAR_3, VAR_4;", "int32_t *pfd;", "VAR_3 = sizeof(*VAR_2) + sizeof(*pfd);", "VAR_2 = g_malloc0(VAR_3);", "VAR_2->VAR_3 = VAR_3;", "VAR_2->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER;", "VAR_2->index = VAR_0->pin;", "VAR_2->start = 0;", "VAR_2->count = 1;", "pfd = (int32_t *)&VAR_2->data;", "*pfd = event_notifier_get_fd(&VAR_0->interrupt);", "qemu_set_fd_handler(*pfd, (IOHandler *)VAR_1, NULL, VAR_0);", "VAR_4 = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, VAR_2);", "g_free(VAR_2);", "if (VAR_4 < 0) {", "error_report(\"vfio: Failed to set trigger eventfd: %m\");", "qemu_set_fd_handler(*pfd, NULL, NULL, NULL);", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
3,042
static int audio_attach_capture (HWVoiceOut *hw) { AudioState *s = &glob_audio_state; CaptureVoiceOut *cap; audio_detach_capture (hw); for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { SWVoiceCap *sc; SWVoiceOut *sw; HWVoiceOut *hw_cap = &cap->hw; sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); if (!sc) { dolog ("Could not allocate soft capture voice (%zu bytes)\n", sizeof (*sc)); return -1; } sc->cap = cap; sw = &sc->sw; sw->hw = hw_cap; sw->info = hw->info; sw->empty = 1; sw->active = hw->enabled; sw->conv = noop_conv; sw->ratio = ((int64_t) hw_cap->info.freq << 32) / sw->info.freq; sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq); if (!sw->rate) { dolog ("Could not start rate conversion for `%s'\n", SW_NAME (sw)); qemu_free (sw); return -1; } LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); LIST_INSERT_HEAD (&hw->cap_head, sc, entries); #ifdef DEBUG_CAPTURE asprintf (&sw->name, "for %p %d,%d,%d", hw, sw->info.freq, sw->info.bits, sw->info.nchannels); dolog ("Added %s active = %d\n", sw->name, sw->active); #endif if (sw->active) { audio_capture_maybe_changed (cap, 1); } } return 0; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static int audio_attach_capture (HWVoiceOut *hw) { AudioState *s = &glob_audio_state; CaptureVoiceOut *cap; audio_detach_capture (hw); for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { SWVoiceCap *sc; SWVoiceOut *sw; HWVoiceOut *hw_cap = &cap->hw; sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); if (!sc) { dolog ("Could not allocate soft capture voice (%zu bytes)\n", sizeof (*sc)); return -1; } sc->cap = cap; sw = &sc->sw; sw->hw = hw_cap; sw->info = hw->info; sw->empty = 1; sw->active = hw->enabled; sw->conv = noop_conv; sw->ratio = ((int64_t) hw_cap->info.freq << 32) / sw->info.freq; sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq); if (!sw->rate) { dolog ("Could not start rate conversion for `%s'\n", SW_NAME (sw)); qemu_free (sw); return -1; } LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); LIST_INSERT_HEAD (&hw->cap_head, sc, entries); #ifdef DEBUG_CAPTURE asprintf (&sw->name, "for %p %d,%d,%d", hw, sw->info.freq, sw->info.bits, sw->info.nchannels); dolog ("Added %s active = %d\n", sw->name, sw->active); #endif if (sw->active) { audio_capture_maybe_changed (cap, 1); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0 (HWVoiceOut *VAR_0) { AudioState *s = &glob_audio_state; CaptureVoiceOut *cap; audio_detach_capture (VAR_0); for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { SWVoiceCap *sc; SWVoiceOut *sw; HWVoiceOut *hw_cap = &cap->VAR_0; sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc)); if (!sc) { dolog ("Could not allocate soft capture voice (%zu bytes)\n", sizeof (*sc)); return -1; } sc->cap = cap; sw = &sc->sw; sw->VAR_0 = hw_cap; sw->info = VAR_0->info; sw->empty = 1; sw->active = VAR_0->enabled; sw->conv = noop_conv; sw->ratio = ((int64_t) hw_cap->info.freq << 32) / sw->info.freq; sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq); if (!sw->rate) { dolog ("Could not start rate conversion for `%s'\n", SW_NAME (sw)); qemu_free (sw); return -1; } LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); LIST_INSERT_HEAD (&VAR_0->cap_head, sc, entries); #ifdef DEBUG_CAPTURE asprintf (&sw->name, "for %p %d,%d,%d", VAR_0, sw->info.freq, sw->info.bits, sw->info.nchannels); dolog ("Added %s active = %d\n", sw->name, sw->active); #endif if (sw->active) { audio_capture_maybe_changed (cap, 1); } } return 0; }
[ "static int FUNC_0 (HWVoiceOut *VAR_0)\n{", "AudioState *s = &glob_audio_state;", "CaptureVoiceOut *cap;", "audio_detach_capture (VAR_0);", "for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) {", "SWVoiceCap *sc;", "SWVoiceOut *sw;", "HWVoiceOut *hw_cap = &cap->VAR_0;", "sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc));", "if (!sc) {", "dolog (\"Could not allocate soft capture voice (%zu bytes)\\n\",\nsizeof (*sc));", "return -1;", "}", "sc->cap = cap;", "sw = &sc->sw;", "sw->VAR_0 = hw_cap;", "sw->info = VAR_0->info;", "sw->empty = 1;", "sw->active = VAR_0->enabled;", "sw->conv = noop_conv;", "sw->ratio = ((int64_t) hw_cap->info.freq << 32) / sw->info.freq;", "sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq);", "if (!sw->rate) {", "dolog (\"Could not start rate conversion for `%s'\\n\", SW_NAME (sw));", "qemu_free (sw);", "return -1;", "}", "LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);", "LIST_INSERT_HEAD (&VAR_0->cap_head, sc, entries);", "#ifdef DEBUG_CAPTURE\nasprintf (&sw->name, \"for %p %d,%d,%d\",\nVAR_0, sw->info.freq, sw->info.bits, sw->info.nchannels);", "dolog (\"Added %s active = %d\\n\", sw->name, sw->active);", "#endif\nif (sw->active) {", "audio_capture_maybe_changed (cap, 1);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
3,043
static int ffserver_opt_preset(const char *arg, AVCodecContext *avctx, int type, enum AVCodecID *audio_id, enum AVCodecID *video_id) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; int ret = 0; AVCodec *codec = avcodec_find_encoder(avctx->codec_id); if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, codec ? codec->name : NULL))) { fprintf(stderr, "File for preset '%s' not found\n", arg); return 1; } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ret = 1; break; } if(!strcmp(tmp, "acodec")){ *audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); }else if(!strcmp(tmp, "vcodec")){ *video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); }else if(!strcmp(tmp, "scodec")){ /* opt_subtitle_codec(tmp2); */ }else if(ffserver_opt_default(tmp, tmp2, avctx, type) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ret = 1; break; } } fclose(f); return ret; }
false
FFmpeg
ed1f8915daf6b84a940463dfe83c7b970f82383d
static int ffserver_opt_preset(const char *arg, AVCodecContext *avctx, int type, enum AVCodecID *audio_id, enum AVCodecID *video_id) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; int ret = 0; AVCodec *codec = avcodec_find_encoder(avctx->codec_id); if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, codec ? codec->name : NULL))) { fprintf(stderr, "File for preset '%s' not found\n", arg); return 1; } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ret = 1; break; } if(!strcmp(tmp, "acodec")){ *audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); }else if(!strcmp(tmp, "vcodec")){ *video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); }else if(!strcmp(tmp, "scodec")){ }else if(ffserver_opt_default(tmp, tmp2, avctx, type) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ret = 1; break; } } fclose(f); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, AVCodecContext *VAR_1, int VAR_2, enum AVCodecID *VAR_3, enum AVCodecID *VAR_4) { FILE *f=NULL; char VAR_5[1000], VAR_6[1000], VAR_7[1000], VAR_8[1000]; int VAR_9 = 0; AVCodec *codec = avcodec_find_encoder(VAR_1->codec_id); if (!(f = get_preset_file(VAR_5, sizeof(VAR_5), VAR_0, 0, codec ? codec->name : NULL))) { fprintf(stderr, "File for preset '%s' not found\n", VAR_0); return 1; } while(!feof(f)){ int VAR_10= fscanf(f, "%999[^\n]\n", VAR_8) - 1; if(VAR_8[0] == '#' && !VAR_10) continue; VAR_10|= sscanf(VAR_8, "%999[^=]=%999[^\n]\n", VAR_6, VAR_7) - 2; if(VAR_10){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", VAR_5, VAR_8); VAR_9 = 1; break; } if(!strcmp(VAR_6, "acodec")){ *VAR_3 = opt_codec(VAR_7, AVMEDIA_TYPE_AUDIO); }else if(!strcmp(VAR_6, "vcodec")){ *VAR_4 = opt_codec(VAR_7, AVMEDIA_TYPE_VIDEO); }else if(!strcmp(VAR_6, "scodec")){ }else if(ffserver_opt_default(VAR_6, VAR_7, VAR_1, VAR_2) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", VAR_5, VAR_8, VAR_6, VAR_7); VAR_9 = 1; break; } } fclose(f); return VAR_9; }
[ "static int FUNC_0(const char *VAR_0,\nAVCodecContext *VAR_1, int VAR_2,\nenum AVCodecID *VAR_3, enum AVCodecID *VAR_4)\n{", "FILE *f=NULL;", "char VAR_5[1000], VAR_6[1000], VAR_7[1000], VAR_8[1000];", "int VAR_9 = 0;", "AVCodec *codec = avcodec_find_encoder(VAR_1->codec_id);", "if (!(f = get_preset_file(VAR_5, sizeof(VAR_5), VAR_0, 0,\ncodec ? codec->name : NULL))) {", "fprintf(stderr, \"File for preset '%s' not found\\n\", VAR_0);", "return 1;", "}", "while(!feof(f)){", "int VAR_10= fscanf(f, \"%999[^\\n]\\n\", VAR_8) - 1;", "if(VAR_8[0] == '#' && !VAR_10)\ncontinue;", "VAR_10|= sscanf(VAR_8, \"%999[^=]=%999[^\\n]\\n\", VAR_6, VAR_7) - 2;", "if(VAR_10){", "fprintf(stderr, \"%s: Invalid syntax: '%s'\\n\", VAR_5, VAR_8);", "VAR_9 = 1;", "break;", "}", "if(!strcmp(VAR_6, \"acodec\")){", "*VAR_3 = opt_codec(VAR_7, AVMEDIA_TYPE_AUDIO);", "}else if(!strcmp(VAR_6, \"vcodec\")){", "*VAR_4 = opt_codec(VAR_7, AVMEDIA_TYPE_VIDEO);", "}else if(!strcmp(VAR_6, \"scodec\")){", "}else if(ffserver_opt_default(VAR_6, VAR_7, VAR_1, VAR_2) < 0){", "fprintf(stderr, \"%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\\n\", VAR_5, VAR_8, VAR_6, VAR_7);", "VAR_9 = 1;", "break;", "}", "}", "fclose(f);", "return VAR_9;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ] ]
3,044
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, const char *boot_device, MachineState *machine, ISADevice *floppy, BusState *idebus0, BusState *idebus1, ISADevice *s) { int val, nb, i; FDriveType fd_type[2] = { FDRIVE_DRV_NONE, FDRIVE_DRV_NONE }; static pc_cmos_init_late_arg arg; PCMachineState *pc_machine = PC_MACHINE(machine); /* various important CMOS locations needed by PC/Bochs bios */ /* memory size */ /* base memory (first MiB) */ val = MIN(ram_size / 1024, 640); rtc_set_memory(s, 0x15, val); rtc_set_memory(s, 0x16, val >> 8); /* extended memory (next 64MiB) */ if (ram_size > 1024 * 1024) { val = (ram_size - 1024 * 1024) / 1024; } else { val = 0; } if (val > 65535) val = 65535; rtc_set_memory(s, 0x17, val); rtc_set_memory(s, 0x18, val >> 8); rtc_set_memory(s, 0x30, val); rtc_set_memory(s, 0x31, val >> 8); /* memory between 16MiB and 4GiB */ if (ram_size > 16 * 1024 * 1024) { val = (ram_size - 16 * 1024 * 1024) / 65536; } else { val = 0; } if (val > 65535) val = 65535; rtc_set_memory(s, 0x34, val); rtc_set_memory(s, 0x35, val >> 8); /* memory above 4GiB */ val = above_4g_mem_size / 65536; rtc_set_memory(s, 0x5b, val); rtc_set_memory(s, 0x5c, val >> 8); rtc_set_memory(s, 0x5d, val >> 16); /* set the number of CPU */ rtc_set_memory(s, 0x5f, smp_cpus - 1); object_property_add_link(OBJECT(machine), "rtc_state", TYPE_ISA_DEVICE, (Object **)&pc_machine->rtc, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(machine), OBJECT(s), "rtc_state", &error_abort); if (set_boot_dev(s, boot_device)) { exit(1); } /* floppy type */ if (floppy) { for (i = 0; i < 2; i++) { fd_type[i] = isa_fdc_get_drive_type(floppy, i); } } val = (cmos_get_fd_drive_type(fd_type[0]) << 4) | cmos_get_fd_drive_type(fd_type[1]); rtc_set_memory(s, 0x10, val); val = 0; nb = 0; if (fd_type[0] < FDRIVE_DRV_NONE) { nb++; } if (fd_type[1] < FDRIVE_DRV_NONE) { nb++; } switch (nb) { case 0: break; case 1: val |= 0x01; /* 1 drive, ready for boot */ break; case 2: val |= 0x41; /* 2 drives, ready for boot */ break; } val |= 0x02; /* FPU is there */ val |= 0x04; /* PS/2 mouse installed */ rtc_set_memory(s, REG_EQUIPMENT_BYTE, val); /* hard drives */ arg.rtc_state = s; arg.idebus[0] = idebus0; arg.idebus[1] = idebus1; qemu_register_reset(pc_cmos_init_late, &arg); }
false
qemu
ddcd55316fb2851e144e719171621ad2816487dc
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, const char *boot_device, MachineState *machine, ISADevice *floppy, BusState *idebus0, BusState *idebus1, ISADevice *s) { int val, nb, i; FDriveType fd_type[2] = { FDRIVE_DRV_NONE, FDRIVE_DRV_NONE }; static pc_cmos_init_late_arg arg; PCMachineState *pc_machine = PC_MACHINE(machine); val = MIN(ram_size / 1024, 640); rtc_set_memory(s, 0x15, val); rtc_set_memory(s, 0x16, val >> 8); if (ram_size > 1024 * 1024) { val = (ram_size - 1024 * 1024) / 1024; } else { val = 0; } if (val > 65535) val = 65535; rtc_set_memory(s, 0x17, val); rtc_set_memory(s, 0x18, val >> 8); rtc_set_memory(s, 0x30, val); rtc_set_memory(s, 0x31, val >> 8); if (ram_size > 16 * 1024 * 1024) { val = (ram_size - 16 * 1024 * 1024) / 65536; } else { val = 0; } if (val > 65535) val = 65535; rtc_set_memory(s, 0x34, val); rtc_set_memory(s, 0x35, val >> 8); val = above_4g_mem_size / 65536; rtc_set_memory(s, 0x5b, val); rtc_set_memory(s, 0x5c, val >> 8); rtc_set_memory(s, 0x5d, val >> 16); rtc_set_memory(s, 0x5f, smp_cpus - 1); object_property_add_link(OBJECT(machine), "rtc_state", TYPE_ISA_DEVICE, (Object **)&pc_machine->rtc, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(machine), OBJECT(s), "rtc_state", &error_abort); if (set_boot_dev(s, boot_device)) { exit(1); } if (floppy) { for (i = 0; i < 2; i++) { fd_type[i] = isa_fdc_get_drive_type(floppy, i); } } val = (cmos_get_fd_drive_type(fd_type[0]) << 4) | cmos_get_fd_drive_type(fd_type[1]); rtc_set_memory(s, 0x10, val); val = 0; nb = 0; if (fd_type[0] < FDRIVE_DRV_NONE) { nb++; } if (fd_type[1] < FDRIVE_DRV_NONE) { nb++; } switch (nb) { case 0: break; case 1: val |= 0x01; break; case 2: val |= 0x41; break; } val |= 0x02; val |= 0x04; rtc_set_memory(s, REG_EQUIPMENT_BYTE, val); arg.rtc_state = s; arg.idebus[0] = idebus0; arg.idebus[1] = idebus1; qemu_register_reset(pc_cmos_init_late, &arg); }
{ "code": [], "line_no": [] }
void FUNC_0(ram_addr_t VAR_0, ram_addr_t VAR_1, const char *VAR_2, MachineState *VAR_3, ISADevice *VAR_4, BusState *VAR_5, BusState *VAR_6, ISADevice *VAR_7) { int VAR_8, VAR_9, VAR_10; FDriveType fd_type[2] = { FDRIVE_DRV_NONE, FDRIVE_DRV_NONE }; static pc_cmos_init_late_arg VAR_11; PCMachineState *pc_machine = PC_MACHINE(VAR_3); VAR_8 = MIN(VAR_0 / 1024, 640); rtc_set_memory(VAR_7, 0x15, VAR_8); rtc_set_memory(VAR_7, 0x16, VAR_8 >> 8); if (VAR_0 > 1024 * 1024) { VAR_8 = (VAR_0 - 1024 * 1024) / 1024; } else { VAR_8 = 0; } if (VAR_8 > 65535) VAR_8 = 65535; rtc_set_memory(VAR_7, 0x17, VAR_8); rtc_set_memory(VAR_7, 0x18, VAR_8 >> 8); rtc_set_memory(VAR_7, 0x30, VAR_8); rtc_set_memory(VAR_7, 0x31, VAR_8 >> 8); if (VAR_0 > 16 * 1024 * 1024) { VAR_8 = (VAR_0 - 16 * 1024 * 1024) / 65536; } else { VAR_8 = 0; } if (VAR_8 > 65535) VAR_8 = 65535; rtc_set_memory(VAR_7, 0x34, VAR_8); rtc_set_memory(VAR_7, 0x35, VAR_8 >> 8); VAR_8 = VAR_1 / 65536; rtc_set_memory(VAR_7, 0x5b, VAR_8); rtc_set_memory(VAR_7, 0x5c, VAR_8 >> 8); rtc_set_memory(VAR_7, 0x5d, VAR_8 >> 16); rtc_set_memory(VAR_7, 0x5f, smp_cpus - 1); object_property_add_link(OBJECT(VAR_3), "rtc_state", TYPE_ISA_DEVICE, (Object **)&pc_machine->rtc, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(VAR_3), OBJECT(VAR_7), "rtc_state", &error_abort); if (set_boot_dev(VAR_7, VAR_2)) { exit(1); } if (VAR_4) { for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { fd_type[VAR_10] = isa_fdc_get_drive_type(VAR_4, VAR_10); } } VAR_8 = (cmos_get_fd_drive_type(fd_type[0]) << 4) | cmos_get_fd_drive_type(fd_type[1]); rtc_set_memory(VAR_7, 0x10, VAR_8); VAR_8 = 0; VAR_9 = 0; if (fd_type[0] < FDRIVE_DRV_NONE) { VAR_9++; } if (fd_type[1] < FDRIVE_DRV_NONE) { VAR_9++; } switch (VAR_9) { case 0: break; case 1: VAR_8 |= 0x01; break; case 2: VAR_8 |= 0x41; break; } VAR_8 |= 0x02; VAR_8 |= 0x04; rtc_set_memory(VAR_7, REG_EQUIPMENT_BYTE, VAR_8); VAR_11.rtc_state = VAR_7; VAR_11.idebus[0] = VAR_5; VAR_11.idebus[1] = VAR_6; qemu_register_reset(pc_cmos_init_late, &VAR_11); }
[ "void FUNC_0(ram_addr_t VAR_0, ram_addr_t VAR_1,\nconst char *VAR_2, MachineState *VAR_3,\nISADevice *VAR_4, BusState *VAR_5, BusState *VAR_6,\nISADevice *VAR_7)\n{", "int VAR_8, VAR_9, VAR_10;", "FDriveType fd_type[2] = { FDRIVE_DRV_NONE, FDRIVE_DRV_NONE };", "static pc_cmos_init_late_arg VAR_11;", "PCMachineState *pc_machine = PC_MACHINE(VAR_3);", "VAR_8 = MIN(VAR_0 / 1024, 640);", "rtc_set_memory(VAR_7, 0x15, VAR_8);", "rtc_set_memory(VAR_7, 0x16, VAR_8 >> 8);", "if (VAR_0 > 1024 * 1024) {", "VAR_8 = (VAR_0 - 1024 * 1024) / 1024;", "} else {", "VAR_8 = 0;", "}", "if (VAR_8 > 65535)\nVAR_8 = 65535;", "rtc_set_memory(VAR_7, 0x17, VAR_8);", "rtc_set_memory(VAR_7, 0x18, VAR_8 >> 8);", "rtc_set_memory(VAR_7, 0x30, VAR_8);", "rtc_set_memory(VAR_7, 0x31, VAR_8 >> 8);", "if (VAR_0 > 16 * 1024 * 1024) {", "VAR_8 = (VAR_0 - 16 * 1024 * 1024) / 65536;", "} else {", "VAR_8 = 0;", "}", "if (VAR_8 > 65535)\nVAR_8 = 65535;", "rtc_set_memory(VAR_7, 0x34, VAR_8);", "rtc_set_memory(VAR_7, 0x35, VAR_8 >> 8);", "VAR_8 = VAR_1 / 65536;", "rtc_set_memory(VAR_7, 0x5b, VAR_8);", "rtc_set_memory(VAR_7, 0x5c, VAR_8 >> 8);", "rtc_set_memory(VAR_7, 0x5d, VAR_8 >> 16);", "rtc_set_memory(VAR_7, 0x5f, smp_cpus - 1);", "object_property_add_link(OBJECT(VAR_3), \"rtc_state\",\nTYPE_ISA_DEVICE,\n(Object **)&pc_machine->rtc,\nobject_property_allow_set_link,\nOBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);", "object_property_set_link(OBJECT(VAR_3), OBJECT(VAR_7),\n\"rtc_state\", &error_abort);", "if (set_boot_dev(VAR_7, VAR_2)) {", "exit(1);", "}", "if (VAR_4) {", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "fd_type[VAR_10] = isa_fdc_get_drive_type(VAR_4, VAR_10);", "}", "}", "VAR_8 = (cmos_get_fd_drive_type(fd_type[0]) << 4) |\ncmos_get_fd_drive_type(fd_type[1]);", "rtc_set_memory(VAR_7, 0x10, VAR_8);", "VAR_8 = 0;", "VAR_9 = 0;", "if (fd_type[0] < FDRIVE_DRV_NONE) {", "VAR_9++;", "}", "if (fd_type[1] < FDRIVE_DRV_NONE) {", "VAR_9++;", "}", "switch (VAR_9) {", "case 0:\nbreak;", "case 1:\nVAR_8 |= 0x01;", "break;", "case 2:\nVAR_8 |= 0x41;", "break;", "}", "VAR_8 |= 0x02;", "VAR_8 |= 0x04;", "rtc_set_memory(VAR_7, REG_EQUIPMENT_BYTE, VAR_8);", "VAR_11.rtc_state = VAR_7;", "VAR_11.idebus[0] = VAR_5;", "VAR_11.idebus[1] = VAR_6;", "qemu_register_reset(pc_cmos_init_late, &VAR_11);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 97, 99, 101, 103, 105 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ] ]