include stdio include time int main int argc char const argv int doubl

 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
#include <stdio.h>
#include <time.h>
int main(int argc, char const *argv[])
{
int j = 0;
double sum_time = 0;
for (; j < 10; j++) {
clock_t start, end;
start = clock();
int i = 0, a=1, val=8192, stop = 123456789;
for (; i < stop; i++)
asm(
"cmp $8192, %1\n\t"
"jl 1f\n\t"
"leal (%1,%1, 2), %0\n\t"
"1: leal (%1,%1, 1), %0\n\t"
:"=d"(a)
:"d"(a)
);
end = clock();
sum_time += ((double)(end - start))/CLOCKS_PER_SEC;
}
printf("%f\n", sum_time / 10);
return 0;
}