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
29
30
31
32
#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();
asm(
"movl $1, %eax \n"
"movl $0, %ebx \n"
"movl $8192, %ecx \n"
"movl $123456789, %edx \n"
"1: cmp %ecx, %eax \n"
"jl 2f \n"
"leal (%eax,%eax, 2), %eax \n"
"jmp 3f \n"
"2: leal (%eax,%eax, 1), %eax \n"
"3: addl $1, %ebx \n"
"cmp %edx, %ebx \n"
"jl 1b"
);
end = clock();
sum_time += ((double)(end - start))/CLOCKS_PER_SEC;
}
printf("%f\n", sum_time / 10);
return 0;
}